30. August 2014

SimulANT+ Scripting Interface CHM – Windows help does not display content

I was testing SimulANT+ software from www.thisisant.com. Application was working without problem, but document with API was not readable. Only index was visible, but no content.

The API documentation is stored in file SimilANT+ Scripting Interface.chm. The problem with CHM content is classical gotcha on Windows.

When you download ZIP with CHM then Windows will automatically mark this file as downloaded from Internet. You have to unblock content of file manually.


Other alternative is to use 7-zip or other extractor which does not keep this flag.

Note: SimulANT+ has Python API, hooray! :)

6. July 2014

Simple HTTP server in Python 3.x on specific port

One very cool feature of Python 3.x is instant web server. Type the following command on command line:

python -m http.server

The Python will start a simple web server serving content from the working directory at URL: http://localhost:8000.

It’s also possible to specify the port to open, simply add the port number as the next parameter:

python -m http.server 8080

The web server by default operates on all network interfaces. It’s possible to restrict which interface to bind by the following command:

python -m http.server -b 8080

This web server will be accessible only from

A similar command is also available for old Python 2.x:

python -m SimpleHTTPServer

22. March 2014

Kivy – buildozer android debug failed with libstdc++.so.6: cannot open shared object file

Kivy is awesome library for developing GUI applications in Python.

It’s possible to build same application for desktop, Android or iOS. It’s something like Cordova/PhoneGap for JavaScript.

I was following Kivy crash course 2: Building an android apk tutorial recorded by Alexander Taylor.

I was trying to build application on Linux Debian for Android:

buildozer android debug

Build failed with quite strange message:

[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] Found 1 AIDL files.
     [aidl] Compiling 1 AIDL files.
     [aidl] /home/georgik/.buildozer/android/platform/android-sdk-21/platform-tools/aidl: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory


assets/private.mp3: /home/georgik/idea/kivytest/.buildozer/android/app/sitecustomize.pyo
Traceback (most recent call last):
  File "build.py", line 431, in 
  File "build.py", line 346, in make_package
    subprocess.check_call([ANT, arg])
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ant', 'debug']' returned non-zero exit status 1

The reason of this problem is not so obvious.

My operating system is 64bit, but Android build system requires 32 bit version of stdc++ library.

Fix is very easy. Just install lib32stdc++6 package :-)

apt-get install lib32stdc++6

If build is still failing, because of other missing libraries, then you can use online Debian package search to find missing dependencies: https://www.debian.org/distrib/packages

Other missing 32bit libraries are often libz, libncurses5:

apt-get install lib32z1 lib32ncurses5

29. June 2013

True/False gotcha Python vs Ruby vs PowerShell vs NodeJS vs PHP

Evaluation of conditions is very important part programming. True is ture, false is false…

Or not? It might surprise you, but not all languages evaluate numbers, empty strings or empty arrays in the same way.

Let’s examine several technologies. Python, Ruby, PowerShell, NodeJS and PHP.

Here is small code written in Python:

def test(value):
    if value:
        print "True"
        print "False"


Here is similar code written in Ruby:

def test(value)
    if value
        print "True"
        print "False"


Let’s compare it to PowerShell:

Function Test($value) {
    if ($value) {
        Write-Host "True"
    } else {
        Write-Host "False"


Same logic in JavaScript for NodeJS:

function test(value) {
    if (value) {
    } else {


Code in PHP:

function test($value) {
    if ($value) {
        echo "True";
    } else {
        echo "False";


Results are little bit surprising:


Python Ruby PowerShell NodeJS PHP
0 False True False  False False
1 True True True True True
“” False True False False False
[] False True True  True False
{} False True True  True False

26. May 2013

How to activate Python virtual environment in PowerShell

It’s quite easy to set up virtual a environment with isolated packages for Python in PowerShell. There are several methods

Method 1. Pipenv

This is the youngest and most convenient method. Pipenv automatically manages the environment and can create virtualenv based on the working directory. Files with virtualenv are stored in a separate directory and the user does not need to worry about them.

Install pipenv package:

python3 -m pip install pipenv

Enter the directory where you’d like to work and type:

pipenv shell

Pipenv will bootstrap and activate the environment. It will launch subshell. If you’d like to leave the environment simply close the shell by command:


Method 2. Using embedded venv

Python 3 contains package venv. It’s often confused with virtualenv which is a standalone package to manage virtual environments. The advantage of the command is that you do not need to install additional packages. Just create a virtual environment in the directory like pyenv:

python3 -m pyenv 

Activate the environment:


To deactivate the environment simply call:


Method 3. Good old virtualenv

Creating a virtual environment with virtualenv is an old method. You need to create a directory that will contain the virtual environment and then activate it. virtualenv is not part of the default Python package, it’s necessary to install it:

python3 -m pip install virtualenv

Now it’s possible to create a new virtualenv in a directory like pyenv by the following command:

virtualenv pyenv

The last step is to activate this environment in PowerShell :


You should see the name of your virtual environment in the command line. The virtual environment is active.

To deactivate the environment simply call: