Craig Andrews

I'm a Senior Software Engineer. I work on quite a few cool projects (I'm especially fond of Java, Web 2.0, and things that are new to me). I'm also very much a Free Software enthusiast.

XMPP/Jabber: candrews@integralblue.com

AIM: molecularcraig

Posts written by Craig Andrews

March 26

“95% of software is developed by enterprises each year and is not for resale”

At the Open Source Business Conference in San Francisco on Tuesday, Jim Whitehurst (CEO of Red Hat) made a number of great points about Free Software and how it can help companies, including his own. According to Whitehurst, “95% of software is developed by enterprises each year and is not for resale.” Furthermore, he states that “there’s hundreds of billions of dollars of wasted [on] software assets each year.” These are truly astounding numbers!

And these numbers are not for just the “software” industry, for companies like Molecular - this applies to everyone from General Motors, to Aetna, to Aegis Media. The business world could literally save a few hundred billion dollars per year by making it’s software Free Software. This approach is the same one used by academia - if universities share research, there’s no need to reinvent the wheel. One common response to such suggestions to share information is that by sharing all this code/software, there will be less work to do, and therefore fewer workers required, so people will lose their jobs. This is clearly not true - in academia, there are no fewer researchers because of collaboration, there are still the same number - they just make progress faster by working on more interesting things. I could discuss points and counterpoints all day - but that’s what the comments are for.

I think companies should do just as Whitehurst suggests and Free their software, and I think he’s right to make Red Hat into a leader of such a movement. This movement to Freedom seems to be an industry trend - should Molecular and others follow suit? What do you think?

March 26

Windows, Java, and an Internationalization Mess

The project which I’m currently working on is a Java project, powered by Spring, built by Maven. I use Ubuntu/Linux to build and run the project locally, but everyone else on the team uses Windows XP. We recently got back a set of translations that included pages in Chinese, Japanese, Korean, and Russian - all languages with characters not included in ISO 8859-1.

The first issue we encountered was that Java will not read properties files (the standard key=value .properties format) in any character encoding except ISO 8859-1. So we converted all the .properties format files in XML properties files with the “<?xml version="1.0" encoding="UTF-8" ?>” declaration for the encoding. And all was well in the world (from my perspective at least).

I built and ran the project, and checked out some the (what I call at least) exotic language pages. I saw Cyrillic characters in Russian, so I was happy. But when someone built and ran the project on a Windows computer, they saw boxes and question marks.

The problem is in how Java handles files based on what the environment specifies. On my Ubuntu computer, my environment is for UTF-8, but on Windows, it’s set to cp1252 (an MS proprietary extension of ISO 8859-1). So when Maven copies files during the build process, Java re-encodes the files to cp1252, which results in lots of question marks and boxes and other such problems.

The solution is to add MAVEN_OPTS="-Dfile.encoding=UTF-8" to the environment before you run mvn. That overrides Java detecting Windows’ cp1252 encoding, and makes everything work.

Now can someone tell me how Windows doesn’t do UTF-8 natively, especially in a world with more speakers of these exotic languages than those with languages that can be expressed in cp1252?

March 14

Firefox 3 - making the web a little better

I’ve been using Firefox 3 betas for a few months now, through the really rough times when bookmarking was totally broken, up until the present day (Firefox 3.0b4 - click for a short review). It’s really been an impressive transformation, and I think that it will mark a very nice evolution in the web. It’s faster, uses less memory, more standards complaint, and has some cool features. All and all, I think Firefox is giving the proprietary RIA technologies (Sliverlight, Flash, etc) a run for their (very large amounts of) money.

The first thing someone who installs Firefox 3 will notice is the performance. You can browse around and things feel faster. Page transitions are quicker, clicking is more responsive, scripts run faster (the Javascript engine is now faster than those in IE, Safari, and Opera!) and after a lot of browsing around, the browser feels just as snappy as when you first opened it. I’m not saying that Firefox 2 was that bad - it’s just that 3 is better. Stuart Parmenter, a Firefox developer, has written about these improvements on his blog. The biggest effect from this will be a blow against the Flash/Silverlight systems, for performance is one argument for those systems over standards based AJAX applications. With Firefox 3, browsers become faster, reducing the performance argument.

The second thing is something a user probably won’t immediately notice, but a developer certainly will: Firefox 3 is more standards compliant. 3 passes Acid2, and introduces closer compliance to the CSS, Javascript, and HTML standards. I can just hear web developers (including the XDs at Molecular) rejoicing about getting that much closer to being able to make a site, and knowing that it will work the same in all compliant browsers - and having more browsers be more compliant. Remember when all sites had badges that said “This site works in IE only?” We’re getting farther and farther from those days.

Standards compliance is also critical in the open standards model of the browser in its battle with the proprietary model of Flash and Silverlight.One of the largest benefits touted for Flash/Silverlight is that you write your application once, and it will run anywhere where the Flash/Silverlight VM will run exactly the same way. Essentially, they have created their runtimes as the one and only “standards” - browsers have a much bigger challenge. But imagine if there had never been standards (such as if IE has truly won the browser war, and closed the HTML, CSS, and Javascript specs and replaced them with something like Silverlight). No web developers could have reverse engineered existing sites to figure out how they work and how to improve them. The Web 2.0 revolution wouldn’t have happened - for that matter, the .com boom would have never happened. That’s why I’m so excited about this supposedly boring topic of standards compliance!

