Jeff and .NET

The .NET musings of Jeff Putz

Sponsors

News

My Sites

Archives

September 2008 - Posts

Performant is still not an adjective

From MSDN...

 "Deep Zoom enables the ability to zoom almost arbitrarily large images in Silverlight in a performant manner."

This is still the most ridiculously over-used word in tech circles, because it's made up. It can, technically, be used as a noun, but "performer" is more common. Seriously, with so many English majors writing code these days, how does this happen?

 I guess I find its use agitant. ;)

Making a business case for Silverlight

I've been thinking a lot about Silverlight lately, for a lot of reasons. What really put me to task was my boss asking me what its impact is and if he should care about it. That certainly changed my approach and purpose for thinking about it.

As one typically does, I started by Googling around for opinions and analyst comments. There really aren't a lot of great objective opinions out there. There's a whole lot of "Flash roX0rz, Silverlight and M$ suX0rz" nonsense, written largely by Flash developers. That's not helpful, but it got me thinking a lot about Flash. I've spent a lot of time with Flash lately, experimenting with some stuff and getting to know it a little better. As an animation tool, it has a certain level of familiarity for me because I was using Adobe AfterEffects way back in 1999 to animate video. I remember the first time I saw the Flash tools, thinking that Macromedia totally ripped off Adobe (ironic since they've since bought them). What has been less obvious in my experimentation is how they arrived at the programming model. That's where I get hung up the most.

Writing code in the context of a temporal structure (the time line) is weird and unnatural. It feels like it was just glued into it because they couldn't think of anything better. It becomes even more frustrating because the predictive typing (can't call it Intellisense, really) isn't very good, and debugging isn't much fun either. Oh, and ActionScript is essentially JavaScript, which I'm sure causes pain for a lot of people. Then there's the issue that Adobe hasn't done a good job of selling Flex as a "real" IDE, and honestly I've never even seen it. Despite all of this, it's easy to appreciate the power that Flash has. For something that started as an animation tool and grew into UI/software platform, it's not terrible.

But I think that's the point at which I started to wonder if it was entirely appropriate to consider Flash and Silverlight competitors. Yes, they're both displayed via browser plug-ins, but Silverlight is an opposite in many ways to Flash. It's a UI/software platform that happens to do animation. When you define it this way, you describe it as a solution to different problems. At that point it doesn't seem like a versus debate anymore. And if you cut out the versus part, and therefore the platform religion, I think you get a clearer picture to consider.

That picture has a lot of clear pro's and con's. On the upside:

  • You can build rich UI with minimal pain to solve complex UI problems. The easy control nesting and rendering tweaks make this so silly easy.
  • Your .NET developers can start using it right now. They mostly get the programming paradigm today, with some exceptions that books and tutorials will address.
  • You can code in Visual Studio, which by most accounts is the world's best IDE. Not saying everyone agrees, but my cross-platform friends feel strongly that it's true.
  • The player is a pretty easy download.
  • Even though it's still beta, the NBC Olympics site was a pretty good case study in how well it works.
  • The code isn't a time line thing, so it's not so weird to traditional OO code monkeys.

That said, there are also some valid concerns:

  • Penetration is a mystery. Sure the Olympics helped, and we can only assume that once it ships it'll get pushed out by way of Windows Update, but having to download a plugin sucks. If this site is accurate, that's not a bad start for beta software.
  • Adobe AIR/Flex folks are even more nuts than people making PC/MAC flamewars. Like it or not, that influences people.
  • The primary design tool is Windows-only, and I'm not sure if designers would even like the tool. If Expression Blend is built on WPF, one can only wonder that if Silverlight, a subset of WPF, can run on a Mac, how hard would it be to get ALL off WPF running on a Mac? Yeah, I'm talking .NET on a Mac.
  • It hasn't shipped yet. (Well, v1 did ages ago, but I think we can agree the "real" release is v2.)

