Codes that Changed the World: Fortran

Before Fortran there was no poetry in programming

The BBC are doing a a very interesting radio series on programming languages called Codes that Changed the World, starting with this one on Fortran.

I learned Fortran 77 at university as part of my maths degree. What most sticks in my memory are the dreadful videos we were made to watch featuring a male programmer trying to explain concepts to his dumb girlfriend. That we found the videos offensive goes without saying. I (and many others) stopped going to the lectures and taught ourselves using the text book.

What really puzzled me was why they showed the videos in the first place. Even the lecturer used to apologise for them, saying they were dreadfully old fashioned, but they can’t have been that old. I went to university in 1984. Now, when did Fortran 77 come out, I wonder?

How to be a Great Writer

I was having a conversation about Detective Fiction with a friend of mine recently.

He brought up the fact, apparently well known in detective fiction circles, that the mobile phone is killing detective plots. Writers are tying themselves in knots trying to invent situations in which their characters are unable to make phone calls: they lose their phone, they’re out of charge, there’s no signal, whatever.

Now, I should state again for the record that I don’t read much detective fiction. I’ve nothing against it, it’s just not my thing. But I can’t help thinking that the writers he’s talking about are missing the point. They’re making the same mistake that bad SF writers do: they’ve had an idea and they’re going to hammer the story around it to make it work. They’ve worked out a plot, and they’re going to follow that plot to the end, even if it means getting their characters to act in some pretty strange ways.

I’m often asked about how much I plot a story, and I usually say the same thing. I plot about half way, I have an idea about the ending but that’s it. I always end up following my characters somewhere else. This is one of those things that you can’t be taught, it only comes with practice.

Good writing involves finding an original set of characters and putting them in an interesting situation. Find those things and the story will write itself. A real character will have their mobile phone with them, they will remember to have charged it. Instead of asking how they will lose their phone, a good writer will instead ask what happens next after the character has made that call a lesser writer would have been trying to avoid. That will resuly in a far more interesting story…

You can tell great writing by the way that it just is. There’s something very unforced about it, something very natural, a sense that what you’re reading could be no other way than the way it is. Characters act naturally, any surprises in the story come from their circumstances, not from their reaction to events. Plots unfold in a manner which appears logical (at least on reflection), nothing seems contrived.

Great writing leaves the reader thinking "I could have done that. All I needed was the basic premise and I would have written that. I mean, what else could have happened?"

And that’s the point. It all seems so real, so natural. That’s the mark of a great writer. Someone who has worked hard to make it all look so effortless.

5 Common Linux Misconceptions

1. The Linux Filesystem Hierarchy is a logical, sensible structure

It’s not. It’s something that has been cobbled together in an attempt to unify diverging practices. In an age of terabyte hard drives its easy to forget a time when you were limited to just a couple of floppy drives for storage and had to store programs across different locations.

That’s why program files today are stored in /usr and /opt. And /usr/local. And /usr/bin and /usr/sbin. Oh and /bin and /sbin. When you can’t store everything in one place, you have to make (sometimes artificial) distinctions between where things go. Remember a time when you used to boot up a computer with one floppy, then put in a second floppy with an application program, then a third floppy with data files?

Someone designing a directory structure in a world where terabyte HDDs are the norm might be persuaded it was a good idea to keep bootup files separate in /bin. But /usr/sbin? /opt? I don’t think so.

Have a look at Gobolinux http://www.gobolinux.org/ As they say

GoboLinux is an alternative Linux distribution which redefines the entire filesystem hierarchy.

If you want to know what goes where, there’s a nice overview of the Linux Directory Structure here: http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilestruct.html

2. Bash is just like the Windows shell, except with different commands

Here’s a simple test. How do you use the ls command to list directories only?

Checking the man page, it’s obviously ls -d, right?

Wrong.

Do a Google search on linux list directories only and you’ll find a lot of people making the same mistake. It all comes down to failing to realise that its Bash that’s expanding the * wildcard, and not the ls command itself.

