Emacs – no pain, no gain (again)

I’ve been here before, at least twice: drawn like a moth to the Emacs flame, only to be burned again by the formidable challenge of remembering and getting comfortable with so many new keystroke combinations and simultaneously un-learning those which have become muscle-memory over the years. It’s a common tale – there are so many other blog posts like this one.

I’ve decided to run Emacs and Sublime Text (v3) side by side for a while. I use both Windows 7 (at work) and a Macbook Pro (personal) and I plan to use Emacs on both of them, but I can’t face it ‘cold turkey’, even though I know it will take longer this way.

Why do this? Two big reasons:

  1. Emacs (and perhaps also Vim) will always be around and well supported. It may be 40 years old but it’s still being maintained, improved and extended. Emacs won’t be discontinued, ‘end-of-life’d or abandoned. Sublime Text is a lovely editor – I even paid for a license – but, like many other people, I’m a little concerned that development may have come to a halt and it is not open-source.
  2. Emacs is almost certainly more powerful than whatever other editor you’re thinking of. Just watch this.

Just two Emacs resources I’ve found useful:

  • Mickey Peterson’s awesome series, Mastering Emacs. This is hands down the most useful resource I have found. I dip in and out of interesting articles, keeping notes as I go. It isn’t a methodical way to learn but it’s a lot more fun.
  • Emacs Rocks – video tutorials on specific features. One of the most encouraging things for a newbie is to see a live demonstration of how convenient, effective and powerful something can be. It’s the evidence I need sometimes, to continue applying myself.

There is another reasonably big reason: Lisp.  I am learning Clojure, which is a dialect of Lisp.  What makes Emacs so powerful is that it can be extended and automated through Emacs Lisp, the editor’s internal language. Like Lisp itself, this only looks like an obviously good thing to someone who is already convinced: Emacs and Lisp share this paradox.

Two nice examples of using and extending Emacs to reach well beyond the confines of a mere editor: this one which starts with executing shell commands embedded in the buffer text, capturing the output in the buffer then moving on to controlling a remote VM over SSH from Emacs; and this one which develops a new Emacs mode for interacting with a Cassandra database.

One other thing to pass on: I am pretty sure that the right thing to do is start with vanilla Gnu Emacs, whichever platform you’re on. Don’t be tempted by starter kits or the frighteningly baroque but accomplished (I think…) piece of work which is Emacs Live. On the Mac, I’m using this installer, and not the seemingly populate Aquamacs.  Start simple, learn the basics, build up your .emacs incrementally. Understand what you’ve got and how it got there.

I don’t really have the time to learn Emacs properly so I’m just going to pick it up slowly when I can. The rest of the time I’ll use Sublime Text and just deal with the guilt.  I know it’s wrong and I probably won’t go to Geek Heaven, but there it is.

Follow-up: after a couple more weeks on/off struggling with Emacs I decided enough was enough.  Sometime I might write about what I did next, but would anyone actually want to read yet another dreary account of swapping editors? No, thought not.

LibreOffice 4 – so what?

I’m sure I am not alone in wanting LibreOffice (or Apache OpenOffice) to flourish. I used OpenOffice for almost ten years and I started using LibreOffice almost as soon as they forked the codebase.

After all this time and with all the effort supposedly directed at making LO or OO properly competitive with MS Office, where are we?

The answer is, not very far beyond OpenOffice circa 5 years ago. The two applications  which arguably matter most, Writer and Calc, are still some way behind the competition. Really basic things which have been lacking in Writer are still not fixed; every new release proudly lists ‘features’ and fixes which presumably someone must be waiting for, but none of the basics are tackled.  The basic change I have been waiting years for is the addition of draft view (or ‘normal’ view) in Writer. Is it even on the horizon?

And now, LibreOffice 4 has arrived, with the usual trumpeting. What do we actually get?  Well to start with, a tarted-up front page on the web site which carries this ridiculous assertion:

“LibreOffice 4 – The free office suite the community has been dreaming of for twelve years.”

This sort of lazy hype is common enough in promotional material, but didn’t any of the people involved take a step back and realise just how embarrassing a statement this is?  Twelve years! We’ve all patiently waited twelve years and this is the best that can be achieved? By all those contributors, in all of that time?  God help us.

