Skip to main content

Posts

Showing posts from April, 2013

Integrating LESS and Maven

When working on your local workstation, running a local instance of your website is very helpful. I often create two scripts to move code from my development workspace into the local website instance. One takes the war file outputted by Maven and publishes it. The second takes all of my static content and publishes it bypassing Maven, which is much faster than building and deploying the war file. When integrating CSS preprocessors into the workflow, I need to make sure they run in both deployment scripts. Here are the requirements for running CSS preprpceasors in my build process: The preprocessors need to run as part of the Maven build so my compiled files make it into the war file. The preproceasors should be run when I deploy just the static resources to my local instance. I am going to walk through installing and integrating LESS, but the concept is similar for other tools like compression or inspections. First I need to install LESS. I am running Ubuntu, so I can simply use

The Joy of Debugging

For a long while now, my demo transit application hasn't been picking up new articles from the web - leaving the home page looking quite stale between deployments. Earlier this week I added extra logging to capture counts of different kinds of articles, and noticed this morning that new articles were only found the first time the parsers run. After reviewing the simple logic for determining which articles are new, I noticed the cache implementation problem. I had implemented a crude cache using a hash map, but apparently forgot to write the cache expiration logic. When the parsers went to look at news listing pages, the cache was returning a stale block of content rather than fetching the new content from the internet. I was so sure I wrote that expiration logic! So things are all fixed up and I'm going to be verifying the fix over the next few days. Nothing quite beats the feeling of finding a simple explanation for a pesky bug.

Defensive System Integration

A big part of my current job is getting different systems to work together and sometimes to work in a way not entirely intended by the original authors. For example, getting a SSO server to share account data with a CRM platform, or getting any "enterprise" system to have a reasonable user interface (enterprise software is always ugly by default). One important consideration is how much I trust the system I am working to integrate: it's more work to be paranoid, but sometimes the software is  out to get you. I tend to trust popular open source libraries, such as those included in the Apache family like Lucene, Hadoop or Cassandra. Level of activity is an important indicator of a high quality open source project. I also tend to trust self-contained libraries more than external services, since many network and availability failure modes just don't apply when code runs in the same runtime as my own application logic. Conversely, I distrust closed vendor systems and