Tag awesome

Installing Windows 7

A well-prepared work area

A well-prepared work area

Windows 7 is out. I’m sure a lot of you have gone ahead and installed it already (or at least started the download process), but for those of you who haven’t, I have suffered through a botched installation and I am blogging this from my Windows 7 installation.

I started the process on Saturday at 11am and finally finished up at 6:00PM on Sunday. First off, let me say that my installation process was made difficult by a number of things: installing on a MacBook using BootCamp, installing anti-virus before anything else, and installing from mounted ISO files using unsupported ISO mounting software. Needless to say, I had my work cut out for me.

Let me start out by saying this: prepare yourself. It’s important to carefully plan out anything that could potentially corrupt your data, especially an operation like installing a new operating system. For the record, I never upgrade my operating system. I always back up to external media and repave the OS. I figure that if I’m making the investment in something brand new and fancy I should start with a clean slate.

First draft of the checklist... and some light reading

First draft of the checklist... and some light reading

Before I started my installation, I took a day and I made a checklist.

So, what goes into this whole process? Well, the first thing I did was make a list of all of the software that I have installed. The easiest way to do this is to either open up the Control Panel and look at Add/Remove Programs or else use a program like CCleaner to bring up a list of everything that’s been installed on the computer. Scribble down anything that you actually want to re-install – I say anything that you want to re-install because we all know that our computers get full of junk that we foolishly install thinking that it is going to be useful at some point. Once that list is put together, take a backup of anything that you want to keep around – put it on some DVDs or CDs or a tape or a spare hard drive or a giant pile of AOL floppies – then put them someplace safe, you’ll need it later. Your next step is to find all of your install DVDs and keys. Since you probably have a lot of applications – AIM or Google Talk or whatever – that didn’t come on a DVD, you’ll want to download all of those again as well. Put all of those installers on an external drive or DVD or whatever and keep that safe too.

So, go ahead and re-install Windows, patch the OS, and install any third party drivers. As you’re going through everything that you need to install, do not install any anti-virus software until you’re done with everything else. Why am I saying this? Because anti-virus software can grab a hold of various files during software installation, and the installation process can be horribly, horribly botched. This happened to me and when something gets botched before I have any personal data on the machine I go ahead and start the installation all over again. I lost a lot of time, but at the end of the day I have a working windows installation.

Once everything is completely done, and only then, should you install any kind of system maintenance software like Diskeeper or any kind of anti-virus software. Yeah, it’s good to have anti-virus software on your computer, but at the same time are you really going out there and looking at tons of horrible websites while you’re installing software? Don’t answer that question, just don’t do it.

The key here is to be prepared: make a list, make backups, have your installation media ready, follow your plan. If you run into problems, take notes. If you run into any problems, you can consult your notes, revise the plan, and start over again. If you prepare properly, you shouldn’t run into any mishaps that you can’t recover from.

A Special Note for MacBook Users

For those of you who are using MacBooks and BootCamp, you’ll want to make sure you have your OS X installation DVD handy. The trick is to install the 64-bit drivers (you are using 64-bit Windows, right?) from the command line. Do this: Start -> Run -> cmd. Then navigate to your DVD drive – mine was D:. Once you’re there, do the following:

cd "Boot Camp\Drivers\Apple"
msiexec /i BootCamp64.msi

Windows will pop up some kind of warning about how Apple is going to eat your computer or that the drivers aren’t compatible. You can ignore that and keep on going. The drivers work… for me.

I had a problem with Windows installing some kind of goofy High Definition Audio Device driver that just didn’t work at all. I eventually found a working driver and downloaded it from these guys. This also works. I ran it through my anti-virus software twice, just to be paranoid, and didn’t find any bad things. It appears to work. I watched The Departed last night, I heard swearing, so I think the sound worked.

Rounding to the nearest 0.5

Yesterday I encountered a fun little problem where I had to round to the nearest 0.5. Admittedly, I solved the problem in C#, but the solution is the same no matter what language you are in.

So, here’s our starting data set:

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

CREATE TABLE #ratings ( rating INT ) ;

