| Main |

February 12, 2004

My project (again)

It's now so close to being finished. I spent almost all of today and yesterday trying to get one of the UI elements just right, before realising that the reason that I couldn't make it work how I wanted was that I was going about it completely the wrong way ;-> That's now fixed, so there are just a couple of bugs left to fix in the user interface, then I can get down to some serious testing, manual writing and starting-up a company to sell the thing.

I'm pretty excited, frankly, and I'll probably find it hard to sleep tonight (although that is in part due to the large amount of strong coffee I drank earlier today…). It's nice to see the work I've been doing coming together.

February 9, 2004

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.

February 8, 2004

Arrows and NSBezierPath

ArrowDemo.app

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, 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).

A compiled version of the program is available here, or by clicking the image above.

February 7, 2004

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.