Wednesday, November 25, 2026

Being Your Own Network Admin: What I Learned Rebuilding My Home Lab

I spent years working end user support and then network administrator. These days that work is a hobby, but every home with kids, a house full of smart gadgets and a dozen self-hosted apps still needs an IT department. In my house, that's me.

This year I rebuilt my home lab from the ground up around one rule: if I'm the support team, I need the tools a support team would have. That means monitoring, automatic updates, backups I don't have to think about, and remote access that doesn't punch holes in my firewall. Here's what changed, what worked, and how AI made a one-person project like this realistic.

Where I started

For a long time I ran everything I could on my NAS, using its built-in apps where possible and workarounds where not. It mostly worked. But keeping it all current was a manual grind. I run over a dozen local server apps, each releasing updates on its own schedule, and updating meant a multi-step process for each one. So updates happened when I had time, which meant they often didn't happen at all.

Certificates were worse. My renewal "process" went like this: open an app, see Chrome's "Your connection is not private" warning, sigh, and remember it was renewal time again. Then kick off the manual renewal and hope I hadn't missed another one.

That's not just inconvenient, it's risky. An outdated app is an open door, and a network you can't keep current is a network you can't keep safe.

Outgrowing the NAS

The first big move was letting the NAS go back to doing what it's great at: storage. Everything else moved to Proxmox VE, running on two modest, low-power machines, with each service in its own lightweight container.

  • One backup job instead of many. Every container is backed up nightly to the NAS. Restoring a broken service takes minutes, not a weekend.
  • Isolation. The media applications live in one container, the reverse proxy in another, monitoring in another. A problem in one doesn't take down the rest.
  • No more workarounds. Each app runs the way its developers intended.
  • Resilience. The two machines form a small cluster, with a tiny tie-breaker running on the NAS so the cluster always knows who's in charge.

You don't need a server rack to run a home lab properly. You need a good hypervisor and a backup plan.

Automation you can verify

The scariest part of my old setup wasn't any single device. It was not knowing what state anything was in. Two changes fixed that.

Automatic updates with monitoring. Every app now updates itself overnight. Uptime Kuma checks every service every few minutes and emails me if something stops answering. It also warns me well before a certificate could expire.

A daily version audit. A small script compares what I have installed against the latest release of every app I run. If anything falls more than a few days behind, I get an email. It also keeps a history of every version change.

In the first week, that history showed 8 different apps updating themselves without me lifting a finger. Before, that would have been 8 separate evenings of maintenance, or more realistically, 8 things quietly falling behind.

Automation is great. Automation you can verify is better.

Goodbye, certificate warnings

The tool that fixed my certificate problem was Nginx Proxy Manager, and it solved two problems at once.

  • Reverse proxy: every internal app gets a clean, friendly name instead of an IP address and a port number I had to remember.
  • Automatic certificates: one wildcard certificate from Let's Encrypt covers everything. It's issued through a DNS challenge, so nothing has to be exposed to the internet to prove ownership, and it renews itself.

Changes happen in a simple web interface instead of hand-edited config files. I haven't seen that Chrome warning since. Finding one tool that handled both the proxy and the renewals was the real game-changer.

One homepage, every device

Between the firewall, NAS, hypervisor, media applications, monitoring and a house full of smart gadgets, I had admin pages bookmarked in different browsers on different laptops, and they were never in sync.

Now everything lives on one self-hosted dashboard, Homepage. Every service is one click away, with a live status dot so I can tell at a glance if something is down. There's a Smart Home row for our device portals, so the whole family has one place to start.

The part I like best: the dashboard's configuration is stored in a GitHub repository. Every change is versioned and backed up, and a button on the dashboard pulls down the latest version. Another link shows the current version of every app in the lab, straight from the daily audit.

Treat your home configuration like code, and you'll never lose it or wonder what changed.

Capable and safe, not one or the other

Everyone in my house depends on our network for work, school, entertainment, and a lot of smart home devices we use every day. With kids online, my parenting radar is always on, so protecting them is part of the design too.

The goal: reach what I need from anywhere, without making the network easier to attack. Three tools do most of the heavy lifting.

  • pfSense is the foundation: firewall, DNS, filtering, and separate network segments so lab services aren't sitting next to every phone and smart plug.
  • Cloudflare handles DNS and makes the automatic certificates possible. Only a small handful of services are reachable from outside, on purpose. Everything else stays internal.
  • Tailscale gives me secure remote access with no open ports for admin tools. From anywhere, I can reach home as if I were on the couch, and I can route my traffic through home when I'm on sketchy public Wi-Fi.

The principle behind all three: expose as little as possible, and make the private path the easy path. When secure access is also convenient, nobody is tempted to take shortcuts. That includes me.

My co-admins are AIs

