RSS 2.0
# Saturday, December 26, 2009

When the Codemash guys announced their API I decided to create an app using it. I wasn’t sure what to do at first but It was pretty obvious anyway. Some kind of scheduling tool.

It took me some time to have the time to start and them to finish it. I finally was able to deploy this last night and today I add another feature to considered completed based on my initial goal.

You can visit the tool here: http://mysessioncalendar.com/ 

What it does?

The tool has three tabs one for each conference day and a third for the pre compiler. Each tab has columns (representing the rooms where the sessions take place, just noticed I don’t have the room on top) and them the sessions are displayed below ordered by time.

The idea is that you can select the sessions you are interested in. The tool does not make any judgement calls and if you want to select two sessions in the same time slot is up to you. Once you mark all the sessions just click the “Save Schedule” button on top and a modal dialog will display with a link to open (in a new window) a list with the selected sessions.

This time the sessions are ordered in three columns: One for each day and the sessions for each day are ordered by time.

The page has the AddThis widget that allow you to twit, email, print, add to favourites, show them in facebook and more. Another cool option is to export them as iCal
, this way you can add them to your google calendar and other tools supporting this format.

How was done.

The site have been implemented using ASP.NET MVC, jquery for all the JavaScript and the UI design using JQueryUI. Data is saved as xml so no need to use databases. Originally I started using Castle.ActiveRecord since the data model is extremely simple, but is so simple that the use of a db was overkill. The total time to have the site done was maybe 24 man hours divided in several coding sessions of no more than 3 hours at a time.

The use a a widget like AddThis make implementing the sharing functionality a 15 minutes deal.

Conclusion.

There are some things that can be better like font sizes (thanks Ahmed for the report). Originally I wanted to have a better interface with drag and drop or double click in a session to select, but decided to go with a simpler implementation and get this out of my computer and into the wild.

kick it on DotNetKicks.com Saturday, December 26, 2009 10:10:11 PM (Eastern Standard Time, UTC-05:00) by Hernan Garcia #    Comments [1] - Trackback
General
# Sunday, November 22, 2009

Some time ago I wrote a first impressions about ASP.NET MVC in Action from Manning. It was after downloading an reading a few chapters available via the Manning early access program (MEAP). The book was written by Jeffrey Palermo, Ben Scheirman and Jimmy Bogard.

A month ago or so I finally got my print copy and I started reading it right away. Let me put it simple, this book is fantastic. If you are planning to do any development with the framework you need to have it in your book shelves.

The content span over just 352 pages and it covers pretty much every single aspect of the framework. It follows a very clear path explaining how the pieces fit together. I think that It can be useful for both the experienced and the novice programmer.

One of the remarkable aspects of the book is the constant focus on testability and customization of the different pieces of the framework to help you reduce friction and improve the design of your application.

I also felt that the authors took a very pragmatic approach while exposing users to different options on implementing web applications with the framework.

I can see the book as having 3 parts. The first 6 chapters explain and show how to use and extend the framework. Chapters 7 to 10, explore more complex scenarios, like complex sites, use of AJAX, how to leverage existing asp.net features and hosting/deploying your final app.

The last part is a compendium of Best practices, Recipes and an study or other two MVC frameworks, Monorails and Ruby on Rails.

kick it on DotNetKicks.com Sunday, November 22, 2009 5:25:43 PM (Eastern Standard Time, UTC-05:00) by Hernan Garcia #    Comments [2] - Trackback
Books
# Monday, November 16, 2009

I try to be pragmatic in my approach to development and one of the things that change the most are the tools I use to deliver software. There are several reasons why I change tools so often.

  1. The evolution of the software I write call for new or different tools.
  2. Search for efficiency and eliminate pain points.
  3. I change my approach to software development and new methodologies need new tools.
  4. I just love to try new stuff :-)

