Wednesday, February 21, 2007

WoW!

A month ago, before the release of BC, this might have meant more...  But, tonight, after about 16.5 days (/played), Jaesyn of Dalaran leveled to 60. 

Not too bad for starting this particular toon in November and not being part of a guild.

Guess Who's 60?

Now the push to 70 begins...

Tuesday, February 20, 2007

Closures

Dustin Campbell has written a great series over the past few weeks on functional programming topics, which despite being a classic computer science topic, tends to be a little bit ahead of the curve as far as modern day .NET programming is concerned (that will all change in the near future, though - trust me!).

"Closures" is one of the topics that both he and Bill Wagner are expressing a lot of passion for these days, because understanding what they are and how they work are a critical as we move forward into everyday acceptance of Anonymous Methods, Lambda Expressions, and scary things like that.

I've had a pretty good understanding of what a Closure was up to this point, thanks mostly to seeing Dustin present on the topic, as well as spending six hours trapped in a car with him as we drove to and from Dayton one evening.  However, I read something today that really made it click.

I was reading up on the programming language LUA, which just happens to be used to create add-on modules for World of Warcraft (wink, wink).  LUA is a dynamically typed language that supports using functions as first-class variables.  It also supports the concept of anonymous/inline functions, as demonstrated by the following:

function makeaddfunc(x)
-- Return a new function that adds x to the argument
return function(y)
-- When we refer to the variable x, which is outside of the current
-- scope and whose lifetime is shorter than that of this anonymous
-- function, Lua creates a closure.
return x + y
end
end
plustwo = makeaddfunc(2)
print(plustwo(5)) -- Prints 7

(Credit: http://en.wikipedia.org/wiki/Lua_programming_language)


From that Wikipedia article comes this quote, which resulted in my "ah-ha!" moment:



A new closure for the variable x is created every time makeaddfunc is called, so that the anonymous function returned will always access its own x parameter. The closure is managed by Lua's garbage collector, just like any other object.


So, the simplified point is that because makeaddfunc(x) contains an anonymous function that uses "x", a closure is created each time that makeaddfunc(x) is called in order to preserve the state of variables that are defined outside of the scope of the anonymous function.


I'm not sure if this will help to clear things up for other people as well as it did for me, but here's hoping!

Monday, February 19, 2007

Day of .NET in Ann Arbor: We're Doin' It Again!

Just a quick announcement that we're busy organizing another Day of .NET in Ann Arbor, which will take place on Saturday, April 28, 2007May 5, 2007 on the campus of Washtenaw Community College.

Last year's event was a huge success, with around 150 people in attendance. At the end, over $40,000 worth of swag was raffled away, with everyone walking away with something.

Keep an eye on the web site for further details as they evolve:

Day of .NET in Ann Arbor

http://www.dodn.org/

The "Call for Speakers" is currently underway, with submissions being due by March 10, 2007.

Friday, February 16, 2007

The Specified Module Could not be Found

This week, I'm helping another branch out with some bug fixes on a web application that I originally assisted with years ago. Or, I should say that I'm attempting to help them out. The first challenge is getting my development environment set up to run this massive application.

Today, everything was working until I tried to test reporting (which happens to also be the area of the system that my issue involves). These reports use a third-party tool to create Excel documents on the server. Despite everything that I could think of, I kept getting a pretty generic error message during the ctor() call of one of the objects in that Excel writer library:

"The specified module could not be found."

The problem, as it turned out, was not due to ASP.NET's inability to find the assembly. What happened was that the assembly was merely an interop wrapper for a COM library, and because I had just "xcopy deployed" the web application, the COM library never got registered.

The solution: regsvr32 the COM DLL that the Interop Assembly required.

Wednesday, January 24, 2007

Working on Blog Template

I upgraded to Blogger's new account, and need to rework my template to take advantage of new features. Until I get the time, I just picked one of their existing templates to start working off of (though, I really didn't need to since the classic templates still work, but I wanted a fresh start).

As a result, things like Haloscan are not yet linked up.

Sunday, January 21, 2007

PDC '07: What's going to be revealed?

Dustin, Steve, and I were chatting at the Developer Express booth at CodeMash about what we thought might be revealed at PDC '07. The Professional Developer Conference is an event where Microsoft usually reveals all of the cool stuff that will be upcoming (1-2 years out).

