Tuesday, 26 April 2011

Cyclist tribes

Living and working in central London, you quickly learn that the fastest way around town is to cycle.

My extensive research into this activity has shown there are a number of different cycling tribes. Of course, I have split them into the two groups that are most appropriate to me: 1) slower than me and 2) faster than me. You can probably tell what sort of a cyclist I am by my attitude to the two groups.

1. Slower than me:
  • Wicker shopping basket. Doesn't matter what the rest of the bike looks like, or the biker, I will always try to get ahead of these.  The extra scary ones are the women in flowing dresses who might be university professors.
  • Boris Bikes.  When there's a tube strike, Avoid At All Costs.  These people probably haven't been on a bike since they were in school, and it shows.
  • Hoody (always a male) on a BMX-style bike with the seat far too low, riding in too low a gear, with baggy jeans that show their... well... everything. Never have lights on their bikes.  Always has a satchel / record bag for maximum inappropriately-dressed-for-cycling points. These buggers are a pain because they never obey traffic lights and will join the road from the pavement on either side, cutting you up in the process. Getting past them is easy, keeping them behind you is much harder. 
  • Not wearing a helmet. Probably not a serious cyclist, so probably easy to overtake. A similar category to the hoody, doesn't obey traffic laws and enormously unpredictable. Otherwise known as an organ donor.
  • Wearing a skirt. Of course, this doesn't apply to me. In the same category: jeans, sandals, high-heeled shoes (not all at once). 
2. Faster than me:
  • Cleats. If you have cleats on the bike I'm going to let you go first from the lights. You'll be fast and possibly suicidal when weaving through traffic.
  • Lycra, especially on a guy. Even if they're not faster than me, they will always overtake, and always pull in front of me at lights. It's an ego thing.  Something about those tight shorts possibly.
  • Panniers. Generally, but not always, a “proper” cyclist, even if they're on a rubbish bike. These guys have experience.
One to watch: businessman in a suit on a Brompton. You can't trust these guys, they can be deceptively fast. It's always embarrassing to be overtaken by them. How do they not sweat into their Armani?


Who does that leave?

Well, my lot: helmet, high vis jacket, shorts (knee-length with pockets). Usually obeys the lights, quick enough, some unpredictability when over-/under-taking. Most of these guys will weave to some extent, but not suicidally.  My tribe is probably one of the biggest, and it leads to lots of subtle negotiation at traffic lights - sizing each other up - checking the bike, the kit, the shoes - to decide whether or not to pull ahead or drop back.

But I mess with people's heads in summer by occasionally wearing a short skirt (with shorts underneath, I'm not out to cause accidents) and wedge sandals, and cycling at 20mph.

I hate to conform to expectations.

Monday, 18 April 2011

TradeTech 2011 - Not like a developer conference

I attended TradeTech last week, an annual event about Equities and Derivatives trading. I assumed from the title that there would be a reasonable focus on technology, but I found it was more “Trade” and less “Tech”.

The fascinating thing to me was how different this is from the sorts of technology conferences I've been to. For example, I popped into JAX this week (albeit in the evening for drinks). At technology conferences (<gross-generalisation>) people tend to subscribe to a variety of dress codes and fashion clans, usually from jeans through the range of business casual, including your fair share of goths and alternatives. Suits would be unusual (</gross-generalisation>). At this place, people were scarily conformist. A few years back, the suits at least would be different colours – navy, greys and black – and may or may not include pin stripes. On Thuresday, almost everyone was wearing a particular shade of tasteful dark grey.

I was also pretty shocked at the time people snuck off to go to the pub. Don't get me wrong, I'm all in favour of imbibing alcoholic beverages as frequently as possible.  And I prefer networking in the pub to poncing around in some conference centre. But I feel it's Bad Form, and I was surprised (and a little bit jealous) that it seemed to be the norm. I felt for all of the later presenters.

Still, I showed my support for them and I turned up to some actual presentations.  The most interesting ones to me were Baroness Eliza Manningham-Buller talking about her time as head of MI5, and Richard Peterson going Inside the Trader's Brain.

The Baroness was talking about leadership during times of crisis – she was in charge shortly after 9/11. What I found interesting, and resonated with me, was her focus on her people. An intelligence organisation is all about the people who work for it. She stressed that it was important to bring fun into the work place, especially because it was a particularly traumatic period to be working. She instigated family days and helped the employees show their families what it was they did. I'm not quite sure how much they could show, given the nature of that industry. But I liked that she understood the people were more than just minions, workers in a hive, that they had families and that they wanted to be proud of their work and share it with the significant people in their lives.

She also refused to take credit for anything for herself, but talked about her team, about the people around her and in the organisation. I like leaders who recognise that it's not all about them.

The thing that stuck with me the most is she said that leaders who take themselves too seriously are not taken seriously by their underlings.

Richard Peterson's presentation was about the risk-taking and risk-avoidance areas of the brain. He showed how your risk-taking behaviour is influenced by bias, and how subtle it is. There was a lot of interesting stuff in this, which scratches my random-interest-in-psychology itch, and confirms what I've been reading/hearing about how behaviour can be triggered and changed.

Ultimately he gave some advice for how to reduce the impact the rest of the world might have on your trading strategy, which is applicable to all of us:
  1. Maintain healthy routines
  2. Take time to reflect daily
  3. Letting go
  4. Gratitude
The ulterior motive for me to be at TradeTech was to watch my boss's “How To Do 100,000 Transactions Per Second At Less Than 1 Millisecond Latency?” presentation. This was a cut-down and updated version of the one he and Mike gave at QCon last year. If you are at all interested in concurrency, high performance, or programming generally, it's well worth the hour to watch it. It outlines the architecture we use at LMAX to get very high performance from our exchange without using anything particularly special in terms of hardware. All it takes is good design and something Martin calls mechanical sympathy.

Anyway enough corporate plugging.

Overall I came back from TradeTech with lots of ideas of things I wanted to do at work and ways to help us market the platform in future. I also came back with a certain cynicism for these types of very vendor-heavy events. However, I did meet some interesting people, and it was a different crowd to my usual technical comfort zone.

 And it did get me thinking, which is really all these things should do.

Tuesday, 12 April 2011

CSS for Developers: Horizontal and Vertical Centring

First, an apology.  I will be using the British spelling for "centre", because, well, I'm British.  But it gets really confusing because you have to use the American spelling in the code.  And doesn't "Centring" just look wrong?

Part Five: Horizontal and Vertical Centring
One of the most common things you want to do with blocks of content is to centre it.  In particular, you would think that vertically centring content would be straightforward, but it turns out that in HTML/CSS it just isn't.

5.1 Horizontal Centring
Centring a paragraph of text is clearly easy - all you need is text-align: center.  However, sometimes you want to centre a block, something like a div, without having all the text centred as well.  This is slightly trickier than you might expect, because the only CSS attributes you have are for centring text.


<html>
<head>
    <title>Horizontal Centering</title>
    <style type="text/css">
        #div1, #div13 {
            background-color: #DDDDDD;
        }

        #div2, #div14 {
            background-color: #BBBBBB;
        }

        #div3, #div15 {
            background-color: #999999;
        }

        #container, #container5 {
            border: 1px solid black;
            margin: 5px;
        }

        #container5 {
            text-align: center;
        }

        #to-center {
            margin-left: auto;
            margin-right: auto;
            width: 200px;
            border: 5px solid red;
        }

        #to-center2 {
            margin-left: auto;
            margin-right: auto;
            width: 200px;
            border: 5px solid red;
            display: block;
            position: relative;
            text-align: left;
        }

    </style>
</head>

<body>
<div id="container">
    <div id="to-center">
        <div id="div1">One</div>
        <div id="div2">Two</div>
        <div id="div3">Three</div>
    </div>
</div>
<div id="container5">
    <div id="to-center2">
        <div id="div13">One</div>
        <div id="div14">Two</div>
        <div id="div15">Three</div>
    </div>
</div>
</body>
</html>
Using margin-left: auto and margin-right: auto on the block you want to centre is a neat trick for doing this.  And it works fine in Chrome and Firefox.  However, it's not so great in IE 7:


