comments edit

Several people have complimented the live comment preview used in my skin. Try leaving a comment and notice the preview mode underneath. It now even supports a few HTML tags. Unfortunately I haven’t updated the comment page to tell you which tags are supported. Doh!

I did not write the original script. It was borrowed from the Asual Theme for blojsom and used in our Piyo skin.

However as I like to do, I spent a little bit of time trying to improve the script and turn it into a Markup Based Javascript Effect Library.

Now, by simply referencing this script, you can add live comment preview to any blog in three easy steps.

  1. Reference the script.
  2. Add the CSS class livepreview to a TextArea
  3. Add the CSS class livepreview to a div

The textarea is of course the form input into which the user enters a comment. In ASP.NET it would be a TextBox control with the TextMode property set to MultiLine like so:

<asp:TextBox id=”tbComment” runat=”server”\  Rows=”10” Columns=”40” width=”100%” Height=”193px”\ TextMode=”MultiLine” class=”livepreview”></asp:TextBox>

The <div> is the tag used to display the preview. There is a good reason to choose a div as opposed to allowing a <p> which I will talk about later. In my blog, that div already had a CSS class applied so I simply added the livepreview class like so:

<div class="commentText livepreview"></div>

And that’s it!

Well not exactly. I fibbed just slightly. There is actually a fourth step for the discriminating blog author. If you crack open the script, you’ll notice the following section on top:

var subtextAllowedHtmlTags = new Array(7);
subtextAllowedHtmlTags[0] = 'a';
subtextAllowedHtmlTags[1] = 'b';
subtextAllowedHtmlTags[2] = 'strong';
subtextAllowedHtmlTags[3] = 'blockquote';
subtextAllowedHtmlTags[4] = 'i';
subtextAllowedHtmlTags[5] = 'em';
subtextAllowedHtmlTags[6] = 'u';

In the next version of Subtext, that snippet is actually generated within an ASP.NET page (specifically DTP.aspx) as it is a list of HTML tags allowed by the blog engine. Since this is configured on the server, I needed some easy way to pass that information to the javascript. I chose to dynamically render javascript. I could have used an AJAX approach, but why bother at this point?

You can edit that array to specify your own tags. Note the preview only currently renders tags that contain something between a start and end tag. So for example, <b></b> won’t show up, but <b>Text</b> will.

For example if you add hr to your list of allowed tags, <hr /> won’t get rendered properly in the live comment preview. It will get rendered properly when it is actually posted as a comment. This may change in a future release.

Now it is up to you to apply some CSS styling to actually make the preview look good.

comments edit

This is a follow up tip to my post on Implementing CSS Based Printing.

One technique that served me well on a project recently was to implement a very simple print.css for the print stylesheet. In fact, it looks like this:

.noprint
{
    display: none;
}

Make sure you declare the stylesheet properly:

<link rel=”stylesheet” type=”text/css” href=”print.css” media=”print” />

And now simply add the css class noprint to any elements in your HTML you do not want printed as in the simple example below.

<html>
<head><title>example</title></head>
<body>
<div id="main">
   <div id="header" class="noprint"></div>
   <div id="sidebar" class="cool noprint"></div>
   <div id="content"></div>
   <div id="footer" class="noprint"></div>
</div>
</body>
</html>

This is useful especially when retrofitting a complicated html page to use CSS based printing.

comments edit

Artificial Teeth In my last post, I mentioned that even in high pressure situations, I would take my time and follow certain practices I believe lead to better code, even if it meant taking longer to complete the code.

I took this approach because I felt secure enough in my career that I was not likely to get fired outright. Or at the very least I wouldn’t mind a bit of severance to fund a short vacation. I was confident that my overall time spent on the code, when taking into consideration time to find and fix bugs, was less than others who rushed through the code and spent the majority of their time debugging it.

However, there is another key fact I realized that kept me from rushing headlong into code oblivion. Many deadlines are totally and completely artificial, and I was tired of that bullshit.

“Tell me how you really feel Phil.”

Linus Oh don’t get me started.

An artificial deadline is nothing more than a comfort blanket to satiate a stakeholder’s need to feel in control over a process he or she refuses to understand. See the image on the left, that’s the stakeholder in charge of your project.

