Tuesday, May 12, 2009

Working with DLLs and C# plugins can be an interesting problem. In our particular case, I needed to be able to drop in a dll (not known at compile time) based on a known interface, and have it discovered an run during runtime.

I found the following video that made everything crystal clear:
http://www.johnkoerner.com/index.php?/archives/43-Creating-a-Plugin-Architecture-in-C.html

Other interesting reading:
http://www.codeproject.com/KB/cs/c__plugin_architecture.aspx
http://www.c-sharpcorner.com/UploadFile/rmcochran/plug_in_architecture09092007111353AM/plug_in_architecture.aspx
http://digg.com/programming/Building_a_Plugin_Architecture_with_C_
http://msdn.microsoft.com/en-us/architecture/bb735304.aspx

Wednesday, May 6, 2009

An update to MS Office caused the following message box to appear continually:
MESSAGE TEXT

[Title] Office Live Workspace

[Body]
Get Started With Office Live


Thanks for installing Office live add-in via Microsoft Update. You can now get started using Office Live Workspace.

This Office Live Workspace lets you:

-Access and view documents from almost any computer with a Web browser
-Open and save online documents directly from Word, Excel, and PowerPoint.

[checkbox] Do not show me this message again [buttons] Continue | Close

The solution to this is here: http://blogs.technet.com/arykhus/archive/2009/01/26/get-started-with-office-live-add-in-window-keeps-popping-up-after-first-startup-of-word-excel-powerpoint-2007.aspx

Note that this is a registry based solution. Be careful!!!

Sunday, May 3, 2009

So I was thinking about the situation of one of the websites I work with. The website is on a separate server from the SMTP server, so requests for information, purchases, etc. risk getting dead air.

I chose to solve this problem by setting up a fairly simple queue on the web server. Essentially, any time someone sends an email, it tries to send anything on the queue. If it can't, then things stay on the queue a little longer. During a typical server reboot, this should accumulate a half dozen emails or so before the SMTP server is back online.

Here's the code. I'd love to hear your thoughts! If you copy\paste, I would appreciate if you could leave our company information in the comments.


using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Mail;

namespace IntentDrivenClassLibrary
// library developed by Intent Driven Designs
// http://www.IntentDriven.com
// copyright 2009
// free to use - post back any changes - do not remove this comment
// posted on http://blog.intentdriven.com
{
   public static class IDDSendMail
   {
      private static Queue Messages = new Queue();

      public static MailMessage Message
      {
         set
         {
            Messages.Enqueue(value);
            while (Messages.Count > 0)
            {
            MailMessage msg = Messages.Dequeue();
            try
            {
               SmtpSendEmail(msg);
            }
            catch (Exception)
            {
               Messages.Enqueue(msg);
               break;
            }
         }
      }
   }

   private static void SmtpSendEmail(MailMessage msg)
   {
      SmtpClient client = new SmtpClient("localhost")
         {
            Port = 587,
            Credentials = new NetworkCredential("[emailaccount]","[emailpassword]")
         };
      client.Send(msg);
      }
   }
}

JP Hamilton will soon be teaching a Code Dojo at the Houston Microsoft office. All of the information is on the Houston Alt.Net Wiki, so come over and check it out!

If you're ready to register, head over to the Registration Page.

WHEN: May 7th at 6 PM
WHERE: Microsoft Office in Houton
WHAT: Totally awesome TDD Code Dojo lead by JP Hamilton of Sogeti.


Thanks to J for helping us get it scheduled at MS!!!