Spot any errors? let me know, but Unleash your pedant politely please.

Saturday, 5 April 2014



I'm getting a bit fed up with ads in my browser redirecting me to the App Store. So I decided to install the apps (if they are free), immediately remove them, and leave a negative review.

I suggest we all do this if we have a spare minute. The danger is that the apps climb the charts, but I found the process to be cathartic.

Feel free to cut and paste the text below into the review.

"I Installed and immediately deleted this app without opening it in order to leave this negative review to complain about being redirected to the App Store from an ad in a web page.

Seriously, this is an intensely intrusive, terrible way to try to get me to try your app.

Please stop!


Thursday, 19 December 2013

Markdown Pro and Syntax Highlighting

I've been writing some documentation for some code in markdown using Markdown Pro, but the code looked a little boring:

def func(blah):

I've used Alex Gorbatchev's Syntax Highlighter on Blogger, so I figured I could use it for these pages too.

def func(blah):

This worked quite well, and I wrote a script (thinking that I was being clever) to add the syntax highlighter code to all the HTML files in a folder hierarchy.  The only problem was that the syntax highlighting code isn't shown in the Markdown HTML view, XML inside pre tags was blank.

A couple of days ago, I started tweaking the Markdown Pro generated css to make the tables a bit nicer and colours of headings stand out a little more.  Last night, as I was dropping off to sleep, it occurred to me that I may be able to add the highlighter css and javascript to a Markdown Pro template too.  Just tried it, and it works. The template has to be re-applied to refresh after changes in order to force the javascript to run. Export to HTML is still good. It's necessary to refresh in order to save the highlighted code to PDF.

Note that the 'template' isn't the usual simple template, but all of the exported css that Markdown Pro would generate on exporting to HTML, (with <script> tags).

(The 'template' file is here if you're curious)

Monday, 9 December 2013

SFTP Python Paramiko (and some of the problems I had)

I needed to rename a file on a RHEL server as part of some test automation scripts.  Hope this helps.

I used paramiko to do it with SFTP.  I pretty much copied some code from Stack Exchange to make this:

import paramiko

class SingleCommandSFTP(object):
    def __init__(self,
                 port = 22): = host
        self.username = username
        self.password = password
        self.port = port
    def _open(self):
        self.transport = paramiko.Transport((,
        self.transport.connect(username = self.username,
                               password = self.password) 
        self.sftp_client = paramiko.SFTPClient.from_transport(self.transport)

    def _close(self):
    def rename(self,
        self.sftp_client.rename(oldpath = source,
                                newpath = destination)

    # Add further commands as and when required.

It only has rename, but that's all I need for now. It would probably be worth making a decorator for the _open / _close functions if many more functions were to be added, but I don't quite know how to do that (yet).

Problems (Mac):

If you try to easy_install paramiko on Mavericks, it'll probably fail because it can't compile pycrypto.  You need to install Xcode and fiddle about a bit (Found at Stack Exchange and Abakas):
  • In Xcode, go Preferences > Downloads, and click on the "Install" button next to "Command Line Tools" to install the compiler needed by Python.
  • sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
I also got this at some point: warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. Unfortunately I can't remember what I did to fix that.

Problems (Windows):

On Windows, it wasn't practical to install a suitable compiler to build pycrypto from source.  I used the 32-bit installer for Python 2.7 (downloads are here).   I had installed Python for all users, but that caused another problem solved by Stack Exchange.  I uninstalled Python an installed for the user only.

I also had to install the ECDSA cryptographic signature library as this wasn't found when importing paramiko.

Tuesday, 29 October 2013

Mavericks "Mail Web Content" going to 100% CPU

If your fans are a blowin', check Activity Monitor/CPU (sorted by descending % CPU). You may see 'Mail Web Content' at the top, hogging 100%.  I've also seen two instances hogging 100% each.

Bouncing Mail doesn't always do the trick.  I've had some success with just killing the process, but YMMV.

I couldn't find any info on it from a quick Google.

My hypothesis is that it's HTML Mail rendering that's got it's knickers in a twist. When the process had been quit, the mesage I was reading was blank, but selecting another one and then coming back to the blank one ... it was rendered, and it was and HTML page.

Dunno if that helps anyone.  Maybe it's enough to know you're not alone ?

Saturday, 25 May 2013

Monday, 15 April 2013

1993 versus 2013

The 1993 watch function has been replaced in the 2013 version.

I don't know who made this, so unfortunately, I'm unable to add a credit.