Latest Entries

A Django Taggit widget with suggestions

To tag my Django models, I am using Alex Gaynor’s Django Taggit. In the Django Admin, it renders an ordinary text input field, handling comma separated tags. Since we have a bunch of editors, and all of them are tagging slightly different, it would be useful to suggest tags based on what they are typing. After some research and tracking the eight forks of django-taggit-autocomplete, I came up with a ninth, and a new name: django-taggit-autosuggest”. We are using it in production and it looks great with Grappelli:

Python: Parallel S3 multipart upload with retries

The fastest way to upload (huge) files to Amazon S3 is using Multipart Upload. Instead of uploading one (huge) file through one connection you split it into (smaller) chunks and upload them through multiple connections in parallel.

In Python, you usually use Mitch Garnaat’s boto library to access the Amazon Web Services. Since I usually work with huge video files, I was searching the web for some implementations and thought about how low the memory footprint and disk usage could be. Both Mitch Garnaat and Brad Chapman used the unix split command to create chunks first, doubling the disk usage. Others were creating StringIO objects on demand, eating RAM. So I had a deeper look into Python’s IO module and wrote FileChunkIO, which takes the path of the file, an offset (where to start reading), the amount of bytes (where to stop reading) and fakes to be just that chunk (read only of course). As you can read it buffered, it’s footprint is pretty low.

An example of my parallel S3 multipart upload with retries using that FileChunkIO is available here:

Triple Screen Setup (on a Mac)


In 2007 I bought a 24″ screen with a native resolution of 1920×1200 px and added a second one last year. Mounted on a Ergotron LX Dual Side-by-Side Arm they are “floating” above my desk and can be readjusted within seconds. Most of the time I found myself using them both in portrait mode, side by side (2400×1920 px), which allows working active on both without turning the head (and loosing focus). But some of the windows, like documentation, search results and terminals were still hidden. So I added a third screen last week (3600×1920 px).

Two screens can be connected to any ordinary graphics card. For the third screen, I bought a HIS USB DVI Mulitview II Adapter (~60 Euro), which is the only USB graphics card I found that supports Macs and 1920×1200 screen resolutions. After the beta driver 1.6b3 installation the screen was available, but in landscape mode only, which is a unresolved bug. To solve that issue, download and run Display Rotation Menu X once. It also fixes the rotation setting in the system preferences. The performance of the USB graphics card is good for standard tasks, but insufficient for video playback, where it starts flickering.

If you’re about to buy some screens, I can recommend buying Dell. Mine are called 2407WFP-HC, the aspect ratio of 16:10 is great in portrait mode, the PVA panels are matte and color stable and the borders are thin. The current model is called Dell U2410 (~480 Euro) and there is also a 23″ 1920×1080 (16:9) model called Dell U2311H(~220 Euro).

Recover from an encrypted Time Machine backup

Today my SSD died the sudden infant death syndrome, it only got 18 days old. For the muggels among the readers: A SSD is a hard disk for computers, no need to condole or get sad.

Letting TimeMachine back up my data once per hour on an encrypted sparse bundle I did not loose anything but time. But as I found out, booting the OS X DVD and clicking on “Restore System From Backup” does not let you enter the password to read and recover your data, even though it detects that there is one. Instead, you need to open up the Terminal and type “hdiutil attach /Volumes/path/to/your/backups/yourbackup.sparsebundle”. It asks you for the password and then mounts your backup volume and allows you to select it in the Restore Utility.

BTW: It was an OSZ Vertex 2 drive. “Back up, back up
Tell me what ya gonna do now” (Lincoln Park).

Using PyFlakes with Hudson’s Violations Plugin

I recently set up Hudson at schnee von morgen, a continuous integration server that smoothly builds our code (mostly Python) and reports back if the testsuite failed. But Hudson is more than an automated testrunner. The violations plugin for example can display the results of pylint, a tool that reads code and detects errors. The problem is: I don’t like pylint, I prefer using PyFlakes. Detecting errors is what I want Hudson to do, not nagging about bad PEP-8 compliance, bad naming and stuff: That’s what I’m excellent at (and probably the reason why my co-workers call me “PEP-8 nazi”). PyFlakes does what we all are bad at: Reading code in about no time while still finding about every error. I usually agree with PyFlakes that what it discovers should be fixed, so I’m fine with considering its results to be “errors”. And with that assumption in mind I can reformat the output to a format that pylint expresses errors with and make the Violations Plugin read it properly:

In my build command, I added the following line to run pyflakes, reformat the output and write the results to a file called pyflakes.txt.

pyflakes [path_to_src] | awk -F\: ‘{printf “%s:%s: [E]%s\n”, $1, $2, $3}’ > pyflakes.txt

Then I configured the violations plugin to read that file:

And what I got was a nice graph on the project page mentioning one pyflakes “pylint” error:

webhook2email: Read what gets POSTed

When you write (or consume) webservices that need some time to process your request, you may end up implementing (or using) a push notification service that gets triggered once the call got processed. In a RESTful world, it’s done by POSTing data to a given URL (call it HTTP callback, or “WebHook” if you like buzzwords). A neat technique to build workflows between distributed systems. But before machines interact with each other, some human being must understand and route their communication data.

The best way of understanding what gets POSTed is reading and studying the data. Unfortunately that’s not a trivial task if there is no proper documentation with samples available. Therefore I wrote a request handler on Google’s App Engine that you can POST data to and that emails you formatted headers, formatted data and plain data in return.

The URL of webhook2email is as follows:
http://webhook2email.appspot.com/?email=[youremailaddress]

If you want to test it right now, open a Terminal and execute the following snippet:

curl -d "hello=nihao&goodluck=haoyun" http://webhook2email.appspot.com/?email=[youremailaddress]

Have fun!

Prepaid mobile internet in Croatia

If you want to be online while travelling through Croatia, you should consider buying a “Vipme Broadband” SIM and plug it in your 3G stick (they sell simlocked sticks, probably lacking Mac support). To prevent paying per MB, you can buy data options for one month (50MB, 300MB, 1GB) online, on their free-to-use account page, that does not require a login once you are using their SIM card. Vouchers are available at many kiosks or at the Vip stores and Vip retailers.

Since the Vip store in Zadar really wanted me to buy their stick and refused to give me the proper credentials before my 10 minutes of complaints, here’s what you need:

  • APN: data.vip.hr
  • LOGIN: 38591
  • PASS: 38591
  • DNS1: 212.91.97.3
  • DNS2: 212.91.97.4

Veranstaltungstipp: Taktwechsel im
Mediennutzungsverhalten

Am Donnerstag werde ich im Podium der Expertenrunde über die Auswirkungen der Digitalisierung auf die Film und Fernsehindustrie im Raum D des Wiener Museumsquartiers mitdiskutieren. Die Interdisziplinarität, der Altersunterschied und die vertretenen Firmen versprechen einen spannenden Diskurs und interessante Blickwinkel in die Zukunft.

Die Anmeldung zur Veranstaltung der FilmFonds Wien und FilmTiki ist bis morgen kostenlos per E-Mail möglich.

VideoCamp Wien am 30. Januar 2010

VideoCamp Vienna 2010 LogoAm 30. Januar 2010 findet das erste Wiener VideoCamp statt, ein BarCamp zum Thema Onlinevideo. Ob Drehbuch, Dramaturgie, Produktion, Technik, Playout oder Marketing - Das Spektrum ist breit gefächert und wie bei einem BarCamp üblich entscheiden die TeilnehmerInnen über was sie sprechen, nachdenken und diskutieren.

Am besten gleich anmelden, und Sessionvorschläge machen.

Blogger im Garten

dctp.tv Meinungsmacher: Sascha LoboIm Informationsgarten dctp.tv sind sie nun eingepflanzt, die ersten von Philip Banse interviewten Blogger. Genauer Markus Beckedahl, Stefan Niggemeier, Johnny Haeusler und Sascha Lobo - letzterer blüht auch schon.



Copyright © 2004–2009. All rights reserved.

RSS Feed. This blog is proudly powered by Wordpress and uses Modern Clix, a theme by Rodrigo Galindez.