Alastair’s Place

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

Cheek!

Everybody knows PC World staff don't know what they're talking about, and that the shop is a pretty expensive place to buy things, and in any case doesn't carry many of the best products. Still, I like to go in and browse occasionally, just to see what they do have.

Anyway, as a self-confessed technophile, I often find it frustrating when their staff are giving customers incorrect advice. Usually I don't bother correcting them, but today, I pointed-out to the customer and the member of staff in question that the customer's request for “something that would let me use the Internet and the telephone at the same time”, could easily be fulfilled by getting a DSL connection, or even 2B ISDN (although that remains unreasonably expensive in the UK, partly due to the cost of installing ISDN lines in BT's Ericsson exchange gear). Even if the customer had wanted to stick with a 56K modem, there are boxes available that will alert you to an incoming telephone call whilst connected to the Internet, and that can even disconnect your modem for you when you lift the receiver on your telephone.

Update: I notice that Tiscali are even offering a lower-rate broadband package, 150Kbps for (at time of writing) £15.99 a month, with a free modem and free setup. That's similar pricing to paid-for Internet access using a Modem!

Predictably, the member of staff, who had initially told the customer that there was no solution to his problem, responded by being rude and patronising. Plainly, an oik with a PC World training course under his belt is more qualified to talk about telephony and the Internet than someone with a first-class honours degree in Information Systems Engineering and who used to work in the telecoms field.

There is one thing for certain, however… PC World staff are much better qualified to be rude.

Arrows and NSBezierPath

One question that has popped-up on Apple's cocoa-dev mailing list a couple of times is how to put arrows on the ends of lines. Some operating systems have built-in support for arrows, but Cocoa and Core Graphics, in common with their PostScript and PDF roots, do not.

It is quite easy to draw a simple arrow on the end of a line or curve, by creating a triangular path and rotating it according to the orientation of the line or of the tangent to the curve (remember that the tangent to a Bézier curve at its end-point is just the line passing through the end of the curve and the adjacent control point). This looks fine for lines, but is sub-optimal for curves… which is why MetaPost, a graphics language often used with TeX, uses curved arrow heads on curves. The actual process used by MetaPost's libraries is that the end of the path is clipped using a circle, then the resulting segment is rotated either side of the original path, and the two floating ends are joined.

How can we do this with Cocoa? Well, we need some additional methods on NSBezierPath to let us chop-off a section of a particular length, but otherwise it's pretty straightforward. Take a look at [this code](/projects/ArrowDemo/), to see how it's done. The code is under a BSD-like license, so you can use it in your applications (if you want).

Menu Extras

Command dragging a menu item

Every so often, I notice something new about the Mac user interface that I haven't spotted yet. Usually it's something really trivial, something that long-time Mac users expect everyone to know. Well, today I noticed that you can drag menu extras around on the menu bar, provided you hold down the Command key. This also explains how you remove them (especially the scripts menu) once they're on there, which had been puzzling me for a while.

G5 PC

Oh My God! (Excuse the expression, but you'll find-out why in a second...)

Now, I know some people can be daft about computers, you know, overdoing the advocacy thing. But this really takes the biscuit. Someone called “Andy” was lucky enough to have his parents buy him a PowerMac G5, which is a thoroughly excellent machine, and quite expensive to boot. This article tells you what Andy did to his lovely PowerMac G5.

It's blasphemous.

I mean, ruining such a nice machine.

If he wanted a PC, all he needed was a case. Instead of which, he did that!

Eugh. I think it's going to take me some time to get over the shock.

If anyone else out there is equally insane and is thinking of doing the same, I'll quite happily swap your new G5 for a PC case. That way you won't have to do any DIY.

Update: it seems that the G5 PC thing was a hoax. The guy that claimed he'd done it actually got an empty G5 shell from somewhere :-)

Portable Computer Games

Groklaw recently ran a poem by Scott Lazar about leaving Windows (for one of the Open Source operating systems). One of the posts in response to that pointed-out that a major factor preventing people from leaving Windows for other operating systems, including Mac OS X, was the availability (or rather lack of availability) of computer games; currently, an awful lot of games are released only on the Windows platform.

That got me thinking… how hard is it really to write a portable game? Games developers commonly claim that they don't have the time or inclination to port to the Mac, and that it would cost too much. That, however, seems like an odd position to take, given that there are 9 million users of Mac OS X, and another 10 or so million on Mac OS 9; assuming U.K.-like pricing, we're talking about anything up to £700 million of potential sales (that's about $1.2 billion at current exchange rates). Is it really that costly to do a port?

It's even more galling, in a way, because most of the portability issues have already been addressed; indeed, both id software and Epic Games Corp, the makers of the Quake and Unreal families of games software, have solved the problem of writing portable computer games. And the Open Source community has gone a long way towards helping realise this kind of thing, releasing a large number of portable libraries that can be used for games development.

Anyway, I've written a short article detailing some common mistakes that people might make in this context, as well as providing lots of useful links. I doubt anyone will take any notice, but we can always hope.


Update 2011-10-14

Since I wrote this, the situation has changed markedly, and many more games developers are actively writing portable code and/or explicitly targeting the Mac platform. It no longer seems terribly necessary to have the original article around, since there are plenty of better resources on the Internet.

Joking at Airport Security

You know, I really thought that the UK was the only country stupid enough to do something as daft as arrest someone for making an obvious joke when asked about the contents of their luggage at an airport. I am, of course, referring to the unfortunate American who, as a citizen of Chicago, joked to airport check-in staff that he had a gun in his violin case. He even showed the woman in question the contents of his violin case (a violin, of course), but, despite this, she still called the police, who arrested him, held him for 24 hours (causing him to miss his flight), and had him banned from all future flights with that airline and a number of others.

The level of stupidity required to do this is, frankly, beyond belief. First and foremost, the incident, which was recorded as part of the BBC's Airport series, was obviously a case of a harmless joke. For one thing, everybody knows that stereotypical Chicago gangsters from the days of Prohibition keep a tommy gun in their violin cases. For another, the man quickly explained that he was joking, and opened his case to prove it. If I were in charge of the check-in staff, I would probably have sacked the woman on the spot. If I were in charge of the police officers who thought it appropriate to arrest the individual in question, I would probably have severely reprimanded them for their behaviour.

But now, it seems that the United States is also afflicted with the same problem; according to this story from the BBC News site, a Briton, Ms. Samantha Marson, was arrested in Miami for joking that she had three bombs in her bag. I imagine that it was probably obvious that she was joking. For one thing, no suicide bomber or terrorist is going to tell airport staff when asked that they are carrying a bomb; if they were that stupid, then they wouldn't have been able to get their hands on one in the first place. No, this is sheer bloody-minded idiocy, just like the similar incident with a U.S. citizen in the U.K.

Sergeant Joe Wyche, Detective Robert Williams and whoever else are responsible for this stupidity should be suspended. At once. Clearly if they feel that an appropriate response to a joke is to arrest someone and threaten to take away their freedom, not to mention waste an enormous amount of court time and other resources in doing so, then they are not fit to be in public office. The same goes for any law-maker that thinks that making it illegal to joke about the contents of one's bag is a good thing and will do the slightest bit to combat terrorism. Terrorists won't tell you they are carrying a bomb or a gun. The only people that might are members of the public making an innocent joke, and if someone can't distinguish the two, then it seems to me that they shouldn't be working in airport security on either side of the Atlantic.

The only purpose served by this sort of thing is to make the rest of the world laugh even harder at American and British stupidity. Come on people, let's have some common sense.

Nearly There!

Today was a major milestone in my project… the basic GUI functionality is now done! I've already completed my command line app., so the vast majority of my first product is now pretty much done (I just need to do some polishing and testing).

I have thought of a couple of additional things that I'd like to have before the first version that I actually ship, but they're fairly minor and should be pretty easy to do.

And there's a manual to write :-)

Anyway, I'm getting quite excited, because I'm rapidly approaching the part I've never done before… that is, starting a company and actually marketing and selling something. I don't yet know how well my product will sell (although I do have some facts and figures, so I have a few ideas), but then even if it doesn't do all that well, I think there's a good chance I'll be happy enough. Still, we'll see :-)

Spirit and Opportunity

It’s nice to see a mission to get something to Mars actually go to plan; we haven’t been doing too well in recent years, what with Beagle 2 (which still hasn’t been found, although Colin Pillinger and team still haven’t given-up hope) and the disastrous 1999 NASA missions, Mars Climate Orbiter (which is believed to have burned-up in the thin Martian atmosphere), and Mars Polar Lander, which was lost together with its sister mission, Deep Space 2.

Anyway, Spirit has landed on Mars and has already sent-back some awesome pictures, which NASA have placed on their Mars Exploration Rover Mission website.

I have to admit feeling sorry for the Beagle 2 team, especially Colin Pillinger, who turned the mission into a personal crusade to show that we (in the UK) really could do this. Along the way they have made some remarkable achievements, especially in terms of miniaturising the scientific instruments so that Beagle could come-in under the tight weight-limit imposed by constraints on the launch vehicle. All, of course, in stark constrast to the comparitively well-funded American effort, whose rovers cost somewhere in the region of half a billion dollars to develop.

It’s a shame that the British government hasn’t shown more of an interest in space; at more than one point in the past, we have had world-beating technology, only to be stymied at the last minute, usually by a complete lack of interest from the establishment… Black Knight and HOTOL are probably the most prominent examples, but there are others too (see the excellent article “What went wrong with Dan Dare?”, written by Dave Wright and Nicholas Hill for History Today magazine—for those that don’t know who Dan Dare was, take a look at www.dan-dare.net and www.dan-dare.org.)

Having said all that, it is interesting to note that, despite strong competition from the United States in the form of Boeing and Lockheed Martin, the French Arianespace company still manages to dominate the commercial launch services market, attracting over 50% of the global market for geostationary satellite launches. So at least Europe isn’t doing too badly as a whole, even though we only spend one quarter as much as the U.S., per capita, on space exploration and research.

Still, who knows… the growth of amateur rocketry in the U.K., coupled with the enthusiasm drummed-up by the likes of Colin Pillinger, may yet see Britain re-entering the space race, albeit in a rather unusual manner.

Automatic Fines for Late Payment of Road Tax?
Yet Another Stealth Tax?

I just read on the BBC News website about the change in the road tax rules in the UK that has come-in today. It seems that now, if we fail to renew our road tax within 14 days of the previous tax disc expiring (even if we do not use our vehicle on the road during that period), we will be automatically fined £80. Nice.

I don’t object to paying the tax—and I have always paid on time, although I imagine that at some point in my life I may very well forget or be otherwise occupied and as a result miss the new 14-day deadline. No, what I really object to is the guilty-until-proven-innocent attitude that is taking hold in the bureaucracy at the centre of the British government. What they are saying is that if we fail to renew within 14 days, they will presume we are guilty of attempting to evade road tax and they will fine us. I suppose if we complain we will probably be told that we should be thankful that they deign to remind us that we need to pay it… after all, they don’t bother for the M.O.T., arguably a far more important event in the annual life of a motor vehicle since it is the M.O.T. that is the government’s mandatory test of roadworthiness.

Of course, the cynic in me says that they have statistics on the number of people who renew within various time periods after the reminder and have decided that £80 times the number they will catch with this new rule is about the amount of money that they would like to bring in. Actually, the realist in me says that too. This isn’t anything to do with catching tax evaders; it’s a cynical attempt to impose an additional tax on the people they know full-well will occasionally forget or be delayed in renewing their road tax.

The thing is that, assuming that they can fine people automatically, they could just tax them automatically instead. But that would deprive them of their additional revenue. And it would be far too convenient for road users as well as entirely fair.

Personally, I don’t believe that there is ever a place for automatic fines; they will always catch-out a number of people who never intended to do anything wrong… indeed, I suspect that in many such systems, these people are in the majority. They breed unnecessary resentment and simply cause stress for all involved. The powers that be often institute “appeals” mechanisms to right such wrongs, but they know full-well that the majority of people would be discouraged from appealing, whether because of a desire to forget about the whole unpleasant business as quickly as possible, because they do not see a hope that they will prevail, or simply because they don’t have the time.

End of the PC BIOS?

Intel, it seems, have plans to finally dispose of the quagmire of unmitigated awfulness that is the PC BIOS. The BIOS, which is responsible for starting-up all PC-compatible machines, testing and initialising hardware and booting the actual operating system, has been around since the very earliest days of the PC, and, largely as a result of technological progress during that time, has accumulated a myriad of bodges, hacks and additional interfaces to provide access to newer hardware whilst retaining backwards-compatibility with software written for earlier systems.

What I find slightly odd, however, is that Intel has chosen to develop its own system, known as Extensible Firmware Interface (or EFI), rather than adopting the existing industry standard, IEEE 1275 Open Firmware, as used by Sun, Apple, IBM, Motorola and others. This seems a shame, particularly as Open Firmware is already established as a solution to the problem of processor/system-independent initialisation of PCI (and other) devices; indeed, it has been around since the days of S-BUS (see this article in Byte magazine and Matthew Johnson's Open Firmware page).

By adopting Open Firmware on the PC platform, Intel would have flattened the market for PCI hardware to the extent that boards intended for RISC workstations would function properly in PCs and vice-versa, resulting in more competition and lower prices for owners of Macs, Suns, and other RISC-based machines… conversely, by insisting on yet another proprietary solution (which will, no doubt, become a de-facto standard, most probably through nothing more than the market dominance of EFI's supporters), they maintain the artificial and unnecessary distinction between PCI cards developed for the RISC world and the Wintel oligopoly, forcing prices up for owners of non-Wintel systems as well as increasing costs for PCI card vendors (who now have three separate sets of drivers to write… x86 binary, Open Firmware FCode and EFI Byte Code).

It has been suggested that one of the major reasons that Intel and Microsoft are supportive of EFI is that it forms part of their plans for the Trusted Computing Platform (see the Trusted Computing Group site), where your computer is trusted by them to restrict your access to information.

The question that we (the computing community) should be asking ourselves here is why it is that we need yet another proprietary technology, and why existing tried-and-tested, standards-based solutions are not the appropriate solution in this case.