Archive for March, 2009

Amazon SimpleDB Domain Names

I was busy working on the Amazon Web Services version of my Photo Sharing application (the App Engine version appeared in February 2008). I was able to create a domain with the name I then wrote a simple query against this domain:

select * from where email=’’

SimpleDB responded and told me that the select query had an invalid format. On a wild guess, I thought it might be the dot (.) in Sure enough, it was. I deleted the domain, added friseton_com, and the query started working.

select * from friseton_com where email=’’

I don’t know if there is any syntax around allowing the dot in the domain name, but I found this, it works, and I’m moving on with the demo. I’ll learn the ins and outs as I go.

1 Comment

Amazon Announces Reserved Instances For EC2

Amazon just announced a reserved instances plan for EC2. This new option significantly reduces costs for Linux/UNIX users. This option is not available for Windows users as of this time. The way it appears to work is this:

  • User buys  block of hours that is good for a 1 or 3 year term.
  • User consumes hours and has this usage debited from the prepaid block of time.
  • If the user fails to consume their hours within the 1 or 3 year term, the money is gone.

The 1 year blocks sell 10833 hours. The 3 year blocks represent 16667 hours. For comparison, a week has 168 hours, a year has 8760 or 8784 hours (leap year dependent). Here’s a cost comparison of the offerings:


1 yr Block of hours

Pay as you go

3 yr Block of hours

Pay as you go
















High CPU/Medium





High CPU/Large






A couple of things jump out at me. First, I wonder if anyone would ever use the Standard/Large instance when the High CPU/Large was available for the same price. The only use case I see is where someone has a Standard/Large humming along perfectly and they don’t want to incur the costs for testing the switch. It seems like it will be cost effective to run a server all year round at these new prices– depending of course on your storage needs.

With these reserved instances, there are a number of restrictions. Keep in mind that Amazon is able to reduce the prices because you are agreeing to lock yourself into a usage mode. In order for you to win, they need to win too! What are the restrictions? From the FAQ, I see these:

  1. You can purchase 1 to 20 instances through website. Instances 21+ require special permission (though it doesn’t look onerous).
  2. Reserved instances live in one and only one availability zone. You are locked into that one for the contract duration. This shouldn’t be a huge restriction since, even when you purchase ahead of time, you come out ahead after consuming 20% of your hours in a high CPU contract and after 30% of your hours in the standard plans
  3. Once you purchase an instance type, you can’t convert things to a different instance type later. You stick with what you purchased. Again, risk is low since if you made a mistake, you can throw away 69% of your hours and still come out ahead of the pay as you go route.
  4. As mentioned above, if you don’t use it, you lose it. Unconsumed hours disappear after the 1 or 3 year term.

This looks like a good deal. I can’t wait until the comparable Windows plan is rolled out!

Leave a comment

Flying Above the Clouds

I originally presented this talk to the Azure Cloud Computing User Group on February 25, 2009. Thanks to Bryce Calhoun for inviting me to present! The original meeting announcement had this summary:

Scott Seely, Architect at MySpace, will kick off the meeting with a 20-30 minute overview of the top three cloud computing offerings available today: Google App Engine, Amazon EC3 and Azure Services. His discussion will be primarily focused on a compare/contrast of the functionality and features inherent to each platform.


var videofile = “Flying Above the Clouds.wmv”;

Leave a comment

F# Seq.fold

A lot of the business code we tend to write deals with taking some collection and producing some fact about that collection. Examples include:

  • Taking all the line items in a sales order and producing a total value of the order.
  • Concatenating a set of order lines to create an order.

In F#, one can take a sequence of items and fold it to return another item representing some truth about that collection. This is done via the Seq.fold function. Typical invocation involves taking some collection, passing that collection via the pipeline operator, |>, to Seq.fold. Seq.fold then takes a function that has two values passed to it: an accumulator and the next value in the collection. Each value is folded into the accumulator in some fashion– if summing up numbers or concatenating strings, the accumulator is just another number or string. On each successive iteration, the return value appears as the accumulator to do more work. The accumulator can also be a different type from the list. Below, we have two examples:

  • sum x calculates the sum of a sequence of numbers.
  • concantenate x takes a sequence of objects and returns the result of concatenating all the string representations together. The example uses the characters ‘a’ to ‘z’.

    1 #light


    3 open System

    4 let numbers =[1..100]

    5 let letters=[‘a’..‘z’]


    7 let sum x = x |> Seq.fold(fun acc a -> acc + a) 0

    8 let concatenate x =

    9     x |> Seq.fold(fun acc a -> String.Format("{0}{1}", acc, a)) ""


   11 let doWork=

   12     printfn("%d") (sum numbers)

   13     printfn("%s") (concatenate letters)

