Monthly Archives: October 2008

Ann Arbor Day of .NET 2008

20 Oct 2008
by mjeaton, posted in Uncategorized   |  6 Comments

My pictures | Sarah’s pictures

Another great Ann Arbor Day of .NET is in the books. 

While Ann Arbor is only a couple hours away, my family and I always make it a weekend away from home and this year was no different.  We pulled the kids out of school early and left town around 1pm.  We didn’t feel too bad about pulling them out since we knew we were going to spend some of the afternoon at the Ann Arbor Hands On Museum.  After a nice, leisurely drive on US-12, we managed to hit downtown Ann Arbor around 3pm. :-\  Ugh.  I love walking around downtown, but the traffic at that time of day was killer.  After 10 minutes of trying to find a parking spot, we finally scored a nice spot directly across from the museum.

100_0670My kids absolutely love the museum and this visit definitely did not disappoint.  :-)   Because of my work with the museum before and during the Ann Arbor Give Camp, they were nice enough to let my family and I in for free.  While my kids were running around being crazy, I spent a few minutes with my primary contact from the Give Camp: Ann N.  During our conversation, I presented her with the check from “The Codestock / DevLink T-Shirt Challenge“.  I had mentioned it to her a few weeks ago in email, but she had forgotten and was actually quite surprised. :-)

After the museum, we headed to our hotel for dinner.  Shortly after dinner, as my wife and kids headed to the pool, Sarah and I hooked up and drove to Mike Letterle’s hotel to pick him up.  After a quick stop to drop his car off at a repair shop, the three of us headed to downtown Ann Arbor to meet up with Dave Giard, 100_0728 Nino, Matt Brewer and Joe Wirtley.  The original plan was for us to meet at Gratzi’s, but that felt just a bit too “fancy” for us, so we bailed and headed a couple doors down to Conor O’ Neills.  The service was slow, but that gave us more time to talk. 

To wrap up the night, me, Dave, Matt, Nino and Mike sat in a nearby coffee shop and talked.  Good times. :-)   I wish I could do this more often.

The next morning, I was up bright and early (wearing “The” Ratt t-shirt BTW) so I could catch a ride with Sarah (and pick Mike up as well).  Since Sarah and I were speaking in the first time slot of the day, we signed in and headed to our rooms for final preparation.

Once again, I gave my “Introduction to Castle ActiveRecord” talk.  I think the talk went extremely well, although at one point, I realized I was moving too fast and had to slow the pace down a bit.  I had some really good questions both during and after the talk and hopefully I answered them satisfactorily. ;-)   (note: My plan is to screencast this talk in the near future and post it.)

After my talk, I hit the speaker room to meet up with my friend Chris.  Chris was preparing to give his very first talk EVER and I wanted to see what I could to help him during his final preparation.  He was speaking in the final time slot of the Chris Roland and Mike Eatonday, and early in the day he seemed pretty at-ease.  I could see him get more nervous as the day progressed.  For a first-time speaker, I think he did pretty damn good.  Of course, I plan on talking to him this week to give him more feedback, but I really hope he continues to speak and develop this particular talk (SQL Server BI).

I floated between sessions most of the day.  I caught part of Carey Payette’s WPF talk and actually came away with some ideas for the application I’m working on.  I also hit a little bit of Jay’s Boo/DSL talk and Len’s JQuery talk.  

Lunch, thank God, was pizza and not box lunches. ;-)   My hatred of boxed lunches is pretty well known, so I was definitely happy to see something different.  As expected, the conversations during lunch were awesome.  After lunch, I ran into a friend and former co-worker (Vinay) and caught up with him.  He started a new job a few months ago and it sounds like he’s having a great time.  It’s definitely a step up from where he was and I was glad to see he made the right decision.

I think the high-point of my day was a 30-minute conversation with Jim Holmes.  Jim is one of those guys that I’d love to talk to more often because I know I’d learn a ton from him. :-)   He definitely didn’t disappoint on Saturday.  We talked about estimation and then I started rambling on about how difficult it is, as an independent developer, to keep track of all 100_0741 the tasks from multiple clients/multiple projects without using multiple applications.  Jim had some great ideas that I hope to pursue in the very near future (I’ll try to blog about them).

