Friday, August 28, 2009

Epic epic sql working today.

This little thing calculates the first day given a year and week number, and the start day of the next week. I have no idea whether it's US week number compliant or ISO...whatever the number is...

but this is what im using anyway;

DECLARE @iYear AS INT = 2010
DECLARE @iWeek AS INT = 1


DECLARE @compareTo AS Datetime = CONVERT(datetime, CONVERT(varchar(4),@iYear))
PRINT 'Date from given year: ' + CONVERT(varchar(100),@compareTo)

print '---------'
print ''

PRINT 'First day of week of specified week: ' + CONVERT(varchar(100),DATEADD

(week, @iWeek - 1, @compareTo))

DECLARE @oldYear AS int = DATEPART(year, DATEADD(week, @iWeek - 1, @compareTo))
DECLARE @oldWeek AS int = DATEPART(week, DATEADD(week, @iWeek - 1, @compareTo))

PRINT 'Year + month of old week: ' + CONVERT(varchar(10),@oldYear) + CONVERT

(varchar(10),@oldWeek)

print '---------'


DECLARE @newYear AS int = DATEPART(year, DATEADD(week, @iWeek, @compareTo))
DECLARE @newWeek AS int = DATEPART(week, DATEADD(week, @iWeek, @compareTo))

IF (@newYear > @oldYear)
BEGIN
PRINT '## a year has been skipped, so specifying date as first week of

next year'

PRINT 'First day of week after specified week: ' + CONVERT(varchar(50),

CONVERT(datetime, Convert(varchar(4), @newYear)))
END
ELSE
BEGIN

PRINT 'First day of week after specified week: ' + CONVERT(varchar

(100),DATEADD(week, @iWeek, @compareTo))

PRINT 'Year + month of new week: ' + CONVERT(varchar(10),@newYear) +

CONVERT(varchar(10),@newWeek)

END

Monday, August 24, 2009

Exclusive Meet and Greet with Dream Theater
Personal photograph with the band
Autograph session (includes 8x10 photo)
Official Meet and Greet Laminate
Exclusive Dream Theater Bandana
Set of Dream Theater Guitar Picks
Collectible Dream Theater “Black Clouds & Silver Linings” Patch
$25 voucher to the official Dream Theater online store

$250.....,.....do i want it? HMM SO UNDECIDED

A reserve tickets $120, IM SO THERE

but why is it a Tuesday night :z

maybe im not extreme enough of a fan for a meet and greet i dunno what i would say to them anyway (oh ya i luvv ur musizzkks, hey mike portnoy can i steal your talent)

Saturday, August 22, 2009

so for some reason in vista all of my usb devices started failing and shit

so i installed windows 7. YAY! :)

Friday, August 21, 2009

If you've ever wondered how to get a different footer/header in a Word 2007 document on anywhere other than the first page, if you create a section page , you can unlink the header/footer so that the content for them is unique (instead of coming from the previous section) - then you can edit it to your hearts content!

Yay for word! (took me way too long to work this out)

Wednesday, August 19, 2009

Lol so this morning I got woken up at 7.40 by NZBus (who Metrolink fall under) following up on a complaint I made about yesterday and the day before's incident....

so they get points back (some)

but the bus driver's still a tard

Tuesday, August 18, 2009

Metrolink Bus Driver Fail - I was in line and got on the bus as usual, but this driver for some reason decided that it would be okay to shut his bus doors on the last person in line, and drive off, citing 'I'm late' as a suitable excuse (even though it was him who was late to the stop.) That's bad enough on its own, but this was even worse because it was just a child that was waiting.

This morning, the same child was there and it was also the same driver, and when accused of driving off yesterday which I clearly saw him doing, he denied it all.

Already knowing he is in the wrong, he then decides to accuse the mother and child of not paying the right fare, which is quickly disproven when he looks at her ticket.

His demeanor was generally rude and confrontational, and puts a black stain upon Metrolink's reputation - a bus driver that does not look out for the welfare of its passengers, and especially children, should not be carrying passengers.


METROLINK FAIL

Tuesday, August 04, 2009

So this has taken me like...an hour to figure out at work so I thought I'd share with everyone;


The problem is, I have to select things from a database, and they always have a start date assigned, but not all have an end date. So how do you properly select everything that falls within those ranges?


THE RULES FOR DATE SELECTION
============================

If there is an END DATE

The Date you are selecting from has to be before or equal to the data's StartDate
The Date you are selecting to has to be greater than the data's EndDate


If there is NO END DATE

The Date you are selecting from has to be before or equal to the data's StartDate
The Date you are selecting to has to be greater than the data's StartDate



To be honest this is more a reminder to myself so I won't forget something so trivially simple made me feel retarded. Yay for solving problems!