Category Archives: Tech

Sometimes, end-users are wonderful

Mostly, when my phone rings, it’s because something has broken somewhere. Or because someone wants to sell me something I don’t want.

I’m sure most IT managers can relate.

But sometimes my phone rings with a good news story, and it’s wonderful.

One example: this morning’s call from a teacher to tell me he was using Skype to include a student in his class despite being sick at home. It was his first time teaching via Skype, and he was chuffed.

I was, too. All those other calls are worth it when you get these.

I love my job.

Custom code formatters in Sublime Text 2

I’m starting to fall in love with Sublime Text 2. It’s the text editor I’ve been looking for since I’ve been editing text.

It’s fast (instant startup, no lag ever). It’s truly cross-platform (looks, feels and runs identically on OS X and Windows). It works beautifully out-of-the-box, but there are plugins galore. It has split windows. It has code completion. It’s pretty.

I could go on.

Anyway, having written my own PHP and JSON beautifiers, I was looking for a quick-and-dirty way of integrating them into ST2 (i.e. without wrapping them up in a dedicated plugin – I’m not fluent with Python yet). Turns out ST2’s build system is almost perfect for this.

Go to Tools > Build System > New Build System, and drop something like this in the window that opens:

{
    "cmd": ["php", "/path/to/pretty.php", "$file"],
    "selector": "source.json"
}

Now, assuming there’s a PHP CLI binary on your path, you’re done! Press Cmd+B in a JSON file and it will be “built”, i.e. formatted.

There’s only one shortcoming I’m aware of: Sublime Text 2 doesn’t check for changes in the source file post-build. So you’ll need to use your favourite method to force a file reload.

OS X terminal tip: get total bytes in all files in this folder

So, you want to know exactly how many bytes are in all of the files under a given directory, and you only have a Mac OS X terminal to work with?

It should be easy, but it’s not.

Here, I’ll save you some time:

find . -type f -not -iname .ds_store -print0 | xargs -0 stat -f %z | awk '{s+=$1} END {print s}'

Of course I’m assuming you don’t want any of those nasty .DS_Store files to be counted.

“Apple’s Magic Is In The Turn, Not The Prestige”

“Apple’s Magic Is In The Turn, Not The Prestige”

A great piece on why people are starting to find Apple’s product launches boring, and why Apple doesn’t care.

Here’s a choice nugget:

Look at the mobile landscape right now. There are two companies that are making any money in smartphones: Apple and Samsung. Or, put another way: Apple and the company Apple just won a billion dollar-plus judgement against for copying their smartphone designs.

How to love Apple too much

How to love Apple too much

You could argue that running a blog/forum called “Mac Rumors” is a bit excessive, but micro-analysing the banners Apple have hoisted for their upcoming launch? Seriously?

I mean, I’m as pumped as the next Apple fanboi for this week’s product launch/es (or, more specifically, how my school might be able to do cooler stuff with better tech), but surely it’s not that hard to know when you’ve crossed the “not quite sane” threshold with the guesswork.

I enjoyed Stephen Hackett’s take:

Tim Cook designed the graphics after taking some LSD he found in Steve’s office.

Let’s all chillax, eh :)

rsync + robocopy + vshadow = fast, free, time machine-like backup

In my role as Maitland Christian School’s IT manager, I’ve been working on a non-proprietary, enterprise-grade backup system that will eventually replace our current ShadowProtect installation.

There are a few reasons for this:

  1. ShadowProtect costs the school $1k+ annually (before adding licenses for various servers I’m still deploying). That’s a lot of money for what is essentially a file copying tool, given we don’t need its instant-restore features in this environment.
  2. I’m not a fan of needing to install and run proprietary tools to explore backup snapshots. It’s slow (you typically need to mount one snapshot at a time and wait for the software to resolve incremental snapshots back to the latest full copy), risky (you depend absolutely on your software vendor to get your files back) and inflexible (for example, you can’t allow users to explore their own snapshots).
  3. ShadowProtect is a resource hog.
  4. Excellent free (or zero-cost) alternatives exist.

As of today, I’ve completed testing the ingredients of our new backup system, which are as follows.

1. rsync

Given this is primarily a Windows environment, it’s unfortunate to depend on software that isn’t NTFS-aware, but none of the usual suspects offer an equivalent to rsync’s --link-dest option, which creates full snapshots using hard links. This option makes it possible to create Time Machine like replicas of entire filesystems as they appear at a given point in time, without duplicating files that haven’t changed since the last sync. Furthermore, individual replicas can be deleted ad-hoc without damaging others. Awesome!

2. robocopy

To minimise the time and scripting involved in restoring data when needed (and also to make it safe for end-users to – hypothetically! – access snapshots straight off our backup server), it’s important to retain NTFS permissions and ownership. Here’s the command that does it (run immediately after rsync):

robocopy SOURCE DEST /mir /copy:sou /is /it /xl /xx

Note that if you don’t use /mir, directory permissions won’t be copied. Annoying but true. At least NTFS permissions get attached to hard links and not the underlying files, though! (Not being an NTFS guru, I wasn’t sure if this would be the case or not.)

3. vshadow

This ensures that files don’t change while you’re copying them. Microsoft explain it all here.

I’ll let you know if/when I have backup scripts that could be used elsewhere!