Hyper V Virtual Machine will not start after moving VHD

July 9, 2010 tsells Leave a comment

I had an issue today where my Hyper V virtual machines would not start after moving the virtual hard disks to another physical drive.  The error received was similar to below.

Microsoft Emulated IDE Controller (Instance ID {<MACHINE GUID GOES HERE>}): Failed to Power on with Error ‘General access denied error’

IDE/ATAPI Account does not have sufficient privilege to open attachment ‘D:\Virtual Server\Virtual Machines\server\system.vhd’. Error: ‘General access denied error’

Account does not have sufficient privilege to open attachment ‘D:\Virtual Server\Virtual Machines\server\system.vhd’. Error: ‘General access denied error’

I knew the issues was account permissions but wasn’t sure how.  After some research and finding the post linked below it appears the virtual machine itself (GUID) is given permission directly to the folder.

Thanks to this post for helping my find the solution.

After applying the fix above it worked as expected.

Unable to Install Windows Home Server Connector Software on Windows 7 with “The password is incorrect” error message

June 26, 2010 tsells Leave a comment

I ran into an issue today with a computer I brought back to life with a new power supply.  It would not connect to the home server and kept saying the password was incorrect.  After numerous searching I found the answer here under one of the more recent threads. 

To Resolve My Issue

  • Start –> type secpol.msc in the Search Box and click the magnifying glass
  • Select Local Policies –> Security Options –> Network Security: LAN Manager Authentication level
  • Change the setting to Send NTLM response only 

image

  • Save
  • Restart the machine
  • Attempt the installation again.

This fix seems to apply to Windows 7 only but may work for Vista as well. 

Command Binding with WPF and Silverlight (.net 4.0) with M-V-VM

June 23, 2010 tsells Leave a comment

This is the second part in a demo series concerning using the M-V-VM pattern.  This section will deal with command binding.  Command binding allows you to bind a command event such as a button click in a view to an action on a view model.  This eliminates the need to create an event handler in the view to pass on to the view model.  It requires less code and allows you to test command events on the view model without the need for the UI.

Command binding wasn’t available with Silverlight until Silverlight 4 was released.  The information below was gathered using the following resources.

http://www.dotnetfunda.com/articles/article859-command-binding-in-silverlight-4-stepbystep-.aspx

http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

The common method being used for WPF is the RelayCommand class courtesy of Josh Smith.  This is nice way to implement command binding in WPF.  However it cannot be used with Silverlight as the Command Manager does not exist in Silverlight’s version of the ICommand Interface.

The source code for the following demos can be found here.

Silverlight Demo

WPF Demo

Silverlight Implementation

For Silverlight the DelegateCommand class will be used.  This class can be found in here.

Create a new Silverlight Application (Blank)

Create a class and copy the DelegateCommand code from the link above into it an save.

Create a View Model Class

Add code to the View (MainPage.xaml.cs) to initialize the view model and set the data context of the view to the view model

public MainPage()
        {
            DataContext = new MainPageViewModel();
            InitializeComponent();
        }

On the view model add the following code

using System;
using System.Windows;
using System.Windows.Input;

namespace SLCommandDemo
{
    public class MainPageViewModel
    {
        /// <summary>
        /// Command Property to Bind to From View (done in xaml)
        /// </summary>
        public ICommand ButtonClickCommand {get; private set; }

        public MainPageViewModel()
        {
            // Setup Command Binding
            // First Parameter - Method with Action to perform
            // Second Parameter - Method to determine if button is enabled
            ButtonClickCommand = new DelegateCommand(PerformClickAction, CanClickButtonandPerformAction);
        }

        public bool CanClickButtonandPerformAction(object parameter)
        {
            // Add any logic here to enable / disable the button
            return true;
        }

        public void PerformClickAction(object parameter)
        {
            // Here you would put the code to execute the desired command.  We are
            // going to show a message box
            MessageBox.Show("You are using Command Binding with Silverlight!!!!");
        }
    }
}

Add a button to the view (MainPage.xaml) and add the following binding statement to bind the command property of the button to the view model.

<Button
            Content="Button"
            Height="23"
            Name="button1"
            VerticalAlignment="Center"
            Width="75"
            Command="{Binding ButtonClickCommand}"
            />

Build and Run the Solution and then click the button.  Congratulations.  You are now using command binding in Silverlight.

image

WPF Implementation

The RelayCommand class will be used for WPF.  This class can be found here.

Create a new WPF Application

Create a class and copy the RelayCommand code from the link above into it an save.

Create a View Model Class

Add code to the View (MainWindow.xaml.cs) to initialize the view model and set the data context of the view to the view model

public MainWindow()
        {
            DataContext = new MainWindowViewModel();
            InitializeComponent();
        }

On the view model add the following code

using System;
using System.Windows.Input;

namespace WPFCommandBindingDemo
{
    public class MainWindowViewModel
    {
        /// <summary>
        /// Command Property to Bind to from View (done in xaml)
        /// </summary>
        public ICommand ButtonClickCommand { get; private set; }

        public MainWindowViewModel()
        {
            // Setup Command Binding
            ButtonClickCommand = new RelayCommand(PerformClickAction, CanClickButtonandPerformAction);
        }

        public bool CanClickButtonandPerformAction(object parameter)
        {
            // Add any logic here to enable / disable the button
            return true;
        }

        public void PerformClickAction(object parameter)
        {
            // Here you would put code to execute the desired command.  We are
            // going to show a message box.
            System.Windows.MessageBox.Show("You are using Command Binding with WPF!!!");
        }
    }
}

Add a button to the view (MainWindow.xaml) and add the following binding statement to bind the command property of the button to the view model.

<Button
            Content="Button"
            Height="23"
            Name="button1"
            VerticalAlignment="Center"
            Width="75"
            Command="{Binding ButtonClickCommand}"
            />

Build and Run the Solution and then click the button.  Congratulations.  You are now using command binding in WPF.

image

Summary

By using command binding with the MVVM pattern you allow each command action to be tested without the need for creating the UI (View).

If you have any questions or comments please post them.

Unable to login to VMWare Virtual Machine joined to a domain

June 10, 2010 tsells Leave a comment

Sometimes you will come across an issue where you can’t login to a virtual machine that meets the following conditions.

  • Joined to a domain
  • Has been reverted to a snapshot

You can log in with a local account but many of the domain specific features do not work.  This is because the machine’s domain password is out of sync with the domain controllers.  There are two options – you can remove / rejoin the machine to the domain or on Windows XP, Vista, 2003, and 2008 you can use the following command to fix it.

Note:  The user must be able to join machines to a domain (domain admin, etc)

netdom resetpwd /server:DomainControllerDNSorIP /userd:Domain\Username /passwordd:userpassword

Note that Windows 7 does not support the netdom feature by default.  You must turn it on.

  1. Install the Remote Server Administration Tools (RSAT) for Windows 7.  They can be found here.
  2. Go to the Control Panel
  3. Select Programs and Features
  4. Select Turn Windows Features on or off
  5. Navigate to Remote Server Administration Tools – Role Administration Tools
  6. Enable the following items and save
    • AD DS and LDS Tools
    • AD DS Tools
  7. Now the netdom command should be available (use instructions for other OS’s above)

WPF Model-View-ViewModel (M-V-VM) Example

June 2, 2010 tsells 1 comment

When starting out with WPF and the M-V-VM pattern I was looking for a simple example of this pattern.  Most of the things I found were full of items that complimented the pattern but didn’t show just the pattern itself.  I decided to walk through a simple example and will detail it below.

You can download the source code from here.

Basic M-V-VM OverView

Layer Items
Model Business Objects, Business Logic

View Model

UI Logic, Data / Services Interaction

View

UI elements (Styling, Data Binding, etc)

The Model

The model in the MVVM pattern will be the business object. For this example my model is a picture object.  This object contains some basic properties a picture would have such as:

  • Name
  • File Path
  • Height
  • Width

It also contains a validation method to validate the Picture object.  This was placed here for example only (notice there is no logic in the method).  Any business logic for the model should be contained within this class or a model helper class.

namespace MVVMDemoApplication.Models
{
    public class Picture : BaseModel
    {
        private string _pictureName;
        private string _picturePath;
        private int _height;
        private int _width;

        public Picture()
        {
            Width = 300;
            Height = 200;
        }
        /// <summary>
        /// Name of Picture
        /// </summary>
        public string PictureName
        {
            get { return _pictureName; }
            set
            {
                if (_pictureName != value)
                {
                    _pictureName = value;
                    NotifyPropertChanged("PictureName");
                }
            }
        }
        /// <summary>
        /// Picture path
        /// </summary>
        public string PicturePath
        {
            get { return _picturePath; }
            set
            {
                if (_picturePath != value)
                {
                    _picturePath = value;
                    NotifyPropertChanged("PicturePath");
                }
            }
        }
        /// <summary>
        /// Height of Picture
        /// </summary>
        public int Height
        {
            get { return _height; }
            set
            {
                if (_height != value)
                {
                    _height = value;
                    NotifyPropertChanged("Height");
                }
            }
        }
        /// <summary>
        /// Width of Picture
        /// </summary>
        public int Width
        {
            get { return _width; }
            set
            {
                if (_width != value)
                {
                    _width = value;
                    NotifyPropertChanged("Width");
                }
            }
        }
        /// <summary>
        /// Determine if Picture is Valid
        /// This is a model based logic validation and does not belong in the viewmodel
        /// </summary>
        /// <returns></returns>
        public bool IsPictureValid()
        {
            bool isValid = true;
            // Add Code here to validate picture - whatever you want
            return isValid;
        }
    }
}

Base Model Class

This class is used to provide functionality to each model class without the need to replicate code.  This works perfectly when implementing the INotifyPropertyChanged interface for Data Bound Properties in WPF and Silverlight.

namespace MVVMDemoApplication.Models
{
    public class BaseModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Notify of Property Changed event
        /// </summary>
        /// <param name="propertyName"></param>
        public void NotifyPropertChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}

The View Model

The view model contains the UI logic for the view.  Any logic, method calls, parameters, etc should always be placed in the View Model.  This logic should not be placed in the view.

The view model contains a collection of picture objects.  These objects have to be populated from a data source.  After many hours of research I have to agree with some of the experts (a.k.a Josh Smith) and say that while the data operations belong in the View Model layer they should be extracted from the view model in a separate set of classes.  This will simplify the view models and allow the reuse of the data access logic across multiple view models.  This will be more apparent and useful when using Silverlight with WCF / RIA Services.

Properties

  • Error Message – displayed when error occurs
  • Pictures – observable collection of Picture Objects (Model).  It is better to use an observable collection when items maybe added / removed from the collection so the data binding recognizes the changes automatically.  This does not occur with list objects.

Methods

  • MakePictureBigger – enlarge picture if valid (notice the call to the IsPictureValid object on the model itself)
  • MakePictureSmaller – make picture smaller (notice the validation logic – since this is UI logic and not business logic it belongs in this class)
  • CheckIfPictureSelected – ensure that an item is selected from the list box – if not modify the error message on the view model.
  • LoadPictures – call to the services class to retrieve the data.  In this case it is a list of image files.  This can be anything from a WCF services call to a call out to a custom Data Access Layer (DAL).
  • BuildPictureCollection – build the collection of picture objects – this is here versus the data services layer to reduce coupling.
  • BuildPictureObject – load values on the object based on the file path given
namespace MVVMDemoApplication.ViewModels
{
    public class PictureListBoxViewModel : BaseViewModel
    {

        ObservableCollection<Picture> _pictures;
        PictureDataServices _services;
        string _pictureDirectory;
        string _errorMessage;

        /// <summary>
        /// Selected Picture in ListBox
        /// </summary>
        public Picture SelectedPicture { get; set; }

        /// <summary>
        /// Error Message
        /// </summary>
        public string ErrorMessage
        {
            get { return _errorMessage; }
            set
            {
                if (_errorMessage != value)
                {
                    _errorMessage = value;
                    NotifyPropertChanged("ErrorMessage");
                }
            }

        }

        /// <summary>
        /// Observable Collection of Pictures
        /// Uses INotifyPropertyChange when list changes
        /// </summary>
        public ObservableCollection<Picture> Pictures
        {
            get { return _pictures; }
            set
            {
                if (_pictures != value)
                {
                    _pictures = value;
                    NotifyPropertChanged("Pictures");
                }
            }

        }

        /// <summary>
        /// Constructor
        /// </summary>        
        public PictureListBoxViewModel()
        {
            // Initialize data services class for later use
            // It is best to keep this isolated from the view model
            _services = new PictureDataServices();
            // Set Picture Directory
            _pictureDirectory = Directory.GetCurrentDirectory() + "\\Images";
            // Initialize here so we don't forget to later and end up with a null reference exception
            Pictures = new ObservableCollection<Picture>();
            LoadPictures();
        }

        /// <summary>
        /// Overload to allow different images directory
        /// Maybe one view has an option to select a directory
        /// </summary>
        /// <param name="imagespath"></param>
        public PictureListBoxViewModel(string imagespath)
        {
            // Initialize data services class for later use
            // It is best to keep this isolated from the view model
            _services = new PictureDataServices();
            // Set Picture Directory
            _pictureDirectory = imagespath;
            // Initialize here so we don't forget to later and end up with a null reference exception
            Pictures = new ObservableCollection<Picture>();
            LoadPictures();
        }

        /// <summary>
        /// Make the selected picture bigger
        /// </summary>
        public void MakePictureBigger()
        {
            //Perform Error Check
            if (!CheckifPictureIsSelected())
                return;
            Picture picture = SelectedPicture;
            // Here is where we call business logic on the picture object itself
            // The validation method on the object determines if object is valid
            // This logic has nothing to do with the view or the view model so it
            // Is placed on the model
            if (picture.IsPictureValid())
            {
                picture.Height = picture.Height + 50;
                picture.Width = picture.Width + 50;
            }
        }

        /// <summary>
        /// Make the selected picture Smaller
        /// </summary>
        public void MakePictureSmaller()
        {
            //Perform Error Check
            if (!CheckifPictureIsSelected())
                return;
            Picture picture = SelectedPicture;
            // Verify we don't make the picture to small.  Since this is a UI
            // check we place in the View Model versus the model.  The model
            // does not care how big the picture is displayed
            if (picture.Height > 60)
            {
                picture.Height = picture.Height - 50;
                picture.Width = picture.Width - 50;
            }
        }

        /// <summary>
        /// Check if user selected item
        /// </summary>
        /// <returns></returns>
        private bool CheckifPictureIsSelected()
        {
            if (SelectedPicture == null)
            {
                ErrorMessage = "Please select a picture";
                return false;
            }
            else
            {
                ErrorMessage = string.Empty;
                return true;
            }
        }

        /// <summary>
        /// Load Pictures from FileSystem into Collection
        /// </summary>
        private void LoadPictures()
        {
            // Load picture collection from services (could be WCF or other Data Access Logic)
            List<string> pictureFilePaths = _services.GetPicturesFromDirectory(_pictureDirectory);
            // Build the Collection of Models here - not done in DataSevices to reduce coupling
            BuildPictureCollection(pictureFilePaths);
        }

        /// <summary>
        /// Build / Load Collection of Pictures
        /// </summary>
        /// <param name="pictureFilePaths"></param>
        private void BuildPictureCollection(List<string> pictureFilePaths)
        {
            foreach (string file in pictureFilePaths)
            {
                // Build Picture Object
                Picture pic = BuildPictureObject(file);
                // Add object to collection if not null
                if (pic != null)
                    Pictures.Add(pic);
            }
        }

        /// <summary>
        /// Load Picture object
        /// </summary>
        /// <param name="filepath"></param>
        /// <returns></returns>
        private Picture BuildPictureObject(string filepath)
        {
            Picture pic = new Picture();
            FileInfo fi = new FileInfo(filepath);
            pic.PictureName = fi.Name;
            pic.PicturePath = filepath;
            return pic;
        }
    }
}

Base View Model Class

This class is used to provide functionality to each view model class without the need to replicate code.  This works perfectly when implementing the INotifyPropertyChanged interface for Data Bound Properties in WPF and Silverlight.

namespace MVVMDemoApplication.ViewModels
{
    public class BaseViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Notify of Property Changed event
        /// </summary>
        /// <param name="propertyName"></param>
        public void NotifyPropertChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}

The View

The view should contain the bindings to the view model only.  This may include some event handling.  In this example I used some event triggers for buttons to call methods on the view model directly.  Command binding reduces the need for this extra code.  For this example I did not want to introduce command binding as it does add an extra level of complexity that is best held for future example / post.

This solution has 2 views.  The first one shows the initialization of the View and View Model via XAML.  The second one performs the exact same functions in the code behind page.

View 1

namespace MVVMDemoApplication.Views
{
    /// <summary>
    /// Interaction logic for PictureView.xaml
    ///
    /// NO Business / Application logic should be in this class
    /// This class is for UI Logic ONLY!!!!
    ///
    /// Also note that the events you see in this class can be removed completely when using
    /// Command Binding.
    ///
    /// Added to interface to enable easy UI switching
    /// </summary>
    public partial class PictureView : Page, PictureViewInterface
    {
        // Reference for events. This can be elimnated when using command binding.  The
        // ViewModel in this case was created via XAML through the Data Context method
        PictureListBoxViewModel _plvm; 

        public PictureView()
        {
            InitializeComponent();
            _plvm = (PictureListBoxViewModel)this.gdRoot.DataContext;
        }
        private void btnMakeSmaller_Click(object sender, RoutedEventArgs e)
        {
            _plvm.MakePictureSmaller();
        }
        private void btnMakeBigger_Click(object sender, RoutedEventArgs e)
        {
            _plvm.MakePictureBigger();
        }
        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            // Grabbed parent window to call the close event on the parent window.  This
            // can be wired up different but was done this way for simplicity
            Window win = (Window)this.Parent;
            win.Close();
        }
        /// <summary>
        /// Added just to show the difference when using different views
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSwitchViews_Click(object sender, RoutedEventArgs e)
        {
            Window1 win = (Window1)this.Parent;
            win.SwitchViews(this);
        }
    }
}

View 2 – Constructor only

    public partial class PictureView2 : Page
    {
        PictureListBoxViewModel _plvm; 

        public PictureView2()
        {
            InitializeComponent();
            // Initialize ViewModel in constructor
            _plvm = new PictureListBoxViewModel();
            // Set Data Context for Grid
            gdRoot.DataContext = _plvm;
        }

View 1 – XAML

Notice the data context and PictureViewModel initialization is done at the Grid.DataContext section instead of in the code behind page.

<Page x:Class="MVVMDemoApplication.Views.PictureView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ViewModels="clr-namespace:MVVMDemoApplication.ViewModels"
    Title="PictureView">
    <Grid x:Name="gdRoot">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>
        <Grid.Resources>
            <Style TargetType="Button">
                <Setter Property="Margin" Value="5" />
            </Style>
        </Grid.Resources>
        <Grid.DataContext>
            <!--Set the Grid Data Context to the PictureListViewModel which initializes the class-->
            <ViewModels:PictureListBoxViewModel/>
        </Grid.DataContext>
        <ListBox x:Name="lbPictures"
                 ItemsSource="{Binding Path=Pictures}"
                 HorizontalAlignment="Left"
                 BorderBrush="AliceBlue"
                 BorderThickness="2"
                 Margin="10"
                 SelectedItem="{Binding Path=SelectedPicture}">
            <!--The list box template can be removed from this file and placed in a resource dictionary-->
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock
                            Margin="5"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            Text="{Binding Path=PictureName}"
                            />
                        <Image
                            Margin="5"
                            Height="{Binding Path=Height}"
                            Width="{Binding Path=Width}"
                            Source="{Binding Path=PicturePath}"
                            />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Grid.Row="1" HorizontalAlignment="Center" Orientation="Horizontal">
            <Label>PictureView</Label>
            <Button Name="btnMakeSmaller" Click="btnMakeSmaller_Click"  ToolTip="Make selected item smaller" >Shrink</Button>
            <Button Name="btnMakeBigger"  Click="btnMakeBigger_Click"  ToolTip="Make selected item bigger" >Grow</Button>
            <Button Name="btnSwitchViews" Click="btnSwitchViews_Click" ToolTip="Click to switch to other PictureView">Switch Views</Button>
            <Button Name="btnClose" Click="btnClose_Click" ToolTip="Close the application" >Close</Button>
            <TextBlock Name="tbErrorMessage" Text="{Binding Path=ErrorMessage}" Foreground="Red" />
        </StackPanel>
    </Grid>
</Page>

Testing

Another major benefit of M-V-VM when implemented correctly is the ability to test the view model.  These can be in the form of Unit or Integration tests.  I added a test project to this solution utilizing NUnit (DLL provided in solution) so it will build.  You will need a test runner to be able to execute the tests.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using MVVMDemoApplication.ViewModels;
using System.IO;

namespace MVVMTestProject
{
    [TestFixture]
    public class TestClass
    {
        [Test]
        public void Verify_PictureModel_HasPictures()
        {
            string imagesdirectory = Directory.GetCurrentDirectory() + "\\Images";
            PictureListBoxViewModel vm = new PictureListBoxViewModel(imagesdirectory);
            Assert.IsTrue(vm.Pictures.Count() > 0);
        }
    }
}

Summary

Using the M-V-VM pattern is a different mindset from traditional WinForms application development.  It is similar to the ASP.NET MVC / Rails patterns but for WPF and Silverlight.  This pattern makes it easy to test the application as the UI presentation layer has been extrapolated from the UI and business logic.  It also helps reduce coupling and make changing the UI layer (Views) much easier.

You can download the source code from here.

Categories: Agile, C#, M-V-VM, WPF Tags: , , , ,

NVidia NIC card reverting to 100mbps on a Gigabit Network

May 31, 2010 tsells Leave a comment

Well I had to replace the motherboard and power supply in my main desktop yesterday.  I rebuilt the system, cleaned it up, reran all the wires, etc.  It felt like a brand new case.  Windows 7 x64 Ultimate went on like a dream.  I started transferring files from my home server to install some apps and the transfer was slow.  I did some checking and found my NIC card was running at 100 mbps instead of 1 gbps.  I did find during my troubleshooting efforts that if you unplugged the cable and plugged back in it would then change to 1 gbps.  This was fine until I rebooted. 

After a couple of hours of digging I found that the new Nvidia NForce drivers were too blame.  I rolled back the drive to Microsoft’s default drivers and the problem is now resolved.

  1. Open Network and Sharing Center
  2. Click on your Connection under Active Networks
  3. Click Properties
  4. Click Configure
  5. Go to the driver tab
  6. Click Roll Back Driver
  7. Accept Changes
  8. Reboot

Problem is now solved.

One key factor to successful programming – Workstation Setup

May 12, 2010 tsells 1 comment

While some say nothing beats developing on the beach with your laptop and a nice drink in your hand I tend to disagree.  While the previous is nice one in a while – a comfortable (and ergonomic) setup is key when coding for long periods of time.  Over the years I have tweaked me environment both at home and at work to really improve my posture as well as eliminate neck issues I had from sitting for so long.  Below is my before and after environment.  I can now sit down and code for 8-10 hours with short breaks every hour or two without feeling completely exhausted at the end of the day.

Here is my old work environment.  Notice the basic office chair and old style computer desk and how everything was cramped?  This was not conducive to writing code.

image

I set out and built a desk that met my needs.

image

I used 3/4” and 1” MDF for most of it and just coated in polyurethane.

image

I put some electrical box conduit on the back for running wires to keep them off the ground.  Note the wheels on it for easy access to pull out.

image

My new environment is much more comfortable now.

All visual items (monitors and TV) require very little head movement and are centered at eye level.

image

I swapped out the basic office chair with a higher end mesh back chair.  This made a world of difference and I don’t get hot any longer sitting in this chair.  Note that the green is a lot brighter with the camera flash.  It is normally a darker color.  This paint change from the standard white wall also made a big difference.  My eyes don’t get nearly as tired.  Now I can code until 4 am instead of 3am.

image

I moved my servers and all of my routing equipment into the closet to lower the ambient noise (and temperature) in the main office.  I have a vent that takes the air out of the office.

image

I am seeing more and more programmers go with the black background on Visual Studio and SSMS.  I still need the white background (preference) so I have found that having a darker background and turning the brightness down on the monitors a bit compensate and get some of the same benefits as the darker IDE backgrounds.

If you have a custom setup that is neat please post a comment with a link to it.  I would love to see it.

Update ***

Here is my setup at work.  Notice the hard back chair – it made a world of difference.

Agile Development – Is it for you?

May 2, 2010 tsells Leave a comment

A short answer to a very broad question – Yes.  For a more in depth answer keep reading.

Defining Agile

If you are in the software development world you have no doubt heard the term “agile” thrown around as much as any other word over the past few years.  But what exactly is agile? Does agile mean the same thing to you as it does to me or anyone else?  The chances are probably not.

I have been in a few different industries besides software development and can tell you that each one is different with it’s own set of rules and practices.  One thing that is common between all of them is how to get more value out of an existing set of resources.  So how is this done?  Other terms come to mind here such as Lean and Six Sigma.  Improving existing processes and re-engineering obsolete processes are a must to keep growing.  In software development this is no different and this is where the term “agile” comes in to play. 

Methodology Choices

Agile is a broad term that describes a movement.  Terms like Scrum and XP are specific implementations of this movement.  Each implementation has it’s own set of practices such as TDD, BDD, Stand Ups (scrums), sprints, etc. So the next question is which one do you follow? This is where the confusion comes into play. 

The purists / elitists would have you believe that if you don’t adopt every process / best practice of the methodology then you are doomed to fail.  This is naive and closed minded in my opinion.  If you follow every process to the letter and don’t attempt to improvise or improve the processes then how can we be expected to continue to improve as an industry?  At some point each group would plateau. 

Each process out there fits some teams better than others since each team is different.  Each team has it’s own dynamics that are unique.  So how can one be expected to apply the same business model to every team?  I would say it’s not possible.  What is possible however is to take the best practices from any implementation / methodology that suits your team best and apply it to your team’s processes. 

Test Driven Development

An example of a specific methodology would be Test Driven Development (TDD).  There are many people in the agile community that swear by this concept.  There are just as many that do not believe in it.  I am somewhere in the middle.  I believe testing your code at the unit level is imperative.  Having a high level of test coverage on your code is not a bad thing.  However – we do live in a world where in the end you have to deliver software.  There is a delicate balance between writing production code and test code.  Writing tests for the sake of writing tests however seems wasteful.    A good article on this concept can be found here. 

There are many that believe TDD is the Holy Grail when it comes to quality and software development.  Again I think this is naive.  TDD is a tool that can help you achieve a higher level of quality in the code you write.  However, the code will NEVER be better than the person who wrote it.  If the developer “didn’t consider that scenario” or “didn’t realize the implications” of a feature or technology then the code can be just as buggy or more so than someone who didn’t write it using TDD.  TDD should NOT be used as a crutch to say “hey look at my code – it’s great code because I wrote it TDD”. 

Summary

So based on the above how can we define agile?  A few key concepts come to mind:

  • Ability to adapt to change (both at a team and organization level)
  • Providing high quality / easily maintainable code at an acceptable pace
  • Consistently improving existing processes

Each one of us can choose to become more agile in our daily processes through development practices.  But to do so at a team or organizational level you must be willing to adopt change.  See my post here about what prevents a team from adopting change. 

One other thing to keep in mind and this is where I differ from most of the elitists.  You do NOT have to adopt EVERY methodology to become a better organization.  You can choose what fits your team and apply it.  This does not mean you are doomed to fail.  It means that you are willing to accept that your team must change and you are starting the process to implement that change. 

Categories: Agile, Scrum, SoapBox, TDD, XP Tags: , , ,

Visual Studio 2010 – First Impressions

April 30, 2010 tsells 1 comment

I have been doing a lot of coding in WPF (xaml) over the past year and was really not pleased with the Visual Studio 2008 designer support for WPF. Blend 3 became my friend for basic tasks as Visual Studio wouldn’t even render some of the UI’s I had created.  I had the designer view turned off in Visual Studio so it didn’t crash.  When they announced a while back that 2010 would be in WPF I was skeptical.  Boy did they prove me wrong.  The VS development team did a really good job with this one.  Below are some of the features / highlights / bug fixes that will apply to me.

  • Launch Time – I no longer have time to get up and go get a cup of coffee while waiting for VS to launch
  • Project List – I can now pin projects to the Recent Projects list as well as remove them – how great is this one!!!

image

  • The UI supports the standard WPF zoom features for all code windows.  This is great for those who code at 3 am and have trouble seeing.  Just hold the control key down and scroll till you can see it.

image

  • Ability to “pin” objects (Data Tips) in the debugger.  This is nice since it persists across multiple debugging sessions.  How many times have you had to hit a breakpoint and then dig down into an object each time to view some properties?  Now you can get to the desired property and pin it to the screen.  Notice the internal items collection for the List Collection in the code below.  In 2008 you had to expand each time.

image

In 2010 just click the pin button to keep it on the screen

image

Another nice thing is you can export these and send them to another developer.  How cool is that?

  • IntelliTrace – the ability to recreate a bug without having to do any real investigative work and environment setup to duplicate the problem?  This is awesome.

image

  • Dependency Graphs – these are great for visualizing how your classes work together.  You may need to sit down when you do this for one of your production projects.

image

  • WPF designer – It’s pretty fast people!!!!
    • Reset Layout – Remember in 2008 when you drag a control onto the form you have to fix all the layout settings manually? Not any more.  Drag the control on right click and select reset layout – all.

image

    • Data Binding – you can now select an object (combo box for example) and setup the data binding via the UI.  This is good for some quick binding.  It also shows you the available resources so you will know immediately if one of your resources, object data providers, etc is not setup correctly.

image

    • The WPF Tree Visualizer – I used to have to use a program called Snoop for this.  It looks like I don’t need that any more either.

image

Tree Visualizer

image

  • Controls – They finally added a good standard set of WPF controls.  No more relying on 3rd party or custom controls for some basic functionality.

Overall I am happy with Visual Studio 2010.  I can’t wait to start working in it full time.

Oracle 11g2 for Windows

April 16, 2010 tsells 1 comment

Oracle 11.2 for Windows has been released.  Check it here for more details.  http://www.oracle.com/technology/software/products/database/index.html.  Oracle I sure hope you got this one right as the first release (11.1) had some major issues with the .net Provider. I will post an update once I have had a chance to test the new versions.

Categories: Oracle Tags: , ,