Posts from October 2003.

The pull of the Mac

I mentioned in the previous entry that iPods are cool, but that I was feeling “the Evil Pull Of MacOSX tempting me away from the ideologically pure land of Free Software”. Mark helpfully showered me with links to iPod-supporting Free Software. If I buy an iPod, I would certainly be looking at that, but it’s not strictly the iPod that I meant — if I wanted a mobile mp3 player then I’d buy an SDMedia card for my Zaurus and use that. What I was talking about (and I didn’t explain this very well, or, indeed, at all) was the Mac itself.

What I want is for Linux to be as pretty and usable as MacOS is, which is why I try and help with projects like RoxOS, but it’s just not there yet. And I keep thinking to myself “wouldn’t it be good to buy a Mac?” The G5 looks really pretty. Really, there are two things stopping me. The first is expense; the last two people I know who bought PowerBooks spent well over a thousand pounds each on them, and I don’t have a thousand spare. This is an invariant, regardless of my political viewpoint. :) The other part is that, well, I spend a lot of my time lobbying for Free Software and against proprietary solutions, and then to turn around and recommend a Mac seems to me the height of hypocrisy.

Perhaps even I’m worried that I’m using the banner of free software to disguise a not-so-admirable hatred directed purely at Microsoft. I’m sure I wouldn’t be alone in this if I were, but I don’t think I am; I don’t quite follow why I have such a high opinion of Apple despite them being exactly the same as any other proprietary software company.

Neal Stephenson mentions this in In The Beginning Was The Command Line:

When Apple engages in this sort of corporate behavior, one wants to believe that they are really trying their best. We all want to give Apple the benefit of the doubt, because mean old Bill Gates kicked the crap out of them, and because they have good PR.

Perhaps this is the truth. All I know is, I want a Mac, but I really don’t want to want a Mac. Perhaps this makes me stupid, or a zealot, or something. Mac people would quite possibly sneer at me for zealotry, for example. The most technically competent guy I know, a pretty big noise in the Debian project (not known for its pro-proprietary-software stance) has just bought a PowerBook (although he’s going to at least dual-boot it). Jono, the guy who set up our LUG and a writer for Linux Format, has a PowerBook and uses it all the time. What hope for me?

But Macs are so nice…

None

Keeping up with the Joneses

Joel on Software – Fire And Motion:

Think of the history of data access strategies to come out of Microsoft. ODBC, RDO, DAO, ADO, OLEDB, now ADO.NET – All New! Are these technological imperatives? The result of an incompetent design group that needs to reinvent data access every goddamn year? (That’s probably it, actually.) But the end result is just cover fire. The competition has no choice but to spend all their time porting and keeping up, time that they can’t spend writing new features. Look closely at the software landscape. The companies that do well are the ones who rely least on big companies and don’t have to spend all their cycles catching up and reimplementing and fixing bugs that crop up only on Windows XP. The companies who stumble are the ones who spend too much time reading tea leaves to figure out the future direction of Microsoft. People get worried about .NET and decide to rewrite their whole architecture for .NET because they think they have to. Microsoft is shooting at you, and it’s just cover fire so that they can move forward and you can’t, because this is how the game is played, Bubby. Are you going to support Hailstorm? SOAP? RDF? Are you supporting it because your customers need it, or because someone is firing at you and you feel like you have to respond?

None

—–

Styling RSS feeds

So, it looks like everyone else in the world discovered this and implemented it while I was in the bog or something, but if you add an XSL stylesheet to your RSS feed then it displays nicely in browsers that support XSL. So, styled RSS feed. Now you can all laugh behind your hands at how slow I am!

Deskjet 610, how we hate thee

Another in the “I Hate Computers” series: An HP Deskjet 610, a scanner, and some network printing.

—–

Python libxml2

Kimbro Staken gives an example of XPath code with Python’s libxml2 bindings. I didn’t even know about this; I always end up poncing around with from xml.xpath import Evaluate or whatever. How are people to find out which XML libraries to use? I do normally try and stick with what you get in stock Python when I write code, to minimise dependencies, but maybe I should rethink that policy.

Oh, and, since “pytohn” isn’t a word, I wish all operating systems would autocorrect it whenever I type it.

—–

Why the iPod

Dell’s Dud, a Daring Fireball essay about why the iPod is the premiere portable music technology and Dell’s promised new “Dell DJ” will provide no credible opposition, and diverging into why Apple don’t own the whole PC market. Excellent stuff. I must read more Mac commentary; it seems all to be well-written technically credible stuff.

