Posts

Code, Quality, and NDepend

Image
I got the idea of Quality with a capital “Q” ingrained upon me years ago when I read the philosophical novel Zen and the Art of Motorcycle Maintenance .  The main thing I took away from the book is that whatever human endeavor you are engaged in, you should let your actions be governed by a desire to do things well, with a constant and abiding interest in achieving the highest possible Quality.  Naturally this idea can (and should) be applied to the complex world of software development, particularly with respect to the question of Code Quality.  It’s not always easy to live this way.  Whatever point we happen to be at in our lives or upon our career path, our knowledge only goes so far.  And sometimes we take shortcuts; it’s often tempting to take the easy (or lazy) way out, thinking we don’t have time to do things well or to do them right. However, in this day and age, .Net developers are fortunate to have a plethora of 3rd party tools available to us to h...

PowerShell 2.0 for Windows Server 2008 R2

Image
This post is simply a brief moan about a particular instance of poor documentation on Microsoft’s web sites, and an attempt to fill that gap. I’ve been reading the Pragmatic Programmer which advocates learning new languages on a regular basis, and also learning your computer’s shell language instead of just relying on the GUI.  I’ve dabbled in a bit of PowerShell and I have a sense of how powerful it is for manipulating SharePoint, SQL Server, the Windows OS, and anything else you might like to manipulate with script, but haven’t made the time to really learn it, so I thought that would be a great way to apply those recommendations.  So I thought I’d get onto by Windows Server 2008 R2 development VM and download the latest version of PowerShell (2.0).  That’s why I thought I’d write this quick post.  If you followed the above thought process, you might experience the same confusion I did as a PowerShell newbie. You might run across pages like this one (which ...

Using XML Serialization to render front-end web pages from a custom CMS built in MVC2

Image
This post is about a technique I developed on a recent project which may be of interest.  This project seemed naturally to call for SharePoint 2010 as it had a CMS component, but it needed to be hosted in the Windows Azure cloud.  As of this writing, (although some seem to have tried with an Azure VM role ) it generally doesn’t seem to be possible to host SharePoint in Windows Azure; I guess it’s because the kind of “wrapper” that they have you put around an Azure application (the “role entry point”) so they can manage it in the cloud, and the stateless nature of Windows Azure apps, doesn’t really lend itself to SharePoint’s architecture.  So I decided to do the project using ASP.NET’s MVC2 Framework and building a custom CMS, in which I used XML serialization to enable a simple publishing capability to provide users with “preview” and “live” versions of web pages.  I needed to ramp up quickly, and as I’ve generally been impressed with the quality of Apress tec...

Request.Browser.IsMobileDevice

It's known that the .Net framework's "Request.Browser.IsMobileDevice" is not entirely reliable in all cases as evidenced by the fact that our MVC2 site wasn't correctly detecting Android as a mobile, and as evidenced by some hits you can see in this search: http://www.bing.com/search?q=request.browser.ismobiledevice&src=IE-SearchBox&FORM=IE8SRC If we really want reliable mobile detection we need to incorporate the WURFL database (a giant XML file of every mobile device - see http://wurfl.sourceforge.net/ ) and from what I’ve seen, the preferred implementation of this for .Net appears to be “51degrees.mobi” … http://51degrees.codeplex.com/ On the MVC2 project I’ve been working on recently, I was using 51degrees.mobi in development; it seemed very effective, and you can do incredibly granular detection with it, but was a bit heavyweight for my particular project, the requirements of which were (in the case of mobile detection) simply to detect wheth...

Server error in “AUTHENTICATE” application…

Image
I couldn’t help but be amused… I received an email from the Microsoft Certification Program telling me I needed to log into their site just to keep my ID active.  So I clicked the link in the email that said “Log into the MCP Member Site”…   On the login page I entered my Windows Live ID, and got a YSOD (Yellow Screen of Death)! Tsk tsk! Happens to the best of ‘em…

Bogus Windows Azure Tools Installer Error Message

Image
Many have probably gone before me, and figured this out, but just thought I’d post this small tip.  (At least one person had a similar problem as shown here ). If you go here to get the Windows Azure tools installer, and you install on a machine or VM that happens to ONLY have Visual Studio 2010 on it, but not Visual Studio 2008, you get this error message: Huh?  This seems alarming, especially since it says “it is recommended that you address these warnings before continuing.” But there’s no cause for Alarm, because it’s actually Bogus, with a capital “B”. Why should I care that it won’t install the tools for VS 2008, if I don’t have VS 2008 on my machine?  Couldn’t MS have made the installer smart enough to figure that out, and shouldn’t that be okay?  Or display a more intelligent message, like “you don’t appear to have Visual Studio 2008 installed, so only the tools for VS 2010 will be installed” ? Clicking “Continue” (with a capital “C”) causes it ...

Lambda expressions and LINQ to XML

You know you’ve become a true geek when you find yourself getting excited about Lambda expressions.  I know it’s old news to some, but I’m just posting a couple of links (no pun intended) here to remind myself of a couple of cool postings on MSDN about Functional Programming and Lambda expressions, etc.  If you’re a C# programmer and you haven’t used this feature of the C# language, you really need to take a look at it.  It makes for some very readable, very terse yet powerful code.  In my own coding I’m just scratching the surface of what’s possible here but the more I use these techniques the more I like them. Eric White’s posting on Lambda Expressions Eric White’s posting on “Query Composition using Functional Programming Techniques in C# 3.0