Monthly Archives: April 2010

Android: Odd Error in DefaultHttpClient

I’m working on a couple of projects that interact with REST api’s and consume JSON data and in doing so I use the DefaultHttpClient from apache, located in the Android framework. The Error Last night I was working on a project and kept getting this error: java.lang.IllegalStateException: Target host must not be null, or set…

Android: Escaping Strings in Eclipse

I’m in the middle of writing some unit tests (jUnit) and I’m testing that my parsing/etc is working correctly from a JSON data source. However, this HUGE JSON data structure needs to be escaped. I was spending about an hour escaping this complex JSON string until I said “screw it, there has to be a…

New TekPub Episode is Live

Episode 2 of my TekPub series, Introduction to Android is now live on TekPub.com! If you want a sneak peak at some of the material I cover in the series and you’re in the Midwest area come on by my Developing for Android session at the Iowa Code Camp this Saturday.

MVC: Unit Testing Action Filters

Certain parts of ASP.NET MVC can be a real pain to test. Namely Model Binders, Action Filters and anything that relies on some magic “Context” that seems to derive from HttpContext, ControllerContext, RequestContext, etc. Below, I’ve outlined how I’ve unit tested a Action Filter. You could extrapolate some of this code into a base Test…

jQuery Tip: Brute Force Dirty Form Detection

If you disable your “save” button on your MVC views when the page first loads and want them to be auto-enabled when any input on the form changes, you can do that with the following jQuery snippet. This is sort of a hack*, but it works. With this HTML and this javascript: You’ll “enable” the…