Minor Updates

Okay, things seem to have settled down with the blog app. I love when that happens. It should stay stable until I decide to hack around with it again. One of the more interesting changes I made is that I'm now using Bloglines' public API to display my blogroll. This means that the blogs listed on the right, there, are the same as the ones I monitor on a regular basis. When I add a feed, it'll show up (and conversely when I remove one...)

In other news, two of my customizations to the SubText engine have been approved for the standard code base. This is kind of cool to me because I'm such a geek. Not that I did anything great. My first was to change the sort on the referrers list in Admin. My second was a change that allows me to list a content category as a list of entry links. I needed that second for the "About Me" section on the side. Small things, yes, but still gratifying.

Technorati tags: , ,
26. January 2007 12:19 by Jacob | Comments (0) | Permalink

Ways to Skin a Blog

The folks who visit the actual blog (as opposed to using an RSS feed) have probably noticed that I re-skinned the site. Now that I'm more comfortable with SubText's skin structure, I figured this would be the next step. Personally, I think that it looks tons better now, but you can let me know in the comments if I'm just being delusional. I still need to tackle that calandar, though.

I can't take much credit for it if you like it. I'm perfectly aware of my (lack of) design sense. I can generally do okay evaluating existing designs, but I suck very, very much in creating my own. I found a design that I liked on Open Source Web Design and picked it apart enough to apply it to my SubText skin. Sweet that folks'll share like that.

Technorati tags: , , ,
12. January 2007 21:15 by Jacob | Comments (0) | Permalink

Building Custom SubText Controls

In my response to Jeff Atwood, I mentioned the Technorati widget control that he is now using in lieu of Trackbacks. The Technorati widget is fairly simple to implement, but you have to be able to feed it the permalink for your post for it to be able to work. Since I already had a go at creating custom controls for use in SubText, I decided that now was a good time to see if I couldn't come up with a way to create one that has access to blog entry attributes like the permalink. For your edification, here's what I found.

First Things First

Before we walk this primrose path, lets make sure that we aren't setting ourselves up for hard times later. Create a custom Skin by copying the files from your favorite built-in Skin into a new folder in the Skins directory.

Once you do this, you'll need to let SubText know about your new skin. This is done in the Admin directory by creating a "Skins.User.config" file. The easiest way to do that is to copy the existing Skins.config file and rename your copy to "Skins.User.config". They have the same structure, but having the extra config for user skins allows the SubText team to maintain the built-in skins without messing up any customizations you might be using. Make sure that you delete all the entries for skins (except the one you copied from above). Then you can tweak the template Name and and TemplateFolder attributes (highlighted below).

Once this is done and uploaded to your SubText site, you'll see your skin listed at the bottom of the skin selection drop-down in the Admin pages (that dropdown is not sorted, so the user skins will be at the bottom). Now you can modify to your heart's content and not worry about a future upgrade nailing your customization. Also, if you really mess things up, just hit Admin and set your skin back to your old starting point.

Where Things Are

The controls you'll use to customize SubText are all in the Controls folder in your custom Skin directory.

The most daunting thing about creating custom controls is figuring out how SubText handles things. You can skip the rest of this section if you don't really care and just want to get on with creating your control.

There are a couple of quirks of SubText that can help you isolate any problems that you might encounter.

  1. SubText transfers some of the controls programmatically by grabbing subcontrols of one object and copying them to the controls collection of the parent object. This is most notable for the subcontrol brought in by the PageTemplate for the "contentregion". If you pick apart your PageTemplate.ascx, you'll see a control with an ID of "MPMain". That's where this happens. The reason for this is that SubText replaces MPMain with a different control depending on what kind of page it is trying to display. Which leads to the following problem.
  2. It isn't immediately clear which control is being pulled in by MPMain for different sections of your blog. The main page (default.aspx), for example, pulls the HomePage.ascx control. It took me a while to figure this out, but now that I have, I found that the control that functions as "MPMain" is determined by a group of <HttpHandler> elements in the web.config file (technically, MPMain can be replaced with multiple controls as you can see if you actually dig out your web.config). The HttpHandler elements in web.config describe a RegEx "pattern" attribute to apply to incoming URL requests and then a "controls" attribute that describes the control(s) used. I could have saved a lot of time if I had known this up front (say by asking members of the dev team who are actually quite helpful and would probably have responded pretty quickly, really)
  3. The classes that implement many of these controls use the specific ID of some controls to populate certain attributes--mostly Text. For example, Day.ascx can have a Literal control with an ID of "PostDesc" that is populated with the descriptive elements of a post at run time (e.g. when it was posted, if there are comments, that kind of thing). Some of these are checked for existence (like "PostDesc"), but some aren't (like "PostText"). Which are checked and which aren't makes pretty good sense, though, so I don't see that as a problem. I mean, I want to see an error if my blog is unable to display the PostText of a post.

