<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Open-Source/Free</title>
        <link>http://ridgway.co.za/category/15.aspx</link>
        <description>Open-Source/Free</description>
        <language>en-ZA</language>
        <copyright>Eden Ridgway</copyright>
        <managingEditor>eden@ridgway.co.za</managingEditor>
        <generator>Subtext Version 1.9.5.176</generator>
        <item>
            <title>.Net Developer's Guide to Getting Started with Cassandra</title>
            <link>http://ridgway.co.za/archive/2009/11/06/net-developers-guide-to-getting-started-with-cassandra.aspx</link>
            <description>&lt;p&gt;I've been quite curious about the various &lt;a href="http://en.wikipedia.org/wiki/BigTable" target="_blank"&gt;BigTable&lt;/a&gt; like implementations as they could have some bearing on what I am involved with at work. After reading various write ups about the competing approaches (e.g. &lt;a href="http://www.vimeo.com/5198661" target="_blank"&gt;HyperTable&lt;/a&gt;, HBase, Dynomite, Voldemort, &lt;a href="http://www.vimeo.com/5184456" target="_blank"&gt;Mongodb&lt;/a&gt;) I decided that &lt;a href="http://incubator.apache.org/cassandra/" target="_blank"&gt;Cassandra&lt;/a&gt; looked like the best option for what I'm after. What I didn't realise was that it wasn't going to be as straight forward as it appears to set it all up as there is no end-to-end guide of getting started with it. So the objective of this post is not to explain Cassandra but save you several hours of jumping all over the web trying to work out what you should do next and how to generate the necessary C# Cassandra Thrift client code. If parts of the post don't apply, e.g. VM setup, simply skip ahead to the parts that do. If you want more information about Cassandra you should check out the following posts: &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://blog.evanweaver.com/articles/2009/07/06/up-and-running-with-cassandra/" target="_blank"&gt;Up and running with Cassandra&lt;/a&gt; &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://arin.me/code/wtf-is-a-supercolumn-cassandra-data-model" target="_blank"&gt;WTF is a SuperColumn? An Intro to the Cassandra Data Model&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;So to get Cassandra up and running in a Virtual Machine (or physical if you choose) you should follow the following steps (valid as at 5 Nov 2010):&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Create a virtual machine to host &lt;a href="http://www.ubuntu.com/getubuntu/download" target="_blank"&gt;Ubuntu 9.10 x86 Desktop&lt;/a&gt;. I use &lt;a href="http://www.virtualbox.org/" target="_blank"&gt;VirtualBox&lt;/a&gt; as my VM host on windows so I will refer to this here but feel free to substitute it with you favourite VM software. The VM I created has 384MB allocated to it with an 8GB virtual hard drive using a bridged network adapter (so it can be accessed from the Windows XP host). Once you've gone through the install process install the client tools so that you change the screen resolution, share folders, etc. To do this with virtual box go to &lt;strong&gt;Devices &amp;gt; Install Guest Additions&lt;/strong&gt; and then open up a terminal window and execute       &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; /media/cdrom/VBoxLinuxAdditions-x86.run&lt;/div&gt;
    &lt;br /&gt;
    Once this is complete you will need to reboot your VM.       &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Now it is time to install Cassandra/Thrift prerequisites and software that we will to set everything up:      &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; apt-get install libboost-dev automake libtool flex bison pkg-config g++ -y         &lt;br /&gt;
    &lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; apt-get install sun-java6-jdk -y         &lt;br /&gt;
    &lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; apt-get apt-get install ant -y         &lt;br /&gt;
    &lt;/div&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Once that is done we can install other useful Ubuntu software that we will use:      &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; apt-get install rapidsvn -y         &lt;br /&gt;
    &lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; apt-get install monodevelop -y &lt;/div&gt;
    &lt;br /&gt;
    I also like to install the following:       &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; apt-get install nautilus-open-terminal -y         &lt;br /&gt;
    &lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; apt-get install samba smbfs smbclient winbind -y         &lt;br /&gt;
    &lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; apt-get install nautilus-share -y&lt;/div&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;You may discover that there is an issue with your Java runtime home directory. If that occurs, select Sun's Java Runtime as the default Java version by running the following command from the terminal window and selecting the third option:      &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; update-alternatives --config java &lt;/div&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Now open up Nautilus by going to &lt;strong&gt;Places &amp;gt; Home&lt;/strong&gt; Folder. Right click and create a Development folder. Within the Development folder create another two folders: Cassandra and Thrift. &lt;/li&gt;
    &lt;li&gt;We can now get the source for Cassandra and Thrift. Run RapidSVN by going to &lt;strong&gt;Applications &amp;gt; Programming &amp;gt; RapidSVN&lt;/strong&gt;. Check out the source from SVN by going to the RapidSVN menu option &lt;strong&gt;Repository &amp;gt; Checkout&lt;/strong&gt;. In the URL enter &lt;a href="http://svn.apache.org/repos/asf/incubator/thrift/trunk" target="_blank"&gt;http://svn.apache.org/repos/asf/incubator/thrift/trunk&lt;/a&gt; and for the Destination Directory browse to the Thrift development folder. So it should look like this:       &lt;br /&gt;
    &lt;br /&gt;
    &lt;a href="http://www.ridgway.co.za/images/ridgway_co_za/WindowsLiveWriter/8fe.NetDevelopersGuidetoGettingStartedwi_4F37/image_4.png"&gt;&lt;img border="0" width="244" height="126" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://www.ridgway.co.za/images/ridgway_co_za/WindowsLiveWriter/8fe.NetDevelopersGuidetoGettingStartedwi_4F37/image_thumb_1.png" /&gt;&lt;/a&gt;       &lt;br /&gt;
    Now get the Cassandra code by doing the same thing but entering &lt;a href="http://svn.apache.org/repos/asf/incubator/cassandra/trunk" target="_blank"&gt;http://svn.apache.org/repos/asf/incubator/cassandra/trunk&lt;/a&gt; as the URL and selecting the Cassandra directory. &lt;/li&gt;
    &lt;li&gt;Once we have all the code we are ready to compile Cassandra, so let's do that by executing the following commands from the terminal window:      &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;cd&lt;/span&gt; ~/Development/Cassandra         &lt;br /&gt;
    ant         &lt;br /&gt;
    &lt;/div&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Start the Cassandra server by opening a new terminal window and running the following commands:      &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;sudo&lt;/span&gt; ~/Development/Cassandra/bin/cassandra -f         &lt;br /&gt;
    &lt;/div&gt;
    &lt;br /&gt;
    The running server will look like the screenshot below. You should take note of the thrift binding address of localhost/127.0.0.1:9160.       &lt;br /&gt;
    &lt;br /&gt;
    &lt;a href="http://ridgway.co.za/images/ridgway_co_za/WindowsLiveWriter/8fe.NetDevelopersGuidetoGettingStartedwi_4F37/image_5.png"&gt;&lt;img border="0" width="367" height="218" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://www.ridgway.co.za/images/ridgway_co_za/WindowsLiveWriter/8fe.NetDevelopersGuidetoGettingStartedwi_4F37/image_thumb.png" /&gt;&lt;/a&gt;       &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Now we want to get communicating with the server, so we will need to compile Thrift so that we can use it to generate our C# client:      &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;cd&lt;/span&gt; ~/Development/Thrift         &lt;br /&gt;
    ./bootstrap.sh         &lt;br /&gt;
    ./configure         &lt;br /&gt;
    make         &lt;br /&gt;
    sudo make install         &lt;br /&gt;
    &lt;/div&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Now we can finally generate a C# client for the Thrift calls to Cassandra:      &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;cd&lt;/span&gt; ~/Development/Cassandra/interface/         &lt;br /&gt;
    ~/Development/Thrift/compiler/cpp/thrift -gen csharp cassandra.thrift         &lt;br /&gt;
    &lt;/div&gt;
    &lt;br /&gt;
    This will create the following directories inside of the Cassandra/interface folder: &lt;strong&gt;gen-csharp/Apache/Cassandra&lt;/strong&gt;. These files along with the Thrift.dll will be copied into a new demo project we will create using MonoDevelop in the Development folder. So again in the terminal window execute:       &lt;br /&gt;
    &lt;br /&gt;
    &lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;span style="color: rgb(0, 128, 255);"&gt;mkdir&lt;/span&gt; ~/Development/CassandraDemo         &lt;br /&gt;
    &lt;span style="color: rgb(0, 128, 255);"&gt;cp &lt;/span&gt;~/Development/Cassandra/interface/gen-csharp ~/Development/CassandraDemo -R         &lt;br /&gt;
    &lt;span style="color: rgb(0, 128, 255);"&gt;cp &lt;/span&gt;~/Development/Thrift/lib/csharp/Thrift.dll ~/Development/CassandraDemo         &lt;br /&gt;
    &lt;/div&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Open up MonoDevelop and create a new console application by going to &lt;strong&gt;File &amp;gt; New &amp;gt; Solution&lt;/strong&gt;. Now do the following:
    &lt;ol&gt;
        &lt;li&gt;Select Console project &lt;/li&gt;
        &lt;li&gt;Enter CassandraDemo as the name &lt;/li&gt;
        &lt;li&gt;For the location browse to the Development folder that we created in your home directory. &lt;/li&gt;
        &lt;li&gt;Uncheck the 'Create separate Solution directory' check box. &lt;/li&gt;
        &lt;li&gt;Click the Forward button &lt;/li&gt;
        &lt;li&gt;Don't make any changes on the next screen and just click Ok. &lt;/li&gt;
        &lt;li&gt;Right click on the CassandraDemo project in the left tree view and select &lt;strong&gt;Add &amp;gt; Add Files...&lt;/strong&gt;. Navigate to ~/Development/CassandraDemo/gen-csharp/Apache/Cassandra and select all the files in the folder. You will now have a project that looks like this:         &lt;br /&gt;
        &lt;br /&gt;
        &lt;a href="http://ridgway.co.za/images/ridgway_co_za/WindowsLiveWriter/8fe.NetDevelopersGuidetoGettingStartedwi_4F37/image_7.png"&gt;&lt;img border="0" width="186" height="264" style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://www.ridgway.co.za/images/ridgway_co_za/WindowsLiveWriter/8fe.NetDevelopersGuidetoGettingStartedwi_4F37/image_thumb_2.png" /&gt;&lt;/a&gt; &lt;/li&gt;
        &lt;li&gt;Add a reference to the Thrift assembly by right clicking on References and selecting Edit References. Change to the .Net Assembly tab and double click on the Thrift.dll and click OK. &lt;/li&gt;
        &lt;li&gt;Now we can add the sample code to test it all out. So double click on Main.cs to ensure that is the class in focus in the editor. Replace the contents of the file with this:        &lt;br /&gt;
        &lt;div class="code"&gt;&lt;font color="#0000ff"&gt;namespace &lt;/font&gt;&lt;font color="#000000"&gt;CassandraDemo           &lt;br /&gt;
        {            &lt;br /&gt;
            &lt;/font&gt;&lt;font color="#0000ff"&gt;using &lt;/font&gt;&lt;font color="#000000"&gt;System&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
            using &lt;/font&gt;&lt;font color="#000000"&gt;System.Collections.Generic&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
            using &lt;/font&gt;&lt;font color="#000000"&gt;System.Diagnostics&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
            using &lt;/font&gt;&lt;font color="#000000"&gt;Apache.Cassandra&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
            using &lt;/font&gt;&lt;font color="#000000"&gt;Thrift.Protocol&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
            using &lt;/font&gt;&lt;font color="#000000"&gt;Thrift.Transport&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
            class &lt;/font&gt;&lt;font color="#000000"&gt;Program           &lt;br /&gt;
            {            &lt;br /&gt;
                &lt;/font&gt;&lt;font color="#0000ff"&gt;static void &lt;/font&gt;&lt;font color="#000000"&gt;Main(&lt;/font&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;font color="#000000"&gt;[] args)           &lt;br /&gt;
                {            &lt;br /&gt;
                    TTransport transport &lt;/font&gt;&lt;font color="#0000ff"&gt;= new &lt;/font&gt;&lt;font color="#000000"&gt;TSocket(&lt;/font&gt;&lt;font color="#808080"&gt;"localhost"&lt;/font&gt;&lt;font color="#000000"&gt;, &lt;/font&gt;&lt;font color="#800000"&gt;9160&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;TProtocol protocol &lt;/font&gt;&lt;font color="#0000ff"&gt;= new &lt;/font&gt;&lt;font color="#000000"&gt;TBinaryProtocol(transport)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;Cassandra.Client client &lt;/font&gt;&lt;font color="#0000ff"&gt;= new &lt;/font&gt;&lt;font color="#000000"&gt;Cassandra.Client(protocol)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                     &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;Console.WriteLine(&lt;/font&gt;&lt;font color="#808080"&gt;"Opening connection"&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;transport.Open()&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;System.Text.Encoding utf8Encoding &lt;/font&gt;&lt;font color="#0000ff"&gt;= &lt;/font&gt;&lt;font color="#000000"&gt;System.Text.Encoding.UTF8&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    long &lt;/font&gt;&lt;font color="#000000"&gt;timeStamp &lt;/font&gt;&lt;font color="#0000ff"&gt;= &lt;/font&gt;&lt;font color="#000000"&gt;DateTime.Now.Millisecond&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;ColumnPath nameColumnPath &lt;/font&gt;&lt;font color="#0000ff"&gt;= new &lt;/font&gt;&lt;font color="#000000"&gt;ColumnPath()  &lt;br /&gt;
                                                {  &lt;br /&gt;
                                                    Column_family &lt;/font&gt;&lt;font color="#0000ff"&gt;= &lt;/font&gt;&lt;font color="#808080"&gt;"Standard1"&lt;/font&gt;&lt;font color="#000000"&gt;,  &lt;br /&gt;
                                                    Column &lt;/font&gt;&lt;font color="#0000ff"&gt;= &lt;/font&gt;&lt;font color="#000000"&gt;utf8Encoding.GetBytes(&lt;/font&gt;&lt;font color="#808080"&gt;"name"&lt;/font&gt;&lt;font color="#000000"&gt;)           &lt;br /&gt;
                                                }&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;Console.WriteLine(&lt;/font&gt;&lt;font color="#808080"&gt;"Inserting name columns"&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#006400"&gt;//Insert the data into the column 'name'           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;client.insert(&lt;/font&gt;&lt;font color="#808080"&gt;"Keyspace1"&lt;/font&gt;&lt;font color="#000000"&gt;,           &lt;br /&gt;
                                  &lt;/font&gt;&lt;font color="#808080"&gt;"1"&lt;/font&gt;&lt;font color="#000000"&gt;,           &lt;br /&gt;
                                  nameColumnPath,            &lt;br /&gt;
                                  utf8Encoding.GetBytes(&lt;/font&gt;&lt;font color="#808080"&gt;"Joe Bloggs"&lt;/font&gt;&lt;font color="#000000"&gt;),           &lt;br /&gt;
                                  timeStamp,            &lt;br /&gt;
                                  ConsistencyLevel.ONE)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;client.insert(&lt;/font&gt;&lt;font color="#808080"&gt;"Keyspace1"&lt;/font&gt;&lt;font color="#000000"&gt;,           &lt;br /&gt;
                                  &lt;/font&gt;&lt;font color="#808080"&gt;"2"&lt;/font&gt;&lt;font color="#000000"&gt;,           &lt;br /&gt;
                                  nameColumnPath,            &lt;br /&gt;
                                  utf8Encoding.GetBytes(&lt;/font&gt;&lt;font color="#808080"&gt;"Joe Soap"&lt;/font&gt;&lt;font color="#000000"&gt;),           &lt;br /&gt;
                                  timeStamp,            &lt;br /&gt;
                                  ConsistencyLevel.ONE)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#006400"&gt;//Simple single value get using the key to get column 'name'           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;ColumnOrSuperColumn returnedColumn &lt;/font&gt;&lt;font color="#0000ff"&gt;= &lt;/font&gt;&lt;font color="#000000"&gt;client.&lt;/font&gt;&lt;font color="#0000ff"&gt;get&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;font color="#808080"&gt;"Keyspace1"&lt;/font&gt;&lt;font color="#000000"&gt;, &lt;/font&gt;&lt;font color="#808080"&gt;"1"&lt;/font&gt;&lt;font color="#000000"&gt;, nameColumnPath, ConsistencyLevel.ONE)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;Console.WriteLine(&lt;/font&gt;&lt;font color="#808080"&gt;"Column Data in Keyspace1/Standard1: name: {0}, value: {1}"&lt;/font&gt;&lt;font color="#000000"&gt;,           &lt;br /&gt;
                                      utf8Encoding.GetString(returnedColumn.Column.Name),            &lt;br /&gt;
                                      utf8Encoding.GetString(returnedColumn.Column.Value))&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;Console.WriteLine(&lt;/font&gt;&lt;font color="#808080"&gt;"Getting splice range"&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#006400"&gt;//Read an entire row           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;SlicePredicate predicate &lt;/font&gt;&lt;font color="#0000ff"&gt;= new &lt;/font&gt;&lt;font color="#000000"&gt;SlicePredicate()           &lt;br /&gt;
                                               {            &lt;br /&gt;
                                                  Slice_range &lt;/font&gt;&lt;font color="#0000ff"&gt;= new &lt;/font&gt;&lt;font color="#000000"&gt;SliceRange()           &lt;br /&gt;
                                                                {            &lt;br /&gt;
                                                                    &lt;/font&gt;&lt;font color="#006400"&gt;//Start and Finish cannot be null           &lt;br /&gt;
                                                                    &lt;/font&gt;&lt;font color="#000000"&gt;Start &lt;/font&gt;&lt;font color="#0000ff"&gt;= new byte&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#800000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;],  &lt;br /&gt;
                                                                    Finish &lt;/font&gt;&lt;font color="#0000ff"&gt;= new byte&lt;/font&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;font color="#800000"&gt;0&lt;/font&gt;&lt;font color="#000000"&gt;],           &lt;br /&gt;
                                                                    Count  &lt;/font&gt;&lt;font color="#0000ff"&gt;= &lt;/font&gt;&lt;font color="#800000"&gt;10&lt;/font&gt;&lt;font color="#000000"&gt;,           &lt;br /&gt;
                                                                    Reversed &lt;/font&gt;&lt;font color="#0000ff"&gt;= false           &lt;br /&gt;
                                                                &lt;/font&gt;&lt;font color="#000000"&gt;}           &lt;br /&gt;
                                               }&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;ColumnParent parent &lt;/font&gt;&lt;font color="#0000ff"&gt;= new &lt;/font&gt;&lt;font color="#000000"&gt;ColumnParent() { Column_family &lt;/font&gt;&lt;font color="#0000ff"&gt;= &lt;/font&gt;&lt;font color="#808080"&gt;"Standard1" &lt;/font&gt;&lt;font color="#000000"&gt;}&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;Dictionary&amp;lt;&lt;/font&gt;&lt;font color="#0000ff"&gt;string &lt;/font&gt;&lt;font color="#000000"&gt;, List&amp;lt;ColumnOrSuperColumn&amp;gt;&amp;gt; results &lt;/font&gt;&lt;font color="#0000ff"&gt;= &lt;/font&gt;&lt;font color="#000000"&gt;client.multiget_slice(&lt;/font&gt;&lt;font color="#808080"&gt;"Keyspace1"&lt;/font&gt;&lt;font color="#000000"&gt;,  &lt;br /&gt;
                                                                              &lt;/font&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#000000"&gt;List&amp;lt;&lt;/font&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;font color="#000000"&gt;&amp;gt;() { &lt;/font&gt;&lt;font color="#808080"&gt;"1"&lt;/font&gt;&lt;font color="#000000"&gt;, &lt;/font&gt;&lt;font color="#808080"&gt;"2"&lt;/font&gt;&lt;font color="#000000"&gt;},  &lt;br /&gt;
                                                                              parent,  &lt;br /&gt;
                                                                              predicate,  &lt;br /&gt;
                                                                              ConsistencyLevel.ONE)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                    foreach &lt;/font&gt;&lt;font color="#000000"&gt;(KeyValuePair&amp;lt;&lt;/font&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;font color="#000000"&gt;, List&amp;lt;ColumnOrSuperColumn&amp;gt;&amp;gt; resultPair &lt;/font&gt;&lt;font color="#0000ff"&gt;in &lt;/font&gt;&lt;font color="#000000"&gt;results)           &lt;br /&gt;
                    {            &lt;br /&gt;
                        Console.WriteLine(&lt;/font&gt;&lt;font color="#808080"&gt;"Key: {0}"&lt;/font&gt;&lt;font color="#000000"&gt;, resultPair.Key)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
        &lt;br /&gt;
                        foreach &lt;/font&gt;&lt;font color="#000000"&gt;(ColumnOrSuperColumn resultColumn &lt;/font&gt;&lt;font color="#0000ff"&gt;in &lt;/font&gt;&lt;font color="#000000"&gt;resultPair.Value)           &lt;br /&gt;
                        {            &lt;br /&gt;
                            Column column &lt;/font&gt;&lt;font color="#0000ff"&gt;= &lt;/font&gt;&lt;font color="#000000"&gt;resultColumn.Column&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                            &lt;/font&gt;&lt;font color="#000000"&gt;Console.WriteLine(&lt;/font&gt;&lt;font color="#808080"&gt;"name: {0}, value: {1}"&lt;/font&gt;&lt;font color="#000000"&gt;, utf8Encoding.GetString(column.Name), utf8Encoding.GetString(column.Value))&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                        &lt;/font&gt;&lt;font color="#000000"&gt;}           &lt;br /&gt;
                    }            &lt;br /&gt;
        &lt;br /&gt;
                    Console.WriteLine(&lt;/font&gt;&lt;font color="#808080"&gt;"Closing connection"&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                    &lt;/font&gt;&lt;font color="#000000"&gt;transport.Close()&lt;/font&gt;&lt;font color="#0000ff"&gt;;           &lt;br /&gt;
                &lt;/font&gt;&lt;font color="#000000"&gt;}           &lt;br /&gt;
            }            &lt;br /&gt;
        }&lt;/font&gt; &lt;/div&gt;
        &lt;/li&gt;
        &lt;li&gt;Hit F5 and watch the Application Output window. This is what you should see:&lt;br /&gt;
        &lt;br /&gt;
        &lt;a href="http://ridgway.co.za/images/ridgway_co_za/WindowsLiveWriter/8fe.NetDevelopersGuidetoGettingStartedwi_4F37/image_9.png"&gt;&lt;img border="0" width="619" height="466" style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://www.ridgway.co.za/images/ridgway_co_za/WindowsLiveWriter/8fe.NetDevelopersGuidetoGettingStartedwi_4F37/image_thumb_3.png" /&gt;&lt;/a&gt; &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/li&gt;
    &lt;br /&gt;
    Hopefully this is enough to get you going and have you fill in the remaining gaps. If you found it useful please post a comment. If the Cassandra guys would like to use the C# example they are welcome to it. Good luck!&lt;br /&gt;
&lt;/ol&gt;&lt;img src="http://ridgway.co.za/aggbug/196.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eden Ridgway</dc:creator>
            <guid>http://ridgway.co.za/archive/2009/11/06/net-developers-guide-to-getting-started-with-cassandra.aspx</guid>
            <pubDate>Thu, 05 Nov 2009 22:32:51 GMT</pubDate>
            <comments>http://ridgway.co.za/archive/2009/11/06/net-developers-guide-to-getting-started-with-cassandra.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://ridgway.co.za/comments/commentRss/196.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Are Database Migration Frameworks Worth the Effort?</title>
            <link>http://ridgway.co.za/archive/2009/01/03/are-database-migration-frameworks-worth-the-effort.aspx</link>
            <description>&lt;p&gt;I’ve always used SQL scripts to manage database creation and migration. At my current company we have a database project with patch scripts that conditionally execute based on the database version. These scripts are simply run in sequence by an installer which stores the current database version as a database extended property. The approach relies on version based naming of SQL scripts and developers to remember to update the patch script whenever they make a structure or stored procedure change. Of course one could try to use a tool such as Redgate SQL compare to generate diff patch scripts but that won’t always suffice as that won’t capture refactoring such as column name changes or data migration (for more read &lt;a target="_blank" href="http://blog.liquibase.org/2007/06/the-problem-with-database-diffs.html"&gt;The Problem with Database Diffs&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The use of SQL scripts is not without it’s problems. The most annoying of these is that a patch script may break as SQL will parse and validate your script against the existing table structure even if the statements are not going to run due to version check condition. This forces one to use nasty EXEC/sp_execute alter/create statements with double escaped strings (Yuck!). I find the following particularly problematic with this approach:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;The string based SQL statements will always pass validation even though when they are executed they may be completely screwed &lt;/li&gt;
    &lt;li&gt;It is impractical to generate these by hand and the best way to create them is to use SQL Management Studio. &lt;/li&gt;
    &lt;li&gt;If your stored procedures are not wrapped in strings, to update the patch script requires you to script out the scripts from the database. Basically this increases development friction and discourages updating of the patch script. &lt;/li&gt;
    &lt;li&gt;It becomes difficult to determine when a structural change was made as one has to trawl through huge SQL scripts and it is not easy to use a regex search to find a change. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Hence I long for something a little more strongly typed, which is why the growing number of .Net based Database Migration frameworks have caught my eye. I want to be sure that there isn’t something obvious that I was missing out by not using one. Fortunately Ben Scheirman has done a fair amount of research already and wrote a fairly good round up of &lt;a target="_blank" href="http://flux88.com/blog/net-database-migration-tool-roundup/"&gt;available .Net migration tools&lt;/a&gt;. Looking at the tools there are clearly two different types of frameworks available:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Structured SQL script execution&lt;/strong&gt; – These tools provide a framework under which SQL scripts will be executed to create and upgrade a database to a specific version. Examples of these are: &lt;a target="_blank" href="http://code.google.com/p/tarantino/wiki/DatabaseChangeManagement"&gt;Tarantino&lt;/a&gt; and &lt;a target="_blank" href="http://www.liquibase.org/"&gt;LiquiBase&lt;/a&gt;. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Rails like Active Record Migration&lt;/strong&gt; – Commands to upgrade or downgrade the database schema and data can be coded in a .Net language, with the possibility of executing SQL statements if required. Tools that fall into this category are: &lt;a target="_blank" href="http://www.rikware.com/RikMigrations.html"&gt;RikMigrations&lt;/a&gt;, &lt;a target="_blank" href="http://subsonicproject.com/2-1-pakala/subsonic-using-migrations/"&gt;SubSonic Migrations&lt;/a&gt;, &lt;a target="_blank" href="http://codebetter.com/blogs/jacob.lewallen/archive/2008/04/25/a-first-look-at-machine-migrations.aspx"&gt;Machine.Migrations&lt;/a&gt; and &lt;a target="_blank" href="http://code.google.com/p/migratordotnet/"&gt;Migrator.Net&lt;/a&gt;. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The obvious question that springs to mind when looking at these frameworks is whether or not the additional development friction (additional tasks that must be performed during the course of development) is worth the benefit. To be honest I don’t see a massive difference between the structured SQL script execution approach and what I’ve been doing all along. However the likes of &lt;a target="_blank" href="http://www.liquibase.org/"&gt;LiquiBase&lt;/a&gt; do provide a functionality that nicely captures database refactorings and diffs, so maybe it could be used as more of a general toolset. However the Active Migration approach would be a more radical departure so I’d like to explore that more.&lt;/p&gt;
&lt;p&gt;Here are my thoughts on Active Record Migration like frameworks:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Best paired with an ORM framework, such as &lt;a target="_blank" href="http://www.hibernate.org/343.html"&gt;NHibernate&lt;/a&gt; or &lt;a target="_blank" href="http://subsonicproject.com/"&gt;Subsonic&lt;/a&gt;, where one is not writing a lot of custom SQL and hence the the upgrade classes can be kept clean and focus on structural and data migration. That is not to say that there will not be benefit to having them execute a lot of SQL statements to add/update stored procedures, it is just that it may get a little messy and possibly tedious. &lt;/li&gt;
    &lt;li&gt;Using C# code to do database change would provide an opportunity to use something like log4net to dump out progress information. I've always longed for a decent way of doing this that doesn't involve a custom proc that inserts into a table. I really like the idea of having a degree of compile time checking for the database changes. Of course with SQL scripts you could always run them on each build and if they break, you fail the build. &lt;/li&gt;
    &lt;li&gt;The whole idea of downgrading a database scares me because if someone accidently points an old version of an application (with automatic migration logic) to the database (think xcopy deployment) you could end up losing tables and data. Of course one should always backup a database before doing a deployment, but I’m talking about a situation where one doesn’t know it is pointing to the wrong database until it is too late. I hope these tools backup the database before applying changes. In my mind a downgrade should only be performed if a rollout fails and one has to revert to a backup taken before the upgrade was undertaken.&lt;/li&gt;
    &lt;li&gt;I really like the idea of using anonymous objects to insert data into the database (&lt;a target="_blank" href="http://www.codethinked.com/post/2008/12/16/Migrations-in-C-using-RikMigrations.aspx"&gt;RikiMigration supports this&lt;/a&gt;) and avoiding the need to write insert statements. &lt;/li&gt;
    &lt;li&gt;Do you not run into potential development concurrency and structuring issues? So for example during a development cycle does one dump all changes into one class or into several? &lt;/li&gt;
    &lt;li&gt;The database vendor abstraction that is can provide is only attractive to a small number of projects. Furthermore one invariably will need to execute vendor specific statements and is best suited to a multi-vendor ORM such as NHibernate.&lt;/li&gt;
    &lt;li&gt;The approach may not fly in an organization where a DBA must review all SQL changes. Although I don’t see any reason why the frameworks couldn’t generate these for you.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I think if I was currently working on a project that used an ORM like NHibernate or LINQ to Entities, the migration frameworks would be a lot more appealing. However with other types of projects I’m worried that the additional effort isn’t really going to be worth the benefit.&lt;/p&gt;
&lt;p&gt;Am I missing any other potential benefits (or problems)? I would really like to hear if there are other compelling reasons to adopt the approach.&lt;/p&gt;&lt;img src="http://ridgway.co.za/aggbug/195.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eden Ridgway</dc:creator>
            <guid>http://ridgway.co.za/archive/2009/01/03/are-database-migration-frameworks-worth-the-effort.aspx</guid>
            <pubDate>Sat, 03 Jan 2009 11:52:03 GMT</pubDate>
            <comments>http://ridgway.co.za/archive/2009/01/03/are-database-migration-frameworks-worth-the-effort.aspx#feedback</comments>
            <wfw:commentRss>http://ridgway.co.za/comments/commentRss/195.aspx</wfw:commentRss>
        </item>
        <item>
            <title>An Updated LINQ to WMI Implementation</title>
            <link>http://ridgway.co.za/archive/2008/01/02/an-updated-linq-to-wmi-implementation.aspx</link>
            <description>I recently needed to do some WMI queries so I went hunting for a LINQ implementation. I found a great basic implementation that &lt;a target="_blank" href="http://bloggingabout.net/blogs/emile/"&gt;Emile Bosch&lt;/a&gt; did way back in 2005.  Once you have finished reading this post you should view his &lt;a target="_blank" href="http://bloggingabout.net/blogs/emile/archive/2005/12/12/10514.aspx"&gt;blog post&lt;/a&gt; for more detail on the implementation.&lt;br /&gt;
&lt;br /&gt;
Unfortunately Emile's WMILINQ implementation no longer works as it was based on a beta version of the framework so I brushed it off and upgraded it to work with the RTM release of .Net 3.5. I also made several other other improvements such as:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt; Updated the code generator to identify and generate array properties and emit a generated code attribute on the associated class&lt;/li&gt;
    &lt;li&gt;Fixed a bug with string where filter parameters&lt;/li&gt;
    &lt;li&gt; Improved the CIM Type mapping conversion logic&lt;/li&gt;
    &lt;li&gt;Added array mapping support to the LINQ query &lt;/li&gt;
    &lt;li&gt; Changed the name to match the new Microsoft LINQ to X naming convention&lt;/li&gt;
&lt;/ul&gt;
Once I had it working I could execute queries against the WMI objects like this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="code"&gt; &lt;font color="blue"&gt;var&lt;/font&gt;&lt;font color="black"&gt; query &lt;font color="blue"&gt;= &lt;/font&gt;&lt;font color="black"&gt;from account &lt;/font&gt;&lt;font color="blue"&gt;in &lt;/font&gt;&lt;font color="black"&gt;context.Source&amp;lt;&lt;span style="color: rgb(0, 0, 128);"&gt;Win32_UserAccount&lt;/span&gt;&amp;gt;()&lt;br /&gt;
            select account&lt;/font&gt;&lt;font color="blue"&gt;;&lt;br /&gt;
&lt;br /&gt;
foreach &lt;/font&gt;&lt;font color="black"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color="black" style="color: rgb(51, 51, 153);"&gt;Win32_UserAccount&lt;/font&gt;&lt;font color="black"&gt;&lt;font color="black"&gt; account &lt;/font&gt;&lt;font color="blue"&gt;in &lt;/font&gt;&lt;font color="black"&gt;query)&lt;br /&gt;
{&lt;br /&gt;
    Console.WriteLine(account.Name)&lt;/font&gt;&lt;font color="blue"&gt;;&lt;br /&gt;
&lt;/font&gt;&lt;font color="black"&gt;}&lt;/font&gt; 	&lt;/font&gt;&lt;/div&gt;
&lt;font color="black"&gt;&lt;br /&gt;
Doing basic queries with the provider is really easy, but be aware that the implementation is very limited. It does not support projections, nested queries and referenced variables. So for example the following query generates an incorrect WQL statement.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="code"&gt; &lt;font color="blue"&gt;string &lt;/font&gt;&lt;font color="black"&gt;name &lt;/font&gt;&lt;font color="blue"&gt;= &lt;/font&gt;&lt;font color="#808080"&gt;"Me"&lt;/font&gt;&lt;font color="blue"&gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;/font&gt;&lt;font color="black"&gt;var query &lt;/font&gt;&lt;font color="blue"&gt;= &lt;/font&gt;&lt;font color="black"&gt;from account &lt;/font&gt;&lt;font color="blue"&gt;in &lt;/font&gt;&lt;font color="black"&gt;context.Source&amp;lt;&lt;/font&gt;&lt;font color="black" style="color: rgb(51, 51, 153);"&gt;Win32_UserAccount&lt;/font&gt;&lt;font color="black"&gt;&amp;gt;()&lt;br /&gt;
            where account.Name &lt;/font&gt;&lt;font color="blue"&gt;== &lt;/font&gt;&lt;font color="black"&gt;name&lt;br /&gt;
            select account&lt;/font&gt;&lt;font color="blue"&gt;;&lt;/font&gt; 	&lt;/div&gt;
&lt;br /&gt;
            &lt;br /&gt;
One would expect it to generate this statement:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="code"&gt; &lt;font color="blue"&gt;SELECT &lt;/font&gt;&lt;font color="black"&gt;* &lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;/font&gt;&lt;font color="black"&gt;Win32_UserAccount &lt;/font&gt;&lt;font color="blue"&gt;WHERE name = &lt;/font&gt;&lt;font color="#808080"&gt;'Me'&lt;/font&gt; 	&lt;/div&gt;
&lt;br /&gt;
but instead executes this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="code"&gt; &lt;font color="blue"&gt;SELECT &lt;/font&gt;&lt;font color="black"&gt;* &lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;/font&gt;&lt;font color="black"&gt;Win32_UserAccount &lt;/font&gt;&lt;font color="blue"&gt;WHERE name = &lt;/font&gt;&lt;font color="#808080"&gt;'name'&lt;/font&gt; 	&lt;/div&gt;
&lt;br /&gt;
Regardless of these shortcomings I still found it quite useful, and I wanted to share the upgraded version with you. So if you'd like to grab it, here's the &lt;a href="http://www.ridgway.co.za/demos/LinqToWmi.zip"&gt;download&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
I am currently working on a rewrite of the implementation using Matt Warren's excellent set of &lt;a href="http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx"&gt;Building an IQueryable Provider&lt;/a&gt; blog posts as a basis. So far it is not looking too bad and it overcomes several of the problems with this implementation, but it requires quite a bit more effort to finish it off, so it may be a while before I release it.&lt;br /&gt;
&lt;/font&gt;&lt;img src="http://ridgway.co.za/aggbug/191.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eden Ridgway</dc:creator>
            <guid>http://ridgway.co.za/archive/2008/01/02/an-updated-linq-to-wmi-implementation.aspx</guid>
            <pubDate>Wed, 02 Jan 2008 07:51:56 GMT</pubDate>
            <comments>http://ridgway.co.za/archive/2008/01/02/an-updated-linq-to-wmi-implementation.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://ridgway.co.za/comments/commentRss/191.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Profiler for SQL Express</title>
            <link>http://ridgway.co.za/archive/2007/07/10/profiler-for-sql-express.aspx</link>
            <description>For those of you who are doing things on the cheap and only using SQL Express, you'll be glad to know that there is an open source &lt;a target="_blank" href="http://sqlprofiler.googlepages.com/"&gt;SQL Express profiler&lt;/a&gt; project. As one would expect it is pretty basic, but has all the important features, like the ability to filter and select the events and columns to trace. I had a look around the code and it is pretty simple (it could do with some more comments though &lt;img src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" alt="" /&gt;), so it should be easy enough to extend should you want to.&lt;img src="http://ridgway.co.za/aggbug/185.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eden Ridgway</dc:creator>
            <guid>http://ridgway.co.za/archive/2007/07/10/profiler-for-sql-express.aspx</guid>
            <pubDate>Tue, 10 Jul 2007 04:45:00 GMT</pubDate>
            <comments>http://ridgway.co.za/archive/2007/07/10/profiler-for-sql-express.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://ridgway.co.za/comments/commentRss/185.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Processing CSV Data</title>
            <link>http://ridgway.co.za/archive/2007/02/19/179.aspx</link>
            <description>If you are a .Net developer, there is very little reason why you should ever write your own CSV parser.  SecretGeek has a pretty good &lt;a href="http://secretgeek.net/csv_trouble.asp"&gt;blog post&lt;/a&gt; on why it is a bad idea.  He mentions a library I have known about for a while called &lt;a href="http://www.filehelpers.com/"&gt;FileHelpers&lt;/a&gt;.  It has some pretty awesome features, such as:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;Serialization and deserialization of delimited or fixed width data&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Attribute based field conversion definition (e.g. [FieldConverter(ConverterKind.Date, &lt;span class="string"&gt;"dd-MM-yyyy"&lt;/span&gt;&lt;span&gt;)] &lt;/span&gt;).  You can also create custom converters.&lt;/li&gt;
    &lt;li&gt;File differences for files with the same record structure&lt;/li&gt;
    &lt;li&gt;The ability to skip empty or first/last N records&lt;/li&gt;
&lt;/ul&gt;
An alternative less powerful approach is to use Microsoft's &lt;span class="pageTitle"&gt;&lt;span id="ctl01_PageTitleLabel"&gt;&lt;a href="http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=DDE579F1-836A-4562-A3CB-57A7DBBEBAE0"&gt;XmlCsvReader&lt;/a&gt;.  This is more useful if you want to treat the file like a read only XML document.&lt;/span&gt;&lt;/span&gt;&lt;img src="http://ridgway.co.za/aggbug/179.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eden Ridgway</dc:creator>
            <guid>http://ridgway.co.za/archive/2007/02/19/179.aspx</guid>
            <pubDate>Mon, 19 Feb 2007 05:52:13 GMT</pubDate>
            <comments>http://ridgway.co.za/archive/2007/02/19/179.aspx#feedback</comments>
            <wfw:commentRss>http://ridgway.co.za/comments/commentRss/179.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Safari on Windows (Web Kit)</title>
            <link>http://ridgway.co.za/archive/2007/01/23/178.aspx</link>
            <description>There has been quite a bit of talk about getting a Windows version of Safari.  Well with the &lt;a href="http://webkit.org/"&gt;Web Kit&lt;/a&gt; and &lt;a href="http://www.getswift.org"&gt;Swift&lt;/a&gt; projects this seems to be finally happening.  It is still early days and the Swift browser crashed on me several times but it has promise. Since I don't have a Mac handy it at least gives me a glimpse of how a web site might look/operate in Safari.&lt;br /&gt;
&lt;br /&gt;
What made me even more interested in the Swift browser was that it is written in C#, but unfortunately the &lt;a href="http://opensource.zimmy.ca/swift_current/trunk"&gt;subversion repository url&lt;/a&gt; provided does not work.  The good news is that the Web Kit project seems better organised and I didn't have a problem getting hold of that code.  It also has pretty good instructions on how to &lt;a href="http://trac.webkit.org/projects/webkit/wiki/BuildingOnWindows"&gt;build it on Windows&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Since the Swift wiki does not have a screenshot of the browser, I thought I'd provide one:&lt;br /&gt;
&lt;br /&gt;
&lt;img alt="Swift Browser" src="http://farm1.static.flickr.com/136/366653300_dba785eeeb.jpg?v=0" style="width: 500px; height: 412px;" /&gt;&lt;img src="http://ridgway.co.za/aggbug/178.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eden Ridgway</dc:creator>
            <guid>http://ridgway.co.za/archive/2007/01/23/178.aspx</guid>
            <pubDate>Tue, 23 Jan 2007 05:26:11 GMT</pubDate>
            <comments>http://ridgway.co.za/archive/2007/01/23/178.aspx#feedback</comments>
            <wfw:commentRss>http://ridgway.co.za/comments/commentRss/178.aspx</wfw:commentRss>
        </item>
        <item>
            <title>iTextSharp XML to PDF Example</title>
            <link>http://ridgway.co.za/archive/2005/07/31/itextsharpxmltopdfexample.aspx</link>
            <description>The iTextSharp's current XML to PDF example is clearly out of date and does not work. So I went about fixing the example. You can download it here: &lt;a name="iTextSharpExample" href="/Images/ridgway_co_za/iTextSharpExample.zip"&gt;iTextSharpExample.zip&lt;/a&gt;.
&lt;p&gt;The generation of a PDF file from XML is surprisingly painless.  The steps are as follows: &lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Create an iTextSharp document
    &lt;div class="code"&gt;&lt;font color="#000000"&gt;Document document &lt;/font&gt;&lt;font color="#0000ff"&gt;= new &lt;/font&gt;&lt;font color="#000000"&gt;Document()&lt;/font&gt;&lt;font color="#0000ff"&gt;;&lt;/font&gt; &lt;/div&gt;
    &lt;/li&gt;
    &lt;li&gt;Get an instance of the PDF writer and at the same time specify the output PDF
    &lt;div class="code"&gt;&lt;font color="#000000"&gt;PdfWriter.GetInstance(document, &lt;/font&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#000000"&gt;FileStream(&lt;/font&gt;&lt;font color="#808080"&gt;"ExampleDoc.pdf"&lt;/font&gt;&lt;font color="#000000"&gt;, FileMode.Create))&lt;/font&gt;&lt;font color="#0000ff"&gt;;&lt;/font&gt; &lt;/div&gt;
    &lt;/li&gt;
    &lt;li&gt;Create an iTextSharp Xml TextHandler passing in the document instance
    &lt;div class="code"&gt;&lt;font color="#000000"&gt;ITextHandler xmlHandler &lt;/font&gt;&lt;font color="#0000ff"&gt;= new &lt;/font&gt;&lt;font color="#000000"&gt;ITextHandler(document)&lt;/font&gt;&lt;font color="#0000ff"&gt;;&lt;/font&gt; &lt;/div&gt;
    &lt;/li&gt;
    &lt;li&gt;Get the TextHandler object to parse the XML file that has the iTextSharp XML elements
    &lt;div class="code"&gt;&lt;font color="#000000"&gt;xmlHandler.Parse(&lt;/font&gt;&lt;font color="#808080"&gt;"ExampleDoc.xml"&lt;/font&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;font color="#0000ff"&gt;;&lt;/font&gt; &lt;/div&gt;
    &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Of course there's more to this because the XML document must be in a format that iTextSharp can use.  Everything is in the itext.dtd file in the example, but here is a summary: &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;The outermost element is &lt;strong&gt;itext&lt;/strong&gt; and one can have &lt;strong&gt;title&lt;/strong&gt;, &lt;strong&gt;subject&lt;/strong&gt;, &lt;strong&gt;keywords&lt;/strong&gt; and author attributes &lt;/li&gt;
    &lt;li&gt;Within that you can have one of the following elements:
    &lt;ul&gt;
        &lt;li&gt;&lt;strong&gt;chunk&lt;/strong&gt; - a small piece of text - useful if you want to set the colour or background of the text &lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;phrase&lt;/strong&gt; - a collection of chunks and allows you to define the space between lines &lt;/li&gt;
        &lt;li&gt;&lt;strong&gt;paragraph&lt;/strong&gt; - a collection of chunks/phrases with a carriage return after them &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;The &lt;strong&gt;list&lt;/strong&gt; and &lt;strong&gt;listitem&lt;/strong&gt; element is used to add lists &lt;/li&gt;
    &lt;li&gt;You can add images to paragraphs, listitem and several other elements using the &lt;strong&gt;image&lt;/strong&gt; element and &lt;strong&gt;url attribute&lt;/strong&gt; &lt;/li&gt;
    &lt;li&gt;Tables are controlled through &lt;strong&gt;table&lt;/strong&gt;, &lt;strong&gt;row&lt;/strong&gt; and &lt;strong&gt;cell&lt;/strong&gt; elements &lt;/li&gt;
&lt;/ul&gt;
Here is an example XML file:&lt;br /&gt;
&lt;div class="code"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;itext&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; &lt;br /&gt;
    &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;paragraph&lt;/font&gt;&lt;font color="#ff0000"&gt; leading&lt;/font&gt;&lt;font color="#0000ff"&gt;="12.0"&lt;/font&gt;&lt;font color="#ff0000"&gt; font&lt;/font&gt;&lt;font color="#0000ff"&gt;="Helvetica"&lt;/font&gt;&lt;font color="#ff0000"&gt; align&lt;/font&gt;&lt;font color="#0000ff"&gt;="Default"&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; &lt;br /&gt;
        &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;image&lt;/font&gt;&lt;font color="#ff0000"&gt; url&lt;/font&gt;&lt;font color="#0000ff"&gt;="Cat.jpg"&lt;/font&gt;&lt;font color="#ff0000"&gt; plainwidth&lt;/font&gt;&lt;font color="#0000ff"&gt;="194.0"&lt;/font&gt;&lt;font color="#ff0000"&gt; plainheight&lt;/font&gt;&lt;font color="#0000ff"&gt;="202.0"&lt;/font&gt;&lt;font color="#ff0000"&gt; &lt;/font&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;br /&gt;
        I got this from&lt;br /&gt;
        &amp;lt;&lt;/font&gt;&lt;font color="#800000"&gt;anchor&lt;/font&gt;&lt;font color="#ff0000"&gt; fontstyle&lt;/font&gt;&lt;font color="#0000ff"&gt;="normal, underline"&lt;/font&gt;&lt;font color="#ff0000"&gt; red&lt;/font&gt;&lt;font color="#0000ff"&gt;="0"&lt;/font&gt;&lt;font color="#ff0000"&gt; green&lt;/font&gt;&lt;font color="#0000ff"&gt;="0"&lt;/font&gt;&lt;font color="#ff0000"&gt; blue&lt;/font&gt;&lt;font color="#0000ff"&gt;="255"&lt;/font&gt;&lt;font color="#ff0000"&gt; reference&lt;/font&gt;&lt;font color="#0000ff"&gt;="http://www.ridgywa.co.za/"&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; &lt;br /&gt;
            Eden's blog&lt;br /&gt;
        &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000"&gt;anchor&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; &lt;br /&gt;
    &lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000"&gt;paragraph&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt; &lt;br /&gt;
&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="#800000"&gt;itext&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;font color="#000000"&gt;&lt;/font&gt; &lt;/div&gt;
This is what the pdf file generated using the xml above looks like: &lt;span style="TEXT-DECORATION: underline"&gt;&lt;a href="http://www.ridgway.co.za/Images/ridgway_co_za/iTextXmlToPdf Example.pdf"&gt;iTextXmlToPdf Example.pdf&lt;/a&gt;&lt;/span&gt;&lt;a href="http://www.ridgway.co.za/Images/ridgway_co_za/iTextXmlToPdf%20Example.pdf"&gt;&lt;/a&gt;&lt;img src="http://ridgway.co.za/aggbug/111.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Eden Ridgway</dc:creator>
            <guid>http://ridgway.co.za/archive/2005/07/31/itextsharpxmltopdfexample.aspx</guid>
            <pubDate>Sun, 31 Jul 2005 14:36:54 GMT</pubDate>
            <comments>http://ridgway.co.za/archive/2005/07/31/itextsharpxmltopdfexample.aspx#feedback</comments>
            <wfw:commentRss>http://ridgway.co.za/comments/commentRss/111.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Open Source Accounting Packages</title>
            <link>http://ridgway.co.za/archive/2005/07/16/opensourceaccountingpackages.aspx</link>
            <description>&lt;p&gt;
At work we've been considering writing our own accounting package, so I did a little
investigation into open source accounting packages.  This is what I found:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.grisbi.org/"&gt;Grisbi&lt;/a&gt; - This is a personal financial management
package but it seems pretty good.  The main advantage I see in a package like
this is the fact that it has been kept simple.  It supports budgets, financial
years, multiple accounts, currencies and users.  However it sounds like it does
not do double entry accounting which is very strange. 
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://www.gnucash.org/"&gt;GnuCash&lt;/a&gt; - It alows you to track bank accounts,
stocks, income and expenses. As quick and intuitive to use as a checkbook register,
it is based on professional accounting principles to ensure balanced books and accurate
reports.  The fact that it does not run on windows is a major problem. 
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://www.lazy8.nu/"&gt;Lazy8 Ledger&lt;/a&gt; - This accounting program is designed
for people who have experience in bookkeeping. 
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://myphpmoney.sourceforge.net/index.php"&gt;MyPhpMoney&lt;/a&gt; - This is a basic
personal financial management system 
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://www.weberp.org/"&gt;WebERP&lt;/a&gt; - This is a PHP based ERP/accounting system. 
It contains the standard accounting features one would expect.  The interface
is really basic and not really user friendly.  For example when capturing a sales
order one has to remember the part code or go to another screen to do a parts search. 
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://open-accounting.sourceforge.net/"&gt;OpenAccounting&lt;/a&gt; - A PHP accounting
and inventory system.  Features are: complex taxation handling, multi-currency
support, sales, purchase orders, inventory and multi-user configuration.  The
demo site was pretty broken which is not a good sign. 
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://xiwa.sourceforge.net/"&gt;XIWA&lt;/a&gt; - A double entry accounting system
that allows you to import Quickbooks files.  It supports multiple ledgers, sub
entities or departments within ledgers and does payroll.  It is written in Perl
and uses a postgreSQL backend database. 
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://www.sql-ledger.org/"&gt;SqlLedger&lt;/a&gt; - SQL-Ledger is a double entry
accounting system. Accounting data is stored in a SQL Server. The entire system is
linked through a chart of accounts. Each item in inventory is linked to income, expense,
inventory and tax accounts. When items are sold and purchased the accounts are automatically
updated.  The web frontend is written in Perl.  
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://oba.sourceforge.net/"&gt;Open Business Accounting&lt;/a&gt; - OBA is a web
based business accounting software modified from sql-ledger to suit accountants ,auditors
and who required massive data entry. 
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://www.compiere.org/index.html"&gt;Compiere&lt;/a&gt; - Another ERP/accounting
system.  It is a Java based application and not web based. 
&lt;/li&gt;&lt;li&gt;
&lt;a href="http://www.ofbiz.org/"&gt;Open For Business&lt;/a&gt; - A Java based ERP system. 
This one may was the most interesting of all the applications I looked at.  If
I had to start my own company I may very well use this.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Another list of free accounting packages can be found &lt;a href="http://www.xtort.net/office/invoice.php"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
None of these really seems to fit the bill for what we are looking for.  Oh well.
&lt;/p&gt;
&lt;img src="http://ridgway.co.za/aggbug/106.aspx" width="1" height="1" /&gt;</description>
            <guid>http://ridgway.co.za/archive/2005/07/16/opensourceaccountingpackages.aspx</guid>
            <pubDate>Sat, 16 Jul 2005 12:27:38 GMT</pubDate>
            <comments>http://ridgway.co.za/archive/2005/07/16/opensourceaccountingpackages.aspx#feedback</comments>
            <wfw:commentRss>http://ridgway.co.za/comments/commentRss/106.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>