custom heroku python buildpack with libgeos support

Because i needed it, and the geodjango buildpack messed up the paths and newrelic support, i forked the standard buildpack and added (okay i copied the code from geodjango buildpack, thanks for that) the installation of the geos lib:

https://github.com/ppp23/heroku-buildpack-python

2 toys for the (python) geo coder

nice way to find out aprox boundaries: http://pos-map.appspot.com/en/coordinates10.html
and a library that totally rocks: http://toblerity.github.io/shapely/manual.html

put together and suddenly you have instand awesomeness :-)

Mo Features Mo Problems

I don’t know what, they want from me
It’s like the more features they come across
The more problems i see

Developer Job in Vienna, starting right now (or when you are ready)

Here’s an informal job description for 2 open positions in my new company, please share it with the people who might be interested!

  • We are an international startup with people in Hamburg, Amsterdam, Chicago, Stanford, Vienna. The development is happening in Vienna right now, where we have both our backend development (currently consisting of, well, me) and Product Management
  • We have frequent development sprints with the whole team. So if you like to fly around, this will be a plus. And Generally you should be interested in flying :-)
  • For both positions proximity to Vienna or willingness to come over here frequently would be a plus, as intensive collaboration will be required in the next months.
  • For both positions we offer flexible working conditions – work as much as you can and feel happy with. Of course the more time you are willing to invest – the better, but really any help we can get from you is highly appreciated.
  • The earlier you could start the better :-) . Don’t worry if you still have other projects to finish on the side. We are flexible. But May – June would be perfect to have your first day on board.

iOS Developer

  •  You will further develop our existing app (currently in beta phase) and slowly take over the work-load from Sebastian, as he will focus more on his studies in Stanford.
  • The App is mostly written in Objective-C and takes use of iOS features such as in App Purchases and (Push) Notifications and communicates with the backend over a REST interface using JSON payloads.
  • Some parts of the app are implemented as a webview. So knowledge (or willingness to learn) of html5/mobile javascript libraries (you can choose) will be a big plus.

Backend Developer

  • The server app is handling requests to different data providers, caching, storing of usage data, calculations based on those data.
  • Currently it is a slick 12.000 lines of python code (while around a third of it are migrations i guess). The framework in use is django including piston for rendering the results to the internal API.
  • There is a lot of work to do on all corners – so basicly you are able to choose what you want to work on. Is it more visible stuff like the webview (see iOs Developer) or the upcoming sharable web boarding pass, a manage interface for easing up daily operational work, extending our automated tests, or is it heavy backend stuff like optimizing caching and our postgres database. Currently i am handling everything and i can use help on any side.
  • If you provide more expertise in a field then i have, and if you are willing to take over the responsibility, i am more then happy to give you the lead in that area. If on the other hand you have no experience in python or django what so ever don’t feel afraid to apply anyway. It is my believe that if you have knowledge of how things work in a server/client environment, worked with any modern web framework and generally provide good programming skills (which include the passion for always learning new stuff!) you will have no problem to learn and adapt very quickly. As mentioned currently the codebase is not very big, and even though some pats where written in kind of a hurry (we have to ship, don’t we) it generally follows well known principles.

Ein kurzer Gedanke zu Europa

Anstatt Milliarden an sterbende Industrien, schwindliche Infrastrukturprojekten oder verbrecherische Banken zu verscherbeln würde sich doch gerade in der derzeitigen Krisensituation die Chance bieten wichtige strukturelle Reformen innerhalb Europas anzupacken. Die meiner Meinung nach vorrangigen Projekte wären die Schaffung einer europäischen Arbeitslosen- und Pensionsversicherung. Das würde nicht nur kurzfristig einen Haufen Arbeitsplätze schaffen, sondern auf lange Sicht auch einerseits Verwaltungskosten sparen, aber auch echte Wachstumsimpulse schaffen. Was hab ich von einem gemeinsamen Wirtschaftsraum, wenn ich in einem anderen Land zwar in alle Versicherungen einzahlen darf aber erst nach mindestbeitragszeiten von mehreren Jahren (wenn nicht Jahrzehnten) etwas herausbekomme. Ich denke das ist immer noch ein großer Hemmschuh in der flexibilität und mobilität am europäischen Arbeitsmarkt. Und wenn wir schon dabei sind bitte ich noch um ein einheitliches Umsatzsteuer System.
Klar diese Visionen brauchen mehr Mut zur Umsetzung als einfach mit der bisherigen Strategie weiter zu fahren, aber wenn sich die EU langfristig von der aktuellen Elendesverwaltung weg zu einem neuen Wachstumsmotor entwickeln will sind große Veränderungen dringend notwendig.

