Powered by Blogger.
My good colleague Paddington bear  has just asked me for some help with a marvellous mobile project he has devised. He has some locally stored JSON arrays that he needs to filter based on various fields throughout the code and he was looking for a nice way to reduce the complexity without having to do nasty loops everywhere and in different ways.

I came up with this example that we then turned into something for him (that you aren't allowed to see :-/) but I thought it might be of value to someone else.

Basically, the code takes the onus of doing the filtering out of the filter function so you then pass the array and the function upon which it is filtered at the same time.

Take a peek, I am sure there's some nicer ways of doing things but I just coded it as we were talking and now I am posting it. He has refined the production version and you guys can do the same if you like the idea!

I am working on a new distributed system at the moment and was using Msmq as my basic queue system (just because it's there, has no dependencies and I know how to use it already).

Anyway, I was doing some of the mess about work using F# Scripts (don't you love it!!!). I have tidied some of them up into a quick start Msmq guide for anyone that is interested. I doubt it's exhaustive but it's a start!

One annoying thing I noticed whilst doing this was that for some reason you have to #r reference the System.Messaging Dll. I have never understood why you had to do that when you can just directly reference other .NET framework Dlls like System.Xml (also used in the example). If anyone reads this and knows the answer, please let me know!

I have a Windows Forms program written in F# that can deploy a code base to n number of sites at once (you select the sites you would like to deploy to and it goes off and completes a number of tasks (backing up current sites, various unpacking and moving of files etc... ).

Once you start it, it begins it's merry journey and begins to update the UI with what has happened. At the moment this method of updating the UI is not pretty because the threads I am doing the work on can't update the UI so I perform some fiendery to make that happen (don't ask).

I knew there was a better way using some newer .NET features but I just hadn't got round to having a fiddle yet. I have now found that if you use the built in Task class but break your code up in a nicer way and then chain the tasks together you can then pass the correct context into the task that you want to talk to the UI.

Here's a little script to give you a feel for it. You can press the "start" button and as hoped, the UI isn't locked up because the work (the sleep) is done on a background thread but then the UI is updated afterwards, it's important to note that you wouldn't want to stick the update straight after task1 is started in the main code because it would just run immediately.

Oculus Rift

No comments
This morning I have been able to play with an Oculus Rift. I wasn't sure what to expect but the experience has blown me away. The control with the head movement is realistic and the feeling of immersion was crazy. I only had time to try the under the sea demo but that was enough for now until my own unit arrives.... I haven't included any video of the demo from my perspective as the various videos and youtube demos out there really don't do it justice.

In preparation of mine arriving I started watching the introduction to Unity videos on Digital Tutors http://www.digitaltutors.com/tutorial/1566-Quick-Start-to-Unity-Volume-1 and I think I will need to get back up to speed with some 3d drawing, it's been a long time since I used Autodesk Inventor or my all time favourite tool for 3d fooling about Sketchup. 

This would have been an amazing tool when I was doing 3d images and walkthroughs of proposed building solutions some years ago. I haven't thought of what our commercial angle will be on this yet but I am sure we will think of something!

New Blog Design

No comments
It's been quite some time since I have done any real blogging but I feel I ought to begin the push again. Writing (even badly) makes for excellent practice in expressing yourself. It's a skill I think all good software developers should have although I don't think that skill must be practised through blogging. 

Anyway, with my return to blogging, I felt I ought to give my blog a bit of a shake up. The built in Blogger theme I had originally used looked awful and the newer design they offered didn't render Gist code examples correctly. In the end I chose a design from Themeforest. Themeforest is often the place I go to for HTML designs as I am extremely poor at front end design and integration, my skills lie elsewhere. 

I hope you like it!

I like the Peek Definition feature in VS 2013...............

It saves opening up thousands of tabs just to take a quick peek at something. The only thing I don't like doing is having to right click on the mouse to access the feature via the context menu. Luckily you don't have to.

[alt+f12] opens peak definition on whatever type you happen to be on and [esc] closes the peek window again :-)

Here's a little more information on the feature if you don't know about it.... http://msdn.microsoft.com/en-us/library/dn160178.aspx
In the latter part of this year both my brother and I have bought a new house and my second daughter has just arrived in time for Christmas. Because of this my family decided that we should tone down the level of giving this Christmas. To be fair, between the adults we don't actually spend much money, we operate a secret Santa lottery in which each of us, my brother, step sister, our parents and our corresponding partners put our names into a hat and brokered by my brother in law (who is a Jehovah Witness so abstains from the act of giving itself) picks the names for us and let's us know who we have to buy for.

It's a reasonable system as it significantly reduces the cost of Christmas. It's main drawback is that you could have one of the poorer benefactors (namely me and my brother) meaning that you get both fewer and lower quality gifts!

This year though, because our coffers have already been emptied we decided to still do the secret Santa; but limit the amount spent to £10 and the gift had to be locally made (or packaged) food or drink.

This has turned out an excellent idea with everyone performing their festive duties more than adequately. I received some locally made beer (from http://www.flipsidebrewery.co.uk/), a Melton Mowbray pork pie and some very nice coffee (not locally made but locally packaged...). All were consumed immediately of course.

Other notable offerings were home made cheesecake and a delicious ginger drink from the Nottingham Ginger Company based in Basford (http://www.locallife.co.uk/c-n/nottingham-ginger-co-ltd-nottingham.asp). Sadly they don't have a website although I bought the drink from Fred Hallam grocers in Beeston (http://fredhallam.com/).

The other boon offered by our Christmas food scheme is the avoidance of further brick-a-brac accumulation. My wife and I have worked very hard to boil down our possessions so that only the essential items remain (give or take a box or two of classic electronic items). The onslaught of Christmas generally brings an awful amount of "stuff" with it that; at the risk of sounding unappreciative, is just not needed. I certainly don't need another book titled "The book of Dad", nor do I yearn for another scarf and hat set. Food on the other hand, once eaten, never burdens you again (apart from the inevitable trip to the toilet and the weight gained).
Older Post →
Older Posts