I was helping someone with some SQL stuff and needed to give them a function to calculate someone's age. Rooted around a bunch of places and finally just ended up re-writing it. So this is mostly to have it on hand. This function is needed because DateDiff doesn't check if they've had their birthday this year. CREATE FUNCTION CalculateAge ( @ Start smalldatetime , @ End smalldatetime ) RETURNS int AS BEGIN -- Declare the return variable here DECLARE @Age int SET @Age = DateDiff( year , @ Start , @ End ) IF DateAdd( year , @Age, @ Start ) > @ End SET @Age = @Age - 1 RETURN @Age END GO VB Version Public Function Age( ByVal value As Date , ByVal d As Date ) As Integer Age = DateDiff(DateInterval.Year, value, d) If value.AddYears(Age) > d Then Age = Age - 1 Return Age End Function Technorati Tags: SQL Server , Visual Basic , Age , Dates , DateDiff
There are numerous posts on the keyboard shortcuts in Windows 8. I’m not going to regurgitate those. Here are the common things you’ll want to do. Shut Your Computer Off, Network / Wi-Fi, Volume, Keyboard Press Windows+I which brings up the Settings bar (below left). Search, Change Application Settings, Manage Devices Windows+C which brings up the Charms bar (above right). Want to find a song or artist in Music, use The rest of the story If you want to read about other short-cuts and print a handy-dandy cheat sheet, visit the Windows Experience Blog . IE 10 Want to get the most out of IE10, then How-To Geek’s The Best Tips and Tricks for Getting the Most out of Internet Explorer 10 is exactly what you need. There’s also Internet Explorer 10 Shortcut Keys In Windows 8 which has some Windows 8 stuff also.
So I was working tonight and ran into a goofy issue with Visual Studio 2013. I had it Remove and Sort Usings for the entire solution. It did but along the way I kept getting a "Your project doesn't compile...Do you want to continue" message. Figuring it was some small issue with a quick fix, I hit Yes. Doh!! When it got done, I had a bunch of "The type or namespace name...could not be found (are you missing a using directive or assembly reference?)" errors. I also had a bunch of metadata errors but they weren't the problem. When I'd add the needed Using, VS would remove it when I'd save and close the file. Wait a minute, I needed that reference and VS should have known that!! If I added the Using and did a Rebuild, it would leave it there and I could close the file. If the file is open it would give me the same error, red squiggles and Remove Usings would take it back out. There were two projects that had issues, Entities and Infrastructure. Didn