Alastair’s Place

Software development, Cocoa, Objective-C, life. Stuff like that.

Safari 3.1 and Acid3

OK, so I get 75/100 on Acid3 with Safari 3.1, with the following failures:

Failed 25 tests.
Test 01 failed: method [object NodeIterator].nextNode() didn't forward exception
Test 02 failed: expected '[object HTMLElement]' but got 'null' - expectation 13 failed
Test 04 failed: expected 'null' but got '[object HTMLIFrameElement]' - expectation 21 failed
Test 06 failed: expected '[object HTMLTitleElement]' but got 'null' - failed to handle regrafting 
correctly
Test 11 failed: when trying to surround two halves of comment: wrong exception raised; code = 3
Test 13 failed: collapsed is wrong after deletion
Test 18 failed: expected '10' but got '1' - DOCTYPE nodeType wrong
Test 23 failed: no exception for createElementNS('null', ':div')
Test 25 failed: failed to raise exception
Test 26 failed: e1 - parent element doesn't exist after looping
Test 27 failed: e1 - parent element doesn't exist after waiting
Test 38 failed: Value undefined (result of expression p.childNodes[1].replaceWholeText) is not object.
Test 42 failed: expected '1' but got '0' - rule did not start matching after change
Test 44 failed: expected '0' but got '1' - misparsed selectors
Test 46 failed: expected 'none' but got 'uppercase' - case y1 failed (index 25)
Test 59 failed: expected 'submit' but got '' - <button> doesn't have type=submit
Test 65 passed, but took 20ms 
Test 70 failed: UTF-8 encoded XML document with invalid character did not have a well-formedness error
Test 71 failed: expected '2' but got '1' - wrong number of children in #document (first test)
Test 72 failed: expected '3' but got '2' - cssRules isn't live
Test 75 failed: Value undefined (result of expression anim.beginElement) is not object.
Test 76 failed: expected '0' but got '100' - Incorrect animVal value after svg animation.
Test 77 failed: expected '42' but got '65' - getSubStringLength #1 failed.
Test 79 failed: expected '34' but got '33' - SVGSVGTextElement.getNumberOfChars() incorrect
Test 86 failed: calling setMilliseconds() with no arguments didn't result in NaN
Test 92 failed: Function object's prototype's constructor was ReadOnly
Total elapsed time: 0.32s

This compares with the latest Webkit nightly build, which managed a stonking 92/100:

Failed 8 tests.
Test 02 failed: reached expectation 13 when expecting expectation 12
Test 23 failed: no exception for createElementNS('null', ':div')
Test 25 failed: failed to raise exception
Test 26 passed, but took 74ms 
Test 65 passed, but took 17ms 
Test 69 passed, but took 31 attempts.
Test 70 failed: UTF-8 encoded XML document with invalid character did not have a well-formedness error
Test 75 failed: Value undefined (result of expression anim.beginElement) is not object.
Test 76 failed: expected '0' but got '100' - Incorrect animVal value after svg animation.
Test 77 failed: expected '4776' but got '5550' - getComputedTextLength failed.
Test 79 failed: expected '34' but got '33' - SVGSVGTextElement.getNumberOfChars() incorrect
Total elapsed time: 5.31s

Interestingly both of them seem to achieve the scores above plus or minus a point. I’m not sure why that is.

Anyway, pretty impressive, especially given the state of Acid3 rendering on other browsers.

A Whole New Use for Straight Quotes

It seems that the BBC has come up with a whole new use for straight quotes (the image is a link to the article on the BBC News site):

Quotes-for-emphasis.jpg

Yes, folks, apparently they’re now used for emphasis.

It’s pretty depressing to think that this kind of thing made it past an editor at the BBC.

You Don’t Need to Restart

The installer for the new version of MYOB AccountEdge Plus (previously known as MYOB Accounting Plus) restarts the machine.

It’s been irritating me for a while that a lot of software, particularly that written by companies who normally deal with PC software, unnecessarily restarts the machine once it has been installed.

