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 

Skip, Take and Twitter Paging: Using TweetSharp To Download All Tweets from the Twitter Timeline

February 4 2010

I have been using TweetSharp lately and I am pretty happy with it so far. One thing that was a little confusing is how they implemented paging in their API on top of the Twitter API. 

What they did was to use the LINQ syntax (Skip and Take). Basically, think of Skip as the page number and Take as the number of records on a page. So, let's say you want to download all of a person's tweets. This assumes of course that you've already gone through the OAuth process and have permission to do so.  Twitter lets you download a maximum of 3200 tweets from a user, 200 tweets at a time.

So, the code to grab all of a user's tweets using TweetSharp would be as follows:

            for (int i = 1; i < 17; i++)
            {
                var query = FluentTwitter.CreateRequest()
                       .AuthenticateWith(_consumerKey,
                                         _consumerSecret,
                                         _accessToken,
                                         _accessKey)
                       .Statuses().OnUserTimeline().Take(200).Skip(i).AsXml();
                var responses = query.Request().AsStatuses();
                if (responses.Count() > 0)
                {
		    //do something with tweets
                }
                else
                {
                    break;
                }
	     } 

 So, what's going on here?  Basically I am attempting to download all 3200 tweets with a for loop, asking to take 200 tweets for each page, which is my counter. If I get less than 3200, I exit the loop, thus not unnecessarily calling the Twitter API (and increasing my chances of getting rate limited).

 

 

Putting Files at the Root of Blog Storage in Windows Azure

February 3 2010

Just learned today that by default you can't store files at the root in Windows Azure storage. So, what if you have http://foo.blob.core.windows.net which you've mapped to http://blob.foo.com and you want to put a file so that it resolves to to http://blob.foo.com/bar.png? Well you can create a special container called $root, which will map to the root.  If you do that, anything in the $root container will resolve as expected, so that http://blob.foo.com/bar.png would work.

If you are using Cloud Storage Studio, their UI supports this with the New Root Container option when creating containers.

 

Critical Hot Fix for Using Silverlight, WCF and Windows Azure

February 1 2010

I innocently added a Silverlight-enable WCF Service to my Azure application and then innocently generated a Service Reference for my Silverlight client. Everything worked fine on my machine; nothing worked once I uploaded it to Azure.  After going down a lot of wrong turns in figuring out what was wrong, I was able to use Fiddler to discover the following response from the service:

The message with To 'http://.../Service.svc' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.

This led me to the following hot fix: http://code.msdn.microsoft.com/KB971842.  After installing the hot fix, in order to get things working, I had to both add the following to my serviceBehaviors behavior:

          <useRequestHeadersForMetadataAddress>
            <defaultPorts>
              <add scheme="http" port="81" />
              <add scheme="https" port="444" />
            </defaultPorts>
          </useRequestHeadersForMetadataAddress>

And then I also had to add the following attribute to my service:

[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]

I then regenerated my proxy and, hooray, everything worked. More on this and other issues when using WCF with Windows Azure is explained here: http://code.msdn.microsoft.com/wcfazure/Wiki/View.aspx?title=KnownIssues 

 

 

VSAchievements
Visual Studio Achievements
Karsten Januszewski (207 Points)