I know what a project like this takes, and I know it's a lot of work for one person doing it in their spare time. This rebuild happened with Claude and Gemini working alongside me, and I honestly couldn't have done it with this speed or this thoroughly without them.

  • Planning: turning "I want this to be safer and easier to maintain" into a step-by-step migration.
  • Execution: writing configs and scripts, and documenting every change in a runbook as we went.
  • Troubleshooting: when I upgraded my NAS operating system and suddenly couldn't reach Plex, AI helped me trace it to a permissions change and a moved data folder, and fix it without starting from scratch.

I stayed in charge of the decisions and kept passwords and keys in my own hands. But having a tireless partner to research, draft and debug changed what's realistic for a one-person IT department.

Wrapping up

If you're the person your family calls when "the internet is broken," you're already the network admin. You might as well have the tools. Start with monitoring and automatic updates, give your apps a reverse proxy with certificates that renew themselves, and keep the private path the easy one. And if a home lab project has felt too big to start, it might be smaller than you think now.

What's in your home network stack? Let me know in the comments.

Products mentioned

  • Proxmox Virtual Environment: open-source virtualization platform for virtual machines and containers
  • Uptime Kuma: self-hosted uptime monitoring with alerts
  • Nginx Proxy Manager: reverse proxy with automatic SSL certificates and a web UI
  • Let's Encrypt: free, automated certificate authority
  • Homepage: self-hosted dashboard for all your services
  • GitHub: version control and hosting for configuration repositories
  • pfSense: open-source firewall and router
  • Cloudflare: DNS and security services
  • Tailscale: secure, zero-config remote access (WireGuard-based VPN)
  • Plex: personal media server
  • Claude: AI assistant by Anthropic
  • Gemini: AI assistant by Google

Sunday, November 15, 2026

3D Printing a Replacement Hook for an RC Jeep — From One Photo

One phone photo and two ruler measurements were enough to get a printable replacement for the winch hook our twins lost off their RC Jeep. No 3D scanner, no 360° photo session, no CAD skills.

The lost hook

We bought the twins matching remote control Jeeps, and each one came with a little black winch hook on a cord. Within a few weeks one of the hooks was gone. Nobody knows where, and the carpet isn't telling.

The surviving hook is a simple part: an eye at the top for the cord, a thick shank, and a J-shaped curve at the bottom. It's about 2.5 cm tall and 1.5 cm wide at the widest point. It looked like exactly the kind of thing a 3D printer is good at, if I could just get a model of it.

Why I skipped the 3D scanning apps

The scanning apps I knew about use photogrammetry. You walk around the object taking dozens of photos from every angle, and the app stitches them into a 3D mesh. That works well for complex, organic shapes. For a 2.5 cm piece of shiny black plastic, it's a tough job: small, dark, glossy objects are some of the hardest things for those apps to capture cleanly.

More importantly, it was overkill. This hook is essentially a flat profile with rounded edges. Everything that makes it a hook (the eye, the shank, the curve) is visible in a single photo taken straight on. The third dimension is just thickness. If I could trace the outline and give it a thickness, I'd have the part.

The approach: one photo, two measurements

I set the surviving hook on the carpet, took one photo with my phone from directly above, and put it in a folder on my computer. Then I asked Claude, Anthropic's AI assistant, for help:

The surviving hook, photographed straight down on the carpet

The one and only input photo: the surviving hook, shot straight down.

Can you make a stl 3d printable model of the hook that I can replace a missing one from? This hook is about 2.5cm long at the longest and 1.5cm wide at the widest. It doesn't need to be pixel perfect... just roughly the same.

That was the whole input: the photo, the overall height and width, and permission to be approximate. Claude had access to the folder through the Claude desktop app, so it could look at the photo directly and write the finished files back into the same folder.

A few minutes later I had an STL file sitting next to the photo, plus a rendered preview to compare against the real thing.

Behind the scenes: what Claude actually did

The part I found most interesting was how the model got built. There was no tracing tool and no CAD program. The hook was described entirely in Python code, then converted to a mesh and checked like any other piece of software.

  1. Looked at the folder. It held the photo (PXL_20261101_172606934.jpg) and a first version of a generator script, generate_hook.py, that was already in the folder.
  2. Read the photo and the script. Claude viewed the photo and compared it to the shape described in the script, checking that the eye, shank and hook curve lined up with what the photo showed.
  3. Described the outline as math. The script defines the hook's 2D outline as a signed distance field: a function that tells you, for any point, how far it is from the edge of the hook (negative inside, positive outside). The outline is built from three simple pieces:
    • a circle for the eye, about 8.6 mm across, with a 4.3 mm hole for the cord
    • a smooth curved "spine" through 9 control points, each with its own thickness, so the shank swells to its widest at the belly and tapers toward the tip
    • a circle subtracted from the inside of the J, so the throat of the hook stays cleanly open
  4. Gave it thickness. The flat outline was extruded to 4.5 mm thick, with 1.55 mm rounded edges all around. Both faces stay flat, so it lies on the print bed with no supports.
  5. Rendered a preview and compared it to the photo. The script draws a shaded front view on a 5 mm grid and a tilted 3D view. The silhouette matched the real hook closely enough that no shape changes were needed.
  6. Built the first mesh and checked it. The script's built-in mesher produced about 120,000 triangles. Claude then counted how many triangles share each edge. In a clean, closed solid, every edge is shared by exactly two triangles. This mesh had 12 edges that weren't, a small defect most slicers would quietly repair, but not something worth shipping.
  7. Tried a quick fix, then a better method. Nudging the sampling grid only reduced the bad edges to 4, then 1. So Claude wrote a short new script, build_stl.py, that rebuilds the mesh with the marching cubes algorithm from the scikit-image library, then nudges every vertex exactly onto the hook's surface.
  8. Verified the final file. The rebuilt mesh came out with 0 bad edges and consistent triangle orientation, which means it's watertight and slices cleanly. Final numbers: 15.0 × 25.0 × 4.5 mm, 290,840 triangles, about 790 mm³ of plastic.
  9. Saved the results back to my folder: rc_jeep_hook.stl, the preview image, and build_stl.py.

