Thank you JavaScript/KC!

Thank you to everyone who attended my “Absolute Beginner’s Guide To Mobile Apps” talk at the JavaScript KC group tonight!  This was easily the biggest meetup group I’ve had the chance to address (almost approaching Cory House numbers!).

I made mention a couple times that a version of tonight’s talk was given back in May to the Xamarin meetup, though that presentation was much more targeted at Xamarin than the JavaScript frameworks.  That said I will readily admit that my blog post for Links and References is already slightly out of date and I’m going to work on revising it and will make updates to that blog post.  The biggest wildcard back in May: that talk was before Microsoft //Build, Google’s I/O, and Apple’s WWDC event — and there might have been a Chrome or PWA event during that time as well.  The point being: I’m going to update that post.  I’ll post on Twitter — @dotNetMike — when there are updates.

Beginner’s Guide To Mobile Apps: Resources and Links

It’s been pointed out to me that there’s a misspelling in this fake book cover. If I were clever I would say it’s an homage to the HTTP_REFERER attribute…

Thank you to everyone who attended my presentation about mobile applications!  As promised, here’s the list of links for information and resources that I said I would share… along with other links to items of general interest for mobile app developers and folks looking to get into this field.

“The Stacks”

In addition to the seven “stacks” I covered in varying degrees of detail last night, I also obliquely mentioned some others in passing. Here are the links to them all. One oversight I want to address: At the May 9th Meetup I said that if you want to learn more about Progressive Web Apps you should check out the KC Google Developers Group (I should have said this at the July 18th meetup as well but I forgot). Their home page — — is both informational and an example of a PWA, and the code for it is available on GitHub:

Some other language/platform options:

A Microsoft Employee making a React Native app on a Mac targeting iOS, Android, and UWP from one UI definition and then pushing new builds of the app — triggered on pushing new code to VSTS — out to handsets of testers, QA, beta users (however you want to set it up) using Microsoft Mobile Center:

Opinions,  Comparisons, Click-bait and Flame-bait, and other reading about mobile:

I lost 60 pounds teaching Xamarin!

Well… I did lose over 60 pounds so far this year and the best before-and-after photos I have are of me giving talks to devs about Xamarin. If you haven’t tried public speaking yet I HIGHLY recommend it. As for the weight loss effects… your results may vary.  🙂

I'm about 295 pounds in this photo...

