diff --git a/_posts/2017-01-23-PCL.md b/_posts/2017-01-23-PCL.md new file mode 100644 index 0000000..ada6e9a --- /dev/null +++ b/_posts/2017-01-23-PCL.md @@ -0,0 +1,193 @@ +--- +layout: post +title: "Solving the onboarding process for PCL Construction" +author: "Mickey MacDonald" +author-link: "https://twitter.com/Scruffyfurn" +#author-image: "{{ site.baseurl }}/images/authors/photo.jpg" +date: 2017-06-26 +categories: [Mobile Application Development with Xamarin] +color: "blue" +image: "images/PCL/xamarinapp-small.png" +excerpt: PCL Construction partnered with Microsoft to digitize their manual new-hire onboarding process. +language: [English] +verticals: [Process Mfg & Resources] +geolocation: [North America] +--- + +The Canadian subsidiary of PCL Construction recently reached out to Microsoft to help digitally transform their manual tradesperson on-boarding process that has been in use since the start of the organization. The current paper-based on-boarding process uses triplicate impact forms, creating high costs in both form printing and manual input hours by the PCL Human Resources team. We proposed to develop a proof of concept (PoC) Xamarin application to replace their current process, and at the same time educate the PCL development team on Xamarin development best practices. + +### Key technologies used + +- [Xamarin](https://www.xamarin.com/) +- [Mobile Apps feature of Microsoft Azure App Service](https://azure.microsoft.com/en-us/services/app-service/mobile/) +- [Azure Active Directory (Azure AD)](https://www.microsoft.com/en-us/cloud-platform/azure-active-directory) +- [Azure Multi-Factor Authentication](https://azure.microsoft.com/en-us/services/multi-factor-authentication/) +- [GIT / Visual Studio Team Services](https://www.visualstudio.com/team-services/git/) + + +### Core team +- Blaine Stearns – Head Solutions Architect, PCL Construction +- [Mark Arteaga](https://twitter.com/MarkArteaga) – MVP/Founder and CEO, Redbit +- [Mickey MacDonald](https://twitter.com/Scruffyfurn) – Technical Evangelist, Microsoft +- [Anthony Bartolo](https://twitter.com/WirelessLife) – Audience Evangelism Manager, Microsoft +- [Tyler Doerksen](https://twitter.com/tyler_gd) – Cloud Solution Architect, Microsoft + +## Customer profile + +[PCL Construction](http://www.pcl.com/) is a group of independent construction companies owned by employee shareholders across the United States, Canada, and Australia. As a diversified general contractor, PCL celebrates the past and builds for the future. From their Canadian headquarters in Edmonton, Alberta, PCL’s Canadian construction companies focus on large commercial, institutional, industrial, and civil construction projects. As Canada’s largest construction contractor, the organization also offers construction services for smaller, unique special projects. + +## Problem statement + +PCL Construction's on-boarding processes for new tradespeople were completed manually on triplicate impact forms. Employees were required to complete up to 60 pages of information regardless of previous employment. This exercise had to be completed each time a tradesperson entered a new construction project. After the form was completed, the document was submitted to a team of three or four PCL Human Resources employees who manually entered the information into the Craft Services Stream application. This whole process was very time-consuming, costly, and prone to errors; hence the request for help. + +The current workflow is depicted in the following diagram. + +![Current workflow]({{ site.baseurl }}/images/PCL/currentworkflow.png) + +
+ +## Solution, steps, and delivery + +The proposed solution was to build a proof of concept Xamarin application that would automate the capture of new employee data, which would then automatically populate the Craft Services Stream Application database. + +PCL Construction's goals for this solution were the following: + +- Create simplified digital new hire forms. +- Provide the forms to new hires via an iOS app on iPad devices. +- Connect with the already existing Craft Services Stream Application database. +- Use existing authentication database for user management. +- Provide secure data storage and communication practices per PCL requirements for sensitive data. + +The Craft Services Stream Application database is a proprietary, internally developed solution that PCL Construction built on top of Azure SQL Database to post and track jobs across the entire organization. Authentication to the database is enabled via an existing Azure Active Directory (Azure AD) implementation that was introduced to ensure that only authorized personnel would be able to review the trade-person's submission prior to it being committed to the database. + +The PCL development team included seven members. To facilitate a quick and productive development environment, the developers were broken off into four groups: three teams of two for the client side, and a team of one to handle the Craft Services API integration. The teams focusing on the Xamarin client employed the pair programming method, which proved to work very well. + + +### DevOps practices put in place during the project + +During the solution development process, several DevOps best practices were introduced to ensure successful processing of updates and/or changes when required. + +#### Source code repository + +The PCL team was already leveraging the use of a private Git server; therefore, it made sense to continue using it to keep the code for the backend processing private while they worked. Considering that the way PCL manages the onboarding of thousands of tradespeople is a competitive advantage, keeping this advantage secret made sense. However, the code for the mobile app being developed during the hackathon was stored in a [public repo on GitHub](https://github.com/WirelessLife/PCLConstruct). + +#### Continuous integration and continuous deployment + +The backend environment utilized Visual Studio Team Services to create and manage the build process that automatically compiled and tested the PCL application as part of an automated continuous integration strategy. The team also utilized Team Services to manage the release process by using continuous deployment templates and tasks. + +### Technical details + +Following is the application flow: + +1. Administrator signs in to application. +2. Application logs on to the Craft Services Stream Application database and loads available jobs. +3. Administrator selects desired job. +4. Application loads forms that correspond to selected job. +5. Device is handed to job applicant. +6. Applicant fills in form information and submits. +7. Forms are scanned by application completion (all required sections have been filled out). +8. If approved, applicant receives notification; if denied, applicant is informed of what needs +to be completed. +9. Application is "locked" until handed to an administrator for security. + +
+ +![Whiteboard value stream map 1]({{ site.baseurl }}/images/PCL/valuestream1.jpg) + +
+ +![Whiteboard value stream map 2]({{ site.baseurl }}/images/PCL/valuestream2.jpg) + +
+ +#### Xamarin client + +The client was created using a Xamarin.Forms Portable application. This type of Xamarin solution was chosen to meet the overall goals of the project to be easily modifiable and potentially cross-platform. The team did look at Xamarin.Android and Xamarin.iOS as options, but felt that even with a shared library or Portable class handling the business logic, the UI code overlap was still too high to justify the platform-specific design approach. + +The application is primarily oriented around data entry, which means it requires a lot of strings and other data to be fed into data controls in each page or view. After some quick research, the team decided that the data binding feature in XAML would work very well for this project. One of the challenges that the PCL development team faced was the first time use of XAML. Even though the team was somewhat knowledgeable in both C# and .NET, the complexity of data binding in XAML was going to be a challenge. Fortunately Microsoft MVP Mark Arteaga agreed to participate in this workshop providing his real world experience in working with XAML and its data binding features. Mark was able to bring the team up to speed quickly and lead the team to tackle the challenge of connecting the newly created Xamarin application to the existing data stream. + +![Xamarin Application Screenshot]({{ site.baseurl }}/images/PCL/xamarinapp.png) + +
+ +![Xamarin Architecture Diagram]({{ site.baseurl }}/images/PCL/xamarindiagram.png) + +
+ +Various options were considered for connecting the Xamarin application to the current PCL data stream, including creating a stand-alone service. Ultimately it was decided to use the Mobile Apps feature of Azure App Service (formerly Azure Mobile Services) for the connection piece. The major factor in this decision was the time to implement and ease of use for the developers to address future updates. Xamarin's support of Azure App Service is well-documented, and the team felt comfortable with tackling any issues that might occur given this support. Mark Arteaga's support also proved valuable as he and Mickey MacDonald were able to guide the team through the creation of a DataServices class. The DataServices class connected the application to the Forms data via Azure App Service. The class provided the application with three public methods: one to retrieve all jobs available, one to retrieve workers by a job, and one to retrieve all forms belonging to a worker. These requests are all asynchronous tasks that return a JSON object. This JSON object can then be consumed and displayed in the application. + +An example of one of these tasks follows. + +``` +public async Task> GetCraftWorkers(string jobId) +{ + var data = await MakeRequest($"tables/craftworker/{jobId}"); + var ret = new List(); + if (data != null) + ret = JsonConvert.DeserializeObject>(data); + return ret; +} +``` + +
+ +After the team had solved the issues of data binding and connecting to Azure App Service, they moved on to the next technical challenge, securing the application during use. The idea was that the application needed to be locked after the form had been submitted. The purpose was to block the modification of any data that the user shouldn't have access to. The proposed solution was to pause the application on a prompt and use Azure Multi-Factor Authentication to allow a valid administrator account to unlock the application and return to the available jobs screen. While the idea sounded complex, the implementation was very straightforward; all that was needed to allow this to occur was to implement Multi-Factor Authentication for the Administrator's account in the Azure AD instance. A simple request was then made to the Multi-Factor Authentication service; in this case, the administrator's cell phone number would be called for verification. + +A simplified version looks something like the following. + +``` +private async Task MakeRequest(string path) +{ + HttpClient httpClient = new HttpClient(); + Uri _uri = new Uri($"{_settings.MobileService}/{path}"); + httpClient.DefaultRequestHeaders.Add("ZUMO-API-VERSION", "2.0.0"); + //httpClient.DefaultRequestHeaders.Add("Content-Type", "application/json"); + + var response = httpClient.GetAsync(_uri); + var responseBody = await response.Result.Content.ReadAsStringAsync(); + + if (response.Result.StatusCode == System.Net.HttpStatusCode.OK) + return responseBody; + else + return null; +} +``` + +
+ +#### Backend + +A simple solution was created to allow the client a secure way to connect, authenticate, and retrieve the data stored in PCL’s existing Craft Services Stream Application database. The team was interested in leveraging the existing Azure infrastructure to connect to the existing Craft Services APIs, hence the reason that the utilization of Mobile Apps in Azure App Service was a perfect fit. Mobile Apps handles authentication by connecting to PCL’s existing Azure AD implementation and provides the client with data access to the Craft Services Stream Application database. The Azure App Service backend also utilized Multi-Factor Authentication APIs providing a “locking” mechanism for the app made available by PCL’s Azure AD Premium subscription. + +To satisfy the need for continuous integration of the backend solution, the project was stored and deployed by using Visual Studio Team Services. + +## Conclusion + +Implementing the created proof of concept into production will allow PCL Construction to remove the manual process of having tradespeople complete triplicate forms and having said forms entered manually by HR. Conducting this PoC in digitizing the processes provided a great opportunity for the PCL Construction development team to upskill on cross-platform Xamarin.Forms application development as opposed to their initial desire to build a native iOS app. Cross-platform development also allowed them to capitalize on their earlier spend of Surface Pro 2 hardware, which could now be utilized at some job sites to on-board tradespeople. + +> "We have made great strides to deliver anything, anytime, on any platform.” —Blaine Stearns, Head Solutions Architect, PCL Construction + +Using Mobile Apps provided a sound implementation of security practices in line with PCL Construction's standards and leveraged an existing Azure AD investment with very little build time. + +### General lessons + +- Xamarin team live (Skype) training was beneficial because it was tailored around what PCL wanted to accomplish. +- Inclusion of MVP Mark Arteaga was crucial to support TE Mickey MacDonald from a “real world” Xamarin development perspective (authentication tools, data storage, and encryption utilization). +- Utilization of the pair programming development method is a great way to accelerate learning and the development process. This is something we will be striving to implement in all future engagements. +- Mobile Apps in Azure App Service provided an easy link to the existing Craft Services APIs. +- Using Mobile Apps made it easier for PCL Construction to adhere to security protocols by leveraging the existing Azure AD and Multi-Factor Authentication. + +
+ +![Project End]({{ site.baseurl }}/images/PCL/endpicture.jpg) + +
+ +### Opportunities going forward + +The PCL Construction developer team found the Xamarin.Forms upskilling process to be quick enough to begin work on digitizing other manual forms. With help from Mark Arteaga, a now approved vendor for PCL Construction, the team is moving forward on developing dynamic forms to better serve the on-boarding process while still adhering to security requirements made available via their Azure AD investment. + +## Additional resources + +[GitHub PCLConstruct repo](https://github.com/WirelessLife/PCLConstruct) + diff --git a/_posts/2017-05-08-Thrive.md b/_posts/2017-05-08-Thrive.md new file mode 100644 index 0000000..75a4475 --- /dev/null +++ b/_posts/2017-05-08-Thrive.md @@ -0,0 +1,163 @@ +--- +layout: post + +title: "Tackling the Dragon – Converting a Java Based Game to Universal Windows Platform" + +author: "Mickey MacDonald & Anthony Bartolo" + +author-link: "https://twitter.com/WirelessLife" + +author-link: "https://twitter.com/ScruffyFurn" + + +#author-image: "{{ site.baseurl }}/images/authors/photo.jpg" + +date: 2017-05-08 + +categories: [Desktop Bridge] + +color: "blue" + +#image: "{{ site.baseurl }}/images/imagename.png" #should be ~350px tall + +excerpt: Thrive games have been working on their lead game, Dragon of Legends with aspirations of delivering their game to the entire world. The team at Thrive games wishes to capitalize on the proprietary game engine to be utilized on multiple platforms (PC, OSX, Linux, iOS and Android) in order to stay committed to making their game accessible to everyone. Being a Kickstarter funded start-up, Thrive Games needed a cost-effective way to reach gamers on these other platforms. + + +--- + +*Ragnarök is Nigh.* + +Thrive games have been working on their lead game, Dragon of Legends with aspirations of delivering their game to the world via the Steam gaming platform. The game uncovers countless mysteries of the past as players battle across platforms in a vibrant 2D world inspired by Celtic and Norse mythology. The team at Thrive games also wishes to capitalize on the proprietary game engine to be utilized on multiple platforms (PC, OSX, Linux, iOS and Android) in order to stay committed to making our game accessible to everyone. With this in mind, Thrive Games needed help to address the Universal Windows Platform portion of their quest. + + + +Technologies used in this project: + + Java + Gradle + ProGuard + Launch4j + Desktop Bridge + +The team was compromised of developers from both the Microsoft community and Thrive Games which included: + +Thrive Games + +- Andy Huynh, Software Engineer +- Matt Paine, Software Engineer +- Michael Huynh, Chief Technical Officer +- Nathan Dworzak, project manager + +Microsoft Canada + +- Mickey MacDonald, Technical Evangelist +- Anthony Bartolo, Audience Evangelism Manager + +![Team]({{site.baseurl}}/images/Thrive/team.jpg) + +## Customer profile ## + +[Thrive games]("http://dol.thrivegames.net/") is a small Hamilton Ontario based startup gaming design shop. The organization is comprised of a group of talented, like-minded individuals wishing to re-capture that sense of wonder and excitement that they first experienced as young gamers during the 1980s and 1990s. Thrive games goal is to revive the magic and complexity that was found in said timeless classics — while infusing them with modern technologies and innovative gameplay mechanics. + +## Problem statement ## + +The Java app platform has been the platform of choice for Thrive Games to architect their Norse tale. While Java games could easily be deployed on other store platforms, such as Steam, the team was looking for a way to offer Dragon of Legends on other popular gaming platforms without incurring long development cycles. Being a Kickstarter funded start-up, Thrive Games needed a cost-effective way to reach gamers on other platforms like Windows. + +*"Our team at Thrive had an awesome time working with Anthony and Mickey from the Microsoft team to convert Dragon of Legends to UWP, and put a demo version up onto the Windows store.* + +*At first we were initially concerned about the technical implications of having our code based in Java, but the conversion process worked quite well on its first attempt and the only thing required from our developers was to compile an executable .jar file."* - Nathan D, Chief Operating Officer at Thrive Games. + + +## Solution, steps, and delivery ## + +### Project Objectives ### + +The objective of this project was to capitalize on the time invested building the proprietary game engine written in Java to be enjoyed on the Universal Windows Platform via a multitude of devices. The following needed to be completed to accomplish this: + +1. Create the Java package file, the JAR, from the game engine's build output. +2. Use a wrapper to convert the JAR to a Win32 executable. +2. Convert the created Win32 application to a UWP app +3. Submit the completed UWP game to the Windows Marketplace + +In addition to the above core goals, our stretch goal is to complete the conversation of the Dragon of Legends UWP game in a span of 1 day. + +### Execution + +Tools and Technologies Used + +- Java +- Gradle +- ProGuard +- Launch4j +- Desktop Bridge + + +![Desktop Bridge architecture diagram](/images/templates/desktopbridgearchitecture.png) + +Our 1st task was to build the JAR package file from the libGDX game engine's output using [Gradle]("https://gradle.org/"). To do this we ran Gradle from the commandline with the command "gradlew desktop:dist". + +Next we preformed a few steps to obfuscate the project to help protect the game assets and code from being extracted from the final release. We accomplished this by using [ProGuard]("https://sourceforge.net/projects/proguard/files/"), and performing the following steps. + +1. Construct a config file (config.pro) file. This file lists all the classes, fields, and methods, that need to be kept and/or that their names need to be kept (Refer to https://www.guardsquare.com/en/proguard/manual/ for more details on how this is accomplished.) + +1. Once the config file is created, we then ran ProGuard from the command line, using the command "java -jar proguard.jar @config.pro". + +Once the obfuscating process had completed we then had a JAR package that could be used for release. The next step was to the create a Win32 executable application. We did this by using a cross-platform Java executable wrapper, [Launch4j]("http://launch4j.sourceforge.net"). This wrapper allows a packaged Java application to be ran just like a native Win32 application, packaging all dependencies with it, including the JRE (Java Runtime Enviroment) needed. + +![Launch4j architecture diagram]({{site.baseurl}}/images/Thrive/launch4j-use.gif) + +*Image source http://launch4j.sourceforge.net + +The steps taken to create the executable in Launch4j are as follows: + +1. Launch Launch4J and make sure you are on the "Basic" tab. +1. On the "Output File*" input: Browse for the destination where you want your EXE file to be name via this "desktop/...../ProjectName.exe" +1. On the "Jar*" input: Browse and locate the jar file you want to convert in your PC +1. On the "Icon" input: Locate your "ico" file for the icon. +1. Go to the "JRE" tab. +1. On the "Min JRE version" input: type in "1.4.0" +1. Click on the gear icon on the top and press save (destination preferably in output file destination, name - "ProjectName"). +1. Press the "Play" button next to and the Jar file should be converted to EXE. + +Once completed, we then had a Win32 executable that we could convert to a UWP application using the Desktop Bridge kit. The conversion process itself was done manually due to the game's lack of installer and the developer’s knowledge of the files needed to operate the game. The following steps were completed to convert the Win32 app manually. + +1. Downloaded and installed the Window 10 Software Development Kit +2. Create the appxmanifest.xml manually (detailed steps found [here](https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-manual-conversion)) +3. Opened the Command Prompt in administrator mode +4. Navigated to C:\Program Files (x86)\Windows Kits\10\bin\x86 +5. Entered the following command: MakeAppx pack /d "Path to Files" /p "Application Name".appx + +We then had an appx package of the game. In order for us to then install and test in on local machines, the following steps were then completed to sign and install the application. + +1. Opened the Command Prompt in administrator mode +2. Navigated to C:\Program Files (x86)\Windows Kits\10\bin\x86 +3. Created a certificate to sign the appx (detailed steps found [here]("https://msdn.microsoft.com/en-us/library/windows/desktop/jj835832(v=vs.85).aspx")) +4. Used the SignTool to sign the application with the created certificate (detailed steps found [here](https://msdn.microsoft.com/en-us/library/windows/desktop/jj835835(v=vs.85).aspx)) +5. The certificate was then installed on the testing computer, which allows applications signed with that certificate to then be installed +6. The last step was to double click the appx and install the application, just as it would be if downloaded from the store. + +![Submitting the game]({{site.baseurl}}/images/Thrive/submit.jpg) + + +###Challenges + +The biggest challenge faced was the process of embedding the dependencies, like the JRE in the final build. After some careful consideration and research, the team decided on using Launch4j. By using Launch4j the team was able to create a lightweight Windows native executable that allowed them to bundle the JRE and any other libraries or dependencies, with out the need to modify any existing code or infrastructure. + +### Release ### + +The game is now available in the Windows Store for download on Windows 10 devices. [Store Listing]("https://www.microsoft.com/en-ca/store/p/dragon-of-legends-demo/9plhr65j1pr9") + +![Screenshot1]({{site.baseurl}}/images/Thrive/Screenshot1.jpg) ![Screenshot2]({{site.baseurl}}/images/Thrive/Screenshot2.jpg) + + + +## Learnings ## + + +- While not a large time consuming effort, it does take multiple steps and tools to convert a native Java application to a Win32 and ultimately a UWP application. Learning these steps is key for helping others in the future. +- The team ran the manual desktop bridge process utilizing the makeappx command as a customer appmanifest.xml was created to address file asset placement +- The Windows Store team needs to be notified when submitting a converted UWP app as they need to add "Run Full Trust access" as a function of the submitted app to run properly. This process can take sometime and should be started as soon as possible to allow submission to be completed. + +## Conclusion ## + +Thrive Games was very impressed with quickness of adding Dragon of Legends to the Windows Store. The team at Thrive is now working on finalizing the game and adding the much anticipated multi-player features. The plan is to do a world wide launch on all platforms in the next few months with would be Norse gods battling it out on their Windows 10 devices. \ No newline at end of file diff --git a/images/PCL/endpicture.jpg b/images/PCL/endpicture.jpg new file mode 100644 index 0000000..26faea3 Binary files /dev/null and b/images/PCL/endpicture.jpg differ diff --git a/images/Thrive/Screenshot1.jpg b/images/Thrive/Screenshot1.jpg new file mode 100644 index 0000000..f6ca3e2 Binary files /dev/null and b/images/Thrive/Screenshot1.jpg differ diff --git a/images/Thrive/Screenshot2.jpg b/images/Thrive/Screenshot2.jpg new file mode 100644 index 0000000..7acc287 Binary files /dev/null and b/images/Thrive/Screenshot2.jpg differ diff --git a/images/Thrive/launch4j-use.gif b/images/Thrive/launch4j-use.gif new file mode 100644 index 0000000..ccb8882 Binary files /dev/null and b/images/Thrive/launch4j-use.gif differ diff --git a/images/Thrive/submit.jpg b/images/Thrive/submit.jpg new file mode 100644 index 0000000..f6dfb7a Binary files /dev/null and b/images/Thrive/submit.jpg differ diff --git a/images/Thrive/team.jpg b/images/Thrive/team.jpg new file mode 100644 index 0000000..97eece8 Binary files /dev/null and b/images/Thrive/team.jpg differ