My RubyGem Release Workflow

When going through and doing a release for ruby_odata, I had a workflow problem that resulted in extra, unneeded, work. I originally posed the question going on three years ago now (wow). You’d think I would remember the solution, but I find that I keep looking for my StackOverflow post where I answered my own question. I figured that was a sign that I should add to the Visoft blog. Before we get to the problem, here’s my basic release workflow for my RubyGems.

Git, Bundler, and RubyGems

I use git for source control whenever I can. The project that I was working on was ruby_odata, my Ruby “wrapper” to interface with Microsoft OData Services. I used to be a huge Microsoft “fanboy” as you know, and have turned very critical of them as of a few years ago. That said, OData Services is really a pretty cool thing. It was magical to be able to have an Entity Framework model, and easy expose it over the web by just adding one service file. Sorry, I digress.

Ok, where were we? Oh yes, git. In addition to git, I like using @nvie‘s gitflow. It makes branching fun. It’s a simple tool, that allows you to issue commands like git flow release start v0.1.6 and that will start a new git branch, and change you over to that release branch. You make all of your changes, checking them in as you go along, then you can run git flow release finish v0.1.6 and gitflow will add a tag of v0.1.6 and merge everything into your master and develop branches. Nothing you couldn’t do manually of course, but gitflow makes it a snap.

Finally, to release my gem, Bundler has made RubyGems even easier to manage and deploy. I would just need to run the command rake release, and off my gem goes to Or did it?

Duplicate Git Tags

Whoops, there is a problem. The rake release command goes and tries to tag your git repository with the same tag that gitflow added, resulting in a conflict. I initially just deleted the git tag manually, and then did the release again, this time, successfully. That’s a pain, there must be a better way

Hunting I went for an answer, so I turned to StackOverflow. In the end, answering my own question. Sometimes it pays to RTFM :)

My Work(git)flow

git flow release start v0.1.6
git flow release finish -n v0.1.6 
git checkout master
rake release

The -n command-line argument tells git-flow not to tag the branch, so when you do a rake release, it will be tagged correctly.

Lights, Camera, ActionBlock!

The TPL Dataflow library available from the NuGet Package Manager is a great way to manage in memory asynchronous data processing. It’s especially useful in producer/consumer situations because it greatly simplifies the amount of ceremonious code required to manage and synchronize multiple asynchronous processes happening in parallel. Last but not least, the library is written on top of the Task Parallel Library introduced in .NET 4.0, so it makes judicious use of Task and Task<T>, which as of .NET 4.5 can be awaited using the new async/await keywords. You could just say that it’s awesome-sauce in a NuGet Package. While the library offers a number of classes that have different specialties, there is one class that I believe to be the rockstar of the group: ActionBlock<T>.

ActionBlock Jackson

Basically the ActionBlock class takes in an Action<T>, which will serve as the code that will be run for every item passed to the block. So if I wanted to email “Hello” to a number of email addresses, I can represent that like so:

var emailer = new ActionBlock(email =>
                using (var smtpClient = new SmtpClient("myhostserver"))
                    var message = new MailMessage
                        From = new MailAddress(""),
                        Subject = "Hi",
                        Body = String.Format("Hello {0}!", email)
                    message.To.Add(new MailAddress(email));

Here I’m defining my ActionBlock and passing in an anonymous delegate that will send an email to the provided email address. After the block is initialized, I can call the Post method to send items into the block to be processed. The Post method is synchronous and returns a boolean that indicates whether the item was accepted by the block for processing. If you want to send data to the ActionBlock asynchronously you can call the SendAsync method, which returns a Task<bool>, and await it’s return. When we’re done posting data to the ActionBlock and we don’t expect to post any more, we call the Complete method on the ActionBlock. This method indicates that no more data will be posted and allows the ActionBlock to finish up any running threads and end itself gracefully.
Continue reading

You Have Chosen Poorly – MaxLength vs StringLength

You Have Chosen Poorly
Are you using Entity Framework and ASP.NET MVC along with client side validations? Are you trying to restrict the length of a string only to find that you client side validation isn’t working? Me too, and there is a solution!

MaxLength Atribute

In a recent project, we are using ASP.NET MVC 5 and Entity Framework 6 (EF for short). We are using Code First along with EF Migrations to update our underlying SQL database. We use Data Annotations throughout the project. A reoccurring pattern for many of our properties looked like this:

public string Name { get; set; }

Our goal here is to obviously require a Name value and to limit the length to 30 characters. This results in an EF migration entry that looks like this:

    c => new
            Name = c.String(nullable: false, maxLength: 30),
              ... Other Properties ... 

From an Entity Framework and EF Migration point of view this is exactly what we wanted.

Now flip to our client experience with ASP.NET MVC. For our Views, we often use shared templates to generate our forms. This uses the ModelMetadata to build the form. For the Name property, we generate an input plus a span for our validation messages, using the Html.Editor and Html.ValidationMessage helpers. It yields your average label and input combo in the UI (Figure 01).

Figure 01: The Name input Field

Figure 01: The Generated Name input Field

Continue reading

SSMS and the IntelliSense Red Squiggle Mess

Have you ever been writing a bunch of SQL code in SQL Server Management Studio (SSMS), only to have the query editor put a red, squiggly line underneath a table, column, view, procedure or any other object that you know exists? Of course, that red, squiggly line means that IntelliSense is not recognizing that object, thus it will also not appear in your auto-complete pop-ups either. If you too have come across this, it is likely that the object has been newly created or modified since you last opened SSMS.

I have known about this issue for years, but have just ignored it up to now. Luckily for us, there is a simple solution. Though I try not to rely on IntelliSense anyways, I decided to take to Google and see if I could figure out how to fix this problem without restarting SSMS. The answer lies in the cache.


The other day I created a new table in my database. I ran the script, checked in the Object Explorer to make sure it was created properly, then started writing Stored Procedures against it. It became quickly apparent that IntelliSense was not recognizing my table, as illustrated below:

Figure 1: Bad Code Before Refresh

Figure 1: Bad Code Before Refresh

My scripts would still run and execute fine, as the table did actually exist, but IntelliSense can make it easy to double-check yourself when writing code. Recognizing that it was an IntelliSense issue, I searched for solutions.
Continue reading

Visual Studio Extensions Update Hell

This post is a rant about the Visual Studio Extension update process. It’s one of those things that I think we all get annoyed with, right? Well, maybe it’s just me. Anyway, let’s look at how the Extension update experience in Visual Studio can be fixed.

Let me start by apologizing to Microsoft and the Visual Studio team, I’ve gotten to the point of being fed up with the process so I found it therapeutic to rant about the experience. My goal here is to improve the software that I use day in and day out.

Begin Rant

First off, in a world of “Automatic Updates” and “Upgrade All” buttons, why aren’t there similar options when updating VS extensions? Having to click each item in the Upgrade list and go through two or three windows to have the update installed is annoying. One fix here would be a list where you could “check” the updates you wanted to install, and then click once to have them all installed.

As you’ll see in the next section that describes the current process, those annoying windows are modal, meaning you can’t do anything with Visual Studio until the extensions are installed, and you can’t even use the extensions until restarting Visual Studio. What a way to kill productivity. Grrrrr…

Continue reading