Have you ever noticed that furniture makers always make computer desks with those closed off little cubby holes for the tower? It’s about time someone told them computers need ventilation to work properly. I’ve seen countless computers overheat and die an untimely death due to this lack of understanding of simple common sense.

Computers have fans in them for a reason: air flow. They take cool air in and expel hot air, all the while keeping the internal case at a constant temperature, in theory. Most of the time though they run hot if they’re more than the little Wally-world special.

So, furniture companies, please remember to leave plenty of breathing room and exhaust ports for computers in your desks and nooks.

I use ELMAH for error handling on a lot of my projects and recently started using FogBugz again after a brief hiatus. The only problem was that to use FogBugz with BugzScout I had to put code in my applications when I already had ELMAH running. I thought that wasn’t very elegant so I grabbed the ELMAH source and the BugzScout source and hacked together a module for ELMAH that will submit to FogBugz. Please note that the formatting needs work as it submits a bunch of HTML at the moment, which FogBugz is interpreting as plain text. Once I get that fixed I’ll post an update or feel free to send me one if you’re ambitious.

I’ve linked the sample files above if you care to look. Just add these to the ELMAH project and use the custom configuration section…

   1: <errorFogBugz
   2:         area="Misc"
   3:         customerEmail="webserver@example.com"
   4:         project="Misconfigured"
   5:         url="https://yoururl.fogbugz.com/ScoutSubmit.asp"
   6:         userName="John Doe"
   7:         defaultMessage=""
   8:         forceNewBug="false"
   9:         />

And you have to add the config section to the top…

   1: <section name="errorFogBugz" requirePermission="false" type="Elmah.ErrorFogBugzSectionHandler, Elmah"/>

Finally you add the module to your modules sections…

   1: <httpModules>
   2:     <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
   3:     <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
   4:     <add name="MsAjaxDeltaErrorLog" type="Elmah.MsAjaxDeltaErrorLogModule, Elmah"/>
   5:     <add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah"/>
   6:     <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
   7:     <add name="ErrorFogBugz" type="Elmah.ErrorFogBugzModule, Elmah"/>
   8:     <!--<add name="FixIIS5xWildcardMapping" type="Elmah.FixIIS5xWildcardMappingModule, Elmah"/>-->
   9: </httpModules>

or for IIS7 use this one…

   1: <system.webServer>
   2:         <validation validateIntegratedModeConfiguration="false"/>
   3:         <modules runAllManagedModulesForAllRequests="true">
   4:             <add name="ErrorMail" preCondition="managedHandler" type="Elmah.ErrorMailModule, Elmah"/>
   5:             <add name="ErrorLog" preCondition="managedHandler" type="Elmah.ErrorLogModule, Elmah"/>
   6:             <add name="MsAjaxDeltaErrorLog" preCondition="managedHandler" type="Elmah.MsAjaxDeltaErrorLogModule, Elmah"/>
   7:             <add name="ErrorTweet" preCondition="managedHandler" type="Elmah.ErrorTweetModule, Elmah"/>
   8:             <add name="ErrorFilter" preCondition="managedHandler" type="Elmah.ErrorFilterModule, Elmah"/>
   9:             <add name="ErrorFogBugz" preCondition="managedHandler" type="Elmah.ErrorFogBugzModule, Elmah"/>
  10:         </modules>
  11:         <handlers>
  12:             <add name="Elmah" preCondition="integratedMode" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
  13:         </handlers>
  14: ...

I hope that someone finds this useful. If there is interest I may package these as a companion library for ELMAH or contribute them to the project.

A couple of quick extension methods for your amusement that I use a lot.


   1:          /// <summary>
   2:          /// Runs action against the specified source.
   3:          /// </summary>
   4:          /// <typeparam name="T">The type of the element.</typeparam>
   5:          /// <param name="source">The source.</param>
   6:          /// <param name="action">The action.</param>
   7:          public static void Run<T>(this IEnumerable<T> source, Function<T> action)
   8:          {
   9:              if (source == null)
  10:              {
  11:                  throw new ArgumentNullException("source");
  12:              }
  14:              if (action == null)
  15:              {
  16:                  throw new ArgumentNullException("action");
  17:              }
  19:              foreach (var element in source)
  20:              {
  21:                  action(element);
  22:              }
  23:          }
  25:          /// <summary>
  26:          /// Does action against the specified source and returns the source.
  27:          /// </summary>
  28:          /// <typeparam name="T">The type of the element.</typeparam>
  29:          /// <param name="source">The source.</param>
  30:          /// <param name="action">The action.</param>
  31:          /// <returns>The source after the action is executed.</returns>
  32:          public static IEnumerable<T> Do<T>(this IEnumerable<T> source, Function<T> action)
  33:          {
  34:              if (source == null)
  35:              {
  36:                  throw new ArgumentNullException("source");
  37:              }
  39:              if (action == null)
  40:              {
  41:                  throw new ArgumentNullException("action");
  42:              }
  44:              return source.Select(
  45:                  element =>
  46:                  {
  47:                      action(element);
  48:                      return element;
  49:                  });
  50:          }