Summary of the A&T fair, 2016 edition

Here is the Affidabilità e Tecnologie (A&T) fair, 2016 edition (held in , Torino April 20-21 2016) summarized by three audiovisual documents:

  1. Robot drives train:
  2. Robot plays golf:
  3. Robot brews coffee:
Posted in Philosophy | Leave a comment

Bash on Windows 10

This week at Build 2016, the yearly developer-oriented conference, Microsoft announced that Windows 10 will be able to run Linux’s Bash shell, by executing the native Ubuntu binary as-is.

Don’t stop at the news headline though: this is not just about Linux Bash, the command shell and scripting language.
All Ubuntu user space commands can potentially work, including the apt package manager with which you can tap from the 60000+ software packages available in the Ubuntu repos.

More technical details are found in two blog posts by Dustin Kirkland, an Ubuntu employee that worked with Microsoft on the magic behind.

This is no virtualization / container technology. It is more about API emulation: Linux system calls get translated in real time into Win32 API calls. No need to recompile the binaries.


It’s an approach that resembles the POSIX subsystem that was part of Windows NT, whose latest (2004) denomination was “Subsystem for UNIX-based Applications” (SUA), deprecated with Windows 8 and Windows Server 2012 and completely removed in Windows 8.1 and Windows Server 2012 R2. I guess it its just a resurrection of this approach.

Even if this technology is aimed at developers, if you think about it, it has certain strategic implications.

On the Operating System competition landscape, this levels the field with Apple OS X, which already had Bash and several package managers (but not apt ! and the binaries had to be recompiled !). It is a praise to the outstanding technical excellence of the Debian Linux distribution, which lies at the foundation of Ubuntu. It lowers the attractiveness of Linux on the Desktop, as developers can run all their preferred tools from within Windows. It lowers the barriers against migrating to Windows services and solutions developed on Linux technologies and stacks (MAMP, LAMP …): not that this wasn’t possible before, but you had to depend on many more bits and pieces of uncertain trust-wordiness. Now it looks like a simpler and well supported path.

It obsoletes certain technologies designed for similar purposes such as Cygwin and MinGW. It also obsoletes the plethora of ad-hoc installers and Windows-specific binaries for tools such as ActivePerl, git, PostgreSQL, nginx, Ruby, Node.js et cetera.

Finally, on the Open Source / commercial software divide, it demonstrates once more (should there be any need for it) that business can benefit from Open Source: effective immediately, thousands of Open Source enthusiasts are working for the good of Microsoft, with no compensation.

ATM many questions are still open: when will this technology land on Windows Server (currently it requires to install an app from the Windows Store, which is not always possible) ? Will this be available on previous versions of Windows like Windows 7 and 8.1 ? Will this be integrated with system administration tasks such as installing / un-installing a service ?

Posted in Philosophy | Tagged | Leave a comment

Modeling a pipe with a large pressure drop

The Pipe model is a concentrated parameter model for pipes. The correlations it uses are applicable only for small pressure drops, i.e. less than 10% of the absolute inlet pressure. If the calculated pressure drop is larger than that, you’ll get a warning.

But what to do if you have a long pipe or a pipe with a large pressure drop ?

Pipes by Nigel Howe

Pipes by Nigel Howe

The solution is to use a MultiStage unit to put together a number of Pipe units in series, thereby effectively discretizing the unit.

Assume this is your flowsheet definition (in the constructor):

addUnit("Pipe", defaults.relay("DN300", "connection piping"));
// ...

addStream("StreamLiquid", defaults.relay("S03", "inlet flow"), "RX", "out", "DN300", "in");
addStream("StreamLiquid", defaults.relay("S04", "outlet flow"), "DN300", "out", "BD", "in");

and this is the pipe unit data (in the setup method):

