Welcome

You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

New Channel9 Show Code to Live Hits the Streets!

Posted by Keith Elder | Posted in .Net | Posted on 24-09-2007

2

image  It is good to see friends and people you respect bring something new to the developer community. Josh Holmes and Steve Loethen have done just that by creating a new Channel 9 show called “Code To Live“.  The show is different from other Channel 9 shows since it doesn’t showcase Microsoft employees talking about Microsoft technologies.  The show’s focus is on finding and showcasing developers who, well, code to live.  Sorry, I couldn’t resist the pun.  To quote the show:

Coding isn’t just a paycheck, it’s who we are! Tour the US with your hosts Steve Loethen and Josh Holmes as they interview fellow code warriors and get to the bottom of the coolest software in the world – yours.

imageThe first inaugural show actually has one of our team members on it, David Redding.  David has been getting into XNA a lot (outside of work of course) and since the HALO 3 launch is right around the corner the first show is covering XNA and Independent Gaming.  Check out the show and get it added to your RSS news reader.

 

 

 

 

 

Technorati tags:

Scripting Database Creation and Fake Data Generation From Data Dude Without Data Dude Installed

Posted by Keith Elder | Posted in .Net | Posted on 30-08-2007

0

I have Data Dude (aka, Visual Studio for Database Professionals) installed on my local machine.  However, my other team members don’t have Data Dude installed.  They are running Visual Studio Team System for Developers.  This puts us all in a quandary.  For example, if I update the database with Data Dude, how do the other developers get the latest updates installed to their local sandbox?  Better yet, how do they generate fake data for the database when they don’t Data Dude installed?  This is supposed to be addressed in future versions of Data Dude but I needed something now.  Here is what I came up with.

For the record, getting the database updated on other team member’s computer’s is rather easy since Data Dude builds a complete SQL file with all of your changes.  Using sqlcmd from the command prompt you can replay the contents of this file back into your database to reset it.  Initially I created a batch file to do this and here is the results of that:

  • sqlcmd.exe -E -S Localhost -d master -w 500 -I -r 1 -b -m-1 -i “DatabaseSchema.(local).MyDatabase.sql”
  • cd ..\Scripts\Post-Deployment\
  • sqlcmd.exe -E -S Localhost -d master -w 500 -I -r 1 -b -m-1 -i “Script.PostDeployment.sql” -v filepath=”C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA” -v databasename=”MyDatabase”

Running these series of commands from a .bat file re-creates the database just fine.  The problem is I didn’t have a way to generate the fake data for the team members.  While I was writing a unit test for a stored procedure it hit me.  The unit testing tool asked me a series of questions when I created my first unit test.  It asked the database name, if I would like the data regenerated each time and if I wanted to clean the data or not.  Surely it took that information and put it somewhere so it could see what was going on.  I cracked open the app.config file on the unit test project and saw this:

<?xml version=1.0 encoding=utf-8 ?>

<configuration>

 

    <configSections>

        <section name=DatabaseUnitTesting type=Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.Configuration.DatabaseUnitTestingSection, Microsoft.VisualStudio.TeamSystem.Data.UnitTesting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a />

    </configSections>

    <DatabaseUnitTesting>

        <DatabaseDeployment DatabaseProjectFileName=..\..\..\Database\DatabaseSchema\DatabaseSchema.dbproj

            Configuration=Debug />

        <DataGeneration DataGenerationFileName=..\..\..\Database\DatabaseSchema\Data Generation Plans\FakeData.dgen

            ClearDatabase=true />

        <ExecutionContext Provider=System.Data.SqlClient ConnectionString=Data Source=.;Initial Catalog=Mydatabase;Integrated Security=True;Pooling=False />

        <PrivilegedContext Provider=System.Data.SqlClient ConnectionString=Data Source=.;Initial Catalog=Mydatabase;Integrated Security=True;Pooling=False />

    </DatabaseUnitTesting>

</configuration>

 

Digging into this I could see there was a custom section called DatabaseUnitTesting.  I cracked opened the dll Microsoft.VisualStudio.TeamSystem.Data.UnitTesting using Reflector to see what was exposed and how things were configured.  After poking around I created a Windows Console application and added a few references to the project:

 

image

Once the references were setup I added the above app.config to the project and then added essentially two lines.  One to deploy the database and the other to generate the fake data. 

      static void Main(string[] args)

        {

            try

            {

                Console.WriteLine(“Rebuilding Database…..”);

                DatabaseTestClass.TestService.DeployDatabaseProject();

 

                Console.WriteLine(“Generating Fake Data….”);

                DatabaseTestClass.TestService.GenerateData();

 

                Console.WriteLine(“Completed.”);

                Console.ReadLine();

            }

            catch (Exception ex)

            {

                Console.WriteLine(ex.Message);

                Console.ReadLine();

            }

        }

    }

