<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0" xml:base="http://www.dovetailsoftware.com">
<channel>
 <title>Kevin Miller's blog</title>
 <link>http://www.dovetailsoftware.com/blog/kmiller</link>
 <description />
 <language>en</language>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/KevinMiller" /><feedburner:info uri="kevinmiller" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>30.406169</geo:lat><geo:long>-97.757438</geo:long><image><link>http://blogs.dovetailsoftware.com/blogs/kmiller/</link><url>http://farm2.static.flickr.com/1075/706129937_1a06f9f816_o.png</url><title>Kevin Miller - Early Onset</title></image><item>
 <title>Getting a ASP.Net request URL into a log4net context</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/rMf2RalGVRI/getting-a-aspnet-request-url-into-a-log4net-context</link>
 <description>&lt;p&gt;We make a lot of web applications and we use a lot of logging to diagnose problems on production systems. Often I find myself wishing I knew what URL was being rendered for a given log. In this post I’ll take you through a good solution for adding the current request URL to the log4net context. Better yet we will do this a configurable way so that you can turn this on and off when needed.&lt;/p&gt;  &lt;p&gt;One perfectly good way to do this would be to add a debug log to the start of each web request.&amp;#160; What I don’t like about this is that it can be tricky to scan logs with simultaneous requests and thus URLs being handled and keep track of which thread is being used to render what URL. Log4net has a context mechanism where you “push” &lt;a href="http://logging.apache.org/log4net/release/manual/contexts.html"&gt;context&lt;/a&gt; into “stacks”.&lt;/p&gt; &lt;script src="https://gist.github.com/3840130.js?file=logrequestcontext.cs"&gt;&lt;/script&gt;  &lt;p&gt;The push method returns a log context which implements IDisposible. When the context is disposed the context is popped off the stack. This allows you to push many different contexts onto the stack. &lt;/p&gt;  &lt;p&gt;Let’s take a look at a simple HttpModule which you can use to push the current request’s url into the log context&lt;/p&gt; &lt;script src="https://gist.github.com/3840130.js?file=logrequestcontext.cs"&gt;&lt;/script&gt;  &lt;p&gt;This module registers two event handlers on begin and end request where begin gets a logger from an IoC container pushes the request url into the context. When the request completes (or the module is disposed) the context is cleaned up effectively removing the url off the log context stack.&lt;/p&gt;  &lt;p&gt;A nice side-effect of making this a HTTPModule is that you can add or remove this HttpModule to your application as needed using IIS Manager or by editting your web.config.&lt;/p&gt; &lt;script src="https://gist.github.com/3840130.js?file=web.config.xml"&gt;&lt;/script&gt;  &lt;p&gt;And make sure you configure log4net appenders to include the context in log output pattern.&lt;/p&gt; &lt;script src="https://gist.github.com/3840130.js?file=log4net.config.xml"&gt;&lt;/script&gt;  &lt;p&gt;Finally here is an example of this module in action with the configuration settings you are seeing above.&lt;/p&gt; &lt;script src="https://gist.github.com/3840130.js?file=log-examples.txt"&gt;&lt;/script&gt;  &lt;p&gt;I hope you find this handy. If so &lt;a href="http://twitter.com/kevm"&gt;let me know&lt;/a&gt;. Not so much? Go watch &lt;a href="http://www.youtube.com/watch?v=go43XeW6Wg4"&gt;kitten videos&lt;/a&gt; on youtube&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/rMf2RalGVRI" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/10/05/getting-a-aspnet-request-url-into-a-log4net-context#comments</comments>
 <pubDate>Fri, 05 Oct 2012 15:29:48 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1927 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/10/05/getting-a-aspnet-request-url-into-a-log4net-context</feedburner:origLink></item>
<item>
 <title>Dovetail Bootstrap – Now With Service</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/4sUico1MHA0/dovetail-bootstrap-%E2%80%93-now-with-service</link>
 <description>&lt;p&gt;A customer recently asked me how to best create a Windows service using our Dovetail SDK. To me this sounds like a task for &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap"&gt;Dovetail Bootstrap&lt;/a&gt;. We have already provided a nice example of using Bootstrap of to build a web application. We did not, until now, have an example of using Bootstrap and Dovetail SDK to create a Windows service. Bootstrap makes it easy to pull data out of your Clarify database and &lt;a href="http://topshelf-project.com/"&gt;Topshelf&lt;/a&gt; makes it easy to roll your own Windows services . Let’s put them both together and build an example Windows service that monitors case creation in your Clarify database. &lt;/p&gt;  &lt;p&gt;If you'd like to skip right to the example you can find it in our &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/tree/master/source/Service"&gt;Dovetail Bootstrap source repository&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;Topshelf&lt;/h3&gt;  &lt;p&gt;At Dovetail we are &lt;a href="http://www.dovetailsoftware.com/blogs/kmiller/archive/2010/01/20/controlling-application-lifetime-in-topshelf"&gt;big&lt;/a&gt; &lt;a href="http://www.dovetailsoftware.com/blogs/kmiller/archive/2010/01/20/configuring-topshelf-using-a-structuremap-container"&gt;fans&lt;/a&gt; of Topshelf and its ability to easily create Windows services from plain .Net console applications. Our &lt;a href="http://www.dovetailsoftware.com/dovetail-seeker"&gt;Dovetail Seeker&lt;/a&gt; and &lt;a href="http://www.dovetailsoftware.com/dovetail-carrier"&gt;Dovetail Carrier&lt;/a&gt; products both use Topshelf for this purpose. First let’s take a look at how Topshelf configuration of your Windows service is done when your application starts up.&lt;/p&gt; &lt;script src="https://gist.github.com/3716577.js?file=program.cs"&gt;&lt;/script&gt;  &lt;p&gt;The code above informs Topshelf on how to configure Windows when you install this application as&amp;#160; a Windows service.&amp;#160; As the comment notes. The installation of the Windows service is done using the command line. It is easy to have your deployment script or windows installer automate this step. The most important part here is the service registration. You are not limited to registering only one service. BootstrapService wires everything up so let’s take a look at that.&lt;/p&gt; &lt;script src="https://gist.github.com/3716577.js?file=BootstrapService.cs"&gt;&lt;/script&gt;  &lt;p&gt;Topshelf is using an interface here to ensure you have methods for starting and stopping the service. In this example the start method constructs the IoC container and uses it to create a CaseMonitor which will do all the work. The IoC container is there because Bootstrap uses it to bring a lot of value. Things like automatic population of settings objects, getting a ClarifySession for the current user, logging support, and much more. Additionally using IoC containers make writing tests easier. Lets move on and take a look at the CaseMonitor.&lt;/p&gt;  &lt;h3&gt;Polling The Database&lt;/h3&gt; &lt;script src="https://gist.github.com/3716577.js?file=CaseMonitor.cs"&gt;&lt;/script&gt;  &lt;p&gt;CaseMonitor starts a timer that pulses every 15 seconds polling the database using a model map filtered by a timespan. It them simply writes to a logger what it finds.&amp;#160; The IoC container is in charge of providing the CaseMonitor’s constructor with instances of the types it is dependent on. The more interesting thing here is the IModelBuilder or RecentCaseModel. This builder uses a Model Map to know how to pull data from a Clarify database. &lt;/p&gt;  &lt;h3&gt;Model Maps&lt;/h3&gt; &lt;script src="https://gist.github.com/3716577.js?file=modelmap.cs"&gt;&lt;/script&gt;  &lt;p&gt;At Dovetail we use &lt;a href="http://www.dovetailsoftware.com/blogs/kmiller/archive/2009/04/27/introducing-dovetail-datamap"&gt;Model Maps&lt;/a&gt; extensively in our applications when we need to pull data out of the database into models (Projection) which we’ll be using in our MVC based applications. &lt;/p&gt;  &lt;h3&gt;Wrap Up&lt;/h3&gt;  &lt;p&gt;You might notice how little data access code we actually wrote. That is the beauty of Model Map. To make the Windows service aspect of your application you only need to give Topshelf some details and implement a ServiceControl based class. The two Dovetail applications I mentioned use the basic pattern demonstrated here but push TopShelf harder registering many Services &lt;a href="http://www.dovetailsoftware.com/blogs/kmiller/archive/2010/01/20/configuring-topshelf-using-a-structuremap-container"&gt;using the IoC container&lt;/a&gt; and &lt;a href="http://www.dovetailsoftware.com/blogs/kmiller/archive/2009/08/26/producing-and-consuming-messages-using-masstransit-and-structuremap"&gt;utilizing&lt;/a&gt; a message bus architecture &lt;a href="http://masstransit-project.com/"&gt;MassTransit&lt;/a&gt; from the same smart people &lt;a href="http://codebetter.com/drusellers/"&gt;Dru Sellers&lt;/a&gt; and &lt;a href="http://lostechies.com/chrispatterson/"&gt;Chris Patterson&lt;/a&gt; that brought you Topshelf. This extra messaging sauce which makes it easy to produce and consume a lot of work across many threads making the most of your server hardware.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/4sUico1MHA0" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/09/13/dovetail-bootstrap-%E2%80%93-now-with-service#comments</comments>
 <category domain="http://www.dovetailsoftware.com/tags/bootstrap">Bootstrap</category>
 <pubDate>Thu, 13 Sep 2012 20:20:24 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1907 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/09/13/dovetail-bootstrap-%E2%80%93-now-with-service</feedburner:origLink></item>
<item>
 <title>FubuMVC Hijacking Behaviors</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/ObghSirQQC0/fubumvc-hijacking-behaviors</link>
 <description>&lt;p&gt;Have you every wanted a convention to wrap an endpoint and conditionally transfer the original chain to a different one? No server redirect here just plain old hijack your currently scheduled response with another one. This is the FubuMVC equivalent of the classic ASP Server.Transfer. Here are a couple of examples on how to do this.&lt;/p&gt;  &lt;h3&gt;Scenario: Web Service API &lt;img style="display: inline; float: right" align="right" src="https://github.com/DarthFubuMVC/fubu-collateral/raw/master/png/light%20background/FubuMvc_Logo_small.png" /&gt;Exception Handling&lt;/h3&gt;  &lt;p&gt;We have a web services application where when things go wrong we want a pretty error page for the developer type who is consuming the service. You don’t want an ugly yellow and red YSOD you have too much style for that. &lt;/p&gt;  &lt;h3&gt;Answer: Wrap the Behavior Chain&lt;/h3&gt;  &lt;p&gt;In FubuMVC you can easily wrap one behavior with another. &lt;/p&gt; &lt;script src="https://gist.github.com/2484005.js?file=APIExceptionConvention.cs"&gt;&lt;/script&gt;  &lt;p&gt;This simple convention pulled from &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Dovetail.SDK.Fubu/Actions/ActionExceptionWrapper.cs"&gt;Dovetail Bootstrap&lt;/a&gt; wraps all of our API actions with the exception handling behavior. The generic argument is the type of the request you wish to redirect to when something goes wrong.&lt;/p&gt; &lt;script src="https://gist.github.com/2484006.js?file=ActionExceptionWrapper.cs"&gt;&lt;/script&gt;  &lt;p&gt;The behavior does the heavy lifting putting a &lt;i&gt;try/catch&lt;/i&gt; around a wrapped behavior. When an exception is thrown and Asp.Net custom errors are enabled we need to hijack the behavior and return a different result. The generic argument type is used to build the target chain’s input model and invoke that behavior chain using a FubuPartial. &lt;/p&gt;  &lt;h4&gt;A Partial? What the fsck is a FubuPartial?&lt;/h4&gt;  &lt;p&gt;A &lt;strong&gt;FubuPartial&lt;/strong&gt; is a really silly way of saying that we want to render the result of an input model. A partial can be rendered two ways: with or without authorization nodes. &lt;em&gt;Invoke() &lt;/em&gt;checks the authorization nodes and &lt;em&gt;InvokePartial()&lt;/em&gt; does not. Why wouldn’t you want to authorize? Well your behavior is likely already positioned after the authorization nodes&amp;#160; in the behavior chain so it might not benefit anyone to do yet another authorization. Unless that is you do for this particular part of your application. &lt;/p&gt;  &lt;p&gt;In the end a &lt;strong&gt;FubuPartial&lt;/strong&gt; is a handy way to get and render the contents of any behavior chain given you have the input model. &lt;strong&gt;Tldr;&lt;/strong&gt; Ok there you go this was the big take away from this post. The rest is window dressing and example code and chest thumping. &lt;/p&gt;  &lt;h3&gt;Scenario: Single Page Web App&lt;/h3&gt;  &lt;p&gt;Often with a single page application using a client side framework like &lt;a href="http://documentcloud.github.com/backbone"&gt;Backbone.js&lt;/a&gt; you want to support deep linking using&amp;#160; &lt;a href="https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history"&gt;browser History and pushState&lt;/a&gt;. Let’s support transferring web service requests coming from search engines and user’s bookmarks to the site’s actual home page while leaving the URL intact so the client side framework can be in-charge of rendering the page. &lt;/p&gt;  &lt;h4&gt;Background &lt;/h4&gt;  &lt;p&gt;A single page app does not reload it uses AJAX requests for everything. Your single page FubuMVC application will likely have RESTful-ish web services returning JSON for each of the views presented to the user. Urls like: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;/customer/new &lt;/li&gt;    &lt;li&gt;/customer/1 &lt;/li&gt;    &lt;li&gt;/customer/1/edit &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Your web services only return JSON and likely don’t have HTML versions of their results. If a user bookmarks one of these links they will only get back JSON. Yuck! &lt;/p&gt;  &lt;h4&gt;Enter TransferAPIRequestsTo Behavior&lt;/h4&gt;  &lt;p&gt;How about we Hijack web service requests that come from actual browsers. We do this in similar fashion as the first example:&lt;/p&gt; &lt;script src="https://gist.github.com/2483356.js?file=TransferAPIRequestsTo.cs"&gt;&lt;/script&gt;  &lt;p&gt;The API requests are wrapped with a behavior that checks to see if the request’s mimetype want’s HTML. If so, just like before we get the partial for the generic argument’s input model and render it.&lt;/p&gt;  &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;A couple of interesting scenarios that leverage the flexibility of FubuMVC in similar yet very different ways.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/ObghSirQQC0" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/04/24/fubumvc-hijacking-behaviors#comments</comments>
 <pubDate>Tue, 24 Apr 2012 22:24:21 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1786 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/04/24/fubumvc-hijacking-behaviors</feedburner:origLink></item>
