Sunday, April 10, 2011

At last broadband speeds as promised with Virgin Media and Fibre optic broadband


Norwich broadband speeds over fibre optic cables

I recently changed from old copper cable based broadband provided by Zen Internet to fibre optic provided by Virgin Media, and I must say I am wowed by it's performance. See above. I am paying for 30mbps and I am getting 30mbps!! fancy that, actually getting what you pay for.

For the first time, I can now stream movies from lovefilm directly through my media centre with no stuttering....

Previously I was paying £25 per month for 8mbps over copper lines but actually only getting (if I was lucky) 1 mbps. Now I am paying £21.49 for 6 months then £30.74 and that includes the phone line.

The last time I wrote a blog on this was when I was living in Guildford, South East England, here: http://www.simonrhart.com/2009/03/broadband-speed-test-south-east-england.html

It still amazes me how broadband service company's can charge you a certain fee for a service you have no way of getting. Imagine if this logic was used in all industries, like the motoring industry. You take your car in to have the tyres replaced, but the garage charges you for a full service instead!! madness!

Monday, March 28, 2011

Unnecessary context scrolling in VS 2010 fixed in VS2010 SP1!!

I published a blog post last year regarding the unnecessary context scrolling in Visual Studio 2010 here: http://www.simonrhart.com/2010/04/turning-off-context-menu-scrolling-in.html

This has been fixed in SP1 of VS2010 and can be downloaded here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5

A list of things that has been updated can be found here: http://support.microsoft.com/kb/983509

This particular fix applies to this: https://connect.microsoft.com/VisualStudio/feedback/details/533342




I tested this fix against the VS2010 SP1 beta (above) as it does seem to be fixed, so well done Microsoft!

Management_Install.ps1 cannot be loaded because the execution of scripts is disabled on this system



You might have seen the above when attempting to install the BizTalk ESB Management Portal on a 64-bit operating system.

This particular error has been talked about a lot in the community with the solution but I wanted to detail here in a little bit more detail.

