Sunday, September 18, 2011

Quicklisp

I think Quicklisp is incredible. I may have to add this

(ql:update-all-dists)

to my list of things to do once in a while. If only I had an automatic alert when a new sbcl version was released. Painful is the way when you are one or two point releases back.

Tuesday, August 23, 2011

Sometimes I'm ashamed

to write such ugly things. This clearly was a trial-and-error design. Strip away all the comments, and mourn your 'cleverness' ever after.

long fib(long n){
long a[3] = {1, 0, 1};
int i = 1;
while(n > 0) {
a[(i+2)%3] = a[(i + 1)%3] + a[i%3];
i = (i+1)%3;
n--;
}
return a[i];
}


Of course, you could define a class of integers mod n, and replace int i with
modular i = new modular(3);

Saturday, August 13, 2011

Adwords sometimes gets me laughing



Notice the ad? I keep clicking on the spam folder, and I keep getting great recipe ideas for Hormel's magic meat.

Friday, August 12, 2011

C++

It looks like I will have to add STL/C++ to my repertoire to deal with the Data Structures class I start in a little over a week. I picked up the second edition of Stroustrap's book (dated but beautiful) for $2.5 from a local used book store and will chew through it. Sometimes it's funny how much I enjoy dead tree editions of computer books, even with the lack of copy paste. I have an electronic 3rd edition, but I think I'll get through this in the meantime.

So, when playing around with Java over the years, I've actually found BlueJ to be one of the best working environments, largely due to the support for runtime creation of objects, and allowing exploratory programming. I think I'll use a mix of Code::Blocks and good old Emacs for the time being, but does a better solution exist? One in which files are presented as the parts of a class hierarchy and methods can be invoked in an interpreter. Code::Blocks seems straightforward enough for creation of boilerplate constructors, destructors, assignment operator, and copy constructors, automatically making headers and implementation files and including header guards.

As an aside, is there an IDE with built in support for TDD in C++? It seems like TDD might be my next side adventure in self-growth. I recently saw a few people from 8th Light give a live demo in python and ruby of a simple TDD walk-through for a trivial change counter. Having never taken principled software creation practices seriously (no more than sane names and proper decomposition of functionality, an 1970's level solution), this was intriguing. Not going to run out and buy Uncle Bob's books, but I'd like to see what proper unit test first program design feels like.

Constantly I need to suppress the 'knowledge' that C++ is a steaming pile of horse manure to dive forward and gain competency. Really, could you find a way to write const any more times in a declaration? Isn't there a better semantics for specifying this sort of compiler hint? One const to say that the arguments are unchanged, one const to say that the object is unchanged, one const to say that the return type is immutable. All using the same word, all dependent on context. I pity the programmers who are forced to think like the compiler to get work done. Although I was reading a talk by Kiczales Why are Black Boxes so Hard to Reuse where he points out numerous times the danger in an implementation deciding in advance what a typical use case will be.

Tuesday, August 09, 2011

Music

I've been toying with a few music services lately (I used to enjoy last.fm but it seems to have stagnated lately, and the gnome move away from rhythmbox leaves a poor substitute in banshee for this service.)

So two that I have tried are shuffler.fm and wearehunted.com, both installable via the chrome web store. At first I thought We are hunted was really good, but I get a little sad about the selection (seems to be finite, and non-adaptive to rating). Of course, there may a dozen ways to personalize my experience that I haven't explored, but I haven't toyed too much with it.

Shuffler.fm seems to aggregate music blogs, and pick music linked from them. The plus side of this is that a good deal of the music is downloadable while you listen. Since I'm one of the five people on the planet without an iPhone and permanent internet connection, downloads still seem like a great idea to me (it turns out that buying 1-2 terabytes of storage per year is cheaper than mobile internet).

All in all, I appreciate being exposed to these services, and the new music they are introducing to my ears.

Sunday, July 24, 2011

Troubling

I just noticed that my bag of coffee beans from Aldi has clever badges stating that it is a gluten and lactose free food. I'm suddenly reminded of xkcd's take on this trend .

Saturday, July 23, 2011

Sadness

One of the worst parts about running a nonstandard operating system on a nonstandard architecture is compiled packages. Amazon correctly noticed I appeared to be running linux, and went more than half way in offering a compiled .deb file for debian/ubuntu. Alas, 4 seconds later, I find it's a 32 bit package, and can't find a 64 bit package. A few fumbling --force-architecture mistakes later with dpkg, and I now have installed a mess of broken dependencies.

How did I dig myself out of this? Launch wine, install firefox for windows, install cloud player/mp3 downloader, and go. Interestingly, wine (as close as I can tell) only supports win32, while my linux seems to choke on dynamically linked 32 bit executables. Years ago I had a debian 32 bit sandbox installed in a chroot environment for dealing with this, but the sands of time make even Ozymandias look weak.