Anyone writing an installer for Mac OS X should take note: You don’t need to restart the machine! In particular:

  • You don’t need to restart after installing an ordinary application. If your application isn’t showing up in Launch Services’ database, you might want to read about Application Registration, but ideally your installer should handle that for you.
  • You normally don’t need to restart after installing a shared library in /Library or /usr/local/lib, provided you handle the case where some existing programs are using an older version. Unless you are using shared memory or IPC in your library, you often don’t need to do anything. If you are doing the latter, you just need to make sure that either (a) the two can co-exist happily, or (b) you get the user to terminate anything that might be using the old version.
  • In most cases, you don’t need to restart after installing a KEXT. Instead, consider using kextload(8) in your postinstall script. If you’re replacing an existing KEXT, just use kextunload(8) to unload it first.
  • You don’t need to restart after adding launch daemons or agents, or if you’re using the older startup items. For launch daemons and agents, just use launchctl(1) to load their plists and start them. For startup items, use SystemStarter(8).
  • You don’t need to restart after installing plug-ins. You might need to restart the program that the plug-ins are for, but please check rather than just assuming because some software may be able to cope with plug-ins being installed (and even removed) at runtime.
  • Remember that Mac OS X provides UNIX-like deletion semantics. That is, you can safely delete a file that is currently in use; anything that has the file open will continue to see the original data until the file is closed.

So please, when you’re building Installer packages, don’t unnecessarily force the user to restart his machine. In particular, if you are not sure whether you need to restart, please ask someone on one of Apple’s many mailing lists or ask Developer Technical Support for their advice.

Don’t just assume that you should restart, because that gives a very bad user experience for your customers; remember, if the user reinstalls their machine from scratch, they may have to install many pieces of software, and if every one of those asks to restart their machine, they are rapidly going to become irritated; even if restarting is optional, end users have no way to know if a restart is necessary.

iPhone Background Communication

Craig Hockenberry (via DF) makes a good point about allowing arbitrary background apps to use the iPhone’s radios.

It seems likely that he’s right about the future direction Apple will take with this. My own preference would be for a generalised events framework, maybe based on the existing notification support. If it supported launch-on-notification, there wouldn’t really be a need for background apps at all, it seems to me. Doing things this way would mean that it was possible to co-ordinate use of the device’s radios in a sensible way, and it would also allow applications to ask to have code run e.g. at a certain time in the future, without having to leave any of their own code running in the background.

MPs’ Expenses

It’s easy to get all het-up over MPs’ expense claims, but it is worth remembering that some of this is here so that it’s possible for anyone to be an MP, no matter how much money they have, which is a laudable aim.

There’s no doubt it is a privilege that has been abused; there have been reports of MPs buying second properties a few minutes away from where they already live, reports of them buying properties that are just as far from Parliament as their main residence, etcetera. Those should clearly be stopped and the people in question censured for behaving in that manner.

iPhone SDK Restrictions

(The iPhone SDK is still under NDA; even though it’s being widely ignored, I’m only going to respond to articles others have published.)

There are a number of commentators, notably Rogue Amoeba, complaining about some of the restrictions Apple has placed on third-party applications.

Of Rogue Amoeba’s list, I agree with one or two of them; it would be nice to be able to run background agents (not full applications), but I think this is the kind of functionality that perhaps should only be made available to people who pay a bit more up-front than the current $99 charge, to discourage any misuse; and access to the host computer and the docking port would be pretty useful too, though perhaps there are security concerns about host access too… I can’t claim to have thought deeply on the matter.

A lot of the others are just crazy. We really don’t want code running on the iPhone to have root access, or to provide access to the entire filesystem. Both of those restrictions are good security features and should discourage people from writing viruses and other malware for the device.

As for the calls from various parties to allow VoIP over the cellular network, it doesn’t actually matter whether Apple does or doesn’t, because no cellular carrier is going to allow them at the network level. I also have my doubts that the call quality would be acceptable, especially as GPRS and EDGE tend to have a substantial latency for IP datagram delivery and VoIP has no built-in support for handling cell hand-off (unlike GSM voice, which works seamlessly in such cases). Moreover, I don’t think it would be fair to expect mobile phone companies to allow people to use their expensive wireless networks for free to provide their customers with a competing service at an artificially low price.

Shocking

Jeff Atwood on the shocking behaviour of G-Archiver.

When I first read this, I was angry. Really angry.

We developers already get all sorts of crazy and unfounded accusations about “violating privacy”, without some jerk writing software that really does steal your data.

For the record, I am an ACM member, so I have to comply with the ACM Code of Ethics that Jeff mentions at the top of his blog post, not to mention the various laws we have here in the U.K. on the matter (e.g. the Data Protection Act, which is overseen by the Information Commissioner’s Office).

Unbelievable

Some people are just unbelievable.

