Weekly Links – 5/6

So I’ve decided to start doing something new, Like any good dev, I spend a lot of time on the internet, so as I’m working on various projects I’ve decided I’m going to post a bunch of useful links out here that I find as i’m going through my travels. Hopefully you find them helpful too.

Technical Links:

Developer Life:

Book Review – Clockwork

Hello all, so as many of you know I read a good bit, and I also like to use “audible”. Great way to pass time while traveling or driving is to listen to audio books. Right now I’ve been on a real kick to learn more about business perspective and productivity. Some of the great books I’ve read and talked about before are:

  • Grit
  • Essentialism
  • 10x Rule
  • Deep Work

But I wanted to take a minute to talk about the book I just finished, Clockwork: Designing your business to run itself, by Mike Michalowicz. Now I have to admit, I found out about this book when I heard about it a couple of times and it showed up on my “recommended reading” books a few times.

So I was skeptical about this book, mainly because the book talks about how its focused on people starting their own business, and I work for a major corporation. So how can this be helpful to me? Well I have to admit, I was wrong.

I found this book to be really thought provoking, and it caused me to re-examine a lot of activities and work I do to measure impact and importance to success. The author makes the argument that in any organization, everyone has a responsibility to do the following:

  1. Protect the Queen Bee Role
  2. Serve the Queen Bee Role

And basically the key part of the business is to take the QBR (the Queen Bee Role) which is the crucial part of your job, and make all of your actions that you take focus on that above all others. Basically the argument is that I should spend every second of my work day focusing on that QBR, and when an activity takes away from that, I should focus on getting done with that as soon as possible, or if possible moving it off my plate.

The intention is that it makes me focus on the bigger picture and creates a scenario where you can take off from work and feel comfortable. For me, I have a tendency to have a hard time unplugging, and stepping away from work. And recently I’ve been setting goals to help myself to unplug. I found that when I started to put this into practice, I was able to unplug with less stress and it helped my overall mental health. For me, I started with the intention of doing the following:

  • Blocking 1 hour for lunch everyday
  • I will not eat at my desk

This forces me to take a lunch break away from my desk, and honestly it sounds small but it has paid huge returns, I have found that when I come back to work I am more focused, and at the end of the day less drained from a mental perspective. I find that stress level has gone down with regard to work and I also find that the work I’m doing is much more satisfying.

Below is a video that summarizes some of the ideas of the book. The value of this book though aren’t the ideas, but how you execute.

Building a facial search in less than 2 hours

So, I’ve been pretty up front that I’ve been expanding my current skills in the data science and AI space, and its been a pretty fun process, and I wanted to point everyone to a demo I was able to build out very quickly.

Facial Searching, is a pretty common use case, so much so that we see it everywhere, Google Photos allows you to tag people in photos and indexes them for you automatically. Facebook makes suggestions for tagging people when you upload new pictures.

So I wanted to build a service that would take a set of selected images or 3 members of my family, and build a solution that would allow me to run any family photo through and it would search for the known members of my family to apply. Seems like a pretty basic use-case, but I’ve been wanting to get some hands on experience with the Azure Cognitive Services.

So I researched and read through our documentation, and decided before I started I was going to set aside 2 hours and see how far I could get to do the following:

  • Build a console app to read in images of 3 family members.
  • Build logic to upload an image and read back attributes about that person, things like age, gender, hair color, glasses, etc.
  • Build logic to search and match faces of people in a photo with the library that was previously uploaded.

The cool news is that I was able to implement all that logic. The full solution can be found here.

So to start, I focused on the first use case, and Azure Cognitive services has this concept of “PersonGroups” that can be leveraged with the SDK. For starters you need to install the sdk from nuget, and this is the required package.

Microsoft.Azure.CognitiveServices.Vision.Face

the first part is the key part is the client, which I configured in a parent class as follows:

public class BaseFaceApi
    {
        protected string _apiKey = ConfigurationManager.AppSettings["FaceApiKey"];
        protected string _apiUrl = ConfigurationManager.AppSettings["FaceApiUrl"];
        protected string _apiEndpoint = ConfigurationManager.AppSettings["FaceApiEndpoint"];
        protected FaceClient _client;

        protected void InitializeClient()
        {
            _client = new FaceClient(new ApiKeyServiceClientCredentials(_apiKey));
            _client.Endpoint = _apiEndpoint;
        }
    }

