'Technology' Category

Unhide ~/Library in Mac OS X Lion 10.7 [Take Two]

As many people have no doubt noticed by now, Mac OS X 10.7 hides your Library folder by default in the Finder. For power users, developers and other such creatures in regular need of the Library, this means a trip to the Terminal, which seems like a step backwards (to me, at least).

There has been a hack floating around to reenable hidden folders which I detailed here, however it really goes too far, enabling the whole Unix filesystem for view in the Finder.

A more useable alternative uses the ‘chflags’ command, and can be invoked with the following:

$ chflags nohidden ~/Library

DIY Linux Transmission Server


One of my favourite things about Linux is its ability to transform a formerly useless elderly computer into something really useful indeed. This is the first in a series of posts covering some great projects to breathe new life into old machines using Linux.

What’s the Project?

BitTorrent is a fantastically useful distribution mechanism – when downloading updated Linux distro ISOs, it regularly exceeds the speeds available through centralised (HTTP/FTP) download repositories, and the sharing of bandwidth and ease of distribution are a great fit for online communities and fan groups (Zappateers, for example). Unfortunately, BitTorrent tends to be a total disk I/O hog, constantly reading and writing tiny chunks of file all over your disk. This causes big slowdowns for all other running programs which need access to your hard disk, not to mention the stress it puts on the drive itself.

We’re going to use an old computer, GNU/Linux and the Transmission BitTorrent client to offload this resource-intensive process to a networked machine, freeing up your main machine to get on with business unfettered. Sacrificing convenience, however, is not an option. Therefore, we’re going to implement the following convenience features:

  • Administering the client through a web browser
  • Sharing content over the local network
  • Creating a zero-setup process for starting new transfers


Privacy & Security Should Be Optional

Having recently upgraded to Mac OS X Lion, I’ve spent a good deal of time in the past couple of weeks reinstalling software on and as-needed basis. One package I’ve been reluctant to reload is Adobe’s Flash player, the de facto media delivery mechanism for the desktop web and a program which knows how to eat CPU and burn up your machine like no other.

While I’ve railed against Flash for its processor greed and propensity for cooking chips in the past (mainly with workarounds and avoidance techniques), I’ve grown so used to these shortcomings and working around them that they are no longer my primary concern when loading my machine with Adobe’s player.

With the release of version 10.3 back in May 2011, Flash gained for the first time a pane in the Mac OS’ System Preferences application. It seems almost incredible that it wasn’t until earlier this year that a piece of software present on 99% of all internet connected computers, 8.1% of which are Macs, didn’t have an OS-conventional approach to settings alteration. Finally setting Flash preferences falls in line with convention. But the addition of the Flash Player preference pane has actually drawn my attention to what I view as an industry-wide problem with ensuring user privacy and security.

You see, with 2.1 billion people connected to the web and more than 1 in 3 using Facebook, privacy and security have become quite the hot topic of late. More people are sharing more information and are, rightly, more concerned about where it’s going and what it’s being used for; as the network becomes the computer (many buy a laptop ‘just to get on Facebook’ and have little interest in how they get there), makers of local and remote software platforms need to have a clear focus on keeping that data safe.

My concern was raised while browsing through the new preference pane that installs with Flash, and the default settings chosen by Adobe. There are four key areas where the user is given the option to dictate the behaviour of the Flash player: offline storage, camera, media playback and updating. Automatic updates for a software platform with as dubious a security history as Flash is an absolutely welcome and necessarily enabled by default. Similarly, the player will request access to the camera and microphone on a case-by-case basis, a good choice given the proliferation of webcam-equipped laptops.

Offline storage and peer-assisted networking, however, are enabled by default. Given the zeal with which Flash consumes my CPU cycles, I’m not sure I would want it to have free reign over my network connection, and given its chequered security record I’m not convinced that allowing it offline storage by default is such a bright idea either.

The main problem I have with these default settings, though, is that they will probably never be changed, which is why companies like Adobe need to take steps further than just chucking in a preference pane with their app – my mother hasn’t ever and likely will never open System Preferences, and I’m sure she’s not alone. There are necessary changes which need to be made by any company responsible for data handling, even if they are merely providing the conduit (as Adobe does with Flash player).

Firstly, the default security and privacy setting must be ‘lockdown’. Flash shouldn’t be assuming control of a user’s bandwidth or storing files on their machine by default any more than it should be automatically serving up a webcam feed without prompting. The effect of a default feature lockout is that user is introduced to the preference pane and forced to actively make decisions about their privacy and security rather than relying on the stock settings. They needn’t feel bothered – after all, they only have to set it up once and forget about it – but they can now browse with confidence in the knowledge that their information is protected to their very own specifications, and just like everybody has different data, everybody values that data differently.

Microsoft actually has tried something akin this approach twice in the past, first with the variable ‘privacy level’ control in the Internet Options control panel, and more recently with the UAC layer introduced with Windows Vista. Between these two approaches, the company has actually got all of the right ideas. The user needs to be jolted into taking a more active role in their security through dialogs such as UAC, and the variable security level controls provide a useful abstract for casual users with the option for fine control for those who require it. Unfortunately, these concepts have both failed in their execution. UAC is widely derided and often disabled because of its irritating frequency, and the user security variables, like most good ideas from Microsoft, are buried under layers of dialogs and menus, effectively rendering them invisible to the casual user.

By switching the defaults to ‘off’ and gently, but firmly, prompting the user to engage with their online security and privacy, responsible companies can educate their (massive) user base and improve the quality of their experience by placing the decision making process in the hands of the user. While the industry aspires to give an experience which ‘just works’, this is one area where the user should definitely be involved – these are choices which people make every day when they shield their PIN at the ATM, don’t give out their phone number to strangers and ask to see ID from the guy at the door claiming he’s from the gas company. When the data involved is personal, it should be the person, not Adobe or Apple or Google or Microsoft, making the call on how it is protected.





Solving the MBProgressHud _WebTryThreadLock Error

MBProgressHud is a really nice bit of plug in code to add fancy status and loading notifications to your iOS app quickly and easily. It looks great! Unfortunately, there’s an irritating error which cost me some time this morning, and hopefully I can save anyone else in the same position some trouble.

The error:

bool _WebTryThreadLock(bool), 0x7b9b5500: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...

This appears when a method which needs to update a UI component is called directly by the MBProgressHUD object.

The most basic usage of MBProgressHUD is thus:

HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
HUD.delegate = self;
[HUD showWhileExecuting:@selector(fetchNewData) onTarget:self withObject:nil animated:YES];

In which ‘fetchNewData’ is the method which is executed while the progress HUD is on display.

Using this technique, fetchNewData will be called on a secondary thread, which causes the crash error we’ve already experienced. UIKit, which handles all the user interface business, should only be running on the main thread, so when the secondary thread makes a move on a particular UI element, its going to throw the ‘web lock from a thread…’ error. (It should be noticed that you can update some UI components using the standard MBProgressHUD setup detailed above, but in most cases you’ll get the error.)

In the case of this example, ‘fetchNewData’ updates part of the UI, so it needs to be called on the main thread. The quick and dirty workaround I used to force it to execute where I wanted it to was to create an intermediary method which can be called by MBProgressHUD as normal but in turn calls ‘fetchNewData’ specifically on the main thread.

You could, for example, call this method ‘performFetchOnMainThread’:

