I think I will upgrade my blog software

I have been running with .Text blogging software since I got this hosting arrangement set up back in 2004. At the time development was quite active on it and it was an introduction for me to blogging, and on my platform of choice of .NET.

Since then things have moved on and I have been looking to bring my software more up to date. Mainly to support more recent developments like blog writing tools that let you compile things offline. I’ve attempted the usual work arounds, like using notepad as an offline tool to draft posts, but it niggles me that more up to date options are available.

The chap (Scott Watermasysk) behind .Text moved on to some success with Community Server, but it appeared to be bigger than I needed. A few years later I was pleased to see that a generous community of developers had branched the .Text code under the project name Subtext. Since I found out about it, I have been planning to upgrade to Subtext and even made an abortive attempt at upgrading but bottled out. Prematurely it would seem as the error I encountered was easily remedied by the support team at my hosts. I was again pleased during a recent visit to the Subtext project site to see that they have recently issued version 2.0 of Subtext after a while where I wasn’t that sure of progress on the application. And as they mention good Windows Live Writer support (which I am using with my work blogs) I think I will give it another go to upgrade.

It may mean that the blog drops off the web for a little while, or it may go very smoothly. I don’t know if the feed URLs may change, I’ll be doing my best to make sure that things are easy to find if they do move.

Interacting with parent controls in Microsoft Dynamics CRM 4.0.

If you do a search in Google on the title above, you’ll find plenty of code samples of the javascript to get and set the values of controls on CRM 4.0 forms and even how to do it from an IFRAME in a page. As you may know if you have any experience of extending MS CRM 4.0, the IFRAME is a big part of offering extra functionality to users.

Of course, as you may know if you have a bit of a history in Web UI design, there are a few hurdles to be able to be allowed to run javascript if your IFRAME contains a page from a site that is different to the HTML page hosting the IFRAME. This so-called cross site scripting was a big problem in earlier browsers and security blocks added in to stop this being hijacked for nefarious purposes. To deal with this the form designer in CRM 4.0 has the option to switch this security on or off. Unfortunately this has its limitations and I found that the option did not have any effect on the script I was trying to run from the page in the IFRAME. In the end I had to create a virtual directory in IIS in the same website as CRM. The other part I had to watch for is that I used the URL from the root of the site, not the redirected path that the CRM application uses.

Once over that hurdle, I had a bit of a wrestle with Javascript and dragging it out of my brain at the same time! To explain what I was trying to do, I had two controls on the parent form to populate. No problem, I had the names of the attributes and CRM 4.0 has a nice way of naming fields and controls from the attribute names. Unfortunately I got an access denied error thrown by the script engine in the browser. By a process of trial and error I established that one control worked and the other did not. Not because of value types or anything, it was because one was a lookup and the other was a straight text field. Lookups need a different approach to accessing them, as they use an array as part of the matching to list setup.

Having established this, I dived in to the code in the Microsoft Dynamics CRM 4.0 SDK which is something like thus :

//Create an array to set as the DataValue for the lookup control.
var lookupData = new Array();
//Create an Object add to the array.
   var lookupItem= new Object();
//Set the id, typename, and name properties to the object.
   lookupItem.id = ‘{1AAC1363-01A1-DB11-8432-0003FF9CE217}’;
   lookupItem.typename = ‘account’;
   lookupItem.name = ‘A Bike Store’;
// Add the object to the array.
   lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
   crmForm.all.parentaccountid.DataValue = lookupData;

Fine, but what guid id is that and how was I going to find it out. Further searching established that it is the guid of the entity that is listed by the lookup. Finding this out was a bit of a hunt again. Firstly I found the name of the entity being looked up by checking the properties of the lookup on the parent form. This pointed me to the source entity. Then I navigated through settings to call up the entity. Doing this lined up a URL with the GUID on it – perfect. The typename was also shown on one of these property pages. I filled them all in, and it didn’t work. I did some cursing of Javascript and started hunting again.

I finally ended up wandering the directories of the SDK again. If you browse down the folders client\howto\usinglookups there are two script files readvaluelookupcontrol.js and setvaluelookupcontrol.js. I opened up the latter and it has the following code:

// Create a lookupItem to store the values that you want to set to a target lookup control.
var lookupItem = new Array();

// Specify the values on the signature of LookupControlItem. These values are the GUID of pricelevel, the type code of pricelevel, and the name of the lookup value.
lookupItem[0] = new LookupControlItem (“{F31BB38A-0EC0-403F-99A6-3AF469D7D76E”}, 1022, “Retail”);

