Archive for February, 2009

Feb 26 2009

Bad Science and a book group

Published by Dougal under Bad Science, Life

We’ve just come back from a science-oriented book group held at the Royal Society of Edinburgh — though as far as I know, nothing to do with them — and I’ve got a few minutes while the bread in the oven bakes and the pasta cooks.

The subject of this evening’s discussion was Ben Goldacre’s Bad Science, a book we have both read, which is extra useful when attending a book group. It was good to see that most people had quite favorable opinions of the book (more on the dissenters later) but that most had never heard of him, didn’t read his column, hadn’t heard of that whole anti-pseudoscience movement and were mostly unaware of the major villains like Gillian McKeith and Patrick Holford.

But anyway, there was some good discussion about where one learns critical appraisal of evidence (does it happen in schools? and more importantly, in school science?) and about where the limits of free speech should be for newspapers and public health issues like MMR. How much legal responsibility do newspapers have to report accurate information?

All that was quite good. I mentioned the dissenters above. There was one guy who seemed to have taken the Mary Midgley approach to popular science literature — read the front cover, decided what the book was about, and then blamed the author for not meeting these standards. We never did get a reasonable idea of what he thought the book was going to be about or what it should have done differently — but suffice it to say, it just wasn’t good enough. Five minutes later the same guy (having previously stated he’s never heard of Ben Goldacre) criticised the author for chasing celebrity status. It was about that point I gave up listening closely to him.

The next session of this book group is actually at a performance of Copenhagen, and there’s related discussions and possibly a meeting with the director and stuff too. It was a bit of a let-down to hear that there is no next book to read for the book group (and the meeting after that is for a film!) but this group’s been going for ages so we can hardly complain if they want to spice things up every so often.

2 responses so far

Feb 25 2009

Time for an argument

Published by Dougal under Computing

Nick’s just posted a succinct analogy for the interesting topic of evaluation strategies. However, it’s an analogy suitable for people who program in the first place because it doesn’t actually explain what call means.

Luckily it’s fairly simple. Though you have to pretend you remember high school mathematics. Can you pretend? Let’s assume so.

A function f is applied to an argument x, like this: f(x). In programming terms this is “calling f”. Calling means applying a function to an argument. We wrap the arguments in brackets for easy reading.

Nick’s post talks about how, specifically, we refer to x when we call f on x. Do we pass it the whole thing, or just tell f where to find it? These are considerations particular to computer programming — mathematics has no need to consider how much data is hidden behind a variable like x.

2 responses so far

Feb 22 2009

Resenting Mondays

Published by Dougal under Life, Work

From Boing Boing:

If one dislikes Monday because of school or work then why does one continue to go back to work or school? I believe that folks like this are probably in the wrong job or studying the wrong course and probably should look for something that enables them to enjoy Mondays — and every other day for that matter. Those who genuinely enjoy work or school probably won’t give “Work or School” as the reasons they dislike Monday.

Interesting, but I don’t agree with the conclusions. I think it’s specifically change that people object to. They don’t like to return to work because they’ve just had two days sitting around at home, relaxing over lunch with family — living in a holiday lifestyle. Then it all has to change.

The same happens to me every single day. In the morning I don’t want to get out of bed, and the evening I don’t want to go to bed. What I’m doing now is always far more interesting than something I might be doing later. And truth be told, last Friday I was late leaving work because I couldn’t bear to leave what I was doing.

So it’s not really about not enjoying the work. For me, at least, it’s about not enjoying the change and resenting that context switch.

One response so far

Feb 15 2009

This man could win a sword-fight with wit like that

Published by Dougal under Books, Humour, Science

We took out membership of the local library this afternoon, and spent half an hour browsing. I got out The Extended Phenotype, a sequel of sorts to The Selfish Gene. In the preface he states that the first chapter goes over a lot of ground from the previous book, and tries to clear up misapprehensions and answer complaints from critics of The Selfish Gene. But I’ve never seen such a back-handed compliment as this:

I am grateful to my critics for forcing me to think again about how to express difficult matters more clearly.

See the kerfuffle behind Mary Midgley’s review for an example of the critics who just didn’t get it, no matter how simply it was worded.

No responses yet

Feb 12 2009

Dear diary.

Published by Dougal under Life

I don’t often do explicitly journal entries here, cos my life isn’t that exciting, I’m sure. I might be wrong though. But I’ve had a nice evening so I thought I’d just blog randomly about whatever’s happening, and whatever’s going through my mind.

I have mentioned already that we’re doing a lot of cinema-going at the moment. If nothing else, the Filmhouse membership cards have forced us to go to the unusual stuff. Some great German cinema, and next week Inherit The Wind being put on by the eternally-useless BA. On Monday there was a Cafe Sci in honour of Darwin’s 200th birthday (today, same day as my brother). My pimping Cafe Sci on the Bad Science forums finally bore fruit, and a couple of the guys from the meet-up last month appeared. The speaker was quite entertaining, and I got a baked potato with chili con carne for tea. Also two pints of Guiness bought for me — that counts as a successful night out, I feel.

