Wednesday, 20 July 2011

Vanish decades of newbie make pain

I've just cured years of makefile hell with this single line:

   SHELL:=bash -c 'exec $(SHELL) "$${@//\\$$'\''\012'\''/$$'\''\012'\''}"' --

It means that make recipes that use \ at the end of a line for multi-line recipes will now have the \ stripped off - at last you can have PROPER multi-line recipes!!!


Previously, if you had normal looking multi-line shell clauses in your make recipe, you had to do something like this:

    if blah ; \
    then update-file ; \
    else create-file ; \
    fi


Which is a bit of a hack, and is actually treated as a single line shell statement with semi-colons.

And that is fair enough unless you have a multi-line sed statement as part of your recipe - which is easy to do by accident if you are using literate programming (http://new.fangled.org) with auto-syntax-quoting as one chunk is included into another. (Auto-syntax quoting is when your shell chunk included in a makefile has the $ converted to $$ automatically [something the banking industry has been doing for years])

Because make will start a new shell command every time it finds a newline in the command string (even if you hide it in a mid-line shell variable) there is no way that a backslash-newline can occur except when the human deliberately escapes it.

The single-line SHELL re-definition of mine uses bash to replace backslash-newline with newline and then passes the command to your regular shell.

And I get extra points for using exec


Now my literate programming tools can automatically and nestedly invoke sed in a bash context and then that bash in a make context with automatic quoting and have it all work nicely!

(As long as the makefile author inserts that sticking plaster at the top of the makefile)

And the newbie who uses this can use backslash-newline in a makefile in the proper intuitive way.

    if blah \
    then update-file \
    else create-file \
    fi


Thursday, 30 June 2011

How to draw a Union Jack

The flag of the United Kingdom, the Union Jack, is a superposition of the flags of Saint George (for England), Saint Andrew (for Scotland) and Saint Patrick (for Ireland). This superposition is quite intricate, and often drawn incorrectly.

J. D. A. Wiseman shows how it is done.

Friday, 10 June 2011

Big brother's cousin over the seas

..Binney believes that the agency now stores copies of all e-mails transmitted in America... the N.S.A. has built enormous electronic-storage facilities in Texas and Utah. Binney says that an N.S.A. e-mail database can be searched ... in the manner of Google. ... “General Hayden reassured everyone that the N.S.A. didn’t put out dragnets, and that was true. It had no need—it was getting every fish in the sea.”
The lesson? Beware when those in authority speak in metaphors.

To me the "dictionary selection after the manner of google" is a dragnet, and to most people it's the sort of thing they were worried about, so when an authority denies a specific behaviour by means of a metaphor, try to see what is being hidden and thus perhaps admitted to.

Drake, a former senior executive at the National Security Agency, faces some of the gravest charges that can be brought against an American citizen.

Monday, 6 June 2011

Good intentions / good actions

This analysis highlights the difference between good intentions and good actions.


Oxfam's latest campaign, "Grow", seems so lovely and cuddly that to criticise it is almost like torturing puppies. What could be wrong with trying to feed the hungry and thus make the world a better place? Alas, if wishes were kings we could all be monarchs for the day and what's wrong with the campaign is not the initial wish but the list of damn fool things it intends to do.

Saturday, 4 June 2011

What makes the improbable valuable

When what makes a thing improbable also makes it valuable, the description "unlikely" is not helpful. Singular claims must be examined independently. That which is not normal makes life meaningful and worthwhile. Here are two good uses of the word "absolutely" to describe some singular events. My favourite paragraph: "How the Atonement was wrought we do not know. No mortal watched as evil turned away and hid in shame"

http://lds.org/pages/necessity-of-atonement?lang=eng&cid=facebook-shared

Monday, 30 May 2011

Rationality?

Rationality... hmm... it affects more than just the individual. See link, with the hidden message (hover over the image) quoted here:
"The universe is probably littered with the one-planet graves of cultures which made the sensible economic decision that there's no good reason to go into space--each discovered, studied, and remembered by the ones who made the irrational decision."


Monday, 16 May 2011

The other placebo effect...

It seems like sugar-water can make anti-biotics infinitely more effective... maybe a placebo is real-medicine too.


Doctors may be able to kill off persistent staph infections using a cheap and easy method. A little boost of sugar can help kill the type of bacteria that regular antibiotics miss.