Animal Magnetism

We’ve recently acquired new neighbours who seem lovely. They have 3 cats who also seem lovely. Our cat does not agree. He is getting on a bit now and is finding the whole territorial warfare lark a bit tough going in the face of such insurmountable odds. The neighbouring cats have noticed and have taken to popping into our house through his cat flap to borrow a bit of cat food from time to time. Mostly at night. This has moved the turf war from our neighbourhood’s interlocking gardens and driveways into our house with all the associated yowling and marking of territory. Not good.

As a result I spent my Bank Holiday Saturday morning upgrading our cat flap to one of those posh ones that only opens for our cat…that’s the theory anyway. The flap in question is a Staywell 400 Series Magnetic 4 Way Locking Deluxe Cat Flap. Homebase did not mention the even posher 500 series which is an infrared operated version. If they had I might have got that instead, given how much I like to be on the bleeding edge technologically, and saved myself a bit of bother.

catflap The cat flap is operated by a small magnet worn on the cat’s collar. So actually it would appear that the 400 Series will grant admission to any cat with similar magnetic accessories. As the cat brings it’s head within pushing distance of the flap the magnet triggers the lock and the flap will open. Brilliant.

Our cat was not impressed. Within minutes of having his new magnetic medallion fitted cathe ran downstairs, upended his food dish in a fit of pique and ran out of the house. The ungrateful bugger returned later in the day after I had swept up all the IAMS and promptly upended the whole thing again. From upstairs I could hear him rattling the empty dish around the hallway and shouting. I cleared up the foodquake debris again.

During the night he tipped all the food out of his dish again. Over breakfast on Sunday we were debating the cause of his protests. Did he not like the new flap ? Did he not like the magnet on his collar ? Did he resent our interference in his complicated relationship with the neighbourhood cats ? We persevered.

The vicious cycle of IAMS-sweeping, re-filling and dish-tipping continued through Sunday and Monday. On Monday night I was woken up at about 1 AM by a particularly violent bought of dish rattling. Trying to get cat biscuit out from between your toes in the wee hours must concentrate the mind wonderfully because the answer came to me in a flash as I was refilling the dish. The cat dish. The biscuit dish. The nice shiny dish. The STAINLESS STEEL F**CKING DISH! There had never been any act of protest at all. Every time the cat had leaned in to get a bite of food the dish had attached itself to his magnet so that when he lifted his head between mouthfuls the dish would tip up and he’d go clanging about about the place trailing biscuit everywhere until he managed to shake it off.

Cat forgiven. Plastic dish purchased. Still considering upgrade to Series 500. INFRARED, Man ! Now that is cool for cats 🙂

Advertisements

Events in C# 4.0

Rx : Reactive Extensions for .Net and JavaScript.

Rx is a set of framework extensions to allow developers to easily do asynchronous programming via familiar interfaces. If you are familiar with LINQ and IEnumerable<T> and IEnumerator<T> you will instantly be able to grasp and use the new interfaces IObservable<T> and IObserver<T>. The enumerating interfaces allow you to PULL sequences of T from an interface in your code. The observing interfaces allow you to have sequences of T PUSHED to handlers in your code in response to asynchronous LINQ queries. Rx is implemented over the top of PFx (Parallel Framework extensions) so all the threading and concurrency is handled for you including synchronization contexts which is especially useful if you are programming UI. It is also particularly significant that the Rx extension methods include a FromEvent() method that allows you to attach handlers to a steam of events in a very fluid way.

If you want to know more watch the video on the bottom of this page where Rx author Erik Meijer explains it in 14 minutes.

If you want to see it in action have a look at this Channel9 video with Wes Dyer where he implements drag & drop from scratch using Rx in 6 minutes.

Also, checkout the Rx Team Blog for downloads, updates and samples.

Finally, back to Channel9 to look at RxJS for Reactive extensions for Java Script so the UI I mentioned above now includes web UI too. As Jeffrey Van Gogh says in the RxJS video, web programming is about “asynchronous stuff” but java script is an imperative language. It’s really hard to do good asynchronous stuff in java script. RxJS changes that it a big way.

SQL Azure

Finally getting round to having a play with SQL Azure. You can’t administer it with the usual UI tools like SQL Server Management Studio unless you want to use this slightly kludgy workaround, only SQLCMD 😦 Fortunately,  Julien Hanssens and Martin Balliauw have created SQL Azure Manager which you can install and run instantly using Click-Once. Nice 🙂

More Azure Videos

Back in July, in the events surrounding the Azure announcements at WPC, I was involved in a press event at Microsoft UK where various Microsoft partners and customers talked about their work on the Azure platform. Dave Gristwood and Eric Nelson made some great videos of the event which are available here.

More Heap

Another great track from the forthcoming album Ellipse.

 

Code Quality

Imogen Heap…no further explanation required.

I remain utterly captivated by Imogen Heap and, in particular, by this a capella performance of Just For Now.
 
 
Look out for her new album Ellipse, due out any day now. Here’s a sample :
 
 

UKAzureNet

The next UKAzureNet meeting will be on Wednesday 29th July at Microsoft’s Cardinal Place building in London. I will be presenting on Azure and the .Net Service Bus in a presentation entitled “Orange meets Azure : If Azure is the answer, what question is easyJet asking ?” The event is free, refreshments will be provided and you can sign up here.

The Rule of 8 : High Performance Scalable Systems

Wille Faler has an interesting article on his blog where he highlights 8 core principles for building high performance, scalable systems. It’s an extension to the list of Best Practices for Speeding Up Your Web Site, but Wille is focussing on general principles for any scalable system rather than just websites.

In short, we have :

  • Offload the database – Avoid hitting the database, and avoid opening transactions or connections unless you absolutely need to use them.
  • What a difference a cache makes – For read heavy applications caching is the easiest way offload the database.
  • Cache as coarse-grained objects as possible – Coarse-grained objects save CPU and time by requiring fewer reads to assemble objects.
  • Don’t store transient state permanently – Is it really necessary to store your transient data in the database?
  • Location, Location – put things close to where they are supposed to be delivered.
  • Constrain concurrent access to limited resource – it’s quicker to let a single thread do work and finish rather than flooding finite resources with 200 client threads.
  • Staged, asynchronous processing – separate a process using asynchronicity into separate steps mediated by queues and executed by a limited number of workers in each step.
  • Minimize network chatter – Avoid remote communication if you can as it’s slower and less reliable than local computation.
%d bloggers like this: