Foursquare Playground

April 12 2011

I’ve had the good pleasure of working with Foursquare in conjunction with Vectorform and the IE9 folks to unveil new features of the Foursquare Playground. Using CSS3 wizardry, geo-location in the browser, SVG and some serious Javascript jujitsu -- not to mention mad design chops -- Foursquare Playground shows off what is possible using nothing but web standards, serving to manifest a novel and illuminating view on the exponentially growing Foursquare dataset of realtime spatial gameplay.

Check out some screenshots:

1

2

KEXP Archive in IE9 Launch and Mellow Johnny's at SxSW

March 21 2011

KEXP Archive is a very cool HTML5 application that uses the KEXP dataset to show off a cool visualization. The KEXP data set represents nearly 10 years of radio playlists and includes over 700,000 tracks with album art, the date and time each song was played, and DJ names. The result, created by Stimulant, can be seen at http://kexparchive.org. Pretty rad.

This application was featured in the IE9 launch at SxSW -- watch it demonstrated in a video here.  Also, it was shown while KEXP broadcasted live from SxSW at Mellow Johnny's, Lance Armstrong's bike shop. Here's some pics of the KEXP IE9 kiosk in the bike shop:

 

 

 

Ze Frank and Star.Me at IE9 Launch

March 17 2011

Check out Ze Frank’s presentation at the IE9 launch event at SxSW:

 

Getting Request.Form Data Out of XDomainRequest In ASP.NET

July 12 2010

I am using the XDomainRequest object in IE8 and IE9 to do cross domain posting.  However, I hit an issue where I couldn't seem to get at the data I was posting: the Request.Form collection contained nothing yet I was clearly sending it. I then found this post:

http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx

which states: "we restricted the content type to text/plain but didn’t allow the caller to specify that the data was in application/x-www-urlencoded form. This is problematic because server-side frameworks (e.g. ASP, ASPNET, etc) will only automatically parse a request’s fields into name-value pairs if the x-www-urlencoded content type is specified.

To workaround this issue, server code that currently processes HTML Forms must be rewritten to manually parse the request body into name-value pairs when receiving requests from XDomainRequest objects. This makes adding support for the XDomainRequest object more difficult than it would be otherwise."

Okay, so how does one do that? Well, turned to be pretty simple. I just had to access the Request.InputStream directly, as follows:

           //set the header to support XDomainRequest

           Response.Headers.Add("Access-Control-Allow-Origin", "*");

           //now extract the data out of the stream

           System.IO.Stream str;

           String jsonContents;

           Int32 counter, strLen, strRead;

           // Create a Stream object.

           str = Request.InputStream;

           // Find number of bytes in stream.

           strLen = Convert.ToInt32(str.Length);

           // Create a byte array.

           byte[] byteArray = new byte[strLen];

           // Read stream into byte array.

           strRead = str.Read(byteArray, 0, strLen);

           // Convert byte array to a text string.

           jsonContents = Encoding.UTF8.GetString(byteArray);

Using Stringify With the New window.msPerformance in Internet Explorer 9

July 6 2010

I've been playing with the new window.msPerformance that's part of IE9 as explained in this blog post: http://blogs.msdn.com/b/ie/archive/2010/06/28/measuring-web-page-performance.aspx. Of course, the main thing you want to do is capture this data. The blog post mentions that you can use the stringify method to serialize the object to JSON and then send the diagnostics back to the server.  Well, I tried this with no luck. Here's what my code looked like:

   <script type="text/javascript" >
        function test() {
            if (window.msPerformance != null) {


                var json = JSON.stringify(window.msPerformance.timing);
                alert(window.msPerformance.timing);
                alert(json);
            }
        }
</script>

Even though the performance object was populated, the serialization to JSON failed.

I did some digging around and learned that the native JSON method in IE9 doesn't successfully stringify native objects, like anything hanging off window or document.  However, I was able to work around this by using Crockford's JSON class from here: http://www.json.org/js.html.  The one thing I had to do was to change the prototype to JSON2 so that the browser's native JSON prototype wasn't called. Then it worked!

Using Stringify With the New window.msPerformance in Internet Explorer 9

July 6 2010

I've been playing with the new window.msPerformance that's part of IE9 as explained in this blog post: http://blogs.msdn.com/b/ie/archive/2010/06/28/measuring-web-page-performance.aspx. Of course, the main thing you want to do is capture this data. The blog post mentions that you can use the stringify method to serialize the object to JSON and then send the diagnostics back to the server.  Well, I tried this with no luck. Here's what my code looked like:

   <script type="text/javascript" >
        function test() {
            if (window.msPerformance != null) {


                var json = JSON.stringify(window.msPerformance.timing);
                alert(window.msPerformance.timing);
                alert(json);
            }
        }
</script>

Even though the performance object was populated, the serialization to JSON failed.

I did some digging around and learned that the native JSON method in IE9 doesn't successfully stringify native objects, like anything hanging off window or document.  However, I was able to work around this by using Crockford's JSON class from here: http://www.json.org/js.html.  The one thing I had to do was to change the prototype to JSON2 so that the browser's native JSON prototype wasn't called. Then it worked!