So, what can possibly be revealed that hasn't already been? Certainly, they won't be talking about Visual Studio 2007 (Orcas), because that's old news by that time.

Then we started speculating. With Ray Ozzie at the helm, I think I know exactly where they're going with the Visual Studio IDE:

<TotalSatire PleaseDoNotSueMe="true">



</TotalSatire>

CodeMash: Closing Thoughts

CodeMash 2007 v1.0 is now complete, and I've had the chance to finally get plenty of sleep in my own bed.  I uploaded the last photos from my camera to Flickr, and now I'm just sitting here amazed that the event went so smoothly and is getting great feedback on the Blogosphere (in fact, "CodeMash" is the #2 #1 search term on Technorati at the moment--how cool is that!??!?).

The reason the conference was such a success really comes down to planning.  We didn't have all of the details nailed down when we arrived at the venue on Wednesday, but we did have the vast majority of them handled.  This created a natural momentum that allowed the event to just drive itself to completion, whether we were there or not! 

The Kalahari staff was just amazing in being responsive to our needs on that first day (I think we wore out the help line's digits on their phones).  They were able to provide anything that we needed, from tables and chairs to extension cords to stapling banners to the wall. 

As usual, I didn't get a chance to attend many sessions because I was traveling from room to room to make sure that there were no issues.  I also tried to chat with the exhibiting sponsors to handle issues or help them feel welcomed, and I popped into the speaker lounge on occasion to see who was hanging out.  By the end of the first day, my legs were really aching, and I had a wicked blister on my toe.

I thought it would be cool to start compiling a list of "fun facts" about the event.  Perhaps the other organizers will follow suit with trivia that I left out/was not aware of.

  • The CodeMash "Gear Head" logo was originally brown, not green.
  • The conference was originally named "Free Your Mind", but that sounded like a better tagline than a conference name.  John Hopkins, president of the .NET User Group in Southfield, MI, owned the domain name "codemash.org", and let us have it. 
  • "DevMash" was one of the names being considered alongside "CodeMash".
  • There is a little error on the cover of the Conference Guide, but it's really only apparent to me (since I'm the one who did the layout).  The "2007" under the CodeMash logo is supposed to be in a wider/thicker/more-technical typeface.  However, I used a non-standard font when I created it, and forgot to provide this to the print shop.  The result is that MS Publisher defaulted to Arial, and the final "2007" came out small and weak looking.
  • Speaking of the Conference Guide, the clever "Welcome" message was written by Jason Gilmore.
  • The blurry code that you see as the background of the cover is actually from my ZMachine.NET project (the opcode handler methods section).
  • There's a reason why this event's T-shirt strongly resembles the Day of .NET in Ann Arbor shirt: I'm not all that creative, and I happened to have produced both shirts...  Maybe the next one will be done by a real designer!  /grin
  • The registration fee that you paid went entirely for food (venue prices are expensive, for those of you playing along at home).  If we charged more, then we could have had hot meals all of the time.  But, I think that Jim Holmes and Dianne Marsh did a fantastic job of balancing the menu and the pricing.
  • Even with all of the planning around meals, we were surprised in the last week by the venue pricing for soda, bottled water, and coffee service.  A big thanks goes out to two of the sponsors in particular who stepped up after making their initial commitment to ensure that attendees would have free beverages throughout the days:

    Microsoft paid for coffee service (i.e., "Microsoft provided the Java")

    Pillar Technology was a superb sponsor in stepping up and offering to cover the pop and bottled water expenses with no hesitation after we approached them while they were setting up on site at the conference. 
  • Many of the books that were given away at the close of the event were written by our speakers, and we had those speakers sign the books (look to see if yours was signed!).
  • Scott Ambler signed each of his Refactoring Databases books with a unique message.
  • Josh Holmes and Brian Prince shaved their heads before the blog-post threshold was actually met...
  • Ted Neward loved the venue in part because they served Coke instead of Pepsi.  I didn't have the heart to tell him that I personally found this to be a flaw... ;-)

 

Wednesday, January 17, 2007

CodeMash: Day 0

The exhibitor tables are in place, and a little more than half of the sponsors have already set up (some are not arriving until tomorrow morning).  There are some pretty neat displays, but one that everyone is talking about already is Quick Solution's booth, where there's a Wii that you can try out (and enter for a chance to win at the end of the event)!

The Expert Panel on Programming Languages is currently under way.  I snuck off to a quiet corner to crank out this blog post, and then I'll be returning.  Be sure to check out the Flickr tag "Codemash" for photos from the conference.

CodeMash: Today's The Day!

I'm trying to finalize all of my email and blogging before throwing some clothes into a bag, loading up my pickup truck with sponsor swag, books, t-shirts, and other conference material that have been piled up in my dining room for a week, and then jumping onto the Ohio Turnpike to head out to Sandusky to help set up CodeMash.  The organizers are arriving mid-day, and sponsors will start to arrive soon after to set up their booths.

Don't worry: the conference itself doesn't officially start until tomorrow (Thursday).  But, if you're arriving this evening (Wednesday), try to get there around 5:00PM or so to check in.

We recognized that there would be a nice crowd of attendees arriving today, so there's an Expert Panel on programming languages scheduled for 7:00pm this evening as a pre-conference event.  Immediately after, Bruce Eckel will be introducing the concept of Open Spaces (this is another "something extra" that we're offering to enhance the conference experience).  Open Spaces is a little bit like Birds of a Feather, but from what I can gather, it's even more ad hoc and informal than BOFs typically are.

Of course, maybe you just want to swim tonight, and that's perfectly alright!  Make the most of the venue, which is a beautiful indoor waterpark.

Sunday, January 14, 2007

WoW, Someone Messed Up...

A few days ago, Blizzard announced that there are 8 Million subscribers playing the World of Warcraft.  At $12-$15 a month (USA pricing), this is A LOT of revenue that they are bringing in.

This Tuesday, the much awaited expansion pack (Burning Crusades) is being released.  In an attempt to make sure that the game is ready, Blizzard forced the second patch in a week today (Sunday).  This means that instead of me jumping into the game this morning, I instead sat drinking my coffee and watching the ever-so-slow "Downloading Updates" screen.  15-20 minutes later, the game was patched, and I logged in.

Or, I attempted to log in.  Again....  and again.... and again...

"Ok, the authentication servers must just be busy because everyone patched at the same time, and now they're all trying to get in," I thought.

After maybe an hour of this insanity (trying the same thing over and over, expecting different results), I finally noticed a message from Blizzard on the login screen:

[8:10am PST January 13th 2007]

The 2.0.5 client-side patch has caused issues with our authentication system. These issues can cause players to be suddenly disconnected from the game, as well as prevent them from logging in to the game. We are working to resolve this issue as soon as possible and will provide you with updates as soon as they are available.

Nice!  So, what they were probably doing is updating WoW in the 11th hour preparation for BC's release on Tuesday with some new top-secret authentication/anti-piracy system, but instead, they managed to lock out 8 Million paying subscribers!

Wednesday, January 10, 2007

Bright Comet in the Sky

If you haven't been paying attention, there's currently a very bright comet visible in the evening sky. 

Comet McNaught (C/2006 P1) is approaching the sun, and has really brightened in the past week.  A few weeks ago, you would have needed a pair of binoculars or a telescope to see it, but now, it pops out of the western sky even before the sky is completely dark! 

The last comet that I was able to see was Hale-Bopp, and I remember that to be pretty bright.  McNaught is supposedly brighter!  In fact, only Venus shines brighter at the moment, and they say that this is currently the brightest comet in 30 years.

Today is really the first day that we have sunshine in Toledo, so I'm hoping to be somewhere with a view of the western horizon when the sun sets this evening.  However, I don't know if being at the Ann Arbor IT Zone to hear about Windows Workflow Foundation would necessarily qualify...  Maybe tomorrow...

UPDATE: We've been cloudy and rainy here ever since I wrote this.  However, SpaceWeather.com has been running a series of articles stating that you can see this comet during the day!  The caveat being that you first must stand in a shadow to block out the glare of the sun, and then search about 5 degrees above the sun (roughly the size of your fist when held at arm's length from your eye) for the bright head (which will likely appear dim because of the blue sky surrounding it).  Supposedly, the tail can also be seen during the daytime, too, once you locate the comet.  I'll be sure to try this, if the clouds ever disappear.

Wednesday, January 03, 2007

Tag, I'm It...

Dan Ciruli, the "I did 66,795 pushups last year and now my wife loves that I'm chiseled" guy tagged me.  I'll play along.

Five Things You May Not Have Known About Me:

