2007-12-19

Dash helps Bash users relive the bad old days

Just as you thought the old shell wars of the 1980s and 1990s were over, just as you thought Bash was the only shell left standing, along comes a stupid idea.

I've talked before about the trials and tribulations of installation, and how there are two schools of thought when it comes to dependencies; that there's the "I'm the admin and I should be able to install whatever implementations/versions of prerequisites I please and force their use system-wide" view and the "I'm the developer, and if I want the thing to Just Work (and avoid a lifetime of handling support calls) I need to explicitly ensure and directly refer to my own dependencies". So in the case of a JVM, the first guy thinks "I should be able to run your application with whatever JVM I choose" and the second guy thinks "I'm going to ensure I run on the JVM I've tested".

They're both right in their own way, but in the real world we can't satisfy them both.

Me? I started off as the first guy (even a developer starts off as a user, after all) and only later learned that my sympathies were misplaced, and both the developer and the user is better off when things Just Work, and it's simply too hard to do that if you leave yourself completely at the user's mercy.

There's a reason why Linux distributions with good packaging systems are the Linux mainstream (and why such a Linux system is a much more comfortable place to be than any other Unix, including Mac OS). Something like Debian packages are the best compromise between the two somewhat-conflicting interests of administrator/user and developer. (I'm ignoring the conflicting interests of administrators and users because I think they mainly play out in the commercial Unixes and Windows. No-one gets a Linux box to be locked down and locked in, and no-one wanting to lock you down and lock you in gives you a Linux box.)

I've also talked before about #! lines, and the different choices you have for what comes next, and how and why an explicit absolute path is the best choice. At the time, I was concentrating on Ruby. For various reasons, though, there are still shell scripts out there. And they're a good example of these same problems.

Once upon a time, we'd write "#!/bin/sh" and we'd be careful to write pure Bourne shell code. (Or maybe we're old enough that there weren't really any alternatives to tempt us at the time.) Then Bash came along, and it sucked slightly less, especially interactively. Some of us may have dallied with better shells like rc(1) in the meantime, but Bash, for the usual sad reasons, was the first real contender for the default shell crown. And Bash took that crown, first on Linux, where it was a bit of a walk over, and later on Mac OS. (The two AIX users, three Solaris users, and that guy with the IRIX box that hasn't actually been turned on in a couple of years in the audience: you don't count. No-one cares. You probably don't even have Python and Ruby out of the box. You may not come with GCC or GNU Make. You probably have real killjoy Bill-Joy vi instead of Vim. If a program is available in an old and crufty flavor, you're still using it. This is why no-one cares. People have to be paid to write software for you, and they still see it as a chore, and you know what kind of stuff that attracts? Oracle. Enjoy!)

Anyway, POSIX specifies the behavior guaranteed by /bin/sh, but doesn't offer an implementation. So much politicking occurs. Note that this doesn't affect the default login shell. That choice is also important for your OS' overall usability, as anyone who used Mac OS in the tcsh(1) days can attest. /bin/sh is effectively the default shell for shell scripts not wise enough to say what they mean. And though you're told to be "portable" or "POSIX compliant" and ask for whatever random shell /bin/sh should happen to be (and that choice should be left to someone other than the developer of the script for what reason?) and so on and so forth, it's actually terrible advice. The people who give it are well-meaning, and in a perfect would it might be good advice. But in the real world, it sucks.

In the real world, not all shells are created equal. No, you shouldn't be doing anything very complicated in a shell script these days. Wrong decade. But still.

In the real world, people have the not unreasonable expectation that when you ask them for shell-like input (their .xsession, say) it will be run by the same shell they normally use. Unfortunately, I'm not aware of any software (beyond shells themselves) that works like this, or that says "just give me an executable, and I'll run it rather than 'source' it into some random shell for you". (I realize this is a slightly different issue, with a slightly different solution, but it's related and relevant and worth mentioning in passing.)

In the real world, programs have bugs. Use only "POSIX compliant" features all you like, but run with enough "POSIX compliant" shells, and you will come across differences in behavior. Sometimes it's because some implementations are broken. Sometimes it's because all implementations are broken. Sometimes it's because the specification isn't implementable. Sometimes it's because the specification is ambiguous. Sometimes the specification is incomplete. This isn't just true of POSIX or POSIX shells; this is true of software. More generally...

