# Friday, August 01, 2008

I finally figured out why my code snippets are all so horribly formatted via RSS, and it has nothing to do with the different source code formatters I've been using and everything to do with dasBlog.  I grabbed the dasBlog source and found the problem is with dasBlog's HTML tidy class, but more importantly I also found in the source how to disable it.  The latest dasBlog source has an option to disable formatting.

image

In the latest version of dasBlog they've added a setting to disable RSS formatting. Notice the setting even mentions "may mess up pre whitespace."  Mess up pre whitespace?  Yeah, no kidding.

At least now I don't have to switch blogging platforms, as the upgrade to dasBlog 2.0 is a whole lot easier.  Here's the dasBlog source code that optionally disables the formatting:

if (siteConfig.HtmlTidyContent == false)
{
    item.Description = "<div>" + PreprocessItemContent(entry.EntryId, entry.Content) + "</div>";
}
else
{
    item.Description = ContentFormatter.FormatContentAsHTML(PreprocessItemContent(entry.EntryId, entry.Content));
}
Friday, August 01, 2008 4:33:31 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, July 30, 2008

After much trial and error I finally gave up and asked Ayende what he uses to post to his blog.  His posts are always nicely formatted - including code snippets in Google Reader

It's that code snippet part that I have problems with, so I'm going to give the Syntax Highlighter for WLW that Ayende uses a shot.  If it works for him, it should work for me. Lets give it another shot shall we?

[TestFixture]
public class UnitOfWorkTests
{
    [Test]
    public void Should_return_same_instance()
    {
        var c = new Customer { Address = new Address(), CustomerID = 1, Name = "Sneal" };

        UnitOfWork uow = new UnitOfWork(new StubDataStore());
        uow.Save(c);

        Assert.AreSame(c, uow.Single(new Customer { CustomerID = 1 }));
    }

    [Test]
    public void Can_save_instance()
    {
        var c = new Customer { Address = new Address(), CustomerID = 1, Name = "Sneal" };

        UnitOfWork uow = new UnitOfWork(new StubDataStore());
        uow.Save(c);       
    }
}

Well that was nice, and boy does this thing support a lot of programming languages (way more than I know).

I've been using Windows Live Writer for a while now and would never go back to directly posting via a webform, WLW is just too easy.

Wednesday, July 30, 2008 12:33:03 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [1]  | 
# Tuesday, July 29, 2008

I'm trying out a new Live Writer code formatting add in. I've had mixed results with the others I've used.  It seems I can't find one that is:

  1. Easy to setup and use.  Copy, paste, done.
  2. Works on my blog page.
  3. Also works in RSS readers like Google Reader.

Lets see how the Insert from Visual Studio addin works...

[TestFixture]
public class UnitOfWorkTests
{
    [Test]
    public void Should_return_same_instance()
    {
        var c = new Customer { Address = new Address(), CustomerID = 1, Name = "Sneal" };

        UnitOfWork uow = new UnitOfWork(new StubDataStore());
        uow.Save(c);

        Assert.AreSame(c, uow.Single(new Customer { CustomerID = 1 }));
    }

    [Test]
    public void Can_save_instance()
    {
        var c = new Customer { Address = new Address(), CustomerID = 1, Name = "Sneal" };

        UnitOfWork uow = new UnitOfWork(new StubDataStore());
        uow.Save(c);       
    }
}

If nothing else, at least it looks pretty from Live Writer.  Lets see when it gets out in the wild...

Tuesday, July 29, 2008 12:45:08 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [1]  | 
# Thursday, July 17, 2008

I think Jeff Atwood hit the nail on the head when he said:

It's an open secret in the blogging community that the comments are often better than the original blog entry itself. Would you browse Amazon without the user reviews? No? Then why would you willingly choose to run your blog that way?

Don't be afraid of comments. Embrace them. Moderate them. The community will respect you for it, and your blog will be better for it as well.

Not only are comments sometimes interesting potentially offering differing points of view, but more than once I've had someone find my blog and leave a comment which solves the issue I was having.  How cool is that?  Even better, the next person having the same issue might be led to my blog by Google and find the answer right there in the comment.

