Sunday, August 16, 2015

I helped a friend with code today and, wouldn't you know it, I ended up learning a few things myself.

In the Sencha flavor of ASP.NET MVC there are no .cshtml views. Instead all views are purely JavaScript files! Autofac is another IoC tool. You may get your current timezone hour offset from UTC time in MSSQL like this:

SELECT datediff(hour, GETUTCDATE(), getdate())

 
 

Offset a datetime's hours in MSSQL, perhaps as if casting a UTC time to local time, like so:

SELECT dateadd(hour, -5, @whatever)

 
 

If you were casting UTC time to local time you'd have to account for the possibility daylight savings time somehow...

SELECT dateadd(hour, (-6 + @daylighsavingsoffset), @whatever)

 
 

Something I told my friend which I might as well write about is that if you are looking at two files with two partial C# classes that make up one class and one of the partial classes inherits from a parent while the other doesn't, as only one has to, odds are that the partial class which calls out the inheritance is the "primary" of the two files so to speak and the other file is the red-headed stepchild which is extending it or perhaps in the case of a .designer.cs is tucking away unsightly noise. Of course, it could be the other way around too. This is more of a perceived nuance than anything concrete as really all partial classes in a class are equals and there is no "primary" partial, not in the strictest sense. In terms of thinking about what came first and what is going on when reserve-engineering someone else's stuff however, my mind tries to find a primary.

No comments:

Post a Comment