Thursday, June 07, 2012

Word heading numbering

Anyone who has used Microsoft Word for any length of time will know that the heading numbering is fundamentally broken; a fact that is unforgivable, given that WordPerfect 5.1 had it pretty much sorted in 1989.

One bug that I've frequently struggled with is where subsections look like this:

Appendix A Name of appendix

A1 Sub-heading 1

A1.1 A paragraph.

A1.2 Another paragraph.

A1.3 A third paragraph.

A2 Sub-heading 2

A1.4 Why?

Getting that third level heading to number correctly is nearly impossible. Ticking the "Restart list after:" tickbox in the "Define new Multilevel list" dialog doesn't work. Sometimes just typing "A2.1<Tab>Why<Enter>" provokes Word to try to be clever and format the heading as such; then it's an easy matter to update the appropriate Heading style to match the selection. Sometimes that doesn't work. Sometimes going back and defining all the relevant heading styles from scratch works.

Now I've found a new way. I noticed the "Click level to modify" list in the  in the "Define new Multilevel list" dialog included A1 but not A2. That inspired the following.

  1. Format the paragraph in the same style as A2; it'll become A3.
  2. Demote the paragraph (possibly by using Tab, but you may need to go into Outline view to be sure).
  3. Now the numbering should include "A.2" and possibly a lot more if, like me, you're using low-level heading styles like H6ff. [Note to self: that's probably a bad idea.]
  4. Now you can edit the numbering in the "Define new Multilevel list" dialog.
It shouldn't be this difficult!

Thursday, November 17, 2011

Thursday, November 03, 2011

Programming books 2

A while ago, I wrote about some of my favourite programming books. I was just reminded of a couple of books that deserved a special mention. I mentioned Stroustrup last time, but what I neglected to point out was the clever and witty epigraphs that appear at the head of each chapter. The only other book I've found to compare in that respect is Hal Fulton's The Ruby Way - sheer genius!

Wednesday, November 02, 2011

Recent gems

When I first bought Conrad Cork's the New Guide to Harmony with LEGO bricks, I was horrified to learn that I was expected to find literally hundreds of tracks. I had been dimly aware of Spotify, but it's great.

Yesterday, through a link in Hacker News I think, I discovered SciRuby. That is a project that could easily eat up all my spare time. I have oddly ambivalent views towards Python and Ruby. Like Ash in Alien, I admire Ruby's OO purity, whereas Python just works, in a DWIM kind of way - it's so good, it's boring!

Saturday, October 15, 2011

Dennis Ritchie

I missed Radio 4's Last Word yesterday, but I've just looked it up on iPlayer. I particularly wanted to hear what they had to say on Dennis Ritchie, who died on Wednesday. I was shocked to find no mention of him. The BBC certainly noted his death, and acknowledged his immense contribution to today's IT. So why did they have nothing to say in their primary obituary programme?

For those who don't know, Dennis Ritchie invented the C programming language. Much of Windows is written in C; some of it is written in C++, which is based on C. If you prefer Mac to Windows, Mac OS X is based on the Unix operating system, which was written in C. In fact, Dennis Ritchie wrote much of the original Unix; that's why he invented C.

The importance of C cannot be over-estimated. By the TIOBE Index, C is, at the time of writing, the second most popular programming language in the world. But its influence spreads far and wide. Look at family trees of computer languages; at the time of writing, of the top 10 languages in the TIOBE Index, all but Visual Basic owe some of their heritage to C.

In the early days of the Web, any pages that were generated dynamically would typically be written in C or Perl. Nowadays, much of that back-end code might be written in PHP, Ruby or Java. Some major Web companies, including Google, Yahoo! and Youtube, use Python. All of these languages have to be interpreted or compiled, that is translated to machine code, before the computer can run them. With the exception of Java, the interpreters for all of these languages are generally written in C. Several Java compilers exist, typically written in C++.

