Author Archives: Dan

How much?

Q:
How much wood
would a woodchuck chuck,
if a woodchuck could chuck wood?

A:
A lazy woodchuck, name of Buck,
tried to chuck, but had no luck.

A crazy woodchuck, name of George,
chucked four cords of knotty boards.

 

Network Manager applet

I mentioned some time ago that I was trying to install the Gnome Network Manager applet, and had some trouble. For anyone else who had the problem, the issue was that it's not really an applet – it's a Notification Area icon. To get it to work, you must have the notification area applet running.

XML schema design patterns

One of the hard things I think about at work is the implications of Data Modelling practices vs XML schema development practices. As an example, there are a lot of folks in the DoD who are enthusiastic about the Command-and-Control Information Exchange Data Model (C2IEDM), a data model developed by the Multilateral Interoperability Programme (MIP).

I have concern that Data Modelling, as a practice, results in good ways to represent information at rest, but that it does not do a good job of developing mechanisms to exchange information. I.e. data modellers define database structures, but do not define languages.

There is a tendency to create good data models, and then run a script to generate the associated XML schema. I worry that this is not sufficient – the resulting XML schema will be good for database replication, but not be useful for anything else.

As an aside, the documentation of the 2002 version of C2IEDM (known as the LC2IEDM) is 315 pages long. The US Air Force, (and others) use a XML schema known as Cursor-on-Target for exchange of C2 data that has 13 elements and can be reasonably documented in about 11 pages. (more here)

C2IEDM and CoT are not pure-competitors; any comparison is not apples-to-apples. In fact, they may be complementary… C2IEDM is a data model, CoT is an XML schema. In other words, CoT can be used to communicate the data that C2IEDM models.

Anyway – most of my concerns are unproven, and understanding the problem will require more thought. I was inspired to blog about this today largely because I stumbled across an article on XML schema: Best Practices called “Global vs Local” that I wanted to link to for future reference that I think has some nuggets that apply to these problems.

 

Model-View-Controller and the Web

I was thinking a lot Friday about the Model-View-Contoller paradigm (aka Model 2) and how it applies to web application design. I was having conceptual issues which I suspected were largely a result of not really understanding the MVC pattern. So I’m trying to sort this stuff out.

In writing this, I ran across Andy Wardley’s article, “MVC: No Silver Bullet“, which shaped my thinking a bit.

The main heartburn that I have with MVC for web applications is the thought that actions are always directed by the Controller, when in fact, often it’s the View that’s getting the clicks. As I was building an MVC framework for my web apps, the Controller was mainly just dispatches to the Views – which doesn’t seem to fit the available documentation on how MVC is supposed to work. If the View prepares the forms, isn’t it the View that should know how to process the form submission?

The answer, according to what I think is the seminal paper on MVC, is this: “Each view is associated with a unique controller and vice versa.” This leads me to wonder: if there is a one-to-one mapping between Views and Controllers, why are they distinct at all? In a rich-GUI environment, I suppose separating out the View and the Controller might make some sense; the View knows how to display the Model, and the Controller processes the mouse-clicks and keystrokes. Since these are very conceptually different, they deserve different classes. That said, in a web environment, the only events are HTTP requests – either page-GETs or form-POSTs – and are more intimately related to the underlying pages. For a pure GET, the Controller only has to dispatch to the right View. For a POST, the Controller should theoretically update the Model, and then refresh the View. That said, to me it makes more sense to keep the form generation code and the form processing code in the same module, which means the View. So the Controller, in a web framework, ends up being just a dispatcher.

I think that the Sun definition of “Model 2” is pretty close to this model, and is somewhat divergent from the Smalltalk MVC pattern. (But that’s okay.) Likewise, the flow picture associate with Catalyst, seen below, seems divergent because it puts the controller completely in charge, rather than having that close one-to-one relationship with the views.

Note that I’m not trying to suggest that the View does the real work. Rather, I suggest that the Model does the work, but that the View marshalls the inputs.

