DocuSign Connect XML Schema

For those of you that have developed for the DocuSign E-Signature platform, you’ll have probably used their DocuSign Connect service to listen for document and recipient events so you don’t have to long-poll their servers, which they strongly discourage. The example XML in their Connect documentation frustratingly does not have all of the possible values and fields that could come through with each request.

I decided to investigate this and came upon this StackOverflow Q&A that had a handy answer, which linked to the complete DocuSign Connect XML Schema as an XSD. You can find the XSD below:

DocuSign Connect XML Schema (XSD)

Print GitHub Markdown Bookmarklet

I was looking for a way to print GitHub markdown documents without all of the GitHub navigation, UI and other extraneous information showing up on the page. Mainly because I like GitHub’s clean markdown styles, and it’s very useful to be able to print documentation for certain projects.

All you need to do is add the following bookmarklet to your browser:

Here is a demonstration of what it does with the intridea/grape repo’s file (before and after):

Print Github Before

Print Github After

Could not successfully convert UCS-2 string to UTF-8

We were performing a massive data migration at work from MSSQL to MySQL using the Migration Wizard in MySQL Workbench. When performing the step that copied the data from one server to the other, we got the following error for some nvarchar columns:

Could not successfully convert UCS-2 string to UTF-8

Or alternatively, we also got Error during charset conversion of wstring: No error. This infuriating error took us an hour and a half to diagnose and work around. I finally stumbled upon this link to a bug on the MySQL bugs website relating to MySQL Workbench

The problem, it turns out, lays with Microsoft’s ODBC Drivers:

This bug is triggered due to improper UCS-2 strings being generated by Microsoft’s ODBC drivers.

And the solution is to select the FreeTDS ODBC Drivers in the first step of the migration wizard of MySQL Workbench. The migration then works perfectly with no further encoding complaints. I hope this helps someone else out with this frustrating problem!

FreeTDS ODBC Drivers

The SMS That Started It All

Today I want to show you the SMS that started it all and began my career as a software developer.


One day in October 2010 my manager and I sat down to discuss a database solution for our company. We had unsuccessfully tried to use another company’s solution for our business needs but found them lacking, and we were already running an Access database for some of our data. At this time I had no experience with databases whatsoever, not even the basics such as tables, columns and primary keys. Jacob wanted to gauge my interest in learning about databasing and Visual Basic so we could develop our own solution. Needless to say I was very keen. (more…)

Failed to build gem native extension on OSX Mavericks

When installing certain gems on Max OSX Mavericks you may run into some issues where either the gem install or bundle install command throws the error “Failed to build gem native extension”, usually in extconf.rb. This has happened specifically to me with the json and mysql2 gems. Some gems may work exactly as expected.

The reason for this odd behaviour is because in the latest release of XCode 5.1, Apple are treating any unknown command line options as errors. The XCode 5.1 release notes read:

“The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified. Projects using invalid compiler options will need to be changed to remove those options. To help ease that transition, the compiler will temporarily accept an option to downgrade the error to a warning: -Wno-error=unused-command-line-argument-hard-error-in-future”

What this means that if any gems use invalid command line arguments in their build or install process, the error “Failed to build gem native extension” will be thrown. As a temporary fix, you can try running either bundle install or gem install with the following argument, which downgrades the error to a warning:

This should clear up most errors. The fix is temporary because Apple have said they will be removing support for the argument in the future, which means any gems with invalid arguments will need to update their build commands.


This fix did not work when installing the mysql2 gem, I got the same error but it required an extra step to fix. I had to run the command brew install mysql. Afterwards I could just run bundle install and the problem was fixed!

Another Year, Another Redesign

We are in the future of 2014 and since it’s been about a year since I’ve changed this blog’s design, I thought time would be ripe to do it again! It’s taken me quite while longer than I would have like this time, but I have a good excuse for that in the form of the birth of my son Patrick Noel Allen Brennan!

I’ve based this design on themes I’ve seen for Octopress, with a large area to place more importance on the content of the blog. I’ve also added a sidebar back in because the site is now 100% width, with a focus on search. I’ve been using a great search plugin called Relevanssi that replaces the default WordPress search, and adds features like indexing, result weighting and search hit highlighting.

For the sidebar icons I used the Simple Icons at and once again I’ve used the excellent highlightjs for syntax highlighting of code snippets, for example on the JavaScript I used to highlight the currently selected page!

Let me know what you think! Here is a comparison of old vs. new!


New Design

Old Design

ContentResult or ViewResult Response Based on Context

In .NET MVC there are times where you may want to return either a ContentResult or ViewResult depending on the situation. For example you may want to return an application/json result for an API request but a structured view with timing information (such as when using MiniProfiler) when visiting the route in the browser.

I had to find out how to construct the different types of results separately first. The main properties that need to be set for a new ViewResult object are the ViewName and the ViewData. ViewData has a Model property where you can set the model that you would like to return with the view. The SimpleResponse model is a simple model that just has a JSON property that I use to display the JSON output of an API route in a nicely-formatted way.

For a ContentResult, you only need to set the content type and the content of the response. Because the API I am developing uses JSON responses, the content type is application/json; charset=UTF-8.

Now, we can put this all together into a practical example. Inside a class called APIResponse I have a method called Resolve.

Custom UTC DateTime Model Binding for MVC

When working with sending UTC DateTimes via HTTP POST to a .NET Web API or MVC route, the dates are converted by the model binder into the server’s local time format before being inserted into the database or being used for whatever you want. This is because .NET MVC handles DateTime Model Binding for HTTP POST and GET differently.

The initially surprising piece of information that it transpires that it actually matters whether you have set the HTTP method to be a GET or a POST.

There are perfectly valid reasons for this that are described in the article that this quote is from, but sometimes you want to keep the DateTimes as UTC to be inserted into the database over HTTP POST. Thankfully, this is fairly easy to do by implementing custom UTC DateTime model binding. (more…)