Comments are valuable, which made me realize I need to do everything I can to help encourage comments.  The default setup for leaving comments in dasBlog is too much work IMO and overall isn't a great experience.  So last week I decided to improve the comment experience on this blog.  Here's a summary of what I did:

  1. Turned off CoComments which implied an extra form to fill out to submit a comment.  I think this just annoyed people and kept them from commenting. I know I didn't like the extra step.
  2. I added Gravatars, which are global recognized avatars (i.e.they work on any site that supports them).  I think this really helps people identify the comment author and makes the comment a touch more personal.
  3. I enabled comments to always show on a post entry.  Previously an extra click was required to see comments... which discouraged people to read or add comments.  Now comments always show because comments are important.  I find it almost silly that dasBlog warns against enabling this setting - granted it says for high volume sites (which isn't me).
  4. Email addresses are now hidden on the blog post entry.  I think most people don't really like their email addresses showing up even if they are somewhat obfuscated on the blog post page.  From now on your email address will not show, but will still allow me to reply back to you via email.  When I reply to a comment I will post it to this blog and then reply to your email with my comment so that you know I've responded.  Unfortunately I couldn't find a way for dasBlog to automatically do this for me.

I'm hoping these changes will make my blog a bit more comment friendly for everyone.  So, try it out and let me know what you think... by leaving a comment ;)

Thursday, July 17, 2008 2:45:27 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, January 14, 2008

The footer now appears at the bottom of the blog in IE (IE 7 anyway).

The content area is floating so that the blog now takes full advantage of your wide screen monitor.  It certainly makes this blog a lot easier to read in 1600x1050.

Monday, January 14, 2008 7:45:02 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, January 10, 2008

I consolidated a few duplicate categories and removed some others that just had one post under them to make the site a little more usable.  Next I'm going to work on the look and feel of this blog and make it work better in IE.

Thursday, January 10, 2008 8:30:23 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Sunday, July 29, 2007

So I tried out the Windows Live Writer code formatting plugin available on CodePlex, and at first sight it seemed to work well, that was until I read my feed through Google Reader.  For some reason within Google Reader there was a bunch of extra white space between lines of code, which as a result made it completely unreadable.  So here I am again trying out yet another Live Writer plugin, Insert Code for Windows Live Writer.  Hopefully this one works.

/// <summary>
/// Recursively gets the innermost exception, i.e. the first exception
/// that was thrown.
/// </summary>
/// <param name="ex">The exception to unwind.</param>
/// <returns>The inner most InnerException.</returns>
public static Exception GetInnerMostException(Exception ex)
{
    Exception inner = ex;
    while (inner.InnerException != null)
        inner = inner.InnerException;

    return inner;
}

I'm using the instructions from Phil Haack.

Sunday, July 29, 2007 4:27:32 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [1]  | 
# Friday, July 27, 2007

After upgrading DasBlog to the latest release and setting up FeedBurner I felt that I needed to do something to improve my posting experience.  Since inception I've been using the built-in rich text web form in DasBlog.  However good it may be it still lacks in a few areas:

  1. No real-time spell checking.  Since FireFox 2.0 came out this hasn't been an issue since it includes a very nice spell checker.
  2. Code formatting.  For the life of me, I cannot get code formatting to respect my tab spacing.  It parses the code just fine, but after it gets inserted into the post text area all the tabbing is gone.  This last point has really frustrated me and kept me from posting code as often.
  3. No offline mode.  Yeah I know, that's a bit much to ask of a web product, although Google seems to have found away around this with their Google Gears, which allows me to use the Google Reader in offline mode.

All of these issues have led down the path to Windows Live Writer, which is what I'm using right now to write this post.  The thing that amazed me about both DasBlog and Windows Live Writer, is that installing and configuring Windows Live Writer just worked.  There was no oeed to read any instruction manual or otherwise research how to set this up.  It just worked.

The other thing that impressed me was that it has a web preview mode which allows me to actually see this post as would appear on my blog - and I mean exactly as it would appear on my blog.  It basically has a complete cache of my blog home page, even when disconnected from the inter-web, which is really nice and unexpected.  In Google terms, that feature "delighted" me.

As for code, lets see if I can cut and paste from Visual Studio...

/// <summary>
/// Converts a local DateTime instance to the MiniTix date time format.
/// </summary>
/// <remarks>
/// ISO 8601 date format in Zulu time.
/// </remarks>
/// <param name="date">The date.</param>
/// <returns></returns>
public static string ToMiniTixDateTimeFormat(DateTime date)
{
    return date.ToUniversalTime().ToString("u");
}

Darn, that didn't quite work did it?  Fortunately I noticed Windows Live Writer has a plugin feature.  Google search...  Found a code formatter plugin right away on CodePlex!  Lets see how the new plugin works.  Exception, Directory not found!  OK that didn't work, although Live Writer did find and load the plugin automatically while it was running (I unzipped the plugin to the plugins folder while Live Writer was still running), lets try restarting Live Writer and try again - Insert clipboard as code:

/// <summary> /// Converts a local DateTime instance to the MiniTix date time format. /// </summary> /// <remarks> /// ISO 8601 date format in Zulu time. /// </remarks> /// <param name="date">The date.</param> /// <returns></returns> public static string ToMiniTixDateTimeFormat(DateTime date) { return date.ToUniversalTime().ToString("u"); }

 Much better!  Even the XML comments got picked up.  Finally, lets see if I can post!

Friday, July 27, 2007 6:14:49 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
It seems everyone these days is using FeedBurner or some other feed aggregation service, so I finally jumped on the band wagon and setup a feed for this blog @ http://feeds.feedburner.com/sneal.  There were several compelling reasons to do this:

  1. Feed speed optimization, my blog server isn't the hottest thing around - by a long shot.  In fact its on my todo list to find a new hoster.
  2. Exposure, hopefully I can draw in more readers.
  3. Feed analytics.  Right now I have really no idea if anyone ever reads this blog, or how often.
  4. Everyone's doing it.

Friday, July 27, 2007 4:42:33 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [3]  | 
I just finished upgrading my DasBlog software from an older 1.9 release to the latest 1.9 version.  I just copied everything from the new version's zip archive, except for the SiteConfig folder, directly over my blog site.  It seems to have worked just fine, which actually somewhat suprised me.

Wee!

Friday, July 27, 2007 3:17:31 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Sunday, March 18, 2007
For whatever reason when I cut and paste code into DasBlog using the "Insert Code" feature, my tabs always end up missing - even though they initially show up right after clicking Parse Code.  I ended up having to find and replace all blocks of four spaces with a tab before pasting into DasBlog.

The missing tab problem and the fact the syntax highlighting isn't as nice as Visual Studio 2005 makes me think I should start looking for another tool to format my code snippets that appear in this blog.

Sunday, March 18, 2007 7:02:58 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, March 07, 2007
So I finally added an about me section.  It uses DasBlog URL rewriting and FormatPage.aspx.

Wednesday, March 07, 2007 8:15:20 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Saturday, September 23, 2006

Note: For visitors of your site, this entry is only displayed for users with the preselected language English/English (en)

It only took me several years to get around to it, but I finally did it; I installed a blogging package, dasBlog!

I'm not sure why it took me this long, but I hope to use this space as a centralized storage of random thoughts and notes for future reference for myself - and anyone else if they're interested.

Saturday, September 23, 2006 4:42:43 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |