Minesweeper

Once upon a time, back when the earth was young, the sky was new, and people weren’t quite as concerned about pollution, I bought a computer.

Back in those olden times of yore, this was actually an event worthy of merit. Believe it or not, I had salespeople who tried to convince me that I did *not* want the latest and greatest: that shit was for businesses. Why on earth would any individual every need 4 MB of RAM or a 500 MB hard drive?

That’s a different story.

They *did* introduce me to this weird new device called a mouse. I still have my doubts about it. It sits around somewhere between my keyboard, my latte, my kitty cat, my barrel of wasabi peanuts, my guitar, my pencil collection, and my wife.

I hope you’ll understand that I do my best to keep my hands very, very far away from any of that except my wife. (If you don’t, you’ve never been married…I’ll have another series of essays soon about how to deal with this flaw in your personal character…it’ll sell for a low, low price).

Once upon a time, I bet I once spent 4 or maybe even 6 hours at a time playing minesweeper, trying to figure out how a mouse works. There was always the thrill of seeing a new batch of free territory open up to keep me trying.

I’m pretty sure that, back in those days, I’d never have guessed that I’d be sitting here one night cursing some programming framework for setting up everything so horribly wrong so that creating a freaking minesweeper clone has taken more than 12 hours of my time.

Graphics and Lisp

I’ve been having fits with this for almost a year now.

I’ve written about some of the pain involved elsewhere. Someday, I may even dig up those angst-driven pieces for others to share my woes.

Until then. I think I may be onto something.

First, start with downloading the zip file from sourceforge (yeah, I know…they obviously aren’t very interested in playing nicely with others). Extract it somewhere. I stuck it in ~/downloads and extracted it into ~/downloads/extract.

Do a `lein new app best-name-ever` to initialize the project you actually want. Or add this piece to an existing project.

Inside your project, `mkdir native` to set up a folder where your native dependencies can live.

The lwjgl binary you extracted [from sourceforge…this entire thing is pretty ridiculous] should have a folder named ‘native’.

There should be a folder that matches your architecture (i.e. macosx, linux, or windows…if you’re using anything else, you probably think you know *way* more about computers than I, so why would you be wasting your time reading this?) under there.

Copy the contents of that folder into the native/ folder you created inside your leiningen project. Add an entry to the :dependencies vector. For me, that seems to be:

[org.lwjgl.lwjgl/lwjgl “2.9.0”]

Then I need to add that piece to…beats me. It looks like the kind of BS that drove me to get into higher-level languages in the first place:

:jvm-opts [~(str “-Djava.library.path=native/:” (System/getProperty “java.library.path”))

I feel bad for even thinking about publishing this. I can’t take any credit at all. Someone else devoted a lot of hours to figuring out that little detail. And I’m not giving that person anywhere near enough credit.

It’s not fair, but I’m really just trying to pass information along. And maybe add a little bit.

Since, after all, this is where the shit really gets interesting. Up until now, it’s all been configuration (and, if you’re like me, wondering how to make this work for consumers). That’s still just sysadmin stuff.

What about actual code? How does it match all those frustrating examples that just assume the imports (if they’re shown at all) magically happen and you can get busy doing your thing?

I pretty much have 2 lines of code to show at this point:

(org.lwjgl.opengl.DisplayMode. 800 600)

and

(import ‘[org.lwjgl.opengl)

No, those aren’t helpful at all. But they’re a start. And, dammit, newbs across the clojure community still struggle to try to figure out the what and how behind (import). Much less the why.

Hopefully this will provide a hint. Either to them or to me in the morning. Whichever.

Based on that import:

(org.lwjgl.opengl.DisplayMode. 800 600)

creates a new DisplayMode instance.

At this point, I was able to follow along with the basic examples at Roger Allen’s hello_lwjgl, and life is looking promising.

Religion in Programming Languages

I don’t have time for this sort of thing, but I keep stumbling across it anyway.

Programmers keep having flame wars about the drawbacks of various programming languages. (I should probably provide a link, but the entire discussion should really just die).

Newsflash: They all suck.

This is a basic engineering fact. No matter what you create, it’s going to suck at something. Everything in life’s a tradeoff.

Want a big brain? You probably aren’t going to fly on your own wings. Want to print lots of color pictures? You probably want separate black toner for the legal stuff. Want a happy marriage? You may have to learn to live without nuts in your carrot cake (though this would be a horrible tragedy…I think we can all agree about that).

Anyway.

I just ran across a blog post that boiled down to “PHP sucks almost as bad as VB6, and it doesn’t matter because you’re going to use it anyway.”

My personal inclination is “Meh…whatever.” *Most* programming languages that gain wide-spread use were not well designed. If elegance were the key, we’d probably all be using Haskell.

There isn’t anything interesting in what I’ve written so far. I’m just telling you what you already know. But there is some meat here, for a change.

I work with a person who honestly seems to believe that all programming languages are basically the same.

He favors PHP, and grades interviewees on their familiarity with that particular language. I strongly suspect that I got a “Pass” in the hiring process from him because I think it has its place. Never mind the referal bonus that I know he received.

At the same time, he’s a fairly rabid K&R C fan who absolutely hates the idea of thinking about performance. One of the things he loves most about C is the ability to link in an extra library to handle your memory management for you.

This particular attitude totally blows my mind.

In this day and age, I’m not sure why anyone who has any choice in the matter would ever choose C except for the ability to explicitly control memory. If you’re calling free() and malloc(), then you’ve probably missed the point.

Well, except that it isn’t C++. That’s something. But still. It just doesn’t seem like a *big* something.

I have some fairly serious doubts about the programming ability of anyone who claims that, for example, C, clojure, and python are all equivalent.

From the Turing Machine perspective, they *are* (at least mostly), but the reality of the concepts you can think about in each language is just vastly different.

The fact that he’s in the process of merging a whole bunch of functions back into one long one (which he promises will be elegant and beautiful) looks like another red flag to me, but that’s probably the subject for another post.

Still Too Much To Do

Here’s a conundrum.

I’m paying for blog hosting with dream host. I have another set of domains hosted (sort-of) over at linode. I’m wrestling with getting those servers set up.

I wonder which approach wastes more of the time that I just don’t have available for this sort of garbage. Do I keep messing with struggling with configuring an email server over there? See about setting it up here? I think I want to point the blog subdomain here, the way I have it now and point the www host there, using their DNS.

I should probably just get in touch with support here to see what they recommend.

I really just need email set up on a totally different domain so I can configure an account on a software-publishing domain that requires an ssh key tied to an email account. I wonder if there’s a reasonable way to get that submitted without actually setting up the email system.