20091015

Bugs that make money

 Here is a find from "P", a potential bug had the database fields been used as intended. Its a big change in reporting that QA has never seen so you know it is in some very obscure code path. Something to be said for code review!


I'm looking at a stored procedure that's reporting $$ for a Revenue report by multiplying Rate * Total, instead of Rate * Quantity (which is the same as just Total).

So what we are looking at is the potential of ordering 50 $1 gift cards, but reporting $2500 for the entry. Just the kind of thing to get you over that bumpy quarter. ;)

20090916

No we won't learn

Not more than a couple days of dealing with an obscure OSQL parsing bug (see link) that we should have known about, we QA-catch another that we already knew about.

If you fully qualify a table in another database and give it an alias, OSQL command parsing will not use the alias. That is you cannot
SELECT something FROM foobarDB.dbo.footable AS otable WHERE otable.someColumn IS NULL
The "otable.xxx" will cause an error as it cannot find that alias.
2005 et.al. seem to be fine.

20090806

Will we ever learn?

A while back I posted about a Microsoft bug in 2000 server installations. Caused a production error again, then this was followed by another (SELECT 1 FROM SYS.SYSINDEXES) the next day.

Turns out it is related to the OSQL/ISQLW/ISQL installed and not the server. You can run this same script from a machine with the 2005 tools installed and point to the 2000 server and there is no error. As we deploy using processes that run the file via an isql.exe -I command line, it is a big deal.

Point is then, when we are testing for compatibility of our scripts, we can't run it from the 2005 management studio. We will get a false positive. We have to run it through the local version of the tools!

ERROR 1
PRINT 'The error is in parsing the GO incorrectly'
/*
This is a comment
GO
*/

ERROR 2
--The error here is the prefix of the SYS. that will not parse correctly
SELECT * FROM SYS.SYSINDEXES

20090801

Summary of Summer

A friend of mine, a life-long resident of Los Angeles California, moved Minneapolis Minnesota and I was giving him some perspective on the seasons where I grew up. Discovered something myself in doing so.

"The thing I grew up with and remember the strongest about the seasons was that when it was the middle of Summer you could hardly wait for winter, and when it was the middle of Winter, you could hardly wait for Summer. Seasons all have their good and bad points, you just have to learn to take advantage of them when they are there. The biggest thing I miss is that change. I have been living in a 22 year long Summer now and its more than a bit annoying. I miss the beauty of the trees in the Fall, fresh fallen snow and the quiet it brings in the Winter, the smell of mud in the spring after the first good thaw. Hmmm, can't think of anything nice about Summer. Oh well."

20090730

Just listen to me fool

You cannot have a valid process until you have a process that you manage. That means making sure it happens and listening for changes that are needed and adapting to them.

20090528

It could be a rumor ...

My favorite programmer asks: Which genius put this into the common library?

return bool.Parse("true");

instead of

return true;



I don't care where you come from, that's funny!

20090525

Open Letter to all Credit facilities

I find your security challenge questions and requirements an invasion of my privacy. You don't need to know anything about me in that detail. As an industry with everyone asking this kind of information, I am being forced to expose MORE data about myself then ever before and I find that MOST offensive.

Find another way or foist your draconian rules on those who have been lax enough to be victimized by fraud - not generate data for future attacks for all.

SS

20090513

I'm all a-twitter

One of our loggin file tables can only display 50 characters, so when someone logged the message:

"A copy group can't be set to verified. Please rotate the spot before verifying."



The users sees

"A copy group can't be set to verified. Please rot"

20090428

Bad Table!


Someone knowing that I do SQL sent me this ...




Source

20090412

Counter Rant on R&B

The Ruby Yacht of Omar Khayyam can be found in Moosylvania, on the waters of Veronica Lake, near the Isle of Lucy, not far from Whynchataka Peak. One can also visit Bullwinkle’s alma mater Wossamotta U. or Rocket J. Squirrel’s alma mater, The Cedar Yorpantz Flying School. R&B was my favorite cartoon when I was little, then it disappeared for about a decade or so, then some network started rerunning it, and the reruns were even funnier because I had collected enough information during that decade to understand all (or most) of the jokes that flew right over my head when I was little.



The whole thing is so littered with cultural, historical, and cold war references that they should probably put out a set of DVD’s with a footnote option that allow you to turn on explanatory text at the bottom of the screen, like footnotes in other classic literature such as I was forced to read in high school and college. I wouldn’t need the footnotes for R&B but a lot of people would, especially younger or dumber ones.



Regarding the ‘Title or: Subtitle’ format, I’m not sure if it was ever a common practice before Bullwinkle. The other well known example is the complete title ‘Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb’. R&B came out in 1959 and Dr. S was released in 1964. When I lived in Menomonie and they were talking about starting up the draft again, my roommates and I and a ‘Hell no We Won’t Go – or – I Always Wanted to See Canada’ party. We even made and displayed a title sign at the party, magic marker gloriously emblazoned on tan cardboard. They liked R&B too.

20090408

On Rocky and Bullwinkle

I have to explain a lot more references in conversations these days. At first it was funny, now its disturbing. I found myself trying to explain Mr. Peabody just two weeks ago. There are no current cultural references to engage this level of humor with so the attempt falls flat. Now it has to be simple, abrupt and fit in a five second sound-byte to be valid. Everyone knows Gilligan though, that's safe. I pick Maryann by the way - always have. Don't know anyone who picks Ginger so why even ask. Really.

The wife sat down with the kids every night for several weeks and they went through the entire Monty Python Collection. All of it. They then did the same with the entire original Star Trek series and have just finished all the movies of the same genres. We feel strongly that this will give then a good religious, political and moral grounding in life. I probably should get the original R&B also so we have someone to talk to about it when we are in the old folks home.

Maybe Faulty Towers also, and some Bob Newhart. Yeah. That would cover it.

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 ...

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.