The other week I was working on my compilers homework – the semantic analysis part is an object-oriented nightmare. Something called the visitor pattern to traverse trees and do weird stuff. It made me want to curl up in a fetal position in the corner, rocking back and forth in a padded room, while mumbling [...]
Using Backbone to improve multiselects
Sometimes you need to ask a users for multiple answers to a single question. But what’s the best way to go about it? A multiselect input field is kind of strange for the user, sticks out and doesn’t really behave like everything else on the web. A bunch of checkboxes is better for the user [...]
What Refactoring is, and what it isn’t
This post is my first test of zemanta’s Blogspire, please tell me if you find this style of reblogging useful and I should do more in the future, or maybe I _should_ reblog, but differently. Thanks Nikos Maravitsas writes about What refactoring is and what it isn’t over at Java Code Geeks. Sometimes a programmer will [...]
Closure and currying magic for cleaner javascript
Sometimes you find a piece of javascript, a perfect piece of javascript, it does exactly what you need! Perfect! You could spend hours, even days, getting something to work and someone’s already done it, shared the code on the internets even! Hooray! But … the code looks something like this: // to populate later var data [...]
How to make your django app slow
The task every developer fears “Hey, I sometimes get a timeout when I want to see the last gazillion days of activity in the dashboard. What gives?” This problem started happening for a project I work on a few months ago. Through a lucky sequence of events I was able to push the problem back [...]
The commonest javascript bug
Every couple of weeks somebody will come running to me: “Swizec, Swizec, I did everything right, but this javascript isn’t doing what it’s supposed to! Whatever I click only the last item works. Halp!” Every time it’s the same bug – people just don’t understand how loops and closures play together in javascript. Invariably they loop [...]
Collatz, Haskell and Memoization
After an awesome longboarding session yesterday afternoon I decided to play around with infinite sequences in Haskell – it’s supposed to be one of the more (most?) powerful features of Haskell – because it’s a lazy language apparently. My first impulse of creating a primes generator was nipped in the bud by a long page [...]
Sabbatical week day 3: Raining datatypes
I’m taking a sabbatical week over the holidays. This week’s posts will serve as a sort of report of what I got up to the previous day instead of the usual schedule – wish me luck that I achieve even half of what I’d like to. As I sit here slowly sipping on my tea [...]
Learning me a Haskell
A couple of days ago I decided that doing my graduation thesis on a topic that, when suggested, brought a sparkle to my mentor’s eye and made him suggest I might want to think about picking a co-mentor just wasn’t hard enough – so I decided to do the whole thing in Haskell. I want [...]
Javascript’s lack of strftime
You know that one piece of shitty code that always makes you cringe? Something along the lines of months = ['Jan', 'Feb' ....]; dateString = date.day()+’ ‘+months[date.month()]; Yeah that piece of code. Let’s talk about that. It sucks. There is a special circle of hell for people who do it and yet JavaScript developers are forced [...]
