Monthly Archives: May 2008

Today, I (hope I) helped people

Today, I…

This is what I do. Most days, it is good fun. Some days, it is a little full on.

Advertisements

Building a Universal binary on OS X with gcc

Recently I’ve been trying to build a C application on OS X. It actually worked first time for me on an Intel MacBook Pro on Leopard (10.5) just via gcc *.c -o [outputfile] … but yesterday it was pointed out that the resulting binary is useless on a G4 Mac Mini.

The nice thing about Apple’s move from PowerPC to Intel chips is that they have this concept of a Universal binary – the same binary file can run on both PPC and Intel. The slightly complicated part is that you have to actually build your binary as Universal, it doesn’t happen automatically.

So it turns out the the corresponding magic-fu is:

gcc -O2 -Wall -force_cpusubtype_ALL -mmacosx-version-min=10.4 -arch i386 -arch ppc *.c -o [outputfile]

At a high level I’m telling the compiler to build for both i386 and ppc architectures. Note that I’ve also set a flag here to specify a minimum OS X level of 10.4 (Tiger).

Of course there are sometimes some coding changes required to support both processor architectures. Apple’s Universal Binary Programming Guidelines should help there.

Fedora 9 on a USB stick

Although you’ll most commonly hear me waxing lyrical about OS X these days, I’m a long-time Linux user. I’ve been running various flavours of Linux at home since Redhat 5.0 days.

Why Redhat and Fedora? Well, a good friend of mine noted a long time ago that it was the distribution likely to get the blessing of enterprise vendors as time went on. I’m not here to invite a flame war, and I’ve been impressed with a lot of other distros over the past couple of years in particular (while I keep meaning to give Ubuntu a “proper” run, I use it for development in VMWare Fusion on the Mac). I’ve run Fedora on a server and a workstation at home for a while now, and I’m always pretty keen to see what a new version has to offer.

Enter Fedora 9. I use my MacBook Pro pretty exclusively these days, so I just wanted a quick and easy way to see what Fedora 9 was like. I considered the Fusion option, but then read about the “Live USB” option. This is really nice… there’s a (currently Windows-based, sadly) desktop app that you run to select the “spin” of Fedora that you want, point it at an inserted USB memory key, and away you go… I chose Fedora 9 and let the Thinkpad download the image and then install it on my 1Gb USB stick. I also asked for a 200Mb “persistent overlay”, i.e. space that I could use for persistent storage of data like (I assume) my home directory. This is a far nicer option than a Live CD, as I can take my data with me.

A quick reboot, choosing a temporary boot device, pointing at the USB stick. The boot process was not all that promising, as it initially reported what looked like errors about inability to assign USB identifiers (or something), but it did all boot fine.

[click for a larger view]

In fact, it booted more than fine. I was pleased to find that Fedora 9 picked the “right” (i.e. max) resolution for my display straight away. The only customisation I needed to do to make the desktop more pleasant was to reduce the font size, but I can see why they went with the default size that they chose.

The next thing was to get myself online, or at least onto my home network. Based on past experience I went into the Network config under system preferences and started fiddling with the NIC settings. Didn’t work – although it could see the wireless card it didn’t want to let me join the network. Then I spotted the little wireless icon in the system tray at the top right of the screen, and clicking there let me join my home network immediately – with OS X levels of ease. Very impressive stuff.

Sound worked straight out of the box too… if I come across as surprised, remember I’ve been using Linux since RH 5 and I’m well aware of how flaky much of this stuff has been over the years.

Firefox worked fine, Pidgin let me configure my Google Talk account within seconds, taking a screenshot and editing in Gimp was no problem… this was a lovely experience overall. I was even able to install the Flash plugin for Firefox (although I had to download and install the RPM via sudo, rather than it just working via the Firefox addons installer).

All-in-all I was extremely impressed with the ease-of-installation and use. I’m not sure how often I’ll want to use this, but the fact that I have a fully-usable Linux distro on a bootable stick is just brilliant.

Sharing large files – drop.io

In the past week I’ve had two separate conversations with people who wanted to know a way of posting large(ish) files on the web for temporary purposes, i.e. just to let a couple of people download something without going via email.

I don’t have a definitive answer, of course. The traditional way would be something like an FTP server. There’s Amazon S3 too.

