Foxit Reader update forces UAC

After updating my recently installed Foxit Reader to most recent version lead to an unexpected behavior: whenever I start Foxit Reader I get the UAC-dialog in Vista. This is more than just annoying.

Well, looking at the settings dialog of Foxit didn’t reveal anything unusual. But then it strikes me: I looked at the settings using my regular user account! Switching to the all-user settings of the link revealed, that administrative privileges where being required in order to start Foxit! Bummer!!

Boost Firefox performance

Since version 3.x Firefox is using SQLite-databases to store it’s interal stuff like history, awsome-bar etc. Because the database can get fragmented over time, you might want to do some cleanup once in a while.

To do so, just open up Tools\Error-Console and evaluate this statemant:

Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection.executeSimpleSQL("VACUUM");

This should freeze the UI for a couple of seconds, but after that you’re all set to go.

Sizing the console

OK, so once in a while I have to work just on a plain old console on one of my linux machines. But since there is this neat 22″ monitor on my desk it hurts to see to see the default-resolution of 640×480 pixels.

So how to alter the default resolution, when you’re not using any graphic window manager thingy?

I have a recent version of Debian running, so I use grub for managing my boot-menu.

To change the resolution the easiest way is to go the /etc/default/grub and edit the commandline settings:

GRUB_CMDLINE_LINUX_DEFAULT="vga=0x0305"

This will give you at least 1024×768 with 256 colors! (A decent list of codes to use can be found at www.pendrivelinux.com).

Getting fluent

The case

OK, so I worked around the first issues with the setup of the NHibernateIntagration facility and fluent NHibernate, and now are new issues just showing up.

So I wrote my first mapping:

public class AccountMap : ClassMap<Account>
{
public AccountMap()
{
Id(x => x.Number).GeneratedBy.Assigned();
Map(x => x.Name);
}
}

This looks pretty slick – in fact this is looking so darn cool, I want it to work!

But what is showing up in my testrunner is not very re-assuring: No persister found for Entity Account.

What the hell?!

The setup

So what happend so far? After getting my solution ready to compile, the next step is to add the fluent mapping to the current NHibernate configuration. Since the configuration is being created within the integration facility this doesn’t seem trivial. But actually, taking a closer look, this isn’t that complicated:

<facility id="nhibernate"
isWeb="false"
type="Castle.Facilities.NHibernateIntegration.NHibernateFacility, Castle.Facilities.NHibernateIntegration"
configurationBuilder="FluentConfigurationBuilder, Core">

The key is the configurationBuilder. This offers a hook in the configuration-building-process of the facility.

Next step is to implement the configuration-builder:

public class FluentConfigurationBuilder : IConfigurationBuilder
{
public Configuration GetConfiguration(IConfiguration facilityConfiguration)
{
var defaultConfigurationBuilder = new DefaultConfigurationBuilder();
var configuration = defaultConfigurationBuilder.GetConfigutation(facilityConfiguration);
configuration.AddMappingsFromAssembly(Assembly.LoadFrom("Core.dll"));
return configuration;
}
}

This is the recommended route to read the fluent mappings from the assembly and to add them to the NHibernate configuration. The key is the AddMappingsFromAssembly extension-method.

So, this is where I stand right now – and this is failing.

The solution

Looking at the source of the fluent NHibernate extension-method AddMappingsFromAssembly reveals some truth:

public static Configuration AddMappingsFromAssembly(this Configuration configuration, Assembly assembly)
{
var models = new PersistenceModel();
//models.AddMappingsFromAssembly(assembly);
models.Configure(configuration);
return configuration;
}

So there it is – black-on-white: the actual mapping is commented out – and no-one knows really why.

Ok, so my current (and working) code looks like this:

public class FluentConfigurationBuilder : IConfigurationBuilder
{
public Configuration GetConfiguration(IConfiguration facilityConfiguration)
{
var defaultConfigurationBuilder = new DefaultConfigurationBuilder();
var configuration = defaultConfigurationBuilder.GetConfigutation(facilityConfiguration);
var model = new PersistenceModel();
model.AddMappingsFromAssembly(Assembly.LoadFrom("Core.dll"));
model.Configure(configuration);
return configuration;
}
}

Everything is fluent

Since fluent is just everywhere, I thought that I would have to go the fluent NHibernate road as well. Turned out to be quite wacky.

First of – I just wrapped up all my referenced assemblies: Castle Windsor 2.0 (which is actually internally labeled as 1.1) as well as all the other stuff and NHibernate 2.1 GA. Then adding the new kind in town: Fluent NHibernate.

And this is where the trouble begins … Fluent NHibernate is build against 2.1.0.4000 of NHibernate (= 2.1 GA). This is good, since I just downloaded this exact version. But wait – what’s my most favorite NHIntegrationFacility doing there – it’s actually linked against 2.1.0.1003. So this screws me off.

OK – don’t panic! Fortunatly .Net has the ability to redirect assembly bindings. Just a little bit of tweaking in the app.config does the trick:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
<bindingRedirect oldVersion="2.1.0.1003" newVersion="2.1.0.4000"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>