Colored notes in OneNote

I like using OneNote when I’m working on a project with different kinds of assets. I’m in the middle of doing a new course for Pluralsight that will be out in a couple of months. I have slides, a script, PowerPoint decks, code, media files, etc. It can get a little confusing trying to keep track of everything.

For the new course, I have been using OneNote to map out each module. The way I create the content is that I create a PowerPoint deck for each module and then write a script for the narration of the deck. I create a new OneNote file for the course, and then add a tab for each module. Inside each module, there are tabs for each section of that module. I have one tab for just for notes and links to resources.

Each tab has multiple OneNote paragraphs, basically one paragraph for each slide. To make it easy to pick out paragraphs, I wanted to give each paragraph it’s own background colors. It makes it easier to find the text that I want and I can move stuff around and easily see what text belongs in each paragraph. You would think it would be as simple as right-clicking in the paragraph and selecting the color. No, that is not an option.

You could just place a colored shape behind the paragraph. That kind of works, but it’s an annoyance if you are constantly editing the text as the shape will not resize with the text.

There is another way, and it’s a bit of a hack. You can do this for new text or for a paragraph that you already have added.

For an existing paragraph, copy the text, and cut it from the paragraph. Then, insert a 1×1 table into the paragraph. Next, paste the text into the single cell table.

Click on the table and select the Layout tab in the OneNote ribbon. In the Format section of the Layout ribbon, select the drop-down arrow for shading. Now you can pick the color that you want for the paragraph. Now you have colored paragraphs and the color matches the size of the text. And with the default borders for a table, you get a simple box drawn around the text.

For a new paragraph, insert the 1×1 table first and just start typing into the table cell. By default, OneNote will add a new table row for each hard return of the Enter key. A way around that is to press Shift-Enter twice at the end of the first line and arrow back up the first newline. As long as you leave one empty line at the bottom, pressing the Enter key will keep the text in a single row.

I can take no credit for this technique, I saw it mentioned a few times on the Internets.

Add a POSH ADB to your Windows Terminal

Windows Terminal is so close to being out of beta. It’s been my default CLI on Windows for about a year. I still don’t think in PowerShell, but I try to use PowerShell as my default shell. I just love how you can configure Terminal.

The default shell for me is PowerShell Core, aka Powershell 7.0. Out of the box, it doesn’t have ADB on the path. When I’m doing Android stuff, I want the ADB. But I don’t want it to be on the path by default. Just like Visual Studio has the “Android ADB Command Prompt” menu option, I wanted to add shell option to Terminals so I can spin up a new PowerShell, but with ADB support. This is what I ended up with:

PowerShell with ADB goodness.

The first thing I did was to create a PowerShell script that just adds the ADB tooling to the path. My first attempt was:

$NeedsAdb = $true

foreach ($p in $env:Path.Split(";"))
{
    if ($p -match "android-sdk\\platform")
    {
        $NeedsAdb = $false
        break
    }
}

if ($NeedsAdb)
{
    write-host "Adding Android SDK Platform tools to path"
    $env:Path += ";C:\Program Files (x86)\Android\android-sdk\platform-tools"
}

It walks through the path and checks to see the folder with the ADB bits is already there.  If not, it gets added. That worked but seemed like a lot. I did a quick refactor and got it down to this

$NeedsAdb = $true

$env:Path.Split(";") | ForEach-Object {
    if ($_ -match "android-sdk\\platform") {
        $NeedsAdb = $false
        break
    }
}

if ($NeedsAdb) {
    write-host "Adding Android SDK Platform tools to path"
    $env:Path += ";C:\Program Files (x86)\Android\android-sdk\platform-tools"
}

A little cleaner, but still too much.  I was taking the path, splitting it up into an array of strings, and then testing each string.  But wait, the path is a string.  That made it simpler.  Instead of doing a string match on each folder the path, I can make one string match against the whole thing.

if ($env:Path -NotMatch "Android\\android-sdk\\platform")
{
    write-host "Adding Android SDK Platform tools to path"
    $env:Path += ";${env:ProgramFiles(x86)}\Android\android-sdk\platform-tools"
}