INSERT  INTO #ratings
        SELECT  1
        UNION ALL
        SELECT  3
        UNION ALL
        SELECT  2
        UNION ALL
        SELECT  7
        UNION ALL
        SELECT  9
        UNION ALL
        SELECT  8
        UNION ALL
        SELECT  3 ;

And, of course, the average is really easy to get as well:

SELECT  AVG(CAST(rating AS DECIMAL)) -- Use decimal so we don't lose precision
FROM    #ratings ;

But that average really doesn’t do anybody any good since it’s nice and precise. How are we going to get to this number? Well, funnily enough if we multiple our average by 2 and round it to the nearest whole number and divide it by 2 (still with me?) we’ll end up with a number that’s rounded to the nearest 0.5.

SELECT  ROUND(AVG(CAST(rating AS DECIMAL)) * 2, 0) / 2
FROM    #ratings ;

It’s also possible to change your rounding precision simply by change the number you multiply and divide by… Want everything in thirds? Just use 3 instead of 2. Magic! You can use this in your rating algorithms to give you half or quarter stars or whatever the heck you want. Happy rounding!

Links for the Week of 2009.07.17

SQL Server

File/Folder/Share Permissions for DBAs and Database Developers So you thought you knew everything you needed to know about security? Take a look and make sure your assumptions were correct.

Groovy Baby, Yeah Tony Bain hits up the sweet spots from Groovy Corp’s press release for a new relational database platform. New DB?!? That’s right a new, in memory, RDBMS.


The Law of Demeter Is Not A Dot Counting Exercise Phil Haack gives the best explanation I have ever read for the Law of Demeter, which is oft quoted by developers and oft misunderstood by me.

In Branch Per Feature Source Control Introduction and Part 1: Why? Derick Bailey is going over a great idea to isolate source code within source control. Rather than branching for each release, branch for each feature. Hit up the articles for an in depth look at this idea.

Stuff & Things

Insanely Twisted Shadow Planet New Trailer Michel Gagne is an illustrator who is working on what looks like a phenomenally beautiful video game. Check out the trailer for some glory.

A Beautiful Method to Find Peace of Mind

Crash Bonsai Thanks to William Gibson I became aware of this art.

Links for the Week of 2009.07.10

SQL Server

Object Naming Standards Scott Herbert put up an overview of the naming standards that he uses. Like the obnoxious lout that I am, I commented. The point is, of course, to use naming standards. Take a look at Scott’s for an example.

No SQL There’s a big hullabaloo going on about this whole “No SQL” movement. Here’s Andrew Fryer’s take on it.

Performance Counter for SQL Server Ever want to know what those performance counters actually mean?


Thrive for Developers is Online Brian Prince, a great guy and former co-worker, highlights some of the benefits of the newly launched Thrive for Developers program. Check it out for some more info on how to improve your career and how MS can help you do it!

10 Useful Firefox Extensions to Supercharge Firebug Firebug is the best tool for web development that I have found so far. These extensions make it even better.

Stuff & Things

Anticipate Your Interviewer’s Next Question to Ace Your Job Interview Good interviewing advice can be found here.

Day made, mind blown: it’s Portal in ASCII

Oh No You Didn’t! Everyone needs a chair like this.

Columbus Give Camp is Just Two Weeks Away

The Columbus Give Camp is only two weeks away but it’s still not too late for both charities and volunteers to sign up.

GiveCamp is a weekend-long event where software developers, designers, and database administrators donate their time to create custom software for non-profit organizations. This custom software could be a new website for the nonprofit organization, a small data-collection application to keep track of members, or a application for the Red Cross that automatically emails a blood donor three months after they’ve donated blood to remind them that they are now eligible to donate again. The only limitation is that the project should be scoped to be able to be completed in a weekend.

During GiveCamp, developers are welcome to go home in the evenings or camp out all weekend long. There are usually food and drink provided at the event. There are sometimes even game systems set up for when you and your need a little break! Overall, it’s a great opportunity for people to work together, developing new friendships, and doing something important for their community.

At GiveCamp, there is an expectation of “What Happens at GiveCamp, Stays at GiveCamp”. Therefore, all source code must be turned over to the charities at the end of the weekend (developers cannot ask for payment) and the charities are responsible for maintaining the code moving forward (charities cannot expect the developers to maintain the codebase).