Most executives have a pretty solid understanding of corporate accounting. Yes, they trust the CFO to handle the specifics, but they understand the basic principles. This makes sense of course. A CEO who runs a company really ought to understand how the money is flowing in and out of the company.

Unfortunately, this same principle seems to apply less to software development. If a company undertakes a software development project, arguably one of the more expensive engagements a company can take on, it would make sense for the executive in charge to obtain a basic understanding of how real software development occurs.

Barring that, at the very least, trust your CTO or lead tech person, whomever that may be.

When given a deadline, I like to probe a bit and see if I can ascertain whether it is a hard deadline, or completely bogus. Bogus deadlines hurt morale, unless your team just plain decides not to care about them. My advice to anyone in charge of a software project is that the right way to gain control over a software project is to take the time to understand the software development process or completely cede control to your head tech person and trust them.

As for the developers and other tech people, we are not without culpability. As a commenter pointed out in my last post, we need to be ready to communicate the business case for why we want to institute certain practices. We have to speak up and speak clearly, or there is no chance for improvement.

UPDATE: James Avery points out the necessity of deadlines lest developers gold plate like they are decorating the sistine chapel.

And I agree. Deadlines are important. This is the comment I left in his blog.

Well I do believe in deadlines. However, deadlines should be set based on realistic deadlines in which the developers give input and feedback. A deadline should really be an agreement between developers and management.

“Artificial” deadlines are those that are not informed by realistic estimates, but by wishful thinking.

comments edit

Plug and Play It never ceases to amaze me how short sighted management at many companies can be with software developers. Jeremy Miller mentions a discussion he had at the Austion Code Camp in which several developers were really unhappy with their work situations for very legitimate reasons.

I am reading a book called Beyond Software Architecture and just finished a short section on Design Debt. I’ve read and written on this topic before, but I focused on the cost to change code that is in debt. Luke Hohmann takes it further, noting that by not paying off that debt, a developer’s attention to quality is deadened. If the management does’t care and won’t allot the necessary time, what can we do? Not only that, allowing the code to remain and incur more design debt chips away at developer morale.

As Jeremy points out, there are two solutions, try and be a leader, institute good practices, and convince management to allocate the time, or move on to greener pastures.

And you know what?

Management doesn’t care. Many of them see developers as plug-and-play. We’ll just get another one. Ignoring the cost to recruit and hire a new developer, they’d rather just plug in a new developer than make difficult systemic changes. Changes that would ultimately lead to the benefit of the bottom line, but does not do so immediately in a manner they can show off to their shareholders, bosses, whomever.

So what is the solution? Unfortunately I do not have much more to offer than what Jeremy points out. Personally, I make all efforts to refuse to compromise on certain practices in the first place. I am not always successful, but I have worked in high pressure situations where I simply refused to lower my attention to quality and still took the time to write unit tests and spend time refactoring. My successor at one job even IM’d me out of the blue to congratulate me on the quality of code I wrote in such a chaotic situation. That felt pretty good.

And the funny thing is, it did take a bit longer to reach code complete, but I do not think the overall time to release was extended. “Code Complete” usually meant to now find and fix all the major bugs introduced from rushing it in the first place.

comments edit

I don’t know about you, but when I find something wordy but really worth reading on the web, I print it out. Sure, I could try reading it on my tablet, but do you really want to deal with your tablet while reading in the…er… “office” if you know what I mean? *wink wink* *nudge nudge*

Unfortunately, the experience of printing many blog posts typically includes an ink draining header graphic, an unecessary space wasting sidebar or two, and the main fixed-width content being truncated off to one side.

If you click through to an individual blog post from my blog using a browser, you will notice that I now have a Print button. Go ahead and click it. It should bring up the following dialog.

Print Dialog

Getting that dialog to display is quite simple. Here is the HTML.

<a href="javascript:window.print();">Print</a>

However if you actually follow through and print a page, you can see that the result only includes the contents of the post and does not include my top navigation nor the sidebar. To test it out without actually printing, try turning on print preview for your printer if your printer driver software supports it.

The other thing you’ll notice is that the printed view displays the urls for links alongside the link (if you are using a CSS2 conformant browser such as Firefox). The image below is a screenshot from my poor quality print preview.

Print Preview
Snippet

