Thursday, August 15, 2013

Data Centre

A modern data centre is a futuristic fusion of library, aircraft hangar and operating theatre. Assuming you could get past the stringent security, you would wander the tiled floors of a vast hall, bathed in air-con chill and calmed by the ambient hum of cooling fans.

Data Centre tourist view

The aisles of servers and network equipment you see above looks quite different to a normal office. Those dense racks may be powering Google searches, or storing billions of facebook pages or running some corporate intranet, but the fundamental design principles are just the same.

Data Centre architecture for web services

Most sufficiently-large networks are three-tier constructions. In the centre is a high-speed backbone - the core network - which is optimised for high-throughput of data packets and connects to the outside world: the Internet, other corporate sites, the Extranet.

Attached to the high-speed core is an aggregation layer. This concentrates the traffic from large numbers of smaller local area networks and provides a home for network services such as: firewalls, security systems (ID&P), monitoring systems, caches, SSL accelerators, load balancers and the like.

Finally we have the access layer: switches which directly connect to those masses of servers and provide their primary network connectivity. In a smaller network, the access and aggregation layers may be merged.

In a certain sense, the essence of data centre design comes down to the architecture diagram shown above.

Monday, August 12, 2013

Google's Schrödinger's Cat

A veritable superposition!

An amusing picture at Google this morning, marking Erwin Schrödinger's 126th birthday. The picture shows his eponymous cat in a superposition of alive and dead states. The cat-in-box wave function |ψ> shows the amplitude for each of these quantum states to be √(1/2).
|ψ> = (cat-alive + cat-dead)/√(2).
We now know that due to environmental interactions known as decoherence the superposition of these two orthogonal quantum states decays almost instantaneously into either the cat-alive state or the cat-dead state. What is not known is how the world decides between these outcomes (although quantum mechanics allows us to work out the probabilities = the square of the quantum amplitudes: in this contrived example 50% for cat-alive and 50% for cat-dead).

Saturday, August 10, 2013

Sunflower yellow, spirits dark

She only humours me when I try for these art-house pictures.

Clare with sunflower

"Making Games with Python and Pygame" (by Al Sweigart) arrived this morning. The first thing you do is go to the website and download Pygame, a piece of cake according to chapter 1: in my heart I knew better.

This explains the following couple of emails sent off to Mr Sweigart & currently awaiting reply. Start at the bottom and work up.
Clare Youell and Nigel Seel (cy.and.ns@gmail.com)
12:49 (49 minutes ago)
Subject: Fwd: Failure to get Pygame imported (a 64 bit OS problem?)
to al@inventwithpython.com
________________________

Dear Al,

From here: http://stackoverflow.com/questions/4676433/solving-dll-load-failed-1-is-not-a-valid-win32-application-for-pygame 

"It could be due to the architecture of your OS. Is your OS 64 Bit and have you installed 64 bit version of Python? It may help to install both 32 bit version Python 3.1 and Pygame, which is available officially only in 32 bit and you won't face this problem.  
I see that 64 bit pygame is maintained here, you might also want to try uninstalling Pygame only and install the 64 bit version on your existing python3.1, if not choose go for both 32-bit version." 
Yes, I installed the 64 bit version of Python 3.3.2 as my machine is running a 64 bit operating system. Do I have to re-install Python in its 32 bit version to use Pygame? 
I am not sure the 64 bit binary mentioned above for Pygame works on Pentium T4300 dual core processors. 
Thanks, 
Nigel.

---------- Forwarded message ----------
From: Clare Youell and Nigel Seel
Date: 10 August 2013 12:31
Subject: Failure to get Pygame imported
To: al@inventwithpython.com

Dear Al,

Sorry to bother you but I can't even get started.

I'm using a Windows laptop with Windows 7. 
 
