February 2012
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
272829  

Categories

Archives

Where’d that null come from?

One of the most annoying things that can happen to a computer programmer is the dreaded NullPointerException, or in C++, the segfault that occurs due to dereferencing a null pointer. The null pointer error has this ‘feature’ which makes it a ‘pleasure’ to debug: the source of the null can be arbitrarily far away from [...]

The Progress Phallus

My friend Ray runs numerical simulations and wanted to have a decent progress bar for his code. A bit of web searching revealed some code, that takes care of this automatically. However, we thought that an ordinary progress bar is simply too conventional. We should gay it up with some ascii art into a beautiful [...]

Higher-Order Functions in Java

This Summer I’ve been teaching Intro to Computer Languages. It’s a really awesome class, with alot of good material in it. Last week, my students got back the results of their midterms, and were disappointed in their scores. Immediately, I heard some clamoring for an extra credit. Not only was the average midterm score [...]

A language should be focused on writing Internal DSLs

I’ve been reading Martin Fowler’s book, Domain-Specific Languages, this weekend. He covered a number of ways in which you can structure your code to achieve what he terms an Internal DSL. Quite a bit is focused on the discussion of a fluent interface. It turns out in many languages there are only so many ways [...]

Const-correctness

One of my fellow lab-mates has already posted about const-correctness, because of some similar issues. My work today, takes it a tiny bit further into sheer insanity.

If you don’t start your program off using a const-correctness discipline, it’s very likely that you will find yourself in a world of hurt when you try to [...]

Type-dispatch with Exceptions

I’m one of those Object Oriented programmers that consider type-inspection to be a design flaw. Much to my chagrin, I’ve found myself making occasional use of the Java instanceof keyword. In my most recent class lecture, we discussed Exceptions, and I later realized that one could essentially type-dispatch using the exception mechanism, because the catch [...]

Interface Extension

I’ve been programming an alpha-beta AI to play variants of connect-k games. For example, connect-3 on a 3×3 board with gravity off is tic-tac-toe, connect-5 on a 19×19 board with gravity off is the basis of go-moku, while connect-4 on a 7×6 board with gravity on is connect four.

Along the way, I’ve made myself [...]

Threaded Image Tiling

For quite some time now I’ve wanted to do a program that demonstrates Image Tiling using threads. Everyone should be familiar with the results of this technique, it’s used in Google Maps, Google Earth, NASA Worldwind, KDE’s Marble, and the like.

So, to begin I started off looking for example of how this is accomplished [...]

Bitstreams

This past weekend I spent an inordinate amount of time writing a small set of code that will allow the fetching of bits (rather than bytes) from a FILE *. For now this only supports reading, not writing. It’s meant to be used in an upcoming piece of work that transcodes mpeg video streams, into [...]