Archives

You are currently viewing archive for November 2011

Wed 30 November 2011 9:31 PM

Fragments

So, reading up on URIs today to see if there is some way in the .NET framework to get access to a "default path separator" character so I wouldn't have to hardcode / when constructing URLs. It doesn't look like anything that specific is available, however, while reading up on URI Fragments on wickerpedia I came across this, which is cool - if not particularly useful:

In URIs for MIME application/pdf documents Adobe PDF viewers recognize a number of fragment identifiers.[9] For instance, a URL ending in .pdf#page=35 will cause Adobe Reader to open the PDF and scroll to page 35. Several other parameters are possible, including #nameddest= (similar to HTML anchors), #search="word1 word2", #zoom=, etc. Multiple parameters can be combined with ampersands: http://example.org/doc.pdf#view=fitb&nameddest=Chapter3.
Category: General
Posted by: beowulf

Fri 18 November 2011 3:24 PM

Offsets

My job would be so much easier if everyone on the planet used UTC.

DECLARE @switchhour int
DECLARE @localdate datetime

-- The switch occurs on the second after the
-- first 1:59:59am local time,
-- so times before the first 1:59:59am local time use
-- yesterday's offset and times after the first
-- 1:59:59am local time use today's offset
-- NOTE: This won't work for timezones with
-- half-hour offsets from UTC
SET @switchhour = (@OffsetYesterday / 60) + 2

-- If yesterday and today's offset are the same,
-- adjust from UTC using yesterday's offset
-- Else if the offsets are different, and the
-- Login/Logout datetime is from yesterday,
-- adjust from UTC using yesterday's offset
-- Else if the offsets are different,
-- the Login/Logout datetime is from today,
-- and it is before 2:00am, adjust from UTC using
-- yesterday's offset
-- Else adjust from UTC using today's offset
SET @localdate = CASE
WHEN @OffsetYesterday = @OffsetToday THEN DATEADD(n, -1 * @OffsetYesterday, @UTCDate)
ELSE CASE
WHEN @DateIDYesterday = CONVERT(nvarchar(8), @UTCDate, 112) THEN DATEADD(n, -1 * @OffsetYesterday, @UTCDate)
ELSE CASE
WHEN DATEPART(hh, @UTCDate) < @switchhour THEN DATEADD(n, -1 * @OffsetYesterday, @UTCDate)
ELSE DATEADD(n, -1 * @OffsetToday, @UTCDate)
END
END
END

RETURN @localdate
Category: General
Posted by: beowulf

Fri 18 November 2011 3:29 AM

Wicker Pedia

You know you knew even before I said anything that this existed - that it had to exist. If anything we know about the universe is good or right, there has to be a wickerpedia.
Category: General
Posted by: beowulf

Thu 17 November 2011 4:32 PM

What he Said

Category: General
Posted by: beowulf