Tim Hibbard

Software Architect for EnGraph software


News





Add to Google



My Stats

  • Posts - 593
  • Comments - 347
  • Trackbacks - 507

Twitter












Tag Cloud


Recent Comments


Recent Posts


Article Categories


Archives


Post Categories


Image Galleries


EnGraph Blogs


Links


Other


Roll


March 2007 Entries

Pictures of Golf and our new office


Yesterday Kyle, David, Jonathan and I walked 18 holes at St. Andrews in Overland Park and then did some planning at our new EnGraph office in Lenexa.  Here are some pics:

DSC00442 DSC00437 DSC00436

David teeing off                                                                        Water hazard?

DSC00438 DSC00444 DSC00445

DSC00441 

Our new desks!                                      David and Jonathan's office                  Server room...finally!

DSC00446 DSC00449 DSC00447

 

posted @ Thursday, March 29, 2007 1:05 PM | Feedback (1) | Filed Under [ EnGraph Sports ]


Unit testing thoughts


I try to maintain 100% code coverage in my non-UI classes, especially my state objects that just hold data.  I recently ran into a situation that I'm having trouble writing an automated test for.  We have a ContactInformation class that holds information about how to contact a person (home phone, cell phone, email), and in that class I have a .SendEmail and .VisitWebSite methods:

public void SendEmail() { if (!string.IsNullOrEmpty(_emailAddress)) { System.Diagnostics.Process.Start("mailto:" + _emailAddress); } } public void VisitWebSite() { if (!string.IsNullOrEmpty(_webPage)) { System.Diagnostics.Process.Start(WebPage); } }

Obviously, running a unit test against these methods would open a new mail item and a web browser.  Plus the methods are void, so my test would only assert that the methods did not encounter an exception.

I'm considering changing these methods so they return a string that the consumer could shell out in the fashion that they desire.  That way, I would remove the functionality from my state object and it would be testable.

Thoughts?

 

Technorati tags: , ,

posted @ Thursday, March 29, 2007 9:27 AM | Feedback (6) | Filed Under [ .NET ]


Our last week in the Lawrence office


The last year in the Pendleton & Sutton building has been good for EnGraph.  It is our first office and I remember when we just moved in.

However, we've added new members to the company (and are still looking for more), and an office in Kansas City just makes sense because all the developers but me live in the KC area.

We just signed for a place on Strang Line Rd that used to be occupied by Kyle's brothers company, ASB.

We move in on Monday and I'll be driving there everyday (which will make Where's Tim much less boring)

 

