Squashing git commits with interactive rebase

Sometimes, you’ll want to re-write the history of a feature branch so your repository isn’t cluttered before merging it into your mainline branch.  This is a simple tutorial about how to accomplish just that.  Watch in HD quality or it isn’t going to look very good.

Two reasons your MarkLogic code is failing silently, part 1

If you’re new to MarkLogic application programming, it’s easy to get frustrated when your code fails without any obvious reason why.  There’s no run-time error, no exception to catch, and when you surround the code block in question with log writing expressions, the “before” log expression and the “after” log expression both work perfectly.

Even now, excellent application developers are still making these same mistakes because they’re so easy to do if you aren’t paying perfect attention.

Coworker: Hey, can you look at this code and see if you know what’s wrong with it?

Me: (before he pastes the code into the IM window)

Me: namespaces or function mapping

Coworker: …

Coworker: Damnit.

[Read More]

Minor site changes and software sharing info

I’m making a couple of minor changes to the site.  In particular, I’m scrapping the WordPress idea of categories.  It had a hard time finding a categorization method that I liked, and even once I defined the categories, I usually wanted to file my posts into several categories even with the tagging mechanism.  So, instead of using categories at all, I’ll just tag articles with whatever topics are touched upon.  I think maintaining a list of tags is easier and makes more sense than maintaining a list of categories and tags when they’re going to be used basically the same way.  For the articles that have already been categorized, they’ll stay categorized.  I just won’t be adding any more categories and I won’t show the categories on the right-hand navigation either.

[Read More]

Oh, Bing, it's cute that you tried

But who really thought it could end up any other way? :)

Choosing Google over Bing

Lovin’ Bing’s bitter message about winning yada yada

Some friendly competition will do both search engines some good, so I invite you to Bing It On.

How Jenkins CI parses and displays jUnit output

Now that I’ve had the opportunity to work on a continuous integration infrastructure for both Mirth Connect interfaces and a MarkLogic-powered REST API.  The Mirth interface testing software was built with Perl and TAP (Test Anything Protocol).  The ML REST API testing software was built on MarkLogic itself.  What they both had in common is that Jenkins was used to build the environments and run the tests.

I’ve really come to appreciate how useful Jenkins can be.  Jenkins can aggregate jUnit style reports out of the box, and Jenkins can give you meaningful textual and graphical representations of those reports.  It will tell you how many tests failed, how many tests passed, what class and packages were being tested, and it give you this information over the course of many builds.

However, since neither CI testing software was actually built on Java, I was unable to leverage the actual jUnit testing framework.  In addition, neither the Mirth Connect interfaces nor MarkLogic/Xquery have a concept of grouping code into packages and classes as a Java programmer may expect. Because of these two issues, I had to generate jUnit output programmatically.  Even though I was able to start with someones stab at the jUnit XML schema, I found that Jenkins does not parse and display the jUnit output exactly as I would have expected.  For the time being, it is probably easier to ignore the jUnit schema and instead listen to what I’m about to say :)

[Read More]

Using jquery.bgpos.js with jQuery 1.8

Today, I spent way too much time working on a front-end problem to a code base that I wasn’t very familiar with. This project’s animated navigation menu stopped working when upgrading from jQuery 1.7 to jQuery 1.8, and we needed jQuery 1.8 because of another dependency. After digging my way through the code, I finally found that the problem was occurring because Alexander Farkas’ jquery.bgpos.js jQuery plugin was not compatible with jQuery 1. [Read More]

Big Data and how Isaac Asimov will have successfully predicted psychohistory

A couple of weeks ago, I had the opportunity to attend MarkLogic World 2012.  The overall theme of the conference was converting Big Data into Big Ideas.  Big Data is a paradigm shift for many in the IT industry; briefly, Big Data saves everything, whether it’s usefulness is obvious or not, in hopes that decisions can be made on that data.  In theory, the traditional data model would be unable to make informed decisions because the data set would not be large enough accurately describe super-complex issues.

Psychohistory, then, as defined by Isaac Asimov in his novel Foundation, goes something like this:

Branch of mathematics which deals with the reactions of human conglomerates to fixed social and economic stimuli; implicit in all these definitions is the assumption that the human conglomerate being dealt with is sufficiently large for valid statistical treatment.

[Read More]

Convert an integer to a sequence of digits in Xquery

I am new to the functional programming paradigm and Xquery. As part of a larger exercise, I wanted to sum the digits of an integer.  The first part of that problem is to solve the smaller problem: convert an integer to a sequence of integers that I can then pass to fn:sum as a parameter.

(: I've declared the function in the nwnu namespace for testing purposes :)
declare function nwnu:number-to-seq($num as xs:integer)
as xs:integer* {
  if($num gt 9) then
    (
      nwnu:number-to-seq(xs:integer(math:floor($num div 10))),
      xs:integer(math:floor($num mod 10))
    )
  else
    $num
};
[Read More]