I have finally set up the .Text multiple blog aggregate page. And of course, I ran into quite a few stumbling blocks along the way (and have had no replies as of yet). I'm pleased by the fact that it's finally up and running, however I am not pleased with how I had to set it up. Apparently, to run .Text in the multiple blog configuration, it needs it's own dedicated web site in IIS (I ran around in circles attempting to get it to work in a virtual directory...to no avail), and it also would appear that the multiple HttpHandlers in the web.config file hijack the entire website...no virtual directories underneath the root will work, and files cannot be downloaded from the root, it will error out as it's actually looking for blogs (I know this is a horrible explanation, but I don't really understand the issue, Scott has mentioned this will be fixed in the final release). I have multiple links on my blog that point to downloadable content and have had to move this content to an FTP site on my network (and had to change each link...grrr)...I am not a big fan of FTP.
I would host the files in another website, but then I would have to assign it a different port number...this doesn't work anyway though; .Text URL rewriting hacks up the following URL: http://zerotrilogy.gotdns.com:81/someDirectory/ and errors out with a 404. There is also an issue with encoding on the OPML link, I will have to track that bug down and will update this post when I figure it out. That all being said, I am more than happy with the end result, setting up new blogs is a snap (takes less than a minute, whereas manually creating new individual blogs took upwards of half an hour). Migrating Orion's blog to the aggregate was a little tedious, but fairly straight forward (lots of primary key conflicts, but easily resolved). All in all, it took about 8 hours total, with another hour or so more to go. I cannot stress enough how good of a job Scott has done with this software, really looking forward to an installer being written for it though!
As a side note, the default setup of .Text has an ASP.NET literal control with a caption of “System Uptime“ underneath “Blog Stats.“ however there is no value there. If you would like to display the system uptime, add this code to the default.aspx.cs file:
private void BindData()
{
...
TimeSpan timeFromReboot = new TimeSpan(0,0,0,0,Environment.TickCount);
...
SystemUptime.Text = string.Format("{0} Days {1} Hours {2} Minutes {3} Seconds",
timeFromReboot.Days.ToString(),
timeFromReboot.Hours.ToString(),
timeFromReboot.Minutes.ToString(),
timeFromReboot.Seconds.ToString());
...
}
If you would like a blog hosted at this domain, please feel free to request one. I have the usual safeguards in place (firewalls, backup, etc) and plenty of harddrive space. Also, if anyone is having issues setting up the multiple blog configuration of .Text, feel free to ping me...I think I ran into just about every problem could be run into. Happy blogging!
[Edit: 06/09/2004]
The previous code works great, up until 24.9 days (TickCount returns a 32 bit signed integer). I am in the process of looking for a new solution, will keep the post updated.
[Edit: 06/11/2004]
Gus Perez (author of Uptime 2000) sent me this link which accomplishes exactly what I need in managed code. If you have seen the source of Uptime 2000, you will immediately notice how much simpler the managed version is. I always forget about the System.Diagnostics.PerformanceCounter class, so thanks again Gus! Here is the code from the link:
PerformanceCounter pc = new PerformanceCounter("System",
"System Up Time");
//Normally starts with zero. do Next Value always.
pc.NextValue();
TimeSpan timeFromReboot = TimeSpan.FromSeconds(pc.NextValue());...
SystemUptime.Text = string.Format("{0} Days {1} Hours {2} Minutes {3} Seconds",
timeFromReboot.Days.ToString(),
timeFromReboot.Hours.ToString(),
timeFromReboot.Minutes.ToString(),
timeFromReboot.Seconds.ToString());
[Edit: 06/15/2004]
I fixed the OPML feed issue mentioned in the original post via a fix found here. A cursory glance, and it looks like the culprit is this line of code (~line 124 in OPML.aspx.cs):
writer.WriteStartDocument();
This line writes the following tag: <?xml version="1.0" encoding="utf-16"?> The encoding attribute was confusing Internet Explorer (silly IE), plus it generated an invalid OPML file. I picked around MSDN trying to figure out why it “defaults” to utf-16 (my initial thought is why there wasn't an Encoding object parameter for this method). It turns out that the WriteStartDocument method uses the value of an Encoding object that's supplied to one of the overloaded constructors of the XmlTextWriter object that invoked it, however, the default is indeed utf-8 if one isn't supplied. In this case, Scott is using the overload where a StringWriter (inherits from TextWriter, which is the actual type expected) is passed in as a parameter (no Encoding object, only a TextWriter or derived). From what I gathered off MSDN, when this overload is used it's the TextWriter (or derived) object that's in charge of setting the encoding. So why is encoding written out as utf-16 when it should be utf-8? The default encoding value in the CLR/BCL is utf-8, therefore I would think that a default StringWriter would result in utf-8 encoding, but what I'm seeing here is contradictory to that line of thinking. Basically, a default StringWriter is passed in to the XmlStringWriter object, which in turn calls WriteStartDocument, yet we get utf-16 encoding specified for the encoding attribute of the opening ?XML tag. I will have to run some tests to confirm this, but it looks a little hokey to me. [I've been up for almost 20 hours, will have to do it tomorrow]
I have only one more bug to track down; the RSS feed from the main page generates an error. I am pretty sure I know why, but I can't find the relevant code.



No comments yet