In this post I want to concentrate in the tools used to manage projects and builds. Until recently my favoured tools in this context consisted of NAnt, CC.Net/Hudson and Subversion.

For bug tracking I used the bug tracker in Google code for my OSS projects integrated to TortoiseSVN or BugTracker.Net. (Note: At work we use FogBugz and we are very happy with it.)

Subversion was the first to go.

Subversion is a great VCS but I usually have two problems with it. Speed and problems with complex merges.

When I work alone, merges are not an issue of course, but speed still is. At the same time more and more people seems to be switching to DVCS (Distributed or Decentralized) systems like Git or Mercurial. After taking a quick look at GitHub and follow their tutorials I was able to move some of my projects there in a few hours. (Most of the time spent on reading and learning from other people mistakes).

Git is fast, Fast, FAST! The whole idea of local commits and clone repositories is fantastic and they really help me with my workflow in the sense that I can do one or two changes, commit, one or two more, commit, find a bug, revert change, finish a story, push to GitHub.

To manage Git I’m using a combination of command line and graphic interface using Git gui. So far I haven’t feel the need to use/install TortoiseGit.

I still have some projects hosted in google code and I’m using Subversion with them, I’m thinking on switch them over to GitHub once I start working on them again.

Nant followed it.

I don’t have a problem with XML so the fact that Nant is XML based does not bothers me, really. But I also like the power of a good scripting language to manage repetitive tasks. I decided to move away from Nant and try to adopt some of the newest build systems.

I took a look at psake and them I read “How a net developer learned ruby and rake to build net apps in windows” by Derrick Bailey and that convinced me to take the plunge.

My knowledge of Ruby is extremely rudimentary but I even with that handicap I was able to have a Rake build script up and running in less than 90 minutes. This script cleans the build target, create the Package folder, builds the VS solution, run Nunit test on two dll's, generate the NUnit report as an xml file, and run the migrations from Migrator.Net (that last part is not working yet, I will need to take a closer look at Migrator.Net command line args).

The most useful resource on Derik's post was Laribee's OMG Rake!. Laribee’s sample code and a few queries to Google was all I need. (No, I did not copy and paste ALL Laribee’s code, just use it as a reference)

Agile Zen or project management made easy.

I got a free account on Agile Zen the first week after they went live. I remember creating the account, playing around on the Board and leaving the site. My thoughts at the moment were something like. This is actually cool. Very nice design. Good usability. I should give it a proper test drive with some real project.

Of course, I never came back until last Friday. While working in a few features for Pronghorn I decided that it was time I stop spiking and started to write proper user stories to drive the framework. I remembered Agile Zen and went back.

The site looks great and there are some improvements since that last time I saw it.

What really amazed me is how intuitive the whole process is. There is no waste generated by using this tool. Creating stories is 1 click. Editing stories, another one. Color coding two clicks. Double click in a field to edit them, etc. Very easy, very intuitive. There is even a bar at the bottom with hints that I decided to hide and I didn’t miss it.

The site is very responsive and the only thing I miss is integration with a VCS system. They have a very simple API for paying accounts, but in the docs it looks like is read only, so no hooks in there (If anybody knows otherwise, please leave a comment).

I will keep using it for another week or so before making a final decision but so far everything indicates that I will be upgrading the account to a paying one pretty soon. (The free account only allows for one project and one developers, what is more than fair.)

Tying it up all together with CI.

As I mentioned before my main experience have been using CruiseControl.Net and Hudson as the CI servers. I installed TeamCity a long time ago to give it a try but I never use it. My first choice was to look for some hosted solution. After searching I only found a few and non of them worked with .Net (at least not at the moment).

I was going to go back once more with Hudson but I wasn’t able to connect to the Hudson site to download the code. (Their site is up now). So I decided to take a new look at JetBrain’s TeamCity. At the moment of this writing they are running the EAP for version 5.

I wanted to install it and use my newly crafted Rake build script with the .Net project and have my test report integrated in the dashboard.

