Wednesday, December 10, 2008

Quote from acts_as_paranoid not found

We have been using the acts_as_paranoid plugin and our move to Rails 2.1 (eventually) woke us up to the need to update it.

In case anyone else should wonder why calling delete on their ActiveRecord model instance - which uses acts_as_paranoid - caused a NoMethodFound error on 'quote', it is because your PostGres (or possibly other) database adapter no longer has such a method - although it used to.

The latest version of the plugin fixes the problem.

Monday, November 17, 2008

OpenID

We see real value to our company in supporting OpenID for our users. Implementation of support as a Relying Party has proved straightforward - thanks to DotNetOpenID.

By supporting registration, as well as login, using OpenID (and only OpenID), we have moved from a typical registration page with many fields to a trivial one. We do have special needs that made this easier but when we realized the simplification this would allow our code and our users we quickly convinced ourselves.

MythTV under Ubuntu Intrepid Ibex

We have two interesting issues since Intrepid Ibex was released. My updates were tied to the development version but I believe these were observed after the release was final:

MythTV playback sound is higher-pitched in almost every case whether recorded months ago or hours ago. So does live TV.

Lirc was failing to run because it did not see the right lirc device. A soft link in /dev fixed that.

Unrelated to Ubuntu, our remote that came with the multimedia PC case is very flaky with the left and down directions on the keypad. It allows far more than the four compass points. It is possible to recognize the other remote signals but tricky to get the right responsiveness - recognizing all of them produces far too many key presses.

Monday, August 25, 2008

lirc and imon LCD under Ubuntu

If you have a MythTV installation you will want to control it via a remote control since keyboards and mice rarely fit the decor of a family room.

I chose a Silverstone case with their nice LCD display. It has a potentially rich display. However such sophistication is not supported by the Ubuntu Hardy LCDproc package.

The Ubuntu 8.04 lirc support for the pad on the remote is incomplete also. There is a patch which is targeted for Intrepid Ibex. So I could build from source, add the patch and install. Or I could fetch the Intrepid package and install that. The latter seemed the simpler case but, since it is aiming to be part of Intrepid, its dependencies could be a problem.

Using Intrepid's package as a base fails interacting with udev each time. I suspect that the direct cause is the lack of the lirc_imon driver despite a reference to it in hardware.conf.

dkms is used to manage the lirc support. Unfortunately it believes I have an empty dkms.conf which is causing all the dkms commands to fail.

I commented out the reference to the missing lirc_imon driver and rebooted to see if the poor interaction with udev as fixed.

Rebooting brought up a repair menu, so I chose the option to repair packages. Since I have Intrepid in my sources.list file, it is now downloading 100s of megabytes of updated and new packages for Intrepid alpha 4.

This may take a while to finish... The only upside I can see so far is the chance to become an Ubuntu package maintainer...

Tuesday, June 24, 2008

Mounting NFS shares on OS X Leopard

A lot of the information about doing this on Mac OS X refers to the NetInfo database and related utilities, but pre-dates changes which came with Leopard.

On Debian - Ubuntu in my case - most of the information refers to nfs-kernel-server for NFS. Unforntunately nfs-kernel-server requires the uid and gid to be the same on both server and client in the general case. While there is information on how to change your OS X uid/gid it is a pain in the neck and gets worse with more systems.

The best resource I found to address these issues securely is on the Ubuntu forums written by EirĂ­kr, and uses nfs-user-server to map between the client and server uids and gids - instead of nfs-kernel-server. Install nfs-user-server using your favorite package manager and configure it according to Eirikr.

Saturday, June 21, 2008

The Mac mini

My windows laptop is on it's last legs. I need a machine for development and I loved the MacBook Pro I chose for development at Jackpot Rewards. The only problem I have with the Pro is it's price - it is a premium-priced product.

I have a great 24" monitor on my desk at home and plenty of keyboards and mice. Having a very portable machine is not very important right now. These factors led me to the Mac mini. My current work from home is using Ruby on Rails and my development environment is centered on TextMate so my performance requirements are quite low.

Sure, I would have loved to buy a Mac Pro but the price difference is huge for the extra capabilities. If we get to the point of running an office with a few people I will definitely consider it.

