﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  <channel>
    <title>old poor october</title>
    <description />
    <link>http://blog.opo.li/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 2.0.0.36</generator>
    <language>en-US</language>
    <blogChannel:blogRoll>http://blog.opo.li/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://blog.opo.li/syndication.axd</blogChannel:blink>
    <dc:creator>Dave Hauser</dc:creator>
    <dc:title>old poor october</dc:title>
    <geo:lat>0.000000</geo:lat>
    <geo:long>0.000000</geo:long>
    <item>
      <title>ASP.NET MVC: Loading data for select lists into edit model using attributes</title>
      <description>&lt;p&gt;After reading &lt;a title="ASP.NET MVC 2 in Action" href="http://www.manning.com/palermo2"&gt;ASP.NET MVC 2 in Action&lt;/a&gt; and watching a &lt;a title="Put your controllers on a diet (Jimmy Bogard)" href="http://www.viddler.com/explore/mvcconf/videos/1/"&gt;presentation from MvcConf by Jimmy Bogard&lt;/a&gt;, I decided to implement some of their ideas in my current project. They use the concept of AutoMapViewResults, which are pretty neat. They use &lt;a title="AutoMapper" href="http://automapper.codeplex.com"&gt;AutoMapper&lt;/a&gt; to map the model to a displaymodel or inputmodel. If you want to see exactly, what's going on there, you should watch Jimmy's presentation. The result is a really tiny controller:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:9bd3b687-a9ef-4ba3-b5d2-1047312cbb8d" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;public ActionResult Show(Event id)
{
  return AutoMapView&amp;lt;EventsShowModel&amp;gt;(id);
}&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:c65c53e1-f1cd-4bdf-94eb-7ffe9b478152" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;public ActionResult Edit(Event id)
{
  return AutoMapView&amp;lt;EventsEditModel&amp;gt;(id);
}
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;One problem now is that in editmodels you often need some additional data, for example for select lists. I found no satisfying solution achieving this with AutoMapper. So after asking about this on Stack Overflow, I decided to try it with a custom attribute. And here is what I came up with. It works for every entity type I have in my database, so there's only this one attribute for all of my select lists in my project.&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:15e6856a-9e9d-4684-976b-6d0948a03f13" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public class LoadSelectListDataAttribute : Attribute
{
    public Type DataType { get; set; }  // defines the entity type I want to populate the select list with
    public string TextPropertyName { get; set; }  // defines the property of the entity, that is used for the text in the select box
    public string ValuePropertyName { get; set; }  // defines the property of the entity, that is used for the value in the select box
    public string SelectedValuePropertyName { get; set; }  // defines some other property on the editmodel, that contains the selected value
    public object SelectedValue { get; set; }  // defines a fixed selected value (if SelectedValuePropertyName is set, then this will be overriden)

    public LoadSelectListDataAttribute() { }
    public LoadSelectListDataAttribute(Type dataType, string textPropertyName, string valuePropertyName) : this(dataType, textPropertyName, valuePropertyName, null) { }
    public LoadSelectListDataAttribute(Type dataType, string textPropertyName, string valuePropertyName, string selectedValueProperty)
    {
        DataType = dataType;
        TextPropertyName = textPropertyName;
        ValuePropertyName = valuePropertyName;
        SelectedValuePropertyName = selectedValueProperty;
    }
}
// the class that actually handles the editmodel/attribute
public static class LoadSelectListDataHandler
{
    public static void Handle(object objectToHandle)
    {
        var properties = objectToHandle.GetType().GetProperties();
        foreach (var property in properties)  // iterate through each property of the editmodel
        {
            if (typeof(IList&amp;lt;SelectListItem&amp;gt;).IsAssignableFrom(property.PropertyType))  // checks if the property is of type IList&amp;lt;SelectListItem&amp;gt;
            {
                var attribute = (LoadSelectListDataAttribute)Attribute.GetCustomAttribute(property, typeof(LoadSelectListDataAttribute));  // checks LoadSelectListDataAttribute
                if (attribute != null)
                {
                    string selectedValue = (string)attribute.SelectedValue;
                    if (attribute.SelectedValuePropertyName != null)
                    {
                        // if SelectedValuePropertyName is set on the attribute then load the appropriate value
                        selectedValue = objectToHandle.GetType().GetProperty(attribute.SelectedValuePropertyName).GetValue(objectToHandle, null).ToString();
                    }
                    var service = (IService)IoC.Resolve(typeof(IService&amp;lt;&amp;gt;).MakeGenericType(attribute.DataType));  // get the Service for the specified data type using IoC (IoC.Resolve is just a wrapper about my actual IoC container, currently StructureMap)
                    var items = service.All();
                    var data = (from x in items
                                let text = x.GetType().GetProperty(attribute.TextPropertyName).GetValue(x, null).ToString()  // get text from entity
                                let value = x.GetType().GetProperty(attribute.ValuePropertyName).GetValue(x, null).ToString()  // get value from entity
                                select new SelectListItem
                                {
                                    Text = text,
                                    Value = value,
                                    Selected = value == selectedValue
                                }).OrderBy(x =&amp;gt; x.Text).ToList();
                    property.SetValue(objectToHandle, data, null);  // set the value of the editmodel's property (with the LoadSelectListDataAttribute) to the generated list
                }
            }
        }
    }
}&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;How to use this attribute?&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:8ad81442-44c3-4564-8c20-e5e977c0a4be" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;// decorate your viewmodel/editmodel
public class EventsEditModel
{
	public string Name {get; set;}

	[LoadSelectListData(typeof(Location), "Name", "Id", "LocationId")]
	public IList&amp;lt;SelectListItem&amp;gt; Locations {get; set;}
	public int LocationId {get; set;}
}


// handle viewmodel/editmodel in AutoMapViewResult
public class AutoMapViewResult : ViewResult
{
    public AutoMapViewResult(string viewName, string masterName, object model)
    {
        ViewName = viewName;
        MasterName = masterName;

        var viewModel = Mapper.Map(model, model.GetType(), typeof(TDestination));  // map model to viewmodel/editmodel
        LoadSelectListDataHandler.Handle(viewModel);  // load select list data, if LoadSelectListDataAttribute is applied
        ViewData.Model = viewModel;
    }
}&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;What do you think about this approach? Feedback is welcome, or even better other ideas, solutions etc.&lt;/p&gt;

&lt;p&gt;Code download: &lt;a href="http://blog.opo.li/file.axd?file=2010%2f8%2fLoadSelectListDataAttribute.zip"&gt;LoadSelectListDataAttribute.zip (950,00 bytes)&lt;/a&gt;&lt;/p&gt;</description>
      <link>http://blog.opo.li/post/2010/08/19/ASPNET-MVC-Loading-data-for-select-lists-into-edit-model-using-attributes.aspx</link>
      <comments>http://blog.opo.li/post/2010/08/19/ASPNET-MVC-Loading-data-for-select-lists-into-edit-model-using-attributes.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=dc692aa6-a384-49e1-aeab-d4a9681f04d1</guid>
      <pubDate>Thu, 19 Aug 2010 21:54:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=dc692aa6-a384-49e1-aeab-d4a9681f04d1</pingback:target>
      <slash:comments>47</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=dc692aa6-a384-49e1-aeab-d4a9681f04d1</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2010/08/19/ASPNET-MVC-Loading-data-for-select-lists-into-edit-model-using-attributes.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=dc692aa6-a384-49e1-aeab-d4a9681f04d1</wfw:commentRss>
    </item>
    <item>
      <title>Windows 7 Wallpaper Contest</title>
      <description>&lt;p&gt;Microsoft Switzerland holds a contest for the upcoming release of Windows 7. They look for background images with typical Swiss subjects. This picture I took back in 2006 made it to this week's selection:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://windows7wallpaper.ch/2009/07/eiger-monch-und-jungfrau/"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Eiger, M&amp;ouml;nch und Jungfrau" src="http://blog.opo.li/image.axd?picture=WindowsLiveWriter/Windows7WallpaperContest_F178/NiesenEigerMnchundJungfrau.jpg" border="0" alt="Eiger, M?nch und Jungfrau" width="560" height="354" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please &lt;a href="http://windows7wallpaper.ch/2009/07/eiger-monch-und-jungfrau/"&gt;vote for my Photo&lt;/a&gt; for it makes it into the official Windows 7 Background Gallery.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;</description>
      <link>http://blog.opo.li/post/2009/07/19/Windows-7-Wallpaper-Contest.aspx</link>
      <comments>http://blog.opo.li/post/2009/07/19/Windows-7-Wallpaper-Contest.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=6500ac06-5ce1-49b6-8127-786305065e68</guid>
      <pubDate>Sun, 19 Jul 2009 17:13:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=6500ac06-5ce1-49b6-8127-786305065e68</pingback:target>
      <slash:comments>85</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=6500ac06-5ce1-49b6-8127-786305065e68</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2009/07/19/Windows-7-Wallpaper-Contest.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=6500ac06-5ce1-49b6-8127-786305065e68</wfw:commentRss>
    </item>
    <item>
      <title>TabsExtension for BlogEngine.NET v0.2</title>
      <description>&lt;p&gt;
Maybe you&amp;#39;ve already heard about &lt;a href="http://enhancedblogengine.codeplex.com" title="Enhanced BlogEngine.NET on CodePlex"&gt;Enhanced BlogEngine.NET&lt;/a&gt;, a customized BlogEngine.NET which supports multiple languages. Because I&amp;#39;d like to write my posts in english and german in the future, I gave it a try and installed it on a different domain. I had to change some lines of my theme and then tried to copy my posts to the new installation. This took some time but finally I got it and I could play around...
&lt;/p&gt;
&lt;p&gt;
Unfortunately the concept behind Enhanced BlogEngine.NET cannot really convince me. The posts are saved in different files for each language, so there would be one file for the english version, one for the germen etc. Comments and ratings are stored separatly for each language in the according files. Even tags and categories exist for different languages and are only displayed, if the according language is selected. So the only advantage over to separate blogs are in my opinion the link in each multilingual post that leads to a version in another language and that I don&amp;#39;t have to switch between to blogs to write my posts. There are maybe scenarios, where Enhanced BlogEngine.NET is fitting, but for me it is no option at the time.
&lt;/p&gt;
&lt;p&gt;
Instead of that I thought about writing an &amp;quot;Enhanced TabsExtension&amp;quot; for BlogEngine.NET, which I could use for my multilingual posts. And what came out in version 0.2 of this extension you can see below:
&lt;/p&gt;
&lt;div id="Tabs1"&gt;&lt;ul class="tabsnavigation"&gt;&lt;li&gt;&lt;a href="#Tabs1_en" class="lang" style="background-image:url('/pics/flags/en.png');"&gt;English&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Tabs1_de" class="lang" style="background-image:url('/pics/flags/de.png');"&gt;Deutsch&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;div id="Tabs1_en"&gt;&lt;p&gt;
&lt;strong&gt;New language tabs&lt;/strong&gt;&lt;br /&gt;
Version 0.2 of my TabsExtension now supports &amp;quot;language tabs&amp;quot;. Give your tab a name like &amp;quot;en&amp;quot; or &amp;quot;de&amp;quot; and the tab&amp;#39;s labelled with the appropriate title and flag. The flag images come from the BlogEngine folder /pics/flags. Since there are no language flags but country flags you maybe have to copy and rename some of them (e.g. us.png or gb.png to en.png)
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;How to use&lt;/strong&gt;&lt;br /&gt;
All instructions you can find in this post about the &lt;a href="http://blog.opo.li/post/TabsExtension-for-BlogEngineNET.aspx"&gt;TabsExtension&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Download&lt;/strong&gt;&lt;br /&gt;
&lt;a href="http://blog.opo.li/file.axd?file=2009%2f3%2fTabsExtension_v0.2.zip"&gt;TabsExtension_v0.2.zip (3 kb)&lt;/a&gt;&lt;a href="http://blog.opo.li/file.axd?file=TabsExtension_v0.2.cs"&gt;&lt;/a&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;div id="Tabs1_de"&gt;&lt;p&gt;
&lt;strong&gt;Neu: Sprach-Tabs&lt;/strong&gt;&lt;br /&gt;
Die Version 0.2 meiner TabsExtension unterst&amp;uuml;tzt nun &amp;quot;Sprach-Tabs&amp;quot;. Wird einem Tab der name &amp;quot;en&amp;quot;, &amp;quot;de&amp;quot; etc. gegeben, so wird automatisch die entsprechende Flagge und die Sprache dazu angezeigt. Die Flaggen werden direkt aus dem Ordner /pics/flags geholt. Weil dort aber nicht Sprach- sondern Landes-Flaggen liegen, m&amp;uuml;ssen unter Umst&amp;auml;nden noch einige Bilder umbenannt werden. So ist z.B. keine Flagge f&amp;uuml;r Englisch (en) vorhanden, sodass entweder us.png oder gb.png kopiert und in en.png umbenannt werden muss.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Wie funktioniert die TabsExtension?&lt;/strong&gt;&lt;br /&gt;
Alles andere funktioniert wie in diesem Post &amp;uuml;ber die  &lt;a href="http://blog.opo.li/post/TabsExtension-for-BlogEngineNET.aspx"&gt;TabsExtension&lt;/a&gt; beschrieben.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Download&lt;/strong&gt;&lt;br /&gt;
&lt;a href="http://blog.opo.li/file.axd?file=2009%2f3%2fTabsExtension_v0.2.zip"&gt;TabsExtension_v0.2.zip (3 kb)&lt;/a&gt;&lt;a href="http://blog.opo.li/file.axd?file=TabsExtension_v0.2.cs"&gt;&lt;/a&gt;
&lt;/p&gt;&lt;/div&gt;

