Qt4.6 Example: Game of Life

As there was occasional downtime at work, I used that time to teach myself the simply wonderful Qt framework. With kind permission of SonyEricsson Mobile Communications I am allowed to release the source.

Here’s a simple Game of Life simulator program implemented in Qt. Download source.

Some example world configurations (use File/Open): example.gol, slurp2.gol, trash.gol and turbine.gol.

Features

  • Toroidal 2-dimensional Conway’s Game of Life
  • Moore and von Neumann neighbourhoods
  • Trails mode (UI bling)
  • Load and save world (XML)
  • Edit mode – draw your own pattern
  • Different colours e.g. invert mode
  • Save image
  • Import world from 80×50 black and white PNG image
  • Settings menu

Build it

Qt 4.6 is needed.

Unpack, then go to the folder and:

qmake
make

Then run the resulting GameOfLife binary.

It’s been tested under Symbian 9.4, Windows and Linux. Works OK, although in Symbian some of the file dialogs were laid out funnily, it ran “mostly OK” anyway.

Note: The doc/ folder contains an UML diagram of the design/structure. It’s not really anything fancy, but in case you’re wondering about why something is the way it is, it’s probably good to check that first.

License

This source code is placed into public domain. Feel free to use it for learning, poke it and see what happens, change it, extend it, etc. Developing it helped my understanding of Qt, maybe it’ll do the same for you. Have fun!

If you do anything interesting with it, please drop a comment with a link!

Swedish e-Legitimation, Part II – “The Signing”

You’ve perhaps read part I and tried it. Everything works until the moment when you need to electronically sign a document. The web browser barfs an error message, you cannot sign anything.

The good news is that this is super simple to fix.
(more…)

Swedish e-Legitimation, the Easy Way

Here are step-by-step instructions about how to get the Swedish e-Legitimation to work in Linux. The instructions are specifically for Nordea bank customers.

You need the “pocket calculator” cardreader (I used Todos NCR1), a suitable USB cable and a card with an EMV chip. If you have Nordea-issued bankkort or VISA you’re OK.

Note: These instructions are Debian-specific but they should work with other distros too with appropriate, slight changes.

Update: Signing will most likely be broken for you, but you can fix the signing too.

(more…)

Warm Prawn Soup for Subzero Temperature Days

When the weather gets cold, the tough whip up a warm soup.

This one is slightly thai-influenced in its taste, and extremely quick and simple to do.
(more…)

DIY Swine Flu Shot

To help keep the Andromeda strain swine flu away, you should take a swine flu shot.

Ingredients:

  • 4 cl of Red Opal (Icelandic salmiac-menthol vodka)
  • a squeeze of lemon juice
  • freshly ground black pepper

Enjoy!

Zenburn v2.13

Zenburn v2.13 is released!

Thanks to Zac Thompson and Christophe-Marie Duquesne, there is now:

  • Fix for invisible NonText-group
  • Various fixes and fine-tunings for Terminal and UI modes for Ignore-, NonText- and Error-groups.
  • Vimball installable version, see vim.sf.net.

Grab it from vim.sf.net or from the official Zenburn page.

Enjoy!

Zenburn v2.5

Zenburn v2.5 is released!

Changes: support for coloring Ignore-groups (thanks to John Gabriele). The Ignore-group coloring is toggleable, see the file for details.

Grab it from vim.sf.net or from the official Zenburn page.

In practice, the Vim help files will change from this (click pictures to show them bigger):

With pre-v2.5 Zenburn, Ignore-groups were not highlighted

to this:

With v2.5, Ignore-groups can also be highlighted

Zenburn for SciTE v1.78

Gianfranco writes:

I send you an adaption of the zenburn colour scheme for SciTE v. 1.78. To install it on a Windows machine, just copy the *.properties files into the SciTE installation folder.

(more…)

Zenburn for EasyEclipse for Python 1.3.1

Abchernin has sent a step-by-step guide how to enable Zenburn colors into EasyEclipse for Python v1.3.1 – it should work with any Eclipse+pydev combination.
(more…)

Everyone Loves a SAT Solver

I needed DIMACS-format output from STP, so I hacked together a patch for it.

It works only against the SVN version of STP, but is trivial (although not automatic) to patch the latest non-SVN version also. To patch, cd to the STP folder, then use something like patch -R -p1 < stp_dimacs.patch

Then, use the "-o" switch to dump a DIMACS file to the current folder. Next, fire up your favorite SAT solver and profit...

Update: It seems the toDimacs call can create strange outputs. Be aware of bugs!