Thursday, 01 March 2012
First look at Visual Studio 11 Beta

Just a quick blog article on my first thoughts on Visual Studio 11 Beta. I suppose the first thing that hits me after the web install (you will need to reboot) is "oh its very monochrome like.". I think I can understand the choice behind the monochrome like feel, its probably been targeted towards developers like myself who use ridiculously high resolutions to get everything on the screen. It also reminds me of some Java IDE's and some Linux GUI applications. 

image

Have a look in Tools > Options and we have the ability to switch to a darker themed version. I can already think of 4 developers I know who would prefer this type of theme, however the majority of developers will probably be looking for ways to get the old themes back.

image

What I do find nice though, is that Microsoft appear to have geared the IDE towards the ability of the developers machine. Its a good idea because not every developer is given the best machine for running a development environment.

image

The Solution Explorer
The solution explorer appears to have changed and appears to be a hybrid between the class explorer and the old solution explorer.

image

Verdict so far?

The new GUI appeared highly responsive, however I was using it from a machine with a lot of memory and an SSD drive. I personally like the monochrome type feel of the IDE although I know I'll be in the minority. I noticed that the Source Control providers such as GIT and Mercurial I had installed on my machine didn't come up in the source control provider drop down, so we'll probably need new versions of these plugins (among others) created for when the product is finally released.

Anyway, more later.

posted on Thursday, 01 March 2012 10:56:01 (GMT Standard Time, UTC+00:00)  #    Comments [0]

 Wednesday, 15 February 2012

Its true Sharepoint DataForm Webparts are incredibly easy to develop if you need to query lists or data without the need to create fully grown webparts from scratch in SharePoint they are definitely the way to go. However there is a but and that is that most of the SharePoint Universe appears to believe that everyone creates DW webparts on their production environment using SharePoint Designer. In many production environments SharePoint Designer is disabled as default. If you have stand alone webparts this may not be an issue, but if you have a set of DataForm webparts that need to be linked to each other you're going to face all kinds of problems when you try to link them to each other on a target environment.

So for example lets say I have developed some webparts on my development SharePoint box. I access a list from my webparts, I have also had the sense to take the list from the production environment as a template so I won't have any conflicts with field names. All works fine my webparts talk to each other but then when I deploy them and try to get them to talk to each other they just refresh the page. Even if I've created connections between the webparts, what happened?

Enter what I feel is the Achilles heal of the DataForm Webpart. If you created those webparts in SharePoint Designer and created the webpart connection between them in there you probably didn't realise that it places a bit of code in there which looks something like this.

 

<xsl:value-of select="ddwrt:GenFireConnection(concat('g_cb4fe2eb_738d_4bbb_8ec7_ce81633092a5*',$fields),string(''))"></xsl:value-of>
 

The problem in the above bit of code, is that when you make a webpart connection in SharePoint Designer with DataForm Webparts it hard codes the GUID of the target webpart. When you deploy your webparts the target environment will give them different GUID's. Even if you try to re-establish the connections in SharePoint's Web Interface this won't make a difference at all.

If you are wondering what GenFireConnection does and I appreciate there is precious little documentation about it, most of it being on previous versions of SharePoint. Its creates an ASP.NET post back link which contains the consumer webpart  GUID (highlighted above) and the data we are sending to our consumer webpart such as the value of a field.

Work Around
The only work arounds I have found to this little problem, unless anyone else has a better method, is to.

  1. Create the link in the SharePoint web interface on the target environment after the webparts are deployed and placed on the page.
  2. Select "Edit Webpart" and use the XSL Editor to change the GUID on the "GenFireConnection" on the calling webpart  to the new GUID of the target webpart.

The other option is to just use query strings in your lists. SharePoint Designer will quite happily accommodate this using parameters you can then pass this around in links around fields.

The above seems to always work for me, although I would love to know if there is a more elegant solution to this.

posted on Wednesday, 15 February 2012 13:15:51 (GMT Standard Time, UTC+00:00)  #    Comments [0]

 Sunday, 12 February 2012
Watching SkyPlayer and other content from your PC on your TV

