Using Popup Pages with Prism for Xamarin Forms

So often as mobile developers we use some sort of Popup view. Really the reasons why we want to do this simple task are pretty endless. For too long it's been something that wasn't an option for Xamarin Forms. Then came one of my favorite new packages Rg.Plugins.Popup. The only problem is that the library requires navigation through their Popup Navigation Service instead of being integrated in with the Xamarin Forms.

This creates an issue for Prism Applications. How do you navigate to Popup Pages while maintaining a proper MVVM pattern? The solution, Prism.Plugin.Popups. With Prism.Plugin.Popups, Prism based apps can now navigate to Popup Pages using the Prism INavigationService that you're already using. Best of all, there is no configuration required. The plugin adds several new extensions in the Prism.Navigation namespace, so simply adding the INavigationService to your ViewModel and using the Prism.Navigation namespace is all you need to do.
using Prism.Navigation;
using Prism.Commands;
using Prism.Mvvm;

namespace MyApp.ViewModels
	public class MainPage : BindableBase
		public MainPage( INavigationService navigationService )
			_navigationService = navigationService;

			NavigateCommand = new DelegateCommand( OnNavigateCommandExecuted );

		INavigationService _navigationService { get; }

		DelegateCommand NavigateCommand { get; }

		private async void OnNavigateCommandExecuted() =>
			_navigationService.PushPopupPageAsync( "MyPopupPage" );
As mentioned before we're using the INavigationService, and just like the INavigationService you'll need to register your View and/or ViewModel the same as if you're registering any other pages for your application. One caveat to this, in order to function as an extension of the INavigationService it requires specific knowledge of the Container you're using as we have to use your container to resolve the View. As a result there is a container specific implementation for each of the public containers for Prism for Xamarin Forms.

IoT Cluster with Raspberry Pi

IoT has been exploding over the past few years, and nowhere is more evident than with the community surrounding the Raspberry Pi. It is probably one of the most versatile ARM platforms being used today. With all of this support we have a wide degree of options.
5 Raspberry Pi 2's running in a Docker Swarm
Enter Docker... with the benefit of preconfigured images from Hypriot, you can now easily set up a fully functional Docker Swarm in mere minutes. For those who know about Docker, let me start by saying I don't believe you'll learn anything new from this post other than perhaps you can make it work on Raspberry Pi.

As for functionality with Docker Swarm running I was able to quickly deploy a number of services including MariaDB, PostGRE, Gogs, along with a number of other applications. It really shouldn't come as a huge surprise that you can have highly available services which are easily deployed using Docker, for me what was the most telling factor was the hardware involved.


One of the first things you may notice about the hardware is I had no real cost for my cables or switch. That's because I pulled out a few old cables and a switch I knew I should throw out but for some reason kept.
Qty Item Cost
Raspberry Pi 2
Micro Sd Cards
Cat 5 Cables
Old 100mb Switch


Now I should probably say I would probably not recommend this for a larger business, but when you have an fully functional cluster of actual physical hardware that can provide Enterprise like availability, drawing very little power... I would say this is an excellent feature for small businesses which may be a little shy about having some hosting service host their data in the "Cloud".

Additional Reading


  • Hypriot Docker Image for Raspberry Pi - Version 0.6.1 Hector - Download - Checksum - Published 11-15-2015
  • Hypriot Cluster Lab - Version 0.1 - Download - Checksum- Published 12-8-2015

Poor Man's Design Strategy for Dynamic Code in PHP

Perhaps this has happened to you. You're working on a code base and as you scroll through the code you see something like:
if( $foo == "bar" )
    $name = $foo;
    # Execute some code
else if( $foo == "fu" )
    $name = $foo;
    # Execute the same code we just did....
else if( $foo == "fubar" )
    $name = $foo;
    # Execute the same code we did the last two times...
// and so on....
I fully admit it drives me absolutely crazy when I see code that is complete reusable and someone decided to type it out two, three, four, or WTF were you thinking times... It's usually about the time where I am grateful I live in San Diego where we have so many great micro-breweries.

A couple of years ago I was working on a code base that had this type of just generally bad code all over the place. On top of this though was the fact that every time a new report page had to be written the Report List Page had to be updated with code like you see above. To make matters worse every time a new report category like "Admin Reports" or "Client Reports" or "Billing Reports" was added an entirely new 'else if' had to be added. The biggest problem was that the code wasn't quite like above it was more like:
# Admin Reports
$admin_rows = array( $stuff );

# Client
$client_rows = array( $stuff );

# Billing
$billing_rows = array( $stuff );

