subtext comments edit

Subtext Logo I’ve been intentionally quiet about how Subtext is progressing (apart from a couple minor posts on how to obtain the code via CVS). My reticense is certainly not from lack of excitement or enjoyment of the project. Working on Subtext has been about the most enjoyable software development project I’ve ever had the pleasure to work on. So much so, that I’ve fallen a bit behind on my “real” work. Unfortunately this has caught up to me as I now have two projects with a potential third not far behind to work on (Yes, I know. A good problem to have, so quitcher belly-aching). This is very exciting for me as it may herald the beginning of a company. But it also means I need to slow down on Subtext a bit.

The reason I have been so reticent about Subtext up to this point is that we have not yet had a release. It was suggested to me that I probably should’t have waited to make the original Subtext announcement until I had a first release. This is definitely good advice for one who is starting an open source project. However, it may have helped in my case that I was building on an existing project familiar to many. And the few who did jump at the chance to help have been invaluable in what progress we’ve made so far.

What progress you ask? Well as you can see in this post, we are making great progress in having a nice logo. This is not the final logo, but probably really close. As you know, if a project has a nice logo, the code must really be nice. ;)

Subtext is progressing nicely in other areas too. So much so that I upgraded my blog to Subtext after a particularly withering comment spam attack. Subtext hasn’t yet completely eradicated comment spam, but it definitely has made a difference already.

In any case, I hoped not to talk much about it until we did have a release, but here I am anyways blabbing my mouth fingers. The goal of the first release is to generate excitement about the project and have many more contributors help with the next release. By talking about it now rather than waiting, I hope to try and encourage people to contribute before the first release. As my involvement declines for a few months (hopefully at most), I hope to have others pick up some of the slack and carry the torch sub forward.

Project Website\ If you’re interested in tracking the progress of subtext, check out our new project website at It is definitely a work in progress, but it has plenty of instructions for how to get the latest source code and how to contribute. Not only that, the site itself is in our CVS repository. So if you want to contribute to our documentation efforts (please! please!), you can submit patches to the project site.

Roadmap\ Also be sure to check out the updated Roadmap.

Well that’s it for me. I spent today on some Subtext housekeeping to clear the way for others to make some nice progress. I’ll probably be much more quite for a few months, though I will respond to emails and such and continue to try and guide the process. It’s been and continues to be fun sailing.

comments edit

Geolocation Anybody out there use a geolocation service they are happy with?

In case you’re unfamiliar with the term (and thus unlikely to be able to answer my question), Geolocation is the process of converting an IP Address into a geographic location. I think many services simply provide a database of ip address to geographic locations.

Also, how do these services handle AOL? Would every AOL user appear to be coming in from Virginia? Thanks if you have any insight!

comments edit

In a recent post I outlined step by step how to obtain the source code for Subtext as a non-developer. Well I was a bit sloppy and made a couple of mistakes in the post (now corrected).

However, I feel a bit bad about it. It’s not like me to be so sloppy and give incorrect information. I decided I must pay penance! These instructions apply to those who want to look at the source code on a development machine.

The Easier Way!

I created a simple batch file you can use to execute the CVS command for you. So my updated steps are:

  • As before, make sure you have TortoiseCVS installed.
  • Create a database in SQL Server named “SubtextData” and make sure your database server has an ASPNET login.
  • Create an ASPNET user using the ASPNET login for the SubtextData database.
  • Download and unzip the batch file to your projects folder (for me, I would place this file in my “c:\Projects” folder.
  • Now double click the batch file.

If you install TortoiseCVS in a location other than your program files, you will need to modify the batch file to point to the correct location.

When you run the batch file, it downloads all the source code from CVS and then runs a downloaded script named “CreateSubtextVdir.vbs” that will set up a virtual directory in IIS pointing to the correct location. All you have to do is compile and browse to http://localhost/Subtext.Web/.

Again, I hope this makes it easier to grab the latest bits and play around with it.

[Listening to: rez/Cowgirl - Underworld - Everything Everything: Live [IMPORT] [LIVE] (11:47)]

comments edit

spam I can have a very filthy mouth when pissed off. Take today for example, my dog was witness to a blistering stream of profanities as I found that my site was down. I was hit with a torrent of comment spam like nothing I’ve seen before.

Since I have my blog configured to send me an email when someone comments, the mail server was trying to send out 500 messages in five minutes. At least according to my hosting provider who turned off my site in response to the massive flood of email. All in all, the spammers posted over a thousand messages in a very short while.

This of course prompted me to perform an emergency upgrade of my blog to the latest unreleased version of Subtext. I wasn’t quite ready to perform this upgrade as I was hoping to get a few more comment spam fighting features implemented, but I was getting tired of the bombardment.

In the process I fixed a few bugs here and there, mostly related to the difference between developing on your own server but being hosted on a shared server.

At least now, I can throttle comments so that too many don’t come in all at once. This particular storm of comments appears to have originated in China (at least the comments and urls were in chinese). I think I may have to post a few posts about freedom, democracy, and the American way in order to get my blog banned in China. ;)