The trick for getting it centred here (the second block) is to set text-align: centre on the div containing the block to centre (container5), then reset the text-align to left on the centred block (to-center2) so the text isn't centred.  Yes, a total faff.

However, there is some good news.  You can get IE to behave the same way as the more sane browsers by setting it into Strict Mode:


Remember kids: Strict Mode Is Your Friend.  And all you need to do is add the following to the top of your HTML file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
5.2 Vertical Centring
<html>
<head>
    <title>Vertical Centering</title>
    <style type="text/css">
        #div1, #div4, #div7 {
            background-color: #DDDDDD;
        }

        #div3, #div6, #div9 {
            background-color: #999999;
        }

        #div5 {
            height: 40px;
            line-height: 40px;
            background-color: yellow;
        }

        #div2 {
            height: 50px;
            background-color: orange;
            vertical-align: middle;
        }

        #div8 {
            height: 40px;
            line-height: 40px;
            background-color: cyan;
            font-weight: bolder;
        }

        #container1, #container2, #container3 {
            border: 1px solid black;
            margin: 5px;
        }

    </style>
</head>

<body>
<div id="container2">
    <div id="div4">One</div>
    <div id="div5">Two</div>
    <div id="div6">Three</div>
</div>
<div id="container1">
    <div id="div1">One</div>
    <div id="div2">Two</div>
    <div id="div3">Three</div>
</div>
<div id="container3">
    <div id="div7">One</div>
    <div id="div8">Massive line of text that needs to wrap to show the centering totally doesn't work when you have more than one line of text.</div>
    <div id="div9">Three</div>
</div>
</body>
</html>
Given some of the problems with horizontal alignment, it shouldn't come as a surprise to find vertical alignment is not simple at all.

Us straightforward developer types would expect to be able to put vertical-align: middle on a div and expect all content inside that div to be, well, vertically aligned in the middle.  However this is not the case - see the orange block above.  A quick Google will tell you why this doesn't work, and I don't intend to duplicate the explanation here.

There is a nice hack which works for single lines of text though: if you set the height of the container and the line-height to the same value, the text will be vertically centred within that container (see the yellow panel, div5, above). This works really well for things like buttons or icons.

However, it doesn't work so well for paragraphs of text or sentences that might wrap, line-height is for a single line of text only.  See the cyan panel above for what happens if your text wraps.

I'd love to give you an answer on how to get this to work for text that wraps, but I haven't found a satisfactory solution yet.  What I usually do is set a fixed height on the container and then set the margin on the text so that it sits in a way that looks vaguely centred.  Not a solution I'm happy with, because a) it can sometimes render slightly differently on different browsers b) it's a very fragile solution if you're going to internationalise your page as some languages will have longer or shorter paragraphs and c) it feels like a massive hack.

If anyone has a nice solution for vertically centring paragraphs of text I'd love to hear it.

Monday, 4 April 2011

How to show your employees how much you hate them

Due to a combination of my restlessness, my consulting experience, and employers that insist on moving offices frequently, I've had the dubious honour of working in a variety of environments.

Today I will teach you, the employer, how to show your staff just how much you hate them.

The Kitchen Is Not For Eating In
Since eating and drinking is unfortunately a fundamental part of being human and staying alive, you will need to provide your staff with a space that pretends to address these needs.

The best example I have seen so far has been a "kitchen" with: no sink; no kettle; no microwave; a tiny under-counter fridge for employee food (for approx 50 employees); nowhere to sit and a maximum capacity of 3 people standing. You're probably wondering how I knew it was a kitchen.  Well, it had a counter top. And a coffee machine which also dispensed slightly warmed water.  And The Largest Drinking Water Dispenser In The World1.

The most important thing to remember here is that This Is Not A Communal Space.  Heaven forbid that your minions actually talk to each other.

For bonus points: if you really want to show your code monkeys how much you despise them, you can dispense with the coffee machine entirely and supply only Nescafe Gold Blend instant coffee.  Honestly, developers don't care what form their caffeine comes in2.

