Checking Hypervisor status with PowerShell

Image courtesy of Serge Melki

I needed to find a quick way to see which hypervisor was installed.  I bounce between different development machines and some have Hyper-V enabled and some have Intel’s HAXM driver installed.  Both assist with virtual machines, but they can’t be used together.  I used to be 100% Hyper-V with running virtual machines and Android emulators.  The Microsoft Android Emulator used to be very good, but is suffering from a fair amount of bit rot.  In the meanwhile, Google’s Android Emulator has gone from being a great of sitting and watching something load very slowly to a tool that that you can use in real time.

Microsoft’s Android Emulator requires Hyper-V and Google’s Emulator really needs HAXM in order to have any level of performance.  Since I bound around from machine to machine (with the occasional repave), I wanted a quick way to see which hypervisor is installed.  Hyper-V requires a some work to turn on and off. HAXM is a kernel driver.  So I wrote a quick PowerShell script to report the status of each Hypervisor

$services = 'intelhaxm', 'vmicheartbeat'

$d = [System.ServiceProcess.ServiceController]::GetDevices() | ? {
  $services -contains $_.Name

$s = Get-Service | ? {
  $services -contains $_.Name


The first line just defines an array of names to match one. The next block of code uses GetDevices() to return the status of the HAXM driver. The block that follows returns the status of the Hyper-V Heartbeat Service. The last part just dumps out the results.

An alternative way is to pass the service name to Get-Service and it will return the status for the specified service. The problem is that it will error out if the specified service does not exist. And while that error message is a status report, it’s an ugly way to get that information

I named the script “hyper-stat.ps1” and when I run it on a machine with HAXM running, I get the following output


Status   Name               DisplayName                           
------   ----               -----------                           
Running  IntelHaxm          Intel HAXM Service 

On a machine with Hyper-V and no HAXM, I get this


Status   Name               DisplayName                           
------   ----               -----------                           
Running  vmicheartbeat      Hyper-V Heartbeat Service    

If I disable Hyper-V, I would get the following:


Status   Name               DisplayName                           
------   ----               -----------                           
Stopped  vmicheartbeat      Hyper-V Heartbeat Service             

There are few ways of scripting this task. This one was simple and I have it on the machines that I use for coding.

Edit: Right after posting this, I realized it didn’t actually work. I was originally reporting on the status of vmms, the Hyper-V Virtual Machine Management Service. If Hyper-V is installed, that service will always be running, even when Hyper-V is not enabled. The Hyper-V Heartbeat service is a better test for seeing if Hyper-V is enabled.

Time to repave (slightly) my work machine

After lunch on Wednesday, I rebooted my work PC and it did not come back.  ADB had somehow lost the ability to see my actual Android devices.  I had tried a few things and was at the “Have you turned it off and on again” step.  I shutdown it and restarted it.   Windows 10 was not very happy.  I got the light blue screen of death.  It had a useless QR code and the ever so helpful message “critical service failure” message.

After a few rounds of rebooting and trying the standard self-repair options, I surrendered and handed it over to our IT guy.  I pretty much knew what the end game would be, but decided to let someone handle it.  He did pretty much the same things that I did and we decided to let Windows reset itself.

Windows Reset is both a good thing and a bad thing.  The good thing is that it basically says that your current Windows OS is rubbish and it will install a fresh one.  One that will be hopefully less damaged than the one that you are currently using. Or in my case, not using.  All of your data files are left intact.  Or at least in the condition that they were in before the SS Minnow goes for a  three hour tour.

I’m not sure what the root cause of the problem was.  I was nearly out of space on the primary drive and it’s been my experience that Windows doesn’t behave well when it runs out of room.  I had rebooted the day before and it was just fine then.  Today I had updated the Android SDK and that pretty much chewed through the remaining free space on the primary drive.  I could have probably used used Mike Halsey’s help.  Mike Halsey has xray vision for this sort of thing.

I’m due for a new machine at work and we had ordered it the day before.  So there really wasn’t much point in completely repaving this machine.  I just needed to install the stuff that I would need for the week or so until the new machine comes in.  So it’s time to install the bare minimum I need to get what I need to work on for the next week or so.

Office 2016
We have Office 365 so this wasn’t an optional installation

Android Studio
While I do nearly all of my Android development with Xamarin, there are times where it’s useful run some code in Android Studio.

Visual Studio 2017
This is where the good stuff happens.  I installed the latest preview bits.  I usually leave the preview versions to virtual machines, but this machine will be in my hands for a week or too.

Visual Studio Code
I have a few projects that are firmware that have their own C compilers, but no IDE.  Visual Studio Code is turning into my text editor of choice.  I like the latest and greatest, so I always install the Insiders edition.

SQL Server 2016 Developer Edition and SQL Server 2017 Management Studio
I have data needs.

It’s more useful to than Edge for most stuff.  I still use Edge, but most of the time I use Chrome.

For making a quick hack of the Windows 10 background.  Why isn’t this bundled with Windows?

Sometimes I need some music to help me concentrate.  I have the attention span of a mal-adjusted toddler, playing music with a good beat tends to keep me focused.

Since I installed Android Studio before Visual Studio, it installed the Android SDK and assorted tools first.  Visual Studio installs a second set and in a separate location.  Android Studio places it a user profile folder, Visual Studio in a Program Files x86 folder.  Since I’m using Intel’s HAXM kernel driver to accelerate Google’s Android emulator, I need to know which IDE’s Android SDK installed HAXM.  When I get the new machine, I’ll install the Android SDK first and set each IDE to use that SDK.

In the meantime, I’ll starting making a list of the tools that I need to install on a new machine.  There is considerable overlap with what I install on my Macbook these days, but there are still key differences.

Vermont Code Camp 2017

So it looks like I’ll be speaking at Vermont Code Camp 2017 on September 16th.  I’ll be doing a presentation on using vector graphics with Xamarin.  If you targeting multiple platforms, using vector graphics like SVG files lets you have one set of images for multiple resolutions.  It’s a short session, but it will be useful for mobile developers of any stripe.

It’s not too late to register for #VTCC9.  You can register here and it’s free.  It’s held at Champlain College in Burlington.  It’s worth travelling up to visit Burlington in the fall.  It’s right on Lake Champlain and it’s a pretty part of the country.   You find the Vermont Code Camp on the twitters at @vtcodecamp. They have a Slack channel at and you can join at

And one other thing.  Mike Halsey has xray vision.  It’s his super power.  This has nothing to do with the code camp, but it’s worth mentioning.

Using the Multilingual App Toolkit with the Microsoft Translator service from Azure’s Cognitive Services

Image courtesy of M. Adiputra via Wikimedia Commons

The Multilingual App Toolkit (MAT) is a great tool for managing your localization workflow with Visual Studio projects.  One of the features is the ability to machine translate your string resources into another language.  You would not want to ship an application that was machine translated, but it provides a jumping off point for the actual translators that will work on your text.  When it was originally released, MAT included support for the Microsoft Translator service,  It just worked right out of the box.

Back in April (2017), the Microsoft Translator service that was part of Microsoft Datamarket was retired.  The replacement is part of Cognitive Services and is hosted in Azure.  The Multilingual App Toolkit (MAT) was using the Microsoft Translator service as the default translation provider for doing machine translations.  If you are using MAT to manage your language resource files and wish to use Microsoft’s translation services, you’ll need to make some changes.  They are documented here, but I’ll mirror the text.

Make sure that you have the latest version of MAT installed.  For VS 2017, you’ll need 4.0.6810.0 as the minimum version.  For VS 2015 or 2013, you’ll need as the minimum version.

Then, you’ll need an Azure subscription.  When you use the Translator Text API, you can pick from a number of pricing plans.  The free plan lets you translate 2 million characters a month, but does not allow overages.  The next plan charges  $10/month per million characters. And it moves up from there.  For most projects, the free tier should be sufficient

You can sign up for an Azure account at  You’ll need a credit card, but you wont be charged unless you go beyond the free plans.

Once you have an Azure account, sign in to the portal and click the New button.

Type “Translation” into the “Search the marketplace” entry field.  Then select the Translator Text API.

Click the Create button

Select the free pricing tier and fill out the rest of the fields and then press the create button.

Click on image for larger version

After Azure deploys the service, it will take you to the service page.

Under “Resource Management”, click “Keys”.  Copy the value for “Key 1”.  This will be the authorization key that enables MAT to use the translation services.  Azure defines two keys, Key 1 and Key 2.  They will both work.  If you plan on sharing the service to let other people translate your code, you can revoke the key at a later date.

Open the Credential Manager in Windows.  The easiest way to launch this is to press the Windows key or Start Menu button and then start typing “Credential”.  You should see the app in the list of matching items

Select “Windows Credentials”

Click “Add a generic credential” and then fill in the fields.

For Internet or network address, enter Multilingual/MicrosoftTranslator

For User name, enter Multilingual App Toolkit

For Password, enter the authorization key that you copied from Azure.

If you copied and pasted the text, make sure that the text does not have trailing spaces at the end.

Click the OK button.

Entering the Azure key as a generic credential

Once you have added the credentials, the Multilingual App Toolkit editor will now use the translation services from Azure.


You can now register for the Dream.Build.Play 2017 Challenge

Microsoft has revived it’s indie game dev contest – Dream.Build.Play and you can register now.

Dream.Build.Play 2017 Challenge

The 2017 Challenge is a six month game contest aimed at indie devs. Teams of up to 7 (individuals can go solo if they desire) can enter one or more of the four categories available:

  • Cloud-powered game – Grand Prize: $100,00 USD
    Azure Cloud Services hands you a huge amount of backend power and flexibility, and it’s cool. So, here’s your shot of trying Azure out and maybe even win big. Build a game that uses Azure Cloud Services on the backend, like Service Fabric, CosmosDB, containers, VMs, storage, and Analytics. Judges will give higher scores to games that use multiple services in creative ways-and will award bonus points for Mixer integration.
  • PC Game – Grand Prize: $50,000
    Building on Windows 10, for Windows 10? This is the category for you. Create your best UWP game that lives and breathes on Windows 10 and is available to the more than 450 million users through the Windows Store. It’s simple: create a game with whatever technology you want, and publish it into the Windows Store. Judges will look favorably on games that add Windows 10 features like Cortana or Inking.
  • Mixed Reality Game – Grand Prize: $50,000
    Ooh, so you want to enhance this world you live in with something a little… augmented? Virtual? Come and join us in the Mixed Reality challenge and build a volumetric experience that takes advantage of 3D content in a virtual space. You’ll need to create your game for Windows Mixed Reality but you can use technology like Unity to get you kickstarted. Oh, and don’t forget the audio to really immerse us in your world.
  • Console Game – Grand Prize: $25,000
    Console gamers unite! Want to try your hand at building a game for Xbox? This category is your jam. Your UWP game will be built for the Xbox One console family, and incorporate Xbox Live Creators Program with at least Xbox Live presence. Consideration will be taken for games that incorporate more Xbox Live services such as leaderboards and statistics.

Teams will be judged on fun factor, innovation, production quality and business aspects of their entry, and winners will be selected from the top three from each of the four categories for a grand final in 2018 where the prizes will be awarded.

Visit the Dream.Build.Play site for more information.  There is a video explaining the competition on Channel 9.

Getting the most out of VMware Fusion 8.5 running Windows 10

I’ve been trying to get the most performance out of my Window 10 virtual machines running on my MacBook Pro through VMware Fusion. I have a Windows 10 virtual machine that I use for software demos and testing beta versions of Windows. It’s been running much slower than you would expect on a 2 3 year old MacBook Pro with a quad core i7.  I’ve collected the following tips (the sources are listed at the end) and they have improved the performance.

From the MacOS Side

Exclude the virtual disks from Time Machine backups.

You’ll want to avoid trying to back up the virtual machines by Time Machine.  If Time Machine is trying to back up the virtual machine while it is being used, it will probably fail to perform the backup and it will definitely throttle the disk I/O.

  • Run the Settings App
  • Open “Time Machine”
  • Click the “Options” button
  • Under the “Exclude these items from backups”, click the “+” button.
  • Select the Virtual Machines folder.  By default, this will be located in your documents folder.  Once you have selected the folder, press the “Exclude” button.
  • Press the “Save” button

If you are running an anti-virus application on your Mac, make sure that it is excluding the Virtual Machines folder

From the Virtual Machine Side

With your virtual machine stopped, you can make some system changes to achieve better performance.  Within Fusion and with the virtual machine open (but not running), open the Settings dialog.  You’ll want to make the following changes:

  • Open “Display” and clear the “Accelerate 3D Graphics” checkbox.
  • Open “Processors & Memory”
    • Set the number of processor cores to a value of n-1 or less, where n is the number of actual cores on your Mac.  My Macbook Pro has a quad core i7, so I run with 2 cores assigned to the virtual machine.
    • Give the virtual machine as much ram as you can, but without starving the host OS.  My Mac has 16 GB, so I split it 50/50.  If you have less memory, remember to leave at least 2 GB to the MacOS OS.
    • Open Advanced Options and select “Enable hypervisor applications in this virtual machine”
  • Open “Hard Disk (SCSI)”
    • Open “Advanced options”
    • Set bus type to SCSI
    • Set “Pro-allocate disk space” to enabled.

There are some settings that are not directly exposed through the settings dialog.  You’ll need to modify the .xmx file directly.  There are a couple of ways of getting at the .vmx file, the clearest technique is documented on the page: “Modifying the .vmx file step-by-step”.

  • Change ethernet0.virtualDev = “e1000e” to ethernet0.virtualDev = “vmxnet3”
    This will change the default network adaptive to an enhanced driver
  • Add the line scsi0:0.virtualSSD = 1
    This will optimize disk I/O for SSD drives.  Only use this if your MacBook has a SSD drive
  • mainMem.backing = “swap”
    May speed up memory swap files
  • MemTrimRate = “0”
    Disable memory trimming, less overhead for the Fusion memory manager
  • sched.mem.pshare.enable = “FALSE”
    Turns off memory sharing between virtual machines
  • prefvmx.useRecommendedLockedMemSize = “TRUE”
    Speed up I/O at the cost of increased memory usage in the host OS
  • MemAllowAutoScaleDown = “FALSE”
    Prevents Fusion from attempting to start the virtual machine with less memory than specified.  This can trigger Windows activation.
  • logging = “FALSE”
    Disabling the logging should speed things up a bit

If you don’t need snapshots, remove them.  When you use a snapshot, disk I/O is parsed through each snapshot.  That will show things down.


Resources for these suggestions

  1. VMware Performance Enhancing Tweaks (Over-the-Counter Solutions)
  2. Making Windows 10 inside VMWare Fusion 8.x a bit quicker on OSX 10.11 El Capitan
  3. How to Fix Slow Windows VMs on VMware Fusion 8.x
  4. Excluding the Virtual Machines folder from being backed up by Time Machine (1014046)
  5. Troubleshooting Fusion virtual machine performance for disk issues (1022625)

Free event at Union College: Out-thinking Old School: the Intersection of Play and AI

On Friday, May 26th 2017, there will be a presentation at Union College in Schenectady on Gamification and AI.  It will be in Karp Hall, room 105 and will be held from 12:50 PM to 2 PM.  The presenter is Phaedra Boinodiris (@innov8game),a Senior Strategy Lead for Education/Technology for IBM.  Phaedra will be discussing how Artificial Intelligence is being used to enhance game play.

This event is open to the public.  For a map of Union College, jump to this link.  For directions to Union, enter “807 Union St, Schenectady, NY 12308” into your GPS device of choice.

Phaedra Boinodiris holds 6 patents in the gaming space, was named one of the top 100 women in the games industry and is the co-founder of Author of Serious Games for Business, Boinodiris started the first scholarship for women to pursue degrees in game design and development in the US. She currently teaches at UNC-Chapel Hill where she is also the UNC Social Entrepreneur in Residence.


Debugging devices without displays or debuggers

I’ve been writing firmware for an RFID reader that connects over USB to an Android device.  Our installers will need to upgrade the readers out in the field and they have no way of knowing which firmware has been installed.  The reader, an Elatec TWN4, has a pretty decent API that you write code for, using the C language.  Their API includes a wonderful function called “Beep”.  You pass in the volume, frequency, how to play the tone (in ms), and finally, how long to be quiet after the tone has been played.  So I have been setting the readers to play a few notes on power up.  This allows the installers to know which firmware has been installed.

The original firmware plays the opening notes to “Smoke On The Water”.  Because anything that can produce at least 4 notes can play it.  The following C code will beep it’s way through some vintage Deep Purple

We added some code to the firmware to allow our app to put the reader is a sleep mode.  Our installers will need to upgrade a few devices out in the field, so it was time to change that tune.  By checking a few different sites, we found simplified chord progressions for some recognizable songs.  My choices were restricted to simple note changes, you can’t generated complicated chords from a device that only knows how to beep.  It does that beep very well, but at the end of the day it’s only a beep.

I needed to play something else to let the installers know that the firmware had been updated.  Something short, something simple, something simple.  One of my musically inclined co-workers worked out the opening notes of “The Final Countdown” by Europe.  That song has a distinctive opening riff.  And many cover versions.  Some might say too many,

I found a note to frequency conversion table and used that to create a set of constants for the notes I needed.  That allowed me to specify the beeps with readable note constants, instead of the frequency values. You can get those constants here.  With the use of those constants, you can play the opening notes of “The Final Countdown” with the following code:

When using the constants, the code is much easier to read.  And it becomes much easier to create new song intros. With that in place, the installers can quickly check the firmware version by powering up the RFID reader.  At some point I’ll refactor the code to just read the values from an array.  The current design is easy to setup and read, I may just stay with what works.

Right now, I need to use Elatec’s development tools to push the firrmware out via a simple GUI.  If I could get a command line tool for pushing the firmware out, I could add code to the firmware to return the version number from a query sent over USB.  That would allow me to write a simple app or Powershell script to identify a connected reader, query the version, and then push the update out.  If anyone from Elatec ever reads this, a command line firmware updater would be very helpful.

Decades of using development tools like Visual Studio has accustomed me to being able to use a debugger to step through the code.  Writing code where you can’t visually debug it, requires thinking out side the box.  I can test much of the code by having the reader send back text, but when testing with the device that it will be hooked up to, that would interfere with how they work.  Sometimes you just have to use a different path out of the machine to see what it’s doing.


What not to do on a job interview: Pressing the Self-Destruct Button

Image by Tumisu

I’ve been with my current employer for the better part of two decades and I was thinking back to the job interviews that I went on before taking this one.  There were two places that I interviewed at where I deliberately blew the interview because I realized we not compatible.  Before I continue, don’t do what I did.

The first place was a company that was not long passed it’s startup days.  They did web development and they had probably less than 20 people.  A friend of mine had started working there a few months earlier and he was still bullish on the company.  I applied and on his recommendation, I was brought in for an interview.

I met first with the owner of the company.  That part went OK, but I didn’t feel comfortable with the owner.  I couldn’t narrow it down to anything specific, but something just didn’t feel right.  It could have been his personality, it could have been my unease being back in the job market after less than a year at the current position.  I just wasn’t comfortable with him.

I then met with the director of development.  Let’s call him “Sam”.  My interview with Sam started off well, we seemed to hit off.  At that point in time, I knew nothing about web development and had been upfront with that.  They were looking for more of back end coder, so my SQL skills more than made up for the lack of all things HTML.  We talked SQL and performance analyzing and things of that nature.  The more we talked, the looser Sam became.  He started saying negative things about some of the developers on his time.  Nothing in depth,  but totally inappropriate to mention in an interview.  Actually inappropriate to mention at all.

Sam had been a C programmer and loved to write code that was more complicated than necessary.  On a white board, he had written a single line of code that was an unholy mess of functions and pointer arithmetic and array offsets.  It was his standard programming challenge for job applicants.  He asked me to parse it.  And this is more or less what I said

I would fire the person who wrote this code.  It’s an exercise to show clever you are for writing this.  By writing all of the code as a Nested Series of Functions from Hell, you eliminated readability and maintainability from the code.  And just forget about the error handling, there’s no room for it.  If any one part changes with a parameter or return type, the best that you can hope for is that it fails to compile.  At worst, it would continue to run and you would get the wrong results and then spend hours trying to figure out what had changed .

Well that was not answer that Sam was expecting.  He made a big production of going over the code, function by function, pointer by pointer.  He had to make his point, which to be fair, my remarks were pretty rude.  He tried to get me to agree with him that the code was elegant. I politely demurred and the interview was pretty much over.  To no great surprise, they did not call me back.

The next interview was with a larger company.  I was interviewing for a Java developer position.  I had taken some Java courses, but had little real world experience with the language. I was comfortable enough with Borland’s jBuilder Java IDE to talk somewhat about it.  My current job was transitioning from Delphi to Java, so it was a skill I was starting to pick up.  My current employer was big on what was then called the AS/400.  Other than writing SQL queries to an ODBC connection to an AS/400, I knew nothing about the AS/400.

This interview was the type where you spent 20 minutes at a time with a person or small group and then was passed to the next group.  They had told me to plan on 3 hours for the interview.  I met first with the Java people.  That went well.  They understood that my actual Java experience was limited, but I knew the tools they were using and I knew had to write client/server applications.  I then met with the AS/400 people.  Or rather the people would be managing the AS/400 people when they hired the AS/400 people.  They wanted me to be the first person on the team, to port their application from UNIX to the AS/400.

I explained that I was not an AS/400 expert and my level of AS/400 skill could be measured as none.  They didn’t care, they wanted an AS/400 developer and that was where they would put me if I was hired.  I said that I was looking for a Java developer position and I didn’t have the AS/400 skills they were looking for.  They said that would be OK and I could learn the AS/400 as I went along.  They then said that I could move to Java team after being on the AS/400 team for 6 months.

They were either lying to me or they had no idea of what they were talking about.  There was no way that I would accomplished anything meaningful in 6 months.  Between not knowing what their app did and how it was designed with not knowing anything meaningful about the AS/400, 6 months was too short a time period.  And from a business perspective, you are not going to spend 6 months getting a developer up to speed on a technology that no one else knows and then allow him to transfer to another team.  That made no sense.

I was then shuttled off to marketing team and sales team.  They showed me how the app works and how they sold it. They did mention how excited they were to be getting an AS/400 version of their application.  They seemed to think that I was going to be the guy or one of the guys who gave them the AS/400 app.  Either way, it was going to be a non-starter for me.

Finally, I met with the president of the company.  She swore like a sailor and kept switching topics.  At one point she started talking about a delay of some new feature from of the teams. She named each person and described where she thought that person could have had dropped the ball.  She then asked me how I would deal with the problem if I had her job.  We then spent the next few minutes talking about the situation.  I broke it down by timeline.  Was the timeline to add the feature realistic?  Were enough resources available to implement and test the feature?  Did they have a manager measuring progress against the timeline?  The usual management stuff.  It was just very odd that we were talking about a specific problem with specific people.  I ended up working with people that used to work there and they said that development delays was a constant problem.

We then got around to talking about the position.  I said that I came in for a Java position but the job was being pitched as combination AS/400 admin/developer.  And that was not my skill skill.  She said that when they discussed my resume, my current employer’s experience with the AS/400 was more important than any other skill that I had.  I thanked her for her time and finally left.  It was another opportunity where I did not expect or receive a call back.

I have gone on very few job interviews and I handled both badly.  With the first position, I should have made an attempt to parse the Code From Hell and kept my opinion to my self,  It was a programming pissing match and my comments did not move the bar forwards.  For the second one, I should have halted the interview process once I realized that our job expectations did not match up.  Even if you don’t want the job, you don’t want to blow the interview.  People move around and you could interview with some of the same people somewhere else and lose the opportunity for your dream job.  Always do your best in the interview.  If you don’t think that the job is right for you, you can always turn down the job offer.

Using console jQuery to scrape lists from Apple’s developer portal.

I needed to grab the lists of registered devices and developers from our company’s Apple Developer portal. Unless I’m being particularly obtuse (an outcome that I never rule out), Apple does not provide any means of exporting the lists.

Apple only allows 100 devices of each type (iPhone, iPad, iWhatever) to be registered as development devices. No matter how many iOS developers that you have at your company, 100 is the limit. And if you remove a device from that list, it still counts towards that total.  Once a year, you can reset the list and carry over the devices that you still need and drop off the ones that are not needed.  To make this easier to manage, I wanted to get a list of the devices and their ids and have the developers pick the ones that they still need.

So I wanted to export that list.  And Apple doesn’t let you export that list.  You can see it on the screen and work with the items in the list, but no export.  I figured that I wasn’t the only person dealing with that limitation so I did a quick search on Stack Overflow and found this little gem.

var ids = ["Device ID"];
var names = ["Device Name"];

var output = "";
for (var index = 0; index < ids.length; index++) {
    output += ids[index] + "\t" + names[index] + "\n";

To use that code, you would go to the list of devices in the browser. Then open up the developer tools for that browser. For example, in Chrome you would press F12 to open up the developer tools. Staying with the Chrome example, you would click on the Console tab in the developer tools and paste that Javascript code in and then press the Enter key. The code would execute within the domain of the page and generate a two column list of device ids and names.

To understand what that code does, you need to look at how the data is rendered on the page. The device list is stored in a HTML table, with each row looking like this

<tr id="1" tabindex="-1" role="row" class="ui-widget-content jqgrow ui-row-ltr">
    <td role="gridcell" style="text-align:center;display:none;width: 34px;" aria-describedby="grid-table_cb">
        <input role="checkbox" type="checkbox" id="jqg_grid-table_1" class="cbox" name="jqg_grid-table_1">
    <td role="gridcell" style="" class="ui-ellipsis bold" title="iPad" aria-describedby="grid-table_name">iPad</td>
    <td role="gridcell" style="display:none;" class="ui-ellipsis" title="c" aria-describedby="grid-table_status">c</td>
    <td role="gridcell" style="" class="ui-ellipsis" title="twletpb659m0ju078namuy8xnv2j0fzt1kytanfz" aria-describedby="grid-table_deviceNumber">twletpb659m0ju078namuy8xnv2j0fzt1kytanfz</td>

Looking at the highlighted lines 6 and 9, we can see the device name and device id as the text of table cell tag. Each cell has a aria-describedby attribute to identity the type of value being stored. We can search on the values of the attributes to locate the data that we want. Going back to the javascript, look at the following lines:

var names = ["Device Name"];

The first line declares a Javascript array with an initial array element of “Device Name”. The next line performs a jQuery select for all of the <td/> elements that have attribute of aria-describedby with the value grid-table_name. The next part of the statement iterates over the list of matching <td/> elements and uses the jQuery html() to get the text value of the cell and add it to the array. We then can then do the same technique to get the device id and then build a list as a string and finally dump it to the browser’s console.

I also needed to the email addresses of all of our registered developers. The email addresses were not in a table, but part of a list. Each email address is wrapped inside a section element like this

<section class="col-100 ng-scope">
  <p ng-bind="::person.fullName" class="ng-binding">First Last</p>
  <a class="smaller ng-binding" 

I just needed the text part from the <a/> element. Getting the email addresses was a simpler version of the code to get the devices. I just a jQuery select on the ng-bind attribute and matched on the value “”. That ended up being a single line of code to run in the browser’s developer console


And that’s how you can screen scrape data from a web page that doesn’t provide any support for exporting the data.

Bonus round
The aria-describedby attribute is a commonly used accessibility element used to describe the element that the tag is part of. The “aria” part of the attribute name is an acronym for Accessible Rich Internet Applications. Among other things, it was designed to allow assisted reading devices help parse a page for users with visual difficulties. It’s a good technology to use on your web pages.