Fair warning: I shamelessly stole this story from a colleague. Let’s call him Jimmy. He doesn’t have a web presence though, and I think it’s worth sharing.
Jimmy was working on a web application. This particular web application had a feature that only activated on a double-click. Don’t be too harsh on Jimmy; he didn’t have a choice in the matter. Sometimes, you have to do what you have to do.
Somehow, the ticket bounced back and forth between the two a few times with no suitable reproduction steps, and Jimmy was at his wit’s end. After several code re-writes and testing across both supported and unsupported browsers, Jimmy gave up and asked Sandra if he could see the problem in action. Once he found Sandra’s desk, he asked for a demonstration.
Sandra brought up the UI and found the feature in question. Jimmy was bristling with excitement, at least until he saw the problem. Sandra hovered her cursor over the button in the UI and clicked with fierce tenacity. A moment later, and no sooner, she clicked again, with equal tenacity. A wry grin must have crossed Jimmy’s face as he explained the difference to Sandra between a double-click and two clicks in succession.
If you learn nothing from my posts, learn these two lessons:
Never put a double-click event in a web app
Walk to the user’s desk to identify mysterious problems that only they seem to have
An application I work on utilizes DNS for important aspects of its functionality. The other day, I wrote a quick and dirty command line application to write zone files for a static set of domains. The app would allow a developer to double-click an .exe and set up a known set of domains in a local Bind instance for test purposes without having to know how or take any manual steps. It was a one-time-per-developer app so I didn’t put a lot of thought or time into it.
Or, at least, I didn’t mean to put a lot of time into it. I ran the executable which wrote the zone files, restarted Bind, and ran the following command in an already opened PowerShell terminal to verify that my test domains were being served by my local Bind instance.
PS C:\Bind\bin> ./dig @localhost ns1.dnstest.dev.local
; <<>> DiG 9.9.4-P2 <<>> ns1.dnstest.dev.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 45832
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;ns1.dnstest.dev.local. IN A
;; AUTHORITY SECTION:
dev.local. 3600 IN SOA dev-ad-01.dev.local. hostmaster.dev.local. 6876 900 600 86400 3600
;; Query time: 4 msec
;; SERVER: 10.0.5.2#53(10.0.5.2)
;; WHEN: Tue Feb 18 18:09:52 Central Standard Time 2014
;; MSG SIZE rcvd: 131
status: NXDOMAIN in the answer section of the response means the DNS query failed. What gives? Now, if you are a seasoned PowerShell user, you probably already see the problem. As a PowerShell novice at best, I did not.Read more »
I ran into an annoying problem the other day when working with a 3rd party library, mail.dll. You see, mail.dll exposes library methods for sending email messages to an SMTP server, functionality common enough that you should never have to write it yourself. While I’ve been pleased with its ability to perform SMTP conversations, I have not been impressed with its use of exceptions.
When the mail.dll SMTP library fails to connect or get a response from the SMTP server to which it is connecting, it throws a mail.dll-specific custom exception, SmtpResponseException. Likewise for the IMAP and POP3 libraries, if a failure happens during client interaction with the server, an ImapResponseException or Pop3ResponseException is thrown, respectively. Since, in the normal course of a properly configured mail client’s operation, the expectation is that the server will respond appropriately, I don’t have a problem with these libraries throwing exceptions. They are understood and can be handled by the consuming application.
Here’s the annoying bit. The custom exceptions thrown by mail.dll only have internal constructors and cannot be thrown outside of the mail.dll assembly. In this article, I’ll talk about why your library should not throw exceptions that the consuming code cannot throw itself and a workaround when someone else’s library does.
Silent failures are a programmer’s worst nightmare, and in a world where first class debuggers are few and far between, those silent failures are sure to drive us crazy. In the first half of this article, we discussed silent failures in MarkLogic due to XML namespace issues. XML namespace issues are going to crop up in any implementation of XQuery, though, so there are many resources to reference in addition to my article.
In the second (and last) part of the article, we’ll discuss a feature specific to MarkLogic’s XQuery implementation. This feature is called function mapping.
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.
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)
It's namespaces or function mapping.
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.
I’m also going to try to make it easier to use the code I post on here. Sure, with libraries with a specific purpose, it is usually easy to grab them off GitHub or BitBucket and integrate them into your project. Sometimes, though, I’ll post random snippets of code that can’t easily be integrated or tested without going through a lot of trouble. From now on, when I will try to be more proactive about writing the code in a way that you can download and execute it without having to do much additional setup. My goal is to put any code I write on the blog also on GitHub.
In addition to putting practically everything on GitHub, I am also going to make it easier to find posts that have code on GitHub. Any article that has code on GitHub will be filed with a GitHub tag. You can easily filter for posts that have code on GitHub by clicking the tag.
The last thing I want to say about SCM and social sharing sites is that I will not be sharing on BitBucket as part of this blog. I used BitBucket a couple of years ago when it was only offering Mercurial support and I was a Mercurial user. Nowadays, I am using Git more and more, and GitHub simply has more momentum as far as social coding that BitBucket does. It’s not that I don’t like BitBucket, it’s just not worth keeping track of code on both sites.
Links to my GitHub and BitBucket pages are in my links section in the right hand navigation bar, but here they are just in case:
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 »