APIMASH Quakes & Astronomy

A bit overdue, but I just realized I never really announced the APIMASH project we’ve been working on.  It’s up on github.   The purpose of the project is to illustrate how to go about constructing a mashup application from a variety of data sources.  We’re adding to the project all the time, and have both Windows 8 and Windows Phone app starter kits to get you going.  What makes the APIMASH concept so fun, to me, is that we’re consuming real-world data.   Whether you use one of our APIs we consume in the kits, or find one through a site like Mashery, Programmable Web, the Azure Datamarket, or others, mashup applications are a LOT of fun to create.  Because many mashup applications use similar patterns, consume similar JSON data, etc., you’ll see it’s easy to adapt the code to just about any scenario. I’ve got a couple of examples in the APIMASH project, and more to come soon.  The first one is an earthquake sample that illustrates how to consume a data feed from the USGS that contains earthquake information for a given time frame.  That data is then plotted on a Bing map.   This starter kit is available as both a Windows 8 app and Windows Phone app.   The starter kits are very bare-bones (intentionally) – a more complete version based off these templates is available in the Windows Store as an app called Earthquake Explorer.   Conceptually, the apps are the same, but the finished app in the store illustrates what you can do by adding a bit of polish to the app.  You can read more about creating a great mashup using this app as an example here in these blog posts. Starter Kit: Completed app: The other project I created in the APIMASH project is called Messier Sky Objects, which is available in the Windows Store as Messier Object Explorer.   This is a mashup (of sorts) that combines Worldwide Telescope with the data of all Messier objects, a collection of objects like nebulae, galaxies, clusters, et. al.  By using the Worldwide Telescope JavaScript API, it’s simple to create great-looking astronomy apps (in fact, many of my apps, listed in my side-bar on my home page, use this as a template). So what’s next?  I just released Brew Finder for Windows 8.   This app uses the brewerydb.com API to show local breweries and is available in the Windows Store here.   I hope to have a nice sample in the APIMASH project soon based on this project. Have another sample you’d like to see?  Leave a comment and we’ll review it on the next team meeting!

Microsoft DevRadio: (Part 2) APIMASH – Earthquake and Messier Sky Object API Starter Kit for Windows Store Apps

My latest DevRadio episode has been published – here are the details! Abstract: In today’s episode Brian Hitney demos for us the Messier Sky Object Explorer and Earthquake Starter Kits for your Windows 8 apps. Tune in as he walks us through both APIs and show us how easy it is get started building for Windows 8. Check out all the APIMASH Starter Kits here Download Earthquake APIMASH Starter Kit Download the Messier Sky Object Explorer APIMASH Starter Kit Next Steps: Step #1 – Download the Tools for Windows 8 App Development Step #2 – Download Visual Studio Express for Windows 8 Step #3 – Start building your own Apps for Windows 8 Subscribe to our podcast via iTunes, Windows Phone Marketplace,  or RSS If you're interested in learning more about the products or solutions discussed in this episode, click on any of the below links for free, in-depth information: Blogs & Articles: Brian Hitney’s blog APIMASH Starter Kits (all) APIMASH on Channel 9 Download the Earthquake APIMASH Starter Kit Download the Messier Sky Object Explorer APIMASH Starter Kit Download the Earthquake Explorer app for Windows 8 Videos: 7 Part Series – Using Windows Azure to Build Back-End Services for Windows 8 Apps Virtual Labs: Windows 8  Virtual Labs Download MP3 (Audio only) MP4 (iPod, Zune HD) High Quality MP4 (iPad, PC) Mid Quality MP4 (WP7, HTML5) High Quality WMV (PC, Xbox, MCE)

Creating a Great Mashup using Windows Azure

