Sunday, December 28, 2008

The joy of discovering new music

A couple of months ago, I came to an important realization. Many of my favorite bands and artists have become my favorites, because of the guitar. This is especially true for many of my favorite songs. "Fragile" by Sting, "Private Investigations" by Dire Straits, most everything by Mike Oldfield, and the list goes on and on.

I believe I've had this thought for many years, the thought of discovering music, that was all about the guitar, the acoustic guitar. Every time that I've tried to find some artists, that do pure guitar music, I've failed. But not this time. With a little help of some cool new websites, I got on track to find a truly amazing duo, Strunz & Farah.

I initially tried to google spanish guitarists, but the Flamenco genre was not quite what I was looking for. Pandora.com to the rescue. I added the artists that I've found, and hit play. The first few songs got a thumbs down, but slowly, I was on my way to find Strunz & Farah, two truly amazing musicians. You can read more about them here:


I fell in love with their music instantly, and the first thought was, wow, it would be really cool to go to a concert with these guys. Are they still active? They have been together for some 30 years. Luck was on my side, and I found a venue close to home, which was perfect. My wife and I enjoyed the concert tremendously. Admittedly, me more than her, but it was an amazing display of how you can be in supreme control of a guitar, and produce beautiful music.

If they come back, I'm going to go see them again.

Wednesday, December 3, 2008

Speeding up your INSERT's with SqlBulkCopy

With version 2.0 of .NET, we got access to a new class in System.Data.SqlClient called SqlBulkCopy. This class will greatly improve your performance when doing mass inserts into your database.

Using SqlBulkCopy instead of regular business objects doing inserts in a loop, reduced the time to insert about 120K rows from 18 minutes to 3 minutes.

Most examples you find googling SqlBulkCopy will show you an example of how to use the class copying from one table to another. I needed an example of how to assemble my own source data into a DataTable, and then copy that to a new Sql table using SqlBulkCopy. So, here goes.

First, we need an instance of the SqlBulkCopy class. In this example, we're passing along a connection string, and the option to keep the identity of the Id column, we'll be setting up in our source data table:
SqlBulkCopy sbc = new SqlBulkCopy();
We also need the DataTable to use as our source for the copy:
DataTable newTable = new DataTable("MySourceTable");
Once you're done adding rows to your newTable, you can submit the the entire table contents to the server with this statement:
sbc.WriteToServer(newTable);
That's it! In some cases you need to use the SqlBulkCopyMapping class to map columns from your data source, to columns in your target table. There's lots of good documentation on that on a google search.