Skip to content

Bad Science, Ben Goldacre

I picked this up in Waterstones, after a quick browse.  It is more or less a book version of Ben’s blog, which in turn is related to his column in the Guardian.  It’s a reasonably entertaining exposé of newspaper journalism concerning health stories.

The main topics covered are: nutritionists, MMR, and homeopathy.  In order: he dislikes them, stupid scare story by ignorant journalists, and it doesn’t work – at all.  There is some exposition explaining the wonders of the placebo effect and the workings of newspaper publishers.  He is also considerably influenced by good old C P Snow’s two cultures idea.  In other words, newspapers are run by arts graduates who prefer authority figures, and ignore educated science graduates, who understand scientific theory and are capable of reading papers and interpreting them.

As a literate science graduate myself, I can sympathise to a large degree.  However, interpreting papers is a damn sight harder than he makes out, although he does at least give strong references to two other books that are medical course textbooks on the topic.

Ben also writes somewhat as if he has a chip on his shoulder about this, and is rather inclined to commit the same sins: referencing a paper and citing conclusions from it as authority, and not always presenting the results as he would have the newspapers do.

I can’t and won’t disagree with anything he presents – I strongly suspect he is absolutely correct in his main themes, even though his writing style leaves me a very little bit cautious about accepting all his conclusions.  Which is no doubt as he would prefer it.

Currently reading: The Compleat Angler, Isaac Walton.

Tagged

A Princess of Mars, Edgar Rice Burroughs

This is the first in a series of posts reviewing books, as I read them.  Older book reviews here are mostly archives of reviews that I have posted to Amazon, some for computing books, others for cookery books.

I first read A Princess of Mars in my early teens (I was possibly 12 at the time, so not-quite-teens), while living away from home at boarding school.  I think I heard about it somewhere, and I know that I had read some of the Tarzan series much earlier (pre-teens).  It had a profound effect on me, alongside Robert Heinlein at the same time.  It was as a result of reading this that I took up fencing, for one thing.

It is a simple book, not very long when compared with current novels, told in first person by John Carter, from Virginia, once a Captain in the Confederate army, and at the start of the book a miner in Arizona.  One thing that I didn’t pick up on my first reading was the Southern voice in which it is told, something that I had never heard (or read) before.  There’s no point going into the wrong science – which was reasonably current when the book was written, at least as far as the landscape of Mars is concerned.  The scaling effect of gravity on John Carter’s strength, and his ability to jump, was perhaps more obviously wrong.

If you haven’t read this, then you should.  The first three of the series, which would include Gods of Mars and Warlord of Mars, are the essentials that anyone should have read.

An interesting diversion is how I got hold of it.  I had been looking for a copy of the trilogy in a desultory way for a number of years, and would happily have paid for a fine print edition, if such a thing could be found (highly unlikely).  I had gone so far as to order a single paperback edition from Amazon, which after many months ended up unsourceable.  Then I had been checking out book reader apps on my iPod touch, and formed a firm preference for Stanza over BookShelfLT.  At the time I had to reject it, despite the better reading controls, because BookShelfLT could give me access to the Baen Free Library, which had a couple of books I wanted to read – and weren’t in print on Amazon.

So, some time later, I found an upgrade to Stanza, which let me access Baen, and I was very happy.  I also discovered that Stanza had included a lot more online libraries, and found A Princess of Mars that way.

Tagged

iPhone app – HandyPoints

This is the draft of the App Store info page:

HandyPoints is an easy-to-use points calculator which makes it simple for you to work out the points score for any food item, and helps you on your journey to your goal weight.   Use HandyPoints to help you diet responsibly.

Just put in the right values and tap Calculate.  To start again, tap Clear or just shake the iPhone to erase.

Did you know that for the USA we use a different formula than in other countries to calculate points?  Most foods in the USA show dietary fiber values on their nutritional information packaging, whereas foods in other countries show saturated fat instead.  So the USA uses a formula based on calories, total fat and fiber; non-US countries use a formula based on calories and saturated fat content.

So HandyPoints looks at your current locale and decides whether to use the US or the Rest of World points formula initially. You can change this in your application Preferences (tap the Info button) if you want.  You can also choose to work with kJoules instead of kCalories.

