Repair vs Replace

What are the economic effects of the repair vs replace decision? Interesting question, that.

If you missed “more local employment of the blue collar type”, go read this:

There is a slight diversion of purchasing strategy, repair rather than replace. This feeds a blue collar industry in the local region.

It used to be, when money was loose, replace with new was the norm. If the repair was 75 percent of the cost of replacement a new motor was ordered, the old motor was scraped, and the country of origin (Mexico, China, Taiwan) benefited. These beautiful USA built, 50 year old, 200 horsepower motors, were going to the scrap heap.

Now the repair industry is swamped.

Africans have known this for a long time, though for them, the causality is the other way around. If you don’t have the communications, transport, logistics and capital it takes to access new products made in far off lands, then you take the next best thing, which is to keep what you have working by repairing it.

My life in DocBook ligature hell

I am working on a new project. The result will be a document. I want to publish it in several formats, including HTML, PDF, and Word. (Hot tip: if you rename a RTF file to end in DOC, you’re done. Don’t make DOC files, they suck. Make RTF files, which any editor can read. You just have to trick your users and Word into using RTF’s by renaming them.)

The accepted standard these days for formatting a document into PDF, RTF and HTML is DocBook. In fact, the modern implementation of DocBook is just “XML + XSL (+ FO)”. You could do pretty much the same thing with XML and XSL yourself, but then your document would not be compatible with someone else’s formatting instructions, and you’d be redoing a bunch of work other people already did.

So DocBook is interesting, but by default it was making my document ugly. Really, really ugly. I just had to do something about it, and that lead me into playing with fonts and layout. Fonts went easy, because there’s really good info in DocBook XSL: The Complete Guide. Farting around finding free TTF fonts was a pain in the butt, but I eventually paired Futura with Garamond, on the advice of the nifty (and niftily named) Esperfonto.

Since I was obsessing about the way the page looked, I decided it would be nice to turn on whatever magic DocBook has available to make printed pages look nice. After all, if DocBook is good enough for O’Reilly, it ought to be good enough for me. I’d already noticed that DocBook was making my quotes curve (as long as you use the hideously verbose <quote></quote> tags). Then I looked into getting my apostrophes to curve.

Hello? Tap tap. Is this thing on?

Turns out the number one rule of the DocBook Club is you don’t talk about the DocBook Club. There’s plenty of mailing lists and stuff, but there are no answers. Eventually, it seemed to me the actual answer is “insert the Unicode symbol for them yourself”.

Wow, that’s seriously fucking stupid. Not even Word is that stupid… and I thought Word had the market cornered on stupid.

So I gave up on curved apostrophes for a bit and went to go turn on ligatures. Since you are probably like me and don’t know your ligatures from your descenders, check out this great picture:

Click on the picture to go learn more. It’s a great website — lots of typo geekery and puns… my kind of stuff. There’s also cool stuff on ligatures there.

So after much gnashing of teeth and experimenting, here’s what I’m coming to see about DocBook, PDF and HTML:

  • Ligatures work, and can be quite beautiful.
  • Ligatures make searching in the PDF document fail mysteriously, because the underlying word is gone, and what remains are the characters that get displayed. “Difficult” is a different word than “Di ffi-ligature cult”. Because PDF is all about the flash, no one has gotten around to fixing this. It would take rocket science. What needed to happen was about 20 years ago someone should have stood up and said, “wait! words are words, and instructions for showing words are not words, and when the two are different, both have to be preserved!”. And in fact, MacOS seems to have this… watch this video to see that Macs can add ligatures “on top of” underlying text without forgetting what the text itself is:

    Using typographic ligature on Mac OS X from Cédric Hüsler on Vimeo
  • Ligatures don’t work with all fonts. That makes them tricky to use in PDF (but doable) and really dangerous to do in HTML (where there’s no guarantee what font you’ll get).
  • DocBook has no support whatsoever for ligatures, just as support is absent for curved apostrophes. It just boils down to “type the Unicode”.

So, now I’m contemplating one of two ways forward:

  • Just forget them all together, which would be a shame
  • Write a script called “ligify” that finds all the ligatures and puts them in, and only let it run for the PDF generation, not the HTML generation. (Bad interactions between nXML mode and XML’s stupid macros mean I already have to do my own macro expansion with sed anyway.)

I’m becoming an expert in DocBook publishing, which would be a nice thing to have on my resume, except that I fear I’d slit my wrists if I was doing this stuff every day. How can it be that SGML has existed 20 years, and it’s STILL THIS BAD? This is clearly an example of Leonard’s Law (software will be as bad as its users will tolerate).

Unlocking the 3Skypephone (AMOI WP-S1, WP-S2 and others)

I have a mobile from 3. It has Skype on it. It is the second worst mobile phone I have ever owned. The worst was the Danger Hiptop, a phone with a software bug preventing it from ringing. (You can’t make this stuff up.) The third worst phone I ever used was a Motorola. And while we are on the subject of crappy phones, ZTE makes cheap phones for Africans with prehistoric UI — but they are learning fast and will come eat Nokia’s lunch some day, mark my words. But that all wasn’t supposed to be the content of this post…

Here’s the content:

If you want to unlock an Amoi WP-S1 (and many other Amoi phones) you need to download a program call DC Unlocker. You need to install the right drivers so that you can talk to your phone with the USB cable. The lightest weight way to do this is put in the CD-ROM that came with the phone, then cancel out of the autorun crap from 3. Plug in the phone, and use Windows Plug and Pray’s UI in advanced mode to load the drivers in the USD drivers directory of the CD-ROM. You have to do the whole thing 4 times, because the phone presents itself on the USB bus in four different ways. Each time you have to agree that you are installing an unsigned driver (because Amoi was too cheap to get them signed). By using Windows to install the drivers, you get only the drivers and not the other 200 megs of crap on the CD.

Next, you start up DC Unlocker. Tell it you have an Amoi phone, and let it auto-detect it. When it sees your phone, you are ready to pay (at this point you can be confident you’ll be able to unlock it). You click “About” and “Buy credit”, then buy 10 credits for your WP-S1. You have to go find the right number of credits for other phones. (Too bad DC Unlocker doesn’t do this itself.) Ignore all the hooha about dongles and value packs, etc. That’s for the professional unlockers. Just buy 10 credits. They take paypal. Quick, easy, and safe.

Back in DC Unlocker, click on “Server” and use the new username and password you just made. You’ll see your 10 credits. Click on “Unlock”, then “Unlock phone”. Wait a bit, and you’re done.

This is painless and cheaper than the guys in the shops (who are likely doing the same thing anyway, but charging a markup on it). The software is of a surprisingly high quality. I’m very impressed, and I’d be happy to use DC Unlocker again.

Exiting from xsltproc with an error

Does anyone out there know why xsltproc and the DocBooc stylesheets are so stuuuupid? When there’s a processing error, they just keep going. OK, fine, maybe useful. But then there’s no return value to say that there was a problem. The man page for xsltproc says it has return values, but it always returns 0 for me. And I’ve found the place in the DocBook stylesheets where the error is emitted. It looks like this:

      <xsl:message>
        <xsl:text>XRef to nonexistent id: </xsl:text>
        <xsl:value-of select="@linkend"/>
      </xsl:message>

The xsl:message tag supports an attribute of “terminate = yes”. So that should do it, but it doesn’t. When I add it, xsltproc terminates, but still returns result code 0.

How can it be that NO ONE has ever tried to put xsltproc into a makefile, and wanted make to correctly stop when there’s a problem with the input? What is WRONG with these DocBook bozos?

Arrrrgh.