# Monday, October 29, 2012

Building Windows Store Apps with MVVM–NOVA Code Camp talk

Yesterday I gave a talk at NOVA Code Camp on building Windows Store (Windows 8) apps using the MVVM pattern. I covered the core concepts of the pattern and why you might want to use it, as well as emphasizing that it is less important in a Windows Store application because you shouldn’t be building apps with hundreds of screens in that world, but still a good thing to do for testability and good separation of concerns that MVVM gives you.

The slides and demos from the talk are below for your perusal.

Slides

Demos





Monday, October 29, 2012 12:02:49 AM (GMT Standard Time, UTC+00:00)
Comments [0]  | 


 # Thursday, August 9, 2012

VSLive! Redmond Slides and Demos

I’m giving two talks today at VSLive! Redmond. You can grab the slides and demos below.

Blissful Separation of Concerns with MVVM – core concepts and implementation of MVVM

Slides    Demos

Building Extensible XAML Client Applications – using MEF, MVVM, and Prism to build highly extensible and loosely coupled XAML apps

Slides   Demos





Thursday, August 9, 2012 6:14:56 PM (GMT Daylight Time, UTC+01:00)
Comments [0]  | 


 # Wednesday, August 8, 2012

Setting up a Minecraft Server (or other software) in the Cloud on a Windows Azure Virtual Machine

My son’s latest addiction is the game Minecraft,  a single or multiplayer game that has a client-server architecture to it, millions of users, a newly released version (as of last week), and a vibrant community. When I first saw the game I was put off by the seemingly crude graphics (a cube-constructed world with overlaid textures on the blocks), but I quickly got over that when I saw how it was both fun to play, sparks creativity in the way it has you gather materials and craft things in survival mode or encourages major creativity in building structures and contraptions in creative mode. I’m also impressed by the huge and vibrant community of people playing and extending the game with plug-ins (mods), custom maps, and public server worlds you can go and play in through sites like http://planetminecraft.net.

156faa1b_Minecraft-logo    windows_azure_small

Setting up a Minecraft Server

With Minecraft you can play single player on a local machine, or you can connect to remote servers. If you are a power user or someone with some IT chops you can easily set up a server of your own for which there are dozens of simple tutorials out there. It basically involves downloading the server software, running it, disabling any intervening firewalls, and typing in an IP address on the client to the server machine.

Of course what comes next is “Dad, can my friends connect to my Minecraft server?”

So I went down that route and configured our home router to do port forwarding to allow open internet traffic to come into the port that Minecraft uses to a machine on our home network. Not too tough and again dozens of tutorials out there that will walk you through that. The scary part there is poking holes in your firewall to allow unknown (and sometimes malicious) parties into your home network and onto a machine that may have other personal information on it. You also have the fact that one of the most important factors in smooth gameplay when connecting to a server is the bandwidth of the connection. If you don’t have a screaming fast internet connection, or have bandwidth limitations on your connection, you could simply be setting up an unusable server in the first place.

Enter Windows Azure Virtual Machines

Being a Microsoft Windows Azure Insider, it naturally occurred to me that there is some infrastructure out there that is optimal for this kind of shared access – Windows Azure. Windows Azure has a lot of capabilities to it including shared host roles, storage, access control and more – what is generally referred to as PaaS – Platform as a Service. But a relatively new offering from Windows Azure is IaaS – Infrastructure as a Service – which includes virtual machine hosting.

The benefits of doing something like this on a Windows Azure virtual machine are many:

  • Full control of the machine
  • Very high bandwidth connections to Windows Azure data centers
  • Scalable architecture to accommodate different amounts of load
  • Redundancy and geo-distribution for high availability if appropriate
  • Simple set up and administration

If you, like me, are just trying to get something up and running for your kids and don’t want to have to spend any money at all, then setting up a server on a home computer is going to be your cheapest option. But it does have the downsides of not being able to support many players, possibly slow /  glitchy performance, and raises some security concerns about exposing your machines and network.

