Fixing Minecraft on Ubuntu with OpenJDK

Minecraft! On Ubuntu! It actually runs great, once you actually get it to run, but there were two little things mere mortals can’t be reasonably expected to debug.

Can’t connect to minecraft.net

My Internet connection worked, minecraft.net was up, friends were able to connect just fine, but I couldn’t. Running it from the terminal via java -jar minecraft.jar showed the error message java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty.

Basically, Minecraft uses SSL to protect your login, but Java didn’t have the certificates needed to verify. The Minecraft launcher really should give a better error message, but this was really Ubuntu’s fault. You need the ca-certificates-java package installed, but on my Ubuntu install, it was broken. Try doing ls /etc/ssl/certs/java/cacerts. If it comes up missing, then you need copy it from a friend or a different Unix machine. You don’t want to copy security files from strangers…

Black screen

Looking in the terminal showed the error java.lang.UnsatisfiedLinkError: ...: libjawt.so: cannot open shared object file: No such file or directory. There’s no good reason why an OpenJDK install can’t find its own damn libraries, but you can manually set your LD_LIBRARY_PATH variable to contain it.

Try doing locate libjawt.so. You’ll want to set your LD_LIBRARY_PATH to include one of the directories it gives you (just the directory, not included the file). Depending on whether you have OpenJDK 6 or 7, you’ll do something like:

LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/ java -jar minecraft.jar

Again, check the results of locate versus your OpenJDK version (if you’re not sure, run java -version).

Getting the Sparkfun EL Escudo to work

I’m really disappointed in Sparkfun. I recently purchased the EL Escudo shield for driving EL wire with a microcontroller, and woe be upon anybody who doesn’t do hours and hours of Internet research before plugging the thing in. There were 3 years of questions from poor customers with only a few answers, and the few answers that were there were often contradictory. Here are my conclusions from my Internet research, and the amazing Will Byrd helped me finally get it to work. Long story short, Sparkfun sets you up to fail and hasn’t fixed things in 3 years.


Continue reading Getting the Sparkfun EL Escudo to work

Ubuntu works great with the MSP430 Launchpad

I got my MSP430 TI Launchpad more than a year ago simply because of the price. It was (and still is) $4.30 (with free shipping!) for a development board, two MSP430 microcontrollers, external crystal, and USB cable. Unfortunately, Windows was the only supported OS at launch time with a couple proprietary bundled IDEs. It still is the only officially supported OS, but setting up Ubuntu 11.10 and newer for the msp430 has become trivial:

sudo apt-get install gcc-msp430 gdb-msp430 mspdebug

To test your Launchpad, try compiling “blink” from https://github.com/mrothe/ti-launchpad.

The build process goes something like:

msp430-gcc -Os -mmcu=msp430x2012 -o main.elf main.c
msp430-objcopy -O ihex main.elf main.hex # generate hex file
mspdebug rf2500 "prog main.hex" # download to the launchpad

Do mind your O, o, and 0.

Why are you bankrupting yourself for college?

What do universities want? The same as what everybody else wants, really. Power. Fame. Money. Well, the money’s actually a means to the first two, because you obviously don’t become powerful and famous (sorry, “prestigious”) without money.

How do universities rise up? They hire and sponsor press-worthy research and researchers, and save up money to build shiny new buildings every so often. That takes a lot of cash, so they have to keep the dough rolling in.

Universities generally rely on four or five sources of funding: Continue reading Why are you bankrupting yourself for college?

Dreamhost is so 2004

Today marks my final move from uncool, mainstream shared hosting to the fantastic world of pay-what-you-need technology mash-ups.

Shared hosting…

I used to have shared hosting at Site5. They were OK. I really can’t complain much except that their dashboard functionality for hosting multiple domains on one account seemed archaic. I signed up almost exactly 5 years ago on their The Five Dollar Web Hosting Deal, which offered seemingly huge allocations of 55GB of disk space and 5TB of bandwidth. The plan has long been discontinued and Site5 followed the rest of the industry towards “unlimited” shared hosting, but I never “upgraded” because I never hit those limits and the newer $5 plans couldn’t host multiple sites. Site5’s interface got slicker and their servers got stabler, but I eventually wanted to go beyond ordinary shared hosting.

Shared hosting has been such a smoke-and-mirrors industry designed to lure in inexperienced webbies with promises of “Unlimited!” and “One-click blogs!”. Sure, for many people, it’s perfectly fine for putting up some information about the local Habitat for Humanity or chess club, but even then, wouldn’t a free Tumblr or Google Sites account be just fine? Regardless, I decided to get more hands-on with my new setup.

Continue reading Dreamhost is so 2004

cd && ls

I’ve noticed that I have a habit of changing to a directory and then immediately listing it’s contents. Wouldn’t it be nice if I could do it in one command?

My goto for shell automation is usually shell scripting. Shell scripting is nice because I can use any language I want, and I don’t have to worry about losing everything if I switch shells or something. Shell scripting isn’t suitable for this, however, because writing cd in a shell script will just change the script’s working directory.