Here's the core of the shape definition, the list of points the hook's spine passes through. Each row is an x and y position in millimeters plus the thickness at that point:

spine_ctrl = [
    [5.65, 19.20, 3.30],  # Inside eyelet base
    [5.20, 15.20, 2.85],  # Neck
    [3.60, 10.00, 3.45],  # Left belly (thickest part of the shank)
    [4.10,  5.60, 3.30],  # Lower left bend
    [6.60,  3.15, 3.10],  # Bottom-most bend
    [10.00, 3.25, 2.85],  # Lower right bend
    [12.55, 5.45, 2.35],  # Right curve rising toward tip
    [13.45, 8.35, 1.80],  # Upper right tip curve
    [13.15, 10.10, 1.50], # Rounded hook tip
]

And the check that caught the defect, simplified:

# Every edge of a closed solid should belong to exactly 2 triangles
edges = np.sort(np.concatenate([f[:, [0, 1]], f[:, [1, 2]], f[:, [2, 0]]]), axis=1)
_, counts = np.unique(edges, axis=0, return_counts=True)
print("bad edges:", (counts != 2).sum())   # first mesh: 12, final mesh: 0

The nice thing about a shape defined this way is that it's easy to tweak. Want the hook 10% bigger, or a larger hole for a thicker cord? Change a number and rerun the script.

The result and printing tips

The finished model is 25 mm tall, 15 mm wide and 4.5 mm thick, with the same eye, shank and J-curve as the original. It isn't a pixel-perfect copy, but it doesn't need to be: it just has to hold the cord and look right next to its twin.

Rendered preview of the 3D model: front view on a 5 mm grid and a tilted 3D view

The generated model: front view on a 5 mm grid (left) and a tilted 3D view (right).

Setting

Recommendation

Orientation

Lay it flat. Both faces are flat, so no supports are needed.

Material

PETG or ABS if the winch pulls hard; PLA is fine for light play.

Strength

100% infill, or at least 4 walls. It's a small part, so this costs almost nothing.

Size

Scale it in your slicer if your hook is a bit bigger or smaller.

If your kids' Jeep uses a different hook, the same trick works for any part that's basically flat: one straight-on photo, the overall dimensions, and a request for an STL.

Friday, November 7, 2025

XConnect certs from DigiCert Need Client Authentication or XDB services will get Forbidden errors

ATTENTION all DigiCert customers who mint certificates for Sitecore's XConnect. They have discontinued automatically adding the Client Authentication extended usage to the cert.



See their bulletin here:

Sunsetting the client authentication EKU from DigiCert public TLS certificates


If you aren't careful and ignore the extra radio button selection during the creation of the certificate, you will have unhealthy XConnect services.  And you'll spend hours troubleshooting the configs, thumbprint values, key permissions, etc.  Because the error message is a familiar client validation error.

Message: The HTTP response was not successful: Forbidden


Sitecore also provides some helpful troubleshooting steps in case this issue is unrelated to your errors.  Check them out here:  How-to's - Troubleshooting xConnect certificate issues


 Notice that the DigiCert announcement also warns that you'll have to plan accordingly for anything minted after May 1, 2026.

Sunday, August 20, 2023

Pixel Phone Owners using eSIM - Get a Backup physical SIM immediately!!!

I was on vacation and my billing cycle ended with Google Fi.  I had changed my subscription plan mid-month so it would upgrade to unlimited data for the next billing month because I would be mostly travelling that month. 

A plan change must initiate an eSIM update and it failed. Not only did my plan upgrade fail to apply, but I could not get any service activated on my phone from Google Fi then.  Hours on chat with Google Fi, numerous emails with screenshots and debug logs back and forth, and resetting my phone twice.  Nothing allowed the Google Fi app to activate my eSIM.

Two weeks later and I returned back to the states and got a new physical SIM for Google Fi and everything works now. Googling, you'll find numerous reports of users with Pixels and eSIMs that stop working. Some blame security patches in Android, some blame the carrier (Google Fi), some blame the Pixel hardware. All I know is you can't trust eSIM and when it's broken, no cell service makes it difficult to do a lot of things. I will never trust eSIM technology again. And I think I may travel with a backup SIM card even. I learned that lesson the hard way.

