<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace V5 Site Server v5.13.594-SNAPSHOT-1 (http://www.squarespace.com) on Sun, 26 Apr 2026 17:56:22 GMT--><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>Weston Binford</title><link>http://trason.net/journal/</link><description>Notes along my journey</description><lastBuildDate>Sat, 10 Dec 2022 06:39:29 +0000</lastBuildDate><copyright>Copyright 2009 Weston M. Binford III</copyright><language>en-US</language><generator>Squarespace V5 Site Server v5.13.594-SNAPSHOT-1 (http://www.squarespace.com)</generator><item><title>Monospace Open Space Thursday Schedule</title><dc:creator>Weston M. Binford III</dc:creator><pubDate>Sat, 31 Oct 2009 23:08:54 +0000</pubDate><link>http://trason.net/journal/2009/10/31/monospace-open-space-thursday-schedule.html</link><guid isPermaLink="false">342899:3630310:5666592</guid><description><![CDATA[<p>There seemed to be some interest in the Monospace Open Space Friday Schedule that I published earlier this week.&nbsp; No doubt, the majority of the interest was from people at the conference, but I thought others might be interested in what was discussed on Thursday as well.</p>
<blockquote>
<p><strong>1:00 &ndash; 2:15pm</strong></p>
<p>Room 18B &ndash; <a href="http://monotouch.net/">MonoTouch</a> Testability and Architecture &ndash; <a href="http://www.persistall.com/">Brian Donahue</a></p>
<p>Room 18C &ndash; Starting an Open Source Project or Contributing to an existing one and the best way to go about it &ndash; <a href="http://www.lostechies.com/blogs/rssvihla/">Ryan Svihla</a></p>
<p>Room 18D &ndash; Moving to <a href="http://mono-project.com/Main_Page">Mono</a>: Why? How? &ndash; <a href="http://lessmayhemmoresoftware.blogspot.com/">Michael Maham</a></p>
</blockquote>
<blockquote>
<p><strong>2:15 &ndash; 3:30pm</strong></p>
<p>Room 18B &ndash; <a href="http://www.codeplex.org/">Codeplex Foundation</a> &ndash; <a href="http://samus.typepad.com/">Sam Ramji</a></p>
<p>Room 18C &ndash; Integrating open source into corporate software &ndash; <a href="http://twitter.com/msheldon83">Mike Sheldon</a></p>
<p>Room 18D &ndash; Distributing on Linux (deb, rpm, huh??) &ndash; <a href="http://public.kgi.edu/~fbergman/">Frank Bergmann</a></p>
</blockquote>]]></description><wfw:commentRss>http://trason.net/journal/rss-comments-entry-5666592.xml</wfw:commentRss></item><item><title>Monospace Open Space Friday Schedule</title><dc:creator>Weston M. Binford III</dc:creator><pubDate>Fri, 30 Oct 2009 04:49:41 +0000</pubDate><link>http://trason.net/journal/2009/10/29/monospace-open-space-friday-schedule.html</link><guid isPermaLink="false">342899:3630310:5654014</guid><description><![CDATA[<p>I expect that this schedule will be available on the Monospace web site <a href="http://monospace.us/schedule">here</a> at any time.&nbsp; Until then, here it is:</p>
<blockquote>
<p><strong>9:00 &ndash; 10:15am</strong></p>
<p>Room 18B - <a href="http://monodevelop.com/">MonoDevelop</a> vs <a href="http://msdn.microsoft.com/en-us/vstudio/default.aspx">Visual Studio</a> + <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> (what do we need to add) &ndash; <a href="http://www.lostechies.com/blogs/joshuaflanagan/">Josh Flanagan</a></p>
<p>Room 18C &ndash; <a href="http://silverlight.net/">Silverlight</a> and <a href="http://windowsclient.net/wpf/">Windows Presentation Foundation (WPF)</a> Best Practices &ndash; <a href="http://blogs.silverlight.net/blogs/justinangel/">Justin Angel</a></p>
<p>Room 18D &ndash; 0 to 60 on Linux for Noobs</p>
<p>&nbsp;</p>
</blockquote>
<blockquote>
<p><strong>10:15 &ndash; 11:30am</strong></p>
<p>Room 18B &ndash; Jazz Band Management (with <a href="http://tirania.org/blog/">Miguel de Icaza</a>) &ndash; <a href="http://geekswithblogs.net/kirstinj/Default.aspx">Kirstin Juhl</a></p>
<p>Room 18C &ndash; Build Your First <a href="http://www.linode.com/">Linode</a> for Running ASP.NET &ndash; <a href="http://www.lostechies.com/blogs/hex/">Eric Hexter</a></p>
<p>Room 18D &ndash; Adding Scripting To Your Applications (and making them cross-platform)</p>
<p>&nbsp;</p>
<p><strong>1:00 &ndash; 2:15pm</strong></p>
<p>Room 18B &ndash; <a href="http://monotouch.net/">MonoTouch</a> Pairing &ndash; Kirsten Juhl</p>
<p>Room 18C &ndash; <a href="http://www.mono-project.com/Mono.Addins">Mono.AddIns</a>, <a href="http://www.codeplex.com/MEF">Managed Extensibility Framework (MEF)</a>, and/or Inversion of Control &ndash; Josh Flanagan</p>
<p>Room 18D &ndash; Using <a href="http://nhforge.org">NHibernate</a> in High Transaction Applications &ndash; <a href="http://twitter.com/msheldon83">Mike Sheldon</a></p>
<p>&nbsp;</p>
<p><strong>2:15 &ndash; 3:30pm</strong></p>
<p>Room 18B &ndash; Lessons Learned by Reading Open Source Software (Architecture, etc.) &ndash; <a href="http://twitter.com/praeclarum">Frank Krueger</a></p>
<p>Room 18C &ndash; Legal Issues in Technology (Independent Contractors, Open Source Software, Intellectual Property (Copyright vs. Trademarks vs. Patents) &ndash; <a href="http://johnvpetersen.com/">John Petersen</a></p>
<p>Room 18D &ndash; Automated Build with <a href="http://rake.rubyforge.org/">Rake</a> &ndash; <a href="http://blog.scottbellware.com/">Scott Bellware</a></p>
</blockquote>]]></description><wfw:commentRss>http://trason.net/journal/rss-comments-entry-5654014.xml</wfw:commentRss></item><item><title>NHibernate Transactional Boundaries</title><dc:creator>Weston M. Binford III</dc:creator><pubDate>Wed, 14 Oct 2009 13:29:00 +0000</pubDate><link>http://trason.net/journal/2009/10/14/nhibernate-transactional-boundaries.html</link><guid isPermaLink="false">342899:3630310:5458300</guid><description><![CDATA[<p>In <a href="http://trason.net/journal/2009/10/7/bootstrapping-nhibernate-with-structuremap.html">NHibernate Bootstrapping with StructureMap</a>, I did not address the issue of transactional boundaries. The example had very simple controller actions that managed their own commits. However, this <a href="http://stackoverflow.com/questions/1041632/controlling-nhibernate-itransaction-with-structuremap">question</a> on StackOverflow left me wondering who should be responsible for the commit?</p>
<h3>Sharp Architecture&rsquo;s Approach</h3>
<p><a href="http://sharparchitecture.net/">Sharp Architecture</a> is an excellent &ldquo;architectural foundation for building maintainable web applications with ASP.NET MVC&rdquo;. It has an Action Filter called <a href="http://github.com/codai/Sharp-Architecture/blob/master/src/SharpArch/SharpArch.Web/NHibernate/TransactionAttribute.cs">Transaction</a> that starts a transaction in the OnActionExecuting event, and then commits if no exception occurred. Otherwise, it explicitly rolls the transaction back. In fact, the <a href="http://groups.google.com/group/sharp-architecture/browse_thread/thread/950dc4377eee90eb#">Implicit transactions</a> thread in the Sharp Architecture Google group discusses the Transaction attribute and some of the issues using it. The Transaction attribute provides the functionality that I want, but it requires the developer to decorate each Action method with an attribute. Why not make the HttpModule that creates and disposes of the Unit of Work handle the commit?</p>
<h3>Modified Bootstrapping Example</h3>
<p>I have modified the <a href="http://trason.net/journal/2009/10/7/bootstrapping-nhibernate-with-structuremap.html">Bootstrapping NHibernate with StructureMap</a> example from my previous post to do just that. Now, the NHibernateModule is responsible for calling Commit() on the UnitOfWork. Here is the NHibernateModule&rsquo;s new Dispose method:</p>
<pre class="brush: csharp;">public void Dispose()
{
    _unitOfWork.Commit();
    _unitOfWork.Dispose();
}</pre>
<p>The only addition is the call to the _unitOfWork.Commit(). However, now that the NHibernateModule is responsible for the commit, the developer can not abort an existing transaction. So, I added a Rollback() method to the IUnitOfWork class. The concrete implementation, UnitOfWork, calls _transaction.Rollback().</p>
<p>One final change to the UnitOfWork prevents it from throwing an exception if the developer explicitly calls commit by checking the ITransaction&rsquo;s IsActive property before attempting to commit. Here is the UnitOfWork&rsquo;s new Commit method:</p>
<pre class="brush: csharp;">public void Commit()
{
    if (_transaction.IsActive)
        _transaction.Commit();
}</pre>
<h3>Multi-Transaction Unit of Work</h3>
<p>There is still one issue nagging at me. Once the developer commits the unit of work, the transaction is closed. The FubuTasks example in the <a href="http://code.google.com/p/fubumvc-contrib/">fubumvc-contrib</a> project solves this problem by starting a new transaction once the existing transaction is committed. <a href="http://code.google.com/p/fubumvc-contrib/source/browse/trunk/samples/FubuTask/src/Framework.NHibernate/NHibernateUnitOfWork.cs?r=51">Here</a> is the source for FubuTask&rsquo;s NHibernateUnitOfWork. I have talked to <a href="http://www.lostechies.com/blogs/chad_myers/default.aspx">Chad Myers</a> about this implementation and he has moved away from the idea of handling rollback in general. In any event, I don&rsquo;t like the idea of starting a new transaction because I don&rsquo;t think there should be one transaction per request. At the same time, I am preventing the developer from using my unit of work for more than one transaction. At least for now, opening a new transaction is a <a href="http://en.wikipedia.org/wiki/You_ain%27t_gonna_need_it">YAGNI</a> for me. What do you think?</p>
<p>The full source code with these changes are available in the <a href="http://code.google.com/p/mvbalaw-commons/">mvbalaw-commons</a> project <a href="http://code.google.com/p/mvbalaw-commons/source/checkout">here</a>.</p>
<p>Tags: <a rel="tag" href="http://technorati.com/tag/NHibernate">NHibernate</a></p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2ftrason.net%2fjournal%2f2009%2f10%2f14%2fnhibernate-transactional-boundaries.html"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2ftrason.net%2fjournal%2f2009%2f10%2f14%2fnhibernate-transactional-boundaries.html" border="0" alt="kick it on DotNetKicks.com" /></a></p>]]></description><wfw:commentRss>http://trason.net/journal/rss-comments-entry-5458300.xml</wfw:commentRss></item><item><title>Bootstrapping NHibernate with StructureMap</title><dc:creator>Weston M. Binford III</dc:creator><pubDate>Wed, 07 Oct 2009 18:04:00 +0000</pubDate><link>http://trason.net/journal/2009/10/7/bootstrapping-nhibernate-with-structuremap.html</link><guid isPermaLink="false">342899:3630310:5416001</guid><description><![CDATA[<p><a href="http://codebetter.com/blogs/jeremy.miller/default.aspx">Jeremy Miller</a> asked me to help him create a canonical example of bootstrapping <a href="http://nhforge.org/">NHibernate</a> using <a href="http://structuremap.sourceforge.net/Default.htm">StructureMap</a>. <strong>This is not that example.</strong> Hopefully, it will provide a starting point of discussion and, with your feedback, we will be able to create that example together.</p>
<p>Many examples on configuring NHibernate depend on some library such as <a href="http://fluentnhibernate.org/">FluentNHibernate</a> or include additional concepts such as Repositories. While we use FluentNHibernate and Repositories to interface with the database, I did not want to complicate the example with these concerns. I did not want to preclude their addition, either.</p>
<h3>NHibernate Registry</h3>
<p>I have encapsulated the NHibernate configuration in a StructureMap Registry. It makes the following available:</p>
<ul>
<li><strong>NHibernate.Configuration</strong> as a Singleton </li>
<li><strong>ISessionFactory</strong> as a Singleton </li>
<li><strong>ISession</strong> scoped to Hybrid (HttpContext, if available, falling back to Thread) </li>
<li><strong>IUnitOfWork</strong> scoped to Hybrid, a light-weight container for ISession (more on this later) </li>
<li><strong>IDatabaseBuilder</strong>, a utility class to create the database using SchemaExport and populate it with initial data. </li>
</ul>
<p>That&rsquo;s it. If you want to create your own ISession (for example, to use in an integration test), then you request the ISessionFactory and call the OpenSession() method.</p>
<p>Here is the NHibernateRegistry class that provides the Configuration, ISessionFactory, ISession, and IUnitOfWork:</p>
<pre class="brush: csharp;">using NHibernate;
using NHibernate.ByteCode.Castle;
using NHibernate.Cfg;
using NHibernate.Dialect;
using NHibernate.Driver;
using NHibernateBootstrap.Core.Domain;
using StructureMap.Attributes;
using StructureMap.Configuration.DSL;
using Environment=NHibernate.Cfg.Environment;

namespace NHibernateBootstrap.Core.Persistence
{
    public class NHibernateRegistry : Registry
    {
        public NHibernateRegistry()
        {
            var cfg = new Configuration()
                .SetProperty(Environment.ReleaseConnections, "on_close")
                .SetProperty(Environment.Dialect, typeof(SQLiteDialect).AssemblyQualifiedName)
                .SetProperty(Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName)
                .SetProperty(Environment.ConnectionString, "data source=bootstrap.sqlite;Version=3")
                .SetProperty(Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName)
                .AddAssembly(typeof(Blog).Assembly);

            var sessionFactory = cfg.BuildSessionFactory();

            ForRequestedType&lt;Configuration&gt;().AsSingletons().TheDefault.IsThis(cfg);

            ForRequestedType&lt;ISessionFactory&gt;().AsSingletons()
                .TheDefault.IsThis(sessionFactory);

            ForRequestedType&lt;ISession&gt;().CacheBy(InstanceScope.Hybrid)
                .TheDefault.Is.ConstructedBy(ctx =&gt; ctx.GetInstance&lt;ISessionFactory&gt;().OpenSession());

            ForRequestedType&lt;IUnitOfWork&gt;().CacheBy(InstanceScope.Hybrid)
                .TheDefaultIsConcreteType&lt;UnitOfWork&gt;();

                ForRequestedType&lt;IDatabaseBuilder&gt;().TheDefaultIsConcreteType&lt;DatabaseBuilder&gt;();
        }
    }
}</pre>
<h3>Unit Of Work</h3>
<p>Recently, I have been in several discussions regarding what the Unit of Work&rsquo;s (single) responsibility is. Per Martin Fowler&rsquo;s <a href="http://martinfowler.com/eaaCatalog/unitOfWork.html">definition</a>, a Unit of Work &ldquo;<em>maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems.</em>&rdquo; In practice, NHibernate&rsquo;s ISession is a Unit of Work.</p>
<p>When I first created my example, I used the ISession directly, but I found myself writing the following code over and over again:</p>
<pre class="brush: csharp;">    var product = new Product {Name = "Apple", Category = "Fruits"};
    using (var session = _sessionFactory.OpenSession())
    using (var transaction = _session.BeginTransaction())
    {
        session.Save(product);
        transaction.Commit();
    }</pre>
<p>When I really wanted to write this:</p>
<pre class="brush: csharp;">    var product = new Product {Name = "Apple", Category = "Fruits"};
    using (var unitOfWork = new UnitOfWork(_sessionFactory))
    {
        unitOfWork.CurrentSession.Save(product);
        unitOfWork.Commit();
    }</pre>
<p>So, my Unit of Work is a simple wrapper that combines the ISession and ITransaction together.</p>
<pre class="brush: csharp;">using System;
using NHibernate;

namespace NHibernateBootstrap.Core.Persistence
{
    public interface IUnitOfWork : IDisposable
    {
        ISession CurrentSession { get; }
        void Commit();  
    }
}</pre>
<pre class="brush: csharp;">using NHibernate;

namespace NHibernateBootstrap.Core.Persistence
{
    public class UnitOfWork : IUnitOfWork
    {
        private readonly ISessionFactory _sessionFactory;
        private readonly ITransaction _transaction;

        public UnitOfWork(ISessionFactory sessionFactory)
        {
            _sessionFactory = sessionFactory;
            CurrentSession = _sessionFactory.OpenSession();
            _transaction = CurrentSession.BeginTransaction();
        }

        public ISession CurrentSession { get; private set;}

        public void Dispose()
        {
            CurrentSession.Close();
            CurrentSession = null;
        }

        public void Commit()
        {
            _transaction.Commit();
        }
    }
}</pre>
<p>I have heard the argument that this is not a real Unit of Work because it does not track the changes per Martin Fowler's definition. While I agree, I also believe that ISession is not <em>just</em> a Unit of Work either because it includes Get methods that have nothing to do with the Unit of Work. Also, <a href="http://nhprof.com/Learn/Alert?name=DoNotUseImplicitTransactions">best practices</a> dictate that NHibernate not use implicit transactions. ISession can not be a Unit of Work without requiring the developer to interact with ITransaction. So, my compromise is to create a simple interface that melds NHibernate&rsquo;s ISession with its ITransaction. I have heard other names for this class such as TransactionBoundary, but that doesn&rsquo;t sound right to me. I am open to other suggestions. However, please don&rsquo;t get caught up in the naming or I&rsquo;ll be forced to change it to an unpronounceable symbol called <a href="http://en.wikipedia.org/wiki/Prince_%28musician%29">&ldquo;The class formerly known as Unit of Work&rdquo;</a>.</p>
<h3>NHibernateModule</h3>
<p>Finally, in order to manage the Unit of Work for web applications, I created an HttpModule called NHibernateModule that creates a Unit of Work in the Begin_Request event handler and disposes of it in the End_Request event handler.</p>
<pre class="brush: csharp;">using System;
using System.Web;
using NHibernateBootstrap.Core.Persistence;
using StructureMap;

namespace NHibernateBootstrap.Web
{
    public class NHibernateModule : IHttpModule
    {
        private IUnitOfWork _unitOfWork;

        public void Init(HttpApplication context)
        {
            context.BeginRequest += ContextBeginRequest;
            context.EndRequest += ContextEndRequest;
        }

        private void ContextBeginRequest(object sender, EventArgs e)
        {
            _unitOfWork = ObjectFactory.GetInstance&lt;IUnitOfWork&gt;();

        }

        private void ContextEndRequest(object sender, EventArgs e)
        {
            Dispose();
        }

        public void Dispose()
        {
            _unitOfWork.Dispose();
        }
    }
}</pre>
<h3>NHibernateBootstrap Source Code and Tests</h3>
<p>I have created a Google Code project called <a href="http://code.google.com/p/mvbalaw-commons/">mvbalaw-commons</a> with the code for NHibernateBootstrap among other things. You can browse the code <a href="http://code.google.com/p/mvbalaw-commons/source/browse/#svn/trunk/NHibernateBootstrap">here</a> or check it out from <a href="http://code.google.com/p/mvbalaw-commons/source/checkout">here</a>.</p>
<p>The sample application uses <a href="http://www.sqlite.org/">SQLite</a>. So, the only external requirement is that you have installed ASP.NET MVC in order to run the web application. You will need <a href="http://www.ruby-lang.org/en/downloads/">Ruby</a> and <a href="http://rake.rubyforge.org/">Rake</a> to run the build file. See the <a href="http://code.google.com/p/mvbalaw-commons/source/browse/trunk/NHibernateBootstrap/README.txt">README.TXT</a> in the root of the NHibernateBootstrap file for more information getting it up and running.</p>
<p><strong>Note: This example requires a build of StructureMap 2.5.4 after revision 262 which changes &ldquo;the concrete class behavior so that it can still build a concrete class that is not specified, but it doesn&rsquo;t get into the GetAllInstances()&rdquo; per the check-in comment. Hopefully, there will be a new release of StructureMap soon. Until then, feel free to use the StructureMap dll in this project which was built from trunk (revision 263).</strong></p>
<p>NHibernateBootstrap includes four projects:</p>
<ul>
<li><strong>NHibernateBootstrap.Core</strong> &ndash; fully functional domain and persistence classes to demonstrate NHibernate. </li>
<li><strong>NHibernateBootstrap.Tests</strong> &ndash; integration tests around CRUD operations for a Product class. </li>
<li><strong>NHibernateBootstrap.Tests.Environment</strong> &ndash; a single test that calls ObjectFactory.AssertConfigurationIsValid() to ensure that StructureMap is configured correctly. </li>
<li><strong>NHibernateBootstrap.Web</strong> &ndash; an ASP.NET MVC 1.0 application with a Product CRUD controller. </li>
</ul>
<p>The sample application bootstraps NHibernate, tests a ProductController, and provides full CRUD operations for a Product through an ASP.NET MVC web application.</p>
<p>In order to improve accessibility, I based my sample application on the one in the <a href="http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-application.aspx">Getting Started Guide</a> on <a href="http://nhforge.org/">NHibernate Forge</a> which originally came from <a href="http://www.lostechies.com/blogs/gabrielschenker/default.aspx">Gabriel Schenker</a>&rsquo;s excellent <a href="http://blogs.hibernatingrhinos.com/nhibernate/Default.aspx">NHibernateFAQ</a> series of blog posts.</p>
<p>Also, I started with <a href="http://ayende.com/">Ayende</a>&rsquo;s <a href="http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx">NHibernate Unit Testing</a> example to get familiar with interacting with <a href="http://www.sqlite.org/">SQLite</a>. I left his example in the <a href="http://code.google.com/p/mvbalaw-commons/source/browse/trunk/NHibernateBootstrap/src/NHibernateBootstrap.Tests/BlogTestFixture.cs">BlogTestFixture</a> class in the NHibernateBootstrap.Tests project.</p>
<p>So what do you think? You can leave comments here or it might be better to move the discussion over to a discussion <a href="http://groups.google.com/group/structuremap-users/browse_thread/thread/aaeee2092d94254b">thread</a> that I started in the <a href="http://groups.google.com/group/structuremap-users/">StructureMap Google group</a> to get more people involved.</p>
<p>Tags: <a rel="tag" href="http://technorati.com/tag/NHibernate">NHibernate</a>, <a rel="tag" href="http://technorati.com/tag/structuremap">StructureMap</a></p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2ftrason.net%2fjournal%2f2009%2f10%2f7%2fbootstrapping-nhibernate-with-structuremap.html"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2ftrason.net%2fjournal%2f2009%2f10%2f7%2fbootstrapping-nhibernate-with-structuremap.html" border="0" alt="kick it on DotNetKicks.com" /></a></p>]]></description><wfw:commentRss>http://trason.net/journal/rss-comments-entry-5416001.xml</wfw:commentRss></item><item><title>Code Snippets Using SyntaxHighlighter on SquareSpace</title><dc:creator>Weston M. Binford III</dc:creator><pubDate>Tue, 06 Oct 2009 23:56:40 +0000</pubDate><link>http://trason.net/journal/2009/10/6/code-snippets-using-syntaxhighlighter-on-squarespace.html</link><guid isPermaLink="false">342899:3630310:5417608</guid><description><![CDATA[<p>So, I didn&rsquo;t expect to return to blogging with such a cliche, but I couldn&rsquo;t find this information anywhere else. So, here&rsquo;s how to set up SyntaxHighlighting for a blog on SquareSpace.</p>
<p>Here is an example code snippet created using Alex Gorbatchev&rsquo;s <a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter">Syntax Highlighter</a> tool:</p>
<pre class="brush: csharp;">namespace StarterProject.Core
{
    public class HelloWorld
    {
        public string Speak()
        {
            return "Hello, World!";
        }
    } 
}</pre>
<p>It uses a series of javascript libraries and CSS styles to render code blocks in modern browsers.</p>
<p><a href="http://www.hanselman.com/blog/">Scott Hanselman</a>&rsquo;s blog post, <a href="http://www.hanselman.com/blog/BestCodeSyntaxHighlighterForSnippetsInYourBlog.aspx">Best Code Syntax Highlighter for Snippets in your Blog</a>. explains how Syntax Highlighter works.&nbsp; He even explains how to use it with <a href="http://www.codeplex.com/precode">PreCode</a>, a LiveWriter plug-in.</p>
<p>I host my blog at SquareSpace, but could not find information on using Syntax Highlighter with it.&nbsp; There is documentation on <a href="http://manual.squarespace.com/advanced-customization/can-i-add-flash-or-javascript-to-my-website.html">adding your own javascript</a> and <a href="http://manual.squarespace.com/search-engines-promotion/where-can-i-insert-my-google-analytics-or-other-tracking-jav.html">how to use Google Analytics</a>.&nbsp; Between these two pages, I was able to add the configuration necessary to integrate Syntax Highlighter with my blog.</p>
<p>First, login to your SquareSpace website.&nbsp; Then, under the Website Management menu, there is a menu called Data &amp; Media.&nbsp; Select the File Storage submenu.&nbsp; Create a folder called scripts and another one called styles.&nbsp; These folders will be available to your web pages as /storage/scripts and /storage/styles, respectively.&nbsp; <a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter:Download">Download</a> and unzip the Syntax Highlighter folder.&nbsp; Use the Upload Files button on the File Storage page to upload the contents of the scripts and styles folders to the new folders you just created at SquareSpace.</p>
<p>Under the Website Management menu, there is another menu called Structure.&nbsp; Select the Website Settings submenu item.&nbsp; On the Website Settings page, there is another menu bar.&nbsp; Select the Code Injection menu item which brings up a drop-down menu for the Injection Region and a textarea for the HTML code.&nbsp; Add the following code (you can cut and paste it from here) to the Extra Head Code (within &lt;head&gt; Tag) injection region:</p>
<pre class="brush: xml;">&lt;script type="text/javascript" src="storage/scripts/shCore.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushBash.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushCpp.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushCSharp.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushCss.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushDelphi.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushDiff.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushGroovy.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushJava.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushJScript.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushPhp.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushPlain.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushPython.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushRuby.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushScala.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushSql.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushVb.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="storage/scripts/shBrushXml.js"&gt;&lt;/script&gt;
&lt;link type="text/css" rel="stylesheet" href="storage/styles/shCore.css"/&gt;
&lt;link type="text/css" rel="stylesheet" href="storage/styles/shThemeDefault.css"/&gt;
&lt;script type="text/javascript"&gt;
    SyntaxHighlighter.config.clipboardSwf = 'storage/scripts/clipboard.swf';
    SyntaxHighlighter.all();