On the other hand, I feel the Evil Pull Of MacOSX tempting me away from the ideologically pure land of Free Software. Must resist.

But they’re so nice…

Python Web SIG

Simon flags the new existence of the Python Web SIG, which is “dedicated to improving Python’s support for interacting with World Wide Web services and clients”. I’m completely behind this; as Simon points out, there’s no shortage of Python web frameworks, but none are anointed by the touch of the standard distribution, and there are a lot to choose from for a novice hacker. The standard library should be better at this; one of the reasons there are so many different Python web frameworks is because dealing with cgi.py is a bit of a pain…

Embedding images in HTML

There’s a neat trick — you might have seen it in Lee Semel’s 5k Wolfenstein game for the 5k competition — where you can embed images directly in a page, rather than have the image data in separate files. Semel demonstrated with XBM images, which are black-and-white image files that (if you look at the image data in the file) actually look like C code defining the image. (See Semel’s notes above for more on this.)

So, thought I, that should work with non-XBM images too, right? I mean, if we can do src="javascript:makexbm()" and have our makexbm() function return C code for an array, there’s no reason why it can’t return binary data that makes up a GIF or PNG image, right? Right? Well, let’s see:

Is there an image here? ()

All I’ve done there is made the src attribute of an img tag be a javascript string containing binary data. If you’re using a Mozilla based browser, you should see a little red ball. If you’re using IE…broken image. Damn. I’m not the first guy to discover this, either. Roger Critchlow wrote an essay about inline images on web pages, offering a few other ways that it might work (data: URLs, document.write, others). And, guess what: they all only work in Mozilla. IE, not a chance. So, it’s not possible to embed images in a web page if that page is to be displayed in IE.

Ah! I hear you say. Can’t we use MHTs for this? MHTs are web archives — IE allows you to save a page as an MHT, and all the resources on that page (images, stylesheets, the works) get bundled up into one MHT file which IE can then open later. (It’s actually an HTML email in format, but it works.) So, maybe they’re a solution? Nope. Mozilla doesn’t support MHT’s. They’re working on it, but it’s not come up igh enough on the radar for it to get fixed, sadly, in the three years since the bug was filed. Some guys are actually prepared to offer money to get this bug fixed; they’ve got a couple of hundred dollars earmarked for the fix for this. But, until then, or until IE supports JavaScript embedded images (which will presumably happen never) there’s no way of distributing a complex page in one runnable file, as far as I know. If anyone knows a way to get around this, ideally to convince IE to work with JavaScript URLs containing binary data, then I’d love to hear about it.

None

Discworld characters

I don’t normally do these (well, I do them but don’t post about them, but don’t tell anyone) but I’ve just finished rereading The fifth Elephant, so it was worth a try, and:

Sir Samuel Vimes

Discworld: Which Ankh-Morpork City Watch Character are YOU?

(via N)

None

The tyranny of tabbed browsing

Tabbed browsing is great in all respects except one: it encouorages you to store away an interesting link in a tab somewhere to come back to later. So, oh, that looks interesting, must make a note of that, (middle-button click on link), I’ll look at that tab later. Repeat for a couple of weeks and you not only have a process that’s been running for ages, but you can’t upgrade to Firebird 0.7 because you have all these links to note on your weblog before you can shut down your running Firebird 0.6.1. So, in a pitiful effort to clear out some of these tabs, herewith a collection of all the random stuff I’ve stored as interesting for the last fortnight or so:

  • mod_accessibility for Apache, “a fully automatic aid to making websites more accessible”. It’s no panacea, but it does do some neat stuff, like bung all your crappy old HTML through some kind of HTML Tidy equivalent thing, or create a “text only” view.
  • A sung version of the Star Wars theme. This is just mental. Cool, but mental.
  • The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!), a Joel “I’m in a fight with Ned Batchelder” Spolsky guide to Unicode and what you have to know. Useful-ish, in that you’ll understand more of the theory, but I bet you still won’t get how to actually use the smegger in your work. Still, no knowledge is bad knowledge, and next time someone asks you about codepoints in the pub (happens to me all the time) you’ll have a glib answer ready.
  • IE vulnerabilities are so much fun, Sam Buchanan’s take on HTML mail and why it’s bad.
  • Suing Your Customers: A Winning Business Strategy?, or, How Henry Ford Righteously Screwed His Competitors The Last Time Big Corporates Tried To Kill Innovation, or, Read ‘Em And Weep, RIAA. Or, ahahaha, hope it works that way this time too.
  • Introducing mod_python, which is something I really must prat about with when I get a chance, which will obviously be never.
  • According to InfoWorld, developers are favouring web-based apps. Good for me, good for my pay packet.
  • Bob Cringely, someone who I forget about for six months at a time and then rediscover, to marvel at his articles. Wish he had an RSS feed.
  • Mahogany Mail, which seems to work seamlessly with Mutt and may therefore become my desktop mail client of choice. Except that it talks lots about its built-in Python interpreter and then says in the README that “Note that this is currently not very useful and may even be broken due to lack of interest in this functionality”. Sigh. And it should be “owing to lack of interest”.
  • The Digital Imprimatur, John Walker’s rather dystopian view of how Big Media, the courts, and the assorted governments might just kill the internet and all its promise. I mean, yeah, imminent death of the net predicted, film at 11. But Walker has a habit of being pretty perspicacious about technology trends…
  • How to 0wn the Internet in Your Spare Time, an article on worms, the threat that being able to remotely r00t lots of boxes noninteractively poses, and how to make a better worm. I wrote a thing about making a better worm once, and this is much the same sort of thing except proper and serious and with good research and all :) A bit concerning, although a bit maths-heavy too.
  • The “Trusted Computing” FAQ, or What DRM Means To You. I go and re-read this every few months, lest I forget.
  • Lie Detector, a brief sumary of how much the Bush administration is lying in its pro-war propaganda programme.
  • Ned notes the Encyclopaedia Britannica Ready Reference using Jython, Xalan, and XSLT. Nice. Actually, the idea of being able to distribute Python code with jython.jar and knowing it’ll run everywhere with a JVM is quite compelling; easier than distributing the CPython runtime, perhaps.