Work, which I don’t mention often, has been going well. I feel like I have been given a bit more responsibility, which is always good for the ego and for the brain. Something to push against, mentally speaking, helps to keep the morale at a reasonable level.

The bread-making has been up and down, mostly because I’ve been testing the limits of my abilities. This has resulted in a lot of swearing and anger but most of the actual bread has been tasty. (Only one absolute disaster so far. The dough was over-hydrated and I didn’t leave it to prove for long enough. So in the end I baked a series of small stiff puddles. But you live and learn.)

Tea this evening was a stew I made from some slightly-dry steaks, with some lovely rice and broccoli. We then watched the Victorian Farm programme, which was really amazing. If you didn’t catch the series I really recommend getting it on DVD or something. It’s the one show that makes up for all those god-awful “how will they survive in a 1950s school?” shows with petulant teenagers that plagued the schedules a few years ago. Three historians that really knew what they wanted and why they were there, ready to muck in and do back-breaking work because that was what it was all about. It was most gratifying: thank you BBC.

Watching the final show in the series, which culminated with a harvest and harvest festival, made me want to try something culinary that we’ve never done before: brewing. I know a lot of people manage home brews. It’s a genuine cottage industry, in some places. And, well, I’ve tried bread so why not beer too? Who’s with me? We’ll probably have to wait until the weather is more clement — in the current climate we’re more likely to manage freeze distillation — but it’s definitely on the cards.

I found out today that there’s a website devoted to the Leith community and its green spaces which seems really interesting. The park that is just out our back window had a volunteer clean-up last Saturday and we never knew! Apparently 20 people turned up and did a whole bunch of cleaning up and rubbish removing. That would have been a really great way to integrate a bit into the local community, something I think that we really need to work on. Anyway, Greener Leith has a blog and RSS feed, so I’ll be keeping an eye on them. Hopefully good things to come from that.

One response so far

Feb 12 2009

Explanation of efficient subsets

I recently enjoyed reading Oleg Kiselyov’s pair of posts on efficiently building subsets of a particular size. Read part one and part two on Oleg’s site.

(By the way, the very act of looking around his site is like wandering through a junk shop where every item you turn over appears to be some lost treasure. A real joy, with mysteries and delights behind every link.)

Whether you’re interested in efficiently finding subsets of size N or not — and let’s face it, you’re probably not — there’s still something incredibly dramatic about the presentation of the problem and solution. I think there is a certain charm to the writing as well:

This article will show the design of the fastest ever interpreted subsets function. Sorry I’m too excited about this.

A warning of course, that if you’re afraid of parentheses, don’t read any further.

No responses yet

Feb 07 2009

How to ruin a joke by explaining it

Published by Dougal under Computing

The assumption is that the joke has enough humour to be ruined by an explanation. But to decide that, you need to understand the joke. Oh…

The following conversation took place on Facebook recently. The geeks responsible have been anonymised to protect the guilty:

  • A: My life needs an O(1) scheduler.
  • B: Are you sure you don’t need a completely fair scheduler?
  • C: Do you find your life is a bit too co-operative, run-to-completion at the moment?

So what are we talking about here? Person A is obviously having some issues with their life. To work out what kind of problems, we need to know what a scheduler does, and what an O(1) scheduler is used for. (By the way, that’s pronounced “order 1 scheduler”.) Small digression time…

Process scheduling

I think it’s fair to say that all general purpose computers nowadays allow multitasking. This is a feature of the operating system, and it’s certainly available for Windows, Mac OSX and anything else you use. The actual multitasking is possible by dividing time into discrete little chunks and doing one thing within each time chunk. Taken across a long time frame it looks like many things are happening at once.

(This may seem a strange thing to say — after all, there’s no multitasking taking place. But then we are just as guilty of this in everyday conversation. I may say that I’m working on three things at the moment, but the truth is that I can only focus my mind on one thing at a time. And even then the mental effort of shifting focus from one task to another causes enormous slowdown, so there are large periods of time when I’m not doing anything. But I’d still say I’m doing three things at the moment, because over a large enough scale, like a working day, that is what I do.)

The computer only does one thing at a time, but very quickly. In human terms they all happen at once, but there is an order of events. Determining which process to run next is the job of the scheduler. There are many ways to write a scheduler, depending on what type of programs you will be running. File servers have different needs from games machines. Do you want to give every process a fair go, or do programs that the user is aware of deserve more attention?

One important consideration is that the scheduler be predictable. For example, you may want it to decide on the next task to schedule within a set time frame. It’s no good if your scheduler is really quick when choosing among three choices, but takes forever to choose between three thousand. A scheduler that chooses the next task in a constant time, no matter how many things there are to choose from, is called a O(1) scheduler. The reason for the name is a bit technical for this discussion, so you’ll just have to take my word for the meaning of this strange terminology.

Too many choices

Having now covered a bit of ground regarding schedulers, we can apply our knowledge to the life of person A. They want a scheduler, so they’re obviously feeling a bit overwhelmed by things they need to do. More importantly, they’re looking for a scheduler that will make choices at a predictable pace — so that even when they are overwhelmed, their scheduler will remain unflustered. Maybe person A is feeling a bit panicked by their hectic lifestyle, and paralysed by the number of things they need to do?