[Listening to: Life in Mind - Paul Oakenfold - Global Underground 007 New York CD1 (4:48)]

comments edit

I’m in San Francisco for a working meeting for a client. We’re doing a bit of project planning and working through the specs and schematics. The thing I love about San Francisco is I never have a bad time, even if I’m only here for two days and one night.

Last night, my buddy Micah took me, his sister, and her boyfriend out to a nice bar/club named “Milk”. The DJs mixed it up with a bit of neo-soul, hip-hop, etc.. and we closed the place down. Afterwards, I had real trouble getting to sleep, finally snoozing at around five AM.

I’m so tired at this point, my head can’t even make sense of it. I feel like I’m walking in an alternate world than everyone else. Like I’m the one black and white character in a color TV show. The slight bit of tunnel vision doesn’t help either. And no, I did not take any “foreign” substances last night, unless you count just a tiny eensy weensy bit of alcohol.

comments edit

UPDATE: Sorry, but my previous instructions contained some errors. I’ll make it up to you. In the meanwhile, here are the corrections.

If you don’t have developer access to the Subtext project on SourceForge but want to take a look at the latest version of source code and compile it yourself, just follow the following steps. I simply borrowed this list from Scott’s post and modified it for Subtext.

  • Download TortoiseCVS and install it.
  • Right click on the folder where you generally create projects (for me it would be in the c:\Projects folder) and select “CVS Checkout”
  • In the CVSROOT text box, enter in this: and in the Module text box enter “SubtextSystem”
  • Hit OK. You’ll get all of Subtext. You should now have a SubtextSystem folder within your projects folder.
  • There is a file named “CreateSubtextVdir.vbs” that will setup Subtext in IIS as a Virtual Directory (thanks again Scott!)
  • Now you’re ready to compile and play around.

NOTE: When you do this you are implicitly getting a label in source control called “HEAD.” That’s the latest stuff that the Subtext team has checked into CVS.

Until Subtext has a release, that’s all there is to play with. Once we do have releases, I’ll provide info on how to download a specific release.

comments edit

Just so we’re all clear about this, the convenience of the CommentAPI, that nifty little service that allows users to make comments to your blog from the comfort of their favorite RSS aggregator, comes at a cost. Enabling the CommentAPI supplies a back door for comment spammers who want to bypass the CAPTCHA guard posted at the front door.

I was just chatting with Andrew about this and we realized it would be quite easy to add CAPTCHA support to the CommentAPI if we could get both RSS Aggregator developers and blog engine developers to agree on how to update to the CommentAPI to support a CAPTCHA image url or a CAPTCHA text question. The RSS Aggregator would then display this image or text, and provide the user a field in the comment dialog to supply the answer to the CAPTCHA challenge, which the CommentAPI would validate with the CAPTCHA control. Of course this wouldn’t close the CAPTCHA backdoor for Trackbacks and Pingbacks.

In the meantime, I tend to favor non-CAPTCHA approaches to comment spam filtering for this very reason. I want to fight comment spam tooth and nail with every resource I have before I turn off the CommentAPI on my blog. Likewise, I still support Trackbacks because I personally have found them more beneficial than detrimental so far.

In any case, Subtext will provide configuration options to turn each of these services on or off individually so that users have full control of comment entry points.

comments edit

UPDATE: I have recently posted a newer and better version of this code on my blog.

As I’ve stated before, I’m a big fan of completely self-contained unit tests. When unit testing ASP.NET pages, base classes, controls and such, I use the technique outlined by Scott Hanselman in this post. In fact, several of the unit tests for RSS Bandit use this technique in order to test RSS auto-discovery and similar features.

However, there are cases when I want a “lightweight” quick and dirty way to test library code that will be used by an ASP.NET project. For example, take a look at this very contrived example that follows a common pattern…

/// <summary>
/// Obtains some very important information.
/// </summary>
public SomeInfo GetSomeInfo()
  SomeInfo info = HttpContext.Current.Items["CacheKey"] as SomeInfo;
  if(info == null)
    info = new SomeInfo();
    HttpContext.Current.Items["CacheKey"] = info;
  return info;