Sometimes it can be good for your diet plan to know that a chocolate muffin really scores 6.8 points even if you have to enter it into your tracker as 7.   HandyPoints shows you the correct points to put into your tracker, and also shows you the exact non-rounded answer just for information.

This program was not developed, supported or endorsed by Weight Watchers or WeightWatchers.

Now the background: Liz has been following Weight Watchers for a couple of months, and needed a quick calculator for her iPhone.  The ones on the App Store had some pretty mixed reviews, and she found the ones she tried inaccurate for some cases.  So Liz has been my main beta tester for this.  She has put a lot of effort into reviewing the user interface, and checking (and double checking) all the calculations.  The app is free, and will remain so – it also has a very simple (functional) user interface, as befits such a simple app.

Now for some details about the app itself: yes, the intention is to calculate points using the Weight Watchers system.  They use one algorithm for the USA, requiring calories, total fat, and fibre, as that is what they can see on the nutritional information panels; and a different one for the rest of the world, using calories, saturated fat, but no fibre.  They also round differently – the USA rounds to the nearest point, the rest of the world to the nearest half point.  So that’s how we work it out, and we have checked the results against various web sites of food manufacturers that list points values for their products.

The UI is intentionally as simple as we could make it, which means non-glitzy; I apologise for not making it flashy and glittery, preferring to keep it in accord with human interface guidelines and functional.  I make my own custom UITableViewCells, with label and text field, with a standard keyboard attached.  Unfortunately, there isn’t an option for a numeric keyboard, so I had to use the (rather lame) numbers and punctuation keyboard.  The numeric keypad that you will sometimes see is intended for numeric only input , such as for PINs- no decimal points.  When you return in one field, it calculates using the current input and moves to the next field, clearing it for entry; on the final field, the keyboard drops down when you enter.  The calculate button is really unnecessary, but it’s there for comfort; a user can feel that they know what to do.  The clear button also isn’t essential, and exists to give the user the impression of a transactional structure to their calculations.  I don’t support rotation, either – it doesn’t feel right in landscape mode (or upside down).  

I have tested this with all variations; permitting rotation, entry into a form rather than table view, a clear button, keyboards dropping at the end of each field.  The version that I am releasing is the one that worked the best for all testers.

The App Store submission should go off in the next couple of days; I realise that things can take a little while to arrive after that.

Please post any support requests or other comments on HandyPoints as comments to this post.  And if anyone likes it a lot…

Tagged

Xcode tips – autocomplete and lookup

There are a few simple key combinations that help a lot when using Xcode – I don’t mean just the emacs key bindings (which are worth a post all on their own), but autocomplete and lookups.  I suffer badly from forgetting these keystrokes when I switch between Xcode and Eclipse (and TextMate and all sorts of other tools).

First the autocomplete key stroke, which everyone knows:

  • Tab – enters the highlighted completion; but then:
  • Esc – pops up a selector for all possible completions for the current context.

Next the lookups:

  • Alt- double click – looks up the current word in the Documentation window;
  • Cmd-double click – looks up the definition (often in a system .h file) for the current word.

Something important I almost forgot: the right click menu inside the Xcode editor brings up a useful list of tools, including all the above options.

That’s all; short and sweet.

Tagged

iPhone developer tip – shake it!

Detecting shakes is easy. Balancing the sensitivity so that a lighter shake is required forward and back to trigger an event than sideways, or up and down – that takes a bit more work. Writing this code the first time will make your controller classes look like a mess, so it’s time to refactor that code.

I have written this as a simple class called PLShaker, which you can drop into any app.  It has one property, a float called ‘violence’, which is a sensitivity scaling parameter, and the default value is 1.5 (more means less sensitive, so it’s not really well named).

To use this class, register to receive a notification from it:

shaker = [[PLShaker alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clear:) name:@"PLShaker.Shake" object:nil];

The @selector should be a method that takes a NSNotification argument (actually, with ObjC this doesn’t matter, but that’s the value that will be passed to you – there’s no user data, so you can’t do a whole lot with it).

For me, most of the time the main use is to clear a form if the device is shaken, which is  a method that doubles up as an action.

PLShaker.h/PLShaker.m