The service I’m increasingly using is drop.io – a really simple way of temporarily sharing files up to 100Mb in size. There’s no sign-up or account required. You simply specify a drop name (so I could create a name of “andyptemp” or similar, and it would end up having a URL of http://drop.io/andytemp) and then specify a time limit of between 1 day and 1 year after which the drop will be deleted. Then you can add as many files as you like up to 100Mb for the drop. You can add a password for access if you like. You can specify whether other people can just download / view the files, or add their own. And that’s it.

If you decide to use the service, one hint I’d give is to set the “optional” admin password for your drop when prompted, as it means that you can go back in later and see how many people have downloaded files, as well as adjusting the “self-destruct” time of the drop.

There are some other really cool features like the ability to have an RSS feed of the drop, get email alerts, post MP3 files via a phone number, fax documents into it… a bunch of things I’ve just not needed to play with yet… but it’s a nice service, and appears to work well.

(NB that drop http://drop.io/andytemp is live for the moment, and it is set to read/write, but in time it will delete itself. Have a play if you like…)

(update: actually on reflection I’ve made it read-only as I should have realised that this means anyone can upload anything and I can’t vouch for whatever is uploaded, which was a bit short-sighted – ordinarily of course you’d only share the URL with folks you know)

Gadgets part 3: Eye-Fi

Here’s something I’ve wanted to get my hands on for a while now… an Eye-Fi SD card. If you don’t know about these things, essentially they are standard 2Gb SD cards that fit into any camera that will take the format (or others, with e.g. a Compact Flash/SD adapter). The good part is that they make the camera wireless-capable….

Pull the tab!

So I picked up my Eye-Fi card and the first thing that I noticed was the cool packaging… pull on the tab on the right-hand side of the box, and the box slides out to the left, revealing a USB dongle and the card already inserted. You need the dongle, because you need to use the computer to configure the card.

Once I plugged the dongle into the machine, an Eye-Fi item appeared on the desktop… it was pretty simple to just install the Mac software. Once I’d done that, I hit a small snag… I got a message about the Eye-Fi Manager software being unable to initalise the card. I tried running the Eye-Fi Manager a few times, but the same thing happened… until I took the dongle out of the USB port on the right-hand side of my machine, and plugged it back in on the left. That time, I got a set of dialogs enabling me to register an account. Not sure what happened there!

Eye-Fi error

Actually this seems to be an issue on my MacBook Pro… for some reason the Eye-Fi Manager software will never “initialize” the card when the dongle is plugged in on the right of the machine (although it still shows up as a mass storage device, and Lightroom sees it and offers to import images from it). Worked fine over on the left, but then the dongle is a bit too wide to enable the Magsafe power plug to be connected at the same time. Actually it seems a little random, unfortunately. I raised a problem with Eye-Fi support and they basically talked me through steps for checking that nothing else is using the port, plugging and replugging – nothing specifically useful. YMMV.

Card and card reader

Right, so here’s how this thing works. You start the Eye-Fi Manager software, which opens a web page to configure the card. Here, you can add wireless network details (it supports a whole range of network settings including WEP and WPA keys), rename the card if you want, and configure a huge variety of online services. I have configured mine for Flickr… but the software supports Facebook, SmugMug, WebShots, SnapFish, Picasa, Photobucket… and a gazillion others that I’ve not heard of before (oddly, Movable Type, Vox and Live Spaces, but not WordPress – hmm!). Once you’ve done that, you put the card in the camera, and it will automatically connect to the network and start uploading shots any time you take them.

EyeFiUpload

What appears to happen, is this: the camera uploads to Eye-Fi’s site, which then transfers to your chosen / configured photo service. The next time the Eye-Fi Manager sees the Eye-Fi site, it then mirrors the photos to the local disk (you can specify a location in the Eye-Fi Manager). I’m not 100% certain that this is how it works, but that’s what I’ve observed.

So now what about the downsides to this? Well for starters, the only supported file format is JPG. That’s OK, but of course Flickr now supports video too, for instance. Oh, and by the way, this is going to upload all your photos, anytime you take any, so I’ve set the default privacy option to private for Flickr uploads so I can review and tag etc. before publishing. The photos are obviously not titled or anything when the Eye-Fi uploads them, and they get a simple tag “Eye-Fi” set, but that’s all. So you will want to go and change title, tags, description, potentially rotate and so on once the image has been uploaded. Now that Flickr has Picnik integration, you can of course do some simple editing later as well. This does all bypass my “standard” photo workflow of Lightroom import, catalog, edit, and then upload, though.

One thing that the Eye-Fi does not support is wireless networks with certificates. Other than that, Open, WEP, WPA/WPA2 are all OK. It’s only going to work with networks it knows about, too (although you can configure more than one) – there’s no UI on the camera for configuring the card, you have to use the Eye-Fi Manager software while the dongle is plugged in to the camera.

Also, because there’s no UI on the camera side, there’s no visual indication as to what is happening… the Eye-Fi will silently upload your shots, and there’s actually no way of knowing that it is doing it, or when it has finished doing it. Of course it would be amazingly difficult for this to integrate with every camera if the makers had tried to build the Eye-Fi into the camera’s user interface, so I understand why this is the case – it’s just a little bit disconcerting! One nice feature is that there appears to be support for “interrupted” uploads, I see there’s a “Receive interrupted” comment in the Eye-Fi manager UI, so I think it will support partial upload and then resume.

Overall, it’s a neat idea, and certainly pretty cool for quick shoot-and-upload scenarios. Of course I often want to catalog my shots and touch-up on the computer first, but I can see cases where this could be really cool. Very handy for conferences etc. (oh, and that USB dongle can act as a reader for any SD card, too – handy). A qualified thumbs-up!

Here’s a link to a nice review, and here’s some news about the new models coming soon.

(post updated 14th May 2008 – a couple of additional details about workflow, the card initialization error, and the screenshot of the local machine import was added)