Quickest Way to Truncate a File in Linux

May 20th, 2008

Ready? It’s:

:> filename

(i.e. colon greater-than followed by the name of the file). This can also be used to create a new, empty file.

Changing a Mac’s Name

May 18th, 2008

Having recently moved from the world of Windows, and even more recently picked up a 2nd Mac, and then even more recently again donated the original Mac to a relative, I hit upon the problem of both Macs having the same name. Of course the network address of each computer was different - one had a “-2″ appended to it, which I wasn’t particularly fond of.

Anyway, as usual, this turns out to be very easy to remedy:

  1. Open up System Preferences
  2. Under Internet & Network, click the Sharing icon
  3. At this point you can simply edit the computer name
  4. Use the Edit button to make changes to the network address (if still necessary)

Et voila!

Reminder: All S3 Bucket Names Must Be Globally Unique

May 18th, 2008

…including those used by EC2 AMIs.

If you get the following error after running ec2-upload-bundle

Server.AccessDenied(403): Access Denied
Bundle upload failed.

…then it’s quite possibly because your S3 bucket name is not globally unique (it doesn’t just have to be unique amongst your own S3 buckets, it needs to be unique amongst everybody’s).

Elasticfox

May 17th, 2008

Anyone interested in working with Amazon EC2 should definitely consider the Elasticfox extension for Firefox. It makes the whole thing a breeze and infinitely more accessible than working with the command-line tools.

The only immediate problem with it is the lack of documentation. Thankfully, some helpful users have gone a long way to addressing this by contributing their own instructions.

It’s also worth noting that the EC2 Getting Started Guide still makes reasonable sense when using Elasticfox rather than the command-line tools.

Papery Fix for Dodgy MacBook Trackpad Button

May 17th, 2008

Having been the owner of a white MacBook for a day or so, I’d been casually niggled by the inconsistent nature of the trackpad button. Press it on the right, you get a satisfying ‘click’. Press it on the left and not much happens - just a vague impression of movement with no real feedback.

A quick search on Google yielded an unlikely fix. Essentially, you fold up a tiny piece of paper and shove it in the battery compartment… and, questionable as it seems, it works! It took a bit of experimentation with the paper length (my MacBook seemed to need 2 1/2 inches rather than 4), but I now have a fully clickable trackpad button.