Visualizing Statistics in Minecraft

Data about public sector spending is often hard to understand and compare. Statistics about government is often presented in tables. In this hack I have used open data from Eurostat (the EU statistics agency) about government expenditure for a set of countries and rendered sets of boxes in a Minecraft world. This makes it possible to explore the data by walking (flying) around the world. Boxes for expenditure data is ordered as General public services, Defence, Public order and safety, Economic affairs, Environment protection, Housing and community amenities, Health, Recreation culture and religion, Education, Social protection....

August 5, 2012 · Peter Krantz

Integrating Yahoo Search in a Django site in 5 easy steps

I have been experimenting with various search options for the eutveckling.se site for a while. Google Custom Search is nice and very fast, but the number of ads appearing in the search result page makes it difficult for users to separate result items from ads. (Update: I am sticking with Google Custom Search until I figure out how to get Yahoo search to present proper excerpts). I am a fast reader which comes with the tradeoff of missing important information sometimes....

December 18, 2008 · Peter Krantz

Improving Django performance with better caching

The Django cache middleware is great, but has one drawback. If you are caching views (which can give a nice performance boost) Django will only use the path segment of the URL to create a cache key. If you are an avid reader of RFC 3986 you may remember that a URI consists of multiple components; path and query being of special interest here. The problem is documented in ticket 4992 (Update: it is now in Django)....

November 2, 2008 · Peter Krantz

Stuff I learned over the weekend

1. Finding stuff in lists of dicts in Python If you have a list of dicts in Python like this: [python]items = [{“id”:1, “name”: “Rasmus”}, {“id”: 2, “name”: “Rick”}][/python] …and want to check if there are any dict items with an id of a specific value (e.g. 2) I first came up with this: [python]2 in map(lambda x: x[‘id’], items)[/python] The downside is that it will loop all items which may be inefficient for larger lists....

October 27, 2008 · Peter Krantz