December 9th, 2009
Over the last few evenings I have been reviewing code done by a fellow developer, and have come to a conclusion.
The .NET code regions (aka Collapse Regions, Collapsible blocks and dear god knows what else in other languages) can really be misused.
Correct use of regions can group common sections of code – for example code that all interacts with the same property (you might have the property itself and also a number of private functions that work with or derive from the property), for improving readability (yes, we all know that we should not have units / classes that size but we all have right?) and generally for being neat (it is cool seeing it all shrink down isn’t it?). BUT, likewise you can seriously go overboard.
This code in question has many levels of nest regions, and although it certainly does tidy the code up, it certainly does not help it’s maintainability.
I’m sure I’m not alone in the fact that I typically use a lot of keyboard shortcuts when I’m developing, but adding many many many regions, with many layers of nesting, this makes keyboard shortcuts for the region collapse / expand pretty useless. No matter what you do, you always seem to end up with too much or too little code on screen – either way, it makes development difficult.
Which brings onto a final point … if this is the case (i.e. the code is damn near impossible to understand at a glance due to the structuring in place), doesn’t this qualify as un-maintainable code? Perhaps we should be setting up rules on TFS and the like to detect the layers of nested regions, and flag them for review when it sees someone going to excess?
Comments, as always, welcomed
Posted in Programming, Visual Studio | No Comments »
November 16th, 2009
I’ve just had a slight dance with the new release of the Azure Tools (that adds VS 2010 Beta 2 compatibility), and thought I would quickly note down the issues I hit – and of course the solutions!
First off, as you can expect, a few things have been renamed:
RoleManager is now RoleEnvironment
ILocalResource is now LocalResource
Don’t forget to release the release notes and recreate your local dev storage databases … but watch out – the command is incorrect – the docs are missing a colon! The command should be dsinit /sqlinstance:<instance>.
Posted in Programming, Visual Studio | No Comments »
October 8th, 2009
As I’m sure some of my (two!) regular readers will remember, I have previously blogged about the security (or lack thereof) when it comes to using Social Networking websites – and specifically when you make use of any of the applications on them (here’s looking at you Facebook).
What’s more disturbing is that I came across this article today, which is equally concerned about it. It does actually increase my concern about Facebook – I hadn’t realised that when a friend takes a quiz, or makes use of an application, they can actually provide access to MY data through them. Interestingly there ARE some controls on Facebook to limit this, but I have yet to find them through a route in settings – but instead you have to use a direct URL: http://www.facebook.com/privacy/?view=platform&tab=other
Maybe you should all check to see what is accessible (take the quiz mentioned in the article, you might be surprised) and adjust your settings …
I’m all for Social Networking, but please, can we at least have some accountability?
Posted in General | No Comments »
September 24th, 2009
I attended Cloud Camp last night in Edinburgh at The Appleton Tower @ Edinburgh University and it certainly delivered a few insights.
As you probably are aware if you read my blog, I work fairly heavily with the Microsoft Azure cloud at present, although this isn’t to say that I have not investigated the other possibilities such as the Amazon Elastic Compute (EC2) offering.
Why did we choose Azure? Quite simply it is a good way to ensure that we are using the same tech stack from top to bottom, which for us allows us to greatly improves our maintainability of our toolset.
There were a couple of product vendors there that did spark my interest: aicache and rightscale. It’s a pity that the management vendors do not support Private Clouds based around the Microsoft Hyper-V arrangement, or we would have seriously taken a look – as it is, they only support VMWare. Shame. Seems a hole in the market!
Another thing mentioned is that it is time to nominate for the Scottish Open Source Developers Award! It’s actually the first time I’ve heard of the award, but it seems a good idea. Unfortunately it seems that their website is down.
You can get an idea of the action by having a look at the #CCScotland tweets from last night: http://twitter.com/#search?q=%23ccscotland
There is one thing that I realised while sitting outside watching the world go by … I need to go back to University
Posted in General, Programming | No Comments »
September 16th, 2009
Hit another Gotcha with CRM 4.0 today when enabling the Outlook integration – when you install it under 64-bit, the odds on it will insist that you do not have Outlook installed, or it is not your default mail client.
To get round this, you need to tweak the registry a little:
Change the default value in both these keys to “Microsoft Outlook”
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Clients\Mail
HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail
And restart setup.
Problem solved
Posted in Sys Admin | No Comments »
September 15th, 2009
I wish installers patched round things like this, especially when they interface with standard mechanisms.
We have decided to have a look at Microsoft Dynamics CRM at work, and carrying out the installation seems fairly painless – until right at the end of the wizard I got an error.
“Action Microsoft.Crm.Setup.Server.MsiInstallServerAction failed. This update package could not be opened. Verify that the update package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Install update package”
It seems that the installer uses the Internet Explorer cache, which defaults to 50Mb. And guess what – the update is more than this, so it happily deletes it after downloading.
Fail! Simple increase the cache size and start again.
Posted in Sys Admin | No Comments »
September 9th, 2009
Argh – trying to debug an application locally with the Azure Dev Framework, and got this:
Yet another really helpful error message guys. Surely in dev stuff (and CTP’s) it’s worth actually giving lots of error data – at least we might understand it and be able to submit more detailed reports back
Posted in Programming, Visual Studio | No Comments »
September 8th, 2009
So you are wanting to be more secure in your day to day activities on the web …
Well, the first thing you need to learn is checking up on where you have BEEN (yes that right, not where you are going, but where you have been!).
Maybe that doesn’t make sense, but let me give you an example.
You, like most people, probably use an online (free) webmail service, or perhaps the webmail service that your Internet Service Provider gives you when you sign up.
Have you had a look to see if it actually tells you something simple such as when you last logged in? Or even where (as in the IP Address)? This simple piece of information is usually enough of a red light should someone gain access to your account from a location that you do not normally use – or a time that you are usually at work, in bed, whatever.
But hold up. Who actually understands what an IP Address is, let alone read one (ok, outside of this circle eh?)?
Maybe we need to come up with a good way of identifying the “norm” for a particular user from a list of previous addresses, and flagging anything unexpected up for them. Maybe at that point you could carry out additional authentication before allowing access to data.
Either way, I can not help but feel that in this digital age, something has to happen to improve digital identity security.
Posted in General | No Comments »
August 24th, 2009
I had to come up with a quick way to do paging of a List of objects today as we have been hitting the packet limit on WCF – we could have easily increased the limit, but in my opinion this just masks the error and doesn’t actually fix it.
Anyway, the quick solution that I implemented is roughly as follows:
Change the interface definition on the WCF to allow you to pass in a page number
In your Data Access Layer code, take the page number and do something like:
int skipCount = (pageNumber – 1) * pageSize;
foreach (Signup alpha in webDal.Signups.Skip(skipCount).Take(pageSize))
{
// Do something else where
}
As you can see – very simple, no fuss and uses Linq. And in theory it shouldn’t load SQL either thanks to the Skip function.
I believe the RIA Services toolkit is going to have paging in there, but I don’t want to switch everything over right now
Posted in Programming, Visual Studio | No Comments »
August 23rd, 2009
Almost three years ago I wrote a piece about the fact that Royal Mail did not provide any means of integrating with their “business class” SmartStamp postage printing software.
In three years nothing has changed.
But, something has.
More people are now using CRM solutions, such as Sales Force, or even self hosted solutions such as Microsoft Dynamics.
Even more are running SugarCRM or any of the other million open source offerings.
Ebay / Paypal have a deal to allow you to print off shipping labels, with postage, via Royal Mail (through their online service, a bit like SmartStamp).
Hey, but you have guessed it. Still no SDK for SmartStamp.
Personally, I find it slightly nuts that a team of developers can write something like this, and not consider the fact that third parties will want to integrate. I’m even more amazed that the architects, managers, and so forth have not realised there is probably an untapped fund stream there!
Posted in General, Programming | 1 Comment »