// Set the form control value to the lookupItem that you just created.
crmForm.all.pricelevelid.DataValue = lookupItem ;

Ok fine, but the realisation dawned slowly that the second line of code was calling a function I hadn’t seen so far. I was correct, after doing some more Google work to establish this. Further hunting revealed that this is a function used by the CRM application itself. If you go hunting in Inetpub, you will find the file that defines the function. Take a look at the file Lookup.js which you will find under the web root in _static\_controls\lookup . In there is the definition of LookupControlItem thus:

function LookupControlItem(sId, iType, sName, sOnclick, sDisplayClass, sData, sTypeName, iCategory, sAmbiguousRecordsXml)
{
this.id = sId;
this.type = iType;
this.name = sName;
this.onclick = sOnclick;
this.displayClass = sDisplayClass;
this.data = sData;
this.typename = sTypeName;
this.category = iCategory;
this.ambiguousRecordsXml = sAmbiguousRecordsXml;
}

Include the code by reference or placement, and call it in the style above and it will work.

Its up to you whether you wrap your parent call in a test (helpful for form load timing issues) but I found this worked in the end.

So the SDK is ok, but needs a bit of background knowledge to work with. Another really helpful file that comes with the SDK is a pdf of the Microsoft Dynamics CRM 4.0 UI Style Guide. Essential to match your UI to the rest of the CRM look and feel to make your IFRAME disappear – if you can work CSS and Style of course!

Thanks to Richard at Evorio for CRM support.

Further catchup with the world of AlistairL

I think I would be better off with Twitter than these summary posts, but such is. These will placeholder my life until I get my thoughts down in more detail:

  • A week last Friday I took Mrs AlistairL out for a Fish Tea at the Tailend restaurant in Albert Place. Alegedly related to the management of the Anstruther place at one time, they managed to squeeze us in without a table booking and the fish and chips was excellent. The dining room is a bit small, so look it up in advance and book. Recommended.
  • I had “fun” this week wrestling with some UI work regarding customisations to Microsoft Dynamics CRM 4.0. A search around the blog postings on IFRAME Javascript calls to parent forms shows the same but frankly useless code example. I’ll spare you a rant on this sort of stuff, just remember that some folks don’t try the sample code they blog. I got it figured with a bit of code from the SDK, a bit of code from a blog posting (I know) and a function “borrowed” from the CRM js libraries. And that was after virtual directory fun in IIS. Full posting to follow.
  • Had a lovely brunch with Mrs AlistairL at S Luca in Morningside, she had the Vegetarian, I went for the French again with extra bacon (poached egg, bacon, muffin with Hollandaise sauce – yum).
  • I’ve stepped in to the breach at work and volunteered to take an exam at short notice (for me). I am booked to sit 70-630 TS: MOSS 2007, Configuring on Monday 8th September.
  • I bought a rorty exhaust for the RS from ebay this week (a bargain). Work are getting used to me carrying motorbike exhausts home from the office.

Catchup with the world of AlistairL

I do these catchup posts from time to time, when I go through a period when I’m not in to keeping the blog up to date. Happenings include:

  • Cat MkII. After keeping her resolution not to have another cat, two weeks after the departure of Cat MkI I accompanied Mrs AlistairL to Dalkeith to meet a little female kitten being fostered with her brother and mother by the Lothian Cat Protection folks. After an hour of play we departed with a little 12 week old black male kitten who is now called Luey. He plays most of the time he is awake and sometimes will play fetch – bringing items back that you throw for him. His little black and white sister didn’t want to play as much – apparently female cats can be like that.
  • New Tyres – put a set of new Bridgestone BT-021s on my bike, which is all back together and working after my tumble. Maybe I blogged about that.
  • Kung Fu Panda – Took Mrs AlistairL to see Kung Fu Panda at the IMAX in Glasgow. Enjoyed it and going to see the Dark Knight on Saturday at the same venue.
  • IAM Motorcycle Observing – I have been helping someone work towards their advanced test. They ride a Fireblade, I’ve not lost sight of them on the ride outs so far.
  • Shiny valve caps – I bought these as one of the other Motorcycle Observers said they were better (they have a seperate seal in them) but the young folks in my street seem to like taking them off my bike and car. After two weeks of replacing them every other day I have given up and gone back to black.
  • New Phone – After enjoying my Orange SPV M600, I have now got a black and shiny HTC Touch Diamond. Doesn’t have a memory slot, but hangs together pretty good. Yes I know it is not an IPhone but neither was the price. Unfortunately the supply chain of accessories is as stuttery as the phone supply chain – I’m waiting on a cradle and one of those strange HTC extended USB cables.
  • SharePoint and Microsoft CRM – I did two courses in the last month or so, one on Microsoft CRM and another on MOSS 07, or SharePoint as we commonly call it. Both are superb products and I’m looking forward to using them.
  • Writing – I wrote a short article covering the Scottish IAM Motorcycle Senior Observer’s day in April and it has been published along with a photograph I took on the day. They went in to the Motorcycle section of the summer 2008 edition of Advanced Driving Magazine, the members magazine for IAM Members.