If you use Google Fi, they'll send you an SIM card for free: https://fi.google.com/order-sim.  Do it now!

Monday, September 30, 2019

Override xaml.xml files in the ~/sitecore/shell/override folder

Occasionally you'll have the desire to add your own custom functionality to dialogs in the Content Editor.  Many of these dialogs can be found under the ~/sitecore/shell/ folder.

Sitecore already comes pre-configured to look in the ~/sitecore/shell/override to find override XmlControls under the node.  That is baked into the Sitecore.config file.

<controlSources>
  <source mode="on" namespace="Sitecore.Web.UI.XmlControls" folder="/sitecore/shell/override" deep="true"/>

This allows you to drop into that folder your customized .xml dialog file that contains your own layout and custom CodeBeside.  The Content Editor will load that one instead of the Sitecore coded one.

However some of the controls under the ~/sitecore/shell/ folder are built with a different technology.

(To read more about the two different control types, Mark Stiles has done an amazing job at documenting them: https://markstiles.net/blog/2014/1/5/sheer-ui-1-a-tale-of-two-systems/)

The extension of these controls is xaml.xml.  Sitecore defines where it finds these controls in the xamlSharp.config file.  Oddly enough, this one doesn't include the  ~/sitecore/shell/override folder.

It is simple to create your own override config for this in Sitecore.

1. Create a new file called xamlSharpOverride.config

2. It should contain the following:
<configuration>
  <sitecore>
    <xamlsharp>
      <sources>
        <source type="Sitecore.Web.UI.XamlSharp.Xaml.XamlFileControlSource,Sitecore.Kernel" patch:before="*">
          <watchers hint="list:AddWatcher">
            <watcher type="Sitecore.Web.UI.XamlSharp.Xaml.XamlFileWatcher,Sitecore.Kernel">
              <folder>/sitecore/shell/override</folder>
              <filter>*.xaml.xml</filter>
              <codefilter>*.xaml.xml.cs</codefilter>
              <includesubdirectories>true</includesubdirectories>
            </watcher>
          </watchers>
        </source>
      </sources>
    </xamlsharp>
  </sitecore>
</configuration>

This config will insert that source folder at the top of the xamlSharp sources list.  Any .xaml.xml file you customize can now be placed into the ~/sitecore/shell/override folder.

Wednesday, May 1, 2019

You can skip the WITH(NOLOCK) when querying Sitecore's dbo.Fields sql view

Don't worry about adding a NOLOCK hint to your SELECT queries against the Fields view in Sitecore.  They already include that hint on all of the tables.


SELECT id, 
       itemid, 
       '' AS Language, 
       fieldid, 
       value, 
       created, 
       updated 
FROM   dbo.sharedfields WITH (nolock) 
UNION ALL 
SELECT id, 
       itemid, 
       language, 
       fieldid, 
       value, 
       created, 
       updated 
FROM   dbo.unversionedfields WITH (nolock) 
UNION ALL 
SELECT dbo.versionedfields.id, 
       dbo.versionedfields.itemid, 
       dbo.versionedfields.language, 
       dbo.versionedfields.fieldid, 
       dbo.versionedfields.value, 
       dbo.versionedfields.created, 
       dbo.versionedfields.updated 
FROM   dbo.versionedfields WITH (nolock) 
       INNER JOIN (SELECT itemid, 
                          language, 
                          Max(version) AS Version 
                   FROM   dbo.versionedfields AS VersionedFields_1 WITH (nolock) 
                   GROUP  BY itemid, 
                             language) AS b 
               ON dbo.versionedfields.itemid = b.itemid 
                  AND dbo.versionedfields.language = b.language 
                  AND dbo.versionedfields.version = b.version 

Wednesday, October 10, 2018

Alexa Skill Developer #1 Support Issue for Me

I took a long hiatus from building skills and am just getting back into it.  I made some dumb mistakes getting stuff to work.  But recently I realized it wasn't always my dumb mistakes.  I ran into an issue twice where all I had to do was "reboot" my Alexa skill.  Equivalent of the the favorite help desk suggestion of turn it off and back on again; unplug it and plug it back in.




Flipping the Test is enabled for this skill was required a couple of times that I remember.

  1. I updated my invocation phrase and rebuilt my models, but things did not work right until I toggled this switch.
  2. After having my certification fail, I tried testing my interactions again and my skill didn't respond.  Toggling the switch fixed that also.
So, when all else fails... flip this switch off and on again.

Friday, August 18, 2017

Don't Let Microsoft SQL Round Your DateTime Field's Milliseconds

I needed to export some data out of Application Insights and save it locally.  While doing a sanity check, I realized that some of my datetime values were not the same.

Therefore, I created a simple test.
  1. Create a table with just a datetime field.
  2. Insert the value I expected.
  3. Select that data back out and witness the rounded value.



I finally found an answer here:
https://stackoverflow.com/questions/36414315/inserting-datetime-with-milliseconds-into-sql-server-table-issue

MS SQL rounds the DateTime field in increments of .000, .003, and .007.  I would assume that means it is saving on memory space behind the scenes by only offering 3 options for the single digit of milliseconds?

Whatever the case, if precision is necessary (as it was for the Application Insights data I was getting),  use the newer datetime2(3) field definition.

Friday, January 6, 2017

Why do I have a binding for SitecoreApplicationCenter in my web.config?

I was doing some cleanup in our config files, and I noticed we have a binding called "SitecoreApplicationCenter".  Looking through our Sitecore solution, I didn't see this referred to anywhere, until I opened the Sitecore.Kernel.dll.

This reference is used when communicating with Sitecore's App Center... just like it's named.  It will be used when making calls to the service: https://apps.sitecore.net/appsservice.asmx

We'll never use this on our frontend servers, so I transformed it out of that config.  But I kept it in our Content Manager server config.

Friday, December 2, 2016

[HttpException (0x80004005): Unable to validate data.] when changing FormsAuthentication machineKey encryption

A new feature on our website required us to use a different encryption algorithm for our Forms Authentication cookie.

Simple change; just update one line in the web.config.  However we read data from that cookie on every web request.  And so as soon as we changed that algorithm, anyone who had previously visited our site would get an ASP.NET yellow screen of death.

"Unable to validate data." ASP.NET error message screen


No problem, I thought.  I can just delete that cookie instead of reading it.  That turns out not to be so easy to do.  The best I could do was set an expiration on the cookie in the client response.  And then I also deleted the cookie in the server request.

// Remove the cookie from the server request
contextBase.Request.Cookies.Remove(FormsAuthentication.FormsCookieName);
                            
// Expire the cookie on the client
authCookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Remove(authCookie.Name);
Response.Cookies.Add(authCookie);

This got me past some errors, but somewhere deep in someone else's DLL the problem still lingered.  I tried a different approach.  I resorted to using a base Forms Authentication method, SignOut().  That worked perfect!  Here is the code I ended up with.  It was placed in the Global.asax Application_PostAuthenticateRequest() event.

protected void Application_PostAuthenticateRequest(object sender, EventArgs e)
{
    var contextBase = ServiceLocator.Current.GetInstance();
    var authCookie = contextBase.Request.Cookies[FormsAuthentication.FormsCookieName];
    if (authCookie != null)
    {
        var encodedTicket = authCookie.Value;
        if (!String.IsNullOrEmpty(encodedTicket))
        {
            FormsAuthenticationTicket ticket = null;
            try
            {
                ticket = FormsAuthentication.Decrypt(encodedTicket);
            }
            catch(HttpException hex) 
            {
                if(hex.Message == "Unable to validate data.")
                {
                    // Clean up any AUTH cookies with 
                    // a different encryption
                    FormsAuthentication.SignOut();
                    return;
                }
            }
            // Unimportant company stuff happens here
        }
    }
}

Tuesday, September 27, 2016

Google's Email Validator Regular Expression

I am anticipating the release of the Google Home device.  And while I was checking out the page's source code, I saw some validation code they use to check email addresses.

[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,10}$

It has always been difficult to find a short enough and smart enough regex for validating emails.  I'll follow Google's lead and use this next time I need a quick check for a valid email.

Monday, August 29, 2016

Alexa Zipcode Lookup


I have been playing around with building another Alexa skill.  I mostly wanted to explore some different techniques to use in a skill.

This new skill will lookup zipcodes for you.  It does it in a few different ways:
  • If you tell it a zipcode, it will tell you what city that zipcode is for
  • If you tell it a city and state, it will tell you what zipcodes are associated with that city and state
  • It will return a card to your Alexa app with a map of the location
The skill uses a few different services.  Zippopotam.us is the service that I use to do zipcode and reverse zipcode lookups.  And I make use of Google Maps API to assist with the spelling of city names, when the Alexa Voice Service doesn't recognize the spelling.  Also, the maps are provided by Google Maps API.

I am going to write about the different parts of this skill across a few different posts.  I hope some of these techniques will help you with your next skill.

The code for this skill is up on Github...  https://github.com/chrispauly/alexa-zipcode-lookup 

Friday, August 26, 2016

NPM to the Rescue for your Alexa Skill



I started writing Alexa Skills in AWS Lambda using the example blueprint and online code editor.

Recently, using the new code samples that Amazon has on Github, I've graduated to writing my code locally in VS Code, and then zipping up the files and uploading them into my Lambda function.

Now, I'm taking it one step further, and instead of writing all the code, I am leveraging NPM to provide functions for tasks that would be tedious and/or difficult to write myself.

I wasn't sure how difficult it would be to start using NPM, like what config settings I would need or how to use them in my skills.  I found out it is as easy as 1-2-3.

  1. Download NodeJS and install it on your OS.
  2. Open a Command Prompt and go into the ./src folder of your skill (the folder where index.js lives).  Run the command npm install [package name]
  3. Refer to the examples provided for your package and incorporate that in your code.

That's it!

My main concerns were having to worry about directory paths or unfamiliar javascript configuration files.  But I had none of those issues.  I just zipped up my code and uploaded it into my Lambda function and everything worked!

I stumbled upon how easy this process was when I needed to write a function to translate digits into words.  When I wanted to ask for a city name in my service, I found that certain city names did not come in as expected.  For example, my hometown, Two Rivers, WI, when the CityName slot was populated by AVS with my spoken words, it came into the skill service as "2 Rivers".  I needed to use the actual city name in my skill service.  It required the actual spelling of the city name, so I needed to translate the number 2 into the word Two.

I found that there are other cities with numbers in their name, so I decided that I should build a more generic function that could translate numbers into words.  But before I wrote that function, I Google'd for javascript functions that do that.  NPM had a number of packages that would work for me, but I settled on number-to-words.  I followed the 1-2-3 steps above and was so happy it worked without any extra effort.

Monday, August 15, 2016

Alexa Meet LUIS


LUIS (Language Understanding Intelligent Service) is a research project that uses a Bing Cognitive AI service to match spoken dialog with an intent.  When creating a LUIS app, you'll create an Intent Schema and Sample Utterances similar to that in an Alexa skill.

Once you have a LUIS application built, you need to train it to create its internal models that it uses to predict which intent best matches the phrase sent to it.  It responds with a JSON object that includes your intent names and the scores that represent how well that phrase matched an existing intent.



I wanted to leverage the power of LUIS to determine what intent has the highest probability to match a spoken phrase, when I didn't include that phrase as a sample utterance in my Alexa skill.

This required me to create a catchall intent.  The schema for this intent is exactly like I described in a previous blog article about matching all the spoken words...  Polly Want a Cracker? A Simple Alexa Skill that Echoes Your Words

Once I created a skill that had a number of intents, along with my catchall intent, I began testing phrases that were not included in my sample utterances.  I soon realized that the AVS already performs LUIS-like language understanding.  It was extremely difficult to ever have the Alexa skill choose my catchall intent.

The one way I could see using LUIS now, would be to build the Polly Want a Cracker skill.  Then use LUIS to define my intents and slots (which are called entities in LUIS).  LUIS has a great service that provides active learning in your app.  LUIS stores the new phrases it hears and lets you review them and label new entities.  This is not available in Alexa right now, so a skill developer has a difficult time understanding what phrases people are trying in their skill that may not be working.

Polly Want a Cracker? A Simple Alexa Skill that Echoes Your Words


Doesn't it bug you that your skill service doesn't receive the understood text that was spoken.  When you don't launch a custom skill, the card that is included in your Alexa app displays the understood spoken text.

Why doesn't Amazon pass spoken text to a custom skill?  I think this keeps Alexa more secure.  If an Alexa owner added a skill that was easy to accidentally launch, then Alexa would be sending that service spoken dialog at times when the owner did not intend to send data.  Also, in a loud room, it is possible background dialog could be sent to your skill.  If someone launches the skill in the same room where someone else is on the phone reciting their credit card number, that is data someone would not want sent to a random skill developer.

However, if you had a need to receive the understood spoken text in your skill, it is possible.  You can use a built-in slot type that only exists for compatibility with earlier ASK skills, AMAZON.LITERAL.  Here is an example of how that would work below:

Intent Schema
{
  "intents": [
     {
      "intent": "Repeater",
      "slots": [
        {
          "name": "A",
          "type": "AMAZON.LITERAL"
        },
        {
          "name": "B",
          "type": "AMAZON.LITERAL"
        },

        --- CLIPCLIPCLIP ---
        --- And so on... ---
        --- CLIPCLIPCLIP ---

        {
          "name": "Y",
          "type": "AMAZON.LITERAL"
        },
        {
          "name": "Z",
          "type": "AMAZON.LITERAL"
        }
      ]
    }
  ]
}


Sample Utterances
Repeater {a|A} {a|B} {a|C} {a|D} {a|E} {a|F} {a|G} {a|H} {a|I} {a|J} {a|K} {a|L} {a|M} {a|N} {a|O} {a|P} {a|Q} {a|R} {a|S} {a|T} {a|U} {a|V} {a|W} {a|X} {a|Y} {a|Z}


I only have one intent that I use to match a phrase.  You'll need to add the missing slots that I clipped.  My sample utterance matches the intent with all AMAZON.LITERALs.  The one thing I noticed while testing this, is if I didn't include enough slots for the spoken words, the AVS wouldn't match my intent.  So, I created a bunch of slots, to catch a decently long phrase.

Then I use some javascript math to loop over all the slots and rebuild the phrase that was heard by Alexa.

exports.handler = function (event, context) {
    console.log(JSON.stringify(event.request));

    if(event.request.type === "LaunchRequest")
        context.succeed(buildResponse("Say something", {}, false));
    else if(event.request.type === "IntentRequest") {
        var output = "";
        for(var i=0; i <= "Z".charCodeAt(0)-"A".charCodeAt(0); i++ ) {
            var slot = event.request.intent.slots[String.fromCharCode("A".charCodeAt(0) + i)];
            if(slot && slot.value)
                output += " " + slot.value;
        }
        context.succeed(buildResponse(output, {}, false));
    }
    else
        context.succeed(buildResponse("", {}, true));
};

function buildResponse(output, attributes, shouldEndSession) {
    return {
        version: "1.0",
        sessionAttributes: attributes,
        response: {
            outputSpeech: {
                type: "PlainText",
                text: output
            },
            reprompt: {
                outputSpeech: {
                    type: "PlainText",
                    text: output
                }
            },
            shouldEndSession: shouldEndSession
        }
    };
}

That should do it for you.  You will now get the complete spoken phrase in your response.

How might this be useful?  It actually won't be that useful generally, since you'd need to do your own language understanding AI to match the spoken phrase in your skill logic.  And generally, if you have other intents in your schema, AVS tries really hard to match the spoken dialog with one of those before it would use this one.

Sunday, August 14, 2016

Monitoring time while using your skill



I wanted to explore making a game using the Alexa.  I thought it would be useful to know how long the game had been running.  Here is an example of how I am able to track the time elapsed since launching a skill.

Intent Schema
{
  "intents": [
     {
      "intent": "TimeIntent"
     },
    {
      "intent": "AMAZON.StopIntent"
    }
    ]
}

Sample Utterances
TimeIntent How much time has passed


I only have one intent that I use to ask for the elapsed time.  And the StopIntent just helps me quit the skill.  All of the work happens in the Lambda function.

var tickingClockMP3 = 
    "https://alexafiles.blob.core.windows.net/demo/ticking-clock.mp3";

exports.handler = function (event, context) {
    var attributes = {};
    
    if (event.session.new) {
        attributes = { startTime: event.request.timestamp };
    }
    else {
        attributes = 
        { 
            startTime: event.session.attributes.startTime,
            timeDiff: (new Date(event.request.timestamp) - 
                       new Date(event.session.attributes.startTime)) / 1000
        };
    }
    
    try {

        if (event.request.type === "SessionEndedRequest") {
                    onSessionEnded(event.request, event.session);
                    context.succeed();
        }
        else if(event.request.type === "LaunchRequest")
            context.succeed(buildTickerResponse(attributes, false));
        else if(event.request.type === "IntentRequest") {
            var output = "" + (attributes.timeDiff || 0) 
                       + " seconds have past.
";
            context.succeed(buildTickerResponse(attributes, false, output));
        }
        else
            context.succeed(buildTickerResponse(attributes, false));
    } catch (e) {
        context.fail("Exception: " + e);
    }
};

function buildTickerResponse(attributes, shouldEndSession, output) {
    return {
        version: "1.0",
        sessionAttributes: attributes,
        response: {
            outputSpeech: {
                type: "SSML",
                ssml: output || ""
            },
            reprompt: {
                outputSpeech: {
                    type: "SSML",
                    ssml: "At anytime you can say... " + 
                          "Alexa, how much time has past?
"
                }
            },
            shouldEndSession: false
        }
    };
}


A few things to note here.  
  1. When creating MP3s, make sure you follow the rules about where they can be hosted and the allowed format.  I used FFMPEG to fix it up: ffmpeg -i input.mp3 -b:a 48k -ar 16000 output.mp3.
  2. While the SSML is playing the audio, the only way to get Alexa to hear you again, you have to say her name.
  3. I store the startTime as an attribute.  I have to copy that value over to the new attributes object I send back each time.
That's it!  You can now keep track of how much time has past since your skill started.


Friday, August 12, 2016

Be careful when switching to use mongoDB session state provider

We just upgraded our Sitecore to use xDB.  And because we have a couple of front end servers that are load balanced, we switched our web.config from using the InProc sesstionState mode to using the custom MongoDB sessionState.

Before you do this, make sure that you check your code for any use of the Session object... typically some reference like HttpContext.Current.Session["Key"] = object.

If you are saving an object to the session, you'll need to make sure that object has been tagged as [Serializable].

Any that you miss will not work correctly when you deploy that config change.  And you'll see a bunch of errors in the event log:

    Exception type: SerializationException 
    Exception message: Type 'My.CustomObject' in Assembly 'My.Website, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
   at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
   at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArrayMember(WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, Object data)
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(WriteObjectInfo objectInfo, NameInfo memberNameInfo, WriteObjectInfo memberObjectInfo)
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
   at System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer)