The Importance Of The Loo/Bathroom/Restroom
(Note for our North American brethren - there's no bath in there and I certainly don't go there to rest.  Can we call them toilets and be done with it?)

If the cubicle door looks like it's already come off the hinges a couple of times and been sellotaped back on, if the cubicles are made of plywood, if there's a genuine chance that someone could get trapped in there by the dodgy door lock, if the loo paper is that tracing paper you used to get in school, perfect. You've managed to convey to your staff just how little they mean to you.  If you have been successful in this, your employees will show you exactly how they feel about you by the state they leave the bathrooms in.

For bonus points: don't pay the cleaning staff enough so the paper and towels aren't replaced frequently.

The Office Canteen Is Also Not For Eating In
If you've done your job correctly with the kitchen and the toilets, your employees are probably desperate for somewhere they can congregate.  You must not allow this - if they get together, they could have Dangerous Conversations, where they Share Ideas and Collaborate.

A rookie mistake would be to not provide a canteen at all.  Do not fall into this trap! If you don't provide food on site, your staff will leave the building, and who knows where they're going to go, what they'll get up to, who they might meet?  No, you want to provide them with facilities you control.

However, you want them to go to their miserable little cubicles to eat, so make sure there isn't enough space for them to sit in the canteen.  For best results, provide a couple of tables and chairs but ensure they're always filled.  That gives them elusive hope that maybe, some day, they will be the ones on that table.

For bonus points: have a separate management restaurant.  This should be visible enough that your employees are aware it exists and that it's better (table service, for example), but private enough that it becomes a mythical place. Then you must make sure they know, every day, that they are not allowed to use it.

Go For Tones Of Grey And Brown
Nothing says "your life is worthless" like a 1970s-council-style-office.  If it's made of concrete and has laminated mirrored windows, so much the better.  To go the extra mile, put up 10 foot high "inspirational" photos of people playing on beaches, in black and white.  That way your employees will remember that there is an exciting world out there, but they can't get to it, and they can't even enjoy it by proxy in this miserable, monochromatic office.

For bonus points: your cupboards should all be laminated Formica, in murky brown.

Reduce Natural Light Sources
I used to think that working in a basement was the worst fate that could befall me. After I did it twice, I swore to never again work in an office with no natural light.

However, there is an even more devious way to make your staff miserable. Ensure there are windows in the office, nice big ones.  Then build cubicles throughout the floor, so that your employees can see there is a window, but they cannot see out of it, or receive any actual light from it.  Watch them pine and fade away, or fight over the desks close to the window.

For bonus points: make sure the people closest to the windows have their monitors angled for maximum screen glare.  Then these unfortunates will close the office blinds voluntarily, and really minimise vitamin D production in your minions.

Provide Beds/Bedrooms In The Office
Now, you might be thinking that this is a little cushy for your minions.  I can assure you, the drain on morale is worth it.  By providing beds, you don't have to shell out for expensive hotels for visiting employees, or for taxis for those who have to work late.  It gives your staff the message that they belong to you, you even own their sleeping hours.

For bonus points: put the bedrooms on the Management Floor (you know, that special floor for those who have Made It), so that your lowest-level employees have to walk through this opulent splendour in order to grab a couple of hours of poor quality sleep, before being herded back into their cubicles to put in another 20 hour day.


In Conclusion
It doesn't matter what size company you are, by following some or all of these rules you can successfully communicate to your Peons just how meaningless their little lives are to you.  Large companies seem to be particularly good at this, but a determined start-up can also alienate all three of its employees if it tries.

By showing your staff how much you hate them, you are sure to attract and retain the best quality people, and motivate them to work hard and efficiently to realise business value for you.

Oh wait....



1 It was the size of a wardrobe. All it did was filter and UV "purify" tap water. It also claimed to be smart, it would dispense a cup if you needed one and detect if you didn't. It attempted to determine the size of the container you placed in it and fill it appropriately (and failed every time). It would tell you how many seconds were left until it had finished filling your vessel, but not give you the option to stop it, or to continue for longer. Seriously. A tap would have been fine. 


2 In case you don't know - they really DO care.