Ron Jacobs is back with endpoint.tv

I used to subscribe to a podcast called ARCast, which was an architecture Podcast from Microsoft, hosted by a chap called Ron Jacobs. I used to listen to it on the bus to the Business Analysis job I was doing at a Corporate Bank. They fitted in quite nicely, I could get 1 to 1.5 podcasts in on my ride into Edinburgh on the X25.

When that job finished I was back to commuting by car and didn’t listen to my MP3 player as much, but my RSS reader kept downloading the files and adding them in to the Media Player sync list. From time to time I checked back and discovered that ARCast wasn’t producing any more files. As it was, Ron Jacobs had moved on to pastures new. Moving from Architecture into deeper technical stuff.

So here I was trying to get to grips with WCF again for a bit of a project that wants to connect Microsoft Office SharePoint Server to Microsoft Dynamics CRM and I came across the total noobs guide to WCF Lesson 1. And this time, Ron Jacobs is in your face – well for a short time until he gets in to the code of a WCF service. This is a great primer and I look forward to the further lessons. If you want a bit of amusement, look behind Ron at the beginning – you see a kid wandering about, then trying to crawl past so as not to appear in his video. Superb.

Good to have you back, Ron.

ZoneAlarm issue an update

Zonealarm have issued an update to the clash with the Windows XP Update mentioned in a previous post. It seems to work, but unfortunately it also means that Windows Security Centre can’t see that ZoneAlarm is doing its firewall bit on my machine. So I still have to have something switched off to stop my PC nagging me.

ZoneAlarm Clashes with Windows Update

I’ve been rebooting and doing all sorts of things to my main desktop PC tonight, as certain services were not connecting to the internet.

Turns out there is a clash between one of the updates in the recent Tuesday Microsoft XP Release and ZoneAlarm. I picked up the news message from CNet via google. Turns out KB951748 which corrected a dns exploit mucks up ZoneAlarm. The two companies are working it out, but it is not the first time that ZoneAlarm has stopped working on me due to an update of Office or Windows. Arrgh. The options for fixing it aren’t too brilliant at the moment either.

My Cat Died Today

My cat Perdy died today (well, I should say our – I found out my wife had acquired her more or less when she appeared in the house). She had been in decline for the last 12 months or so. We “inherited” her years ago from a young couple we know who were at the time starting a family, and Perdy’s habit of sitting on everything was a bit too much for new parents. Her exact age was uncertain, though we reckon she was at least 16 years old. The last few months were the usual old age problems of not cleaning herself properly, losing a bit of mobility etc, but she still managed to get stuck behind the kitchen units a couple of weeks ago.

Before that she did the usual cat things, sitting on anything you wanted to read, sitting on my computer keyboard, climbing wherever possible. She also did a few different things like being very vocal, never scratched, liked getting her tummy tickled, and at times liked to climb on my shoulders. She illustrated some of the real cat attributes of offsiding (always being on the other side of a door) and played cat chess with the other cats in the street. I think she shared the house with us for about 10 years. And for those who know me, the fact she was black fitted in with my casual wardrobe. I’m not exactly macho in admitting, but I think I was quite attached to the daft cat. I’m quite sad about it.

Another ride out on the motorcycle

Out again for a short ride yesterday, so I took part of the route we travelled on my Qualified Observers test the other week. A nice wee bimble, so I connected up the curly Autocom lead and plugged in the MP3 player to listen to some tunes on the way.