&lt;/div&gt;

</description>
      <link>http://blog.opo.li/post/2009/03/29/TabsExtension-for-BlogEngineNET-v02.aspx</link>
      <comments>http://blog.opo.li/post/2009/03/29/TabsExtension-for-BlogEngineNET-v02.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=572d176e-0efa-41d9-a264-31373def0c1f</guid>
      <pubDate>Sun, 29 Mar 2009 16:12:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=572d176e-0efa-41d9-a264-31373def0c1f</pingback:target>
      <slash:comments>66</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=572d176e-0efa-41d9-a264-31373def0c1f</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2009/03/29/TabsExtension-for-BlogEngineNET-v02.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=572d176e-0efa-41d9-a264-31373def0c1f</wfw:commentRss>
    </item>
    <item>
      <title>April theme on ASP.NET MVC Design Gallery</title>
      <description>&lt;p&gt;
I recently submitted a new theme to the ASP.NET MVC Design Gallery. It?s called April and is a fresh theme dominated by green tones. Naturally I included the jQuery login panel as well as in &lt;a href="http://blog.opo.li/post/MVC-Design-Template-october-updated.aspx"&gt;my previous theme&lt;/a&gt;.
&lt;/p&gt;
  
&lt;p&gt;
&lt;img style="display: inline" src="http://blog.opo.li/image.axd?picture=april_screenshot.jpg" alt="April Theme Screenshot" title="April Theme Screenshot" width="600" height="400" /&gt; 
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://www.asp.net/mvc/gallery/View.aspx?itemid=74" title="April theme on ASP.NET MVC Design Gallery"&gt;So have a look at the April theme, download it and vote for it, if you like it.&lt;/a&gt;
&lt;/p&gt;
</description>
      <link>http://blog.opo.li/post/2009/02/06/April-theme-on-ASPNET-MVC-Design-Gallery.aspx</link>
      <comments>http://blog.opo.li/post/2009/02/06/April-theme-on-ASPNET-MVC-Design-Gallery.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=b9ed4199-a7ee-4a9e-8285-53003d56ed60</guid>
      <pubDate>Fri, 06 Feb 2009 20:15:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=b9ed4199-a7ee-4a9e-8285-53003d56ed60</pingback:target>
      <slash:comments>54</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=b9ed4199-a7ee-4a9e-8285-53003d56ed60</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2009/02/06/April-theme-on-ASPNET-MVC-Design-Gallery.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=b9ed4199-a7ee-4a9e-8285-53003d56ed60</wfw:commentRss>
    </item>
    <item>
      <title>Opo Perspective - An ASP.NET Webmail: Part 03</title>
      <description>&lt;p&gt;In this post I’ll talk a bit about the architecture of Opo Perspective. I wrote in my first post that this application should be very flexible and extensible. Here are some thoughts about this topic. Most of the ideas presented here are already realized, have a look at the &lt;a href="http://www.codeplex.com/OpoPerspective/SourceControl/ListDownloadableCommits.aspx"&gt;source on CodePlex&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;The mail messages’ way&lt;/h2&gt;  &lt;p&gt;The following graphic illustrates how a mail message makes it’s way from the mail server to the web page (click for larger view).&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://blog.opo.li/image.axd?picture=PerspectiveMessagePipeline.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="PerspectiveMessagePipeline" border="0" alt="PerspectiveMessagePipeline" src="http://blog.opo.li/image.axd?picture=PerspectiveMessagePipeline_thumb.png" width="276" height="400" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The MailStore&lt;/strong&gt; is an external place, where the mail messages are received from. This could be any sort of mail server or, if the mail server is running on the same system for example, a directory with the mail messages.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The MailCache&lt;/strong&gt; is an internal respository where the messages are saved. Messages displayed in the webmail are retrieved from the MailCache.&lt;/p&gt;  &lt;p&gt;This is done through &lt;strong&gt;the MailService&lt;/strong&gt; where also could be dealt with some business logic .&lt;/p&gt;  &lt;h3&gt;IPerspectivePipeline&lt;/h3&gt;  &lt;p&gt;There are two places where a PerspectivePipeline comes into play. The first one is intended to filter, tag, delete, … mails that are stored in the MailCache. In the graphic there's a SpamPipilinePlugin, which searches the message's header for such inserted by spam filters and adds a &amp;quot;Spam&amp;quot; tag to the message. This is one example how the pipeline could be used.&lt;/p&gt;  &lt;p&gt;The second pipeline is intended to manipulate the message before displaying. One possibility would be to convert links in the text body of the message to html hyperlinks so they can be clicked within the message. Or we could prevent images from beeing shown initially and insert a link at the top of the message that loads the images on demand.&lt;/p&gt;  &lt;p&gt;Since all involved classes are based on interfaces it's easy to write your own mail store, mail cache or pipeline plugin.&lt;/p&gt;  &lt;p&gt;Because messages in Opo Perspective are based on the same interface (IPerspectiveEntity) like contacts, appointments etc. the same plugins can be used for these as well.&lt;/p&gt;</description>
      <link>http://blog.opo.li/post/2009/01/02/Opo-Perspective-An-ASPNET-Webmail-Part-03.aspx</link>
      <comments>http://blog.opo.li/post/2009/01/02/Opo-Perspective-An-ASPNET-Webmail-Part-03.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=205ecd63-d10a-493f-8ea2-c8a809caff23</guid>
      <pubDate>Fri, 02 Jan 2009 22:46:11 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=205ecd63-d10a-493f-8ea2-c8a809caff23</pingback:target>
      <slash:comments>72</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=205ecd63-d10a-493f-8ea2-c8a809caff23</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2009/01/02/Opo-Perspective-An-ASPNET-Webmail-Part-03.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=205ecd63-d10a-493f-8ea2-c8a809caff23</wfw:commentRss>
    </item>
    <item>
      <title>Opo Perspective - An ASP.NET Webmail: Part 02</title>
      <description>&lt;h2&gt;Organizing mail messages&lt;/h2&gt; &lt;p&gt; Most mail clients provide a folder structure to organize emails. As GMail came out in 2005, they relied on labels instead of folders. I really like this approach and will do the same thing for Opo Perspective. Only difference: I&amp;#39;ll name them tags, not labels. :)  &lt;/p&gt; &lt;p&gt; I&amp;#39;m not sure how strictly GMail follows the tag approach, I don&amp;#39;t know if spam or deleted mails &amp;quot;only&amp;quot; get a label or if they are moved to another folder or something similar. For Opo Perspective I want to manage all that with tags. Add the tag &amp;quot;Trash&amp;quot; &amp;ndash; the message is deleted, add the tag &amp;quot;Inbox&amp;quot; &amp;ndash; the message shows up on the home page.  &lt;/p&gt; &lt;p&gt; So every new message should get the default tag &amp;quot;Inbox&amp;quot;, or if it is junk mail, the tag &amp;quot;Spam&amp;quot;.  &lt;/p&gt; &lt;p&gt; There is a second possibility to mark a message, a flag. It&amp;#39;s only possible to add one flag to a message (like GMail&amp;#39;s &amp;quot;starred&amp;quot;).  &lt;/p&gt; &lt;h2&gt;Organizing contacts, appointments, chat messages, &amp;hellip;&lt;/h2&gt; &lt;p&gt; Because I want Opo Perspective a extensible application there maybe some day things like appointments or chat messages that also must be organized. Therefore all these object should implement the IPerspectiveEntity, which is defined like follows:  &lt;/p&gt; &lt;pre style="display: none" class=c# name="code"&gt;