1. College?  Uh, Yeah... I Went to College

Despite being a decent student and taking college-prep courses in high school, I didn't start college right away, opting instead to work as a sorter for an overnight freight company.  When I did start at the University of Toledo, I only attended part time while I kept working for the same company.  I might have accumulated enough credits to be classified as a Sophomore before moving from manual labor into a programming position "upstairs".  Shortly after, I took a break from school in order to concentrate on my career.  That break is still continuing today, a decade later, as is my successful career...

2. Sure, I can swim.  Watch me!

The summer between my 2nd and 3rd grade, I almost drowned at my town's public pool.  I wasn't a strong swimmer, and leaped into the "5-foot section".  I found myself further away from the wall than I should have been, couldn't touch bottom, and began to panic.  I remember being out of breath, and starting to take in water before a friend (Myles Cartwright) pulled me to safety.  Thanks, Myles!

For the record, I'm a great swimmer today, despite my adversion to cold water (and thus, my general adversion to swimming when presented with the opportunity)

3. I've Traveled the World..... of Warcraft.....

I'm hopelessly addicted to the World of Warcraft at the moment.  I resisted playing for so long, because I know my inability to control myself when presented with a game, let alone a never-ending game.  But, a couple of friends finally convinced me (damn you Blizzard and your free trials), and now I have two Tauren Druids that I'm alternating between (Jaesyn of Dalaran is currently a level 42, and Jaesyn of Dragonblight is currently a level 22).  Interestingly enough, my wife now plays, too, and her Dwarf Paladin is a level 28 on Dragonblight.

4. Potty Pumper

I am an Eagle Scout, and worked at different summer camps for 3-4 years.  One of the most respected camp employees, IMHO, was the Camp Ranger who lived on-site year round and served as a caretaker for the property.  The ranger at the first camp that I worked for became a very influential role model to me, and helping him out was a very desireable activity among my circle of friends (because we drove trucks and tractors and did cool things that nobody else got to do). 

Interestingly enough (as I look back on this time of my life), a great assignment to receive was to "pump potties".  This involved pulling a large "honeydipper" (tank) behind a tractor, backing up to the latrine, connecting a big hose to a pump, and filling the tank with whatever was in the latrine vault before you got there...  I'll leave that to your imagination.  Then, you had to transport the "stuff" to a septic pond and switch the pump from "suck" to "blow" in order to empty the tank.  I'll let you ponder the visual on that detail for a moment, too.

Another interesting fact: I later married the daughter of a different camp ranger.

5. Skilled Performer

In high school, I used to perform for audiences all of the time.  I was a member of our Choir and Show Choir, and also acted in plays and musicals.  This is probably why I don't mind standing up in front of a group.  However, don't ask me to sing or dance today...  These activities are no longer performed... in public, at least.  I don't think I was exceptionally good back then, and certainly things have not gotten better over time.

 

Now, in the honored tradition of this Meme, I come to the point where I must tag five other bloggers in order to keep this pyramid scheme alive (and to give future Googlers more fodder to enjoy): Greg Huber, Dustin Campbell, Bill Wagner, Josh Holmes, and Jim Holmes...  Have fun, guys!

Friday, December 22, 2006

Congratulations Jim and James

Jim Holmes has posted that his book (Windows Developer Power Tools, co-authored with James Avery), is now out!

http://frazzleddad.blogspot.com/2006/12/book-is-ou...

I've read an early version of the book, and I can say that it is definitely a must-have.  Get your copy today (and then bring it to CodeMash in January to have it signed).

Thursday, December 21, 2006

Dan Ciruli's Pushup Challenge

Doh!  I've been called out:

http://westcoastgrid.blogspot.com/2006/12/your-new...

Dan Ciruli (that grid computing beast on the west coast) took on a New Year's resolution last January to do one pushup (and one sit-up/crunch) for each the day of the year.  For example, on Jan. 1, 2006, he did one pushup.  January 2, he did two pushups.  Today, being the 355th day of the year, he did 355 pushups!

What an animal.

And then, he had to go off and name a bunch of internet personalities (myself included) to take on this same crazy challenge for 2007.

Hmmmm.  Perhaps I will, my friend.... Perhaps I will....

CodeMash Update

CodeMash: January 18-19, 2007 at the Kalahari Resort in Sandusky, OH
www.codemash.org