I was really glad to see that Alan Barber made the trip up from Bowling Green.  Unfortunately, he had to leave right after the giveaways so I didn’t get as much time to talk to him as I would have liked. Hopefully he had fun at the Halloween party he left us for. ;-)

After the end-of-day giveaways, we all headed to a local sports bar where we ate, drank, played pool  and talked for a few hours.  A huge thanks to Sogeti for picking up the tab for the after-party!

It was great seeing all my friends again…Dave, Dan, John, Jason, Jay, Jeff, Marty, John, Martin, Mark, Chris…god the list goes on, so if I missed you, cut me some slack. ;-)  

The organizers did a great job this year (again) and I can’t wait until next year!

Project: re-writing a VB6 app using .NET / WPF

13 Oct 2008
by mjeaton, posted in Uncategorized   |  1 Comments

As I mentioned in a previous post, on June 1, I started a new project that entails re-writing a VB6 desktop application.  I actually led the team in 2000 that wrote the original VB6 application, so I’m excited to be the one that’s re-writing the application.  I wanted to give a little more detail about the project and some of the things I’m doing.

The original application took myself and 3-4 other developers about 6 months to deliver back in mid-2000.  The consulting firm I was working for at the time had a “process” and it was called Waterfall. ;-)   We spent weeks gathering requirements, a few more weeks on a “BDUF” (big design up front) before we finally got to writing code.  In the end, we generated a huge stack of paper that was looked at once and then ignored for the remainder of the project.

At the time, we followed Microsoft’s guidance for creating client-server desktop applications (aka Windows DNA).  The user interface wasn’t necessarily thin, but it wasn’t exactly thick either.  It called into our business objects which, at the time of rollout, were hosted in Component Services (COM+).  Over the years (while another consultant was maintaining the application), it was decided that COM+ was unnecessary, so the business logic was removed from Component Services and re-located to each workstation that runs the application (currently  6-8 systems).

Besides that change (and a couple other minor enhancements), the application has remained pretty much untouched since we rolled it out in October 2000.  Even with 8-years of data, the application remains very snappy and stable.  There is one issue that appears at “random” times, but I think it’s a display driver issue and not an application problem.  The end-users (most of whom were there when we developed the original application) are still happy, but are also looking forward to some enhancements.

As I mentioned in my previous post, I decided to go with C#/WPF.  This decision was made with input from my client and it was based on a few things: first, we (the client and I) wanted to get away from the plain old battleship gray application and make some usability improvements.  I saw WPF as being a good way to do that.  Third, my plan is to re-use/share some of the Xaml between the main application and a Silverlight-based application.  Finally, it’s 2008 and I wanted to work with some cutting-edge technology. :-)

I’ve done a couple walkthroughs with some early prototypes and they seem to like it.  Time will tell of course.  I’m hoping to get a version on their desks soon and then get into the rhythm of releases every 2 weeks.  I want to reduce the amount of manual work they do as well as eliminate the work-arounds they’ve come up with over the years.  This is harder than it sounds because these particular users consider these things (work arounds, etc.) “normal”.

Overall, I find this project to be really fun and exciting.  My next post will talk about some of the tools and technologies I’m using outside of WPF/C#.

Recent and upcoming events

06 Oct 2008
by mjeaton, posted in Uncategorized   |  Comments Off

I recently spoke at two user groups: The West Michigan .Net Users Group in Grand Rapids and the Microsoft Developers of Southwest Michigan group in Kalamazoo.

On September 9th, I gave my “Introduction to Castle ActiveRecord” talk for the West Michigan group.  I went to Grand Rapids early that day and had lunch with some friends (Steve, Matt and Joel).  I wish I could have talked to them all day, but since they had to get back to work, I ended up spending most of my afternoon at a Panera trying to get a reliable internet connection.

That was my first time attending one of their user groups and I have to say, it was a nice experience.  The Watermark Country Club is a pretty nice venue.  The pizza was really good and it was nice to grab a drink before I gave my talk. ;-)   It felt strange having my old boss (Steve) in the audience, but beyond that the talk itself went pretty well.  My only complaint was that the projector could only do 800×600. :-\  That made some of my demos tough, but I got through it. 

