Category Archives: Programming

New free software for drawing diagrams of vertebral columns

I already blogged about this over on Sauropod Vertebra Picture of the Week, but since it’s a software release, I figure I ought to mention it on my programming blog, too!

wedel-and-taylor-2013-bifurcation-figure-9-bifurcatogram

Matt Wedel’s and my 2013 paper on bifurcation in the neural spines of sauropods included the figure above, which shows in schematic form what we know about split spines in the vertebral columns of various specimens. Rather than draw this by hand, I wrote a program to generate it from a simple textual description. Continue reading

JavaScript hashes that inherit from a parent

For a JavaScript program I’m working on, I want to have hashes that can inherit values from a parent. Specifically, I have many widgets, each with a (usually small) hash of configuration parameters; when I access such a parameter and it’s not defined in the widget I want to get the value from the configuration of the team that the widget belongs to; and when that’s not defined I want it to get the value from the global configuration.

sushi-by-rob-owen-wahl-small

Continue reading

… Or maybe they’re doing web-site registration completely right

A couple of weeks ago, I wrote that DeviantArt are getting web-site registration completely wrong by asking for the email address (which you can see as you type it) to be repeated, but not requiring confirmation of the password (which you can’t see).

deviantart-registration-small

A lot of people in the comments (both here and at Hacker News) pointed out that I was wrong.

Continue reading

Inclusive and Exclusive OR in informal speech

As good computer scientists, we know that there are two kinds of OR.

An inclusive OR, which is what we nearly always need in programming, is true if either of its branches is true: “exit this loop if we’ve processed 50 items OR there are none left to process.”

An exclusive OR is true if exactly one if its branches is true, but not if both are. “If player 1 is attacking player 2 OR player 2 is attacking player 1 (but not both) then inflict damage.” [This is a contrived example: that’s because it’s hard to think of non-contrived examples — they hardly ever come up in real programs.]

abbot-ruddles

When we use “or” in informal speech, we nearly always mean exclusive or. If I tell you I’m going to the cinema to see Skyfall on Wednesday or Thursday, you understand that I will go on one day or the other, but not both. If I ask you what you want to drink and you say Abbot Ale or Ruddles County, you’d be surprised (but maybe not disappointed) if I brought you two pints.

Continue reading

“You can do anything if you believe in yourself”

Trust your heart.  Believe in yourself.  Follow your dream and you can do whatever you want to.  Ubiquitous morals in Hollywood movies and many TV series.  But potentially poisonous.  As Andrew Rilstone has pointed out, “this is a deeply re-assuring message for the high-achievers who make movies. It says in affect ‘We are rich and famous because we deserve it’. It is a very depressing message for the people who make their coffee.”

Plus it’s, you know …  Not true.

(This image is from a T-shirt that I am very tempted to buy.)

Continue reading

On trying to read Dune

Matt Wedel is constantly telling me I need to read Frank Herbert’s classic sci-fi epic Dune.  I’ve never been keen because of the vast number of sequels, but I finally gave in to his repeated requests and started on it last night, on my Kindle.

I got as far as page 4.  Since the Kindle shows small pages, I guess that’s part way down page 2 of a printed copy.  Here’s why:

Yes, Paul.  What is a gom jabbar?

Continue reading

Tagore Smith on functional programming

My travails with functional programming have been a bit of a recurring theme on this blog, and I have to admit that my attempt to learn Scheme has stalled, more than anything due to all the other things I’ve been doing.  I’m sufficiently aware of it to feel guilty, but not sufficiently to actually invest the time I ought to into actually learning it.

But today, Togore Smith wrote a brilliantly insightful comment on one of my oldest posts (Closures, finally explained!), and it’s got me thinking about this subject all over again.

Continue reading