The Archivist Is Live!

June 28 2010

Well, the project I've been working on for quite a while just went live to the world: The Archivist at http://archivist.visitmix.com. Go give it a whirl and let me know what you think. The intro article is here: http://visitmix.com/LabNotes/Intro-To-The-Archivist and you can download the source code here: http://code.msdn.microsoft.com/archivist

Been quite an adventure building and shipping this puppy -- looking forward to seeing what happens now that it is out in the wild.

 

 

HttpClient and HttpResponseMessage Unhappy in Medium Trust

June 19 2010

Just hit an issue where I was using the WCF REST Starter kit and their wrapper methods for handling HttpWebRequest and HttpWebResponse for consuming ATOM. All was fine -- until I deployed. Then I was getting a securtiy exception.  So, I ported the code to use raw HttpWebRequest and all worked. My guess is that my provider has configured something to explicitly allow for HttpWebRequest but not wrapper methods around it. Or something. Anyway, here was my old code:

        private SyndicationFeed GetFeed(string url)
        {
            using (HttpClient http = new HttpClient())
            {
                using (HttpResponseMessage resp = http.Get(url))
                {
                    resp.EnsureStatusIsSuccessful();
                    return resp.Content.ReadAsSyndicationFeed();
                }
            }
        }
 

And here's my new code:

   private SyndicationFeed GetFeed(string url)
    {
        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        {
            if (response == null)
                return null;
            if (response.StatusCode != HttpStatusCode.OK)
                return null;
            using (XmlReader reader = XmlReader.Create(response.GetResponseStream()))
            {
                try
                {
                    return SyndicationFeed.Load(reader);
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }

Optical Art

June 18 2010

This picture is wack:

 

Swingify: Photoshopping Music

June 7 2010

Check out this sample by Steve Marx called Swingify.  It uses the Echonest API and builds off a sample called Swinger that came from the Music Hack Day that took place recently in San Francisco. These two came out particularly well:

Sweet Child O' Mine (Swing Version) by plamere

White Rabbit - The Swing Version by plamere

Steve's post explains how he built Swingify on Azure -- nice!

Azure Development Tip: Toggle Where You Get Config in Application_Start()

May 2 2010

The Azure Development Fabric is quite useful as far as simulating Azure on your dev box, It is especially nice how it simulates mulitple web roles and worker roles, so you can find web farm problems and what not before deploying. But, one hassle when working in the dev fabric is that once you start debugging, it creates a package and "deploys" the files, so that you can't make any changes to the site and hit refresh. So, no changes to CSS, static html pages or .aspx pages. This is kind of a drag.

I thought the solution would be as simple as just creating a different .sln that wasn't an Azure project and then adding the .csproj file to that .sln.  But, I tried that and got the following error:

"SetConfigurationSettingPublisher needs to be called before FromConfigurationSetting can be used."

Basically, what was happening was that any code that tried to call CloudStorageAccount.FromConfigurationSetting was failing because it couldn't get to the Azure config, which is where I have stored the connection string to my blob storage.

At first, I was going to just get rid of using the CloudStorageAccount and move my config elsewhere, but I briefly searched my code and found I was using it a lot. And, if I removed it out of there, I could no longer make any changes to config after I deployed. I found a more elegant solution (tip o' the hat to Fernando Tubio and this thread in the Azure forums.)  Basically, I duplicate the settings in web.config and then call the following code in Application_Start() of global.asax.cs:

CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
  {
    string connectionString;

    if (RoleEnvironment.IsAvailable)
    {
      connectionString = RoleEnvironment.GetConfigurationSettingValue(configName);
    }
    else
    {
      connectionString = ConfigurationManager.AppSettings[configName];
    }

    configSetter(connectionString);
  });

Works great! And makes for a much better development experience!

Oh, the one other thing I had to do was rem out the diagnostics trace listener in web.config. If I wanted to be more elegant, I could have removed this from web.config programmatically in the conditional statement above...

Beware of Using Memory Storage With The ASP.NET Chart Control In Windows Azure With Multiple Instances of Your WebRole

April 12 2010

In the documentation here: http://blogs.msdn.com/deliant/archive/2008/12/02/managing-chart-generated-images-with-chart-image-handler.aspx on the ASP.NET Chart Controls, it states:

Do not use this [the memory storage] option in a server cluster or a multiple-process site.

Well, if you have multiple instances of your web role in Windows Azure, this is gonna get you.  It got me. But hats off to the Windows Azure for actually simulating multiple instance in my development fabric -- didn't realize they did that.

 

Rhizotron

April 8 2010

I'm not sure exactly what the rhizotron is, but I feel some kinship and connection to it. And it sure looks rad.

from http://www.flickr.com/photos/its_gem/4179999304/ 

Presenting at MIX10 - Incarnate: Behind the Scenes

March 2 2010

My session at Mix has been posted:

Incarnate: Behind the Scenes

A recent MIX Online lab, Incarnate is a service that finds your avatars around the web, so you don't have to upload a new one every time you join a service or leave a comment. Behind the scenes, Incarnate is a service hosted in Windows Azure with a WordPress plug-in. In this session, we dive into some of the more interesting aspects of Incarnate, including how microformats are used to discover avatars, the diagnostics and logging support in Azure, writing a JSON-P service in Windows Communication Foundation and writing the WordPress plug-in.

Lagoon AB on Tuesday at 11:35 AM, March 16

So, if you are interested in the nitty gritty on Incarnate, come on by. And if you'll be at MIX and want to catch up, let me know...

Presenting At Future Of Web Applications 2010 in Miami

February 12 2010

Just got confirmation that I'll be doing a presentation at the illustrious Future of Web Applications 2010 conference in Miami on February 23rd. Here's my talk:

How To Think About Services For The Open Web

Today, if you are building websites, you are probably using services from any number of web providers (Facebook Connect, Disqus, etc.). You might even be thinking about exposing some services yourself. There's a dizzying array of choices and protocols when it comes to actually dealing with services. You are expected to become savvy with JSON-P, OAuth, XML, SOAP and perhaps even screen scraping HTML. Based on years of experience with building and consuming standards based services, Karsten will review the matrix of options available to you with some practical advice.

Also, while it isn't listed on the agenda, I'm doing a session during lunch. Here's what it's about:

What’s Cooking in the Mix Online Labs

Mix Online creates free, open source, ready-to-use prototypes on emerging trends for web developers and designers. Past projects have included Oomph: A microformats toolkit and Glimmer: a jQuery Design Tool. Come get a special sneak peek into upcoming, cutting edge projects coming out of the Mix Online labs. 

If you are going to the conference or are in Miami, lemme know

 

BlogEngine.NET and Incarnate

February 5 2010

With the release of BlogEngine.NET 1.6, Incarnate is now supported.  Read all about it here: http://www.visitmix.com/LabNotes/Incarnate-Updates 

VSAchievements
Visual Studio Achievements
Karsten Januszewski (207 Points)