On September 25, I opened up MDSM’s 2008-2009 season with a brand new talk: ALT.NET, The Community and You.  I originally wanted to do a talk just on the community, but after talking to the group leader (Mark), I found out the group wanted to know about ALT.NET, so I decided to combine the two.  Actually, talking about alt.net was a great segue into the community in general. 

The alt.net portion of the discussion talked about the history of the “movement”, but I really tried to focus on the positives, especially from the standpoint of David Laribee’s original post.  I also talked about some of the principles and practices and then I jumped into how we as a community can drive change in the world of software development.  I finally talked about how each of us can help affect positive change within the larger community.  I enjoyed giving this talk and might work it into my rotation. :-)

I’m speaking at the upcoming Ann Arbor Day of .Net on October 18th.  This will cap off speaking in the heartland region for me this year, and once again, I’ll be giving my “Introduction to Castle ActiveRecord” talk.  After the Ann Arbor event, I have a month of no events and then on November 15th I’ll be attending the Raleigh Code Camp:-)   Originally, I was going to this event to help Alan and James with the Open Spaces event, but James said I should submit to speak, so it looks like I’ll also be giving my “Introduction to Castle ActiveRecord” talk one last time this year.

Maintenance project: baby steps

02 Oct 2008
by mjeaton, posted in Uncategorized   |  6 Comments

This is the first in what I hope will be a series of posts about my attempts to make this particular project better.

A couple months ago, I took over a pretty cool C#/WinForms project that deals with RFID scanning.  I was given the green light to refactor the application as needed, which is awesome because the application really needs it. :-)   I’ve been working on a new feature which consists of several data-entry screens and three reports.  The screens and reports are all hitting about a dozen new tables I added to the system.

One of the requirements of the application is that as new versions are installed at customer sites, it should be able to handle updating the local databases without the use of external scripts or setup applications.  Basically they want to be able to send an updated .exe and application .dll to the customer, have them run it and know that the local database schema has been updated (if needed).  While I have my own opinions on this, there are bigger fish to fry, so I decided to follow the existing method for database updates.

When I first dug into the code, I saw many, many methods that had hard-coded SQL in them for creating new database objects, altering existing objects, etc.  Ugh.  Here’s an example of what I’m talking about:

string sqlCmd = "create table Accounts (" +
    "AccountID varchar(50) NOT NULL PRIMARY KEY," +
    "ClientName varchar(50) NULL)";

SqlCommand dcmd;
int rows;

dcmd = new SqlCommand(sqlCmd, dc);

try
{
    rows = (int)dcmd.ExecuteNonQuery();
}
catch (Exception e)
{
    // log the exception
}
 

Ok, now there are obviously more problems here than the hard-coded SQL, but that’s not the point of this post. :-)

When the application starts, it connects to the database and checks the “VerInfo” table.  It grabs the “current” database version from this table and then executes “upgrade” code (like the code above).  It is smart enough to perform all the upgrades it needs in order to become completely current.

private void CheckToUpgrade()
{
    int version = GetDbVersion();

    if (version <= 102)
    {
    DbTo103();
    SetDbVersion(103, DateTime.Parse("6-1-2007 12:00:00 PM"), "Added Accounts Table");
    version = 103;
    }

    if (version <= 103)
    {
    DbTo104();
    SetDbVersion(104, DateTime.Parse("6-19-2007 12:00:00 PM"), "Added AccountID/ClientName field to Synch Table");
    version = 104;
    }

    if (version <= 104)
    {
    DbTo105();
    SetDbVersion(105, DateTime.Parse("6-21-2007 12:00:00 PM"), "Added SyncLog table");
    version = 105;
    }

    if (version <= 105)
    {
    DbTo106();
    SetDbVersion(106, DateTime.Parse("9-16-2008 12:00:00 PM"), "Added several new tables table to support Admin station.");
    version = 106;
    }
}

In the whole scheme of things, NOT the way I would have approached this particular problem, BUT I also need to work within the constraints of this client (and their clients).  They do NOT want external scripts that have to be manually executed.  Ok, I’m fine with that.  The application also doesn’t have a setup because they want to easily do x-copy installs. 