With Windows Azure you can set up a free 3 month trial that includes 150 compute hours (the primary unit of billing for an Azure virtual machine), which means you can run for a month continuous free, or you can shut it down at times and only spin it up while it is in use and potentially stretch that 150 hours over a 3 month free period. After that, if you stay with an “Extra Small Instance” that can accommodate up to about 8 players concurrently for less than $10 per month.

So lets step through what I did to get this set up and running.

Setting up a Windows Azure Account

If you don’t already have a Windows Azure account, you can go and create a free trial easily here.

FreeTrial

After setting up your account, you will follow the link/button in the upper right corner to the Portal. At the time of writing this, they are switching the management portal over from an old one to a new one, so you might be prompted to use the preview portal. If so, click to use the preview one. You will be presented with a welcome tour the first time in, feel free to go through that to get a sense of what all is there.

The virtual machine capabilities of Windows Azure are still in preview status, so initially you won’t see anything about virtual machines in your portal. To get to them, you can click the + at the bottom of the screen for adding new services, and follow the link from the virtual machine option to sign up for the preview program. Depending on when you are reading this, that may no longer be needed if you see virtual machines listed in the main navigation on the left in the portal. Follow the link from the greyed out virtual machine item and click the Try It Now button. Then follow the link back to the management portal and you will see virtual machines as one of your services.

Virtual machines

Creating your first virtual machine

Click on the link to create a new virtual machine, and chose the option to create from the gallery. I chose to use Windows Server 2008 R2 SP1, June 2012 template, but you can choose one of the others as appropriate for your needs.

In the step for VM Configuration, enter a virtual machine name – this is what will be listed in your portal and has a length limitation to it, a password for the admin account, and a size. The Extra Small size is going to be the cheapest once you start paying (<$10/mo), but your free trial includes a small instance, so if you want more memory for better performance during your trial period, leave the default of small. You can change the sizing of your virtual machine later by deleting it and adding it back with a different instance size so you could switch to extra small once you have to start paying.

VMConfiguration

In the VM Mode screen, you pick your VERY IMPORTANT DNS name. This is what users will use to connect to your virtual machine as an address from the internet, so think about what you want ahead of time. The name you pick will have to be unique across all Azure virtual machines already out there, so you may not be able to use something too simple.

VMMode

The other defaults in this step will be fine. For the final step, just leave the Availability Set Not Set and click the check mark to complete the wizard. You will see your virtual machine listed now and it will start in a state of “Provisioning”.

Provisioning

It will transition through “Starting (Provisioning)” to “Stopped” to “Running (Provisioning)” over a period of about 5-10 minutes. It is important to realize that stopped virtual machines still consume compute hours. The reason is that hardware resources are still reserved for them an unavailable for other customers. You have to remove your virtual machine to stop incurring charges for it, which I’ll talk about later in this post.

Connecting to your virtual machine

Once the status reaches at least “Running (Provisioning)” you can click on the Connect button at the bottom. This will try to open an rdp file, which is a Remote Desktop connection file. Click on the Open prompt in the browser or download the file and then open it to open Remote Desktop Connection and connect to your virtual machine. Accept the various connect prompts and enter the password you chose in the earlier step for the admin password to connect. Next thing you know you will be staring at the desktop of your newly provisioned machine with the Initial Configuration Tasks window in front of you.

Opening the Minecraft ports in the Windows Firewall

Minecraft uses port 25565 by default, so we need to unblock that in preparation for running Minecraft server. Since the Windows Firewall is one of the tasks in the Initial Confguration Tasks window before us, we might as well tackle that now. Click on Configure Windows Firewall at the bottom of the window. Click on Advanced Settings, then Inbound Rules in the tree. Click on New Rule in the upper right, then select Port and click Next at the bottom of the dialog. Type in 25565 in the specific local ports entry and click Next. Keep “Allow the Connection” in the next step, then keep all the checkboxes checked in the next step. Give the new rule a name of Minecraft in the next step and click Finish.

