Archives

Archives / 2004 / May
  • Unit testing with HttpContext

    I've become a real fan of unit testing, though I was somewhat skeptical about its use in Web apps. NUnitASP is pretty cool for testing UI, but what I really needed was a way to test classes running in the context of a Web app, not actual requests for pages.

    I do some caching voodoo in POP Forums to reduce database hits. Naturally this relies on the cache of the Web app, which you don't have in a unit testing context. Bummer! After some searching and link hopping I got to this article by Steve Padfield. Bam! That's what I needed. I only needed to make it work in .NET v2.

    After some messing around, I arrived at this:

    TextWriter tw = new StringWriter();
    HttpWorkerRequest
    wr = new SimpleWorkerRequest("/webapp", "c:\\inetpub\\wwwroot\\webapp\\", "default.aspx", "", tw);
    HttpContext
    .Current = new HttpContext(wr);

    Pop that code in any test that will call a class that needs a non-null HttpContext. Works like a champ, and life is grand. Now if I can only get the damn tests, or the assembly being tested, to see my config settings.

    Read more...

  • I really dig the provider model

    As I've been musing lately about how to integrate POP Forums with the new security features of ASP.NET v2, I have to say that I really, really dig the new provider model. Since I had to come up with all of the plumbing once upon a time to set roles and such, this is much easier having to just write the plumbing code to the data store.

    The last day or so, between holiday picnics, I wrote a provider for RoleProvider and MembershipProvider, and both have been mostly easy to implement since I had most of the necessary data calls already written to get the data. What an outstanding addition to the framework!

    It is clear, however, that when I get around to writing the UI, that I'll have to do two separate versions for the “customer” (I use quotes because, hey, it's not like they're paying for it). I'm not sure that everyone will be willing to plug in my provider, so doing things the old-fashioned way with my People object and the Principal replacement in Global.asax is something I should still allow.

    I'm starting to wonder now if I should shift my data layer for the forum to this provider model. As of now, the app loads a the right class implementing the IPopForumsData interface and caches it, calling it for the actual data access (something I ripped off from the www.asp.net forum). This works well enough, and the interface doesn't need its own implementation of any kind. I suppose it's easiest to just leave it.

    Programming is a little more fun when you've got new stuff to mess with!

    Read more...

  • NUnit against v2 of .NET Framework?

    Thought I'd toss this out to the “blogosphere” (I hate that term)... Has anyone been able to make NUnit work with the May build of .NET v2? I was able to get the source to compile, but running it throws errors I'm too dense to understand. Not sure if it's being configured right either.

    Anyone that can help is my hero!

     

    Read more...

  • Rob Howard goes solo

    Wow... I couldn't believe it when I read that Rob Howard was going solo. Didn't see that coming.

    I can't entirely blame him though. I went solo last week (not from Microsoft), hopefully on to something that will allow me to make a living. I hope that the rest of the Microsoft .NET folks are in good hands. My future depends on it!

    Read more...

  • Membership in POP Forums revisited again

    Last week I posed the question on whether or not I should write my own Membership provider for use in POP Forums. As I mentioned in that post, I already have my People class that does so much of what Membership does, but it might be convenient for users including the forum in their app to use the familiar (well, it'll be familiar someday!) Membership class instead of my own.

    Now that I've spent some time with it, creating my own provider would be a piece of cake because I'd only need to override the various methods of MembershipProvider and have them make calls to my classes. It would in fact be ridiculously easy!

    Using the Profile class looks like it's a little more complicated, and of course is dependent on web.config to map properties. The SDK docs are missing a lot of stuff, so I'm not sure where to go next on this. Is it possible to programmatically set properties for the profile object on app startup instead of having to do it from web.config? Would it make more sense to hard-code properties into a derived Profile provider?

    This is all pretty exciting stuff. It's neat to be doing new things in .NET and it seems like it will be forever before we get bits we can use in production!

     

    Read more...

  • Source Safe by HTTP: It's about time!

    I just read this about Visual SourceSafe 2005:


    Remote Web Access over HTTP. Use Visual Studio to connect to Visual SourceSafe databases from anywhere in the world where HTTP or HTTPS Web access is available. (Requires Visual Studio 2005, IIS, and ASP .NET).

    It's about time!

     

    Read more...

  • Self-employment: Week 1

    Since quitting my job last week, I can't tell you how liberated I feel. Aside from some final pay issues to deal with, I really feel like I'm living on my own terms.

    I didn't do much of anything Monday except take a walk in the morning with Stephanie and do some grocery shopping. Other than that, I took it easy all day since I've not really had time to chill since January. Today I got back to writing the book, a process now made more official since the publisher sent me the right Word templates and a time line. Oh, and I have an ISBN number! Bummer that I won't see it in print until next spring, but hey... I'm writing a book and that's pretty cool.

    I'm glad to see that there's another VS 2005 build going out this week, although it seems like it isn't that necessary with the beta allegedly in the works for next month. The more I play, the more I love it. I'm torn between starting to build stuff and understanding the new features well enough to write about them. I'd like to do both at the same time, but if I do that, my deadline will be upon me and I'll have no book!

    With the AdTech conference going on, we keep hearing about the rebound in Web advertising, which is welcome news because that's what's paying my mortgage right now. CoasterBuzz and PointBuzz are both getting nice traffic. Yeah, pop-ups are annoying, but my audience doesn't seem that annoyed because they keep coming back (that and on CB you can buy a membership that kills all ads). I look forward to the inevitable shift to traditional ad formats when IE ships with a built-in pop-up blocker.

    uber:ASP.Net is suffering from neglect. I need to get back in gear with that now that I have time. I'd also like to build some kind of volleyball site for kids, parents and coaches in high school or Junior Olympic ball. That one won't ever make much money, but it's something I'd enjoy doing.

    That's what I'm up to. More of the things I like to do, and none of that dread that comes from getting up to go to a place I don't want to go.

     

    Read more...

  • Today is the day...

    Today is the day that I voluntarily quit my day job.

    Today is the day that I accept the financial risks of working for myself and take a real stab at making it work.

    Today is the day I can begin concentrating on my ASP.NET book so that it's finished on time and doesn't suck.

    Today is the day that a job and The Man no longer place constraints on me that keep me from doing what I really want to do in terms of professional development, personal time, diet and exercise.

    Today is the day that even my “hobby” sites can be something that is better than the rest because I can devote proper time to it.

    Today is the day where I don't have to dread Monday, because Monday I'll be working on my own terms.

    Today is a glorious day.

     

    Read more...

  • Integrating Membership and Profile with POP Forums

    Now that I'm finally getting more comfortable with VS 2005, I think I'm going to start writing some code for POP Forums v8. I'm in a funny place though regarding the membership system I already have.

    I have a People class that is more or less a container for rows in the forum's member table. It has properties that match like Name, Email, etc. My Global class does the plumbing you've seen elsewhere to associate roles with the logged-in user by creating a new Principal object and blasting it to the user.

    Now, in ASP.NET v2, we have the Membership and Profile API's that make dealing with this kind of data super cool. Since it has always been my goal for the forums to act as the base for all kinds of user stuff, in the forum and elsewhere in the user's app, I'd like to continue that, even if Microsoft will now provide it.

    So the question is, do I leave this stuff “as is,” or do I write my own providers so the developer can use Membership and Profile as if it were their own? Leaving things “as is” means the dev can add whatever they want without impacting the forum, but then they're using two separate API's. On the other hand, using an alternate provider that hooks into the forum framework then makes it a little harder to alter it.

    What would you do?

     

    Read more...

  • Writing a book is a bitch...

    OK, actually I already knew that. No, actually I'm not finding it that hard getting pen to paper. It's the time... there isn't enough time.

    I decided I need to quit my contract job at a Major Auto Insurance Company(TM). I hate to do it as things keep ramping up, but this book is too important to me. I need the next three months off to concentrate and make it a tome that will sell 10,000+ copies. To do that it needs love and attention, as does ASP.NET v2 because it'd be suicide to write a book that doesn't cover it.

    It's a minor financial risk I suppose (my wife is in grad school, so I'm the “breadwinner”), but I also hope that the consulting firms don't all poo-poo on me in the future for ditching the job. Most seem to understand that you have to do what you gotta. The flip side is that being an author could potentially blow open the doors to self-employment if I do it right. Actually... if my content projects continue to take advantage of the recovering ad market, I might not need to work for The Man at all.

    Really exciting times for me. I'm energized to be doing this, especially as we get into summer. Sun, roller coasters, some serious parties... life is looking pretty good.

     

    Read more...

  • Launched a new site last night!

    Finally, Walt and I launched PointBuzz last night. The premise is simple: I don't have the desire to maintain a ton of content, and would rather write code, while Walt likes to produce content. So we combined Virtual Midway and Guide to The Point into PointBuzz. It is, without question, the greatest unofficial Cedar Point site ever created.

    I'm excited about it. I can't take a ton of credit for it because Walt's the insane one to cover everything at Cedar Point. What I find neat is that the underlying code is serving data so damn fast. Really top notch! The same code base has been serving CoasterBuzz for awhile, so it's what I expected. I guess the excitement just comes from letting GTTP go for the last two or three years.

    For you geeks, obviously POP Forums is running the forum and underlying permissions system. CliqueSite® Content is my CMS that has been evolving in .NET since 2001 or so. It's far from perfect, but it performs really well and I'm happy with it. I always wanted to sell the system, but I've not been able to make it easy enough to use so that John Q. Codemonkey could get the bits and make it go. Hell, half the time I'm not sure when I put up a new site with it!

    At least I've got the registered trademark. :)

     

    Read more...

  • Open source: Far from a reason not to use .NET

    I love the little holy wars that go on in various forums about why .NET sucks or whatever. Those who state this are generally folks that have never used the platform. One of their key “arguments” is the lack of open source community around it.

    I'll admit I've never bought into the open source ideology as something that will save the world, but I've been really impressed with all of the open source tools in the .NET world. I personally have used NUnit, Nant, NDoc and FIT, among others. Heck, I give away POP Forums too.

    I've grown pretty fond of NUnit in particular, since outside of my “day job” I've been really breaking stuff down to little pieces and actually practicing test-driven development. I feel like such a corporate tool, but it's such a great way to get stuff done and make it quality.

     

    Read more...

  • "I'm blogging this." Huh?

    So I wore my new “I'm blogging this” shirt from ThinkGeek.com to my J.O. volleyball tournament Saturday. None of my girls knew what it meant, and their parents were just as clueless. Only one of the officials (a young, not geeky cutie) actually got it.

    I guess even if Business 2.0 thinks so, blogging apparently isn't the critical mass we think it is outside of our own circles.

    Read more...

  • The demise of TechTV. Good thing they didn't get Disney.

    The mental giants at Comcast bought TechTV, now they're going to close it. How f'ing stupid is that?

    I don't pretend to know the financials of the network, but I can't imagine it was that bad off. Even if it was, I'd love to here the logic behind buying it, closing it, and trying to divert the audience to a gaming network. That's the single most stupid thing I've ever heard of.

    TechTV was finally establishing itself as a brand. It's filled with a lot of young, smart and interesting personalities that people enjoy watching. It's also the TV home to the tech media's good guy, the face of TechTV, Leo Laporte. Now we'll have a gaming channel at 273? Who the hell wants to watch that.

    Congratulations to Paul Allen for building something up, cashing in (as if he needed the money) and watching it get torn down. If this is the kind of brilliance that Comcast has, thank God they won't get Disney.

    It's a damn shame. I'm going to miss Leo, Patrick, Jessica, Sarah, Kevin, Yoshi, Foo, Cat, Morgan, and yes, even Adam. What a damn f'ing shame.

    Read more...

  • Is it 2005 yet?

    Just installed the March build of Visual Studio 2005. Even better than the last build in terms of just working.

    Is it 2005 yet?

    Read more...

  • HR and off-shoring

    Wally McClure had an interesting response to Intel's CEO regarding some comments he made about off-shoring.

    To a certain degree, I agree that HR is often a big problem in big companies. They create barriers to getting the right people, for reasons I can't explain. On my current gig, we lost out on the ultimate .NET guru because HR kept screwing around, not making phone calls, delaying the background check, etc., so he went elsewhere.

    I agree that if a company wants to off-shore, that's what they should do. It's a global economy, and in some cases our skills are becoming commodities. It just depends on the skills. While it is happening quickly, it does happen in every maturing industry.

    I do disagree with Wally about immigrants coming for “our” jobs, with companies overlooking the home bodies. I don't think we can universally apply the idea that there are qualified Americans available and plentiful for all skills, in all parts of the country. I'm the only “white guy” in a team of seven .NET developers. Here in Cleveland, I get recruiter calls weekly because they can't find qualified people. Trust me, we're even willing to work with “hello world” code monkeys and train them. They just aren't here.

    I think there's a lot of hype about off-shoring, and it's not as big of a deal as it's made out to be. Easy for me to say because I have a job, but I've been on the street enough in the last four years to understand the market. It's self-adjusting, and will continue to do so for the next few years. New stories in every magazine every month (and now News.com) aren't going to change that. Legislators shouldn't change it.

    Read more...

  • The documentation is the code. Duh!

    Let me start by saying that I tend to agree with most of the common tenants of extreme/agile programming, as well as test-driven development.

    However, this stuff about “the code is the documentation” has some serious drawbacks. For example, my fellow code monkeys and I are writing some stuff against a framework that has some 400 classes. When we run our build scripts and get errors outside of our own code, we have absolutely no idea what we're looking at when we look at those existing classes, in part because we aren't entirely sure what the code is supposed to do. Looking at the unit tests are almost less helpful.

    The notion that nearly a hundred developers (when this project hits full speed) are supposed to know and figure out what these 400 classes do on their own isn't realistic or efficient. Furthermore, with all of this technology, we sure as hell shouldn't need to rely on person-to-person storytelling techniques that tribal cultures were using hundreds of years ago. Come on, you've played the “telephone” game, right?

    I think even in an agile environment, you still need some basic blueprints to get around, or your new hires are going to run for the exits.

     

    Read more...