Tuesday, November 4, 2008

intrepid ibex, hp, wi-fi learn to make nice


Ubuntu upgrades usually represent several steps fowards, but they can also take one or two back, at least temporarily.

The process of upgrading to Intrepid Ibex started flawlessly, as expected. I was even happily surprised to see that my AZERTY keyboard no longer switched to QWERTY on the login screen (which it had started doing ever since I'd attempted to hook up a projector. Talk about bizarre side-effects!). But after that high, came a low: I couldn't connect to my wi-fi. In fact, the network card wasn't even being recognised.

Some searching brought me the answer:
Add folowing [sic] lines to /etc/modprobe.d/blacklist

blacklist ssb

blacklist b43
Since I have a HP nw9440 and he or she has a 6515b, I guess the advice applies to many models. What does it mean? I have no idea, but it works!

I'll just add that you'll need to open the file with administrative privileges, for example with:

sudo gedit /etc/modprobe.d/blacklist

Saturday, November 1, 2008

active-pattern


One way to learn about programming is to actually, well, program.

I've been thinking about the Active Record pattern for a while, and how different it is from the three-tier architectures I'm used to. Both the traditional Entity/DAO layering pattern and the API (since you're calling persistence methods outside DAO's) are quite different. Views seem to vary on what Active Record actually is, as Martin Fowler's original description has it bundling data and behaviour, while Bob Martin limits it to pure data structures.

Brief looks at Ruby on Rails piqued my interest. Then, a tiny (semi-finished) utility webapp I wrote on Google App Engine for my girlfriend gave me a first practical taste of Active Record (and of what an environment with out-of-the-box full-stack integration feels like). Currently, I'm writing a small in-house web framework on top of Struts 1 for a client, and I get the feeling that Active Record could be a good way of turning it into a full-stack environment.

I'm aiming, first, for a very simple usecase to get a feel for the pattern: how it affects the overall design, the ORM challenges and integration with existing frameworks, effect on amount of boilerplate, etc. Later, maybe it could grow into something usable by a real-world, basic CRUDing app.

Some of my initial assumptions:
  • ActiveRecords are actually delegating to a DAO-like Repository. This Repository is injected into ActiveRecord instances (dependency injection is handled by Guice)
  • ActiveRecords mirror DB records exactly, except that foreign keys become object references
  • This whole thing is pointless if it doesn't remove a lot of tedious DAO-related boilerplate
  • It must be kept simple
With that, I give you the barely-born active-pattern.