May 2005 Entries

I came across the f(m) project via the Ajaxian Blog. It's pretty neat to see someone undertaking this. I realize there's lots of little scripting frameworks out there, but AFAIK no one has taken the same angle to model it after the .NET BCL.

One of the coolest libraries f(m) offers is one that mimics System.Threading. For the uninitiated, there is no such thing as multi-threaded programming in the web browser. The best you can do is schedule work via a Timer, but that's no where near the same thing.

It feels good to finally know that, thanks to the rest of the world finally realizing the power of the browser+script because of all the Ajax hype, the next time I want to write an client application I will be able to depend on someone else's libraries instead having to hand roll my own for collections, events, DOM discrepencies, etc. Really wish this stuff was around sooner.

Now, if only someone would realize that what's really needed is a component architecture for HTML then we'd be one step closer to where we are today in the “real” world. Did you know Microsoft submitted a spec in 1998? Maybe it wasn't perfect, but what the hell is our excuse for still not having one today? FWIW, this architecture still works in IE today and Dean Edwards even wrote an Mozilla XBL binding to support it! And, yes, you've heard me rant about this before, but it doesn't seem to be doing any good. :P

posted Tuesday, May 24, 2005 6:05 PM | Comments | Filed Under [ Web Development ]
Tim Sneath posts up the official set of changes (Word format) for the May Beta 1 RC. Word is this will also be availble on MSDN soon. It actually has a less complete list of renames/reorganizations than the change log I've been maintaining so be sure to check that out, but it does a better job introducing some of the newer features added in this release.
posted Tuesday, May 24, 2005 11:56 AM | Comments | Filed Under [ .NET WinFx/Vista ]
I've started documenting some of the changes to the Avalon APIs between the March CTP and the May Beta 1 RC. The list is brief and only includes the major ones for now, but I'll continue to update it as I learn more. The intention of this list is to hold people over until Microsoft posts an official list of their own.
posted Monday, May 23, 2005 11:46 AM | Comments | Filed Under [ .NET WinFx/Vista ]

From the main download page, you will find a link to the updated SDK (iso format). Looks like Friday's announcement kinda jumped the gun, but it's all available now.

Oh and for those who were asking, yes, this build is 100% compatible with Whidbey Beta 2.

posted Monday, May 23, 2005 9:22 AM | Comments | Filed Under [ .NET WinFx/Vista ]

This ought to supply the geeks with something to do this weekend... besides going to see Star Wars of course. ;) I'll try and do some coverage of Avalon changes/additions since the March CTP. Oh and congrats to both teams for reaching Beta status!

Note: if the link doesn't come up for you I think it's because it's still propagating through Microsoft's server farm, give it a little time.

Update (3:32AM): Download still not working? Well, here's a direct link to the executable. Time for me to sleep off a night of partying, enjoy!

posted Friday, May 20, 2005 5:19 PM | Comments | Filed Under [ .NET WinFx/Vista ]

Nick Kramer, a PM on the Avalon team, bursts into the blogging scene with his first post being about Avalon's various naming conventions. The primary need for these conventions is for discoverability through reflection. The primary “client” that needs to reflect on types using these patterns is the Avalon serialization architecture itself. However, these patterns can also be leveraged by design time tools to discover interesting aspects about Avalon based types.

posted Friday, May 20, 2005 3:38 PM | Comments | Filed Under [ .NET WinFx/Vista ]

Dare posted up the other day about Microsoft's language choices and how they have “missed the boat” with some of today's trendsetters. He mentions that Microsoft is too busy competing with Java and the JVM with C# and, as a result, other language/technology crowds aren't receiving enough attention. He makes some good points, so definitely give it a read.

I originally just commented on the post because at one point he states that Microsoft provides no JavaScript IDE. Since I've been using versions of it since around 1996, that just didn't seem to make sense to me. Not to mention the Visual Studio IDE has provided the best JavaScript debugger out there (IMHO) since v6.0 with Visual InterDev.