The main purpose of this method is to get some information in the form of the SomeInfo class. Normally, this would be very straightforward to unit test except for one little problem. This method has a side-effect. Apparently, it’ll cost you to obtain this information, so the method checks the Context’s Items dictionary (which serves as the current request’s cache) first before paying the cost to create the SomeInfo instance. Afterwards it places that instance in the Items dictionary.

If I try and test this method in NUnit, I’ll run into a NullReferenceException when attempting to access the static Current property of HttpContext.

One option around this is to factor the logic between the caching into its own method and test that. But in this case, I want to test that the caching works and doesn’t cause any unintended consequences.

Another option is to fire up Cassini in my unit test, create a website that uses this code, and test the method that way, but that’s a “heavy” (and potentially very indirect) way to test this method.

As I stated before, I wanted a “lightweight” means to test this method. There wouldn’t be a problem if HttpContext.Current was a valid instance of HttpContext. Luckily, the static Current property of HttpContext is both readable and writeable. All it takes is to set that property to a properly created instance of HttpContext. However, creating that instance wasn’t as straightforward as my first attempt. I’ll spare you the boring details and just show you what I ended up with.

I wrote the following static method in my UnitTestHelper class. All the write statements to the console shows the values for commonly accessed properties of the HttpContext Note that this method could be made more general for your use. This is the version within Subtext.

/// <summary>
/// Sets the HTTP context with a valid simulated request
/// </summary>
/// <param name="host">Host.</param>
/// <param name="application">Application.</param>
public static void SetHttpContextWithSimulatedRequest(string host,
string application)
  string appVirtualDir = "/";
  string appPhysicalDir = @"c:\\projects\\SubtextSystem\\Subtext.Web\\";
  string page = application.Replace("/", string.Empty) + "/default.aspx";
  string query = string.Empty;
  TextWriter output = null;

  SimulatedHttpRequest workerRequest = new SimulatedHttpRequest(appVirtualDir, appPhysicalDir, page, query, output, host);
  HttpContext.Current = new HttpContext(workerRequest);
  Console.WriteLine("Request.FilePath: " + HttpContext.Current.Request.FilePath);
  Console.WriteLine("Request.Path: " + HttpContext.Current.Request.Path);

  Console.WriteLine("Request.RawUrl: " + HttpContext.Current.Request.RawUrl);

  Console.WriteLine("Request.Url: " + HttpContext.Current.Request.Url);

  Console.WriteLine("Request.ApplicationPath: " + HttpContext.Current.Request.ApplicationPath);

  Console.WriteLine("Request.PhysicalPath: " + HttpContext.Current.Request.PhysicalPath);

You’ll notice this code makes use of a class named SimulatedHttpRequest. This is a class that inherits from SimpleWorkRequest which itself inherits from HttpWorkerRequest. Using Reflector, I spent a bit of time looking at how the HttpContext class implements certain properties. This allows me to tweak the SimulatedHttpRequest to mock up the type of request I want. The code for this class is…

