Category: Uncategorized

Review of Better: A surgeons notes on performance

Better: A Surgeon's Notes on PerformanceBetter: A Surgeon’s Notes on Performance by Atul Gawande
My rating: 5 of 5 stars

This book is an easy read but very thought provoking.

One of the most interesting bits was where he examines the difference between the average Cystic Fibrosis centres and the best ones. All human activity has a bell curve attached to it, but CF treatment is very well understood and systematic. So why does one centre have startlingly better results than another?

In essence the better centre didn’t compromise, they didn’t think that (for example) 80% lung function was good enough, the patients under their care were expected to have 100% or better.

It’s the difference between 99.99% and 99.5% – we’d all be happy with 99.5, but excellence is in the remaining fraction of a percent, because when you add this up over several years this tiny difference means a lot. The sums are simple 99.5 over 5 years will give 97%, 99.99 will still be 99.99 or thereabouts. If you take this up over a patient’s life of 30 or 50 years the difference would be even more apparent.

I’ve hit this in other walks of life, for example project management, where you maybe have a 0.9 chance of finishing on time every iteration. This means that the chances of still being on track are as low as 0.6 after 5 iterations – it’s just mathematics. When building software having a fire break every so often to deal down the technical debt and reset the projects is perfectly doable, but if you’re looking for excellence in medical care or some other industry that could kill people then you have to become fanatical about getting higher scores

There are plenty of other excellent articles in the book, the fight to eradicate polio and the crazy situation faced by doctors in India are really great articles, and I learned a lot about how we could really help the people in poor countries. I admire Gawande’s honesty about his own shortcomings, this gives the writing a validity that it would otherwise lack. And the nutty unjust system that is the law based compensation for medical errors, that wrecks the chances of the poor to get help and helps no-one but the lawyers.

View all my reviews

Nearly midnight, again

So here we are again, it’s the middle of the night and I should be asleep. Instead I sit here waiting for the evening to be over. It’s dark outside but for the street lights. I wonder which of the endless layers of me is writing this, what obscure trophism is pretending to be me right now, creating the narrative force that pretends to be I.

I could be angry or frustrated, or so many things at once. The mind is an endless running brook split by rocks. The streams join together and I emerges out of the wreckage of all of the conflicting pieces, a pretence of a coherent whole. One never sees this sleight of hand except when you do bad things. The doing and the justification rarely hold up when you place them firmly under the microscope. So few people ever do, they just stumble from one moment to the next, thinking they are thinking and deciding things. But it’s all the dance of chemical chimera.

Longer ago than you can count stars exploded and made the matter you are made of. You sit at the bottom of a gravity well, perfectly adapted to what is in front of you, the chain of circumstances, of causes and conditions goes back beyond even those stars.

They died for love, for love could never have existed without them. But they had no mind, no awareness to die for it. Just like sand accumulating on the beach, it is ineluctable and happens without a master plan. So too, this whirling of circumstances that manufactures I will be gone and never seen again. The Buddhist masters say that the lives connected with you are like bricks on top of one another, the wall would not stand without that connection: but I begin to feel that the bricks are just bricks, the connection is the connection behind everything – the fragile I just makes itself and leaves enough traces to allow another one to stand in its place with some of the same attributes.

So let it go, now, and embrace it too. 

It’s not a bug. It’s a feature.

I like Android development. But you go off the beaten path and, well …

I’ve written some custom ListView objects that get rendered depending on what kind of device is needed for a home automation app I’m working on.

So far so bad.

Now you need to be able to turn that device on or off.

Tricky.

On the phone’s screen there is a button for every item displayed, each showing the correct value. 

BUT … inside it reuses the object that has been created. I have attached listeners to the button that mean when you toggle it off or on it sends a message to the underlying device.

It does. But then it sends messages to ALL the devices of the same type, because I’ve attached the listeners to what is basically the same GUI over and over again. So it looks right on the screen, but underneath all that happened was things were set in the right order so they display correctly. Right at the end of the call chain it sets the value back just for fun.

OK – let’s get it to tell me the ID of whichever row was tapped and only allow commands to be sent to that device. Nope. The button has the focus and won’t tell it’s container there was a tap and I’ve tried all the suggestions google could find for me. So the listener doesn’t ever get fired.

I think I’m going to have to short circuit the views and create them by hand, so each is a separate object with its own button etc. defined with its own listeners.

List View is designed to work with thousands of elements of homogenous data that can be tapped on and treated as a unit. But actually, for the case where there’s only a few that might have other things on them, it just doesn’t work.

I’ll have another look on line tomorrow.

By the way – I’d lay money that iOS Table View has similar problems, before people start doing the fanboi thing.

Take what the defence gives you – coding

I’ve recently listened to Steven Pressfield’s Turning Pro about 10 times driving up and down the motorways. I can’t recommend it highly enough. One of the things he talks about are the things that get in the way of getting things done, of pursing your art and doing what you have to do when you turn pro.