<item>
 <title>Dovetail SDK C# Helper Extensions</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/egmRWmdQ-So/dovetail-sdk-c-helper-extensions</link>
 <description>&lt;p&gt;Dovetail SDK is quite useful for doing data access with your Clarify databases. When using our ClarifyGenerics there is some ceremony to the syntax there for backwards compatibility that always bothered me.&amp;#160; I’ve written a few helper extensions for Dovetail SDK that I use a lot these days so I thought I should share them with you. &lt;/p&gt;    &lt;h4&gt;ClarifyGeneric Extensions&lt;/h4&gt;  &lt;p&gt;&lt;script src="http://gist.github.com/1942703.js"&gt;&lt;/script&gt;&lt;/p&gt;  &lt;p&gt;I use these to help me filter generics in a fluent way. Create and Traverse to generics without needed a separate line to set which fields should be selected.&lt;/p&gt;  &lt;h4&gt;ClarifyDataRow Extensions&lt;/h4&gt;  &lt;p&gt;&lt;script src="http://gist.github.com/1942716.js"&gt;&lt;/script&gt;&lt;/p&gt;  &lt;p&gt;Row fields are plain objects but you always want to put them into a strongly typed variable. I use these to get at fields without having to do a lot of conversions and checking for DBNull.&lt;/p&gt;  &lt;h4&gt;An example of these extensions in play&lt;/h4&gt;  &lt;p&gt;&lt;script src="http://gist.github.com/1942487.js"&gt;&lt;/script&gt;&lt;/p&gt; Here I create a generic. Filter it in my fancy new way and project the results into many result objects.&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/egmRWmdQ-So" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/02/29/dovetail-sdk-c-helper-extensions#comments</comments>
 <category domain="http://www.dovetailsoftware.com/tags/dovetail-sdk-0">Dovetail SDK</category>
 <pubDate>Wed, 29 Feb 2012 17:40:52 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1765 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/02/29/dovetail-sdk-c-helper-extensions</feedburner:origLink></item>
<item>
 <title>Automating Deployment For Clairfy Using Rake</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/66LlotxPqzM/automating-deployment-for-clairfy-using-rake</link>
 <description>&lt;p&gt;Gary posted recently on &lt;a href="http://www.dovetailsoftware.com/blogs/gsherman/archive/2012/01/11/automated-deployment-for-clarify-example"&gt;Automating Deployment For Clarify&lt;/a&gt;. A customer recently had an automation need that I answered in a similar way but rather than using NAnt I pulled from our fancy favorite new build automation tool Rake. In this post we’ll take a look at automating common database setup tasks like applying schema scripts and executing arbitrary SQL using Rake. I hope you find it useful.&lt;/p&gt;  &lt;h3&gt;Where is the Code?&lt;/h3&gt;  &lt;p&gt;I put together a &lt;a href="https://gist.github.com/1705486"&gt;Dovetail Automation gist&lt;/a&gt; with everything you need to solve two problems. &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Applying&amp;#160; Dovetail Schema Editor schema scripts. &lt;/li&gt;    &lt;li&gt;Applying all SQL scripts in a directory. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Check out the &lt;a href="https://gist.github.com/1705486#file_a_readme.md"&gt;readme&lt;/a&gt; for setup and execution instructions. Next I’ll talk a little about what each task does.&lt;/p&gt;  &lt;h4&gt;Applying Schema Scripts (apply_schemascripts)&lt;/h4&gt;  &lt;p&gt;This task looks for a child directory named &lt;strong&gt;schema &lt;/strong&gt;below where the &lt;a href="https://gist.github.com/1705486#file_rakefile.rb"&gt;rakefile.rb&lt;/a&gt; is located. Every file in this directory ending in &lt;strong&gt;schemascript.xml&lt;/strong&gt; will be applied to your target database. &lt;/p&gt;  &lt;h4&gt;Applying SQL Scripts (apply_sql)&lt;/h4&gt;  &lt;p&gt;This task looks for the child directory named &lt;strong&gt;database&lt;/strong&gt; again below the current working directory. Every file ending in &lt;strong&gt;.sql &lt;/strong&gt;is &lt;/p&gt;  &lt;h4&gt;Ordering&lt;/h4&gt;  &lt;p&gt;Both these tasks apply files to your database in the order they are found in the file system. This means you’ll want your scripts to be orthogonal to each other. &lt;/p&gt;  &lt;p&gt;&lt;img alt="fork" src="https://a248.e.akamai.net/assets.github.com/images/gist/buttons/fork_button.png?1304432798" /&gt;&lt;/p&gt;  &lt;p&gt;I’ll leave it as an exercise to the reader to customize these scripts to follow a conventional file ordering. If you do fork the gist and &lt;a href="http://twitter.com/kevm"&gt;let me know&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;My Quick Argument For Rake over Nant&lt;/h3&gt;  &lt;p&gt;The main difference between to Nant and Rake is that NAnt encodes its behaviors using XML and Rake uses the scripting language Ruby. I am a self proclaimed NAnt Ninja but I do everything I can in Rake these days. Why? XML is pretty terrible at expressing useful behavior compared to a top shelf language like Ruby with lots of extensibility via its deep repository of Gems.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/66LlotxPqzM" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/02/06/automating-deployment-for-clairfy-using-rake#comments</comments>
 <category domain="http://www.dovetailsoftware.com/tags/automation-0">automation</category>
 <category domain="http://www.dovetailsoftware.com/tags/schemaeditor-0">schemaeditor</category>
 <category domain="http://www.dovetailsoftware.com/tags/sql">SQL</category>
 <pubDate>Mon, 06 Feb 2012 19:03:02 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1758 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/02/06/automating-deployment-for-clairfy-using-rake</feedburner:origLink></item>