So the obvious conceit here is that I expect to someday write something worth printing. In the meanwhile, I have the print icon there to give people the impression that my content is worth printing.

And setting this up is quite simple using media specific CSS. My blog has a separate css stylesheet for printing. The changes the stylesheet makes to the layout include changing from a fixed-width layout to a 100% width layout as well as setting the display of certain elements to none. Note that this print specific stylesheet works whether a reader clicks on the print icon or uses the browser’s print button.

My inspiration for setting this up was this article in A List Apart by Eric Meyer. His article provides several tips for better web printing.

Setting This Up For Subtext

For those of you with a Subtext blog, how can you set this up for yourself? Glad you asked.

One enhancement we made to the skinning engine over .TEXT is that we added more options to the Skins.config file located in the Admin directory.

A skin can now specify one or more script and css files. For script files, you may specify the language, though javascript is the default. For css files, you can specify the media type.

Here is a snippet from my Skins.config file. Haacked is my personally customized skin not included with Subtext.

<SkinTemplate SkinID="Haacked" Skin="Haacked">
    <Scripts>
        <Script Src="scripts/ExternalLinks.js" />
        <Script Src="scripts/LiveCommentPreview.js" />
        <Script Src="scripts/tableEffects.js" />
    </Scripts>
    <Styles>
        <Style href="IEPatches.css" />
        <Style href="print.css" media="print" />
    </Styles>
</SkinTemplate>

As with .TEXT, the skinning engine just assumes that there is a style.css in the root of your skin’s directory, so it does not need to be specified here. However, now you may simply add additional css files for your skin to reference. In the snippet above, you can see I have a separate file for IE CSS hacks as well as a separate css file for printing.

The declaration for print.css includes a value of “print” for media. Other allowed values include, all, aural, braille, embossed, handheld, print, projection, screen, tty, tv, though for everyday use, most developers will stick to print and screen.

After setting a reference to your print.css file in the Skins.config file, simply add a print.css file to your skins root and you are on your way to better printing.

comments edit

Kent Sharkey comments on the necessity of marketing and advertising in general in response to Microsoft’s recent viral marketing efforts.

Blah Blah Blah

What grabbed my attention was the new word he coined (or if he didn’t coin it, he brought it to my attention and that is good enough).

Whorosity

I just have to add it to my vocabulary. I’ve tried to coin terms in the past such as blogtegrity that I hoped would catch on, but I realize now that I’m just stooping to linguistic whorosity.

comments edit

Scott over at LazyCoder called me out in my comments for participating in Channel 9’s viral marketing campaign for On10.net, whatever that may be.

I have never met Scott in person, yet he challenges me about this. And this is exactly what I love about the blogosphere^1^ .NET blogging community. That despite never meeting, it really does feel like a community in which we know each other well enough through our writings and feel empowered to challenge each other if need be.

On his blog, he writes (and my ego leads me to believe this is a response to my post) a promise statement that everything he says will be genuine. This is a statement of his blog’s integrity or blogtegrity for short (sorry, but I like making up words). Think of blogtegrity as being kind of like journalistic integrity, but with much more integrity to the truth and not beholden to the government or large corporate interests (ooooh, I went there).

I love this and it gave me an idea to take it to the next step. For a while now on the top navigation of my blog I have had a link to my privacy statement. I have now added a link to my blogtegrity statement. It is a promise similar to Scott’s that I will maintain my Blogtegrity to the best of my ability.

As for me being a Microsoft Shill, here was my response…

I have a couple of friends I know personally (I knew them before they were assimilated into the borg) that work there who are very excited about the work they’ve been doing and told me about this, but couldn’t give me details.

This is just friends helping friends. I trust their judgement.

In a follow-up I mentioned

Ha ha. Oh ye of little faith.

Scott, after writing this post (Better Developers Through Diversity) critical of “Microsoft-Think” you’d still think I might be a Microsoft Shill? ;)

Till next time, Goodnight and Goodluck.

^1^ Apparently it is no longer de rigueur to use the term “blogosphere”. I have never personally had a problem with the word, despite the fact that it is ill-defined. The term “architecture” is ill defined as well but useful in discussing software.

How many words describing a community are well defined?

Meaning of words are hardly ever set in stone, they are an ongoing negotiation. Much like grammar. Otherwise meaning would never change to fit the changing context in which we live.