Anyway, I just went back to the post and reviewed some of the other comments that have been made and naturally people have to bring out the “Microsoft is a monopoly” argument and that once they move into a space and crush the competition they just go stale. What I don't get about this argument is that, on one hand people bitch Microsoft is a monopoly and always tries to conquer everything, yet on the other hand people expect them to implement everything. Why in the hell does Microsoft have to provide every language? What's wrong with IronPython or any of the other language implementations that run on the CLR!? Just because it's not provided out of the box by Microsoft you can't use it? Wouldn't that just perpetuate the whole “Microsoft is a monopoly” ? Microsoft did their part by providing the CLR (100% free of charge I might add), standardizing it, having resources out there helping third parties port their languages to it, etc. Microsoft provides four languages out of the box that run on the CLR: C#, VB, JScript and C++. Why should they have to be the ones to provide all the others? 

Next, we all know a language isn't much good without a decent development environment. Well, Microsoft helps out there too: VS.NET is 100% extensible and anyone who might port a language to the CLR can also integrate into the IDE and provide a full set of debugging/editing services just as well as Microsoft can. Don't want to integrate into VS.NET because it's too “heavy” or you don't want to require your users to fork over the cash for it? Fine, write your own IDE and just hook into the CLR using the debugging and profiling APIs.

It's impossible for Microsoft to please everybody. In the end they are a business and need to be strategic about which battles they choose. If you don't like the fact that there's not a version of your favorite language on the CLR or that the support isn't that great, quit bitching and do something about it!

posted Friday, May 20, 2005 8:07 AM | Comments | Filed Under [ .NET ]
Ian just put up a great, simple overview of Avalon's input and command architecture. Having this type of stuff baked right into the framework just makes life so much easier for application/control developers. We get to focus on our specific problem rather than having to worry about all these silly plumbing problems.
posted Thursday, May 19, 2005 12:39 PM | Comments | Filed Under [ WinFx/Vista ]

This was a pretty interesting experiment. Ian Griffiths made a post to the Avalon NG asking why it wasn't possible to just put the ID of a node into the Target property of a Label in XAML. The reason is because it's a property that expects another FrameworkElement instance. So I created a custom MarkupExtension to provide the behavior at deserialization time.

Click here to read the thread and click here to get the source code for my custom MarkupExtension which works, but has an unfortunate restriction right now which you'll learn about at the end of my reply to Ian's original post. Hopefully I'll find or get a solution from Microsoft and, when I do, I will post an updated working version.

posted Wednesday, May 18, 2005 1:46 PM | Comments | Filed Under [ WinFx/Vista ]

Damn... another dream job offering. Unfortunately my commitment bars me from taking the red pill, but best of luck to anyone that attempts to pounce on this opportunity and just know in advance: I'm jealous. :P

posted Wednesday, May 18, 2005 12:57 PM | Comments | Filed Under [ WinFx/Vista ]

My company, Mimeo.com, has been named a Red Herring 100 company (press release). That puts us amongst ninety-nine other private companies who are changing the face of their respective markets. It's an honor to even be mentioned as a finalist let alone actually end up on the list. I remember when this company was just a few guys with only some desks, chairs and computers in an otherwise empty ~5000 sq. ft. floor. We've sure come a long way since then. :)

Congratulations to everyone on the team!

posted Wednesday, May 18, 2005 12:55 PM | Comments | Filed Under [ Personal ]
Yes, it's official, IE7 has tabbed browsing. Personally I hate tabbed browsing. I like finding my windows via the task bar and am a very strict about my window management in general. That said, I realize I must be in the minority, so I hope the rest of the world is now happy and will stop complaining about IE not having the feature. ;P
posted Monday, May 16, 2005 9:58 AM | Comments | Filed Under [ Web Development ]

