How Fluent Cassandra Handles Runtime Types

Today I had the question come up about some wonky behavior with retrieving data from Cassandra for non-string types. Here is the issue in a nut-shell: dynamic obj = record.CreateSuperColumn(); obj.Id = 1234; obj.CreatedOn = DateTime.Now; obj.IsOnline = true; // blah blah blah save to database and retrieve Console.WriteLine(obj.Id); // (some unprintable characters) Console.WriteLine(obj.CreatedOn); // (some unprintable characters) Console.WriteLine(obj.IsOnline); // (some unprintable characters) To understand why this is happening we first must talk about how Cassandra stores data in the database. Cassandra stores everything by columns either by super-column or a regular column but for the sake of this post we are just going to talk about regular columns. These regular columns are made up for three properties: ...

June 7, 2010 · 4 min · 642 words · Nick Berardi

Your First Fluent Cassandra Application (part 2)

Last time I demonstrated how to create your first Fluent Cassandra app. After we finished learning about how to create records and save them to the database, I issued a challenge to implement comments for our command line blog app we created. I hinted at how I would have done it with this column family configuration: <ColumnFamily Name="Comments" ColumnType="Super" CompareWith="TimeUUIDType" CompareSubcolumnsWith="UTF8Type" /> And this is what we are going to implement today. ...

June 6, 2010 · 6 min · 1140 words · Nick Berardi

Your First Fluent Cassandra Application

As your are probably aware by now if you follow my Twitter status or have looked in to some of my recent posts. I am developing a library called FluentCassandra which is a .NET library for using the Cassandra database in a .NETty way. The project has progressed quite nicely in the last couple of months and I am finally ready to start talking about it and giving examples on how it can be used in your applications. So lets gets started… ...

June 2, 2010 · 6 min · 1160 words · Nick Berardi

.gitignore Config File For .NET Projects

I wanted to post this mostly for my future reference. But I think it is also equally as useful to anybody else with a .NET project that is using the Git as their source control, and want to make sure non-code extras that come with .NET projects don’t get checked in. .gitignore File This file specifies the paths and files to ignore in your project. Each line constitutes a new path, and each one can use basic RegEx to generalize the ignore checking. ...

May 19, 2010 · 1 min · 196 words · Nick Berardi

TimeUUID only makes sense with version 1 UUIDs

In a world where we are all use to dealing with objects we often forget that everything gets reduced to ones and zeros before being transmitted over the wire to the destination. Most times the destination easily handles converting this object back in to an object on the other side that is easily understood and consumed. The frustration comes when we run in to a situation where the other side doesn’t understand our transmitted data. This can often cause us to pull our hair out, become irritable, and throw out hands up in disgust. Well recently I have been doing all that when trying to solve what sounds like simple problem on the surface. Sending the bytes of a Type 1 UUID, or GUID, over the wire from .NET to a server running on Java. ...

May 16, 2010 · 4 min · 720 words · Nick Berardi

Creating a Time UUID (GUID) in .NET

Previously I had written about how to setup Cassandra as a database on your Windows machine. As I was diving in deeper to learn more about the subject, I realized that .NET lacks a critical type to Cassandra, for column comparison and sorting, called TimeUUIDType. TimeUUIDType is a Version 1 UUID used in the CompareWith attribute of the storage config file. A Version 1 UUID is defined as the following: Conceptually, the original (version 1) generation scheme for UUIDs was to concatenate the UUID version with the MAC address of the computer that is generating the UUID, and with the number of 100-nanosecond intervals since the adoption of the Gregorian calendar in the West. In practice, the actual algorithm is more complicated. This scheme has been criticized in that it is not sufficiently “opaque”; it reveals both the identity of the computer that generated the UUID and the time at which it did so. ...

April 5, 2010 · 4 min · 759 words · Nick Berardi

Determining A Significant Change In A Web Page

The problem with many web pages today is that they include useless hidden pieces of constantly changing information that serves no purpose to the general web or anything else besides debugging. A pretty good example of this is one that I found on my own blog, and removed, as I was experimenting with the code in this post: <!-- 12 queries. 0.274 seconds. --> This really serves no purpose to anybody but the the few debuggers who might be looking at the code for performance reasons once every so often. ...

January 12, 2010 · 5 min · 864 words · Nick Berardi

ASP.NET MVC – 0 to 30 in 30 minutes

I recorded the following presentation for DevReady.NET, a new project that I am working on with a bunch of talented MVC’s and Microsoft employees. After I get done with editing the presentation, I will post it up to DevReady.NET and my blog. This will be my first try at making a video presentation for the web, so I look forward to your comments.

December 10, 2009 · 1 min · 63 words · Nick Berardi

Sometimes you just need to CodingHorror it!

The title of this post is a tongue-in-cheek reference to SubSonic’s inline query by the same name, which in turn is a reference to the blogger Jeff Atwood’s blog who you should all know. Rob Conery, the SubSonic project leader, named the inline query class CodingHorror after he allegedly read Jeff Atwood’s post titled Embracing Languages Inside Languages, in which he bestowed the virtues of inline SQL inside your code, instead of the standard bequeathed statement that I bet you all have heard “We do all database work in stored procedures.”. Jeff outlined his though process on ad-hoc vs stored procs as follows: ...

December 3, 2009 · 4 min · 672 words · Nick Berardi

Static Constructors in .NET 3.5, still a bad thing?

Recently at the Philly.NET User Group, Kathleen Dollard gave a great presentation on the use of generics and rethinking object orientation. Both topics were very engaging. But the part of the night that I found most intriguing was a conversation, that I had in a Ruby Tuesdays after the presentation, about the useage of static constructors and if they are still a bad thing to use in your code. Many years ago, I had read the articles by K. Scott Allen and Brad Abrams, explaining why the original FxCop rule, “Do not declare explicit static constructors”, existed and the IL command beforefieldinit, that caused the FxCop rule to trigger and cause performance issues. Jon Skeet explained it best in a recent Stack Overflow post. ...

August 30, 2009 · 10 min · 1921 words · Nick Berardi