comments edit

10 So those crazy cats at Channel 9 are up to something new and somewhat secretive so far.

A mysterious source who will go unnamed (but will receive a beer at Mix06) showed me the picture to the right on Jeff Sandquist’s Flickr site. At first I wondered if he was having a child and naming it Channel

  1. But I dug a little deeper and saw a link to on10.net which includes a videocast.

From the video and the thumbnails which represent further clues that will be unveiled this week, it looks like they are producing some sort of television show (for developers?) hosted by some woman and Cl@y Aìken.

Actually, upon further review of the video, I don’t think that is Cl@y after all^1^.

Seems like Microsoft is really on this let the cat out of the bag slowly style of viral marketing these days. I believe this is quite independent of Origami, but I can’t help noticing the parallels in how they are taking advantage of the blogging community to slowly build out hype from the grassroots level. I personally think its neat, though I realize I am providing unpaid advertising for something I have no idea what it is. It had better be good! ;)

As an aside, I wonder when they’re going to be rebranded as Channel9 Live™. Their URL still contains MSDN but it’s only a matter of time. ;)

^1^ UPDATE: So I was right, it is definitely not Cl@y. In the beginning of the video, there was a bit of uncertainty, but at the very end, it is obviously someone much better looking and more female. Someone named Laura Foy who was on G4TV, which I’ve never seen but I heard about. Wasn’t it a show about computer games for geeks? Maybe On10 is going to be an XBox show.

comments edit

This past week was a particularly good week and weekend for me and my wife. First of all, I was happy to announce the release of Subtext with only a few minor hitches which is a great feeling.

Also during the week, my wife received a huge raise from her boss. In part this was a response to an impressive offer made by a large clothing company she was on “loan” to as a pattern maker. The fashion district in Los Angeles is known for being quite stingy with the employee pay, so this came as a bit of a surprise. Basically this means we can upgrade from Ramen to some pricier noodles for our three squares.

In truth, it means the risk we took in me taking a large paycut to start a company with Micah is largely mitigated. We can start putting money back into our savings.

Soccer Ball On the soccer front we finally had the opening game of the season for the competitive league I joined. Up until now, we’ve been playing a few pre-season practice games.

We opened up the season with a 2 to 0 win with a goal from yours truly. In the other league, we won 4 to 1 in a game where I flubbed two good chances. So I had exactly one day to relish and replay the goal in my head before it was completely replaced with the two I should have put in.

In any case, it was a much better soccer weekend than the previous weekend’s pummelling.

PS: The term “Haackayamas” is a term our friends use for me and my wife. It is a mashup of my last name and hers.

subtext comments edit

UPDATE: Ok, this is totally my fault. I took a perfectly good NAnt script another developer wrote and tried to add a few things in there and made a dumb error. I should have a unit test for our NAnt script. ;) I’ll write up a post later describing the issue.

So I guess my fears of the release weren’t totally out of order. The first major bug report has come in. Fortunately it is an extremely easy fix.

The emoticons.txt file appears to be missing from the webroot in the distribution package. I looked at our codebase, and it is there. I run an NAnt script which automates creating a distribution package. I see the line where it is supposed to add the emoticons.txt file into the package, but it has decided that it would rather not. I need to dig into this.

In the meanwhile, I just updated the distribution in SourceForge. For those of you who already downloaded Subtext, please download and unzip this file into the root directory of your Subtext site.

For those of you about to download Subtext, SourceForge has the corrected version.

Tags: Subtext

comments edit

Via Slashdot, I recently read an article entitled What Corporate Projects Should Learn From Open Source by Andrew Stellman and Jennifer Greene.

This article is a wonderful complement to the book on managing open source projects I mentioned recently as it focuses on what corporated projects can learn from successful open source projects.

Among many factors, one key factor they discuss is how the lack of strict hierarchy and transparency in an open source community is a key component to an OS project’s success.

Features and changes cannot simply be added or changed on the whim of some VP who has no clue about how software development works and is unwilling to expose his or her reasoning. If someone proposes a big change, it gets discussed and weighed on its merits in an open forum. The marketing team does not drive the schedule in an open source project.