So I called that one add-adb.ps1 and saved it to a common folder that I put scripts in.  Next, I wanted a cosmetic tweak so that I knew which shell has the power of ADB.  I went to materialdesignicons.com and did a search on “Android”.  I found an icon named “android-debug-bridge”, which was perfect.  I downloaded the .svg version of the icon and then made a .png file out of it with PhotoShop.  I named it android-debug-bridge.png.  Then I made a smaller version to be the icon. You can grab the images and the .ps1 file from the following Gist link: https://gist.github.com/anotherlab/364e3805d9ea56b574b394127acc9aa6

Now that I had the script and the images, it’s time to add a new shell profile.  From within Windows Terminal, select “Settings” from the drop-down menu.  You can also press the CTRL+, shortcut.  This will load the settings.json file in the text editor of your choice.  I have Visual Studio Code registered as the default app for JSON files.  You can use a lesser editor, but that’s on you.

There will be an array of objects named “list”.  These objects are the different shells that can be run from within Windows Terminals.  I added the following item to the list array

 

"list":
[
    {
        "guid": "{50caca3f-bff1-4891-b7f7-e3a05c040003}",
        "fontFace":  "Cascadia Code PL",
        "backgroundImage": "d:/grfx/android-debug-bridge.png",
        "backgroundImageStretchMode": "uniform",
        "backgroundImageOpacity": 0.15,
        "hidden": false,
        "name": "ADB PowerShell",
        "icon": "d:/grfx/adb-32.png",
        "commandline": "pwsh.exe -noe -c D:/scripts/add-adb.ps1"
    },
]

Let’s go over this line by line.

FieldValue
guidIt wants a GUID, so just get one.  I used guidgenerator.com, but any GUID generator will do.
fontFaceI’m using the Powerline version of Cascadia.  More on that in a bit
backgroundImageGrab it from my Gist or use your own.
backgroundImageStretchMode Size the image to fit the Shell window
backgroundImageOpacity I set it to be mostly transparent
hiddenIf you want to hide this from the list of shells, just set it to True
nameCall it what you want
iconThe tab icon is optional, but you can grab it from my Gist.
commandlineThis is what gets launched. The “-c” option says to run the next parameter and the “-noe” says not to exit after running the command

And that lets me spin up a new PowerShell with ADB on the path.  Mixing PowerShell with ADB makes it easier to do ADB commands that would normally be clunky.  For example, I want to test some Android code that would access the photo gallery.  When you new up a new Android emulator, there are no images.   ADB lets copy files to the emulator’s filesystem, but it doesn’t do wild cards.

You may have notice the “/” slash being used instead of “\” for file paths. Windows Terminal lets you use the “/” as the directory separator and this avoids having to use “\\” to get a single “\” in.

I have a folder with a bunch of images that I wanted to copy to an Android Emulator image.  I then run the following command from PowerShell:

Get-ChildItem .\*  -Include *.jpg,*.png | Foreach-Object {adb push $_.Name /sdcard/Pictures}

Get-ChildItem gets a directory listing and I use the -Include parameter to only include the files that have the .jpg and .png extension. If I didn’t need to filter the files list, I could the aliases for Get-ChildItem of gci or ls. I then pipe the results into Foreach-Object. This will execute everything in the {} block for each item. $_.Name is the name of the file and that gets passed to adb push to copy that file to /sdcard/Pictures in the emulator. There’s a bit of typing, but it does save time when trying to copy a set of files over to Android.

About that “Cascadia Code PL” font face.  I’m running a theming engine inside PowerShell called “Oh-my-posh”.  I’ll do a longer post on it in the future, but the short story is that it makes the PowerShell prompt contain the current git status for the current folder.  Read about it and get it here.  On the Mac, I use Oh-my-zsh to get a souped-up zsh shell.  Scott Hanselman did a good write up of Oh-my-posh here.

Oh-my-posh uses Powerline Glyphs (originally defined here) as part of the status display.  So you’ll need a font that includes the Powerline Glyphs.  Microsoft’s Cascadia Code font has a version with Powerline and you can get it here.  Here’s what that looked like when I was adding the files to the Gist

You can see the color and text information change as I used git to add the icon to the Gist. When working with git, it’s very handy to easily see which branch you are working with and the current status of that branch.

Some quick improvements for the home video conferencing experience

After a few months of full time working from home, there are a couple of things that I have done to improve the video conferencing experience. Well, for me, anyway.

Having a decent webcam will be a big improvement in the quality of your video. And it can give you some added flexibility with positioning over the webcams that are built into laptops.  Even though they are hard to get now, they are well worth the money.