First I got the msi from the daily builds for version 5.00. Double click on it to install the server and the agent and after a few minutes and two (three?) questions, the home page of the serve shows up in the browser.

Creating the first project and associated build profile was a breeze. I just followed along the instructions in the screen. A few times when I wasn’t sure what a given label meant, I made use of the contextual help.

I did have an issue but it was my fault when setting some relative path to the build file and the build target, for running test and creating the Package folder.

From downloading the installer to having the project building successfully took me between 10 to 15 minutes.

Conclusion.

This new setup makes me more productive since I have better tools that save me time in different areas like. Setting things up, working around their idiosyncrasies, configuration heavy or too verbose a language.

While this is a combination that works for me, yours may be completely different. The important part is to have tools that feel this roles and make sure that they are really working with and for you and not the other way around.

kick it on DotNetKicks.com Monday, November 16, 2009 12:26:55 AM (Eastern Standard Time, UTC-05:00) by Hernan Garcia #    Comments [1] - Trackback
Continuous Integration | Methodology | Programming | Testing | Tools
# Tuesday, November 10, 2009

The NoSql movement is  gaining more and more inertia. A year or two ago I took a look at CouchDb but this time I wanted to try MongoDB. I have been hearing a lot of nice things about MongoDB, mostly about how simple is to query it and how fast is. So I decided that it was time to actually take it for a spin.

A quick search point me to this odetocode post that was a great starting point to have Mongo running in my dev machine using the defaults and the Driver for C#. So, go and read K. Scott Allen’s post if you want to follow along with the code in the rest of this post.

Detour (some background on NoSql and MongoDB):

If you already know about this you can skip all this paragraph.

The so called NoSql movement is based on the notion that using RDBMS may not be the right choice in some cases. They propose using alternative databases, like key-value pair storages and document databases. To perform operations on the data some make use of Map-Reduce, others like MongoDB use a query mechanism that resembles Sql. One of the most attractive features of this db’s is the ability to easily run clusters and do data sharding. Most of them support both features without a lot of fuss, or that I heard.

MongoDB is a document based db, that stores the information as Binary Json.

End of detour.

What’s a document?

A document is not the equivalent to a Row. A document can be seen as a key-value pair collection of objects. It’s actually a complete object Graph, persisted as Json. Documents are organized into Collections.

Now, to be usable in C# we need to have some mapping from the Document object to our object graph. We could use the Document directly but will be like going back to use DataTables, not very pretty.

  1: var movieName = movie["Name"].ToString();
  2: var actors = JsonConvert.DeserializeObject<Dictionary<int,string>>(movie["Actors"].ToString());

The simple way to go from Json to an object should be to pass the load of a document to a JsonDeserializer like Json.Net and just get the object back, like this:

  1: var movie = JsonConvert.DeserializeObject<Movie>(document.ToString());

But while trying to do so I got an error in the id of the document. Looking at the paymoad of the document the Id looks like this:

  1: "_id": ObjectId("4eebf0006829c72c1d000000")

The problem is in the ObjectId function. But do not despair, there is an alternative.

From a document to a fully usable object graph.

