KISS – A computer odyssey

Introduction

In a recent post on misc@openbsd.org Ingo Schwarze, an OpenBSD developer, wrote as follows.

I waste time whenever i have to select anything from any kind of menu, select any icon from any kind of iconbox or desktop background, select any file or directory from any file selection dialogue, or have to click any icon in any dialogue box.

I prefer typing commands and use as little menus, clickable icons, selection lists, and dialogue boxes as possible because it is faster, simpler, and requires less looking at the screen.

My feeling exactly. I favour the KISS (Keep It Simple, Stupid) principle in computing, although it took me a long time to realise this fully. But looking back I see it’s a continuing trend.

MS-DOS to Linux

I got my first PC some time in the early 1990s to replace an Amstrad PCW, if anyone remembers that. The PC came with MS-DOS and Windows 3.0, which was replaced almost immediately by Windows 3.1. I didn’t upgrade. I didn’t see much point in Windows and continued to use DOS until, at some point in the 1990s, I began to experiment with Linux. After an initial unsuccessful attempt to use Slackware I tried Red Hat and got on better with that.

I knew nothing about Unix at this stage; in fact, I still knew very little about computers in general. But I was beginning to enjoy the intellectual challenge they offered and that was what drew me to Linux. At this time it was pretty much entirely reliant on the command line, but this wasn’t a problem for me because I was used to it from DOS and in fact preferred it. But the lack of word processors was a different matter.

Linux and word processors

My practical reason for using a computer was as a writing tool for books and articles. In my Amstrad and DOS days I’d had a word processor called Protext which I liked, but it wasn’t available for Linux. In fact, there weren’t any real word processors for Linux at the time; you pretty much had to use either Emacs or Vim. I tried both and eventually settled on Vim. Some people disliked it because it is modal (you have to alternate between Insert mode to write the text and Normal mode to modify it), but that didn’t worry me because Protext is also modal.

I still use Vim all the time, even though there are now plenty of word processors and similar programs available to me. The only one I have any use for is LyX, which I’ve used to produce seven books, but even there I usually write my text first in Vim and then paste it into LyX for final editing before printing.

Desktop environments and window managers

Together with the switch to Linux I also began to use the graphics mode, and that led me to explore the world of desktop environments. KDE and Gnome intrigued me at first but gradually I realised that I didn’t need or want either of them. Eventually I settled for a simple stacking window manager, IceWM, and was happy with that for a long time, until I tried tiling window managers. Since then I’ve been sold on them; nothing would persuade me to go back to a stacking WM. My favouring tiling WM, as I’ve explained elsewhere, is Spectrwm. (See my previous blog for details.)

From Linux to OpenBSD

I’d long had a curiosity about the Unix philosophy and I tried out FreeBSD, a couple of times, but found it rather frustrating and always went back to Linux. Then I tried OpenBSD, simply from curiosity. Over a period of about six months I became completely hooked, and four years later I still am.

The transition from Linux to OpenBSD was probably easier for me because the Linux distribution I was coming from was Arch, which is often said to be the most Unix-like version of Linux. I very much doubt I shall change my operating system again. Ths Unix philosophy  is based on KISS and that’s what suits me.

Conclusion

Looking back now over almost 40 years of messing about with computers (and doing some proper work with them in the process, obviously!) I see that there has been a gradual but quite definite progression towards simplification and minimalism.  I know that at least some other people have had a similar experience. If that’s your case I hope you may find these jottings of interest.