I still have my personal copy of Microsoft Office 2003 and it’s installed on this laptop alongside LibreOffice 4.  That’s a ten year old Microsoft product – not quite twelve years, I’ll grant you, but close enough in software terms. It outperforms the latest Writer in every significant way. Documents are loaded faster, fonts are rendered better and moving around the document is faster than Writer. And the saddest thing is that I actually prefer Writer in many ways, but some of Writer’s shortcomings just make it too difficult to live with.

LibreOffice 4 claims to have improved interoperability with Microsoft document formats. This is very important for any product which has ambitions to replace Office.  It doesn’t stand up to much scrutiny. Here’s a real-world test: I needed to consult part of the DICOM standard (a medical imaging protocol and file-format). The standard can be freely downloaded in Word format from the NEMA site. And this is Word 97-2003 format, not the newer docx format. I downloaded DICOM Part 3 which is a .doc file of around 20MB, with around 1450 pages. I have a reasonably powerful laptop (Core i5 with 8GB RAM) so opening a 20MB file shouldn’t really tax it.

Opening this document in Word (cold start, Word not already running) takes three or four seconds. I can start to use the document, scrolling down to the table of contents and through the first few pages while Word loads the rest of the document in the background. Complete loading of the entire document takes something less than 30  seconds.

Opening the same document on the same laptop in Writer takes over 5 minutes.  And I tried this a few times, also checking that I wasn’t running something else which was hogging CPU or memory. LibreOffice displays “Importing Document…” for 5 minutes or so, eventually displaying the title page.

You might argue that Writer is dealing with a foreign file format and once imported you could then save to ODT and never have to convert again. Saving to ODT took almost a full minute. Loading the resulting ODT took almost a minute. Much better than the original conversion time, but still a lot slower than Word 2003. Moreover, you cannot do anything at all with the document in Writer until it is completely loaded – all you see is a grey rectangle.

The worst is yet to come. Most of us will actually be prepared to wait, especially if the product is free. But most of us will also expect the document to be rendered and paginated correctly and this is where Writer falls down badly. The sample document is not particularly complex but does contain some figures and diagrams, embedded as images. Writer completely fails to display some of these. Below is a screenshot of the same section (7.4) of this document, Writer on the left and Word on the right:


The images for these figures are completely missing in Writer. Scrolling through the document, it appears that few images are rendered (see for example the very start of Section 7 – all four figures are missing).

Free or not, that’s not good enough.  I haven’t had to work hard to find these faults: I happened to need this document for something I am working on and just decided to give the latest Writer a shot at opening it. How many more howlers would I find if I spent longer and looked deeper?

Is this really what we have all been dreaming of for the last twelve years?

Test for embedded gist

This just tests the gist embedding feature in WordPress and contrasts the result with the WordPress built-in syntax highlighter.

The GitHub gist URL appears on a line on its own, immediately below this one:

Two things to note:

1) Place the gist URL on a line by itself – I find this is easier to get right using the Text tab in the page editor. If you paste a URL into the Visual editor, it renders it as a plain anchor.

2) Remember to ensure the gist is marked as public on GitHub, otherwise it won’t be available to the WP engine (and WordPress reports it as having been deleted).

And here is a fragment of code using the built-in syntax-highlighter:

  public static <T> void copy(List<? super T> dst, List<? extends T> src)
    for (int i = 0; i < src.size(); i++)
      dst.set(i, src.get(i));

BMW R100S – ‘Peach’

After a fair amount of searching / thinking / indecision, I believe I’ve found the right bike (motorcycle) so took the plunge and I’ve handed over the money.

‘Peach’ is a 1978 BMW R100S who needs a little work and a bit of TLC to bring her back to prime condition. Here’s a camera-phone picture:

The previous owner is moving back to the US and wanted her to go to a good home – so that’s what I will try to provide.

The panniers (Siebenrock, you can see one in the foreground) are tardis-like: you really can get a lot of stuff in there.

There’s almost a year’s MoT but no tax (fair enough as the owner won’t be here much longer) and I will need to attend to a few practical things before riding long distances, but most of the remaining work is cosmetic. The R100S should have a bikini-fairing – this link is to a picture showing what Peach should really look like, but I’m not too concerned about that. At some stage I’ll probably find and fit one.

I’ve never owned a BMW but always been attracted to these bikes: there is something very appealing about the simplicity of the engine, the feeling that you really do stand a chance of being able to do most maintenance yourself, and of course the overall build quality.  The owner included the Clymer manual, toolset, complete set of spare bulbs and some other bits and pieces so I reckon this was a great find.