&lt;/script&gt;</pre>
<p>I noticed some issues with preview in LiveWriter and even previewing the blog posts before publishing them, but it looked right for me once I published the blog entries.&nbsp; For reference, I installed Syntax Highlighter version 2.0.320 and PreCode version 5.0.1.</p>
<p>You may also want to adjust the width of your content column to accommodate wider code snippets.&nbsp; If so, I recommend this page, <a href="http://manual.squarespace.com/website-structure/adjusting-column-widths.html">Adjusting Column Widths</a>.</p>]]></description><wfw:commentRss>http://trason.net/journal/rss-comments-entry-5417608.xml</wfw:commentRss></item><item><title>AltNetSeattle: Why We Stopped Using AutoMockingContainer</title><dc:creator>Weston M. Binford III</dc:creator><pubDate>Sat, 18 Apr 2009 13:35:09 +0000</pubDate><link>http://trason.net/journal/2009/4/18/altnetseattle-why-we-stopped-using-automockingcontainer.html</link><guid isPermaLink="false">342899:3630310:3669384</guid><description><![CDATA[<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:05077efc-2ba8-417b-8f3c-639755078b2e" class="wlWriterEditableSmartContent" style="display: inline; float: none; margin: 0px; padding: 0px;">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/alt.net">alt.net</a>, <a rel="tag" href="http://technorati.com/tags/altnetseattle">altnetseattle</a>, <a rel="tag" href="http://technorati.com/tags/mockobjects">mockobjects</a>, <a rel="tag" href="http://technorati.com/tags/mspec">mspec</a></div>
<p>&nbsp;</p>
<p>At the <a href="http://altnetseattle.pbwiki.com/">AltNetSeattle Open Spaces</a> conference at the end of February, <a href="http://codebetter.com/blogs/aaron.jensen/">Aaron Jensen</a> convened a session on how the AutoMockingContainer that they created is not working for them and where to go from here. I went into the session expecting an overview of Machine.Container, but it turned out to be more of a discussion of the issues that people are having using mock objects in Test Driven Development.</p>
<p>Basically, the problem is that refactoring break tests because they are brittle or because the tests are no longer relevant after the refactoring.&nbsp; So, you spend your time maintaining tests, not maintaining code.</p>
<p><strong>AutoMockingContainer</strong></p>
<p>Aaron described the evolution of their process as starting with manual mocking in fine-grained unit tests, but found that they were creating a lot of mocks.&nbsp; In response, they came up with the AutoMockingContainer.&nbsp; It worked great, but mocking entities was not as useful because they were persistent ignorant anyway.</p>
<p><strong>Fluent Builders</strong></p>
<p>This led to a move towards fluent fixtures or what some people call fluent builders (e.g. new Student(&ldquo;Bob&rdquo;).EnrolledIn(new Course(&ldquo;101&rdquo;)) ).&nbsp; The goal of fluent builders is to make it easy to create object graphs, but not necessarily specify the business behavior.&nbsp; However, even this process has problems because refactoring or decomposing a service breaks the tests because they are no longer relevant.</p>
<p><strong>Introducing a Container</strong></p>
<p><a href="http://jimmybogard.lostechies.com/">Jimmy Bogard</a> asked about introducing an Inversion of Control (IoC) container.&nbsp; Aaron said that the problem with containers is that registration time is slow and they can get in the way of testing.&nbsp; For example, a container would cache an object, but you might want more control than a traditional container allows you to have.&nbsp; For testing, you need a container that does fast registration, gives you the ability to override with mocks, and allows for lifetime reset.&nbsp; <a href="http://codebetter.com/blogs/aaron.jensen/archive/tags/machine/default.aspx">Machine</a> addresses some of these issues, but he did not go into detail on it.&nbsp; Instead, the session became more of a discussion about how different people deal with the brittleness.</p>
<p><strong>No real answers, yet</strong></p>
<p>Aaron went through a couple of examples of starting with the controller and adding checkpoints as you flesh out the implementation.&nbsp; Also, he brought up the idea of having tests that fail (warning tests?), but don&rsquo;t stop the rest of the tests.&nbsp; <a href="http://codebetter.com/blogs/ian_cooper/">Ian Cooper</a> mentioned their use of Fitnesse tests. (Read more about the session in Ian&rsquo;s blog <a href="http://codebetter.com/blogs/ian_cooper/archive/2009/03/02/alt-net-seattle-2009-some-impressions.aspx">post</a> about AltNetSeattle.)&nbsp; Aaron also mentioned the <a href="http://synthesis.rubyforge.org/">Ruby Synthesis</a> project which I would like to investigate further.</p>
<p>I came away from the session with a lot of new ideas, but no real answers, yet.&nbsp; However, it is nice to have the opportunity to listen to people that are further down the path than I am.&nbsp; Thanks to all who participated.</p>
<p>You can watch the video here:</p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:ccaed5e0-7540-4d25-a72e-71dae0538783" class="wlWriterEditableSmartContent" style="display: inline; float: none; margin: 0px; padding: 0px;">
<div><object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4173087&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4173087&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object><br /><a href="http://vimeo.com/4173087">AltNetSeattle: Why We Stopped Using the AutoMockingContainer</a> from <a href="http://vimeo.com/user1385004">Weston M. Binford III</a> on <a href="http://vimeo.com">Vimeo</a>.</div>
</div>
<p>&nbsp;</p>
<p>Here are my <a href="http://altnetseattle.pbwiki.com/Why+We+Stopped+Using+the+Auto-Mocking+Container+and+What%27s+Next">Session Notes</a>.</p>]]></description><wfw:commentRss>http://trason.net/journal/rss-comments-entry-3669384.xml</wfw:commentRss></item><item><title>AltNetHouston: FubuMVC session</title><category>altnethouston</category><category>fubumvc</category><dc:creator>Weston M. Binford III</dc:creator><pubDate>Sun, 12 Apr 2009 19:04:00 +0000</pubDate><link>http://trason.net/journal/2009/4/12/altnethouston-fubumvc-session.html</link><guid isPermaLink="false">342899:3630310:3621339</guid><description><![CDATA[<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:66de7a13-3723-4829-be10-872c4e032e5b" class="wlWriterEditableSmartContent" style="display: inline; float: none; margin: 0px; padding: 0px;">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/alt.net">alt.net</a>, <a rel="tag" href="http://technorati.com/tags/fubumvc">fubumvc</a>, <a rel="tag" href="http://technorati.com/tags/altnethouston">altnethouston</a></div>
<p>At the <a href="http://houston.altnetconf.com/home">AltNetHouston Open Spaces</a> conference last weekend, I convened a session on <a href="http://fubumvc.pbwiki.com">FubuMVC</a>.&nbsp; Selfishly, I wanted to get <a href="http://www.lostechies.com/blogs/chad_myers/">Chad Myers</a> and <a href="http://codebetter.com/blogs/jeremy.miller/">Jeremy Miller</a> to talk more about their alternative MVC stack.</p>
<p>FubuMVC is an MVC framework built on .NET.&nbsp; It is often looked at as an alternative to Microsoft&rsquo;s <a href="http://www.asp.net/mvc/">ASP.NET MVC</a>. framework that shipped last month.&nbsp; FubuMVC is a framework that grew organically out of work that Jeremy and Chad were doing at <a href="http://www.dovetailsoftware.com/">Dovetail Software</a>.&nbsp; The Fubu in FubuMVC is short for For Us By Us.</p>
<p>At <a href="http://kaizenconf.pbwiki.com/">Kaizenconf</a>, they gave a workshop called <a href="http://kaizenconf.pbwiki.com/Using+and+Abusing+ASPNET+MVC+for+Fun+and+Profit">Using and Abusing ASPNET MVC for Fun and Profit</a>.&nbsp; Based on the interest from that workshop, Chad looked to recreate the framework that they were using at Dovetail as an open-source project.&nbsp; Over the Christmas break, he coded the core of framework (available on Google Code <a href="http://code.google.com/p/fubumvc/">here</a>).</p>
<p>Unfortunately, my laptop died during the AltNetHouston conference and I was unable to keep my MinoHD camera charged.&nbsp; So, I was only able to record the first half hour of the hour and ten minute session.&nbsp; There was another video recording.&nbsp; I will try and track that down and post a link here if and when it is available.</p>
<p>In the meantime, here is the first half hour:</p>
<p><object width="400" height="230"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4113404&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4113404&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="230"></embed></object><br /><a href="http://vimeo.com/4113404">AltNetHouston: FubuMVC</a> from <a href="http://vimeo.com/user1385004">Weston M. Binford III</a> on <a href="http://vimeo.com">Vimeo</a>.<br /><a href="http://vimeo.com/4113404"></a></p>
<p>Also, here are the <a href="http://houstonaltnet.pbwiki.com/Fubu-MVC">Session Notes</a>.</p>]]></description><wfw:commentRss>http://trason.net/journal/rss-comments-entry-3621339.xml</wfw:commentRss></item><item><title>AltNetHouston: Opening Circle Video</title><category>alt.net</category><category>altnethouston</category><category>openspaces</category><dc:creator>Weston M. Binford III</dc:creator><pubDate>Sun, 12 Apr 2009 16:55:34 +0000</pubDate><link>http://trason.net/journal/2009/4/12/altnethouston-opening-circle-video.html</link><guid isPermaLink="false">342899:3630310:3622938</guid><description><![CDATA[<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:92fbe263-8d11-43c5-994b-8c1afa091d8f" class="wlWriterEditableSmartContent" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/altnethouston">altnethouston</a>,<a rel="tag" href="http://technorati.com/tags/openspaces">openspaces</a></div>
<p>Last weekend, I attended the <a href="http://houston.altnetconf.com">AltNetHouston Open Spaces</a> conference.&nbsp; Thanks to <a href="http://flux88.com/">Ben Scheirman</a>, <a href="http://claudiolassala.spaces.live.com/">Claudio Lassala</a>, and <a href="http://blog.microsoft-j.net/">J Sawyer</a> for organizing the event and to <a href="http://stevenlist.com/">Steven &ldquo;Doc&rdquo; List</a> for facilitating.&nbsp; I especially enjoyed the sessions on <a href="http://houstonaltnet.pbwiki.com/Fubu-MVC%C2%A0">FubuMVC</a> and <a href="http://houstonaltnet.pbwiki.com/Why-Blog-and-Open-Source%C2%A0">Why Blog and Open Source</a>.</p>
<p>As with previous conferences, there were a number of people videoing the proceedings.&nbsp; I had my MinoHD camera, but had battery charging issues after my laptop died.&nbsp; I did record the Opening Circle Friday night and part of the FubuMVC session on Saturday.</p>
<p>If you are not familiar with Open Spaces conferences, the participants get together at the beginning of the conference and create the agenda as a group.&nbsp; Doc is an excellent facilitator.&nbsp; Ben opened the conference and then turned it over to Doc to explain how Open Spaces work.&nbsp; Finally, the attendants proposed sessions for the weekend.</p>
<p>Here is the Opening Circle video:</p>
<p><object width="400" height="230"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4111810&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4111810&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="230"></embed></object><br /><a href="http://vimeo.com/4111810">AltNetHouston: Opening Circle</a> from <a href="http://vimeo.com/user1385004">Weston M. Binford III</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>You can see other videos and session notes for most of the sessions on the <a href="http://houstonaltnet.pbwiki.com/Houston-ALTDOTNET-Sessions">HoustonAltNet wiki</a>.</p>]]></description><wfw:commentRss>http://trason.net/journal/rss-comments-entry-3622938.xml</wfw:commentRss></item><item><title>"The perfect is the enemy of the good"</title><category>blogging</category><category>cliche</category><dc:creator>Weston M. Binford III</dc:creator><pubDate>Sat, 11 Apr 2009 00:51:18 +0000</pubDate><link>http://trason.net/journal/2009/4/11/the-perfect-is-the-enemy-of-the-good.html</link><guid isPermaLink="false">342899:3630310:3614897</guid><description><![CDATA[<p>So, at the risk of joining the revolution after it is already over, I have decided to start blogging.</p>
<p>This is something that I have planned to do for almost five years, but never started because I was afraid of starting and then not sticking to it, picking the wrong platform, or just not having enough to say.&nbsp; However, the <a href="http://houstonaltnet.pbwiki.com/Why-Blog-and-Open-Source%C2%A0">Why Blog and Open Source</a> session at the <a href="http://houston.altnetconf.com/home">ALT.NET Houston Open Spaces</a> conference last weekend gave me the kick that I needed to get started.</p>
<p>Instead of trying to get it perfect.&nbsp; I'm just going to start.&nbsp; Hopefully, there will be something here worth reading someday, but I know that I will never get it right if I don't start somewhere.&nbsp; So here goes.&nbsp; I take solace in the fact that nobody is probably reading.&nbsp; If you are, please bear with me as I find my voice.</p>]]></description><wfw:commentRss>http://trason.net/journal/rss-comments-entry-3614897.xml</wfw:commentRss></item></channel></rss>