Archive for the ‘Programming’ Category

Largest palindromic long long int that is also the product of two integers

Just to practice my C skills I’ve begun doing the Project Euler exercises in that language. Project 4 asks what is the largest palindromic number that can be expressed as the product of two 3-digit numbers. The answer is 906609 = 993 x 913. Just for fun I modified my program to compute the largest [...]

Posted on June 2, 2009 at 11:28 am by lindelof · Permalink · Leave a comment
In: Programming · Tagged with: ,

Default welcome page with Tomcat and Spring MVC

In my professional development, I felt that I had always neglected the field of web aplication development. To correct this I’ve started a little side project with Spring MVC, a web application to help a Toastmasters club’s Vice-President Education with their duties. Between the official documentation and the Spring in Action book, I found the [...]

Posted on May 29, 2009 at 9:04 am by lindelof · Permalink · Leave a comment
In: Programming · Tagged with: , , , ,

Source code filtering with Maven

Today I searched for a Maven plugin that would filter some of my source files before compiling them. An equivalent to the resources plugin with filtering turned on, but for Java sources, that would replace occurences of, say, ${token.name} with somevalue wherever that string occurs in the source files. I could not find such a [...]

Posted on April 30, 2009 at 3:15 pm by lindelof · Permalink · One Comment
In: Programming · Tagged with: , , ,

Don’t unit test JavaBeans

Should unit tests cover JavaBeans just to get a higher code coverage? These days I am working on a payment processing application that exposes its main interface as a SOAP web service. The API requires the client to build a wrapper object that packages the information needed for processing, for instance, a credit-card debit authorization: [...]

Posted on April 7, 2009 at 12:59 pm by lindelof · Permalink · Leave a comment
In: Programming · Tagged with: , , , ,

Spring for structure, property files for parameters

Spring is a great framework for externalizing the object graph of your application. Typically you write an XML config file that defines a number of Java objects (or “beans“) and how they are supposed to relate to each others. For example, suppose you have a class ThermalNode whose instances need to hold a reference to, [...]

Posted on March 13, 2009 at 2:48 pm by lindelof · Permalink · Leave a comment
In: Programming · Tagged with: , ,

A unit test that Could. Not. Fail. (but did)

I am now convinced that even the most trivial pieces of code must be unit-tested. Recently I’ve been working on a Java implementation of a building thermal model. A textbook model with thermal nodes and thermal capacities and conductances between them. This is supposed to eventually become part of a generic testing harness for home [...]

Posted on February 17, 2009 at 1:16 pm by lindelof · Permalink · Leave a comment
In: Programming · Tagged with: , ,

Canonical data formats, middleware and GCC

These days I’m working on a middleware application that bridges a company’s ERP and its warehouses. The ERP posts messages in a given XML schema, our application reads these messages, transforms them into the schema understood by the warehouse management system, and uploads onthem on the warehouse’s FTP server. We use XSLT to transform messages [...]

Posted on January 26, 2009 at 9:26 am by lindelof · Permalink · Leave a comment
In: Programming, Tools · Tagged with: ,

Remotely editing files as root with Emacs

I often need to edit files on remote machines or on embedded devices, that is, machines without a monitor and on which a proper editor might not necessarily be installed. In the past that has always left me with the rather painful choice between vi and nano. Now I have never invested enough time in [...]

Posted on December 9, 2008 at 3:32 pm by lindelof · Permalink · Leave a comment
In: Programming, Tools

MATLAB, Java, Spring and dynamic classloading

I have sort of a love-hate relationship with MATLAB, and always had since I read its tutorial in January 2003. On one hand it’s a proprietary closed-source system, which in my book rules it out for any scientific work. My one and only encounter with a Mathworks sales representative did nothing to help my misgivings. [...]

Posted on November 28, 2008 at 3:58 pm by lindelof · Permalink · Leave a comment
In: Home automation, Programming

Schema validation with LXML on Ubuntu Hardy

LXML is an amazing Python module that picks up where the standard xml.dom(.minidom) left off. It’s basically a set of wrapper code around the libxml2 and libxslt libraries, and provides functionality missing in Python’s standard library, including XML validation and XPaths. On a project I’m currently working on I needed a good XML library for [...]

Posted on October 21, 2008 at 4:32 pm by lindelof · Permalink · Leave a comment
In: Programming, Tools