So, some days you just can’t get your mojo on. The pro doesn’t let this stop the work happening. So you take whatever you can get today and work with it. In sporting terms you’re having a day where you can’t make progress against your opponent. So you take what the defence gives you and push on. 

So when you look at what you need to get written today and don’t know how to start do the little things you can do and let the ideas percolate through your head. This is similar to the technique where writers just start writing anything that comes into their heads. When you do this it gets you moving and when you are moving you are not stuck any more.

So take what the defence gives you, take the steps you can take. You can’t do the big stuff all the time. But keep moving, that’s what works.

Android and mobile, purity, who cares?

Been doing Android dev full time for a few weeks now. I have to say I’m enjoying it. I also put myself through iOS training and have been doing some of that. Really enjoying that too.

I think I’m fed up with web apps, and all the arsing about you have to do to get things going and stoping useless bastards breaking your site. I can just fire up an IDE, and I’m there with mobile.

Beginning to think that the web will become the cloud (ha ha) sooner or later and most things will generally run as native mobile apps talking to servers (that used to be web servers). This will also take web apps away from the current Jesus-it’s-JavaScript-with-bouncy-shit car crash, the (web) interfaces will become simple again, because most of the time you’ll only go onto a site where a phone screen is too small to do something complicated.

I have to confess that I’m not missing Scottish Ruby either. I’d like to be there, but I’m enjoying writing apps in Objective-C and Java. I like the feel of this. Rails is becoming an over-complicated PITA to install and run. I mean, WTF, we replace JavaScript with something we can’t even debug? Please!

I’ve also discovered that my hatred of Java is really a hatred of J2EE and all that shoot yourself in the head dependency injection crap. For putting GUI components together in a coherent way it’s fine. But this makes sense, as it was originally designed to run set top boxes, and build desk top GUIs with Swing. It was only because it was the new kid in town and the web was new at the same time that it ever got popular, i.e. it was the only place to go for corporates who didn’t want to go the Microsoft route. But it was designed by a committee of computer scientists who’d didn’t understand what real people need, so it was always going to suck as much as the MS stuff. Sigh.

I’m not missing Ruby. I’m not missing BDD. I’m writing simple apps with a much faster turn around. Fuck me. I’m having FUN. Who’d a thunk it? Ruby was fun, it was radical. Rails made the web much easier and quicker. But now? I’m just bored by it, dunno why. I like to get things in the hands of folk who need them. Don’t care about the pedantic stuff. In fact the computer science types have taken over again. Sigh.

If you want to create a ListView adapter that searches on the string arbitrarily I’ve created a gist here, by the way. Enjoy.

error: Permission denied sending UDP broadcast packets

Sorry, gentle reader, this one’s a bit technical.

I was reusing some of the code Apple supply for sending UDP packets between servers, but the system I’m working with listens for broadcast packets. I set it up to use the address 255.255.255.255, but got the EACCESS error: Permission denied

I found an example that did work (without using Apple’s CFSocket class) and did a line by line what’s different. You need this to do broadcast

int broadcastEnable=1;

int ret=setsockopt(sd, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable));

if (ret) {
    NSLog(@”Error: Could not open set socket to broadcast mode”);
    close(sd);
    return;
}
If you edit this into Apple’s UDP echo project then it will allow broadcast. Give thanks and praise at http://splinter.com.au/sending-a-udp-broadcast-packet-in-c-objective

Laments to the 10 years of Agile

Laments to the 10 years of Agile

PGError: ERROR: date out of range for timestamp

Note – this assumes you’ve enabled the pgbackup plugin in Heroku – as it does the full database backup for you for free – I suggest you do it right now!

Oh, the fun I just had with this one. One of my clients’ systems started throwing this message over the last week or so.

I’m lazy so I was using sqlite for my development database and Heroku’s Postgres for live.

So, thinks I, time to switch to using Postgres in my development environment, because it must be the database, mustn’t it?

I’d installed it on my Macbook ages ago but hadn’t actually used it with Rails. So I found a couple of blog posts and changed things around. I had already told Postgres to use passwords for validation.

It took me ages to realise I needed to set a password for the postgres Unix user – this was the password I needed to connect to the database. Then I followed these instructions and got my dev database set up.

So – pull stuff down from heroku and then import it to my dev environment.

Right – everything works perfectly – right!

So where is the error? 

I googled for it and found a forum posting suggesting that you could have a date stamp that is outside the range of time stamps and the coercion of date stamps is going boom. Did a lot of messing around in the heroku console to no avail, trying to issue commands like analyze table and count things.

Also, the column is a timestamp anyway, so you can’t store nonsense in it in the first place.

So, I put the app into maintenance mode, took another backup, restored that backup over the existing database, and all was well.

This might be a better solution than trying to rescue the database in any event, because all of the statistics will have been reset too.

I was a little bit hampered by heroku not letting you connect to a shared database because I was trying to issue commands using Active Record – but hey – it’s free. I do wish that heroku console was slightly more informative than server error