SQL Server 2005 Express Edition

With Vista, Microsoft seems to have finally thrown support for Microsoft SQL Server Desktop Engine out the window. I have a Microsoft product that depends on a SQL Server compatible database for installation, and it flat-out refuses to install on Vista using MSDE 2000. I grabbed SQL Server 2005 Express Edition instead, and while looking for the download link I couldn't believe how much other stuff the SQL group is giving away.

For starters, there's a SQLite competitor called SQL Server Compact Edition, a free day of video training on how to use the product, a $49 developer edition with all the features of Enterprise Edition, a reporting tool to make quick reports from the data, and lots of other stuff.

If you don't mind being locked into Windows, that means you can get an account on a Windows Server 2003 box and throw up a whole web serving stack (IIS, ASP, SQL Server Express, C#), for nothing but the cost of the OS. With the cost of Windows Server 2003 Web Edition licenses dropping past $250 because Windows Server 2008 is about to come out, this might be a great idea for folks who don't need or want to know anything about Unix. If you get a hosting provider to amortize the cost of the license for you, it's even cheaper than that.

By the way, you really do need a Windows Server 2003 license. You can't weasel out of this by using a cheap XP or Vista license, since both products include a clause in the EULA saying you can't use them for "commercial hosting." (Vista EULA section 8, XP EULA section 5).

(no subject)

My Thinkpad T61 is a great product except for the default Windows software load, which stinks pretty bad. Something that's been bugging me for a while has been display artifacts when playing back full-screen video on the Quadro 140M in my model. I just fixed it by twiddling with the Nvidia control panel settings and disabling the PowerMizer feature.

(no subject)

Linux Weekly News is running a series called What every programmer should know about memory, which discusses many topics that are somewhat critical to understanding what's going on in your computer. The text applies to all operating systems, not just Linux, and is well worth your time to go through. Some of the effects described are only going to become more prominent in the next few generations of silicon, and you should be aware of them so you don't do anything silly on your next project.

(no subject)

The other day I had to talk to a Force 10 Networks switch, and I typed "help" at the IOS-like CLI prompt. I got this back:
Special keys:
  DEL, BS .... delete previous character
  Ctrl-A  .... go to beginning of line
  Ctrl-E  .... go to end of line
  Ctrl-F  .... go forward one character
  Ctrl-B  .... go backward one character
  Ctrl-D  .... delete current character
  Ctrl-U, X .. delete to beginning of line
  Ctrl-K  .... delete to end of line
  Ctrl-W  .... delete previous word
  Ctrl-T  .... transpose previous character
  Ctrl-P  .... go to previous line in history buffer
  Ctrl-R  .... rewrites or pastes the line
  Ctrl-N  .... go to next line in history buffer
  Ctrl-Y  .... print last deleted character
  Ctrl-Q  .... enables serial flow
  Ctrl-S  .... disables serial flow
  Ctrl-Z  .... return to root command prompt
  Tab,  command-line completion
  Exit    .... go to next lower command prompt
  ?       .... list choices
Except for the history related stuff, this is a good list of the "standard" control codes that you should expect to be supported by a modern interactive shell. Unfortunately, much of this knowledge is spread over several standards, so most people tend to pick it up by word of mouth when they work in a multiplatform environment. For example, most of the movement commands can be found in the Bash manual, C-s and C-q come from ASCII, C-z comes from Cisco IOS's use of the DOS convention (which in turn is DOS trying to play nice with CP/M), and the DEL and BS mess is familiar to anyone who's used Linux for a while.

I had to write the server side of a terminal implementation for an embedded system once, and it was a pain in the ass trying to find references for all these control codes I've picked up over the years. It's nice to see them all in one place for a change.

Sun: Great engineers, marketing... not so much.

I went to go check my email the other day and found this waiting for me:
From: Sun Microsystems <engage@mail.communications.sun.com>
Subject: Buy $99 Solaris OS support, get $50 for dinner

Sun Microsystems
Buy a Solaris Subscription and enjoy dinner on us
What the hell? At first I thought it was a prank, then the email rapidly turned into the usual Sun corporate communications lulz and I realized this was a serious offer from them:
We're glad you're up and running on the Sun Solaris 10 Operating System! Now for a limited time, purchase a Solaris Subscription: Basic Service Plan for $99 (a $240 value) and get great support plus $50 in restaurant gift certificates.* Or buy discounted Standard or Premium subscriptions and get up to $200 in dining gift certificates.

Learn More...

* I'm Ready for Dinner!

Not interested? Let us know.
Maybe they're trying to say something about Solaris users...?

I was talking to some guys at an office near Stanford the other day and their Director of Engineering guy with the cool British accent [1] told me a funny anecdote about how one time at Sun his old boss Mr. Ponytail tried to convince a key Linux engineer to stay with Sun instead of leaving to do Linux stuff at Google. Mr. Ponytail did this by babbling on about how Linux is a stack of poop lasagna compared to Solaris, which of course just pissed the engineer off even more. Oops.

Reading the OpenSolaris code and the Solaris Internals book, I've come to respect Sun's technical staff, but clearly their external communications need a little work. Because it's really funny, I'm going to pull this infographic out again, courtesy of Ars Technica:

I think that Apple has it all figured out with their Hollywood release model, where they shout RA RA iProduct yaaaaaay iProduct as loud as they can and everyone talks about how awesome the iProduct is and then they queue up for a place in line so they can give Steve Jobs fat wads of cash. No one ever gets excited about things like Thumper or dtrace. Then again, I guess it's kind of hard to make backend server stuff sexy in the same way the iPhone or the iPod are sexy. It's been tried, but it just does not work:

[1] Lately, all of my project supervisors have been tall British guys with strong accents, and it kind of weirds me out, like there's a secret society that's trying to take the Union back. Oh wait, the PM for the current project I'm working on is a Scot, but that still counts since he's from the UK. (Yes, I know it's a different country, but I'm a dumb American and all you guys sound the same to me.)

[edit] Oops, I've been told Scotland is not actually another country and a Scottish accent is really quite different from an English accent if I would bother to pay some damn attention :)

(no subject)

Earlier today I had to give someone a file from a unix machine, but he was behind a NAT box and all I had was python. What to do?
[jspence@somewhere /home/me/somewhere]$ python2.4
Python 2.4.4 (#2, Oct 18 2007, 10:08:13)
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
>>> import SimpleHTTPServer
>>> SimpleHTTPServer.test()
Serving HTTP on port 8000 ...
The web server that gets started serves up the contents of the current directory, with protection against all the usual things like directory traversal and CGI execution.

(no subject)

Earlier this week I borrowed a labelmaker from someone to label a CD, and in turn they asked me where a good place to put the label would be. She wasn't quite sure where the data was on the CD, and thought putting the label on the top might be bad since the data might be there.

The data actually is on the top side of the CD, but there's usually some coating there to keep your grubby fingers from messing it up with a label. Maybe a picture would help:

Aluminum data layer


Most people see this and think, well that's stupid, the laser is shining on the bottom of the CD so why not put the data closer to the bottom? Why is there all this plastic in the way?

It's for the same reason you can drive in the rain. The engineers who designed the original compact disc specification knew that if you focus on something far away, small objects in the way blur out and become invisible. When you're driving in the rain, your eyes focus on the road ahead of you and stuff on your windshield disappears. If you deliberately focus on a windshield while it's being rained on (park your car first), you can see that the rain is really kind of annoying unless you focus on objects past it.

The thick polycarbonate layer between the laser and the data layer ensures that any dirt on the bottom of the CD will be on the laser's "windshield," and the laser can focus on the data down the road.

These days, the new 400 nm optical recording media have data densities so high that this simple model doesn't cut it anymore and the discs have become pretty complicated. The picture over to the right is what Verbatim says their Blu-ray discs look like these days. I haven't read the Blu-ray specification so I don't know what the dielectric layer is for, and it's probably going to bug me until I figure it out. There's certainly a good reason for it, but seeing it in this context is like seeing a part labeled "Cuisinart" on my bicycle.

(no subject)

One of the style things that programmers in {}; (C, Java, ...) languages run into when they enter the real world is the fight to have exceptional or non-exceptional code first. An example of exceptional-first:

rc = dostuff();
if(BAD(rc)) {
  goto out;

rc = do_more_stuff();
if(BAD(rc)) {
  goto out;

rc = yet_more_stuff();
if(BAD(rc)) {
  goto out;


if(did_stuff) { free_dostuff(); }
if(did_do_more_stuff) { cleanup_do_more_stuff(); }
if(did_yet_more_stuff) { undo_yet_more_stuff(); }
The other way:

rc = dostuff();
if(GOOD(rc)) {
  rc = do_more_stuff();
  if(GOOD(rc)) {
    rc = yet_more_stuff();
    if(GOOD(rc)) {
There are many arguments for and against either style, and I'm going to analyze them over the next few days. For now, think about your initial reactions to both styles.

(no subject)

To compensate for yesterday's post, here's something useful. Consider an ASCII letter, like A. A is 0x41 in hex, or 01000001 in binary. Lower-case 'a' is 0x61 in hex, or 01100001 in binary. Notice something? Check out bit #5:
01000001 A
01100001 a
That's right, they differ by only one bit. That's true for the entire alphabet in ASCII, and you can take advantage of this by setting or masking bit #5 as appropriate to upper-case or lower-case a character.

When reverse engineering, the hex sequence 0x20202020 or 0xDFDFDFDF (four bit #5's) sometimes shows up in string manipulation code because the program has inlined an upper-case or lower-case routine. 0x20 is also the ASCII space character, so it might be something involving spaces too. Use common sense to figure it out.

I learned that from David Topham in the mandatory x86 assembly class at Ohlone College. I don't think I ever learned anything that practical at Berkeley, and I sometimes think of this when people say bad things about the California Community College system. I've seen the Calculus classes at both schools, and I have to say that I think the Ohlone classes are a hell of a lot better than the ones at Berkeley. Maybe I would have done harder problems, but dammit, I learned the Calculus at Ohlone. At Berkeley they seemed a lot more interested in using them as weeder courses.