Japanese officials are preparing to finally declare the Fukiushima power plant in a state of cold shutdown as early as 9am tomorrow (GMT). Now they can begin the estimated 40-year process of dismantling the site and repopulating the area. More »
// find an loop through all the elements in the document
for (i = 0; (a = document.getElementsByTagName("link")[i]); i++)
{
// disable all the stylesheet
if (a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("title"))
a.disabled = true;
// if it is the stylesheet requested, then enable it
if (a.getAttribute("title") == title)
a.disabled = false;
}
}
// Jumble addresses
function decryptEmail() {
for(i=0; i<= document.links.length-1; i++) {
var str = new String(document.links[i].href);
document.links[i].href =
str.replace(/^mail:([^\?]+)(\?.+)?$/,"mailto:$
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
$2");
}
}
var __PNGReplace = "png.gif";
function changePngForIEWin()
{
imgs = document.getElementsByTagName("img");
for (var i = imgs.length; i-- > 0;)
{
if(imgs[i].src.indexOf(".png") > 0)
{
imgs[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/ + imgs[i].src + ",sizingMethod=scale)";
function PreloadImages()
{
//alert("number of images to load: " + PreloadImages.arguments.length);
// var arr = new Array(PreloadImages.arguments.length);
for(var c = PreloadImages.arguments.length; c -- > 0;)
{
_img = new Image();
_img.src = PreloadImages.arguments[c];
}
}
function setLinkedStyleSheet(title)
{
var linkNodes = document.getElementsByTagName("link");
for ( i = 0; i < linkNodes.length; i++ )
{
linkNode = linkNodes[i];
relAttr = linkNode.getAttribute('rel');
if ( relAttr && ( relAttr.indexOf("style") != -1 ) && linkNode.getAttribute("title") )
{
linkNode.disabled = true;
if ( linkNode.getAttribute("title") == title )
linkNode.disabled = false;
}
}
}
// function for changing stylesheets using document.styleSheets
function setStyleSheet(theme)
{
for ( i = 0; i < document.styleSheets.length; i++ )
{
if ( document.styleSheets[i].title )
{
document.styleSheets[i].disabled = true;
Few years have passed since we first heard about the Predator drones used by the Air Force and other organizations, yet it's already time to begin waving goodbye to the outrageously expensive aircraft as their more dangerous replacements take over. More »
// The function can return undesirable results if the SET DATEFIRST statement is set to anything other than Sunday.
if not object_id('dbo.udf_GetDaylightSavingsTime') is null
drop function dbo.udf_GetDaylightSavingsTime
GO
CREATE function [dbo].udf_GetDaylightSavingsTime(@year int, @extent varchar(255))
returns datetime
/**********************************************************************
PROCEDURE: udf_GetDaylightSavingsTime
PARAMETERS: @year: the year to return the daylight savings time begin
date
@extent ('Begin' or 'End'): indicates whether the function
returns the begin or end date of daylight savings time
APPLICATION: System Support
PURPOSE: This procedure will return the date of daylight savings
time according to the current federal schedule, which is
currently the second Sunday in March: http://www.energy.ca.gov/daylightsaving.html#chart
NOTES: This procedure will also return the begin date for the previous
schedule which ended in 2006, which was the first Sunday of
April
if @extent not in('Begin', 'End')
begin
set @dateTime = 1/0
end
set @dateTime = case @extent
when 'Begin' then
case
--latest daylight savings time
when @year >= 2007 then cast('3/8/' + cast(@year as varchar(4)) as datetime)
--old daylight savings time prior to 2007
when @year <= 2006 then cast('4/1/' + cast(@year as varchar(4)) as datetime)
end
when 'End' then
case
--latest daylight savings time
when @year >= 2007 then cast('11/1/' + cast(@year as varchar(4)) as datetime)
--old daylight savings time prior to 2007
when @year <= 2006 then cast('10/31/' + cast(@year as varchar(4)) as datetime)
end
end
set @dateTime = case
when @extent = 'End' and @year <= 2006
then DATEADD(DAY,1-DATEPART(weekday,dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,@dateTime)+1, 0))),dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,@dateTime)+1, 0)))
else
case when datepart(dw, @dateTime) = 1
then @dateTime
else dateadd(dd, 8 - datepart(dw, @dateTime), @dateTime)
end
end
-- daylight savings time begins at 2 am
return convert(varchar(10), @dateTime, 101) + ' 02:00:00'
end -- function
GO
declare @TestyWesty table (UTCDate datetime)
--Test DST Begin date
insert into @TestyWesty values('03/08/2009 09:59:59')
insert into @TestyWesty values('03/08/2009 10:00:00')
insert into @TestyWesty values('03/08/2009 10:00:01')
--Test DST End date
insert into @TestyWesty values('11/01/2009 08:59:59')
insert into @TestyWesty values('11/01/2009 09:00:00')
insert into @TestyWesty values('11/01/2009 09:00:01')
SELECT
case
when dateadd(hour, -8, UTCDate) >= dbo.udf_GetDaylightSavingsTime(year(UTCDate), 'Begin') and dateadd(hour, -7, UTCDate) < dbo.udf_GetDaylightSavingsTime(year(UTCDate), 'End')
then dateadd(hour, -7, UTCDate)
else
dateadd(hour, -8, UTCDate)
end as UTCDate
from @TestyWesty