The alternative is not pretty but works and is easy to implement. Just pass the document to the root of your object graph, an access the underlying collection via the objects properties. Let’s see how this can look like. (Note: Yes there are some hardcoded strings in there that should be removed. I’m also never closing the connection to the Db, when I probably should).

  1: using System;
  2: using System.Collections.Generic;
  3: using Newtonsoft.Json;
  4: using MongoDB.Driver;
  5: 
  6: public class Repository
  7: {
  8:     private Database _db;
  9: 
 10:     public Database Db()
 11:     {
 12:         if(_db != null) return _db;
 13:         var server = new Mongo();
 14:         server.Connect();
 15:         _db = server.getDB("DynamicProgrammer");
 16:         return _db;
 17:     }
 18: 
 19:     public void Insert(Document document, string collectionName)
 20:     {
 21:         var collection = Db().GetCollection(collectionName);
 22:         collection.Insert(document);
 23:     }
 24: 
 25:     public IEnumerable<TDocument> getListOf<TDocument>(string whereClause, string fromCollection) where TDocument : IMongoEntity
 26:     {
 27:         var docs = Db().GetCollection(fromCollection)
 28:             .Find(whereClause).Documents;     
 29:         return docsToCollection<TDocument>(docs);
 30: 
 31:     }
 32: 
 33:     private IEnumerable<TDocument> docsToCollection<TDocument>(IEnumerable<Document> documents) where TDocument : IMongoEntity
 34:     {
 35:         var list = new List<TDocument>();
 36:         var settings = new JsonSerializerSettings();
 37: 
 38:         foreach (var document in documents)
 39:         {
 40:             var docType = Activator.CreateInstance<TDocument>();
 41:             docType.InternalDocument = document;
 42:             list.Add(docType);
 43:         }
 44:         return list;
 45:     }
 46: 
 47: }
 48: 

IMongoEntity is a simple interface to force our entities to expose the Doc property.

  1: public interface IMongoEntity
  2: {
  3:     Document InternalDocument { get; set; }
  4: }
  5: 

And our Movie Entity will look like:

  1: public class Movie : IMongoEntity
  2: {
  3:     public string Name
  4:     {
  5:         get { return InternalDocument["Name"].ToString(); }
  6:         set { InternalDocument["Name"] = value; }
  7:     }
  8: 
  9:     public int ProductionYear
 10:     {
 11:         get { return (int)InternalDocument["Year"]; }
 12:         set { InternalDocument["Year"] = value; }
 13:     }
 14: 
 15:     public Dictionary<int, string> Actors
 16:     {
 17:         get { return JsonConvert.DeserializeObject<Dictionary<int, string>>(InternalDocument["Actors"].ToString()); }
 18:         set { InternalDocument["Actors"] = value; }
 19:     }
 20: 
 21:     public Document InternalDocument { get; set; }
 22: }

Notice I’m using JsonConverter to return a complex type, we should probably encapsulate that functionality in some kind of base class, maybe convert IMongoEntity into an abstract class that provides some basic utilities.

I will try to dig deeper into MongoDB, seems to be really suited to a Domain first approach. I wasn’t able to have anything but the most simple queries working, so I will have to take a closer look at the syntax.

kick it on DotNetKicks.com Tuesday, November 10, 2009 12:04:54 AM (Eastern Standard Time, UTC-05:00) by Hernan Garcia #    Comments [4] - Trackback
Programming | Tools
# Sunday, November 08, 2009
kick it on DotNetKicks.com Sunday, November 08, 2009 12:43:56 AM (Eastern Standard Time, UTC-05:00) by Hernan Garcia #    Comments [0] - Trackback

# Wednesday, October 28, 2009

The tag line of the book is refactor your wetware, and after reading it, you will.

Andy Hunt explores how the brain works and try to point us (the readers) into ways to improve our use of it.

For me the first five parts; Introduction, Journey from novice to expert, This is your brain, Get in your right mind and Debug your brain; is where I found the book most useful. This is not to say that the last four parts weren’t interesting, but for whatever the reason I took some effort on my part to concentrate and finish them.

The book had several a-ha moments. The Dreyfus model was specially interesting and the idea of carry around a pad to write any idea you may have has serve me well so far. (Note: My journalism teachers all insisted that we always carry a pad to take notes and make observations, but I never extended the practice as a developer.)

If you are into continuous improvement this is a book that you should read. I’m sure you will find some or all of it useful.

kick it on DotNetKicks.com Wednesday, October 28, 2009 4:31:00 AM (Eastern Standard Time, UTC-05:00) by Hernan Garcia #    Comments [0] - Trackback
Books
# Sunday, October 25, 2009

I got my tickets the first week the conference was announced, not really knowing what to expect but exited on the opportunity to learn new things and talk to people that work in other languages/technologies beside the .net world.

Once the sessions were announced my excitement decreased a little bit.

Friday morning was miserable in the weather department, so going to the conference was a nice proposition. I print my ticket, pack my laptop into the bag and took the TTC. I arrive a little after 8:00, the registration process was fast and everything was really well organized. There was coffee, water and muffins in the breakfast area. Good vibes in the air and a general feeling of excitement in the public. I crossed path with some faces I know from other similar gatherings while getting my second cup of java of the day.

After entering the auditorium Joel Spolsky addressed the audience with a key note about designing software products. He talk about how to make good products, the constant struggle between simplicity and features and how to achieve a balance. It was a vey interesting keynote.

The first session was on Asp.Net MVC, Joe DeVilla and Barry Gervin give us a good overview. Nothing knew to learn for me, but the presentation was good, and a lot of the developers in the audience weren’t .net developers.

After each brake, the conference resumed with some video from FogCreek, short but good, presenting some aspects of FogCreek or software development in general.

The other session I enjoyed and the one that justified the ticket price was the one by Greg Wilson. He is not just an excellent presenter but he also has something to say. He talked about doing scientific analysis of development methodologies and use real data to make decisions on what practices are really beneficial to our profession.

As a summary: one of five sessions + the keynote were relevant for me. For $99 it’s not bad value and I probably will go again next year if they decide to come back to T.O. Just hoping they rise the level of the sessions, maybe 2 at the 100 level, 2 at the 200 level and 1 at the 300 level.

kick it on DotNetKicks.com Sunday, October 25, 2009 8:14:02 PM (Eastern Standard Time, UTC-05:00) by Hernan Garcia #    Comments [0] - Trackback
General
# Thursday, October 15, 2009

Some time ago I heard about the intent of putting together a package manager for .net ala gems or pear. I wasn’t aware that this project was actually under way. The name of the project, Horn.

Please check the links in the project home page on how to get started with Horn. It’s very simple and actually works as promised. One thing you need to remember is that you will have to install a subversion client and a Git client for Horn to check out the source code from the projects you want to build.

I had two issues in my Win7 machine, where I tested. The first issue is related to Git really and not to Horn and/or Win7. Make sure that you have the path to your git.cmd into the PATH of your computer.

It’s usually %PROGRAMFILES%/Git/cmd, if you don’t when trying to do a horn –install on a project using Git, Windsor (the Ioc container used by Horn) will throw an exception.

The other issue seems to be a concurrency issue when trying to read a Temp file. Not sure how this files is been created just yet. This happens while trying to build complex projects like MvcContrib. Re-issuing the install command will “resume” the build. It took me three attempts to build MvcContrib.

Even with this issue (that may not be a Horn issue at all) I think that this is a very important project for the .Net community. It makes building this complex projects with all the dependencies a routine task. You don’t have to spend hours tracking down the project, the source code and pray that everything builds and works well together.

kick it on DotNetKicks.com Thursday, October 15, 2009 9:19:19 PM (Eastern Standard Time, UTC-05:00) by Hernan Garcia #    Comments [0] - Trackback
Frameworks | Programming | Tools
Add The Dynamic Programmer Mippin widget
Navigation
Archive
<January 2010>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456
What I'm reading
Shelfari: Book reviews on your book blog
About the author/Disclaimer
Hernan Garcia I have been a software developer for the last 16 years or so.
I was a journalist before and I still consider myself one.
Besides baseball, programming is my other big passion.

Me on twitter. @TheProgrammer
Certified Scrum Master
© Copyright 2010
Hernan Garcia
Sign In
Statistics
Total Posts: 197
This Year: 15
This Month: 1
This Week: 0
Comments: 70
Themes
Pick a theme:
All Content © 2010, Hernan Garcia