I’m about 295 pounds in this photo. This was March 22, 2016 and I’m talking to the KC .NET Developers Group about Xamarin (which was still non-free as of this talk —  the //Build announcement was the next week). Thank you to Heather Downing for taking this photo with my iPhone!

Still 6'5" but now I'm under 230 pounds as of Nov. 12, 2016. Still talking about Xamarin!

Still 6’5″ but now I’m under 230 pounds as of Nov. 12, 2016. Here I’m talking about Xamarin Native to the Kansas City Xamarin Dev Days attendees. Like the March talk where announcements the following week rendered a bunch of things obsolete, this was four days before the announcements at Connect() rendered a huge portion of this talk obsolete as well! Thank you to Duane Newman for giving me this photo!

Getting Started Links for my talk at the DevUp Conference

Thank you to everyone who attended my session at DevUp!  As promised, here’s a non-exhausitve list of resources for getting started mobile application development!

VMWare Workstation and Xamarin Development: It could have been so good

I’ve been doing Xamarin Development for almost two years now.  Until a few weeks ago my preferred environment has been Xamarin Studio on a MacBook Air, which worked fine for the mobile apps themselves but not so well for writing and editing the Azure/ASPNET MVC service layers; for that I really need Visual Studio.  I considered getting a MacBook Pro and running Visual Studio in a Parallels or VMWare Fusion VM, but what I really wanted was the ability to run several VMs at once, especially dedicated VMs for SQL Server and SharePoint.  This latter consideration rules out the MacBook Pro as we know it currently: 16GB of RAM isn’t enough for MacOS and Xamarin Studio, a VM for Visual Studio and IIS, and a VM for SqlServer (16GB is barely enough for Chrome, but I digress).

Since I don’t see Apple releasing a MacBook Pro with 32GB of RAM anytime soon (or selling it for less than $4000 when they do), I opted to get a Lenovo P50 with a quad-core i7, 64GB of RAM, and a 1TB NVMe SSD (for just $2200 — top that, Apple!).  Part of the goal here is to have separate and isolated client VMs so that the work I do for Client A is in it’s own VM, Client B in another VM, etc.  This is especially useful when a client requires archaic versions of Visual Studio or Sql Server (as recently happened on a DTS 2000 to SSIS 2012 migration project).

To accomplish this VM strategy I downloaded a 30 day trial of VMWare Workstation Pro 12 and used the last Windows 10 Pro license I had on hand.  I created a pristine base image and then created a Linked Clone for the first client project.  In that clone (let’s call it Client-A-Stable) I then installed Visual Studio 2015 Professional, all of the bits for Xamarin development, and all of the Android SDK components and tools for APIs 19 – 23.

Now the fun part: programming!  I pulled down the code for the client’s Xamarin app, performed the initial build (made longer by Nuget restores and some “works on my machine” config updates to get things to run) and was ready to launch the app in an Android emulator… which is where this story goes wrong.  On Windows, there are three choices in Android emulators: the Google supplied emulators (slowest), Genymotion (fast but requires Virtual Box which I would prefer to avoid), and Microsoft’s Hyper-V based emulators for Android which are the fastest option available.  I installed the Microsoft Hyper-V emulator and upon launch was met with the first problem: Hyper-V support in a VMWare Workstation VM.  Officially, VMWare doesn’t support Hyper-V currently though they do have an unsupported Hyper-V mode which makes the operating system in a VM think that it’s running in a proper Hyper-V environment.  Okay, let’s give it a try now: no-go.  Even though, per VMWare’s sparse documentation on the topic, Hyper-V features should be working at this point, the Microsoft Hyper-V emulator refused to run, with a dialog box citing that Hyper-V support was absent.

No big deal, I still have a couple more options left. Next I created a Linked Clone from Client-A-Stable (Client-A-Genymotion) and downloaded and installed Genymotion. More dramatically, Genymotion, which is built atop Virutal Box, detected that it had been installed in a VM and flat-out-refused to even try to launch. Okay, delete that Linked Clone, at which point I’m thinking this linked clone business is awesome: if I want to experiment with something that could potentially muck up or destabilize my VM, just create a linked clone, give it a try, and delete it if the experiment fails.  But as nice as that is, I really need an Android emulator to work sooner than later or I’m going to be up a creek fast!

Last option: the Google supplied emulators. Initially this was a no-go (no Vt-x support was detected). Fortunately the client had a physical Android device I could attach to my laptop and use for debugging until I could get the emulator mess figured out.  After a couple weeks I discovered that having Hyper-V enabled in the VM (or the base operating system) makes it appear to apps that VT-x is not available even though my i7-6820HQ CPU most certainly has this ability. The solution, as I learned, is to turn off Hyper-V in the VM and specifically enable emulated VT-x, at which point I could FINALLY get the Google/Intel HAXM Android emulators to run.  Well, “run” really isn’t the right term… crawl is more accurate.  So slow that clicking on the “apps grid” button allowed me to see in janky detail, over a period of a few seconds, the animation of the button grow to full screen, totally cover the whole screen of the emulator, and then do an animated disappearing act, revealing the grid of apps loaded in the emulator.  And this was after waiting more than a full minute for the emulator to load. There are only two words to describe this state of affairs: completely unsatisfactory.

In summary: the high performance Hyper-V android emulator won’t run in a VM even though it’s in hyper-v mode, and VMWare won’t support VMs in this mode so I’m on my own and out of luck on this option.  Genrymotion is a no-go because it detected it wasn’t running on the base operating system and refused to even start. And the Google/HAXM emulators are a no-go because they take too stinking long to actually do anything… which will always lead to other things. At least for this client engagement I can use their physical Samsung device tethered to my machine for development and testing, and while this certainly work, there are a few problems. First, this device belongs to the client and if they suddenly have a need for the loaner device I have then I’m on my own again. Secondly, this device represents only one of the API levels being supported for this app.  The app is officially supported on APIs 19 -23 (and 24 before the end of the month) but the testing device I have is API 22.  Lastly, by being restricted to the physical device I’m locked into thinking of the app in that aspect ratio and screen size only.  You always need to make sure the app looks and acts well whether you’re running on a 10″ tablet or a 4″ Nexus 4. Emulators are perfect for this kind of smoke testing — but I cannot run an emulator and get work done in a reasonable amount of time.

Ideally I would be able to run the Microsoft Hyper-V emulators in a VMWare hyper-v-enabled VM and just get my work done quickly, but this doesn’t seem to be an option with the current state of VMWare Workstation.  Looks like my only recourse is to install Visual Studio and all other once-per-client software requirements in the base OS (Windows 10 Pro) and hope the time between erase-and-reinstalls on this machine is minimal.

Xamarin 3D Questions and Answers (belated)

As promised, here are some answers to the questions raised at the “Xamarin 3D” meetup back in May. If you have more questions please feel free to contact me via Meetup or at @dotNetMike.

My apologies for not posting this much sooner… Kunjan is my witness that I emailed this reply to him the day after the presentation back in May (though I’ve updated the TFS question this morning since I have more info). I plan to completely re-do this talk with an emphasis on demonstrating everything I’m covering rather than just saying “Trust me, it’s cool and you can do it.”

Questions and Answers

Q. Can I developing Windows Mobile apps on a Macintosh?
A. No. You’ll either need a Windows VM on your machine (or an Azure VM to which you can remote?) or an actual Windows machine for this.

Q. What is the C++ interop story for Xamarin?
A. I’m linking to two articles, one which addresses building and debugging C++ libraries in Xamarin.Android with Visual Studio, and another which discusses using Visual C++ for cross-platform mobile development. Mac: I’m not sure if, in aggregate, this answers your question. If I understood it correctly, you were curious whether you can write both an Android and iOS app from the same IDE. While these articles don’t specifically say yes to this, I’m going to dig deeper on the Xamarin forums and see if I can make contact with someone engineers at Xamarin who can answer this question completely.


Q. How much of the CI/CD pipeline can I do with on premises TFS?
A. Per a friend of mine who is a TFS expert: TFS on prem can do what VSTS can do. For local iOS builds you’ll need a Mac for hosting an iOS build process but TFS can connect to it and everything should Just Work.

Other Notes and Links

I mentioned Calabash as an alternative tool for creating tests for use locally or in the Xamarin Test Cloud. More information about Calabash can be found at:

The videos that didn’t play:

The first was a section from the HockeyApp & DevOps talk at Xamarin Evolve, specifically the portion of the video which addressed the annotation and user feedback features of HockeyApp:

The second video is a later section of that same presentation which dealt with setting up automated (or manual, if you prefer) distribution pipelines such that an app could be auto-published to the app stores after passing tests and getting required authorizations from managers and testers:

I highly recommend watching the whole video as it really does a good job covering the DevOps/CI/CD story that is possible with the Xamarin & Microsoft (VSTS) tool chains:

Last is this two and a quarter minute high-level overview of the features of HockeyApp… short enough to be digest-able by most managers:

So you want to build a mobile app — show me some resources!

Today I’m debuting my new talk — “So you want to build a mobile app — now what?” — at Iowa Code Camp 17.  While this following isn’t an exhaustive list of resources mentioned in my talk, here are some high-level links to get started.  I’m re-writing this talk from scratch (yes, the mobile world changes that fast!) and will be presenting it again at the DevUp conference in Saint Louis on October 21.


Clean Code versus Really Clever Code

Last year I found this humorously unreadable chunk of C# code on a blog.  Without explanation, here’s the code:

// “Animal” is a class from which there are many
// inherited classes, one of which is “Dog”
for (Dog _dog = _animal as Dog; _dog != null; _dog = null) {
//more code here

As we’re preparing to interview candidates to back-fill a C# web developer position here at work, I’ve decided to print out this code on a sheet of paper and have it on hand for possible use in an interview.  The questions based on this code are:

1. Describe what will happen when this for loop executes.
2. What would you do if you encountered code like this in the application?

If your first reaction to the code is confusion, don’t be alarmed. Most senior devs will blink and stare at this code and not get it, and have to “mentally compile and run it” even after it’s explained.  If another reaction is a desire to gag, puke, or want to do violence to whomever wrote that, you’re also in good company.

But the question remains: what is happening here?  I think this is a valid code scenario with which to quiz a C# interviewee because most of us only think of the for loop construct as being useful for iterating over a collection.  Yes, you can iterate over a collection with a for loop but C# has a better tool for that: the foreach loop.  What makes the for loop interesting is that it’s an assign, evaluate, reassign construct.

(If you really want to know what’s happening here, the explanation is at the end of this piece.)

Admittedly, this looks like a blatant gotcha of an interview question, but that’s not the point. The expectation isn’t for someone to explain it (which they probably won’t be able to do unless they’ve already read this: but to be knocked a bit off balance by it before having the logic flow described, allowing them to see how and why it works. Once the process of the for loop is explained and the interviewee gets it, the table is set to ask the question that this scenario is really about:  What would you do if you encountered code like this in a production application? Any reasonable variation on the following is what I’m looking for: I would re-write it as follows to make it more easily readable to every programmer after me who has to work in this part of the code base:

Dog _dog = _animal as Dog;
if (_dog != null) {
//more code here

It’s not unusual for interviewees to write code in an interview: depending on the scenario it gives insight into the person’s thought process and problem solving skills. But I think it’s also useful to get a feel for whether a candidate would be inclined to impose readability on a block or section of obtuse code while passing through.

The real question here is: do you write clean code? Are you merely going to add code to the applications here, or are you going to make it a better code base as you go along? Any programmer can write code that a machine can understand but I want to know if you’re committed to code that humans can read. And if you are a clean-code programmer then I want you on my team.

(If you have not taken Cory House’s course on clean code — Clean Code, Writing Code for Humans — you really should… I can’t recommend it highly enough.)

* * * * * * * * * * * * * * *

As promised, here’s the explanation to the weird looking for loop. To understand this it’s important to remember that a for loop isn’t a mere iteration construct: it’s a construct with an initial assignment following by an evaluate, process, re-assign loop which continues until the evaluation returns false. Let’s go through it step by step:

The initial assignment: this which happens only once in the life-cycle of a for loop — we define a variable of the type Dog and, using the “as” keyword, we cast _animal to Dog and assign that to the variable _dog.  If the “as” keyword in C# is new to you the key thing to know is that if _animal cannot be cast to Dog then null is returned.

The evaluation statement: _dog != null.  In the previous step, if _animal can be cast to Dog, then this evaluates to true (_dog won’t be null) so code in the body of the for loop.

The reassignment statement: this might be the part that tripped you out the most. Typically this statement is something along the lines of “i++” (or “i + 2” if you’re skipping every other item in an array) but any valid assignment work here… such as “_dog = null.” This statement runs after the first execution of the code in the body of the loop and immediately before re-running of the evaluation test (_dog != null).

So in plain English: if _animal is able to be cast to the type Dog then run the block of code exactly once. It’s useful to realize a for loop can be used this way, but writing code like this is extremely hard to read… so hard that even after it’s explained you probably went back to step through it in your brain.  Code as obtuse as this should always be re-written to something simpler to understand.


Switching to Windows Phone: The Google-Free Zone

While I am almost completely happy with my switch to Windows Phone, the lack of apps from Google is rather annoying.

Google ships exactly one app for Windows Phone: their Google Search app.  This used to really get on my nerves since I use Gmail for my email and had switched to using Hangouts instead of iMessage for chat/instant messaging but I think I understand — at least partly — why Google is doing this.  Sure, part of it is competition: they are rivals with Microsoft on several levels.  Then again, Google is also in competition with Apple in the phone market as well but yet they provide numerous apps for the iPhone and iPad.  So what’s the difference? The underlying phone’s SDK.

If you wrote Windows Phone 7 apps you know that these had NOTHING in common with the Windows Mobile 6.x apps from the WinCE days. I don’t recall if Windows Phone 7.5 required major rewrites but I seem to recall that WP7 apps had to at least be re-comiled for 7.5.  Ditto WP8.  And Microsoft is now talking about “Universal Windows Apps” starting with Windows 10 (and whatever number the Windows Phone OS happens to be) which will replace the current Windows Store apps on Windows proper and the apps on Windows Phone.  Given that the state of the API on Windows Phone is less stable than the politics of eastern Syria it’s no wonder a company would avoid Windows Phone for now (even a company with a bazillion programmers such as Google).

So while I initially wanted to hold it against Google for not providing apps for Windows Phone, on second thought I can’t really blame them.  This is a mess Microsoft has made for themselves over and over.  Ironically, Xamarin might be their savior on this front.

Switching to Windows Phone: it Just Works

I was planning to get all cute with the title of this blog post, making reference to the default dark color scheme of the Windows Phone, by calling this the “Welcome to the Dark Side” installment.

But honestly, that’s just too dramatic for this phone, which is the real theme of this piece: it just works.  No drama, no needing to reboot the device because the Audible app has hung (again!). There is nothing flashy about this phone or the O/S to the point it’s almost boring.  But on second thought, isn’t that a good thing?  I’m not fighting this phone to get it to do what I want: the Podcasts app works as expected (though I really wish I had a button to go back 30 seconds and hear the last few sentences again).  The music app just works.  There were no headphones that came with this phone so I can’t say they “just work” but the $20 Amazon Basic headphones (ostensibly for their Fire Phone) work like they were made for this phone.

In the last post I ranted about what the phone is missing in terms of apps, but it’s missing something else as well: frustration and configuration headaches.  Need to sync your contacts and calendars from both your Google and iCloud accounts? No problem! Need to import all of your music from your iTunes library? Microsoft has an app for that (which works on Windows and Mac) which does it’s job well and nothing more.  I want to expand on this last point a bit.  If you have a Mac and an iPhone then you know the “joy” of having your Mac happily launching a bevy of applications as soon as it sees your iPhone connected (you know, because if iTunes doesn’t automatically back up your phone’s state, or iPhoto doesn’t upload your photos, and iCal doesn’t do whatever the heck it’s doing when it sees your phone then you’ll never remember to do it on your own!).  Not only will a Mac, like an over-eager puppy wetting itself at the return of its master, launch a bunch of apps upon the connection of an iPhone, there’s a photo import process related to iPhoto which sucks up so much memory that my habit was to reboot my Mac after syncing and disconnecting my iPhone (16GB is enough RAM for mobile application development in Xamarin Studio along with a bazillion Safari and Chrome tabs open, but not enough for an iPhone apparently).

I know… First World problems, but my Lumia 635 doesn’t give me any of that drama… and isn’t this more in line with what we want our phones to be?