Using Hyphens In Post Names

Community Server Comments

There was a discussion regarding naming of posts in a CommunityServer forum (a surprisingly unknown feature of CS::Blogs, though even dotText .96 supported it). CS replaces spaces with underscores. However, Jonathan stated that Google prefers hyphens to underscores. So I tried to use hyphens in the post name, but I've stumbled over two issues:

  1. You cannot enter hyphens in the post's name edit box because the field validator won't accept it. The regular expression is defined in the code as [a-zA-Z][1234567890a-zA-Z_\\s]{4,250}, i.e. only letters, digits, underscores, and white-spaces are allowed. To enable hyphens as well, you have to change line 155 in Blogs\WeblogPosts.cs to

    public static readonly string PostNamePattern = "^[a-zA-Z][1234567890a-zA-Z\\-_\\s]{4,250}$";
    

    and re-compile CommunityServer.Blogs.dll.

  2. When you want to visit the post using the named url, you'll get a 404 error. That's because the regular expression in SiteUrls.config is defined as ``\w+, i.e. only letters, digits, and underscores. Again no underscores. Fortunately, there's no compilation required, instead change the regular expressions forweblogpostNameandweblogarticleName` to:

    <url name="weblogpostName"
        location="weblogs" path="{0}/archive/{1}/{2}/{3}/{4}.aspx"
        pattern="([\w\.-]+)/archive/(\d{4})/(\d{1,2})/(\d{1,2})/([a-zA-Z][1234567890a-zA-Z\-_]*)\.aspx"
        vanity="post.aspx?App=$1&amp;y=$2&amp;m=$3&amp;d=$4&amp;PostName=$5" />
    <url name="weblogarticleName"
        location="weblogs" path="{0}/articles/{1}.aspx"
        pattern="([\w\.-]+)/articles/([a-zA-Z][1234567890a-zA-Z\-_]*)\.aspx"
        vanity="post.aspx?App=$1&amp;PostName=$2" />
    

    (Be careful if your SiteUrls.config differs from the default configuration, e.g. if you have used Ken Robertson's SiteUrls Generator.)

If you're using ScottW's auto-naming module, you can skip step one including the re-compilation and just edit your SiteUrls.config.

Save Bandwidth and Compress Your CommunityServer Feeds

Now that my vacation and the PDC are over, I can continue with all the stuff which I left unfinished on my desk. One of these is a mod for CommunityServer which compresses all the exposed feeds. I've written it some weeks ago already and deployed it on my web server. Since it seems to work properly, I now want to announce it publicly. Though my bandwidth at WebHost4Life isn't limited, for some of you it may save real money.

The HTTP standard defines the compression of any content in RFC 2616, section 3.5. IIS supports compression, however, admin permissions on the server are required. So if your CS blog is hosted in a shared environment, you do not have access to the server. Therefore, you have to look for another solution.

Due to the nature of blogs, the most accessed part of a blog is its feed, or better, the feeds, as most blogs offer RSS as well as ATOM, and may even explose feeds for categories and comments. Therefore it makes sense to at least compress the feeds.

Some time ago Jeff Julian has written an add-on for dotText which compressed the RSS feed. I used to use this add-on on my blog as well, which reduced the size of my feed by about 80%.

Currently CommunityServer does not compress its feeds, and till now there is no add-on available which would add this functionality. Therefore I took Jeff's solution as a starting point and wrote a module myself. Now I'm happy to announce Thoemmi.CommunityServer.Compression 😃

The installation is pretty easy: Download the ZIP file and extract the DLL's to your bin folder. Then replace the handlers in the httpHandlers section in web.config to point to my classes. Here's a lineup of the corresponding items:

Original blog RSS handler
CommunityServer.Blogs.Components.WeblogRssHandler, CommunityServer.Blogs

Replacement
Thoemmi.CommunityServer.Compression.CompressedWeblogRssHandler, Thoemmi.CommunityServer.Compression

Original blog ATOM handler
CommunityServer.Blogs.Components.WeblogAtomHandler, CommunityServer.Blogs

Replacement
Thoemmi.CommunityServer.Compression.CompressedWeblogAtomHandler, Thoemmi.CommunityServer.Compression

Original blog comment RSS handler
CommunityServer.Blogs.Components.WeblogCommentRssHandler, CommunityServer.Blogs

Replacement
Thoemmi.CommunityServer.Compression.CompressedWeblogCommentRssHandler, Thoemmi.CommunityServer.Compression

Original gallery RSS handler
CommunityServer.Galleries.Components.GalleryRssHandler, CommunityServer.Galleries

Replacement
Thoemmi.CommunityServer.Compression.CompressedGalleryRssHandler, Thoemmi.CommunityServer.Compression

Original forum RSS handler
CommunityServer.Discussions.Components.ForumRssHandler, CommunityServer.Discussions

Replacement
Thoemmi.CommunityServer.Compression.CompressedForumRssHandler, Thoemmi.CommunityServer.Compression

If you have had a default installation before, the httpHandlers section should now contain following lines:

<add verb="GET" path="blogs/rss.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedWeblogRssHandler, Thoemmi.CommunityServer.Compression" />

<add verb="GET" path="blogs/atom.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedWeblogAtomHandler, Thoemmi.CommunityServer.Compression" />

<add verb="GET" path="blogs/commentrss.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedWeblogCommentRssHandler, Thoemmi.CommunityServer.Compression" />

<add verb="GET" path="photos/rss.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedGalleryRssHandler, Thoemmi.CommunityServer.Compression" />

<add verb="GET" path="forums/rss.aspx"
    type="Thoemmi.CommunityServer.Compression.CompressedForumRssHandler, Thoemmi.CommunityServer.Compression" />

That's it. By default, the feeds are compressed with deflate with normal compression. If you want to change the compression level or switch to gzip compression, have a look at web.config.merge in the ZIP file. My add-on uses Ben Lowery's HttpCompressionModule, which in turn uses SharpZipLib. Both assemblies are included in the ZIP file as well.

BTW, if you want to check the compression of your feeds, PipeBoost generates Web Compression Reports.

[Update 10/14/2005: Fixed broken link]

1,000 phones for 10,000 buyers

PDC '05 Comments

BizTalk Visionary wrote:

During “Keynote" audiance advised they would have the chance to buy the iMate JASJAR (normall $1100) for $149. This meant some people bailed out to go and buy. The majority stayed and watched - of course. Only 1000 available so sold out while the majority watched the keynote. This really sucks. Microsoft should have had enough for all to buy.

 

I totally agree on this. While those leaving the keynote can buy all the devices, the others are penalized for staying.

Tags: PDC05

The Return of the Sidebar

Windows Vista, PDC '05 Comments

The sidebar's back. Microsoft presented it to us two years ago, but in succeeding CTPs it was gone. Now it's back and you can add so-called gadgets. To speak in Apple terms, think of sidebar and gadgets as dashboard and widgets. You can write own your gadgets using WPF or DHTML, and they even launched Microsoft Gadgets yesterday, a site dedicated to gadget development.

Tags: PDC05

Windows Vista UX Guidelines Released

Windows Vista, PDC '05 Comments

Steve Sinchak points to a post by Brad Wardell, that Microsoft has released a preliminary version of the Vista User Experience guidelines:

According to Brad Wardell's blog on JoeUser.com, Microsoft has released a preliminary version of the UX guidelines to help developers write applications that look and take advantage of the new Vista glass user experience.

The UX guidelines are a series of web pages that can be downloaded directly from Microsoft. For those of you that do not want to download the web pages, I have placed all of them up on my web server for everyone to view.

Click Here to view the UX Guidelines

Click Here to download the UX Guidelines form Microsoft

Read Full Story at Brad Wardell's Blog