In the real world, only the very configurations you've actually tested really work.

Those are some reasons why, next time you think of writing "#!/bin/sh", you should be more specific instead.

As an example, I had trouble switching from Debian to Ubuntu at work because various scripts had, over the years, come to depend on Bash features. But Ubuntu uses "dash" as /bin/sh, and the scripts weren't asking for /bin/bash explicitly. They'd worked for years on dash-free Linux installations. And now they were quietly or subtly broken. If the authors of those scripts hadn't wasted their time chasing the illusion of portability, those scripts would have worked on Ubuntu too.

A friend had a similar problem, where his .xsession (in his home directory accessed over the network via NFS) relied on a Bash feature which meant he couldn't log in to GDM on Ubuntu. He wasn't told what the problem was, of course, or given any reasonable way to diagnose it. And his assumption, that a file of commands he was supposed to write but couldn't specify a shell for would use his default shell, was a perfectly reasonable assumption. Of course it ought to work like that. Anything else would be crazy. ("Welcome to X11", as they say.)

The really funny part, though, is that the usual hobgoblin of POSIX compliance doesn't seem to have been the reason. The reason is speed, according to the dash as /bin/sh spec. If you read that, you'll see some fairly impressive numbers. 30s knocked off the boot of an "old laptop"? Wow.

My friend tried booting Ubuntu on an old laptop. A Dell Latitude C640, which a quick web search tells me is from the year 2002. Booting as far as rc.local takes 45s with Bash and 43s with dash. Not 15s, which would be awesome, and well worth the inconvenience of having a different default /bin/sh from the default login shell. Nope. A whole 2s were saved.

It's probably no coincidence that Nokia are mentioned. And, yes, they run Linux on a machine with about as much processing power as my wristwatch. But that's their mistake, not ours. And something they should be paying for, not us.