posted @ Tuesday, March 27, 2007 7:44 AM | Feedback (5) | Filed Under [ EnGraph Where's Tim ]


GeoRSS on maps.google.com


The Google Maps API blog talks about adding support for GeoRSS enabled feeds on Google Maps.

That means you can take the Where's Tim Messaging Feed and view the last 50 message people sent me on Google Maps

You can also take my location feed and view it on Google Maps.  Since my location feed contains Yahoo Maps, clicking on the GIcon will show a Yahoo Map on the Google Map!

 

posted @ Monday, March 26, 2007 12:20 PM | Feedback (1) | Filed Under [ GPS Mapping Where's Tim Social Geocoding ]


GUID as Primary Key


Jeff Atwood wrote an interesting post yesterday arguing for using GUIDs instead of auto-incrementing integers.

We recently had one of our clients merge with another one of our other clients and it was a pain merging their ParaPlan databases.  If we were using GUIDs as Primary Keys, the headache would have been much less.

 

posted @ Wednesday, March 21, 2007 7:45 AM | Feedback (0) | Filed Under [ EnGraph .NET ]


Vista New Email shortcut


Typing mailto: in the search box in the Vista start menu will open a new mail message in Outlook. 

It is much faster for me to hit the Win key on my keyboard and type mailto: than it is for me to hunt through the 15 open applications, find Outlook and click "New".  Plus I don't have to transition between my mouse and keyboard.

It's really not a new Vista thing since you could have typed WinKey + R, then mailto: before, but it's still cool.

 

Technorati tags: ,

posted @ Monday, March 19, 2007 12:47 PM | Feedback (0) | Filed Under [ MS Office Vista ]


Perfect NCAA bracket


According to SportsCenter last night, out of 3 million brackets submitted to ESPN.com, only one person has picked his bracket perfectly.  The team that he has winning it all?  Kansas Jayhawks!  Rock Chalk!

 

posted @ Sunday, March 18, 2007 9:17 AM | Feedback (2) | Filed Under [ Sports ]


Chris West's NCAA picks


Chris West has posted his picks for the first and second round and also his picks up to the championship.  I still like my picks better, but it's cool to see his thought process for each of his decisions.

Update - Fixed the link

Technorati tags: , ,

posted @ Wednesday, March 14, 2007 1:49 PM | Feedback (0) | Filed Under [ Sports ]


More thoughts on Equals()


I agree with Dru's comment on my post yesterday about overriding Equals().  I now want to implement a static function into my objects that will compare two objects.  Again, I'm stuck between two ways of doing it.  I could accept specific  object types (static bool Equals(MyObject a, MyObject b)) or just accept an object type and cast it (static bool Equals(object a, object b)).  I'm leaning towards the latter way as it allows me to define that method into the interface that all my objects already implement.  But as I look through the .NET framework, Microsoft used the first way.

Assuming I have an object called Audit, here are the ways I'm trying to implement it.

The first way:

public static bool Equals(Audit a, Audit b) { bool rv = true; try { //compare } catch (Exception) { rv = false; } return rv; }

The second way:

public new static bool Equals(object a, object b) { bool rv = true; try { Audit first = (Audit)a; Audit second = (Audit)b; //compare } catch (Exception) { rv = false; } return rv; }

I guess I could implement both ways and let the consumer decide which one to use, but I don't have a way to enforce that with an interface.  Any thoughts?

 

Technorati tags: , ,

posted @ Wednesday, March 14, 2007 10:25 AM | Feedback (3) | Filed Under [ .NET ]


The upset that will win me all my NCAA pools


#13 Davidson will crush Maryland tomorrow, making me the envy of all those in my bracket pool.

Other over-ranked teams taking an early first round exit: Butler, Notre Dame, UNLV, Indiana, Creighton and Vanderbilt.

Kansas and Texas in the National Championship.  Kevin Durant scores 44, but still suffers his third loss of the year to the Jayhawks.

Rock Chalk!

 

posted @ Wednesday, March 14, 2007 7:51 AM | Feedback (7) | Filed Under [ Sports ]


Overriding Equals thought


When overriding Equals() in an object, I wonder if it is better to compare the fields using != or use the .Equals of the field's value type.

Assuming that _invoiceID is an int and that x is the obj, should I use the != way of comparing:

if (x._invoiceID != this._invoiceID) { return false; }

Or use the .Equals method of int, like this:

if (!x._invoiceID.Equals(this._invoiceID)) { return false; }

If I use the .Equals style, then I won't have to change my code if I ever abstract InvoiceID into its own object.

Is there a standard practice for doing this?  I usually don't mess with overriding .Equals or .ToString, but I've been finding it useful lately, so I want to do it right.

 

Technorati tags: , , ,

posted @ Tuesday, March 13, 2007 3:19 PM | Feedback (1) | Filed Under [ .NET ]


ToolStripManager with ClickOnce


The ToolStripManager is a great way to save the position of toolbars on your WinForm apps.  More info here.  It works a little bit differently with ClickOnce applications, but it is an easy fix.  Just set the key to a unique string.  The key would probably have to be unique for the entire machine, but I'm not sure about that.  The code looks like this:

 

void formValidateBatch_FormClosing(object sender, FormClosingEventArgs e) { ToolStripManager.SaveSettings(this,"medicaidFormValidate3116789"); } private void formValidateBatch_Load(object sender, EventArgs e) { ToolStripManager.LoadSettings(this, "medicaidFormValidate3116789"); }

 

Technorati tags: , ,

posted @ Friday, March 09, 2007 11:22 AM | Feedback (1) | Filed Under [ .NET ClickOnce ]


Evil in the air


The next task in our Team Foundation Server is going to be id 666.  Maybe I should not work today and just watch basketball.

 

Technorati tags:

posted @ Friday, March 09, 2007 7:30 AM | Feedback (5) | Filed Under [ EnGraph TFS ]


TFS Work Item Management Outlook Addin


 

Wow!  The SRL Team has released an Addin for Outlook that connects to Team Foundation Server.  This is the task management tool that I have been waiting for.  You can generate a work item right from Outlook.  You can view queries, you can search your work items, you can even generate a work item based on content from an email.  I mapped the subject to the task title and the body to the description, but you can map any field you want.  Then it changes the subject line in the email to have the work item id.

Great work guys.  The only problem I had, is that I had to kill the outlook.exe process after installing this addin to get it to show up.  I think that was because I had ActiveSync running.

 

Technorati tags: , , ,

posted @ Thursday, March 08, 2007 7:06 AM | Feedback (5) | Filed Under [ MS Office TFS ]


Localize Me


According to the LJWorld, a Lawrence man has eaten at Local Burger (a local organic restaurant) three times a day for the last 30 days.  He lost almost 25 pounds and his cholesterol dropped from 285 to 166.

He is going to continue his new diet and the owner of Local Burger is giving him a 50% discount until he reaches his goal of 200 pounds. 

Good for him!

 

posted @ Wednesday, March 07, 2007 1:08 PM | Feedback (0) |


Why doesn't SqlClient.SqlCommand CommandType default to StoredProcedure?


I find it frustrating that the SqlCommand object doesn't automatically set the CommandType to StoredProcedure on instantiation.  If you look in Reflector, you'll see that _commandType isn't initialized to anything.  I thought Microsoft wanted us using stored procedures.

Anyways, I got tired of always writing this code:

SqlCommand CMD = new SqlCommand(spName); CMD.CommandType = CommandType.StoredProcedure;

So I wrote a little function that I keep in my DAL classes:

private SqlCommand NewSqlCommand(string sqlText) { SqlCommand rv = new SqlCommand(sqlText); rv.CommandType = CommandType.StoredProcedure; return rv; }

So now when I want a new SqlCommand object, I use this following code:

SqlCommand CMD = NewSqlCommand(spName);

I know I'm only saving one line of code , but I think my physical therapist would be proud!

 

Technorati tags: , ,

posted @ Monday, March 05, 2007 3:52 PM | Feedback (1) | Filed Under [ .NET ]


Starting physical therapy


A couple weeks ago, I blogged about the pain in my hands because of tendonitis.  Since then, I've followed all directions from my doctor, took my medicine and even switched to using my left hand for the mouse.  The pain only got worse, and it got to the point where my hands, wrists and forearms were throbbing.  It hurt to drive, play with the dogs, use the remote control and my productivity with EnGraph was going down the tubes.  Some days I would have to quit at 3 PM and just read a book.  By the way, Professional Team Foundation Server by Mickey Gousset and Co. is fantastic.  I've been wanting to do full blown review, but I haven't yet, so I'll just say it's an easy, necessary read for anybody working with TFS.

So I went back to the doctor last week and she did some more tests and determined that it still wasn't carpal tunnel, just that the tendonitis was getting more aggressive.  She gave me some new pills and suggested that I see a physical therapist.  Turns out that Bird Physical Therapy had just hired a hand specialist. 

I went to see Kathy at Bird last Wednesday.  She also confirmed that it was just tendonitis.  She gave me a bunch of new exercises to do and told me that I was icing wrong.  Apparently even though the tendonitis hurt in my hands, the source was just below the elbow where all the tendons are bunched up.  She showed me the correct place to ice and told me that I should only ice for 10-15 minutes, instead of the 30-45 minutes that I currently was.  She also told me that since we caught this early enough, that we wouldn't have to take any aggressive measures like surgery or not using a computer.  This made me feel a lot better.  I was concerned that this might lead to me being out of work, having to sell my Saturn and living in an abandoned warehouse (again!).

Since my visit with Kathy, things have gotten a bit better.  The pain is much more manageable, and the exercises are helping.  I have my first actual physical therapy session this morning and we are going to do ultrasound heat medication and deep tissue massage.  Watch me on Where's Tim here in few.  Or better yet, get the Where's Tim Alerter to be notified if I (or anybody on Where's Tim) is moving.  It just sits there politely in your task tray until I start moving and it's ClickOnce so it updates itself.

 

posted @ Monday, March 05, 2007 7:23 AM | Feedback (5) | Filed Under [ EnGraph Where's Tim TFS ]


C# code to get generic list of dates between starting and ending date


This code snippet will return a generic list of DateTime containing the dates between a starting date and ending date:

private List<DateTime> GetDateRange(DateTime StartingDate, DateTime EndingDate) { if (StartingDate > EndingDate) { return null; } List<DateTime> rv = new List<DateTime>(); DateTime tmpDate = StartingDate; do { rv.Add(tmpDate); tmpDate = tmpDate.AddDays(1); } while (tmpDate <= EndingDate); return rv; }

To view this code in action, copy and paste the following code into SnippetCompiler:

DateTime StartingDate = DateTime.Parse("02/25/2007"); DateTime EndingDate = DateTime.Parse("03/06/2007"); foreach (DateTime date in GetDateRange(StartingDate,EndingDate)) { WL(date.ToShortDateString()); }

And it will return:
2/25/2007
2/26/2007
2/27/2007
2/28/2007
3/1/2007
3/2/2007
3/3/2007
3/4/2007
3/5/2007
3/6/2007

Technorati tags: , , ,

posted @ Thursday, March 01, 2007 12:54 PM | Feedback (1) | Filed Under [ .NET ]


Kansas weather is weird


Yesterday it was 74 degrees and sunny, and I went running wearing a short sleeve shirt.  This morning, it was snowing on the drive to work.

Hopefully, this is winter's last gasp of air and spring is right around the corner.

 

Technorati tags: , ,

posted @ Thursday, March 01, 2007 6:54 AM | Feedback (1) | Filed Under [ Where's Tim ]