lauri.sokkelo.net The homepages of Lauri Kainulainen 2012-02-23T05:44:36+01:00 Lauri Kainulainen lauri(@)sokkelo.net tag:lauri_at_sokkelo,2011:http://lauri.sokkelo.net/kassi/atom.php Looking for new adventures - new layout, cv Looking for new adventures - new layout, cv 2011-11-15T12:55:26 2011-11-15T12:55:26

Recently it became obvious that Intgrlab, the software company we've been building since early spring, doesn't have any development work in the pipeline. Hence there is no work for me - the guy who hasn't bothered with the consulting side yet.

So I decided to start looking for new stuff! There's loads of interesting opportunities out there. For this I've finally sat down and updated this site (less clutter, contact section) to use as a portfolio and updated my CV to match my current skills. Check 'em out! Also if you happen to know anybody who needs a hardcore dev / designer.. drop me a line!


Want to convert simple SVG into JSON with Python? Want to convert simple SVG into JSON with Python? 2011-02-19T18:30:52 2011-02-19T18:30:52

Why on earth would you want to do that? My reason was that I needed to draw SVG in Processing.js. So I took a simple flat SVG with filled polygons and converted it to JSON, which then is drawn by PJS. Here's the Python JSON extraction snippet.


#!/usr/bin/python
''' 
    Convert a simple svg to a bunch of javascript
    arrays that can be drawn in code
    stdout get the json
    stderr print some information helpful in the js code
    
    @author Lauri Kainulainen - lauri.sokkelo.net
'''

import sys
from xml.dom import minidom
import simplejson

if len(sys.argv) < 2:
    print "usage:", __file__, "SVG_FILE"
    sys.exit(1)
d = minidom.parse(sys.argv[1])

points = []
minx, miny = 10000, 10000
maxx, maxy = 0, 0
amount_of_polys = 0
for c in d.childNodes[1].childNodes:
    if c.nodeName != '#text' and c.tagName == 'polygon':
        coords = c.attributes.get('points').value.split(" ")
        polygon_data = {}
        polygon_points = []
        for coord in coords:
            x, y = coord.split(',')
            x, y = float(x), float(y)
            minx = min(minx, x)
            miny = min(miny, y)
            maxx = max(maxx, x)
            maxy = max(maxy, y)
            polygon_points.append((x, y))
        polygon_data['points'] = polygon_points
        if c.attributes.get('fill'):
            val = c.attributes.get('fill').value
            if val.startswith('#'):
                r, g, b = int(val[1:3], 16), int(val[3:5], 16), int(val[5:], 16)
                polygon_data['fill'] = (r, g, b)
            else:
                polygon_data['fill'] = c.attributes.get('fill').value
        amount_of_polys += 1
        points.append(polygon_data)

print simplejson.dumps(points, indent=2)
sys.stderr.write('\n ~# Wicked SVG Statz: #~\n')
sys.stderr.write('  min X,Y: %s, %s\n' % (minx, miny))
sys.stderr.write('  max X,Y: %s, %s\n' % (maxx, maxy))
sys.stderr.write('  polygons: %s\n' % (amount_of_polys))
sys.stderr.write('\n')

Then you probably want it on the screen. We used the following processingjs snippet on Helsinki New Media Locomotive site for testing:



void setup()
{
    size(300,300);
    background(255);
    noLoop();
    strokeWeight(0.5);
}

void draw(){  
    var data = YOUR_OWN_DATA_ELEMENT; // make this point to your JSON structure
    for(int i = 0; i < data.length; i++) {
        var pd = data[i];
        fill(pd.fill[0], pd.fill[1], pd.fill[2]);
        beginShape();
        for(int ii = 0; ii < data[i].points.length; ii++) {
            var point = pd.points[ii];
            vertex(point[0], point[1]);
        }
        endShape(CLOSE);
    }
}

Atom feeds, new project and Disqus support Atom feeds, new project and Disqus support 2011-01-30T18:49:05 2011-01-30T18:49:05

Finally found the effort to move this site to the web 1.5 era by implementing an atom feed generator. Also threw in Disqus commenting to be all social and hip and stuff.

Projects got a new addition with Jorma the Skeleton. A small, fun project we did with Niko for Levykauppa Äx. And believe me - this is just the beginning for silly endeavours..


Yet Another Site Layout Yet Another Site Layout 2010-10-18T11:10:50 2010-10-18T11:10:50

I decided to redo my site ages ago but as design processes go, redesigning your own site is probably one of the most painful ones. I went from several layouts finally to this one (as usual the last one is the simplest) and I'm still not entirely happy.

I wanted to share all the fun projects I've been doing here at Medialab and give them more emphasis. At the same time I wanted to go to a one page layout to better support touchscreens in tablets and other mobile devices (and to stand out from the crowd a bit ;) )

I also had some processing.js animations working in the background, but disabled them for now as the html-canvas element still seems to be quite slow.

Maybe I'll still clear out some visual noise and include some simple graphics, but for now I'll leave it as it is.