Ritchie's influence extends to smartphones. Apple's iOS iPhone operating system is based on BSD, a variant of Unix. Google's Android is based on Linux, which is a functional copy of Unix. iPhone apps are written in Objective-C and Android apps are written in Java, both languages based on C.

I've written before about my slightly odd habit of reading computer manuals. It started with Kernighan and Ritchie (Yes, Ritchie - him again!) It took me about a quarter of a century to find another computer manual that came close in terms of readability.

There has been much written in the past couple of weeks about Steve Jobs. He was an architect, not a builder. He could say what he wanted software to do, but he couldn't write it. His fame stems mainly from his being a charismatic salesman. The artisan programmers who made his vision a reality did so using tools made by Dennis Ritchie.

Monday, June 28, 2010

Visualisation tools - Part I, resonance

For several years now, I've had the notion of writing a discussion of the characteristics of various musical instruments, with a particular focus on the primary resonator (string, air column, whatever) and ignoring, at least in the first instance, the effect of the modes of vibration of other bits of the structure (because that's complicated).

I plan, as a starting point, to consider a string, pinned at both ends. This has an infinite number of potential modes and which ones are excited depends on the mode of excitation: a guitar string starts with a displacement function and zero velocity; a piano string starts with zero displacement and a velocity that I suspect can be fairly well approximated by a Dirac delta function; I don't know about a violin string.

I'll then go on to discuss wind instruments, particularly flute and saxophone (because I have them lying about the house), before dealing with the most difficult of all, the humble harmonica. That's difficult because, even using the simplest Euler-Bernoulli model, you have to deal with hyperbolic functions.

An optional extra module will serve as a prequel to all of this - explaining Fourier analysis and synthesis.

I've been wondering how best to do the graphics. The two obvious candidates are VPython and Easy Java Simulations (EJS) - there's a good comparison at the brilliant Dot Physics. I've been using Python a lot lately, especially with NumPy, SciPy and matplotlib, and with all those great libraries it gives you essentially a free MATLAB. On the other hand, the fact that Java can run on pretty much any machine (except the IPhone), means EJS wins hands-down for an online demo.

Saturday, March 27, 2010

The origin of Sheldon?

I got a delivery from Amazon last week including From Eternity to Here by Sean Carroll - I enjoy his blog, and he gives a good lecture, so I thought I'd buy the book. I bought a few other books in the same order, so I haven't started reading it yet, but I'm looking forward to it.

I bought the book in spite of a particularly scathing review by Luboš Motl.  I had a look at Motl's other Amazon reviews. He really doesn't like Lee Smolin's The Trouble with Physics, but he does like Leonard Susskind's Black Hole War. I haven't read Black Hole War, but I've attempted a couple of other Susskinds. An Introduction to Black Holes defeated me. Don't be misled by the title; the tensor calculus starts on page one, and he doesn't say that it's tensors, he just assumes that the reader recognises them. In short, that book is aimed at readers with a better grounding in physics than I have (just a 19-year-old honours degree). On the other hand, Susskind's The Cosmic Landscape was superb. I read that and Smolin's The Trouble with Physics back-to-back last year, and I've been meaning to send Amazon reviews of both. I'd certainly give Smolin more than Motl's two stars, but all of this made me wonder "Who is this Motl guy?"

According to Wikipedia, Motl's a (former) string theorist who's left Harvard to return to his native Czech Republic where he writes a blog, in which he denies anthropogenic global warming, among other rants. He's also written a book (in French) commending the work of the Bogdanov brothers. I'll grant that Motl is better placed than I am to understand their work but I'm still convinced, as I wrote back in 2007, that it's nonsense. The most interesting snippet I've picked up on Motl, from an incoherent jumble of a blog, is that The Big Bang Theory's Sheldon was modelled on him. Actually, I should probably point to this clip; although it isn't just Sheldon, the views he espouses in it are Motl's.

While looking for links for this post I stumbled across this article, complete with comments by all the major players I've mentioned. I haven't finished reading it yet, but Motl is as tactful as ever.