Wednesday, December 30, 2009

Sudoku (unfinished)

It has been well said that "Sudoku is a denial of service attack on the human intellect".

Sudoku is an entirely mechanical procedure. Solving a Sudoku is just following an algorithm. Many sudokus can be solved by the most mindless constraint-propagation approach. All can be solved by combining this with a backtracking search.

Some very hard puzzles would take a long time to solve this way by hand, so one can make the algorithm faster by putting in shortcuts which are not immediately obvious from the ground rules. Perhaps the fun is in deducing what these shortcuts are as one develops an intuition for the puzzle?

But it is a bit as if newspapers printed long multiplications and divisions daily with their answers the next day.

I've never really got it, but many people do. Why is is it so addictive?

It's definitely maths, though. It distresses me when people say it's not on the basis that it doesn't involve any adding up.

Granted the numbers aren´t really doing anything numeric. They may as well be different colours. Are there nine easily distinguishable colours? It might prove quite pretty presented like that. You'd need special coloured pens to solve it though.

But the puzzle is saying ¨Given that these things are true, what else must be true?¨, which is pretty much a definition of mathematics: ¨All that which can be reasoned about without error¨.

In fact, why not teach sudokus in maths classes? If people really find these sorts of formal systems interesting, there's a lot to learn from examining them.

Of course a possible consequence would be an all consuming addiction, with the whole of society wasting endless amounts of time. But that is happening anyway. And it would be a nice environmentally friendly way to waste time, which wouldn't hurt anyone. What are people supposed to do? Go out and get jobs so that they can buy cars?




I wonder if there's a useful analogy between sudoku and formal logic.

The rules of sudoku would be analogous to logic itself.

If you had a blank grid, then there would be many possible solutions available, which would be the analogues of all the possible formal systems.

Specifying that a particular number had to go in a particular place would reduce considerably the number of possible solutions, and would be the equivalent of adding axioms.

Certain combinations of axioms would be compatible, certain combinations would lead to contradictions.


Deductions about what other number-placements were forced by the axioms would be theorems of the system.

Certain combinations would lead to unique solutions, analagous to axiom systems which are both consistent and complete.

Sadly there's no Gödel theorem due to the finiteness of the system, but is it possible to make a sudoku like thing powerful enough to express the problem?

The Arse Bomber

Once upon a time, there was  "the shoe bomber". A drooling comedy halfwit type who failed to set fire to his shoe, causing worldwide terror.

In response to this, another drooling idiot and a man mainly famous for lying set fire to the wrong bit of the middle east, killing millions of people who'd never set fire to any shoes or anything.

One of the few people left alive threw his shoe at the idiot. Again it failed to explode.

In a display of spectacular ineptitude, two men attempted to set fire to themselves and a concrete airport building, succeeding in the first part of their aim.

This prompted an immortal letter to a well known national newspaper, which started "Sir, I can't help thinking that if baggage handlers at Glasgow Airport spent less time punching burning terrorists and more time handling baggage then my luggage and I ......."

Hot in the news at the moment is "the underpants bomber".

I see the hand of the Carry-On team in all this. What next? Will Osama "Bin" Laden actually turn out to be the dastardly Khazi of Kalabar?

But best of all so far are the efforts of "the Arse Bomber".



glorious, glorious terrorism

Behold this heroic young gentleman martyr. He stuffed his own rectum with grenades and some sort of timing device, then surrendered to the Saudi anti-terrorist forces and asked to meet Prince Nayef, who is in charge of the counter terrorist effort on the peninsular.

I think I see a problem here. Can you imagine what it would be like if Prince Charles were in charge of MI5? Or, God forbid, either of our other two princes?

The prince was reported to have been 'surprised' when his interlocutor exploded from the waist down. This is understated irony at its best. England salutes you, Prince Nayef.

Unfortunately, of course, one can't actually get that much TNT up one's arse, and the body is a fair blast shield. The poor sap succeeded only in blowing his own legs off. No one else present was hurt.

But can you imagine the mess? I hope they patch these fellows up before they hand them over to the virgins.

Tuesday, December 29, 2009

The Menace from Earth (Robert Heinlein)

A collection of the old master's short stories. Nothing profound, all entertaining.

I do not think that the inner lives of women are as Heinlein thought they were. Nevertheless, the world would be more fun for all of us if they were.

Canopus in Argos: Archives. The Making of the Representative for Planet 8 (Doris Lessing)

This is actually rather good. I'd never have read it after the pitiful first book in this series if they hadn't both been Christmas presents, and nearly didn't read it anyway, but somewhere between volumes one and four of Canopus in Argos, the author has got the hang of it.

There's still nothing you'd call 'science fiction', it's more 'magic realism with occasional mention of spaceships'. And anyone with even A-level physics is going to have to ignore a certain amount of unlikeliness. But plenty of good books fit that description. And this is one.

It's a painful, suffocating story of a happy world being slowly entombed in ice.

The pompous smug emissary Johor is a key figure. But here he's a constant beacon of hope. His presence makes the whole story much worse. The ending is a beautifully cynical betrayal.

As a bonus "afterword", there's an excellent and thought provoking essay on Scott's doomed expedition to the Arctic.

It makes me wonder whether vols 2 and 3 might be worth reading too. And why I had such a bad reaction to vol 1.

Apparently this book was made into an opera. I can just imagine. I bet there aren't too many tunes you'd find yourself whistling.

Sunday, December 20, 2009

Les Contes d'Hoffman (Opera at the Cinema)

I have a new favourite (non-Wagner) opera.

Contes d'Hoffman is comical, light hearted and deep.

I think a lot of the power of this production is in the direction. A lot of the muse's malign influence is suggested by her acting and movements on stage, and very little (or possibly none) by the words.

Perhaps she can be read as an entirely positive force. If she usually is, and if the opera loses some of its meaning if she is, then that might explain how I've managed to remain ignorant of its existence for nearly twenty years.

But the music is wonderful. When you spend the rest of the evening suppressing the urge to whistle you know that things have gone well.

I've not previously been impressed with the 'Live Opera at the Cinema' idea. I think it ruined a perfectly good Tristan and Isolde, and after a very fine Tosca a few weeks ago I was left thinking "That would have been wonderful. I wish I'd been there."

But this one worked fine.

Granted it's not the same as being in the opera house. There's a certain feeling of having been present at a performance missing, and the music sounds subtly wrong. The difference between a really good recording played on a really good amplifier and the real thing. Intangible, but there.

However, there are compensations.

The sound quality is even throughout the cinema, and all perfectly in balance, so the voices are always clear.

The camerawork (I think particularly skilled in this one) gives you a feeling of being actually on the stage, involved in the action. I've never had that in the Coliseum, or in fact in any large theatre. But you do sometimes get it in a small theatre in-the-round. And in a film. And sometimes watching rugby on a giant TV in a pub. And you get it here. And it's great.


So now I wonder why it hasn't worked for me before.

And  I can think of a few possible reasons, some of which I'm ashamed of:


The first is that this opera is just bloody good, and its cast are faultless. All wonderful, without exception. Each character a treasure to remember. The staging, costumes and direction inspired.

Another may be that the Met is getting the hang of filming opera. Presumably it's all fairly new to them, and it's taking a while to get the technique sorted out.

A third may be that this one was in French. My French isn't brilliant, and I'd have been lost without the subtitles. But with them to crib from in moments of difficulty I could understand fairly well. I don't think I'd have been able to for a real performance, since I sometimes had difficulty understanding opera in English at the Coliseum. But the clarity of the cinema sound makes it much easier.

Being able to understand the words as sung makes a big difference. This is the first one of these I've seen in French.

And the fourth reason, and the one that worries and shames me, and that I hope is the least important, is this:

Every actor and actress without exception in this production looked the part. All the young women characters were played by beautiful young women. And all of them sang easily, without looking short of breath or showing apparent effort.
And they could all act as well as sing, with their faces as well as their gestures.

That makes absolutely no difference in a real opera house, since they're a long way away, and a certain suspension of disbelief can make a paunchy fifty year old into the young superhero Siegfried, or a mountainous middle aged lady desperately sucking air into the ageless Valkyrie.

But it makes a huge difference if they're on display, thirty foot tall and only twenty feet away, with the camera taking close-ups of their faces.

And this production was self-consciously sexy. Underdressed chorus-girls. The ambiguous muse as Dietrich. I don't think it would have worked in the cinema if the characters had been more in the traditional operatic mold.

Besides making me feel rather trivial, this worries me. If these streamed operas become a significant source of revenue, are we going to see opera lose its focus on beautiful singing?

Might it mean that an actual visit to an opera house might be less magical in future, because the singers have been picked for the cameras?

Are good singers going to be confined to recordings, denied the opportunity to sing live, because they don't look the part?

A dreadful prospect. I worry. I am ashamed.

(And I have fallen for Kate Lindsey.)

Saturday, December 19, 2009

Cambridge in the Snow

Wow! About five inches of snow in one night! Walking home in a magical wonderland. Oooh Christmas.

Mill Road in the morning is a hell of nasty black sludge and honking. See the fluffies of incompetence spinning their wheels on the ice near the grandmothers and the small children! Watch the dumb-ass proles in tracksuits seizing the chance to overtake by going from 0 to thirty in two seconds on a crowded icy street!

A bit later I'm watching two small children sliding around on the pavement, and remembering my own first snow. In Yorkshire it was all crispness and supernatural silence. I wonder if memories of terrifyingly slippery pavements in the middle of a town are the same thing.

Suddenly some cunt in a van drives fast through a puddle right next to them and covers them in freezing wet black filth. They're crying and their mother is trying to comfort them.

We really have to get rid of these things. Perhaps by machine gunning traffic at random? Maybe someone could do a feasibility study?

Once safely into town away from the bastards it's a wonderland again. Parker's piece is shiny and bright and clean in the sunshine. It's like the Alps. Only flat. But flat's good.

A big group of rowdy hoodies. One of them throws an idle snowball which hits my leg. I return fire. It ends up six to one and we're all laughing but it's about to get nasty and I'm covered in snow. I surrender and we all shake hands and wish each other Merry Christmas. Thank God for that! I thought I was dead. Good lads. Up for a fight but magnanimous in victory.

On into town. King's is so beautiful. My college. I still love it. In any weather it's wonderful. In the snow best of all.

On to the Castle. Lunch and a cigar in the garden. A perfect morning.

Le Premier Jour du Reste de ta Vie (film)

Wonderful, heartwarming, family comedy. Strangely for a French film it's not obviously set in Paris. But maybe it is and I just didn't spot key landmarks.

Zabou Brietman deserves a mention just for being so gorgeous.

A Serious Man (film)

Traditional Coen brothers' weirdness. No plot. No point. No ending, even. Very dark in a light-hearted sort of way. Awesomely Jewish from start to finish. The only understandable bit was the lecture on Quantum Physics. Wow his neighbour is sexy. How can someone saying "They're goys, aren't they?" make a goy go weak at the knees?

I love Jewish humour. I was unaccountably skipping down the street afterwards. All the way home.

Citizen Kane (film)

I've avoided seeing this on TV for so long in the expectation that someone would eventually show it full size. I was so looking forward to it.

I suppose a little disappointment was inevitable. It might have been better if I hadn't known who Rosebud was from the start.

I'm not saying it's bad. I'm glad I went to see it. It's affecting. It made me think. A bit.

It's just that from what's generally agreed to be the best film of all time, I was expecting something a bit more.

Maybe you had to see it at the time. Or maybe I just didn't get it.

The Godfather (Film)

My God this is a good film. It's three hours long and I was amazed it was over so quickly. Absolutely riveting from start to finish. Not one wasted scene. And I've seen it before. Twice.

Where the Wild Things Are (Film)

Nicely captures the fact that children are utterly insane. Goes on a bit.
Don't know how children will react. Don't bother if you're an adult.

Cracks (Film)

Alive as I am to the necessity of setting desperate deadly lesbian intrigues in girls' schools, I can't help wondering if it would have been possible to come up with a plot that didn't require every single character to be barking mad from start to finish.

What was all that about? What was the point? What was the message? Don't trust the obvious sexy weird lesbian paedophile with the mysterious past alone with the hormone saturated obsessive cruel teenagers?

What were they thinking? What were they all thinking?

Death of Borders

So Sad.
Beloved bookshop.
Hope books find good homes.
Flying off shelves. Not many left.
Happy hours. Browsing and café.
Quiet third floor. Physics and maths.
Novels and magazines and calendars and newspapers.
Pens! Notebooks!
Couldn't say goodbye. Danger of crying.

What will replace it? Another horrid "sports" shop?
Once had a girlfriend who cried when her shoe shop closed.
Know how she felt now. Sorry for laughing.

Desolation and loss.
Two left.
Guard them. Protect them.

Wednesday, November 18, 2009

Agora

I'm planning to create a new literary form that allows dialog to occur between thousands of people simultaneously whilst automatically removing spam and trolling.

I'm going to call it Agora, after the marketplace in ancient Athens where the first thinkers had their dialogs.

After thinking about it for a bit, it could be described as:

Like a newsgroup, but with reddit like karma for individual posters, and a graph structure rather than a tree.

Like a wiki, but where everyone is responsible for their own labeled pages, which only they can edit, but where everyone can take a copy of a page, and edit it themselves, after which it gets a credit like 'originally by A, edited by B'.

Like reddit and hacker news, but where the discussions persist permanently, and can link into other discussions, forming a web like structure.

There sort of already is one of these. It's called the internet. But on the internet it's hard to see the reply structure of page and counter-page. In Agora, the links will be manifest first class objects and both the links and the pages will be up and down-votable like comments in reddit.

I want a wiki that works like a newsgroup with a reputation system.

To write this, I clearly need to take the easiest to understand open source thing that is most like what I want, and grok it.

Grokking it may mean translating it into another language.

My favourite languages are Clojure, Python and PLT Scheme.

Clojure, although the most immature of the three, does have the advantage that its memory model is very like an in-memory database, which for a collaborative web site is probably a good structure.

Does anyone have any ideas where I should start?

Would anyone like to give me a hand? It will be easier with two.

If you're reading this, and see what I mean, feel free to go off and do it, and e-mail me the web address of the prototype as soon as you've got something running.

I don't want to own it. I am just fascinated by what it might look like, and how it might work.

And I think it might be fun.

My original thoughts about this are in the somewhat tedious blog post: http://johnlawrenceaspden.blogspot.com/2009/10/meta-tree-about-meta-trees.html
There's also:
http://johnlawrenceaspden.blogspot.com/2009/10/agoras-elevator-pitch.html

PERL is an anagram of LISP

This observation was made by the godlike Shriram Krisnamurthi in his talk 'The Swine before Perl' http://ll1.ai.mit.edu/shriram-talk.ppt but I thought it deserved a post of its own.



One of the nicest things about a traditional LISP environment compared to a traditional compiled language like C is the REPL.

A REPL is a read-eval-print loop. You can converse with the compiler by asking it questions and getting back answers.

> (* 3 2)
6

Read an expression, evaluate it, then print the answer.

In a decent editor, you can write a whole program this way. Write a bit, evaluate it, define some functions, test them. Use the editor to arrange the working bits above the interactions.

In most languages, you'd write the function that creates the REPL something like:

(print (eval (read)))
(loop)

or for those who like their brackets elsewhere:

print (eval (read())) ;
loop ;

So you might call it a print eval read loop instead.

PERL

No one's ever been sure what PERL stood for. Practical Extraction and Report Language & Pathologically Eclectic Rubbish Lister are the two traditional explanations.

But in a world of LISP and FORTRAN, PERL is clearly a descendant of LISP with a syntax taken from the UNIX scripting tools sh sed and awk.

So if you were wanting to write a LISP variant for performing sysadmin tasks, which is a pretty fair description of PERL, and you wanted to throw a backhanded compliment to LISP without scaring anybody away, what would you do?

Thursday, November 12, 2009

Trouble with lasers

As every schoolboy knows, the energy of a wave is proportional to the square of its amplitude. And when waves interfere, the amplitudes add.

This is a paradox. Consider:

Lasers produce coherent light. Pure waves.

If I take two lasers, and focus them on a wall, they will interfere.

If they interfere constructively, then their amplitude will double, so their energy will multiply by four.

If they interfere destructively, then their amplitude will be zero, and there will be no energy.

These energies are real and measurable things. I can buy two laser pointers from a store, connect them to mains power, and focus them on a thermometer.

I have found a method of heating my house that will either halve my heating bills or allow me to burn money without warming anything up.



When I was myself a schoolboy, I didn't know about lasers, but this question occurred to me about water waves, and I asked my physics teacher. He thought for quite a long time, and said that the answer must be that *whenever* waves interfere, they must interfere both constructively and destructively, so that whenever we win, we must also lose.

He was a clever man, my physics teacher. The answer shut me up, and I haven't thought about it since. But even at the time, I found the answer suspicious, because it seemed like the universe was conspiring to preserve the conservation of energy.

I didn't believe in a teleological universe then, and I don't believe in one now.

Water waves are made up of particles, and the particles do not calculate. It must be possible to explain why there are always both sorts of interference in terms of particles bouncing off each other. But I knew that I was not clever enough to do that, and my paradox had gone away, so I put the question on the back burner and forgot about it.



The reason that I have suddenly begun to worry about this problem again is that I am making one of my periodic attempts to understand quantum mechanics, and it occurred to me that the same mathematics, and the same paradox, occur in quantum mathematics.

If a particle has two routes to the same destination, then they must interfere. You can have the same sorts of interference.

Suppose you close one of the routes, but leave the other one open, and you leave your experiment running for a while, and count how many particles get to your detector.

And suppose you had got 1000 particles arriving in your detector. And it is the same for the second route.

And now you open both routes. Particles will start arriving at a rate that depends on how the apparatus is set up. You might get anything up to 4000 in an hour. You might get none.