This article can apply to just about any content that you can watch on your PC but just can't watch on your TV be it via XBOX, PS3 or some type of set top box we have to face the facts that some services are either limited on these devices or have content restrictions.

So for example lets say I want to watch a show that is on SkyPlayer on my TV via my XBOX. You may discover that that show is restricted for viewing via Xbox on your TV but you are perfectly free to view that content on your PC. Sounds silly doesn't it?

Anyway the next option is to connect your laptop or PC to your TV and that can often be pretty impractical especially if you want to use the laptop at the same time.

The Solution
Enter this lovely box of tricks by StarTech called a Ethernet to VGA Over IP Converter, so how does this help?

StarTech

This clever little device plugs into your home network and has a VGA connector on the back that plugs into your TV or monitor. You then install drivers for the device on your laptop which will discover this device on your network and treat it as an extra monitor!

But it doesn't just stop there, the device is also a USB server. That means you can plug any USB device into it and your laptop will think its plugged into one of its local USB ports. You're probably wondering why? Well you may want to plug a USB mouse and keyboard in there so you can control what's happening on the screen from near the TV.

I basically use it by dragging the video I am watching onto the extended display my laptop suddenly has via this device and can carry on using my laptop while at the same time its playing a video in the other window.

So just how good is this?
There is a "but" though, your were expecting one weren't you? You can use this device over WiFi but to get a good quality broadcast I resorted to both my machine and the device being on a 100meg wired network. In theory if I had a 300meg WiFi network instead of 54meg it would have had the same result?

posted on Sunday, 12 February 2012 20:47:00 (GMT Standard Time, UTC+00:00)  #    Comments [0]

 Friday, 20 January 2012
SQL Insert Statement Issues

Have you ever got the following SQL Insert statement issues

"There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement."

Like me you probably went and counted your columns and then counted your values and realised they were the same so spent ages scratching your head trying to figure out what on earth was going on. Well here is how I managed to reproduce the issue.

