Jeff and .NET

The .NET musings of Jeff Putz

Sponsors

News

My Sites

Archives

October 2006 - Posts

37signals on Apple

I know that this will annoy some people (right, Rob?), but here's a video of the 37signals guys kissing Apple's ass:

http://www.apple.com/education/whymac/compsci/video.html

Forget about the content... look at the office. It's reflective of their Web apps. It's sparse, functional and simple.

I'll admit that I'm sick of hearing about these guys, but why am I so drawn to what they have to say? Why did I buy the Getting Real e-book? Sometimes I'm annoyed at myself for being into their world.

I think to answer this obsession question, we have to look at the two sides to the life of a developer. On the user side, simple is better in most cases. Who uses more than a fraction of the features in Word, right? I just want to write a damn letter! So the fact that Backpack or Ta-DaList does something fundamental in a fundamental way allows me to "just do it." You can't beat that appeal.

From the programmer view, they do what many of us only dream about. They build stuff quickly, it works, it delivers, it generates income for a company that consists of less than a dozen people and we're jealous. How hilarious is it that we all want to build The Next Big Thing and have it used by giant companies (or have your company bought by said companies), and these guys build something simple for the millions of small customers that don't buy products from IBM or Oracle.

I hate those guys because I'm not them! 

Ancient bug not fixed in Firefox 2.0
Wow, this is annoying. If you've used Firefox, you probably know that from time to time you'll be typing in a regular text box, and typing an apostrophe will bring up the search box. I can't figure out how to make it stop other than click around on junk until it goes away. I can't believe that wasn't fixed in the new version.
Modal-style pops in Javascript and CSS

I haven't seen a simple example on how to do this, so I thought I'd post one here. I've seen the components in various places (how to center stuff, move with scrolling, etc.), but I wanted to tie it all in to one place.

Start with the actual HTML:

<div id="modalPage">
    <div class="modalBackground">
    </div>
    <div class="modalContainer">
        <div class="modal">
            <div class="modalTop"><a href="BLOCKED SCRIPThideModal('modalPage')">[X]</a></div>
            <div class="modalBody">
                <p>total solid</p>
            </div>
        </div>
    </div>
</div>

Forget the script call there for a minute. The top level div "modalPage" acts as a big container to hide everything. The next one, "modalBackground" is the div we'll use to cover the entire page, somewhat transparent, so you can't click on stuff. The "modalContainer" div is the actual meat of stuff we want to show, which happens to contain a little window-esque header and a body element.

Next up is the CSS. There's a lot of it, but it's not very complicated.

<style type="text/css">
body
{
    margin: 0px;
}
#modalPage
{
    display: none;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0px; left: 0px;
}
.modalBackground
{
    filter: Alpha(Opacity=40); -moz-opacity:0.4; opacity: 0.4;
    width: 100%; height: 100%; background-color: #999999;
    position: absolute;
    z-index: 500;
    top: 0px; left: 0px;
}
.modalContainer
{
    position: absolute;
    width: 300px;
    left: 50%;
    top: 50%;
    z-index: 750;
}
.modal
{
    background-color: white;
    border: solid 4px black; position: relative;
    top: -150px;
    left: -150px;
    z-index: 1000;
    width: 300px;
    height: 300px;
    padding: 0px;
}
.modalTop
{
    width: 292px;
    background-color: #000099;
    padding: 4px;
    color: #ffffff;
    text-align: right;
}
.modalTop a, .modalTop a:visited
{
    color: #ffffff;
}
.modalBody
{
    padding: 10px;
}
</style>

  • "modalPage" is set to cover the entire page, and it's set as "display: none" so that initially you can't see it.
  • "modalBackground" sets up a gray screen over the existing page. Note the hacks to get opacity to work in all of the browsers (works in Safari too). The z-index is one of several we'll set so that it's layered correctly.
  • "modalContainer" is next and is set up further in the z-index, with its top left corner positioned at the center of the page.
  • "modal" is set in the container, and will be the same size, so to make it appear in the right place, we need to set its dimensions, but make its position relative to the container. Since the container's top-left is dead center of the page, we want to go half the width and height from that spot, in a negative direction. This z-index is highest because it's on top.
  • The other elements are to setup the content in the "window" that will sit in the middle of the page.

