Dugan Chen's Homepage

Various Things

Quetzalcoatl 2.0 Released.

I have finally completed version 2.0 of the Quetzalcoatl MPD client. It’s at the the old GitHub page: https://github.com/duganchen/quetzalcoatl Previous versions have moved here: https://github.com/duganchen/quetzalcoatl-legacy The master branch of the legacy repository is the first release, and the experimental branch is the rewrite that I eventually developed into this one. Why An MPD Client? I […]

Bootstrap Directory Index Skins for Apache and Ngnix

This is how you can get nicer directory indexes in Apache and Nginx. First, have you ever used h5ai? I have. It’s great. But now, I want something lighter. I want a solution that does not defer to a CGI, an application server, or equivalent. I want something that uses only the web server itself. […]

A PyQt implementation of JQuery’s Promises and Deferreds

I tried to implement jQuery’s Promises and Deferreds in PyQt. I was moderately successful. The use case here is chaining QNetworkAccessManager calls. When you have the name of an artist, it takes two calls to fetch the artist’s photo from last.fm. The first call fetches a reply that has the image URL. The second call […]

PyQt Implementation of MSDN’s MVP Example

I had a look at Microsoft’s Model View Presenter example, and I couldn’t resist blogging a PyQt version. For the PyQt version, we’ll have a dropdown list of music artists. When one artist is selected, its bio is retrieved from Last.FM and loaded into the UI. I only loosely skimmed the article and its source […]

MVP with PyQt. With a Model layer.

Some of the peer feedback I received on my MVP for Qt (PyQt and PySide) made good points. Pushing all the complexity to a single monolithic Presenter class simply moves the problem; you still have to subdivide that complexity, or the Presenter will be huge. Furthermore, if you have a tabbed layout, there are benefits […]

MVP for Qt (PyQt and PySide)

I took my PyQt implementation of Michael Feather’s Humble Dialog box example, and I refactored it into a Model View Presenter implementation that fits PyQt and PySide better. I’ll show you the code first, and then I’ll discuss it: The code, filter_chain.py The code itself is PyQt, but the discussion below also applies to PySide. […]

Qt, Python, AsyncIO. And Quetzalcoatl.

I’ve know I’ve said this before, but I’m at work on the next version of Quetzalcoatl, my Qt-based MPD client for KDE, written in Python. PyQt and PySide I did not say “PyQt-based”, because PySide compatibility is on the table. Normalizing PyQt for API-compatibility with PySide is easy. If you’re importing PyQt, you set its […]

LEMP on Slackware

I’ve gotten to really like the nginx web server. Here’s how to set it up on Slackware. Nginx Just install the nginx SlackBuild from SlackBuilds.org. Then make nginx’s startup script executable, and start it. Browse to http://localhost/, and you should see nginx’s start page. Add the following to /etc/rc.d/rc.local, so that nginx is started on […]

Building SDL2 programs with CMake and PkgConfig

Here’s what I feel is currently the easiest and safest way to build SDL2 programs. First, you should never be writing Makefiles by hand. You should be generating them. And for generating Makefiles, CMake is more or less the current standard. How does CMake detect where a library and its header files are installed? Well, […]

Reading Environment Variables in Python. With Metaclasses.

I work in the animation industry. Here, the standard practice is to use environment variables to control the runtime behavior of software. It is common enough, in fact, that powerful open source projects such as Rez have been started to manage it. The idea is that before launching each application, you set the environment variables […]