Monthly Archives: August 2012

SQL Server Version

If you want to know details about which version of SQL Server is running on a machine, you can run the following query:

SELECT @@version as [Verbose Version Info]
    , SERVERPROPERTY('productversion') as 'Product Version' 
    , SERVERPROPERTY('productlevel') as 'Patch Level'  
    , SERVERPROPERTY('edition') as 'Product Edition'
    , SERVERPROPERTY('buildclrversion') as 'CLR Version'
    , SERVERPROPERTY('collation') as 'Default Collation'
    , SERVERPROPERTY('instancename') as 'Instance'
    , SERVERPROPERTY('lcid') as 'LCID'
    , SERVERPROPERTY('servername') as 'Server Name'

Also, for the specific version of the databases:

SELECT name, version 
FROM sys.sysdatabases

When would you run this? You get error messages that specify a particular version of SQL Server must be installed for a particular database to be attached/restored (as the case may be).

Visual Studio, Proxy Settings and the Extension Manager

When working through a proxy, Visual Studio 2010 does not automatically pick up any proxy settings which you may have input in your browsers’ settings. So, that makes using the Extension Manager in Visual Studio a bit of a challenge. Or not…

Visual Studio 2010 itself, is a .NET application (written using the awesome WPF), with its own config file.
So firstly, go find the config file. For me, it was devenv.exe.config in the directory D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE (many people will have that directory on their C drive). Then, crack it open and view the System.Net element:

            <ipv6 enabled="true"/>

Now, add your proxy details in there, so it looks like this:

        <defaultProxy useDefaultCredentials="true" enabled="true">
            <proxy usesystemdefault="True" />
            <ipv6 enabled="true"/>

Now, just restart Visual Studio and your extension manager should work like a charm.

Twisting the Triad – MVC

I have spent a lot of time researching the difference between the MVC and MVP design patterns, as I could not really articulate those differences in a conversation, even though I have used them both in practice. When asking around, I found that a lot of other developers also did not actually know the difference either. So I was in good company.

When you go down this road, you encounter the phrase “Twisting the Triad”. The MVP pattern was arrived at by “Twisting the Triad” (among other things). But the many people who talk about twisting the triad never actually stop to explain what that means exactly. And when I started asking colleagues what is meant by that phrase, I was not surprised to find that no-one (not 1) person could explain what twisting the triad means. Rotating the nodes in the diagram is not quite good enough as an explanation because it has no context. And how far are they rotated? ** Blank looks all round **. Some guys thought it had something to do with the arrows in the diagram. Whilst the difference in the directed arrows between the MVC and MVP diagrams does encompass a huge part of the distinction between the 2 patterns, it does not, in any way, explain what “Twisting the Triad” means.

After much cogitation on the issue, I believed I worked it out one day during my morning shower. But I wanted back-up before I was sure. This theory gave me fresh keywords for Googling and I finally stumbled upon this post by a very well-respected guy in the ASP.NET MVC community. See the last paragraph under the heading The Difference?.

So, without further ado, let me explain what the phrase “Twisting the Triad” means, when used to explain how the MVC pattern evolved into the MVP patten. It is all about which node of the diagram is the first point of contact for the user gesture (or user request). Let me explain with an interactive diagram. The diagram below shows the MVC pattern with the nodes following this colour legend:

  • Red: Model
  • Green: View
  • Yellow: Controller

The arrow represents the user gesture. As you can see, with MVC, the first point of contact for the user gesture is the Controller, which then orchestrates how the application handles that user input.
Now, click the button with the text Twist the Triad!

User Gesture

When you twist the triad by clicking the button, the View now becomes the first point of contact for the user gesture, which is observed by the Presenter i.e. it raises events to the Presenter which then handles those events.

  • Red: Model
  • Green: View
  • Yellow: Presenter

So to recap, this post was about Twisting the Triad. I realise there are other differences between the two patterns. But I’m hoping this post clearly articulates the meaning of “Twisting the Triad”, which so many great developers cannot seem to explain.