<item>
 <title>Introducing Dovetail Bootstrap</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/Ph-oX1Undg4/introducing-dovetail-bootstrap</link>
 <description>&lt;p&gt;Over the years we’ve grown a lot of infrastructure for building web applications on Dovetail SDK. These infrastructure pieces get used by a lot of different Dovetail products. Today we are launching &lt;b&gt;Dovetail Bootstrap&lt;/b&gt; which packages up many handy capabilities like dynamic case history and case creation on top of common infrastructure like: model projection, authentication, logging, and session management. The core goal of Dovetail Bootstrap is to get Dovetail SDK developers up and creating web applications quickly.&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;!--break--&gt;  &lt;h3&gt;How do I get it?&lt;/h3&gt;  &lt;p&gt;The code for Bootstrap is &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/license.txt"&gt;open&lt;/a&gt; and available on &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap"&gt;GitHub&lt;/a&gt;. Feel free to watch, fork and improve the code. We’d love to work with you to add great new things to Bootstrap. I recommend reading the &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/readme.md"&gt;ReadMe&lt;/a&gt; as it takes you through setting up a development environment.&lt;/p&gt;  &lt;h3&gt;What Can Bootstrap Do?&lt;/h3&gt;  &lt;p&gt;Bootstrap is not a product but a starting point giving you the building blocks of your own applications. Let’s take a look at the basic features that are there now.&lt;/p&gt;  &lt;h4&gt;Authentication&lt;/h4&gt;  &lt;p&gt;Implementing authentication is a pain. Bootstrap’s “Hello Bootstrap” web application has a simple one. When a user is not authenticated they are redirected to the Sign In page. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-authentication.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="bootstrap-authentication" border="0" alt="bootstrap-authentication" src="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-authentication_thumb.png" width="488" height="374" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;After signing in, the user is taken to the URL they originally requested. Your code can easily get the current user of the current incoming web request. This is all pretty typical stuff for web developers but a pain to write and wire up. Below, the master layout uses a partial to display the current user.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-home-with-signout_0.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="bootstrap-home-with-signout" border="0" alt="bootstrap-home-with-signout" src="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-home-with-signout_thumb_0.png" width="604" height="358" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h4&gt;Case Listing &lt;/h4&gt;  &lt;p&gt;The home screen, above, demonstrates showing the user’s open cases. To accomplish this we are using a &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Web/Handlers/home/UserOpenCaseListingMap.cs#L27-34"&gt;Model Map&lt;/a&gt; to pull case details from a view (qry_case_view) to a view model object which the Spark view engine will consume.&lt;/p&gt;  &lt;p&gt;Clicking on the case ID takes us to the case history.&lt;/p&gt;  &lt;h4&gt;Dynamic History &lt;/h4&gt;  &lt;p&gt;We have invested a lot in our dynamic history infrastructure and here we are sharing it with you. Getting good case history is a tricky problem. There is the static history on the case record which is not that useful as its length maxes out at 32K. The better alternative is to use the activity entries logged for every action taken, but hand building history via activity entry queries and collating results is a tricky and manual data access task. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-history_0.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="bootstrap-history" border="0" alt="bootstrap-history" src="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-history_thumb_0.png" width="604" height="453" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;All the work to build this view is done by Bootstrap’s &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Web/Handlers/api/history/get_Type_Id_handler.cs#L18-25"&gt;history assembler&lt;/a&gt; and it works for cases, subcases, and solutions. Better yet the output of the history generated can be extensively customized:&lt;/p&gt;  &lt;p&gt;· &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Dovetail.SDK.Bootstrap/History/TemplatePolicies/SamplePolicy.cs#L10-14"&gt;Add or remove&lt;/a&gt; which history (activity) entries are shown&lt;/p&gt;  &lt;p&gt;· Edit history contents, including &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Dovetail.SDK.Bootstrap/History/TemplatePolicies/SubcaseActEntryTemplatePolicy.cs#L27-33"&gt;getting records related to the activity entry&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;· Child object history can be mixed in e.g. case history can contain selected sub case history items.&lt;/p&gt;  &lt;p&gt;The output of the history assembler is a &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Dovetail.SDK.Bootstrap/History/HistoryViewModel.cs"&gt;history view model&lt;/a&gt; and is rendered by the &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Web/Handlers/api/history/history.spark"&gt;appropriate view&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;Create Case&lt;/h4&gt;  &lt;p&gt;Most everyone wants to create a case at one time or another. Bootstrap comes with an example of doing this using our Dovetail SDK&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-create-case.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="bootstrap-create-case" border="0" alt="bootstrap-create-case" src="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-create-case_thumb.png" width="514" height="530" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Look in the &lt;em&gt;/api/cases/create&lt;/em&gt; handler directory. The get_handler class is in charge of showing the form for GET requests of&lt;em&gt; /api/cases/create &lt;/em&gt;url. The post_handler class handles POSTs to the same URL and creates the case based in the input model.&lt;/p&gt;  &lt;p&gt;Take a look a the drop downs for the case Type, Severity and Priority. The dropdown values are automatically populated by a feature of FubuMVC called HTML Conventions.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-create-case-dropdowns.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="bootstrap-create-case-dropdowns" border="0" alt="bootstrap-create-case-dropdowns" src="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-create-case-dropdowns_thumb.png" width="457" height="245" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this case we set an attribute on the output model of the create case GET. We have trained the web application to render special Html when trying to display an input for this “special” attributed property. HTML Conventions are another whole blog post. I put together &lt;a href="https://gist.github.com/1672372"&gt;a gist&lt;/a&gt; containing all the moving parts that make this happen.&lt;/p&gt;  &lt;h4&gt;Application List Listing (try to say that fast) &lt;/h4&gt;  &lt;p&gt;Application lists (GBSTs) are used a lot in Clarify. In fact, I just talked a bit too much about conventionally showing drop downs for them above. As an example in Bootstrap we provide a simple listing and detail view of application lists. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-gbst-listing_0.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="bootstrap-gbst-listing" border="0" alt="bootstrap-gbst-listing" src="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-gbst-listing_thumb_0.png" width="604" height="466" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Take a look at how easy it is to do the ClarifyGeneric query used to &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Web/Handlers/api/gbst/get_handler.cs#L19-25"&gt;generate the listing&lt;/a&gt;. Here is a detail view of one of the lists showing off its elements.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-gbst-list-detail_0.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="bootstrap-gbst-list-detail" border="0" alt="bootstrap-gbst-list-detail" src="http://www.dovetailsoftware.com/sites/default/files/kmiller/bootstrap-gbst-list-detail_thumb_0.png" width="604" height="466" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;To show this list detail view we &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Web/Handlers/api/gbst/show/get_Name_handler.cs#L18-38"&gt;project a view model&lt;/a&gt; from the Dovetail SDK’s list cache ordered by rank highlighting the default list element.&lt;/p&gt;  &lt;p&gt;That finishes our fly through of the Bootstrap Web example. There is an extremely exciting About page that I did not show off. I’ll let you grab the code and take it for a spin to see that gem.&lt;/p&gt;  &lt;h3&gt;What exactly is in Bootstrap?&lt;/h3&gt;  &lt;p&gt;Bootstrap is written in .Net 4.0. It currently consists of 3 libraries and a web application pulling the libraries together showing it all off.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Bootstrap&lt;/b&gt; – SDK session management, history builder, settings (configuration) support. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;ModelMap&lt;/b&gt; – map view models to your database schema and easily populate them (awesome). &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Fubu&lt;/b&gt; – FubuMVC specific infrastructure: list rendering conventions, forms and token based authentication. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Web&lt;/b&gt; – An example Agent authenticated web application with a user customized home page, case history rendering, create case example, application lists &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;Retrieving data using ModelMap &lt;/h4&gt;  &lt;p&gt;Long ago I talked about the first iteration of ModelMap called DataMapper.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“&lt;s&gt;DataMap&lt;/s&gt; ModelMap makes it easy to populate model objects from a Clarify/Dovetail CRM database. It is a sort of one-way Clarify specific object relational mapper tool.”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Model Map saves you from having to write a lot of data access code for querying and mapping data from query results into view models. For more details take a look at &lt;a href="http://www.dovetailsoftware.com/blogs/kmiller/archive/2009/04/27/introducing-dovetail-datamap"&gt;my original post&lt;/a&gt; and at the &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Web/Handlers/home/UserOpenCaseListingMap.cs#L27-34"&gt;example map&lt;/a&gt; shipped with Bootstrap which is used by the home page to build &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/blob/master/source/Web/Handlers/home/get_handler.cs#L17"&gt;a list&lt;/a&gt; of the current user’s open cases. If you don’t find anything else useful about Bootstrap do stop and take a look at the power of ModelMap at Dovetail we use it everywhere.&lt;/p&gt;  &lt;h4&gt;Web Application Framework&lt;/h4&gt;  &lt;p&gt;The Bootstrap web application is built on ASP.Net using the &lt;a href="http://mvc.fubu-project.org/"&gt;FubuMVC web framework&lt;/a&gt;. At Dovetail we use FubuMVC a lot. My secondary goal of Bootstrap is to make our customers more aware of “Fubu” by shipping great and useful examples of using it. &lt;/p&gt;  &lt;p&gt;By no means are you required to write only FubuMVC apps using Bootstrap. In fact, I’ve updated our &lt;a href="http://www.dovetailsoftware.com/dovetail-mobile"&gt;Dovetail Mobile&lt;/a&gt; product (based on ASP.Net MVC 2) to use Bootstrap to prove out this assertion. I may later provide guidance for using Bootstrap with ASP.Net MVC. Let me know if this interests you. &lt;/p&gt;  &lt;h3&gt;Wrap Up&lt;/h3&gt;  &lt;p&gt;That is about it for the main features and examples in the Bootstrap web application example. Bootstrap is by no means is done. We are starting to use Bootstrap as a foundation for our products at Dovetail and it has been really handy publishing the Bootstrap libraries as &lt;a href="http://nuget.org/"&gt;Nuget&lt;/a&gt; packages for use by us internally. &lt;/p&gt;  &lt;p&gt;The name of the project is a blatant rip-off of &lt;a href="http://twitter.github.com/bootstrap/"&gt;Twitter Bootstrap&lt;/a&gt; which we use in the web application.&lt;/p&gt;  &lt;p&gt;I apologize for glossing over a lot of FubuMVC detail there is an &lt;a href="http://mvc.fubu-project.org/getting-started/"&gt;ever improving about of educational information&lt;/a&gt; on Fubu out there. Go ahead and &lt;a href="https://twitter.com/fubumvc"&gt;follow them&lt;/a&gt; on the Twitters. &lt;/p&gt;  &lt;p&gt;If you have any suggestions or find bugs hit me on or &lt;a href="http://twitter.com/kevm"&gt;Twitter&lt;/a&gt; or create a &lt;a href="https://github.com/DovetailSoftware/dovetail-bootstrap/issues"&gt;GitHub issue&lt;/a&gt;. If you are stuck please do send me a line.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/Ph-oX1Undg4" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/01/24/introducing-dovetail-bootstrap#comments</comments>
 <pubDate>Tue, 24 Jan 2012 23:24:46 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1751 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2012/01/24/introducing-dovetail-bootstrap</feedburner:origLink></item>
