Register
Sunday, February 05, 2012
 
 DBAs And ProgrammersBlog
  
News! Minimize
   
 
 Print   
 
Misc Blog Stuff Minimize
   
 
 Print   
 
The Reluctant DBA Minimize
 
 
 
 Print   
 
Reluctant DBA Minimize
   
 
  
 
Reluctant DBA Minimize
   
 
  
 
The Reluctant DBA Minimize
 
Author:CarpDeusCreated:4/18/2008 6:56 AM
As a programmer and database administrator, I've seen a lot and here I'll record bits of information about what I'm doing and how I'm overcoming various challenges

Over the last several months, I’ve had to write patch scripts for database updates. Writing the scripts tends to be easy and I came up with a fairly effective way to implement changes but writing the actual script got to be tedious. So, like any good programmer, I automated the task.

My Patch Implementation There are a lot of ways to write patch scripts, but one main concern is that you don’t overwrite procedures with old versions. For my environment, I came up with a fairly simple solution for procedures and user defined functions. Every update to a procedure or UDF creates a time stamped named version of itself. If I was generating a patched version of auditing.GeneralLogInsert today, I would check to see if auditing.[GeneralLogInsert-2011-06-22] exists. If it does, then I don’t proceed any further with that stored procedure. If it doesn’t, then I populate an nvarchar(max) variable with the create statement for the procedure/UDF, execute a rename on the existing object and then execute the create. It...

Read More »

So, I’ve been slowly but surely switching my version/source control over to Git. And, for the purposes of having some open source code for that, I’ve set up a GitHub project for storing useful SQL Scripts at https://github.com/CarpDeus/ReluctantDBAScripts.  At the moment I only have two scripts there but I’ll be going through my list of scripts and adding more as I go through my archives.

So, this morning I encountered an error that was new to me, one of those errors that makes perfect sense when you think about it, however. The error was one that offered common sense help as well that is totally useless:

MustBeLessThanInfinity

Sorry for the image, I couldn't get a screen shot except by using my camera phone... for some reason Paint Shop Pro wouldn't capture the float.

Yes, when casting from a number, the value must be less than infinity. Which makes one wonder how much less than infinity? C#'s unsigned, 64-byte int (uint64) supports a value of 18446744073709551615. The following line of code:

...

Read More »

So, this morning I encountered an error that was new to me, one of those errors that makes perfect sense when you think about it, however. The error was one that offered common sense help as well that is totally useless:

MustBeLessThanInfinity

Sorry for the image, I couldn't get a screen shot except by using my camera phone... for some reason Paint Shop Pro wouldn't capture the float.

Yes, when casting from a number, the value must be less than infinity. Which makes one wonder how much less than infinity? C#'s unsigned, 64-byte int (uint64) supports a value of 18446744073709551615. The following line of code:

UInt64 ui = Convert.ToUInt64("18446744073709551616");

...

Read More »

There has been a surge in recent years involving Test Driven Development, something that Mike Amundsen and I were discussing last night. It's not a development style that we work with much and that discussion led to this post and a new style of programming we call MDD, матрёшка doll development. матрёшка (Matryoshka) dolls are nesting dolls, looking something like this:

800px-Russian-Matroshka2

 

To understand the MDD, let's look at TDD and some of the reasons it seems to have exploded in popularity. One reason that I posited was that TDD is really great for quickly creating demo software. Create the stub of a class,...

Read More »

So, you've got an Azure SQL Database and have been doing some work in it/on it and then find out it is a CTP and you need to move the data and schema to another database.

Which isn't bad but there aren't any good tools for scripting an Azure SQL database, mostly because Azure SQL doesn't support using the DMO, which is what most people use.

So, I wrote my own.

It's not perfect, it's missing a few things (doesn't handle triggers, for instance) but it should be good enough to get you started.

AzureSQLScripter

It's simple enough. Download...

Read More »

The title of this post comes from an ad for one of those code generators that scans your database and creates an application with little to no work on the part of the developer. Sounds impressive, but what would impress more is the right 10,000 lines of code. Mark Twain said it best:

The difference between the almost right word & the right word is really a large matter--it's the difference between the lightning bug and the lightning.- Letter to George Bainton, 10/15/1888

The same goes for code. If you want a simple example, look at sorting algorithms. Bubble sort is the one that almost everyone comes across when first learning to sort data, and they quickly find that there are other ways to do it, some of which are more efficient in certain situations than others. The difference between the right sort routine and the wrong sort routine is the difference between a scalable program and one that has limitations.

...

Read More »

Luciano E. Guerche was recently lamenting the costs of changing frameworks, especially within the Microsoft world. He said:

If you want Winforms app to turn a WPF app? Rewrite it from scratch? Come on M$...

To which I replied:

(re)Writing from scratch enables you to avoid the bugs in the original app and write brand new ones! (yes, bugs)

It was tongue in cheek and very reminiscent of an old saw about bugs in code:

Every program has at least one bug and can be shortened by at least one instruction  from which, by induction, one can deduce that every program can be reduced to one instruction which doesn't work.

But it also had a couple of truths in it. Frameworks are wonderful things. Engineers and architects use frameworks all the time. The Statue of Liberty is copper over an internal framework of steel. But changing that framework isn't easy. And the same thing applies to writing code.

...

Read More »

I used to work in an office that had a pool table, one of those really expensive, championship caliber ones. Since it didn't cost me anything to use it, I would use it a lot as a break from my net time. And I come to some conclusions that I wrote back then. Not quite a "Everything I need to know I learned from pool" but some things that are as applicable now as they were 7 years ago.... Finesse can be more important than power. Oh how true. Like many things in life, I started out shooting pool by just trying to ram things through. I can be quite powerful and when I break with all my might, the balls scatter to the four corners of the table. But most of the time finesse is required over brute force. If you have the perfect shot lined up, particularly a straight shot, and power the ball into the pocket, odds are the cue ball will follow it in and you've wasted that shot. Remember the goal of the game. When I was in college, back in the mid-80s, I got hooked on 9-ball. The rules are simple. You have to hit the lowest...

Read More »

One of my friends was recently musing on whether they should attend DevLink or not and, in their musings, said it all depended upon what the SQL Tracks were going to be. For some reason, that particular incident reminded me of the parable of the Beam:

Judge not, that ye be not judged.For with what judgment ye judge, ye shall be judged: and with what measure ye mete, it shall be measured to you again.And why beholdest thou the mote that is in thy brother's eye, but considerest not the beam that is in thine own eye?Or how wilt thou say to thy brother, Let me pull out the mote out of thine eye; and, behold, a beam is in thine own eye?Thou hypocrite, first cast out the beam out of thine own eye; and then shalt thou see clearly to cast out the mote out of thy brother's eye.Matthew 7:1-5

Regardless of the original intent of the parable, I think it's very applicable to developers (myself included) when it comes to technology in general and programming languages in specific.

I would say that most developers...

Read More »

 
 
 Print   
 
Privacy Statement | Terms Of Use Copyright 2001-2008 by ReluctantDBA.com