Shoreditch

Shoreditch

Shoreditch is a happy mix of cozy quarters and urban environment. It's just not for families. The streets are narrow and very busy. During weekends a good deal of the area turns into a large street market. (Actually three.)

The vicinity of City makes Shoreditch a very attractive choice for single young professionals. Street food is everywhere and the local restaurants appear to be pretty top-notch. There is also some minor air of bohemia, meaning that well-to-do artists would probably find the region to their taste.

The closest thing I can think of what Shoreditch resembles is, even to my own suprise, the romanticised Brooklyn as shown in TV series from turn of the millennium.

Brick Lane alone is worth a weekend visit.

Earl's Court

Earl's Court

People say that nobody lives in London anymore, because it's too crowded. Apparently Earl's Court can still support some amount of human life, so maybe we can entertain the idea that it might not be in London after all.

The streets are busy. And while there are green spaces, they seem to be strictly private and thus limited for denizens of the nearby houses. Not a place for the family.

On the other hand, once off the largest roads the place did have an oddly familiar vibe. The region feels like an upscale version of the centrum side Eira in Helsinki.

(And that's saying something.)

Soho

Soho

No, Soho is most definitely not a a place for families to live in. It is ... different. Walking around it, the closest match is probably downtown Helsinki on a slightly cool early summer day, before the holiday season has had the opportunity to kick in.

If you look at a map of London, you'll see that Soho is a relatively small region just north of Trafalgar Square and Piccadilly Circus, both notorious tourist sites. The kinds of tourists who would visit Soho, on the other hand, would likely find the Square and the Circus somewhat oppressive.

There are numerous theatres around Piccadilly, and some of the smaller ones have valiantly edged themselves towards the fringes of Soho. Whatever you may have heard about the district, you've probably been mislead to some extent. Yes, there are sex shops. Yes, there are private sex clubs. And yes, you may overhear a prostitute and a john discussing practical arrangements. In Soho, that's just another unremarkable event in a day.

But those same sex shops and clubs are probably the reason for Soho's continuing gravity. Rents in London are insane, and the price tags next to (or immediately nearby) major tourist attractions reflect this state of affairs. One reason is the simple fact that prime real estate encourages bidding wars, which in turn prices out all but the biggest brands.

Soho is just a couple of blocks north of Trafalgar Square, but it still sports a very healthy selection of small, individual restaurants. Just the kind of places you wouldn't expect to afford the rents so close to Piccadilly. This is where the character of Soho comes into play. The presence of sex shops, along with the prominence of the other PR-wise dubious characteristics ensure that the major brands will keep their distance.

The biggest, most expensive brands in the world simply will not want themselves associated, even by accident, with the seedy side of Soho.

Cue the small restaurants. And the foodies.

(The sex shops are pretty classy establishments, too, by the way.)

Putney

Putney

Putney is a large area, and to that end its various regions have their individual characteristics. East Putney certainly does.

(North-)East Putney

While there are a couple of fairly nice looking schools and daycares, the overall feeling was maybe bit too "squeezed-in". It was as if the area was originally planned for a good deal less people, and nowadays there wasn't much room for anything else.

The place had a slight feel of Kouvola or Pajamäki to it.

Just a bit further down south the situation was quite different.

Putney Heath and Putney Village

Coming down from East Putney, and once over the busy Kingston Road, the landscacpe changes. Putney Heath feels like it is a slightly older suburb, gently fitted in between the green spaces nobody at the time had the heart to tear up.

People are a nice mix of families and gentry. And with so many parks to choose from, many of the residents appear to have dogs. Friendly ones. Going for a whiff of a stranger is seen as a perfectly normal thing to do.

Closest match to a Finnish place would be, perhaps, Ruoholahti. Not the high-tech hub - the living grounds.

Another sprint down south brings us to ...

Putney Commons and Wimbledon

A place known of, and used for, sports. Of course there's lots of green. A good deal of it open.

Very much like Tali in Helsinki, to be honest.

As for living in, the place certainly had a nice and somehow "wider" feel to it. Personally I wouldn't mind living there, but for a family it might be a bit edgy. Brief walk through the area didn't let me see a single school, and overall the place would probably be a better fit for grownups. During sports season one would expect there to be quite a lot of extra traffic and noise late into evenings.

Other than that, the living areas remind me of Paloheinä.

Graphite - No Such Thing as Overkill

No such thing as overkill

Pretty graphs, state-of-the-art backend system, easy deployment. Pick any two.

Graphite seems to be the current tool for taking care of heavy lifting, and of the three options, it has gone for first two. This is the story of making Graphite run on a Debian Sid system. To really add some gnarly twists, this is done with Lighttpd.

Some of the unexpected dependencies include Twisted (for graphite itself), and Django (for actually running Graphite).

Broken with Django 1.5 - investigation required. Upstream is aware, will be fixed eventually Fixed in Debian Unstable as #721085

Prepackaged

The Graphite stack is commonly available:

sudo apt-get install python-whisper graphite-carbon graphite-web

The tentacles...

Running Graphite with Postgres takes a few extra packages.

sudo apt-get install postgresql python-psycopg2 python-flup

Psycopg2 is a Postgres connector. Flup is required for FastCGI. And Postgres? Well, that's for Django.

Massaging Postgres into shape

Before we add any databases (for Django's benefit), there are a couple of changes we need to do:

New line in postgres's pg_ident.conf :

# MAPNAME SYSTEM-USERNAME PG-USERNAME graphs _graphite graphite

This creates a new internal account-name map "graphs", telling that system name "_graphite" will be treated as Postgres user/role "graphite".

Then, we change access control for domain-socket connections:

Changes in postgres's pg_hba.conf

# Locally mapped usernames in 'graphs' local all all ident map=graphs # "local" is for Unix domain socket connections only local all all ident

These changes mean that access control decisions are based on local identity (available to peers when connecting over domain socket), so these connections do not require passwords for database connections. We add the manually mapped account identification before the global default, so the map is checked first.

Restart Postgres.

No base without data

Let's create the database for our graph data.

sudo -u postgres createuser -D -R -S graphite sudo -u postgres createdb -O graphite graphite

This gives us the Postgres user/role "graphite" as the owner of database "graphite". Thanks to mapping above, we can now do this:

sudo -s su -l -s /bin/bash _graphite psql -d graphite graphite

So we can connect to the newly created graphite database as Postgres user "graphite", when our session user is "_graphite".

Configuring Graphite

The default configuration file /etc/graphite/settings.py corresponds to local_settings.py in Graphite documentation. However, the file provided in graphite-web packaging is from an older version. The database connection section in particular has changed. Instead of individual DATABASE_FOO tokens, the configuration section now allows multiple databases and has been changed into a dictionary. The options now reside in DATABASES['default'][FOO] - so the configuration for our setup looks like this:

DATABASES = { 'default': { 'NAME': 'graphite', 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'USER': 'graphite', 'PORT': 5432, } }

The connection port is not generally needed, since we're connecting over domain socket. However, the port number is also used by Psycopg2: the listening port number is included in the name of the Postgresql socket. In case of non-standard Postgres port, the number will be necessary.

While editing settings.py, we also drop RRD_DIR from DATA_DIRS. We simply don't have any RRD files around at the moment, and Graphite insists that all data directories must exist. Thus, removing the bogus directory prevents a runtime error.

At this point, Graphite should be able to connect to Postgres. We'll initialise the database.

_graphite% /usr/bin/graphite-manage syncdb

That takes care of the Django part. (Note that we did not create a Django project. Graphite IS a pre-packaged Django project, with its own manage.py wrapper. The file's just named differently and is placed in an unusual path.)

Connecting with FastCGI

We start by enabling FastCGI in Lighttpd. Individual modules are available in conf-available, and linked from conf-enabled just like with Apache.

/etc/lighttpd% ls -l conf-enabled/10-fastcgi.conf lrwxrwxrwx 1 root 33 Jan 21 14:47 conf-enabled/10-fastcgi.conf -> ../conf-available/10-fastcgi.conf

Then, we need to choose the path for our FastCGI domain socket. In my case, I added the following block to /etc/lighttpd/lighttpd.conf:

# Graphite setup; FCGI+Django+Twisted+Carbon+GraphiteWeb fastcgi.server = ( "/graphite" => ( "main" => ( "socket" => "/run/graphite/graphite.sock", "check-local" => "disable", ) ), )

The socket is the communication point between Lighttpd and Graphite. Since the socket is created by Graphite, we need to ensure that Lighttpd processes can use the socket. We add www-data user to _graphite group:

% grep -e www-data -e _graphite /etc/group www-data:x:33: _graphite:x:122:www-data

Now, finally, with only slight preparations we can run the entire stack.

As root/sudo-capable user:

sudo mkdir -m 775 /run/graphite sudo chown _graphite._graphite /run/graphite

And as _graphite:

/usr/bin/graphite-manage runfcgi socket=/run/graphite/graphite.sock pidfile=/run/graphite/graphite-fcgi.pid daemonize=true umask=002

A particularly fun fact is that socket permissions are only applied when running in daemonize=true mode.

Taking it out for a spin

From the FastCGI server setup in lighttpd.conf we know that all queries to the path /graphite are forwarded to Graphite engine. We can test that Graphite is working correctly by manually entering the following URL in browser:

http://YOURHOST/graphite/render?target=carbon.*.*.*

If everything is working as it should, we should see a single graph showing how the storage backend (carbon) has been using resources.

Stapling the stack together

Visualised the stack looks something like this:

Graphite stack with lighty+fastcgi

Pokerstats - Hold'em and Omaha Statistics

PokerStats - Hold'em and Omaha Statistics

PokerStats is a software for Linux (and probably other *nix variants) which allows you to track your play, as well as your opponents in Hold'em and Omaha cash games. It reads the hand histories generated by PokerStars client and creates statistics about players and their tendencies. A savvy player can use this information as an additional tool when making decisions.

Features

New/Hot Features

  • HUD - FPDB's Heads-Up Display ported to PokerStats
  • Omaha is now a supported game (currently only in git)

Shows the basic statistical information for players: VPIP, PFR, attempt to steal, continuation-bet frequency, 3bet/4bet frequency and so on.

  • Visualisation of your monetary progress with a graph
  • Statistics about individual hands
  • Player notes
  • Positional statistics
  • Filtering by dates and game level

Download

Latest release: pokerstats-0.3.99 (1.1 MB)

Git tree:

git://bostik.iki.fi/src/pokerstats.git

What does it do?

  • Basic functionality
  • Money graph
  • Most often needed stats
  • Hand reader and HUD in their separate processes for reliability
  • Simple set-o-meter

Requirements

  • Python
  • PostgreSQL
  • Python-Psycopg2
  • PyGTK2+
  • Python-matplotlib
  • Python-dbus
  • Python-libxml2
  • Python-wnck

License

GNU General Public License 3

You are free to use the software as you wish. You are free to learn from it. You can improve or modify it as you wish. You can redistribute it to anyone you want to. The only requirement is that if you pass the software to someone else, you need to provide them with your modifications and grant them the same privileges.

Known Problems

Every now and then the pot calculations are off. About once every 8000 hands a small blind is missed. Also, some shove-contests may end up being miscalculated. If you know which hand triggers this behaviour, please report it.

History

I wanted a poker statistics software that would run natively on my system. But more than that, I wanted to understand how they worked on the inside.

When I first started playing, the only client that would work neatly with WINE was PokerStars. So I took to that. Later on, when I decided to take poker seriously, I found out that there was a selection of very sophisticated statistics software written to help the players analyse their own, as well as their opponents' game.

At the time, the state-of-the-art software was Poker Tracker, which I tried to get working with WINE, without success. I only needed a very basic subset of all the features, so instead of installing another operating system for just casual poker playing, I decided to write my own statistics tool instead. How hard could it be?

And that's how it started.

Wayland for Kids

Educational Computing

What do you get if you combine Wayland, in-car minimonitor and Raspberry Pi? In my case, a perfect setup for our daughter who just loves computers.

Background

Our daughter has been infatuated with computers since before she could crawl. A physical keyboard which produces immediate effects on the screen is a particular favourite. Since it's impossible to draw the little lady away from computers, we might as well let her have one of her own.

The idea for this project was to build a simple computer we could let our daughter to play with, and which would automatically boot to a kiosk-like state. There were only a few requirements:

  • Cheap
  • Low power consumption
  • Movable around the house as needed
  • Easy to hack

The computer part was easy: Raspberry Pi fits all the specifications. If it breaks, replacement cost won't even exceed that of a few beers. I still wanted the setup to be simple, so any monitor I chose would have to have HDMI input and relatively small physical size. I found the answer in a rather unexpected place - small in-car monitors. They fit the physical specifications - and they come with HDMI inputs by default. In comparison, cheapest desktop monitors are heavier, way bigger, and tend to omit HDMI. (At least for the hardware available where I live.)

One thing still missing is the enclosure for RPi. It's a work-in-progress, made of a leftover piece of 3mm thick acrylic plate which cost next to nothing. The piece is also big enough to provide material for a dozen setups.

Construction

The setup looks and behaves like this:

? (Click image for video)

As a base, I used a thick(ish) piece of plywood.

The monitor's power adapter is literally strapped down with large zip ties. The keyboard and cables are set in their place with smaller ones and matching stick-on hooks.

For powering the RPi, I simply used a quality 1.2A/5V µUSB charger.

When the system starts, it boots directly into a native Wayland session. Instructions for building Wayland+Weston (reference compositor) can be read here, and followed with a just couple of tiny modifications.

  1. install autoconf, libpam0g-dev (+ vim-nox) in addition to other packages
  2. add --disable-documentation to wayland build configuration
  3. if necessary, rebuild cairo with --enable-glesv2
  4. build weston with --enable-weston-launch
  5. after weston install, change mode on weston-launch:

    -rwsr-xr-x 1 root root 37289 Jan 15 16:41 bin/weston-launch

Session startup scripts

For the automatic session launch, I use a few simple scripts.

** Wayland Environment: **

pi@raspberrypi ~ $ cat wayland-env-setup.sh #!/bin/sh export WLD="$HOME/local" export PATH="$WLD/bin:$PATH" export LD_LIBRARY_PATH="$WLD/lib:/opt/vc/lib" export PKG_CONFIG_PATH="$WLD/lib/pkgconfig:$WLD/share/pkgconfig" export ACLOCAL="aclocal -I $WLD/share/aclocal" export XDG_RUNTIME_DIR="/run/shm/wayland" export XDG_CONFIG_HOME="$WLD/etc" if [ ! -d $WLD/share/aclocal ]; then mkdir -p $WLD/share/aclocal fi if [ ! -d $XDG_RUNTIME_DIR ]; then mkdir -p $XDG_RUNTIME_DIR fi chmod 700 $XDG_RUNTIME_DIR chown pi.pi $XDG_RUNTIME_DIR

** Weston Compositor Launch **

pi@raspberrypi ~ $ cat W #!/bin/bash source ${HOME}/wayland-env-setup.sh exec weston-launch -- --max-planes=0 --idle-time=99999

** Terminal Launch **

pi@raspberrypi ~ $ cat T #!/bin/bash source ${HOME}/wayland-env-setup.sh exec weston-terminal

** Modified /etc/rc.local **

pi@raspberrypi ~ $ cat /etc/rc.local #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi # Launch Weston as 'pi' if [ -e /home/pi/W ]; then su -l -c '/home/pi/W &' pi fi # Launch terminal inside weston session # but wait until the compositor is ready if [ -e /home/pi/T ]; then printf "Waiting for Weston session..\n" while true; do sleep 1 if [ -e /run/shm/wayland/wayland-0 ]; then break fi done printf "Socket found, compositor ready!\n" su -l -c '/home/pi/T &' pi fi exit 0

Known problems/oddities

The monitor supposedly has a native resolution of 800x480, but the EDID data does not expose this setting. Trying to force this resolution in /boot/config.txt results in black screen and no video output at all. The automatically chosen nearest-match resolution is larger than what the monitor supports, and so the desktop does not fit on screen.

The monitor has to be on when the RPi is booted. Apparently RPi only tries a HDMI handshake at boot time. (Fixed by hdmi_force_hotplug=1 in config.txt)

Disclosure

Some of the fascination for Wayland and car monitors comes from my place of work, Nomovok. Our dealings with bleeding-edge stuff and embedded systems have had an effect on me.

Pastakastike

Minimalistinen, herkullinen pastakastike

Arvioitu valmistusaika: 1h

Ainekset

  • 1kg tomaattipyreetä (2x500g)
  • Nippu basilikaa
  • Valkosipulia, 6-10 kynttä
  • Oliiviöljyä, reilu 1dl
  • Kuivaa chiliä
  • (Paistettua jauhelihaa)

Tarvikkeet

  • Normaalikokoinen kattila
  • Pieni kasari tai liemikattila
  • Tarttumaton paistinpannu

Valmistus

Kaada tomaattipyreet isompaan kattilaan ja laita pienelle lämmölle. Hämmennä vähän väliä, ettei pala pohjaan.

Riko valkosipulinkynnet painamalla niitä veitsen lappeella. Kaada oliiviöljy kasariin. Lisää basilikanlehdet, murskattu chili ja valkosipulit öljyyn. Keitä matalalla lämmöllä kunnes basilika on kuivaa ja valkosipulit kullanruskeita. Kaada siivilän läpi tomaattipyreen sekaan.

Hauduta ja hämmennä seosta kunnes öljy ei enää erotu. Tähän menee yleensä noin puoli tuntia.

Siivilään jääneet palat voi laittaa lautaselle naposteltavaksi.

Keitä pasta, mutta jätä se minuuttia tai kahta vajaaksi. Ota 2-3 kauhallista kastiketta paistinpannulle ja nostele yhden hengen pasta-annos sekaan. Jos käytät jauhelihaa, pistä kourallinen tai pari sekaan. Heittele annosta pannulla jotta se ilmaantuu ja saa kermaisemman koostumuksen.

Kaada lautaselle ja tarjoa.

Tramp - Tray MPD Client

Tramp - Tray Mpd Client

The primary function of a music player is to play audio files. mpd does just that, and Tramp is a minimalistic client with only the bare necessities needed to listen to music.

Features:

  • Tray icon
  • Playlist creation
  • Playlist selection
  • Seeking with mousewheel

Everything else is controlled with mpc by binding actions to multimedia keys.

Get the Source

There are no prebuilt binaries. Just grab the source:

git clone git://bostik.iki.fi/src/tramp.git

and build. The source tree contains required files to build into a debian/ubuntu package. Install the needed build dependencies and make your own package:

sudo aptitude install autotools-dev debhelper-dev libmpd-dev libgtk-3-dev fakeroot

dpkg-buildpackage -rfakeroot

The code, including comments, is just ~1600 lines of C.

Screenshots

Because tramp is a minimalistic client, there won't be much in way of screenshots. However, these are the things you're likely to see when using tramp:

Systray icon: ? ; Main window for playlist selection: ?

In addition, the current playlist is shown in tooltip.

Using Tramp

  • Left-clicking on tray icon pops up the window
  • Right-clicking on window hides it
  • Right-clicking on tray icon also hides window, if it's shown
  • Each scrollwheel click on main window seeks 15 seconds

Configuration Examples

When using tramp, controlling mpd is meant to be done with hardware keys. Practically all modern keyboards sport a variety of "multimedia keys" that may be bound to perform actions of all sorts.

My controls for mpd and audio, from fluxbox keybinding file look like this:

None XF86Forward :ExecCommand mpc next None XF86Back :ExecCommand mpc prev None XF86AudioPlay :ExecCommand mpc play None XF86AudioMute :ExecCommand mpc stop Mod1 XF86AudioPlay :ExecCommand mpc toggle None XF86AudioRaiseVolume :ExecCommand aumix -v +2 None XF86AudioLowerVolume :ExecCommand aumix -v -2

While the unmodified keys require no explanation, I have bound Alt+AudioPlay to "toggle", which really is just mpd's way of saying "Pause/Un-Pause".

BBQ-ribsit Bostikin tapaan

BBQ-ribsit Bostikin tapaan

Arvioitu valmistusaika: 6h

ribsit

Kastikeainekset

  • 500g purkki tomaattipyreetä
  • Pullo Worchestershire-kastiketta
  • Etikkaa, vajaa 1dl
  • Keltasipulia, paljon
  • 5-6 valkosipulinkynttä
  • Hunajaa, 2rkl (vaahterasiirappi ja palmuhunaja käyvät myös)
  • Chiliä maun mukaan
  • Tuoretta sitruunamehua
  • Suolaa
  • Tummaa rommia, noin 1dl
  • Cayenne-pippuria
  • Juustokuminan siemeniä

Muut tarvikkeet

  • Iso kattila
  • Kookas ja laakea astia

Valmistus

Jos chilit ovat kuivia, ne voi laittaa pieneen kattilaan jossa on noin 5dl vettä. Kuumenna kevyellä lämmöllä. Tarkoitus on nesteyttää chilit, ei keittää niitä. Älä heitä vettä pois.

Silppua keltasipulit mahdollisimman pieneksi ja kuullota pannulla pehmeiksi. Älä paista! Kaavi pehmenneet ja läpikuultavat sipulinpalat kattilaan.

Silppua tai murskaa valkosipulit ja sekoita sipuliin.

Leikkaa chileistä kannat pois ja pilko loput niin pieneksi kuin ikinä pystyt. Mikäli käytössä on yleiskone, leikkaamisen sijaan chilit voi myös käyttää pikaisesti soseuttimen kautta. Lisää chilihakkelus tai tahnamainen murska kattilaan.

Lisää kattilaan vajaa 5dl vettä. Jos nesteytit kuivachilejä, käytä siitä jäänyt vesi.

Jauha juustokuminan siemenet morttelissa ja lisää kattilaan.

Keitä sipuli-chili-seosta niin kauan että sipulit alkavat hajota nesteeseen. Tarkoituksena on suurustaa kastike pelkästään sipulin tärkkelyksellä. Lisää vettä tarpeen mukaan pienissä erissä jotta seos ei pala tai paakkuunnu.

Lisää kaikki loput aineet kattilaan ja pistä pienelle lämmölle. Sekoita usein ettei kastike pääse palamaan pohjaan.

Kastiketta keitellään kasaan niin kauan että se ei enää ole vetelää tai nestemäistä. Tähän kuluu helposti parikin tuntia, ja jos sen aikana näyttää siltä että kastike alkaa paksuuntua liiaksi, sekaan kannattaa lisätä tilkka vettä. Mitä pidempään kastike saa hautua, sen parempaa siitä tulee.

Kun kastike on mielestäsi valmis, ota se hellalta ja jätä hautumaan kannen alle. Älä laita kastiketta kylmään.

Ribsit

Ribsien valmistukseen tarvitaan iso kattila ja jokin kookas, puolisyvä astia. Hätätapauksessa syvä uunipelti ajaa asian. Iso metallinen paistivati on oikein hyvä.

Keitä ribsejä kattilassa 40-50 minuuttia, ja kuori lihasta irtoava vaahto päältä pois sitä mukaa kuin sitä kertyy. Siirrä kypsät ribsit puolisyvään astiaan. Peitä astia foliolla. Mikäli kaikki ribsit eivät mahdu kattilaan kerralla, tämän joutuu tekemään muutamassa palassa.

Kun kaikki ribsit ovat astiassa, kaada pieni osa valmistamaasi kastiketta lihojen päälle. Pyörittele ribsejä sen verran että mausteista kastiketta pääsee kaikille pinnoille. Laita folio takaisin päälle ja pistä lihat jääkaappiin vähintään 4 tunniksi.

Ota lihat jääkaapista. Kaada astian pohjalle vajonnut kastike takaisin huoneenlämmössä olevan sekaan.

Grillaus

Grillaa ribsejä noin 3 minuuttia per puoli, valellen niitä koko ajan kastikkeella. Nosta lautaselle ja tarjoile välittömästi.

Syödään sormin.