$table = array(
That may not seem so bad, but this ended up in a bloated file that was in excess of 1000 lines of code.

There are always those days for a developer where you can say "and finally the day came...", and it did. Finally I had to add a new report and I refused to add to the mess. As is my style, I looked for a solution that had a certain elegance to it, something that could dynamically provide what I needed at runtime. My ultimate goal was to stop having to update the Report List page every time we added a new report.

Now to be fair here I did know a few constraints.
  • I knew the possible Report Categories that would exist
  • I knew that all of the Reports would start with the word 'Reports'
  • I knew that some reports were used more than once as a different report by passing in different parameters.

As you are probably all too familiar, if you give a thousand programmers a problem you'll get a thousand solutions. What I opted for is what I lovingly refer to as the "Poor man's Reflection Design Pattern in PHP". It's of course not quite true reflection but a design pattern that allows us to look at our project's classes for a known attribute to assist us.

Step 1:

The first thing that I needed was some way of identifying what a particular report was. For this I opted to create an array of hash-tables (aka associative arrays). This allowed me to identify information about each report dynamically and use that to decide how it needed to be constructed.
class ReportsFooBar
    public $report_info = array(
            'category' => 'FooBar',
            'active' => 1,
            'order' => 3,
            'title' => 'Foo...',
            'description' => 'When things are foo bar',
            'request' => '?bar=true'

    # some more code...

Step 2:

Implement the "Poor man's reflection design pattern". This looks at the php classes in a defined space. To save a few processing cycles we discard any classes which did not meet our requirement for starting with Reports. Then we load this into a hash table that will let us get the information we collected to build out our view.
# Load the local php files with a name containing 'Report'
# Setup an empty array of reports we will need to build our view for our reports
$reports = array();
foreach( $file_array as $key => $filename )
    # Do some cleanup to get the filename as a class name
    $report = new $filename();
    $report_info = $report->{'report_info'};

    # $report_info was not declared in our report class
    if( !$report_info ) continue; 

    # Add report to the report hash
    for( $i = 0; $i < count( $report_info ); $i++ )
        # Set report at $reports[category][order]
        $reports[strtoupper[$report_info[$i]['category']]][(int)$report_info[$i]['order']] = array(
            'title' => $report_info['title'],
            'description' => $report_info['description'],
            'request' => $report_info['request']

Bonus Step:

The end result ultimately needed on additional step as you saw above we were doing the same thing over and over. Ultimately for as clever as my solution was to discover reports, it still wasn't good enough. To finish I had to literally make my variable name a variable itself. While I cannot get into the full implementation here, it looked something like:

foreach( $reports as $category => $report_info )
    ${"{$category}_row"} = array();
    ${"{$category}_cell"} = array();
    # do foo...

.NET Debug - Remote Debugging Setup

We all might try to pretend that the code we wrote is perfect and will never break, but if there is one constant in Software Development it is that no matter how genius you were when you wrote your code, you are bound to run into bugs. As every developer is all too aware, debugging can present a real challenge, particularly when the code must be executed from within a specialized environment remote from the developers own computer.

As .NET developers we have transitioned our model to a Cloud First mentality which is to say that all of our processes must work in the cloud including the ability to debug our code. When I found myself suddenly needing to reach out to the Cloud as any developer would I began researching what options were available. It didn’t take long for me to find out that Visual Studio offers free Remote Tools. Unfortunately every article I read seemed to be either out of date or leave just enough information out that it ultimately led me in circles.

From vNow to vNext, .NET provides one of the friendliest environments for working Cloud First once you understand the tools at your disposal. Regardless of what type of .NET application you have deployed on your Windows Cloud Server, Visual Studio provides you with an easy out of box solution for securely connecting to your live code in the Cloud. While every development situation is a little different, one of the common one’s that I see today is for the Web App Developer. With that in mind here’s a simple guide to go from a fresh Cloud Server to a Web Server that you as a developer can fully utilize to debug your code.


  • Microsoft Windows Server running Server 2008 or later
  • Add any Local or Domain Users and Groups that should have access to the Remote Debugging Tools to the Local Administrators Group


Step 1:

  • Perhaps this should go without saying, but Install the Web Server (IIS) Role. This can be done manually or by using either Web Platform Installer or the included script.


Step 2:

  • Install Web Deploy 3.5 if you want to deploy your solution directly from within Visual Studio. This should be done from within Web Platform Installer or the included script.



- OR -

  • Install Web Platform Installer.
  • Install the following packages:
  • Recommended IIS Configuration ( Step 1 )
  • Web Deploy 3.5 ( Step 2 )

- OR -

  • Recommended IIS Configuration for Hosting Providers ( Steps 1 & 2 )
  • This includes Web Deploy, PHP 5.3, PHP 5.5, and Node.JS

You should also verify that all of the Features of the Web Server you want are installed.

Step 3:

Download and Install the Remote Tools for the version of Visual Studio you have installed and will be using. The installation process is extremely simple, simply agree to the license and click Install.
The installer has the same easy flow for vNow to vNext. Agree to the Terms and Conditions and click Install.
The installer has the same easy flow for vNow to vNext.
Agree to the Terms and Conditions and click Install.
Following the installation you will need to open the Remote Debugger Configuration Wizard from the Start menu. Since it just seems like a bad practice to leave your server open to anyone to be able to connect to the processes, my suggestion would be to opt for running the Remote Tools as a service. You can use any account you want though running it as the Local System should be fine for most applications.
Note that there is an option for the Remote Debugger and the Remote Debugger Configuration Wizard. You want the Wizard to set it up as a service.
Note that there is an option for the Remote Debugger and the Remote
Debugger Configuration Wizard. You want the Wizard to set it up as a service.
Check the box to run as a Service. Leave the User name as
LocalSystem or enter the User Credentials you want the
service to run as.
Once you’ve configured the Remote Tools to run as a Service; your server is ready for Cloud Development. If you open your Visual Studio Project simply right click the Project and select Publish.