Friday, July 29, 2016

Careful with Sitecore Icon's Recent Items List


It is tempting to select that recent icon when choosing an icon for your new template.  However, when you package up this template and deploy it to a new server, the path to that icon may be invalid.

I installed a package that I built onto a different server, and most of my icons never loaded.


When I checked the path to those icons in the package file items, I noticed they all were pointing to a temporary IconCache folder.


So, I changed all my icons in my original templates, by finding them through the Icon tab.  Now all of my paths to the icons were valid and relative to where Sitecore installs them by default, not where they may get temporarily cached.

Wednesday, June 22, 2016

10 Web Tests per Application Insights Resource

One of my favorite features of Azure's Application Insight resource is the Web Test.  You can use it to perform keepalive/heartbeat tests on your websites.  You can also use it to proactively be informed if your site is having problems.

Today I learned that you can only have a maximum of 10 web tests per resource.











This is still incredibly generous when you consider the
following:

  • You can run any webtest from up to 16 global locations.  So each webtest can really be thought of as 16 tests.
  • You can create a multi-step test using Visual Studio's Web Performance and Load Test project template.  In one of these projects, you can configure a complex series of web tests.  This only counts as 1 web test in App Insights.  But you could easily merge all of your webtests into a single project, and therefore only use 1 single webtest slot.