I will write again when i have spent more time using it as a personal system and a development system.

Tuesday, June 3, 2008

"The Name of the Wind" by Patrick Rothfuss

I love the Fantasy genre and this book is is one of the best. A great story with well-interleaved flashbacks and great prose.

It was one of those perfect autumn days so common in stories and so rare in the real world. The weather was warm and dry, ideal for ripening a field of wheat or corn. On both sides of the road the trees were changing color. Tall poplars had gone a buttery yellow while the shrubby sumac encroaching on the read was tinged a violent red. Only the old oaks seemed reluctant to give up the summer, and their leaves remained an even mingling of gold and green.

Everything said, you couldn't hope for a nicer day to have a half dozen ex-soldiers with hunting bows relieve you of everything you owned.


The humorous style of writing made it a joy to read. I picked that passage at random - it is the start of the second chapter - but it is typical of the whole. Just reading that passage again makes me want to re-read the whole book. The characters are well-developed and this, the first of three books, finished much too soon (662 pages).

Friday, May 9, 2008

Little Brother by Cory Doctorow

I was going to write a review of the book but a quick Google gave me Neil Gaiman's review from six months ago. I had read his review but did not try the book because work was just too time-consuming then.

Neil's more recent reference caught me with a little more free time.

Read his review; read the book. Give the book to a teenager you know. I plan to give copies to all the young adults I know.

Spring Configuration

A recent task was to consume a simple comma-separated file and generate database records from it.

Our application is quite middle of the road in terms of the complexity of it's configuration. One of the most complex parts is the many databases which we access from our code. In this case, I wanted to import test data so we could check out the user interface we were developing for it.

I spent about a week on the task. Four and a half days working on the wiring, trying to find a way to build a configuration which would run and be able to access the database. Just half a day was required to write and debug the actual code.

In the end I gave up on trying to test it in the 'correct' place in the code, and hacked at some code where I knew that I would be able to access the database and have a existing user interface to invoke it from, and see the results.

The code works. Our user interface looks good and displays the imported data.

This configuration overhead adds to development time and makes it harder to justify extensive testing.

We have a number of cross-cutting concerns and use Java 5 annotations extensively. Not all these concerns result in annotations at the places which 'need' them. Our transaction interceptor is an example. For most of our code it 'just works'. The rest of the time it can be hard to know where to start on a solution to the problem.

To be fair, not all of the configuration overhead relates to our Spring wiring. I did lose a couple of hours when a Maven deploy on another branch caused a puzzling regression. That is clearly Maven configuration overhead.

While I have done some work with Groovy, I have not tried Grails yet. I have used Tapestry in the past but Tapestry 5 is a lot different than the Tapestry 3 I used. I doubt that Tapestry will ease these configuration issues. Grails might based on my experience with Ruby on Rails.

Wednesday, April 30, 2008

Testing by JExample

The back end of our software - the part which allows us to scale to millions of users - has some very long tests involving networks and databases. They take long enough to run (30+ minutes) that, when run over our VPN, the connection is sometimes dropped before the tests can conclude. While infrequent it is a cause of great frustration when it happens.

Unit tests need isolation from potential side-effects. Providing that isolation requires potentially extensive and / or time-consuming setup and sometimes tear-down code.

A very new testing framework based on JUnit is called JExample. Unlike JUnit, tests can depend one upon another. Since the tests have passed, the environment is in a known, tested as correct, state and can be relied upon as the basis of subsequent tests.If test A passes, then test B can rely upon the result and context of A. When A is a long test, or requires considerable setup or teardown, this can result in substantial time savings.

A dependency graph of tests is built and used to order the tests.