Another striking quality of successful open source projects is that despite the tendency towards an agile approach to development, they are at the same time very disciplined. Every project profiled had fairly well documented and detailed rules about the procedure for committing code, how a release is packaged, how a bug is triaged, etc…

I believe this turns the notion that open source projects are undisciplined chaotic bucket of bolts endeavors while commercial projects are finely tuned tightly run machines on its head. In fact, it is the commercial projects that could stand a bit more discipline.

Unfortunately, I believe that some of these lessons may never reach the right ears, as pride and arrogance tends to bring about the downfall of many a corporate project.

In any case, I encourage you to read it and sneak it under the door of the stakeholders of your various projects.

comments edit

Shoeless An old saying I’ve been using a lot lately is the old saw “A shoe cobbler’s kids go shoeless”. Basically, it points out how difficult it is to keep one’s own affairs in order when it is one’s job to do so for others. As an example, my company is in the business of building fantastic technology solutions, but our own website is rather neglected. This is something we see as a real problem and will address soon.

In truth, falling into this trap is understandable, but a bad idea. What better advertising for the shoe cobbler than to have his kids in fantastic shoes? But the fact that there is even a saying about this reflects just how common this is. When starting a business, your first priority in the early stages is to get the cash flow going and make sure your customers are happy and well fed. Only then can you take the necessary chunk time to really focus ony our own needs. But until then, you shouldn’t totally neglect yourself. You wouldn’t want to hurt future growth for near term gains.

The point of all this is that I have updated my blog to the latest release. I was running an older internal build of Subtext for a while which had a couple bugs that would make themselves evident. The last thing I wanted is for someone to see the announcement on my site, notice the bug, and make a judgement based on that.

The noticeable difference is that there is now a comment preview feature as well as a recent comments display on the right. I’ll probably be tweaking my skin in the near future adding a few fun goodies.

comments edit

Subtext Logo Well it took a bit longer than I thought it would, but we’ve finally put the final touches to Subtext 1.0, code named “Nautilus”! One of the primary goals of this release was to make it much easier to setup and use than .TEXT, and I think we’ve accomplished that.

[Download it here]

Acknowledgements

It is a LOT of work delivering an open source product, especially given that all this work is done in our spare time. A big thanks goes out to all the contributors: those who submitted code as well as those who contributed ideas and encouragement (especially my wife who has been very understanding of my code obsession and made me a fantastic cup of tea last night as I tried to finalize the release). All of it is helpful and appreciated.

In particular I want to give much credit to the team who have put in a lot of effort lately to get this ready. Robb, I am ready for that homebrewed beer!

I also want to highlight TurboMilk, the creative folks who designed our logo.

Installation

Check out the installation guide on our project site for a walkthrough of the installation. There are also a couple screen casts if you are the more visual type.

New Features

There are many small improvements both under the hood and in the UI. Here are some of the highlights…

  • Web Based Installer - Installs the database schema and stored procedures.
  • BlogML Support - Import and export your blog data to and from other blogs that support this new standard.
  • .TEXT 0.95 Import Wizard - This is a direct database to database import.
  • Host Admin Tool - Use this to manage multiple blogs
  • Improved multi-blog support. Read the configuration docs for more details.
  • Improved Documentation - We’ve gone out of our way to improve documentation as much as possible.
  • Logging Console - The first iteration of this console displays error messages in the admin section. You can update the Log4Net.config file to change logging levels.

Interface Improvements

These were designed to spiff up the look of Subtext and remove some of the headaches in .TEXT

  • New Skins - We added some spiffy new skins for your blog delight.
  • Recent Comments Skin Control - Display recent comments on your blog (requires editing a skin if it doesn’t have the control already).
  • Multiple Comment Deletion - Rather than deleting comments one at a time, check them off and delete them in bulk.
  • Single Web.config file - There’s only one web.config file to worry about.
  • Comments disabled after N days - Where N is an integer of your chosing zero or larger.
  • Comments throttling - Specify a delay between comments as well as filter out exact duplicates. This is good for those repetitive spam bot attacks.
  • Edit Link Control - when logged in as an admin, an edit link appears next to post titles (requires editing a skin if it doesn’t have the control already).

Under the hood