Fine.  So, my solution to this particular problem (the hard-coding of SQL statements in the code) was to:

  • Take my SQL scripts that I already generate for checking in to svn and add them to my project as embedded resources.  This gets me away from hard-coding the SQL (and worrying about proper escaping, quote matching ,etc.) and allows me to easily change the scripts (either by hand or by modifying the objects in the database and re-scripting from the database).  It also allows me to do more such as checking to see if the object exists within the script itself.  As one of my reviewers pointed out, this is still “hard-coding”, but honestly, isn’t this better than hard-coding the actual “create” and “alter” statements? :-)
  • I created a method named “ExecuteSqlUsingSMOFromEmbeddedResource(string resourceName) and used SMO to execute the embedded scripts.  I used SMO (which was already referenced in the project) so I wouldn’t have to worry about stripping “GO” statements from the scripts.  Yea, the method name is a bit verbose, but I’d rather see a long name like that than “execSQL”.  I wanted to make it clear exactly what I was doing to any other devs that look at this code. :-)
private void ExecuteSqlUsingSMOFromResource(string resourceName)
{
    SqlConnection connection = this.dc;
    Microsoft.SqlServer.Management.Smo.Server server = new Microsoft.SqlServer.Management.Smo.Server(new ServerConnection(connection));
    if (server != null)
    {
        using (StreamReader s = new StreamReader(this.GetType().Assembly.GetManifestResourceStream(resourceName)))
        {
             string createScript;
             createScript = s.ReadToEnd();
             server.ConnectionContext.ExecuteNonQuery(createScript);
        }
    }
}

I actually feel a lot more comfortable with this solution.  I have control over the scripts, and if/when a table/object change is needed, I can make them in one place, script them out and call it good.  As for dependencies…well, right now I’m simply making sure objects are created in a specific order and then applying all indexes, etc. at the end.  It works well for my very limited scenario.

So, what do you think?  Good idea?  Is there a better way?  One of my reviewers mentioned migrator.net as an alternative, so I might look into that for future revisions.  Another mentioned a tool from Red Gate.  As the title of this post suggests, my solution is a bit better than the original, but it can still be improved.  It is a baby step toward a better, more robust solution.  What that final solution is remains to be seen. :-)

What I’ve been working on

01 Oct 2008
by mjeaton, posted in Uncategorized   |  Comments Off

Right around the first of June, I started a new project.  This is one that’s been in the pipeline since last September or October.  After submitting a proposal near the end of November 2007, final approval was given near the middle of May and the official kick-off was June 1st (although our kick-off meeting didn’t actually occur until June 3rd).  The project itself is pretty cool; it’s a re-write of a VB6 application that I worked on in 2000.  When I led that team back in 2000, I never imagined I’d be re-writing the application 8 years later.  Cool stuff. :-)

The application itself has been pretty stable and the users have no major complaints, BUT new features are being requested, the possibility of this software being used at other offices combined with the fact that VB6 is “end of life” means a re-write is required.  This rewrite is giving me the opportunity to bring this application into the 21st century, both with the technology I’ll be using as well as the look and feel of the application.

The decision has been made to forge ahead with C#/WPF and some ASP.NET thrown in for good measure. :-)   The cool thing is that I will be using the latest and greatest tools and technologies.  This means all the goodness that is .NET 3.5 combined with some really great open source tools.  My client has bought into the idea of improving the user interface /user experience and have given me a lot of leeway in that regard.  Early prototypes have met with good feedback and I’m moving along.

On top of that, I picked up a part-time gig that consists of maintaining an existing application that does RFID scanning.  In the last 2 months, that maintenance has included adding a pretty big feature to the application.  It’s been a learning experience, especially since some of my team mates are in Europe. :-)   The original developer on the project is long-gone and I’ve been given permission to refactor as needed.  One of the first things I did was introduce Castle ActiveRecord for use with all of the new tables I added (for the new feature).  This has meant a huge boost to my productivity.

Anyway, this blog has been a bit quiet and I wanted to let everyone know why. :-)

Technorati Tags: ,,,