Monthly Archive 2016-02-20

ByMogens

Tababular

Sometimes it’s nice to be able to work with text, especially when you’re building command-line applications. I usually end up with a bunch of little text formatting helper methods, and recently I made one that could format a JSON array as a nice ASCII table.

I figured that this could be of use to other people as well, so I pulled it out, cleaned it up, added a few nifties, and made it into a NuGet package: Tababular (the code is on GitHub as usual).

First you

Install-Package Tababular -ProjectName YourProject

and then you can do this:

var objects = new[]
{
    new {FirstColumn = "r1", SecondColumn = "hej", ThirdColumn = "hej igen"},
    new {FirstColumn = "r2", SecondColumn = "hej", ThirdColumn = "hej igen"},
};

var text = tableFormatter.FormatObjects(objects);

Console.WriteLine(text);

which will give you something nice to look at:

===============================================
| FirstColumn  | SecondColumn  | ThirdColumn  |
===============================================
| r1           | hej           | hej igen     |
===============================================
| r2           | hej           | hej igen     |
===============================================

and that’s it 🙂

(although there’s a few nice details, like e.g. the ability to properly format multiple lines in cells, etc.)

ByMogens

Rebus FM and open source

It should come as no surprise that we love open source here at Rebus FM – after all, we are building our business around Rebus, which has always had pure open source pumping through its arteries.

We are doing other things too, which we plan to release on the rebus-org organization on GitHub.

If you are working with either Microsoft SQL Server or the excellent PostgreSQL in .NET, you might want to check out our latest addition to the org: Migr8.

Migr8 is a sweet database migration tool that allows for having migrations written as short and sweet scripts, either in C# code or as text files.

It is pretty unique because it supports parallel development of migrations, and thus is the perfect companion if you are working with a git-flow-like workflow where multiple branches are being developed at the same time.

Moreover, Migr8 has now been extended to support PostgreSQL – so, depending on which database you want to use, you can either

Install-Package Migr8 -ProjectName YourProject

or

Install-Package Migr8.Npgsql -ProjectName YourProject

and then start migrating that database.