Tue, 06 Apr 2010

annoy.smarx.com: Letting the Internet Choose My Wallpaper

imageFor a demo I gave today at the Windows Azure Firestarter event, I let anyone on the internet change my wallpaper. You too can set my wallpaper by pointing your browser to http://annoy.smarx.com. I’ll try to continue running on my laptop for the next few days, so any time my laptop’s on and online, you can set my wallpaper. (If my laptop’s not on, you can still see the web page, but you’ll get a strange XML message when you try to change my wallpaper.)

You can even get the code and let people set your wallpaper too (if you have Windows Azure and Service Bus accounts). The entire project took less than eight hours to develop and deploy.

(All videos, slides, and code from the event will be available on Mithun Dhar’s blog in the next few days.)

Why I Stared at My Desktop Wallpaper For 30 Minutes

Last night, in preparation for my demo today, I tweeted the following:

Help me test my demo for tomorrow's Windows #Azure Firestarter event. Go to http://annoysmarx.cloudapp.net now!

Over the next 10 minutes, my laptop’s wallpaper changed more than 100 times! I was so amazed and entertained that I spent the next 30 minutes watching it and chatting about it on Twitter. Then for the next few hours, I continued working on the demo while watching my wallpaper change every minute or so.

Overall my wallpaper changed about 700 times last evening, and then 300 times over the night when I wasn’t looking. Today when I did the demo at the Firestarter event, I got another 1000 wallpaper changes.


Here’s a picture from my slides from today which describes the architecture of the application at a high level.

annoy.smarx.com architecture

The application consists of the following:

  1. Windows Azure – An ASP.NET MVC web role serves up annoy.smarx.com and handles uploads. (No, you can’t upload without my password.) There’s also a worker role which generates thumbnails for display on the home page (just like the Thumbnails sample in the Windows Azure SDK).
  2. Blob storage – This stores the wallpapers and thumbnails.
  3. Windows Azure CDN – With a custom domain (cdn.annoy.smarx.com), this caches all the thumbnails to make the home page zippier.
  4. Service Bus – This connects the user’s browser to my laptop, which has a listener on it. (The user’s browser is hyperlinked to a URL like https://annoysmarx.servicebus.windows.net/AnnoySmarx/SetWallpaper?id={guid}.
  5. My Laptop – A local listener runs on my laptop and opens a connection via the service bus. It also polls blob storage to pull down any new wallpapers, and then it uses Windows to set the wallpaper.

The Code

Download the code here: http://cdn.blog.smarx.com/files/AnnoySmarx_code.zip, and you too can crowdsource your wallpaper selection!

Be sure to set all the right configuration settings (in ServiceConfiguration.cscfg as well as in the local listener’s app.config) to point to your own storage, CDN endpoint, and service bus namespace. Then just deploy the app and launch the local listener on your desktop/laptop.