Turn off Internet Explorer ESC

Internet Explorer has Enahnced Security Configuration enabled by default. This will interfere with some of the downloads you need to do to get Minecraft installed, so you need to turn this off. In the Server Manager window that came up when you went to advanced firewall settings, there is a link in the bottom right corner to configure ESC. Click on that link and disable ESC for Administrators.

ServerManager

Install Java

Minecraft is built on Java, so you need to get the Java platform installed. The OS of the Windows Azure virtual machine I selected was Server 2008, and they use the 64 bit variant. So you will want to make sure you get the 64 bit version of Java 7, not the 32 bit one that they want to install by default. To do this, fire up Internet Explorer from the start menu, accepts the defaults on the initial configuration of IE, and head on over to www.java.com, click the Free Download button, and then find and click the See All Java Downloads link. Download and install the 64 bit version for Windows.

Installing Minecraft Server

While Java is installing, you can head over to minecraft.net and find the download button on the right margin. You will have to set up an account ($27 annual), but I’m assuming you are well past that point if you want to set up your own server already. You could download the Minecraft Server.exe, but the .jar version gives you better configurability of the memory it will use, which is important for the memory constrained extra small instance or small instance in Windows Azure. So download the minecraft_server.jar file to the desktop of your virtual machine. It actually downloads it as a .zip file extension even though it is really a .jar file.

Go into your Windows Explorer Folder and Search Options and disable the option to “Hide Extensions for Known File Types” so that you can see the .jar file extension on the file you just downloaded.

Once you see the .zip file extension, change it to .jar.

Right click on the desktop and select New > Text Document. Name it Minecraft.bat and accept the file extension change. If you are not prompted for changing the file extension then you don’t have the option off to not hide file extensions and the file won’t run as a batch file. Then right click on the file and select Edit. Enter this text in the bat :

@ECHO OFF
SET BINDIR=%~dp0
CD /D "%BINDIR%"
java -Xmx512M -Xms512M -jar minecraft_server.jar
PAUSE

If you are using a small instance instead of an extra small instance for your virtual machine, you can bump both of those numbers up to 1024 instead of 512. Those affect how much memory the Java virtual machine will try to consume. Save the file and close it.