Creating a New Control

The key feature that you need in order to leverage SubText entry information is a control class defined in SubText called CurrentEntryControl. This nifty little guy has no implementation in any of the default skins, so he's easy to overlook. The key feature he possesses is that if referenced from a control that has a blog entry associated to it, it'll let you use databinding syntax within that control to access the properties of an entry. I'm not going to say how long it took me to figure this out. Let's just be happy that I have...

The Technorati embed needs your fully qualified URL (i.e. the full-on web address to reach your post--the one you'd paste into a browser's address bar to reach just that post), so the best databind expression that I found for my purposes is:

<%# UrlEncode (Entry.FullyQualifiedUrl) %>

Believe it or not, this actually works. UrlEncode is defined in the CurrentEntryControl object along with the Entry property. Again, don't ask how long it took me to figure all this out. Just for kicks, here's the Entry class properties:

Since I'm going to want the Technorati embed to function in a couple of different page contexts, I think the easiest way to implement it is to put the script in its own control. This will be pretty simple for just the Technorati embed script:

<%@ Control Language="c#" Inherits="Subtext.Web.UI.Controls.CurrentEntryControl" %>
<script src="http://embed.technorati.com/linkcount" type="text/javascript"></script>
<a class="tr-linkcount" href="http://technorati.com/search/<%# UrlEncode (Entry.FullyQualifiedUrl) %>">View blog reactions</a>

That should be generic enough to function in any blog. I've put it together for you to download here if you want to save yourself some copy and pasting.

Placing The New Control

Now that we have the control we're going to use for Technorati's embed, you have to decide where you're going to use it. For me, I decided to use it both for posts on the blog's home page and for the individual posts themselves. After digging around, I decided that the best candidates for the new control were Day.ascx and ViewPost.ascx. Day is eventually referenced from the home page and ViewPost is referenced when displaying a post from archive (i.e. permalinked pages).

For the control to work, you'll need two things: a Register tag and the control tag. The Register tag lets the parent control know where to find your custom control. The control tag lets it know where to display it. My new ViewPost.ascx looks like this (my changes are highlighted):

Save those changes, upload to your server, and you're done. Just because I can, I included both of the modified controls in the download I referenced above. Pop all three into the Controls folder of your custom Skin and you should be good to go. Note that I pulled both of those controls out of the "Piyo" built-in skin, so it's very possible that they may differ from the controls in other skins.

22. December 2006 05:30 by Jacob | Comments (2) | Permalink

Hacking SubText