Q("").set(300.0, "mm");
Q("DN300.s").set(5.0, "mm");
Q("DN300.L").set(2000.0, "m");
Q("DN300.h").set(0.0, "m");
Q("DN300.eps").set(0.0457, "mm");
Q("DN300.vhConcentrated").set(3.0 * 0.75);

(beware this is C++ code ! check a tutorial if you have no clue how process modeling in C++ is possible !)

So to discretize the Pipe unit you’d merely change the addUnit command creation to create a MultiStage unit (no need to change the addStream statements):

addUnit("MultiStage", defaults.relay("DN300", "connection piping")
  ("nStreams", 1)
  ("typeT", "Pipe")
  ("typeU", "StreamLiquid")
  ("nStage", 30));

The meaning of the options passed to the addUnit command and ultimately to the constructor of the MultiStage unit is:

  • nStreams: this is useful for more complex multi-stream arrangements, in this case each Pipe unit has just one inlet and one outlet so we set it to 1
  • typeT: the type of the unit operation model used for each “stage”
  • typeU: the type of the stream model which connects the “stages”.
  • nStage: the number of stages i.e. of discretization steps

The model setup becomes:

for (int j=0; j< I("DN300.nStage"); ++j) {
  std::string stage("DN300:S[" + std::to_string(j) + "]");
  at(stage).Q("de").set(300.0, "mm");
  at(stage).Q("s").set(5.0, "mm");
  at(stage).Q("L").set(2000.0 / static_cast<double>(I("DN300.nStage")), "m");
  at(stage).Q("h").set(0.0, "m");
  at(stage).Q("eps").set(0.0457, "mm");
  if (j == 0)
    at(stage).Q("vhConcentrated").set(3.0 * 0.75);

Here we iterate over all the “stages” and set de (external diameter), s (thickness), h (elevation) and eps (rugosity) to the same values as before on all discretization “stages”; the L (length) we divide by the number of “stages”; finally the vhConcentrated (velocity heads associated to the concentrated pressure drops) we place only once in the 1st “stage”.

Done !

Posted in C++, Chemeng | Leave a comment

Where is the SQL database plugin for ODBC (qsqlodbc.dll) in Qt 5.6 ?

It looks like the SQL database plugin for ODBC (qsqlodbc.dll) is missing from the standard Qt 5.6 installer for Windows you download from

You’d expect to find it in C:\Qt\Qt5.6.0\5.6\msvc2015_64\plugins\sqldrivers\ where the sqlite, mysql and postgresql ones are found, but the ODBC plugin is not there.

The issue is known (see QTBUG-49420 and QTBUG-51390) but these bug reports are closed and it seems there will be no fix on a short term.

So here is how you build qsqlodbc.dll from source for Windows 64-bit with Visual Studio 2015, based on the instructions “How to Build the ODBC Plugin on Windows”.

First get the source package from and unzip it in any location, for example C:\qt-everywhere-opensource-src-5.6.0.

Now open a “VS2015 x64 native tools command prompt”, CD to the location of the qt-everywhere-opensource-src-5.6.0 directory then:

cd qtbase\src\plugins\sqldrivers\odbc

At the end you’ll find the qsqlodbc.dll in C:\qt-everywhere-opensource-src-5.6.0\qtbase\plugins\sqldrivers alogside with qsqlodbcd.dll and qsqlodbcd.pdb.

Just copy these three files to the location where the Qt 5.6 installer for Windows should have put them
C:\Qt\Qt5.6.0\5.6\msvc2015_64\plugins\sqldrivers\ and you’ll be done !

Posted in C++, Howtos, Rants | 1 Comment

“api-ms-win-crt-runtime-l1-1-0.dll is missing” error with LIBPFonOPC on Windows Server 2012 R2 64 bit

You may receive the error “The program can’t start because api-ms-win-crt-runtime-l1-1-0.dll is missing” when launching the LIBPFonOPC configurator 1.0. 2264 on a fresh install of Windows Server 2012 R2 64 bit.

01Related symptom: this error silently appears in the Setup Log of the Event viewer during the installation of LIBPFonOPC:
Windows update could not be installed because of error 2149842967 "" (Command line: ""C:\Windows\SysNative\wusa.exe" "C:\ProgramData\Package Cache\3ACBF3890FC9C8A6F3D2155ECF106028E5F55164\packages\Patch\x64\Windows8.1-KB2999226-x64.msu" /quiet /norestart")


Here is a hint to the solution: “Excel can’t start because api-ms-win-crt-runtime-l1-1-0.dll is missing”.

So it turns out that the Visual C++ Redistributable for Visual Studio 2015 silently fails to install on a fresh install of Windows Server 2012 R2 64 bit … So just update the OS and reinstall the Visual C++ Redistributable for Visual Studio 2015 update 1 from here:

Posted in Howtos, Uncategorized | Leave a comment

HOWTO make verbosity level accessible for users

LIBPF’s  4 diagnostic levels allow the model developer to fine-tune the verbosity at a global, compilation, unit, function and class instance level. Of these, two (verbosityGlobal and verbosityInstance) are also available at run-time, but normally not for the model user.

If you want to make them accessible to the user, there are several options. Here I’ll show you how to do it using a couple of real-valued Quantities that can be directly manipulated in the user interface or via the LIBPF™ Model User API.

NOTE: we use Quantities rather than Integers because currently there is no way for the user to change integers at runtime; the user will have to enter an integer value such as 1, 2 or 100 for really high verbosity.

Se here we go:

  1. declare two custom variables in your model class:
    Quantity global; ///< global verbosity
    Quantity instance; ///< instance verbosity
  2. initialize them in the model class constructor initializer list:
    DEFINE(global, "global verbosity", 0.0, ""),
    DEFINE(instance, "instance verbosity", 0.0, ""),
  3. register them in the model class constructor body:
  4. make them user-modifiable in the setup method of the model class:
  5. use them at model calculation to increase /decrease the verbosityGlobal and verbosityInstance variables, by implementing the FlowSheet::pre and FlowSheet::post overrides of your model class:
    void MyModel::pre(SolutionMode solutionMode, int level) {
      verbosityGlobal += global.toDouble();
      verbosityInstance += instance.toDouble();
    void MyModel::post(SolutionMode solutionMode, int level) {
      verbosityGlobal -= global.toDouble();
      verbosityInstance -= instance.toDouble();
Posted in C++, Chemeng, Howtos | Tagged | Leave a comment

Qt Data Visualization preview

In the Qt Roadmap for 2016 they say “In addition, Qt 5.7 includes a lot of modules that have been previously available only with the commercially licensed Qt: … Qt Data Visualization – Versatile set of chart types for 3D visualization of data“.

This is interesting news: the Qt Data Visualization module provides a way to visualize data in 3D. What if we want to try it out now ? For example on Debian 8 which ships Qt 5.3.2 ?


1. get and build QDV:

cd /tmp
git clone git://
cd qtdatavis3d

(the build of the library succeeds, while some example fails; we’ll skip on that).

2. build the Surface Example:

cd examples/datavisualization/surface

3. To run it, we need to make it find the right dynamic libraries:

find ../../.. | grep

this is easy with (on 32-bit systems, use /lib/ rather than /lib64/

/lib64/ --library-path ../../../lib/. ./surface

Mandatory screen-shot:

Note: to rotate, press the RMB (right mouse button) and drag.

Posted in C++, Howtos | Tagged , | Leave a comment

RSS feed for EASME news

If you are looking for the RSS feed of the EASME news (the European Commission’s Executive Agency for Small and Medium-sized Enterprises), here it is:


For details how this works, see the related post RSS feed for AIChE ChEnected where we published scrapped the RSS feed of AIChE ChEnected (the online community of young professional chemical engineers hosted by the American Institute of Chemical Engineers)

Disclaimer: we do not alter in any way the contents of EASME news; we do not claim any rights on their content; we have no responsibility of their content; the service may break in the future; etc etc.

Posted in Chemeng | Leave a comment

A JSON-based file format for the exchange of thermo-physical model parameters

We present a proof-of-concept, JSON-based, vendor-independent file format for the exchange of thermo-physical model parameters. You can try it out in this browser-based demo tool.

We started from what is already avaiable: the IK-CAPE PPDX format, a vendor-independent file format for the exchange of thermo-physical property data and model parameters.

But although IK-CAPE PPDX was developed in 1997, it looks a lot like it’s still the 1970‘s:

sample IK-CAPE PPDX file

Its shortcomings are:

  1. It is a soup of data, thermo set-up and parameters; BTW for experimental data we now have ThermoML, an XML-based, IUPAC-backed standard;
  3. And it looks like it’s punched on a card: it is a text file, 80-columns wide, totally unstructured, write-your-own parser type of affair.

But then XML is so 2000-ish, so we propose to update IKC-PPDX adding a JSON format variant.

Also to make things tidier, we restrict it to the exchange of thermo-physical parameters, and we exclude data and thermo set-up.

Our proof-of-concept JSON-based file format divides the thermo-physical model parameters in four groups:

  1. Pure scalars, for pure component constant parameters
  2. Pure vectors, for pure component T and/or P dependent parameters
  3. Binary scalars, for binary constant parameters
  4. Binary vectors, for binary T and/or P dependent parameters

Here is the JSON schema.

And here is the simplest possible sample JSON file, with only one pure component scalar parameter:

  "components": [
      "cid": "H2O",
      "name": "water",
      "cas": "1-11-111",
      "formula": "H2O"
  "pure_scalar": [
      "name": "PC",
      "parameters": [
          "cid": "H2O",
          "value": 3800000

Get the JSON schema, the sample JSON files and the source code of the demo from the gitlab repo here.

Posted in Chemeng, Philosophy, Uncategorized | Tagged , | Leave a comment

Making images responsive in your wordpress theme

It’s fashionable nowadays to have responsive websites, consequently you also end up with responsive wordpress themes, like the one used in this blog.

In bootstrap 3 images can be made responsive-friendly via the addition of the img-responsive class.

If you want to make your images responsive in wordpress, add a functions.php file in the wp-contents/themes/your_theme directory as explained here, with this content:

function my_image_class_filter($classes) {
 return $classes . ' img-responsive';
add_filter('get_image_tag_class', 'my_image_class_filter');

(if you already have a functions.php file, add this code to the end – but beware the PHP sadness !)

The added code is using the wordpress add_filter function to hook the user-supplied my_image_class_filter function to filter the get_image_tag_class builtin function. The my_image_class_filter function appends the img-responsive class to the classes wordpress always adds to images.

For example if I add this very wide (1920px) image (courtesy, it should be responsive:

cats-q-c-1920-200-5Hoorrah ! Indeed it’s responsive.

But of course this only applies to images added from now on, not to the images already present in the blog !

To fix old posts, we had to dig into the wordpress database tables; normally it’s the wp_posts table you have to look for, in this case (it’s a multisite wordpress install) the table is wp_2_posts. You need console access to the server, and some practice with mysql, the The MySQL Command-Line Tool. Start mysql with:

mysql -u my_user -pmy_password my_database

where you’ll replace my_user, my_password and my_database with the actual values of the DB_USER, DB_PASSWORD and DB_NAME in your wp-config.php file.

Then use this query to show the contents of a given post:

select post_content from wp_2_posts where id=873;

and this one to make images responsive selectively just for that post:

update wp_2_posts
  set post_content = replace(post_content,' wp-image-', ' img-responsive wp-image-')
  where id=873;

If you feel bold, a more radical option is to use wp-cli with something like (untested !):

wp search-replace ' wp-image-' ' img-responsive wp-image-' wp_2_posts

good luck !

Posted in Howtos | Tagged | Leave a comment