Tech in the 603, The Granite State Hacker

C# and WebAssembly

I’m honored to be able to post in Matt GrovesAnnual C# Advent again this year, and today… December 22nd, 2018, is my second year contributing to it.

Last year I talked about ways to unload the main UI thread in WPF/.NET apps.

This year, I want to call attention to the Uno Platform tools I’ve been evangelizing for the past six months or so. 

Silverlight is dead – Long Live Uno Platform!

To understand this perspective, we’ll need to walk through some key terms….

What is Silverlight?silverlight

For those who don’t know, about ten years ago, Silverlight was the way to write C# and XAML to run in the web browser. It required a plug-in to run, much like Adobe Flash Player. Unfortunately, Microsoft announced the…. untimely demise of Silverlight in 2012. Silverlight, to some extent, seemed a more catchy term than other related technology names, so Microsoft used Silverlight as the name for mobile platforms that are also now depricated. As a result, it became almost synonymous with XAML.

What is XAML?

XAML, “eXtensible Application Markup Language” is the markup language behind a few great UI / UX layers in various Microsoft .NET-oid languages.  For those who’ve used it, it’s an addictively cool language family.  Using Visual Studio, Blend, and Adobe DX, you can create first-class UI.  With features like Storyboard animation, basic animation becomes child’s play. Composition makes fast, dynamic animations easy. Once you’ve gotten the basic idea of it, one finds themselves wanting to use it anywhere they can…  or at least that’s been my experience through WPF, Silverlight, Silverlight for Windows Phone, Silverlight for Windows Phone 8 / 8.1, Universal Windows Platform (UWP) and probably others.

The “code behind” XAML is typically C#, and historically .NET based.

What is Universal Windows Platform (UWP)?

UWP is the native platform of Windows 10.  It’s similar to classic .NET in a few ways.  First, UWP feels a lot like Windows Presentation Foundation (WPF) and .NET, being XAML and C# based, respectively.  It differs from classic .NET because it has a lot of fixes, both in terms of security and performance, that .NET can’t afford to apply for various reasons.  More simply put, .NET had some serious technical debt built up, so the easiest way to forgive that debt was to build a new platform based on the old languages.  Your XAML and C# skills are the same, but the namespaces and supporting framework libraries are different.

Don’t fret, though…  UWP runs natively on over 800 million devices (as of today, December 22nd, 2018), and that number continues to grow.  UWP is the native platform for all Windows 10 devices.  This means desktops, laptops, tablets, phones, HoloLenses, Xbox consoles, IoT embedded devices, and more. 

What is WebAssembly?webassembly

WebAssembly is a relatively new bytecode language specification… a virtual machine specification, similar to the Java Virtual Machine (JVM), that is fully supported by most modern major web browsers.  It allows near native performance in the same sandbox that javascript apps run in.  When you run javascript in a web page, the jit compiler in the browser converts the code into tokenized bytecode in order to execute it quicker.  WebAssembly improves on this significantly by pre-compiling the code.  Because the code is pre-complied, it doesn’t have to be sourced from javascript.  It can be compiled from just about any programming language.  Wasm, as it’s called, went from a specification just a few short years ago to being well supported in all major modern web browsers.

What is Uno Platform?uno platform

Uno Platform, for our purposes, is not really a new platform, but an extension to UWP. 

You write your UWP application for your Windows 10 devices the same way you always have.  Uno provides a mechanism to re-compile that UWP app to Web Assembly (and… by the way… using Xamarin tools, also to iOS… and also to Android!)

In a sense, Uno Platform is to UWP as Xamarin is (roughly) to classic .NET.

See the connection? 

Let’s do some math…

UWP = C# & XAML for Windows 10.  (800,000,000 devices)

Uno Platform += UWP for iOS (Millions more devices), Android (over a Billion devices), and WebAssembly (every modern major PC in the world)

Now factor in this…

.NET Core 3 += UWP for services

What does all that add up to? 

One skill set… 

