Category Uncategorized

Taking out the Trash

If you’re like me, you probably don’t think a lot about what you throw into the trash on your computer – you just put files and folders in there to be deleted and, eventually, you empty the trash. The other day I dropped a 40GB virtual machine into the trash and then told OS X to empty the trash. A few hours later, it was still chugging away at pretending it was deleting the trash. There were no messages in Console about files being locked and unable to be cleaned up and no warnings of any other kind.

Being the resourceful individual that I am, I dropped into the terminal and ran sudo rm -rf .Trash/*. That process hung as well. I checked the console and all of the various logs again and there was nothing going on.

As a last resort before giving up and switching to the backup computer, I rebooted the Mac into single user mode (hold down Command-S during the boot sequence). Once I was in single user mode, OS X dropped me off at a command prompt as the root user. A few quick cds later and I was able to once again rm -rf .Trash/*. This time it worked like a charm.

I have no idea what happened and there were no logs to point me in the right direction. I can only assume that OS X got hung up trying to read the contents of the virtual hard disk which is, in reality, nothing more than a bundle of files, much like an OS X application. Maybe there was just too much junk…

Upcoming Training

AppDev Virtual Chapter – The Database is Dead, Long Live the Database

I’ll be speaking on Tuesday June 28th for the PASS Application Development virtual chapter. Things kick off at 5PM Pacific, so it’s a bit late for those of you on the east coast and might be a bit early for people in the UK. I’ve given this talk twice before – once at Stir Trek in Columbus and once on SQL Cruise. If you want to know what the fuss is about, you should join the Live Meeting

If relational databases are so great, why are people talking about NoSQL? Shouldn’t we explore other ways to store and manipulate data? We’ll look at four scenarios – caching, session state, flexible data models, and batch processing – and discuss how traditional databases perform in each situation and what other options exist on the market. At the end of this session, attendees will have a better understanding of how different workloads perform in RDBMSes, best practices, and alternative storage solutions to make your life easier.

OSCON – Refactoring SQL

I’m really excited to be presenting at OSCON this year. The title of the talk is “Refactoring SQL”. It’s aimed squarely at shit hot application developers who refactor SQL code just like they refactor their application code – by bundling everything into loops and cursors and user defined functions. The point is, refactoring SQL is not like refactoring application code. We’ll go over a bunch of different techniques to squeeze extra performance out of your RDBMS so you can sleep easy after yelling at you DBA that it’s all his fault. You might even find places to make sweeping performance improvements. I’ve been tuning SQL applications for performance, throughput, and concurrency for a few years; I may not have written the book on the subject, but I’ve screwed up enough to know a few things.

You can buy tickets here, and use the code os11fos for 20% off. They pay me in beatings, the more tickets that are sold, the less the speakers get beatn.

T-SQL Tuesday #13 – What the Business Says Is Not What the Business Wants

T-SQL Tuesday logo

Steve Jones created this month’s topic: What the business says is not what the business wants. Despite the inflammatory title, it’s really about interacting with business: What issues have you had in interacting with the business to get your job done?

I’m going to piss a lot of you off right now: it’s your fault.

Ready to get more angry? Shut up and listen. Stop. Shut up. Listen.

When you start having those gut reactions about terminology, proper technique, or anything else: shut up and listen. You don’t make cars or DVDs or coffee makers. The business users don’t write code. There’s a knowledge gap. The users are probably talking like that because they want you to take them seriously. STFU and listen.

When you’re talking to business users, turn off the thinking part of your brain that is already designing an elegant solution in BCNF that uses the latest .NET IFlangingSkrillAdapter and a combination of Silverlight, HTML5, and buttplugs to solve the problem. Stop it. Stop it right now.

Just listen to what the users are saying to you. Listen to how they’re saying it. Underneath that project they’re asking you to build, there’s a real problem that you need to solve. Sometimes, they aren’t even asking you to solve the real problem. Sometimes they’re asking you to solve a problem that wouldn’t exist if someone had listened three years ago.

When I started out in IT, I wanted to build awesome things. I wanted to change the world and make smart solutions and have everyone look at me and say “Oh, look at how clever he is!” Clever software isn’t going to solve your users’ problems. Time after time I had to go back and forth with the users. Every time we met, we’d both be more frustrated – things were going slower than expected and features didn’t work as designed. I’d stalk back to my desk after those meetings, grumbling the whole way about how the users didn’t know what they wanted and how they should let me design what they wanted.

You know what happens when you let computer geeks design something for humans to use? You end up with elegant, useless, software that doesn’t help anyone.

This really hit home a few years ago. A buddy and I were working at a client solving some of their needs. When he was talking to one of the users, he noticed that she seemed to be holding back. He stopped for the day and said, “Let’s meet again tomorrow at 9:00 and take a look at this fresh.” She agreed. The next day, my buddy comes into the office, grabs a fresh pad of paper and walks off to his meeting. He showed up three hours later demanding more paper. I gave him one of my many spare legal pads and kept typing away, working on my elegant code that would interface between six disparate systems. At the end of the day, my buddy had two legal pads of notes.

Think about that it: in 8 hours of listening to a user, my friend was able to fill two legal pads with factual notes. There was nothing speculative in there. It was all facts about processes, business rules, and the information that was moving around inside the company.

The next day, we talked about the underlying problems. At first we started talking about the systems we could build and the consulting money that was there and the commission we could make. We stopped. We looked at the papers again. The problem wasn’t that there was software to be written and rates to be raised. The problem was that there was software in the first place. Sure, the software had been written to fill some nominal business need, but it really existed to satisfy a developer’s visceral urge to try out something new. In solving their programming problems, our predecessors had removed the business needs and created their own elegant, but useless, software.

Listen to your users. They know what they want and they know what they need. They may not always have the words and sometimes you just need to listen.

MSDN 2010 Contest!

Update: The contest is closed. Winners have been announced over here. Thanks for playing.

Who wants an MSDN 2010 subscription?

Due to my over-involvement in the development and database community, Microsoft gave me three MSDN licenses to give away. I’m not sure who I should give them to, so I thought about how to give them away. I originally posted this on Twitter and I got a bajillion responses in a few minutes. I figured that I would normally be incredibly lazy and give it to the first three people. Then I had more thoughts. Then Arnie Rowland messaged me telling me about his great idea: giving them to the unemployed or under-employed.

I think this is a great idea. I don’t want to rip off Arnie’s idea, so I’m not going to.

I have three of these things to give away, so why not mix it up a bit and go in three directions. I’m going to give away the three MSDN subscriptions to the people who email the best description of how they will use the MSDN subscription to help them

  1. further their own career/education
  2. work on an open source project
  3. help them prepare for a new job

It’s all secret this way. Nobody has to know about how much you hate your boss or you want to make an open source porno bit torrent search engine or program some kind of robotic articulated llama comb. Doesn’t matter. Just send your email to

Your email MUST contain the phrase “i want some msdn” in the subject line. Otherwise, I’m trashing it. End of story.

Entries are due by Friday, July 9. I’ll judge them on July 10 while I’m recovering from getting a tattoo and then I’ll make the announcement on Monday, July 12.

Clearing out old backup history

Let’s say that you want to clear out your old backup history. Why would you want to do that? Let’s also assume that your maintenance plans (yes, maintenance plans) have not been cleaning up after themselves.

If this has happened over a small period of time, you can just do this:

EXEC sp_delete_backuphistory DATEADD(m, -1, GETDATE());

But what if you have a lot of backup history? Trying to delete two years of backup history will slow things down incredibly on your server and take a very very long time. To the point where your boss will come over and frantically say ‘Hey, why is the server refusing connections?’

Instead you’ll want to use something like this:


IF OBJECT_ID('tempdb..#dates') IS NOT NULL
  DROP TABLE #dates;

SELECT DISTINCT DATEADD(d, 0, DATEDIFF(d, 0, backup_start_date)) AS d
INTO #dates
FROM dbo.backupset

SELECT @oldest_date = DATEADD(d, 2, MIN(d))
FROM #dates

EXEC sp_delete_backuphistory @oldest_date;

Why isn’t this in a loop? Because I have a sinus infection and I didn’t feel like being that clever while I’m working from home. That’s why. You probably should be clever and put this in a loop. And put a nice little wait at the end of it that waits for a minute or two before repeating the whole thing. Me? I just sit here and zone out for a few minutes. The point is, this works.

If you’ll excuse me, I’m going to get back to watching day time TV and pressing F5 every 3 minutes.

Links for the week – 2009.06.26

SQL Server

Deploying Databases From Visual Studio Team System Database Edition Grant Fritchey has written an article about using Vistual Studio Team System Database Edition to deploy databases and database changes. If you haven’t taken a look at Data Dude, now is the time to do so, it’s a great product!

Declarative Database Development This is a nice introduction into how to develop using Data Dude (VSTS Database Edition).


Fluent NHibernate And You Josh over at Computerist Solutions has a quick introduction via code snippets to Fluent NHibernate.

Stuff & Things

Implement Advanced “Siestas” for Improved Sleep I’m a big fan of naps. Any excuse to use them to improve my life is a fine by me.

Networking for the Shy Entrepreneur

CBusPASS Meeting – July 9th, 2009

In two weeks, Andy Leonard will be presenting remotely for CBusPASS, the friendly Columbus PASS chapter.

Come pay us a visit. It will be a good time.

Here is the information from the CBusPASS website:

Incremental Loads, Change Data Capture, and SSIS 2008

Change Data Capture is a new SQL Server 2008 feature. One benefit of CDC is data filtering for Incremental ETL in SSIS: only touching rows that are new, updated, or have been deleted! In this presentation I walk through enabling Change Data Capture in SQL Server 2008, then present an overview of an SSIS package that utilizes Change Data Capture to perform Incremental ETL.


THE Andy Leonard

THE Andy Leonard

Andy Leonard is an Architect and manager with Unisys Corporation, SQL Server Database and Integration Services developer, SQL Server MVP, PASS Regional Mentor (Southeast US), and engineer. He is a co-author of Professional SQL Server 2005 Integration Services (Programmer to Programmer), Professional Software Testing with Visual Studio 2005 Team System: Tools for Software Developers and Test Engineers (Programmer to Programmer), and MCITP Self-Paced Training Kit (Exam 70-441): Designing Database Solutions by Using Microsoft SQL Server(TM) 2005 (Self-Paced Training Kits). Andy founded and manages and maintains two blogs there: Applied Team System and Applied Business Intelligence . He also blogs for . Andy’s background includes web application architecture and development, VB, and ASP; SQL Server Integration Services (SSIS); data warehouse development using SQL Server 2000, 2005, and 2008; and test-driven database development.

What was your first computer and what were some of your favorite games?

Denis Gobo started up a new meme about your first computer and favorite games.

My first computer was a Tandy 1000SX with 640KB of RAM that my family got when I was 9 or 10, I think. My dad quickly overclocked it to an astounding 7.6 MHz of pure Intel 8088 power and added a 20 MB hard drive. For the time, it was an amazing computer.

My two favorite games were Elite and Starflight. Proving that my love of sci-fi and space opera began a very long time ago.

That Tandy 1000, with its noisy dot matrix printer and 16 color graphics, served as my primary computer until 1999 when I received an upgrade to a 60 MHz Gateway machine.

I’m going to go ahead and tag Rick Kierner since most of the data folks seem to have been tagged at this point.

Links for the week of 2008-12-26

SQL Server

Best practices for taking on the DBA role as a developer – Armando Prato covers the basics of what it takes to go from developer to DBA. This is a good article and one that’s very near and dear to my heart since I’m pulling myself away from the development world and into the DBA world (I’m almost there!).

Auto generated SQL Server keys – uniqueidentifier or IDENTITY – Armando Prato (who gets a double dose of link love) wrote a pretty well-balanced article about a subject that is often a source of contention between DBAs and developers – primary key types. I have a very strong bias towards using IDENTITY columns, but this article presents both sides of the argument.

Graphical Exeuction Plans for Simple SQL QueriesGrant Fritchey has had an excerpt from his book, Dissecting SQL Server Execution Plans published on It’s a great read, especially if you, like me, have often wondered how to read an execution plan. I can’t claim to be an expert after reading this article, but I can claim to have a much better understanding.


Composite Architecture – The Open Close Principle as applied to system architecture – Ayende Rahien weighs in with his opinions on unit testing and talks about how it’s possible to architect and build a system that doesn’t really need to be unit tested, well not nearly as much as a standard system.

Early Christmas Present from PowerShell Team: Community Technology Preview-3 (CTP3) of Windows PowerShell V2 It’s just what it says: PowerShell 2 CTP3 is out. Get it while it’s hot!


Your idea sucks, now go do it anyway – Jason Cohen talks about starting a company. Many companies start out with a completely different idea than the finished product. Oddly enough, he mentions a game that I used to play online – Game Neverending – which eventually became flickr.

Nuclear Urbanism – Geoff Manaugh highlights a cool Google Maps mash up that lets you see what an atomic weapon would do to your home city. This really brings the scary power of these things to light. Just some food for thought.

Web Persona and Your Career – Tom LaRock makes some great points about how to present yourself on the web. Ultimately it comes down to being yourself. As I’ve started writing more for this blog I’m finding more of my voice as an author and I’m getting comfortable enough to start trying different things. Time will tell, but the important part is to just be yourself.

A brief note: Due to the holidays and work there will be no real blog post this week. I’m working on several post ideas and should be fleshing them out over the 5 day weekend and returning with more content in the new year.

Links for the Week 2008-12-19

SQL Server

Cloud Computing and me – TJay Belt delivers the best look at cloud computing that I’ve read yet.

Some interesting affects of Table Partitioning – Kent Tegels discusses some interest side effects of partitioning tables and indexes.

The N pillars of a well built database? – Louis Davidson is in the process of re-working his book and is thinking out loud about what makes for good database design.


Iron Python 2.0 has been released – Denis Gobo sums up the newest release of the Iron Python language. This is a big thing – dynamic languages have finally arrived on the scene in the .NET Framework.

Disable WiFi with PowerShell – Rob Farley demonstrates PowerShell’s amazing abilities by giving a quick demo of how to disable WiFi through PowerShell.


Fractal – Jason Santa Maria is a Graphic Designer with Happy Cog Studios and is an avid photographer. He showcases his work on his blog in the daily photo feature. He always has a fresh take on what is sometimes a very mundane subject.

Breaking the Rules – Jason Cohen gives several examples of people and companies who have broken all of the rules in grand ways and succeeded. His post can be summed up with this gem of a sentence: ‘There’s no rule that can’t be broken, so long as it’s broken with purpose.’

This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 531 items have been purified.