|
 |
|
The Reluctant DBA |
 |
|
 |
| |
| Author: | CarpDeus | Created: | 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 |
By CarpDeus on 3/26/2010 8:22 AM
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:
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 » | By CarpDeus on 3/26/2010 8:22 AM
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:
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 » | By CarpDeus on 2/12/2010 2:45 PM
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:
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 » | By CarpDeus on 11/10/2009 5:00 AM
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.
It's simple enough. Download... Read More » | By CarpDeus on 8/13/2009 7:51 AM
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 » | By CarpDeus on 7/24/2009 7:39 AM
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 » | By CarpDeus on 7/10/2009 8:03 AM
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 » | By CarpDeus on 7/4/2009 2:55 PM
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 » | By CarpDeus on 7/1/2009 2:21 PM
RowNumber() really is a great addition to SQL Server and has been very helpful in many of my applications. But I have been granted a new task, adding grouping within a sort. To explain the dilemma, let's look at some rows of data that are sorted in date order:
RecID GroupTag SortColumn RowNumber 1 NULL 2009/2/13 1 2 NULL 2009/2/13 2 3 GroupSet 2 2009/2/14 3 4 NULL 2009/2/14 4 5 GroupSet 2 2009/3/01 5 6 GroupSet 2 2009/3/10 6 7 GroupSet 2 2009/3/10 7 What I need to do is sort it so that RecIDs 5-7 show up between 3 and 4, because they belong to a group (defined by the GroupTag) and should be grouped together with the first record in the sort of that group.
To make things slightly easier, I'm actually selecting a subset of data and using the RowNumber() function to put it in order and support paging. The trick is to resort to adding a column called GroupSort to the data to apply grouping within either a temporary table or table variable. Now for the tricky part (or at... Read More » | By CarpDeus on 6/29/2009 10:30 AM
I know I've put a lot of Azure information in this blog and more people expect it to be geared more toward SQL Server and C#. So I've created a new website, AzureDBA.com, to host all of my Cloud Computing information; including, but not limited to: - Best Practices
- Codes Samples
- Forums for discussions
Stop by and join the discussion of what will be an important part of the next step in computer programming. Josef
|
|
|
| |
|
|
|
|
|