The deadline is July 8th, so get your charity proposals and volunteer submissions in!

Only 4 days left!

You know what? I don’t actually know how many days are left in the contest. All I know is that Bill Graziano just sent me an important email that I need to pass on to all 5 of my readers who aren’t my mom. (Hi mom)

There isn’t a lot of time left, but you still have a chance to win your PASS Summit registration, hotel, or one of a number of other cool prizes. If you don’t win, you can still go to PASS and spend time with me, or Brent Ozar, or Tim Ford, or Thomas LaRock or Blythe Morrow (Blythe is part of why PASS works). But, if eating waffles, bacon, or having treadmill races isn’t your cup of tea, there are a number of other reasons you might want to go to PASS this year.

Allow me to enumerate:

  • More than 160 top-quality sessions scheduled across 5 tracks and 14 pre/post-conference seminars (I’m an alternate presenter, bet you didn’t know that!)
  • Great chances to network with awesome people. There are even sessions to help you improve your networking skills like this one with Don Gabor.
  • A great lineup of top experts, authors, presenters, thought-leaders, and community influencers, including Kalen Delaney, Paul Randal, Kimberly Tripp, Itzik Ben-Gan, Kevin Kline, Greg Low, Louis Davidson, Steve Jones, Andy Warren, Brian Knight… and the list goes on and on (look, I stole that last line from some PASS copy, it’s 12:05 AM Eastern time, I’m not going to be all that original).

So, here’s how the contest works:

  1. Write 250 words or less about the best thing you learned at PASS.
  2. Send your submission or a link to your blog to contact@sqlpass.org with the subject line ‘Best Thing I Learned at PASS Summit

It’s really that easy. Check it out if you don’t believe me.

Point is, I’m going to be there.

Now, to find out how much time you have left, you need to

  1. open up SQL Server Management Studio (Express Edition works just fine).
  2. Open up a new window and paste the following code into the new query window:
    SELECT DATEDIFF(dd, GETDATE(), '20090701');
  3. Press F5 or CTRL + E or click Execute

You can enter three times, so enter three times. Three chances to win!

If you need help convincing your boss to send you, check out this great ROI or send them a letter or just send them the link to the conference agenda.

One thing I learned at PASS: it’s possible to include references to Krull, ballet, ice cream, and bacon in the same conversation.

Speaking in July

I’m presenting again! Woohoo!

On July 23rd, I will be presenting at the Central Ohio .NET Developer’s Group. The fun starts at 6:00 PM. I strongly suggest you bring large piles of money to throw at me.

What will I be speaking about, you might ask? (You’re probably not asking yourself this question because you already know I’m going to tell you.)

From Tables to Objects: Making Your Database Work With You

Time & Location

July 23rd at 6:00 PM, at Central Ohio .NET Developers Group located at the Microsoft building on Polaris Parkway in Columbus, OH


A database is far more than a persistent object store for your application; it is capable of data validation en masse, aggregations, and creating different projections of data. By working with your database, rather than against it, it is possible to leverage all of the capabilities of a relational database to provide rich, high performance interaction with your application through an ORM. This presentation will discuss the finer points of building a full-featured data access layer using an ORM and the features of a relational database.


  1. Teach attendees about database features that make development easier – including views, sparsely populated tables, and user-defined functions and types.
  2. Empower the audience to solve object relational impedance mismatch using data modeling techniques and database features.
  3. Demonstrate how to integrate the database and object oriented software using a custom designed data access layer.

Links for the Week 2009.06.19

SQL Server

Why Object Databases will always be Tomorrow’s Technology Tony Davis (editor at Simple-Talk) writes the guest editorial over at SQL Server Central. He makes a great case why object databases don’t fit with most business needs (and why they likely never will). (Thanks to Grant Fritchey for finding this one.)

East Iowa SQL Saturday – Call for Speakers! That’s right, the East Iowa SQL Saturday is coming up and they need speakers. I shall be making the trip out there, and you should too. Submit sessions!

Free stuf SQL Server Courses & Software Free Stuff. Free Training. Free. Free.FreeFreeFreeFreeeeeeeeeeeeeEEEEEeeeee


Top 10 Developer Interview Questions About SQL Server Brent Ozar put get together his top 10 list of questions to ask a developer about SQL Server.

Documentation is a necessary evil. Mike Walsh talks about the necessity of documentation while considering his shower soap.

Life After Loops Once I found how easy it was to do things with set-based operations in SQL, I found loops to be more than a little bit annoying. Well, Justin Etheredge has taken the time to show how this works with lazy evaluation and how this will work in the future (.NET 4.0) with parallel even lazier evaluation! Good times.

Stuff & Things

Thinking Differently Thomas LaRock, formerly known as SQLBatman, opines on problem solving and how, sometimes, you have to look at things sideways to find the easiest solution to the problem.

Andy Warren in his Tips on Getting Hired Part 1 Part 2 and Part 3 puts together some great… tips on… getting hired. The advice in here is job hunting gold. If you’re in the market for a new career, or just keeping your options open, there are a lot of great things to keep in mind.

Lifehacker Pack 2009: Our List of Essential Free Mac Downloads Free crap for the mac. ’nuff said.

Beer cart? Yes, beer cart.

Links for the Week of 2009.06.12

SQL Server

Denis Gobo provides a double dose of dynamic SQL hotness via Changing exec to sp_executesql doesn’t provide any benefit if you are not using parameters correctly and Avoid Conversions In Execution Plans By Using sp_executesql Instead of Exec. Following his tips in here will net you some considerable benefits in how your dynamic SQL behaves and performs in your production applications. The best part is that he provides a huge amount of example code to back up everything he’s saying.

Free SQL Server tools that might make your life a little easier Mladen Prajdic maintains an amazing list of free tools to help data folks get their job done. SSMS Tools Pack (which Mladen created and maintains) is incredibly helpful. I suspect that if he finds these other tools useful, they’ll probably save you many many hours over the years to come.

SQL Server Troubleshooting Tips and Tricks This isn’t a blog post so much as it is really important to keep around. It’s just a list of tips and tricks to keep things easy and painless with SSMS. If you didn’t check out the pain of the week webcast with Michelle Ufford and Brent Ozar on SSMS, you should do so when you get the chance, it’s well worth it!

More SQL Server Training Videos Training. Free. Videos. I’m in there, that’s really all the reason you need to visit that link.

BONUSTen SQL Server Functions That You Have Ignored Until Now Bonus link from Denis Gobo, once again, covering some great, little known, SQL Server functions.


Unit Testing is Not a “Figure It Out Later” Read this. Read this now. Do it. We’ll still be here. Stop what you’re doing and read this. I cannot stress how important it is for you to read this, even us data folks. If I could put a blink tag around this paragraph, I would. (Thanks to Stephen Wright for finding this link.)

Defensive Programming – Assumptions Must be Guaranteed or Tested Aaron Alton blogs about the importance of defensive programming. While this is specifically from a SQL Server standpoint, it’s important no matter which language you’re using. In fact, Aaron proves an important point – you can put any development practice to use in any language.

Stuff & Things

Improving your intranet – keep it sustainable using kaizen – Patrick Walsh talks about using kaizen to produce evolutionary improvements to an intranet. You could do this with anything, really, but it’s a good read either way you look at it.

I cheated and stole the last two links from Lifehacker, but they’re just too good to not share.

CopyPasteCharacter.com Makes Special Characters Easy to Paste Yup, easy. Nice. Easy mode: engage.

LiberKey Installs 200+ Portable Applications I have too many thumbdrives laying around the house. Now I have a use for them.

Splitting Strings in SQL

Let’s say that you have a column that contains some goofy data and it looks like this:


So, how would you typically split such a string to only get the part after the ‘/’?

Well, here’s how I did it:

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

  s VARCHAR(255)


SELECT SUBSTRING(s, CHARINDEX('/', s) + 1, LEN(s)) -- this is what does all the work
FROM #tmp;

But, apparently, there’s a simpler way:

FROM #tmp;

It’s a bit hacky, but it works.

Basically, it takes advantage of the PARSENAME function to grab specific sections of a period delimited string, as it it were a SQL Server object.

Now you know. Paypal me some money if you find this useful and pass it off as your own work of genius.

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.