Why I hate ant


$ strace -f ant > out.txt 2>&1
$ grep "stat.*java" out.txt | wc -l
32933

WTF? No wonder our build times suck. I still have yet to hear a rationale for the existence of ant that had any more substance than “but make uses tabs!”

Phoneless

My Nokia 6230 apparently bit the dust last week, so if you called me, I didn’t get it. The phone no longer turns on, even with a freshly charged battery and with a new memory card. Darn. I have a crappy $40 unlocked phone on the way in the mail to tide me over until I can get something decent or fix this busted one. Anyone know when an android-capable phone is going to hit the market? Maybe it’s time to sign up with grand central

Robots!


Talking Robot 2
Originally uploaded by bluesterror

Angeline and I went to the KC to see the ballet last night. They are having this celebration of Japan’s “hyperculture,” whatever that means. But one thing it means is there are robots there!

Actually, the robot display is somewhat disappointing. Asimo and the trumpet player thing are there for occasional demonstrations, but they weren’t out on the floor when we were there. So, the only robots we got to see were this little yellow thing that supposedly can talk (only in Japanese, however), a small menagerie of Aibo-like toys, and the creepy “Actroid” DER2, pictured. DER2 does look somewhat realistic, actually, but you wouldn’t mistake it for a real person. You can ask it canned questions, then it will do the speech recognition stuff and say a canned response. Eye-rolling stuff such as, “I’m looking for a guy with a heart of gold and brain circuits to match!”

Still, robots!

Scripted

A month or two ago I was thinking about test-driven development and what a pain it is to write test cases. Or, well, test at all for that matter. Who needs testing when you have users to do that for you?

At work we have this fairly complicated UI that eventually interacts with stateless session beans in the whole wizbang J2EE world. Usually, I spend most of my debugging time tickling the backend rather than fooling with the UI so all tasks of logging in, navigating windows, setting up data and so forth are just overhead.

One previous company I worked at had an excellent solution to automating all of that without winrunner or other similar crap: everything in the GUI created a command string that was then fed to a command parser to perform the task. You could use these command strings exactly as a script to control the app. Had a crash? Just replay the customer’s log to see the segfault.

So I had the rather obvious idea: use an EJB 3 interceptor with XStream to record method calls, their parameters and return values to the server logs. Later, we can execute these logs to replay all the SLSB calls and check the return values. Ta-da, we have some automated tests without even trying. Not full coverage of course, but better than nothing at all.

Another developer got the lucky task of implementing it, but I’ve just started using it today. Very slick. Now we just need a Lisp interpreter and an email client.

mmio trace for fun and no-profit

I’m not sure what got me interested in assembly language as a nerdy high-schooler. It could have been the growing interest in computer graphics, at a time when you had to use assembly to get decent performance out of the machine. I remember learning tricks from much smarter people than myself, such as how to set a 256×256 pixel video mode so that you could address any pixel without ever needing to multiply. Not that you would use a multiply anyway since you can always use shifts and adds.

I suspect, however, that part of what spurred me on was an interest in reverse-engineering, specifically to crack games. You would start BattleChess, say, and it would ask you for some move from some historical chess game in a big book before letting you play. This was to ensure that if you copied the game, that you at least also photocopied your friend’s manual. [For the record, while I cracked a few games, I never released any such cracks. More from being l4m3 than any teenage sense of ethics. I did, however, release instructions for patching the video game “Home Alone” so that you could never die. I may have been the only person on the planet to play that one all the way through.]

In order to crack a game, first you would load up SoftICE, a killer software debugger that would let you debug almost anything. It would let you set breakpoints on interrupts so step one was to put a breakpoint on ‘int 10h’. Interrupt 0x10 was a call into the video BIOS for setting up the video card. Back in the DOS days, it was the first thing every graphical program (and therefore game) did, because you started out in text mode and had to go into VGA mode. The BIOS would know how to load all the registers for that particular card; you just had to say “put me in 320×200 mode, now, thanks!” and that was via the assembly command “int 10h”.

After SoftICE caught the interrupt, the screen would switch back from VGA mode into a text mode listing of assembly instructions and raw machine code hex values. I don’t think I knew what all these meant at first, but I understood ‘call’ and ‘jmp’, and everything else I quickly learned from a text file describing the x86 instruction set architecture. So cracking then became a matter of just single stepping through all of these instructions, and waiting for BattleChess to get to the part where it asks you the question. Then, you start paying attention, looking for the assembly equivalent of “Is the answer right? If so, goto game! Else goto nasty message!” Some of these were harder than others, but generally it looked something like:

mov ax, ds:[43ac]
mov cx, ds:[3401]
cmp ax, cx
jnz 0027