The Early Bird rate of $99 has expired (fellow procrastinators: I'm sorry!).  The new registration fee is $149.

However, the Kalahari Resort has allowed us to continue the great deal on the hotel rooms ($88/night + tax for a "Hut" room) until 12/28, unless the hotel sells out before then.

So, for $325 + tax, you get to stay two nights at an indoor waterpark resort in the middle of January, plus attend CodeMash, which is looking to be THE EVENT of 2007 that you don't want to miss! 

In fact, two people from London, England (that's like this whole other country that's an ocean away from us) thought the same thing, and they are flying over just to attend!  Why?  One primary reason cited was because there is nothing like this event in Europe.

Jim Holmes, fellow conference organizer, user group leader, and friend of mine, summed the event up quite nicely in the following (which I have permission to plagerize):

I’m making one last pitch to you in the hopes of convincing you to register and attend this terrific event.

Why is CodeMash something you should consider attending?  You should strongly consider attending because you’ll have the opportunity to attend sessions and keynotes from some of the software development industry’s finest minds.  We’ve three keynote addresses from luminaries who have been motivating forces behind some of the most significant products, methodologies, and changes in the development industry:

 

  • Bruce Eckel – Internationally Recognized Speaker and Author of “Thinking in Java”
  • Neal Ford – Application Architect at ThoughtWorks, Recognized Speaker on Languages and Compilers.
  • Scott Guthrie – General Manager, Microsoft Developer Division. 

Other internationally-recognized speakers include:

 

  • Scott Ambler – Internationally Recognized Speaker and Author on Agile Development and Database Refactoring. 
  • Marry Poppendieck – Recognized Expert on Lean Development Methodologies. 
  • Jay Pipes – North American Community Relations Manager at MySQL. 
  • Bill Wagner – Expert on all things C# and author of “Effective C#”

If that’s not enough then consider that we’ve 40 sessions covering an immense range of technologies including .NET, PHP, Java, Ruby, and other platforms.  We’re holding sessions on design, architecture, testing, agile methodologies, and deep dives into areas of the technologies I just mentioned.  Some of the session topics include:

 

  • Curry Favor with Closures: An Introduction to Functional Programming in C# and VB.NET (Bill Wagner, Microsoft Regional Director, Microsoft MVP and author of “Effective C#”)
  • SOA as a Conversation (Ken Faw, Regional Practice Director, Perficient, Inc.)
  • The Productive Programmer (Neal Ford, editor “No Fluff, Just Stuff”)
  • Let NHibernate Be Your Data Access Layer (Dave Donaldson, Microsoft MVP)
  • Lean Software Development (Mary Poppendeick, internationally recognized expert on agile/lean development and author of “Lean Software Development”)
  • Maximum Velocity MySQL (Jay Pipes, North American Community Relations Manager, MySQL)
  • EJB3 – What’s New? (Joseph Faisal Nusairat, author of “Beginning JBoss Seam”)
  • Ruby on Rails for Java Developers (Rob Stevenson, Quick Solutions, Inc.)

CodeMash is a terrific opportunity for developers of all ilk in this region.  I encourage you to register and attend.  It’s a conference that should not be missed!

 

Also see Jim's post on the value proposition for management to send developers to events like this:

http://frazzleddad.blogspot.com/2006/11/why-conferences-matter-and-how-to.html

Saturday, December 16, 2006

New Type of Blog Comment Spam?

I'm starting to get comment spam like the following:

I see you put a lot of work into this one A. I respect it!! Good luck and keep up the good work. bruxelles hotel de previsioni tempo estate distillation de l alcool

(The underlined parts in spanish link to *.es websites)

I just thought it was an interesting tactic that they used....

Friday, December 15, 2006

Book Review: Foundations of WF

Windows Workflow Foundation (WF) is a key component of the .NET Framework 3.0, and comes from the collection of API’s that were previously known as WinFX. It provides a robust framework that can be incorporated directly into a .NET application in order to provide workflow capabilities that would otherwise be complex and time consuming to develop.

On more than one occasion in the past, I have had to build custom workflow capabilities for my applications to use. So, when it was announced that WF was to become part of the .NET Framework, I became very interested in figuring out how to use it instead of always reinventing the wheel.

Foundations of WF: An Introduction to Windows Workflow Foundation by Brian R. Myers is the first book that I have read through on the topic. Brian has a conversational style of writing that I found easy to follow. He includes a lot of screenshots and source code snippets to break up the text into smaller, more palatable bites. This book is sure to become one of my standard reference manuals on the topic.

One good thing about this book is that there are examples in both VB.NET and C#, so you do not need to translate syntax in your mind if you know only one of these languages. But, this also becomes a bad thing when trying to use this book as a reference.

I personally prefer a single language version of books because I find it distracting to repeat sections of content for the sole purpose of displaying a different language’s syntax. In addition, I recall a couple of places in this book where the C# section refers you to something that was described in detail in the VB.NET section. If you tend to read a technical book sequentially from front to back, then this might be acceptable. I, on the other hand, tended to skip over the VB.NET sections of each chapter since the C# sections were found immediately after.

Aside from the dual code issue, and some minor stylistic/creative decisions that he made in creating the demo source code (i.e., his method of padding a purchase order number with leading zeros makes me cringe every time that I see that snippet of code), I found this book to be a great companion to step me through the “Hello World” and beyond of WF.

You will not only learn what is required to use WF in your application, but you will also become exposed to the different types of workflow provided by WF, the various out-of-the-box Activities, how to create your own custom Activities, and how to deploy your workflow-enabled application. As a bonus, Brian also includes a chapter on using WF with Office 2007 and SharePoint (chiefly by means of a single example scenario using an InfoPath form).

Full Disclosure: A review copy of this book was provided to me by Apress.

Look for Auroras Tonight and Tomorrow

We're currently at the Solar Minimum, or the point in the 11-year solar cycle where the Sun doesn't really do too much.  However, there has been some strong activity over the past few days that have caused geomagnetic storming here on Earth.

A Coronal Mass Ejection (CME) passed by Earth yesterday, which started a strong GM storm.  This resulted in the Northern Lights being seen in lower Michigan and Ohio, and possibly even further away.

Another CME that resulted from a X1 solar flare on Dec 14 will reach our planet some time in the next day.  This will most likely enhance the storm levels again to the Strong, Severe, or possibly even Extreme levels.

For those of us not worried about keeping satellites in orbit, or maintaining a working electric power grid, this usually means that we can go somewhere dark (away from city lights) and look to the North for an absolutely beautiful display of nature.  Be advised that during particularly strong storms, you may need to look up, or even to the South (depending on your latitude) because the Auroras would have been pushed that far away from the magnetic poles.

Disclaimer: I have seen instances where an incoming CME completely halts all GM activity, so don't be surprised if nothing at all happens.  It's important to be patient when hunting the Aurora.  It's well worth the wait if you find an active display in session.

Tuesday, December 05, 2006

Blog about CodeMash and Win a Zune!

http://www.codemash.org/Blog4ZuneContest.aspx

Help us spread the word about CodeMash using your blog, and you could win a Zune!

There's about two weeks left to register and take advantage of the early bird pricing. $99 for the conference, and $88/night (+ tax) for the rooms. That's just an awesome price for an event like this, so don't miss out.

Besides the conference, you also get admission to the indoor waterpark at the Kalahari Resort in Sandusky, OH. In fact, many people are planning to take advantage of this by bringing their families for a little vacation in the middle of January!

Don't know what CodeMash is? Check out the site for information and a list of keynote speakers and sessions:

http://www.codemash.org

UPDATE: Note that CodeMash is not just a conference for people in Ohio and Michigan. Sandusky is located between Toledo and Cleveland, Ohio, and both of these cities have airports serviced by major carriers. CodeMash is a full-blown, multi-day conference with nationally-known speakers, and is not to be confused with a Code Camp or other similar event.

Hope to see you there!

tags:

Friday, December 01, 2006

SQL Server Date Trick

Need an easy way to truncate a SQL Server DateTime to just the date part (i.e., midnight of the day that is represented)?

You can cast a DateTime as a float, take the floor value of that in order to get an unrounded integer, and then cast that back to a DateTime. 

cast(floor(cast(@fromDate as float)) as datetime)

This works because almost any modern platform's datetime value is a floating point value that represents a number of days since an epoch date (with the fractional part representing the time of day).  Negative numbers are days prior to the epoch, etc.  So, trim off the fraction, and you have just days.


This is much cleaner than another way that I found in some stored procedure code which essentially subtracts the hours, minutes, seconds, and fractions of a second from a given DateTime...