/// <summary>
/// Used to simulate an HttpRequest.
/// </summary>
public class SimulatedHttpRequest : SimpleWorkerRequest
    string _host;

    /// <summary>
    /// Creates a new <see cref="SimulatedHttpRequest"/> instance.
    /// </summary>
    /// <param name="appVirtualDir">App virtual dir.</param>
    /// <param name="appPhysicalDir">App physical dir.</param>
    /// <param name="page">Page.</param>
    /// <param name="query">Query.</param>
    /// <param name="output">Output.</param>
    /// <param name="host">Host.</param>
    public SimulatedHttpRequest(string appVirtualDir, string
appPhysicalDir, string page, string query, TextWriter output, string
host) : base(appVirtualDir, appPhysicalDir, page, query, output)
        if(host == null || host.Length == 0)
            throw new ArgumentNullException("host", "Host cannot be null
nor empty.");
        _host = host;

    /// <summary>
    /// Gets the name of the server.
    /// </summary>
    /// <returns></returns>
    public override string GetServerName()
        return _host;

    /// <summary>
    /// Maps the path to a filesystem path.
    /// </summary>
    /// <param name="virtualPath">Virtual path.</param>
    /// <returns></returns>
    public override string MapPath(string virtualPath)
        return Path.Combine(this.GetAppPath(), virtualPath);

Within the SetUp method of my TestFixture, I call this method like so…

public void SetUp()
    _hostName = UnitTestHelper.GenerateUniqueHost();

    UnitTestHelper.SetHttpContextWithBlogRequest(_hostName, "MyBlog");

Unfortunately, this so called “lightweight” approach has its limits. Any call in your code to HttpContext.Currert.Request.MapPath will throw an exception. I tried working around this, but it looks like I’m at an impasse. The MapPath method makes use of the HttpRuntime.AppDomainAppPath property. Unfortunately, I cannot simulate the HttpRuntime in a lightweight manner. There is a way to run the code being tested within an HttpRuntime, but that, of course, is the heavyweight Cassini method mentioned above.

comments edit

Oh man, I have been head deep into “real” work lately, which explains the relative silence on my blog. In any case, it’s time to jump back in the fray with some light technical content.

Starting with version 2.2.1, the ever so handy NUnit unit-testing framework finally supports building custom test attributes. This allows you to create your own attributes that you can attach to tests to allow you to run custom code before and after a test and handle what to do if an exception is thrown or not thrown.

Roy Osherove, a unit-testing maestro, wrote up a simple abstract base class developers can implement that greatly simplifies the process of creating a custom test attribute.

In an MSDN article, Roy outlines various methods for dealing with database access within unit tests including a particularly promising method using COM+ 1.5. He mentions that he’s implemented a Rollback attribute for a custom version of NUnit he calls NUnitX.

Not wanting to run a custom implementation of NUnitX, I quickly implemented a Rollback attribute for NUnit 2.2.1. Heck, it was quite easy considering that Roy did all the fieldwork.

Unfortunately, I ran into a few problems. The custom attribute framework is not quite fully baked yet. When you apply a custom test attribute, your attribute may break other attributes. Case in point, my ExpectedException attributes suddenly stopped working. Looking through the NUnit codebase, it appears that the first attribute loaded handles the ProcessNoException and ProcessException method calls.

This is a known issue and an NUnit developer stated that he’s working on it. In the meanwhile, I worked around this issue with a beautiful kludge. I simply extended my Rollback attribute to absorb the functionality of an ExpectedException attribute. This is really ugly, but it does the job. So if you use this Rollback attribute, you can also specify an expected exception like so:


I know, “ewwww!”. This is essentially an attribute doing double work. It’s probably better to name it “RollbackExpectedException” attribute. But I hope to remove this functionality at a later date when the custom attribute support in NUnit is more full baked.

The second problem I ran into is that this approach enlists the native Distributed Transaction Manager for SQL Server (in my situation). In one project, I’m testing against a remote database and native transactions are turned off for security purposes. The solution in this case is to use TIP, or Transaction Internet Protocol. This would require modifying the “BeforeTestRun” method to (notice the added line in bold):

ServiceConfig config = new ServiceConfig();

config.TipUrl = “http://YourTIPUrl/”;

config.Transaction = TransactionOption.RequiresNew;


So far, I haven’t been able to get our system administrator to enable TIP so I haven’t fully tested this last bit of chicanery.

In any case, make sure to read Roy’s articles noted above before downloading this code. I’ve made some slight modifications to his base class to reflect personal preferences. Let me know if you find this useful.

[Listening to: Wake Up - Rage Against The Machine - Rage Against The Machine (6:04)]

comments edit

So it’s maybe thirteen years too late, but I finally have my first pair of Air Jordans. Yeah, they don’t have anywhere near the cachet they did back in the day, but hey, better late than never. Here’s a photo to commemorate the occasion.

Air Jordans\ Michael thanks you… all the way to the bank.

I remember when I was a high-school ball player (made JV. At 5’ 9”, I was a bit short for Varsity), I positively drooled at the idea of owning a pair of Air Jordans when they came out. They defined hotness for the realm of basketball shoes, though they seemed to do little to actually improve my teammates’ skills. I remember one point guard in particular who claimed the coveted title of being the “First” to own a pair (Remember how important it was to be the “First”? New toilet model coming out. I had it first!). He would show up to practice in head to toe Jordan gear complete with the tongue sticking out and proceed to build a very sturdy tenenment with the bricks he tossed up.

For a military brat, these emblems of Basketball glory were outside the realm of affordability. But now as a hot-shot independent consultant, they are still outside the realm of affordability. The difference now is that I have less sense, so I bought a pair anyways. They certainly are a lot cheaper than they were back in the day.

To justify this purchase, I give you a picture of my last pair. As you can see, I do wait till the last minute and beyond, before buying a new pair of shoes. Now excuse me while I purchase a new pair of Copa Mundials to replace my thoroughly trashed soccer cleats.

Ratty Shoe\ Look what the cat dragged in.

personal comments edit

This is what I was working on before the siren call of independent consulting lured me away.

The new product, which Philp projects to go live next month, will be known as SkillJam Mobile. For the initial product launch, SkillJam Mobile will be separate from the site, giving users separate log-ons. Philp said the company hopes to combine the two sites in the future.

SkillJam Mobile will offer what Philp calls multipack gaming, an innovative concept in the mobile space. Most carriers have games on their systems but are able to deliver them only one at a time.

At the time that I left, much of the infrastructure work had been completed, though I made myself available to do some contract work to help finish up some of the loose ends, which they took advantage of. It’ll be interesting to see how well this does.

comments edit

blogging my way to
pdc This is my feeble attempt win an all expense trip to the PDC this year. All I have to do is explain why I want to attend. Unfortunately, I’ll be judged on creativity, value to the community, writing quality and style. It was my hope that my dashing good looks and slipping someone a freshly minted bill would suffice.

Well the reason I want to attend is simple, it’s to play XBox 360… AND to get a heads up on the upcoming technology Microsoft is churning out. I’m particularly interested in future versions of VS.NET and ASP.NET. I hope to get some ideas to apply to Subtext.

As for sharing with the community, there’s this blog thing I have. I’ve recently inherited a video camera so I will very likely place videos and photographs on here, along with witty and insightful commentary (assuming I can hire that witty and insightful off-shore ghost writer). Like a relentless avalanche, I’ll go door to door and tell people in person if that’ll help.

Lastly, I’d like to drop the economic argument: I live in Los Angeles, so Microsoft can stay lean and mean and save a buck on the air fare voucher, though I’d gladly accept the hotel accomodations. Bill and Steve will pat you on your back for your resourcefulness.

personal, tech comments edit

TRS 80 Color Computer Via Rory’s post here, I’ve discovered the Obsolete Technology Website.

The fact that this site evokes nostalgia only reinforces two facts about me, that I am a total geek and I’m getting old. I love the write-up of my very first computer (which I still own and have laying around here somewhere).

The gray/silver color scheme was fetching for the original TRS-80 Model I computer, but it just doesn’t work on the Color Computer - it has to be one of the ugliest computers ever.

Ahhh yeah!

Commodore 128Later, when several of my friends were riding the Commodore 64 wave, I jumped one step ahead with my second computer, the Commodore 128 (one-piece model). In sense, this wasn’t a step ahead at all as the Commodore 128 was just a glorified Commodore 64 with a nicer looking case. Just about nobody jumped at the chance to write software that took advantage of the C128 Mode or the CP/M mode. I pretty much spent most of the time using it in C64 mode.

Amiga 500 My third, and last computer before switching over to the Wintel universe, was every geek boy’s wet dream at the time, the Amiga 500. Unfortunately the site doesn’t have a write-up of the Amiga 500 specifically, but you can read up on the Amiga 2000 which came out the same year.

Ahhh memories…

UPDATE 2013-06-24: Turns out I still have that TRS-80!


comments edit

Looking at my SPAM filter, I notice that nearly a quarter of my emails appear to be from PayPal. Of course, these are all spoofed to appear that way.

If you get an email from PayPal, DO NOT CLICK ON ANY LINKS IN THE EMAIL!

Instead, fire up your browser of choice, and type in in the address bar. Nearly all of these emails are fakes. Here’s an example of a particularly tricky one that raised alarms and almost caused a knee jerk reaction till I realized it was a fake. It played upon a simple fear.

You have added

as a new email address for your PayPal account.


If you did not authorize this change or if you need assistance with your account, please contact PayPal customer service at:

Thank you for using PayPal!\ The PayPal Team

Please do not reply to this e-mail. Mail sent to this address cannot be answered. For assistance, log in to your PayPal account and choose the “Help” link in the header of any page.

—————————————————————-\     PROTECT YOUR PASSWORD\

    NEVER give your password to anyone and ONLY log in at

Protect yourself against fraudulent websites by opening a new web browser (e.g. Internet Explorer or Netscape) and typing in the PayPal URL every time you log in to your account.


PayPal Email ID PP007

This is a standard notice when adding a new email address to your PayPal account. What caught my attention is that the email address has the name brian. My brother is named Brian, so instinctually I wondered if he made a mistake with his own paypal account, adding me as an address.

But soon, I realized that this has to be a scam, simply because EVERY email I seemingly get from PayPal appears to be a scam.

Notice the URL so helpfully included to ostensibly help you contact PayPal customer service. In my email, this was a link. When I hovered my mouse over it, it’s displays a completely different URL at some server with the IP A quick DNS Lookup shows this is not a PayPal server.

In fact, EVERY “link” in this URL points to that IP address, even the word which you would expect to be a mailto: link. Very sneaky.