-(void) performFetchOnMainThread    {
[self performSelectorOnMainThread:@selector(fetchNewData) withObject:nil waitUntilDone:YES];

Instead of directly calling ‘fetchNewData’ from MBProgressHUD, use it to execute ‘performFetchOnMainThread’, which uses the ‘performSelectorOnMainThread’ method to force ‘fetchNewData’ to be executed on the main thread.

This isn’t the most efficient or beautiful way to accomplish this, but it works, so if you’re getting a ‘web lock from a thread…’ error and you need to make sure your code is executed on the main thread, you can use this technique to get the job done quickly.

Hidden Messages from AOL?

I saw the above job listing from AOL on the CrunchBoard at TechCrunch.com for a back-end software developer (see the listing here). The listing is oh-so-cleverly stuffed with carefully chosen capitalised words – the first paragraph reads ‘You love coding and web architecture’, while the second declares that ‘We [AOL] build stuff to help people’.

Fine, very cute. The message hidden in the final paragraph appears to have a very different flavour:

‘A bad reputation means we have nothing to lose’

You said it. Is someone having a joke here or is AOL the most self aware company on the planet? Hmmm, that doesn’t sound quite right…

PC Keyboards in Mac OS X Lion

One of the benefits of the recent upgrade I made to Mac OS X 10.7 Lion is how consistently simple using a PC keyboard now is. The preference pane for switching the modifier keys around (using alt in place of CMD, Windows key in place of option etc…) was available in Snow Leopard and earlier versions, but compatibility with the range of PC keyboards I’ve tried with my various Macs has long been a bit patchy – even though the changes would save in System Preferences, the keys would still use the default mapping.

If you’re used to CMD being either side of the space bar, it can get pretty annoying when it isn’t there.

In earlier versions of OS X, I’ve used DoubleCommand when there’s been trouble remapping keys, however I’m pleased to report that Lion seems to have addressed some of the earlier issues with the modifier preference pane being ineffective.

I’ve tested the modifiers with a range of keyboards (including ones I’ve experienced issues with in the past) and they all seem to be altering the maps without issue.

To alter the key map:

1. Open System Preferences and select the ‘Keyboard’ preference pane

2. Click the ‘Modifier Keys’ button and switch the mapping. When you’re done, click ‘OK’ and close the preference pane.

Schedule WordPress Backups Using Cron

I was contacted a couple of days back by a reader who wanted to add my super simple WordPress backup program to Cron, the Unix task scheduler, to create automated regular snapshots of his site. Backing up my website using the program is something I normally do by hand as part of my general system maintenance routine, but the program is easily incorporated in to Cron to run on a timer. Completely by coincidence, I suffered a WordPress plugin failure within a couple of days of creating the Cron job, and thanks to my now daily backups I was able to restore from a 10 hour old snapshot with the minimum of fuss. (more…)

Colorshare – Available in the App Store

Hot off the presses and approved by Apple mere moments ago, colorshare will become available in regional iPhone App Stores the world over over the next 48 hours or so.

Colorshare is a simple utility which allows you to quickly design a palette of colours on your iPhone or iPod Touch and with the tap of a button share it with the web using the unique palette ID number, which you can punch right into the colorshareapp.com homepage.

Once you’ve entered the ID of the palette you want to work with, it will appear on screen alone with a full breakdown of each colour in RGB, hexadecimal and CMYK.

Colorshare is completely free, and you can grab it from the App Store by following this link.

WikiKnowItAll – In the App Store

Brand new to the iOS App Store, WikiKnowItAll lets puts your own personal wiseacre right in your pocket. We all know someone who knows something about everything, and with Wikipedia behind them your WikiKnowItAll will never run out of interesting factoids – or enthusiasm for letting you know. The app is available in the iOS App Store today.




TWiT Early Show Downloader

For me, TWiT network is one of the most valuable resources on the internet: their programming is always informative, slick and balanced, and the guests are always top-teir tech talkers.

As with most pod/netcasts broadcast from the States, the scheduling of live shows is always at pretty peculiar hours of the day thanks to the time difference, which means waiting for the edited version to be uploaded and published to the TWiT website.

Handily, the editors seem to work much quicker than the web folks over in Petaluma, CA, and the shows are normally uploaded quite a bit earlier than they are listed on the website. I’ve been using a little Python program which I wrote to download the shows before they are linked on the site, which you can grab using the instructions below. It uses cURL to download the files so it’ll work on Macintosh and Linux systems.