Tagged

iPhone developer tip – image sizes

I’m going to jot down a few notes about image sizes for iPhone apps – these facts are hard to unearth, and I haven’t yet found them all together in place; hence this post.  I will update this if I find out any more.

For most purposes, an iPhone app uses png format images; however the App Store submission is required to use a jpg/tiff image.

1. Main Logo – 57×57 – PNG

2. Tab bar icons – 30×30 – PNG (and 24 x 24, by another source).  Mid-grey with a transparent background

3. App Store Icons – 512×512 – TIFF or JPEG

4. Default.png (Default launch page image, ‘Primary Screenshot’) – 320×460  JPEG or TIFF (480 if you include the status bar).  (Apple docs say the image must be jpeg, but various forums say jpeg or png)

Other images and sizes that I can think of – full screen size (320×480), status bar height (20), nav bar height, default table cell height, table cell image, table cell accessory.

Tagged

Hello world!

Hi!  Switching this blog to WordPress.  It started in plain html, moved to blosxom, then adopted blojsom when Apple included it in Mac OS X Server, which then painfully languished – so it’s time to move on.

I will repopulate old pages over time, then redirect the web server to here.

Benefits: commenting reenabled, better management for me of uploads, and it looks a whole lot better.

__CompanyName__

This is in the cocoa-programming Apple list FAQ (if you can find it), but it deserves wider currency. If nothing else, I’m always forgetting the details.

If you want to change the __CompanyName__ text that Xcode puts into every single file’s comment headers:

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ "ORGANIZATIONNAME" = "My Company"; }'

Tagged ,

Café Playlists

Sitting right here in a cafe (Stell’s, Redlands, CA), I have been listening to a play list from the 60s. Ordinarily that would be great – much Neil Young, CSN, Nick Drake, and many tracks that I am familiar with from the first time around (and the cafe owners presumably aren’t).

But I was fantasising that I could put together a truly great playlist for the cafe vibe – although it would probably offend a true 60s cafe folk purist, and who knows, maybe that’s exactly who assembled the playlist I am listening to?

Add in some real folk – and Richard Thompson, of course, staying away from the more disturbing, faster tempo tracks; Nic Jones (Annan Water, Annechie Gordon); Hedgehog Pie; Vashti Buntan; Devendra Banhart; Antony & the Johnsons; Dion DiMucchi; Scott Walker; PF Sloan; John Fahey; Davy Graham; Leonard Cohen; …

The basic idea is to stick with the ethos, but vary the era. Also hit some of the undeservedly unknown artists from those days. Looking back at the list, I can see that mine represents a edgier, less reassuring take on the genre – who, after all, thinks of Nick Drake these days in that way, even if that is what his music really represents to me?

Hire Car – Mitsubishi Eclipse

Our hire car, supposed to be compact/intermediate, was a Mitsubishi Eclipse – which I detest. It has two doors, alcantara trim on the seats, and people say “ooh, sporty!”. The acceleration isn’t too bad, either, although the vagaries of automatic gearboxes (it’s a hire car, what do you expect?) make it surprising hard to tell. However… the turning circle is so wide it makes U-turns tricky, and makes my Lotuses look good. Another element in common with old Lotuses is that there is an even worse view from the the three-quarter lines – which makes reversing out of parking spaces a considerable gamble. Just to be clear, it’s much worse than any old Lotus, and not in a way that could be considered endearing.

It also reacts very poorly to the wave rippled concrete on the I-10, setting up an uncomfortable back and front rocking at highway speeds. First time I experienced this, I thought I’d had a blow out. Along with that, when we picked it up, the tire pressure warning light was on; the local air hoses (mandatory free in CA, hurray!) don’t have any pressure gauge – so it’s hard to tell what’s going on, but the light goes off after driving, and doesn’t go off when you add air to the tire in reasonable quantities (we haven’t tried the unreasonable, yet).

As is very common with American hire cars, I haven’t found a trunk release lever apart from on the keys. On which subject, why do we always get two very bulky keys, both attached to a key ring that they can’t be removed from?

One last thing, which really only impacts people touring – the luggage area is exposed, in that you can see everything in the truck through the back window; that’s not secure, but may not matter to a typical buyer.