It requires Visual Studio 2010 to compile the code so this is for a development environment:

  1. Start the Windows Powershell command window from the following path: C:\Windows\syswow64\WindowsPowerShell\v1.0\Powershell.exe
  2. Edit the Management_Install.ps1 script and alter the line that sets the VS environment variable to this: $env:VS="${env:ProgramFiles(x86)}\Microsoft Visual Studio 10.0\Common7\IDE"
  3. Run: set-executionpolicy unrestrictedBold
  4. Run the Management_Install.bat from the current powershell command window (don't forget to include current directory i.e. .\Management_Install.bat (notice the .\)
The above should successfully use Visual Studio to build the Management Portal. Of course a better way of doing it would be to use something other than Visual Studio like pure MSBuild.

I need to write something that is suitable for a production environment, so when I do I'll post it here.

Thursday, March 24, 2011

Error: Cannot import wsdl:portType

I recently published a post on fixing an error you might get using the WCF SVCUTIL.exe utility when creating WCF service contracts from WSDL documents here: http://smart421.wordpress.com/2011/03/24/error-cannot-import-wsdlporttype/

Thursday, March 17, 2011

Deploying View... ERROR: The BAM deployment failed. Internal error: The operation terminated unsuccessfully.

I wrote a blog post recently on how to overcome the issue of not having the BAMStarSchema database when attempting to deploy the BAM ESB exceptions definition files as part of a Microsoft BizTalk 2010 ESB Toolkit 2.1 installation. This post can be found here: http://www.simonrhart.com/2011/02/bam-star-schema-database-has-not-been.html

After you get past that and you have a BAMStarSchema database you might then see the following error:

Deploying Activity... Done.
Deploying View... ERROR: The BAM deployment failed.
Internal error: The operation terminated unsuccessfully.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_ExcDatetime', Name of 'ExcByApplication_ExcDatetime'
was being processed.
Errors in the OLAP storage engine: An error occurred while the 'Month' attribute
of the 'ExcByApplication_ExcDatetime' dimension from the 'BAMAnalysis' database
was being processed.
Server: The operation has been cancelled.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_Application', Name of 'ExcByApplication_Application'
was being processed.
Errors in the OLAP storage engine: An error occurred while the 'Application' att
ribute of the 'ExcByApplication_Application' dimension from the 'BAMAnalysis' da
tabase was being processed.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_ExcFaultDescription', Name of 'ExcByApplication_ExcFa
ultDescription' was being processed.
Errors in the OLAP storage engine: An error occurred while the 'FaultDescription
' attribute of the 'ExcByApplication_ExcFaultDescription' dimension from the 'BA
MAnalysis' database was being processed.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_ExcDatetime', Name of 'ExcByApplication_ExcDatetime'
was being processed.
Errors in the OLAP storage engine: An error occurred while the 'Year' attribute
of the 'ExcByApplication_ExcDatetime' dimension from the 'BAMAnalysis' database
was being processed.
OLE DB error: OLE DB or ODBC error: Cannot open database "BAMStarSchema" request
ed by the login. The login failed.; 42000.
Errors in the high-level relational engine. A connection could not be made to th
e data source with the DataSourceID of 'bam_ExcByApplication', Name of 'bam_ExcB
yApplication'.
Errors in the OLAP storage engine: An error occurred while the dimension, with t
he ID of 'ExcByApplication_ExcDatetime', Name of 'ExcByApplication_ExcDatetime'
was being processed.
Errors in the OLAP storage engine: An error occurred while the 'Day' attribute o
f the 'ExcByApplication_ExcDatetime' dimension from the 'BAMAnalysis' database w
as being processed.

This essentially means that the SQL Server user account is not added to the 'db_datareader' role in order to read the BAMStarSchema database.

Simple soultion to fix this is to add the SQL Server service user to that role for the BAMStarSchema database. I this is a development machine, I am running SQL Server under the NT AUTHORITY\NETWORK SERVICE account, so the SQL to fix this could look like the following:

use BAMStarSchema

EXEC sp_addrolemember 'db_datareader', 'NT AUTHORITY\NETWORK SERVICE'

Of course you could do this via SQL Management Studio if you wanted too.

Happy BizTalking!

Wednesday, March 16, 2011

TFS Workbench: An 'WebException' exception occured during the report list load process

Have you seen the following error recently after loading TFS Workbench:

An 'WebException' exception occured during the report list load process. Error Message: The request failed with HTTP status 401: Unauthorized.

If you don't know what TFS Workbench is, take a look at the above link. It is a great tool for managing work items and running SSRS reports in Team Foundation Server. It works with a range of Team Project process templates, I happen to be using Scrum for Team System for TFS 2010.

If you are getting the above error which is really annoying, you'll see the Report Viewer button at the bottom of TFS Workbench grayed out as per the screen shot below:



The annoying thing about that error is that I get a HTTP TFS challenge when I load TFS Workbench because my client is not running within the same domain as the development environment - which is a fairly common scenario - although not ideal sometimes we have no choice.

When I get this challenge I enter my DOMAIN\username and password, hit return and I am authenticated successfully. I know this because I am able to see my team projects in TFS Workbench. The HTTP 401 error tells me the client is able to resolve the reporting services server as if it wasn't, I would get a HTTP 404 error instead. (I added a CNAME record to the DNS server).

So I *think* what is happening is the code is applying the current credentials for the reporting services authentication web service call but not for the TFS Web Service calls.

Perhaps the code looks something like this:

ReportingServicesClient client = new ReportingServicesClient(); client.Credentials = System.Net.CredentialCache.DefaultCredentials;

Who knows, I don't have the code nor have I decompiled it so I don't know...

The solution is to simply add the name of the machine running reporting services along with the password to the Windows Credential Manager (new feature in Windows 7 and Windows Server 2008).

You can load the Credential Manager from Control Panel:




Then click on the Add Windows Credential hyperlink and enter your details in the dialog that pops up:



When you click OK, reload TFS workbench as the TFS Workbench should now resolve the correct credentials for the reporting services server in the Windows Credential store instead of using the default credentials which should fix this issue.


Saturday, March 05, 2011

The local computer is not a member of a windows failover

Don't make the same mistake as I did recently which was installing the wrong edition of Windows Server 2008 R2 in order to make use of Failover Cluster services.

I installed Standard edition of Windows Server 2008 R2 but in order to make use of the Failover Cluster services and managment snap-in, you need either Windows Server 2008 R2 Datacentre or Windows Server 2008 R2 Enterprise.

Attempting to install SQL Failover Cluster in standard edition will give you the following error message during the validation process: The local computer is not a member of a windows failover

This document describes the whole administration process: http://technet.microsoft.com/en-us/library/cc731844(WS.10).aspx

Thursday, March 03, 2011

In Seattle at the MVP Summit 2011


Well I have to say what a great event this year at the MVP Summit 2011. As always Microsoft has done a great job to give us the best experience they possibly can.

This is my 3rd summit and they just keep getting better and better like a fine wine....

Of course I am under NDA so what goes on in Redmond stays in Redmond! It was also a pleasure to catchup with some old friends.

Tuesday, March 01, 2011

Using the Guard pattern to simplify code contracts

I've just published a post on my other blog regarding implementing the Guard pattern in your .NET apps and where Microsoft is taking this approach...

Read it here: http://smart421.wordpress.com/2011/03/01/using-the-guard-pattern-to-simplify-code-contracts/

Saturday, February 26, 2011

The BAM Star Schema database has not been configured. Run bm.exe setup-databases to configure the database

If you have tried setting up the BizTalk ESB Toolkit 2.1 to work with BizTalk 2010 and you're interested in BAM (Business Application Monitoring) for anything going onto and through the bus using BAM (nice feature) then you may get the following error when attempting to deploy the BizTalk ESB BAM definition files for exception handling and itinerary events:

C:\Program Files (x86)\Microsoft BizTalk Server 2010\Tracking>bm deploy-all -Def initionFile:"C:\program files (x86)\Microsoft BizTalk esb toolkit 2.1\bam\micros oft.biztalk.esb.bam.exceptions.xml" Microsoft (R) Business Activity Monitoring Utility Version 3.9.469.0 Copyright (C) Microsoft Corporation. All rights reserved. Using 'BAMPrimaryImport' BAM Primary Import database on server 'FOO-BAR'. .. Deploying Activity... Done. Deploying View... ERROR: The BAM deployment failed. The BAM Star Schema database has not been configured. Run bm.exe setup-databases to configure the database.

These are the commands required to import the Exception and the Itinerary BAM definitions:

Bm.exe deploy-all -DefinitionFile:"C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit 2.1\Bam\Microsoft.BizTalk.ESB.BAM.Itinerary.xml"

and for exception handling definitions:

Bm.exe deploy-all -DefinitionFile:"C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit 2.1\Bam\Microsoft.BizTalk.ESB.BAM.Exception.xml"

So how do you get the BAMStarSchema database into SQL Server? This is not particually intuitive but it is done during the BizTalk configuration process and in particular when configuring the BAM Tools feature:



If you got the above error, it was probably likely to do with the fact you didn't check the Enable Analysis Services for BAM aggregations checkbox during configuration of BizTalk after setup. When you check that checkbox, two more databases will appear in the Database Name list; BAMAnalysis and BAMStarSchema. Clicking Apply Configuration creates those missing databases ready for the activity import later.

Once you have created those databases, re-run the ESB BAM activity import and you should get something like the following:

C:\Program Files (x86)\Microsoft BizTalk Server 2010\Tracking>bm deploy-all -Def
initionFile:"C:\program files (x86)\Microsoft BizTalk esb toolkit 2.1\bam\micros
oft.biztalk.esb.bam.exceptions.xml"
Microsoft (R) Business Activity Monitoring Utility Version 3.9.469.0
Copyright (C) Microsoft Corporation. All rights reserved.

Using 'BAMPrimaryImport' BAM Primary Import database on server 'FOO-BAR'.
..

Deploying Activity... Done.
Deploying View... Done.
Deploying Alert... Done.
Deploying Security... Done.

The import may still fail as it might be due to the way you have configured SQL Server, then I will write another post as to what the cause of this might be sometime soon...

UPDATE: If deploying Views fails for you, check this post as it might help: http://www.simonrhart.com/2011/03/deploying-view-error-bam-deployment.html

Thursday, February 24, 2011

How to package your Windows CE applications into a CAB during a nightly build process

I just wrote a post on how to package up your Windows Mobile/Phone/CE applications into a CAB file as part of your automated build process using either TFS 2010 or TFS 2008 and MSBuild. Check it out here:

http://smart421.wordpress.com/2011/02/24/how-to-package-your-windows-ce-applications-into-a-cab-during-a-nightly-build-process/

Wednesday, February 23, 2011

My/our other blog

For the regular readers of my blog, I also blog on my companys weblog found over at http://smart421.wordpress.com.

If you're interested in SOA and Enterprise Architecture, you'll like that blog. The stuff I write on there will be more lower code-level in most cases.

Cheers.

Microsoft Notification Services Control Utility 9.0.242.0 Could not load file or assembly 'Microsoft.SqlServer.Instapi, Version=9.0.242.0

Have you seen this error recently when attempting to configure BAM Tools as part of a BizTalk 2010 installation:

2011-02-22 13:06:04:2007 [Error] BAMTools Error configuring
Error executing bm.exe with tracing enabled. (Microsoft.BizTalk.Bam.CfgExtHelper.Utility)
Error executing process: C:\Program Files (x86)\Microsoft BizTalk Server 2010\Tracking\bm.exe (Microsoft.BizTalk.Bam.CfgExtHelper.Utility)
Microsoft (R) Business Activity Monitoring Utility Version 3.9.469.0Copyright (C) Microsoft Corporation. All rights reserved.ERROR: Failed to set up BAM database(s). There was a failure while executing nscontrol.exe. Error:"Microsoft Notification Services Control Utility 9.0.242.0╕ Microsoft Corp. All rights reserved.An error was encountered when running this command.Could not load file or assembly 'Microsoft.SqlServer.Instapi, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified." (Microsoft.BizTalk.Bam.CfgExtHelper.Utility)

This screen might be familiar to you if you have seen the above once or twice:




This message is frustrating as you need the BAM Tools configured before you can configure the BAM Portal. So even if you don't care about alerting, but you do care about BAM, you still need this to work before you can continue to the next step.

After following the Installing BizTalk Server 2010 on Windows Server 2008 R2 and 2008.docx file, I was still getting the above exception. You can download this document here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b77d6a4f-8b41-470e-a58c-730dc5859b38&displaylang=en

The BizTalk 2010 installation document mentions that you need to install Microsoft SQL Server 2005 Notification Services if you want BAM Alerts because it is not included in Microsoft SQL Server 2008 R2 - which is the recommended SQL Server version for BizTalk 2010. You need Notification Services if you want any kind of BAM functionality - not just alerting.

As mentioned, the document recommends SQL Server 2008 R2 for BizTalk 2010 and if you want BAM functionality, you need to install SQL Server Notification services. It recommends you install 3 components that form SQL Server 2005 Notifications that can be downloaded from MSDN, they are:

  1. Microsoft SQL Server Native Client (sqlncli_x64.msi)
  2. Microsoft SQL Server 2005 Management Objects Collection (SQLServer_XMO_x64.msi)
  3. Microsoft SQL Server Notification Services Client Components (SQLServer2005_NS_x64.msi)
So this all seems very straight forward. After installing the above components I was still getting the same error when attempting to configure BAM.

If we have a closer look at the error message, notice the program that is generating the error: C:\Program Files (x86)\Microsoft BizTalk Server 2010\Tracking\bm.exe. Also notice the assembly and assembly version bm.exe is looking for: Microsoft.SqlServer.Instapi, Version=9.0.242.0. So I looked for this dependency in the current folder (where bm is running) and couldn't see it. So it will either be on the PATH or in the GAC. Not running any tools to figure out the location where the CLR was looking (I'm lazy!), I looked in the GAC and noticed the file Microsoft.SqlServer.Instapi was present. But it wasn't the version 9.0.242.0 bm.exe was looking for. In the registry was version 10.0.0.0.

