Proud iBook owner

As recently chronicled, my Powerbook is no longer viable as a portable notebook computer. This makes me sad. :’(

The obvious silver lining, of course, is that it provided an opportunity for a new purchase. So I umm-ed and ahh-ed about the new MacBook Pro, but it was pretty hard to justify the four or five grand it would cost me. And everyone warns you off getting the first release of a new generation of Apple hardware.

Also, as much as I love the 15” wide screen, the idea of the 12” form factor was very attractive—most of the non-desk places I’m likely to use a laptop lend themselves to small and light.

So it came down to either a 12” PowerBook or iBook. I finally settled on the iBook. While it’s even slower than my old Powerbook, the price factor was too good to ignore. Essentially, it would have cost me about $1,000 more for the 20% speed boost and marginally smaller size/weight of the PowerBook. I can save that money now and upgrade to a high-end Intel model sooner rather than later.

And perhaps more to the point, the iBook is less “precious”… I’ll feel more comfortable throwing it in my bag and whacking it out on the table of the local coffee shop, not having to worry about sullying its lovely finish.

I’ll be keeping it away from open milk cartons though…

Not such a happy ending after all

Well, some months have passed since my happy ending. Turns out it wasn’t the end, and it wasn’t so happy.

After a few weeks, my screen started playing up again. It was just an occasional flicker at first, but quickly degenerated into being almost unusable. I took the PowerBook back into the shop for another look, but they weren’t too optimistic. In a nutshell, they tried everything short of replacing parts, and the most likely part that would need to be replaced was the screen—at around AUD1,500, not really worth it.

The screen more or less behaves itself when left on for long periods (the problem seems to be partly heat related), so it was ok during the day at the office. But it is pretty useless for the train or coffee shop. So, I resigned myself to having a portable desktop. I bought a 17” LCD display for home, which along with an external keyboard and Mighty Mouse makes for quite a usable office machine.

Sigh. Maybe next time, I’ll get the extended warranty…

Apple Mail.app “not responding”

This morning, my mail server was rebooted by my ISP. This is not extraordinary in itself, but somehow it caused my mail client (Apple’s Mail.app) some confusion. It thought the IMAP server was offline (which it was for half an hour or so), and would not reconnect.

When I restarted Mail, it froze. “Application not responding”. Force quit worked to kill it, but it always froze on restart (even after a reboot). Other IMAP clients (I also use the excellent Mutt in conjunction with offlineimap, and when really desperate, Thunderbird) were working just fine.

I found this article on macosxhints, but its suggestion:

% cd ~/Library/Mail
% find . -name '.index.ready' -delete
% find . -name 'content_index' -delete
% find . -name 'table_of_contents' -delete

did not work. (Well, it obviously worked, the files were deleted, but it didn’t help the symptoms.)

I noticed another indexy cachey looking file in my mailbox directories: .mboxCache.plist. Deleting all of these:

find . -name '.mboxCache.plist' -delete

seemed to fix Mail.app for me.

NOTE I have no idea what this file is for, or what the implications of deleting it might be. It appears to have Worked For Me(tm), but it could also cause all your email to fall out of the back of your computer and make a nasty stain on your carpet.

PHP can’t talk to MySQL after OS X 10.4.5 upgrade

I just tried to access one of my local dev sites (that is, running on my powerbook), and received the dreaded “mysql can’t connect to socket” error:

Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'

I was sure MySQL was running (I could access it via the command line mysql tool, and MySQL Administrator). And it used to work… But sure enough, there is no directory /var/mysql, and no mysql.sock file in it. :-/

After a bit of digging around, I noticed that the php.ini file (/etc/php.ini.default) had been updated on Feb 8th, about the time OS X 10.4.5 was released. Hmm.

I don’t remember customising this file, but it certainly didn’t contain any customisation now. The “mysql.default_socket” setting was blank, meaning it would use the compiled-in default. I’m not sure whether PHP was upgraded with 10.4.5 and this changed the default, or if I had customised it previously and I’ve just forgotten. But either way, it was now looking for the MySQL socket in /var/mysql, and my version of MySQL (4.0.24) wasn’t putting it there.

So I created this dir and set its owner to mysql:

sudo mkdir /var/mysql
sudo chown mysql /var/mysql

and followed the instructions in this Apple support article by adding the following setting to /etc/my.cnf:

[mysqld]
socket = /var/mysql/mysql.sock

[mysql]
socket = /var/mysql/mysql.sock

(The last two lines are not mentioned in the Apple article, but are required for the command line mysql utilities to work.)

A quick restart of the mysql server later, and all is good again.

Know your bugs

From Wil Shipley:

I never, ever fix a bug, even from another user, unless I can say with some surety that I can see the circumstances that led to that person writing that bug. It may be as simple as “oh, copy and paste error” or “this person was tired and overlooked this edge case, and that didn’t come up until now.” But if you see a bug and think, “How in the hell did this code ever work?” then you’ve got a lot more work to do (assuming the code did ever work), because you aren’t allowed to move on until you can answer that question.

Understanding your code, and the underlying code of the environment you’re in, is more important than fixing any one bug.

Sage advice.