Alastair’s Place

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

Unexpected Plumbing

Well that disrupted my day. This morning, we turned-on the taps in our house to discover that the water was full of small, spherical, amber-coloured particles. Well, some of the taps, anyway… after a bit of experimentation, I managed to isolate the problem to those taps that draw water directly through our water softener, which gave me a big clue. The fact that the particles were so uniform, both in colour and in approximate size and shape, was another clue that they were man-made rather than natural in origin, and I finally realised that they were, in fact, the resin from the ion exchange column in the water softener. Which means our water softener is kaput.

Anyway, thankfully the water softener is easy to isolate, so the problem is fixed, for now—although we are, of course, now stuck with hard water, which means we use more soap and also that we need salt for the dishwasher (which we didn’t have, so I had to go and get some). Plus we’ll have to descale the kettle more often.

Not the most auspicious start to a Sunday, I think you’ll agree. Still, as unexpected adventures in plumbing go, it could have been a lot worse.

Finally, the Logo Is Right on IE/Windows!

Anyone viewing this site from Internet Explorer on Windows will have noticed that the logo in the top left seemed to have a grey background rather than being the same colour as the rest of the page. This didn’t happen on other browsers, because Internet Explorer is the only modern, graphical, browser that doesn’t support transparency in PNGs.

Those of you that develop your own web pages may say, at this point, well, that’s not hard to fix, however the solutions that are out there at the moment deal with <img> tags, whereas the logo on this site is done using a background-image: setting on the CSS body style.

If only Microsoft would fix its broken browser. Their Mac team did it, because transparent PNGs work fine on the Mac version of Internet Explorer, but, sadly, the PC version still isn’t fixed.

By Popular Request

…I’ve added an e-mail link to the sidebar on the right hand side.

If you use a browser that doesn’t support Javascript, or the Javascript support is disabled, you’ll find that the e-mail link is replaced by a request for you to post a comment. The Javascript is there to make it harder for spammers to harvest my address; but don’t despair, comments posted on my weblog reach me just as quickly as e-mails.

Also, comments don’t put your e-mail address on the Internet, so posting a comment on this site shouldn’t cause you to receive any additional spam that you weren’t already getting.

Possible Outages

I’m currently fiddling with my site a bit (actually, I’m rearranging the directory structure), so there’s a possibility that my site could go down at some point. If it does, then please accept my apologies for the outage.

Update: I’m done fiddling now.

Company Formation

This is one of those things that seemed a bit daunting at first, although the more I found out about it, the less awkward it seemed to be.

Anyway, I have incorporated a company (in fact, it was incorporated yesterday) through which I can sell my products. The next few things to do are:

  • Transfer the 1 share that was subscribed to by the company formation agent into my name.
  • Decide on the accounting reference date (currently this is 31st March, which means, coincidentally, that the company’s accounting year runs in step with the tax year… I am undecided as to whether or not this is a benefit).
  • Decide how to invest money in the company (e.g., whether all of my investment should be in the form of share capital, or whether I take another route).
  • Open a bank account for the company.

I should also be getting a form from the Inland Revenue, which I will need to complete and return to them, although if I don’t receive it within a sensible amount of time I’ll need to contact them.

And on top of all that, I’ll want to register for VAT.

Once all of that’s done, I’ll be pretty much up and running!

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.

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 :-)