Leap Day is a Big Hack

Our Earth makes a complete revolution around the sun every 31,556,956 seconds. This means a year is truly 365 days, 5 hours, 49 minutes and 16 seconds. However, the average of the true solar day is 86,400 seconds, or 24 hours. The length of the solar day also has variation depending on the orbital motion of the Earth, but the average is 86,400 seconds. When you do the math and divide 31,556,969 by 86,400, you end up with some left over time, which is what causes Leap Year. Leap Year was created to maintain our seasonal calendar and prevent seasons from drifting, for example, Winter in July. Leap Year takes the remainder 5 hours, 49 minutes and 16 seconds, rounds it to 6 hours, accumulates it, and every 4 years, the 24 hours of accumulated time is tacked onto the end of February, Leap Day, Feb 29th.

Now if you were paying attention, you caught that we cheated a little and we rounded the 5 hours, 49 minutes and 16 seconds up to 6 hours. What happens to the leftover 10 minutes and 44 seconds?

Leap Year Misunderstood

A common misconception is that Leap Year occurs every 4 years. For most of us reading this, we can go on believing that Leap Year occurs every 4 years because that’s how we’ll see it for the rest of our lives. However, for those that make it to 2100, you won’t see a Leap Year in 2100, even though 2100 is divisible by 4. Why? Every 134 years, the left over 10 minutes 44 seconds accumulates into a full day. To account for that, only years that are divisible by 4 and not divisible by 100 is a Leap Year. 2100 will not be a Leap Year.

If you look back at the 2000 calendar, there was a February 29th. Two thousand is divisible 4 and 100, therefore it shouldn’t have been a Leap Year. What’s going on? Well, we have another math problem. Every 134 years that leftover time makes a full day, but we compensate every 100 years, so we end up with a 34 year deficit that gets handled by another rule. This rule states that if the year is divisible by 4 and 400, ignore the previous rule and add a Leap Day. Now if you are still tracking with me, you may be thinking that this math doesn’t solve the problem and there still seems to be some time left over after all of those hacks and adjustments. If you are thinking this, you are correct.

The purpose of Leap Year is to keep seasons lined up with our calendar. Keeping the vernal equinox on or close to March 21st is the objective. This Superman III, Salami Slicing means that in 8,000 years, the calendar will be one day behind. There have been suggestions to help with this too. Some think that by the time this occurs, the length of the vernal equinox will have changed. Unfortunately, the Cone of Uncertainty is at play and this far out the change to the vernal equinox cannot be accurately predicted. As a result, the current series of Leap Day hacks will have to do. Others like John Herschel have suggested that we need another hack in the algorithm that would make the year 4000 a non-Leap Year. Who knows what this will look like by year 4000. By then I will long be forgotten, the Earth might not even exist and this Leap Year hack won’t concern me. However, if you’re a software developer like me, here’s a chunk of C# code to help you determine if a given year is a Leap Year.

bool IsLeapYear(int year)
   return (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0));

All of that Leap Day history is interesting and it’s interesting to know that something as central as our calendar has a big hack like Leap Day. But I now have a practical Leap Day question for you and it’s likely more important than this useless trivia.

What do you have planned for Leap Day 2012?

Leap Day 2012 is shaping up to be a day of announcements and product releases from Microsoft. My plan for Leap Day includes downloading and installing the Windows 8 Consumer Preview, Visual Studio 11 Beta, taking a certification exam, tuning in to hear announcements from Mobile World Congress and following the MVP Summit 2012 buzz on twitter. The following is the list of the Leap Day 2012 items that I’ll be paying attention to with links for more information and downloads.

Mobile World Congress – Windows 8 & Windows Phone Announcements

Windows 8 Consumer Preview

Visual Studio 11 Beta

MVP Summit 2012

What’s on your list for Leap Day 2012?

ALM for Agile Comes to Madison, WI

The Agile experts at Centare, in partnership with Microsoft, are bringing a day of Agile Application Lifecycle Management (ALM) to you in Madison, WI. The tour that started in the Fall last year, with Chicago, IL, Milwaukee, WI and Indianapolis, IN is now coming to Madison, WI on January 25th.

If you would like to learn how to drive your business forward with Agile Application Lifecycle Management, check out this FREE day of learning. Centare’s experts will dive into the basics of Scrum, emergent architecture, Agile testing and the Microsoft ALM tools including Visual Studio 2010 Ultimate, Team Foundation Server and Test Manager.

Register for the January 25th event in Madison, WI.

Coded UI Presentation from Chicago Code Camp

If you attended my Chicago Code Camp session on Saturday, thank you and I hope you got value from it! I want to take a moment to thank the organizers of this event. Without these community leaders, we wouldn’t have been able to enjoy such a great code camp. Thank you Michael D. Hall, Scott Seely, Jean Seely, Sergio Pereira, Tim Stall and Clark Sell, not just for Chicago Code Camp, but everything that you do for our community.

I also want to thank Angela Dugan. Angela is our Microsoft Developer Tools Evangelist for Illinois, Wisconsin, and Indiana. If you got a book or shirt from my session, please thank Angela, she provided all of those goodies.

If you would like my slide deck, you can get it on my SkyDrive.

One of the questions asked, that I answered with 99% accuracy but wanted to confirm, was “Can I record UI actions with Firefox, or is it just playback?”. It is just playback and you must record using Internet Explorer. For more details, check out this documentation on MSDN. http://msdn.microsoft.com/en-us/library/gg269475.aspx

Also, we discussed the VS 2010 and TFS VHD for exploring these tools. Microsoft has provided a VHD for each Microsoft virtualization technology and can be downloaded from the following links.

One of the books that I gave away, “Software Testing with Visual Studio 2010”, is a great little book that has broad coverage of the Visual Studio 2010 testing tools and I highly recommend reading it.

Thank you again. If you have any other questions, feel free to comment or reach out to me.

Speaking about Coded UI Tests at Chicago Code Camp

We are just days away from this year’s Chicago Code Camp and it is shaping up to be an outstanding event. Chicago Code Camp is an entire day of FREE sessions for developers of all walks, including C#, Java, F#, SmallTalk, Clojure and more. If you are a developer in the Chicago-Milwaukee area, you should set aside this Saturday, May 14th to attend Chicago Code Camp.

I will be presenting “Testing the User Interface: Coded UI Tests with Visual Studio 2010” and expect this session to be educational and interactive. In an attempt to make this session as valuable and targeted as possible, I’ve setup a UserVoice forum where you can suggest and vote on the content presented. I’ve seeded the forum with the topics that I have envisioned, but I’m sure there are other great ideas I haven’t considered. If you are planning to attend, please visit http://ericdboyd.uservoice.com to suggest and vote on the topics you would like to see.

There is an amazing lineup of speakers and sessions for Chicago Code Camp 2011, and you can get a complete listing with the schedule at http://chicagocodecamp.com. If you are planning to attend and you haven’t yet registered, please do so at http://chicagocodecamp.eventbrite.com. It is a completely FREE event, but event logistics are a lot easier when you know how many people are attending.

The organizers of this event have spent a great deal of time making this a world-class code camp, so please thank them when you see them. I would like to extend a special thank you to Michael D. Hall, Scott Seely and Clark Sell for all of the work they have done to make this event great.