From the developer angle, it's hard to argue against it. From the designer angle, it's a toss up leaning slightly against it for Mac shops (especially those who haven't upgraded to Intel machines). From a business angle, you've got the idea that you can leverage existing talent to build stuff and pit it against end user adoption. At the end of the day, it seems that the best you can do is wait and see for some point after v2 goes RTM.

Of course, if you're a developer, you probably already can think of a great many things to do with it today, and I think it's important to get out there and try that stuff. Deep zoom is a killer feature, and we could only make it more interesting by finding more novel ways to use it. But there I go making it religious again!

Why I hate Windows today

I know there are plenty of excuses that people come up with for Windows, but why does it suck so much? It always seems to get in the way of doing anything.

Today I did a fresh VM install of XP so I can use it on the new job (by the way, unattended install using Parallels for Mac is breathtakingly fast when installing against the ISO). Next task, install Visual Studio 2008. Next task, install SP1. Fail. Fail. Fail. And it's the worst kind of failure too, where it just sits there and doesn't do anything to indicate it's failing. It just says, "Download starting." Only it's not. You can push cancel and look at the log, which is useless to me because I didn't write the thing.

Yesterday my fiance is offloading some photos from the camera to her Vista laptop. It renames all of the files when it copies them, and it doesn't seem to ask you if that's OK. Then if you want to copy a bunch of photos from one folder to another, and there are duplicate names (and there will be since it renumbered them), this huge, confusing dialog opens with a bunch of wordy options on what to do. How is it that Microsoft can spend oodles of cash to find out where people get stuck in Halo but they can't find their way through simple file operations?

I was playing around even with solitaire on Vista, and when you try to do something against the rules it says something like "invalid operation." Are you kidding me?

I hate Windows. I seriously do. I need it to do one thing, develop software, and once everything works it generally seems fine. But why is getting there such a pain in the ass? I've come to realize that it isn't that I'm a big OS X or Mac fanboy, it's that I seldom realize it's there. That's what an operating system should be.

Launching QuickTime movies in the player using ASP.NET AJAX framework

As my dearest friends know, I once existed as a broadcast monkey prior to my life as a code monkey. It gives me great joy that it's finally at least somewhat practical to deliver short-form high definition video via the Internet, even if it is only a couple of minutes at a time. That said, the best bang for the buck in terms of compression is easily H.264, encoded by way of QuickTime. Flash can actually play these files, but it's not practical to do it in-browser when you're talking about something that's 1280x720 or 1920x1080. That's probably why Apple spawns the movies in the player itself. It's a pretty seamless experience, and since "everyone" has iTunes, "everyone" has QuickTime. (If you want to get into some stupid religious debate about this, please, do it elsewhere.)

What's not nearly as obvious is how Apple was doing it. It took awhile to find the right article on the subject, and even then, it didn't quite align with what the movie trailer site was doing. QT movies can begin with a "poster movie," and that can be anything QT can "play," including a still image. For reasons still not clear to me, you need one of these even if you're not going to show any of the markup as rendered stuff in the browser.

The design goal was simple: Make it so that clicking on something launches QuickTime Player and plays a movie. What follows is my first attempt. Keep in mind that it's not particularly pretty, and it needs some refactoring. It's obviously not as efficient as it could be. Comments follow...

/// <reference name="MicrosoftAjax.debug.js" />

Type.registerNamespace("Video");

Video.QuickTimePackager = function() {
        Video.QuickTimePackager.initializeBase(this);
        this._Id = null;
        this._TargetElement = null;
        this._FileUrl = null;
        this._PosterImage = null;
        this._holder = null;
}

Video.QuickTimePackager.prototype = {
    initialize: function() {
        Video.QuickTimePackager.callBaseMethod(this, "initialize");
        $addHandlers(this.get_TargetElement(), { "click":this._make }, this);
        this._holder = document.createElement("div");
        this._holder.setAttribute("id", this.get_Id());
        document.body.appendChild(this._holder);
    },
   
    _make : function(e) {
        var o = document.createElement("object");
        o.setAttribute("codebase", "http://www.apple.com/qtactivex/qtplugin.cab#version=7,3,0,0");
        o.setAttribute("height", "1");
        o.setAttribute("width", "1");
        o.setAttribute("id", "outobject");
        this._createParam(o, "src", this.get_PosterImage());
        var i = document.createElement("object");
        i.setAttribute("data", this.get_PosterImage());
        i.setAttribute("type", "video/quicktime");
        i.setAttribute("height", "1");
        i.setAttribute("width", "1");
        i.setAttribute("id", "inobject");
        this._createParam(i, "href", this.get_FileUrl());
        this._createParam(i, "target", "QuickTimePlayer");
        this._createParam(i, "controller", "false");
        this._createParam(i, "autohref", "true");
        this._createParam(o, "href", this.get_FileUrl());
        this._createParam(o, "target", "QuickTimePlayer");
        this._createParam(o, "controller", "false");
        this._createParam(o, "autohref", "true");
        o.setAttribute("classid", "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B");
        this._holder.appendChild(o);
        if (navigator.userAgent.indexOf("MSIE") == -1 || navigator.userAgent.indexOf("Opera") != -1)
            o.appendChild(i);
    },
   
    _createParam : function(parent, name, value) {
        var param = document.createElement("param");
        param.setAttribute("name", name);
        param.setAttribute("value", value);
        parent.appendChild(param);
    },

    dispose : function() {
        Video.QuickTimePackager.callBaseMethod(this, "dispose");
    },
   
    get_Id : function() {
        return this._Id;
    },
    set_Id : function(value) {
        this._Id = value;
    },
   
    get_TargetElement : function() {
        return this._TargetElement;
    },
    set_TargetElement : function(value) {
        this._TargetElement = value;
    },
   
    get_FileUrl : function() {
        return this._FileUrl;
    },
    set_FileUrl : function(value) {
        this._FileUrl = value;
    },
   
    get_PosterImage : function() {
        return this._PosterImage;
    },
    set_PosterImage : function(value) {
        this._PosterImage = value;
    }
}

Video.QuickTimePackager.registerClass("Video.QuickTimePackager", Sys.Component);

And then to wire it up to whatever object you want to be clickable:

Sys.Application.add_init(function() {
    $create(Video.QuickTimePackager, { "Id":"hd", "TargetElement":$get("fauxButton"), "FileUrl":"http://www.popw.com/video/kittehfight.mov", "PosterImage":"/images/blank.png" }, null, null, null);
});

The first piece of code is a Sys.Component, which you can drop in an external file and/or have it loaded by ScriptManager. I dumped it in a library as an embedded resource, but feel free to do it your way. The fragment at the end should live in script tags at the bottom of your page. Id is your name for the movie's container, where the object tags will be rendered, TargetElement is the actual element (not its ID) that you want to make clickable, FileUrl is the location of the movie and PosterImage is the poster movie you'll never see.

The init function simply adds a click handler to the DOM element you passed in with $create, and creates an empty div as the placeholder for the object tags. The _make method makes the object tags that force the sudden creation of a movie, specifiying the player as the target. This combination of parameters overall are necessary to get the movie to launch. Part of those requirements are the poster movie, which no one will ever see, but has to be there. I just pass in a blank 1x1 graphic.

The object within an object is a little strange, but this is how Apple does it on the trailer site as well. The outer object is what IE needs to work, while the inner one is what every other browser expects (including Opera, which impersonates IE sometimes, but we know better). Also of note is that, according to comments in the script library that Apple uses, the classid attribute has to be added last, or IE won't see the rest of the parameters. That seemed to be true as I experimented. The rendered stuff will launch the player with the movie, and off you go, spreading your glorious HD porn, er, nature video, across the Series of Tubes.

Again, it needs a little clean up, but it's a nice reusable piece for you to plant your HD, spawned QT movies in your ASP.NET page.

Three-hour marathon interview
I had three hours of phone interviews today with people from a company I'm very much hoping to work for. That was crazy. It's not any less exhausting doing it by phone. You start to get tired of talking about yourself.

But I think it went pretty well. The last time I had that kind of marathon was in Redmond. This was a lot different, because these guys seemed genuinely interested in what I was about and what I had done. That's a far cry from Microsoft, who seemed more interested in trying to stump me or give me puzzles to solve. I'm more and more convinced that's mostly useless in assessing the ability of your subject. I felt like it was OK to simply say, "I don't know," when there was something I didn't know.

From what I can gather, said company is doing some really cool things in the near future, so I'm crossing my fingers. This is the first time in a long time that I've felt pretty good about what a company does, and what it stands for. I'm crossing my fingers.
Science project no more: playing with client frameworks

Awhile back I mentioned how sometimes I get sucked into these science projects, and I end up not doing more productive things. That particular science project was me trying to build a drag-and-drop list. Sounds silly, right? Because there are existing solutions. But I had good intentions.

First off, the ReorderList control in the ASP.NET AJAX toolkit blows. It has all kinds of problems selecting stuff as you drag, the rendering forces you in to an unordered list, and it doesn't have the nice clean movement you see in other similar pieces around the Internet. The underlying code is hopelessly complex too, and I'm not sure why it has to be that way. More on that question in a moment.

My second motivation was just that, dammit, I want to see if I can do it. I remember the first time I saw the getBounds method in the AJAX framework, and I immediately thought it was a key time saver to creating a drag-and-drop list.

So what did I manage to do? I managed to do the dragging part, which came pretty easily. I managed to create a placeholder that lived where the item was coming from too. At that point, I really only had about a hundred lines of code. This object model that I had come up with, however, made it exceptionally illogical for altering the list as you were dragging. All along I already had something in mind for this control, and at this point I was just wasting time when there were solutions out there. Really, really good solutions.

Something else recently landed me on the Yahoo UI page, and I figured I'd give that a good look to see if it would do what I wanted with minimal pain. For the most part I think it can, but it wasn't nearly as easy as Scriptaculous. They use some odd naming conventions (like event handlers being called "observers"), but for the most part everything is so straight forward. The code is fairly easy to understand, and definitely has seen many rounds of refactoring. The Sortable object was exactly what I needed. I looked at JQuery as well, and it looks remarkably similar.

Why is the ASP.NET AJAX stuff so heavy? It reminds me of so many server-side controls that try to do everything but succeed at being useful only a small percentage of the time, primarily for those old-school line-of-business app developers. Although, does it really matter?

I'm not hating here, let me make that clear. The first time I wired up server-side stuff to the client-side, and then had two client-side objects interact, I totally understood why Microsoft's framework is pretty cool. It's just the stuff being built on top of it that doesn't seem to be as elegant and useful as I think it should be. But regardless, it thrills me that these frameworks can live peacefully together.

Those who can't write blogs for washed up magazine's Web sites

First this tool writes about how the London Stock Exchange crashes, and it's all the fault of using Microsoft software. He has no evidence, mind you, but that must be it.

But oh wait, no, it was a network problem.

It still seems ridiculous that people get into this religious zealotry, and people are really into it. Is it because people like me are so annoyed by it? Some tool whose byline says he's been writing about software for 30 years doesn't make him qualified to make such asinine statements. Fortunately some people called him out on it.

But hey, clueless pundits keep those of us who endeavor in consulting rolling in the cash I suppose. Maybe we should write more about it.

Waiting for "the" job and not settling for "a" job

I've gotten a little more serious in the last week or two about finding a job, because I think it's about time. Getting CoasterBuzz out last week was kind of like finishing up on a consulting job and looking for the next thing.

I've said all along that I wanted to hold out for "the" job instead of just taking "a" job. There are plenty of the latter where I live, and I learned years ago that you've gotta do what holds your interest or suffer from soul suckage. Nobody wants that! What I find difficult though is not believing in my qualification for various gigs, but getting the right message to interviewers. They really come in two flavors.

The flavor that I work well under is the kind who are most interested in accomplishments and the details of how you made them. One that I'm talking with now started with the owner of the company, a small-ish consultancy, and he is somewhat technical at best. His CTO understood programming more, but even he would concentrate more on practical, real world technique. These kinds of talks are more interested in how you're designing things, and how they performed in production.

The other flavor is the computer science stump interview, and I hate those. I don't have any formal education in computer science. I still can't explain polymorphism eloquently. I can't tell you about how memory works and is allocated, because I'm not that interested in our managed code world. It doesn't mean I wouldn't endeavor to gain a deep understanding if a situation would merit.

I've been thinking about how I can get around this, and my first instinct is a "25 cool things I've done with .NET" list or something like that. I have the distinct advantage of having more of my own code not owned by a former employer than most. I can show stuff like an AJAX control like Facebook's tokenized text list (what you use to add names to a message) or data-driven page mapping frameworks or, ugly as the SQL may be, my own text search engine.

There's still very much a divide between the computer science types and everyone else in some places. I'm not suggesting that it's some personality flaw with anyone, just that it's a cultural challenge. There are too many developers without the formal education who produce results as good as, if not better, than their lifetime computer science counterparts. Cutting through that barrier continues to be a challenge.

Lessons from the relaunch of CoasterBuzz.com

I flipped the switch to turn CoasterBuzz back on a little after 3 a.m. last night, once I was content with the data conversion and had the basic content up.

Being a one-man show for this kind of thing is a very different experience than what you see in a team environment. While I don't feel like I've pulled off any huge feats of programming, I'm reminded that the forum app clocks in around 10k lines of code, and CoasterBuzz specific code is around 2k lines. I should probably give myself more credit than I do. Hacking together a site with a bunch of free apps isn't that hard, but doing it all from scratch is quite an effort.

By morning I had found about two dozen "issues," three of which were actual bugs. The one was a silly mistake amplified by the fact that Google's bot was hammering the page over and over on ten second intervals. You'd think the smart people at Google would not let that happen. Once I cleared those from the log, there were a few things to clean up, and lots of formatting issues.

The forum search indexing is going a little slow, and I wonder if there's a better way to do it. I mean, in real life it wouldn't be an issue because there aren't generally hundreds of thousands of posts queued for indexing, but I still think about it. I cranked it up to one topic per second and the server just choked over disk thrashing. One topic every two seconds seems to be going a lot more smoothly.

That server has been running now at The Planet for five years. It's a 2.4 GHz P4 white box with a couple of standard hard drives and 2 gigs of RAM. I've wanted to upgrade for some time, but I don't really want to pay more when it's adequate 99% of the time.

Hopefully this will give me a better idea of how the forum performs too. It has been running on PointBuzz since November, but it's a lower traffic site, and it never really gets tested. I suppose I'm curious more for me than anyone else. I still have that little site to sell the forum, but honestly I'm not sure if I'm that motivated to truly sell it to the world at large, even for a couple hundred buck in revenue per year. I still wrote it for my sites first and foremost.

The integrity, or lack thereof, of the the coaster and park databases bothers me, but that'll be resolved over time. There are a lot of ugly tools on the back end for me to manipulate that data, and I'd like to find a way to expose them to users in a reversible fashion. That was one of my early goals going to back to 2006, and one of the things that created a big hang up for me.

On July 1, I lost my job. That day I decided that it was now or never if there was every going to be a CBv4. I threw away most of what I had and started over. Looking back, there were probably around 160 actual man hours involved, spread over the two months. I don't think I've been that focused since I wrote my book. I didn't feel that focused, but all of a sudden, I put some color around the site layout, it felt more real, and I was a lot more driven to get it done.

There's plenty to do, of course, but key word is "enabled." Now the infrastructure is in place that I can make good on things I'd like to try, whereas, I used to be bound to the mistakes and limitations of my experience level of five years ago. Working at Insurance.com made me nuts at times, but it also gave me a lot to think about in terms of building something that's easily maintained and scaled.

For now, my brain needs a break. Perhaps I'll go see a movie tomorrow. Maybe then I'll get a job.

More Posts