If you’re going to use Bash, you’re going to have to take a little time to read up on how it works. This is a great site: http://linuxcommand.org/

(My preferred method is ls -d */, btw.)

3. The .exe files are in there somewhere

It’s easy to accept that file extensions aren’t necessary in Linux, but it’s hard to shake the idea that something like exe files are still lurking in there somewhere, albeit under different names.

Not really. Linux is far, far more modular than Windows. This is down to the philosophy on which the system is built: programs tools chain their input and output to produce results. A typical Windows application is a flat pack wardrobe, something that solves one problem. A typical Linux application has been formed from many parts using the equivalent of saws, hammers, screwdrivers and chisels.

As an example, a GUI based program that would be a single exe file in Windows would typically be a graphic interface to command line utility in Linux. In terms of user experience, there should be no difference, but behind the scenes, things are very different.

4. Linux is faster/uses less resources than Windows

That may have been true back in the Windows Vista Bloatware days, and it may be true for lightweight distros like Puppy Linux http://puppylinux.org/ and Damn Small Linux http://www.damnsmalllinux.org/, but its not so true now.

Windows 8 may have the worst user interface ever devised, but it installs quickly, loads quickly and runs quickly, matching if not beating systems like Ubuntu 14.04 in benchmark tests.

Why mention Ubuntu 14.04? Well, that leads onto the next point…

5. It doesn’t matter what it looks like, so long as it works

It does.

It really, really matters.

You might do everything via the command line. You might think that Openbox is all you need as far as desktop management goes, but you’re in a minority.

If you’re the only person using your computer, then fine, but if your less technologically inclined partner, friends, parents or children are relying on you to provide the IT then all of a sudden looks really matter.

Of course they does. In a world slowly being taken over by Apple this is so obvious it shouldn’t need saying.

The command line is fantastic, lxde is a miracle of economy, damn small linux is damn fine, but they’re not what most people regard as a solution. What most people want is something that looks good and is so easy to use they don’t even have to think about it. And there’s nothing wrong with that. I don’t care how my shirts are made as long as they look smart and feel comfortable. Most people feel the same way about their computer.

How Long does it Take to Write a Novel?

The answer? Fifteen days, twenty hours and fifty five minutes.

I know that because I finished Dream Paris yesterday and I’ve been clocking the time I spent working on the novel.

The time includes the writing of the first draft of the novel and three redrafts: first redraft, the second following feedback from my wife and a third following feedback from other readers. The novel is now with my editor awaiting his feedback and will probably undergo at least two further redrafts.

I’ve not counted time spent planning the novel or the notes I made prior to embarking on the writing. As some of the ideas, scenes and dialog that appear in the novel have been collected over several years, it was difficult to measure this.

Some statistics you might find interesting:

I started on the 18th February, 2014 at 9:58am
I finished on the 20th February, 2015 at 3:00pm exactly

If I’d been writing an 8 hour day the novel would have taken around 48 days to complete.

The book is almost exactly 100 000 words as it stands, given that it took just short of 381 hours to write that gives an average word rate of a rather pitiful 262 words an hour. Given that the first draft took around half the total time to complete, that makes the word rate a more respectable 524 words an hour. As I normally average around 850 words an hour, the missing words are partially accounted for by the fact that I cut around 60 000 words from the novel due to mistakes, changing my mind or no good reason.

If you’re interested how I collected this data, well, have I mentioned Emacs? I recorded the time taken using org-mode. You can find out more by reading this post on My Emacs Writing Setup.

10 Books I Couldn’t Put Down

I don’t know what my favourite book is, but the following are books I read at various times of my life that, at the time, I couldn’t put down. Most of them I finished in maybe one sitting – definitely no more than two or three – perhaps whilst lying ill in bed or on holiday.

Some of them I’ve read over and over again, two of them I’ve only read once (one of those because it’s not yet available on Kindle and I don’t buy paper books any more)

Most of them are expertly crafted, one of them is appallingly written. All but two have very good stories, half of them are strongly plotted, three of them are character driven, three of them made me laugh out loud, three of them made me smile, four of them had me on the edge of my seat, none of them made me cry. Maybe three of them would get into my top ten books ever.