An interview with Chris Anderson just went up over on Channel 9 where he talks about the “nuts and bolts” of Avalon. If you're the type of person that likes to know how the pixels end up on the screen then this is the video to watch. Topics discussed:

  • How Avalon sits on DirectX and User32
  • The Avalon stack: milcore.dll -> presentationcore.dll -> presentationframework.dll
  • The UI and composition models and how they interact with respect to threading and communication
  • Touches on the control and styling model
  • Discusses the mantra of “lookless” controls where the behavior of an element is completely separated from the visual design

Best part is they don't even mention XAML until the very end where they drive home the point that XAML is just another programming model and is not at the core of Avalon.

posted Thursday, May 12, 2005 8:37 AM | Comments | Filed Under [ WinFx/Vista ]

Chris Anderson is jumping on the Python bandwagon and is building support into AvPad for IronPython as a scripting language. Pretty interesting stuff. In his latest post, he has extended IronPython to support ICustomTypeDescriptor so that you can interrogate an IronPython object at runtime and discover properties that may have been added on the fly. The main purpose Chris added this is beause it is actually one of the interfaces Avalon will use for reflection as he shows here in a databinding example

On a related note, I wonder if IronPython already has support for IExpando? If not perhaps they should consider adding it for even better interop since, when communicating with COM, classes implementing IExpando will be exposed as IDispatchEx making them richer in environments that support the interface (i.e. scripting languages).

posted Wednesday, May 11, 2005 10:45 PM | Comments | Filed Under [ .NET WinFx/Vista ]

I received notification this morning that I won tickets from a KROCK contest (local radio station here in NYC) to go see Coldplay at a private showing at the Beacon theatre. I had been trying for about a week to win and finally got lucky last Friday for the six o'clock drawing. I've been a Colplay fan for a while. Saw them in concert once before and it was great, so to be able to go to a private show where they'll be doing a live music taping for AOL is pretty freakin' awesome! :)

posted Monday, May 09, 2005 8:05 PM | Comments | Filed Under [ Personal ]
Any other NIN fans out there? I bought With Teeth from MSN Music when it was released Tuesday this week. Absolutely amazing... love it. The Hand That Feeds is the single for the album, but my favorite song on there (so far) has to be All The Love In The World.
posted Friday, May 06, 2005 6:28 AM | Comments | Filed Under [ Personal ]

Filipe shows the layout difference between applying a straight Transform to a UIElement's RenderTransform and nesting the element in a TransformDecorator with AffectsLayout=”True”. He doesn't show it, but it's important to note that TransformDecorator with AffectsLayout=”False” results in the same effect as a straight RenderTransform, making it pretty much senseless to use in that case since the layout difference is pretty much the only reason to use the TransformDecorator in the first place.

posted Thursday, May 05, 2005 3:15 PM | Comments | Filed Under [ WinFx/Vista ]

Here's a thread in the Avalon newsgroup that I was participating in that shows why it's important to put any kind of long operations on a background thread. Basically if you're familiar with the threading model of WinForms then you know you need to put long running operations on a background thread and marshal calls to update the UI on the main thread using Control::Invoke so that you do not cause your program to become unresponsive to input or screen painting. Well, Avalon shares the same concepts...

Instead of Control, which is the base of all UI elements in WinForms, we have a base class in Avalon called DispatcherObject. DispatcherObject has a propety called Dispatcher which returns the Dispatcher instance (surprise!) that this object is tied to. Dispatcher is the class that controls the message pumping aspects for a thread and, as such, is where Invoke and its async equivalents, Begin/EndInvoke, are now exposed. You'll notice one major difference between Dispatcher::Invoke and Control::Invoke, every overload of Dispatcher::Invoke takes a DispatcherPriority as its first parameter. This allows you to efficiently schedule tasks with the Dispatcher so that, for example, they are synchronized with other intrinsic Avalon operations such as loading, data-binding, rendering, etc. So in the case where you're trying to update your UI from a background thread you would probably choose DispatcherPriority.Render so that the message is pumped when the renderer is ready to process new rendering instructions.

