
Earlier in the year, I found myself in the middle of a great tragedy: the harddrive in my aging 12” powerbook decided it was time to say farewell. Now, I’m not certain, but I’m going to assume the main reason it left us, was to be with the superdrive which had also passed away about 8 months prior.
Clearly the only way to survive this whole affair was to sever all ties to the powerbook, and rebound with a new laptop. Clearly.
Since my primary development environment is VisualStudio.NET, I’d pretty much decided that my next computer would probably be a windows… Unfortunately, once I started shopping around, none of them met my small list of requirements:
It seems that if you’re looking for a laptop from HP/Dell/IBM, you can’t get these things. Hardly any PC laptops have DVI out, and the ones that do tend to be those 17” beasts.
And then there’s the new Intel-based Macbooks. Core2Duo, DVI out, 13” widescreen… but could I really run VisualStudio.NET in parallels? I figured “what the hell”, and plopped down the money to see if it would work. One great thing about Apple machines is their high resale value. I figured, if I hated it, I could craigslist the damned thing, and get back most of the money.
So I ordered one of sexy black ones, with 2GB of RAM and a 160GB disk. It’s been a month now, and it’s going “OK”. The macbook is a lovely machine, but everything you read about fingerprints on the black are no exaggeration—the goddamned thing is a grease magnet. I’ve been using a microfiber polishing cloth to clean it, and I’m to the point of having to do it daily (damned OCD).

VisualStudio in parallels is also “just OK”. I’ve run into a number of weird issues with the Parallels Windows XP installer, where it appears to set permissions on the disk weirdly, and VS just can’t seem to cope with it.
I've also had a number of issues regarding disk corruption with the parallels disk image (not bootcamp)… maybe this is related to the above problem.
Parallels doesn’t like to sleep. If i just close the macbook while parallels is running, there's a 75% chance that the mac book won't make it into sleep mode, and also won't seem to wake back up. If I suspend Parallels before sleeping, it seems like there’s about a 40% chance that Windows will bluescreen on resume. I’ve finally learned to just shut Windows down all the time now, which is kind of a bummer.
Parallels is also just not as fast as I want it to be. When checking out the main Presto solution, there’s a number of web applications, web services, an instance of SQL Server, some device simulators, etc. that all need to be running. It’s do-able, but it feels like it’s running at the speed of my old 1.4Ghz windows desktop. Not awful, but after having everything in the Mac OS X go so fast, it’s a bit of a let down.
I’m finding that my natural work habits now are to run only VS in parallels, and run everything else (Mail, IM, browsers) in the mac OS… which I reckon is fine, though it's not quite what I expected.
Well… So, it looks like I bought into the hype. I’ve now completed rewriting this weblog from C#/ASPNET to Ruby on Rails.
It’s kinda funny, I guess, that I spend time writing, (and rewriting, and rewriting, and rewriting) this weblog when I never actually write in the damn thing. So it goes.
I reckon it’s become an interesting project for me these days, and a good practical exercise when working with a new language or a new environment. And, since I’ve written the damn thing at least half a dozen times now, I’ve learned a lot about what it means to build an effective administration UI, what it means to keep the data in the DB portable (because I assure you that in a couple of months I’ll be looking at rewriting this in smalltalk, python, or lisp), and how helpful it is to fully separate your logic from your presentation.
Anyway… back to the subject at hand: some of my perspective as a C#/ASPNET developer on Ruby on Rails, and how porting this blog to ROR went. There’s a number of things about ROR that I really like, so let’s let the glass be half-full, and start there.
Now, after all that praise, let’s talk about what doesn’t work well from my perspective…
All in all, it's been an interesting experiment. I’m not sure I’d ever choose ROR for a “real” development project (I still have lots of questions about fcgi, and some of the more “backendy” things that rails does) but for building internal tools, or (like this case) a simple blog, it seems pretty slick.
I imagine I’ll tinker on modifying this weblog app a bit more, and then try and rebuild one other side projects in rails—an online photo album
So here’s an interesting thing I thought I should mention. In working on some of the code for this blog engine, I’ve been using the ASP.NET OutputCache directive on some of the .aspx pages to help speed things up. This way, in the event of a slashdotting, or some other sudden increase in traffic, you’re not rebuilding the page or hitting the DB for each request. Nice, huh?
So that’s all fine and good, but what about when you want to blow the page out of the cache? Case in point, in adding comments to the blog engine, the user will expect to see the comment posted immediately, not in 3 minutes.
Sure, I could go in and just make sections of the page cacheable, but… eh… that’s a lot of work. I want to be lazy and just blow the cache away. Sounds simple enough, right? But, for the life of me, I just could not get it to work.
After doing some googleing on the topic, playing around with both the Cache.Remove() as well as the HttpResponse.RemoveOutputCacheItem() methods just seemed to not work.
After several hours of pulling my hair out, I realized the mistake was in the OutputCache directive on the page. I had been using:
<%@ OutputCache Duration="60" VaryByParam="*"%>
What I was missing, was adding the Location parameter to the statement. By changing it to
<%@ OutputCache Duration="60" VaryByParam ="*" Location="Server" %>
the HttpResponse.RemoveOutputCacheItem() method would now work. Woo-hoo!
The other trick I found was when calling the HttpResponse.RemoveOutputCacheItem() method, for the path parameter should be the full virtual path to the page. So, for some site: http://foo.com/somedir/somepage.aspx the path param would be "/somedir/somepage.aspx". Also, it shoud not include any QueryString information.