Tales from the Evil Empire

Bertrand Le Roy's blog

News


Bertrand Le Roy

BoudinFatal's Gamercard

Tales from the Evil Empire - Blogged

Blogs I read

My other stuff

Archives

March 2007 - Posts

ASP.NET Ajax UpdatePanel PDF erratum

I corrected a few remaining errors in our O'Reilly shortcut on UpdatePanel (mainly references to the old Atlas codename). If you already bought it, you can download the new version for free. And if you haven't, what are you waiting for? ;)

http://www.oreilly.com/catalog/atlasupc

Microsoft joins OpenAjax

OpenAjaxI'm extremely pleased to announce that we're joining OpenAjax today and that I'll represent the company in the organization's meetings starting this Thursday. This is a way for us to ensure that our user community can combine the Microsoft AJAX Library and ASP.NET 2.0 AJAX Extensions with other frameworks, today and in the future. Interoperability in the browser is a hard problem but it opens key Ajax scenarios. An industry-wide organization such as OpenAjax is a great way to ensure this goal is met in the long-term.

The press release:
http://www.marketwire.com/mw/release_html_b1?release_id=228535

Brad's post:
http://blogs.msdn.com/brada/archive/2007/03/20/microsoft-joins-the-openajax-alliance.aspx

What are these Foo$Bar$baz functions in the Microsoft Ajax Library files?

If you've looked at the debug version of our JavaScript files, you may have noticed code similar to that:

Foo.Bar = function Foo$Bar() {
	Foo.Bar.initializeBase(this);
}
function Foo$Bar$baz() {
	// Do something
}
Foo.Bar.prototype = {
	baz: Foo$Bar$baz
}
Foo.Bar.registerClass('Foo.Bar');	

And looking at that, you may have wondered what the Foo$Bar$baz names were for. That's a very good question and I congratulate you on your thoroughness. Here's why:
Stack trace shows anonymous functions

"JScript anonymous function"? That's not very helpful in a debugger stack trace and that's what you'd get if we had written the above code this way (or run the release version of the script):

Foo.Bar = function() {
	Foo.Bar.initializeBase(this);
}
Foo.Bar.prototype = {
	baz: function() {
		// Do something
	}
}
Foo.Bar.registerClass('Foo.Bar'); 

In this case, the methods on class instances are anonymous methods.

Thanks to the global "dollared" names that we inject into the debug code, the functions have a global name that is easy to map to the actual member that they are aliases for, and here's what a typical stack trace looks like in debug mode:
Stack trace shows meaningful function names

That's of course a lot more useful. Of course, you should never use those names in code that consumes those libraries, as they are here only to make debugging easier and they won't be there if you run the release versions of the scripts (which you are doing on your production servers, right?). For example, Foo$Bar$baz in the above example is an alias for Foo.Bar.prototype.baz, which is what you should use if you need it. Most of the time, you'll just call baz off an instance, like this: myBar.baz().

Finally, you may wonder why we're not writing this (which would be more compact and maybe a little easier to read):

Foo.Bar = function Foo$Bar() {
	Foo.Bar.initializeBase(this);
}
Foo.Bar.prototype = {
	baz: function Foo$Bar$baz() {
		// Do something
	}
}
Foo.Bar.registerClass('Foo.Bar'); 

Well, that would be great, but our good friend Safari 2 refuses to parse it... Safari 3 seems to fix that bug though.

How to manipulate files inside Inetpub/wwwroot all day without being bugged by UAC

A lot has been written about UAC. Some choose to disable it. I chose not to and I'm doing just fine. At least, I don't have to type in my password on every prompt like on some other OS that likes to mock us on TV ;)

Anyway, the one place where UAC has been really annoying to me as a web developer is that any file manipulation in Inetpub requires validation by default (and that's legitimate, it's not a directory that you want rogue processes to be able to easily modify). I tend to be in that directory a lot.

So I was talking about that with Nikhil yesterday and we were wondering if running the Windows Explorer as administrator would fix the problem. At first, it looks like it doesn't, but Nikhil then mentioned that Explorer was probably not actually running as admin because all Explorer windows run under a single process by default. So I went to the folder options (press alt while in Explorer, choose tools/folder options) and activated "launch folder windows in a separate process" in the "view" tab. An Explorer launched as an administrator from this moment on will enable you to do all file manipulations without UAC prompts.

