Neo4j Podcasts

The IBM Java technology zone technical podcast series has two nice podcasts about the Neo4j Graph Database:

  • Emil Eifrem, the man behind Neo4j (mp3)
  • Agile architect Peter Bell on Neo4j, a graph-oriented datastore built in Java (mp3)

The whole podcast series is worth listening, so subscribe to the RSS Feed.

Google Developer Weekend Hack and Tell

The Google Developer Weekend started with a Berlin Hack and Tell Special Google Edition at C-Base.

Thanks to Deborah from http://9flats.com for the Pizza.

Here's a short list of the projects:

Friedger Muefke

http://open-accessories.com

Friedger showed how to modify google docs with google appscript and access data from a spreadsheet and send it to a blog.

Lean Engine

Mathias from lean engine showed how to cloud enable your mobile apps.

Stefan Wehrmeyer

Stefan presentedhttp://mapnificent.net, a layer over google maps which tells you what points in a city you can reach via public transport in a given time.

Stefan uses http://www.gtfs-data-exchange.com/ to get the timetables for public transport. Sadly the berlin transport organization BVG does not provide real time data.

wheelmap.org

whellmap.org is a map with wheelchair accessible places. The presenter showed how to work around the android sqlite limitations to work with lat/long positions.

Launchmode

Gonsala shode launchmode, an app to help visualize android activities.

xbounds.net

xbounds is a great hack to add screensharing to mobile devices.

andengine

Johannes presented how to use andengine together with Physics Editor. It's a simple way to add physics to your games (like collition detection). Just load an image of your level to Physics Editor and load the result to andengind.

komoot.de

Jonas and Jan talked about some design decisions for http://komoot.de an outdoor navigation and route planning app.

They dropped a local database on the mobile phones in support for a thin caching layer and now get all data from their servers.

Daniel Kurka

@dankurka showed m-gwt.com. It lets you programm gwt applications for mobile phones. The gwt programm is compiled to html5/css and runs via phone gap on your mobile phones

Barcamp Stuttgart 2011

Barcamp Stuttgart 2011 is over and it was really nice, interesting and well organized (as always).

Timetable

I chosed to participate in the following sessions:

  • Identity Management I visited the slot because I thought it would be about online identiy management, but the slot was about the corporate world. Tobias talked about different identity sources in corporations like SAP HR, Microsoft AD/Exchange and the problems on how to keep them up-to-date and in sync.
  • Memotechnik Andreas Lohrum introduced us to the art of memory and showed us how to remember the first 30 digits of PI. So now I only have to remember 100 words for the numbers 0 to 100 and than I should be able to remember telphone numbers. We'll see...
  • Startupscene Stuttgart What's the current status of the local startup scene and how to improve it. Harald Amelung made some Notes.
  • Geile Twitterbots Karsten Sauer showed us some of his twitter bots:
  • #GO-NUTS Sven gave a short introduction into the go programming language

There could have been some more technical sessions. The quality of the speakers was very good.

send notes to simplenote from the command line and vim

sn.py is a command line app to send text to simplenote service. It uses the simplenote.py library.:

#!/usr/bin/env python
"""simplenote command line app"""

import sys
import fileinput

from simplenote import Simplenote
sn = Simplenote("XXX", "XXX")


def send(txt):
    note = {'content': txt}
    note, status = sn.add_note(note)

    if status != 0:
        print >> sys.stderr, note
        sys.exit(1)


def read_until_dot():
    line = raw_input()
    while line != ".":
        yield line
        line = raw_input()

import sys
def main(argv=None):
    if argv is None:
        argv = sys.argv

    if len(argv) == 1:
        lines = read_until_dot()
    else:
        lines = fileinput.input()

    send("\n".join(lines))


if __name__ == '__main__':
    main()

Usage

Enter a note:

$ sn.py
write text
you want to send to simplenote
end note with one . in line
.

Pipe the output from another commant to simplenote:

$ echo "send output from command" | sn.py -

Send the contents from a file to simplenote:

$ sn.py some_text_file.txt

Vim

There is the simplenote.vim plugin. It lets you interact with simplenote. If you just want a quick way to send notes to simplenote use the following commands:

Send the current buffer to simplenote:

:%w !sn.py -

Send the current selection to simplenote:

:'<,'>w !sn.py -

Adding a dict based interface to the python leveldb api

In the last post I showed how to install the python LevelDB bindings. Here is how to wrap the python LevelDB API into a dict like API with the help of UserDict.DictMixin. In a subclass we will extend the the simple key<string>:value<string> mapping to a dict with arbitrary JSON serializablie values.

from UserDict import DictMixin
import leveldb
import json


class LevelDict(DictMixin):
    """Dict Wrapper around the Google LevelDB Database"""
    def __init__(self, path):
        """Constructor for LevelDict"""
        self.path = path
        self.db = leveldb.LevelDB(self.path)

    def __getitem__(self, key):
        return self.db.Get(key)

    def __setitem__(self, key, value):
        self.db.Put(key, value)

    def __delitem__(self, key):
        self.db.Delete(key)

    def __iter__(self):
        for k, v in self.db.RangeIter():
            yield v

    def keys(self):
        return [k for k, v in self.db.RangeIter()]

    def iteritems(self):
        return self.db.RangeIter()

    def rangescan(self, start=None, end=None):
        if start is None and end is None:
            return self.db.RangeIter()
        elif end is None:
            return self.db.RangeIter(start)
        else:
            return self.db.RangeIter(start, end)

To store more than just strings we will add JSON serialization to a subclass:

class LevelJsonDict(LevelDict):
    """Dict Wrapper around the Google LevelDB Database with JSON serialization"""
    def __getitem__(self, key):
        return json.loads(LevelDict.__getitem__(self, key))

    def __setitem__(self, key, value):
        LevelDict.__setitem__(self, key, json.dumps(value))

    def iteritems(self):
        for k, v in LevelDict.iteritems(self):
            yield k, json.loads(v)

    def rangescan(self, start=None, end=None):
        for k, v in LevelDict.rangescan(self, start, end):
            yield k, json.loads(v)

Now you have a fast JSON Store with a Dict based Interface and a LevelDB backend.