I notice that a lot of people like to use aliases for various little things like command abbreviations, but aliases can’t interpolate arguments. Without control over arguments, I can’t give cd the argument and then ls after that.

The final solution I wrote is a bash function in my .bashrc, and while it’s bash-specific, I doubt I’ll ever need to port it to another shell (and it shouldn’t be difficult to do either).

cl () { cd \$1 && ls; }

Now I just need to train my fingers to type “cl” instead.

Using the Chez Scheme debugger

Achtung! Chez Scheme and Petite Chez Scheme do not give the same debugging information. Petite Chez Scheme is often much less helpful than Chez Scheme, and is probably half the reason why nobody actually tries debugging programs in Chez Scheme.

Here’s a sample, buggy program:

(define myreverse
  (lambda (ls)
    (if (null? ls)
      '()
      (append (myreverse (cdr ls)) (cons (car ls) '())))))

(define mylist (cons 1 (cons 2  (cons 3 (cons 4 5)))))

(display (myreverse mylist))

Let’s try loading it in Chez Scheme.

$ scheme
Chez Scheme Version 8.0
Copyright (c) 1985-2010 Cadence Research Systems

> (load "example.ss")
Exception in car: 5 is not a pair
Type (debug) to enter the debugger.
> 

Obviously, (debug) invokes the debugger. Once we get in there, however, it’s fairly cryptic.

debug> ?
Type i  to inspect the raise continuation (if available)
     s  to display the condition
     c  to inspect the condition
     e  or eof to exit the debugger, retaining error continuation
     q  to exit the debugger, discarding error continuation
debug>

Usually, inspecting the continuation is the most helpful thing to do, because once we’re in there, we can get a stack trace to find out where the error occurred. The command to print out the stack frames is sf.

debug> i
#<continuation in myreverse>                                      : sf
  0: #<continuation in myreverse>
  1: #<continuation in myreverse>
  2: #<continuation in myreverse>
  3: #<continuation in myreverse>
  4: #<continuation in myreverse>
  5: #<system continuation in map>
  6: #<system continuation in compile>
  7: #<system continuation>
  8: #<system continuation>
  9: #<system continuation in dynamic-wind>
  10: #<system continuation in dynamic-wind>
  11: #<system continuation in $reset-protect>
  12: #<system continuation in new-cafe>
#<continuation in myreverse>                                      : 

Knowing the stack trace, we can move down the stack frames using down, which is important if the debugger drops you in an error handler under the actual source of the problem. This information is often enough to debug your program. From here, we know that the error occurred when we were five instances deep in myreverse, so the problem was with the end of the list. But if you wanted more specifics, you can type s for show:

#<continuation in myreverse>                                      : s
  continuation:          #<continuation in myreverse>
  procedure code:        (lambda (ls) (if (null? ls) (quote ()) ...))
  call code:             (cdr ls)
  free variables:
  0. ls:                 5

Now we know for certain that we attempted (cdr ls) but ls was actually 5, and (cdr 5) is wrong.

Let’s try example2.ss:

(define pass-me-a-closure
  (lambda (thunk)
    (break)
    (thunk)))

(pass-me-a-closure
  (lambda ()
    (let loop ((x 5)
               (a 1))
      (if (zero? x)
        a
        (loop (sub1 x) (* a x))))))

Notice that we’ve set a breakpoint in the code using (break). This triggers the debugger, but only if we’re running Scheme interactively. If you try running scheme example2.ss directly, it will exit when it hits the breakpoint.

At the break point, we do the usual inspect and sfow frames.

[[email protected] ~]$ scheme
Chez Scheme Version 8.4
Copyright (c) 1985-2011 Cadence Research Systems

> (load "example2.ss")
break> i
#<continuation in pass-me-a-closure>                              : sf
  0: #<continuation in pass-me-a-closure>
  1: #<system continuation>
  2: #<system continuation>
  3: #<system continuation in dynamic-wind>
  4: #<system continuation in dynamic-wind>
  5: #<system continuation in $reset-protect>
  6: #<system continuation in new-cafe>
#<continuation in pass-me-a-closure>                              : s
  continuation:          #<system continuation>
  procedure code:        (lambda (thunk) (break) (display (thunk)))
  call code:             (break)
  free variables:
  0. thunk:              #<procedure>
#<continuation in pass-me-a-closure>                              : 

Right now, it doesn’t actually tell us what thunk is besides just #<procedure>. We need to rnspect that particular free variable by its number or name by issuing r 0 or r thunk and then printing the code.

#<continuation in pass-me-a-closure>                              : r 0
#<procedure>                                                      : c
(lambda () ((letrec ((loop (lambda (...) (...)))) loop) 5 1))     :

Notice that the let-loop form has been expanded (remember, the macro expander has already run) and on top of that, the part we actually care about has been elided. Also, the current object is now the code, instead of #<procedure>. Because of that, we can pretty-print the current object, and it will pretty-print the entire object.

(lambda () ((letrec ((loop (lambda (...) (...)))) loop) 5 1))     : p

(lambda ()
  ((letrec ([loop (lambda (x a)
                    (if (zero? x) a (loop (sub1 x) (* a x))))])
     loop)
    5
    1))

You can always go back up to the parent object from here.

In Chez Scheme, inspect is also available as a procedure that will launch the debugger and inspect whatever is passed to it. For example, writing (inspect thunk) into the above code would immediately launch the debugger on thunk. Likewise, doing (call/cc inspect) will launch the debugger and inspect the current continuation (which you can then trace).

Now you should know how to enter the debugger, inspect the stack frames, and inspect variables inside the stack frames, including the procedure code and call code. When in doubt, randomly hit keys or ask for help? Expect a pop quiz over this.

Arrow Endianness: How GNOME got sorting backwards

Conventions are important, even when it seems like it doesn’t matter one way or the other. Just look at all the people who complain about the nerve of Steve Jobs to place the close-window button on the left.

There’s no reason why the left side is better than the right side. Convention, however, says that you must choose one way and live with it, or else you’ll be forever forced to constantly convert between left-handed and right-handed traditions. Just ask anyone who’s ever had to write low-level networking code. When sending an integer, it doesn’t matter whether the big end or little end goes first, but if you don’t agree with the other party, your message will come out garbled.

So imagine my discomfort when I have to sort files in Nautilus or sort processes in System Monitor.

Continue reading Arrow Endianness: How GNOME got sorting backwards

Venturer HPS9308 GPS navigation system

If you ever want to modify or upgrade your Venturer HPS9308 GPS navigation system, you can easily do so by modifying or replacing the software on the SD Card. However, there are some settings that aren’t obvious and aren’t directly modifiable, so you have to follow a couple things.

It seems like the default Venturer shell, when you choose “Navigation”, looks for SDCard\MobileNavigator\MobileNavigator.exe and runs it. Thus, if you want to replace the software that gets run, you should place the executable at that path. In addition, the GPS device is on port 1 with a baud rate of 4800, at least according to a working config file I found. For reference, that was in SDCard\MobileNavigator\sys.txt with the section
[gps]
port="1"
baud="4800"

Gaming hasn’t changed

This is about an essay I wrote a couple years back about gaming, under the theme of work and play, and it’s about how video games are just a subset of gaming, and how they conceptually fit within philosophical frameworks established in the mid-20th century. Among other things, it goes into why World of Warcraft directly maps onto the four categories of games set forth by Roger Caillois in 1958: Agôn, alea, mimicry, and ilinx, which could be described as competition, chance, role-playing, and thrill.

It’s not a perfect paper and gamers might roll their eyes at reading a description of what an MMO is. There are surely some things that I would revise if I had the chance, but the version presented here is untouched from my original, save for formatting. It’s not a journal paper nor is it a book review, but I hope that some find it interesting. There is a lot that has been written on this subject, and there is much more that could be written. This is just a piece towards the theory that the core components of a fun game are readily identifiable and, with that knowledge, anybody can assemble a fun game.

Some quotes from the paper
Profit Versus Play: Business and Gaming in MMOs (application/pdf, 87 KB):

On whether MMOs qualify as games in a traditional sense:

David Golumbia, who is incidentally among such de-
tractors, could not examine this issue without first defin-
ing the French word jeu in the context of Jacques Der-
rida’s deconstruction of “play.” Fundamentally, Golumbia
establishes jeu as both “play” and “games” (and not con-
trivances like “freeplay”) and this paper will assume the
same: that “games” and “play” are merely different parts
of speech referring to the same concept without carry-
ing any intrinsic differences. And, as we’ll see, MMOs
like Ultima Online and EverQuest are certainly games in
the traditional sense as they fit like clockwork into Roger
Caillois’ categorization of games.

On the never-perfect divide between game and real:

This “contagion of reality” that plagues MMOs has
been and will continue to be money. “The minute you
hardwire constraints into a virtual world, an economy
emerges,” explained Castronova to Wired. “One-trillionth
of a second later, that economy starts interacting with
ours.”

And on harnessing Nietzschean behaviors:

It’s this type of accumulating points system that
Golumbia described as an exploitation of Machtelgust, or
the “lust for power” from Nietzsche’s writings. Golumbia
colored computer games in general as being deceptively
simplistic and degenerate. A single-player first-person
shooter (FPS) like the classic sci-fi game Half-life, while
appearing to offer freedom and a story to the player, is re-
ally a very rigid, pre-scripted experience of just shooting
anything that moves with a superficial and shallow plot
tacked on. Likewise, he wrote, MMORPGs are mostly
single-player experiences, despite the name, filled with
repetitive quests in a “surprisingly rigid, uncompromis-
ing, and even authoritarian” world.