Hope this helps.

UPDATE: Dean suggested in the comments giving rights to your user acount on the directory. That works too, but it means that you're permanently disabling UAC on that directory for *all* applications that run under your identity. That may be fine depending on the value you attach to Inetpub contents. For example, don't do that on a production, public-facing machine (but the above method should probably not be used either in this situation). The method I expose above also exposes the system to shell extensions that you may have installed on the machine, so check those and only use trusted ones I suppose, or don't do this if unsure.

Posted: Mar 14 2007, 04:51 PM by Bertrand Le Roy | with no comments
Filed under:
UpdatePanel PDF updated for ASP.NET Ajax 1.0

ASP.NET AJAX UpdatePanel Control: Add Ajax interactivity to your ASP.NET 2.0 web pagesThe PDF document that I wrote with Matt Gibbs a while ago on UpdatePanel is now up to date and in sync with the RTW (Release to Web) version of the ASP.NET 2.0 Ajax Extensions. It's a 60 page document that teaches how to use the UpdatePanel control to incrementally "ajaxify" an ASP.NET 2.0 web site. The booklet comes with downloadable code samples that are immediately applicable in the real world.

The update contains a few new sections that cover the features that appeared since the last revision such as the client-side events for partial updates.

Of course, if you bought it before this final version, O'Reilly offers the current version for free.

Buy the book from the O'Reilly site:
http://www.oreilly.com/catalog/atlasupc/

Download the code samples:
http://examples.oreilly.com/atlasupc/

What happens when Mozilla, Microsoft and Opera get together under Douglas Crockford's moderation?

A very interesting conference that's available from Yahoo!. Douglas Crockford's introduction is worth the watch in itself but the others also have very interesting things to say.

Chris Wilson from the IE team and Mike Shaver from Mozilla are all about conciliation and doing the right thing for the Web to continue to be the platform of choice for the killer applications of the future. Encouraging. Mike even had nice things to say about IE7 (yes, you read that right).

Håkon Lie was more trying to pitch his product (and gently bashing IE) but still made an interesting case for a standard <video> tag that works without any kind of plug-in. The interesting part was the codec part and he's advocating for the adoption of Ogg. While I'm convinced that having a patent-free format is good for some applications (he cites Wikipedia), I think such a tag should be open to any codec, using a "type" attribute that gives the MIME type of the contents (like <script> and other tags already do). Although from a personal point of view (in other words this is in no way the Microsoft view) I think DRM are a failed attempt at preventing piracy that ultimately only bothers legitimate users, it remains a fact that a large part of the media industry still requires it and it is irrealistic to think that a <video> tag could be widely adopted if it doesn't take that aspect of things into account.

Finally, Apple's attitude was really revealing. Microsoft has often been (and sometimes rightfully) accused of arrogance, but replying to an invitation from Douglas Crockford "we are busy writing software" just redefines the term. Nicely done.

Watch the video at:
http://ajaxian.com/archives/browser-wars-mozilla-ie-opera-join-up-for-a-panel-discussion

UPDATE: A discussion on Ajaxian about the <video> element proposal:
http://ajaxian.com/archives/opera-element-proposal

ASP.NET Ajax-aware JavaScript IntelliSense available from the Orcas CTP

This is an absolutely awesome feature. IntelliSense / autocompletion for JavaScript is a difficult problem (because of the dynamic nature of JavaScript) which the Visual Studio team is brilliantly solving. They were able to build an elegant solution to the problem that works reasonably well on plain JavaScript, but really shines when used with ASP.NET Ajax. The type information that we added to our debug scripts through doc comments really helps in making the whole experience seamless.

Jeff King wrote a great blog post that shows what's already available in the Orcas CTP:
http://blogs.msdn.com/webdevtools/archive/2007/03/02/jscript-intellisense-in-orcas.aspx

The CTP itself can be found here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=b533619a-0008-4dd6-9ed1-47d482683c78&DisplayLang=en

More Posts