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...

Posted on March 2, 2010 16:40
Actions: E-mail | Comments (1)

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

 

Posted on February 12, 2010 08:46
Actions: E-mail | Comments (0)

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

Posted on February 5, 2010 10:36
Actions: E-mail | Comments (0)

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).

 

 

Posted on February 4, 2010 11:22
Actions: E-mail | Comments (0)

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.

 

Posted on February 3, 2010 12:35
Actions: E-mail | Comments (3)

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 

 

 

Posted on February 1, 2010 15:56
Actions: E-mail | Comments (0)

I just started reading Professional Twitter Development: With Examples in .NET 3.5 (Wrox Programmer to Programmer) and came across this quote, which cracked me up:

The Twitter API is the Schrödinger’s cat of web service APIs. Until you call it, you never know if it's alive or dead. Sometimes the mere act of calling it is enough to kill it.
--Scott Koon,Witty

Hilarious. And true.

Posted on January 25, 2010 10:10
Actions: E-mail | Comments (1)

I recently had to move an Azure service from one account to another.  Unfortunately, they could not migrate my account, which meant that I manually had to migrate it.  In the case of the service, I had created a cname {name}.mysite.com that pointed to the Azure DNS name ({name}.cloudapp.net).  Lucky me: I was able to migrate the service and then repoint the CName to the same DNS entry with no changes or problems.  But in the case of my blob storage ({name}.blob.core.windows.net) I hadn't created a Cname, which means I manually have to update any reference to anything in blob storage. 

Lesson learned: use CNames for everything in Azure in case you need to transfer accounts, ownership, etc.

Posted on January 22, 2010 11:05
Actions: E-mail | Comments (1)

I've written before about the most excellent tool Cloud Storage Studio by Cerebrata. I use exclusively for uploading blobs to Windows Azure as well as downloading my IIS log files. I just hit an issue as far as IIS logs which (fortunately) easily resolved. By default, Cloud Storage Studio does not preseve path settings when downloading files.  This presents a problem if you have multiple instances of your application on Windows Azure, because, when you go to download the log files, there will be duplicate log file names (aka  "u_ex09121403.log") from your different instances. 

The fix is easy. Go into options and see if the "Preserve directory path information in blob name when downloading files & directories" setting checked or not? You can check this setting either under "Configuration Settings --> Container/Blob Setting" or under "Download Window --> Download Settings" By default it is unchecked. If it is checked, then Cloud Storage Studio will preserve the folder hierarchy. You may need to restart the app after you set it as it didn't pick up my configuration changes after I set it. (They need to implement INotifyPropertyChanged!)

 

Posted on December 18, 2009 09:32
Actions: E-mail | Comments (3)

 Just shipped Incarnate, a new lab from the fresh new looking Mix Online site. I think the appropriate tagline for Incarnate is "Who do you want to be today" as people are quickly realizing that it can be more entertaining to be a celebrity avatar than yourself.

Now you know what all those posts about JSON-P, Windows Azure, REST Starter Kit and more were about! 

And, as you may notice, I've implemented Incarnate on this blog, inside .NET Blog Engine. Unfortunately, I couldn't use their plug-in model and I actually had to modify the source, but it wasn't too bad. If you are running .NET Blog Engine and want to know how to install Incarnate into it, let me know.

Posted on December 16, 2009 12:54
Actions: E-mail | Comments (3)