Blog updated

I’ve now updated the software running this blog to dasBlog 1.6. It came with a default theme that looks so nice I’m going to keep it. Only problem so far is that dates are rendered with the locale settings of the browsing user, at least with IE (I get ”den 4 maj 2004” when I want to get ”Tuesday, May 04, 2004″, which is what I get with Mozilla). Anyway, it seems to fix the problems with the ASP.NET 1.1 paranoid security settings that Göran encountered in this thread (which is an interesting discussion that you should follow, by the way).

Update: No, spoke too soon. It seems you can still cannot post anything containing the string ”script:” in a comment on a dasBlog instance.

Stuff now imported into dasBlog

I went ahead and wrote a little C# program to convert a sharpreader-style cache RSS file into a set of dasBlog-compatible dayentry files. One little problem surfaced in that while BlogX used a url + random GUID for each entry’s guid, dasBlog uses only a random guid. This will have the effect of a bunch of entries (15, to be exact) appearing as new in your RSS aggregators. Sorry about that as well.

Anyway, if someone needs to do something similar, here’s the code I used. It expects a sharpreader-generated file named ”backup.xml” in its working directory (look for a suitable file in %USERPROFILE%\Application Data\SharpReader\Cache and rename it), and if you’re not in the CEST timezone, you should probably fix the line with the FIXME comment.

using System;
using System.Xml;

namespace DasBlogImport
  class Importer
    static private void addElementToEntry(XmlDocument doc, 
                                          XmlElement entry, 
                                          String elementName, 
                                          String elementValue) 
      XmlElement e = doc.CreateElement(elementName);
      e.InnerText = elementValue;
    static void Main(string[] args)
      XmlDocument doc = new XmlDocument();
      XmlNodeList nodeList = doc.GetElementsByTagName("Items");
      XmlNode element;
      XmlNode entries = null;
      String lastDate = String.Empty;
      XmlDocument dayentry = null;

      foreach  (XmlNode item in nodeList) 
        element = item.SelectSingleNode("PubDate");
        String date = element.InnerText.Substring(0,10);

        if (date != lastDate) 
          // flush the entries for the current day, and start a new document
          if (dayentry != null)
          dayentry = new XmlDocument();
          XmlElement root = dayentry.DocumentElement;
          element = dayentry.CreateElement("Date");
          element.InnerText = date + "T02:00:00.0000000+02:00"; // FIXME: If you're not in the CEST timezone, you probably want to change this
          entries = dayentry.CreateElement("Entries");
          lastDate = date;
        XmlElement entry = dayentry.CreateElement("Entry");

        addElementToEntry(dayentry, entry, "Content",        item.SelectSingleNode("Description").InnerText);
        addElementToEntry(dayentry, entry, "Created",        item.SelectSingleNode("PubDate").InnerText);
        addElementToEntry(dayentry, entry, "Modified",       item.SelectSingleNode("PubDate").InnerText);
        String guid = item.SelectSingleNode("Guid").InnerText;
        addElementToEntry(dayentry, entry, "EntryId",        guid.Substring(guid.Length-36,36)); // 36 = the length of a 128-bit GUID in standard string form
        addElementToEntry(dayentry, entry, "Description",    String.Empty);
        addElementToEntry(dayentry, entry, "Title",          item.SelectSingleNode("Title").InnerText);
        if (item.SelectSingleNode("Subject") != null)
          addElementToEntry(dayentry, entry, "Categories",   item.SelectSingleNode("Subject").InnerText);
          addElementToEntry(dayentry, entry, "Categories",   String.Empty);

        addElementToEntry(dayentry, entry, "IsPublic",       "true");
        addElementToEntry(dayentry, entry, "ShowOnFrontPage","true");
        addElementToEntry(dayentry, entry, "Crossposts",     String.Empty);

Hard disks suck

So, my spiffy SATA hard disk crashed. I had most important stuff backed up, but sadly not the blog postings. I do have all the content in the form of a sharpreader cache file, so the stuff will come back, but it seems that all images and, more importantly, all comments, are lost. Sorry about that. New backup routines are established…

Now I have to write a little program to parse the cache file (which seem to be straight RSS) and convert it into the XML files that dasblog expect. I could go with VBScript and MSXML, which I’m familiar with, and get it done in 30 minutes, or I could go with C# and the .net framework XML classes, which I’m not so familiar with, and get it done tonight, or I could install python, sit down with the newly released Dive into python 5.0 edition, and be stuck for the rest of the week. Decisions, decisions…

By the way, the templates that come with dasblog look nice, but they don’t work so good in Mozilla. More proof that Clemens Vasters hates open source 🙂

Is this on?

Ok, so after re-installing my main home
PC I’ve finally come to the point where I re-enable the blog. I decided to be a little
daring and replace the old and not-very-maintained BlogX engine
with a brand new dasBlog installation. I haven’t
managed to import the old blog entries yet, despite them being very similar in structure.
Well, got to save something for another night.