This post details features used by Earthquake Explorer, a Windows 8 app that displays earthquake information on Bing maps.   Earthquake Explorer was based off of the Earthquakes mashup starter kit on github. Creating a mashup is pretty easy in Windows 8 – creating a great one requires a bit more work.   In this case, I'm working with the USGS earthquake GeoJSON feeds, a very easy-to-use feed that contains earthquake information for either the past hour, day, week, or month.   Overall, it’s a pretty ideal feed.  But, if you search for and install virtually any earthquake app in the store, you’ll see the limitations quickly.  While some apps allow some lightweight filtering of the data, there really isn’t a concept of search, pagination, and server-side filtering. To solve these limitations, we’d typically need to build out a fairly robust back-end server; fortunately, Windows Azure Mobile Services makes this really easy so let’s get started. First thing you need is a Windows Azure account (here’s a link to get a free trial).  To get the pricing stuff out of the way first:  Windows Azure Mobile Services currently offers a free tier (even beyond your trial), however, quite likely you’ll want to use a database behind the scenes, and that starts at $4.95/mo.  EDIT:  Good news!  SQL Databases now offers a free tier for up to 20MB databases. Multiple Mobile Services can share the same database as they are all schematized.  With your account ready to go, log in to the Windows Azure portal and select  Mobile Services in the left nav.   Next, click the New button in the bottom left to create a new Mobile Service (which I’ll just refer to as WAMS).  The New flyouts are context aware, so it should be ready to create a new WAMS but, just to verify, you should see something like this: After a few moments your service is set up and ready to go.  You will need to create a new SQL Database if you don’t already have one.  The default page of your WAMS should look like this, and it’s full of great info for creating new or leveraging WAMS in existing apps: Let’s click on the data link highlighted above to create a table to store our data.  We’ll call it ‘earthquake’, and we’ll also make it so only scripts and admins can modify the table, all users can read the table, like so: By default, WAMS is configured with dynamic schema, which means we can start inserting right away and the columns will be added dynamically to fit the objects we pass in.  This is perfect for development.  The next thing we’ll want to do is go over to the scheduled jobs page: After clicking create a scheduled job, give it a name like ‘fetchquakes’ and leave it run on demand only.   The job will be created and if you are looking at the details of the job by clicking on it, you’ll see a fairly empty screen – we don’t care about the configuration and schedule right now, we simply want to add a script that runs as part of our job.  Click the script button: Let’s start with a simple script.   Ideally we’ll go out to the service and use live data, but this will get us started: function fetchquakes() { var eq = {place: "Los Angeles", mag: 5.3, timestamp: new Date()}; var quakesTable = tables.getTable('earthquake'); quakesTable.insert(eq); }   .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } If we run this script (by clicking the Run Once button near the bottom/middle of the screen) and then navigate over to our table in the Data tab, we’ll see the row in the table: The nice part about this, too, is that it did a good job of figuring out the column types: However, we could go into the database itself and change the column definition if we wanted to.  We’ll wrap up the post here to keep this from becoming a book, but in the next post we’ll dive a bit deeper into consuming the live feed and storing that in the database.

APIMASH and Intro to Game Dev Raleigh

I’m really excited to be hosting a few events in the Microsoft Raleigh office focused on Windows 8 development.  The first on revolves around our APIMASH starter kits – a great way to get started building mashup style applications in Windows 8, with templates and examples in both C# and HTML/JS.  The other sessions are intro to gaming, developing some simple games using Construct2, and GameMaker/other frameworks as time allows.   Here are the events/times: APIMASH: Tue 6/4/2013 from 10:00am to 2:00pm and Tue 6/11/2013 from 10:00am to 2:00pm Intro to Gaming: Wed 6/5/2013 from 10:00am to 2:00pm and Wed 6/11/2013 from 10:00am to 2:00pm Here’s a more official description of each event: Game Development for Beginners In this beginner level workshop we will cover the basics of game design, programming and publication. We will build a casual game and publish it to the Windows Store. This workshop is great for students, hobbyists and professional developers who want to learn the basics of game development and publish their first app to the store as no programming skills are required! Windows 8 App Mashup Series In this workshop you will learn how to develop Windows 8 apps based on well-known web service API's such as Twitter, Meetup, ESPN, EchoNest and data from the World Health Organization WHO. Your app could entertain or even change the world. This workshop is great for students, hobbyists and professional developers who want to learn the basics of app development and publish their first app to the store. For more info, stay tuned to the MSDN Events page!

My Apps

Dark Skies Astrophotography Journal Vol 1 Explore The Moon
Mars Explorer Moons of Jupiter Messier Object Explorer
Brew Finder Earthquake Explorer Venus Explorer  

My Worldmap

Month List