Bash Notebooks in Jupyter

So IPython now has a back end called Jupyter that supports a large number of kernels as well as Python.

This means we can write Jupyter notebooks with bash for example.

Here’s how.

Installing Python 3

The bash kernel requires Python 3 and I’ve only installed Anaconda using Python 2.7. How do we easily get Python 3.4 or later as the kernel requires?

Fortunately conda can create a Python environment with Python 3 in one easy step.

conda create -n py3k python=3 ipython notebook

That creates the environment using Python 3 and adds the IPython and Juypter system with notebook support.

This will give us all we need so then source activate py3k will turn it on.

You can tell you are in a conda environment as the bash prompt is prepended with the name of the environment like so py3k)Air:~/dev/Notebooks tonyw$ Continue reading

Happy Birthday To My Favourite OS

I thought the 15th birthday of my favourite operating system was the perfect time to look at why I love it so.

I do love OS X, I certainly think it is the pinnacle of operating systems. Don’t get me wrong, I know it has faults and I am more than happy to enumerate them given the chance. It is, however, the best available operating system at the moment, it has been for many years.

Alan Kay, the scientist who worked at Xerox PARC on the first GUI, called the Macintosh “the first computer worth criticising”. I’ve always thought of OS X as “the first OS worth criticising”. In case you’re wondering why Alan Kay, he’s one of my gods. Go read his Wikipedia page. Continue reading

Rebuilding The Operating System

I set out to rebuild the OS on my constant companion, the MacBook Air. It has been running OS X 10.10 upgraded from 10.9 and since I do a lot of weird things on it the cruft level was getting pretty high.

The first step was to back it up using Carbon Copy Cloner. Such a useful tool. This included backing up my usual boot partition and the one I had built to test 10.11 onto an external drive. No need to waste time on an OS install, though if you don’t have a known good install then do it from scratch.

I then booted into the newly cloned 10.11 on the external so I could wipe the internal SSD. God, the new version of Disk Utility is a disaster. The interface has been “dumbed down” so that an expert doesn’t get the information required and it’s still too difficult for most. This time it failed to either wipe or repartition the internal drive and gave so little feedback on the reason for failure it was useless.

I booted into the backup of my 10.10 partition and used the old Disk Utility. The drive had been a bit mangled so it no longer saw both partitions and Core Storage meant it didn’t show the SSD, just a single logical volume. Fortunately erasing the logical volume fixed that and I once again had a 256 Gb SSD. Phew.

Carbon Copy Cloner quickly had my 10.11 partition back on the SSD and it kindly offered to create a Recovery partition on the drive. Got to love a good tool.

The whole idea behind doing this is to end up with an exceptionally clean System so I’m not using Migration Assistant for anything and only installing applications as I need them, preferably from a fresh download.

On To Installs

Continue reading

Why Alex Is Wrong And What Are Apple’s real Software Problems

OK, that headline is a bit inflammatory and an insult to a perfectly good tech journalist but Alex Kidman here is the latest in a long line of commentators to take a swipe at Apple for the quality of its software. Unfortunately he grabs the wrong end of the clue stick.

I am not going to argue that there aren’t some things that Apple could do to improve software quality, indeed I will point out some of them before I conclude. What I would like to do is look at some of the reasons there are problems. I will also point out some of the things that won’t fix the problems and why. As I do I’ll show why Alex is partly wrong though partly correct at the core of his arguments.

First, software is hard. I started out my professional life as a programmer, mostly writing code for accounting software, most of the time in C. It is impossible for anyone who has not spent several years writing software to understand the complexity of what you do and the difficulties you find in proving it’s correct. Continue reading

Search As Interface

At the moment we could say that the internet and our computer provides us with so much information that the problem is not that the information you want is not there, but that it is difficult to find.

Back in the early days of computers we developed the concept of files and directories. It has been the underlying metaphor used on your computer since the late sixties.

At the same time there were researchers developing what we call “hypertext”. The idea was first described by Vannevar Bush in 1945. It could be said that the first actual system was “ONS” show by Douglas Engelbart at “The Mother Of All Demos” in 1968, but this was more of a demonstration of the windows, icons, mouse pointer system that was further developed by Xerox PARC and Apple to become the modern computer interface. The hypertextualisation was minimal.

The first real hypermedia system in common use was the Macintosh application “Hypercard” written by Bill Akinson. Through Robert Cailliau (a colleague), Tim Berners-Lee was highly influenced by HyperCard when he developed HTTP and HTML to give us the World Wide Web.

This quickly became a second interface to information. Searching it was not too bad when we only had a few million pages but quickly became unwieldy when it was hundreds of millions of pages.

Curated web pages and lists of web pages became major information sources. Indeed companies such a Alta Vista sprang up to use the power of folksonomy to develop user curated indexes of pages on various topics. Continue reading

The Joys Of Hacking ‘hosts’

In my job I am constantly visiting client offices where you need to know a number of IP addresses that aren’t often kept in the local DNS, even if they have one.

Recently I had a revelation, my computer already holds a (very short) list of names to be translated into IP addresses. The ‘hosts’ file in /etc/ – here’s what it looks like on your Mac:

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost

Short, right? Not terribly useful, but we can easily fix that.

Continue reading

Adding an Application Specific Keyboard Shortcut to OS X

This is just a short post mainly so I can link to it for a friend who might want it.

We are going to set a keyboard shortcut to toggle automatic spelling checking in Safari. This is incredibly useful for people who sometimes write a bit in a foreign language as auto correct will keep “correcting” those foreign words.

To start open System Preferences and choose Keyboard. When that comes up select Shortcuts in the row near the top and you will see a pane like the figure below.

key_pane

Now in the left window click on App Shortcuts and it will be just like the figure.

Now click on the + under the right hand window. A small dialog will open up similar to the figure below. Click on the pop up menu next to Application and you can select Safari. In the text box next to Menu Title type Check Spelling While Typing (the exact text of the menu item to which we want the keyboard shortcut to apply). Then click in the box next to Keyboard Shortcut and type Option-Command-T. Your dialog should look exactly like the figure below. Click on the Add button and our task is complete. If you want to know how I came up with the text ‘Check Spelling While Typing’ then go to Safari and under the Edit menu look at and under Spelling and Grammar you will see the text. This is what the Keyboard System Preference means by “Menu Text”, it’s just the text ofthe menu item you want to trigger when you type the shortcut.

key_dialog

When you want to type some foreign text in Safari type Option-Command-T to turn off auto spell checking and when you have finished type Option-Command-T again to turn it back on.

Using the same method you can easily build your own keyboard shortcuts. For more complex keyboard shortcuts you might want to look at Keyboard Maestro, my favourite keyboard shortcut tool.

Real keyboard dweebs, like me, also install Karabiner for really customizing the keyboard and on desktop Macs with third-party keyboards Seil, a utility for “the caps lock key and some international keys in PC keyboards” as they put it. This may be too much for you but I’m the sort of person who paid $150 for the keyboard I use on my desk at home, so I’m demonstrably not rational when it comes to keyboards and shortcuts.