June 14, 2006

Cocoa Keyboard Coolness

One of the things that I've found difficult about adapting to OSX is the behaviour of the keyboard. It seems that each application requires different keystrokes to move the cursor to the end of a line or to scroll to the top of a page. The thing that annoyed me the most was that the page up key (ctrl-up or fn-up in the text editor application) does not move the cursor back by one page in the text editor. It scrolls the view buffer by one page, but doesn't move the cursor.

In my search for a solution to this problem, I learnt about a very cool feature of the Cocoa UI controls that newer OSX applications are built with: the key bindings can be altered system wide (or on an individual user basis). Just by editing some simple files, I have been able to make my Mac move the cursor up and down by a page in all applications that use a Cocoa text editing control - the text editor application, mail, and others. That's a nice fix, but what's even better is that I can add new functionality to all applications by describing sequences of actions to take on certain key presses. If you are a keyboard user with a Mac, I strongly recommend reading the following pages to learn how to do this:

I really don't like to have to reach for the mouse to perform a simple operation, especially on a laptop where the mouse pad is a nuisance to use. Eventually I'll learn shortcuts for all the things I do regularly, but in order to do this it helps to be able to explore the menus. In MS-Windows, Gnome, or KDE, I can always access application menus by holding down the ALT key and pressing the first letter of the menu item name. This doesn't work in OSX. The closest I've been able to find is to use Ctrl-F2 to move focus to the menu bar, then letter keys or the arrow keys to navigate around. Ctrl-F3 moves focus to the Dock, and Ctrl-F8 moves focus to the status menus at the top right of the screen.

The trick to enabling this behaviour on a new Mac laptop is to open the Keyboard & Mouse part of the System Preferences application, select the Keyboard tab, and select the checkbox labeled 'Use the F1-F12 keys to control software features'. You may need to press Ctrl-F1 to switch on this type of keyboard access. Having done this, you'll then need to use the fn key in conjunction with the function keys to access their hardware specific role, e.g. fn-F5 to increase sound volume. While you've got the System Preferences application open, you can also switch over to the Keyboard Shortcuts tab and select the radio button labeled 'All controls' at the bottom of the dialog. This will enable you to move between controls using the Tab button. When a dialog with buttons is presented, for example, you can tab to a button then use the space bar to press it.

June 11, 2006

I, Newbie

On Friday I bought myself a new laptop. I'd been quietly iCurious for a while and then vocally so for the last few weeks, so I bought myself a Macbook Pro. The last time I used an Apple for any length of time was over ten years ago (and the first time about 25 years ago!), and it seems like I haven't remembered much from that experience.

Everything seems so foreign that suddenly I feel like a complete newbie. Different GUI, a mouse with bits missing, and an even stranger keyboard. I guess I should try to remember this feeling.

The first thing I wanted to do was learn more about the hardware I had - hard drive, memory, video memory, USB hub details, etc. I looked around in the applications folder but I couldn't see anything obvious that would describe the hardware. I started up a bash shell to look for something like the /proc directory I'm used to in Linux, but couldn't find anything so I was only able to answer the basic questions (e.g. df -k to check the drive size). Eventually I found what I wanted: the System Profiler application. As it turns out, this application gets started when you click the More Info... button in the About This Mac dialog that is accessible from the apple menu at the top left corner of the screen. I didn't click that button first, though, and I don't think I even noticed it. The distraction of all the new stuff seemed to affect my ability to see what was right in front of me. That's worth remembering too, for the next time I see someone using one of my applications for the first time.

February 23, 2006

A reason to Ruby

Like many others, I've been playing around with Ruby a lot lately, and of course I have been very impressed with the language. I'd like to be able to say it lives up to the hype, but I don't think it's possible for anything to ever live up to that much hype.

I've written the odd little script here and there, and thought to myself that this is what Ruby is good for. As much fun as it's been, nothing big has reached out yet and struck me as a great place for using Ruby in a more comprensive way. Until a few days ago, when someone pointed me towards Sketchup, which is a very impressive 3D drawing program. It doesn't feel like a full on 3D CAD package, but it's certainly a lot more than a 2D vector drawing tool.

And here at last is the cool part - it has a Ruby API that looks fairly comprehensive. Ruby just seems like a perfect fit for this situation. Now not only do I have a very interesting language at my disposal, I have something very cool to do with it. I wish the electronics CAD package I use provided for Ruby scripts instead of the half-baked C/Pascal type language it has.

Unfortunately, there is of course a down side. It costs USD$495, which I know is probably not that much for a good 3D package, but is too much for someone that doesn't really have a need for it. I'd like to be able to give the people who wrote this software money for their work, but I can't justify that much money (it's about AUD$675 if you're wondering) on a bit of fun at the moment. I've still got some time left on the free 8 hour trial, but after that I guess it's time for me to make another attempt at figuring out the Blender user interface.

February 14, 2006

The SuperBowl of teaching

Like about a hundred million other people, I watched the SuperBowl on TV last week. It was SuperBowl number 40, which reminded me that I've been enjoying American football for over twenty years now. I like it for the amazing acts of athleticism, the rapid changes in fortune, and the spectacle of it all. Some people have told me they find it boring because of the stop–start nature of it, but that suits me fine — I need those breaks in play to mentally process what's just happened.

It was an exchange student from the USA, Mike Mattson, who introduced me to the game. It had been shown on Australian TV for a while, but I hadn't found it very interesting. Mike patiently explained the basics of the game to me one day, and that completely changed my outlook. It was a relatively small investment on his part, but a large reward for me in the form of twenty years of enjoyment — as near as it gets to a something–for–nothing arrangement.

If there's a lesson to be learnt from this, it is that there are many ways to be an influential teacher, and most of them don't involve making lots of noise. You don't have to write books or present at the big conferences. All you have to do is tell someone something cool now and then.

February 8, 2006

No user servicable parts inside

A while ago, my TV stopped working completely. Nothing at all when I tried to switch it on. I left it alone for a week or two, but eventually it got to me - not so much because there was something I wanted to watch, but because I had a big expensive box of electronics in my lounge room that wasn't working. So I opened it up to take a look at what might be wrong. Fixing it was probably going to be more entertaining than the TV shows being broadcast anyway.

Given that it was completely unresponsive, and that the power indicator on the front didn't light up, the first place I looked was the power supply. Sure enough, it turned out it was just a fuse. As you can see from the picture it had blown in a quite spectacular way. It looks like it sensed some really bad TV shows coming and exploded in disgust.

The fuse has exploded in pieces over the circuit board.

It's interesting that the fuse is mounted inside the plastic power supply cage. For another device like a stereo system I might think that this made sense, because it prevents idiot users like me from accidentally touching a source of high voltage. But in a TV set, there are very high voltages in other exposed places that could also give a very nasty (probably fatal) shock. Surely a fuse holder accessable from outside the case would be safer, so that no-one is tempted to open the case?

I remember home appliances that used to have a screw-in fuse holder accessible from the outside of the box: changing a fuse like this is no more complicated or dangerous than changing a light bulb. There are of course reasons we don't do this any more. A fuse holder like this costs a little extra money, which makes it very unattractive to a manufacturer who needs to shave every cent possible off the cost in order to remain competitive. It is, however, concerning to see how disposable electronic appliances are becoming. I see discarded items on the side of the street every week around rubbish collection day, and I wonder how many of them could be fixed easily. I guess I should consider myself lucky that my TV set had a replaceable fuse at all. I wonder what's in a new TV set now?