I was walking down the famous (but I’m sure disappointing for tourists) Carnaby Street on the way to the office this morning and there was a proper crime scene - something I’ve never seen before.
A shop on the corner of one of the side streets was cordoned off with bonafide “Police Line” tape, and there was a man in a dust suit delicately brushing the outside of the shop for fingerprints. I didn’t see any evidence of a break-in or smashed windows, and to be honest I have no idea what might have happened.
I didn’t think it appropriate to take a photo, but it was quite exciting in a very-low key, CSI-style way.
I recently bought a Kindle - which is completely brilliant - and already have found that the convenience of always having a few books available means I’m definitely reading a lot more.
I’ve just finished “ReWork” by Jason Fried and David Heinemeier Hansson - two of the founders of http://37signals.com/. I quite enjoyed the book, so I thought I’d do something new and write a review of it on Amazon.
I don’t think my review was particularly good, insightful or useful but I enjoyed writing it and definitely something I’ll try to get into the habit of doing.
You can see my initial attempt at being a critic on my page on the Amazon UK website.
As you probably know, I spend most working weeks down in London, and reasonably often fly down to Heathrow from Newcastle.
Today, I thought I’d try getting the Heathrow Express to Paddington (and then the Bakerloo line to Piccadilly Circus) rather than getting the Piccadilly line direct there.
Plus points:
- Quite a bit quicker getting into the office - despite being delayed by about 7 minutes on the Tube it took about 20 minutes less than usual
- Much more comfortable - nice seats and plenty of room
Minus points:
- Much more expensive - cost £18 for a single paying on the day rather £4.50 using my Oyster card on the Tube.
So will I do it again? Definitely if I’m in a rush or if have lots of bags, as it’s no fun in the rush hour on the Piccadilly line with lots of luggage.
However on a normal commute - and sadly this is pretty normal for me - saving 20 minutes isn’t worth £13.50
It’s the last day before I’m back at work (and in London) tomorrow, so obviously I wanted to make the most of the day and spend it on my computer :-) This means today’s post is quite a technical one, so iff you’re not a software engineer, you may want to look away now.
What I’ve been looking into is efficient geospatial queries i.e. how to find a set of points that are close to a specific point. I’ve got some ideas for some projects for both work and personal use which need this, which in a crappy “it sounds more interesting than it is if it’s secret” way, I can’t really talk about right now.
First off was to understand how to calculate distance between two latitude/longitude points. This is a reasonably well-known algorithm which I have used in the past, and this page gives a good explanation and code examples in C# and JavaScript: http://pietschsoft.com/post/2008/02/Calculate-Distance-Between-Geocodes-in-C-and-JavaScript.aspx
Now this is useful in general purpose queries, but I’m using Google App Engine for hosting some of my personal projects (not the work ones for obvious reasons). I’m doing this mainly learning new skills - Python in particular - and also having a free entry point for low-usage sites makes it massively more attractive than Windows Azure when you’re just playing about. I’ve no idea why Microsoft don’t offer this option :-(
Anyway, one of the drawbacks of using simple entity stores like the App Engine Datastore is that they don’t offer complex “WHERE” clauses in the native query languages. You could implement a query using the algorithm explained above at runtime, but clearly this wouldn’t be very efficient as you’d be doing a lat/long comparison on every entity in the datastore rather than using the native processes of the datastore itself.
A bit of research found a very interesting article at http://code.google.com/apis/maps/articles/geospatial.html - which explains one rather clever approach to exactly this problem. The article explains it in full, but in essence it simply:
- Breaks the lat/long two dimensional space into a grid of referenced squares
- The larger parent squares have a shorter label than the squares contained within it
For example, the grid square labelled “a7c52b” has a larger parent square of “a7c52”, which also has a parent square of “a7c5” …
This means you can use a StringListProperty type in the App Engine datastore to hold the set of any lat/long point’s parent squares, and hence with a bit of care you can do a simple “WHERE” query at the appropriate accuracy level. Very clever!
Other options discovered include:
- Geodatastore - http://code.google.com/p/geodatastore/wiki/HowItWorks
- Google Fusion tables http://www.google.com/fusiontables/public/tour/index.html
- Geohashing - http://en.wikipedia.org/wiki/Geohash
In summary, I definitely learnt a new algorithm for efficiently storing lat/long points in an entity store in an easily queryable way, so it both passed a fun couple of hours and meant I could keep my #new365 streak going :-)
The one thing I miss most about not travelling so much to the US is my Sunday morning trip to IHOP for pancakes with @sicklemon and fam.
I’ve also been reading “Cooking For Geeks” (@cookingforgeeks and http://cookingforgeeks.com) - an excellent book that explains how cooking works, rather than just a list of recipes to follow. Definitely recommended.
Anyway, I decided to try making some US-style pancakes at home - something I haven’t tried before - following the method in the book. The results tasted better than they looked (which is usual for my cooking) so despite the evidence of the picture attached they were not too bad at all.
As the book recommends I need to try further experiments until I perfect my own method. Things I learnt are:
- Don’t have the pan too hot, as it cooks the pancakes a little too quickly and makes them hard to get right
- I think a smaller pan with higher sides would have helped too
It’s New Year’s Day, so it’s the perfect time for starting ambitious but vaguely plausible projects.
The challenge I’m setting myself is to try to do something I haven’t done before on all 365 days of 2011.
In my rules, anything counts as “something new” if it’s a new experience for me, so it could be something as trivial as walking a different way to work, cooking something I haven’t made before, learning something new about software development, …
Why am I doing this? Several reasons really, but most of all I want to force myself to keep trying out new ideas and experiences. By making this a public challenge I’m hoping it will keep up my enthusiasm throughout the year. It will also be a reasonably interesting daily diary of 2011, but hopefully not too much like this video:
I’ll be using the Twitter Hashtag #new365 for posts in the project, and would be very happy if you want to play along too!
In a vaguely recursive sort of way, me setting up this project is the first new thing I’ve done this year, so I’m counting this as my first post (1/365)