For a long time, I used a Microsoft LifeCam.  It was more or less fine, but every time I sat back in my chair, it would hunt for focus.  That’s an unnecessary distraction.  I wrote some code to deal with that.  And that became a project that still lives on.  But I no longer use that webcam.

I bought a Logitech (sorry, I refuse to say “logi”) c922 webcam.  It had the resolution that I wanted and a tripod mount on the base. It tilts up and down but oddly doesn’t adjust from side to side.

I’m pretty sure it came with a tripod, but at the moment I’m not exactly sure where that went.  I have it mounted on an old JOBY Gorillapod that I had in my camera bag.  It’s an older one, without the adjustable head. 

With the c922 on the tripod, I can move the webcam around as it suits my mood.  I like having the camera at more or less eye level.  With my PC, when it was mounted on top of one of the monitors, so it was always looking down on me.  With the tripod, I can place it in between two of the monitors and at eye level.

Webcam deployed

Sometimes I want it at a slight angle from my face.  With the webcam free to move around, that makes it easy to adjust.  I’ve been in meetings where we spend most of the time going over documents, and we don’t need the “eye to eye” viewpoint.

If you are doing a family Zoom meeting, it’s handy to connect a laptop to a TV and then be able to move the webcam so that it’s in front of the TV.  And yes, sometimes I just aim the webcam at the dogs.

Every day is now take your work to dogs day

At this point, replacing the background of your webcam is getting a bit tired.  But early on in WFH mode, it was fun to change it up.  At work, we use Teams, and back in March, it didn’t support virtual backgrounds.  So I bought a license for XSplit VCam.  VCam lets you use static images, videos, and even YouTube links for the background.  And it will let blur any of that with fine control over the level of the blur.

One of my teammates had bought a house last year from another co-worker.  Thanks to that co-worker, I was able to grab pictures from the real estate listings for the house.  For our first standup meeting after WFH, it looked like we in the same house.  It’s a fun trick but grows tiresome after a few times.  Also, do not make your webcam background a live feed of puppies playing.  Unless bringing a meeting a flying stop is the desired outcome, then, by all means, go ahead.

Puppies, the meeting killer

The meeting apps that have the virtual background (and the 3rd party apps) can usually do the replacement without a green screen.  But if you have an actual green screen, you can get better results.  When I was given the WFH order, that night I bought the parts to make one.  It’s basically a 2×4, some PVC pipes, and cheap green table clothes.  I think I spent $15 at Home Depot and a dollar store.  I followed the instructions from this video:

It was cheap and easy.  And I can tear it down in seconds.  If you have kids at home that are bored out of their minds, let them use a green screen and make their own videos.

Another thing I did was play around with the lighting.  By genetics and behavior, I’m pretty pale.  If the lighting is not balanced, I look like Caspar.  And not in a good way.  For Christmas, I received a Circadian Optics Lattis Light Therapy Lamp as a gift.  It’s very bright and full spectrum.  For the longest time, I couldn’t figure out what to do with it.

Now, when I’m in a video meeting, I turn the Lattis light on, but I have it facing the wall by my desk.  By bouncing it, I’m getting a nice gentle fill, instead of the light of a thousand suns.  I have a window directly behind me and having a light source off to my side keeps me properly lit.  The Lattis has three settings, Low, Medium, and I’m Going Blind.  I find the lowest setting works the best.

At the lowest setting

Then there’s the audio.  If you are going to be in video meetings, get a decent set of headphones with a noise-canceling microphone.  If your environment has other people in it (like children, spouses, angry farm animals), the other people in the meeting will appreciate it. 

I have a Macbook and a Windows desktop and on the Mac, I use my Jabra earbuds.  They fit well and the microphone is good enough.  On the Windows box, I use a set of cheap headphones, the Microsoft Lifechat LX-3000.  They get the job done and they work with everything.

Work From Home is the new normal for me. And based on current conditions, I don’t expect that will change for a few months, probably longer. So it’s important to me to do what I can to improve the video conferencing setup.

In other news…

Next week, I’m restarting the TVUG user group after a few months of hiatus. It’s on Tuesday, the 12th. You can join in via this handy link via Teams. I’m going to be the presenter, so it’s important that the audio and the visual work well.

And don’t even get me started on chairs…