So the first thing I thought I'd try was to force the loading of the version 10.0.0.0 assembly instead of the version 9.0.242.0 version it was looking for. As bm.exe is managed code, I could create a probe that forced the load of version 10.0.0.0 by adding this to the bm.exe.config file. After doing this, on start up of the bm.exe, it overwrites the config file! so this change was completely useless. So then I thought I could add this probe to the machine.config file but thought this is getting very silly now.

The next thing I turned to my helpful friend, Google. searching hi and low for a solution to this the only concrete thing I could find was this post on the Microsoft Social forums: http://social.msdn.microsoft.com/Forums/en/sqlsmoanddmo/thread/e85cbf20-4a81-4059-88a9-6666bfeb02dc

A response from James K. Howey in the above post from Microsoft suggests its an issue with the SQL Server 2005 Management Objects Collection and this issue might be fixed in Sp2.

"I have reproduced this issue in house and can confirm that this is a problem with the Microsoft SQL Server 2005 Management Objects Collection. We will consider this issue for inclusion in Service Pack 2."

James also mentions that he tried GAC'ing the version 9 assembly but this failed with different error suggesting that the managed assembly is in fact a wrapper around something else or perhaps has other dependencies.

This was getting very messy, and all I wanted was for the BAM Portal to work - surely this is not much to ask! should it really be this hard...