some more python exploration

problem 1: given a list of dictionaries, you need to sum the (int) value of one of the dictionaries fields:

>>> from operator import itemgetter
>>> a = [{"foo": 1},{"foo": 2},{"foo": 3}]
>>> sum(map(itemgetter("foo"), a))
6

problem 2: given a list of dictionaries you want a sum of unique entries under one key

>>> a = [{"foo": "ATH"},{"foo": "ATH"},{"foo": "VIE"}]
>>> len(set(map(itemgetter("foo"), a)))
2

while i would not bet to much on the performance of those babies.

python snippet of the day

as django’s very own unlocalize filter outputs a string, we can not chain it’s result to the date filter. so i wrote this filter to format (standard) datestrings:

@register.filter
@stringfilter
def strftime(value, format):
    return datetime.strptime(value[:19], '%Y-%m-%d %H:%M:%S').strftime(format)

UPDATE: i found a more elegant way to achive what i need, so instead of

{% flight.get_departure_time_display|unlocalize|strftime='%H:%M' %}

and handling the localization in the get_departure_time_display function, i use the timezone tag:

{% timezone flight.arrival_airport.timezone %}
    {{ flight.get_arrival_time_display|date:"H:i" }}
{% endtimezone %}

looks much more readable to me.

the filter might come in handy somehwere in the future though, so i leave it as is.

The Revolution will be live

You will not be able to stay home, brother.
You will not be able to turn on, log in and status update
You will not be able to lose yourself on your timeline and friends posts
Get distracted by commercials for online poker and penis enlargments,
while skipping through your spam folder.
Because the revolution will not be on the web.

The revolution will not be on the web.
The revolution will not be featured on youtube
in 4 parts with ads by google.
The revolution will not post pictures on flickr,
or on facebook’s mobile uploads,
using hipstamatic and instagram apps.
The revolution will not be on the web.

The revolution will not be a meme on 9gag or 4chan,
there will be no re-posts on tumblr, likes on facebook and +1s by google.
The revolution will not give you a longer lasting sex, one night stands in your area, or secret tricks for a flatter stomach.
The revoluton will not write you comments, emails or private messages,
because the revolution will not be on the web, Brother.

There will be no ACTA, no PIPA and no SOPA,
there wiil be no site’s shut down or videos blocked because of pirated material.
There will be no pictures of pigs shooting down brothers
filmed close captured on camera phones.
There will be no blogging about viral marketing campaigns and government abuses.
There will be no private sex tapes or pictures from hacked iPhones.
There will be no monthly membership fees.
The revolution will be avaible in your country.
The revolution will not be blocked by the national firewall.

The revolution will not be on the web, will not be on the web,
will not be on the web… The revolution will be live!

Freedom

here’s the problem with freedom.
most people don’t care about freedom,
they will trade off their freedom for whatever will make them feel less alone.
that’s why societies form, why there are trends, why such things as facebook can be as successful as they are. why people still follow religions, football clubs and communist ideas. so if you want to sell something big don’t argument with freedom, argument with social acknowledgement. freedom will always be a niche market. a luxury product for the few who can afford it.
those who center their interests around freedom will always be considered outsiders, outcasts of society, as the very core of any society is not individual freedom but togetherness. whereas the reason for togetherness is not the substantial thing, but the operationality of it. societies do not break because of the peoples cry for freedom, but the spreading lack of communal identity.
so the outcome of revolutions is hardly ever more freedom, as it is not the intention of it in the first place.
a successfull revolution fixes the problem of alienation in a society, whereas a failed revoultion only is able to establish a feeling of togetherness upon it’s protagonists.

