Getting a new dev machine set up, macOS Style

It’s that time of the decade when I get a new Macbook Pro. I use a Macbook to compile iOS apps with Xamarin which makes it required equipment. Even though my current one was a late 2014 model, it was still fast enough to do what I needed to do. It’s a work laptop and was out of warranty, so I was due for a new one. The 2014 one will go to another developer.

The last time I did this, I did a blog post on what I installed. This will version will be mostly the same, plus adding the cool new things that have come down the pike in the last 4 years.

FileVault
First thing to do is to enable Apple’s full disk encryption. If someone steals this thing, they can’t access the files. They can get my body, but not my soul.

VPN
This is my work laptop. Which means the usually Corporate IT requirements. Which includes a VPN so that I can connect back to the mothership when I’m remote. Plus the corporate AV solution de jour.

Files
I had tons of files to move over. I was pretty good about keeping the files under the user folder. Between my old MacBook and this one, I used AirDrop. I also copied a fair amount of files from the old Macbook to my home server and then from the home server to the MacBook.

I took care in copying over the .ssh folder. Which in retrospect was a waste of time, It’s easier just to regenerate the public keys.

Homebrew
This is a one of those command tools that makes it easier to get other command line tools (git, node, iterm, etc). Here’s a good guide for how to install Homebrew.

Fira Code
If you spend half of your day slinging code around, treat yourself to a font that is designed for coding and has ligature support. Fira Code is a nice, easy on the eyes font and has the ligature support that your eyes have been craving.  Using ligatures with coding is a personal preference and there are some good arguments against using them.  I would suggest turning off ligature support when presenting your code or posting code listings.

Iterm2
While MacOS comes with fully capable terminal app, there are ones out there that provide a more productive workspace. One of them is Iterm2.  Better copy/paste, better tabs, better autocomplete.  Just get it from here.

Zsh
After installing iTerm2, the next thing is to install Zsh with Oh My Zsh. Zsh is an *nix shell built on, but greatly improved over Bash, the standard MacOS shell. Oh My Zsh is a an open source kit for managing Zsh. I followed this guide for installing Zsh and Oh My Zsh. And I’m learning how to use it from this cheatsheet.

QuickRes
If you are doing screen captures, you don’t always want the captures done at Retina resolution. I usually use a second monitor at 1920×1080 (1280×720 if recording for Pluralsight), but if you only have the MacBook, you can use 3rd party apps to force the resolution down. QuickRes is a popular one. I haven’t had the need to use of of these utilities, so this is more of a way of stashing that information.

Xcode
Even though I do my coding with the .NET stack using Xamarin, I still need to have Xcode installed.  Apple makes the Xcode compilers part of the tool chain.  Plus that’s the only way you get the iOS Simulator.

Certificates
The bane of any Apple developer. I have a bunch of developer certs to move over. I didn’t use any sane way of moving them. I just let Xcode pull them down to the new machine. Afterwards, I discovered Fastlane.

Fastlane is an open source project designed to manage Android and iOS deployment and it has command line tools and strategies for managing the Unholy Hell that is Apple codesigning. I think I’m going to redo how we handle certificates and provisioning profiles for the next project and use Fastlane to manage them.

Visual Studio 2019
As a Xamarin developer, this is where I spend a great of deal time in. When installing, make sure to add Xamarin Workbooks. Get it here.

After installing VS, I used to have to update ~/.android/advancedFeatures.ini to include the line
HVF = on
This sets Google’s Android Emulator to use Apple’s Hypervisor-Framework to speed up the performance of an x86 emulator image. I used to use Intel’s HAXM, but we don’t need that anymore. The Google Android Emulator can now use the native hypervisor on MacOS and Windows. Taking HAXM out means one less thing to worry about breaking when you update the OS. With the current install of VS 2019, this is set for you.

Visual Studio Code
This has replaced every other text editor for me on both Windows and the Mac. I use it edit MarkDown files, write C for embedded hardware, quickly hack .csproj files, and pretty much any file that starts with “.”. Get it here.

If you want to run VS Code from the command line by just typing code, do the following:
Open the Command Palette (⇧⌘P) and type ‘shell command’ to find the Shell Command: Install ‘code’ command in PATH command.

Docker
Remember when we used to spin VMs to run specialized apps? I still do run Windows on my Mac, but for everything else we have Docker containers. It’s 2019 and the ability to run SQL Server on a Mac in a Docker container is old news. So you’ll probably want Docker Desktop for the Mac.

Pluralsight Offline Player
I’ve been a big fan of Pluralsight for a number of years. And as of this year, I’m also a Pluralsight author. If you get the Offline Player App, you can download courses and watch them without an Internet connection. Like on a plane.

Vysor
When testing Android code, an actual device works much better than an emulator. Vysor provides a remote desktop to the Android device, which is handy for using the keyboard and doing presentations. Vysor uses ADB to make the connection, but if you doing Android development work, the odds are high that ADB has already been installed. There is a free version, but get the paid Pro license. You get more features and it keeps the product funded.

OneDrive
I share files with multiple providers and on multiple machines.  I use OneDrive a lot.  I have a personal account of about 20 GB and an Office 365b account for work.  I used to be a big fan of Dropbox, but they changed their policies and it costs more to use an account on multiple computers.  So I’m phasing out my usage of DropBox.

Microsoft Edge
Who knew that Microsoft would do a better Chrome than Google? It behaves a lot like Chrome, but it feels a little snappier. Competition is a good thing. Get it here.

Google Chrome
While the Chromium based Edge browser is my day to day browser, I still use Chrome. It has better synching of bookmarks and easy access to Google Services. You know where to find it.

Adobe Creative Cloud
Photoshop and Illustrator are still the gold standard for working with bitmap and vector images. I also use Premiere and After Effects for inhouse video projects. If you are creating animations with Lottie, you are going to need After Effects.

PaintCode
PaintCode is one of those really cool developer apps that only exist for the Mac. This app lets you take and edit vector images (.ai, .svg, .pdf) and convert them to resources that you can use in your apps. It can take an image and convert to an object in Swift, Objective-C, C#, and Java. It can also export Android Vector Drawables and SVG files.  My typical usage for PaintCode is to take a source image from Adobe Illustrator in .ai format and use it to render Android Vector images along with .png (with the @2 and @3 variants) for iOS.

A really cool feature is if you are creating an object in code, you can assign properties to parts of the images. You can move, rotate, or scale them. Change their colors, animate them, change the visibility. Very handy when you have an object that change appearance based on the input from the user or the data.

Snagit
This is probably the best screen capture tool that you can use. I use it on both Windows and Mac and I just love it. From the good people at TechSmith.

Camtasia
Also from Techsmith comes Camtasia, a video editing app that is great from online training courses. It’s what I use for making Pluralsight courses.

Office 365
The Office apps on the Mac have more or less parity with the Windows version. It’s what we use at work, so I have most of the Office experience. In additional to the standard Office apps, I add Skype for Business and Teams. Our team lives inside MS Teams and it’s pretty much the same experience on both platforms.

Slack
I’ve installed the Slack desktop app as an experiment. I have been using the web page, but when you belong to a bunch of Slack sites, it starts getting cumbersome to manage.

Postman
A handy tool for checking web service calls. Design and test your web API calls with one tool.  Get it here.

VLC
This video player will play just about anything. Video files, DVDs, streaming protocols, etc.

Google Earth Pro
Vey handy when working with KML files and just fun to play with. You can do more with the desktop edition of Google Earth than is available with the online versions.

Audacity
While Adobe CC has a good audio editor with Audition, most of the time when I need to edit an audio file, Audacity is just what I need. It’s free and open source and it does pretty much what most of us need,. I should learn Audition though.

Parallels Desktop
When I need to run Windows on my Mac, I use Parallels. I used to use VMWare Fusion, but it was just a pain in the ass. Dragging a window from a Retina screen to a FHD didn’t handle the font scaling correctly. And it was slow.

Moving my Windows 10 VM from my old Mac to the new one was trivial. I copied the VM as a file from one machine to the other. I then installed Parallels on the new machine and it was able to open the VM without any complaints. When I enter in the activation code, it prompted me to deactivate the license on the old PC. I hate having to deal with licenses, but this was tolerable.

BetterTouchTool
This should have been baked into the OS. If you want window snapping features or want to customize the Touch Bar, then get BetterTouchTool.

Disk Inventory X
Sometimes you run out of disk space. This will show you where it went

Windows only apps that I would to see on the Mac

Multilingual App Toolkit
This is a Windows only tool from Microsoft. It provides a workflow for managing language resource files and can perform machine translation through Cognitive Services. It integrates into Visual Studio, but only Windows.

Markdown Monster
This is a neat editor for editing Markdown files. While VS Code has pretty decent support for Markdown, Markdown Monster is better.

LINQPad
I have had days where this is the only development tool that I have touched. When I’m testing some new .NET code or tweaking calls to a web service, LINQPad is the tool that I tend to grab first. And I really want a Mac version.

Hardware

At my desk, I use both Windows and Mac machines. I often go back and forth. I used to have identical keyboards with separate mice. This takes a fair amount of desk space. For the last 100 years, my keyboard of choice has been the Microsoft Natural Keyboard 4000. If I’m lucky, I get a year out of one.