You could step through it, type the wrong answer, then watch it jump to instruction number 27 which then printed out the nasty message. Then you could try again, and this time modify the code while you’re in the debugger. For example, change the jnz 0027 to a few no-ops (instructions that do nothing). Type in the wrong answer, and now it keeps on going to the game. Bingo, the game is cracked! SoftICE was such a nice debugger that I even used it for C debugging until I finally moved off of that whole DOS thing.

Anyway, I’ll never be a Jon Johansen, but that interest in reversing stuff has stuck with me. I think that figuring out how the Karma worked, which involved many hours of pouring over hex dumps trying to come up with the pattern, was much more fun than coding the driver. Particularly when the “ah-hah!” moments would strike. Incidentally, coding the driver was/is still fun, probably more so than actually using the device.

This little walk down memory lane was inspired by the recent entrance of mmio-trace into my zone of consciousness. I’m not sure who used this first, but the Nouveau project has been using the utility for some time to reverse-engineer the NVidia video cards so that Linux can gain decent open source drivers. My laptop luckily has an Intel based video card, but it does have an Atheros wireless chip which also has a binary blob. There’s currently an effort to produce a reverse-engineered driver for it as well. In my case, the new driver almost worked, but I needed to come up with some other details, so I tried out mmio-trace.

PCI cards are configured by register writes, but the driver generally has to program it to get it going. The BIOS can’t do that work for us any more. So the OS maps a region of memory that the driver can just write into, which then all gets converted magically into writes into the PCI device’s register file. Thus, MMIO=”Memory Mapped IO”, and mmio-trace does what it sounds like. Using it is rather painless, you first ‘hook’ a module you want to capture, modprobe mmiotrace, then load the hooked module. All writes to PCI config space get captured into a debugfs file that you then run through a user-space filter. The end result is a nice report of all of the reads and writes to the registers of the PCI device. Very neat!

Oh, the driver maintainer already knew about the issue and confirmed my proposed change so hopefully by 2.6.26 ath5k will support my Macbook.

I hate you, Sun.

Is it too much to ask of a compiler that if it decides to blare warnings at you for no reason at all, that you can turn the !@#$ thing off? In a move that rivals the stupidity of certain gcc warnings, we have this:

[javac] file: java:519: warning: com.sun.rowset.CachedRowSetImpl is Sun proprietary API and may be removed in a future release

Well, hey that’s a nice heads-up to give me 600 times when compiling our tree. Let me go find the non-com.sun equivalent of that. Oh wait, there isn’t one! And, the freaking javadoc even tells you to do it that way. Okay, well, maybe @SuppressWarnings({"deprecation"}) will work? Nope, haha! Sigh. Time for a wrapper script.

Request of persons who wish to write a better javac: can I have plugins that let me muck with the AST? Custom static checking would be nice…

Back

I am back in the country after wintering abroad. Toronto: still cold.

While away I managed to get some work done on the latest installment of the Rio Karma project: a FUSE-based implementation of the “Optimized” MPEG Filesystem. This one has the advantage that it theoretically will work with the busted every-byte-swapped ReplayTV, and that it takes approximately 10% more time than the kernel driver for a given task. There still isn’t an official release because it will destroy your hard drive and wipe off the serial number so you won’t be able to replace it. Plus it gives another excuse to use git, which has finally replaced svn in my day-to-day.

Meanwhile, work is continuing to suck, with two more people gone this week. So, I’ll be on the market shortly. I’m not sure what I want in a new job but my usual criteria apply: linuxy, interesting, not evil, and convenient commute-wise (I’m about 1 for 4 at current job). I don’t particularly care if it makes millions or not.

Not a whole lot is going on otherwise. Santa brought us a Wii and the wife kicks my ass in tennis. Weird that no matter which controller I use, it’s always the broken one. Just like when playing soccer on the Sega in college…

Gave One Got One


00025.jpg
Originally uploaded by bluesterror

I just received my OLPC from the “Give One Get One” program. For the uninitiated, this is the program that aims to send $100 ($200) laptops to children in undeveloped nations.

First thoughts are that this is a cool little laptop. It is very light. The screen is small but has decent resolution, in the 800×600 range. The processor is an AMD Geode 400 mHZ, it’s got a gig of flash for storage, and 256 megs of RAM. It seems a tad sluggish for a machine with those specs (similar specs to my firewall at home which runs X fine), but not so slow that you couldn’t get used to it.

The UI is neat, running on top of Linux and I understand mostly written in python. There’s a video recording app (did I mention the thing has a camera?), word processor, browser. There’s a little python IDE with some sample programs (basic math, print Pascal’s triangle and Fibonacci numbers, etc). And a terminal where you discover that the device has vim installed but no gcc. C programmers everywhere cry.

All in all, it’s probably not going to work for anyone who already has a laptop, or any adult for that matter without using a USB keyboard since the keys are so small (mine is eventually going to my nephews). But I think if I got this at age 6, it would spark my imagination as much or more than the C=64. I think we’ll see a lot of computer professionals emerging from these countries in 20 years.

(A few more pics at flickr.)