Thursday, February 18, 2010

Backup failed while creating Hyper-V VSS Snapshot

I use Backup Assist to perform backup our Hyper-V instances we use for our development machines (code repositories, bug tracking, test databases etc).  This morning I arrived in the office to find the backup had failed overnight, with the following error:

Backup stopped before completing.
Detailed Error:
ERROR - Volume Shadow Copy Service operation error (0x800423f3)
The writer experienced a transient error. If the backup process is retried,
the error may not reoccur.

Nothing had been changed on the Hyper-V server, any of the Hyper-V instances or Backup Assist, so I was shocked that the backup just all of a sudden failed with a cryptic error.

I started googling and all I could find about this error was a hot fix which resolved the issue.  I was sure the hot fix wasn’t going to do squat as the backup was working yesterday.  So before looking further into the hot fix I decided to have a poke around my Hyper-V server and instances to see if there was anything obvious.

After about 1/2 an hour of looking into the event logs or each machine etc I found one Hyper-V instance had only 100megs of free disk space.  Surely that wasn’t causing the backup to fail?  So I freed up some space so it had a gig of room free and now the backup is working!

Moral of the story, always make sure your Hyper-V instances have a reasonable amount of free disk space and if you get the error above, your more than likely run out of space somewhere.

Monday, January 04, 2010

How to install the Hyper-V Management Tools for Windows 7?

Every time I need to install the Hyper-V Management tools on a Windows 7 installation I always have trouble finding the related installer and setting it up. 

If anyone else has this problem (or when I next forget) here is what you need to do:

  • Download the Remote Server Administration Tools (RSAT) for Windows 7 from here
  • Install the update
  • Then go to Turn Windows features on or off in your control panel

control panel

  • Under Remote Server Administration Tools and then under Role Administration Tools select Hyper-V Tools

Windows Features

You can then find Hyper-V Manager in your start menu


Thursday, November 05, 2009

Problems with Uploadify, ASP.NET MVC and Chrome/Firefox

Today I came across a problem where all of a sudden Uploadify stopped working with both Chrome and Firefox but continued to work with IE.  I could have sworn that it was working on all 3 browsers previously and had now idea what had changed.

So I started doing some digging and found that Uploadify was trying to upload the file to the correct controller and action but Forms Authentication was rejecting it, even though I was logged in correctly!

After doing a few Google searches I came across this blog post which explains the problem and even has code for a new AuthorizationAttribute which solves the problem.

Basically the issue is with flash where it will ignore the browser’s session state and grab the cookies from IE, which is a known and active bug.  This means that both Chrome and Firefox won’t work with Uploadify and authorisation because flash will send no cookies!  It also means it is entirely possible for it to have previously work for me while testing because I probably also had a IE window open and logged in while testing, which would have given me a valid cookie.

Announcing My Family Photos

Today Zero41 released the invite only beta of My Family Photos.

This is something we have been working part time on the for past couple of months and we will be continuing to add new features in the future.

For more details go to the My Family Photos Blog.

Tuesday, July 07, 2009

Why won’t ASP.NET MVC rebase a CSS link for a masterpage?

I just spent the better part of an hour trying to work out why one particular CSS link in an ASP.NET MVC masterpage would not rebase when the others were working perfectly. 

Lets see if you can spot the problem?

   1: <link href="../../Scripts/style.css"rel="stylesheet" type="text/css" />
Can you see the problem?
I couldn’t for almost an hour and then it struck me, there is no space between my href and rel attributes surely it can’t be that.  Yup that was exactly the problem, sticking the space in there made it all work!  Sometimes I just *love* development!
So remember, if ASP.NET MVC isn’t rebasing a CSS link in one of your masterpages make sure there is a space between all your link attributes!

Monday, June 15, 2009

Clean code – No double negatives

Today I came across the something similar to the following code today:

   1: public void ProcessSomething(bool unsuccessful)
   2: {
   3:     if (!unsuccessful)
   4:         SendEmail();
   5: }

At first glance this method looks fine but if you read it out loud you would say “If not unsuccessful then send email” which is a little bit confusing because of the “not unsuccessful” double negative.  If the method is more complicated then double negatives just add to the complexity.

Instead it is best to just flip the bool around so you don’t end up with the double negative:

   1: public void ProcessSomething(bool successful)
   2: {
   3:     if (successful)
   4:         SendEmail();
   5: }

Which would read “If successful then send email”, simpler, clearer and just plain cleaner code.

Thursday, June 11, 2009

ASP.NET MVC Controllers can automatically cast DropDownList values as int, Very Impressed!

I just did something which I totally did not expect ASP.NET MVC to handle but I thought I would try it anyway and amazingly it worked, adding more proof to how well a job the guys at Microsoft did with this framework.

I added a drop down list to my view with the following Html helper:

   1: <%= Html.DropDownList("myDropDown", new List<SelectListItem>
   2:         {
   3:             new SelectListItem{Text = "Item 1",Value = "1"},
   4:             new SelectListItem{Text = "Item 2",Value = "2"}
   5:         }) %>

I originally had an action on my controller which looked like this:

   1: [AcceptVerbs(HttpVerbs.Post)]
   2:  public ActionResult DoSomething(string myDropDown)
   3:  {
   4:      //Cast myDropDown to an integer, handle empty 
   5:      //strings etc
   6:  }

Which is a pain having to parse myDropDown to an integer and just makes things messy, so I wondered what would happen if I changed myDropDown from a string to a nullable int?

   1: [AcceptVerbs(HttpVerbs.Post)]
   2: public ActionResult DoSomething(int? myDropDown)
   3: {
   4:     //Surprisingly it works
   5: }

And to my surprise it work exactly as I had expected!  ASP.NET MVC seems to be impressing me more every day that I use it.  It is the small things like this which make working with ASP.NET MVC such a joy.