<item>
 <title>Compositional Architecture FTW</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/nm8qAbURTEU/compositional-architecture-ftw</link>
 <description>&lt;p&gt;&lt;a title="Composition FTW!!!" href="http://www.flickr.com/photos/zigazou76/4486195717/"&gt;&lt;img style="margin: 0px 0px 0px 8px; display: inline; float: right" align="right" src="http://farm5.static.flickr.com/4003/4486195717_3e5c848ff8.jpg" width="240" height="161" /&gt;&lt;/a&gt;While doing a deployment of our Dovetail Carrier product our customer was having connectivity issues with their email server. We ran into situation where we needed prove that the product could connect and simply firing up an email client was not as good as proving that our code worked. The compositional architecture of Carrier allowed me to quickly build a little console application to detect email configuration problems.&lt;/p&gt;  &lt;h3&gt;Recompose It&lt;/h3&gt;  &lt;p&gt;Plucking the necessary pieces of code out of our application and recomposing a utility to solve the problem at hand was easy. Here is the gist of the console code.&lt;/p&gt;    &lt;br /&gt;&lt;script src="https://gist.github.com/1015413.js?file=email-config-tester.cs"&gt;&lt;/script&gt;  &lt;p&gt;Writing this code did not take long.&lt;/p&gt;  &lt;h4&gt;Lean on the container&lt;/h4&gt; Allowing the container to compose my types for me frees me from having to worry about minutia. There are other things going on behind the scenes that I don’t have to worry about. For better output I pulled in our logging infrastructure. Way better than writing to standard out.   &lt;br /&gt;&lt;script src="https://gist.github.com/1015413.js?file=output.txt"&gt;&lt;/script&gt;  &lt;h3&gt;Validation?&lt;/h3&gt;  &lt;p&gt;Not really. A minute before I posted the console app to the customer figured out the problem was on their side. But had the mystery still been afoot we’d had a tool on our belt.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/nm8qAbURTEU" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2011/06/09/compositional-architecture-ftw#comments</comments>
 <pubDate>Thu, 09 Jun 2011 22:01:55 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1662 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2011/06/09/compositional-architecture-ftw</feedburner:origLink></item>