This allows for configuration to be the app.config, and this face client will be leveraged for all operations to hit the API.

The Face API leverages this concept of “PersonGroups” and “Persons” to handle the library of faces you are going to compare against. The process is broken into 4 parts.

  • Create the group
  • Create the person
  • Register Images for that person
  • Train the Model

If you review the source code you will find that I have broken these out to separate methods. The benefit of creating the groups is that you can limit your searching to specific groups, and have your application recognize the differences between groups.

Once you completed loading these images and “Persons” into the service you are ready to search through this repository by uploading an image. This is done with the following code:

public async Task<Dictionary<Guid,FacePerson>> IdentifyFaces(string filePath,string groupID)
        {
            InitializeClient();

            Dictionary<Guid,FacePerson> ret = new Dictionary<Guid, FacePerson>();

            using (Stream s = File.OpenRead(filePath))
            {
                // The list of Face attributes to return.
                IList<FaceAttributeType> faceAttributes =
                    new FaceAttributeType[]
                    {
            FaceAttributeType.Gender, FaceAttributeType.Age,
            FaceAttributeType.Smile, FaceAttributeType.Emotion,
            FaceAttributeType.Glasses, FaceAttributeType.Hair
                    };

                var facesTask = await _client.Face.DetectWithStreamWithHttpMessagesAsync(s,true,true,faceAttributes);
                var faceIds = facesTask.Body.Select(face => face.FaceId.Value).ToList();

                var identifyTask = await _client.Face.IdentifyWithHttpMessagesAsync(faceIds,groupID);
                foreach (var identifyResult in identifyTask.Body)
                {
                    Console.WriteLine("Result of face: {0}", identifyResult.FaceId);
                    if (identifyResult.Candidates.Count > 0)
                    { 
                        // Get top 1 among all candidates returned
                        var candidateId = identifyResult.Candidates[0].PersonId;
                        var person = await _client.PersonGroupPerson.GetWithHttpMessagesAsync(groupID, candidateId);

                        var fp = new FacePerson();
                        fp.PersonID = person.Body.PersonId;
                        fp.Name = person.Body.Name;
                        fp.FaceIds = person.Body.PersistedFaceIds.ToList();

                        var faceInstance = facesTask.Body.Where(f => f.FaceId.Value == identifyResult.FaceId).SingleOrDefault();
                        fp.Age = faceInstance.FaceAttributes.Age.ToString();
                        fp.EmotionAnger = faceInstance.FaceAttributes.Emotion.Anger.ToString();
                        fp.EmotionContempt = faceInstance.FaceAttributes.Emotion.Contempt.ToString();
                        fp.EmotionDisgust = faceInstance.FaceAttributes.Emotion.Disgust.ToString();
                        fp.EmotionFear = faceInstance.FaceAttributes.Emotion.Fear.ToString();
                        fp.EmotionHappiness = faceInstance.FaceAttributes.Emotion.Happiness.ToString();
                        fp.EmotionNeutral = faceInstance.FaceAttributes.Emotion.Neutral.ToString();
                        fp.EmotionSadness = faceInstance.FaceAttributes.Emotion.Sadness.ToString();
                        fp.EmotionSurprise = faceInstance.FaceAttributes.Emotion.Surprise.ToString();
                        fp.Gender = faceInstance.FaceAttributes.Gender.ToString();

                        ret.Add(person.Body.PersonId, fp);
                    }
                }
            }

            return ret;
        }

One key note above is the face attributes, this identifies the attributes you would like the service to review and discover. You can limit this list as you like.

Please feel free to review the sample code and I hope you find a great use-case. For me, a very cool project that is on my list next is to build a camera with a raspberry pi that captures people who come to the door and compares them against a known database of people.

It’s also worth mentioning that this service is fully available in Azure Government for customers that have requirements to be deployed in a sovereign cloud.

TerraForm Kubernetes Template

Hello All, I wanted to get a quick blog post out here based on something that I worked on, and finally is seeing the light of day.  I’ve been doing a lot of work with TerraForm, and one of the use cases I found was standing up a Kubernetes cluster.  And specifically I’ve been working with Azure Government, which does not have AKS available.  So how can I build a kubernetes cluster and minimize the lift of creating a cluster and then make it easy to add nodes to the cluster.  So the end result of that goal is here.

Below is a description of the project, and if you’d like to contribute please do, I have some ideas for phase 2 of this that I’m going to build out but I’d love to see what others come up with.

