Tuesday, September 1, 2015

How to take apart and fix a Brio electric locomotive

Favourite electric engine number 7 started working only intermittently. Electrical fault? Carpet fluff in the gears? This photo blog details how I fixed it.

Thursday, August 27, 2015

Unexpected signs of malignancy

Chapter 1
Bedside manner is an interesting thing. How should a doctor tell you things about yourself? How should you pass on information to friends? How should I write this blog post?
My doctor told me something on Thursday 16th July 2015, and I'm going to write about it here. I noticed that my doctor told me in a slightly oblique way, flying past the central topic a few times, using slightly technical language, and emphasising how unexpected the information was. Somehow, this emphasis on the unexpectedness of the information made it comfortable to absorb.
Here's why I was visiting the doctor: I'd been to see him two weeks before, because I was feeling unreasonably exhausted - even walking up one flight of stairs was difficult; he had done a blood test, found that I had anaemia, and had referred me to the hospital for an endoscopy, which I'd had on the 9th of July. (Looking at the stomach was motivated by a history of stomach pain over the past couple of years.) The endoscopy doctor had told me, on the day of the endoscopy, that I had a stomach ulcer. The Thursday-16th-July meeting was for me to hear more about the results of the endoscopy.
My doctor got straight to the point: tests had been done on biopsies from my endoscopy; the letter from the hospital the ulcer showed signs of malignancy, most unexpectedly.
"Malignant adenocarcinoma", he said.
That's a cancer of the glandular tissue, he said.
"So you need to go for a CT-scan tomorrow, to get more information. There's no reason to think it has spread at all. And in the absence of information about the grade (histology) and the stage (degree of spread) it's hard to say what treatment will be recommended; but almost certainly stomach surgery will be involved, soon. I need to take blood today for a kidney-function check before the CT-scan. Then next week after the CT scan, a multidisciplinary team will meet to discuss all the results and make a plan."
He also said "you could drive yourself crazy reading about this on the internet"; he encouraged me not to do that, but to wait to hear what the hospital team said.
So that was it. Unexpectedly off to hospital for an unexpected CT scan (cool!) to investigate an unexpected cancer on a mildly surprising stomach ulcer.
Many friends to whom I have told my news in the last month have said "you must be devastated"; but I didn't feel devastated. I just felt "ok, that's the way things are"; I started adjusting my plans to take into account the new information. Friday's trip to London had to be cancelled. Which Summer holiday plans would we need to change? Which engagements might I need to cancel? Should I stop trying to raise research funds to build up a new research group?
I found Ramesh in the village hall and we walked home together, pushing Eriska in her pushchair.
I did a little bit of reading on the NHS website about adenocarcinoma of the stomach. The probability of surviving stomach cancer is not great, as this Tufte graphic makes clear.
"But hey, if only 20% survive 5 years, I aim to be in that 20%", I figured.
Naively I thought "almost certainly stomach surgery will be involved" implied I should be planning for a couple of days in hospital some time in August. A friendly doctor disabused me of this notion however - the normal treatment for early-stage stomach cancer is surgery to remove some or all of the stomach and all nearby lymph nodes, and it typically takes at least a 10-day stay in hospital until the digestive system recovers sufficiently from this insult to work at all; during those 10 days, you are fed through your vein and a vacuum tube is put down your nose to ensure that nothing gets beyond the oesophagus. Hmm, that doesn't sound fun.
I found an internet discussion group for people who've had stomach surgery for cancer treatment. Lots of positivity about the eventual return to near-normality.