10 web tests per resource limitation should not be a limitation for anyone.

Sunday, June 5, 2016

Use Microsoft Azure to Host Alexa Card Images




Alexa Skills Kit includes the ability to add an image on your card.  So, I uploaded a file to my website and added the url to the response.card.image.smallImageUrl value.  Sadly, all I got was an empty grey box in the card.  It turns out that I needed to setup CORS.

An easy option is to use AWS's S3 storage.  But, I am more familiar with Microsoft Azure.  And I have free credits to use each month, so I wanted to see what it would take to use Azure's storage to host these images.

It turns out that it's not too difficult to setup.  And even if you don't have free credits, it will cost you pennies each year to host thousands of images used in your skills.

This blog will step you through
  1. Creating an Azure Storage Account resource
  2. Uploading files to the blob container
  3. Enabling CORS on your Azure Storage Account


Create a Blob Storage

In your Azure portal click '+ New'


Search for Storage Account.
Click Create.
Give your storage a name.  This will be part of the URI you'll use to access your files.
There are a lot of other options in here that you can choose depending on your needs.  Each choice will change the cost of your storage.  But based on the small files and limited amount of data I'd be storing in here (less than 1GB), I can't see how it would cost me more than pennies every month, no matter which options I choose.



Now add a container.  Make sure to change the Access type to Blob.  This will ensure that your files are accessible to the Alexa app.



