20090330

Red Velvet Cake - au natural


A new desert store opened up in the neighborhood and the best they had was a red velvet cupcake. Then the email thread started about what makes it red. Turns out that before Dutch processed cocoa became widely available the reaction of acidic vinegar with the butter milk would tend to turn the cocoa a reddish color. Most people now use food coloring or beets. The challenge then was to make it without coloration and see what you get.
file:///C:/Users/Public/Pictures/Blackberry/
Turns out is is a reddish brown in the end - but not crazy blood red like you see in the pictures surfing for this one. Takes under two hours including the trip to the store. I recommend starting the icing early so that it's first step can cool while you work, and do the cupcakes 'cause they're just the right size.


RED VELVET BATTER
3 or 4 tlbs unsweetened cocoa powder
1 or 2 ounces red food coloring (left this out - man that is a LOT OF COLOR!!!)
1 cup buttermilk
1 tsp salt (sea salt preferred)
1 tsp vanilla extract
1 cup oil (I used sesame)
2 cups powdered sugar
2 eggs (large)
2 1/2 cups all-purpose flour, sifted (I did not sift, I am lazy. Used 2cups and stopped when it looked a PDGC or pretty darned good consistency)
1 1/2 tsp baking soda
1 tsp white vinegar


Grease two 9 inch round pans (I made 21 paper cupcakes)
preheat oven to 350 degrees F.
Make a paste of cocoa and food coloring (I just looked at the cocoa and thought RED)
set aside