Two other things I should probably mention are that the WinForms Timer equivalent in Avalon is called DispatcherTimer and currently there is no equivalent of the BackgroundWorker class in Avalon although I had written one for the older builds of Avalon so eventually I'll get around to upgrading it to the latest API changes. :)

Anyway, definitely check out that thread in the newsgroups and here's a direct link to the sample I attached to one of my replies to demonstrate the difference in behavior.

posted Wednesday, May 04, 2005 9:01 PM | Comments | Filed Under [ WinFx/Vista ]
Filipe Fortes, a PM on the Avalon team over at Microsoft, has put up a couple of posts about the Viewbox and TransformDecorator with a ScaleTransform. His posts deal specifically with the different effects the two have on content layout. This is yet another part of Avalon that I see people having difficulty adjusting to. Definitely a must read for anyone who is experimenting with content layout in Avalon.
posted Tuesday, May 03, 2005 10:30 PM | Comments | Filed Under [ WinFx/Vista ]

Disclaimer: Don't blame me if your productivity takes a hit when you click the following link.

This is a really, really great idea and excellent excercise for the brain: Guess The Google.

posted Tuesday, May 03, 2005 9:07 PM | Comments | Filed Under [ Personal Web Development ]
Came across a recent post on MSDN Blogs with some great info on how to accomplish drag n' drop behavior with Avalon. Unfortunately there's no good explination/sample in the WinFX SDK just yet, so this question comes up all the time in the newsgroups, so it'll be good to finally have a nice link to point to as an answer.
posted Tuesday, May 03, 2005 8:25 PM | Comments | Filed Under [ WinFx/Vista ]

Disclaimer: C# Express/March CTP/.NET version v2.0.50110

This is for the performance concious freaks out there (like me). The following code results in a new Delegate instance being constructed every pass through the loop even in release builds:

private void MyBackgroundWorker(object state)
{
 for(int work = 0; work < 10000; work++)
 {
   this.Invoke(new MethodInvoker(
                   delegate()
                   {
                    this.label1.Text = work.ToString();
                   }));
 }
}

If you disassemble this version and have a look at the IL you'll see the MethodInvoker is newobj'd every pass through the loop. Curious... can't C# just unroll this version? If not, why not? So while the short hand, inline looks great and probably the nicest to maintain, beware the potential performance costs (unecessary allocations of the delegate) as opposed to this far less elegant, yet more efficient approach:

private void MyBackgroundWorker(object state)
{
 int work = 0;

 MethodInvoker myCallback = new MethodInvoker(
                            delegate()
                            {
                              this.label1.Text = work.ToString();
                            });

 for(work = 0; work < 10000; work++)
 { 
  this.Invoke(myCallback);
 }
}

I guess my next question is for all the real hardcore folks out there that like to get into the JIT'd machine code: Is it unrolled by the JIT? I guess I could just attach the profiler and see how man MethodInvoker's are actually instantiated at runtime, but I'm only running C# Express on this box so I don't have it and AFAIK there's no “official” CLR Profiler for .NET 2.0 yet.

On a related note, I find it really annoying that I have to do new MethodInvoker at all. Why can't I just do:

this.Invoke(delegate()
            {
              this.label1.Text = work.ToString();
            });

I guess in the particular case of Control::Invoke I can understand the need to know exactly what kind of delegate instance to construct because it takes Delegate which is an abstract class. However, even when the type of delegate could be inferred from the method signature it is not. :\

posted Tuesday, May 03, 2005 6:18 PM | Comments | Filed Under [ .NET ]

ExtremeTech just published a great article detailing all the nitty gritty details of where graphics are going in Longhorn. Key technologies: WGF 1.0, LDDM, DWM (used to be DCE), Avalon (for the masses) and WGF 2.0 in the future. Noticeably absent is mention of the MIL unless that's lumped under the WGF umbrella.

posted Tuesday, May 03, 2005 5:16 PM | Comments | Filed Under [ WinFx/Vista ]

