Cats have feelings too

It feels odd being in the house without Kathy, I know I spend a lot of time during the day by myself normally but its in the evenings that I really miss her. It seems odd cooking just for me and the evenings drag on and when it comes to bed time it really does hit home.

But I’m not the only one missing her. Most of the cats, like Chester and Munchkin, don’t really seem to be bothered, and Chester only really gets bothered when we’ve got the suitcases out and mum and dad turn up because he knows something is going on. But Bandit really is missing her.

Bandit was a cat we didn’t plan on having. When we went to get Pixie, who is a black cat, Bandit was the only kitten left from the litter who hadn’t been adopted and he was the runt of the litter and so we took him home along with Pixie.

Here is a photo of him taken as soon as we got him home back in August 2006 (the fuzzy black in the background is Pixie) :

Hello!

Bandit, along with Pixie, is a quite photogenic and when he was settling in here he just gave us a lot of photo opportunities:

Why, Hello!

Yes????????

Those being just two from a large collection of “cute” photos.

As Bandit grew (and boy did he grow) he really bonded with Kathy and sometimes he seems to behave more like a dog in that he followed Kathy round the house and he loved carrying things round in his mouth too. In the evenings after supper he often hopped up into Kathy’s lap to get some attention and he “patty paws” her. Bandit is really Kathy’s cat and he never grew out of the habits he showed as a kitten.

He’s now three and is a big solid cat as can be seen from this recent picture where he is relaxing on the doormats we brought back from the boat for cleaning (the ears in the foreground are Pixie’s)

Bandit on the mats

He might be a big solid cat but he’s really missing Kathy and when I go to bed at night he hops up on top of me and miaows and demands lots of attention. If I ignore him then he headbutts my hand or my arm until I give him tickles. If I put my arms under the covers then he lies on me and stretches out his left paw and pats me on the chin, and if I ignore that then he resorts to licking the end of my nose. Then when he’s had enough tickles he goes to the bottom of the bed and goes to sleep down there. When Kathy is home he tends to sleep on her side of the bed.

Now I know that you’ll probably just say that its a cat and he doesn’t care where he gets his tickles from but its only in the early evening that his behaviour changes. During the day he’s doing just what he does most days, sleeping on our bed or out in the utility room on the boat mats. Its when it gets to about 6:30 which is when Kathy usually home that he starts prowling round the house more and he miaows a lot more too.

Both Kathy and I know what he’ll be like when she gets home, she wont be able to go anywhere in the house for days without him sticking to her like glue and any time she sits down he’ll be there in her lap demanding attention.

Getting to grips with Latitude


Warning: This post contains material of a technical and mathematical nature, if you start reading and feel dizzy or nauseous then stop reading immediately and go and lie down.

Google Latitude is an interesting little app which allows you to advertise your location. On the Android G1 the GoogleMaps application comes with the ability to update your Latitude location directly from the phone.

The usual way of displaying your Latitude location is using the iframe that Google provide which looks like this:

Part of the integration work that I’ve done to link the blogs here to my brother’s CanalPlan website (which is based very loosely on work I did for my ‘O’ Level computer studies way back in 1981/82 – and yes we did actually have microcomputers back then) involved using his list of locations to allow you to insert links easily into the blog post . I then extended that to allow you to easily embed Google maps of those locations into your posts. For example Wigan Pier  :


So the next logical step was to link Latitude locations back to CanalPlan locations.

first of all I looked at scraping the contents of the iframe but its a complete mess, and apparently against the Google TOS, and I was struggling of finding a neat way of getting data from Latitude. Then I found that Google provide two “feeds” for third party applications (i.e. its acceptable under the TOS to take data). The support extracts in JSON and KMZ formats. I choose the JSON one (http://www.google.com/latitude/apps/badge/api?user=-2983480754731033286&type=json)  because I’m already parsing JSON data from my brother’s site so I could just re-use some of the code. So that’s brilliant, I now have my Latitude and Longitude from Google Latitude and I have a list of Canalplan places with latitudes and longitudes so in the words of Aleksandr Orlov, Simples, just match the two and the problem is solved.

Actually its far from simples because the locations inside CanalPlan are for very specific points and the chance of ever being on exactly the same co-ordinates as the CanalPlan location are pretty damned slim, especially given that a lot of the locations in CanalPlan are derived from other data sources. But it would be really nice to able to show the nearest Canalplan location to your current Latitude location wouldn’t it? Especially if you were on the boat and moving.

There is a solution: Geospatial functions, and I think I just head a couple of heads hitting tables.

I was lucky that I’m running the blogs on MySQL 5.x because it supports some basic Geospatial functions. These are functions that allow you to perform calculations on places or rather sets of places, in my case that’s the latitude and longitude of two places. I had to create a new column for my places table (called lat_lng_point) which is of a special datatype called point, and then I had to populate that column with data calculated from the latitude and longitude for each place using the MySQL GeomFromTextfunction which creates a very odd looking data item.

It might look very odd but its quite powerful because you can do some very interesting things with it. If you take two “points” created using GeomFromText you can find the “distance” between them using the GLength function.

So using the following bit of code:

$findit="GeomFromText('Point(".($lat) ." ".($lng).")')";
$sql="SELECT place_name,lat,`long`,GLength(LineStringFromWKB(LineString(AsBinary(lat_lng_point), AsBinary('".$findit."')))) AS distance FROM canalplan_codes ORDER BY distance ASC LIMIT 1";
$res = mysql_query($sql);

We can take the latitude ($lat) and longitude ($lng) from the JSON feed and find the nearest CanalPlan location that matches it.

At the time of writing this post the code (with a few extra bits to make it look nice) produces:

Finding places closest to My current Latitude location at Cheltenham, Gloucestershire, UK (51.9031645,-2.0471622)

Avon Lock (51.9962,-2.15681) is 0.14382 from Cheltenham, Gloucestershire, UK

Now no doubt you’re scratching your head trying to work out what that distance is. Well its a distance expressed in degrees which is pretty meaningless to people like us.

So that is how things stand now, and that’s why the little Latitude Widget on the right hand bar has a little bit of text underneath it saying what the nearest Canalplan location is.

What comes next?

Well possibly implementing a “real” distance. As I said the distance given is in degrees so we can either trust that its right or we can recalculate from scratch. The calculation for this is quite simple (!) :

gcdr=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))

