Dugan Chen's Homepage

Various Things

Django, Tastypie, Generic Foreign Keys and Backbone

I’m going to show you how to implement, in Django, a tagging database and a web service to query it. By the time we’re done, our web service will also be usable from an unmodified copy of Backbone.js. Requirements Our system will have pages, posts and tags. Tags can be attached to either pages or posts. This data […]

Preparing Video for AMVs. In Linux. Part 2.

This is a follow-up to a previous entry: Preparing Videos for AMVs. In Linux. This is how you cut out the first ten seconds of GG’s Madoka Magica fansubs in lossless HuffYUV format: The size of output.avi? 147M. Or almost 15mb/s, or around 21 GB per episode, 252GB for the whole season. And this is […]

Drag and Drop Uploading with HTML 5 and CoffeeScript

About half a year ago, I blogged about Progressively Enhancing Upload Forms. Here’s another implementation. This time, I’m going to use CoffeeScript. With CoffeeScript, you get for free what you would otherwise have to struggle for if you try to follow best practices and make everything pass jslint. It makes easy what is often difficult: […]

Deleting lines with find and sed

Now here’s a use case that calls for command-line Unix tools. I use Slackware Linux. Slackware Linux includes, in its /extra directory, packages that are not installed by default. This includes a script to package Google Chrome. The Chrome packaging script includes Chrome dependencies, including ORBit2 and GConf. Still with me? A very popular repository […]

My audiophile PC setup

My current PC audio setup is economical, versatile, and awesome. The key components are: Behringer U-Control UCA202 Fiio E6 Note: both links are to the actual stores where I bought them. The Behringer USB sound card’s RCA outputs are connected to the Fiio headphone amplifier’s line input via an adapter cable. Now here’s why the […]

Quetzalcoatl 2.0 Screenshot

This is what you’ll see if you check out Quetzalcoatl’s “experimental” branch. All images are loaded from last.fm’s web services, based on tags in the music files. The albums shown in the “Songs” subtree of the left pane are: the soundtrack to the 2011 version of Jane Eyre, Frente’s “Marvin the Album”, Loreena McKennitt’s “The […]

Using Django with Selenium

Much has been written about the ways to integrate Django with Selenium. Here’s my attempt. First, I was inspired by harry’s fantastic Test-Driven-Django Tutorial and GitHub page. I am also aware of django-selenium and django-nose-selenium, but have not used them. Now, for functional testing, you want Selenium. Most guides to testing with Selenium recommend integrating […]

Using PyQt4 to download images from Last.fm

The following is code that I’m planning to roll almost directly into Quetzalcoatl. It asynchronously downloads an image from Last.fm and loads it into a widget. The image then scales with its containing widget, using maximum amount of space while keeping its aspect ratio. Keep in mind that it’s example code, not production code, and […]

Playing SDL_mixer games with soundfonts

Here’s a post for people who use Linux and still like to play games. As almost everyone above a certain age is aware, DOS was a popular gaming platform. Because most DOS games were made before the advent of CD-ROMs, they stored their music in MIDI format, which is extremely space-efficient. A MIDI file is […]

Django with Yahoo’s Geoplanet Database

Most web applications eventually need to provide the following user experience: select your country select your “administrative division” from a list appropriate for your country Where administrative division could be state, city, province, prefecture, or something else appropriate to your country. It goes without saying that to pull this off, you need a populated backend […]

« Previous PageNext Page »