First go listen to this interview with Robert McLaws of LonghornBlogs fame and then here are some corrections on a few bits of misinformation given about Avalon in the interview:

  • Avalon is not a “desktop renderer”: It is an API for designing next generation windows client applications. Part of that has to do with a new graphics and multimedia stack, but that's not all Avalon is. It also introduces a new: threading model, application modeldata-binding model, resource model, eventing modelinput and command model, etc. So this is not what I would deem as the rendering technology. The rendering technology is actually DirectX which leads me to the next point...
  • No version of Avalon is built on top of GDI+: It is built on top of DirectX. XP, 2003, or Longhorn... doesn't matter. As such it leverages all the features of the GPU to do all rendering. This includes 2D as well as 3D. In fact, all 2D is actually accomplished using 3D. GDI[+] is still available even in Longhorn, it's just that Avalon completely bypasses it. Note that you can host WinForms and pure Win32 controls in an Avalon application and, believe it or not, vice versa.
  • Avalon != XAML and not a “declaritive markup engine”: This is a common misconception. XAML stands for: Extensible Application Markup Language.  It is simply a serialization format that allows you to declaritively define an object graph based on everyone's favorite syntax: XML. Avalon controls are just one kind of object graph that can be built and, obviously, the most common example right now. However I could just as easily construct a graph of any other type of .NET objects. That said, the XAML serialization engine is part of the Avalon API.
  • “Loose” XAML no longer browseable as of latest builds: As of the March CTP you can no longer simply browse to a XAML file. It must be compiled into an application. The main reason for this seems to be that Microsoft does not want to promise delivery of this feature because of all the security holes it could potentially open up. There tends to be a lot of discussion about this in the Avalon newsgroup. Also, “browsing to an application” really has nothing to do with XAML or even Avalon, but rather smart client technology, aka Click Once as mentioned. Windows Forms apps can be run exactly the same way.
  • Avalon backported to XP/2003 because: The plan was not always to backport it. The reason it was backported is so that third parties can develop applications built on this great technology and have them work on XP/2003 as well as Longhorn. Obviously not everyone is gonna run out and upgrade to Longhorn “day zero”. That said, some features of Avalon will only be available on Longhorn, not to mention that the new graphics driver model (the LDDM as mentioned) coupled with the Desktop Window Manager (DWM) that come along with Longhorn ensure a vastly better experience when you have multiple Avalon applications running. This is because the old driver model for GPUs does not lend itself to multi-tasking. The current display driver model was basically meant to run GDI[+] or one 3D application as fast as the metal allowed (e.g. Doom 3 or HalfLife-2 full screen). Now that the GPU is a core dependency of the way the OS displays everything on your desktop, it needs to support richer scheduling as well as virtual memory. For more information on what differences there are between platforms, check out this post from Chris Anderson. For info on all the improvements being made to graphics technology in Longhorn, definitely check out this article that was just published over on ExtremeTech.
posted Monday, May 02, 2005 8:48 PM | Comments | Filed Under [ WinFx/Vista ]

This one has been beat to death, but some people still aren't accepting it. The WinHEC build just wasn't meant to show off Longhorn to a consumer audience. Really this shouldn't be breaking news for anyone who has paid attention to the whole discussion, but I figured I'd chime in as another voice of reason. At the same time the reason you don't hear many people saying this is because of NDAs. So, I'll put it as succinctly as possible to avoid any kind of violation: That's just not the UI. 

Think about it. When you consider just how neat all the slapped together demos being shown for Avalon are, do you honestly believe what you saw in the WinHEC build is the best Microsoft's design teams, filled with of all sorts of talented designers that money can buy, can come up with in all these years for the next generation Windows user interface? C'mon, be critical all you want, but use those brain cells just a little.

Give 'em some time folks, you'll know when the release is meant to wow that target audience. In fact, it wouldn't surprise me if PDC is the place where that happens.

posted Monday, May 02, 2005 8:16 PM | Comments | Filed Under [ WinFx/Vista ]