Setting out from home I got some petrol at Shell Lizzie Bryce, just near the house, only needed about half a tank or so but wanted to make sure I was well fueled up for the wee run to the borders. Then off along the A71 to join the Edinburgh bypass, then along to Fairmilehead to take the road South to the Borders.

I left the A720 and turned South to join the A702, this is a gently undulating road with a few villages and 3d stuff going on i.e. it goes left and right and goes up and down, with some bits where both happen. I travelled on this south until you come across the A721 turning left off the A702. On a map it doesn’t look much, but because it is a major intersection the junction is well painted, laid out and has good visibility leading up to it. On the way down the A702 there are a couple of 40 and 30 limits to take account of. On my run yesterday there were a couple of interesting vehicles – both with accelleration belying their size. One was a camper van which could shift once out of the lower gears, and another was a middle size coach. It made planning an overtake interesting as once they were up to 45 ish they would pull quite strongly to 60, making an overtake a bit difficult.

Once at the A702 I cut across the wee twisty road to the A72, which is a fairly well used route north to Edinburgh. On this route it gives a hint at what is to follow. The Scottish Borders are covered with a network of rivers cutting their way to either the East or West Coasts to join the major rivers of the Clyde and Forth, so most roads will find you either following a river valley or cutting up and across a river valley. This means lots of twisting with ascents and descents, which means you have to keep your wits about you. At this point I stayed on the A72, which rather than continuing North cuts West. Turning the corner faces you with a sobering sign – on this road they post temporary warning signs for bikers during the summer months, showing the number killed or seriously injured on the road. Taking this into account I took my time.

The A72 in this direction starts by following a river valley along the side of “Tarth Water” as it heads to join a larger river “Lyne Water” as you can guess the smaller river valley twists and turns as does the road that has been built along the side of it. These twists are also known as the Castle Craig Corners and have unfortunately seen a few accidents. I took it easy along there, having come the other direction to find gravel on my line in the past. As the valley joins the larger river it opens out to be less twisty, but with that comes more speed. This showed itself with a van and car having a race coming the other direction, no problem though as you can see them across the valley to the left under Hog Hill. Then we cross the river further on so the slope is now on our left instead of the right. Coming down to Peebles introduces more sweeping curves with the odd strange corner due to the landscape. Nearer the Western Approach to Peebles we also have more trees – these are conifer based forests so they are there all year round, rather than the hedgerows at the moment which are thicker during the summer months. Along there was a left hander with flowers attached to the fence – a memorial to someone who didn’t do so well on the road.

I had a wee stop at the carpark on the left as you go in to Peebles, and had a wee go at slow maneuvering – still a big weak point for me but practice will help. Then I got off and tucked my gloves into my sleeves while it wasn’t raining. Thankfully it didn’t rain at all that day, but it meant some more flies.

Then I headed North on the A703 Edinburgh road, with a couple of overtakes. I was taking it easy again and perhaps missed one or two safe opportunities because I was dawdling, no massive problem there. Then through Penecuik and joined the A720 at the same place. It was beginning to get into rush hour so I did some filtering up the middle of the two lanes, taking my time. Lots of drivers move out of the way (both trucks and cars) to assist even though there was plenty of room. Thanks to them for that. I take it really steadily and only filter really when the traffic is stationary, moving back in to lane when it gets moving again.

Then off at the Calder junction with a reminder of the white van man syndrome you see there a lot. Two things happen a lot at this junction with the A71 – Sighthill has a lot of delivery company depots so at teatime they all rush home to base. This means a lot of vans making last minute swerves off the bypass onto the slip road – so if you see a red or yellow van in the outside lane at Baberton, watch out for them. The other vans take the right lane for a left turn onto the A71, to try and beat the queue. Such is, but most drivers of that ilk will also race you to the roundabout at the park and ride to get ahead of you. I had a white van undertake me last night, which then meant I had to follow him all the way to the turn off for Kirknewton. An object lesson in patience for me – whatever lane you take on approach to the roundabout at the Hermiston Park and Ride, such a driver will dive to the other lane and try to beat you to the A71. Note to self – spot them at the slip road and let them sit on the tail of someone else.

So a nice wee short ride followed by a quick chat on the phone with Nigel Bowers who is a really nice chap from Staffordshire who earns a few pennies for his retirement helping people to ride their motorcycles better. He has an interesting technical setup on his bike involving three cameras, sony recording kit, Autocom audio wiring and bike to bike comms. He has also posted a large number of videos on Youtube, which can now be viewed in high quality too!