After I fried the last one, I decided to switch gears a bit. I got the Logitech Craft keyboard and MX Vertical Mouse. The MX Vertical supports Logitech’s Flow feature. When paired to two or three computers, you can treat the desktops as single expanded desktop. When I move the mouse off the right edge of my Windows desktop, the cursor is on the left edge of the Mac desktop. And the keyboard switches at the same time. You can also copy and paste between the computers. It’s a neat trick and probably works as expected 98% of the time.

I’ve been using the MS Natural keyboards since they came out and I’m still getting used to the regular layout. The vertical mouse helps my wrist more than then keyboard and having just one keyboard on my desk is worth the compromise. They are wireless and use USB-C, which made me like them before opening the box.

Docks
For years, I’ve been asking for every port that wasn’t USB-C to just go away. For better or worse, I got my wish with this Macbook Pro. It has 4 USB-C/Thunderbolt 3 ports, and oddly enough given what Apple did to the iPhone, a headphone jack.

My old MacBook Pro has this wonderfully insane dock from Henge Docks. You place the MacBook down and two arms would automagically connect to each side, replicating all of the ports to the back. Except some how it gained a full sized Display Port connector and Ethernet port. It was crazy and fun, but tied to the port configuration of the models that it supported. So they stopped making it.

I now have one of their new models, the Stone Pro. It sits underneath the Macbook and connects with a USB C/Thunderbolt 3 cable. When I get to work, I just connect the one cable and my external monitor and iOS devices are connected. And it has it’s own dedicated power supply. Which means I get to leave the Apple brick in my backpack.

I did get a smaller dock that connects to the side of the MacBook Pro, using two of the USB C connectors. It replicates the ports, plus adds a HDMI connector, USB A ports, and SD/Micro SD card slots. All of which is useful when I go somewhere and want to share my screen.

I do want to note that as much as I love having a chunky USB C charging brick, I already miss the Mag Safe 2 connector. There are 3rd party magnetic USB C connectors, but I have yet to see one that would fully support the power and data functionality. There is something common sense about a power cable that wont drag your laptop off the table when someone trips over the cord.

I get that it’s trickier to do data connections with a magnetic connector. A momentary disconnect of the power lines will have little to no effect. Dropping the data lines is different matter altogether. But Apple, find a way to make it work.

In the 4 years since the last Mac upgrade, it has become a lot easier to work all day on the Mac. All of the MS Office apps that I use are there and have more or less parity with the Windows versions. The developments tools are on both. Still better on Windows, but that gap is narrowing. The Mac keyboard still drives me crazy, but since I use external keyboards most of the time, it’s just something for me to complain about.

All product logos in this post are property of their respective owners.

When your Apple device refuses to be trusted

Back in July, I received a new Macbook Pro.  A lovely little device, but I had this one problem.  It wasn’t showing up as a trusted device under my iCloud account. 

When you log into a site or a service that requires Apple’s 2 factor authentication, you can use a Trusted Device to generate a 6 digit authentication code.  Most people use their iPhone, but I don’t have an iPhone.  Plenty of other Apple devices, just not the phone.  And 2 factor authentication works on my iPad, my old Macbook, and my Mac Mini.  Just not on the new Macbook. 

The 2 Factor Auth prompt

When I’m travelling, the only Apple device that I carry is the Macbook.  When I log into a service that needs the Apple auth, I want to be able to use my Macbook to provide that code.  That’s a pretty reasonable request.

This is what you should get

This has been frustrating me for a good month or so.  There is no switch or setting to enable.  Once you enable your iCloud account on an Apple device made in the last few years, that device is now a trusted device. That’s all you are supposed to have to do.

Except for my new Macbook.  It would not display the dialog that would prompt for the authentication code.  I tried Apple Support via email, but that proved to be fruitless.  I don’t think that they fully understood the problem.  I tried again today with Apple Support via phone.  It took the better part of an hour, but we finally resolved the problem.

Basically everything was setup correctly and should have worked.  But it didn’t.  With anything computer related, sometimes the best solution is to nuke the problem from a Low Earth Orbit.

It’s the only way to be sure

So we removed the iCloud account, rebooted, and added it back again.  That resolved the problem.  The Apple Support rep thinks that the iCloud auth token on the Macbook was corrupt. I have no idea how or why that happened, but that would explain what caused the problem.

Opportunity has ended it’s mission


NASA’s Opportunity Rover looks back over its own tracks on Aug. 4, 2010. Image credit: NASA/JPL-Caltech

Last night, NASA sent it’s final communique to the Opportunity rover. Somehow managing to last more than 14 years past it’s 90 day mission, Opportunity stopped responding after being blanketed by a planet wide dust storm last June.

