<p>A while back I moved my weblog to Azure websites, because it was just cheaper than the hosting I had. I'm happy with the service I'm getting from Microsoft and the way the weblog performs. Zero downtime so far and the pages are pretty fast. </p> <p>When Microsoft came up with the mobile services API I was pretty excited. If this thing is as good as the websites feature, they will get another bag of money from me and I will be putting mobile services in the cloud for my Windows 8 apps. Or so I initially thought.</p><!--more--><p>In this post I will take you on a tour through the new Mobile Services feature and talk a bit about how to use it and what you can expect when you start building a mobile service.</p> <h2>Creating a new mobile service</h2> <p>The mobile services preview of Azure looks much like the Azure websites feature in terms of how a new service is created. If you want to create a new mobile service, you can click the Large "New" button at the bottom of the screen in the management portal preview site. This will show a menu with various options for new services. One of the options is the Mobile service.</p> <p><a href="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/09/image.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/09/image_thumb.png" width="699" height="230"></a></p> <p>Click the mobile service and you will get a wizard that asks you for a name and a SQL database for the service. You can either use an existing database or create a new one. At the moment of writing, you can only create the database in East US, this is because all this stuff is still in preview status.</p> <p><a href="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/09/image1.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/09/image_thumb1.png" width="244" height="176"></a> <a href="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/09/image2.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/09/image_thumb2.png" width="244" height="176"></a></p> <p>After completing the wizard, you will see an overview page with a short tutorial on how to connect to your new service. Microsoft has made it really easy to work with mobile services, you can download the application directly from the portal. It's not complete obviously, but it does contain sample code and some pregenerated classes that make working with the mobile service a lot easier.</p> <h2>Working with data</h2> <p>Azure Mobile services are all about data, the service is a REST service. You can only invoke Read, Insert, Update and Delete operations on each table. If you need to query, you will need to construct that query on the client. There is no way to define queries on the server to make querying common datasets easier. Also, the database schema isn't fixed initially. Tables are filled with a schema once you insert the first data item into them.</p> <p>Because the schema is dynamic, you only need to specify tables on the management portal. They will get an ID column initially and that's it. There's currently no option to define the rest of the columns of a table. These are generated once you have defined an entity on the client and posted that to the service.</p> <p>You can create a new table by going to the data section of the mobile service in the management portal and click the large "Create" button at the bottom of the screen. In the screen that will pop up, you can enter the name of the table and the permissions for the table. These permissions determine who can enter data in the table and who can read the data contained in the table. By default Azure will set these permissions to a setting where everyone with an application key can modify and read the data. You can also choose to allow only authenticated users or everyone. </p> <p><a href="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/09/image3.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/09/image_thumb3.png" width="244" height="211"></a></p> <p>Once you have a table, you can access that table through the Mobile Services SDK on the client. There's an SDK for WinRT available, which you can <a href="http://go.microsoft.com/fwlink/?LinkId=257545" target="_blank">download from the Microsoft website</a>. Accessing the table is easy, first you need to have a MobileService instance in your application with the appropriate settings for the service and the API key for it. Once you have that, you can invoke GetTable<T>() to get the table for the desired entity. </p>
Since a few months, I switched completely to apple hardware. Reason being that I develop mobile apps including iOS apps, which require you to have a mac. It's been a very fun transition, I learned a lot of new stuff that inspired me to do things a little different on Windows as well.
One of the things I learned is how to use ruby for building test scripts and small utilities. Why ruby? Well, it's easy to learn. Also, it's used in the test tools I use for testing my Xamarin based apps. When you want to run Calabash tests, you have to know a little bit about Ruby development. Now this may sound like it was a breeze to get everything working, but trust me, it wasn't so trivial when I started using these tools.<!--more--> <h2>The update story of Apple</h2> Using ruby to run tools like Calabash on Mac OS X is a bit problematic. Apple does support Ruby out of the box on every apple machine. However, the version that you get with the box is old. The ruby community has moved on to version 2.0.0 while Apple is stuck on 1.8.2 on my machine. This means that several tools that use Ruby no longer work on Mac OS X.
A while back I started learning more about specification by example, because of my role as a proxy-product owner (I replace the product owner when he's not around and spend a lot of time with him working out the specs for our application). He somehow managed to get me quite excited about it (Thanks Joop, you did it :P).
After he told me about specification by example a while back, I learned a lot more about its uses during development when I started exploring Calabash-Android.