Intention:

The purpose of this template is to provide an easy-to-use approach to using an Infrastructure-as-a-service deployment to deploy a kubernetes cluster on Microsoft Azure. The goal being that you can start fresh with a standardized approach and preconfigured master and worker nodes.

How it works?

This template create a master node, and as many worker nodes as you specify, and during creation will automatically execute the scripts required to join those nodes to the cluster. The benefit of this being that once your cluster is created, all that is required to add additional nodes is to increase the count of the “lkwn” vm type, and reapply the template. This will cause the newe VMs to be created and the cluster will start orchestrating them automatically.

This template can also be built into a CI/CD pipeline to automatically provision the kubernetes cluster prior to pushing pods to it.

This guide is designed to help you navigate the use of this template to standup and manage the infrastructure required by a kubernetes cluster on azure. You will find the following documentation to assist:

  • Configure Terraform Development Environment: This page provides details on how to setup your locale machine to leverage this template and do development using Terraform, Packer, and VSCode.
  • Use this template: This document walks you through how to leverage this template to build out your kubernetes environment.
  • Understanding the template: This page describs how to understand the Terraform Template being used and walks you through its structure.

Key Contributors!

A special thanks to the following people who contributed to this template:
Brandon Rohrer: who introduced me to this template structure and how it works, as well as assisted with optimizing the functionality provided by this template.

How to punch up your resume?

So I thought given the new direction with this blog, I would focus my attention on some of the questions I get a lot.  And one of the  biggest questions I get asked frequently is “My resume is terrible, how do I make it better?”

To be perfectly honest, most people undervalue their resume, and think of it like some kind of checkbox.  I love hearing people say “I’m not worried, once I go in for the interview the resume is meaningless.”  To which my response is HOW DO YOU THINK YOU GET THE INTERVIEW!

There’s an old adage, that the you never get a second chance to make a first impression, and when applying for jobs, the resume is your first impression.  When I worked for a prior company, part of my job was interviewing new talent and determining if they were a good fit to move the organization forward.  As such, I literally conducted over 100 interviews in a 8 month a period.  I can say I’ve seen a lot of things, and this blog post is really based around the tips that would apply to help get your resume noticed and get you in the interview.

  1. DO NOT stick to one page:  In college they will tell you that your resume must be limited to one page.  That is not realistic for a technical position, because in these positions we are looking for the skills you have.  Don’t go crazy but a good three page resume is a lot better than Times New Roman, size 8 compressed onto a page.  The human eye needs white space more than anything.
  2. Keep it up to date:  This is jumping a little further ahead, but make sure it is 100% current.  I’ve read resumes of people and nothing turns the interviewer off more than to bring you in and here, “Here’s the stuff that I’ve been working on”.
  3. Describe the projects:  Even better than a list of skills is a project description, and acknowledging that you can’t give up all details.  But things like, “Project XYZ was a mobile app built with Xamarin with a Cosmos DB database back end, and I was the lead developer of the mobile side.” tells me a lot about what your skills are.
  4. Be clear about your role:  It helps if you tell me what you did on the project, and be clear about the responsibility not the titles.  I’ll give an example, my first job I was responsible for building software for managing test centers and grading certification exams with the state, but being the state my job title was “LAN Technican”, no even close.  So I found that you should try to change your title, just list what you did on the project.  It gives a clearer picture of what your skills are.
  5. Put in personal projects:  I used to tell people “I can teach someone to code the way I want, but I can’t teach passion”.  So if you’ve contributed to GitHub projects, put it in there, if you have apps in the app store, put them in there.  Talk to me about what you with, that shows perseverance and drive, which I can’t teach.  If you blog list that, if you work with user groups, put that.  I once had a candidate show “my son and I built a cloud enabled race car with a raspberry pi and a cell phone”, that’s fantastic information.  But make sure you limit it to what you’ve done.
  6. Be Honest about how much you’ve worked with something:  It’s a great idea to quantify your technical skills, you can use a 1-10 scale, or some other measure, on my resume I use a 1-5 scale.  This allows them to get a good assessment of your skills and saves everyone time.  And to be honest this is another one where you show “I’m learning Xamarin on my own” is huge.  Expect that during the technical interview you are going to be grilled on all these, and if you aren’t honest, that’s a guaranteed out (next post we talk about the technical interview).