Friday, October 26, 2012

Changing Time!

For those wondering if their jobs will run twice (or not at all) because of the daylight time changes in the next few months, here are a couple of links to help

Daylight Time and SQL Server Jobs

and for those using SQL Server 2005 and 2000,

Preparing for Time Changes

TTFN


Friday, October 19, 2012

I'm counting out time, hoping it goes like I planned it

Title courtesy of Genesis ("The Lamb Lies Down On Broadway").
[Tech Stuff]
A somewhat strange title, you might think, but I just had the task of re-writing a couple of T-SQL functions that calculate times. Numbers of days in an interval, to be more precise. Someone had either written or copied a solution that was kind-of working; I needed the real right answers.

Here's the version for calculating weekdays inclusive between two dates. The "inclusive" means that if you're asking "how many days from Tuesday to Thursday" you really mean "how many days work from the instant that Tuesday begins to the very last moment in Thursday - all 72 hours of it. It may be a little difficult to read - use [Ctrl] & [+] to make it bigger in your browser - but I didn't want to get lots of line-wraps.


ALTER function [dbo].[fnCalcWeekdaysInPeriod]

@daStartDate date, 
@daEndDate date 

returns int 
as
/*
select dbo.fnCalcWeekdaysInPeriod('9/29/2012', '9/30/2012')
*/
Begin 
-- ---------------------------------
if @daStartDate > @daEndDate return 0
declare @intDays int, @intWeeks int, @intResDays int
-- ---------------------------------
-- We're only interested in Mon - through -  Fri, 
-- so adjust boundary weekends out of the calculation
-- Push the start date on two for Sat, one for Sun.
-- Pull the end date back two for Sun, one for Sat.
-- ---------------------------------
if (datepart(dw, @daStartDate) = 7) set @daStartDate = dateadd(d, 2, @daStartDate)
if (datepart(dw, @daStartDate) = 1) set @daStartDate = dateadd(d, 1, @daStartDate)
if (datepart(dw, @daEndDate) = 1) set @daEndDate = dateadd(d, -2, @daEndDate)
if (datepart(dw, @daEndDate) = 7)  set @daEndDate = dateadd(d, -1, @daEndDate)
-- ---------------------------------
-- Get the days  --  plus one to make the count inclusive.
-- ---------------------------------
set @intDays = datediff(d, @daStartDate, @daEndDate) + 1
-- ---------------------------------
-- If negative then start date has met end date - which shouldn't happen unless they're very close
-- ---------------------------------
if @intDays < 1 set @intDays = 0
-- ---------------------------------
-- Find out how many weekends there are between the dates
-- ---------------------------------
set @intWeeks = cast((cast(@intDays as float) / 7) as int)
-- ---------------------------------
-- Subtract 2 for every internal weekend
-- ---------------------------------
set @intResDays = @intDays - (@intWeeks * 2)
-- ---------------------------------
return abs(@intResDays)
End

If anyone can find a problem with it then I'd be happy to buy the first few people a beer each! The next post will be for the same thing but for work days - i.e. the days people work after taking company holidays off. It depends on this, though, so this needs to be correct!
--------------------------------

On a more personal note, my cousin Edward now has a berth on the Queen Mary II. Congratulations and best wishes to him!

Go here for information on the ship.

Go here for booking information (shameless plug!).




--------------------------
[Food]
My darling wife and I collaborated on dinner last night. This isn't a cause for a blog in and of itself, but it turned out more successfully than we'd expected. It was a very simple meal - chicken breast, couscous, and some sauce, with a few veggies - but it turned out to be very nice indeed, and pretty low-effort.

Ingredients
Two (or more!) chicken breasts Chicken broth
Dried Basil and Bay Leaf, crushed up  Salt and Pepper
Spring Onion, chopped small Celery, chopped fairly small
CousCous Cream Cheese
Roast Garlic Jelly Butter

Instructions
1. Clean the chicken breasts well, trimming off any fat you don't want to serve.
2. Lay each breast on a piece of aluminium foil big enough to fold up loosely around the whole breast.
3. Turn up the foil around the edges  and pour in some broth, enough  to reach about a centimetre
    up the breast.
4. Strew the breast with the herbs.
5. Fold up the foil over the breasts to close them in, put them all on a baking tray, and bake
    for 35-40 minutes at between 380F and 400F.