It’s last message was received on June 10th, 2018. It sent that last message from Perseverance Valley. It went into hibernation mode shortly after that. It was hoped by NASA that after dust storm ended and the Martian winds had blown the the dust off the solar panels, that contact would be reestablished. After a final attempt was made to contact
Opportunity on February 12th, 2019 NASA declared the project dead. For mission highlight’s check out Six Things to Know About NASA’s Opportunity Rover.

Selfie from Opportunity. Credit: NASA/JPL-Caltech/Cornell

A perspective view of Opportunity’s final location, taken by NASA’s Mars Reconnaissance Orbiter in February of 2018.

That time I taught that dog a trick

Image by FiveRings [CC BY 3.0], from Wikimedia Commons

Many, many years ago, I used to work with Jack*.  Jack is a musician and at the time was in band with two other guys.  Jack was renting this little cottage and that was where the band would rehearse.

One fine summer evening, the singer (Bill) came over with his dog. It was one of the little dogs with a vague, call it haphazard, genetic history.  The dog’s name was Zero (a cool name for a dog or a singer).  Bill’s landlord had just discovered that Bill had a dog and Bill’s lease prohibited pets.  Bill asked/pleaded/demanded if Jack could watch Zero for a few days.  Jack was the new guy in the band and felt a bit pressured to allow the dog to stay.

A few days turned into a couple of weeks.  Jack is not really a pet person.  He had nothing against Zero.  Zero was a perfectly fine dog.  It was just a responsibility that Jack didn’t want.  At that point in life, I really didn’t know anything about dogs.  Whenever I came over (I spent a lot of time there), I would play with the dog and we became friends.

So I decided to see if I could teach my new friend a trick.  Jack’s cottage had a little bit of land, enough for the dog to run around in.  There wasn’t a lot of space, but there wasn’t a lot of Zero either.  The cottage didn’t have many rooms, but it had a small living room.  There was a couch with a window right above the couch.  It was a pleasant summer and the windows were usually open.  The living room window didn’t have a screen in it. This would come in handy.

Over the span of a couple of days and a fair amount of dog treats, I trained Zero to jump out of the window on command.  If I said “Zero, Out!”, the plucky little dog would run into the living room, bound up on the couch and jump out the window,  That was the easy one.  It took much longer to train the dog to jump back in through the window.  But somehow, he did it.  If I yelled “Zero, In!”, he would take a running leap to the window.  He would get his front paws up on the window sill and pull himself in, back legs scrabbling against the siding.  Good times.

After a few days of training the dog to jump out a window, Bill came over.  I was outside with the dog and I stepped inside to see Bill.  Bill despised me and me being there always annoyed him.  After ignoring my greetings, he looked around for his dog.  He asked Jack where his dog was.  I spoke up: “You want Zero, he’s outside.  I’ll get him for you….  ZERO, IN!”.

On command, Zero came in through the window.  Bill was speechless to a moment and then managed to sputter out “What?”.  I said, “You don’t him in?  ZERO, OUT!”.  The intrepid canine went sailing back out the window.   Bill’s face turned red and I yelled “ZERO, IN!” and the dog came back in.

To make a long story, Bill took the dog home that night.

Looking back on this, I get that it was a really stupid thing to do to a dog.  And I don’t advise anyone else to teach an animal to jump out a window.  Zero was small and light, a larger dog could have been seriously injured.  Plus, it’s all fun and games when you are on the first floor….

* The names have been changed to protect the sheepish.  Except for Zero, he had a cool name.

Microsoft Edge to adopt the Chromium project

After a week of rumors, Microsoft has just publicly announced that they will be adopting the Chromium project for their Edge Browser.  They actually announced three things today:

  1. The Microsoft Edge browser will adopt the Chromium project
  2. Edge will no longer be released just for Windows 10, with updates limited to the latest version of Windows 10.  Edge will be available for Windows 7, Windows 8, and probably MacOS.
  3. Microsoft is joining the Chromium project and will be an active contributor.

What does that mean?


This is A Good Thing

Chromium is an open source project that Google started.  It is the basis for the Google Chrome browser. For better or worse, Chrome is considered to be the standard that web developers use for measuring compatibility.  There are things that Edge handles better than Chrome.  Touch gestures and battery life are better on Edge.  Microsoft has done a lot of work on accessibility and assisted reading devices.

This does not mean that Edge and Chrome will be the same thing.  Microsoft will add their secret sauce to the new Edge browser.  Nothing has been announced yet, but I would guess that it have better ties to Office 365 and Azure services.  Also Edge will be the default browser that comes with Windows.  When you get a new Windows PC, installing Chrome will no longer have to be the first thing that you do.

