Well, you know what they say: “You aren’t making a DSL tool if you haven’t
implemented Martin Fowler’s State
Machine language using your tool yet” ;)
This is a well known DSL example from his book Domain-Specific
Languages. If you are doing stuff
in the field of DSLs you should definitely read this book. There is an excerpt
from the book
available on-line so I advise you to read it before watching the video below.
In the video bellow I am explaining the implementation of the Martin Fowler’s
State Machine language in textX by:
Specifying the grammar of the language
Creating source code generator by generating a nice dot state charts
Creating model interpreter in Python
This tutorial is a good overview of textX workflow and capabilities but if you
want to see basic introduction together with installation and the first steps I
suggest you to watch video introduction to
Full source code presented in the video is available at the project GitHub
I hope you will enjoy watching this video as much I enjoyed playing with this
Today, while hacking on pyFlies I
run into trouble with the code generated for the
PsychoPy backend. PsychoPy is using
Pyo to generate sound. The problem
is that Pyo do not support
JACK. This might be a good choice since JACK is
better suited for low latency sound processing, but today most linux distro use
PulseAudio which is better suited for general desktops.
In order to use PsychoPy, first thing to do is to start JACK. Luckily,
there are nice GUI apps to do that easily, e.g.
cadence. Starting JACK
will suspend PulseAudio while JACK is runnning.
Now, we must instruct pyo called from PsychoPy to use JACK. Although,
there is audio parameter in Server call of pyo lib which could be used to
specify JACK as the backend, this would require changing source code of
PsychoPy. There is luckily a non-obtrusive way to achieve the same effect.
Just specify environment variable:
Now pyo lib will use JACK by default and the PsychoPy sound will work.
For my day-to-day coding (when I don’t code in Java ;) ) I use vim
editor and I like it a lot. It is arguably the tool of
trade that needs quite amount of time to learn properly but it is surely
rewarding. It has some amazing plugins and it is the editor that is installed
on your linux servers so knowing at least some basics is almost necessary if
you need to do some server administration.
For shell stuff I use zsh and great set of
If you haven’t try it yet, you don’t know what are you missing.
Terminator is my
terminal emulator of choice. It has some great features like:
Vertical and horizontal split (Ctrl+Shift+E, Ctrl+Shift+O)
Moving among splits (Alt+arrow)
Resizing splits (Ctrl+Shift+arrow)
Zooming split (Ctrl+X)
Increase/decrease font size (Ctrl-+, Ctrl–, Ctrl-0)
I usually open vim inside terminator which gives nice and easy spliting, moving
splits, running shell commands. Enviroment very much like those provided with
tiling window manager. This setup cuts mouse usage to zero during coding
sessions which is nice especially when working on laptop (and this is most of
Here is how it looks like.
To make this setup even more easy to use I did simple integration with Dolphin
file manager (KDE) to:
open directory with the terminator
open textual files with vim inside terminator.
To do first make a shell script terminator-open-dir with the following content:
Right click on a directory in Dolphin and go to Properties, choose File Type
Options and in the list of application in the lower part of dialog choose
Add and navigate to terminal-open-dir script. Make sure that script has
executable flag set.
After this you will be able to Open with... directory with terminator.
To open textual file with vim inside terminator make a shell script
terminator-vim with the following content:
terminator --working-directory="`dirname "$@"`" -x vim "$@"
Repeat the above procedure but this time by right clicking on the file you
would like to open with vim.
Here is another nice trick found
If you put this in your .vimrc
If you are experiencing a several seconds delay while opening files with Libre
Office (Open Office might be affected to) it might be the same issue I run into
It seems that during startup LO polls printers over CUPS
daemon. If there is a problem with
the network and configured printers are not reachable you will experience a
several seconds delay with each file open. This will not affect opening a file
in the already running instance of LO.