We definitely do not want this country’s legal system going the way things have in the United States. That this chap slipped on a grape is unfortunate and the fact that he was injured doubly so. But it is hardly the fault of Marks & Spencer. For one thing, he should have been watching where he put his feet; for another, I don’t see how M&S could possibly be expected to be responsible for a single grape ending up on the floor, whether in their store or in their car park.

Hopefully our judiciary has the sense to reject this nonsense.

I Hate Routers

I hate DSL routers. I don’t know why, but router manufacturers seem incapable of designing one that works properly. They’re usually let down by their software, and sometimes they’re also let down by their hardware too.

The most recent routers I’ve used are:

  • Alcatel SpeedTouch 780WL (Be branded)

    This one seems to be generally OK, although the web interface is pretty awful. I think the problem there is that Alcatel can’t make up its mind whether it wants the router to be easy-to-configure or full of features, so the web interface is an uneasy half-way house. The worst problem with it is that it’s badly organised and hard to navigate; there are pages that look just like the settings screens, but where you can’t change anything, and it often takes me a couple of minutes to find the right part of the interface. It seems to be fairly decent from the command line, though the docs for that are somewhat lacking. WLAN works OK on this router, which is a refreshing change.
  • ZyXEL Prestige 662HW

    The main problems with this router aren’t to do with the software, which is OK (not brilliant, but OK). It has a good range of features and a reasonable web interface, which is at least easy to navigate, unlike the Alcatel. No, the main problems are hardware ones. Firstly, this router’s input seems to be too heavily attenuated, as a result of which it has trouble sustaining a DSL connection at high data rates. I’m quite close to the local exchange, so there’s no good excuse for this, especially as other vendors’ products don’t suffer from this problem. Second, the WLAN is unreliable. When I bought this, I was hoping that I could replace an earlier ZyXEL Prestige (a 243, I think) and my Apple AirPort with just the one box. No such luck.
  • Netgear DG834N

    I bought this to replace the ZyXEL when it became apparent that I was going to have regular connectivity problems with the latter. It was easy to set up, with a simple web interface and the DSL connection has been very reliable with this unit. Unfortunately there are some serious deficiencies with the DG634N, which Netgear doesn’t seem to be in a great hurry to address:
    • It has a very small feature set compared to other manufacturers’ routers. On the plus side, that makes it easy to configure for end users.
    • It only supports 802.11n draft 1. Draft 2 has been “forthcoming” for some time now.
    • Its UPnP support is badly broken.1 As a result, it is impossible to use software that requires special support for NAT, unless the authors have taken account of the device’s eccentricities.
    • There is no command line.2
    Oh, and this is another router with unreliable WLAN. Maybe that’s because it’s trying to support 802.11n draft 1, but since I’m using 802.11g devices primarily, that doesn’t seem to be a good excuse. Nor does it matter how I configure the WLAN support. All of this might be OK if, as with other Linux-based routers, the firmware could be replaced with something a bit better. There are a couple of custom firmware packages out there, but because the drivers for the Broadcom chipset that is used by this router aren’t Open Source, they are basically the same firmware with rebuilt applications and/or modified web interface.

Anyway, in a fit of irritation, I bought myself a new Airport Extreme and a Netgear DM111P DSL modem. The Airport in particular was spectacularly easy to set up, though I would have liked to have been able to choose a subnet of 10.32.x.x which is what I had been using previously (10.0.x.x is no good because if I do that then I can’t connect to the VPN between my home and my office).

As a result, I now have reliable WLAN (with a better signal than I got from my previous Airport), a reliable DSL connection, and reliable NAT traversal courtesy presumably of NAT-PMP. I can finally screen share between work and home! Yay!

OK, so the AirPort Extreme isn’t terribly configurable and doesn’t support UPnP. It does work however, which seems to be something of a unique selling point in the home router market.

1 It uses the wrong namespace for responses ({urn:upnp-org:serviceId:WANIPConnection} rather than {urn:schemas-upnp-org:service:WANIPConnection}), and unhelpfully returns the wrong error code (402 Invalid Args rather than 713 SpecifiedArrayIndexInvalid) when you pass an out-of-range index to GetGenericPortMappingEntry(), which is irritating because the error is the only way to tell when you’ve finished enumerating mappings. 2 Yes, I know about debug mode and that you can get a Linux prompt, with all that that implies. That’s not the same thing, and as a result of the lack of a command line interface, the features in the web interface are basically all you get (unlike some other manufacturers’ equipment).