Category : Dasblog

On becoming the Geo Guy

handheldgps Apparently I am rapidly becoming ‘Geo Guy’. I seem to be adding Geo / Gps support and plug-ins to everything I use…plugins

I just finished adding ‘Insert GPS Link’ support to PockeTwit (a great little Windows Mobile twitter client – really, go and get a copy now…)
Previously I added GeoRSS support to dasBlog for individual blog posts as well as the RSS feed, and I also added geo microformat support to Windows Live Writer with my ‘InsertGeoMicroformat’ plugin.

So, what’s next – have you got an app that needs Geo / GPS support added ?

  PockeTwitIcon   DasBlog Reflection 640x480 Green

GEO 51.4043243116043:-1.28760516643523

Listen Live

imageToo much effort reading my ramblings ? Want to listen instead ? Now you can !!

Courtesy of the excellent odiogo, the excellent text to speech service. This is a free service that bloggers can use, it takes your RSS feed, splits it out to each separate post and then creates a MP3 for the post.

The text-to-speech quality is really good, only about 1 in 50 words is corrupt/unintelligible – easily high enough quality to get a good rendition of the post. Obviously it depends on the content of the post, I have not yet listened to a post with lots of sample code or the like, but I expect it would be pretty hard going.

Get the audio for this blog here. You can even subscribe in iTunes. I will also update the site to include the links in the sidebar.

GEO 51.4043197631836:-1.28760504722595

Replace in Files for PowerShell

A while back I restructured my website so that this blog no longer started at the root, instead starting from /blog. This was so that I could introduce some other web apps and have a subfolder for projects etc.

One of the pains of this restructure was modifying all the links – I thought I had caught all this with a Redirector HttpModule, but recently realised that for some reason I had not caught images embedded in the posts themselves.
Also it was becoming a pain having to remember to include the HttpModule in my web.config everytime I upgraded my blog (dasBlog)

I wanted it fixed properly this time, so grabbed a copy of all the XML files in my ‘content’ folder, copied them to a local folder and cracked open PowerShell…

I wanted every instance of www.mywebsite.com changed to www.mywebsite.com/blog – not difficult, but this would also change valid urls such as www.mywebsite.com/blog/page.aspx to www.mywebsite.com/blog/blog/page.aspx (note the /blog/blog in the url)

So I got everything I needed done with two ‘one liners’ in PowerShell…

dir | %{ $a = get-content $_ ; $a = $a -replace (“www.mywebsite.com”, “www.mywebsite.com/blog”) ; set-content $_ $a }

…and…

dir | %{ $a = get-content $_ ; $a = $a -replace (“www.mywebsite.com/blog/blog”, “www.mywebsite.com/blog”) ; set-content $_ $a }

All fixed…

 

GEO 51.4043197631836:-1.28760504722595 

Insert Geo Microformat Plugin for Windows Live Writer

InsertPanel I have just completed a new Windows Live Writer plugin. This extension allows ease insertion of geo microformat information.