In no particular order…

  • Rachel’s Holiday by Marian Keys
  • The Bonfire of the Vanities by Tom Wolfe
  • The Hitch Hiker’s Guide to the Galaxy by Douglas Adams
  • The Secret Diary of Adrian Mole aged 13 3/4 by Sue Townsend
  • The Mote in God’s Eye by Larry Niven and Jerry Pournelle
  • Complicity by Iain Banks
  • A Tale of Two Cities Charles Dickens
  • The Rainmaker by John Grisham
  • Harry Potter and the Deathly Hallows by JK Rowling
  • The Da Vinci Code by Dan Brown

My Ubuntu Set Up

Installing Ubuntu is quite straightforward. One thing that stumps many new users, however, is which programs to install next. Windows users can find themselves faced by a bewildering range of programs, many of which appear to do the same job.

The following are the applications I install. I’m not saying they’re the best, but they will get you started with a system that does most of the things you require. I’ve included applications already included in the Ubuntu install for the benefit of those using other distros. These pre installed applications are marked like this

  1. Install Ubuntu

  2. Check for software updates

  3. Install the things that will help me install everything else

    • Dropbox: for access to my files
    • Emacs: Text Editor
    • Lastpass: password manager
    • Chrome: because waiting for Firefox to install updates each time its opened is really irritating.
  4. Install encfs: encrypts Dropbox files

  5. Install productivity and entertainment applications

    • Libre Office: Word Processor, Spreadsheet etc
    • Shotwell: Photo Manager
    • Gimp: Image Manipulation (like Photoshop)
    • Shutter: Print Screen
    • Geary: Lightweight email client
    • VLC : Media Player
    • MediaTomb: UPnP Media Server
  6. Install a number of useful drivers and utilites
    sudo apt-get install…

    • aptitude: alternative to apt-get
    • nautilus-open-terminal: right click in nautilus to open current location in terminal
    • nautilus-image-converter: right click in nautilus to quickly edit image
    • gparted: Graphically edit disk partitions
    • nmap: Scan networks
    • vim: Old text editor
    • feh: fast and flexible image viewer
    • filezilla: ftp client
    • ubuntu-restricted-extras: support for such things as mp3, avi, mpeg, TrueType, Java, Flash, Codecs
    • sudo /usr/share/doc/libdvdread4/install-css.sh: Play restricted DVDs
    • Deja dup: Simple backup software
    • backintime: snapshot backup software
    • openssh: Networking
  7. Install Wine, the Linux windows emulator, and the Chrome UA Spoofer app. The spoofer app fools the browser into thinking it’s running on a different machine. This makes it easy to download and install the Evernote Windows client

  8. Install the following External Packages

    • Tomahawk: Unified Media Player
    • Calibre: ebook management
    • Spotify Client: Not really needed now I use Tomahawk…
    • Kodi (formerly XBMC): Media Player/Home Theatre
    • Handbrake: Video ripper and transcoder

PLR – Have you signed up?

I just received my PLR statement for this year. If you’re wondering what the PLR is, then read this, taken from the PLR website:

Public Lending Right (PLR) is the right for authors to receive payment for the loans of their books by public libraries.

I’m a huge fan of the PLR and not only for the obvious reason that they send me money each year, but also for the fact they are so good at their job.

I first found out about them a few years ago when one of their operatives phoned me up to say she’d noticed I hadn’t registered with them and was due some money if I did so. Since then they have operated with quiet efficiency, paying my money directly into my bank each February without fail. They’ve also got an excellent website – nothing fancy, it just works.

If you’re a published writer and you’ve not signed up yet, you could be losing money. Where does it come from? Well, again, as it says on the website:

Under the PLR system in the UK, payment is made from government funds to authors, illustrators and other contributors whose books are borrowed from public libraries. Payments are made annually on the basis of loans data collected from a sample of public libraries in the UK. The Irish Public Lending Remuneration (PLR) system covers all libraries in the Republic of Ireland and operates in a similar way.

To qualify for payment, applicants must apply to register their books.

It takes less than ten minutes. There’s absolutely no reason not to sign up.

There’s a nice end note to all this, too. Many top selling authors waive their PLR payments, allowing them to go back into the pot to help out other writers.

PLR, they really do bring a ray of sunshine into these dark January days.

The Twelve Days of Christmas – Simplified

If, like me, you’ve found yourself repeatedly performing The 12 Days of Christmas over the last few days, you’re probably in search of some way of remembering where you are in the score. After all, most scores make much use of repeats to keep the page count down, so when you’re performing the song for thirty fifth-time it’s easy for the attention to wander and to lose track of where you are.

The following is an attempt to provide a simple aide-mémoire that will help you keep your place.

  1. The song consists of 12 verses. Let n = the current verse
  2. For n = 1, play the phrase as written.
  3. For 1 < n < 5, there is a repeating phrase on the present count. (Three French Hens, Two Turtle Doves etc.) Repeat this phrase (n-1) times.
  4. When n = 5, play the phrase for the current present and then repeat the subsequent present phrase 3 times
  5. For n > 5, repeat the present phrase (n-6) times, then play case n = 5

This can summarized as follows

* For n < 5, repeat the phrase (n-1) times
* For n = 5, play as written, then repeat next phrase 3 times
* For n > 5, repeat the phrase (n-6) times, then goto case n = 5

Incidentally, my carol book has a tempo of crotchet = 132. In order to maximize jollity, this tempo should be varied according to the formula

crotchet = 132 + 2(n-1)

thus ensuring a steadily increasing pace that increases the excitement of the singers.

Tip: if time prohibits a full performance, simply play a selection of verses such that n is a prime number

And there you have it. Festive fun delivered in a rational and logical manner.

Merry Christmas.

First Drafts

I finished the first draft of Dream Paris on Wednesday (at 14:40pm precisely. I know that, because I texted my wife to let her know.)

I think of first drafts as being partially inflated, like a half pumped up a bouncy castle or an air bed: you can see the rough outline of the finished article but it’s bent out of shape, it’s still full of creases.

Today I started on my favourite part of the creative process, the second draft. Now I know that the story works, now that I am sure of the shape of the piece I can go through and put in the detail. I can take my time, I can enjoy the scenery, I can really get to know the novel.

I remember once hearing John Cleese talking about writing Fawlty Towers. He said how he and Connie Booth would spend ages plotting the scenes. It was only at the end they put in the jokes.

I started that this afternoon. Not putting in jokes, but beginning to make the book more like I want it to. This isn’t the end of the process. There are quite a few drafts before that comes about, but, for me, this is the best part.

I Have no Opinion

Who says that Weetos are just for breakfast?

I have no idea. I’ve never heard anyone express an opinion on the right time to eat Weetos, one way or the other.

But advertisers love these sort of challenges. They appeal to the rebel in people (hey, no one tells me when to eat my breakfast). More than that though, they want to make you part of the debate. Advertisers validate the thing they are trying to sell by tricking you into having an opinion on it one way or another, because once you have an opinion on something it becomes important. That’s why the adverts want you to believe that you have to either love or hate Marmite, they want you to believe that indifference is not an option.

Well, yes it is. Indifference is a vital thing. I have no opinion on many things. I haven’t got time to have an opinion on everything, because if I were to try it would stop me concentrating on the things that are really important.

This is the politician’s trick. Concentrate on the fact that it’s important to vote and you validate the people you are voting for, the politicians themselves. Keep telling people that they have to vote or the wrong party will get in, and they’ll forget to check if the right party has anything going for it.

The Internet is full of people with opinions, many of them keen to get you involved in their debates. That’s how they validate themselves. That’s how they promote themselves. They want to drag you into the argument, they’ll tell you that you have to be involved, that if you’re not part of the solution then you’re part of the problem.

Well, no. You’ll just have to excuse my indifference.