Monthly Archives: March 2009

MSDN Code Search Preview

(Just read about this on CoDe Magazine)

Microsoft launched MSDN Code Search Preview.

The MSDN Code Search Preview lets you search for code in the MSDN Library, MSDN Code Gallery, and CodePlex.

You can read all about it on the about page or this post from the MSDN & TechNet Search Blog.

redgate .NET Reflector Released

Today redgate released version of .NET Reflector.

It was a bumpy release. Early today, at work, as soon as @antsprofiler was announced the deployment of the new version I tried to upgrade and was offered an upgrade to the version over and over again.

Early tonight, at home, when I tried to upgrade I was offered to upgrade to

The funny thing is that, if I try to run it from C:\Program Files I get a UAC dialog the mentions Reflector 5.1.3.

Just moved to my C:\Program Files (Utils) and it all works fine.

Adobe Reader Fails To Upgrade/Install

Yesterday I was offered an update to Adobe Reader (the latest version for Windows Vista is version 9.1) on my company’s laptop.

I accepted the update but it failed. It was late and a failed update to Adobe Reader was the least of my worries at the time.

Today, when I tried to use Adobe Reader, I noticed it had been uninstalled.

It’s not nice having to download and install something like Adobe Reader when I need to open a document, but the worst came when I tried to install it.

Adobe Reader requires elevated privileges to install but, due to the way the installer works, being a local administrator (I running Vista x64 Enterprise joined to a corporate domain) is not enough to install Adobe Reader on C:\Program Files (x86), because it was still failing.

I had already created C:\Program Files (Utils), to install the Windows Sysinternals tools (in particular, Process Explorer) and did the same for Adobe Reader.

Do you know what was the first name I thought of for this folder? C:\Program Files (Bad)

Just blame it on Vista.

MIX09 Session Presentation Slides

On a previous post I introduced the feeds I created to subscribe to Mix09 session videos.

I’ve decided to also create a feed for the presentation slides:

MIX09 Session Videos – How I Did It

On my last post I introduced the feeds I created to subscribe to Mix09 session videos.

In case someone is interested on how I did it, here it is:

<%@ WebHandler Language="C#" Class="mix09" %>

using System;
using System.IO;
using System.Web;
using System.Linq;
using System.Xml.Linq;
using System.Net;
using System.Xml;

public class mix09 : IHttpHandler, IHttpAsyncHandler
    class WebClientOpenReadAsyncResult : IAsyncResult
        private AsyncCallback callback;

        public WebClientOpenReadAsyncResult()
            this.IsCompleted = true;
            this.CompletedSynchronously = true;

        public WebClientOpenReadAsyncResult(AsyncCallback callback)
            this.callback = callback;
            this.IsCompleted = false;
            this.CompletedSynchronously = false;

        public object AsyncState
            get { return null; }

        public bool CompletedSynchronously { get; private set; }

        public System.Threading.WaitHandle AsyncWaitHandle
            get { throw new InvalidOperationException("ASP.NET should not use this property ."); }

        public bool IsCompleted { get; private set; }

        public Stream Stream { get; private set; }

        public void Completed(object sender, OpenReadCompletedEventArgs e)
            this.IsCompleted = true;
            this.Stream = e.Result;
            if (this.callback != null)


    private static Uri mixSessionsUri = new Uri("");

    private HttpContext context;

    private string type;

    #region IHttpHandler Members

    public bool IsReusable
        get { return true; }

    public void ProcessRequest(HttpContext context)
        WebClient wc = InitializeRequest(context);

        if (wc == null)



    #region IHttpAsyncHandler Members

    public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
        WebClient wc = InitializeRequest(context);

        if (wc == null)
            return new WebClientOpenReadAsyncResult();

        WebClientOpenReadAsyncResult ar = new WebClientOpenReadAsyncResult(cb);

        wc.OpenReadCompleted += ar.Completed;

        wc.OpenReadAsync(mixSessionsUri, extraData);

        return ar;

    public void EndProcessRequest(IAsyncResult result)
        Stream stream = (result as WebClientOpenReadAsyncResult).Stream;

        if (stream != null)


    private WebClient InitializeRequest(HttpContext context)
        this.context = context;
        this.type = context.Request.QueryString["type"];

        if (string.IsNullOrEmpty(this.type))
            return null;

        WebClient wc = new WebClient();
        wc.Headers[HttpRequestHeader.UserAgent] = "Required User Agent";
        return wc;

    private void OutputFeed(Stream source)
        XmlReader feedReader = XmlReader.Create(source);

        XDocument feed = XDocument.Load(feedReader);

        var rss = feed.Element("rss");
        var channel = rss.Element("channel");
        var title = channel.Element("title");

        title.Value = string.Format("{0} ({1})", title.Value, this.type.ToUpper());
        channel.Element("link").Value = "";

        foreach (var item in channel.Elements("item"))
            string link = item.Element("link").Value;
            string session = link.Substring(link.LastIndexOf('/') + 1).ToLower();
            string enclosureUrl = string.Format("{0}/{1}.wmv", this.type.ToLower(), session);

                new XElement("enclosure",
                    new XAttribute("url", enclosureUrl)));


        this.context.Response.ContentType = "application/rss+xml";

        HttpCachePolicy cache = this.context.Response.Cache;
        cache.VaryByParams["type"] = true;

MIX09 Session Videos

Updated (2009Mar25): Added MP4 feed. 

Mix09 is over and I would like to watch some sessions.

I like to watch these kind of videos by subscribing them using the Zune Software as a podcast. I like the Zune Software because it downloads the “episodes” and I can watch them in any order and it never forgets where I was – even if I was watching it in the Zune.

Unfortunately, the only feed available ( does not include the videos.

Fortunately, the address of the videos is very predictable and I was able to build my own feeds:

The session videos are not available in all formats for every session (at least, not now) but, if you subscribe to all, you’ll get videos for all the sessions.

Subscribe and enjoy.

ASP.NET Futures: Control ClientID Generation

ASP.NET is expected to have some improvements on the generation of client IDs.

Although this is a major improvement, it comes short by not allowing the generation of shorter client IDs for server controls.

My good friend Nuno Gomes has done some work on generating shorter client IDs for controls (*).

Jeff has taken it one step further with his How to shorten ASP.NET automatically generated control IDs article on CodeProject.

If you want to see a running example, check out