This gives the “Great Circle Distance” between the two points (lat1/lon1, lat2/lon2) in degrees. You then convert this to nautical miles by multiplying it by 60, and then finally multiplying that by 1852 you get the distance in metres which I can then convert into one of several “nicer” formats. So it could say:

Avon Lock is a distance of 9 miles, 7¼ flg from Cheltenham, Gloucestershire, UK

The other, much easier, thing to do is to create a new widget that replaces the Google Latitude iframe with a mini Googlemap with your nearest CanalPlan location on it (and saying where you actually are under it).

Well I think everyone’s brains are probably hurting now, so I think I’ll go for a walk.

Class Dismissed!

Summer is over… it’s official

September 1st and Summer is now officially over.

How do I know? Do I have some special Almanac that tells me? Is it all based on folk lore? Is it because the schools went back today?

Nope, its none of those.

I know Summer is over because when I went to our local Sainsbury’s supermarket, to pick up a few things, all the “Summer” related products such as BBQs, charcoal, lighter fluid, disposable picnic plates etc., have all vanished. Gone as if they never existed. All gone and replaced with something else.

So what “Season” is it now? Is it Autumn, Season of mists and mellow fruitfulness ? No… I’m afraid not.

It’s “Back to School” Season. What ever that is. Not everyone has children of school age and this obsession shops have with things like this just depresses me.

Still it could be worse, it could be Christmas (I think that’s in a couple of weeks).

All hands on Deck

Last weekend Nick and I headed up to the boat to do some work on it. The deck boards on the boat are made out of plywood and they get wet and once water gets in on the cut edge they start to break down, and the starboard deck which is the one that we use a lot to get on and off the boat (and also gets more water running over it)  had gone a little mushy and was starting to fall apart:

img_0065

The last thing we wanted was for someone to jump onto the back deck at a lock and go through the deck into the engine well so we’d decided to replace it. The decks have been replaced twice since the boat was launched in 1986 and the last time they were done was back in 2000/2001. As you might have noticed the side panels aren’t square and cutting a piece of ply that big to that sort of shape isn’t easy, and its not cheap to buy either!

So we’d discussed alternatives and decided to go with timber planks which had been pressure treated against rot. There were several reasons for this:

  • Hopefully they should last longer than ply
  • They would be cheaper as ply, or no more expensive
  • Its easier to cut one plank to the odd taper than a sheet of ply and it if goes wrong then you’ve only wasted one plank.
  • A solid cut edge will be less permeable to water than the cut edge of the ply
  • Easier to repair, if a plank gets damaged we can simply replace it.

So we went to Wickes and spent about £60 on timber planks and beams and screws, bolts and brackets and early on Saturday morning we took a screwdriver, our trusted Dunlop tyre iron and our hands to the old deck and ripped it up exposing the top of the starboard fuel tank and the batteries:

img_0066

The first thing we did was clean the piles of grit blast off the top of the tank – it gets everywhere and my recommendation to anyone is DONT ever grit blast your boat unless you want to be finding the stuff for years.

Once we’d done that, and had a coffee, we put wooden beam down the side of the drain channel and then built a timber frame up which would provide support for the planks. We had to do this slightly differently than the way we’d planned it in our heads because we couldn’t remember just how things were arranged under the deck, but the principle was the sane:

img_0067

Then it was a matter of cutting each plank to length and fixing them in place with lots of screws and lots of frame sealant to stop water creeping through it:

img_0068

As the sealant needed to cure and as it was now late afternoon we called it a day, got cleaned up, had something to eat and headed off to the pub.

Sunday morning we got up early and we took some floor paint which we diluted to make it easier to apply onto the raw wood and we painted the deck:

img_0072img_0071

What these last two photos show is that the two middle deck boards really need replacing next. As these two are the ones that sit over the engine, and have to be lifted to check the oil and coolant and to access the weedhatch and sterngland, we’ll probably use ply wood for these two but we might put a cross strut on the bigger board to stop it flexing as much as it does. The other side deck is slightly more complicated because its got the fuel filler hose and the control panel on it. But now we pretty much know what to do we know that its another days work for the side panel (and we have all the timber we need for that) and other one for the middle panels