What you will never find is that you can use these effects to create particles for free! You can't put 2000 particles in and get 4000 out!

The mathematics of it is exactly the same as the mathematics for the wave.



In quantum mechanics the conservation of particle number is explained by the calculating machinery that we believe nature must use to advance the state of the world.

The world proceeds through unitary operators. One way of looking at a unitary operator is that it is an operator that preserves lengths.

But since the lengths in quantum mechanics are just the probabilities of a particle arriving, we are not really saying much here except that 'the universe must play according to rules that conserve the numbers of particles'.



So I've been wondering how my laser pointer experiment really works. Why does the conservation of energy survive the superposition of waves?

My physics teacher thought that if there was interference, there must always be both types in equal measure. So perhaps the reason that the spot on the wall does not go away or shine four times as bright is that it is made up of some places where there is one sort of interference and other places where there is the other.

Perhaps it must always be that the spot made by two laser pointers has bright bits and dark bits?

Why would that be true for the laser pointers?

Well, I can't put the laser pointers on top of each other, but I can put them right next to each other. At that point, their waves will be coming into the spot at very similar angles.

But of course the wavelength of visible light is very small, so even the very small angles might be enough, if the spot is large enough. I would imagine that the spot will be made up of bright and dark stripes, like a zebra.

But surely, if I make the spot very small, and put the lasers very close together, and put the lasers far away from the wall, I can make it so that I just make a bright band, and not any of the dark ones?

Hmm, maybe.

If I shone the lasers at the moon, that might do it!

But perhaps the laser beams would spread out, and the spot would get too big, and the bands would still be there?

So perhaps I should use red light instead of blue, to make the bands spread out more?

But perhaps as I do that, the beams will spread out more, so that as the bands get wider, the spot gets wider too, and I still have bright red and black stripes. In exactly the right proportion.

I will begin to feel that the universe is conspiring against me.

I haven't done any of these experiments, or anything like them. I am just trying to work out what might happen from half-remembered school physics.



And it has occurred to me that another place where it can appear that the universe is conspiring to make troubling questions hard to ask is the uncertainty principle that prevents you working out which slit a particle has gone through in Feynman's two slit experiment.

And perhaps if I can work out why it must always be true for waves, which can be explained in terms of particles bouncing around, I might be able to work out why it is true for quantum mechanical probabilities.

Maybe. I have looked on the web for the answer, and I have not found one, and I have asked some physics students, and I have asked a friend who did a doctorate in light waves, and none of them has thought about it, so I have written this blog post and I am going to submit it to reddit and see what happens.

Advice to a talented child

I can't believe that I'm recommending this to a child, but I think I detect an exceptional intelligence.

Try SICP. The Structure and Interpretation of Computer Programs. Until recently it was MIT's introductory computer science course.

The book is a masterpiece. It's online and free. http://mitpress.mit.edu/sicp/full-text/book/book.html

There are videos of the authors giving the lectures. Watch them and read the book at the same time. Follow along and do the exercises as you go.
http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/

You will need a scheme. I found that the best by far was PLT scheme. http://www.plt-scheme.org/
And you will need to set it to use the version of scheme called R5RS for maximum compatibility. Even then it's not perfect, but google is your friend.

Don't worry if the book is too hard for you. It would have been far beyond me at your age. But I think you will be OK if you work hard.

It is a real university degree course in the maths part of CS. You won't be able to skim it. You need to do the exercises and play with the ideas in each lecture before you go on to the next.

Every exercise in the book looks hard, and most look boring. Once you get into them they are all well chosen, interesting, and do-able, and each one will teach you a valuable new thing.

If you can do it, then you will enjoy it as you have never enjoyed anything before. And you will be a much better programmer in any language. In fact you will understand that deep down all languages are the same.

Good luck, and beware that I may have overreached myself. If you don't like it, carry on playing with whatever interests you. Sooner or later you will have to read this book, or something like it, but you have plenty of time.

Wednesday, November 11, 2009

Mutual Independence

Suppose you did a statistical survey, and you found out that heart disease and diabetes had nothing to do with each other.

That's not publishable, so suppose you did another. To your despair, you found out that diabetes and overweight had no relation either.

In desperation you tried looking for correlations between overweight and heart disease.

But there was no correlation.

According to your data, diabetes and heart disease are independent, diabetes and overweight are independent, and heart disease and overweight independent.

How surprised would you be if your research assistant later showed, from the same data, that the three were never found together?

I.e. that heart disease, diabetes and overweight are not contracted independently. If they were, you'd expect some poor sod to get all three!



What do we mean by independence?

If you take 100 people at random out of the phone book and ask them whether they've got diabetes, you'll get a certain number, let's say it's 33.

Now let's take 100 people with heart disease and ask them. The answer's also 33.

It looks as though heart disease occurs independently of diabetes. Diabetes attacks one third of people, and whether you've got heart disease makes no difference as to whether you've got diabetes.

Same for overweight vs diabetes, and same for heart disease vs overweight.

Now if A is independent of B, B is independent of C, and C is independent of A, then surely the things are about as unconnected as they can get.

So how many people would you expect to have all three?
Well, a third of people get diabetes, a third of those are overweight, and a third of overweight people have heart disease.

Three threes are twenty-seven, so you'd imagine that one in every twenty seven people are unlucky enough to have all three.




But the real answer is that you have no idea.

Imagine three lights: red, green and blue.

Imagine that there's a mechanism that turns them on and off.

It decides, quite at random, whether it is going to light one, two, or no lights.

Once it decides that, then it decides, again completely at random, which light is going to be the odd one out.

One third of the time, the red light is on.
One third of the time the red light is on, the blue light is also on.

And since the situation is symmetrical, that's true blue vs red, red vs green, and green vs blue.

Which is exactly the situation we had above.

But the three lights are never all on at the same time.

The horror of programming

I've been roundly attacked, by programmers, for leading children astray. This comment is typical in its content, but more eloquent than most:

We should not fool children with this nonsense. Programming isn't about problem solving, fun, or beauty. It is about architecture, patterns, and tedious comma placement in templating languages. Give a child a copy of PoEAA. If the child enjoys it, steer that child into programming. Otherwise, encourage them to find a career that requires critical thinking, pride in one's work, and elegance; encourage them to be a carpenter.

I've edited that ever so slightly, the original is here:
http://www.reddit.com/r/programming/comments/a2wo7/why_programming_has_gotten_so_much_easier_our/c0flrcy


My initial response included the lines:
I've been a programmer for nearly 30 years, a professional for most of the last 20, and I've done very little that wasn't problem solving or fun. Some of it was beautiful too.

I spent this evening in the Kingston Arms in Cambridge talking excitedly about Clojure with a bunch of really nice, interesting geeks. It was immensely enjoyable.

And this came back:
Not at all, I should have set off my post with sarcasm tags and added an 'A' to make PoEAA.

In fact, I love programming, but the short time I've spent in industry (now just over a year) is a bit disheartening. At home, I love hacking my toy Lisp interpreter or working with profs at the local university. But in the supposed "real world" there is very little to reward excellence that goes much beyond keeping the system or application running as a whole. Even though it may cause future headaches, the short-sighted-cutting-of-corners is often rewarded. And furthering the state of the art is almost never a priority. Perhaps I am at the wrong place, but these complaints seem widespread.

Sorry for the sour grapes. Nearly all of my daytime posts are fueled by php frustration.

Now I'm really troubled. This is a young man, who likes programming so much that he writes LISP interpreters at home. I do too, and it's the sign of a truly lost soul. But one lost in the joy of it all!

(A quick google reveals PoEAA to be "Patterns of Enterprise Application Architecture", by Martin Fowler)

Now, it would be very wrong of me to slag off a book I haven't read, so I'll confine myself to judging its title, which I have:

"Enterprise" is a word I have come to associate with tedious overcomplicated unusable rubbish. Examples are legion.

So I'll guess that this book is a tedious overcomplicated unusable rubbish version of:

Design Patterns: Elements of Reusable Object-Oriented Software, by Gamma Helm Johnson and Vlissides.

And this original Patterns book was joyful in its spirit, but it should really have been called: 'How to do all the things you can do in LISP if all you have is C++'.

A point I believe the authors considered so obvious that they didn't bother making it. [citation needed]

So now I feel like a man who has been offering round fine cigars and whose friends have, as a consequence, developed 40-a-day cigarette habits.

------------------------------

And I'm not sure how to respond. Not long ago I showed python to one of the brightest people I've ever met. He took to it like a duck to opium, and within a couple of weeks had written a truly impressive program to take advantage of arbitrage opportunities on betfair by screen scraping.

As a result, he walked into a programming job in London, where he tells me that his daily work involved programming in a deservedly obsolete language. His shop mandated copy and paste programming on the basis that it was a safer technique than using GOSUB.

He's now moved on to writing Java as part of a large team, as part of his firm's 'advanced research' effort.

