SyntaxHighlighter setup

Sunday, December 30, 2012

Windows 8 and PostgreSQL

I recently upgraded to Windows 8 Professional on my main development machine and was having trouble getting PostgreSQL installed.  The official installer would pop up some very strange dialogs and just sit.  Finally I tried the Chocolatey installer at http://chocolatey.org/packages/postgresql and success!  I hope that saves someone the headache I had yesterday.

Update: This issue seems to have been handled now. 

Wednesday, March 7, 2012

ASP.NET MVC 4 Single Page Application Presentation

ASP.NET MVC 4 (now in beta), along with Knockout, adds support for creating Single Page Applications more easily.  Steven Sanderson, the creator of Knockout did a really great presentation on creating such an application and it is amazing how much of the typical boilerplate coding is removed from the process.  He also goes into some great tips on making web apps have a more "Native" experience on the iPad.  I highly recommend watching it (link)

Sunday, February 19, 2012

Tools Update: Ditto Clipboard Manager

One of my favorite tools is the Ditto Clipboard Manager. This is an open source tool that is basically copy/paste the way that it should have been done in Windows to begin with.

The long and the short is that it keeps your clipboard contents back as many entries as you want (I store the last 500 entries).  You access them by the key stroke Ctrl+` (this is configurable) and it looks like this:

Ditto Clips dialog

























The team just released a new version. Get it here

Friday, February 10, 2012

MongoDB and the .NET Developer, Part 1: Mongo what?

I have found the whole NOSQL movement an interesting one.  And the product that I am most intrigued about is MongoDB.  I just went to their MongoDB Boulder event this week and was struck by how big a deal Mongo is in the PHP/Python/Node/etc... space but hasn't gotten much traction with .NET folk, so I am going to write a bit on getting started with it from a Visual Studio user's perspective.

First what is NOSQL and particularly MongoDB?  In general NOSQL is a growing set of technologies that are alternatives to the Relational Database.  Why bother?  We have so grown up with using the relational database that we assume it is the answer to every storage problem except few like file storage.  NOSQL questions that.  I will point out different benefits as I go, but for a more in depth treatment ask Wiki or the Duck

MongoDB is a fairly mature, open source NOSQL database produced by the company 10gen. There are binary downloads for Windows, OSX, many flavors of Linux and others.  It is easy to start it as a regular exe, but can also be run as a service. It manages data as collections of JSON/BSON documents.

One of the coolest things about it is that you can store rich hierarchical data in a very simple manner, in .NET basically handing an object off to your repository, it is serialized and stored and you are done.  Big deal you might say...we can do that pretty easily in a SQL table. First I promise it is much easier to do in Mongo than in SQL Server. But the real difference here is that all of that hierarchical data can be indexed by Mongo to make searches very efficient. For example, here is an simple example document of a person contact info:
{
  _id: 3409d3008c8d35c816390000
  firstName: “Matthew”
  lastName: “Nichols”,
  addresses: [
    {streetAddress: “123 Smith St, Unit Q”, city: “Denver”, state: “CO”, postalCode: “80206”, type: “Home”},
    {streetAddress: “123 Barney St”, city: “Denver”, state: “CO”, postalCode: “80211”, type: “Office”}
  ]
}

A collection in MongoDB could have many thousands of documents like these.  With the right indexes set up on the addresses array you could search for all of the people that lived in Colorado.

Features
So why bother?  There are a number of features that Mongo has that I find compelling:
  • A simpler and more flexible programing model: In Mongo your documents are just the data that your application hands it.  You are essentially just storing your domain model.
  • Replication is easy to setup. This allows for very high availability and data safety.  I will walk through setting this up in a later post.
  • Scales horizontally:  Database sharding is made pretty easy in Mongo. This allows the system to scale across multiple cheap machines rather than scaling vertically on increasingly expensive hardware.
  • Unlike many cross-platform open source projects Windows is well supported.  There is excellent documentation and a very competent driver.
Next post I will walk through setting up Mongo and some related tools on a development machine.

Tuesday, January 10, 2012

Daniel Suarez & Daemon

A couple of years ago my friend Mohan turned me on to the novel "Daemon" by Daniel Suarez which I thoroughly enjoyed.  It and it's sequel "Freedom" are a tale of  what sort of changes, good and bad, could be forced upon us by the software around us.  While certainly there were a couple of exaggerated technologies, by and large I am convinced that it is a fairly realistic possibility.  Entertaining and educational.

Today I heard a podcast of the author speaking at one of my favorite lecture venues, the Long Now Foundation about the same subject matter.  I recommend checking it out. Link

Drawing a tree diagram with Raphaël and CoffeeScript

I recently had to create an interactive tree diagram displaying companies and their subsidiaries and the business requirements specified something "prettier" than I could achieve by styling a nested HTML list.  Additionally I had to support Internet Explorer 8, which does not have Canvas or SVG support.  Pondering the problem I remembered hearing on The Changelog of a client-side drawing library called Raphaël.  Raphaël provides an abstraction over SVG on browsers that support it and on IE does the same thing using VML and thus giving me the ability to draw pictures in the browser going all the way back to IE 6.

So armed with the ability to draw I created my tree.  Most of the new client-side code that I am writing today is in CoffeeScript so that is what I used here.  The following is my main drawing routine:

And then some code to create some sample data and call it:

See it in action here

I'll post the zipped code shortly.