UWP (C# & XAML) = FULL STACK, on all major platforms

From data access layer to REST API to UI canvas.

Wait a minute…  What about Xamarin?

Xamarin is the older way to do C# for cross platform / mobile.  

Coincidentally, just this past Thursday, Carl Barton, a Microsoft MVP for Xamarin presented the Xamarin Forms Challenge at the Windows Platform App Devs users group. The goal of the meetup was to demonstrate creating a simple app in C# and running it on as many platforms as we could in the hour.  He easily pushed ran the app on over a dozen platforms in the hour.

Uno Platform actually depends on Xamarin libraries to support iOS and Android. 

The main differences between Xamarin and Uno Platform are these:

  • Xamarin encourages you to use a Xamarin-specific dialect of XAML, including Xamarin Forms to express your cross platform UI.
  • If you already know & understand Microsoft’s UWP dialect of XAML, Uno Platform uses that dialect.
  • Xamarin enables you to produce binaries for dozens of different target platforms, reaching a billion or more devices.  These include .NET, UWP, iOS, Android, Tizen, Unity, ASP.NET, and many others.
  • Uno Platform only enables you to reach three additional binary output targets…  iOS, Android, and WebAssembly…. but WebAssembly can or likely will soon cover most of what Xamarin Forms covers.

I’ll leave it up to you which to choose, but for me, given the choice between Xamarin with several years of technical debt built up in a distinct dialect of XAML, and Uno Platform, using the fresher, native UWP dialect of XAML…  

Finally… 

Here’s the slides I presented most recently at the New England Microsoft Developers meetup in Burlington, Mass on December 6th (thanks again to Mathieu Filion of nventive for much of the content):

[office src=”https://onedrive.live.com/embed?cid=90A564D76FC99F8F&resid=90A564D76FC99F8F%211297452&authkey=AM6QZrb_6-9ltdE&em=2″ width=”402″ height=”327″]

Tech in the 603, The Granite State Hacker

Intro to Uno Platform

Uno’s free.  Uno is open-source.  Uno could seriously be the next significant disruption in mobile development.

Apologies that I neglected to hit on the conference call for the introductions.  We did get the bulk of the presentation recorded.

On the call:  Jerome Laban, Architect, and Francois Tanguay, CEO of nventive of Montreal, Quebec, Canada. Participants of the Windows Platform App Devs (including myself) were in the audience, asking questions.

To make up for the intro missed in the call, let me begin with the elephant in the room…

What’s “wrong” with Xamarin?

The relatively well known Microsoft tool set called Xamarin enables developers to write a dialect of C# and Xaml to target a variety of platforms including Windows, Windows Mobile, iOS, Android, MacOS and others.

For that reason, Xamarin’s currently a top choice for mobile developers around the world. Xamarin enables developers to target billions of devices.

The problem Xamarin presents is that Xamarin has become its own distinct dialect of .NET-based development.  Xamarin has its own distinct presentation layer called Xamarin Forms. Xamarin Forms as an employee skill set is not the same as a classic Windows developer set.  It’s not exactly the same as a Windows 10 developer skill set.  It’s a different platform, and requires developers that understand it.

Uno Platform reduces the skillset burden in this problem by converging the main skill set on Windows 10 development. Developers with an appreciation for the future of Windows development will definitely appreciate Uno Platform.

Windows Universal Platform (UWP) targets ALL flavors of Windows 10, including some unexpected ones, like Xbox One, and IoT devices running Windows 10 IoT Core.

Uno bridges UWP to iOS, Android, Web Assembly (Wasm), on top of Windows 10. This targets a huge and rapidly growing range of devices… (currently approaching around 3 BILLION… and that might be a low estimate.)

I’d embed the video, but Blogger’s giving me a hard time with the iframe-based embed code… please click this

Link to the video:

Intro to Uno Platform Skype conference recording.

The meetup:
Granite State Windows Platform App Devs
https://www.meetup.com/Granite-State-NH-WPDev/events/251284215/

Uno Platform’s site:
http://platform.uno

Tech in the 603, The Granite State Hacker

Prism and Unity, an MVVM and DI Knockout Combo

I recently had the opportunity to do UWP work for Hewlett Packard.  It was a really cool experience, building UWP apps for the HP Elite X3 Windows 10 based phone.

I’d also just rolled off a project prior-to that used Unity under the hood for Dependency Injection, so Unity felt like a natural extension. Prism as an MVVM presentation framework on UWP also felt like a natural extension of the MVVM framework we’d build on WPF in that same previous project.

Here’s the slides from the June 22nd, 2017 presentation to the WPDevNH group in Salem, NH. [office src=”https://onedrive.live.com/embed?cid=90A564D76FC99F8F&resid=90A564D76FC99F8F%211278476&authkey=AI5mw9sxEY9MfHI&em=2″ width=”402″ height=”327″]

Tech in the 603, The Granite State Hacker

Rise of the Smart App

Microsoft didn’t talk much about the Windows Phone at Build 2016.  If you think that’s news, you’re missing the point.

As Microsoft re-defines “Mobile First, Cloud First” they declare shenanigans on the idea that the tech world revolves around phone and tablet.  Yes, tablet and smartphone are mature, first-class citizens, now, but they’re not above laptops, PCs, or other computing devices, as Apple (and perhaps even Samsung) might have you believe.

There’s no denying that Microsoft lost the battle for smartphone market share.  RIM’s Blackberry, considered a relic of the primordial smartphone market, is all but forgotten. Microsoft was pushing Windows Phone as significant competitor, yet, with about the same market share as Blackberry, no one really took their smartphone offering seriously. 

Until Windows Phone’s recent convergence with the PC on the universal Windows 10 OS, Windows Phone had no more competitive edge than Blackberry, either.  Sadly, this new competitive edge comes too little, too late. Or has it?

Several years ago, in a very sly move, Apple narrowed and laser-focused the global technology mindset on a much smaller battle… one that it was well positioned in. Apple then equated the battle to the war… They made it all about the smartphone/tablet market.  (I don’t think Apple counted on Android, but it didn’t matter… in terms of market share, Android won, but in terms of profitability, Apple won.)  Billions of dollars can’t be wrong, so Microsoft tried to position itself in Apple’s vision, and let itself get dragged around for years… 

Until now.

By connecting Mobility with Portability, Microsoft is driving the scope of technology mindshare again, and are driving it back out to a scale Apple will have to struggle to position itself in. Apple made good smartphones.  Cool beans.

With its converged “Universal” Windows 10 platform, Xamarin portability, and mature cloud offerings replete with machine learning, Microsoft is targeting a much broader “smart app” market… Smart Apps are apps that make any device (keyboard, mouse, display/touchscreen, microphone, pen, scanner, camera, video recorder/editor, audio mixer, cell phone, media player, whiteboard, virtual/augmented reality, what have you) into a smart device.  (Notice anything missing here?  perhaps cars…  but it’s hard to imagine that won’t change in the next few years…  after all, cars (e.g. BMW) did get mentioned at Build.) 

The smartphone isn’t irrelevant, it’s just not the whole pie. The reality is that Microsoft is not going to exclude phones from Windows 10 now or any time soon. 

Smartphone prominence is not innovation superiority.

So, how does this make you feel?

Tech in the 603, The Granite State Hacker

Mobile First, Cloud First as Redefined in Build 2016

There were a number of very cool announcements made at Microsoft Build’s 2016 kickoff today, Wednesday, March 30th.  On first brush, one might not notice the common theme across the announcements, however.

These things may seem disconnected, but if you look again, they’re not… nor are the other less obviously connected major announcements such as:

Microsoft has been promising Mobile First, Cloud First for a long time. Until today, there’s been a consensus that Mobile First meant Tablet and Phone…  as in those hardware form factors get updates and features before classic alternatives.  Today Satya Nadella, CEO of Microsoft, addressed the developer crowd and clarified (or perhaps more accurately “redefined”) what “Mobile First” really means.

Mobile First, Cloud First has morphed to mean something more like “Portable First, Cloud First”, with portable referring directly to the Universal Windows Platform…  write your code once, and the user can take it to any device (desktop, laptop, phone, IoT) and use it as naturally as possible with the whatever human interface device is available (keyboard, mouse, touch, ink, voice, text, etc)…

And there is, indeed, how all the announcements fit together. 

All of the announcements made today talk about how Microsoft is diversifying the human interface, yet keeping the context of all your work and play available across all devices.  Your apps are there, and they work just as naturally with voice commands as they do with ink. 

Note that keyboard and mouse are relatively unnatural compromises in human interface paradigm, and their use will be diminished in the future. 

If pen and paper is the natural choice, Ink will replace it. 

If voice makes sense, it will be available.

If an intelligent actor might assist you, Cortana and your trusted “Network of Experts” (Apps and BotFX bots) are there. If a virtual or augmented reality makes sense, your apps will join you on Hololens. 

If an Xbox controller is the right choice, no problem. 

All of these things can be enhanced significantly with DirectX 12, even for non-games.

And the Cloud will interlink them naturally so that you can flip from tablet to Hololens without skipping a beat. (in some ways, live process migration is really becoming a reality;  when the apps are the same across every deployed device, the only thing that needs to transfer from device to device is user data, and that’s happening via cloud.)

One segment that didn’t see much love today:  the Web.  Or did it?  Bash for Windows 10 is a bit of a stretch to connect to the coming shift, but really, it is meant to make it easier for developers to deliver web-based, cloud-hosted solutions using Visual Studio to non-Windows hosts.  Indirectly this will aid in the creation of services that might support Bots made with the BotFX, for example.  All of this is based predominantly on JSON over REST / HTTP.

Some would point out that Windows 10 Mobile (formerly Windows Phone) didn’t get any stage time, either, but the reality is that Microsoft no longer sees the smartphone edition of Windows to be a separate thing.   Windows 10 is converging on “The Best Windows Ever”, Windows 10… smartphone or not. 

Tech in the 603, The Granite State Hacker

Retirement of the Corporate PC

Remember the company car?  Neither do I.   There’s a good chance the company-provided PC that most information workers are issued is trending toward extinction as well.

The net result could be a boon for PC retailers.  Policy agreements become SLA’s with the employee, and the budget moves out of IT and into HR.

Posted on Linked In:  Retirement of the Corporate PC

https://www.linkedin.com/pulse/retirement-corporate-pc-jim-wilcox

Tech in the 603, The Granite State Hacker

Apache Cordova and SharePoint Online / Office 365

The concept came from a good place, but at this point, the story is best described as “science experiment”, as I mentioned at SharePoint Saturday Boston 2015.  I was working on a cross-platform Apache Cordova project for Windows, Windows Phone and Android when the call for speakers hit.  I said “why not?” and I signed myself up to present it…

The good news is that the story’s not without some worth to someone exploring the idea of hooking into SharePoint from an Apache Cordova-based app. Tools that exist today at least assist in the process.

[office src=”https://onedrive.live.com/embed?cid=90A564D76FC99F8F&resid=90A564D76FC99F8F%21470742&authkey=AF2UYViSqPU21mw&em=2″ width=”402″ height=”327″]

The demo code is mostly about accessing files from your personal SharePoint profile document library (A.K.A. OneDrive for business) and indeed, the code is using file access code in addition to SharePoint connection.  The hardest work in a browser based app is to authenticate with Office 365, and this code does that, and then opens up to the rest of SharePoint…

[office src=”https://onedrive.live.com/embed?cid=90A564D76FC99F8F&resid=90A564D76FC99F8F%21470744&authkey=ABWELP8Z5xOqUSY” width=”98″ height=”120″]

Tech in the 603, The Granite State Hacker

Windows 10 and the Near Zero Hardware Liability Enterprise

With Windows 10, Microsoft is re-defining the BYOD (bring your own device) game, and it’s a subtly aggressive move that many will probably appreciate.

No, really.  Like you, I have heard “BYOD game-changer” shticks before, and dismissed it as marketing hype.  Hear me out.  (And also keep in mind that folks once often said “never” with respect to the cloud… but “never” is a lot longer than folks tend to look.)

Let me start by describing what I mean by “near zero hardware liability”.

There are already smaller organizations out there that have completely moved their hardware behind the wizard’s curtain. That is, they own little to no IT hardware themselves (with little to no capital expense, depreciation, or hardware liability.) These companies are typically small, use the cloud to support their infrastructure & services hardware, and BYOD for their employees’ desktop machines.

While cloud services are making serious headway into the enterprise, BYOD has been an arguably harder sell. The whole concept of BYOD has been largely dismissed by most larger companies because BYOD in in the Windows 7 (and prior) world can’t be managed.  Policy can’t be addressed and applied.  Data can’t be protected on an “unmanaged” employee owned device.  Hardware depreciation, liability, and support is kinda small compared to the other liabilities involved.

Imagine a more classically European view of the world however.  In Europe, a user’s computer traditionally is considered to be only a step away from personal property.  Like the days of being given a company car, the days of being issued a PC by your employer may well be coming to an end. 

At the Windows 10 Pre-flight Summit in Redmond this week (6/1-2), it seems the word of the day isn’t so much about “upgrade”.  It is, but there’s a bigger word floating around. 

It’s “provisioning”, or enrolling a device in an enterprise.

In Windows 10, the word “upgrade” is going to die.  It’s not just one platform for multiple devices.  It’s not just one platform for now, until Windows 11.  It’s one platform for the coming decades.  Upgrade to Windows 10, sure.  Update Windows 10, yes.  Upgrade from Windows 10, not in the works.  It’s also one very personal platform in more ways than one.

The day may be coming when part of a hiring decision (both by employee and employer) may be that an employee has devices of their own to bring to the table.  The employee will have their own support network, their own personal liability, and in order to accept the job, the employee must be willing to provision their devices with their employer.

Provisioning a device means the device gets an enterprise managed workspace, as us developers would say, a sandbox where all managed apps and app data live.  Provisioning also sets a minimum acceptable standard policy on the device.  If the device can’t meet the provisioning policy requirements, it won’t be accepted…  (sorry Charlie, you need new hardware.)

I speculate on how much effort it would save companies if they could have the security & policy management without the hardware ownership overhead, but I bet, all told, it would be pretty significant. 

In many ways it will be similar to the car analogy…  you can’t expect to keep a job if you can’t manage your own transportation sufficiently to get you there when you need to be there.

This is also a very aggressive tactic. Imagine an enterprise deciding to implement BYOD, and it’s very successful… to the point where you can’t really get a job at that company without bringing a Windows 10 device.  Is that a labor issue? 

By kicking down as many objections to BYOD as possible, Microsoft may even be looking to drive adoption from the bottom up. Rather than the CIO/CTO decreeing and pushing Windows 10 down, the BYOD user will use Windows 10’s features to overcome the BYOD objections.  Tired of the “golf cart” class standard issue machine at work, a power user brings in their own “hot rod”, and harasses IT until IT realizes the objections can be sufficiently mitigated with Windows 10… and the floodgates open.

I also speculate on the ramifications of the job market.  I could easily envision a day when the mark of a more desirable employee would be the higher end hardware they bring with them.  Imagine how it might re-invigorate the PC market if employee competition drove sales.  Imagine the PC becoming more important than the automobile in terms of employability-driving hardware, as a competitive attribute of an employee.  (The mark of a good chef is their knife set.  The mark of a solid information worker may be their laptop.)

It won’t hit all at once on July 29th.  It all has a ways to go.  It is a very thought provoking possibility.  What do you think? Is this on the path to Tomorrowland?

Edit 6/3:  Day 2 of the conference points out that Hyper-V 6.2 included in some editions of Windows 10 will enable virtualized Trusted Platform Module (v-TPM).  This means that an employer could provide a secure, Bitlocker enabled VM to an employee (which may or may not be provisioned), rather than provisioning the employee’s device as a directly provisioned system.   Yet another way to make BYOD a more Enterprise friendly policy.

Tech in the 603, The Granite State Hacker

Apache Cordova and Windows Universal (8.1)

Thanks to everyone who made it out to the Granite State Windows Platform Users Group last night (April 16, 2015) to see my presentation on using Apache Cordova to create Windows Universal (8.1) “store apps”. 

I walked away feeling like I’d helped inspire everyone who attended…  even as an “intro” level presentation, the demos seemed to keep everyone engaged, asking questions, and prompting me to go “off-roading” to check out various features. 

We really had fun with it!

So while the best part of the presentation was the demos, the slides do have some great links in them.

[office src=”https://onedrive.live.com/embed?cid=90A564D76FC99F8F&resid=90A564D76FC99F8F%21370273&authkey=AKm8AYTLUY1iyG8&em=2&wdAr=1.7777777777777776″ width=”350″ height=”221″]
 
 

If you missed it, don’t worry too much…  I’ll keep this presentation dusted off & ready for upcoming events, as well…  I could imagine it fitting well into a Code Camp event or something akin to it in the coming year.  

Heck, feel free to reach out to me if you think this is something you’d like to know more about… I’m happy to have a chat about it.

Next month’s meeting is already scheduled…  we’re looking forward to Jim O’Neil coming to reprise his Boston Code Camp 23 presentation on Themes in Windows Universal (8.1).   Please join us!

Meetup:  http://www.meetup.com/Granite-State-NH-WPDev 



Tech in the 603, The Granite State Hacker

AppStudio gotcha

Recently, I upgraded the Granite State (NH) SharePoint Users Group’s website from WSS 3 (MOSS 2007 generation) to SharePoint Foundation 2013.  The upgrade itself went as well as a 2007 to 2010 to 2013 upgrade could go, in general.

The only real “problem” I ran into was the Windows Phone app I wrote for the group years ago.  It was coming up with a 401 error trying to grab content from lists.asmx.  

I spent some time digging in the dirt, trying to resolve the 401, and hit a few common settings known to have an impact, but no good.  

Rather than struggle with it in my not so copious amounts of spare time, I decided to trash the old app, and build a new one with AppStudio.  

The app loads content from the #NHSPUG web site (http://granitestatesharepoint.org), mostly via RSS feeds.  I put a little extra effort into this.  Using AppStudio (http://appstudio.windows.com), I found a couple hours…  after that, I had not only a much prettier v3 of the Windows Phone app, but a Windows 8.1 (tablet style) publishing package as well.

One thing that caught me off guard though… the Gotcha:

The Windows 8.1 edition of the app wouldn’t load the content from the users group website. 

With some debugging, I found that attempts to load the content were coming up with “Unable to connect to the remote server. hresult=   -2146233088”.

Turns out the error had to do with the fact that I had not enabled Capability “Private Networks (Client & Server” in the Package.appxmanifest.   Ironically, the app works fine anywhere except where I was trying to test it:  on the same network as the content source server. So, to be fair, this is an environmental/configuration issue, not AppStudio, but it was worth mentioning, since my original assumption led me down that path. Maybe this will help someone else.

Oh… Here’s the Windows Phone app:
http://www.windowsphone.com/s?appid=8c1ce3ea-9ffd-46a0-80bd-6b45d1019b32

And here’s the Windows 8.1 (tablet style) app:
http://apps.microsoft.com/windows/app/granite-state-sharepoint-users/01ea0a83-f3af-4be6-abb0-268587072686

And here’s my moment of shame recording the incident and solution in the forums:
https://social.msdn.microsoft.com/Forums/windowsapps/en-US/be7b02cf-25d0-4aa2-8850-e0e2dce21fd2/appstudio-windows-81-apps-not-loading-external-content?forum=wpappstudio&prof=required