The main results are less elapsed time for the tests and test failures which are more likely to pin-[point the exact place where a problem is occurring.

The work is based on the paper by  Kuhn, Van Rompaey, Haesenbarger, Nierstrasz, Demeyer, Gaelli and Van Leemput. There is an introduction and Eclipse integration. Java 6 is required.

Tuesday, April 29, 2008

The Rails Way

I never picked up my novel. The Rails Way is well-written enough to have kept me reading it through the whole vacation. I read about 500 pages and if our vacation had been any less busy I would have finished it.

The text is easy to follow no matter how complex the topic, with the exception of a passage relating to meta-programming. I will have to go back and see if I do better a second time around.

I found a few typos and errors but none that obscured my understanding of the author's true intent.

The testing section had some good coverage of Rail's built-in facilities and also of RSpec. I have been reading about Shoulda recently also and I plan to compare the two more closely.

Agile Web Development with Rails has been considered the leading book on Rails. For a newcomer to the topic it is still a better book but, for anyone with some knowledge of the framework, this is a much better organized volume. Sam Ruby is updating it for Rails 2 but it will only be a beta book for most of this year.

Hill towns of the Cote d'Azur

Haut de Cagnes and St. Paul de Vence were two hill towns which we visited. People have been seeking the shelter of these steep hills since at least Roman times.

They both have associations with the Grimaldi family - rulers of Monaco - but only Haut de Cagnes attained the importance to gain a castle.

As a child I read how Hannibal crossed the Alps with his Elephants to avoid a Roman army blocking the route to Italy. Given the terrain it would have been very hard to force a passage along the coast with plenty of places for the Romans to set up a strong defensive position.

Now the coastal hills are thickly littered with houses showing how many people are attracted to the scenery, climate and food.

Haut de Vance
town square from
the castle roof.

Thursday, April 24, 2008

From the Left Bank to Notre Dame to the Louvre along the Champs Elysee to the top of the Arc de Triomphe to the Eiffel Tower to a bus back was about six miles including the long, long corridors of the Louvre. Excellent exercise after months of keyboard pounding.

Arc de Triomphe

I took photographs of each of the twelve roads leading from the Arc de Triomphe.


Notre Dame
has a crypt but, here, that is an archaeological site showing some of the foundations and wall upon which the area in front of the cathedral has been built. Apart from the many changes in use - including as houses and two different hospitals - it was a shore fortification in Roman times although the bank of the Seine is now at least fifty yards distant.

Do I hear footsteps?

A friend lent us a map of Paris. After arrival we noticed that she had underlined the metro station we used on the way in from the airport. She had also underlined the road of our hotel. The road is only 100 yards long and just has one hotel.


Before looking at the map I would have imagined that the odds of us staying at the same hotel were small. Now I have to believe that we actually did stay there...

Wednesday, April 23, 2008

The Rails Way is proving very readable and I am yet to pick up my novel.

Paris was fantastic - more on that later. We are now staying in a converted castle guardhouse near Nice. The restaurant here is incredibly good. Our room is huge with a balcony looking out over the valley. There are some very acceptable frog noises in the background as type. We are planning a more relaxing day tomorrow so I will catch up on the events of Paris then.

Saturday, April 19, 2008

Vacation reading

I often find it difficult to decide what books to read on vacation. Fun? Technical? If I really think I need to read some thick technical tome, I will often take just that one book. If I take the big book and a fun one, I know which one I will pick up when I get a moment.

For this trip I brought along "The Rails Way". I have found it very readable so far. I have been using Rails for a couple of years now and I find the approach of this book much more suitable now than the "Agile" book.


At the risk of not reading The Rails way, I also brought along Shadowplay by Tad Williams. I am a huge fan of his other books. Memory, Sorrow and Thorn is from the same genre but I liked it much more than the first book in this series. I will see if it grows on me...

The plane is waiting...

Friday, April 18, 2008

Making a start

My last vacation was to Scotland in 2006. I love the Highlands and Islands: The Great Glen, Skye, Kyle of Lochalsh, Mallaig, Oban and the lochs and valleys which connect them. Tobermory on Mull is a great favourite.

Tomorrow we leave for Paris and Nice. They will be such a contrast. One of the great cities of the world with its monuments and museums; and the grassy, rocky, lochs of the Scottish coast. Each is beautiful in its own way - each refreshing to the soul.

I still have to decide whether to bring my MacBook Pro with me. I can not remember the last vacation I took where I did not spend hours working late at night after a busy day's sightseeing. I have some ideas for a new web site. It would be a contrast to the heavy Java coding of the last ten months. I would probably use Ruby on Rails although Merb is an interesting and tempting alternative.

If I do not take the laptop with me, this first post might not be succeeded for a couple of weeks. I would love to be able to add some photos of Paris though...