6. For the sauce, take about 10 oz of cheese, about the same of the roast garlic jelly, and some
    chicken broth to help thin it out. Put it all into a saucepan and whisk gently to mix while heating through.
7. For the couscous, heat some butter (maybe a quarter of a stick) in a pot, then pour in about 3/4 cup of
    courcous per person. Stir while still heating, so that the couscous is a little fried in butter. When you can
    hear the mixture start to sizzle a little, add a cup of chicken broth and stir well. Stir in some more celery
    and spring onion, and any aromatics that catch your eye - such as a little Rosemary or Thyme for
    flavouring to your taste.

Eat well!
TTFN
--------------------------

Thursday, September 06, 2012

Experts Exchange

Experts Exchange is a site where you go to get help. Yes, I know there are many of these, but this is a really technical one, mainly for programmers, DBAs, and the like, although there are other sides to it too, like areas for operating systems where you could ask questions about things like MS' Office-365.

I've been a member for quite a few years, but only recently started answering more "seriously", if you can put it that way, and today I got a reward:



along with a certificate. Hopefully some more will follow.

Now to go prepare Jambalaya (I think!).

TTFN

Tuesday, June 26, 2012

On Getting a Cat

I was sitting calmly in work a couple of months ago when the cell phone rings. "Hello darling" the voice at the other end purrs, "please get some cat food on the way home". My thought process went something like "Well ok ... we don't have a cat ... well maybe we do now!"




So I stop on the way home and get some cat food. When I get home I find the wife with a very emaciated cat.


Here she is curled up inside a jam pan.




So I was sent out to get all the bare necessities (tray, litter, scoop, more food, bed ... )

The bed seems to be popular!




Then there's housing for the needy!








and here she is gazing intently at the squirrels feeding noisily outside the window!







TTFN




Thursday, May 17, 2012

Cookies!

One Egg
Half a cup of Nutella
Five tablespoons of flour.

Mix well
Distribute around a pan of twelve mini-muffins


Bake at 350F for 10 minutes.


Take out and they look like this





They taste seriously good - like muffins made from very very good brownie-mix. Not heavy like brownies, though.
TTFN

Sunday, May 06, 2012

Maryland Sheep and Wool 2012

And welcome to the fair!

For the very fourth time - and it's Cinco de Mayo today ..... and a super-full moon. There'll be crazyness tonight - that's for sure!

The first thing seen in through the gate today was a yarn- bombed sign - it says "Sock Yarn for Sock Lovers"!

Anyhow, I'm posting just some pictures here. I'll probably not send them all up to PhotoBucket like the last few years 'cos I'm using a new (=better) camera now, and I don't think they'd appreciate a gigabytes-worth of space grabbed all-at-once! 



These two (left and below) are of the booth from the Tsock Tsarina.

 If you've never seen her extras on socks, you need to! I saw some leaves on a sock and, for a moment at a distance, thought them real!





 We kept wandering around the area uphill from the entrance for a while, looking in where people were just finishing setup.


 Below you see the shop from a guy where we bought new chopsticks.





 Next, of course, was my personal favourite - Tess !  I just love the colours and the way they drift into one another.

 



 













Courtesy of the young lady below - and her scissors - I'll be getting some brick-red socks in a few months (assuming I keep on the right side of the AG!)
 



So, that's all the pictures for this post. More next time.

TTFN

Saturday, May 05, 2012

I Won Again !!

Two years ago I joined a kind of a book club, called 101 Free Tech Books.

About eighteen months ago I won a book on being a SQL Server DBA from 101 Free Tech Books.

Well, guess what? It happened again! This time I chose a Powershell book, 'cos I'm starting to need that more and more.





WIN FREE Tech Books!

101ftb-iconWhy pay for Tech Books when you can get them for FREE! 101FTB.com raffles 101 Tech Books each month. Join Now http://101ftb.com/K90W40T770

Yes - it's an advert. It's the advert for 101 Free Tech Books. Click on it and go and join! It's free, and you get books! What's more, it's totally free!!!

 One last note for this post:
We're in MD for the MD Sheep & Wool again, 
so stand by for more photos on Photobucket tomorrow!
so photos will get reduced in size and put up here - 
I went over a gig of images in 2 hours !!

TTFN

Found Food

I have published quite a few recipes here on my blog over the last few years, and I hope that all my readers have tried at least some of the...