There's no real lesson here that we didn't already know. Be explicit and specific. Portability comes from hard work, special cases, and – probably most importantly of all – testing, not from specification compliance. (I consider myself a Java programmer, and most of my hard-won experience is with Java applications, so don't waste your time thinking there are any magic bullets.)

Oh, and don't trust benchmarks unless you understand them and ran them yourself.

2007-12-12

Review: Mac OS 10.5

This isn't really a review, because I'm assuming that anyone who cares to has already read enough Mac OS 10.5 reviews. I wasn't intending to buy 10.5 until Apple shipped Java 6 or a Mac that seemed worth buying (the Mac mini is underpowered or over-expensive, depending on how you look at it, I don't need or want a built-in display, and I'm not in a hurry to spend three grand on a "Pro").

It's funny how these things turn out, because I now have three copies of 10.5. I bought my first copy when 10.5-specific bug reports for software.jessies.org projects started coming in, and no-one else looked like they were going to upgrade first. I bought another copy for my dad, who's been trying and failing to find an excuse to give it a go. He's more interested in iWork, so I've got him a copy of that too. (He knows, so it's okay if you mention this to him before his birthday.) My third copy? Well, that came free when I finally gave in and bought my girlfriend a MacBook.

I'm writing this on said MacBook right now, because someone's using my old G5; it may not have the horsepower any more, but it is still connected to a very nice display. I haven't used a laptop for anything at all in years, and I haven't used one seriously in about 5 years. I'd actually forgotten how bad laptop displays are. Even the latest MacBooks suck. I keep having to adjust the lid because of either the shiny screen or the narrow viewing angle. And small? There's seriously only just enough horizontal room for two terminals and the dock. It's like being back on an early-1990s desktop.

But enough about the MacBook. I'm not here to talk about the MacBook. It's perfectly adequate, but not very interesting. Especially after all that time; I assumed there would have been bigger improvements.

Actually, I think I just ruined the story of 10.5 for you. Oops.

Visual changes
The dock has two stupid new looks, but I seriously doubt anyone reading this uses the dock at the bottom of their display anyway, which gets the stupider new look. That position always seemed like it was for demo purposes only, but Apple now seems to want to punish you visually as well as functionally for not bothering to move your dock. Rest assured that putting the dock on the side of the display where it belongs gets you a sensible enough appearance that I slightly prefer over the old appearance (it's darker, and the "running" indicators glow). You still need to set that default to make hidden applications' icons dim. I don't understand why that (a) isn't an option in the dock preferences and (b) doesn't default to on when the dock's at the side (indicating a "serious" user). I just can't use hiding otherwise. The glowing "running" indicators (the little black triangles in 10.4) are particularly hard to see on a glossy-display laptop with the dock along the bottom. I wonder how much time and effort actually went into that new look? Not much, I'd guess.

The menu bar, as you've doubtless heard, is now transparent, for no obvious reason. It doesn't bother me, though it can make the menu bar harder to read, and doesn't work particularly well with the high-contrast default desktop picture (which has stars behind the menu bar). That just seems sloppy. Two minutes in GIMP drawing a black rectangle over the top of the picture would have fixed that. The Japanese garden picture and the tree canopy picture (two new ones I actually like) work fine. But what's going on? Will 10.6 dump all the existing desktop pictures in favor of an Ubuntu-like selection of brown, brown, brown, or turd (brown)? Will 10.6 have the menu bar text in light gray 6pt Zapf Chancery on a very light gray background? Or maybe a hiding menu bar that only appears when you mouse over where it ought to be?

Enough about bugs they've introduced. What about old bugs? You'll be pleased to hear (if you're a perfectionist cynic) that the Spotlight icon is still "special". Click on the Apple icon, watch it highlight. Move your mouse/trackpad over all the other menu items (on the left and the right sides of the menu bar) and watch them highlight in turn. Arrive at Spotlight and... no highlight. Trivial but weak all the same, like the way the baseline of the text of the stuff in GNOME's panel doesn't line up properly.

The Help menu looks like a shriveled deformity. Trust me, if you haven't seen it yet, the first time you do, you'll think something's broken. I don't know why all the items on the Help menu are now tiny and indented too far to the right, but they are, and it looks so bad I expect it to be copied in the next release of KDE. In a way, it feels like the kind of misfeature people deliberately put in one release so they can score cheap points by removing it in the next, but more than that, it feels like a crash about to happen. Unlike most visual things, it doesn't seem to be possible to get used to this one. The new search functionality on the Help menu, which may well be useful, isn't seeing any use from me because of this strong disincentive against using the Help menu. Every time I see the messed-up menu, my visceral reaction is "this program has corrupted its heap; I'm about to lose my work". I'd be curious to know if non-developers (or even just other developers) have the same reaction. Presumably not, or this mess would never have made it past QA. By contrast, the search field in System Preferences is awesome. It's made Mac OS' System Preferences the best of its kind, preferable to any other OS' equivalent, especially the way it also matches non-Mac terminology and translates it to the Mac equivalent. Even when I know where a particular setting lives, I use the search field now, and love it.

Text in general looks somehow different to me. Darker and smudgy. I don't know what if anything's changed there; it could just be that I had some setting I didn't know about before and lost it in the reinstall. I don't like it, but haven't found how to fix it. I do feel that I'm slowly getting used to it. But I do now prefer Ubuntu's text rendering (on a slightly lower-DPI 30" display).

The login window now has a space-themed background picture, though the old solid blue is still there behind it, which gives a somewhat un-Apple shoddiness to the system, as the solid blue flashes up. That's the kind of lack of polish one associates more with Microsoft or Linux, not Apple.

One thing I do definitely prefer over 10.4 is the new "unified" window appearance. All my windows look the same now; a slightly more subtle "brushed metal". Good to have things settle down. I like the way the tool bars merge into the title bars now too. Everything's much tighter than we're used to, especially if you've been around since 10.1 or earlier. The unification of appearance goes deeper than just the window frames, though. Mail now looks more like iTunes, and the Finder looks more like iTunes. Terminal still looks like Terminal, though its tabs look like Safari tabs. They've not quite done it right, though. The blue background to left-hand pane in iTunes (and now everything else) turns gray when the application's not focused, but Mail, for example, gives the BOLD AND CAPITAL HEADERS a disabled appearance where Finder doesn't. Conversely, Finder gives its tool bar buttons a disabled appearance where Mail doesn't. And, yes, there are still many different kinds of button, but I'll touch on that later.

Mail's merged its activity window into the main window. That's excellent. Mail also contains one of the few windows where the new unified look doesn't really work. The compose windows look strange, with their heavy metallic tops and then a sudden shift into a more traditional style that looks flimsy and insubstantial after all that metal, and looks disturbingly like it might break off.

From a developer's point of view, NSImage has gained constants for various standard images, fixing a bug I raised around 2001 and which even GTK solved long ago. GTK's selection is a lot wider. Apple's icons are a lot nicer. You win some, you lose some.

VNC
This isn't really 10.5-specific, as far as I know, but I've only just got around to trying VNC. If you're connecting from Ubuntu, the "Terminal Server Client" seems to be useless (in addition to its usual faults of being ugly, having a ridiculously complicated "translate every command-line option into a widget in one window" UI, and sounding more Windows-specific than it actually is). You need to run vncviewer(1) with the -FullColor switch. It would be nice if I could configure the firewall via its UI to only allow incoming VNC connections from a specific machine, but I can't.

Annoyingly, if someone on the console uses "fast user switching" to log in as another user, your VNC session ends. It would have been useful to be able to keep working, but if you reconnect, you get the other user's session. Useful to some, but the opposite of what I'd like.

Finder has a new "SHARED" section in its iTunes-like sidebar, showing the VNC servers on your network. It shows both Macs running 10.5 and Ubuntu boxes, provided they have their desktops shared. Presumably Windows woks too, but I don't have a Windows machine to check. Anyway, click on a machine name and you can either look at files, if it's sharing, or "Share Screen", which starts Apple's own VNC viewer. I'd complain about the name, "Screen Sharing", but given that the competition is "Chicken of the VNC", I'll let it pass. The latter has long been an adequate solution, but I'll be glad to see the back of it just so I never have to see its stupid name again.

By default, the remote display is scaled if it's larger than the local display. It works surprisingly well, but fitting a 23" display onto a 13" one is quite a squeeze, and a 30" display is totally squint-tastic scaled down to 13". If your remote display is Mac OS, you should disable dock hiding because it doesn't work properly; the remote view doesn't notice that the dock has popped out. Scaling my Ubuntu 30" display seemed to use 100% CPU on the Mac, even when nothing was changing. Turning scaling off on the View menu fixed that, with the obvious side-effect. I also had trouble with trackpad-button clicks being registered as right-button clicks, but only when the remote display was Mac OS. (If only the MacBook had a right button!)

If you want to use "Screen Sharing" to connect to a computer on a remote network, or for some reason need to start it from the command line, you're best off with your old friend open(1). The app itself is hidden away in /System/Library/CoreServices/, but it registers itself as handler for vnc: URLs. So "open vnc:" will get you a dialog to enter host information, or you can translate Ubuntu's suggestion of "vncviewer herakles:0" as "open vnc://herakles.local:0". The URLs also mean you can embed links in web pages, which might be handy in some environments.

Dictionary
Dictionary was probably my favorite 10.4 feature, and it's made slightly more convenient in 10.5 by being accessible from spotlight (Spotlight is also now a more convenient calculator than the old Calculator application, which I haven't used since upgrading). I wish the new Japanese dictionary were a German dictionary instead, or Spanish, or Italian, or Greek, or French, or basically any language using a script I can read. Hopefully one day there will be at least as many built-in dictionaries as there are Mac OS localizations. It's mildly handy that Dictionary now automatically includes Wikipedia. I don't like the way pointing at a word visibly turns it into a link; I was happy with the old Dictionary's double-click behavior (annoying though it is when web sites do it). I guess not enough people found that functionality on their own.

Spotlight
Speaking of Spotlight, it seems more usable now. I'm not sure if it's just because I haven't got many files on the machine yet (I installed on a new disk), no longer have an iPod for it to spin up (and hang while doing so), no longer use the machine for much development work, or that it's really genuinely better in 10.5, but it's certainly acceptable given those caveats, where it was nothing but a resource pig and performance dog in the past. So far, I've had no reason to disable it system-wide, as I did with 10.4.

Java
Apple may not have given us Java 6 yet, but they have done a lot of good work on Java 5. They've added a lot of support for making your Java application look more like a native application (detailed in TN2196, which is also a good place to see all the 10.5 button styles, if you're curious). Of particular note is the support for JTextFields that look and act like native search fields and circular indeterminate JProgressBars. I've updated my previously rather lame-looking Java search field in light of the new functionality. On Mac OS 10.5 it now looks and feels just right. I'm also now able to use a "mini" check box when JCheckBox is used as a JTable cell renderer (and table headers are now correctly aligned without manual intervention). Plus there's a documented and supported way to change the alpha for a JRootPane's containing window.

Two undocumented changes I've come across so far are: 1. JTabbedPane is now non-opaque by default. 2. setBorder(null) no longer stops a JButton's border from being drawn; you need to use setBorderPainted(false) instead, which also works fine on 10.4.

For details of bug fixes, there are the Java on Mac OS 10.5 release notes.

I did set out to polish an embedded HTML browser in one of my projects, so that its windows would look more like Safari. Java has access to NSImage's new named "stock" icons, and I can ask for the segmented button style, so it was easy to get the back and forward buttons more or less right. I had trouble, though, because Java 5 doesn't let you say "don't render button text", and "" or " " or null or the Unicode thin space all gave visibly wrong results. I also had trouble making the toolbar merge with the title bar. I turned on the increasingly misnamed "brushMetalLook" property, but that had the side-effect of making my status bar (at the bottom of the window) a very dark metallic gray, and it was immediately disconcerting as a user that I couldn't drag the window by the large expanse of empty metal toolbar. (If you'd asked me, I'd have said I don't take advantage of that much. Even brief experience with a broken application teaches otherwise.) There's another property to enable dragging from anywhere, but it goes too far the other way. I can now drag from the buttons (which of course means that many sloppy clicks become window-drags) and I can't use the scroll bar because it tries to drag the window underneath.

So although you can do more than you could before, and things like perfect Mac-like search fields are now trivial, this is but a step in the right direction. Still, it's the most positive improvement (and, perhaps more importantly, sign of positive intent) I can remember in Mac OS Java since they dumped the 1980s home computer OS for Unix. Much appreciated.

Now where's my Java 6?

Developer Tools
GNU Make is now 3.81, Subversion now comes as part of the base install (CVS is part of the optional Xcode install). Mercurial will have to wait for 10.6, I guess. It would be nice to have this in the next Xcode update. I have yet to use the new Xcode (I've never been able to stand it, though it's always had some good ideas, even when it was still Project Builder) or DTrace.

Bash is now version 3.2.17(1), which isn't the very latest, but it's a step forward from the prehistoric version that shipped with 10.4.

I say I haven't used DTrace, but I have played about with Instruments (formerly known as Xray), and that's great fun. Nerdy fun, but fun all the same. It certainly feels like a good way to get started with DTrace, via pre-packaged scripts.

Apple's still shipping a bunch of broken crappy BSD utilities instead of the GNU rewrites the rest of the world (minus Solaris users) know and love. I was impressed to see Mac OS' df(1) use the proper binary prefixes:

/dev/disk2s3 1.2Gi 1.2Gi 9.9Mi 100% /Volumes/Xcode Tools

I was less impressed when I looked more closely and saw beauties like this:

devfs 108Ki 108Ki 0Bi 100% /dev

Someone in Berkeley/Cupertino needs to have the difference between a prefix and a unit explained to them.

DVD Player
DVD Player continues to be pretty good, though it's gaining new interfaces faster than it's shedding old ones, which is usually a recipe for disaster. I actually like the newest interface, which is rather like the full-screen slideshow UI we first saw in 10.4, but it's awkward and non-obvious to activate it (moving the mouse gets me the old DVD Player control panel; pausing at the bottom of the screen for long enough gets me the new one). I'd rather have seen them throw out the old interface, or not add the new one. What is this, Windows? KDE? Be bold, Mr Jobs. We respect an ethos, even when it's not the one we'd choose ourselves, more than we respect pandering to the over-conservative, and the mediocrity that pussy-footing leads to. (See also the problem of having two new looks for the dock.)

DVD Player has a new "chapter view" that shows you a still image from the start of each chapter. It's okay, but it's a bit weak that you have to have watched the chapter first. (That might seem reasonable, but it's less reasonable if you've already seen the film, say, and seems to add more of an air of unfinishedness than appearing to be a deliberate decision. "It's like this because that's easiest in the code.")

There's still no integration with subtitles or ability to full-text search the subtitles. I'd really like to see someone automatically download subtitles (the subtitles actually on the DVD are just images, stupidly enough; I don't know if this was fixed for either of the new contenders for DVD replacements) and offer searching. It's easy enough to write, and I've done it myself with QuickTime for Java, but you can bet someone's lawyers will fuck it before it's born, as they're wont to do.

QuickTime Player
Somewhat relatedly, the most obvious difference in 10.5's QuickTime Player is that the little marker showing you how far through you are no longer has a solid arrowhead; it's hollow. The full-screen option is now available to all, but if you assumed that would mean that all the "PRO" nonsense was gone, think again. That whole app is stuffed full of upsell attempts. Funnily enough, not being a Windows user or ever having bought a machine that came with Windows, QuickTime Player was the first thing that came to my mind when I saw that Apple TV ad where the smug bastard was sneering at the nice guy for being covered in ads. Well done, all concerned. (Speaking of unnecessary, I wasn't impressed by the BSOD icon either. I think Jesus summed it up best when he said "don't be a dick".)

Safari
Safari's find-in-page functionality is much better than the horrid state of searching affairs in 10.4 (Firefox users have no idea how bad things were, and I've no wish to upset any children or ladies who may be present by going in to details; suffice it to say that it was about as bad as it could be without being Vim looking at the source, without even the saving grace of regular expressions). Visually, I find the new match highlighting a bit distracting in that way that makes things feel slow even when they aren't, but I've seen worse. I guess I'm just used to dull old development tools making a serious effort to find stuff as fast as possible and, even more importantly, making an effort to feel like it couldn't be done any faster. I'm sure I'm not waiting long for that bubble effect, but it's long enough for my brain to think "come on already; stop messing about".

Much more important is that I've had Safari crash quite a bit. Usually as I pop up a combo box. If it keeps that up, it'll soon burn through the goodwill the new find-in-page functionality has generated, and I'll be back using Camino as my main browser on the Mac. (As it is, I'm using Ubuntu ever more so my motivation's low. But that tells you something about Safari when I'm saying I've seen it crashing despite the fact that I've mainly been using Firefox on Ubuntu.)

Preview
I've long liked Preview (since whenever they added search), but I guess it was already good enough for me in 10.4, because without starting it up to remind myself, I couldn't tell you what's different. Oh, it looks a bit different, but the unified look doesn't suit it all that much. (I think, if you asked me to guess, I'd say that the unified look works best where there's a thin toolbar relatively full of buttons and text fields, as with Safari, and doesn't work where you're left with big empty metallic areas. It draws your eye away from the actual relevant content and, literally, encourages you to stare at nothing. The "Picture Browser" button in Mail's compose windows counters this effect a bit by being right-aligned and helping to balance the toolbar.)

Quick Look
Even after having lived with this for a while, I have to admit I still don't get it. I just don't see what purpose it serves. The cynic in me pipes up "it livens up keynote demos, stupid!". Something like showing icons in the Finder that represent the actual content of the document (for more "documenty" types now, not just the types that had thumbnails in 10.4) gets a few cool points and is sometimes useful. Having lame-o cut-down viewers just seems like some stupid Microsoft idea from the 1990s to try to get more people locked in to one of their proprietary formats, encouraging people to think it's okay because there's a "free" viewer.

Except this is nothing to do with that.

The only use for Quick Look that I can discern is that it bulked up the "300 new features" or whatever arbitrary number it was this time round. (I actually consider that kind of nonsense as rude and condescending as the covers of women's magazines with their 18 hottest fashions and 175 new hairstyles and 320 tricks that will drive him wild, or whatever other crap they offend my eyes with at the supermarket checkout. Why don't Ballmer and Jobs just duke it out over "lines of code" or "number of installed files" or something equally meaningless but at least accurately measurable and satisfyingly large?)

Cover Flow and the new Finder
See above. It's a nice gimmick for the iPod/iPhone, but it's pure crap without a touch screen. If you don't use this in iTunes, I don't see you using it in the Finder. But who apart from magazine OS reviewers uses the Finder much anyway? Yawn.

iCal
iCal's dock icon now shows the correct date all the time, whether it's running or not. This is my girlfriend's favorite improvement, but she's lived with it broken for so long that she still doesn't completely trust it, and I don't blame her. I can't believe how long that took.

As for iCal, well, it's still iCal. Luckily, I don't have much use for calendars.

iChat
Speaking of things I don't have much use for, I'm too old for IM. But iChat still doesn't support MSN or Yahoo!, so what little use I do make of IM will continue to be via Adium. I had to have this pointed out to me, though, so it's no big thing.

Time Machine
Much has been made of Time Machine, but – though I get the point – I feel like we're missing a few pieces. At the low end, my dad's machine didn't come with two disks, and he's not likely to fit one or buy himself an external disk. Most real people don't seem to think of backing up to another disk as backup at all. Optical disks, yes. Thumb drives, yes Paper, maybe. But another hard disk? I think there's something about the act of physically removing the copy that convinces.

At the high end, on the other hand, nerds either already have an rsync(1)-based backup in place, or don't care, so something like Time Machine isn't of interest to them. Time Machine backs up to local disks, for local people. Not network file systems. This seems odd to us, because the network is the natural place to back up to; as Linus said, "Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it.". Another, obvious, Time Machine flaw is that it's Mac-only, but any real nerd has a more heterogenous group of machines to deal with.

So presumably there's some big middle "end" of people who believe in disk-to-disk backup, only use Macs (preferably just the one) and have multiple drives. I'm not being funny here, either; I can well believe there is. It's just that I don't know anybody from the middle end, so I'm a bit mystified when reviewers sing Time Machine's praises. At least until I remember that computer journalists are very likely to inhabit the middle end.

Assuming Apple isn't cynical enough to target features mainly at computer journalists, I imagine that future iMacs will come with two drives. The Mac Pro has always been available with multiple drives, and now there's more motivation for those people to buy a multiple-drive model. I'll be interested to see whether my dad asks about getting another drive, internal or external. I would like to see Time Machine succeed, even if I don't imagine I'll ever use it.

The worst 10.5 bug so far
The most annoying bug I've come across occurs if you put the machine to sleep at the login window. When you wake the machine, three times out of four (he says, having just done four quick tests in a row) the login window will clear the text fields while you're entering your username and password. This affects both my dual G5 and the MacBook, and it's bloody annoying; time spent logging in is 100% aggravation time that isn't really doing anything for the user at the best of times. One of the best things about Macs and Mac OS, usually, is how well sleep/wake works.

I've raised Apple bug 5654899 for this.

Summary
10.5 isn't like Vista. It isn't likely to produce a situation where people buying new machines are actively clamoring for their old OS back. I'm typing this in Safari on 10.5 and I don't care and would be hard-pressed to notice, other than that the menu bar is a sickly shade of green where the tree canopy image seeps though, instead of the pure white god and the limitations of 1980s hardware intended it to be. There are a whole bunch of minor improvements that make life slightly better, a whole bunch of irrelevant changes seemingly for their own sake that make no difference, and I can't think of anything (with the possible exception of Safari crashing more than it used to) that actually makes life worse. But is it worth USD129? Maybe if you're living outside the US. The dollar is weak, after all.

One problem I've noticed with the last couple of OS releases is that a lot of the big improvements have been under-the-hood "enabling" improvements. New technologies for developers that should allow them to write better apps more easily. Which is fine, but it's kind of hard to sell directly to end-users, and it's not really obvious that we should have to pay. I've been to one of Apple's "10.5 Tech Days", and if I were writing non-Java for the Mac, I'd be really excited. Hell, if we get a decent iPod touch SDK, I may be excited come February. As it is, I'm waiting for someone else to write something I'd want. And being a developer, and one with a distaste for non-Free software, that would have to be a hell of an app.

2007-12-08

Streaming music to your Xbox 360 from Linux

I've been busy lately, which is why I haven't posted much. Sadly, that hasn't stopped me from wasting what free time I have had. Just the other day, for example, given an evening to myself I spent it trying to stream music from my Ubuntu box to my Xbox 360; something I have absolutely no need to do, and relatively little interest in doing. It seems my idle curiosity gave up the whole idleness thing. The result being that I spent several hours banging my head against the problem of streaming music to an Xbox 360 without Microsoft's Windows Media Center (or anything else Microsoft but the Xbox itself).

There are several options, but if you searched the web before I wrote this, you wouldn't come across much in the way of helpful comparisons. There are plenty of forum posts saying "it works", "no it doesn't", "works for me", "has anyone got this working yet?", but nothing very conclusive.

I tried three different programs: uShare, GMediaServer, and x360mediaserve (listed in the order in which I tried them, and if you're impatient and don't want to read on, I'll give you a little clue: people generally stop trying alternatives when they find one that works okay).

uShare seemed the best on paper. It had an explicit --xbox switch, relatively simple configuration, looked like a traditional Unix program (which may put some people off, but is important to me if I'm considering running the thing at start-up as a daemon), and the only real negative point was that people (not necessarily the authors) kept saying "written in C for speed", which is usually the sign of a lost project with neither clue nor sensible focus. Unless you've messed up and used something hugely inappropriate, or you're a library or something else where users should reasonably expect to have to deal with the code, implementation language is not a feature. Anyway, I couldn't get this to work. I tried, too. This was the only one where I bothered enough to chase dependencies and build it myself, the only one where I bothered enough to really look at the network captures to try to work out what was wrong (nothing obvious; if it weren't for the fact that nothing showed up on the Xbox 360, I'd say it was working; XML was squirted in both directions, with contents that looked plausible to me).

GMediaServer was off-putting with its crappy GNU-style home page, but it did have a pre-built package in the Ubuntu repositories, which is always a good sign; someone with enough clue to maintain a Debian package thinks the thing is worth packaging. Not that there isn't plenty of good and useful software that doesn't get this treatment, and not that there isn't plenty of utter crap that does, but it's better than nothing, and it at least means (a) no manual tracking down of dependencies and (b) no need to build anything myself and (c) worry about how to uninstall when it turns out not to work. GMediaServer, being packed, was much easier. Unfortunately, it didn't seem to work any better than uShare. The documentation, though it mentions the PS3, doesn't even mention the Xbox 360, which is surely the most widespread uPNP streaming media client, no? I mean, I hate some of the things Microsoft do, and every time they start on with bollocks ads about how great Windows is or anti-Linux FUD, I feel guilty that I'm actually partially responsible for funding those misinformation campaigns. But (and bear in mind I'm just guessing this is why there's no mention of the Xbox 360) ignoring popular devices makes no sense; better to say "we don't support X for reason Y". Whatever, GMediaServer wouldn't talk to my 360, the documentation doesn't even mention the 360, and although there are patches on the web that allege to make an old version able to talk to the 360, there's no sign those patches were ever integrated. Plus GMediaServer has been updated once in the last 12 months and the first thing mentioned in the ChangeLog entry is that it needs a new maintainer. At that point, I gave up and turned to my last choice...

x360mediaserve. This program has no documentation that I could find. Nothing of any use at all. It wasn't obvious that it has a proper website, and it's basically an "alpha" project on sourceforge.net, everybody's favorite internet code orphanage. It's not available as a package, and is just a spew of binary files and shell scripts/.bat files. The source isn't included in the download, the structure of the download isn't the usual GNU/Unix one, blah, blah; basically, it's a really crappy experience. But if you run "./start", point your browser at "127.0.0.1:7000/configure", enter a directory of .mp3s in the relevant box and ignore the stupid download prompt when you submit, it just works. Yeah, it's got all the wrong buzzwords: J2EE, servlet, XML, bloatware; yeah, it looks and smells like ass, but it works. If they'd default to using ~/Music, it would probably work out of the box for most people. (Well, most people who have a suitable JVM installed.)

So, anyway, we have a "clear" winner. Bear in mind that the "winner" seems to only support music (that is, it doesn't support video), and doesn't seem to be much more actively developed than GMediaServer. If it had actually worked, uShare would have been my choice; it seems the most professional and the best-maintained. (I reiterate this mainly in case you're a PS3 user, for whom it may well work.)

As for the Xbox 360's side of things, I was unimpressed. The sound came out of the front left and front right speakers only, and with my Z-5450 speakers, that's not nearly as good as the M-Audio "monitor" speakers on my desk. The 360's controller is a pretty inconvenient remote, too.

All in all, I can't really see a reason why I'd ever do this again. But if you want to try, hopefully this post can save you some time.