September 2011
3 posts
4 tags
Connecting to Cassandra with C# and Thrift
Here’s something I wanted to write down for a long time now, because every time I have to do this (when Cassandra changes its interface), I have already forgotten what and exactly how needs to be done. Let’s assume that we have Cassandra up and running, because most distributions should have a package ready to use, or at least a build script. And now we want to connect to it with C#....
Sep 24th
2 notes
3 tags
Web Server In 50 Lines
Web servers are useful, but not always you want or can install and configure one. Here’s a self contained, functional, multi-threaded and extensible web server in just few lines of C#. 1 using System; 2 using System.IO; 3 using System.Net; 4 using System.Text; 5 6 7 class Server { 8 9 static String root = "/home/you/web/root/"; 10 11 static String prefix =...
Sep 15th
5 notes
2 tags
Transpose Rows To Columns
One very common problem when making reports from a RDBMS, is that you need to show, data that’s stored in rows, in columns. For example, from data like this: 1 CREATE TABLE #data_a ( 2 cat varchar(20) NOT NULL, 3 mon date NOT NULL, 4 val int NOT NULL 5 ); 6 INSERT INTO #data_a 7 VALUES 8 ('Foo', '2011-02-01', '752'), 9 ('Qux', '2011-03-01', '700'), 10 ('Qux',...
Sep 7th
27 notes