<item>
 <title>Dovetail Software is Multi-Core Aware</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/U_0fFVTru0M/dovetail-software-is-multi-core-aware</link>
 <description>&lt;p&gt;A customer recently asked if they should provision multiple CPUs on virtual machines hosting Dovetail applications. The short answer is &lt;strong&gt;Yes &lt;/strong&gt;most of our applications do a pretty good job taking advantage of multiple CPU cores. Let’s take a look at this in a bit more detail.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intel.com/pressroom/enhanced/research/rockcreek/gallery/images/p_scc-h-wafer.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px 0px 0px 6px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="48-core-intel" border="0" alt="48 Core " align="right" src="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/image_5.png" width="179" height="174" intel?="Intel?" from="from" chip="chip" CloudCcomputing?="CloudCcomputing?" /&gt;&lt;/a&gt;Our Clarify products all use our .Net Dovetail SDK. The SDK is not itself multi-threaded (each thread runs on a CPU core) but most Dovetail products using the SDK utilize multiple cores in one way or another. &lt;/p&gt;  &lt;h3&gt;Web Applications&lt;/h3&gt;  &lt;p&gt;Most of our customers use one of our web applications. &lt;a href="http://www.dovetailsoftware.com/dovetail-agent"&gt;Dovetail Agent&lt;/a&gt;,&amp;#160; &lt;a href="http://www.dovetailsoftware.com/dovetail-agent-lite"&gt;Agent Lite&lt;/a&gt;, and &lt;a href="http://www.dovetailsoftware.com/dovetail-mobile"&gt;Dovetail Mobile&lt;/a&gt;, and &lt;a href="http://www.dovetailsoftware.com/dovetail-administration"&gt;Dovetail Administration&lt;/a&gt; are implicitly multi-threaded because the web server (IIS) that they run on uses a thread per web request being processed. &lt;/p&gt;  &lt;p&gt;Note: There is a limit to the &lt;a href="http://blogs.msdn.com/b/tmarq/archive/2007/07/21/asp-net-thread-usage-on-iis-7-0-and-6-0.aspx"&gt;number of threads IIS will put into play&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;Message Based Applications&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://www.dovetailsoftware.com/dovetail-seeker"&gt;Dovetail Seeker&lt;/a&gt; and &lt;a href="http://www.dovetailsoftware.com/dovetail-carrier"&gt;Dovetail Carrier&lt;/a&gt; are message based applications which run as Windows services. They both use multiple threads to produce and consume messages. This architecture does a very good job at parallelizing the work being done. For example Dovetail Seeker is a bit CPU intensive when indexing a large amount of content. We have seen a linear increase in the amount of content that can be indexed concurrently when adding additional cores. Here is a screenshot from my development machine doing some heavy Dovetail Seeker indexing.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/image_6.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/image_thumb_4.png" width="484" height="128" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Seeker’s usage is not purely CPU as there is still a bit of waiting that occurs while talking to the database and file system. It doesn’t hurt to have a fast&amp;#160; database server and local file system where the search indexes get written.&lt;/p&gt;  &lt;h3&gt;Dovetail RuleManager&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://www.dovetailsoftware.com/dovetail-rulemanager"&gt;Dovetail RuleManager&lt;/a&gt; is very much like our message base applications. It is a Windows service and uses multiple threads. We wrote this application before our experience with message based architectures. If I did major rework this application would become message based. RuleManager uses a producer consumer multi-threading model where one thread polls the database for events feeding consumer threads work to do when events are found.&lt;/p&gt;  &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;Should you use multiple CPUs for Dovetail applications? Yes. How many? I would recommend at least 2 cores for web applications. Our message based applications can in theory use as many CPUs as you throw at them.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/U_0fFVTru0M" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2011/04/12/dovetail-software-is-multi-core-aware#comments</comments>
 <pubDate>Tue, 12 Apr 2011 21:31:08 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1633 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2011/04/12/dovetail-software-is-multi-core-aware</feedburner:origLink></item>
