Thursday, March 13, 2008

[Bake] Baking tip - let your oven heat up!

So, for years we used the "preheat" cycle on our oven. 4 minutes and we can start cooking things? Awesome! Or so we thought.

One day we bought an oven thermometer, mostly so I could work on my barbecuing method (smoked-meat barbecue, not charcoal grill barbecue). Lo and behold, the temperature was 220 after the preheat cycle was finished. Gee, I think I know why we felt our oven was temperamental and not all that good.

Ignore the preheat cycle - it just warms the air inside up, and not all that well.
For 350 degrees, let it heat up for 15 minutes.
For 400 degrees, let it heat up for 20 minutes.
(etc, etc).

This will instantly make your oven MUCH better than it ever was before.
-- TBD

[Cake] Olga's Jam Cake

Okay, here's another from my Baba's trove. I was starting to think I didn't have anything useful to add, cooking-wise - then I realized that, at the very least, I have all my Baba's recipes. Which, if nothing else, you should go make the Borscht. Trust me on this.

Anyhow, here's another of her recipes growing up. You might find it a bit dry - I don't. The combination of the crumbliness of the cake and the jam holding it together works really well. I used Raspberry Preserves this last time - go for seedless. Strawberry also works really well with this.

Baba's Jam Cake
1 stick butter
1 stick margarine
1 cup sugar
3 cups AP flour
1.5 teaspoon baking powder (less if wanting a denser consistency)
4 egg yolks
1/2 cup sour cream
18-24 Ounce jar of Fruit Preserves (your choice of flavor)

* Set butter & margarine out so they soften
* Cream butter/margarine & sugar (aka put them in the mixer, and let them mix for 3-5 minutes on medium. The color will lighten and it'll get a little fluffy)
* Mix everything but the flour together
* Mix in flour with a spoon (practically, I do everything in my kitchenaid, paddle attachment, then add the flower in small installments, on low.)
* Take 3/4 of the dough and put in a 9x12 pan (or cookie sheet, but it needs to be 1-1.5 inches deep). Make it even with a knife/spatula/etc.
* Pour your preserves over this (1.5 pounds, aka 18-24 ounce jar) Using a knife, spread it evenly over the cake
* Take that last 1/4 of dough, add flour, and roll it out into strips. Make a lattice, taking care to include all 4 sides of the pan.

This was the hardest part for me, never having made it before. What I did was to take the last 1/4 of dough, put it on a sheet of wax paper, fold the wax paper over (so it's covered) then roll out to about the right length. Stick in the freezer 20-30 minutes. Bring it out, and quickly cut the strips with a pizza cutter, and lay them out. I didn't do anything fancy - one strip on each edge (yes, some will be too long. Cut them short.), then lengthwise, then widthwise. You're making a crisscross pattern. If you want to get fancy do every other stripe in one direction, then the other, then finish the first direction, then the other.

Bake at 350 degrees for 45-50 minutes. Watch it starting at about 40 minutes. One thing you're also looking for, besides being Golden Brown on the lattice, is that the jam/preserves "crystallize". It winds up being just a little crunchy, probably due to the jam caramellizing (is that how it's spelled?). The first time I did it it came out perfectly. The second time it didn't gel, and so you didn't wind up with that wonderful texture. My only other thought, besides "I pulled it out too early", was that I used Jam instead of preserves. Ironic since it's called "Jam cake", so I bet I just pulled it early.
-- TBD

Monday, March 10, 2008

[Maint] Show free space within a database

I use this all the time. Not sure where it came from, though it's probably from Simon Sabin's Taskpad_view report for SSMS. This will run on 2000 or 2005, and will show you how big your database is, as well as how much of that is used.

create table #data(Fileid int NOT NULL,
[FileGroup] int NOT NULL,
TotalExtents int NOT NULL,
UsedExtents int NOT NULL,
[Name] sysname NOT NULL,
[FileName] varchar(300) NOT NULL)

create table #log(dbname sysname NOT NULL,
LogSize numeric(15,7) NOT NULL,
LogUsed numeric(9,5) NOT NULL,
Status int NOT NULL)
insert #data exec('DBCC showfilestats with no_infomsgs')
insert #log exec('dbcc sqlperf(logspace) with no_infomsgs')

select [type], [name], totalmb, usedmb, totalmb - usedmb as EmptySpace from
select 'DATA' as [Type],[Name],(TotalExtents*64)/1024.0 as [TotalMB],(UsedExtents*64)/1024.0 as [UsedMB]
from #data
union all
select 'LOG',db_name()+' LOG',LogSize,((LogUsed/100)*LogSize) from #log where dbname = db_name()
--order by [Type],[Name]
order by [Type],[Name]
drop table #data
drop table #log

Tuesday, March 4, 2008

[ETL] Disabling foreign key constraints

When you're doing bulk loads, the Foreign Keys can bring you to a standstill. I can't load that one without this one going first, etc.

Quick way around it: disable all the constraints, load, then enable. Thanks to "sqladmin" at for this one, as well as Erland for the WITH CHECK.

I love sp_MSforeach[...] - makes it very easy to walk through databases/tables. Indispensable.

One note, though: even if you disable the constraints, on SQL Server 2005 SP2 (and possibly others; haven't thoroughly tested yet) you still cannot TRUNCATE the table. You can DELETE from it, just not TRUNCATE.

To Disable all Constraints

To Disable all Triggers
exec sp_MSforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL'

To Enable all Constraints (the WITH CHECK forces it to verify all the constraints are now good. Very important, as it helps ensure good execution plans)

Enable all Triggers
exec sp_MSforeachtable 'ALTER TABLE ? ENABLE TRIGGER ALL'