Background Shuffler Background Shuffler 2010-06-07T08:57:52 2010-06-07T08:57:52

The need to code "something completely different" made me do Background Shuffler - a beautiful background changer for Gnome. I wanted to extend the UNIX philosophy to desktop applications so Background Shuffler only changes your background. It does not make coffee.

So I spent a few days hacking and with the help of great tools and libraries like Quickly and appindicator I managed to build this nifty little program that I'm using all the time now.

Features:

  • handle all through the indicator icon. No mysterious script running in the background, retain complete control over your desktop at all times
  • make the backgrounds change as quickly or slowly as you like
  • integrates with F-Spot, so search for certain tags or ratings
  • optionally specify a folder that will be searched with photos

But I guess screenshots explain a thousand words.


It runs in your indicator area! A more ubuntu-dark-stylish icon should added at some point.
It runs in your indicator area! A more ubuntu-dark-stylish icon should added at some point.

Preferences sum up the core of the application
Preferences sum up the core of the application

You'll probably be best running Ubuntu Lucid (10.04). To install the app just download the deb or add the ppa to your sources at: https://edge.launchpad.net/~luopio/+archive/ppa

Bugs, suggestions and patches welcome! Email at lauri(dot)kainulainen(at) gmail.com


Last week Last week 2010-03-22T23:36:33 2010-03-22T23:36:33

So the last post was from Chile. Weeks have passed since and we've seen more and more of Chile (avoiding the devastating earthquake by less than a day), and now we're in Buenos Aires. Argentina has been very nice. Iguazu falls were incredible although very touristy, as such places tend to be.

Just a few days left now. Around 9 months since I left Finland. Wonder if I'll suffer the biggest culture shock once I land in Vantaa.. not really looking forward to it much: it's >25 degrees here, yesterday rained (and they cancelled the Superclásico), but most days are sunny.

Buenos Aires is really nice. Almost as nice as DF in México (I'm biased of course). Having our own apartment in Palermo makes the experience even better and not really that much more expensive since we're three now that Eeva has joined us.


From Bolivia to Chile From Bolivia to Chile 2010-02-16T15:01:15 2010-02-16T15:01:15

A few days ago we passed the border from Bolivia to Chile. The change is quite remarkable: from one of the poorest to the most developed nation. Prices went up a lot and due to the high season here we're suffering difficulties finding accomodation.

Still some nice places here, like San Pedro de Atacama in the desert and La Serena where we are right now. Thankfully Argentina should be cheaper again :)


Traveling in south South America Traveling in south South America 2010-01-28T16:17:01 2010-01-28T16:17:01

Last three weeks were spent in Peru. Landed in Lima, continued to Huacachina to live on a desert oasis (sandboarding, dune buggy riding, etc.), proceeded to Cusco, where we spent 13 nights due to a need to wait for a trek from our chosen agency Lamapath.

Aino got a combination of different illnesses including salmonella which forced her to drop the trip, while I participated (no refunds, no other good dates).

When we finally got out of Cusco we headed out to lake Titicaca and visited the floating islands, stayed in a local family on an island, saw Puno and crossed the border to Copacabana. On the bus ride to the border we remembered that we left our money belts in the Puno hostel.. thankfully after some arranging with our bus company rep, we evaded the need to return to Peru and got the stuff via the company. The hostel didn't make it easy though as their phone was occupied 24/7, hence I do not recommend Qorikancha in Puno.

Now we're in La Paz and finally in front of a computer that has something better than internet explorer (which won't work with this blog). From here to the Jungle I guess.


Rain approaching on Isla Amantani on Lake Titicaca
Rain approaching on Isla Amantani on Lake Titicaca

And as an extra note, we missed the current crisis situation in Machu Picchu by a few days. The river did look quite scary already at that time. Aguas Calientes is a nice little place, but I wouldn't want to be stuck there...


Coastal Tour Coastal Tour 2010-01-03T22:35:05 2010-01-03T22:35:05

Returned yesterday from a tour on the Mexican south-southwest coast. Went through Zipolite-Mazunte-Puerto Escondido-Acapulco-Zihuatanejo in a bit under 2 weeks. Mazunte was the best, Acapulco the worst. No surprise there.

During the 9 hour busride the environment changed from the continuous 30 degree beach to plus 15 or so here in DF. And it's great! I can wear a sweater! And I'm not sweating all the time!

Tomorrow I'm out of Mexico... off to South America. Sad to leave the good ol MX behind, but on the other hand it'll be nice to find entirely new places.


Equalizer experimentation Equalizer experimentation 2009-12-06T02:18:29 2009-12-06T02:18:29

School is out so I have a bit more time on my hands now. I've been slacking in my own field as my time has been consumed by random mexican studies and other stuff. To make up for that I started experimenting with Equalizer, and today I managed to get a simple OpenGL-thing rolling.

See the video. It's dead simple and currently running on my Asus eee 1000HE (hence the slowness!), but it could easily be running on 4 separate computers connected to projectors (for instance).