Megan’s Mac Mini and Breezy Badger

Bought Megan a Mac Mini for her second birthday. She loves it and it's convenient to have a computer up-and-running on the main floor all the time. (Zette and I each have laptops, but they float around and the batteries run out.)

We're using the Microsoft Wireless Optical Desktop for Bluetooth with the Mini, which works pretty okay. I had some issues at first getting them to talk reliably, but setting the Microsoft Keyboard and Mouse as 'favorite' bluetooth devices seems to have solved the problem. We'll see how useful it is to have keyboard and mouse that are battery-powered.

I also upgraded my laptop to the latest stable release of Ubuntu, codenamed "Breezy Badger". I did it mainly because I read a favorable review of Network Manager, (which aparently was not available for the "Hoary Hedgehog" release of Ubuntu), but when I installed NM, it doesn't seem to come up. Have to troubleshoot that later.

Apache2::Reload and Class::DBI

I had some issues with Apache2::Reload and Class::DBI not playing nice together. The problem s something about CDBI not wanting to over-write existing symbols when it reloads classes. I found a hack on some japanese Perl forum for Apache::Reload, and I ported it to Apache2. Hopefully this helps somebody.

This is the modified section of /usr/lib/perl5/Apache2/Reload.pm, version 0.09:

if ($mtime > $Stat{$file}) {
my $package = module_to_package($key);
if ( UNIVERSAL::isa($package, 'Class::DBI') ){
no strict 'refs';
warn "Apache2::Reload: clear the symbol table of $package\n" if $DEBUG;
%{"$package\::"} = ();
}
ModPerl::Util::unload_package($package);
require $key;
warn("Apache2::Reload: process $$ reloading $package from $key\n")
if $DEBUG;
}

More sailing with Megan

Went sailing with Megan again last Sunday. Had a great time tooling around the cove, and zipping out across the Potomac. After we were tied up to the dock again and I was furling the sails, Megan fell off the dock into the river. Life vest was still on; nothing hurt but her toddler pride.

Linux on Walmart/Tatung WXGA laptop

Placeholder to fill in later.

The gist is that I bought a Tatung WXGA laptop from Walmart.com. It came with WinXP on it, as well as some Redhat derivative that was on a "hidden" partition. Probably that was the rescue partition.

EIther way, I reformatted the entire disk and first tried to install the most recent Fedora Core. The FC install CD would not boot on this laptop. (Kernel panic during boot.)

So I tried installing Ubuntu linux, about which I had also heard good things. It installed clean and worked just about perfectly the first time. It detected the unusual screen geometry (1280×820) and the wireless network card just fine. I haven’t tried using USB or Firewire devices yet. Sound and 3D graphics seemed to work fine. I’m not sure if I tested Xvideo. or not.

The minor issue I had were that Ubuntu includes hibernate scripts for suspending to RAM and to disk on ACPI events. If you want to suspend to disk, you need to include ‘resume=/dev/hda5’ into the grub config, assuming that hda5 is your swap partition. I assume that the swap partition must be as large as the RAM, also. It also had some issue where on resume it would not restore to the correct Virtual Terminal. I recognized what it was doing, and could hit Ctl-Alt-F7, to fix it, but many Linux folks would not be so sophisticated to figure this out. I added a line somewhere to force a change back to VT7.

This seemed to work fine at first. About a week or two into using the laptop, Ubuntu offered a package upgade to the kernel. After installing it, the laptop would only suspend once – subsequent suspends would power down and then immediately resume. There were messsages in dmesg about problems with the ohci1394 driver, which I assume was causing the problem. I blacklisted that driver, since I’m not using any firewire/ieee1394 devices with that laptop currently. I’m not sure if that fixed the problem or not yet, since I have so little time to mess with it because of my two small children.

Anyway, for anyone else who’s considering the Walmart Tatung WXGA laptop for use with Linux, it worked almost perfectly out-of-the-box for me. (modulo problems described above).