RSS  

Thomas G. Mayfield

Bloglines Beta Easter Egg

2009-01-18 @ 3:28:25 UTC
Filed under: Uncategorized by thomas

I was using the Bloglines Beta tonight (side bar: is it ever coming out of beta?). I meant to hit Ctrl-Tab to move to the next tab, but my fingers were one key off the mark and I hit Shift-Tilde (~). The backtick by itself appears to work, as well. I guess the Bloglines guys like console games.

More perusing of the javascript hasn’t revealed any other magic, sadly, unless they’re using something other than their default hotkey registration for other undocumented shortcuts.

Comforting Quirks

2008-07-18 @ 3:08:18 UTC
Filed under: Uncategorized by thomas

For those that don’t know me so well, I need you to read a post entitled The Quirkbook on Rands in Repose.

Truth be told, at least 4 out of 5 of those listed and the comments following (or ones very like them) are quirks I grew up with. I’ve worked and worked to get rid of most of them, but more come to fill their space, or they just morph into something less obvious to an observer.

Up until reading that, the only people I’ve encountered with similar issues were actors, portraying crazy people.

Failing unit test for NHibernate configuration warnings/errors

2008-07-11 @ 1:34:59 UTC
Filed under: NHibernate by thomas

I’d mentioned on Dave Laribee’s Test Your NHibernate Mappings! post that you can use a custom log4net appender to catch the messages NHibernate outputs on initialization. Here’s a bit more detail.

First, the custom ListAppender class:

class ListAppender
    : log4net.Appender.AppenderSkeleton
{
    private List<LoggingEvent> _events = new List<LoggingEvent>();
    public List<LoggingEvent> Events
    {
        get { return _events; }
    }

    protected override void Append(log4net.Core.LoggingEvent loggingEvent)
    {
        _events.Add(loggingEvent);
    }
}

And a sample unit test:

[Test]
public void TreatNHibernateWarningsAsFailures()
{
    ListAppender appender = new ListAppender()
    {
        Threshold = log4net.Core.Level.Warn,
    };
    log4net.Config.BasicConfigurator.Configure(appender);

    string myConfigPath = @"wherever\you\put\your\NHibernate\config.xml";
    Configuration config = new Configuration().Configure(myConfigPath);

    using (ISessionFactory factory = config.BuildSessionFactory())
    {
        // Spin up the factory and then throw it away. We just want to guarantee that initialization has occurred.
    }

    if (appender.Events.Count == 0)
    {
        return;
    }

    StringBuilder errors = new StringBuilder();
    errors.Append("Warnings/errors issued when starting up NHibernate:");

    foreach (log4net.Core.LoggingEvent ev in appender.Events)
    {
        errors
            .AppendLine()
            .AppendFormat("\t{0}: {1} - {2}", ev.Level, ev.LoggerName, ev.RenderedMessage);
    }

    Assert.Fail(errors.ToString());
}

Powered by WordPress