It allows the user to easily choose the location they want to insert (in microformat) from a Virtual Earth map and also configure how it is displayed (if at all on the post.

Recently I (with considerable help from Alexander Groß) added GeoRss support for dasBlog. The co-ordinates can be specified when adding a post via the web interface. This plugin is stage two of this support, stage three will be parsing the geo microformat when a post is added and using that to populate the GeoRss info.

The end goal being to allow the geo info to be entered when creating a post in Writer and having that info available in GeoRss format in the feed.

I started this plugin with the view to using Google Maps, however they require that you get an API key and that key is only valid for a particular web site / URL path. This foiled my plans to embed the map in a Windows Forms WebBrowser control (I did look at producing an html page that was served from my web site, and using it embedded in the WebBrowser – not scaleable and too much configuration for a normal user to do.

InsertMicroformat 

I hadn’t looked in depth at Virtual Earth, but recently went to MixUK:07 and saw a couple of demos / presentations on it – a quick look found that it didn’t need a API and was not tied to a particular URL / path – the JavaScript for it is pretty similar to the one for Google Maps so learning curve was pretty short. The only issue I have with http://local.live.com is that there is no (currently) facility to enter a GeoRss feed in the search query and just display the data (the current method of displaying this kind of data is to embed a map in your own pages and use their API to display the items as a ‘collection’).

You can get the installer for it here InsertGeoFormatSetup.msi (325Kb).

GEO 51.4043243116043:-1.28760516643523

GeoRss for dasBlog

I have completed stage one of GeoRss enabling dasBlog.

In the config page I added some options for enabling GeoRss, specifying a default lat/long and enabling ‘integration’ with Google maps. There is also an option to use the default lat/long for any non geocoded posts.

  clip_image0022_thumb1

If GeoRss is enabled then the edit entry screen provides textboxes to allow specifying lat/long (populated with defaults from config page).

clip_image00421_thumb2

If the google maps integration is enabled then you’ll get the ‘Show Map’ button and clicking it will display a map which you can move around until you find the location and then click on the location to get the lat/long texboxes populated.

clip_image00681_thumb1

If you have existing non geocoded posts then you can have the default lat/long added to those if you wish.

I puzzled around for ages when trying to display the georss in google (http://maps.google.com/maps?q=yourfeedaddress) – it kept telling me that the feed was invalid. I eventually found that feedburner was adding <atom10:link blah blah /> to the xml which for some reason google maps thinks is invalid. The only way I could find to prevent feedburner adding the atom link was to turn OFF the ‘Browser Friendly’ feature in feedburner.

So – stage 2…

The work I still want to do with this is basically to add macros to get lat/long  – fairly easy I guess, and then some way to specify lat/long from Windows Live Writer (and other offline blog clients) – a little more complex. Scott mentioned a geo microformat and from my initial looks seems to be a good route to take – watch this space…  

Now it is simply a case of retrofitting the geo info into all my old posts…

 

dasBlog 2.0 Released

dasBlog_image So dasBlog 2.0 (running under AS.NET 2.0 and medium trust) is now released. Scott has a great write up on it.

I have been running this web site on it for a few weeks now and it’s been fine. We sneaked in a couple of last minute features (one of mine was a new macro for rendering the navigation links as an Unordered List instead of a table with one cell per row).

I’ve been spending a fair bit of time on dasBlog recently – extending activity Rss feed and working on georss integration. I have a georss version working with a simple UI allowing the user to specify Lat/Long for each post and then a link to view the feed items in Google maps. I have not checked it in yet as I want to provide a slicker UI for specifying the location (maybe a map that allows you to drag/select the location or enter a zip code and view the location then use that).
I also want to provide options for getting the location in when using blogging clients (Windows Live Writer etc), not just the web based ‘add entry’ UI.

There is also some great work going on with Clemens Vaster and other really revamping some of the architecture bits and bringing dasBlog to the next level.

Watch this space…

Activity RSS for dasBlog

A few months ago I added a ‘Daily Report Email’ feature to dasBlog, so I could have the activity reports (referrers, searches etc) delivered to my mailbox at the end of every day.
I wanted to take this one step further and deliver it via RSS (and dasBlog is a RSS engine after all).

There were a couple of suggested methods raised on the dasBlog developers mailing list; one was using HTTP authentication – I was reluctant to use this as Outlook 2007 does not support authorized feeds. The other suggestion was to obfuscate the URL with a Guid or the like – this was my preferred option.

So, I have been working on it over the past few evenings, got it rolled out to this blog and it seems to be working pretty well.

image

I added a checkbox to the site configuration page, that when checked generates a Guid that is used as part of the path. The ‘activityrss.ashx’ page doesn’t exist at that path (in fact it doesn’t exist at all!), instead there is a HttpHandler for the file ‘activityrss.ashx’ that intercepts any requests for that file and does some processing.

In this processing I check that the requested URL contains the Guid and if so, generate the Activity RSS feed. The content of each feed item is the activity report (similar format to the daily report email).

image

NOTE: This is not in a release yet, if you want it you’ll have to check out the source, patch it with this patch file and compile, deploy it manually.

 

Word 2007 Blogging Fix 2

One of the developers on the dasBlog team (Nick) looked at this and found that there was a fairly easy fix we could do to dasBlog that would get around the Word 2007 issue.

The metaWeblog API states that the blogid parameter is ‘the same as defined by the blogger API’
The blogger API defines it as :

blogid (string): Unique identifier of the blog the post will be added to.

As dasBlog is a single blog instance there is no real need for the blogid – we could simply pass back “0” which would allow Word 2007 to send us a blogid of “0” (which we don’t even use anyway).
A fix (thanks Nick) is now in the latest source.

This post was published from Word 2007 and the $64000 question is – does it display this image ?

Word Blogging Fix

On 13 December 2006 I wrote this post demonstrating why Blogging from Word 2007 to Dasblog (and other blogs that correctly implemented newMediaObject) was broken. Recently I noticed a number of my referrals come from www.codesecurely.com (by Rudolph Araujo).

Rudolph goes one step further than I did with the Word blogging problem and actually outlines a FiddlerScript that modifies the Xml section of the submitted post to fix the integer/string mismatch. His article is here.

Well done Rudolph, thanks for the tip, I look forward to posting from Word now…

IHttpModule redirector

 I use dasBlog as the vehicle/technology for this site and currently have it configured at the root of the website (so you go to http://kapie.com and you get directly into this blog). This is kind of an unusual setup as most people put it in a /blog subdirectory or virtual directory.

I have plans to put a fair bit more static content up so I wanted to change to the standard of /blog subfolder – the problem is that all my current links will fail when I move the content along with all the content google has cached / indexed about the site – Not Good.

Scott Hanselman suggested in response to a question I posed on the dasBlog mailing list that writing a HttpModule with a HTTP temporary redirect (HTTP response code 302) might be the way to go and reckoned it might only be a handful of lines of code….

 I was pleasantly surprised at how easy it was…

I have included the code below in case anyone else might find it useful. It is pretty specific at the moment (takes the requested URL and if it does not include /blog/ then it insert it) but it could easily by made generic (RegEx or the like).

Happy to share the actual source files if anyone wants them – drop me a mail/comment. 

using System;

using System.Web;

using System.Text;

 

 

namespace KH

{

    public class Redirector : IHttpModule

    {

        private EventHandler onBeginRequest;

 

        public Redirector()

        {

            onBeginRequest = new EventHandler(this.HandleBeginRequest);

        }

 

        void IHttpModule.Dispose() { }

 

        void IHttpModule.Init(HttpApplication context)

        {

            context.BeginRequest += onBeginRequest;

        }

 

        private void HandleBeginRequest(object sender, EventArgs evargs)

        {

            HttpApplication app = sender as HttpApplication;

 

            if (app != null)

            {

                string host = app.Request.Url.Host;

                string requestUrl = app.Request.Url.PathAndQuery;

                if (requestUrl.IndexOf(“/blog/”) == -1)

                {

                    Uri newURL = new Uri(app.Request.Url.Scheme + “://www.” + host + “/blog” + requestUrl);

                    app.Context.Response.RedirectLocation = newURL.ToString();

                    app.Context.Response.StatusCode = 302;

                    app.Context.Response.End();

                    return;

                }

                else

                {

                    return;

                }

            }

        }

    }

}