Category Archives: python

Berlin guide for intellectuals, part 1.

Berlin: “Capital city of Germany.  Poor but sexy.“  Intellectual: “A person who places a high value on or pursues things of interest to the intellect or the more complex forms and fields of knowledge, as aesthetic or philosophical matters, especially on an abstract and general level.

Part 1) A mini guide to Berlin for geeks, nerds, makers, and other thinking misfits.  I’m trying to list things here unique to Berlin, and Germany which may pique the interest of the intellectually curious.

I’m mainly writing this for my many friends who are visiting over the summer… but if you have any tips, or URLs to interesting things please email me ( ) or leave a note in the comments. Thanks! I have a *lot* more to add, but this is a good start I think. Hope someone finds it useful.  Sorry for the pretentious name ;)

Club Mate

Do you have any more of that disgusting energy drink? It’s gonna be a long night.” — Julian Assange

Move over coffee!  Each serious intellectual movement has its drug of choice, and that is no different in Berlin.  Where the drink of choice amongst makers is Club Mate.


“It tastes like cold tea and cigarettes.  Like when someone puts their cigarette in your cup of tea the night before, and you drink it in the morning by mistake.” — Anonymous friend.

Berlin Philharmonic

The Berlin Philharmonic was voted the worlds number two orchestra in 2008, and ranked as top 3 in Europe by mumble mumble… The exact awards they won escape me, but they are FUCKING GOOD.  That is the main point, and you can go to see them.

The schedule, and tickets can be found at the The Berlin Philharmonic website.

 Berlin Philharmonic Orchestra in 2006. Photo by Monika Rittershaus.

(Philharmonie on summer break until 30th August)

Deutsches Technikmuseum Berlin

But didn’t the USA invent computers?  And aeroplanes, and the wheel?” — Me.

Section of the Z1 replica

In fact, the information age can be said to have begun in the 1930s, within walking distance of the German Museum of Technology. In Berlin-Kreuzberg, the inventor Konrad Zuse built the world’s first computers. On the occasion of his hundredth birthday, the museum’s Department of Computing and Automation is presenting a newly conceived permanent exhibition: in the space of roughly 300 square meters (over 3000 square feet), the life and work of Konrad Zuse are presented in six thematic units and placed in the context of the worldwide history of technology.” — Mathematics and Computer Science exhibition.

The Z3 computer (made in Berlin) was “the world’s first working programmable, fully automatic digital computer”.  The Deutsches Technikmuseum Berlin has a display devoted to its maker, Konrad Zuse.

Computer play museum

We were walking down around here earlier, and damn!  It’s like New York in the 80′s.  So fresh.” — They Might Be Giants.
A museum dedicated to play and computer games?  Why not?

Our new permanent exhibition “Computerspiele. Evolution eines Mediums” (“Computer Games. Evolution of a Medium”) opened on the 21st of January, 2011. Over 300 exhibits, including rare originals, playable classics and art works from the game-art sector and interaction performances, conspire to turn you into “Homo Ludens Digitalis”, so that you can create your own image of the game players of the 21st century. Experience a historical journey with highlights for every generation.

Computerspielemuseum Karl-Marx-Allee 93a, 10243 Berlin

Chaos computer club.

A hacker club with its origins in the 80s named after Chaos theory.  You may want to disable your wireless and mobile phone before visiting any of their events ;)

Forkbomb tattoo

The Chaos Computer Club e. V. (CCC) is Europe’s largest association of hackers. For more than thirty years we are providing information about technical and societal issues, such as surveillance, privacy, freedom of information, hacktivism, data security and many other interesting things around technology and hacking issues. As the most influential hacker collective in Europe we organize campaignsevents, lobbying and publications as well as anonymizing services and communication infrastructure. There are many hackerspaces in and around Germany which belong to or share a common bond to the CCC as stated in our hacker ethics.

Tischtennis (Ping Pong)

Tisch means table in Deutsch(German), and Tennis means… tennis.  Add them together and you get Tischtennis.  Which means Ping Pong.  Got it?

Tischtennis is everywhere