<item>
 <title>Making ASP.Net Custom Errors Less Dookie</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/4CQjZkuFLuk/making-aspnet-custom-errors-less-dookie</link>
 <description>&lt;p&gt;I wanted to share some lessons learned from an experience recently adding custom error pages to one of our &lt;a href="http://fubumvc.com/"&gt;FubuMVC&lt;/a&gt; projects deployed to IIS7. &lt;/p&gt;  &lt;h3&gt;Treat your users well&lt;/h3&gt;  &lt;p&gt;Having good looking error pages in your app is a nice sign of polish. They mean that you care about your user’s experience even when things go wrong. &lt;a href="https://github.com/"&gt;Github&lt;/a&gt;, who always seems to knock it out of the park, recently updated their error pages. I love the 404 page complete with parallax JavaScript effects.&lt;/p&gt;  &lt;p&gt;&lt;a title="Click to check it out. Go ahead take a look. We&amp;#39;ll wait." href="https://github.com/doesnotexist!!!!"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Click to check it out. Go ahead take a look. We&amp;#39;ll wait." border="0" alt="Github 404 error page" src="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/image.png" width="404" height="259" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;ASP.Net has this all handled right?&lt;/h3&gt;  &lt;p&gt;Sure they do. Well sort of. Lets take a look at your web.config.&lt;/p&gt;  &lt;h4&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms690497(v=vs.90).aspx"&gt;httpErrors&lt;/a&gt; – good for static content&lt;/h4&gt;  &lt;p&gt;An &lt;a href="http://msdn.microsoft.com/en-us/library/ms690497(v=vs.90).aspx"&gt;httpError&lt;/a&gt; seems to allow you to customize error pages for static sites and the parts of your app that do not flow through the ASP.Net runtime. For us this worked well for our 404. The main problem here is that you cannot use a virtual path to your error page.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/httpErrors.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="title" border="0" alt="httpErrors entry" src="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/httpErrors_thumb.png" width="604" height="158" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Unfortunately, this requires that we have a deployment step to set the correct value in the path attribute of the error element.&lt;/p&gt;  &lt;h4&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/h0hfz6fc.aspx"&gt;customErrors&lt;/a&gt; – almost good but not quite great&lt;/h4&gt;  &lt;p&gt;A customError tells ASP.Net to avoid the built in IIS (404, 403) and Yellow Screens of Death (500) error pages and instead use what you provide. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/customErrors.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="title" border="0" alt="customErrors Entry" src="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/customErrors_thumb.png" width="457" height="106" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We ran into one major problem with this. What actually happens under the hood is that an error on your page generates a 302 redirect to your custom error page. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/image_0.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="firebug trace of the error redirect" border="0" alt="firebug trace" src="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/image_thumb.png" width="432" height="52" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This doesn’t seem too bad. Until you think about it. You have an error page with is ultimately returning a &lt;strong&gt;200 OK &lt;/strong&gt;status.&amp;#160; It is saying everything is &lt;u&gt;OK&lt;/u&gt; when it is &lt;u&gt;NOT&lt;/u&gt;. The mismatched status code breaks the semantic contract your error page has with your browser. &lt;/p&gt;  &lt;p&gt;Where this goes terribly wrong is with AJAX requests. AJAX will now receive no error when things go wrong. This has the effect of really messing up AJAX requests that pull in server side generated views. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/messedup-ajax.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="messedup-ajax" border="0" alt="messedup-ajax" src="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/messedup-ajax_thumb.jpg" width="504" height="325" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;See how the error page is plopped into the middle of the website. Lovely. This happened because jQuery’s ajax method dutifully followed the error redirect pulled in the error page’s html content into results div. &lt;/p&gt;  &lt;p&gt;We have error handlers which look much nicer. Let’s make them work. &lt;/p&gt;  &lt;h4&gt;Fixing the AJAX error redirect problem&lt;/h4&gt;  &lt;p&gt;We tried way to hard to get this to work. In the end it was something simple that our Dovetail colleagues had already found. The solution is to prevent the custom error page from rendering for AJAX requests. Turns out this is pretty easy.&lt;/p&gt; &lt;script src="https://gist.github.com/776816.js?file=snip-global.asax.cs"&gt;&lt;/script&gt;  &lt;p&gt;This code is cancelling the error and rendering a short error page with the proper 500 error when something goes wrong. Now our example AJAX request can handle the error.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/image_4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Better error result" border="0" alt="Correct AJAX error" src="http://blogs.dovetailsoftware.com/sites/default/files/kmiller/image_thumb_3.png" width="504" height="177" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;Hopefully this was useful and we didn’t miss too many obvious alternative solutions. Down the road I’d rather have a behavior in FubuMVC that skips the custom errors if they are enabled and also supports 403 authorization errors behind AJAX requests. Better yet I wish that custom errors would do the right thing and serve up the correct status by default.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/4CQjZkuFLuk" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2011/01/13/making-aspnet-custom-errors-less-dookie#comments</comments>
 <pubDate>Thu, 13 Jan 2011 22:15:51 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1577 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2011/01/13/making-aspnet-custom-errors-less-dookie</feedburner:origLink></item>