With the releases on older versions of Windows and Mac, developers will have larger audiences that can run Edge.  Enterprise customers with long term support for Windows 7 or Windows 8 will have a browser that will be continued to be supported for their machines.  Mac users will have the same experience on Mac and PC.

Microsoft will be joining and contributing to the Chromium project on Github.  Over the last few years, Microsoft has been one of the largest supporters of Open Source and has been an active contributor for many projects.  If you use Edge, you will have a closer match to web standards.  If you use Chrome, then you’ll get the benefits that Microsoft will add to the code base.  A rising tide lifts all boats.

What does this mean to developers who were targeting Edge?

Edge currently uses a rendering engine called EdgeHTML.  It was designed to be faster and more compliant with W3C web standards over Internet Explorer.  It’s part of the Windows 10 OS and updates are issued as OS updates.  It was pretty compliant with W3C standards, but Chrome was more compliant.  Quality Assurance testers would have to run different tests to make sure that web apps ran the same way on Edge has it does on Chrome.  With both apps using the same parsing and rendering engine, web pages should look and run the same way with both browsers.

With the move to Chromium, the Javascript engine will change from Chakra to V8.  Both are very good parsers and compilers, most web pages should have roughly the same performance with either engine.  There are runtime versions of each for Node.js.  One question will be will Microsoft continue to support and advance Chakra or will they focus that effort on improving V8.

So when?

All Microsoft is saying is “early 2019” for the preview builds.  While Microsoft has not given out a release date, I would be on sometime in mid 2019.  This isn’t their first trip to this rodeo.  The Edge browser on Android is based on Chromium now, so they have some experience with the code base.  If you would like to get early access the next Edge, you can register for the Microsoft Edge Insider program.

Fix for “[Network & Virtual Switch] Failed to update DDNS “myQNAPcloud”

After Windows Home Server was more or less retired by Microsoft, I bought a new NAS server for home.  After some deliberation, I bought a QNAP TS-451+, a couple of years back.  It has been very reliable and is one of those things that Just Works.

Today I logged into it and it said that it had a firmware update, to version 4.3.5.  I haven’t had any issues at with firmware updates so I let it do it’s thing and went back to mucking around with the faulty CAT6 connections in my house.

After about a half hour, I started seeing emails coming in from the QNAP box.  When something goes it wrong, it does a nice job of sending me email notifications.  Every 10 minutes, I was getting the following error message

NAS Name: swan
Severity: Warning
Date/Time: 2018/10/15 23:26:17

App Name: Network & Virtual Switch
Category: Infrastructure
Message: [Network & Virtual Switch] Failed to update DDNS "myQNAPcloud".

OK, that’s a new one.  I took a cursory look at the settings and apps, but didn’t see anything amiss.  Fortunately, the Internet is now on computers and I pasted that error message into my browser and it found stuff.  I found a message thread on the QNAP forum (you are not a real product unless you have a support forum) that mentioned the problem.  Misery loves company and when it comes to computers, seeing other people with the same problem means that it’s probably Not Your Fault.