This writes:


Yet another nifty technique to add to your toolbox.

Leave a comment

Method Overloading in F#

In my goal to learn F# better, I’m doing all of my recreational development in the language. This gives me lots of learning opportunities (better known as WTF moments). I was implementing a MembershipProvider for an ASP.NET web site where the datastore is not SQL. By and large, MembershipProvider requires that you implement uniquely named methods. It does exposes a pair of abstract methods that one must implement. In C#, they look like this:

    public abstract MembershipUser GetUser(

        string username,

        bool userIsOnline);


    public abstract MembershipUser GetUser(

        Object providerUserKey,

        bool userIsOnline);

These two methods seemed pretty natural to overload in F#. I just wrote these stubs:

        override this.GetUser(providerUserKey: obj, userIsOnline: bool) : MembershipUser =



        override this.GetUser(userName: string, userIsOnline: bool) : MembershipUser =


The compiler didn’t like this, telling me

Duplicate definition of value 'AwsMembershipProvider.GetUser.3.override'

No amount of fiddling with the signature produced results. I was at a loss, so I pulled out the Object Browser in VisualStudio and focused on the FSharp.Core assembly. This looked like a job for a special attribute– F# seems to handle interop with the object oriented world via attributes and a few keywords. None of the keywords looked right. That’s when I found Microsoft.FSharp.Core.OverloadIDAttribute. Clicking on the class in the object browser, I learned this:

Adding the OverloadID attribute to a member permits it to be part of a group overloaded by the same name and arity. The string must be a unique name amongst those in the overload set. Overrides of this method, if permitted, must be given the same OverloadID, and the OverloadID must be specified in both signature and implementation files if signature files are used.

Now I got it– the overload didn’t work because both methods had the same arity (number of arguments). I needed to tell the compiler that these two methods looked the same, but have different IDs for the overload set. This is what got me to compile:


        override this.GetUser(providerUserKey: obj, userIsOnline: bool) : MembershipUser =




        override this.GetUser(userName: string, userIsOnline: bool) : MembershipUser =


Leave a comment

Crossdomain Silverlight Hosting

At work, I had a need for a line of business monitoring application to figure out server health. Due to the nature of the monitoring, it made sense to write this as a MySpace Developer Platform application, hosted in the browser. The display needs required a Rich Internet Application interface, meaning Flash, Silverlight, or heavy AJAX. I chose Silverlight, just because. Now, MySpace doesn’t allow one to publish a Silverlight application, but that didn’t stop me from writing an app for my own personal consumption. Given the nature of the application, I needed to host the Silverlight XAP file on a server separated from the JavaScript and web page that displayed the application. Silverlight doesn’t like having JavaScript call into it unless the application manifest says that it is OK. It took me several hours to figure out the nature of why my scriptable objects, which worked fine in my test environment, failed in production. Living on two servers busted things. If you host the Silverlight XAP file on a domain that is separate from your web page, you need to declare the following in the Silverlight application’s manifest:

<Deployment xmlns=""






ExternalCallersFromCrossDomain supports two values: NoAccess and ScriptableOnly. It is secure by default, setting NoAccess. Since I needed JavaScript from a different domain (a different web site) to access the scriptable members of the, I had to set this to ScriptableOnly.

FWIW, this bug followed the Seely Bug Fix Complexity Rule: the longer you spend troubleshooting a bug, the smaller the fix will be. Time spent troubleshooting: 4 hours. The bolded item above shows the fix.

Leave a comment

Dollhouse Blows

I just got done reading Penny-Arcade’s 2009-2-27 post on Joss Whedon’s Dollhouse. I had high expectations for this show. I waited for the show to be ready for my Media Center to record on a regular basis. The promos looked interesting and he did have a reputation. A few weeks ago, that first show appeared in Recorded Shows on my computer. My wife and I fired it up. 20 minutes into the show, we looked at each other, said "This is crap. Let’s delete this thing from our regular recordings and go wash the dishes." Yes, dishwashing was more appealing than watching the remainder of the show. Furthermore, we had no desire to assault our senses with the show EVER AGAIN!!! The acting was horrible, the premise sucked (reminded by of My Own Worst Enemy without the decent actors). Maybe Whedon should listen to his comedy muse instead of the other ones. He wrote Buffy The Vampire Slayer. The translation to a TV show sucked. His recent work in 2008 on Dr. Horrible’s Sing Along Blog was a riot! The guy knows funny! But, his serious stuff makes me shudder.

Leave a comment