insert into myTable ([columnA], [columnB ) values (1,2)

Did you see what I did in the above statement? I left the "]" off the end of "columnB" the above statement will give you the above mentioned error message. It was pretty much a typo on my part and it took me ages to find it in a large SQL Insert statement.

Hope this helps anyone who has gone about trying to solve the above problem and found they do have equal columns and values.

posted on Friday, 20 January 2012 14:39:31 (GMT Standard Time, UTC+00:00)  #    Comments [0]

 Thursday, 29 December 2011
My WiFi IP Camera/Baby monitor

wifiCam

I remember being in a Microsoft building many years ago wondering what was the best time to go to the canteen when one of the guys I was working with told me to just check on the Intranet. He logged in and showed me a live web cam of the canteen area, placed there so the staff could see when the canteen wasn't busy to go down for lunch.

Suddenly I was more interested in the camera than in lunch as my colleague informed me it was an IP Camera.

"Where can I get one!" was my first question.

He told me they would probably retail at around £600. I gauped at him, I loved the idea of an IP Camera but I wasn't prepared to spend that much on one. Then roughly 6 years later. I discovered a Wireless Camera, with night vision, pan and title functionality, built in microphone and speakers for around £40! You have to admire the evolution of technology!

This camera is by no means the best in its class and from what I can see its a pretty cheaply manufactured Chinese device.  But for the money I spent on it, I get a lot more functionality than I had originally bargained for.

With a bit of fiddling I eventually got the camera to work on my home network on a static IP address. I then setup some port forwarding on my router so I could view the camera on the Internet (password protected).

The camera comes with its own built in web server which has interfaces for most browsers and mobile devices so you can move that camera around from your iPhone, Windows Mobile or Android phone if you want. The cool bit is, is if you install the iPhone or Android app you can also listen in over the camera's microphone! You can also speak over the camera's speakers using the app which is equally as cool when you're playing pranks on people.

At the moment I use the camera as a baby monitor. Its proved incredibly useful as one, given that I can check on the baby from any room in the house now and for the price it provides the same functionality for a much lower price than baby monitors with the same functionality.

posted on Thursday, 29 December 2011 14:54:08 (GMT Standard Time, UTC+00:00)  #    Comments [1]

 Saturday, 17 December 2011
Whirlpool ADP 451 Dishwasher constantly beeping

I wrote this blog article because I just couldn't find any information online about to resolve the above issue and hopefully it will save you some time.

Yesterday the drainage pipe on my washing machine came loose and the eventing water works filled the kitchen floor with water as I pulled the dishwasher out to hurriedly get to the washing machine pipe. After mopping up the floor and later that evening putting the dishwasher on, the dishwasher began to constantly beep/buzz and the Express wash light continually flashed. After some searching I eventually managed to get hold of the service manual (not the users manual) for the dishwasher.

It appeared this particular warning is error code 4 which indicates an "Overflow failure". The dishwasher beeps for 30 seconds and then constantly tries to drain water. The thing was there was no water in the dishwasher! However I did click that this may have had something to do with the washing machine flooding the kitchen earlier. Looking around the dishwasher I tilted it up on one side off the floor and as I did water poured out of a small hole onto the floor for a little while. I then tilted the other side of the dish washer over and more water leaked out over the floor for a little while. I then turned the dishwasher back on and hey presto it worked!

The dishwasher obviously thought it was filled with water. However the water couldn't be drained as it wasn't really inside the wash area.

Anyway hope this helps someone Smile

posted on Saturday, 17 December 2011 10:45:22 (GMT Standard Time, UTC+00:00)  #    Comments [3]

 Tuesday, 01 November 2011
Eating the Agile BDD Cake with SpecFlow - Part 2

In the previous part of this article I took you through how I would go through testing using Agile and BDD together in one process from the start to finish in a test project. In the previous article we had setup our project and our story/feature for viewing our basket and getting the tests to run and fail. Next we will code the basket to get the tests to pass.

So in my solution I have 3 projects.

image

I have my Domain, most of this is going to be encapsulated by my Model. The web is where I have my model, view and controller, and yes I probably would split the model out from the web project. Lastly we have the tests project where all of our features live.

On to the code.

So my test will be hooking into my Basket Model. My BasketModel consumes an IBasketRespository type for which I do not have an implementation of. The reason being, I am not doing an integration test so I don't really care what is in this object and will mock it using Rhino Mocks in my test.

   1:  using DemoBDD.Domain.Contracts;
   2:   
   3:  namespace DemoBDD.Web.Models
   4:  {
   5:      public class BasketModel
   6:      {
   7:          private readonly IBasketRespository _basketRespository;
   8:   
   9:          public BasketModel(IBasketRespository basketRespository)
  10:          {
  11:              _basketRespository = basketRespository;
  12:          }
  13:   
  14:          public BasketFormModel GetBasket(string basketId)
  15:          {
  16:              return Mappers.MapBasketDomainToBasketFormModel.MapBasket(_basketRespository.GetBasketByBasketId(basketId));
  17:          }
  18:      }
  19:   
  20:   
  21:  }

And now my test

   1:  namespace DemoBDD.Web.Tests.StepDefinitions
   2:  {
   3:      [Binding]
   4:      public class ViewBasketItemsSteps
   5:      {
   6:          private BasketModel _basketModel;
   7:          private IBasketRespository _mockbasketRespository;
   8:          private BasketFormModel _basket;
   9:          private string _basketId = "fakebasketid";
  10:   
  11:          [Given(@"that the shopping basket contains 0 items")]
  12:          public void GivenThatTheShoppingBasketContains0Items()
  13:          {
  14:              var mock = new MockRepository();
  15:             
  16:   
  17:              _mockbasketRespository= mock.StrictMultiMock<IBasketRespository>();
  18:   
  19:              Expect.Call(_mockbasketRespository.GetBasketByBasketId(_basketId)).Return(new Basket(){Items = new List<BasketItem>()});
  20:   
  21:              mock.ReplayAll();
  22:   
  23:              _basketModel = new BasketModel(_mockbasketRespository);
  24:          }
  25:   
  26:          [When(@"I view the basket")]
  27:          public void WhenIViewTheBasket()
  28:          {
  29:              _basket = _basketModel.GetBasket(_basketId);
  30:              Assert.IsNotNull(_basket);
  31:          }
  32:   
  33:          [Then(@"the basket will show an empty basket")]
  34:          public void ThenTheBasketWillShowAnEmptyBasket()
  35:          {
  36:              Assert.AreEqual(_basket.Items.Count,0);
  37:          }
  38:   
  39:   
  40:      }
  41:  }

And the results of my test.and it all worked first time.surprising Smile

image

.What next?

I think I like SpecFlow, I think I am liking it more than MSpec and I never thought I would find myself saying that.

But I find what I have done has still left me with many questions and I can start to think of all kinds of ways to refactor what I have done which is natural for any developer and tests or "specifications" help us make sure that what we are changing is still working once it has been changed.

So what would I change?

  1. I would probably move the tests to the controller and not the Model. Why? Because BDD is supposed to be a top down development approach. Work at the top and work your way down. Testing my controller is also going to test my Model for me in this case.
  2. If my project grew larger I may move the model into a separate project.

Unsure of

  1. Adding integration tests later on to cover the repository layer. Would these connect back to the same story/feature? Or would we have a different story or feature that covered this aspect?
  2. Bug fixing. Would we create features for bugs or would we update an existing feature to take the bug into account?
  3. Having been to a session on BDD I found it interesting how one team had thrown out tasks and completely replaced them with scenario's. In a way it makes sense and I would be intrigued to try this concept out for myself.
posted on Tuesday, 01 November 2011 09:41:45 (GMT Standard Time, UTC+00:00)  #    Comments [0]

 Monday, 10 October 2011
Eating the BDD and Agile Cake with SpecFlow - Part 1

Speaking to a colleague of mine one evening, we got talking about Agile and BDD. What I found interesting was that he was providing the Agile aspect for me and I was approaching it from the developers context. I realised that in many of the implementations of BDD I hadn't quite seen the connection happen from the user stories down to the actual BDD tests.  While I had seen BDD used I wasn't quite sure it was being done "properly" or working properly it seemed as though lip service was being paid to the methodology. He made the clever suggestion that maybe we should test it out.

"As in make an actual app for the purpose of testing the process?" I said, he nodded and I decided then I was hooked on the idea. I could probably blog about it and let people know about my experience using a test project and it would give me a chance to try out SpecFlow. I would expect to write roughly 3 blog articles covering the subject, feel free to comment on any aspect - all constructive criticism welcome Smile

So getting to the project. We agreed he would be the product owner and I would be the developer (naturally). He went away for a day and came back to me with the requirements for a basket application. He provided me with a user story and then some conditions of acceptance. I looked over his conditions of acceptance and made some more suggestions. We were essentially collaborating around the conditions of acceptance and wording them in the classic BDD syntax. This was good, this was what was supposed to have happened.

The app was to be a simple shopping basket you add products to. My initial reaction was to get coding the basket and I had to quickly stop myself as I realised I wasn't following the process. Do the tests first!

So my Project Setup was as follows. I won't dwindle too much around the SpecFlow setup as I am sure there are plenty of tutorials out there.

Install SpecFlow

Create an MVC project in Visual Studio 2010 and allow it to create an accompanying test project (we will use this later).

image

Change the app.config of the test project so SpecFlow will work with MSTest (and Resharper)

image

Step 1. Creating my feature using SpecFlow (in Gherkin). The features file type is available to you in Visual Studio after installing SpecFlow.

image

 

Step 2. Run my tests using Resharper and MSTest, as expected my tests fail and SpecFlow gives me recommendations on what it was expecting.

image

 

Step 3. Create a Step file for my actual tests (this is where the actual tests are coded in MSTest)

image

 

Step 4: I copy the suggested code from SpecFlow unit test in step 2 into my new Steps file

image

 

Step 5: I then rerun my tests and get a different error telling me that I basically have empty tests.

image

Step 6: I am now ready to start coding to fix my tests! Which I will cover in my next article.

posted on Monday, 10 October 2011 12:46:03 (GMT Standard Time, UTC+00:00)  #    Comments [0]