The owner is a great character and we spent quite a while just talking and drinking tea. The bike has a nice back-story, plus his parents owned BMWs too and there are tales of how they got on their 1965 R-50 (a wedding gift) after changing out of their marriage clothes into denim, and headed across America from NYC to California. Their children subsequently ‘grew up’ on the back of that one.

I really enjoyed meeting and talking to Walter – I’m sure we will stay in touch and he’ll get to hear about my adventures with ‘his’ bike.

Test Post (gist)

This is simply a test to see whether github’s gist facility works acceptably as a way to quote source-code fragments in a post.

The following is a snippet of Groovy code which should appear as a gist:

This text should appear immediately below the code snippet.  If this experiment works then I will very likely return to using Blogger – the alternatives are just too much fiddle (Posterous, Tumblr) or much more baroque and complex than I need (WordPress.com).  I want to get back to writing and micro-blogging properly: the first job is to pick the right platform and commit to it.

NetBeans IDE 7 Cookbook

There’s another NetBeans IDE book out from Packt Publishing. This one is called  the NetBeans IDE 7 Cookbook and they will be giving me a review copy, so I’ll post my impressions of the complete book some time in the next couple of weeks.

NetBeans IDE 7 Cookbook

Meantime, I have been sent one chapter in advance,  Chapter 7 -EJB Application, which I am permitted to share via the link. You can read and download this chapter for free, too.

First impressions are not good, if this chapter is representative of the quality of the whole book.  First, the numerous typos are distracting: average proof-reading would have found most of these so I wonder whether there is enough quality assurance applied, pre-publication. I haven’t the patience to list them all.  The quality of the writing is also not particularly high, though I’m always prepared to make allowance for non-native English writers/speakers and I believe the author is Brazilian. Not all the clickable links in the PDF have been checked either: the first one I decided to click, at the top of page 160,  leads to the 404 page on Oracle’s site.

However, my main criticism of this chapter is to do with its content. This is supposed to be a ‘cookbook’ and in the context of computing books ‘cookbook’ usually means a compilation of ‘recipes’ (concise instructions) for solving real-world problems using a specific programming language or tool.  Well… I suppose the sample chapter does tell you how to use the EJB functionality in NetBeans 7, so in a very shallow sense I suppose this could be regarded as a ‘recipe’, but the chapter text does little more than walk you through the IDE wizards. Cookbook recipes are usually focussed on something more substantial. The pasting-in of the source code generated by the NetBeans wizards isn’t all that helpful either – if you’re running the IDE, you’ll have the code in front of you anyway.  Lastly, as this is Chapter 7 of a book dedicated to NetBeans and Java EE, why does the text redundantly repeat instructions on downloading NetBeans and ensuring GlassFish is installed?

If you don’t know anything about Java EE, this book won’t help you much.  If you do know EJB / Java EE then you probably won’t have much trouble working out how to drive NetBeans to create (e.g.) a stateless bean, so I’m not sure who the target audience is.

But this is just one chapter: I will review the rest of the book when I receive it.


Cloud Storage and Security

Very disappointed to read about the latest DropBox security issue.  Disappointed in two quite distinct ways: first because their account of this issue suggests a somewhat careless attitude to both security and regression testing, and second, the fact that the first I heard of this was when I read this Register piece. Not good enough. The world is scrutinizing cloud applications quite closely and I fear DB hasn’t been paying attention.

Leaving aside the insecure nature of the DropBox service itself and it’s apparently relaxed attitude to regression testing, there is the issue of service management and customer relations. As many others have pointed out, directly informing all users, as soon as reasonably possible, is a pre-requisite for establishing trust. Just compare DB’s behaviour with that of LastPass. As soon as LastPass detected a possible breach, they immediately informed their users and took sensible action. Impressive, and reassuring.

I’ve been a SpiderOak user for a while, but until now I hadn’t considered using their Sync feature, as I’ve been using DB instead. This incident has been just the trigger necessary to make me move my stuff out of DB and into SpiderOak, and I will be trying their Sync service now. By the way, I have no affiliation with SpiderOak whatsoever. I use their service principally for these reasons:

  1. Zero-knowledge privacy 
  2. Their attitude to engineering
  3. Their prices. (Better than DB)

Another comparison article can be found here.

Superficially, DropBox is a lovely product but as you start to rely more on cloud storage you begin to think of all the ways your content might be compromised or misused and SpiderOak’s robust, credible approach completely trumps any pretty UI.