So the next thing I thought was it seems BizTalk 2010 is designed to talk to SQL Server 2005 but recommends SQL Server 2008 R2. But there seems to be low-level dependencies it requires from the older SQL version. I didn't want to have to install the fully blown SQL Server 2005 on this machine so instead installed Notification Services from the fully blown SQL Server 2005 ISO.

After this I noticed the assembly Microsoft.SqlServer.Instapi version 9.0.242.0 in the GAC!!! Feeling rather upbeat, I re-executed the BAM Tools configuration (bm.exe) and it worked!:




Conclusion:

If you want BAM functionality in your BizTalk 2010 environment, do not install the Notification Services MSI's referenced in the BizTalk 2010 install guide, instead install from the fully blown SQL Server 2005 ISO from MSDN Subscriptions.

Happy BizTalk'in!

Thursday, December 30, 2010

Free PostSharp licence courtesy of Gael Fraiteur up for grabs

It seems I can't give away free licences for software these days!!

I have a free "legit" licence of PostSharp that Gael Fraiteur of SharpCrafters gave to me to give to a friend. But after offering it around nobody seems to want it, so the first person to leave a comment can have it!

PostSharp is a framework that allows you to implement Aspect Oriented Programming (AOP) in your software code. AOP allows a cleaner and simpler architecture by abstracting out your cross-cutting concerns. Cross-cutting concerns are the things that slice vertically across layers in your application such as logging, instrumentation, caching etc.