Chapter 2
Off I went for the CT scan. What a wonderful Siemens machine! A whizzing circle. And a nice clinical scientist who set up the injections and told me that as it went in it would feel as if I had wet myself, but don't worry, you won't have. (She was right.)
On Wednesday 22nd July I met some members of my multidisciplinary team. They said that the CT scan had not resolved the degree of spread; it looked like several lymph nodes near the stomach might be cancerous, and perhaps one lymph node near the aorta; and there might be something in the liver but probably not; so they wanted to do more scans and a laparoscopy to pin the situation down. An MRI scan of the liver, to check that there was nothing there. A PET-CT scan of the chest to investigate the lymph node near the aorta - this would require special finance-paperwork because it is a non-standard test. And a laparoscopy, which means inflating the abdomen with CO2 and putting a camera in for a look around, under general anaesthetic. These things would probably take two weeks to complete, because the scanners are in demand.
After these investigations, the team would then recommend one of two courses of action: either
1. treat stomach cancer with chemotherapy and surgery from mid-august (start of chemo) to roughly november 17 (surgery) followed perhaps by more chemo; all with the intention of cure. The surgery would remove some or all of the stomach (and based on what I'd read, and the location of my ulcer, I reckoned probably 'all' was the right thing to expect)
2. just chemotherapy, no surgery; with the intention to improve/extend quality of life but not to cure. [don’t bother with surgery because too much spread].
So the one fairly certain thing seemed to be that I would be in for chemotherapy fairly soon.
After meeting the gastric consultant and nurse specialist, I met a dietician, then the dashing surgeon who was going to do my laparoscopy and (under plan 1 above) my stomach surgery.
His bedside manner was very direct. After the laparoscopy, he said, we will know whether it is good news or "doom and gloom". And in the good news scenario, he would remove my stomach. Yes, the whole thing. He wasn't bothered with hedging about any possibility of removing just part of it.

Chapter 3
We nipped away for a brief holiday. The scheduling of the two scans and the laparoscopy was chaotic but in the end all three took place very neatly on Monday 3rd and Tuesday 4th August. And as I came round from the general anaesthetic on the Tuesday afternoon, the dashing surgeon came in with a bundle of photos he'd taken and with his direct bedside manner.
"You remember I said the results could be anything between good news and doom and gloom? Well, I'm afraid it's doom and gloom."
There are secondaries all over the peritoneum. He showed me two of the pictures, which showed a thin white layer of tissue covering much of the diaphragm. He said he reckoned that without chemotherapy I might have roughly 12 months to go, and the chemotherapy might extend things by 6 months or so, but was unlikely to make me last more than 24 months.
My main reaction was "hurray! I get to keep my stomach!"

Chapter 4
At this point I started telling more friends and colleagues the situation. I emphasized "I am feeling fine and enjoying eating well in order to build strength." Ramesh and I both felt determined to have some fun. On 5th August I wrote "There is still an option of having palliative chemotherapy, but I am not sure whether that will be a good choice, since it would eat into weeks or months of valuable time now in exchange for perhaps just a few months of extra time later; I’ll talk to oncology specialists at Addenbrookes today and see how they see the pros and cons." One of my main reasons for hesitating was my perception that I was feeling fine right then, and August and September seemed a fantastic opportunity for having some fun. Chemotherapy would spoil that opportunity. Was it worth it? Could I delay the chemotherapy a few weeks?
I met my gastric consultant again, and met the head of chemotherapy at Addenbrookes, who confirmed the surgeon's rough estimates about life-expectancy. He recommended that I take the chemotherapy immediately, even though the median extension of life by chemotherapy was only about two months; I asked about the loss of quality of life during the chemotherapy; he said the loss of quality was "only 20% or so", and that the expected return (in terms of the area under the quality-of-life curve) was greater.
What about the PET-CT scan and the MRI scan? The MRI scan had shown nothing in the liver. And the PET scan didn't show anything - apparently my cancer doesn't show up at all. And they said that it hardly showed up under the original CT scan either.
I agreed to their recommendation of "EOX" chemotherapy. I had one week of rest to recover from the laparoscopy (which left the tummy surprisingly sore for several days), then the following Thursday I was back in the hospital for...

Chapter 5 - the biggest red syringe I've ever seen
It looked like something out of an Austin Powers comedy. The nurse kindly squeezed it in. Then put me on the drip to put in the second cytotoxin. Then two hours later sent me home with my huge bag full of pills.

Oh, before I tell you about the chemo, I should insert a little addendum to Chapter 4.

Chapter 4b - the last minute hesitation
It wasn't "denial" or wishful thinking, but in the final day before starting chemotherapy I found myself really concerned about the possibility that the whole thing was a big false positive. After all, they had told me that the CT scan showed very little, the PET scan showed nothing, and the MRI scan showed nothing. The only 'positive' evidence we had to go on was a histologist's report from the gastroscopy saying "malignant adenocarcinoma" and the photos and expert judgement of the surgeon that what he saw was definitely secondaries all over the peritoneum. But what if I have an unusual-looking peritoneum? And could the histology results have been mixed up somehow? A bad histologist? Specimens mixed up? It would be stomach-churningly terrible to undergo chemotherapy if in fact I didn't have cancer! I hadn't seen any data with my own eyes that really convinced me. I was only agreeing to treatment because I trusted the NHS staff. But I really wanted to feel more convinced myself. (My head of department had just told me a few days before about a friend of his who had a misdiagnosis of cancer.) Thankfully a friendly doctor suggested what to do - certainly, he said, samples would have been taken from the laparoscopy too, and they should have been tested by now; I could ask about the histology results. So I did that, and was told that those biopsies were indeed cancerous too. As I said, I wasn't in denial. It's just that to believe things you need either data that you understand or you need complete trust. I still wish I had seen more of the raw data with my own eyes. I like data. Anyway, with both the independent histology findings, I was happy to go ahead.

Chapter 6 - Chemotherapy - it's not nice, but I think I shouldn't complain. It's much worse for some people. Here is a probably-too-detailed account of Side-effects and other recent history.
1. During my first (EO) infusion I had no side-effects for the first 90 minutes, but during the final 30 minutes or so, I had cramps in my infusion arm, and weird sensations in the out-facing surface of that arm (see point 4 below).
2. Some of the infusion arm’s veins were painful and I still noticed slight vein pains (if I looked for them) on day 13.
3. I experienced some of the predicted (neuropathy) side-effects: my fingertips had sharp pins and needles sensations, especially in cold situations; this lasted a few days; my feet also had cold-induced pins and needles, for two days. My tongue was very cold-sensitive for the first couple of days and remained somewhat cold-sensitive (feeling like a puffy sock) for about 5 days. After 7 days the tongue returned to normal.
4. I don’t know if it is part of the neuropathy syndrome, but my infusion arm’s out-facing surface remained strange for about 7 days. During the first 4 days the skin and hairs were very sensitive to the touch; it felt like being stroked with a cheese grater - all over the arm, and especially the hand. By day 7, this cheese grater sensation was mainly confined to the back of the hand.
5. I didn’t have strong feelings of nausea.
6. I took steroids for 2 days as instructed. My stomach had some ups and downs which were eased along by senna and lactulose.
7. My mood became quite dark on days 1-3, then I perked up again by day 5 onwards.
8. I feel tired a lot of the time, and spend lots of time snoozing and sleeping.
9. I got a sore throat on day 11 (Sunday 23rd) and then sore throat and cough on day 12; the oncology clinic instructed me to get antibiotics from my GP and to suspend taking the "X" (capecitabine) for a couple of days while I get over the cold. This cold reached its worst on Wednesday 27th, and now (early hours of Friday) I think I am getting over it. (Increased vulnerability to infections is one of the expected side-effects of the chemo.)

How I felt about the side-effects.
I didn’t enjoy the pins and needles feeling, but if it always were to go away after 5 days, that would be ok. However, the medics have indicated that the neuropathy is expected to worsen over subsequent cycles. So I am going to talk to my doctors about switching to a less-neuropathic alternative to oxaliplatin at the next cycle this Thursday coming. The down-sides of the alternative are “longer infusion, more chance of nausea”.

Chapter 7 - What's next
There are probably going to be eight cycles of chemotherapy. Each cycle lasts three weeks, starting with a Thursday infusion, followed by 21 days of pill-taking. Eight threes is twenty-four, which is roughly six months. Given how I've felt during the first 14 days, I expect I will feel fairly tired for much of the next six months, and I'll probably spend most of it at home or near home. So the having-fun plan is focussed in the Cambridge area for the near future, with aspirations to do some having-fun further afield [perhaps on a Scottish island or two] about February, March, or April.
I'm still feeling fine, and as I shake off the cold I am beginning to feel really perky again. I've got a great appetite. My time spent snoozing is happy time, usually accompanied by radio 4 comedies. I'm spending a lot of time listening to music and transferring music from CDs to my computer and my smartphone, so that I can have favourite music wherever I am.
The biggest weight on our minds is the question how to prepare for helping our children (aged 4 and 1) through whatever the next year or three throw up.
Here we are... we are all happy!

I'll add another blog post here at itila.blogspot.co.uk every three weeks or so, to keep you updated.
Thank you to our dear friends and relations for your support!

Wednesday, April 15, 2015

Newcastle-under-Lyme School, Form 5 beta, 1982/3

My form teacher and biology teacher (Bill Beatson) sent me this nostalgia-inducing photo of my class. We were 4th years? No, 5th years. The school had just started turning from a state school into a private school; all but two of this form were state-funded pupils.

Tuesday, January 27, 2015

Public transport & cycling orbital for Cambridge

I have long thought that West Cambridge (and Northwest Cambridge, now that it is being built) should be connected by fast public transport to Cambridge railway station and to Addenbrookes hospital. The rough map above shows a proposed route running (from NW Cambridge) East to the Science Park and the new Chesterton Junction Railway Station; and (from West Cambridge) south alongside the M11 to Trumpington and the guided busway. This route would connect to both the Trumpington and Madingley Road Park-and-Ride sites.
If there were a nice cycle-path along these routes too, it would provide pleasant commuting options for people who live outside Cambridge to get to work at the West Cambridge, NW Cambridge, or Science Park sites.
The part alongside the M11 could have a nice view of the Cambridge wind farm that I visualised in June 2009. A 36-turbine wind farm would produce enough power, on average, to power the University's Departments and Offices (not including the Colleges). I think that an arc of turbines alongside the M11 could make an interesting icon.

Monday, January 19, 2015

Bye bye Ubuntu Linux - Hello MacBook Air

Today I unpacked a MacBook Air. I have used Ubuntu Linux happily for a long time, but it seems to be time to migrate.

Favourite software on ubuntu:

mutt for mail
mgp (magicpoint) for presentations

I'll record my progress on this blog-post.

Kind friends made excellent recommendations.


I installed MacPort and it provides a functionality very similar to apt (apt-get install blah). And I found that many packages are supported by Port, some of which I had never expected to see again! xcode had to be installed for port to be able to do its thing.
sudo port selfupdate
     sudo xcodebuild -license
     sudo port install gnuplot
     sudo port select --set python python27
     sudo port install ghostview 
     sudo port install gv
     sudo port install make
     sudo port install convert
     sudo port install imagemagick
     sudo port install magicpoint
     sudo port install mutt
     sudo port install unison
     sudo port install xv
     sudo port install xephem
     sudo port install ruby
     sudo port install tcl
     sudo port install xeyes
 sudo port install tk
 sudo port install rails
 sudo port install wget
 sudo port install mercurial git 
 sudo port install ffmpeg figlet lynx mysql ncftp stunnel unrar tcsh csh sh git-core  signing-party  ntop tcping bash bash-completion file xdu tree 
 sudo port install acroread
 sudo port install xpdf
 sudo port install dasher

To get "locate" to work, I did this:
     sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
Tom taught me about caffeinate -i to stop the machine from going to sleep. It is already installed.
To get focus to follow mouse (into terminals at least) I tried this, but it didn't seem to work.
  defaults write com.apple.Terminal FocusFollowsMouse -bool true
  defaults write com.apple.x11 wm_ffm -bool true
  defaults write com.apple.Terminal FocusFollowsMouse -string YES


I installed Quartz because xdvi said it needed X11 in order to run. It says I need to log out and in to get X11 to work. Not sure what that means.


I used system preferences to crank up the key-repeat speed to the maximum. I switched off most of the audible notifications; to switch off the "outgoing mail sounds like a jet engine" nonsense, I had to go into mail preferences.


I need to figure out whether going with MacTeX is a good idea or should I find a version in Port and stick with that? Instructions for MacTeX
cd /Volumes/packages/MacTeX/
installer  -pkg MacTeX-2011.mpkg -target /

/usr/local/texlive/2014/bin/x86_64-darwin/tlmgr update --self
/usr/local/texlive/2014/bin/x86_64-darwin/tlmgr update --all


I want shift-3 to give # not £ so I went into keyboard preferences, selected "show keyboard options in menu bar" and then added US as well as UK to the list of available keyboards, and switched to US.

Things I still need

Keyboard shortcuts in Apple's Mail programme - can I get it to feel like mutt? Why doesn't "mark as junk" come up as an option? How to move mail's focus between the message and the list of messages? What is the keyboard shortcut to close just one terminal window? (not all terminals! which is what cmd-Q does) Why does
emacs filename & 
not work? How can I get the command line completion feature that I had in tcsh? (e.g. ls !$TAB)

Tim's recommendations

Some of my productivity choices:

Although it comes with an emacs, I use Aquamacs : http://aquamacs.org

Flip windows around with keypresses: http://mizage.com/divvy/

After you have got used to the mac a bit, Quicksilver : http://qsapp.com

And a key macro (e.g. for inserting dates and times): http://smilesoftware.com/TextExpander/index.html

Tom's recommendations

My biggest tip is that, if in doubt about how to do something, try dragging and dropping.

My second biggest tip is to make use of Time Machine. Hassle free overnight recovery from a lost or stolen machine.

As for software:

* A better terminal: http://iterm2.com
* A package manager: http://brew.sh
* Like Divvy: http://manytricks.com/moom/
* Like emacs: https://code.google.com/p/macvim/ ;-)
* For all those random notes: http://notational.net (not been updated in ages but works really well for me)
* Offsite backup: https://www.backblaze.com 
* A forgetful programmers friend: http://kapeli.com/dash
* Like Word: https://www.tug.org/mactex/ 

And some important command line tricks:

* Drag a file or folder onto the terminal
* Drag the little icon at the top of a document window onto the terminal
* Copy, then type pbpaste in a terminal  (e.g. pbpaste | wc)
* ls | pbcopy  — then paste
* caffeinate -s (for when your computer is too sleepy)
* open index.html
* open random-word-doc.docx

Seb's recommendations

Using search is usually quicker than navigating to find stuff. Cmd-space (Spotlight) to find apps (including switching to open ones), files, emails, etc. Or use the search box in ‘file open/save’ dialogs. (Quicksilver is a fancier search/launcher system, which I don’t use)
Cmd-Tab switches applications, but use Cmd-~ to switch windows within each application.
Delete is Fn-backspace  (both for text and things like files in Finder).
If you download an app from the internet which hasn’t got Apple approval, the first time you launch it, override the fact that Apple “protects” you from it by “right clicking” (two-finger-click or ctrl-click) and ‘Open’. Thereafter it will open normally. You can turn off this security feature completely if you want.

Time Machine is indeed excellent for backup - and as the name suggests you can go back to older version of files if you need to. You either plug in an external drive, or configure it to use a device on your home network (Apple Time Capsule or non-Apple equivalent NAS device, just check it offers Time Machine support).

Personally I would be wary of iPhoto - it has some nice features but I don’t trust it either to look after my photos or give them back to me when I want to stop using a Mac.

I don’t know if ti’s still the case, but to get backspace to work properly in Terminal when ssh’d to a Linux box, in Terminal Prefs, I had to select rxvt as terminal type, uncheck 'Delete sends Ctrl+H', (http://chad.glendenin.com/macosx-backspace.html)

Everything below this point is third party stuff you need to install (mostly free):

nvALT is an updated version of notational velocity (which Tom mentioned) - for keeping text-based notes. Works well for me too, and you can store the notes in Dropbox so you can access them on your smartphone too.

pwSafe - password safe (not Mac-specific, but there’s a mac version) (syncs to phone etc too)

Making disk images - Carbon Copy Cloner. Good as an extra backup, and also if you lose you Mac or, heaven forbid, it dies, you can plug the disk into a friend’s Mac and boot up your system straight off it.

An alternative online backup: Arq (looks nice, haven’t got round to trying it yet).

Ripping DVDs: makemkv

Tuesday, August 12, 2014

Wind farm visible from Cambridge

I popped up Castle Hill two days ago and discovered that 13 wind turbines can now be seen from Cambridge.
The wind farm is called Wadlow Farm and here is a bit of it arriving during the 2011-2012 construction:

Monday, May 26, 2014

Energy density of a spring

Energy density of a spring (or a "mainspring")

My 2-year-old son loves wind-up toys, and that set me thinking... what is the energy density (the energy per unit mass) of a wound-up spring? After a bit of googling, I have come to the conclusion that this is one of the few questions to which the internet does not know the answer!

A clockwork toy's gearbox A clockwork toy's mainspring, fully wound down.

Quite a few people have already asked the question.

For example, on the xkcd forum " today I began thinking about mainsprings, the coiled springs typically used to power wind up clocks, watches, etc. While reading up on them I began to notice a trend where articles comment on how much energy they can contain (usually described as "a lot" rather than anything useful.) This led me to try to find a source for the potential energy of a mainspring, something that I've found rather difficult to find." The same question has been asked more than once on physicsforums.

And there must be plenty of experts who know the answer

... for example these Birmingham researchers, and about 400 years of clock-making experts, and Trevor Bayliss who made the wind-up radio. I don't know why they are so secretive! :-)

Let's figure out a rough answer to the question

A coiled spring stores energy in the same way as a bent beam. You can read about the energy stored in a bent beam in my lecture on the musical note produced by the "beams" of a marimba or xylophone.

Gamelan - a musical instrument like a marimba

It's interesting stuff, but actually we don't need all that detail to get the answer. The key insights we need are

  1. The energy per unit mass in a bit of the spring that is strained with a strain of ε is
    0.5 Y ( ε2 ) / ρ
    where Y is the Young's modulus, and ρ is the density.
  2. The stress τ is (roughly) related to the strain by
    τ = Y ε
  3. and the maximum stress you can cope with [in a spring that is to be reused many times] is called the Yield strength, which I'll denote by the symbol τmax.
Putting these facts together, if εmax is the maximum strain [εmaxmax/Y] The maximum energy per unit mass in the bit of the spring that is maximally strained is
0.5 Y ( τmax/Y )2 / ρ = 0.5 (τmax)2 / ( Y ρ )
Now, not all of the spring will manage to be in this state of maximum strain, and the spring must be housed in a container too, which adds to the weight, so this energy density is an upper bound on what is possible with a spring made of a given material.

Material Y τmax ρ 0.5 (τmax)2 / ( Y ρ )
GPa MPa kg/m3 (Wh/kg)
Steel (structural ASTM A36 steel) 200 250 8000 0.005
Titanium 116 225 0.013
Rubber 0.03? 16? 1100 1.1 ?
Carbon fibre [.] 230 4000 1600 6.0?
Carbon nanotubes ? ? ?
Steel (Micro-Melt 10 Tough Treated Tool (AISI A11)) 200 5000 7450 2.3

We can compare these energy densities with those of other energy storage systems featured in my book by looking at page 199. Sadly, the wind-up spring doesn't get close to the energy density of even the worst rechargeable batteries (30 Wh/kg).

[Next steps: quality-assure the numbers in the table, and do a real-world check against the actual weight and actual energy stored in real clock mainsprings.]