Finally, you'll need just a little Javascript to make it work.

<script language="javascript" type="text/javascript">
function revealModal(divID)
{
    window.onscroll = function () { document.getElementById(divID).style.top = document.body.scrollTop; };
    document.getElementById(divID).style.display = "block";
    document.getElementById(divID).style.top = document.body.scrollTop;
}

function hideModal(divID)
{
    document.getElementById(divID).style.display = "none";
}
</script>

revealModal(divID) takes the name of the div and attaches a handler to the window's scroll event. It moves the div to the top of where ever page is, so that it moves with the page and keeps everything covered. The next line changes the display to "block" so you can see it. The third sets the div's initial position. hideModal(divID), appearing in the little link we put in there, will naturally hide it.

To make it go, just attach this onclick to a button or link or something:

<input id="Button1" type="button" value="Click here to be naughty" onclick="revealModal('modalPage')" />

That's it! 

Six reasons not to buy Vista

Love the junk in the EULA this time, as translated by Wendy Seltzer.

I don't get Microsoft. They hit home runs in some groups (Xbox 360, parts of Live, ASP.NET mostly), and then other parts of the company do things like this.

Wendy says people can't vote with their wallets, but I heard about this company that has doubled their laptop market share in the last year that would probably beg to differ. 

Flexibility was too much of a constraint

In my last post, I talked a bit about how trying to use the Membership API, with my own provider, was hurting more than it was helping in my forthcoming rewrite of POP Forums.

Last night, I wiped out all of the Membership and Role stuff and rolled my own. In about three hours, it was all gone, I eliminated hundreds of lines of code (and many tests), removed the data constraints I was talking about and generally made myself a happy boy. I feel liberated.

My first design goal in this project has always been to efficiently facilitate community discussion. Somewhere along the line, I got lost and distracted worrying too much about what some programmer down the road might want to do with the code. That was a mistake. And I should know better too, since most forums out there aren't integrated with other site functions. Those that are have people clever enough to deal with the situation.

The lesson learned here is that trying so hard to offer the flexibility of shoehorning my application into a familiar API caused more constraints than provided flexibility. I was putting up roadblocks trying to solve problems that didn't need to exist in the first place.

Simplicity really is better. It frees you to build stuff faster. It was a neat idea, but seeing as how several of my own forthcoming projects rely on a rewritten forum app,  this was a path not worth pursuing. I need to ship something.

For those that need Membership in a forum, I'm pretty sure Community Server uses it, so there is an option.

Posted: Oct 19 2006, 09:34 AM by Jeff | with no comments
Filed under: ,
I think the Membership dream is really just a fantasy

Way back in early 2004, when I first got my hands on ASP.NET v2 and the Membership API, I though, wow, this is a seriously cool. What a dream come true to be able to plug this into any site and write your own provider. After all, isn't a single familiar and predictable interface to user data a good idea?

After much thought about the subject, I have to say that, no, it's not as great as I thought. Don't get me wrong, it certainly has its benefits for simple projects, but all of that flexibility ultimately constrains you. Oh the irony.

I started this year thinking, yep, this is the year I'm going to rewrite POP Forums, and dammit, I'm going to release it by the end of the year. The truth is that I have made some fabulous progress, and I'm starting to feel really good about the shape it's in. That said, the majority of my issues with the rewrite have had to do with user management, and trying to shoehorn it in to Membership.

I already ditched Profile, because I just didn't see any value in it anymore. It was an exercise that reminded me a lot of my first experiences with a DataGrid. Fabulous and flexible, but nearly worthless if you want to do any kind of clever UI or make something perform at a level you could respect. In the end it was almost always easier, and significantly faster, to roll your own solution with a good old fashioned Repeater, or your own templated, data-bound control.