For some simple tutorials on PostSharp see here: http://www.sharpcrafters.com/postsharp/documentation/getting-started

Also check this out: http://www.sharpcrafters.com/

The really cool thing is with this tool is it supports Windows Phone 7, which is great as normally mobile platforms are not normally supported for advanced frameworks such as this. If I recall PostSharp did support the .NET Compact Framework but only up to v2.0. Need to confirm this though.

Thanks to Gael Fraiteur for the free licences and keep up the good work!

Cheers

Tuesday, November 16, 2010

Smart421

I have recently left Hitachi Consulting and joined a similar Microsoft and Oracle Gold Partner consultancy company named Smart421 where I work as a Technical Architect in the Microsoft space.

Smart421 offer Consultancy, Service Management, Data Management and Business Integration and is part of a larger public company called KCOM.

KCOM were originally a large telecommunication company but now they consist of: KC, eclipse, KCOM and Smart421.

Smart421 specializes in complex enterprise integration projects but more recently full system design the implementation. We have a lot of expertise in SOA Governance and PCI DSS.

I form part of the Microsoft practice but we also have a fairly large Java practice with particular focus on IBM WebSphere, DataPower and many other IBM tools/technologies. Smart421 prides itself in Enterprise Architecture as we are active members of the Open Group and have many TOGAF practitioners.

So far I'm liking it a lot as I get to be involved in lot of different things and hope soon to be a certified TOGAF practitioner.

Saturday, November 06, 2010

Smartphone Essentials WP7 Article - not completely true...

I was in a local newsagent the other day waiting for my train and noticed a magazine "Smartphone Essentials" (UK magazine) as it had a spread on the newly released Windows Phone 7 device. I only had a couple of minutes, so I skipped to the Windows Phone 7 bits.