This is for you developers out there. Holla!

  • Unit Tests - We added a bunch of unit tests (using MbUnit) to the codebase. We are by no means where we want to be regarding code coverage, but it is a step in the right direction.
  • NDoc - We included an NDoc file and compiled help file of the code base.
  • FxCop - We have way too many FxCop violations, but at least we know we do via our FxCop project file.
  • NAnt Build File - Build the entire solution from the command line. Choosing the “doc” target builds a compiled help file.
  • RFC3229 Delta Encoding - Potentially saves on bandwidth once clients start implementing their side of the protocol.
  • RSS GZIP Compression - Compress that baby.
  • Fixed MetaBlogAPI - Fixed a few bugs with the MetaBlogAPI implementation. You can now edit blog posts via w.Bloggar.

What’s Next?

The next version of Subtext code-named “Daedelus” will focus on delivering a Plugin framework along with a few plugins. That will be the key deliverable. You can view the Roadmap to see other planned features, but be aware that we may revise this list soon in order to keep the next release tightly focused. Deliver early and often I always say.

comments edit

I have never worked as part of a shrink wrapped product team, which makes working on Subtext the closest thing to the experience. When a product team releases a product, they often stamp it with the acronym RTM, Release to Manafacturing, which is more and more becoming a misnomer as the only manafacturing being done is the manafacturing of hyperbole by the marketing team.

But I digress…

Release Party The other thing a product team does when they release is throw a release party! With an open source project with no funding, that is a bit more of a challenge. The party sort of gives double meaning to the word “release”. Shipping a product and the release party provides a release from the stress of getting the code ready for RTM.

At least that’s how I imagined it. I thought that after the release, I would feel contentment, euphoria, and relief, all without the help of a drug. Instead, I feel foreboding, anxiety, and fear.

Yes fear.

Bug in the system The fear that there we left something important out. The fear that there is yet some hidden but treacherous bug left in the code that will jump out at the wrong moment and eat the first born child of a user (or it might run format c:\ if the user is childless).

I am guessing this is pretty typical of the actual experience of releasing a product. This is the real feeling one gets, which is why they resort to getting really sloshed at the release party, to quell these disturbing thoughts.

Fortunately there are a few things that allay these fears. First is the extensive testing we performed (along with the nice suite of unit tests). As with any product, there will definitely be a few bugs that get uncovered, but they aren’t likely to eat anybody’s kids.

Earth from
Space Secondly is the great team of developers from all over the world that participated in getting this first release out there. It is nice to know that when I hit the sack for some shuteye, somebody in Italy, Turkey, New Zealand, etc… is just getting around to taking a look at the code. Eyes are on the prize 24 hours a day. :)

comments edit

Soccer BallThis week, I’ve had the pleasure of being pummelled in soccer not once, but twice.

As I mentioned in a previous post, I have joined another more competitive soccer league. In that post, I mentioned that we tied one of the top teams. I was wrong.

Hearing that we tied this team, the team that did win the league last season wanted to schedule a match against us (it is pre-season right now). When we took the field, they had a short guy who we joked looked like Freddy Adu. The joke was on us as this “kid” had scored two goals against Brazil for Ghana in the U-17 world cup. This team also sports a former pro who used to make a million bucks a year in Spain.

They pretty much set us in our place, thoroughly dominating the game and scoring maybe seven or eight (we lost track) goals on us. Only our goalie knows the real number, and I told him I’d rather not know.

Fortunately, there is a new semi-pro league starting and some of their players will be moving up.

Today, in my other league, we played a Jamaican team known for smoking out on the sideline. Since our game was in the afternoon, we had hoped they would have been nice and toasted by then. Again, we were wrong.

With my team missing all three of our players who are capable of playing goalie, and not having any subs, we were destroyed as they scored six goals on us. The worst part is I convinced my wife to come watch and she know thinks she might be bad luck as both games she has witnessed we lost terribly. What a humiliating week of soccer.

comments edit

Just wondering, but are there any non-techie readers of this blog (besides my wife of course)? The reason I ask is that I am noticing that I am writing less and less about what’s going on in my life. In part, because I think my audience is almost entirely tech readers and google searchers.

Not that I would suddenly turn this blog into an on the Oprah couch tell-all blog if you were all non-geeks. Seriously.

comments edit

Intro