I downloaded http://pygame.org/ftp/pygame-1.9.2a0.win32-py3.2.msi
and ran the installer with C\Python33 as target (I'm using 3.3.2).

Typing import pygame into the Python interpreter produces:

Traceback File "<most recent call last>:
File "<stdin>", line 1, in <module>
File "C:\Python33\lib\site-packages\pygame\__init__.py", line 95, in module>
ImportError: DLL load failed: %1 is not a valid Win32 application


I have no idea what this means or how to fix it. Help!

Thanks,

Nigel.
__________________________________________________________________

UPDATE: Saturday afternoon  (speaks for itself).
Dear Al,

Please disregard earlier emails. After a lot of messing around I discovered that the problem is incompatibility between the current Pygame and recent Python releases. The only thing which works with Pygame version pygame-1.9.2a0.win32-py3.2.msi is Python Release 3.2.5 -- which I have now installed.

I can see that it's a major headache trying to keep Pygame synchronised with the main Python development stream.

Best regards,

Nigel.
__________________________________________________________________

And Al replied: (Saturday evening).
Hi Nigel! I'm glad you got it figured out. Pygame for 3.3 is available, but for some reason they don't have it on the main download page. You can find it here though: https://bitbucket.org/pygame/pygame/downloads.

Friday, August 09, 2013

Proximate wildlife

Seen in our garden today.

Infeasibly large for a bird: a bat?


I was this close: very tame or very stupid

Update Saturday: Turns out that the tame dove (aka pigeon) is much loved: there was a poster on the telegraph pole outside our house this morning advertising its loss. We called the number when the bird re-appeared this afternoon and a much-distressed young woman and her husband turned up with a cat-basket. Via the loan of our step-ladder they coaxed it out of our tree (actually, he just climbed up and grabbed it) and with much joy the reunited creature was driven off.

I would have videoed the whole saga had I not been intimately involved in the retrieval.

Thursday, August 08, 2013

Object-Oriented Programming

I remember when Smalltalk first came out, with its new programming paradigm. I even took a course (in Watford! ) but never used it for real. After  narrowly avoiding brain damage through use of COBOL at the start of my programming career, I was actually paid to write code in ML and Lisp - elegant functional programs which used recursion, had functions as first-class values and eschewed side-effects in favour of returning values.

I am finding it hard to get my head around OOP in Python. I keep expecting methods to return values (let's say I have a strong ethical bias that they should! ) but it seems we're mostly about changing the values of instance variables by side effect or assignment. I struggle to suppress nausea.

My attempts to rewrite my simple resolution theorem prover in an object-oriented style have foundered under such continuing mis-expectations: after two hours I've just managed to get the 'clause' class with its methods defined correctly. Many minutes were spent staring at the screen in plain bafflement.  Why is it doing that???

However,  I do buy into the superior modularity and encapsulation so will persist with objects till they come naturally!

One year of the 5:2 diet

It's been one year since Michael Mosley's Horizon programme on intermittent fasting; one year since I started a calorie-restricted diet two days a week. And here are the results.


Month Date Stone Lb Pounds Kg Δ(Lb) BMI Height (m)
0 07/08/2012 13 8 190 86.4 27.20 1.782
1 08/09/2012 12 13 181 82.3 9 25.91
2 06/10/2012 12 7 175 79.5 6 25.05
3 08/11/2012 11 12 166 75.5 9 23.76
4 08/12/2012 11 6 160 72.7 6 22.90
5 08/01/2013 11 2 156 70.9 4 22.33 Waist
6 10/02/2013 11 1 155 70.5 1 22.19 34.5 inches
7 09/03/2013 11 0.4 154 70.2 1 22.10
8 09/04/2013 10 12.2 152 69.2 2 21.79
9 11/05/2013 10 10.8 151 68.5 1 21.59 34 inches
10 11/06/2013 10 10.6 151 68.5 0 21.56
11 11/07/2013 10 13 153 69.5 -2 21.90
12 08/08/2013 10 13.2 153 69.6 0 21.93
I started at 13 stone 8 pounds and have finished at around 11 stone. Let's say a weight loss of two and a half stone. My BMI has changed from an overweight 27 to a healthy 22. My NHS markers for blood glucose and cholesterol seem good. So here are some of the lessons I learned over the year.

1. You will feel hungry

It's sad but true. It's impossible to lose weight - to fast - without feeling hungry. The body, looking on fat as insurance against lean times, prefers you to forage rather than draw down the fat reserves. Hunger is its message: ignore it - tomorrow you get to eat again.

2. Weight loss does not equal fat loss

A pound of fat contains 3,400 calories (you need about 2,000 a day to operate). If you don't eat a thing, you will burn - over a day - about half a pound of fat.

A litre of water weighs a kilogram, 2.2 pounds. If you drink you will gain weight; if you eat you will gain weight; if you go to the toilet you will lose (a little) weight.

After a recent holiday my daily weight fluctuated over a week between 11 stone 3 lb and 10 stone 12 lbs, a difference of five pounds (plus or minus one kilogram). Losing fat is watching that kind of interval steadily reduce in its endpoints.

3. The 5:2 diet is not a road to anorexia

Once the fat had burned off at the six month point, my weight plateaued at c. 11 stone and refused to stay much lower. On an eating day you would be frankly appalled to watch me at dessert.

4. Fasting and exercising

About half-way through the process last year, I joined the local gym and began hour-long workouts three days a week. I soon discovered that it's:

a. Not a good idea to fast the day before a hard gym session: no energy.

b. Not a good idea to eat nothing after a gym session: no protein repair.

So I schedule gym sessions after a day of eating. When I return home I have a protein-rich salad (c. 5-600 calories) if it's a fast day, eating nothing else. I estimate a gym session burns around 400 calories.

5. It's more about cell-repair than dieting

Best not to forget that Mosley's programme promoted intermittent fasting as helping to fight cancer and diabetes - fat loss was was a desirable side effect.

So, we carry on.

Tuesday, August 06, 2013

The perils of ageing fathers

A post "Paternal Age" published a little while ago over at West Hunter.
"Decode Genetics has a new report out in Nature that shows how mutations increase with age, by sequencing family trios. They found that women contribute about 15 de novo mutations, independent of age.

"Men contribute more (55 on average) , and the number increases rapidly with age. They found that the average 20-year old father passed on 25 mutations, while the average 40-year old passed on 65, an increase of about two mutations per year of paternal age.
"
To be precise: if you are a woman and you have a child with a husband aged 28, your infant will on average have 15 + 41 = 56 mutations. Wait another ten years and your unfortunate baby will be 76 mutations worse off. These mutations are unlikely to be good news for your new offspring.
"The researchers talked about the problems caused by these de novo mutations – things like schizophrenia and autism. We already knew that such risks increased with paternal age, but this work quantifies the mutations responsible. 

"Stefánsson opines that the higher mutation rate with older fathers is not that worrisome, since the absolute risk for schizophrenia and/or autism is still small (~2%) and since mutations are our friends: “You could argue what is bad for the next generation is good for the future of our species.
“
A piece of very sloppy thinking. It's true that mutations generating a very deformed worm, for example, might have ended up as pre-adaptations for limbs and a great future for ambulatory critters (not a great consolation to the ancestral worms if they valued wriggling but sadly went extinct).

Humanity's unique selling proposition is intelligence, a bio-engineered function depending on the exquisite coordination of thousands of genes. You can get more intelligence by mutations (we are, after all, smarter than monkeys) but you need pretty hard selection (i.e. lots of pre-reproductive deaths) to eliminate the overwhelming majority of useless/deleterious genetic changes.

Greg Cochran continues
"Well, not for the first time Kari Stefánsson is wrong. If mutations with large effects are more common with increased paternal age, mutations with small effects must also be more common. Those small-effect mutations are removed slowly by natural selection, and so they accumulate with time. This eventually results in a population in which everyone has a higher genetic load, not just a few unfortunate kids out of each generation.

"... more genes are expressed in the brain than in any other organ, meaning that the fraction of new mutations that will affect its functions is the highest.

"So, what is the likely consequence of a higher paternal age? Population B will eventually be significantly dumber and crazier than population A."
In a small and statistical way, that fate also applies to the children of ageing fathers today.

Brandeston Hall

Adrian is helping out with the management at Kids Klub Brandeston Hall, which has its own facebook page. Here he is with some of the current clients.

Adrian (on right) with the staff

They also put together a rap-style 'pirate video':
"The dread pirate Aidy has stolen our precious rum and that's just not good enough says Captain Becky! "All hands on deck" she cries to the new pirate recruits. Their mission is to follow the clues and find the pieces of treasure map which will lead them to the buried treasure and hopefully our beloved rum! Will they get revenge on the dread pirate Aidy who is cleverly disguised as a centre manager?? Follow our crew on their quest and the fun they had along the way!"
You can check it out by clicking here.

Monday, August 05, 2013

Reasons to be sickly

We try to keep an eye on the cat while we're away - our network of house surveillance cameras produces images like this one.

What the kitchen catcam sees

His food, already somewhat depleted, can be seen on the blue tray. He really doesn't like the hard tack and this may explain why he vomited so much of it up in our absence ...

The Economist has a feature this week on 'Neuromorphic Computing' - designing machines which faithfully replicate the neural design of the human brain. The principles of this new (and increasingly well-funded discipline) include:
  • low power consumption (human brains use about 20 watts, whereas the supercomputers currently used to try to simulate them need Megawatts); 

  • fault tolerance (losing just one transistor can wreck a microprocessor, but brains lose neurons all the time); and 

  • a lack of need to be programmed (brains learn and change spontaneously as they interact with the world, instead of following the fixed paths and branches of a predetermined algorithm).

The article concludes:
There remains, of course, the question of where neuromorphic computing might lead. At the moment, it is primitive. But if it succeeds, it may allow the construction of machines as intelligent as—or even more intelligent than—human beings. Science fiction may thus become science fact.

Moreover, matters may proceed faster than an outside observer, used to the idea that the brain is a black box impenetrable to science, might expect. Money is starting to be thrown at the question. The Human Brain Project has a €1 billion ($1.3 billion) budget over a decade. The BRAIN initiative’s first-year budget is $100m, and neuromorphic computing should do well out of both. And if scale is all that matters, because it really is just a question of linking up enough silicon equivalents of cortical columns and seeing how they prune and strengthen their own internal connections, then an answer could come soon.

Human beings like to think of their brains as more complex than those of lesser beings—and they are. But the main difference known for sure between a human brain and that of an ape or monkey is that it is bigger. It really might, therefore, simply be a question of linking enough appropriate components up and letting them work it out for themselves. And if that works perhaps, as Marvin Minsky, a founder of the field of artificial intelligence put it, they will keep humanity as pets.

It's not science-fictional to imagine that we might have a conscious computer system within a decade or so; within most of our lifetimes for sure. How do we ethically debug it - or turn it off?

Saturday, August 03, 2013

In which we travel and meet relations (pix and videos)

We arrived back this morning to the yowling of the cat which immediately threw itself at Clare's ankles begging for forgiveness. Inside the house we found the dried remnants of cat-vomit on:  our bed, the bedroom carpet (several), the back bedroom bed, the kitchen floor, and the new couch.

Our week had started in a cottage near Tenbury Wells, Worcestershire staying with Clare's relations. The picture below shows an approaching thunderstorm but in truth the weather was mostly good and we were able to take in the delights of Stokesay Castle and the indifferent attractions of Ludlow and Leominster.

The world divides into those who sing karaoke and those who would rather die: likewise charades. It's sometimes hard to predict who will jump into the cold water (Clare after a few drinks) and who will stay warm and dry at the edge and just take the video (me). Clare is trying to convey the word 'Karate' which she has confused with Judo.

Weather approaching our cottage near Tenbury Wells

Wednesday we were in Formby for lunch with more of Clare's relations and friends.

Lil Youell took this video of the meal. Mr Tarantino had better watch out!

Then we were on the road again to Clare's cousin in Chester, ending the day at the Premier Inn, Macclesfield.

Clare and the ascent of Mam Tor

Thursday we visited "Pemberley" (Lyme Hall and Park). Actually we got as far as the entrance drive with its tantalising view of a lake, to be told the house itself was closed that day: something about 'not too much light'. We spun the car and moved on to Mam Tor where we managed an ascent of, oh, I don't know, maybe 150 feet? (And never returned to P.).

The old Sheffield-Manchester road (built on shale)

In fact the dismal state of the old Sheffield-Manchester road is pretty impressive. Built on shale, it has slid off the mountain on numerous occasions and was finally abandoned as too expensive to maintain. Today it's even a challenge for mountain bikes.

Holly has these flowers - who knew?

Yesterday we took in the tiny but perfectly formed gardens at Hare Hill, followed by the enormous and wasp-ridden estate at Tatton Park.

Tatton Park - the Mansion

Deer at Tatton Park

Clare fretted about the famous deer all the way through, and we finally spotted them as we were driving out. In the evening we had dinner with my nieces and their partners at Sutton Hall, Macclesfield and returned this morning real early (6 am start) with the motorway still packed.

Good timing: as I write the thunder is roaring and it is chucking it down.