May 102015
 

EDIT – This post was written for mocking a Netty 3.x server. For mocking a Netty 4.0 server, see this post.

While working on an app with my current job, I wound up touching some code that didn’t have any unit tests associated with it. Since we’re a small team (but growing), any automation in testing really helps (not to mention just being a good thing to do). The issue was the code was all in a request handler for a Netty server, which meant I needed a way of either running a Netty server during the Maven build process, or I needed to simulate 1 via some type of mocking library. Ultimately, I settled on the latter. Here’s how I did, and the things I learned along the way.

Continue reading »

 Posted by at 4:20 PM
Feb 072015
 

Pretty much everybody in the developed world (and most of the developing world) interacts with Facebook as an application. Not many people have to actually deal with Facebook from an API level. I’ve spent a few months writing some code that tries to perform a few simple tasks on Facebook, and it’s been rough. Here’s a random collection of things I’ve learned, gotchas, and other points worth noting in the process. As a brief point of reference, most of my interaction with Facebook comes from the server-side code, written in Java, although I’ve played around with Facebook’s JavaScript SDK as well.

Continue reading »

 Posted by at 3:31 PM
Nov 072014
 

1 of the last projects I worked on at my previous job involved aggregating, storing, and querying log data into and from Elasticsearch (yes, I know that Logstash does that – and in reality I should have gone that route). That, along with some lookups on the data outside of the code, gave me a chance to start playing with Elasticsearch. After my brief experience with it, I can tell you there’s a lot of power in Elasticsesarch, but it’s going to take you a surprisingly longer to figure out how to tap it than you would expect. Continue reading »

 Posted by at 12:28 PM
Apr 262014
 

Read any technical blog post that gives a deep dive into fixing any type of issue, and 1 thing you notice fairly quickly is that going through the logs is an important part of the process. Debug issues in any application you’re working on, and 1 thing you notice fairly quickly is whether or not your logs are any good. It’s a distinction that can make all the difference when the question of “What the deuce just happened?” rears its ugly head. Better logging can make your life easier, largely by telling you all about the state of what’s going on in your code so you can spend your time actually fixing and updating things instead of running down just what is going on in the first place.

Continue reading »

 Posted by at 10:44 PM
Mar 252014
 

I spend a lot of time at work on a read-only RESTful API. A little bit of big picture here, the company I work for, Digitalsmiths, builds the data delivery APIs for TMS (they provide most of the scheduling data you see when you “Guide” on your TV remote). This is powered by Digitalsmiths’s own APIs. Basically what happens is that the TMS API is a front-end for our own API. Calls come in, we build queries for our own API, and query said own API, process the results and then return the appropriate data. When the API was first written, the data covered just the US and Canada. As TMS expanded started to cover other countries, that data grew, and with that has come some growing pains. Continue reading »

 Posted by at 1:14 AM
Nov 232012
 

While perusing the Internet, I stumbled on some question about getters and setters and why people are supposed to use them (which of course I can’t find the link to now, even with the help of the might Google). After reading the question, I realized something. Holy crap, a lot of getter/setter examples on the Internet aren’t that good. Most of the tutorials on getters and setters talk about variable visibility, and you don’t get any real useful discussion about how to use them properly outside of technical forums or discussion boards. So, I thought I’d write a quick little guide on the topic in part to increase the number of useful pages on the topic out there on the Internet, and thus make it easier to find a good reference on the matter. Continue reading »

 Posted by at 3:26 PM