I have to say the authors for this magazine need to do more research before they publish this stuff. Windows Phone 7 Series is not "Brand new from the ground up". The magazine was suggesting that WP7 is a completely new OS built from scratch. This is simply not true. When people read this, they generally assume 1 thing, it's brand new so it will be full of bugs and issues so I'm going to wait for v.NEXT.

Windows Phone 7 series has a new shell and application framework that is fully managed code that sits on Windows CE 7 OS. Windows CE is the same OS used in Windows Mobile except in Windows Mobile the latest version used is Windows CE 5.2.

The other thing that is not true was that fact they mentioned Windows Mobile is dead. Windows Mobile is still being sold and is still supported by Microsoft today. It will be renamed soon to Windows Embedded Handheld which is essentially still the same Windows Mobile shell OS.

There is still a fairly large enterprise market with investments in Windows Mobile that are being used for mission critical applications today and will continue to do so. Windows Embeded Handheld will be geard towards business users. Some Windows Mobile devices such as the MC65 and ES400 will port over to the new OS.

Smartphone Essentials: just because Windows Mobile is not competing too well against platforms such as Android and the iPhone in the consumer markets, doesn't make it a dead platform. There is another world out there.

Friday, November 05, 2010

SELECT TOP (n) in Entity Framework or LINQ to SQL

I have recently inherited a project that makes use of WCF Data Services with the Entity Framework being used as the ORM to facilitate this with Microsoft SQL Server 2008 R2.

I had a requirement to only ever retrieve a maximum of 100 items no matter the query. In SQL this is easy and can be achieved using the SELECT TOP (N).. syntax.

Using a lambda expression to return a collection of IQueryable objects can be achieved simply as the following:
IQueryable<MyObject> resultSet =
service.MyObjects.Where(c => c.Name.Contains(searchText))
.OrderBy(x => x.Name)
.Take(100);
Remember here that the actual REST call is not made until you call ToList() on the collection. This query simply creates the REST URL as a string.

But using the extension method Take(n) will translate to TOP in SQL.

Saturday, October 30, 2010

Free Not For Resale MSDN Subscription up for grabs!!





I have in my possession a Not For Resale Visual Studio 2010 Ultimate with MSDN Subscription, and it's up for grabs. Like all other Microsoft MVPs I had 3 to give away, I have given away 2 already but now I have just 1 left.

So I can't think who to give it to as the two lucky people that received this free subscription were the only ones that I know of who wanted to get into programming or wanted to move to Visual Studio 2010 and the 2010 wave of Microsoft products. Most of the people I know receive Visual Studio 2010 as part of their corporate MSDN licence provided by the company they work for.

I thought about who to give this to and I couldn't really think of anyone that I thought really derserves it. So instead I took an idea from what some other MVPs have been doing and that is to present a challenge to the community and the best or the right answer wins the MSDN subscription! That's fair don't you think...


The Challenge

As I am passionate about Technical Architecture and good clean code and the fact I have done lots of code reviews in my career, I thought the challenge could be around best coding practice or the best example of clean maintainable easy to understand code.

So the challenge is really: write an application for the new Windows Phone 7 Series device using the new free tools (Visual Studio 2010 Express with Windows Phone 7 Series) that promotes good architectural design.