public interface IPerspectiveEntity
{
	Guid ID { get; set; }
	string Title { get; set; }
	string Summary { get; }
	DateTime Date { get; set; }
	bool IsRead { get; set; }
	IFlag Flag { get; set; }
	TagCollection Tags { get; set; }
} 
&lt;/pre&gt;</description>
      <link>http://blog.opo.li/post/2009/01/02/Opo-Perspective-An-ASPNET-Webmail-Part-02.aspx</link>
      <comments>http://blog.opo.li/post/2009/01/02/Opo-Perspective-An-ASPNET-Webmail-Part-02.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=f2eef54f-847f-400f-91f6-6047f8dacc71</guid>
      <pubDate>Fri, 02 Jan 2009 21:37:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=f2eef54f-847f-400f-91f6-6047f8dacc71</pingback:target>
      <slash:comments>63</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=f2eef54f-847f-400f-91f6-6047f8dacc71</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2009/01/02/Opo-Perspective-An-ASPNET-Webmail-Part-02.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=f2eef54f-847f-400f-91f6-6047f8dacc71</wfw:commentRss>
    </item>
    <item>
      <title>MVC Design Template "october" updated</title>
      <description>&lt;p&gt;
Some days ago I wrote about &lt;a href="http://blog.opo.li/post/My-first-template-on-ASPNET-MVC-Design-Gallery.aspx"&gt;my first MVC Design Template&lt;/a&gt;. I told about the jQuery login and that it&amp;#39;s not very efficient because there was no specific login action action to handle the ajax request.
&lt;/p&gt;
&lt;p&gt;
I now updated the template and included an extra action and view for the partial login. I also decided to stay with the full page postback for the login process because there are possibly places all over the page that have to be changed on successful login. It&amp;#39;s not very practical to do that all in javascript and you&amp;#39;d have to look at in in every single page.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.asp.net/MVC/Gallery/View.aspx?itemid=66"&gt;Download the updated template&lt;/a&gt; from the MVC Design Gallery (and vote for it, of course :-)
&lt;/p&gt;
</description>
      <link>http://blog.opo.li/post/2009/01/02/MVC-Design-Template-october-updated.aspx</link>
      <comments>http://blog.opo.li/post/2009/01/02/MVC-Design-Template-october-updated.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=c3842176-b538-4416-a3cc-7d0839b39571</guid>
      <pubDate>Fri, 02 Jan 2009 16:32:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=c3842176-b538-4416-a3cc-7d0839b39571</pingback:target>
      <slash:comments>124</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=c3842176-b538-4416-a3cc-7d0839b39571</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2009/01/02/MVC-Design-Template-october-updated.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=c3842176-b538-4416-a3cc-7d0839b39571</wfw:commentRss>
    </item>
    <item>
      <title>My first template on ASP.NET MVC Design Gallery</title>
      <description>&lt;p&gt;I just got an email from &lt;a title="Stephen Walther's blog" href="http://stephenwalther.com/blog/"&gt;Stephen Walther&lt;/a&gt; saying that my first template for the ASP.NET MVC framework has been published on &lt;a title="http://www.asp.net/MVC/Gallery" href="http://www.asp.net/MVC/Gallery"&gt;http://www.asp.net/MVC/Gallery&lt;/a&gt;. Just look out for the theme called "&lt;strong&gt;october&lt;/strong&gt;" or use this direct link: &lt;a title="http://www.asp.net/MVC/Gallery/View.aspx?itemid=66" href="http://www.asp.net/MVC/Gallery/View.aspx?itemid=66"&gt;http://www.asp.net/MVC/Gallery/View.aspx?itemid=66&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Since there's only space for a 180 letters description and a small screenshot on the Design Gallery, I'll give you some more information here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;CSS for most HTML elements&lt;/strong&gt; &lt;br /&gt;including headers, tables and forms &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Additional CSS for message boxes&lt;/strong&gt; &lt;br /&gt;information, error, success &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;"Ajaxified" login panel&lt;/strong&gt; &lt;br /&gt;A click on the login menu button let slide in a login panel (without a full page postback). This is achieved by using jQuery's AJAX functionality. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I was not sure if I could include additional actions in the template, therefore the normal "/Account/Login" action is loaded by jQuery and then filtered for the login form itself. The drawbacks are that there is far too much data loaded (the whole page instead of the login form only) and that a click on the form's login button will conclude in a full page postback.    &lt;br /&gt;But it's very easy to replace this functionality with your own partial action like so:&lt;/p&gt;
&lt;p&gt;Change&lt;/p&gt;
&lt;div id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:511d5415-9806-4f8f-8576-383630e84229" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"&gt;
&lt;pre class="js"&gt;url: '&amp;lt;%= Url.Action("Login","Account") %&amp;gt;',
success: function(data) {
	lc.html(jQuery('form',jQuery(data))).slideToggle();&lt;/pre&gt;
&lt;/div&gt;
&lt;pre class="js"&gt;to&lt;/pre&gt;
&lt;div id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:ad5cf8d6-e67e-4696-8698-ddfe8bb565c0" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"&gt;
&lt;pre class="js"&gt;url: '&amp;lt;%= Url.Action("PartialLogin","Account") %&amp;gt;',
success: function(data) {
	lc.html(data).slideToggle();
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And here some screenshots:&lt;/p&gt;
&lt;div class="gallery center"&gt;
&lt;p&gt;&lt;a href="http://blog.opo.li/image.axd?picture=october_screenshot_1.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Header, menu, normal text, lists, tables" src="http://blog.opo.li/image.axd?picture=october_screenshot_1_thumb.png" border="0" alt="Header, menu, normal text, lists, tables" width="404" height="365" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.opo.li/image.axd?picture=october_screenshot_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Form elements, message boxes" src="http://blog.opo.li/image.axd?picture=october_screenshot_2_thumb.png" border="0" alt="Form elements, message boxes" width="404" height="341" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.opo.li/image.axd?picture=october_screenshot_3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Login panel" src="http://blog.opo.li/image.axd?picture=october_screenshot_3_thumb.png" border="0" alt="Login panel" width="404" height="175" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</description>
      <link>http://blog.opo.li/post/2008/12/28/My-first-template-on-ASPNET-MVC-Design-Gallery.aspx</link>
      <comments>http://blog.opo.li/post/2008/12/28/My-first-template-on-ASPNET-MVC-Design-Gallery.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=de056fb3-f44c-41c6-973e-61277bfd0825</guid>
      <pubDate>Sun, 28 Dec 2008 21:05:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=de056fb3-f44c-41c6-973e-61277bfd0825</pingback:target>
      <slash:comments>92</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=de056fb3-f44c-41c6-973e-61277bfd0825</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2008/12/28/My-first-template-on-ASPNET-MVC-Design-Gallery.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=de056fb3-f44c-41c6-973e-61277bfd0825</wfw:commentRss>
    </item>
    <item>
      <title>Opo Perspective on CodePlex</title>
      <description>After I released the 0.1 version of Opo.Net (&lt;a href="http://www.codeplex.com/OpoNet" title="Opo.Net on CodePlex"&gt;http://www.codeplex.com/OpoNet&lt;/a&gt;) I finally started with my original project: Opo Perspective - An ASP.NET MVC Webmail Client. I wrote my first post about this project back in June this year. Yep, that&amp;#39;s a long time and I&amp;#39;m very excited that I really made it and published some Perspctive code on CodePlext (&lt;a href="http://www.codeplex.com/OpoPerspective" title="Opo Perspective on CodePlex"&gt;http://www.codeplex.com/OpoPerspective&lt;/a&gt;).
</description>
      <link>http://blog.opo.li/post/2008/12/26/Opo-Perspective-on-CodePlex.aspx</link>
      <comments>http://blog.opo.li/post/2008/12/26/Opo-Perspective-on-CodePlex.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=dc38fd06-4f49-444a-a554-c54864391897</guid>
      <pubDate>Fri, 26 Dec 2008 21:34:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=dc38fd06-4f49-444a-a554-c54864391897</pingback:target>
      <slash:comments>40</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=dc38fd06-4f49-444a-a554-c54864391897</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2008/12/26/Opo-Perspective-on-CodePlex.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=dc38fd06-4f49-444a-a554-c54864391897</wfw:commentRss>
    </item>
    <item>
      <title>Dave's lustiges Buch vom Sterben</title>
      <description>&lt;p&gt;
And now for something completely different! :-)
&lt;/p&gt;
&lt;div id="Tabs1"&gt;&lt;ul class="tabsnavigation"&gt;&lt;li&gt;&lt;a href="#Tabs1_en" class="lang" style="background-image:url('/pics/flags/en.png');"&gt;English&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Tabs1_de" class="lang" style="background-image:url('/pics/flags/de.png');"&gt;Deutsch&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;div id="Tabs1_en"&gt;&lt;p&gt;
These are some pictures of my latest project. I had the idea to this back in 2001 but never made the graphics. The title&amp;#39;s (translated from german) &amp;quot;Dave&amp;#39;s funny book of dying&amp;quot;, on each page there&amp;#39;s one sentences which can be read with two different meanings. One of them is really trivial but the other one is a phrase for dying. In german this is quite funny but unfortunately most of them cannot be translated without loosing their meaning...
&lt;/p&gt;&lt;/div&gt;
&lt;div id="Tabs1_de"&gt;&lt;p&gt;
Die Idee zu diesem Projekt hatte ich bereits 2001, habe aber nie die Grafiken dazu gemacht. Das Ganze heisst &amp;quot;Dave&amp;#39;s lustiges Buch vom Sterben&amp;quot; und ist eigentlich eine Sprachspielerei mit einer grafischen Umsetzung dazu. Aber Bilder sagen mehr als tausend Worte, deshalb... - schaut selbst:
&lt;/p&gt;&lt;/div&gt;

&lt;/div&gt;

&lt;div class="gallery center"&gt;
&lt;p&gt;
&lt;a href="http://blog.opo.li/image.axd?picture=Titelseite.png"&gt;&lt;img style="border: 0px none ; display: inline" src="http://blog.opo.li/image.axd?picture=Titelseite_thumb.png" border="0" alt="Titelseite" title="Titelseite" width="196" height="244" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.opo.li/image.axd?picture=Seite01.png"&gt;&lt;img style="border: 0px none ; display: inline" src="http://blog.opo.li/image.axd?picture=Seite01_thumb.png" border="0" alt="Seite 01" title="Seite 01" width="196" height="244" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.opo.li/image.axd?picture=Seite02.png"&gt;&lt;img style="border: 0px none ; display: inline" src="http://blog.opo.li/image.axd?picture=Seite02_thumb.png" border="0" alt="Seite 02" title="Seite 02" width="196" height="244" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.opo.li/image.axd?picture=Seite03.png"&gt;&lt;img style="border: 0px none ; display: inline" src="http://blog.opo.li/image.axd?picture=Seite03_thumb.png" border="0" alt="Seite 03" title="Seite 03" width="196" height="244" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.opo.li/image.axd?picture=Seite04.png"&gt;&lt;img style="border: 0px none ; display: inline" src="http://blog.opo.li/image.axd?picture=Seite04_thumb.png" border="0" alt="Seite 04" title="Seite 04" width="196" height="244" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.opo.li/image.axd?picture=Seite05.png"&gt;&lt;img style="border: 0px none ; display: inline" src="http://blog.opo.li/image.axd?picture=Seite05_thumb.png" border="0" alt="Seite 05" title="Seite 05" width="196" height="244" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.opo.li/image.axd?picture=Seite06.png"&gt;&lt;img style="border: 0px none ; display: inline" src="http://blog.opo.li/image.axd?picture=Seite06_thumb.png" border="0" alt="Seite 06" title="Seite 06" width="196" height="244" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.opo.li/image.axd?picture=Seite07.png"&gt;&lt;img style="border: 0px none ; display: inline" src="http://blog.opo.li/image.axd?picture=Seite07_thumb.png" border="0" alt="Seite 07" title="Seite 07" width="196" height="244" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.opo.li/image.axd?picture=Seite10.png"&gt;&lt;img style="border-width: 0px; display: inline" src="http://blog.opo.li/image.axd?picture=Seite10_thumb.png" border="0" alt="Seite 10" title="Seite 10" width="196" height="244" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;copy; 2008 David Hauser&amp;nbsp;
&lt;/p&gt;
&lt;/div&gt;
</description>
      <link>http://blog.opo.li/post/2008/12/21/Daves-lustiges-Buch-vom-Sterben.aspx</link>
      <comments>http://blog.opo.li/post/2008/12/21/Daves-lustiges-Buch-vom-Sterben.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=8b19a3f4-5beb-49c3-a0a5-41b2ccfc3cad</guid>
      <pubDate>Sun, 21 Dec 2008 21:39:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=8b19a3f4-5beb-49c3-a0a5-41b2ccfc3cad</pingback:target>
      <slash:comments>35</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=8b19a3f4-5beb-49c3-a0a5-41b2ccfc3cad</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2008/12/21/Daves-lustiges-Buch-vom-Sterben.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=8b19a3f4-5beb-49c3-a0a5-41b2ccfc3cad</wfw:commentRss>
    </item>
    <item>
      <title>Developing a C# POP3 client: First Release on CodePlex</title>
      <description>&lt;p&gt;Finally a first release of Opo.Net on CodePlex! Yeah! :-) &lt;/p&gt;  &lt;p&gt;With this release it's possible to connect to a POP3 server, recieve messages and convert it into Opo.Net.MailMessage instances. Sending mail messages via SMTP is the next step. I think it's now a lot easier becaus some classes can be reused for the other way round. &lt;/p&gt;  &lt;p&gt;A very simple example for using the Pop3Client: &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:5fdace00-0dbc-4c10-9424-7487c2fbae1b" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;Pop3Client pop3 = new Pop3Client("pop.example.org", 110, "accountName", "password");
pop3.Connect();
pop3.Login();
string mimeData = pop3.GetMessage(1) // recieve first message on server
pop3.Logout();
pop3.Disconnect(); 
IMailMessageConverter converter = new MimeMailMessageConverter();
IMailMessage message = converter.ConvertFrom(mimeData);

Console.WriteLine("Subject: " + message.Subject);
Console.WriteLine("From: " + message.From.ToString());
Console.WriteLine("To: " + message.To.ToString());
Console.WriteLine("");
Console.WriteLine(message.Body);
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This will output something like this: &lt;/p&gt;

&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 2; toolbar: true;"&gt;Subject: Test message
From: &amp;quot;Example Email 1&amp;quot; &amp;lt;email1@example.org&amp;gt;
To: &amp;quot;Example Email 2&amp;quot; &amp;lt;email2@example.org&amp;gt;, &amp;quot;Example Email 3&amp;quot; &amp;lt;email3@example.org&amp;gt;

This is the message body.&lt;/pre&gt;</description>
      <link>http://blog.opo.li/post/2008/11/07/Developing-a-C-POP3-client-First-Release-on-CodePlex.aspx</link>
      <comments>http://blog.opo.li/post/2008/11/07/Developing-a-C-POP3-client-First-Release-on-CodePlex.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=3d15d62d-367b-4035-a752-7d4277e9f56b</guid>
      <pubDate>Fri, 07 Nov 2008 22:17:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=3d15d62d-367b-4035-a752-7d4277e9f56b</pingback:target>
      <slash:comments>35</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=3d15d62d-367b-4035-a752-7d4277e9f56b</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2008/11/07/Developing-a-C-POP3-client-First-Release-on-CodePlex.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=3d15d62d-367b-4035-a752-7d4277e9f56b</wfw:commentRss>
    </item>
    <item>
      <title>RFC 2822 compliant date parser</title>
      <description>&lt;p&gt;You may have read my series of posts on &lt;a title="Developing a C# POP3 client - Part 7" href="http://blog.opo.li/post/Developing-a-CSharp-POP3-client-Part-07.aspx"&gt;writing a POP3 client in C#&lt;/a&gt;. Normally you'll recieve mail messages in MIME format. MIME dates conform to RFC 2822 (&lt;a title="RFC 2822 - Internet Message Format" href="http://www.ietf.org/rfc/rfc2822.txt" target="_blank"&gt;http://www.ietf.org/rfc/rfc2822.txt&lt;/a&gt;, 3.3): &lt;/p&gt;  &lt;p&gt;Example: Mon, 0&lt;strong&gt;1 Jan 2001 00:00&lt;/strong&gt;:00 +0100 (non-bold: optional) &lt;/p&gt;  &lt;p&gt;It's also possible that the time offset (+0100) has a format like &amp;quot;GMT&amp;quot; or &amp;quot;PST&amp;quot;. These are actually obsolete but nonetheless used sometimes. The goal is now to parse these dates and save them as &lt;a title="Coordinated Universal Time" href="http://en.wikipedia.org/wiki/UTC" target="_blank"&gt;UTC&lt;/a&gt; date. So this is the code with some additional comments: &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:95a21c69-fb9c-40b4-94c5-15bf8cbdb3a6" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;public DateTime ParseRfc2822Date(string dateTime)
{
	// replace alphabetical time zones with numerical
	date = date.ToLower();
	date = date.Replace("bst", "+0100");
	date = date.Replace("gmt", "-0000");
	date = date.Replace("edt", "-0400");
	date = date.Replace("est", "-0500");
	date = date.Replace("cdt", "-0500");
	date = date.Replace("cst", "-0600");
	date = date.Replace("mdt", "-0600");
	date = date.Replace("mst", "-0700");
	date = date.Replace("pdt", "-0700");
	date = date.Replace("pst", "-0800");

	DateTime parsedDateTime = DateTime.MinValue;

	// Regular expression that matches RFC 2822 compliant dates, contains two groups "DateTime" and "TimeZone"
	string pattern = @"(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), )?";
	pattern += @"(?&amp;lt;DateTime&amp;gt;\d{1,2} (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}\:\d{2}(?:\:\d{2})?)";
	pattern += @"(?: (?&amp;lt;TimeZone&amp;gt;[\+-]\d{4}))?";
	Regex r = new Regex(pattern, RegexOptions.IgnoreCase);
	Match m = r.Match(date);
	if (m.Success)
	{
		// Remove preceding "0" that all dates match the same pattern ("d MMM yyyy")
		string dateTime = m.Groups["DateTime"].Value.TrimStart('0');
		
		// Parse the date and time parts (without time zone)
		parsedDateTime = DateTime.ParseExact(dateTime, new string[] { "d MMM yyyy hh:mm", "d MMM yyyy hh:mm:ss" }, CultureInfo.InvariantCulture, DateTimeStyles.None);

		// If time zone is declared, set the offset
		string timeZone = m.Groups["TimeZone"].Value;
		if (timeZone.Length == 5)
		{
			// Create new TimeSpan representing the time zone offset to UTC
			int hour = Int32.Parse(timeZone.Substring(0, 3));
			int minute = Int32.Parse(timeZone.Substring(3));
			TimeSpan offset = new TimeSpan(hour, minute, 0);

			// Set the offset using DateTimeOffset
			parsedDateTime = new DateTimeOffset(parsedDateTime, offset).UtcDateTime;
		}
	}
	return parsedDateTime;
}&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can download this code as part of the &lt;a title="CodePlex: Opo.Net" href="http://www.codeplex.com/OpoNet"&gt;Opo.Net project on CodePlex&lt;/a&gt;. &lt;/p&gt;</description>
      <link>http://blog.opo.li/post/2008/11/02/RFC-2822-compliant-date-parser.aspx</link>
      <comments>http://blog.opo.li/post/2008/11/02/RFC-2822-compliant-date-parser.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=e0b8410a-66e0-4836-88a4-be3bf35dc1d7</guid>
      <pubDate>Sun, 02 Nov 2008 17:54:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=e0b8410a-66e0-4836-88a4-be3bf35dc1d7</pingback:target>
      <slash:comments>33</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=e0b8410a-66e0-4836-88a4-be3bf35dc1d7</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2008/11/02/RFC-2822-compliant-date-parser.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=e0b8410a-66e0-4836-88a4-be3bf35dc1d7</wfw:commentRss>
    </item>
    <item>
      <title>Developing a C# POP3 client: Part 07 - Design considerations and some refactoring</title>
      <description>&lt;p&gt;This is number seven in a series of posts on developing a POP3 client in C#. These are the previous posts on this topic: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blog.opo.li/post/Developing-a-CSharp-POP3-Client-Part-01.aspx"&gt;Developing a C# POP3 client: Part 01 - POP3 commands&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.opo.li/post/Developing-a-CSharp-POP3-Client-Part-02.aspx"&gt;Developing a C# POP3 client: Part 02 - The SimplePop3Client&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.opo.li/post/Developing-a-CSharp-POP3-Client-Part-03.aspx"&gt;Developing a C# POP3 client: Part 03 - Session States, Exception Handling, SSL&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.opo.li/post/Developing-a-CSharp-POP3-Client-Part-04.aspx"&gt;Developing a C# POP3 client: Part 04 - Somewhat more comfort&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.opo.li/post/Developing-a-CSharp-POP3-Client-Part-05.aspx"&gt;Developing a C# POP3 client: Part 05 - MIME Messages&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blog.opo.li/post/Developing-a-CSharp-POP3-Client-Part-06.aspx"&gt;Developing a C# POP3 client: Part 06 - Parsing MIME messages&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;It's quite a while since my last &amp;quot;real&amp;quot; post about my POP3 client project. Along some other projects I'm working on, I noticed that I had to reconsider some of my design decisions. Some months ago, in March or April I read the (by the way very recommendable) book &lt;a title="Amazon: Head First Design Patterns" href="http://www.amazon.com/Head-First-Design-Patterns/dp/0596007124/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1224540745&amp;amp;sr=8-1"&gt;Head First Design Patterns&lt;/a&gt;. One thing that is pointed out very clearly is to &amp;quot;coding to interfaces, not to concrete implementations&amp;quot;. While I had that in mind I didn't get an overall picture of the project and which interfaces and classes are really needed and how they relate. In the last couple of weeks I also dealt with &lt;a title="Wikipedia: Dependency Inversion Principle" href="http://en.wikipedia.org/wiki/Dependency_Inversion_Principle"&gt;Dependency Inversion&lt;/a&gt;, &lt;a title="Wikipedia: Inversion of Control" href="http://en.wikipedia.org/wiki/Inversion_of_Control"&gt;Inversion of Control&lt;/a&gt; and &lt;a title="Wikipedia: Dependency Injection" href="http://en.wikipedia.org/wiki/Dependency_Injection"&gt;Dependency Injection&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;So I made some thoughts about how to achieve a larger flexibility and less &amp;quot;hard coded&amp;quot; dependencies between the different classes. Also another fact forced me to rethink my design. While programming the code for converting string MIME data to MailMessage classes, I came at a point where I had to add a reference in Opo.Net.Mime to Opo.Net.Mail but got the error &amp;quot;circular reference&amp;quot; because I already had a reference from Opo.Net.Mail to Opo.Net.Mime: &lt;/p&gt;  &lt;p&gt;&lt;img alt="" src="http://blog.opo.li/image.axd?picture=2008%2f10%2fCircular_reference.png" /&gt; &lt;/p&gt;  &lt;p&gt;I decided to change the MimeEntity to only hold string values and to add a MailMessageConverter class that then converts the MimeEntity to a MailMessage. Furthermore I wanted to let the user plug in custom MIME parsers and converters for other formats (e.g. XML). For that purpose I introduced the interfaces IMimeParser and IMailMessageConverter. For now I implemented the RegexMimeParser class (uses regular expression to parse the MIME data), a MimeMailMessageConverter (not fully implemented now) and a XmlMailMessageConverter. &lt;/p&gt;  &lt;p&gt;Lets have a look at some code samples: &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:558b1d65-cb7b-4682-9a1e-7fbbf56ada22" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;// download a message from a server and then convert it to MailMessage instance
using Opo.Net.Mail;
using Opo.Net.Mime; 

// MimeMailMessageConverter uses default IMimeParser (RegexMimeParser)
public void LoadMessage()
{
	Pop3Client pop3Client = new Pop3Client("example.org", 25);
	string mimeData = pop3Client.GetMessage(1);
	IMailMessageConverter mailMessageConverter = new MimeMailMessageConverter();
	IMailMessage mailMessage = mailMessageConverter.ConvertFrom(mimeData);
}

// MimeMailMessageConverter uses custom IMimeParser
public void LoadMessage()
{
	Pop3Client pop3Client = new Pop3Client("example.org", 25);
	string mimeData = pop3Client.GetMessage(1);
	IMailMessageConverter mailMessageConverter = new MimeMailMessageConverter();
	IMimeParser mimeParser = new RegexMimeParser();
	IMailMessage mailMessage = mailMessageConverter.ConvertFrom(mimeParser, mimeData);
}&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The MimeMailMessageConverter uses IMimeParser and IMimeEntity internally. May the converter interface will change to something like this, but I'm not sure if this makes more sense... &lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:51eb6c46-b36f-4589-a665-f12b4bb5a41b" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;public interface IMailMessageConverter
{
	IMailMessage ConvertFrom(ref IMailMessage, object data);
	object ConvertTo(ref IMailMessage, IMailMessage mailMessage);
	IMailMessage LoadFromFile(string path);
	string SaveToFile(IMailMessage mailMessage, string path);
	string SaveToFile(IMailMessage mailMessage, string path, string fileName);
}&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is what the dependencies look now: &lt;/p&gt;

&lt;p&gt;&lt;img alt="" src="http://blog.opo.li/image.axd?picture=2008%2f10%2fCircular_reference_redesigned.png" /&gt; &lt;/p&gt;

&lt;p&gt;Get the updated source on Codeplex: &lt;a href="http://www.codeplex.com/OpoNet"&gt;http://www.codeplex.com/OpoNet&lt;/a&gt;&lt;/p&gt;</description>
      <link>http://blog.opo.li/post/2008/10/21/Developing-a-CSharp-POP3-client-Part-07.aspx</link>
      <comments>http://blog.opo.li/post/2008/10/21/Developing-a-CSharp-POP3-client-Part-07.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=eb122c86-10e2-49a2-8d35-cfe314213d48</guid>
      <pubDate>Tue, 21 Oct 2008 20:40:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=eb122c86-10e2-49a2-8d35-cfe314213d48</pingback:target>
      <slash:comments>51</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=eb122c86-10e2-49a2-8d35-cfe314213d48</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2008/10/21/Developing-a-CSharp-POP3-client-Part-07.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=eb122c86-10e2-49a2-8d35-cfe314213d48</wfw:commentRss>
    </item>
    <item>
      <title>Developing a C# POP3 client: Now on CodePlex</title>
      <description>&lt;p&gt;
It was quite still the last few months. But now I&amp;#39;m back with some news about my POP3 client project. Since this little project grows and it&amp;#39;s a bit cumbersome to always make the zip file and upload it to the blog, I decided to host it on ClodePlex. You&amp;#39;ll find it here: &lt;a href="http://www.codeplex.com/OpoNet"&gt;http://www.codeplex.com/OpoNet&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I also made some changes since my last blog post about this topic. It&amp;#39;s mainly some additional classes like MailMessage, MailAddress etc., which I decided to implement myself rather than using the built-in ones. I thought about writing a decorator to extend it or inherit from System.Net.Mail.MailMessage. But my idea of MailMessage is slightly different from what&amp;#39;s already in the framework.
&lt;/p&gt;
</description>
      <link>http://blog.opo.li/post/2008/09/06/Developing-a-C-POP3-client-Now-on-CodePlex.aspx</link>
      <comments>http://blog.opo.li/post/2008/09/06/Developing-a-C-POP3-client-Now-on-CodePlex.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=e63e705a-cb7d-4435-9a6e-c63b9b5107dd</guid>
      <pubDate>Sat, 06 Sep 2008 16:55:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=e63e705a-cb7d-4435-9a6e-c63b9b5107dd</pingback:target>
      <slash:comments>32</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=e63e705a-cb7d-4435-9a6e-c63b9b5107dd</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2008/09/06/Developing-a-C-POP3-client-Now-on-CodePlex.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=e63e705a-cb7d-4435-9a6e-c63b9b5107dd</wfw:commentRss>
    </item>
    <item>
      <title>TabsExtension for BlogEngine.NET</title>
      <description>&lt;p&gt;
Today I wrote my first extension for BlogEngine.NET: TabsExtension. 
&lt;/p&gt;
&lt;p&gt;
To show you the functionality I put all info in some tabs. 
&lt;/p&gt;
&lt;div id="Tabs1"&gt;&lt;ul class="tabsnavigation"&gt;&lt;li&gt;&lt;a href="#Tabs1_Installation"&gt;Installation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Tabs1_Syntax"&gt;Syntax&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Tabs1_Features"&gt;Features&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Tabs1_Style"&gt;Style&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#Tabs1_Download"&gt;Download&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;div id="Tabs1_Installation"&gt;&lt;p&gt;
Copy TabsExtension.cs into the App_Code/Extensions folder of your BlogEngine.NET installation. That&amp;#39;s it.
&lt;/p&gt;&lt;/div&gt;
&lt;div id="Tabs1_Syntax"&gt;&lt;p&gt;
The syntax for the tabs is as follows: 
&lt;/p&gt;
&lt;p&gt;
[ tabs] 
&lt;/p&gt;
&lt;p&gt;
[ tab=Tab Title] 
&lt;/p&gt;
&lt;p&gt;
Tab content. 
&lt;/p&gt;
&lt;p&gt;
[ /tab] 
&lt;/p&gt;
&lt;p&gt;
[ tab=Title for Tab 2] 
&lt;/p&gt;
&lt;p&gt;
Tab content. 
&lt;/p&gt;
&lt;p&gt;
[ /tab] 
&lt;/p&gt;
&lt;p&gt;
[ /tabs] 
&lt;/p&gt;
&lt;p&gt;
(Without the spaces after the left parentheses!) 
&lt;/p&gt;&lt;/div&gt;
&lt;div id="Tabs1_Features"&gt;&lt;p&gt;
The TabsExtension uses unobtrousive javascript for showing and hiding the tabs and therefor jQuery. If javascript is disabled or not available, the tabs navigation is shown as an unordered list with links to the different tab divs (links like #Tabs1_Tab1). In this version the jQuery library is loaded directly from the jQuery website (&lt;a href="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"&gt;http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&lt;/a&gt;). I&amp;#39;m planning to extend this extension to enable configuring the path in the settings dialog. 
&lt;/p&gt;&lt;/div&gt;
&lt;div id="Tabs1_Style"&gt;&lt;p&gt;
For now the css is written directly into the page. In further versions I&amp;#39;m planning to let you set the path for a css file. Naturally you can edit the main css file of your theme, the classes are the following: 
&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;.tabs: The tab container (div) which contains the navigaion and the tabs.&lt;/li&gt;
	&lt;li&gt;ul.tabsnavigation: The navigation for a tab group (ul)&lt;/li&gt;
	&lt;li&gt;.tab: The single tab (div)&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;div id="Tabs1_Download"&gt;&lt;ul&gt;
	&lt;li&gt;Version 0.1: &lt;a rel="enclosure" href="http://blog.opo.li/file.axd?file=TabsExtension.cs"&gt;TabsExtension.cs (8,30 kb)&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;

&lt;/div&gt;

</description>
      <link>http://blog.opo.li/post/2008/06/05/TabsExtension-for-BlogEngineNET.aspx</link>
      <comments>http://blog.opo.li/post/2008/06/05/TabsExtension-for-BlogEngineNET.aspx#comment</comments>
      <guid>http://blog.opo.li/post.aspx?id=6148f460-0d36-4f4b-9e52-5e2a85bddf6e</guid>
      <pubDate>Thu, 05 Jun 2008 00:11:00 +0100</pubDate>
      <dc:publisher>Dave</dc:publisher>
      <pingback:server>http://blog.opo.li/pingback.axd</pingback:server>
      <pingback:target>http://blog.opo.li/post.aspx?id=6148f460-0d36-4f4b-9e52-5e2a85bddf6e</pingback:target>
      <slash:comments>40</slash:comments>
      <trackback:ping>http://blog.opo.li/trackback.axd?id=6148f460-0d36-4f4b-9e52-5e2a85bddf6e</trackback:ping>
      <wfw:comment>http://blog.opo.li/post/2008/06/05/TabsExtension-for-BlogEngineNET.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.opo.li/syndication.axd?post=6148f460-0d36-4f4b-9e52-5e2a85bddf6e</wfw:commentRss>
    </item>
  </channel>
</rss>