Plus ca change

Been browsing through some of Mark’s old posts, and I have learned three things.

First: all Bruce Schneier’s excellent Crypto-Gram newsletters are on his personal site now, not in the Counterpane Labs, because the Labs don’t seem to exist in the same way any more (”With the formation of Counterpane Internet Security Inc., Counterpane Systems has changed its name to Counterpane Labs and no longer does outside consulting. We continue to perform world-class research in cryptography and computer security.”) I wonder why?

Secondly, the Firebird Link Toolbar (the thing that gives you Next, Previous, and Up buttons, if the site has specified where they should point for the page you’re looking at) is really, really handy. I really must do that specification for pages here. I’ve just noticed how, after browsing around Mark’s site, how irrationally annoyed I’m already getting when I can’t step from one page to the next using the toolbar on other people’s sites. See, Mark, there is a point to all that work you do, although I doubt your point was “make surfers hate everyone other than you”.

Thirdly, considering that the stuff I was reading was from early 2002, around eighteen months ago, a hell of a lot of links have succumbed to linkrot. Even from people I’d consider high in their class, like, say, Anil Dash (not wishing to pick on Anil specifically here; that broken link was just the straw that convinced me to write about this particular camel’s back). The links fortunately don’t die completely in most cases; instead of 404s, you get a front page or an archive page for the site you’re directed to. But Cool URIs don’t change. Personally, I think that inventing the One True URL Scheme for your site right off the bat, as soon as you start building, is a pretty unrealistic ivory tower hope; I mean, maybe TBL can do it, but I sure as hell can’t. What this means, I think, is that any site that has a lot of small content, like a weblog or a news site, will, over time, accumulate a massive forest of .htaccess rules or similar that keep old links alive but allow you to deprecate them. I’ve done what I am able to do here; when I moved from MT to Vellum, my IDs for the posts changed (because I couldn’t work out a good way to keep them the same), and hence links like Simon’s to my original Pingback idea would have broken; he linked to http://www.kryogenix.org/days/000138.cas, and the post is now at http://www.kryogenix.org/days/80.html. To handle this, I set up the following rules in .htaccess for my weblog:

rewriteengine on
rewritebase /days
rewriterule ^([0-9]+)\.cas$ /days/mt2v.cgi?id=$1

and mt2v.cgi is a Python CGI with a great big lookup list in it. I could have just added a massive load of Alias directives or something similar, but mt2v allows me to catch any old links that I missed and show a “sorry, try the index” page. We now appear to be a lot closer to the One True Way of URLs for permalinks to weblog posts, specifically that specified by mpt in his definition of the ultimate Weblogging system, so perhaps it is easier to specify your URLs correctly from the outset now. But that’s taken a couple of years to refine with a hell of a lot of people working on it. In practice, if you’re running any kind of site with lots of stuff in it that isn’t just static individually created and named pages, then be prepared to build a big set of redirects every time you redesign anything on the back end, because you’ll realise you want to change the URIs then too.

None