Archive for February, 2010

The Easiest Way to Organize Zimbra Email

February 26th, 2010

If you’re like me, receiving 30-40 emails is par for the day. Because Source Allies provides consulting services for companies wishing to implement or better take advantage of Zimbra, it is also the mail server we use at our company. Zimbra has incredible search capabilities, but my OCD tendencies still require that my email is nicely filed away in it’s designated folder. However, if statisticians say we spend an average of 3 years of our lives waiting at red stop lights, I certainly don’t want to spent that much time or more, dragging emails from my inbox into my IMAP folders.

This blog post lets you manage all of your email in OCD detail, with just (2) keyboard shortcuts: u and s. » Read more: The Easiest Way to Organize Zimbra Email

Siri

February 24th, 2010

Siri, which debuted last week, is surely the first iPhone app that’s the commercialized result of a multimillion-dollar Defense Department research project. It’s a “virtual personal assistant” that uses voice recognition, your GPS location, and links to local information and services to respond to requests you speak into an iPhone 3GS.

You can ask Siri to call you a taxi, or to reserve a table at the best nearby sushi joint, or to tell you who’s playing at a local concert venue. The voice-recognition part works just about perfectly. And it all feels like a sneak preview of how we’ll get and use information in the future, even though I’m occasionally disappointed by the results (Siri occasionally recommends local businesses based on skimpy data.)

Java EE 6 and Scala

February 22nd, 2010

Last weekend while pondering the question “Is Scala ready for the enterprise?” I decided to write a simple Java EE 6 app entirely in Scala, without using any Java. I had three main reasons for doing this: one was just to see how easy/difficult it would be to write everything in Scala (it was easy).  Another was to document the process for others journeying down the same road (the entire project is on github).  Finally, I wanted to identify advantages of using Scala instead of Java that are specific to Java EE apps (I found several).
» Read more: Java EE 6 and Scala

Running a Technical Book Club – Take 1

February 18th, 2010

Last year I coordinated a technical book club here at Source Allies. This was my first experience doing one and I wanted to share my experience for the benefit of others who may be looking at starting one.

The fact that we even started a book club was a big positive because it is one great way to geek out with very smart people. You get the opportunity to voice your opinion on a certain topic and hear counter-points or similar views that expand your own perspective. » Read more: Running a Technical Book Club – Take 1

Ubuntu Live Network Boot using PXE

February 16th, 2010

Requirements

  • Linux server with NFS (or compatible)
  • TFTP server
  • DHCP server
  • syslinux / pxelinux files

To simplify these instructions we are going to make the following assumptions.

  • DHCP server is 10.0.0.2
  • TFTP server is 10.0.0.3
  • NFS is a Ubuntu server at 10.0.0.4

In reality it’s likely your TFTP and NFS server are going to be the same server, however because we go by IP in this, it is hopefully easier to understand.
» Read more: Ubuntu Live Network Boot using PXE

Replacing and Patching Java Application and Core classes

February 15th, 2010

Why would you ever need that?

Say you get a jar file. After using the jar for a while you realise that there is a bug in a class in the jar file. Unfortunately you also find out that the jar is no longer supported and there is no way you will get a fix from the author (who is long gone fishing).

In order to solve this issue, you first need to get the source of the class. If you are lucky enough and the author did not obfuscate the class file you can decompile it with a decompiler (my favourite one is JD-GUI).

» Read more: Replacing and Patching Java Application and Core classes

IP Addresses in PHP/MySQL

February 12th, 2010

I’ve been working on a web-based tool that stores, among other network-related things, IP addresses. When I first started I stored each IP address as four TINYINTS (0-255 for each octet):

mysql> DESC ipaddresses;
+----------+---------------------+------+-----+---------+----------------+
| FIELD    | Type                | NULL | KEY | DEFAULT | Extra          |
+----------+---------------------+------+-----+---------+----------------+
| id       | int(10) UNSIGNED    | NO   | PRI | NULL    | AUTO_INCREMENT | 
| A        | tinyint(3) UNSIGNED | NO   |     | NULL    |                | 
| B        | tinyint(3) UNSIGNED | NO   |     | NULL    |                | 
| C        | tinyint(3) UNSIGNED | NO   |     | NULL    |                | 
| D        | tinyint(3) UNSIGNED | NO   |     | NULL    |                | 
+----------+---------------------+------+-----+---------+----------------+
5 rows IN SET (0.00 sec)
 
mysql> SELECT * FROM ipaddresses WHERE id=1
+----+----+----+----+-----+
| id | A  | B  | C  | D   |
+----+----+----+----+-----+
|  1 | 10 | 20 | 30 | 131 |
+----+----+----+----+-----+
1 row IN SET (0.02 sec)

As I started manipulating these addresses I found it awkward to do common binary math (like bitwise ANDs). I decided instead to store these 32-bit values as unsigned integers (of length 32). To make my life easier yet, MySQL and PHP both have native functions to convert IP addresses between my old and new formats to make this migration extremely easy.
» Read more: IP Addresses in PHP/MySQL

Taking Advantage of Spring MVC’s Default Behavior

February 11th, 2010

Over the last several months I have worked on several content heavy websites for one of our clients. When I say “content heavy”, I mean that 80%-90% of the pages in the application are static, or at least mostly static, a customer name, membership number, etc may need to be floated in, but not big data tables with dynamic data being pulled from the database. The marketing department manages this content with their content management system and publish fully formed HTML pages (layout, look and feel, etc is controlled in the CMS) which are then pulled into our /WEB-INF/jsp/content directory by our build process.

Our applications treat these HTML pages as JSPs (simple rename in the build script). This lets the marketing team work from a cheat sheet of EL expressions such as ${customerName} and keeps the IT department out of the day to day content management work. One of our goals with these systems was to easily and seamlessly deal with both static pages and very dynamic pages requiring custom controllers to be built. With just a little bit of work Spring MVC makes it easy to provide this functionality and also provides a sane set of defaults for building out these web sites one page at a time.
» Read more: Taking Advantage of Spring MVC’s Default Behavior

A Modern Parable

February 10th, 2010

I recently ran across the following article on a blog:

A Japanese company (Toyota) and an American company (General Motors) decided to have a canoe race on the Missouri River. Both teams practiced long and hard to reach their peak performance before the race. On the big day, the Japanese won by a mile.
» Read more: A Modern Parable

Sonar – Code Quality Analysis Tool

February 9th, 2010

What is Sonar?

Sonar is a web based code quality analysis tool for Maven based Java projects. It covers a wide area of code quality check points which include: Architecture & Design, Complexity, Duplications, Coding Rules, Potential Bugs, Unit Test etc. Sonar has a rich set of features like what you would get with different tools such as Covertura, PMD, FindBugs, Check Styles combined.

http://sonar.codehaus.org/

Setting up Sonar