Other people had posted that this problem started after installing the 4.3.5 firmware upgrade.  I posted a “me too” post (not a #metoo post).  I then decided to see if there was something obvious that I could fix.  Under My Apps, I had a MyQNAPCloud app and it wasn’t running.  What this app provided was a mechanism where the QNAP box would punch a hole through your router and get you a domain name that would route down to your server.  With SSL via Lets Encrypt.  All in all, pretty cool.

Sidebar:
If you are not familiar with QNAP servers, they are running some variant of Linux and there are apps that you can download and run to extend the functionality.  They do a very good job of hiding the nuts and bolts of the OS from you, you manage everything from a web based GUI.  It’s quite impressive.  You basically pick a name and you get https://notmyrealname.myqnapcloud.com and that takes you to the management portal of your server.  From anywhere.

When I drilled into the MyQNAPCloud app, it gave me the ever so useful error message of “MyQNAPCloud cannot start because of incorrect information in its configuration file”.  And there was no way of accessing that configuration file.  At least nothing that was immediately obvious.  So I deleted the app to see if I could download it again and reset the configuration.

After I deleted the app, I discovered it was no longer in the QNAP App Store.  Rut ro, Shaggy.  I fired up the Network & Virtual Switch app and selected the DDNS option.  When I doubled clicked on DDNS, it launched a myQNAPcloud window.

The thick plottens.  What used to be a downloadable app was now part of the OS.  I went in and had it verify that the router was configured correctly.  It’s 2018, UPnP actually works.  I forced the SSL Certificate module to update the Let’s Encrypt certificate.  If your site doesn’t use SSL, get a Let’s Encrypt cert.  It’s free and it works.

After futzing around with the myNAPCloud settings, I let the QNAP box do it’s own thing while I sent back to CAT6 things.  After 20 minutes, I noticed that the warning messages had stopped.  This is a good thing, I had addressed whatever the problem was.

This was one of the times where poking the beast with a sharp stick actually worked.  I like the QNAP boxes.  They are easy to work with, up-gradable, and the UI is actually useful.

Planning for Wi-Fi

After 20 years in our existing home, we are getting ready to move to a new home.  The new house is still being built and I had CAT6 run to the places where I thought it would matter.  Time to plan for Wi-Fi. The new house is a single floor design, with a decent sized basement.  Once again, Fios will be our ISP.  The ONT will be installed in the basement and at some point, I will build (or hire someone to build) an office in the basement.  The plan is to have the Fios router in the basement and run the CAT6 cables to the router. I need the Fios router because cable boxes need it there in order to get their channel guides.  The current plan is use a Mesh router setup on the main floor to provide the Wi-Fi.  As a router, the Fios router is fine, but for Wi-Fi it’s pretty much “meh”.

Meh

The Mesh router that I like right now is Eero Pro package.  You get three Eero routers that work together to provide a true mesh network.  The user just sees a single SSID and the device connects to the Eero device that has the best signal.  It’s a tri-band system, using three radios.  You have your standard 2.4 and 5 Ghz radios that handle the typical alphabet of 802.11 Wi-Fi channels.  And one more 5 Ghz radio that works as a back channel for the Eero devices to talk to each other.

Eero Pro

With the Eero Pro, one of the routers is defined as the master and the other two are the satellites. If you only have the master wired to the modem (or other ISP provided device), the other two units connect to the master over the back channel.  The Pro system can use a wired connection for the back channel.  Wired beats wireless for speed and dealing with pesky things like walls.

I like to go fast

I haven’t decided if I want to run the Eero units as Access Points (AP) or let one be a full router and have a double NATed home network.  It will work either way, but running in AP mode will port forwarding simpler.  I have a QNAP NAS server and it’s useful to be able to remote access it from the outside.  With a single NAT, it can more or less configure the router to forward the right ports.  When you have it double NATed it gets complicated. So why Eero?  It’s certainly not the cheapest option.  There were several things that I looked for a mesh system.
  • Performance I wanted the biggest bang for the buck for Wi-Fi.  I want stuff to work and I want to take advantage that I had the house wired for Ethernet.
  • Appearance I don’t want hardware with an ungodly number of antennas or something mounted to the ceiling like a smoke alarm on steroids.
  • Support Ideally, you shouldn’t have to worry about support.  But this is the Achilles Heel for the big players in the consumer space.
In the reviews that appear in the usual places, the Eero devices usually come out on top or near the top for performance.  In the reviews that I have seen, the Netgear Orbi devices tend to be the fastest.  But your mileage may vary.  The Orbi devices tended to be bigger and their support, well, didn’t get rated as high as the Eero devices.

The Netgear Orbi

The Orbi was probably my second choice, but I think the Eero will work better for my setup.  The Orbi router and satellite do come with a generous number of Ethernet ports.  That would be the only thing that I would ding the Eero on.  More importantly, frrom what I saw on in the Eero support forum and on Reddit, it looked like people were happy with them.

It’s the Borg, with rabbit ears

Some of my more technically bent friends suggested that I look at the Ubiquiti product line.  There are two separate and very different consumer product lines.  The Amplifi system is a router in the shape of small cube and two satellites.  The satellites are ugly little things with antennas that need to oriented for best reception.  The performance didn’t come anywhere near the Netgear or Eero offerings.

Glowing Frisbee mounted to ceiling

Ubiquiti also has the Unifi line of access points.  They are really cool and the management end is very powerful.  But I didn’t want glowing frisbees mounted to my ceiling. And the POE thing means all new switches to power the APs.  They are really good technology, I just didn’t want to deal with it. So I’m about a month away from moving in and playing with the Eeros.  It will be interesting to see what kind of performance I get out of them.

A Xamarin wrapper for the ACS USB library for Android

ACS ACR122U USB NFC Reader

ACS ACR122U USB NFC Reader

A while back, we were using RFID readers made by ACS.  They make a number of decent readers and we used one of the USB models, ACR1220U, with our bespoke Android tablet.  To communicate to the reader, ACS provides libraries for Windows and Android.  The Android library comes with a .jar file and some sample (but very limited) code.  The demo showed how to connect to the reader, but didn’t have that much for getting information from the reader.

The ACS reader follows the SmartCard standards.  Their library provides the low level access to the reader.  It’s up to the consumer of the library to write the code that actual sends and receives data from the RFID reader.  If you are working with a SmartCard reader, then you’ll need to know how to create APDU packets.  An APDU, application protocol data unit, is the command packet that is sent from the reader to the card, and from the card to the reader.  When you use this reader, your code is responsible for creating and sending the packets.

The logic that I used more or less follows this flow:

  • Reader signals the application that a card has been detected (or no longer detected)
  • Applicate tells the reader to a warm reset of the card
  • Application tells the reader to set the communications protocol for talking to the card
  • Application tells the reader to transmit the APDU command to get the unique identifier (UID) from the card
  • The response from the transmit command will have the UID from the card.

And that’s just to get the UID from a card.  If you are trying to read a NDEF packet, then you have a lot more work to do.  NDEF records are stored differently, depending on what kind of card that you are reading.  If you are using RFID data from cards with the built-in NFC support that Android provides for hardware that comes with the device, you are benefiting by the low level code being handled for you.

For the last .5 decade, we’ve been using Xamarin for our Android coding.  To use the ACS reader, I created a Xamarin wrapper library for their Java library.  It basically takes and embeds the .jar file and provides a nice .NET API to their library.  I then took their sample library and did a more or less straight port from Java to C#.  If you grab that repo from Github, you’ll get the library and and the demo app.  It was created with Visual Studio on Windows, but should work on the Mac.  Should being the code word for “I didn’t do anything that was platform specific, but I didn’t test it on the Mac.”

The results of that wrapper/conversion are up on Github.  You can grab it here. The .jar file that the library is compiled with is included in the repository. It is part of an API kit that should be downloaded from https://www.acs.com.hk/en/mobile-support/. The API kit includes the API documentation in HTML format.

The library does not have the APDU code to get the data from a RFID card.  I do have that code, but at the moment it’s part of some code that I can’t share.  I’ll pull the APDU code from our business code and post it later.  In the meantime, this is the code from the OnStateChange event that gets assigned to the reader.

        public void OnStateChange(int slotNum, int prevState, int currState)
        {
            // If the previous state and the current state are outside the range of allowable
            // values, then assign min/max of the range
            if (prevState < Reader.CardUnknown || prevState > Reader.CardSpecific)
            {
                prevState = Reader.CardSpecific;
            }

            if (currState < Reader.CardUnknown || currState > Reader.CardSpecific)
            {
                currState = Reader.CardUnknown;
            }

            // Create output string
            string outputString = "Slot " + slotNum + ": "
                    + stateStrings[prevState] + " -> "
                    + stateStrings[currState];

            // Log the status change
            LogMsg(outputString);

            // We tapped the card
            if ((prevState == Reader.CardAbsent) && (currState == Reader.CardPresent))
            {
                // We have the right slot - opening the reader generates a spurious StateChange event
                if (slotNum == SlotNumber)
                {
                    // read the card

                    // The APDU (smart card application protocol data unit) byte array to get the UID from the card
                    // Command  | Class | INS | P1 | P2 | Le
                    // Get Data |   FF  | CA  | 00 | 00 | 00
                    var command = new byte[] { 0xFF, 0xCA, 0x00, 0x00, 0x00 };

                    // The byte array to contain the response
                    var response = new byte[300];

                    try
                    {
                        // In order to set the Get Data command to the card, we need to send a warm reset, followed by setting
                        // the communications protocol.
                        var atr = this.Power(slotNum, Reader.CardWarmReset);

                        this.SetProtocol(slotNum, Reader.ProtocolT0 | Reader.ProtocolT1);

                        // Send the command to the reader
                        var responseLength = this.Transmit(slotNum,
                            command, command.Length, response,
                            response.Length);

                        // We appear to be getting all 9 bytes of a 7 byte identifier.  Since 9 would be considered a too
                        // large value of 7, we drop the last 2 bytes

                        if ((responseLength > ForcedIdSize) && (ForcedIdSize > 0))
                        {
                            responseLength = ForcedIdSize;
                        }

                        // If we got a response, process it
                        if (responseLength > 0)
                        {
                            // Convert the byte array to a hex string
                            var s = ByteArrayToString(response, responseLength);

                            // Add the scan to the collection and notify any watchers
                            AddScan(s);

                            // Notify any watchers
                            LogMsg($"UID: {responseLength} {s}");

                        }
                    }
                    catch (Java.Lang.Exception e)
                    {
                        LogMsg(e.Message);
                    }

                }
            }
        }

This is probably as a good point as any to menton that we no longer use the ACS readers.  While their documentation is obtuse and technical support is non-existent, they do exactly what they are supposed to do.  Which is fine, but it just didn’t mesh up with our needs.

Our use case is for scanning student and driver RFID tags for our Android tablet.  We use an external RFID reader so that the students are scanned as they get on the bus.  Our tablets are securely mounted in cradles, which tends to block RFID readers that are built in to the tablets.  We had the following problems with our use of the ACS readers

  1. The ACS readers are NFC only.  RFID covers a multitude of sins.  NFC is just a subset of that.  Our customers may have RFID cards that use different technologies, like HID PROX or EM400.
  2. The steps needed to get a UID were quick, but not fast.  To get the UID. there needs to be several round trip conversations between the table, the reader, and the card.  If a student getting on the bus didn’t hold the card long enough to the reader, we ended up missing some scans.
  3. The power draw was draining school bus batteries.  The ACS readers are designed to draw power continuously from the USB port.  Because the readers are mounted to the bus, they would be drawing power all the time.  They are radios and there’s a power cost to run those radios.

These issues turned up during our initial deployment.  We found a better solution with the Elatec RFID readers, but the ACS readers are a good solution.  The ACS NFC readers are pretty much the industry standard for external FNC readers.  If I was wiring up and external RFID reader that was connected to a device with AC power, an ACS reader would be the first thing I would consider for the project.

FocusUF or how to turn off the autofocus setting of the LifeCam HD-5000 webcam

Welcome to the FuzzyCam

Why am I out of focus? It’s because I have a Microsoft LfeCam HD-5000 and I’m running Windows 10. The LifeCam HD-5000 webcam is a decent webcam with an annoying feature. The autofocus keeps shifting the focus around if you move your head slightly. It goes in and out of focus and locks in after a second or two.  When you are in a video chat, this can get very annoying (very quickly) for the other viewers. Your face will shift in and out of focus and it’s just a distraction.  Microsoft used to supply drivers for the HD-5000 and it had a control app where you could adjust the focus settings. Since Windows 8, they stopped as the OS directly supported the webcam.

I’m not able to sit motionless while on a webcam. I needed a work around. There is a registry hack that lets you turn off autofocus. I prefer to avoid hacks like that when it’s something that I could code around. So after seeing some stuff on StackOverflow on how to use the IAMCameraControl interface in DirectShow, I wrote a tiny command line app called FocusUF.

FocusUF uses the DirectShowLib library library to provide nice, friendly C# access to DirectShow. The DirectShowLib library maps the DirectShow Interfaces for use from a .NET app. With that library, it was little more than a handful of lines of code to access webcam controls. The app is hard coded to connect to a LifeCam HD-5000, but it would be easy enough to change the code for other webcam.

The code was written with Visual Studio 2017, it has not been tested with any other compiler. The source code is up on GitHub via this handy little URL.

How it works

To use the DirectShowLib library, I added it via nuget.

Install-Package DirectShowLib

The next step was to get access to the webcam. Using DsDevice from DirectShowLib, I was able to get the list of devices for the category of VideoInputDevice. Then I do a LINQ query to filter that list for the first match “Microsoft® LifeCam HD-5000”. If you are having a autofocus problem with a different brand or model of webcam, just replace that name with the name of your webcam. You can dump out the list of DsDevices and peek at the name property until you see your webcam.

Now that I have a DirectShow  sDevice that represents the webcam, I create a filter to expose the control interface of the web cam. DirectShow uses a module system called filters to expose device functionality. I create a new object that implements the IFilterGraph2 interface so that we can add a new filter. After getting that filter, I cast it to an IAMCameraControl to get access to the setter and getter methods. I get the current focus level and mode from the webcam.  I then set the focus to the current level and force the focus mode to manual.

How to use

Launch the app that will be using the webcam. Wait until it is in focus and then run FocusUF. It will detect the webcam and flip the autofocus setting to manual and lock it to the current focus setting. The setting will persist until the webcam is reset or another app changes the focus setting.

I probably looked better out of focus…

The name “FocusUF” is a tip of the hat to the YouTube channel AvE, where the host uses the phrase “Focus You F@*&” whenever his video camera loses focus.

It’s 2018, time to join that David Bowie Book Club that his son has started

Bowie’s READ poster from the American Library Association (1987)

Filmmaker Duncan Jones has started a book club of his father’s 100 favorite books and has invited everyone to join.

The first book has already been selected, Hawksmoor by Peter Ackroyd

Hawksmoor is a 1985 novel that takes place in the 18th and 20th centuries. From Wikipedia: It tells the parallel stories of Nicholas Dyer, who builds seven churches in 18th-century London for which he needs human sacrifices, and Nicholas Hawksmoor, detective in the 1980s, who investigates murders committed in the same churches.

Bowie’s list of 100 books to read can be found here.  Some of these books may be harder to find than the others.  I plan on seeing how many of them I can get through my local library.  Also check out the The Bowie Book Club and it’s accompanying podcast.  They already have a decent start on the Top 100.