The suggestion of person B is that a completely fair scheduler would be preferable. With some schedulers a process can be penalised if they only need to do things occasionally. Processes which constantly demand attention will get more attention — like the cuckoo chick that demands to be fed constantly. This can starve other processes, so they seem to be acting sluggishly. Unfortunately it’s the programs which users interact with that are the “occasional” users, so when the user finally does something there will be a noticeable, and irritating, delay. Completely fair schedulers are optimised for this situation, to make the system seem more responsive.

I’m not sure what this means for scheduling person A’s life — maybe they need to spend less of their attention on things which make lots of demands. Another way of telling someone to focus on their “work/life balance”?

And finally we come to person C, who suggests that person A’s life “a bit too co-operative, run-to-completion”. These are again terms to talk about task scheduling. Back in the bad old days, before “proper” multi-tasking, programs had to let other processes have some time on the processor. The operating system didn’t enforce this, and there were many badly-behaved programs which didn’t stand aside. This is how Mac OS used to work in the Classic days. Maybe person A has many things to do that “will just take five minutes” but in fact never seem to end, and prevent other things from being done.

A run-to-completion system prevents higher priority processes from taking precedence. All processes take the full amount of time to do their work, even if there is something which the operating system deems to be more worthy of attention — like responding to user actions.

So person C is referring to tasks which not only take control of your life, but never seem to let go again. Even in the case where you know there are more important things to do.

4 responses so far

Feb 06 2009

Johnsburg, Illinois (or, An exercise in fooling ourselves)

Published by Dougal under Humour

It’s fairly well known that human beings are apt to fool themselves that coincidences have deeper meaning. I recently found a great little game to demonstrate this.

This is actually just a silly questions meme, but it has a nice mixture of producing answers that are (a) unrelated to any actual answers you would give and (b) demonstrating what kind of music you listen to. And like I said, it’s great for showing how easily we spot patterns in meaningless coincidence.

The rules are:

  1. Put your iPod or other music player on shuffle.
  2. For each question, press the next button to get your answer.
  3. You must write that song name down no matter how silly it sounds!

This is what I got. How many of these do you think are relevant answers to the questions? I would say nearly a dozen.

If someone says “is this okay” you say?
9th & Hennepin
What would best describe your personality
Terrific Speech 2
What do you like in a guy/girl?
Houston
What is your life’s purpose?
Weather Storm
What is your motto?
Mainstream
What do your friends think of you?
Sing for the Submarine
What do you think about often?
World Keeps Turning
What is 2+2?
Everything You Can Think
What do you think of your best friend?
Echoplex
What is your life story?
Breaking Into Heaven
What do you want to be when you grow up?
A Sight for Sore Eyes
What do you think when you see the person you like?
Juliet (Keep That In Mind)
What do your parents think of you?
Prescilla
What will you dance to at your wedding?
All is Well
What will they play at your funeral?
Heads Will Roll
What is your hobby/interest?
Watch Her Disappear
What is your biggest secret?
Hunter
What do you think of your friends?
Don’t Know Why
What’s the worst thing that could happen?
Atoms for Peace
How will you die?
All Summer Long
What is the one thing you regret?
Foreign Affair
What makes you laugh?
Hike
What makes you cry?
Last Tide
Will you ever get married?
Leila Came Round and We Watched a Video
What scares you the most?
Bigger Than Me
Who likes you?
Generation Y?
If you could go back in time, what would you change?
You Don’t Know Jesus
What hurts right now?
Scotland’s Shame
What will you post this as?
Johnsburg, Illinois

I particularly enjoyed “what is the one thing you regret? — foreign affair” and “what hurts right now? — Scotland’s shame”.

2 responses so far

Feb 06 2009

Bad MIME-type hack

Published by Dougal under Computing

Occasionally you come across a file online which you know to be a text file, but has been given a MIME type that the browser doesn’t recognise. Internet Explorer does something called MIME-type sniffing — which is to say, it reads the beginning of the file and tries to determine what type it actually is. I’m not here to debate the merits of this tactic, only to point out that Firefox doesn’t do this, and will instead prompt you to save the file or open it with something else.

This is a really intensely irritating behaviour. There should be a third option, Open in Firefox as… but there isn’t. If the file is a text file you can cheat. Copy the URL into the address bar and prefix the whole thing with view-source:.

For example, if

http://www.example.com/mypage.txt

doesn’t load properly, load this page instead

view-source:http://www.example.com/mypage.txt

No responses yet

Feb 04 2009

Doing the lambda lambada

Published by Dougal under Programming

The letter lambda (upper case Λ and lower case λ) seems to be a very friendly, approachable sort of symbol. Everyone and their dog has used it for something.

How simply can we draw one?

dia = pad 10 10 $ unionA left bottom [topcurve,legcurve]
    where
        topcurve = curved 1 $ pathFromVertices [(0,0),(2,0),(8,10),(10,10)]
        legcurve = curved 1 $ pathFromVertices [(5,5),(2,10),(0,10)]

Pretty simply, it seems.

No responses yet

Next »