Every time I talk to him he seems a bit less full of the joy of life, and I wish I'd never shown him how to start that damned interpreter.

------------------------------

But here goes:

A well paid job which you do not enjoy is a curse. Once you start to depend on the money, it stops making you happy and you are left with an infinity of drudgery which has to be endured if you are not to lose the things you have bought. The philosophers are unanimous and clear on this point.

If you are in an environment where everyone else is well paid, you don't even get the warm glow that comes from high status. Instead you just find yourself craving larger and larger amounts of money.

The process ends in a very few cases with a yacht in St Tropez that you are too busy to visit, but which you own to impress your friends. And that's what it means to be successful. Such people may or may not be happy. How would I know?

It doesn't matter, because they are a set of measure zero. As rare as world-class footballers are in a world of dreaming children.

But in the vast majority of cases you have a tedious daily grind. Your soul dies, and all you have to show for it is the desire for more money.

If you enjoy programming, then you have something that you love.

If you want to be a prostitute, be a courtesan rather than a crack whore.

First you need to go cold turkey.

You'll need about £2000 pounds. Quit your job and go skiing. Snow is always falling somewhere in the world.

Find a resort where there are youth hostels as well as hotels, and stay in the cheapest hostel you can find, sharing a room and cooking facilities.

You will meet large numbers of enthusiastic young people who are making sacrifices to do what they love. They work long unsocial hours at menial jobs in order to ski. To do what they love.

They are the happiest people in the world, and they are great fun. They will take you in and drink with you round the hostel table. They will teach you to ski for the sheer joy of passing it on, and show you where the best bits of the mountain are.

You will be a student again. You will remember why the old speak wistfully of student days.

Eventually you will get bored. When you return home, the idea of a big house to yourself in the suburbs will no longer seem so compelling.

Rent a room in the centre, near the university, because that's where the clever interesting people of all ages are. Make sure that you share a house, but you are now permitted to have a room to yourself. The luxury!!

And now find a job.

Not a permanent job. Never ever, not unless you're starving.

Find someone who has something that they need doing quickly.

Agree to do it for them at an hourly rate. They will pay a freelance three times as much as a permanent employee for the same work, and there are good reasons why that's a good deal from their point of view too, so don't be shy.

Word of mouth contacts from your last job are the best way, but there are agencies for such things if that doesn't work, and you are even allowed to consult for the company you walked out of, as long as the arrangement is paid by the hour.

From now on, you might only work for six months in any given year.

But that's OK. You will still make more than you used to, and you're back to living like a student so six months work will keep you going for three years.

Never allow your expenses to increase to the point where you even notice them.

And suddenly you are free.

You are free to choose to do things that seem interesting. It doesn't matter a bit whether they are for someone else, or just things you want to do, which are of no possible value to anyone else, like lisp interpreters.

There are always enough interesting jobs to pay the rent.

-----------------------------------------------------

In case you think I'm some starry eyed idealist, preaching an impossible gospel,
I have lived like this since I was twenty five. It works a treat. Every time I've found my expenses creeping up to the point where I need to work rather than want to work, off to the ski slopes again for a detox.

And the thing is that there are plenty of companies round here that I'd be happy to work in as a permanent employee. Enlightened companies doing interesting things. I often work for them as a freelance, and their people are happy and fulfilled. But I value my freedom for itself.

And every time I do something, even a particularly mindless two week testing job that I once got tricked into, I learn something new. And as long as you're learning, you're enjoying. For me they are the same.

You said:

Otherwise, encourage them to find a career that requires critical thinking, pride in one's work, and elegance; encourage them to be a carpenter.

I have all those things. So do many of my friends. You might want to consider that a man who trains as a carpenter can set up his own business and make things that he loves for grateful clients for his whole life. Or he can spend his days on minimum wage in a gloomy factory operating one stage in an assembly line.

We programmers have the same choice. The only real difference is that programming is intrinsically more complex than carpentry.

Tuesday, November 10, 2009

A program for twelve year old programmers

When I was little, I would have found this program interesting:


import turtle

def fib(n):
    turtle.forward(30)

    if n<2:
        pass
    else:
        turtle.left(15)
        fib(n-1)
        turtle.right(30)
        fib(n-2)
        turtle.left(15)

    turtle.forward(-30)

turtle.reset()
fib(10)


I still do!

The program is in python.

Play with it. Change the numbers and see what happens. Make it be in colour. Make each branch a different colour.

Once you have done this, you will understand something fun.

Nick Rolfe has translated it into logo, so you can run it in a web browser. Unfortunately it has to be Firefox rather than Internet Explorer.
http://logo.twentygototen.org/ynJXcOr1
You can still play with it and modify it in Firefox, just like you can in python.




The program is in python. I can not tell you how to install python, because it is different on every computer. But some computers already have it. And it is very easy to install on the ones that don't. The best way to run the program in python is to use IDLE, which is part of python.

If you run it in IDLE, the turtle's window will not disappear when the turtle has finished. If you'd like to run it any other way, Steven's comment below will tell you how to stop the window disappearing.


My python is version 2.6.4, but I imagine it will work in any later python as well, and possibly some earlier ones too.

I am sure that I will be corrected if I am wrong.


Footnote for anyone coming via reddit


Forgive me.

The article before this has been the top hit on the programming reddit all day, with the title "Why has this got so much harder to do? Why kids don't program any more."
The associated discussion handed me my ass on a plate, so I wrote this new program to show how easy it was for a modern child to explore recursion, which wouldn't have been at all easy in ZX Basic thirty years ago.

I was assuming without thinking about it that people who read the first would read the second and vice versa, which was a bit dim of me.

Monday, November 9, 2009

Why has this got so much harder to do?

Behold, in its full glory, a program that I ran on my ZX Spectrum nearly 30 years ago:

10 FOR n=0 TO 255
20 PLOT n,88+80*SIN (n/128*PI)
30 NEXT n

It plots the mathematical function sin over a full turn. This little program was an inspiration to me. It was followed quickly by a program to plot cos, which looks very similar. The next one plotted points of the form (cos t, sin t) with t between -pi and pi, which looks like a circle.

It's no exaggeration to say that this program turned me on to mathematics.

At school at about the same time, we'd been going over sin and cos and tan, which were names for the ratios of the sides of right-angled triangles. I'd never seen anything so boring and pointless. There were all sorts of stupid rules for remembering which was which, and when some were supposed to be positive and negative. It was the dullest thing in the world.

And then suddenly it wasn't. SIN and COS were things I could use to draw circles on my computer screen. If I plotted (2*sin, cos), I could make ovals. It was all marvellous. It was obvious what SIN and COS were. They were the distances across and up from the centre of the circle as you were going round it.

Once you knew that, all the blether at school didn't just make sense, it was obvious. I couldn't understand why it had seemed hard. I still didn't see what it was for. But I was very interested in drawing things on my computer. And circles were a big part of that.

A bit later on, for a game, I used my computer to draw a cannonball as it flew. I figured that it would start off going right and up at a certain speed. After a tiny bit, it would have moved, but the speed it was moving up would have gone down a bit. I wrote a program to draw what happened as time went on. It turned out that it made a sort of arc shape like the underside of a bridge.

And a bit later, I worked out how it would change if instead of the cannonball always falling downwards, it always fell towards a certain point on the screen.

A bit later I was watching the moon go round the earth as the earth went round the sun.

When, about five years later, we got to projectiles and ballistics in A level maths, I already knew all the answers.

And when it came to orbital mechanics during my degree, I had a pretty good intuitive grasp.

And it turned out that sin and cos were pretty useful too.




The reason that I mention this is that 27 years ago, a twelve year old child with a new toy and a shiny orange paperback that told him how to use it could draw the graph of sin, and then play with the program to get more interesting programs.

Whereas now, in 2009, a forty year old professional computer programmer sitting in front of a box at least 1000 times more powerful with a screen one hundred times the size that can display millions of colours is having to google for how to do it. (I am trying to write a simulation of an imaginary diffusion equation.)

And answers are not easy to come by. One of the things that google offered up by way of answer was the ZX Spectrum manual. And childhood memories came flooding back.

And I wonder how the hell a modern twelve year old is supposed to write his orrery.







--------------------------------------------------------------------------------
Footnotes

P.S. I posted this on hacker news and it got some interesting responses:
http://news.ycombinator.com/item?id=930752


P.P.S. So I posted it on reddit too, where one answer was (in python)

>>> import turtle
>>> turtle.forward(100)

And this led me to:
http://us.pycon.org/2009/conference/schedule/event/65/
and (I hate to link to a ppt, but it's great)
http://us.pycon.org/media/2009/talkdata/PyCon2009/065/SevenWaysToUseTurtle-PyCon2009.ppt
Which answers my rhetorical question about as well as it could be answered!

Friday, November 6, 2009

more post titles

How much of a crime is stealing poppies?

Why I don't answer e-mails or texts.
Why did they bother inventing the telephone when we already had telegrams? How old is Cary Grant?

A confused Italian girl at a cash machine

The three slits experiment
It is not that the universe works differently when we're looking. Is it?

Why do we have to use classical reasoning to construct quantum mechanical thought experiments.

Aliens would transmit 2 pi. In binary that's just a bitshift. If we're transmitting pi, that will look to them like tau/2. Might they answer with tau/3 (2 pi / 3!!) to show they'd got the signal? What does that look like in binary?

Hilbert space is just arrows. Inner product is a similarity metric.  angle bracket arrow arrow arrow bar is a member of C^3

Teaching is research. The distillation of concepts into forms from which the next step is obvious is the essence of both.

Michael in the cafe on a blind date being creepy. The awkwardness of the Edharians before the Procians.

Maths is more interesting than sex. Even to teenagers.

Release from the cycle of being.

Concepts that you don't understand are gaps in the fabric of reality.
Words that you don't understand are signs of concepts that you don't.
Consider hermeneutics, semiotics and dialectics.

Is it OK to dismiss religious/ecstatic/drug/dream/out of body experiences as meaningless?
They are the traces of memories laid down in the brain when it is operating under the control of a shattered mind. Maybe a mind completely absent. Perhaps they are telling us something?

Are the other people in my dreams conscious?

Why can I not think about QM without becoming mystical? Is this true for everybody or is there something funny in the Markov Chain of my mind? Chaos theory is another thing often used in bollocks philosophy to spout about free will vs determinism, but that doesn't have the same effect. On the other hand, topology and particularly Riemann surfaces used to. And lambda-calculus still does

(double (double double)): toil and trouble

The Quantum-Stochastic Financial Dynamics of Superconducting Cosmic Strings in a seven-dimensional Universe of Discourse. Hoaxes in literary theory and in string theory.

Agora should be viewable on different time-scales. What's hot now, what's hot now with a different time constant, what was hot last week, what was hot in 2009. General weighted average needed. Perhaps do it as a zoomable graphic equalizer. If you have +ve and -ve votes then the sum is coolness and the difference is attention. People creating uncool things which get a lot of attention should be penalized heavily.

Agora ID. Any username, any id, total anonymity. Can set level in browser.

The mighty fork bomb: b(){ b|b& };b

Thursday, November 5, 2009

An Education (film)

A riveting, edge of seat coming-of-age drama about a schoolgirl under the sway of an older man.

There's a sense of moral ambiguity about everything. It's not at all clear who's going to get hurt, and the tension is amazing.
Like any English film, the whole thing is riven through with class issues played for laughs, and may or may not be comprehensible to outsiders.

I would have found the whole scenario, and particularly the mistake leading to the denouement, completely unbelievable if I hadn't had a friend who could well have been the leading man. Truth really is stranger than fiction. That's not just something that people say. Having seen that sort of thing happen in real life, I can forgive the script-writer his unbelievable plot twist.

But actually the thing I'll remember for the rest of my life about this film is the sense it gives of the impossible glamour of Juliette Gréco. I'd only thought of her before as a woman with a strange voice on some old French songs. But from drab fifties London she must have been going off like a lighthouse.

Wednesday, November 4, 2009

Notes on the Age of the Essay

On re-reading this: http://www.paulgraham.com/essay.html, I decided that I liked it so much that I'd try to make a summary. If you haven't read the original, go read the original. It's beautifully written. I'm suspicious of beautiful writing because you can end up believing things that aren't true if they're well expressed. So I'm trying to pick out the thread of the argument and some handy maxims for essay-writing.

School essays were dull.
Because they're about English Literature, and that's dull.
Even Dickens wouldn't be interested in an essay about symbolism in Dickens.
Why did we do them?

After the Dark Ages, people rediscovered the classics.
The Greeks and Romans knew much more than the Europeans of the 12th century.
Relearning their stuff was really important.
Study of ancient texts was most of what scholars did.
This period lasted perhaps 200 years.
But the study of ancient texts was considered the highest pursuit for 500 more.

Universities used to teach writing.
Until teachers were required to do research. What should the teachers research?
If it's worth studying old texts, it must be worth studying modern ones too.
So writing teachers have to be researchers into modern literature as well.
They end up teaching writing about modern literature.

Schools imitate universities.
The end product is that schoolkids write essays about modern literature.
This is an imitation of an imitation of a thing that's 500 years out of date.

School essays take a position and defend it.
That's also a fossilized idea.
The structure comes from medieval law schools.



Good writing should be convincing, but it should be convincing because you got the right answers, not because you did a good job of arguing.

If you write something unconvincing, talk it through with the person who finds it unconvincing. You may come up with a clearer way of saying it, but more often you'll find that you have to change what you're saying. If you can convince clever people, then you're probably near the truth.

In 1580, Michel de Montaigne published a book of essais, or "tries".
An essay is something you write to try to figure something out.
You don't know what it is yet, so you can't begin with a thesis.
You begin with a question.
Montaigne's great discovery is that writing ideas down helps to form them.
In a real essay, you're writing for yourself. Thinking out loud.
But having an audience makes a difference. It forces you to think well.

You don't always come up with answers. Don't publish those.
Anything interesting will do.
The Meander is a river.
Meandering is not a flaw in a search for the truth.
At each step, go in the most interesting direction.


Backtrack if you get stuck.
Clean up your train of thought, but not so much that you lose spontaneity.
Err on the side of the river

Interesting is the same thing as surprising.
How was it different to what you were expecting? is a good question.
Surprises are things that contradict things that you thought you knew.
How do you find surprises?
Only write about things you've thought about a lot.
Then things that surprise you will also surprise readers.

So you need things that you've thought about a lot, and the ability to ferret out the unexpected.

What should you think about?
Anything can be interesting, even working in fast food.

The author sees more things in his memories of being sixteen than he saw at the time.
So the ability to ferret out the unexpected must be learnable.

Consider history. The more you learn, the more connections you can make.

Collecting surprises is similar. Life gets more surprising as you get older.
Perhaps there are ways to speed the process up.

Ask why? about things that seem wrong.
Scepticism is helpful in this.

Pay attention to things that seem wrong in a humorous way. Humour is a sign of surprise.

Write down things that surprise you in notebooks. It's not necessary to read them, though.

Being cool is an impediment. Dwell on your mistakes.

Seek out situations where inexperience will make you look foolish.

Study lots of different things. Include history. History is 'all the data we have so far'.
History gives us confidence that there are many good ideas under our noses.

Above all, pay attention to things you're not supposed to. If you're curious, trust your instincts. Follow the threads that attract your attention.

Once, only a tiny number of writers could publish essays.
Now everyone can.

The web may make this the golden age of the essay.

And that's not something I realized when I started writing this.

Tuesday, November 3, 2009

Another thing about essays

Writing things down like this helps you to think about more that one problem at once.

It's difficult to keep more than one problem in your head, but writing them down means that you can forget about something for a while and think about new things.

That means that when and if you come back to reading the old things that you wrote about, you can start again from the same place. But of course your brain may have been working on the old things while you weren't watching it, so sometimes there are ready-made new thoughts that come to mind as soon as you read the old posts.

So it makes you more able to think about more things, and it makes you better at it.

Philosophical Tools

I know of two 'Philosophical Tools':

  • Occam's Razor: Don't use a more complicated explanation than you need.
  • Diax's Rake: Don't believe something just because you'd like it to be true.

What else have we got, and what gardening implements can we associate with them?

A list of tools would be really handy. Because when you're stuck, new approaches help. And a list of mental images for complex concepts would help you remember them.

Some handy maxims which need names are:
  • If you can't prove something, try to prove the opposite.
  • See if you can change the problem to make it easier.
  • Specific examples and generalizations illuminate each other.
  • Explain your argument to a child, a foreigner, an alien, a computer.
  • Try to write it down.
  • Sleep on it.
  • Leave it alone and work on something else for a bit.
  • Look around, and contemplate nearby objects and how they relate to the problem in hand.
Feynman and Sussman both tried to explain their ideas clearly, to mathphobes and computers. Montaigne explored his ideas through writing. But neither of these things remind me of any tools, or in fact any objects.

Can we go the other way? What about taking a list of tools and thinking what each one would mean if used as a metaphor for a way of attacking a problem.

Here are some tools I can see from where I'm writing:

The mirror, the lantern, the penknife, the swiss army knife, the thing for getting stones out of horses hooves, the pickaxe, the probe, the shotgun, the earplug, the key, the spoon, the zipper, the book, the flask, the camera, the paperclip, the paperweight, the radio, the tape recorder, the fire extinguisher, the magnifying glass.

Do any of these have philosophical connotations?

The radio: tell everyone you know about your argument and see what happens
The earplug: stop reading about other peoples attempts to solve it and see what you can do on your own for an hour or so.
The thing for getting stones out of horses hooves: See if there's a tiny sub-problem that's tractable.
The notebook: write down tiny notes every time you think of a new thing. You don't have to read them later. Just writing will do.
The probe: Find a new way of measuring something about the problem.
Magnifying glass: Just look at one part of the problem in isolation (really good for cryptic crossword clues)

That seems a more tractable approach to finding a list.

blog posts I'd like to write

Summarize "The Age of the Essay"

Quantum Mechanics. What happens if we take the quantum view of the world literally?
Consider the dual-slit experiment as a start state, two intermediate states, and a final state?
The system is static. What does it look like? What about other states? Why don't the probabilities of going via them mean that probabilities can't be conserved or stable?
What if we put a classical clock in the system? What does time even mean in a static phase-diagram type universe? What does a phase diagram look like if we look at it as a map for moving classical probabilities around?
What about a system with a single particle on a finite ring of states? What does momentum mean for it?
If that's a basis of position states, what does the corresponding basis of momentum states look like?

What happens if you make a random blog post inviting people to the pictures (I'm going to see either An Education or Fantastic Mr Fox at the Arts Cinema tonight at 21:00 if anyone wants to come.)

Condense the very boring ubuntu installation blog into something readable. Is this even possible?

How to solve the Workout in the Times? It's easy by hand, but what are we doing when solving it? How would a computer do it? How do we define hard? Is there a computer method which finds the same things hard as I do? What should the recursion be for generating all possible divisions of a square into rectangles? If we can do that we can generate puzzles with unique answers.

Another useful tool is "Try to explain it to a foreigner". Example is the controversy over parents cheating to get their children into better schools. Why are they doing anything wrong? They've both paid the same for their education. How can they be stealing off the people rich enough to live near the good schools? If we can think about it like that, why can't we say that rich people who live near good schools but are sending their kids to private schools are doing a public service and should be compensated?

Disabled baby case. Mother wants it to live, Father wants it to die. Needs judgement of Solomon. Remember two mothers fighting for baby. Not necessarily correct, but right. If we had a consciousness-swapper, how would we organise a literal contest between the two, using the prize of swapping their consciousness with the baby's? Would Solomon want to kill half the baby? What about killing half the baby's brain?

Lymington's secret dentist. Try to explain that to a foreigner. Perhaps a foreign dentist.

The life of Mohammed. Can't make a film because not allowed to depict prophet. What about making a first-person shooter? Can we do the voice of the prophet? What about God? A burning bush? If you can't record the voice of God, isn't the Koran blasphemous of itself? If it isn't, could the burning bush (possibly off camera) speak literal verses of the Koran? Could we do a life of Mo computer game? Should it be an FPS or should it be real-time strategy? What do we have to preach for the religion to spread. Other players could represent competing desert religions. The climax could be a battle for Mecca with all the followers so far recruited.

Blogging software should allow readers to highlight the boring/unconvincing/funny bits. If we want continuously variable colourings then do we have to pick three primary attributes?

What's wrong with revenge? Revenge is the foundation of civilized society. The first duty of the state is to prevent the blood feud, and it does this by nationalizing the duty of revenge.

Which bits are boring and which are unconvincing?

Hi,

I seem to be writing a lot of blog posts recently, and to my surprise a fair number of my friends seem to be reading them. I also have comments from people I don't know, so I must have an audience of some sort.

I've just re-read, "The Age of the Essay":

http://www.paulgraham.com/essay.html

Which gave me the idea of trying to work out what I think by writing it down.

In it he says:

When I give a draft of an essay to friends, there are two things I want to know: which parts bore them, and which seem unconvincing. The boring bits can usually be fixed by cutting. But I don't try to fix the unconvincing bits by arguing more cleverly. I need to talk the matter over.


That seems like useful information to have.


Anyone can comment here, anonymously or not, and I get to delete anything I really don't like, so please don't be shy or worry about giving offence.


Which bits are boring and which bits are unconvincing?


If you know me personally, I'm happy to buy pints in return for good counter-arguments!

Monday, November 2, 2009

Don't read this it's incredibly boring

Installing Ubuntu 9.10 (Netbook Remix) on my Dell Mini 10v (Live Report on first try)

First hurdle was that the download is an iso, rather than a flash image file.

It turns out that there's a program usb-creator-gtk which does the conversion.
Originally that failed to work for me, claiming that my usb drive needed formatting, but then doing nothing when I pressed the format button.
Eventually I tried formatting the USB disk myself, and it still didn't seem to work, until suddenly it did. Sigh.

It's now taking a while to write all the data to the flash drive.

Transferred flash drive to netbook.

Reboot.

Wow, it's taking ages to start up!

Now it wants a login! (As user ubuntu. What am I supposed to type? ubuntu fails. blank succeeds)

It's very pretty!

But there's no wireless connection. This is sub-optimal for a netbook.

After a while a message pops up to say that restricted drivers are available. There's a choice of two. Broadcom b43 and Broadcom STA. I don't understand the difference. Choose Broadcom STA because that rings a bell.

Ha! Now it tells me that I need to restart the computer in order to use this driver. Have I installed Windows by mistake?

I can already see an infinite loop forming, but I'll take it at its word and reboot it.


Well, it's been two minutes now and its not rebooted. Just sitting there with a little ubuntu logo pulsing slowly. Talk to me. What are you doing? Are you dead?

Alt-Ctrl-F1 has no effect at all. I'm beginning to suspect kernel death.

Suddenly the screen goes blank. Is this life?

After five minutes I give up. Alt-SysRq-B produces a reboot, though, so there must have been something in there.

Now its in its just sitting there pulsing mode again.

Five minutes later.

It's totalled! It's gone into some mad infinite loop, endlessly scrolling text too fast to read about bugs in the D-Bus library.

Well, after a bit of staring, what it's saying, over and over again, is:

This is normally a bug in some application call using the D-Bus library.
process 2039: arguments to dbus_pending_call_set_notify() were incorrect, assertion "pending != NULL" failed in file dbus-pending-call.c line 596 .

Ah, Alt-SysRq I has stopped the screen. Apparently it was process 2839. Silly me.


Try again:

Same result. Mad scrolling. Same error. Hmmm.

So far, this has taken one hour.

Was I just lucky the first time, or has the bloody thing actually tried to modify the boot disk in order to get this driver working and corrupted itself?

The md5sum on the iso file is correct. I'll try to remake the USB stick.

Weirdly the md5sum on the desktop iso is wrong. But I'm sure I didn't use that by mistake since I got the funny interface on first boot. As I say, it was pretty while it lasted.

Okay, I've remade the USB stick. On the ubuntu initial boot screen, there was something called 'check integrity of disc' It wasn't clear whether that meant my hard drive, or the USB stick, but I tried it anyway. Much pulsing of the little logo I am beginning to hate. Why won't they just tell me what's going on?

But the light on the USB drive is flashing steadily, so there must be some sort of check going on.

Okay, check finished, all fine, try again.

This is better, a nice ubuntu waking up noise, and the pretty screen again.

I am not going to fall for this 'installing Broadcom drivers thing again'.

So I've plugged it into the wall, but I'm now blogging from the netbook rather than from my desktop! Yay!

And I must say I'm fairly impressed so far. They've fixed the touchpad, which didn't work very well in 9.04.

When I got to www.blogger.com, firefox wanted to install a flash player, and I thought 'what the hell, it's not going to actually write to disk'. It then asked me if I wanted to enable the universe and multiverse repositories. I said yes, but then it failed.

OK, when the little box came up I gave in to temptation and enabled the other wireless driver, b43.

And this one hasn't demanded a reboot.

I'll save this post and then pull the network cable and see what happens.

Well, that didn't work. Pulling the cable just disconnected me.Plugged it back in now.

Camera works. Sound output works. Internet Radio works. Sound recording does not work.

Well, I am sufficiently happy to try installing it.

The installer so far seems very impressive, and I'm very impressed that I can keep using the computer while it's running. I wonder at what point it will actually disconnect from blogger.

I've set it up to obliterate the previous installation of 9.04, which was unsatisfactory in many ways. I never used it, preferring to use the Dell version of 8.04, which is actually pretty good once you turn off the Dell interface.

I want to try the 'require my password to encrypt my home folder' option, and I'm setting setup to import two of the three accounts on the Dell 8.04 installation, just to see what happens.

Nothing like putting it through its paces.

And off it goes. A slideshow is showing and things are being copied as I type.

Hmm, after a few minutes an error box pops up, something about devkit-disks-daemon crashing. That doesn't sound good at all. It asks if it can report the problem to base and I say yes.

However, there's now nothing going on. I imagine that's not good. I wonder if my little system is still bootable? Only one way to find out.

Wait.... The light on the flash drive is going. Is it still installing? Or is it firefox related?

top doesn't seem to think there's anything going on.

Just out of devilment, I'll try running the installer again.

It seems to work, repartitions the disks, starts to go through its slideshow, and then crashes. Only this time it's 'ubiquity' crashing, which is presumably the installer.

Repeat once again to make sure. Ubiquity crashes again.

It's been two hours since I started this.

I'm back to blogging from the desktop.

Now the netbook won't boot off the flash drive again.

These people have actually managed to create an installer that can destroy itself.

For minutes there's just that fucking pulsing ubuntu symbol.

Then it goes to a text screen, obviously in the middle of a very distressed init.
All sorts of file system errors scroll past, and the whole thing ends when it says initiating crypto disks [OK], and crashes.

Needless to say, if I bypass the USB disk, the netbook will not boot, because one of the installs has obviously got far enough along to destroy the master boot record.


I'm getting angry now. This isn't a little bug caused by incompatible hardware.
For that matter Dell sell 10vs in partnership with Canonical, so if they were going to test it anywhere it should have been on one of these.


This is just rank bloody incompetence. What a bunch of muppets.


I'm now in the situation where I can't boot my netbook in any way. I really don't want to start trying to use the remains of this flash drive to try to fix the problem, because I honestly don't trust it not to destroy my original 8.04 Dell version.


I'm going to find a version of 9.04 and burn that to my flash drive. That wasn't great, but I don't remember the installer itself being fucked up.


I think ubuntu and I might be through. The 8.04 version Dell supplied is great. But I don't think I'm at all keen on letting anyone who can write an installer as cripplingly rubbish as this mess about with any computer I care about.


Alright, calmed down a bit now. Did get as far as the 9.04 flash disk, but it's obviously the same installer. Maybe asking for encrypted disks is the problem.

Will try again with utterly vanilla version.

Sunday, November 1, 2009

Diax's Rake

In Neal Stephenson's wonderful novel Anathem, a character called Diax drives the numerologers out of the Temple of Orithena using a garden rake.

This legendary rake gives its name to a philosophical principle, Diax's Rake:

Be careful of believing things because you want to believe them.


In the book, it is also used as a verb. One can rake a sentence of its emotional content. At one point, a character speaks of "reforms". His interlocutor rakes his sentence, pointing out that the word "reforms" carries with it a judgement that the reforms were necessary. When they agree to use "changes" instead, the character of their argument becomes different.

Since I read this, situations where the maxim is useful have occurred to me almost every day.

For instance, the theory of evolution by natural selection is a peculiarly horrible idea. It implies that life is a terrible, and extraordinarily wasteful, war of all against all, and that almost every feature of every form of life is the result of the deaths of millions of innocent creatures whose only fault was not to have the feature.

Many people choose not to believe this awful idea because they have a theory that they would prefer to believe.

The most obvious current example is religious creationists, who have the much more comforting idea of a God of love, who cares about the fall of every sparrow.

There's an equally persistent view that evolution is a continuous process of improvement towards perfection. In this view, humanity is the most evolved of all the living creatures.  This is one of the most dangerous evolutionary fallacies. In fact the common cold virus has done just as much evolving as we have, and is in many senses much more perfectly adapted to its environment than we are.

Some people who call themselves Darwinists positively glory in the horror and cruelty of the Darwinian view of the world. Sometimes they come to believe that the theory of evolution has some sort of moral content, and that what is natural is also morally right.

The scientific establishment of the Soviet Union, mostly educated, clever men, could also not bring themselves to believe in the Darwinian theory, preferring various forms of Lamarckism. Lamarckism is also an evolutionary theory, but based on the transmission of acquired characteristics, such as the sons of blacksmiths inheriting their father's strength. The problem is that there's very little evidence that anything like this happens.

Since the emotional value of a theory has nothing to do with its truth, it strikes me that to prefer one theory over another because of its moral content is a fundamental error.

But it seems to be one which is very difficult to avoid.

I think that Diax's Rake is a philosophical fundamental, as useful as Occam's Razor (which also makes an appearance in Anathem, under the name of Gardan's Steelyard).

If a concept is that useful, it is very important to give it a name.

But I can't think of any philosophical principle that Diax's Rake is a paraphrase of.

Perhaps we should adopt it, and just call it by the name Stephenson gave it.

Saturday, October 31, 2009

What are complex numbers?

A lot of people find complex numbers mysterious and counter-intuitive.

Defining i to be "the square root of minus one" is about as sane as defining it to be the square root of the colour blue.

The first people who thought about it followed that approach, and were rightly scared stiff and confused by it. Even Euler made trivial mistakes. They called them "Imaginary Numbers" because they seemed to be useful for calculating, but no-one really believed that they existed.

 
Argand came up with the right way of thinking about it:

Take all the tuples (x,y). (Where x and y are just integers). Define on them addition and multiplication rules.

Oh look! There's a big system of these things, and embedded within it is a sub-system which works exactly the same as the integers and their rules.

Since they're exactly the same for all practical purposes, we may as well forget about the difference and say that we'll write (a,0) as a and (0,b) as ib, and (a,b) as a+ib

And although none of the pairs in the  sub-system square to be (-1,0), also known as -1, there are two other things that do! 

So now we know that both (0,1) and (0, -1), otherwise known as 1i and -1i, or i and -i, are square roots of -1.

No slight of hand or magical thinking necessary, and we have the complex integers.


As it happens, we can do the same thing starting from the reals, to form something that embeds the reals. But the reals really are dark and mysterious and need to be brought about by a kind of magic.

According to me. Some people think they're as real as the complex numbers.

Friday, October 30, 2009

e^(i pi) = -1

Imagine you're a complex number, which is just a type of arrow.

Exponentiation is to do with growth.

Growth at a speed which is a multiple of how big you are already.

i is the multiplication which turns you through ninety degrees.

If you grow in a direction which is at right angles to yourself, you turn rather than increasing in magnitude.

Your head moves at the speed which is your length. So pi is how long it takes you to turn through a half circle.

So if you grow at right angles to yourself for time pi, you are pointing the opposite way.

That is the meaning of the famous identity e^(i*pi) = -1.

If we know what sin and cos are, we can see equally easily that e^it = cos t + i*sin t, which is known as Euler's formula. Sin and cos are just the coordinates of a point on a circle that has moved a distance t anticlockwise round a circle of radius 1.


Thursday, October 29, 2009

some more titles

Blog posts I want to write: I'm a bit short of time so I'll save the titles here in case I forget.

A foundation for not being evil
What can we do to get rid of the car?
The mind expander (forgot what I meant by this, so it can't have been too important)
Building a language: attempt to reconstruct Guy Steele's masterwork
A moment of religion outside the Queen's Head at Newton

What does it mean to be a good translation? (boring)

WARNING: This article has been judged boring, and will at some point be rewritten.

How can we tell if two texts are the same?

Compare them letter by letter (space is a letter) and see if they are all the same.

Is it possible to measure the distance between them if they are not?

A mathematician's first answer would be a metric on letter differences.

So "arfle" is 1 away from "arfly".

That's a bit rubbish.

We'd like "The cat sat on the mat" to be similar to "A cat sat on the mat".

Those two phrases are so close in meaning that there are languages where it's hard to express the differences. But the first letters are different (AT), and the second( h), and the third (ec), and the fourth.

So we might try something like an editing metric. How many operations does it take to turn one sentence into another. So saying "Swap cat for mat" is a distance of one. Insert "green" is a distance of one, etc.

Latin would translate them both as something like: "Catus mate satavit". Which can be interpreted as "The verb sat takes cat as its subject and mat as its indirect object, in time past and the action is completed.


Both English phrases are valid translations of the Latin phrase, and indeed both are as close as you can get to the original.

It is also possible to say in Latin "mate catus satavit". This means almost exactly the same thing, but there's a slight feeling of emphasis on the mat.

We can't do the same thing in English, "The mat sat on the cat" isn't what we meant at all. It would have to be "It was the mat that the cat sat on".

So we've made a small change to the Latin (one step). But in the English we've moved "the" and "mat" and added "It" "was" and "that".

So

phrase A -> translate -> phrase B -> move 1 -> phrase C -> translate -> phrase D

Alternatively phrase A -> move 2, add 3 -> phrase D.

It looks like whatever editing metrics we choose we're going to have them be unstable under translation.

And yet the four phrases are obviously very close in meaning.

You can imagine a conversation where Mulder says "The cat sat on the sofa", and Scully replies "The cat sat on the mat.". And one where she says "It was the mat that the cat sat on." And the information communicated is no different.

Perhaps there's another attack?

We could say "The difference between two texts is defined by the reader". Texts don't have meanings by themselves. It takes a conscious mind to measure the difference between two things.

OK, so now what is a good translation? By good I mean "conveys the same meaning".

Well, you need to take someone who can speak both languages, and ask them if the two things mean the same to them.

I'm a good speaker of English, and a poor speaker of French.

My interpretation of French is different because I am an English speaker.

When I hear the French word "boulingrin", which means lawn, I cannot help but imagine a lawn which is like a bowling green.

When I hear "C'est ma femme, actuellement". I hear "This is my wife, actually", and only later do I hear "This is my current wife", which is what the French phrase really means. "This is my wife, actually" would be "C'est ma femme, en fait".

So you can't ask me whether a French text and an English text mean the same thing. Because a French text doesn't mean the same thing to me as to a Frenchman.

Neither can you ask a good French speaker who is also a poor English speaker, for the same reason.

Neither can you ask a true bilingual, I would imagine. Because in every language there are clusters of concepts which are separate in other languages.

In English "Free Software" means software that is unrestricted, but it also means software that costs nothing.

In French, these two concepts "Software libre" and "Software gratuit" are completely separate and there is no easy way to conflate them.

It is not that the distinction is meaningless, which explains why English speaking Free Software loonies say things like "Free as in speech, not as in beer".

And in fact the phrase "Software libre" is taking off in English as a shorthand way of expressing an important difference in meaning that English has no easy way to express.

Notice that the problem is in the English language. English brains can hold the concept of "software libre" even before they hear the phrase.

Similarly in French "J'ai raison" means "I am right". But it also means "I am correct".

In English these concepts are quite distinct. But if you're French, you can't be wrong without your reasoning being incorrect.

Don't get me wrong. There are ways to say in French "I am morally right" and "I am correct". It is just that they're not expressed normally. As in free software being the usual term as opposed to 'liberated software' or 'costless software'. They're artificial-sounding circumlocutions.

This idea of rightness being the same thing as correctness is a very fundamental philosophical difference! France and England have different legal systems and ways of thinking about things, but I think that if the two concepts weren't as firmly separated in the French brain as they are in the English, then the differences would be very much greater. Indeed I suspect that one of the differences would be that France would have ceased to exist. There'd be too many religious wars.

But when you speak in French, you destroy the difference as the information gets passed from mind to mind, and who knows whether it gets reconstructed properly?

What about if the two languages you're translating between are the same language at different times?

When I was a boy, I was worried about the fact that Shakespeare's comedies aren't funny. There are funny bits, to be sure. But the funniest bit I can think of is the porter scene, in Macbeth. Which isn't one of the comedies.

My father told me that in Shakespeare's time, "Comedy" meant something different to what it does now. They would have called our comedies "Farces".
He told me to look, not for humour in Shakespeare, but for poetry and truth.

I was puzzled by this answer, since that seemed to leave Comedy meaning "Any play which is not a tragedy or a farce". Also it meant that Shakespeare then, as he is now, would be a very elevated sort of taste.

Not many people are going to pay to watch a TV program that they have to study in order to understand.

I don't think it's the right answer. Shakespeare's Globe theatre was on the wrong side of the river. Amongst the prostitutes and bear baiters of Elizabethan Southwark. About the nastiest place in England.

And he was a popular entertainer. He made himself rich and famous with his plays. People flocked to them, and contemporary reports have them rolling in the aisles.

Perhaps the comedies were funny. Humour fades so fast. Even the immortal Monty Python seems a little pale now. You'd need to study to understand why the ministry of silly walks is subversive, or why the army's effete drilling is so shocking. Or who the Pirhana brothers are.

I can still remember why these were hideously, screamingly, achingly funny things. I can't imagine that modern kids understand at all, even when it's been explained.

In four hundred years time, I can well imagine a father telling his son to look for the poetry and truth in Monty Python. Except that there isn't any, so they'll probably be about as well known as Shakespeare's great commercial rivals, X and Y.

It does make me wonder, if they're still good enough to be considered the best things ever written in English, how good they actually were when they were new.

But at the time they were just disposable entertainment. It's a happy accident that some friends of Shakespeare liked them enough that after he was dead they gathered up some of the old scripts and published them.

So now it looks like we might need an English to English translation process.

And what about dialects? Where I grew up, people would say "Can tha borrow us twenty pence till tomorrow?".

That's so meaningless in the Standard English of the South that the meaning is immediately obvious!

Some people deal with this by saying that the Northern version is "wrong". These people need to explain what they mean by "right". Notice that the Northern phrase uses "tha", the singular you form that Shakespeare also uses. Is that "right" or "wrong". Maybe "right" is time dependent, and Shakespeare gets to use thee but moderns don't?

What about "Our father, which art in Heaven, hallowed be thy name?". Surely that's Standard English. It's old, but people say it every day. And even modern religious men call God Thou instead of You in their prayers. Is is right or wrong?

What about "to boldly go?" What about "That is a rule up with which I refuse to put?" (The rule up with which Churchill refused to put was never to end a sentence a preposition with).

What if all the people in the South of England were to die of some guacamole-related disease which didn't make the jump to mushy peas?

What would be right then? After all the reason that Elizabethan English isn't modern English is that the Elizabethans are all dead.

Anyway. It looks like we need a way of translating from English to English.

Almost certainly, we need a way of translating from one person's English to another person's English.

But we're not done yet. As you age, you learn new things.

If I say "The best way to handle an exception is to throw a trampoline", I'm making a point about computer science. If my fifteen year old self had said this, then he'd have meant that when you run into weirdos you should throw sporting equipment.

These two perfectly comprehensible sentiments have very different translations into French, but they probably have very different translations into the English of almost everyone else in the world. Including me at thirty.


So, to recap.

How can we tell if two texts are the same? How can we tell how different they are?

We can't.

It's all subjective.

Two texts that are absolutely identical can have different meanings to different people.

Two texts that are different can have the same meaning to one person.

Two texts that are arbitrarily close can have arbitrarily different meanings.

Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.
The king of France is bald.


The problem with this is that it is all horse-shit.

Of course one thing can be a translation of another thing. Of course you can read a document in French that doesn't tell you anything you don't already know from reading a document in English.

I have read Alexandre Dumas and Fritz Lieber and Douglas Adams and Edgar Allen Poe and Asterix and the Bible in English and in French.

The books are recognisably, obviously the same books. There are little differences that make it a pleasure to compare them. There are mistranslations, there are places where one language can't express the thought in the other language without going all round the houses, and thus introducing new ideas, which weren't in the original.

But it's nothing serious.

Or is it?

Dumas and Lieber and Adams are both better in their own language. The translations are poor shadows. The joy is gone.

Edgar Allen Poe (translated by Baudelaire, no less) is much better in French!

The Bible is flat and dull in French (as the Vulgate is in Latin). The English Bible (Authorised Version) is one of the most beautiful books in the language. I can't imagine a non-religious Frenchman loving the Bible.


On the other hand, there are lots of really tedious English bibles. They often have the word 'modern' in their titles. But the content is always exactly the same.

Accurate translation matters to these people a lot. Accurate translation mattered very much more to the people who translated the King James.

Asterix is hugely funny in English and in French, but the jokes are different!

When Asterix goes to visit his British cousin, he remarks that he likes his cousin's tweeds, and asks if the fabric is expensive.

The cousin replies that his tailor is rich.

This is funny in English because of the understatement. I thought it was hilarious when I was a little boy.

It is the same sort of thing that is going on when someone rants on for twenty minutes about how bad a restaurant is, and someone else says "So you wouldn't recommend it then?".

It is a form of humour that only the British understand. Even the Americans, who speak what is recognizably a subset of English, don't really get it.

In French it is funny because "My tailor is rich" is a famous useless phrase from a post-war English course that every French schoolchild once knew, like "The pen of my aunt is larger than the garden of my uncle" or "My postillion has been struck by lightning" or "My father was a war profiteer and made all his money on the black market" (seriously, my father has a German phrase book with this in).

An absolutely literal translation of the same phrase means two completely different things.

And if you read it now, you'll see both meanings at once. So I've just changed the meaning of a pre-existing text for you.


What on earth is going on?

Thirst (Film)

I imagine that if you

(a) are into vampires
(b) grew up with enough far easteners that you can read their facial expressions
(c) speak Korean
(d) don't find the film's grubby aesthetic a complete turn-off

then this is one of the best films ever made.

I don't tick any of the above boxes, but I still enjoyed it.

I can't imagine a British or American remake capturing the spirit of the original, but if the French could get the guy who made Mesrine to rip this off, it could be awesome.

In a summer of fine films, this is the first one that I wouldn't immediately pay to see again if a friend wanted to go, but I don't think it's bad.

Far from it. An interesting tale well told. I think the acting's good too, but it's just impossible for me to tell since I'm so bad at reading the emotions of the actors.

Wednesday, October 28, 2009

Twisted Wing (Ruth Newman)

I ought to declare an interest here. Ruth is an old friend from college and I read her book before it was published. I'm told one of the characters is me. I'm not sure which one, although everyone else says it's obvious.

It's just come out in English, having been published in various translations first. I bought a copy for Ruth to sign, and read it, for the third time, last night.

It's very good! It's about a series of killings in Cambridge, at a (very thinly disguised) King's College, where we were both students.

I don't usually read detective fiction, but I would if it was all like this. It's been impossible to put down on all three occasions that I've read it. I started at about 10pm last night, and finished it at about 3am. As a result I'm completely knackered today. I recommend starting it just after tea on a quiet night.

This despite the fact that I already knew what was going to happen.

The plot twists violently and intriguingly, which I think is why you can't stop reading. The sense of the rather claustrophobic student life is spot on. It's heart-rending to see the characters forming the same sorts of life-long friendships that we made, only to see them ruined by the actions of a maniac.

The villian is the most terrifyingly evil character I've ever read about. I don't know if that's a commonplace of crime novels, but it scares all hell out of me.

Followers