The coolest new feature (IMHO) of Firefox 3 is the so called “Awesome Bar” - the location bar got hooked up with baseball’s steroids dealers. The “Awesome Bar” is “the much improved location bar autocomplete that unlike Firefox 2 which only looked for web addresses in my history, this one looks on visited and bookmarked page titles and tags along with web addresses.” For example, oftentimes I think to myself, “a little while ago I saw a great page about performance… but I can’t remember the URL. How do I find it?” With the new location bar, I simply type “performance” and relevant results show up, and I can click on the one I want. I can’t tell you how many times this has helped me find things that I thought were long since lost to the vastness of the Web.

One final notable thing I’d like to comment on is the native look and feel improvements made in this version. Previously, Firefox had it’s own look and feel - it used it’s own colors and icons. Starting in 3, Firefox will look as close to a regular application as possible, so it will feel a lot more familiar, and feel much easier to learn, on Windows (both XP and Vista), Mac, and Linux. New users should feel like they are already familiar with the application, because it feels just like every other application, and power users will appreciate how it seemlessly blends with their environment.

Is Firefox 3 revolutionary? No. But it is evolutionary. By being faster, more standards compliant, and introducing some cool new features, Firefox 3 improves the user experience of probably the world’s most common computer based activity. Start the countdown to the release!

February 7

Backslash - a URL pet peeve

Today, on the way to work, I was listening to NPR as usual in the car. I consider NPR to have very high quality, intelligent content - they even do their own commercials rather than have the company advertised for make the commercial as every other radio station does.

But, I digress. At one point, a commercial came on advertising some services company (I can’t remember, possibly a realtor?) . The announcer said, “visit us on the web at w-w-w dot something dot com backslash something.” Immediately, I was annoyed.

I can accept (although unhappily) that many people do not know the difference between a backslash and a forward slash (aka “slash“), and I can also accept that many people do not understand when to use one or the other. However, no URLs use backslashes in them - it is an illegal character! If you do enter a URL with a backslash into a web browser, it will return an error (Firefox reports “Firefox can’t find the server at www.something.com\something”). Advertisers should know this little tidbit of information. Not knowing it makes them look, quite frankly, as if they don’t know what they’re talking about. It also causes consumers who don’t know that the backslash is illegal and attempt to enter it into their browers to receive an error, causing the advertiser to lose a visitor to their site, and therefore a potential customer.

Why is this misuse so pervasive, even among the media services perceived as being more intellectual (such as NPR)?

January 28

Continuous integration and a light on my desk

A few months ago, I discovered the wonders of continuous integration. The idea behind continuous integration is very simple: when a commit is made (or every few minutes, but more often than daily), compile and test the code and perhaps do a few more things. Generally, you want your continuous integration builder to do its thing after every single commit. At this point, I can sense all the IS/IT people out there screaming “OMG! Too many resources!” And yes, it does take a lot of resources - a compile and test for a decent size project can take 10 minutes at full power on one of the servers here at Molecular. But continuous integration is most definitely worth the trouble!

When working on a large team (there are probably ~15 developers in diffferent areas working on the project I am on now), the repository can frequently be in an unstable state, meaning either the code does not compile, or the tests don’t pass so the thing doesn’t work. This can happen because someone forgets to commit a file (I’ve done that many times), someone makes a typo, or someone just doesn’t make sure the code works before they commit. Needless to say, it can be really annoying to update your local copy and start to work, then run into errors, only to find out you didn’t create them. Then, as an annoyed developer, you want to find someone to blame (and also to fix the situation so you can resume your work), so you email the everyone you suspect, or walk around the building. That adds up to a lot of lost productivity!

Continuous integration solves this problem by making sure that every commit in the repository results in a working, stable, tested build. If it doesn’t, the developer who broke the build gets a nasty automated email, and everyone else gets notified that the repository isn’t in a usable state. That way, the other developers know not to update their local code. Finally, when the problem is resolved, everyone gets an email saying things are a-okay again.

The value of continuous integration is proportional to the quality of the test cases the team writes. The more test cases, and the more code coverage, the more likely a bug will be caught and reported by the continuous integration system right after it is committed. This minimized regressions to almost nothing (assuming the team is really diligent with their test cases).

The CI server can also do other things besides build and test. In the case of my project, the artifacts are published to a central repository so others can grab them. For example, one component we built is an interface to Solr. Whenever the CI server builds the Solr interface project, it publishes the resultant jar file to our maven repository (Artficatory), so now the developers who depend on the Solr interface will automatically grab the latest snapshot, but do not need to compile it themselves, saving everyone time.

Another really cool thing you can do with a continuous integration server is generate documentation, and run bug scanners, as part of the build. My project generates javadoc, and runs Cobertura, PMD & CPD, and a host of other tools against the code, and publishes all this to a web site. Those tools do take a while to run - so developers tend not to run them too often. Having them as part of CI ensures that the latest documentation, code coverage, and bug suspects are always available.

Don’t let my Java example lead you to any premature conclusions - CI can be used for anything from Javascript to Haskell to C#. If you can build it from the command line, you can use CI (and even Visual Studio projects can be built from the command line now).

Finally, CI can be fun. I just hooked up an X10 remote control lighting kit I had laying around to a lamp I have sitting on my desk. Combine that with a ruby script, and in about 30 minutes (I spend 20 minutes finding a lamp), I setup a build status beacon in my cube. Presently it is on, indicating the build is broken… so I won’t be updating from the repository quite yet.

In case you were wondering, here at Molecular we use Hudson. It’s incredibly easy to install (drop the war into Tomcat, and you’re done), adding projects is quick and easy, and it supports Maven, Ant, msbuild, and ruby right in the web UI. This ease of administration and use is why I chose it over Continuum, for example.

With that, I heartily recommend CI for all projects. It’s very easy to set up, and well worth the small initial investment if you can avoid the common situation of developers running around searching for the person who broke the build.

Browse posts by month

Browse by author

We're hiring!

Come take a look at careers with Molecular