-
posts
-
Administer WordPress using Django's Admin
I recently came across one feature of Django that seemed pretty useful for one off projects and customizations and was startled because it’s one of Django’s least mentioned features. In fact, I’ve been using Django at work for over 5 years now and didn’t hear of it until this last week. This feature is the manage.py command inspectdb which inspects the tables in an existing database and creates Python code defining the Django models for those tables. We had a use case at work where we had a database table that was not managed as a Django model, but we...
-
Mixins and Python
Python supports a simple type of multiple inheritance which allows the creation of Mixins. Mixins are a sort of class that is used to “mix in” extra properties and methods into a class. This allows you to create classes in a compositional style. Mixins are a really great concept but I often find that people use them incorrectly which can lead to some bugs. I often see Mixins used like the following: class Mixin1(object): def test(self): print "Mixin1" class Mixin2(object): def test(self): print "Mixin2" class MyClass(BaseClass, Mixin1, Mixin2): pass However, in Python the class hierarchy is defined right to left,...
-
A Japanese Python Community Who's Who
There is a small but growing Python community in Japan. Many people, even some of those Python enthusiasts who living in Japan, are unaware of this and don’t know who any of these people are. There are a lot of reasons for this but the number one reason is probably the large language barrier between Japanese speakers and non-Japanese speakers. Currently it can be kind of hard to know who’s interested in what, or who the go-to person is for a particular topic. I think that’s a shame and that there should be more communication going on with the community...
-
Phantom QUnit Test Runner
I have been using PhantomJS and QUnit for a while now to run JavaScript automated tests. I like QUnit because has a decent in-browser UI but also has a nice extension API so you can create plugins and output in different formats if you like. However, I’ve been spoiled by test runners like the Python test runners that create output that is easy to parse with the eyes, shows you tracebacks, and lets you specify filters to limit which tests get run. Most JavaScript test runners aren’t very flexable. QUnit allows you to filter tests, and this can be done...
-
Blog Access Data
I’m the kind of guy that likes to be open about data and such I thought it might be interesting to share what kind of access pattern my humble little bi-lingual blog gets. I really don’t get that many visits, so it’s not really useful to do any kind of deep analysis so, in terms of demographics, there are only a few metrics that are really useful to look at. Because this is a blog and because it’s bilingual the things I look at are what content people are looking at (particularly the language of the content), what the user’s...
-
Homepage Redesign
I recently redesigned my homepage to streamline it and give it a different look and feel. Here’s what the old site looked like since I converted it to Django back 3 or so years ago: No More Lifestream I based the original site on the concept of a lifestream after seeking Jon “Yongfook” Cockle’s homepage based in some PHP software he wrote called Sweetcron. I had started working in Python so I wrote similar functionality to Sweetcron into my own Django app called django-lifestream. It was my first Django app and I learned a lot making it so it wasn’t...
-
My Love-Hate Relationship with JavaScript
I have a love-hate relationship with JavaScript. Well, more hate and less love but I find myself conflicted when I write it. JavaScript simply makes it hard for me to write good code. As a little background, the JavaScript I write is almost exclusively meant to run in the browser. I don’t do node.js or rhino (I’ll get to that later). Writing Modular Code Sucks JavaScript makes it hard to write modular code. Most sane languages give you a way to sensibly scale your code base. They allow you to put code into containers that have clear APIs and their...
-
Google IO: Input/Output
This year’s Google IO page has a nifty little game that allows you to build a machine that guides a ball from an input chute to an output chute. I noticed right away that the tools you can use seem to have odd shapes as if designed for a purpose. You could also choose the primary colors that Google uses often. I figured that they were originally designed so that you could easily make a machine that was in the shape of the familiar Google logo so I went about trying to figure out how. I think I got something...
-
Django's contrib.auth and django-newauth
Recently there have been a lot of conversations on the Django mailing list about fixing the auth module. Here are some of the recent mailing list threads: authentication by email auth.User refactor: reboot auth.User: The abstract base class idea Originally the topic came up because of the fact that you can’t really authenticate effectively using the email address as a username. The username field is currently required and only allows for 30 characters which is too short for an email. Developers can put a unique dummy value in the username field and just use the email field to authenticate the...
-
Decentralized groups and Stand Alone Complex
The other day I watched the talk “The coming war on general computation” by Boing Boing editor Cory Doctorow. The talk itself was very interesting and I encourage anyone interested in the recent attempts to pass laws like SOPA to listen to the talk. Cory makes a lot of sense in his arguments and his delivery is very interesting and easy to digest. That said, what caught my attention was a comment he made after the talk when answering questions. He mentioned how he would talk about the hacker/activist “group” Anonymous and that people would constantly correct him about what...