The dream of Membership starts to become a nightmare as soon as you want to associate that data with other things. The system forces you to work in its little universe so that it can work the same with any provider. That creates a boundary from other data, and the simple SQL join becomes impossible because it would break compatibility with other providers.

So I think the time has come that I'm going to ditch the Membership component of the forum app. I have enough code coverage in unit tests that I think I can get away with the changes pretty quickly. I'm done trying to be clever and use ASP.NET to its fullest just for the sake of doing so. Maybe I've been drinking the 37signals Kool-Aid, but more simple is better.

Posted: Oct 18 2006, 03:27 PM by Jeff | with 14 comment(s)
Filed under: ,
Who doesn't love a good "versus" debate?

OK, actually the holy wars over platforms and languages isn't all that entertaining. But still, for all the hype surrounding Ruby on Rails, I had to check it out to see if I'm really missing something.

Looking at examples, I don't think I am. It's an interesting approach to be sure, but I'm not seeing anything that jumps out at me as being more super sweet than anything I can do with ASP.NET today. In fact, I was thinking about how I should build the same app using VWD and SQL Express that they use in this tutorial. I bet I could do it faster.

But who has that kind of free time? :) 

One month in with Google Apps For Your Domain

(also posted on NerdLifestyle

About a month ago, I got an invite to try out Google Apps For Your Domain, a system that allows you to do semi-private label Gmail, Calendar, Chat and Web page stuff using your domain name.

Honestly, I didn't even mess around with the Web page tool, and I haven't enabled it. I can't tell you if it's any good. I don't really bother with the chat service either. However, my main focus was to get e-mail service that I didn't have to host, and to that end, Google Apps is like a dream come true.

The reason for its positive impact should be fairly obvious: Gmail rules because you search for e-mail and you find it. Doesn't that sound radically obvious? But seriously, when have you ever had an e-mail program that could do that, and do it from anywhere? You never had such a thing, and that's what makes it so cool.

If you've hosted your own Web server, you've probably either used your host's e-mail system, or ran your own. I was using SmarterMail, and I give it very high marks for being an excellent product. The truth is, the only reason I no longer wanted to use it was that I didn't want a process handling a couple thousand e-mail messages every day (mostly spam) on the same box as my Web server, and I didn't want to keep everything there on the server either for searching purposes (disk space issues). Gmail solves these problems for me.

Now when I need to find or keep some kind of information, I just tell people to e-mail it to me. So when I need to know "Catherine's address," I type it in and find it. When I need the link to my vacation photos, I type in "Mackinac Island photos."

What seals the deal is that Gmail does enable POP access, so you can still "own" your e-mail and download it. It even keeps the messages you send from your e-mail client on the server in your "sent" folder. That's pretty smooth. The only weirdness is that it lumps together all of your inbound and outbound mail together when you get it via POP, so you need to set a filter on your program that moves it to the client's "sent" box and marks it read, simply by applying the rule to e-mail from whatever your address is. Works great in Eudora and OS X Mail.

Side note: I recently migrated all of my Windows-based Eudora e-mail, lots of it dating back to 1997, to OS X Mail using this awesome little mailbox cleaner app.

I'm actually using the Calender app now too. I was skeptical that I would have much use for it, but I find myself using it pretty frequently to keep track of my junk. It's only a link away from my mail, so why not?

So I'm finally in a world where I can access and search my e-mail anywhere, and own it on my local computer, and not have to host it myself. Big thumbs up for Google Apps.

Thoughts about RSS's inadequacy

In the interest of not duplicating the same text in a hundred places, I'll just link you to one of my many other blogs for my thoughts on the subject...

http://www.nerdlifestyle.com/News/34.aspx

MVP not

I'm still not an MVP. I didn't expect to be.

It just seems like the thing to blog about, I guess. :) 

Posted: Oct 03 2006, 03:27 PM by Jeff | with 3 comment(s)
Filed under:
More Posts Next page »