Rumour has it, in the GDR Stasi times, East Berlin people are said to have played ping pong to stop the spies from recording their conversations.  These days, there are still some bars which have Tischtennis inside, sometimes in the basement through a side door.  Outside, Berlin has a LOT of Tischtennis tables all around the city which you can use for free.

Check out (bookmark it on your phone), so you can see where the tables are around you.

One type of game which is fairly popular in groups is called Around the world.  Each person has a bat, and the people run around the table taking turns at a hit.  If you lose the point, you are out of the game and you stand aside.  As many as 30 people play at once, and it’s great fun.

Whilst you are playing, you can pretend to be hiding secrets from spies too ;)

Co-working, and hacker spaces, meetups

You want to meet some people, hear their ideas or make something with others?  Berlin is a freelancers dream.  Plenty of places to hang out in and do some making.  When visiting a city, going to the various meetups can be a great way to meet people.  Interested in bee keeping?  Or want to know how to make a synthesiser out of toothpicks?  There’s probably a meetup or workshop for you.  Check out, lanyrd, or just search for “berlin X usergroup” on a Search Engine and you’ll probably find a few options to your liking.

If you need to do some serious work, perhaps a coworking space will be better than sitting in a café.  There’s plenty around, and they mostly allow drop ins just for the day.  Most of them charge around 12 euros per day.

Co.Up. Adalbertstr. 8, 10999 Berlin
Ahoy Windscheidstrasse 18, 10627 Berlin
ESDIP Grünbergerstr 48, 10245 Berlin

Note:I’m just listing Coworking spaces that have day rates.

Drinking, Berlin style.

“How do you say Beer in German? Bier.  Oh.” — Not you.

Feierabend, means home time, or Beer O’clock.  You’ll see many Berlin people with a beer open walking home from work.

The locals love beer in Berlin, and you can get a nice bottle from about a euro from a corner shop called a “Spätkauf” or “Späti”.  You are allowed to drink whilst walking home from work, and you are allowed to drink in many parks.


Many bars have table service, and you pay at the end of your drinking session.  Although, not for all bars.  Whilst Berliners mostly drink beer you can get plenty of other booze.  You can get a Gin, Wodka, and many fine wines made either in Berlin or Germany.

There’s not so much of a “rounds” culture.  If you offer to pay for someones drink they may look at you funny.  I regularly encounter people who are completely baffled by the concept.

There’s not much wine made in Berlin, but there is in the south of Germany.  To get the low down on German wine, the wikipedia page has a good enough article.  If you want dry wine, look for “trocken”.  I think the “Grauburgunder” wines are sort of good, and quite underrated if you want to try something different.  Whereas German wine is best known for its Riesling.  “Ice” wines are another interesting style.  If you’re from outside of Europe, then you have a massive task ahead of you coming to grips with endless wine varieties :) Bubbles (sparkling wine) is called Sekt, and you can get a drinkable bottle from a few euros.

Words on paper, Book shops

Mmmm, book smell.” — Readers.

Does hanging out in bookshops eating bagels and reading books sound appealing?  Once you have your book, your adventure begins.  Take your book to a park (or a lake) and drink in the day with book smell and sun.

Music to take home, Record stores.

You know those black spinning things which have tiny little groves in them?  It turns out a lot of people still make them.

Berlin is not only a centre of classical music within Europe, but is also a hub of many other types of more modern music.  Berlin is the capital city of the underground if you are into electronic music.  It’s where soundcloud is, and it seems every third person in the street is a DJ.  Germans also love their metal, and punk too.  So you can often pick up some great discs if you’re into that sort of thing.

Unsurprisingly there are a *lot* of record shops you can hang out in.  You could spend hours, days, and even months flicking through crates and listening to lost sounds.  Many of the flee markets also have record sellers.

