23 February 2006

Solaris upgrades

Well, the blush is off the rose, Solaris-wise. I have spent the last couple of nights whacking my Ultra 20 with a blunt installer, to little effect. First, I installed the Ultra 20 1.2 supplemental update (updates the BIOS and installed new drivers for the built-in hardware). That went all right, but when I rebooted I couldn't get the network interface working. I quickly figured out it was something with DNS (I could ping my router and print server just fine, but anything not in /etc/hosts was unreachable). So after a couple of hours tweaking this and poking that and whacking the other, I found out that Solaris doesn't like the DNS server that RoadRunner provides. It's there, and my wife's Windows box doesn't seem to have a problem with it, but Solaris won't talk to it. Fortunately, I have an alternate public DNS server configured, but unfortunately Solaris won't use it. For some reason, it thinks that the RR server sends it a valid 'domain not found' response. Once it gets a response from a server, it uses that server for all further requests. I finally used nslookup(1) to query my alternate name server, and then Solaris started to use it. Chalk up two hours to "learning experience".

Last night, glutton for punishment that I am, I installed the new Solaris Update utility. It analyzed my system, then ran off to Sun to find out what I needed. 57 patches! So I let it download them all and install what it could. Then it said I needed to reboot to install the rest. Since I'd already blown my uptime (148 days), I didn't think it was any big deal. So I reboot, and the box says it's in system maintenance mode and starts installing patches. It installs a bunch, then seems to just sit there. It looks like all the patches have been successfully installed, so I go ahead and reboot. When the system comes back up, it's a lot different: it's now using the Grub boot loader, and no longer shows the boot messages as it comes up. It also tells me that it can't initialize nge0 (the network interface), which I'm not looking forward to digging into again. Then, it tells me to wait while the X server starts, followed in a few seconds by the notice that the X server cannot be started. Not Good. I've got a job application to fill out, and my email to check, I really can't be wasting hours sorting out some system misconfiguration issue. So I scarf the wife's laptop and go trolling for clues. While dredging through the Sun "Miscellaneous hardware" forum (where all the workstation issues go), I find a mention of a Yahoo! newsgroup dedicated to x86 Solaris. So I hie myself over there, and lo and behold, someone else has reported this same issue! Unfortunately, there was no resolution posted, but someone did point out there was a utility (kdmconfig) that would allow you to switch to the Sun X server (Solaris 10 uses the X.org server by default). I did that, and was able to get X up (albeit at 1024x768 instead of the 1600x1200 I favor). So I got back into the patch tool and backed out the two patches that looked most likely to be responsible. When I rebooted, the Sun X server started, so I went in and set the default back to the X.org server. Which then failed to start again. I checked the log file, and it seems to indicate that the nVidia driver (I am using an NVS280 card) was found and initialized itself, but it can't find or initialize the graphics card. So I switched back to the Sun server and resolved to call Sun Support.

07 February 2006

Hack of the day

Well, this hasn't happened in a while. I had an idea, wrote it up in vi, then compiled and ran it, and it compiled cleanly and worked the first time! Obviously it's a trivial example, but it's kind of neat, so I thought I'd share.

Background: On my current project, we have some boilerplate logging code that has to go into every method. It looks something like this:
logEvent("Module", ErrorConstants.EVENT_START, "Method name");
I got a comment on a code review that I should be defining string constants for my module and method names, since string constants should never be directly used in code (yes, that's the kind of shop we have here...)

The idea: I had had another idea regarding allocation tracing, and I remember that (since Java 1.4) you could get access to the call stack via a Throwable. A quick glance at the JavaDocs showed that you can get both the class and method names from the stack trace. This led to the quick&dirty code shown here:


private String getMethodName() {
Throwable t = new Throwable();
StackTraceElement[] ste = t.getStackTrace();

String methodName = ste[1].getMethodName();

return methodName;
}

private String getModuleName() {
Throwable t = new Throwable();
StackTraceElement[] ste = t.getStackTrace();

String moduleName = ste[1].getClassName();

return moduleName;
}


Quick & dirty == no JavaDoc or comments. Could be worse, I could have written it all on one line!

Denoumont: "Warning: may contain code which is too intense for young programmers". Turns our my solution (replacing all hard-coded strings with dynamic code to obtain the module and method names) was too...something for my team. They never really said what, just that they didn't think it was a good idea. This is a CMM Level 5 crew, and they don't really accept outside ideas well. Oh well, it'll go into my bag of tricks, and I'm sure I'll find a use for it on another project.

06 February 2006

Parse error: brain halted

My daughter got me the other day. We were poking around in the library downstairs, and she found a shelf of books that we had picked up at the Lincoln Public Library's annual shelf-clearing sale. They were all books that looked nice, but that we thought she wasn't old enough for yet (ratio of pictures to text wasn't high enough). Anyway, she picked up a copy of Curious George Rides a Bike. I read her the title, and she asked, "Daddy, what's curious mean?"

My brain vapor-locked for a second.

Then I explained, and we read the book, and she enjoyed it. So then we spent the next half-hour or so reviewing the books on the "not-yet" shelf and picked out several to take upstairs to put in her library.