Access Keys

You'll need your access keys to finish up a couple of the final steps.  These are available under the settings of your storage account.  Copy your key1 because you will need it later.

(the keys are for my old storage account, so I didn't bother blurring them out)

Upload files

The easiest tool to upload files into your container is available in Microsoft Azure Tool's for Visual Studio.  In the Cloud Explorer, drill down into your resources (Storage Accounts -> [BlobStorageName] -> Blob Containers -> [ContainerName]).



The first time you open your container, you may need to provide your storage account's Access Key.

You can now open up the Blob Container Editor.  This tool allows you to upload blobs/files into your container.  Each file will have a URL associated with it that can be accessed publicly, since this was setup as a blob container.



Test out your uploads in a web browser.  You can right-click on your uploads and copy the url.

You can now upload MP3s to this container and use them in SSML responses.

If you would like to use images in your cards, you'll need one more change.  The echo.amazon.com website and Echo app requires that the hosting site has CORS enabled.  This lets the web browser know that it's ok to download content from your website, even though it's displaying a webpage hosted at Amazon.


Enable CORS

There is MSDN documentation about how to enable CORS on your Azure Storage containers.  I tried to follow the RESTful PUT request to enable this, but first had issues with the format of my authorization header.  I found another article that describes how to format the auth header, but then I ran into another issue. I was getting a generic error about my XML content being malformed.  I gave up and decided to spend time on a different approach, the Azure C# SDK.

I created a new console project and added the nuget package, WindowsAzure.Storage.  Then, with a few lines of code, I enabled the CORS rule necessary for using images on cards.  Copy the code below into the Main() function.  And then update it to include your AccountName and AccountKey.

CloudStorageAccount StorageAccount 
  = CloudStorageAccount.Parse(@"DefaultEndpointsProtocol=https;AccountName=alexademo;AccountKey=CKBnwLxjJqZ0n6zvoe...");

CloudBlobClient BlobClient = StorageAccount.CreateCloudBlobClient();

ServiceProperties blobServiceProperties = BlobClient.GetServiceProperties();
blobServiceProperties.Cors = new CorsProperties();
blobServiceProperties.Cors.CorsRules.Add(new CorsRule()
{
    AllowedMethods = CorsHttpMethods.Get,
    AllowedOrigins = new List() { "http://ask-ifr-download.s3.amazonaws.com" }
});
            
BlobClient.SetServiceProperties(blobServiceProperties);

Run the code once and your storage container will now return images to the Alexa app.

Test it out

Your cards will now be able to access your images (be sure to update your skill code to point to the new azure blob stored images).  If you have any problems, make sure you are following the other requirements around the images
  • Correct format: JPEG or PNG
  • Allowed size: Less than 2MB

Enjoy!