You can pick up local genres of music like Neue Deutsche Welle ( or music from the GDR. I’ve personally started collecting German sea shanties (yes, the record store owners usually laugh at me when I make my purchases).

Be nice to Berlin, and Berlin will be nice to you.

Be a considerate little tourist will ya?  You don’t like it when someone spews up on your doorstep yeah?

Berlin will ♥ U if U ♥ Berlin.
  • Do say hallo and smile at people.
  • Do put your recycling in the correct bins.
  • Don’t take photos of people without asking. Privacy is important to Germans.
  • Do tip.  It’s not expected but people love it!
  • Don’t use AirBNB or similar.  It drives up the rents for people trying to live in the city.
  • Don’t say the N word.
  • If you are going to put something on a wall, please make it good.

Where else to look? Blogs, Websites, Facebook.

What’s up this week Berlin?  There’s lots of blogs, websites, and facebook groups in English.  Many of the blogs below have lists of other blogs to check out too.

    10 things to do in a Berlin summer

Long form articles about Berlin in the “slow travel” tradition.

A visual magazine about Berlin.

Most big clubs are on resident adviser of course :)

A daily email magazine with things to do.

Lots of the open air/underground music/dance events:
Unlike is filled with hipstery type things.

LGBT clubbing, and such.

Food, design, and life in Berlin.

Berlin design blog is about… well.

I heart Berlin is a blog about Berlin, also with a weekly events guide.

A blog about … [guess... go on! ...] Berlin!


Mind the gap!” There, I’ve warned you to mind the gap.  Try and remember that, since it won’t be repeated at you every three minutes.

Keep off the bike paths!  You might get hit by a bike rider.  The bike paths are often separated from the roads, and next to pedestrian ones.  People new to Berlin are sometimes not used to bike paths, and hopefully just get a bell rung at them a few times rather than have a collision with a bike.

Riding your bike in Berlin is waaaaay safer than many cities in the world.  There’s bike paths, and many car drivers are used to bikes.  Most people don’t wear helmets, since you are not required to by law.

Going to a gallery opening held inside an abandoned office block might sound cool, until you fall through the floor and realise the walls are made of asbestos.

Berlin is pretty safe compared to many big cities.  But there are areas a bit more wild than others.  I know many women who go around Berlin by themselves and feel safe.  Neuköln in particular seems to be a place which gets more reports of trouble.  Having said that, Neuköln is a really fun place with many interesting things. Just be aware at night, and maybe don’t go alone.  If you walk through a park at night, you’ll probably get offered illegal drugs.

This is not a complete safety guide, but covers some basics.  You should probably look up a more comprehensive guide.

More to come…?  Corrections, feedback?

If you liked this, and want more please leave a comment :)   Or if you have a suggest, please comment or email me ( ).

Continue reading

Posted in berlin, guide, python | Comments Off

Dear Apple, please make Swift more fun

Dear Apple,

it was with great pleasure that I see you enjoy 3 letter key words.  Your use of ‘let‘ and ‘var‘ were inspired!  These allow people to line things up nicely in a 4 space world.  With 3 letters for the keyword, and 1 for the space.  Brilliant!

However python has more elegant type setting than Swift in this case.  It uses “def” rather than “func”.

It is not too late to make Swift more fun!

For your consideration:

func sayHello(personName: String) -> String {
let greeting = "Hello, " + personName + "!"
return greeting

… now let’s remove that c at the end of func…

fun sayHello(personName: String) -> String {
let greeting = "Hello, " + personName + "!"
return greeting

See how the function name nicely lines up with the variables below!  That is type setting gorgeousity right there that is!

Pretty please, think hard about renaming func.  To either “fun” or to “def”.

Thank you,

Continue reading

Posted in apple, python, Swift | Comments Off

Statically checking python

With python, type checking is usually done at runtime.  Python will tell you of type problems when you run the code.  At runtime Python will tell you if there is a problem with the program 1 + ‘a’. Since the types int and string can not be ad… Continue reading

Posted in checking, python, static, type | Comments Off

Welcome to your new NSA partner network. Tech art in Berlin.

Whilst walking around the Afterglow art hack day opening in Berlin, my phone buzzed as I had received a text message.  Opening up my phone I saw this:

“Welcome to your new NSA partner network.”

I immediately had a scary thought.  “Had someone hacked into my phone?”

My next thought was “oh, someone is hacking the mobile networks”.  “Damn, I forgot to turn my phone off like I usually do before coming to hacker events”.

My phone didn’t have service to either of the networks it usually connects to, so someone was definitely jamming the phone systems.

This message was a very impressive piece of tech art indeed.  It made me think, and feel something.

We are starting an EU/UK tech online magazine. Want to know when it is released?

Rest your head against the speaker.
Part of the art hack day.

The revolution is over. Welcome to the afterglow.” reads the opening line to the transmedial festival in Berlin.

The transmedial festival brought back Cyber punk type thoughts from the last 15-20 years or so.  Now that the digital revolution is over, and “The future is now“, and that 2020 is just around the corner… what next?

The afterglow.

“What is next” is a question lots of people in tech are always pontificating about, but perhaps not in the context of the time known historically as the information revolution.

Despite all that lofty talk, and a long speech on this topic, the event was a lot of fun.  Especially the art hack day parts.  Lots of people were there interacting with various art works people had made.

Some sort of eletronic alchemy going on here

Art Hack Day as a grassroots event/exhibit format/community for artists whose medium is tech and hackers whose medium is art.”

Over 80 artist hackers were invited to create the exhibit from scratch in 48 hours.  What they came up with was quite often fun and impressive.

Stamps combine to make prints.

Knowing the design brief for these pieces can give you a better appreciation of what went into the thought process.  Here is the brief the creators were given:

As coders we fear the ‘legacy’ system, a piece of old junk we haven’t yet figured out how to throw away. As artists, we’re tempted by prolific outbursts of freshness and novelty; more art of less value. Businesses and government crave more data, more connections, more context. By embracing these impulses without contemplation we perpetuate the technological hype cycle and unintentionally shorten the half-life of our artefacts. Technology has become akin to a natural resource, generating physical and immaterial waste that is appropriated in such diverse contexts as e-garbage dumps, big data businesses and mass surveillance schemes. As such, trash is no longer what is just left behind but is central to our post-digital lives. When digital detritus piles up it decomposes, giving rise to a post-digital afterglow with the potential for new expression and new enterprise. Can we make peace with our excessive data flows and their inevitable obsolescence? Can we find nourishment in waste, overflow and excess? Can the afterglow of perpetual decay illuminate us?

This honey pot exhibit was one of my favourites.  If you look closely you can see a phone in there tempting passers by…

Honey pot.  With actual honey. With phones in the honey.

Below are a selection of short video clips showing some of the other exhibits in motion.

The tower of beer was one of my favourites.  Not just because it had beer cans in it, but because of the great video effect it had when filmed.

The augmented reality of this tablet swinging from a rope was popular.  Point it at the picture of a rubbish bin painted on the wall, and the video will show rubbish flowing out of the wall.

Not only is the Afterglow happening for the digital revolution, but also for the revolution in Berlin.  After the Berlin wall fell, many artists entered the city from around the world.  It is currently undergoing another revolution of sorts, with many tech companies growing from within Berlin, and also moving to Berlin.  However, tech in Berlin has been around for a long time.  From groups like the Chaos Computer Club (europe’s largest association of hackers), to the Z3 (world’s first working programmable, fully automatic digital computer), Berlin has a very old historical involvement with technology.  The other revolution in tech that is going on is citizens fighting back against surveillance of the state and corporations.  So maybe we are not finished with the digital revolution, and perhaps it will cycle, one more time, towards a future.  But which future?

We are starting an EU/UK tech online magazine. Want to know when it is released?

Continue reading

Posted in Art, berlin, music, pygame, python, raspberrypi, tech | Comments Off

Serial and pixels for breakfast. Arduino + pygame.

Taking a byte of bits of Serial, along with Green screen with Sam, pygame, and an Arduino hooked up to a light sensor and a motor thing.Coffee too?  Naturally.Where do we begin?  At the end of course.  A video of the result…The arduino… Continue reading

Posted in arduino, making, music, pygame, python | Comments Off

Reducing the number of concepts. To make teaching easier.

I am Sam.  Sam I am*.  Well at least my middle name is Sam.  So of course, one fun book I’ve always been drawn to is Green Eggs and Ham. The famous beginners book by “Dr. Seuss”.  It contains just 50 different words: a, am, and… Continue reading

Posted in language, pygame, python, teaching | Comments Off

Raspberry pygame

The Arduino adventure took a little pause today… I finally managed to buy a raspberry pi.Things have improved greatly with the software since I messed around with an alpha board 1 year and 7 months ago.  Pygame is even on the desktop!  Pret… Continue reading

Posted in pygame, python, raspberrypi | Comments Off

pygame logo colour swatches

Been messing around with some colour swatches for the neu pygame website…colors/colours for pygame logo Continue reading

Posted in pygame, python | Comments Off

How I got Dynamite Jack from 62MB down to 46MB

Hey, So – I went Universal with Dynamite Jack just today! Yay! This involved a lot of “blah blah” messing with resizing all the menus for iPhone users, which wasn’t very interesting, though it came out really well. The interesting bit was when I realized that “going Universal” meant that my retina iPad assets were [...] Continue reading

Posted in C++, dynamitejack, python | Comments Off


Posted in python | Comments Off

pretty print json

Pretty Print JSONHow to pretty print json from the command line?$ echo ‘{“foo”: “lorem”, “bar”: “ipsum”}’ | python -mjson.tool{ “bar”: “ipsum”, “foo”: “lorem”}$ python -mjson.tool < /tmp/input.json { “bar”: “ipsum”, “foo”: “lorem”}$ … Continue reading

Posted in json, python | Comments Off

Pygame Google Summer of Code, 2012.

Thanks to the students, and mentors donating their time, along with the PSF, and Google, the following pygame related projects are ongoing over the summer.

“Pygame: GUI toolkit” by Sam Bull (sambull), mentored by Mike Fletcher(mcfletch) and with backup mentor Robert Deaton (masquerade). (Proposal | Blog)

“Pygame: Improved Sprite and Scene system” by Sagie Maoz (n0nick), co-mentored by Robert Deaton (masquerade) and Katie Cunningham (kcunning). (Proposal | Blog)

“Easy networking in PyGame” by Szymon Wróblewski (bluex), mentored by Rene Dudfield (illume) and with backup mentor Mike Fletcher (mcfletch). (Proposal | Blog)

Some project updates:

Sagie wrote a tutorial on pygame.sprite.Dirty and pygame.sprite.LayeredDirty, as well as a blog update on his progress.

Szymon wrote a blog post on the networking project:

Sam wrote a post on the “SCG” beta release of the GUI project:

Sam has also written to the mailing list asking for feedback on his work.!topic/pygame-mirror-on-google-groups/AQiDPF_rINo

Sagie has also been getting into some conversations on the mailing list, and in the irc channel about the sprites project.!topic/pygame-mirror-on-google-groups/KhaV8V6o4Js

Sam, Szymon, and Rene started on a little game for pyweek to be used as an experimental sandbox for testing out gsoc project ideas.

Continue reading

Posted in games, pygame, python | Comments Off

Internet protocol 6, 6, 6.

June 6th, 2012 is ipv6 launch day. You can now go to with version 6 of the internet protocol. Continue reading

Posted in internet, ipv6, pygame, python, web | Comments Off

SQL Injection via field names, and table names.

About a year ago I had to implement a system where the table name could be configured for an application.  Why would you want to do that?  Lots of reasons really, like if you have a table generator via a web interface.  In this case, the system integrates with other systems, and users need a way to specify where the data would go in an existing database.  So I merrily went ahead to try and put the table name in a prepared statement… but ERROR!  Unfortunately the sqlite database does not do table names or column names via prepared statements (like postgresql does for example).  The documented solution by sqlite is to escape them correctly with the provided functions.  Unfortunately python does not expose these SQL escaping functions – since most people should be using prepared statements.

Here are some WONTFIX, closed, invalid bugs also mentioning table names, and column names not being a problem.  One of them is six years old.

(closed wontfix)
(closed invalid)
(closed invalid)

Python and Django don’t really consider this a vulnerability in themselves, but a problem in users code.

However, I still think it is something people should still be aware of.  Especially if you are taking user input to generate your table names, or your field names.  For those people, it could be a problem unless you are really careful.

SQL Injection with Django (a case study)

I’m going to use the python framework Django as a case study of what to be careful of.  However this advice applies to all python, php, [insert your favourite language or framework] and other SQL using libraries.

This code is used to quote table names, and field names in Django via the mysql db backend.

    def quote_name(self, name):
        if name.startswith('"') and name.endswith('"'):
            return name # Quoting once is enough.
        return '"%s"' % name

Note how there is no database provided escaping of the input?  To protect against SQL injection it should be using prepared statements or an escaping function.

Because Django mostly does things like validate field names, and table names… this turns out to not be a problem in a lot of cases.  Other layers of security in Django protect it here.  This isn’t an “OMG free Django p0wny!” bug, but a fairly niche bug if you do something wrong in your own code.

An example of how you can inject SQL because of quote_name is here, where the command takes a table name: createcachetable ‘myinjectedtable` (id INT) select id from users;create table `thecachetablename’

This SQL injection could be a problem if you are getting the cache table name from user input somewhere else, and not validating it first.

quote_name (as one of the places that does it wrong) is used in public 3rd party code, and internally within Django.  It is not a private method, since it does not begin with ‘_’ or ‘__’.  There are places where a string can be supplied from outside of django (either through command line, or through other APIs used, or from a file).  It says that the db backends are responsible for quoting the field names (eg, the Q.__str__ method).

The Django book says:

Thus, if you need to, say, dynamically construct a list of tables from a POST variable, you’ll need to escape that name in your code. Django provides a function, django.db.connection.ops.quote_name, which will escape the identifier according to the current database’s quoting scheme.

Another example where you can inject SQL…

MyObject.objects.extra(where=['"name"="SomeName";CREATE TABLE qwer (id int) select id from users'])

The Django documentation warns to be careful about this function.  However there is no documentation on the extra method about escaping field names, or table names.  Should probably add a warning there:

You should be careful using input from untrusted places where you’ll use it for table names, or field names.  Luckily this is not done very often by lots of people.

What can we do to fix table name SQL injections?

  • Use prepared statements if db backend allows,
  • … or escape it correctly(as documented by each DB engine) when using prepared statements are not possible.
  • Disable multiple statements in the db connect, so even if something gets through the damage is limited.
  • validate the input where possible (for example, why would a table name need to include ;  or DROP DATABASE?)
  • document dangerous calls to explain how to escape values correctly in your database abstraction.

Some more expensive to do fixes are:

  • have automated SQL injection tests.
  • use the database provided permission systems. So front end code only has permissions to do what is required, and admin code can only do what is required of it.

Continue reading

Posted in django, PHP, python, security, sql, sqlite, web | Comments Off

Dynamite Jack: The second prototype, post-post mortem

So about six months after I created “Escape from Anathema Mines” during the Ludum Dare game jam, I created a game called Dynamite in the PyWeek game jam. Theme So the theme of PyWeek #1 was “Power” .. I worked with my brother-in-law Tim on this game, and we spent a fair amount of time [...] Continue reading

Posted in dynamitejack, pygame, python | Comments Off

Dynamite Jack: Seven Years Ago Today – the prototype post-post-mortem

The development of Dynamite Jack was a really involved and long-term project. The project started almost exactly SEVEN YEARS AGO. I’m going to do a series of blog posts over the next few weeks leading up to the release of Dynamite Jack highlighting both the features of the game, the development of the current version [...] Continue reading

Posted in dynamitejack, python | Comments Off

Chaos Python

Add this into your functional tests and smoke it. import sys, randomdef chaos_trace(frame, event, arg): if event == ‘line’ and random.random() < 0.000001: raise MemoryError() return chaos_tracesys.settrace(chaos_trace) You will get … Continue reading

Posted in python | Comments Off

CherryPy – I love it because it’s pyhon.

CherryPy moved to bitbucket a while ago, and also got a website refresh.I love cherrypy, since I can use it with python 3 – not legacy python.I love cherrypy, because I can just use python objects.I love cherrypy because it has a clever name.I love ch… Continue reading

Posted in python, web | Comments Off

Thoughts on Python 3

It’s awesome.Go get some! Continue reading

Posted in python, python3 | Comments Off

PyGameZine issue0

Today we are very excited to announce the launch of PyGameZine! There is more information about it on the website. Continue reading

Posted in games, pygame, pygamezine, python, zine | Comments Off