Archive for the 'Life' Category

Jan 28 2012

Here’s to us, we’re no deid

Published by Dougal under Friends, Health, Life

We are on our way to a Burns supper in Morningside this evening, though I feel unsure about the whole proceedings. 

Last year we went straight from a Sunday night roda to the Burns supper and generally felt great. Through some freak event I was the only fellow to wear a kilt and so was “volunteered” to give the toast to the lassies.

This year I feel much worse. I am not sure if this is medical problems, the effects of being back on a full dose of medication, work stress, the weather and travel, Helen’s studies or a grand mixtur of them all, but I will not be wearing a kilt this evening.

Out of the three capoeira classes since the beginning of the year I have missed two from injury. I need to feel more alive.

No responses yet

Jan 26 2012

All I need is a wardrobe and a lamppost

Published by Dougal under Life

One day pouring rain, the next day snow. At least I’m not worried I shouldn’t have got waterproof panniers.

What the fancy panniers don’t do is make it any easier to ride face first into the snow — that was exciting! — or salve my extremely sore bum from my ice slip this morning.

I think I just need to make it a rule that I don’t ride straight out of the station in the morning until the weather improves. That short stretch of road isn’t well used, is twisty, sits on a hill and is in the shadow of the rising sun. A recipe for pain which I would do well to remember.

No responses yet

Nov 29 2011

Bike lights

Published by Dougal under Life

The clocks have been changed for a month now and this has made a massive difference to my commute. Whereas before I would leave the house as light was beginning to creep into the world, and arrive home as the last light was dying, I now leave the house in partial daylight and return home in full darkness.

Amongst other things, this has turned my thoughts to bike safety when cycling in low light conditions. As Helen pointed out, the first thing to do is investigate the findings of the Evidence-Based Biking community. What is actually effective on the roads in darkness? The Cochrane Library, source of “independent high-quality evidence for health care decision making”, has a survey covering the topic of night-time visibility of pedestrians and cyclists. Sadly if you pin your hopes on the studies available you have to be content when they say “not enough evidence to make a conclusion”.

The one interesting aspect brought up by the review is summed up in this statement from the results summary:

Retroreflective materials enhance recognition, in particular when arranged in a ‘biomotion’ configuration, taking advantage of the motion from a pedestrian’s limbs.

I was very aware that while my bike was reasonably visible (lights, reflectors) my body was not. So actions like signalling were largely invisible, especially in rain where everything is glistening and car windscreens are harder to see through. So it’s odd that high-viz cycling jackets don’t emphasise either the arms or the general human body shape in their design.

I’ve got myself a new rear light just to be on the safe side. But on my searches I came across this extremely cool Tron-light-cycle system which is still in development, which looks like it has great potential to push us from bike lights being “torches strapped to bikes” to something which is designed around the bike itself. I wish the developers luck with their project. And maybe in a few years we’ll all own lights like this…

One response so far

Oct 09 2011

Bike to work

Published by Dougal under Life, Work

I’ve recently started commuting to work by bike which is both more enjoyable than walking and gets me there quicker. There are a few downsides but they’re small enough that I’m going to continue like this until the weather really forces me off the road.

I was initially quite afraid of the ride through the centre of Glasgow. There are lots of one-way streets, really steep hills and traffic lights. I was even contemplating leaving the bike at the station overnight and commuting through town by subway. But a few more days of the inner-city commute set me at ease. It can be a bit daunting but I know the route now, and I know the tricky points and where to position myself so I’m not trapped by buses and so on.

Bike to Work Day at the Mid Market Energizer Station

The train is also good. There’s a bike carriage on every train with six hooks to hang bikes. The biggest problem is caused by station staff who create deliberate bottlenecks (!) on the platform ends during peak commuter times, which cause all the following trains to be late. I honestly can’t believe it’s more worth their while to start off the day behind schedule than to just employ enough conductors for the trains.

My work isn’t the most cycle-friendly environment. There’s nowhere particular to chain up a bike, so mine gets tied to the banister at the foot of a stairwell, next to the mops and Slippery Surface signs. Classy! There’s also no shower/changing facilities and the toilets are a bit of an offence to hygiene, so things could be better. But then who puts an office in an industrial estate in the middle of nowhere anyway?

My next steps are to get some panniers for the bike, to reduce the need for a rucksack (which just makes cycling hotter and sweatier) and get more familiar with maintaining my trusty steed. I would have said “I can probably pump up the tyres without assistance” but since the front inner-tube was involved in a “rapid deflation event” last time I tried to pump it up maybe that’s not true! If I suffer a puncture en route I just have to walk it to my destination as I don’t have the immediate skills or materials to patch things up.

2 responses so far

Oct 08 2011

Trip to China (pt 3)

Published by Dougal under Life

Our first big trip out in Xi’an was to the city walls, which are huge and intact. So huge that you can hire a bike to ride round the entire thing, which takes about forty minutes if I remember.

We first walked through the streets at the base of the walls, past the calligraphy stands and the vendors of tourist tat, and came to rest in a quiet garden just outside the walls. We sat in the shade with other people enjoying the calm, just two minutes walk from the main busy roads.

View from the city walls

This was our first step from industrial China into something reminiscent of ancient China from films. The greenery seemed right, the pigeons were suitably exotic and even the concrete shaded walkway was made to a different design than it would in the UK.

Shaded in a tranquil public garden

The people lazing around us got in some good staring at this point. The gawping never really disappeared, though it was less common in Beijing than Xi’an. The only occasions on which we weren’t the centre of attention was walking down the street with my brother and his girlfriend — a Chinese girl and a pasty Westerner holding hands attract much more attention than we ever could.

When we found the steps up to the wall itself it was a bit disappointing. If the air had been clear we could have seen across the city in all directions. But Xi’an is enveloped in a cloud of perpetual smog. The temperature is in the mid-30s but you never see the sky. In the late afternoon we often looked into the sky and though “oh look, it’s the moon”. It was the sun, shining as hard as it could but still looking wan and inconsequential. There were no shadows on the ground. The temperature didn’t really drop at night. It was all very disconcerting.

Standing on the city wall

We walked a quarter of the wall, or a bit less than, until we were tired and hungry. We then wandered the streets getting stressed and angry, and ever more lost, until we found something to eat. And food fixed everything.

That looks really good

Comments Off

Sep 28 2011

Trip to China (pt 2)

Published by Dougal under Family

As promised, it’s time to continue the record of our recent trip to China. My brother lives in a new high-rise flat on the edge of Xi’an, in an area still under massive construction. In fact the bottom floors of his building weren’t even finished. I’m not sure if they built all 26 storeys from the top down.

Inside the house are my brother, his girlfriend and five (!) cats. The tale is that he used to have two cats but one died. He bought a companion kitten for the lonely cat that was left… but this kitten turned out to be pregnant. This kitten, illustrated here, is now known simply as “Mama”.

Mama

And she’s no longer a kitten, obviously, because she’s got three of her own — Milk, Chocolate and Milkshake, who are white, black and a mixture of the two colours, respectively.

Life revolves around the low table in the living room, and in drinking tea.

A relaxing cup in the afternoon

This is the same style of tea-drinking that my brother treated us to for my birthday when he visited Scotland last year. It involves lots of heating cups and rinsing the tea and very fast infusions (seconds). The tea is poured into tiny little cups, like espresso mugs. It was very different from British tea-drinking — and the ceremony (well, the process anyway; there was no formality) was something that became quite comforting for all its strangeness.

Tea

Near the flat there were a couple of supermarkets which gave us our first glimpse of Chinese consumerism. Oddly, many of the shops reminded me of Chinese supermarkets in the UK. I wonder if the same holds for other immigrant supermarkets? Are all the Polish convenience stores on Leith Walk just like they are in Poland?

It’s amazing how little one can determine from some packaged products. You’d think many mass-produced items would have simple pictures to let you know what you’re dealing with but that isn’t actually the case. And any English description which did appear could be suspect to say the least:

Missing some nuance

We saw many great Engrish slogans, and t-shirt watching became a full-time occupation in the crowded parts of the city. The glossy branded products were also not above some awkward or ill-advised English text:

As sold by the Vatican

Not really in the spirit of the One Child policy, is it?

3 responses so far

Sep 27 2011

Trip to China (pt 1)

Published by Dougal under Family

Helen and I recently went to China. China! It’s a long way away and my brother’s been living there for several years, so I don’t see him often. We visited him in Xi’an — but first things first. We took a lot of photos there and I’m slowly putting them all online. I’ll try to blog about them as they appear.

We left Edinburgh airport at some unreasonable hour in the morning and arrived in Charles de Gaulle airport for six hours of hardcore sitting. I read my book and Helen slept for much of the time, though we took some time out from this rigorous schedule to pay through the nose for a bottle of Coke. Even €3.80 wasn’t enough to dampen the spirits:

Holidays ahead!

Then we hopped on the second leg of our journey to Beijing, which was longer and less comfortable. Ten-and-something hours later we landed in an extremely foreign country. The words were not related to any words we knew, and the writing even less so. Somehow, through gesture and confused looks we got a bus to Beijing West train station and then onto the sleeper train to Xi’an.

The restaurant car was our first attempt at prolonged transaction and ordering a meal. We got some things on plates and a couple of beers, and that was all we could really ask. The staff and train crew sat and smoked underneath the no-smoking signs.

Restaurant car

I’ll spare you the picture of my bleary-eyed face as we pulled into Xi’an the next morning. Just be assured that I had really needed that sleep and that the train could have been stationed in a steel works all night and I still wouldn’t have stirred.

Outside the train station in the bright lights of another strange and bustling city, we managed to call my brother’s mobile and get him to meet us. He lived with his girlfriend, Joy, at the edge of town (er, city) which was an hour’s ride away on the bus.

Joy and Ali

I will introduce you to his house in the next post!

2 responses so far

Apr 13 2011

PyWeek April 2011 post-mortem

Published by Dougal under Friends, Games, Programming

Well, it’s been a while since I wrote in this little box. My new job continues to form and my commute has been easier lately, since I’ve been getting a lift from a colleague who also lives in Edinburgh. I get back home in the evening much earlier, which is nice, though the start is still as early as ever (the alarm goes off at 5.30).

But I didn’t break this hiatus to talk about commuting, I promise. Last week was PyWeek, a twice-yearly programming challenge to write a computer game in the Python programming language. Nick was keen to give it a go, so between me, him and Mat we concocted an idea which was just interesting enough that it might be worth playing.

Due to some unforeseen problems we didn’t get much time to write code, so the game didn’t really come together in time for the deadline. I think, in fact, that the code was broken as zero-hour ticked over. Oh well.

Having started we decided to finish, so we all met on Monday night (for the first time since the challenge started…) and got large chunks of the game completed. It’s now playable, I think, though outrageously taxing and quite awkward for one person to play against themselves. The plan, then, is to iron out some of the kinks and see if we can pitch the difficulty at just the right level to make it addictive. Maybe we’ll get it transferred to an Android/iPhone app in the future?

I’ve known these guys for years but we’ve never actually sat down and written a program together for the fun of it. It was really interesting, especially since we were all basically learning Python from scratch for the purpose, and I was trying to remember what all this OO stuff is supposed to be about. Maybe we’ll tackle it again for the autumn PyWeek with a new game idea, more experience and maybe a bit more time scheduled to the task.

Comments Off

Mar 12 2011

Getting embedded in my new role

I’m in a new job. I’ve done one week, so my life has mostly been on hold while I work out how things will fit together. I’m working for Honeywell Security writing embedded software. Similar to before but in alarm systems instead of networking.

The job requires a hefty commute — at least two hours each way if things go well, but between delayed trains and poor weather it’s sometimes an extra half hour on top of that. Which means I get up at 5.30, leave the house before 6.30 and get home in the evening around 7 o’clock. You can see why the rest of my life has been a bit quiet. I’m having to rethink how I look at the week. The arrival of the weekend is important and precious!

I’m still learning the ins and outs of work but the people are all very friendly and helpful, which makes the travelling more bearable. Spending hours travelling to and from a hateful job would be horrible. I spend an hour on the train each way which has given me more time for other things. I’ve been splitting my travelling activities, so that in the morning I read the freebie Metro for a bit and then do some “thinking” to limber up for the day. Recently I’ve been doing simple program calculation exercises, deriving the fusion rules for fold/unfold or map/map and so on. I’m really interested in the idea of deriving correct and efficient programs from executable specification.

(Just to show you what I’m talking about, this is the fold/unfold fusion rule. Let us say there are two functions, foldr and unfoldr defined as follows:

foldr f z     [] = z
foldr f z (x:xs) = f (foldr f z xs)
 
unfoldr g s = case g s of
                Nothing     -> []
                Just (x,s') -> x : unfoldr g s'

The function foldr combines a list of elements according to the function f and unfoldr creates a list of elements from the seed s. We might use foldr to define a product function which combines the elements of the list by multiplying them together:

product = foldr (*) 1

And we might create a list of elements from 1 to n with an unfold.

enumTo n = unfoldr step 1
  where step s = if s>n then Nothing else Just (s, s+1)

The observant reader will have noticed that combining these two separate functions will give us factorial, the product of numbers from 1 to n — first we create the numbers 1 to n, then we multiply them all together.

factorial = product . enumTo

The inefficiency is that enumTo works on producing a list which is consumed by product. The elements are inserted into a list only to be removed straight away. Can we omit the redundant list production? It turns out we can, and we can do it for all cases where foldr operates on the result of unfoldr. The product and enumTo are specific instances of a general method which we can use to fuse production and consumption of values.

This fusion rule can be demonstrated by algebraic manipulation of the programs we’ve defined so far. We’ll call the unfoldr and then foldr by the name hylo, with the naive implementation shown:

hylo f z g = foldr f z . unfoldr g

The equational style here facilitates some nice rearrangements which help to assert their correctness from step to step. Let’s see how this works — each line will be justified by some comment in braces:

  hylo f z g s
= { definition from above }
  foldr f z (unfoldr g s)
= { definition of unfoldr }
  foldr f z (case g s of
                  Nothing     -> []
                  Just (x,s') -> x : unfoldr g s')
= { push foldr into result }
  case g s of
       Nothing     -> foldr f z []
       Just (x,s') -> foldr f z (x : unfoldr g s')
= { foldr on empty lists }
  case g s of
       Nothing     -> z
       Just (x,s') -> foldr f z (x : unfoldr g s')
= { foldr on non-empty lists }
  case g s of
       Nothing     -> z
       Just (x,s') -> f x (foldr f z (unfoldr g s'))
= { definition of hylo }
  case g s of
       Nothing     -> z
       Just (x,s') -> f x (hylo f z g s')

Each step should be clearly equivalent to the one before and the one after, but by the end we have a definition for hylo which doesn’t construct a useless list.

hylo f z g s = case g s of
                 Nothing     -> z
                 Just (x,s') -> f x (hylo f z g s')

Naturally we can use the original definitions of product and enumTo to create an optimised factorial using this logic. The result is that factorial doesn’t create a redundant list either:

factorial n = hylo (*) 1 step
  where step s = if s > n then Nothing else Just (s,s+1)

I think this is beautiful result despite its obvious simplicity. However this has been a long digression, so I’ll stop now. But if you found it interesting I encourage you to check out work on “program calculation”, “program derivation”, “algebra of programming”, “origami programming” and so on.)

My evening journeys have been spent unwinding with a book, though the evening trains are noisier. I’m reading Brighton Rock right now and it’s good though the story makes me feel quite uncomfortable at times. One of the characters seems close to doing something wild and dangerous and it’s a fight between “must find out what happens” and “can’t bear to read any more” on a daily basis.

I hope week two will be easier and I will start to feel like my routine is falling into place. Watch this space.

3 responses so far

Jan 24 2011

Books: Incoming, outgoing and in a holding pattern

Published by Dougal under Books, Friends

Right now I’m reading The Three Musketeers by Alexandre Dumas. It’s really enjoyable so far — whimsical and witty like a 19th-century The Princess Bride (not inconceivable). I’ve got a big ol’ pile of things to get through after that. I still have a book from my birthday in June and a bunch from Christmas too. I came away from last night’s book group with two more — Pathfinders: The Golden Age of Arabic Science by Jim Al-Khalili. I’d been swithering over this one until I noticed the author. He has produced some great science television so I thought his book might be worth it. And Under Milk Wood, a play I associate strongly with my father though I’ve never heard or read it. But I’ve been quoted it a lot!

I took along Seamus Heaney’s translation of Beowulf but no-one was interested. I think a lot of people had book overload and weren’t taking new ones to read. We’re not having our next meeting until March so there will be plenty of time for people to finish the books they’ve got. Hopefully I can deplete my to-read pile slightly by then.

One response so far

Next »