Think Different(ly)

In a recent conversation with Knightwise we were musing that it doesn’t seem that it’s very long since we were both ragging on Dave to get off Windows and get a Mac. Today we’re both seriously entertaining the possibility that our next primary computing device might be running an OS from Redmond. What changed? Has Windows gotten that much better?

Yes. It’s undeniably better.

But we’re also different.

And Apple is different.

I think when we switched to the Mac we saw it as the Valhalla of everything we were looking for. A better system with a unix terminal which would give us the best of both worlds: open source, and a first-class GUI driven OS.

In a lot of ways the Mac hasn’t progressed since the Intel transition. Sure there have been feature additions, and if you use iOS regularly there is a lot to help you work with those devices and in that ecosystem.But for switchers and sliders there hasn’t been significant change in the Mac operating system for the better part of a decade.

Long in the Tooth

And the hardware? Well as of this writing, the best rating for the “when to buy” page for Macs is a neutral rating for the Macbook Pro.

  • iMac: 16 months since last refresh
  • Mac Mini: 28 months since last refresh
  • Mac Pro: 38 months since last refresh

These machines need some love if you expect knowledgable people to buy them. And if you don’t well then I guess that’ll be where we part ways.

  • Mac Pro
    • Ships with a CPU released in September 2013
    • Costs the same as it did when it was new
    • Pretty much every component is outdated
  • Mac Mini
    • The best CPU option was released in July 2014 – there have been 3 generations of i7 CPUs since then
    • The max RAM is 16GB
    • Costs the same as it did when it was new

And Windows? Well you can get BASH on Windows now, on reasonably inexpensive and current hardware.

Book Report - Hamlet's Blackberry

Title: Hamlet’s Blackberry
Author: William Powers

I’ve been trying to get this book read for about the last 18 months. It had come highly recommended by a friend who found the book to be a good look into the technological overload of our modern times, and the inherent constant connectivity to the crowds provided by the Internet.

It took me quite a while to get into this book. Powers’ continual assertion that the technology that we have come to rely on is disconnecting us from ourselves, and our reality. The same technology that we use to keep us connected and allow us to collaborate and communicate with people all around the globe was, in turn, not allowing us to actually experience and enjoy that connection because it’s giving us the attention span of a squirrel on speed.

Ultimately there’s more to it than that. Unfortunately Powers doesn’t get into most of the rest of the minutiae and the possibilities for managing the technology that tries to take over. It feels like 80-90% of the book is spent framing the problem and drilling it into your head over and over again without offering much in the way of strategies or tactics to deal with it.

Overall, this book is ok. It raises some valid points and will make you think about just how critical it is to have your phone on your bedside table (I use mine for an alarm clock, so I left it where it is) but it does little to help address these challenges.

Creating Spaces in MacOS

Virtual desktops are an extremely useful feature of modern operating systems. It’s a feature that provides some of the benefits of multiple monitors without the extra space or expense of adding more displays to your computer. Generally speaking the feature allows you to group together windows on one or more additional logical desktops without the need for multiple monitors.

Preference pane for Mission ControlOn the Mac this feature is known as “Spaces” and was originally introduced way back in OS X 10.5 “Leopard”, and was integrated into the Mission Control preference pane a couple of years later. This merge into Mission Control works very well, as long as you know where to look — because the preference pane doesn’t really tell you where it is or how to find it.

Mission Control view of spacesTo create a new space, or desktop you need to launch the Mission Control interface. This can be done either by pressing F3 on a modern Mac (or fn-F3 if you have your function keys enabled by default), pressing ctrl-Up or by doing a 4-finger swipe up on a trackpad. Once you open up Mission Control you can see a plus sign on the far-right hand side of the screen. Clicking that will allow you to add a new Space to your Mac. You can add up to 15 new virtual desktops, to your system.

Once they’re created you can switch between spaces a few different ways:

  1. Four-finger Swipe: performing this swipe left or right will move you between desktops.
  2. Ctrl-arrows: Holding down the ctrl key, and pressing the left or right arrow will move you between desktops.
  3. Cmd-tab: Using the regular application switcher will move you to the first space where that application is open.
  4. Mission Control: You can select a space directly from Mission Control to activate it.

Once you find it, this is a very useful feature, and can make operating on a smaller screen (like my 11” Macbook Air) a lot easier by allowing quick and easy context switches to move from browsers to text editors to terminal windows. It’s something I definitely recommend if you’ve never tried it before.

Hash-based Diff for Directories

Recently I was working on a project where I needed to quickly and reliably detect changes to the contents of a directory, and when a change was detected run a series of commands.

There are any number of file differential tools, the venerable diff chief among them, and I think they would certainly do the job. They would certainly do a very complete job allowing for a comparison of every line of every file and be able to show exactly what changed where. But for what I needed to do, this seemed overkill.

Ultimately what I needed to know was if something had changed, not specifically what had changed. To that end, I realized what I needed was a view of the directory, not a view of the files themselves. I needed to know if a file had been changed, added or removed. Looking at a directory listing, I could easily see that something had been changed compared to an earlier listing sample. And then it donned on me – I could solve this with a hash.

The MD5 hash is a fairly simple and very quick to execute hashing function which takes any input it is given and generates a hash value. Most POSIX systems include an md5 command that can be run from the command line which will output the hash value as a string. By capturing the hash value of the directory and comparing it each time the script is run, it becomes fairly easy to see when something has changed.

To make this work, I just needed to pipe the contents of the my directory using ls -la into the MD5 command and save the resulting string to a file.

ls -la | bash

The final logic for the script looked something like this. I’ve done this extract to remove the bulk of the script which is all of the actions being run.

#!/bin/bash

hashfile="/path/to/lastrunhash.md5"
postdir="/path/to/source/directory/"

lasthash=`cat $hashfile`
thishash=`ls -la $postdir | md5`

echo "Last Hash: $lasthash"
echo "This Hash: $thishash"

if [ "$lasthash" != "$thishash" ]
then
  echo "Directory value has changed"
  echo "Do your actions here..."
  echo "$thishash" > "$hashfile"
else
  echo "Match!"
fi

Grand Plans

I have a habit of coming up with (grandiose) ideas for things I want to do. Be they small things or large things, or amorphous life goals, I talk a lot and tend to be rather stingy on the follow through. Sometimes these goals are stopped by other projects, sometimes they’re stopped by my “better judgement” when I talk myself out of them, sometimes is exhaustion, sometimes it’s pure laziness. Whatever the reason or excuse I don’t do nearly as much doing as I feel that I should, or that I want to.

Tonight I was mulling these things over as I proceeded about my cleaning and folding of laundry and had a minor brainwave about a couple of the projects that seem, on the surface, to be complementary but were leaving me in a loop of “I want to do x, but I really should do y first. But y is hard and will take a long time, I can’t take that on right now.”

So I’m not going to do y — probably ever — and I’m ok with that. I can move on with x, and if I break x up into reasonable size pieces, I might be able to do some other things in between those pieces.

I’ve started on piece #1, and really don’t want to stop. It pays to know my own tendencies and make the decisions that can capitalize on some and minimize the effect of others.