After these few and simple steps I built the project and then ran it.  My console window opened and started running.  After about 30 seconds it finished.

image

Holy cow!  I just recreated Data Dude’s two main features in a matter of a few lines of code!

The only thing left I had to do is to set the VisualStudio DLLs to copy out to the local directory.  This worked on my computer at first since these DLLs were already installed in the GAC.  However, the other team members obviously won’t have them in the GAC.  On each of the VisualStudio DLLs I right clicked on properties and set the “Copy Local” option to true.

image

This will force all the required assemblies to be pushed out into the build folder once a build is done.  The final build ended up looking like this:

image

Now everyone on the team can update their local sandboxes and restore the latest fake data when the database is updated.  I’m really excited to have this working because we’ve had a lot of trouble keeping database changes in sync on developer machines.  Data Dude helps with the problem but only if you have it installed and if you are just a Developer on the team who doesn’t have it installed, there is no reason why you should be left out of all the fun. 

In the future this is “supposed” to be built into Visual Studio so Developers won’t have to jump through this many hoops to leverage Data Dude.  Until then, this works.  I hope those of you that have been struggling with this as I have find this useful.

Data Dude References Wrong Assembly in Unit Test Project With VS2008 Beta 2 Installed

Posted by Keith Elder | Posted in .Net | Posted on 30-08-2007

0

I just ran into this bug this morning.  I was creating a unit test project for my database so I could create unit tests for the stored procedures.  Turns out when I created the project and added the first unit tests to it it referenced the Visual Studio 2008 Beta 2 9.0 DLL for Microsoft.VisualStudio.TeamSystem.Data and Microsoft.VisualStudio.TeamSystem.Data.UnitTesting. 

The fix was to remove them and then re-add them but why it did this I have no idea.

Finally, Visual Studio 2008 Beta 2 Installed

Posted by Keith Elder | Posted in .Net | Posted on 27-08-2007

1

image Finally Visual Studio 2008 Beta 2 is installed.  I’ve been through hell trying to get it installed on Vista.  I’ve ran the setup program probably 15 times only to have the .Net framework 3.5 installation stopped. 

I spent countless hours reading blogs, forums and error codes trying to get it installed.  In the end I think the majority of the problem was a bad DVD.  Yes, I am once again haunted by a bad DVD burn from a validated ISO. 

My fix was to first install .Net 3.5 Beta 2 release by itself since this appeared to be the major hurdle most people had problems with during the install.  I figured if I could get the 3.5 framework installed then I *should* be on my way.  After I had this installed I got an I/O error half-way through the web designer tool install.  To remove the I/O and DVD burn problem I mounted the ISO over the network via Virtual CloneDrive and everything installed. 

Once Visual Studio 2008 was installed I had to download the Visual Studio Team Foundation Server 2008 since the previous download did not include the team foundation server client.  To install the client I ran a custom setup and chose the client.  Why this is not integrated with the original install I have no idea. 

I’ll be digging into VS2008 with Smart Clients pretty heavily and look forward to finally running VS2008 outside of a virtual machine.  For those wondering if VS2008 will take over as my daily IDE for development the answer is no, not yet.

RIM You Owe Me $450 or 3 Hours of My Life Back

Posted by Keith Elder | Posted in .Net | Posted on 08-08-2007

2

I’m sitting eating lunch and it just hit me that I wasted three hours of my life last night trying to install the Blackberry Plugin for Visual Studio that was recently released.  I tried to install it on 2 different machines and it kept trying to install SQL Server Express 2005 although it was already installed.    I told it to skip the SQL Server Express install and it canceled the install.  Yeah, the whole thing.  I then told it to go ahead and try to install it hoping it would bomb and then move on.  It did bomb and appeared to be running through the rest of the install but then it would die. 

I spent a total of three hours trying to get this plugin to install.  RIM, if you are going to publish an installer at least make sure it works.  Did you test it on Vista?  How about x64?  Did you assume that no one would have express already installed?  You do know there is a SP2 upgrade for express to even work under Vista?  Why was this bundled in with the installer in the first place?  I can’t believe the installer relies on SQL Server Express.  Really this just blows my mind that an installer would need express just to install.  WTF?

RIM, I’ve lowered my hourly rate to $150 since it was after hours so you only owe me $450 for this time wasting adventure.  I will only accept cash, sending me a $450 Blackberry is not acceptable.