When I originally announced the subtext project, I had planned to not include multi-blog support even though it was already included in the .TEXT codebase.

The primary reason I wanted to exclude this feature was to simplify the code as well as the administration of a blog. If you ever had the pleasure to install .TEXT, you would remember that there were four web.config files from which you had to choose the appropriate one.

What changed my mind, besides the pleas from several multi-blog .TEXT users, was the day I thought it would be nice to create a blog for my homeowners association. I didn’t want to have to add another installation of Subtext for each blog.

However, any multi-blog scenario would have to adhere to our goal in making Subtext simple to set up and easy to use. So for the most part, the Subtext user experience is optimized for users with a single blog. For these users, you pretty much never need to know there is support for multiple blogs.

It turns out there was a lot of duplication of effort among the four config files, so by being careful, I distilled everything into a single config file. This alone should make the process of installation much simpler.

The Details

However, for those of you who wish to install multiple blogs, I’ve written up some documentation on how it works. Subtext supports multiple blogs from the same domain as well as multiple blogs from different domains.

asp.net, subtext comments edit

Fountain PenFor simple ASP.NET applications that do not employ URL Rewriting, stepping through the code that handles a request is fairly straightforward. For example, given a request for http://localhost/MyProject/Page.aspx, simply open up Page.aspx and look at the code-behind file to see what code handles this request.

But for applications such as Subtext that support dynamic URLs, it can be a bit daunting to find the code that finally responds to the request.

Common approach to URL Rewriting

Most applications that employ dynamic URLs employ a tactic called “URL Rewriting” The approach these applications typically take is some variant of this approach outlined by Scott Mitchell.

In this approach, a handler maps incoming requests for a dynamic URL to the actual ASP.NET page that handles the request. As an example,

http://localhost/CategoryName.aspx

Might be rewritten to:

http://localhost/Category.aspx?Cat=CategoryName

The .TEXT and Subtext approach {.clear}

Subtext employs a slightly different technique that it inherits from .TEXT which Scott Watermasysk wrote about a while ago. Instead of mapping incoming urls to different pages via a configuration section within web.config, it pretty much maps every request to a single page called DTP.aspx, a barebone template file.

Cracking open Subtext’s (or .TEXT’s) web.config file, you can see a section named HandlerConfiguration. It has an attribute defaultPageLocation with the value DTP.aspx.

Within that section are a set of HttpHandler nodes each with a regular expression pattern. When a request comes in, the handler with the pattern that matches the URL is invoked. Subtext adds the set of controls defined in the controls attribute of that handler and then returns a compiled instance of DTP.aspx via a call to PageParser.GetCompiledPageInstance.

Future Direction

For future versions of Subtext, we may consider changing to a model more in line with what Scott Mitchell wrote about above for a couple of reasons. The first is that the current model is not really supported.

According to the MSDN documentation on the GetCompiledPageInstance method

This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.

The second reason is that it is a lot more difficult for people to understand this method. We may gain a level of simplicity via the other approach without losing much in flexibility. This decision will be made when we have enough time to evaluate the differences and tradeoffs between the two methods.

Full Request Lifecycle in Subtext

If you are interested in a more detailed discussion of how Subtext handles incoming requests, please check out the recently added documentation on this subject, An In-Depth Look At The Life of a Subtext Request.

comments edit

So I spend my time writing up a hopefully useful guide to Subversion on SourceForge and all this one reader from Spain (¡hola!) wants to know is where I got my theme from?

My
desktop

Click on the image above to see a full screenshot

Well let me tell you amigo. Step one is to install the uxtheme multi-patcher. I first learned about this patcher via this post by Ryan Farley. This effectively replaces the uxtheme.dll that comes with Windows with one that allows you to use other custom styles.

You can find information about the patch from here or directly download it from this link.

I was a bit hesitant to install this as I generally don’t like to mess around with system dlls, but Jon Galloway and others have told me they have not run into any problems. So if you have any problems, blame Jon.

Once you have the patch installed, you can download interesting themes from DeviantArt. The particular theme I chose is called VXP Final.

My first impression was that it was a bit cartoony. But after spending a bit of time with it, I noticed that this skin was much more original and well thought out than many of the others I’ve seen. The maker of this theme paid a lot of attention to little details, including interesting rollovers of the start menu icon etc…