Combine the buttermilk, salt and 1 teaspoon vanilla
In a large bowl, cream together the oil and 2 cups sugar until light and fluffy (by hand!)
Beat in the eggs one at a time. then stir in the cocoa mixture
Beat in the buttermilk mixture alternately with the flour, mixing just until incorporated. (you'll be tired if you do this by hand and won't over mix)
Stir together baking soda and vinegar (separate from anything else because its like those volcano experiments you do with your kids) then gently fold into the cake batter
Pour the batter into prepared pans (cupcake tins for us, don't fill over 3/4 or 7/8 of the cupcake papers as there is about 40% rise)
Bake in preheated oven for 30 minutes (cupcakes you better check at 15 - mine tool 18 and I know our oven is old and slow) or until a toothpick inserted into the center of the cake comes out clean
Allow to cool completely before frosting (cause it would just melt all over!)
Refrigerate until ready to serve (we ate ours in the first 10 minutes)




STANDARD ICING
1 cup milk
5 tbls all-purpose flour
1 cup powdered sugar
1 cup butter
1 tsp vanilla extract


In a saucepan, combine the milk and 5 tbls flour (that I did not use in the batter above cause I didn't really measure)
cook over low hear, stirring constantly, until mixture thickens (it will flip over suddenly then you will need to take it off the heat and keep stirring until the pan your using cools - that can still burn it)
Set aside to cool completely (refrigerators work well for this)
Cream together butter, 1 cup sugar and 1 teaspoon vanilla until light and fluffy (or your arms fall off)
stir in the cooled milk and flour mixture, beating until icing reaches spreading consistency (which doesn't take long)


I don't have the original source recipe location. If you recognize it let me know and I will cite it appropriately.

20090326

My favorite ranter

My friend KB who-should-have-everything-he-ever-says-published-but-is-never-published says:

Well I remember a night, all those years ago, down at ‘Bachelors 3’ when we were sitting around as usual and I predicted the impending extinction of the guitar as the dominant instrument in popular rock music. Not an unreasonable prediction given the popularity of the euro-synth pop, synth laden dance pop, and a general adoption of synthesizers as instruments rather than the 70’s use of synthesizers as, well, whatever Keith Emerson and Rick Wakeman were doing with them. Well, I was wrong. Just about everybody in the music business worth listening to now, new and old, still uses guitars.

On the same night, or another night just like it, I didn’t make a second prediction. But I was talking about investments, mutual funds, the financial world in general with (or at) Greg. While doing so, I was waving my arms around and being generally more animated than should be necessary while talking about such matters. Now, everyone does that.

20090309

That's not real food you're eating

Got a bug that we don't make a log entry for a module in one case. Turns out they are reading the text of the log to determine how to make calculations for one of their reports.

Who bases $ calculations on log entries? It's not real data. I think Joe Celko would have a good rant over that.

The reasoning was that the comparison between created date and updated date was unreliable. Instead of a trigger band-aid which would have left their code the same after the reliability issue was resolved, this solution was devised.

Two days and many man-hours of research later we found that the reason they had no log was that someone updated the database through an Ad-Hoc SQL query. The log is generated through the GUI changes.

20090306

Exactly how did you test that?

The comment found in the code of an old stored procedure states the following:

--Using dynamic SQL (faster than static SQL for large tables)


To add to the confusion, the procedure neither had dynamic SQL nor returned more than one record.

20090227

Wonky and still logically incorrect

This is another result from the school of cut-and-paste polymorphism. The original IF statement checked for two items in an OR condition, explaining the apparent redundancy in the second IF - but not why anyone would check @@error twice and expect the same value...


IF (@@error <> 0)

BEGIN

IF @@error <> 0

BEGIN

Set @intResultCode = @@error

Set @chvResultText = 'Error when registering the Station/Date. ' +

(SELECT description from master..sysmessages where error = @intResultCode and msglangid = 1033)

END
END

Because @@ERROR is cleared and reset on each statement executed, check it immediately following the statement being verified, or save it to a local variable that can be checked later. Source: MSDN

20090130

Mushroom velouté with buttermilk 'blini'


Click on the title for the original LA TIMES publication of this. Then go and make it - if you don't you're a wimp.



Mushroom velouté with buttermilk 'blini'

Total time: 2 hours, 15 minutes

Servings: 8

Note: Crème fraîche is available at Trader Joe's, Whole Foods, Bristol Farms, Gelson's and most well-stocked markets.

Buttermilk "blini"

1/2 cup flour

3/4 teaspoon sugar

1/2 teaspoon baking powder

1/4 teaspoon salt

1/8 teaspoon baking soda

6 tablespoons buttermilk

1 egg, lightly beaten, divided

1 tablespoon melted butter

Oil for the griddle

1. Combine the flour, sugar, baking powder, salt and baking soda in a medium bowl. Combine the buttermilk, 2 tablespoons beaten egg and the butter in a small bowl. (Set aside the remaining egg for use in the soup.) Make a well in the center of the dry ingredients; add the liquid ingredients. Stir just until blended.

2. Heat a griddle or skillet over medium heat with just enough oil to coat the bottom of the pan. Spoon 1 teaspoon of batter onto the griddle or skillet for each "blini." Cook 30 seconds to 1 minute on each side until both sides are dark golden brown. Repeat until all the batter is used, adding oil to the pan as necessary. Makes about 30 "blini." Reserve in a warm place until ready to use.

Soup and assembly

4 tablespoons butter, divided

1 cup diced leeks

1/2 cup diced celery

1 teaspoon minced garlic

1 pound cremini mushrooms, trimmed and sliced

1/2 pound oyster mushrooms, trimmed and sliced

6 cups chicken broth

1 small bay leaf

1 (2-inch) sprig fresh rosemary

1 tablespoon flour

1/4 cup heavy cream

2 tablespoons beaten egg (reserved from blini recipe above)

Salt

White pepper

Scant 2 tablepoons crème fraîche

1 teaspoon thinly sliced chives

8 sprigs parsley

1. Melt 3 tablespoons of the butter in a large sauce pot over low heat. Add the leeks and celery and sauté about 5 minutes, stirring often, until tender. Add the garlic and cook 1 minute, or until the garlic is fragrant.

2. Add the mushrooms and sauté until all the vegetables are tender, about 10 minutes.

3. Add the chicken broth, bay leaf and rosemary and bring to a boil, then reduce the heat and simmer, loosely covered, for 45 minutes. Remove bay leaf and rosemary.

20090119

Why we need code reviews

The ever diligent programmer P noted this bit of code today:

  • throw(new ArgumentException(errorMessage, "It is a very twisted intersection!"));
I would hate to be the person reading through the error logs a year from now ...

20081218

Simplify Simplify Simplify

Here is the code as found ::
private string FormatTime(object DateTimeValue)
{
string result = " ";
if (DateTimeValue != null)
{
DateTime dt = DateTime.Parse(DateTimeValue.ToString());
if (dt.Hour < 10)
result = FILLER_NUMBER + dt.Hour.ToString() + ":";
else
result = dt.Hour.ToString() + ":";

if (dt.Minute < 10)
result += (FILLER_NUMBER + dt.Minute.ToString() + ":");
else
result += (dt.Minute.ToString() + ":");

if (dt.Second < 10)
result += (FILLER_NUMBER + dt.Second.ToString());
else
result += dt.Second.ToString();
}

return result;
}


Here is the refactored version::

return DateTime.Parse(DateTimeValue.ToString()).ToString("HH:mm:ss");

20081212

The wheels of the object go round and round

Notice that if dsSTData were null you will allocate it, but not use it to look up the ThingyMin :)

public int ThingyMin
{
get
{
int _ThingyMin = 0;
if (dsSTData == null)
{
this.dsSTData = ONAME.ProdName.Common.Business.CONAMESystemDataList.STs;
}
else
{
foreach (System.Data.DataRow row in sSTData.Tables[this.DEFAULT_TABLE].Rows)
{
if (Convert.ToInt32(row[0]) == this._STID)
{
_ThingyMin = int.Parse(row[OllCommon.COL_THINGY_MIN].ToString());
break;
}
}
}
return _ThingyMin;
}
}

20081210

How to ruin a set of data

From my bud. Not strictly SQL but close enough. He would like to know:

I'm not asking a lot. I just would rather see
"if (this.Order.IsPacked)"


instead of
"if (
this._DataSet.Tables[OrderCommon.TBL_ORDER].Rows[OrderCommon.DEFAULT_ROW][OrderCommon.COL_IS_PACKED] == DBConst.DBNull)"

20081122

Built In Bugs :: VarChar

Alexander Kuznetsov pointed this one out on his blog. He goes on to a longer explanation and how to test for the issue in general (see link). SS

In Transact SQL you can assign a 10-character value to a VARCHAR(5) variable, as follows:

DECLARE @c VARCHAR(5); SET @c='1234567890'; PRINT @c

12345

The value will be silently truncated without raising an error. Because of this behavior it may be very easy to make mistakes.

20081121

Please use comments ...

Many management types continually rant about leaving comments in the code so that the next person will be able to figure out what is going on. Sometimes it just proves something else ...

'* Comments: IMPORTANT: The global constants are being temporarily prefaced with "" until
'* all the reports can be integrated with calls to the delegate methods. Afterwards,
'* a global search/replace of "" with "" should rename the constants to coding
'* standards compliancy.

20080916

This is going to hurt a little

Imaging a 5100 line stored procedure that is doing a conversion of some data. After hundreds of site updates, you get called in to find a wee little bug that seems to have no consistent behavior but it is definitely in the conversion. Then some where in that 5100 lines of code you find these snippets - several hundreds of lines apart but interacting just as viciously:

CREATE TABLE #Duplicates
(
RecID INT IDENTITY (1,1)
,i_id INT
, and other things
)

..eventually some insert code fills this temp table. Later we find this new table:

CREATE TABLE #Itemslist
(
RecID INT IDENTITY(1,1)
,INo INT
, and other things
)

...which also gets properly loaded. Eventually final results are loaded into yet another temporary table. I will spare you the details and just point out the join here;
SELECT some stuff
FROM #Itemslist il
JOIN #Duplicates d ON il.RecID = d.RecID
JOIN etcetera


Fortunately the duplicate table was very small which is the only thing that contained the error that propagated from this.

20080912

Where else does one equal zero?

From more of the old code from Hyberia: We figure that this is the lazy man's (person's) method to making insert tables without all that messy typing.