Wehrpflicht

A nation that makes a great distinction between its scholars and its warriors will have its laws made by cowards and its wars fought by fools.

– Thucydides

Wehrpflichtgegner Argumentieren neben der alles diktierenden Kostenfrage vor allem mit Schlagwörtern wie Effizienz, Professionalität, ‘Zeitgemässheit’. Die Argumentation greifft aber ziemlich kurz, da viele Fragen, etwa nach der gesellschaftlichen Kontrollierbarkeit und die Bedeutung für die innere Sicherheit ausgespart bleiben.
Zusätzlich hat das Heer neben seinen offiziellen Aufgaben auch einen sozialen Faktor, der nicht zu unterschätzen ist. Während man sich Schule, Beruf und Freundeskreis mehr oder weniger aussuchen kann bzw. diese aus dem sozialen Hintergrund gegeben sind, müssen zum Heer alle die dazu fähig sind. Diese nunmehr 6 Monate sind daher einer der seltenen Zeiten im Leben wo viele wirklich intensiven Kontakt und gemeinsame, teilweise prägende Erfahrungen mit Menschen unterschiedlichster Gesellschaftsschichten haben. Idealerweise sollte das Heer auch so was wie weine Charakterschule sein, das hier oft Versäumnisse auftretten soll nicht verleugnet werden. Auch, das Grundwehrdiener oft gefühlt oder real unnütze und langweilige Arbeiten durchzuführen haben, und ein großteil der Zeit beim Bundesheer oft als vergeudetet angesehen wird. Aber genau hier, und nicht bei einer Abschaffung der allgemeinen Wehrpflicht, sollte angesetzt werden.
Denn ein Berufsheer hat im Vergleich zu einer Volksarmee für eine Gesellschaft schwerwiegende Auswirkungen, welche in der aktuellen Debatte nichtmal ansatzweise diskutiert werden. Ein aktuelles Beispiel dazu ist Ägypten, wo das Militär vor allem durch Zurückhaltung aufgefallen ist. Ägyptens Heer besteht vor allem aus jungen Grundwehrdienern, die nicht sehr viel von den Leuten auf der Straße trennt. Ein professioneller Aparat, wie ihn die Ägyptische Polizei darstellt verhält sich in so einer Situation jedoch erwiessenermaßen gänzlich anders.
Eine professionelle Armee kann wie eine professionelle Polizeitruppe nie so einen Querschnitt durch die Bevölkerung bilden wie eine Volksarmee. Zu befürchten ist das die meisten freiwilligen schon mit einer gewissen Grundeinstellung den Dienst antreten, und diese Einstellung in den Jahren der Kasernierung noch bestärkt wird. Die Gesellschaft ist da weit weg.
Darum ist ein Berufsheer vermutlich auch effizienter. Die Frage ist, wollen wir diese Effizienz? Effizienz im militärischen bedeutet nach innen und aussen Fähig sein Kriege zu führen. Das erfüllt ein Berufsheer sicher besser. Sicher fällt es einer Freiwilligen Armee leichter in Gefechte zu gehen, als mit Menschen die gezwungen werden. Wieso war die Widerstandsbewegung gegen den Vietnamkrieg so viel intensiver als jene gegen den Irakkrieg, und am Ende erfolgreich? Weil es damals noch die Wehrpflicht in den USA gab, und die jungen Wehrpflichtigen Amerikaner einfach versuchten ihre Haut zu retten. Und genau das ist der historische Irrtum der Anti-Wehrpflichts Bewegung: Wenn gesellschaftliche Verantwortung abgewälzt wird weil niemand den Arsch hinhalten und sich die Hände schmutzig machen will, dann schwindet damit auch die Möglichkeit der gesellschaftlichen Einflussname. Ein Heer wird es so oder so geben. Fragt sich nur ob es ein Heer aus dem Volk sein wird, oder eine hochtrainierte und bewaffnete ‘Parallelgesellschaft’.