Betamax Testing with Java 8

Betamax is a useful testing library as it combines elements of integration and unit testing. The library runs a MITM proxy that will record, and playback any requests that run through it, allowing you to capture an API call with well-known data and then later allow you to continually play back the recorded response so you do not have to deal with getting your external source in a known state. However, during my initial work and subsequent attempts to integrate Betamax into my project, I’ve run into some issues around mismatches in library versions, issues recording HTTPS calls, and other assorted issues that represent hell to a developer. After much digging, I’ve gotten Betamax working for all of my use cases. For the impatient, I’ve also included a GitHub sample project, just clone and run gradle test. Enjoy.

Continue reading Betamax Testing with Java 8

IntelliJ Databases for Easy DBUnit Configurations

I use DBUnit for integration tests – It’s the biggest bang for my buck in terms of test coverage and ease. For the unitiated, DBUnit uses an XML schema to populate your database with test data, and can provide cleanup and assertions for the state of your database. Nifty. My only hangup is writing out verbose XML schemas. Given that your workflow surely involves a database already initiated with data for testing and developing against, why not just pull out that data to use for your test cases?

Continue reading IntelliJ Databases for Easy DBUnit Configurations

Play! & IntelliJ Configurations

These are just some notes I’ve thrown together for setting up a new Play! framework project with IntelliJ. There are a few minor “gotchas” or minor details that I did not find up to snuff. The built-in command play idea works pretty-damned well at setting everything one would need, but it gets some little details wrong. Some of the following is general to Play’s generation of a new application, while the latter portion is specific to it’s integration with IntelliJ. Do note that I have written this guide against version Play! 2.2.1 and sbt 0.13.0 so things could be different depending on where you are.

Continue reading Play! & IntelliJ Configurations

Removing DD-WRT from Netgear WNDR3700

As luck would have it, my Netgear WNDR3700 crapped out in fun way: my download speed became 0.01Mbps. After trying everything I could think of, including getting an RMA from Netgear, I decided to give DD-WRT a shot to see if it might help fix the problem. Did it? Nope.

So I’m going to be returning the router to Netgear and hopefully will be getting a shiny new router back, but I don’t quite think having non-factory firmware looks good, so I needed to flash the original firmware back onto the router. Despite simply uploading a CHK file into the Netgear’s web based UI to switch to DD-WRT, it is a real pain in the ass to switch back.

Continue reading Removing DD-WRT from Netgear WNDR3700

Android Annotations & IntelliJ

So after reading skimming Pro Android 4 and concluding that the default Android way of doing things is pretty asinine (though I get why it is the way it is) and doesn’t belong in the year 2013, I too a look into libraries and tools to make things nicer. Long story short, I found Android Annotations and fell in love with it. Combine that with the Android app we have at work using it, thus giving me a nice example of everything I could need, I got to work. However setting things up in IntelliJ was a bit more of a pain than I bargained for.

Continue reading Android Annotations & IntelliJ

Genymotion with IntelliJ

So there is this great tool out there called Genymotion, which provides an extremely fast Android emulator. I started to learn Android development about a month ago and quit as soon as I fired up the emulator. Having seen Genymotion on Hacker News, I decided to try it out and dayyyyuuumm does it solve the speed issue. My only hangup was getting things working with IntelliJ. Given that it doesn’t use a traditional AVD, you have to do some configuration to use Genymotion. Down the rabbit hole we go…

Continue reading Genymotion with IntelliJ

Response Headers and Chrome Extensions

So I just got around to releasing the Header Editor version 2.0.0 Chrome extension. It’s fancy! Somehow I missed the fact that there are request and response headers to be modified, so after a little hacking around you can now edit the response headers as well.

Now for those of you like me, who check everything in the Chrome request inspector, you’ll notice that the response headers do not show up in the list of response headers. You probably think “Well shit, that’s a bug there ain’t it?”, and you’d be right.

Continue reading Response Headers and Chrome Extensions

Travis CI and Tabs

I caught the NodeJS bug a few days ago, and have started working on my first module. Being the good software “engineer” that I am, I decided to add testing to my module to give anyone using it that warm tingly feeling because they know the software is high quality shit. Since I’ve already started down the hipster path, I decided to try out that Travis CI thing I keep seeing over on good ol’ GitHub.

So setting up a basic .travis.yml file for Node is pretty simple. It basically looks like this:

language: node_js
	- "0.11"
	- "0.10"
	- "0.8"
	- "0.6"

Continue reading Travis CI and Tabs

Switching WordPress Themes by Name (or Anything, Maybe)

I’m going to preface this one with this: I HATE WordPress. Kinda. From a user’s standpoint it’s not really all that bad. I’ll go out on a limb and say it’s marginally nice. From a programmer’s standpoint? I’d like to see the WordPress developers strung up by their thumbs. Ouch.┬áTo quote myself on Twitter

“Every time I work with WordPress, I reaffirm my belief that the WP devs really just are a programming troll collective.”

From time to time I’ll run into fun little things like WordPress inserting <p> and <br /> tags into my code text (apparently it’s text now, whatever WordPress…).

Continue reading Switching WordPress Themes by Name (or Anything, Maybe)

Chrome Extension Library

If you’re working on a Chrome Extension inside of one of those fancy IDEs, you may just want to be able to get those nifty features such as auto-completion and error checking. Luckily, the folks working on Google’s Closure Compiler are kind enough to have a mock library, chrome_extension.js. Just add this file to your IDE of choice as a library, and you’re good to go.