Create a folder on the desktop (call it Minecraft or whatever you like and move both the minecraft_server.jar and the Minecraft.bat file into it.

Then double click on Minecraft.bat to run it.

You should see the Minecraft server start up and it will create some additional files in the folder. For the full details of those files and what they do for you, see the Minecraft Server topic on the Minecraft Wiki.

Configuring endpoints

Besides the firewall built in to the Windows OS that we opened the Minecraft port on earlier, you also need to open ports in the Azure infrastructure so that people can get to your virtual machine in the first place. To do that, you go to the Endpoints button at the top, add a new endpoint, give it a name (i.e. Minecraft), and specify the external and internal ports. For a default Minecraft setup, those will both be 25565.

Play!

At this point you should be able to go into the Minecraft game on any internet connection computer, Add a Server, and enter the address of your server in the form mymcserverdns.cloudapp.net.

Deleting your virtual machine to avoid incurring charges

As mentioned before, your virtual machine will continue to consume compute hours while it is running and even if you simply shut it down. You need to delete or remove the virtual machine to stop the clock ticking on your compute hours. Deleting your virtual machine does not mean you have to set it all up again when you want to start it up again. When you delete a virtual machine, the machine image is stored into your storage account, and you can easily create a new virtual machine based on that image and it will start up with everything just as you left it before you deleted the virtual machine.

To do this, go into the management portal, open your virtual machine page, and click on the Delete button at the bottom.

DeletingServer

 

Recreating your virtual machine to spin it up again

After your virtual machine has been deleted, a “Cloud Service” with the same name will be created that holds the DNS name for your virtual machine. You will need to delete that cloud service to recreate your virtual machine with the same DNS. So go select the cloud service with the same name as your virtual machine and delete it.

Next you go back to the virtual machine section and add a new virtual machine. Select the Gallery, and you will see your previous virtual machine listed at the bottom.

Recreate vm

Select it, and in the next step, reclaim your previous DNS name and you are off and running again. When the machine finishes provisioning, you will have your previous machine as you left it.

If you want a little more automated process for doing this, as well as not letting someone else have the opportunity to grab your DNS name between when you delete it and reclaim it, you can follow use the powershell scripts outlined here:

http://michaelwasham.com/2012/06/18/importing-and-exporting-virtual-machine-settings/

Other options

Once you want more than about 10 concurrent players supported, a Windows Azure machine is going to get more expensive than some of the Minecraft hosting providers out there, for example servercraft.co.

Wrapping Up

Whether you are trying to set up a Minecraft server or some other kind of internet accessible piece of software, Windows Azure provides an attractive and easy to use hosting option. Setting up your own virtual machine you have full control over installing whatever software you need and configuring the box. The machine is sitting in a high bandwidth data center that can handle traffic much better than your own machines through a home or small office connection. You don’t have to worry about exposing your own machines or network to the open internet because you can put what you want to be publicly accessible out in the cloud, isolated from your own stuff.

Hope you found this little tutorial to be helpful.





Wednesday, August 8, 2012 3:43:51 AM (GMT Daylight Time, UTC+01:00)
Comments [0]  | 


 # Wednesday, June 27, 2012

MADExpo and CapArea.NET talks

Last night I spoke at CapArea.NET and presented a longer variant of the talk I am giving today and tomorrow at the MADExpo conference in VA. I’m also giving a talk on the Single Page Application capabilities in development for ASP.NET and the client side Upshot library that provides a lot of its capabiities.

Here are the slides and demos for those talks:

Embrace Async    Slides    Demos

Rich HTML 5 Client Data Applications with Upshot    Slides    Demos





Wednesday, June 27, 2012 8:29:18 PM (GMT Daylight Time, UTC+01:00)
Comments [0]  | 


 # Friday, June 8, 2012

Stronger User Access Control (UAC) Minimum in Windows 8

I recently stumbled over a new feature in Windows 8 that some people, especially developers may want to be aware of. In Windows 7 if you were logged in with a user account associated with the Administrators group, and you turned the User Access Control (UAC) slider down to its minimum level, you were basically running all apps as full admin permission.

Once I started developing in Windows 8, I tried setting things up the same way but was a little baffled when some things started prompting me for running as admin or failing for permissions reasons. For example, launching a particular solution I was working on in Visual Studio 2010 for debugging resulted in this:

AdminPermission

And several command line scripts that I have to run on a regular basis for development were failing as well.

The fix was simply to make sure I launched whatever process was failing with “Run as Administrator”. But that seemed weird because I thought I was running as Administrator.

I did some digging with the Windows 8 team and found out that in fact they have made some changes in UAC. Even though the dialog looks the same as it did in Windows 7 and says “Never Notify”:

6-8-2012 1-30-02 PM

The underlying meaning of that setting is a little different. Instead of “UAC off” it really means “UAC auto-approve/never prompt” but not actually off. If something actually needs full admin permissions to run, you will have to explicitly run the process as Administrator.

The team also said that apps that require implicit Administrator permissions to run are considered obsolete and only partially supported.

So if you have been using Administrator permissions required as a crutch in your applications, get over it. And as a dev, you might sometimes have to explicitly start processes as Adminstrator even if you did not in Windows 7.





Friday, June 8, 2012 8:51:38 PM (GMT Daylight Time, UTC+01:00)
Comments [0]  | 


 # Tuesday, May 29, 2012

Upcoming VSLive! Redmond Talks - Register Now!

I’m really looking forward to speaking at VSLive! Redmond this year and think it is going to be a great conference. As usual there is a star studded lineup of speakers with great topics.

I’ll be giving two talks – Blissful Separation of Concerns with MVVM, and Building Extensible XAML Client Applications.

If you are interested in the conference, now is the time to register since the super early bird special is up on June 1 and the early bird doesn’t go too far beyond that. Click on the image below to get registered now for a great conference!

VSLRED12 Speaker Incentive_Noyes





Tuesday, May 29, 2012 11:55:50 PM (GMT Daylight Time, UTC+01:00)
Comments [0]  | 


 # Friday, May 25, 2012

Book Review: Microsoft Silverlight 5 and Windows Azure Enterprise Integration

I finally got the time to finish reading and reviewing the book Microsoft Silverlight 5 and Windows Azure Enterprise Integration. By the way, the initial promotion of the book is up at the end of May, so now would be a good time to go buy.

My high level summary is this:

I think this book is an outstanding read and resource for developers and architects who are getting started with Windows Azure and what is involved in building cloud-based solutions. It does a great job of covering most of the capabilities exposed by the Windows Azure platform, and tying them into a Silverlight application context through the samples presented throughout the chapters. You do not have to be a Silverlight client developer to benefit from this book – any .NET developer who wants to start building applications leveraging the Windows Azure cloud can start with this book to get a great sense of what the individual features of Windows Azure are and how they can tie into either a web-based front end client like Silverlight or ASP.NET or even how to tie them in with back-end services that support something like a WPF or Metro client app (even though those are not explicitly covered in the book).

I won’t do a chapter-by-chapter break down of the book, a quick look at the TOC will give a good sense of what is covered. One of the main downsides to this book I think is the title. It is less about Silverlight than it is about Windows Azure (and as mentioned, you definitely don’t need to be a Silverlight developer to get a lot out of the book if you are new to Azure), and the “Enterprise Integration” part of the title is kind of vague and misleading. The “integration” part is one of the strong aspects of the book, it does a good job of first educating you on what each of the Windows Azure services is, and then shows how to build applications that leverage one or more of those services in an integrated fashion.

You are not going to learn how to build Silverlight applications from this book, or even become an expert in Windows Azure. Each feature of Azure really needs a book unto itself to achieve expert level knowledge in it. But this book is great for building the big picture of what each Windows Azure capability is, what it does for your architecture, how to use it from a basics perspective, and also how to tie it in with other Azure services and your application architecture.

Some of the things you get expose to in the book are:

- How to get your development environment set up to do Azure development, as well as a good survey of related and useful tools for building Silverlight and web client application on Azure

- A good survey of all the Windows Azure features

- How to get web client and Silverlight client applications and services hosted in Windows Azure web roles

- Working with Azure queues, blob storage, and tables

- Working with SQL Azure, Entity Framework, WCF RIA Services, and OData (very light coverage on the latter three, but enough to see how they fit into an Azure deployment scenario on top of SQL Azure)

- Basics of securing your Azure hosted applications

- Scaling and using AppFabric Cache

Bottom line, think it is definitely a good read for someone wanting to get their hands dirty for the first time doing some cloud Azure development, especially (but not only) if you are a Silverlight developer.





Friday, May 25, 2012 1:24:58 PM (GMT Daylight Time, UTC+01:00)
Comments [0]  | 


 # Wednesday, May 16, 2012

VSLive! NYC Talks and Demos

I presented 4 sessions at VSLive NYC over the last two days and had a great time. I love the set up of this conference – not too spread out, good sized rooms, great attendees, and lots of great speakers.

Below are the slides and demos for those interested, enjoy!

Build Extensible XAML Client Applications:   Slides   Demos

Build Portable XAML Client Code and Resources:   Slides   Demos

Secure and Personalize Silverlight 5 Apps:   Slides   Demos

Learn to Behave – Extending XAML with Client Behaviors:   Slides   Demos





Wednesday, May 16, 2012 9:10:30 PM (GMT Daylight Time, UTC+01:00)
Comments [0]  | 


 # Saturday, April 21, 2012

Upcoming Book Review–Microsoft Silverlight 5 and Windows

I picked up a book that looks very interesting:

Microsoft Silverlight 5 and Windows Azure Enterprise Integration

A bit of a mouthful, but the table of contents looks very good. There are a lot of Silverlight books out there, but few that actually focus on all the other stuff you need to know outside the boundary of your client application - the hosting, services, and deployment to Windows Azure. Its got chapters focused on the hosting, working with Azure storage, RIA Services, OData services and more. I'll write up a review here in a couple weeks after I've had time to make it through it.





Saturday, April 21, 2012 10:24:12 PM (GMT Daylight Time, UTC+01:00)
Comments [0]  | 


 # Thursday, March 29, 2012

DevConnections Demos and Slides–Web API, Async, and Extensible XAML Clients

Today I am giving three sessions at DevConnections. The first on the new ASP.NET Web API, both defining and consuming WEB API and RESTful services from many client platforms. The second is on the new async patterns in .NET and WinRT with the Task-based Asynchronous Pattern, TPL, and PFX. The last is on building extensible XAML client applications.

You can grab the slides and demos below.

Leveraging ASP.NET Web API to Reach Many Clients :   Slides    Demos

Embrace Async:    Slides    Demos

Building Extensible XAML Client Applications : Sides    Demos





Thursday, March 29, 2012 9:48:01 PM (GMT Daylight Time, UTC+01:00)
Comments [0]  | 

















May, 2013 (1)
April, 2013 (2)
March, 2013 (2)
February, 2013 (2)
January, 2013 (2)
December, 2012 (3)
November, 2012 (1)
October, 2012 (1)
August, 2012 (2)
June, 2012 (2)
May, 2012 (3)
April, 2012 (1)
March, 2012 (2)
February, 2012 (2)
January, 2012 (1)
November, 2011 (4)
October, 2011 (1)
September, 2011 (2)
August, 2011 (1)
July, 2011 (1)
May, 2011 (5)
March, 2011 (4)
February, 2011 (2)
January, 2011 (3)
November, 2010 (4)
October, 2010 (1)
September, 2010 (5)
August, 2010 (5)
July, 2010 (6)
June, 2010 (8)
May, 2010 (2)
April, 2010 (2)
January, 2010 (1)
December, 2009 (3)
November, 2009 (2)
October, 2009 (3)
September, 2009 (3)
August, 2009 (2)
July, 2009 (3)
May, 2009 (3)
April, 2009 (2)
March, 2009 (1)
February, 2009 (2)
January, 2009 (2)
December, 2008 (1)
November, 2008 (2)
October, 2008 (5)
September, 2008 (4)
August, 2008 (2)
July, 2008 (1)
June, 2008 (2)
May, 2008 (2)
April, 2008 (3)
February, 2008 (6)
January, 2008 (3)
December, 2007 (1)
November, 2007 (1)
October, 2007 (5)
September, 2007 (1)
July, 2007 (3)
June, 2007 (8)
April, 2007 (2)
March, 2007 (4)
February, 2007 (1)
December, 2006 (2)
November, 2006 (9)
October, 2006 (5)
September, 2006 (3)
August, 2006 (2)
July, 2006 (4)
June, 2006 (5)
May, 2006 (10)
April, 2006 (4)
March, 2006 (2)
February, 2006 (12)
January, 2006 (7)
December, 2005 (2)
November, 2005 (15)
October, 2005 (6)
September, 2005 (7)
August, 2005 (3)
July, 2005 (10)
June, 2005 (11)
May, 2005 (7)
April, 2005 (8)
March, 2005 (6)
February, 2005 (2)
January, 2005 (6)
December, 2004 (3)
November, 2004 (5)
October, 2004 (2)
September, 2004 (5)
August, 2004 (13)
July, 2004 (6)
June, 2004 (14)
May, 2004 (17)
April, 2004 (12)
March, 2004 (8)
February, 2004 (10)
January, 2004 (14)
December, 2003 (9)
November, 2003 (13)
October, 2003 (3)

Sign In
Copyright © 2006-2012 Brian Noyes. All rights reserved.

designed by NUKEATION STUDIOS