Okay, I've had SubText up and running for a week and some now, so naturally it is time to tinker. In poking around, I'm not as happy with SubText's integration model as I was with DasBlog's. DasBlog exposed a number of "macros" that you could use to insert certain internal values into your own stuff. I kind of liked their model because once you registered your own code, you could reference your macros from DasBlog stuff as well (bear in mind that I didn't actually implement DasBlog, so my impression could be off).

That said, as long as you don't need to access things like entry links or other internal blog workings, it's pretty easy to modify a "Skin" in SubText to add new stuff. SubText reads a main ASP.Net Web User Control called PageTemplate.ascx that holds essentially the format for the other Web User Controls that a SubText site uses. Which subcontrols are used are pretty much determined by this PageTemplate control and the controls it references. This structure made it pretty easy for me to add a new embed control I wanted to play with.

The Technorati Embed

There are a number of sites that offer badges, embeds, and other tools intended for their users to simultaneously spruce-up their own sites and provide free advertising for the service involved. The Technorati search feature on the right is an example and was my first foray into modifying my blog template. With Technorati, the tag I need to use to expose a Technorati search link is this:
<script src="http://embed.technorati.com/embed/xw5vkfrkzb.js" type="text/javascript"></script>

To pop it on there, I just added that code right in the PageTemplate.ascx file where I thought it'd do some good (using a text editor). Straightforward, but inelegant.

The Great Games Experiment Embed

 For my next trick, I wanted to see how SubText would handle it if I mimicked their own structure to create a new control. To do this, I created a couple of things that are way more complicated than they needed to be. I mean, technically, all I needed to do to pop the user embed onto my site is copy the badge tag from their site in the same place I put the Technorati stuff. The tag isn't all that complicated:
<iframe src="http://www.greatgamesexperiment.com/greatgamesbadge/user/Jacob" height="140" width="204" scrolling="no" frameBorder="0" />

Doing so would produce this handy "badge":

But I'm a geek and I wanted to test some stuff out, so instead of simply pasting a bunch of html, I created a .Net project and two custom web user controls. One of the controls creates a user badge. The other control creates a game badge. The result of this project is that you can drag one of these controls onto an ASP.Net page and set the "UserName" property (or "Game" property for a game badge) and it'll take care of the rest. The active html would look like this:
<cc1:GreatGamesUserEmbed ID="GreatGamesUserEmbed1" runat="server" UserName="Jacob" />

Somehow, I managed to get that to work. As long as you've registered my assembly for the right tag prefix, you're golden.

But that wasn't quite enough for me, oh, no. Simply adding that control to PageTemplate would be kind of hokey and out of place, so I went one further. Following the pattern of the other controls, I created a GreatGames.ascx file under the Controls directory and referenced that instead. It's a simple file, but then, most of those Control files are. It creates a section that fits in much better on the right side bar and groups the Great Games badges together more naturally.

And wonder of wonders, it worked first time. Love when that happens.

Wrap-up

SubText doesn't have any documentation that I could find detailing these steps, so making these modifications required mucking about in the code to follow their flow during page delivery. If I get the gumption later, I'll re-write this as a more generic how-to in creating very basic SubText add-ins because the community needs something like this. Also, I saw a couple of interesting objects that look like you can extend them for more complicated things (like controls that access the SubText data, I'll bet). I'm sure that Phil Haack and others could point those out. In fact, they're nice enough folk on their dev email list I'd bet they'd be happy to answer questions if I took the time to ask.

Also, if you want those Great Games controls, download the source code. It's nothing fancy, but does the job. Or, if you just want the binary, download that instead. The source code project includes my GreatGames.ascx file as well so you can see an example of implementing them. Let me know if you do anything interesting with them.

14. December 2006 18:34 by Jacob | Comments (1) | Permalink

Blogging Software Update

Well, I still haven't chosen what blog software I want to use in a new home. So many to chose from and none are a perfect fit. The comments left by Scott Hanselman, Phil Haack, and Dave Burke were good ones and point out the connectedness of the blogosphere (is that word accepted enough to forgo the quotes now?)

Since I gave DasBlog such short shrift in my original post, I spent some quality time with it. DasBlog has some really strong points in its favor. For one, it has a very active developer community, though that isn't as apparent as it is with Subtext. DasBlog 1.9 was released today and I'm even mentioned in the release announcement (it's always nice to see your name in print--even virtual print).

I am leaning towards DasBlog now. Two bonuses of using it: no tricky database settings (it uses XML files stored in the web file system), and a really flexible plug-in system (they call them macros, but they're actually compiled .NET assemblies with a standard interface and config-file usage).

Not that I've decided to use it. Or not. I'm not generally this indecisive. I think...

 

Technorati tags: , , , ,
22. September 2006 18:38 by Jacob | Comments (0) | Permalink

Blogging Software

It's always the little things that chafe, you know? I mean, for the most part I'm happy with Windows Live Spaces, but there are little things that bug me from time to time so I find myself getting antsy. On the plus side, I like the modules and the freedom to place them where I want them. I like the book list (but I'd like it better if I could a) put it in the order I want and b) could rate the books listed there). I like my links.

But I find that I keep wanting things I get with more of a hosting service. I want more control. I'm a tinkerer, what can I say? So I've been looking at blogging software a bit. Since I have an account at Go Daddy, I'd like to find something that I can use there, and I'd like very much for it to be created in ASP.NET. It'd be nice if it was open source as well, if only so I can tweak and explore at my own capricious whim. Also, as long as I'm putting together a wish-list, how about if it could be programmed in ASP.NET 2.0? I mean, master pages and application themes with skinning support is, uh, lacking an appropriate white-guy expression, "da shiz".

The front-runners in the .NET space for blogging software appear to be SubText and DasBlog--both are branches from their progenitor .Text which appears to be defunct. Unfortunately, since .Text was originally ASP.NET 1.1, both SubText and DasBlog are rooted in that technology. They both support custom themes, but they had to hack ASP.NET 1.1 to do so--mostly with custom controls.

DasBlog

I was originally drawn more to DasBlog because I've become a fan of Scott Hanselman--first from his podcasts, Hanselminutes, but later to his blog (which actually uses DasBlog, kudos for eating the dinner you've made). He's one of those over-producers who seems to have his hand in on fifteen million things at a time and is able to simultaneously talk about it all.

However, DasBlog's main website is frequently down, and there doesn't appear to be a lot of action in the form of improvements, releases, news, or updates. Which makes me wonder if it isn't a dying product, suffering from Scott's hyper interests.

SubText

SubText is developed by another blogger I like, Phil Haack. Phil also lives in the house he built so you'll hear his experiences with SubText on his blog sometimes. I was intrigued to see him announce that SubText 1.9 has been released recently. SubText 1.9 is a project conversion to ASP.NET 2.0 so I was reasonably excited to see its release.

So excited that I went ahead with an install. It was a painful experience. Not because SubText isn't a pretty good product, but an install on a cheap Go Daddy account is a step or three down from the expected configuration. The main blockage is that while Go Daddy gives you dbo (owner) privileges on your database, you have highly restricted rights on the master database. Unfortunately, the install assumes that you can use a select on a master location to see if a table already exists and that select blew chunks.

One advantage of open source, though, is that someone reasonably competent (or simply lucky as is more likely my case) can dig through the install process and see what needs to happen. Since I could see that the table didn't exist, I ran the script manually. Unfortunately, since the install tracks installation stage in memory instead of checking the database, I ended up having to do the entire install manually instead of just that first step. Ouch.

So it was a hack, but it appears to have succeeded. I'm not entirely happy with the implementation, though, because while SubText is now ASP.NET 2.0, it doesn't actually use the new  master page and theme features. Those may be implemented in future, but since that's a relatively fundamental alteration, it would break a lot of things--particularly a lot of user-created theme files. Creating work for yourself is one thing, but making your users go back and re-do all the custom themes they so generously contributed to your project is going to be a hard sell when there isn't a well established benefit. Indeed, the roadmap implies that if it happens, it's at least two releases away (and frankly, 2.1 looks a little daunting to me and should probably be cut down some if they want to take less than a year with it).

SUB

One of Phil's more endearing traits is a kind of perverse generosity that led him to advertise for a competitor (while throwing down the gauntlet of course). Since I'm not entirely happy with SubText, I thought that I'd give SUB (Single-User Blog) a look-see.

Frankly, I like SUB. It's pretty simple and since it's done from scratch in ASP.NET 2.0, it has all the goodies I've been looking for and some I had thought of but didn't figure I could get.

Unfortunately, SUB has two draw-backs that make me hesitate. The first is that it is, as its title clearly states, single-user. One thing I came to like about SubText is that you can support more than one blog from an installation. Indeed, I was able to point both domains I had registered with Go Daddy to the same location, have them run the exact same files, and yet have each site perfectly individualized (it does this by checking the incoming URL address to know which blog settings to use).

The second draw-back has to do with my personal tastes in programming, so I'm going to leave that for another post.

So what?

I've no idea what I'll end up doing with my blog(s). Since one of them is a new one for Cawti, I'll have to make some relatively irrevocable choices really soon here. I'm feeling all Frankensteiny, thought, so I may just mash pieces of lots of different things together so I can terrorize intolerant villagers. Yeah, that sounds fun...

 

7. September 2006 03:44 by Jacob | Comments (0) | Permalink

Calendar

<<  February 2017  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
272812345
6789101112

View posts in large calendar