• I'm porting some old C++ code to Java. How old? So old that it doesn't just assume a long is 32 bits, it actually checks to make sure and bails if not. That's 1997 or so, by my guess.

    I can already hear the programmers in the audience asking, "Why not just interface with the library using JNI?" We decided to port the code because we must support Unix and 64-bit environments, and the library specifically fails on all our Unix machines. We do have the source, so we could modify it... but then we'd be forced to deliver and maintain it, which carries its own set of headaches. So I'm working on 20,000 SLOC.

    (Anybody wondered why the site has been so quiet for so long? It's because I'm porting 20,000 SLOC of OLD C++ to Java.)

    Most of the code has been pretty straightforward. There have been the usual problems with C++ unsigned types, which don't have any corresponding Java type, as well as a bit of pointer arithmetic confusion. When I get confused, I just write a quick test program and make sure the C++ does what I expect.

    The thing that blew my mind today was the weird use of the "magic number" 0x80000000.

    Continue reading "Unsigned Subtraction in Old C++ Code"

  • In part 1, I explained how key-based SSL authentication works. In part 2, I intend to explain how to implement a certificate authorized SSL connection in Java.

    If you haven't read part 1 yet, you might want to check it out. I'll still be here when you get back.

    Continue reading "Using SSL in Java, Part 2"


  • Working (as I do) with secure equipment, it was inevitable that I'd eventually have to connect to a server using SSL. I didn't even get to write my own code; I had to use a Java client library that was provided to me.

    The programmers of my client library weren't exactly forthcoming on where I could change its configuration, but at least they had provided me with the certificates I needed. I had to do a lot of research to find out how to use them, and I'm recording that information here.

    After all, isn't learning supposed to be cooperative? Read on, and I'll show you how to work with SSL sockets in Java.

    Continue reading "Using SSL in Java, Part 1"


  • I was thinking about the depth perception techniques we use for automated vehicles. The one that one the DARPA Grand Challenge used a laser rangefinder, as well as a camera; many of the contestants used lasers, radar, or a combination of the two.

    It's generally well-known that human depth perception is provided by two eyes at an offset (binocular vision). There was one Grand Challenge car that used two cameras as its sole sensing equipment; I liked that solution, not only because of its simplicity, but because it modeled human vision. (They finished second, as I recall.)

    However, wouldn't it be simpler to do it with a single camera?

    Continue reading "Monocular Depth Perception"

  • We recently clogged our kitchen sink. We just put too much stuff down the disposal, I think.

    I bought a snake, disassembled the drain, and went to work. It was DISGUSTING! About 10 feet in, I found a clog, and managed to do a little something... but not enough. It wouldn't drain.

    I tried using the CLR compressed-air kit. It blew a bunch of water out the roof air vent. Very impressive, but not helpful.

    I used an entire bottle of Draino gel. It sat overnight, but the water didn't move.

    We called a plumber recommended by a friend: Ace Plumbing in Kissimmee. They were HORRIBLE. They charged $80 to come give us an estimate -- that should have been our first clue that something was wrong, since the guy just opened up his notebook and quoted a fixed price directly from it. Oh, and it costs $750 for Ace Plumbing to snake your kitchen drain!

    We later found out Lowe's will do it for $150. But it's hard to make this kind of comparison when you've already paid $80 just for the guy to show up, and then he's standing there waiting for you to make a decision.

    He also broke the seal on the kitchen sink drain, then claimed that I had caused the damage when I added the Draino. He further claimed that the seal couldn't be purchased separately, and quoted $150 to replace the drain.

    We found the seal later for $15 at Ace Hardware in Oviedo -- a fine institution, which has been helpful to me many times in the past. Despite the name similarity, they have no relation to the nefarious organization that I mistakenly hired.

    I'm considering whether there's some way I can retrieve the lost $600. Could I claim fraud in small claims court? Probably not: I hired him and signed the receipt without comparison shopping. Sigh.

    I still feel like I've been ripped off. I'm never using them again.