A taste for `minimalism in computing probably reflects a more general attitude to other things in life. I’ve written a post about that as well.

Simplicity, minimalism, KISS…

Introduction

A long time ago I read a poem, ‘Alexandria’, by Lawrence Durrell which contained the lines: “As for me I move/Through many negatives to what I am.” That has stayed in my mind ever since and recently it’s occurred to e that it describes an attitude that has grown in me over the years: a taste for minimalism. Looking back, I seem to see my life as a long succession of relinquishments.

I certainly see it in the way my use of computers has evolved. But there are other examples too.

For instance

One is music. Given the choice, I’d rather listen to chamber music or soloists than to an orchestra. And I have a taste for minimalism in music too; for example, I like Steve Reich’s Drumming.

I prefers small gatherings to large parties.

Then there’s my teaching of acupuncture. I’m an advocate of what is often called Western Medical Acupuncture (WMA), which is based on the modern understanding of how the body works (and fails to work) instead of the ancient Chinese ideas. I’ve been involved in acupuncture for over 40 years and in that time I’ve progressively tried to simplify it. We we don’t need the traditional apparatus of “points” and “meridians”.

Of course, this should not be taken too far. WMA relies on the modern understanding of the nervous system, and that is a boundlessly complicated subject, but it’s a necessary kind of complication whereas the Chinese stuff is unnecessary. As Einstein may or may not have said, “Make everything as simple as possible, but not simpler”.

What about religion? I was brought up as a Catholic and that’s a pretty complicated faith. Later I got involved with Hinduism, which is even more complicated. But really I’m more sympathetic nowadays to Buddhism, although even here there are differences; Theravada Buddhism is relatively simple compared to Mahayana. Naturally, I prefer Theravada; however I’m not a Buddhist.

In fact I’ve now left all of this behind. My life seems to have been be a process of progressive simplification. Another poem which I read many years ago – I think it was in a BBC magazine of the time called The Listener – was on this theme of abandoning more and more things. The concluding lines, quoting from memory, were these: “all of it a practice run/For doing without myself”.

I could go multiplying examples of this inbuilt search for minimalism almost indefinitely,The problem isn’t finding enough examples, it’s finding too many. Which would, of course, be exactly what I want to avoid.

Acupuncture: an interesting Canadian study

As I discussed in a previous post, so-called sham acupuncture is not a good control to use in clinical trials. I recent study in Canada used a different approach.

The trial

The researchers studied patients suffering from Bell’s palsy. This is a disease which comes on acutely (suddenly) and produces paralysis of the muscles on one side of the face. Patient smile unevenly and may have difficulty in closing their eye on the affected side. The cause is unknown, though it is thought to be a virus that has caused swelling of the facial (VIIth) nerve on one side. In most cases patients recover in a few weeks, although some do so incompletely or even not at all. It is usually treated with corticosteroids (prednisolone) and this seems to improve the chance of a good outcome.

All the patients received both prednisolone and acupucture. The control group’s acupuncture was done gently and superficially; the active group received acupuncture that was sufficiently deep and vigorous to elicit the typical acupuncture sensation (de qi).

The results were assessed by three neurologists who saw videos of the patients carrying out face exercises. The neurologists did not of course know which treatment each person had received.

Results

At six months recovery was assessed to be 70% in those who had received the presumably less effective acupuncture and 90% in those who had received the more effective acupuncture. The difference was statistically significant.

Comments

Most acupuncture trials are for pain, which is assesse largely subjectively, by the patients’ reports. In this case the assessment was based on objective criteria, the patients’ abilityto perform movements. Also, all the patients had been needled at the same sites; the only difference was in the vigour of the needling. The trial therefore gets round many of the objections that critics often raise. Of course, only a few kinds of disease are suitable for assessment in this way.

Reference

Xu et al., 2 April 2013; 185(6):459. See also accompanying article by John Fletcher

 

 

 

 

 

Mispronouncing “extempore” in “Book of the Week”

Helen Bonham Carter is currently reading LEL – Lucasta Miller’s “account of an infamous female poet in ruthless times – London in the 1820s and ’30s”. She pronounced “extempore” to rhyme with “shore” instead of with “Moray”. Is this ignorance or the latest example of speak as you spell? Either way it jars. It’s all the odder because a little later she pronounced another Italian word with scrupulous correctness.

Doris Day – “que sera, sera”?

The speaker in today’s “Thought for the Day” said that Doris Day had taught him how to pronounce Spanish correctly. Actually, it should have been Italian, although it is now widely said to be Spanish. It was cited by Christopher Marlow in his 1604 play Dr Faustus.  The Italian phrase is “che sarà, sarà”, although even this is gramatically incorrect – see https://en.wiktionary.org/wiki/che_sara_sara.

Brexit second thoughts – sort of

I’ve been thinking about the upcoming  elections for the European Parliament. This really a vote about Brexit.

I didn’t want the Brexit referendum in 2016and I voted to remain.  I regarded the outcome we got as as disastrous if predictable,  both because it seemed to reflect a narrow isolationist view of our place in the world and because it was mostly older voters who took this position whereas it’s the younger ones who will have to live with the consequences. I also thought the leaving process would be very difficult although not as difficult as it is turning out to be.

A lot of those who voted to remain now want a second referendum but I doubt the wisdom of this. I haven’t changed my mind about Brexit itself but I don’t think a new referendum would be decisive and it might well make matters worse if there were a narrow margin in favour of remain. It would be widely seen by leavers as a betrayal of our democracy.

All this makes the decision on how to vote in the forthcoming European Parliament election very difficult. Yesterday I heard my namesake Alistair Campbell (Tony Blair’s former political aide) say that he didn’t know how to vote. I’m in the same situation. I hope I’ll have worked it out by next week.

Note added 23 May 2019

Well, I finally decided to vote for Brexit. What helped me to make up my mind was a remark on Newsnight last night by Lord Sacks, the former Chief Rabbi. He spoke of the need to sustain democracy, using the analogy of a parent whose children have taken what one thinks is a wrong decision  which one nevertnheless should nevertheless support. A bit patronising,perhaps, but it’s what I’ve been feeling myself. Our demonracy is shaky just now and I don’t think it will stand the shock of the 2016 vote being ignored.

 

Book review: The Secrets of Station X, by Michael Smith

When Winston Churchill published Their Finest Hour, the second volume of his memoir of the second world war, in 1950 he made no mention of Ultra, the programme to decrypt the German cipher system that had been carried out at Bletchley Park. This was not an oversight, of course. The total secrecy that characterised this huge enterprise was not relaxed at the end of the war; not until 1974 did it become generally known.  Read more

How to make a sitemap.xml for a medium-sized site & edit it with Vim

Introduction

In this post I describe two topics in the creation of xml sitemaps:
1.  producing the sitemap.xml file and 2. editing this file to correct errors.

1. Problems with creating xml sitemaps

If you want a sitemap.xml on your website there are places on the Net where you can make one for free, but most of them have restrictions of one kind or another. They all, as far as I know, limit your pages, often to something like 500 or fewer. That’s OK if you don’t have too many, but I have more than 3500.

Perhaps you don’t need to index the whole site, or may prefer to split it and index different parts of it separately. This may get round restrictions on the number of pages you can index and will certainly be quicker. But it requires you to start indexing at a subdirectory below your root directory and some sitemap generators don’t allow  this.

Currently I’m using Online XML Site Generator. It’s free (though you are invited to make a small donation  – £2, equating to 2.46 USD or 2.34 EUR, which seems very fair). The number of pages crawled is limited to 2000. Here is a full list of the conditions.

  • Maximum pages 2000 (includes pages which errored)
  • Spider will run for maximum of 60 minutes.
  • Individual page timeout 20 seconds
  • Download limit of 60K (for larger files the first 60K is downloaded).
  • Maximum of 20% urls hitting 20s second timeout.
  • Average request time across all urls must be 75% of timeout (which is 15 seconds) sampled every 25 urls.

As you are allowed to start at a subdirectory I can live with these conditions, including the 2000-page limit; I make separate sitemaps for different areas on my site.

However, I find that the sitemaps so produced need editing. They are not accurate; they contain links to all the pages in the relevant subdirectory but include others as well.

To see how this works, suppose you have a website called myfruit.com, with subdirectories myfruit.com/apples, myfruit.com/oranges, and myfruit.com/pears. You make a sitemap for myfruit.com/apples. This should contain URLs for apples, but in fact it will contain many URLs from the other subdirectories.

2. Editing the sitemap.xml file

You can easily edit the sitemap.xml you’ve just created, but if you have to remove a lot of unwanted entries manually it will take you a long time. Fortunately Vim (the One Editor to Rule Them All) allows you to automate the process almost completely. (Yes, I know other editors are available but I don’t use them, so if that’s what you use you’ll have to work out your own method.)

Taking the example website above, let’s suppose you have made a sitemap called sitemap-apples.xml. When you load this in Vim you see that as well as entries for apples there are also lots of entries for oranges and pears. They will look like this.

<url>
<loc>https://myfruit.com/pears/</loc>
</url>

To remove all the entries containing “pears”, use  Vim’s macro (recording) facility. Here are the keystrokes,with comments (after #).

Start in Normal mode and issue these commands.

  • qa   # start recording and store results in register a
  • /pears   # find first line containing “pears”
  • k   #  move cursor up one line
  • 3dd    # delete three lines
  • n   # find next instance of “pears”
  • q  # end recording

You have now set up your macro. Test it by doing @a. This should delete one instance of “pears” and position your cursor on the next instance. You can repeate it with @@.

If this works, you can continue to delete all the remaining instances of “pears” automatically by doing something like 300@q. Don’t worry if this gives more repetions than necessary; these will simply be ignored.

Make a similar macro for “oranges” and you should be left with a correct sitemamp.xml file that you can upload to your site.

3. Saving the macros

If you only have one or two sets of unwanted URLs to delete it won’t take long to type the macros. But what if there are more than this, or if you update sitemap.xml frequently? Can you save your macros for future use? Yes, you can, and it’s easy.

There is a site which provides most of the information you need, but I found it didn’t work exactly as specified, possibly because of later changes to Vim. Here is what I do, which works as of 12 May 2019.

  1.  Add lines like these to your .vimrc.
    let @a=’/pears^Mk3ddn’
    let @b=’ /oranges^Mk3ddn’

NB.  ^M is produced in Vim by typing Ctrl-v <Return>.

2. Load sitemap.xml into Vim. Do 200@a. This should delete 200 instances of pears. Now do 200@b; this should do the same for 200 instancs of oranges. (Don’t forget to source .vimrrc or stop and reload sitemap.xml in Vim after you’ve modified .vimrc.)

 

 

 

 

 

 

 

 

How to avoid problems with Vim undo & redo

Starting with Vim 7.0 this brilliant editor introduced a more powerful set of commands for Undo and Redo, using an undo tree. Being lazy, I didn’t fully get to grips with this and as a result didn’t really understand what I was doing. At times I accidentally deleted text I’d just writtenjjjk and then couldn’t recover it.

I knew the previous version of my work had to be there but I didn’t know how to get it back. After a time I realised that when things seemed to go wrong the solution was to use ‘g-‘ and ‘g+’ to go hack and forth in the undo tree.  But this was a bit hit & miss.

If you have had a similar experience here are a couple of useful site where things are explained clearly;

https://vim.fandom.com/wiki/Undo_and_Redo.

https://vim.fandom.com/wiki/Using_undo_branches

The second of these sites has links to a couple of plugins which make life easier. I’m not generally an enthusiast for plugins but I’ve installed Histwin, which seems pretty good; I’ll probably try Undotree as well.

Finally, thanks to a third page I now know why I occasionally deleted work I’d just done and couldn’t recover it. See:

https://vim.fandom.com/wiki/Recover_from_accidental_Ctrl-U

This explains why it happens (pressing Ctrl-u in Insert mode) and provides a way to avoid it.

 

 

 

Useful resource: Wikipedia’s Style Page

I’ve just been looking at  Wikpedia’s Style Page. Some of this is specific to Wikipedia but quite a lot has application to writing more generally.  See, for example, “weasel words”,  “expressions of doubt”,  “clichés and idioms”.  I think the late F.L. Lucas, whose Style has been my main guide for many years, would have approved.