Archive for May, 2008

Mac OS X 10.5.3 and Office 2008 SP1: Are Spaces Finally Fixed?

Friday, May 30th, 2008

Mac OS X 10.5.3 is now available on auto update. I am about to reboot and install, but before I do will cross my fingers and hope that between this and the recent Office 2008 service pack, the annoying issue with Spaces and Office is now resolved.  Let’s find out…

…that’ll be a resounding NO then. It just doesn’t work - especially if you have multiple Office windows open (for example, Word in addition to its Formatting Pane). As you move from Space to Space, windows jump around all over the place, either apparently following you or running away from you, resulting in a pretty dismal experience.

Also, Spaces in general doesn’t seem particularly polished to me. When I leave one Space for another, do a bit of work and then head back to my original Space, I want it laid out exactly as it was when I left it. This is quite often not the case, however: if, say, I have Finder windows open on multiple Spaces, clicking any of them will bring them all to the foreground - even those on the other Spaces. I also encountered other minor niggles whereby certain dialog boxes (if that’s what they’re called in the Mac world) would vanish behind other windows after a simple flick between Spaces with no other interaction with the OS.

So it seems that Spaces still cause more problems than they solve for Office 2008 users, and perhaps have a few issues that need ironing out in any case, which is why I am leaving them disabled until a glorious future date.

Email with EC2

Sunday, May 25th, 2008

A quick search of the web reveals that Amazon’s EC2 is perhaps not a great choice for a host when it comes to sending emails. Workarounds exist - using a 3rd party forwarding service, for example (see Paul Dowman’s blog for a good discussion) - but what do you do if you have to send emails from your EC2 instances? What can you do to give your email the best chance of getting delivered?

Here are some ideas that should help things a little:

  • Make use of Elastic IPs: assign a static IP address to your instance.
  • Check that your IP address is not blacklisted (a quick Google search reveals several tools).
  • Assign a hostname to the server that matches an actual DNS record that’s pointing at it. The default EC2 hostnames have embedded IP addresses that spam-prevention systems may be wary of. Actually, it’s probably worth adding the hostname to /etc/hosts too (use the private IP for this), and on Fedora at least, you probably want to set the hostname in /etc/sysconfig/network so that it persists across reboots.
  • Make sure you are sending emails with a From: address matching the domain in question, or any domain that actually has records pointing at the machine if you are hosting multiple.
  • Create an SPF record for your domain that authorizes your EC2 instance to send email.
  • If necessary, be sure to tell your MTA to trust the applications you are using to send email - e.g. mongrel and apache. With sendmail you can do this by adding the users that these applications run as to the file /etc/mail/trusted-users and restarting the service. Not doing this can result in the MTA leaving warnings in your mail headers.
  • Finally, use some decent content in the email - the less your email looks like spam, the more chance there is of it getting past (say) a Bayesian filter.

Please respond if you have any feedback or further tips when it comes to emailing from EC2.

MySQL Query Results as CSVs

Sunday, May 25th, 2008

Here’s a simple example showing how to export the results of a MySQL query to a CSV file on disk:

SELECT some,fields,to,export
INTO OUTFILE '/tmp/sqlresult.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'
FROM some_table WHERE some_other_field=123;

Hopefully that’s reasonably self-explanatory. Obviously you’ll edit the SQL accordingly and replace /tmp/sqlresult.csv with the path to the file you want to create.

Passenger (mod_rails) vs Apache/Mongrel

Saturday, May 24th, 2008

Having been a long time advocate of the Apache/Mongrel Rails ever since Coda Hale blessed us with it some time ago, I’ve not since paid a huge amount of attention to the alternative Rails deployment options that have come and gone. Not, that is, until the arrival of Passenger (aka mod_rails).

In my humblest of opinions, the deployment of Rails is not as straightforward as it could be. It’s always been something of a chore, and more recently has become a little overwhelming in terms of the number of software configurations available to do the job, each setup apparently faster and more scalable than the last.

PHP developers have enjoyed mod_php for many years now, and whilst not without its issue, it certainly makes for straightforward deployment of PHP applications. If Passenger lives up to its promise, Rails developers can now enjoy the same blissful roll-out of their own applications.

In the ever-useful Ruby Inside blog, Peter Cooper provides a useful collection of passenger resources that will surely help with the adoption of this upcoming technology. I’m still running Apache, Mongrel et al at the moment, but am very keen to see if Passenger can make my life easier. I’m also considering a move from VPS hosting to Amazon EC2 in the very near future, so perhaps I can kill two birds with one stone…

SVN+SSH on a Non-Standard Port

Friday, May 23rd, 2008

In order to use svn+ssh:// URLs on a port other than 22, you need to edit your subversion configuration and define a tunnel.

Open up ~/.subversion/config in your preferred editor and head to the [tunnels] section. In here you can add something along the lines of the following:

myscheme = ssh -p 12345

This will enable you to work with URLs like: svn+myscheme:// and connect to Subversion on SSH port 12345.

Of course, there are also other SSH arguments you can include, such as the username to connect with, whether to use compression, and so on.

Mac Mac Mac Address

Tuesday, May 20th, 2008

To find the mac address of your MacBook’s wireless interface:

  1. Open up Network Preferences
  2. Select AirPort and click the Advanced… button
  3. The mac address will then be listed as AirPort ID

Quickest Way to Truncate a File in Linux

Tuesday, 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

Sunday, 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

Sunday, 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

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