Archive for the ‘Software Development’ Category.

Contemporary LaTeX Resource

I am currently using LaTeX to produce PDF output for a multilingual (polish characters anyone) business application. I hope to write a proper post about this once I am done. But I have to post the url of this blog which deals with doing nice contemporary typesetting with LaTeX.

The Gospel

Today’s lesson is from the book of stackoverflow 65,35-21:

It’s a well known fact, that Oracle treats empty strings as null.

I knew about that, but somehow I forgot…

The Train Build Monitor

On our current project we came up with a model train build monitor. The objective was to have the train move, while the build is green and to stop, when it goes red. The whole thing looks some what like this:

As a USB interface we chose to go for the Velleman K8055, which is available for about forty pounds and provides eight digital and two analogue outputs as well as two analogue and five digital inputs. The analogue outputs are provided as pwm signal.
The outputs are all open-collectors. Being a good developer I did of course anticipate a few more use-cases and hence designed the controller, so we could actually control the speed as well as the direction in which the train in moving. Essentially it uses a transistor to switch the train (using the pwm) and a relay to reverse the direction (yes this is somewhat lame). Also there is two free-wheeling diodes to protect the electronics from the high inductivity of the relay and the trains motor. This is the circuit diagram of the controller that goes between the K8055 and the train:

The K0855-board ships with a DLL to control the IO. Apparently there is a linux driver, which is much better than the windows version, but we are in a bit of a windows shop, so we went with the DLL. It turned out wrapping a DLL in a ruby script is fairly trivial:

require 'Win32API'
 
open = Win32API.new("K8055D", "OpenDevice", ['L'] , 'L')
outputAnalog = Win32API.new("K8055D", "OutputAnalogChannel", ['L','L'],'V')
outputDigital = Win32API.new("K8055D", "WriteAllDigital", ['L'],'V')
inputDigital = Win32API.new("K8055D", "ReadAllDigital", [],'L')
 
open.Call(0)
 
outputAnalog.Call(1, 10) # setting DA channel 1 to 10
outputDigital.Call(128)    # reversing

Future plans include figuring out where the train currently is to stop in the station. The original plan was to use a reed switch, but that proved to be a bit unreliable, so the current thinking involves using a camera and something like hornetseye to get the exact position of the train.

Not exactly a consultant hat…

…but still a valuable addition to my professional wardrobe. That helps me being mindful of what I am and what I am not.

13119585-19215581

What’s missing in Java 7

Assuming Sun manages to get “closures” into Java7 there is still a few things that are lacking. Today I once again ran into the restrictions around annotations. The .Net solution is simply more elegant. The fact that I can’t use arbitrary classes for annotation parameters is arbitrary and promotes widespread abuse of enums. Also that these guys aren’t regular classes with methods and all is quite annoying.

Using arbitrary classes as annotations would actually make the language simpler and is therefore good…

Documentation on Presentation Model Pattern

Here some links to the pdf and the sourcesfor my tutorial.

Deploying on Windows

I spent the best part of this week on doing remote deployments to a jboss server running on Windows. Don’t ask why I am doing this. But there is an intersting observation about psexec. It doesn’t work reliably when called with redirected io, e.g. from the awesome TeamCity server.

Apparently there is a fix, which is using RemCom.exe, which in turn is somewhat neglected these days.

Lesson learnt: windows is not built for relentless automation.

Practices of the Proper Christian Programmer

This post is to announce the publishing of “Divine Code – Practices of the Proper Christian Programmer”.

Whilst more or less appropriate commandments have a long standing tradition in software development – one of the first examples being Dijkstra’s famous “Goto Considered Harmful”, little has so far been written about sound practices in God fearing development, that acknowledge the necessity of a strong faith and recur to the spiritual experience of two millenia.

The authors provide us with a step by step introduction to the practices that could very well be used as a maturity model.

They start out with the practice of Prayer. Praying has a long standing tradition in software development – the steps pray and deploy are part of every serious continuous integration effort. It is now well understood that the power of the prayer is – not unlike TDD – twofold. There is a direct effect when the spirit enters the code base as well as an indirect effect through the changed mind-set of the developer. Some pagan processes do rely on daily standups as a substitute for prayer. These efforts might be well-intended but do nonetheless amount to heresy!

Further practices include Christening, which involves getting your system properly soaked, the Holy Communion formerly known as team drinks, Exorcism which comes in different degrees ranging from the casual refactoring to a full blown rewrite. When all that could be done has been done the Annointing of the Sick Code Base could be your last resort.

Another practice that has recently been falling into misuse by heathen folks is the Sacrament of Reconciliation aka Confession. The godless call it retrospective though.

Peace of mind is essential for the productive programmer and can easily be achieved with the firm believe in the Project Everlasting. Everything else failing there is always the option of applying the time honored practices of Crucifixion or Stoning to the incompetent manager or customer, though the authors concede that in most cases generous amounts of Holy Water and Incense will do.

In the true spirit of inclusiveness and diversity there is a contributed chapter on Halal coding Habits, that provide an even more elaborate mental frame work for the aspiring programmer, vividly illustrating that Christianity is not the only hope for the industry. Halal actually meaning lawful or permitted our knowledgeable co-author makes a good point that doing the bad stuff makes the project go haram – unlawful. Another interesting point is his elaboration on the importance of a prophet between the mere mortals and the divine, incomprehensible supreme being. This indirection has indeed come to us in the form of asynchronous messaging with a certain BizTalk combining these virtues with the agile virtue of talking to the biz.

The book is available as of today, April 1st 2010 – let the lord in to your heart. Buy a copy. And become a truly superior programmer.

Use Jetty!

I was somewhat shocked to learn that a lot of my colleagues are not even aware of the existence of jetty. I have been using it for quite a while. It is the best thing you can do during development – and no jboss is not a good thing it is after all quite similar to websphere. Arguably jetty is also the best thing in production.

As I will die one day, I can’t be bothered to use anything else, because there are no insights to be gained and no problems to be solved by using anything more “elaborate”.

Naked Objects Talk in London this Thursday

Dan Haywood will be coming to the ThoughtWorks London Office to talk about his new book Domain Driven Design using Naked Objects. I have been excited about the idea of NO for quite a while, though the actual implementations have been controversial. So I hope for interesting discussions.

Here the details:

Thursday December 10, 2009 from 7:00pm – 10:00pm
ThoughtWorks UK Office
Berkshire House, 168-173 High Holborn
London, United Kingdom, England WC1V 7AA

If you are keen on the free pizza sign up on our
Upcoming Page.

Some interesting links:
Naked Objects Home of the original implementation.
JMatter A more beautiful implementation

Hope to see you there.