The things I'm looking for and this will greatly increase your chance of winning are as follows:

  1. Good OO, pay attention to the single responsibility principle. No procedural code
  2. Code must be maintainable
  3. Easy to understand
  4. Good system design patterns such as, command, MVVM, MVP, repository etc
  5. Good code coverage (doesn't need to be 100%) but if used will make achieving 1, 2 and 3 on this list a lot more likely
  6. You'll get extra marks if you make use of the IoC container I checked in to codeplex: http://wp7.codeplex.com/ - note that project is targeting the Beta tools of Windows Phone 7, I haven't got round to updating it yet but it should work with the RTM release of Windows phone

So..... the ultimate question you're probably asking is, what application should you write? well it doesn't matter. It could be an application as simple as a calculator to something that makes use of networking or Windows Azure for example. The person that wins this will be win it based on good architecture code design.

You've got until Tue 26th November to get something to me to review. Then I'll announce the winner before the end of November. The subscription does expire soon which is why I'm only giving about 3-4 weeks to do this.

Send submissions to simon (at) simonrhart (dot) com. If you have any questions then leave a comment on this post.

Happy coding!!

Friday, October 22, 2010

TFS 2010 Backup Power Tool - Grant Backup Plan Permission Failed

Now that TFS Power Tools has been released we can take advantage of the Team Foundation Server Backup feature that makes backing up TFS so much easier than it used to be.

The TFS Power Tools contain tools client side too, it's just the backup feature is designed to actually run on the TFS server itself.

It supports backing up not only all your collections but also your Reporting Server database (if using SQL Server Reporting Services integration) and your SharePoint databases if using MOSS for enhanced reporting. It works very much like the standard Windows Server Backup utility that is shipped with Windows Server 2008 R2.

You have an option specify how many copies of the backup to keep. You have to backup to a network location. You can't backup to local disk like you can with Windows Server Backup. This tool is designed to worry about backing up TFS so you don't have to.

The tool integrates with the Team Foundation Server Administration Console. So you create a backup plan from within there. You can specify when the backup should run i.e. daily, weekly, time of day etc. It can run under a domain or local account to.

There are a few articles out there that step you through the process of setting this up so I'm not going to do it here. Instead I came across a nice "issue" with it when setting it up that I thought might save other people time as I burnt quite a bit of time on this. Here is a very good example of this: http://myalmblog.com/2010/09/12/tfs-2010-power-tools-tfs-backup-and-restore-hands-on-lab/

So my issue was when getting to the end the readiness checks were failing with the Grant Backup Plan Permissions step. Which was weird as I had write access to the UNC path to which the backup was writing. The other strange thing was I discovered a file in the UNC path after running this readiness check.

After investigating further and looking at the log file (snip copied here) I figured out what was wrong:
Error  @15:35:29.014] System.UnauthorizedAccessException: Access to the path '\\server\backup\TFSBackups\Tfs_Configuration_20101022163528.bak' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.Delete(String path)
at Microsoft.TeamFoundation.PowerTools.Admin.Helpers.BackupFactory.TestBackupCreation(String path)
[Error @15:35:29.060] !Verify Error!: Account DOMAIN\user failed to create backups using path \\server\backup\TFSBackups
[Info @15:35:29.060] "Verify: Grant Backup Plan Permissions\Root\VerifyDummyBackupCreation(VerifyTestBackupCreatedSuccessfully): Exiting Verification with state Completed and result Error"
[Info @15:35:29.060] !Verify Result!: 5 Completed, 0 Skipped: 4 Success, 1 Errors, 0 Warnings
Notice what it is doing yet!? It basically writes a file to the UNC path to check for write permissions - BUT not as the service account, it uses the current logged on user account (this is a bug I'm sure). But what is failing is actually the deletion of the file.

Because of this the readiness checks fail and you can't continue. After looking at the permissions (or should I say IT looking at the permissions) it turns out I didn't have Delete permission for the current logged on user for that UNC path. Once setting the Delete permission to true, the problem went away and now I have a successful backup plan in place!

Tuesday, October 19, 2010

Power up failed (vrc=VERR_VMX_MSR_LOCKED_OR_DISABLED, rc=E_FAIL (0X80004005))

I recently tried to use VirtualBox to run a Virtual Machine on my new laptop which is a HP EliteBook 8530w. But after attempting to start the VM I encountered the following error: Power up failed (vrc=VERR_VMX_MSR_LOCKED_OR_DISABLED, rc=E_FAIL (0X80004005))

So as per the return code, this is telling me that VT-x is either locked or not enabled. It can't be locked as this is running on Windows 7 which does not have any other virtualizer running, i.e. VirtualPC or Hyper-V. It is enabled as I explicitly set virtualization in the BIOS. It turns out that I needed to also enable Txt Technology. Once Txt Technology was enabled, the VM fire-up! nice

I am not normally a VM person, but my new laptop is a beast. 8Gb of RAM so I can allocate 4Gb to the VM and it runs like a host OS.