In 2008 I bought a Western Digital My Book Home Edition 500GB external hard drive to do Time Machine backups to. Although when I got a Time Capsule the drive was repurposed as an adjunct to my Media Centre Computer (i.e. my old 12" PowerBook plugged into the TV), although it didn't seem to like the fact the PowerBook went to sleep and eventually the file system got corrupted. I wrote a Perl script to recover files from an "unrecoverable" HFS+ filesystem (if anyone is interested I could clean up this code and post it) and got all the data back off it, reformatted it and attached it as an external disk to the Time Capsule.
And so it chugged on, occasionally having things dumped on it. Until last week, when I noticed that the Time Capsule seemed to be playing up, and the cause was apparently the external disk. I disconnected it and had a quick look with it plugged into my laptop and it seemed to be OK (although in retrospect I should maybe have done a bit more investigation that just looking to see if a directory listing showed there were files there).
Shortly afterwards I happened to be in Maplin and noticed they had a deal on Seagate GoFlex Desk 2TB External Drives, and so I got one of those, hoping I would be able to copy all the data off the failing 500GB drive before it lost the plot completely.
It turned out that although all the empty boxes in the shop proclaimed the drive was USB 2.0 and "upgradable to USB 3.0" (the GoFlex drives have swappable bases that allow you to choose different interfaces) that the drive I got already had a USB 3.0 adapter base. And so I ended up with my first USB 3.0 device, which by itself isn't particularly useful. However the supplied cable was perfectly adequate to connect the rather wacky USB 3.0 Micro-B socket on the HDD to the standard USB 2.0 A socket on the Time Capsule, and everything seemed to work fine. I kicked off an archive of the Time Capsule's internal disk and the next morning all my backups had been duplicated to the new disk.
So then I tried to recover the data from the failing 500GB drive. It turned out that it wasn't as happy as I'd originally thought. Although files would show up in Finder, if you actually tried to copy them off the drive the whole thing failed, making spin-up/spin-down noises and then disconnecting. I tried it through various interfaces (FireWire and USB), and also with the drive in various physical orientations (you never know). I even tried a different power supply in case the original one could no longer supply enough juice, but to no avail.
After I decided that there wasn't anything critical on the drive (mostly old TV shows I hadn't got round to watching) and that it was out of warranty, I thought I'd open it up. This was easier said than done. I eventually managed to lever the sides of the MyBook slightly open with a screwdriver and then open it like, well, a book, and get to the drive inside.
The MyBook is a sturdy well-constructed package, but once I got in I found there was a WD Caviar GP 3.5" SATA drive inside. Unfortunately I don't have a 3.5" SATA/USB enclosure. I probably should have guessed it was a SATA drive, as the MyBook has an eSATA connection as well as FireWire and USB. So I had a last ditch attempt at reviving it without it's case on, and even tried dropping the drive from about 6" onto my desk - just in case it helped. Then it dawned on my that the adapter for the GoFlex drive is just a SATA/USB3 bridge, so I removed the GoFlex drive from it's base, and then precariously balanced the bare WD drive on top of the adapter and proceeded to recover all my data from the WD drive.
This makes me think that the SATA/USB/FireWire bridge board in the MyBook enclosure is the component that is failing. Although it's not completely failed as it still talks to the disk to some extent. I find this slightly perplexing as I would have thought it was the component least likely to fail. Maybe some component on the board is undergoing heat failure.
Anyway, I offer this story up to the Internet in the hope that someone in a similar situation may be able to recover some important data that they thought was lost for ever, by using the power of the search engine, a screwdriver and a SATA adapter.
Thursday, April 19, 2012
Sunday, February 26, 2012
New Scientist: Enigma 45
This is the item published in the New Scientist #2853 Feedback section about my solution to Enigma Puzzle 45.
And on page 35:
It only took 32 years to solve Enigma No 45. The version of the weekly New Scientist puzzle that was set in the issue of 3 January 1980 - a problem in linear algebra - was, it seemed, too difficult even for New Scientist's notoriously clever readers. The deadline for responses passed and, two weeks later on 17 January, Enigma's editor announced: "No correct solutions were received for Enigma No 45."
And that's how things stood until December 2011, when Jim Randell emailed New Scientist to say: "I was browsing through Google Books and I came across Enigma 45..." He promptly had a go at the puzzle himself and found "a solution that satisfies the conditions".
"What I'd like to know," said Jim, "is whether mine is the first correct solution you've received for this puzzle - albeit almost 32 years late."
We forwarded Jim's email on to the mathematical genius who regularly checks readers' solutions for Enigma puzzles.
He said that Jim had indeed got the answer right, and added that he had used "a reasonably straightforward computer program" to do the checking. "Presumably the reason no one got this answer 32 years ago," he surmised, "was because of the lack of computers then."
Our congratulations go to Jim Randell, who will be awarded an Enigma prize - at the 2012 rate, not the 1980 one. His solution to the puzzle is published in this week's Enigma on page 35.
And on page 35:
Answer to 45 Six squares - harder: P=434657, Q=420968, R=150568
The winner Jim Randell of Bristol, UK
Thursday, February 23, 2012
Retrocomputing Enigma 45
A few months ago I launched Enigmatic Code - a place to post programmatic solutions to New Scientist's Enigma Puzzles.
As well as solving contemporary puzzles I found that Google Books has archives of back issues of New Scientist dating back to the 70's and 80's, and in my search for early Enigma puzzles I came across Enigma 45: Six squares - harder. Which involves finding non-negative integers P, Q, R such that P+Q, P+R, Q+R, P-Q, P-R and Q-R are all perfect squares.
After a couple of false starts - the solution clearly wasn't as small as I'd hoped - I came up with an algorithm to attack the problem in a reasonable amount of time.
However, when I checked my solution against the one published in the following issue of New Scientist I saw that the answer I had got wasn't the same as the solution they were expecting. But we had been asked to minimise the sum P+Q+R and my answer had a smaller sum than the published solution.
Curiously in New Scientist #1190 it is noted that no correct entries were received for this puzzle. "Shame on you!", they said. So I sent an email with my solution to ask if I was the first correct entry, albeit 32 years too late.
In the current issue of New Scientist (#2853) they published a short item in the Feedback section about this story, and they have awarded me a £15 prize for solving the puzzle!
If you're thinking it's a little unfair to unleash 2011 computing power on a 1980's problem, I decided to put a more contemporary machine up to the challenge. The BBC Micro was launched at the end of 1981 (although I don't think I would have been using them until probably '82 or '83), and I did quite a lot of programming on them at school, so I stood a fair chance of being able to get a program together to attack the problem.
So, I downloaded BeebEm3, and managed to get a BBC BASIC program together to solve the problem. The hardest part was trying to input the program, as the keymap of the emulator doesn't match the layout of my laptop keyboard. Nevertheless I managed to get my program typed in and running. (See image above).
It took about 40 minutes to run, and the Emulator said it was running at a speed of around 17, which I'm assuming means it's running at 17x the speed of a real BBC Micro. If so, that would mean that a contemporary-ish home computer could have solved the problem in under 12 hours (in BASIC!). Admittedly it's not up to the 255ms runtime of my present day Python solution, but it would be a bit of a poor reflection on 32 years of computing development if it was.
Note: It turns out this problem was posed by Italian mathematician Pietro Mengoli in 1674, and the smallest solution was discovered by Euler a century later, probably without the benefit of even a BBC Micro.
Note: I've now received my physical copy of New Scientist #2853 and I've reproduced the article (and the illustration) on my own blog: New Scientist: Enigma 45.
As well as solving contemporary puzzles I found that Google Books has archives of back issues of New Scientist dating back to the 70's and 80's, and in my search for early Enigma puzzles I came across Enigma 45: Six squares - harder. Which involves finding non-negative integers P, Q, R such that P+Q, P+R, Q+R, P-Q, P-R and Q-R are all perfect squares.
After a couple of false starts - the solution clearly wasn't as small as I'd hoped - I came up with an algorithm to attack the problem in a reasonable amount of time.
However, when I checked my solution against the one published in the following issue of New Scientist I saw that the answer I had got wasn't the same as the solution they were expecting. But we had been asked to minimise the sum P+Q+R and my answer had a smaller sum than the published solution.
Curiously in New Scientist #1190 it is noted that no correct entries were received for this puzzle. "Shame on you!", they said. So I sent an email with my solution to ask if I was the first correct entry, albeit 32 years too late.
In the current issue of New Scientist (#2853) they published a short item in the Feedback section about this story, and they have awarded me a £15 prize for solving the puzzle!
If you're thinking it's a little unfair to unleash 2011 computing power on a 1980's problem, I decided to put a more contemporary machine up to the challenge. The BBC Micro was launched at the end of 1981 (although I don't think I would have been using them until probably '82 or '83), and I did quite a lot of programming on them at school, so I stood a fair chance of being able to get a program together to attack the problem.
So, I downloaded BeebEm3, and managed to get a BBC BASIC program together to solve the problem. The hardest part was trying to input the program, as the keymap of the emulator doesn't match the layout of my laptop keyboard. Nevertheless I managed to get my program typed in and running. (See image above).
It took about 40 minutes to run, and the Emulator said it was running at a speed of around 17, which I'm assuming means it's running at 17x the speed of a real BBC Micro. If so, that would mean that a contemporary-ish home computer could have solved the problem in under 12 hours (in BASIC!). Admittedly it's not up to the 255ms runtime of my present day Python solution, but it would be a bit of a poor reflection on 32 years of computing development if it was.
Note: It turns out this problem was posed by Italian mathematician Pietro Mengoli in 1674, and the smallest solution was discovered by Euler a century later, probably without the benefit of even a BBC Micro.
Note: I've now received my physical copy of New Scientist #2853 and I've reproduced the article (and the illustration) on my own blog: New Scientist: Enigma 45.
Thursday, January 12, 2012
A Variation on the West Mendip Way
The walk goes from Wells Cathedral to Weston Bay at Uphill, just south of Weston-super-Mare. (Officially it goes the other way, but I think it might be more aesthetically pleasing to finish at the sea).
I've made some variations to the official route, these are:
- Avoid dropping down to the road at Draycott, instead cut through Draycott Sleights Nature Reserve.
- Walk along the cliff edge from Cheddar to Blackrock Gate.
- Go along Velvet Bottom and up to Beacon Batch (the highest point in the Mendips), and then rejoin the official route at Rowberrow Warren. (Although an even further extension could be added here to take in Dolebury Warren).
- A minor detour from the official route to visit the summit of Crook Peak.
The route could be split into 3 stages of around 10 miles each:
- Wells to Cheddar, 11 miles (17.4 km).
- Cheddar to Winscombe Hill, 10 miles (15.8 km).
- Winscombe Hill to Uphill, 10 miles (16.0 km).
The last stage is trickier, you would need to get a bus between Winscombe Hill and Weston-super-Mare, and then another one between Weston-super-Mare and Uphil (Beach End Road), which will take over an hour. It may be easier to arrange for someone to meet you at the beach for a celebratory ice-cream.
Or it could be done in 2 stages of around 16 miles each, by breaking the route at the summit of Beacon Batch. That way you get to do the highest point in the Mendips on both days.
- Wells to Beacon Batch, 16 miles (25.8 km)
- Beacon Batch to Uphill, 15 miles (23.4 km)
My plan is to do this when there is a fine spell of weather in the spring.
Tuesday, January 10, 2012
Enigmatic Python
While attempting to find a programmatic solution to Enigma 1602 (which really is much easier to do with pencil and paper) for the Enigmatic Code Blog, I briefly toyed with the idea of writing my own code to solve sets of linear simultaneous equations.
Then I discovered the rather marvellous SymPy library, which can do that and much more, and made for a very neat solution.
I've really only scratched the surface of this module, but I expect to use it more in the future.
Along with other Python modules that aid in the writing Enigma solutions: unlimited precision integers, set, itertools, collections, fractions, probably lots of other standard modules I have yet to discover, and, of course, my own set of useful routines.
And finally, to squeeze that bit extra out your Python programs you can always try using PyPy, which is a Python interpreter, written in Python. It includes a JIT compiler and often ends up running faster than the standard CPython interpreter.
I tried it on my code for Enigma 1653 - one of the trickier ones - and I got the following runtimes:
CPython 2.7.1: 2m01s
CPython 3.2: 1m52s
PyPy: 0m10s
Then I discovered the rather marvellous SymPy library, which can do that and much more, and made for a very neat solution.
I've really only scratched the surface of this module, but I expect to use it more in the future.
Along with other Python modules that aid in the writing Enigma solutions: unlimited precision integers, set, itertools, collections, fractions, probably lots of other standard modules I have yet to discover, and, of course, my own set of useful routines.
And finally, to squeeze that bit extra out your Python programs you can always try using PyPy, which is a Python interpreter, written in Python. It includes a JIT compiler and often ends up running faster than the standard CPython interpreter.
I tried it on my code for Enigma 1653 - one of the trickier ones - and I got the following runtimes:
CPython 2.7.1: 2m01s
CPython 3.2: 1m52s
PyPy: 0m10s
Thursday, December 1, 2011
Enigmatic Code
For the past few years I've been treating the weekly Enigma puzzles in New Scientist magazine as a programming challenge. I started writing programs to solve the puzzles in Perl (and occasionally C, when speed was all important), but more recently I've been coding up solutions in Python.
Now, I've decided to set up a blog to share programmatic solutions to Enigma puzzles. I opted for a WordPress blog, as I couldn't get Blogger comments to accept pre-formatted code. Whereas WordPress comments let you use HTML <pre> tags.
I aim to add new puzzles (and solutions) as they are published (usually on a Thursday in the UK), and also retroactively add old puzzles that I have coded solutions for, or found from the New Scientist archives on Google Books, as time allows.
If you'd like to join in, please visit the Enigmatic Code blog.
Now, I've decided to set up a blog to share programmatic solutions to Enigma puzzles. I opted for a WordPress blog, as I couldn't get Blogger comments to accept pre-formatted code. Whereas WordPress comments let you use HTML <pre> tags.
I aim to add new puzzles (and solutions) as they are published (usually on a Thursday in the UK), and also retroactively add old puzzles that I have coded solutions for, or found from the New Scientist archives on Google Books, as time allows.
If you'd like to join in, please visit the Enigmatic Code blog.
Monday, September 26, 2011
Dice Emulator
![]() |
| The Merry Game of Floundering |
All the pieces were there with the exception of one of the dice (it needs to two). So rather than search for another die I did what any self-respecting programmer would do, and knocked up a dice emulator in Python.
Thanks to the pygame library and Unicode characters U+2680 - U+2685 I was able to get a program together quickly which we then triggered using the Apple Remote (using Remote Buddy's Virtual Mouse behaviour). Simple as that!
![]() |
| dice.py |
- Download dice.py
[*] While searching for more information on the game I found someone selling a set on eBay as "The Messy Game of Floundering".
Subscribe to:
Posts (Atom)





