Philip Hendry's Blog
Sporadic musings from Philip Hendry

Grouping Multiple Consecutive Days using T-sql

Feb 21, 2011 • T-SQL • 3 min read

I have a timesheet table that contains one entry per day per employee and against each entry is a reason flag which indicates whether the entry is for a holiday or sickness etc. I’ve written a SQL Server report that generates a list of the holidays that drills-down several levels to the actual holidays but I don’t want to list individual days but rather the holiday periods as a date from/to and numbers of days. With some inspirational thinking from Rob Farley I’ve created must the same query as his to merge the consecutive days and provide a total. Here’s the initial version :  Read →

Displaying ‘Unsaved Changes’ message for a web page using jQuery

Feb 10, 2011 • ASP.NET, jQuery, Web • 1 min read

I had a need to allow a user to cancel navigation to another page if changes to a form had not yet been saved – especially if they attempted to navigate to another page from the ever present menu. The code I used has a slight ‘hack’ which involves using the propertychange DOM event in IE rather than the change event which I would have usually expected.  Read →

Creating a EqualityComparer on the fly with Lambdas

Nov 15, 2010 • Testing • 2 min read

When I’m writing unit tests I need the code to be a succinct as possible and one of the issues I’ve had is comparing objects sets/graphs to confirm expectations. Here’s a couple of the unit tests that test my solution and hopefully demonstrate what I’m after :  Read →