<item>
 <title>How To Setup hMailServer To Use a SSL Certificate</title>
 <link>http://feedproxy.google.com/~r/KevinMiller/~3/yCs3OEIoKM4/how-to-setup-hmailserver-to-use-a-ssl-certificate</link>
 <description>&lt;p&gt;I am adding IMAP support to one of our &lt;a href="http://blogs.dovetailsoftware.com/blogs/kmiller/archive/tags/carrier/default.aspx"&gt;products&lt;/a&gt;. Likely more that one person out there a needed to do this, so enjoy. I’ll take you from creating an SSL certificate to configuring &lt;a href="http://www.hmailserver.com/"&gt;hMailServer&lt;/a&gt; to work with both secure and regular connections to testing your setup.&lt;/p&gt;  &lt;h3&gt;Creating a Self Signed SSL Certificate&lt;/h3&gt;  &lt;p&gt;First things first you’ll need to &lt;a href="http://www.slproweb.com/products/Win32OpenSSL.html"&gt;download OpenSSL&lt;/a&gt;. I downloaded the &lt;a href="http://www.slproweb.com/download/Win64OpenSSL_Light-1_0_0a.exe"&gt;64bit 1.0 light version&lt;/a&gt; which required &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=bd2a6171-e2d6-4230-b809-9a8d7548c1b6"&gt;Visual C++ 2008 Redistributables (x64)&lt;/a&gt; to be installed first. I told the installer to put OpenSSL in my &lt;strong&gt;c:\utilites\&lt;/strong&gt; folder.&lt;/p&gt;  &lt;h4&gt;Create a Key&lt;/h4&gt;  &lt;p&gt;Next up you’ll need to create a key. I recommend you replace &lt;strong&gt;&amp;lt;host&amp;gt;&lt;/strong&gt; with your machine name.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;gt;&lt;strong&gt;openssl&lt;/strong&gt; genrsa -out &amp;lt;host&amp;gt;.key 1024&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;Certificate Request&lt;/h4&gt;  &lt;p&gt;Now you need to create a certificate request. This is the file you normally send off to your &lt;a href="http://www.smallbusinessnewz.com/topnews/2008/03/18/top-five-ssl-certificate-providers"&gt;SSL certificate provider&lt;/a&gt;. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;gt;&lt;strong&gt;openssl&lt;/strong&gt; req -new -nodes -key &amp;lt;host&amp;gt;.key -out &amp;lt;host&amp;gt;.csr&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Oops if you’re like me here you’ll get this error: &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Unable to load config info from C:/lan/ssl/openssl.cnf&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Looks like the default config location is not cutting it. You can clue OpenSSL in with an environment variable:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;SET OPENSSL_CONF=c:\utilities\OpenSSL-Win64\bin\openssl.cfg&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Let’s try that again…&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;gt;&lt;strong&gt;openssl&lt;/strong&gt; req -new -nodes -key &amp;lt;host&amp;gt;.key -out &amp;lt;host&amp;gt;.csr&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Answer the questions the best you can.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/blogs/kmiller/image_27423E67.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Example Certification Request Input" border="0" alt="Example Certification Request Input" src="/sites/default/files/MTM4My1pbWFnZV90aHVtYl8wMDA3RjUzMi5wbmc=.png" width="604" height="340" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;For the Common Name you should put the fully qualified domain name of the server where you will deploy the certificate.&lt;/p&gt;  &lt;h4&gt;Self Signing the Certificate Request&lt;/h4&gt;  &lt;p&gt;If you are like me this certificate is for development and you won’t really need a certificate authority to sign it for testing purposes. Luckily it is easy to generate your own certificate.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;gt;&lt;strong&gt;openssl&lt;/strong&gt; x509 -req -days 1024 -in &amp;lt;host&amp;gt;.csr -signkey &amp;lt;host&amp;gt;.key -out &amp;lt;host&amp;gt;.cert&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;Configuring hMailServer With Your New SSL Certificate&lt;/h3&gt;  &lt;p&gt;Bring up your hMailServer administrator UI and add a SSL certificate&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/blogs/kmiller/image_0DDA3B2D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Add a SSL certificate" border="0" alt="Add a SSL certificate" src="/sites/default/files/MTM4My1pbWFnZV90aHVtYl8zRkQxREJCNy5wbmc=.png" width="604" height="454" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Next create new TCP/IP ports which use SSL for each protocol you are interested in testing. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/blogs/kmiller/image_38B29F3F.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Add TCP/IP ports and protocols" border="0" alt="Add TCP/IP ports and protocols" src="/sites/default/files/MTM4My1pbWFnZV90aHVtYl80Njg0RTUzQS5wbmc=.png" width="604" height="454" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Notice the port numbers I use for IMAP (993) POP3 (995) seem to be the default secure ports for these two protocols. Each change will restart hMailServer. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h3&gt;Test Your Secure Connection&lt;/h3&gt;  &lt;p&gt;Go ahead and fire up your favorite email client. I use Windows Live Mail which I’ve configured to pull email from one of the test accounts I’ve setup on hMailServer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/blogs/kmiller/image_787C85C4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="user address" border="0" alt="user address" src="/sites/default/files/MTM4My1pbWFnZV90aHVtYl82RDUyRkI3QS5wbmc=.png" width="304" height="369" /&gt;&lt;/a&gt; &lt;a href="http://blogs.dovetailsoftware.com/blogs/kmiller/image_1F4A9C05.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="server addresses" border="0" alt="server addresses" src="/sites/default/files/MTM4My1pbWFnZV90aHVtYl81MTQyM0M4Ri5wbmc=.png" width="304" height="369" /&gt;&lt;/a&gt; &lt;a href="http://blogs.dovetailsoftware.com/blogs/kmiller/image_4618B245.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="server port and security settings" border="0" alt="server port and security settings" src="/sites/default/files/MTM4My1pbWFnZV90aHVtYl8wRDAxRDU0My5wbmc=.png" width="304" height="369" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;And now for a test message or two?&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.dovetailsoftware.com/blogs/kmiller/image_3EF975CD.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/sites/default/files/MTM4My1pbWFnZV90aHVtYl8zN0RBMzk1NS5wbmc=.png" width="604" height="431" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I’ve setup a few pop3 accounts and an IMAP and had a lot of fun sending my virtual test personas emails. The dialog is not so riveting. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h3&gt;You’ve Got SSL&lt;/h3&gt;  &lt;p&gt;There you go. Hopefully you didn’t run into anything weird that I did not.&amp;#160; This post is basically a roll up of the hMailServer &lt;a href="http://www.hmailserver.com/documentation/latest/?page=reference_sslcertificates"&gt;SSL certificate documentation&lt;/a&gt;. And &lt;a href="http://sial.org/howto/openssl/csr/"&gt;Generating Certificate Signing Requests&lt;/a&gt; from &lt;a href="http://sial.org/"&gt;Jeremy Mate&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KevinMiller/~4/yCs3OEIoKM4" height="1" width="1"/&gt;</description>
 <comments>http://www.dovetailsoftware.com/blogs/kmiller/archive/2010/08/17/how-to-setup-hmailserver-to-use-a-ssl-certificate#comments</comments>
 <category domain="http://www.dovetailsoftware.com/tags/carrier">carrier</category>
 <category domain="http://www.dovetailsoftware.com/tags/email-0">email</category>
 <category domain="http://www.dovetailsoftware.com/tags/email-agent-0">email agent</category>
 <category domain="http://www.dovetailsoftware.com/tags/howto">howto</category>
 <category domain="http://www.dovetailsoftware.com/blog/kevin-miller">Kevin Miller</category>
 <pubDate>Tue, 17 Aug 2010 15:17:35 +0000</pubDate>
 <dc:creator>kmiller</dc:creator>
 <guid isPermaLink="false">1383 at http://www.dovetailsoftware.com</guid>
<feedburner:origLink>http://www.dovetailsoftware.com/blogs/kmiller/archive/2010/08/17/how-to-setup-hmailserver-to-use-a-ssl-certificate</feedburner:origLink></item>
</channel>
</rss>
