tikadiff: graphical diff for text from “binary” files

Code

The code is from the Downloads area of my Atlassian Bitbucket repository; see the README online.

Version Control Systems (VCSs)

VCSs like mercurial, git and bazaar (to mention only a few) are great for keeping track of changes to source files, but their utility doesn’t stop there.  If you’re working on documents in applications like Word, OpenOffice or LibreOffice, especially when you are asking others to review those documents, a VCS program can save you a lot of anguish.

However, people who work not with source code, but with research papers, academic assignments and the like, are not inclined to make themselves familiar with the tools that geeks have grown used to.  Considering how long it took for software developers to embrace those tools, it’s hardly surprising. Continue reading “tikadiff: graphical diff for text from “binary” files”

Help for digest checking

Updated 2018-02-14

It’s pretty important to check the digests of software you download.  When a downloaded file is accompanied by a signature file, for example a gnupg .asc file, you can verify the signature with various tools.  Often though, a download site will include the MD5 or SHA1 digest hash of the file, which allows a quick check on the file’s integrity.  OS X has an /sbin/md5 command, and includes the openssl distribution.  Within openssl, the digest subcommand allows for the generation of digests for an array of digest algorithms, including MD5 and SHA1.  So it’s simple enough to generate the appropriate digest for that file you just downloaded.

Comparing them is a bit tedious, though.  If you’re like me, you skim across the two digests – the one you generated and the one that the authors published – and look for eye-catching patterns near the beginning, middle and end.  That works pretty well in practice, but its hardly rigorous.

Continue reading “Help for digest checking”

Monad; that’s a wrap!

Just like everybody else who starts to look at monads, I found it was like coming to the face of a sheer cliff.  Let me qualify that: just like every other programmer who is not a mathematician (and that’s most of us).  I am looking at monads in the context of clojure, so code snippets will generally be written in clojure-like syntax.

I have found these resources the most helpful:

Continue reading “Monad; that’s a wrap!”

Schrödinger’s Baby

Ms Schrödinger is pregnant; and Ms Schrödinger is not.

Her pregnancy confirmed, she experienced joy or resignation; and she cursed the inconvenience or shrugged her shoulders.  She sought advice from her friends about obstetricians; and she sought advice about clinics and prescription drugs.  She has expectations of new life; and she has expectations of her old life. She is immersed in a whirlpool of change and growth, of ultrasound images and another heartbeat, of wonder and retching sickness, of anxiety about the future; and she has recovered the status and statis of the recent past.

Continue reading “Schrödinger’s Baby”

zargrep: grep files in a zip archive

How do you search for strings within a zip archive?

I’m tinkering with EPUB3 files, and I wanted to be able to find certain strings within .epub files, so I had a look around, and I immediately found zgrep and family. The trouble was that zgrep assumes a single zipped file, not an archive.

So, without further ado, I wrote the following script, which I called, naturally, zipgrep. It uses grep and unzip, which it assumes to be available on the PATH.  Not wanting to have to pick through the argument list, I decided to mark the end of arguments to grep with the traditional ‘‘, after which I could stack up as many zip file names as I liked.

Continue reading “zargrep: grep files in a zip archive”

Redefining marriage

Brendan O’Neill raises a point which I have never heard in the discussion before, but which I have always felt is critical. This unprecedented redefinition of the basic building block of human society rewrites the contract that the State entered into with every currently married person. How’s that for retrospective legislation? I will return to this point below.

Continue reading “Redefining marriage”

Setting environment variables in OS X Sierra, El Capitan and Yosemite

UPDATE for High Sierra, Sierra, and El Capitan

The changes between Mavericks and Yosemite, noted below, still apply in Sierra and High Sierra. At least, I have not had to change anything since Yosemite for either El Capitan, Sierra or High Sierra.

UPDATE for Yosemite.

Apple and Tim Cook have shown their commitment to the wider developer community, once again, by starting to pull the plug on the launchctl facilities for setting and modifying environment variables.  Here’s the rub: with the last lot of changes, Apple got the system working very, very well.

You can get a feel for the impact of the changes by reading the launchctl man page.  See, in particular, the section LEGACY SUBCOMMANDS.  It’s not entirely accurate, but that’s not unusual.  The critical subcommands are getenv, setenv, and unsetenv. The man page indicates that the export subcommand is available; it is not. (See update in the text, below.)

Continue reading “Setting environment variables in OS X Sierra, El Capitan and Yosemite”

Identity Theft

On the 10th of October, 2010, Natasha Mitchell interviewed Thomas Metzinger on the Australian Broadcasting Corporation’s Radio National network program All in the Mind. The show was titled You are not a self! Bodies, brains and the nature of consciousness. The ABC is the Government-financed public broadcaster in Australia. Radio National (RN) is an AM radio network dedicated to cultural and scientific topics that do not get much airplay on commercial radio. Metzinger was introduced on the programme like so:

Professor Metzinger is based at the Johannes-Gutenberg University in Mainz in Germany, and has long collaborated with neuroscientists and artificial intelligence researchers and others. And in his new book The Ego Tunnel: The Science of the Mind and the Myth of the Self he makes the case that there is no such thing as a self.

Continue reading “Identity Theft”

Ant: process elements in a list

I was looking for a way to process a list of items in an ant build file, similar to what you would do in Java with a construct like:

for ( Element element : elements ) {
    // do stuff with element
}

The approach of XSLT, using recursive calls with local variables, looked promising. In the ant-user mailing list, I found a posting on the topic Implementing a loop in ANT with something like what I was looking for. Ben Stringer’s example gave me the critical information—that I could make indirecly recursive calls to antcall. He also used an external file, updated with the buildnumber task, to maintain state through the recursive calls. Bingo!

Continue reading “Ant: process elements in a list”