SELECT rlk.*, rlk.i_id as i_id2 --CREATE #RSLAG table
INTO #RSLAG --note.. the i_id2 column was added to
FROM RSLAG rlk --cause the original i_id column to be
WHERE 1 = 0 --created without the IDENTITY property

SELECT rlk.* --CREATE #RSLAG_total table
INTO #RSLAG_total
FROM #RSLAG rlk
WHERE 1 = 0

20080910

Query to NoWhere

In a three hundred line stored procedure (not bad) one developer noted that the performance issue came down to the corrolated sub-query. Upon inspection, this left-joined monster was not even referenced by any output column, where clause or reference.

What a FIND!

SELECT
a_bunch_of_stuff
FROM #RPT_ORDERS ot
LEFT JOIN (SELECT
Another_long_painful_query
FROM #RPTEXTRA toc
INNER JOIN A_BUNCH_OF_STUFF_TO_MAKE_IT_EVEN_SLOWER tm
WHERE toc.x = 400
GROUP BY toc.y
,tm.starts
) mt ON tmt.ord = mt.ord
AND tmt.starts = mt.starts
ORDER BY more_stuff

20080815

Code Blurg

When you are not really sure what you want, you can try it in more than one place! At the worst you get an additional line of code for your metrics.

insert #DeleteSpots

Select os.Linked_ID, os.BID

from #olspot ols

join dbo.ORDERED os on os.bid = ols.bid

AND os.B_Position IN(0,1,3)

where os.Linked_ID is not null

and os.B_Position = 3

20080711

Resolution notes are required for all fixes

This came from our crazed supervisor today ...

From now on, please make all resolution notes in Haiku form. By way of example:
Try it again please.
Whatever the problem was;
Works on my machine.

20080709

Why have all the commission rates gone?

I liked this one. This is what happens when you start cutting and pasting code without looking at the end result real close.

In this situation, the developer was removing a variable that had a default value of zero. Guess they figured that the safest thing to do was to replace it with that number. There were a couple of places in this 460 line procedure to change. They must have checked the top half which was just fine, but the original designer had basically copied the first 200 lines and duplicated them in the second half - and he did not use the variable the same way. The maintenance developer did not check this second half which ended up as below.

Snippet:
SELECT
round(convert(money,sum(r.rate) * 0),2)
,0
,round(convert(money,sum((r.rate * 0) * isnull(r.ag_com_pct,0))),2)
,count(*)
FROM
Whatever


20080706

The French know the secret to destroying database performance!



I saw this on GOOGLE VIDEOS and thought it was the funniest SQL performance technical explanation I had ever seen. His name is Stephane Faroult at RoughSea Ltd. It is also nice in that he turned the problem on its head and looked at the performance problem backwards. How to make it worse.

Who would have believed it

I was reading Aristotle and thinking how I could create a software development paradigm based on his nicomachean ethics. Then I ran into an LA Times blog about these guys and their radio program. I think it terribly interesting to see where this show airs - plus its a lot of fun to listen to. All the past shows are available for download.
"This is not a lecture or a college course, it's philosophy in action! Philosophy Talk is a fun opportunity to explore issues of importance to your audience in a thoughtful, friendly fashion, where thinking is encouraged".
http://www.philosophytalk.org/

License & copyright

Creative Commons License
StinkySQL weblog and any related pages, including the weblog's archives are licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.