Scott Hanselman

Docker 101 and How do containers work?

August 26, 2020 Comment on this post [7] Posted in Docker | Open Source
Sponsored By

Everyone is using containers and talking about containers. Except those for whom it hasn't "clicked." Obvious to some and unendingly frustrating to others, containers are changing how we build and deploy software. As part of my ongoing 'Computer Stuff They Didn't Teach You' Series on YouTube, I explain Containers and Docker in about 30 min, with lots of demos and slow, deliberate examples.

Please do check it out and subscribe as I'll be doing Kubernetes next.

I hope you enjoy it! Please subscribe to my YouTube and explore my playlists and recent videos!


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Connect to a device over Serial COM Port on Windows 10 with WSL1 TTY devices with Windows Terminal and minicom

August 19, 2020 Comment on this post [9] Posted in Hardware | Win10
Sponsored By

imageI hope that this blog post is found and helps someone. I wasn't sure what to title it. Hope Google Juice got you here!

Read this whole post, there's a lot initially but there's really just two or three small pieces. It'll be worth it because you'll be able to have a nice one click menu and drop directly into a serial port terminal on Windows in the Windows Terminal

Often when you're doing embedded systems development you'll want to monitor or talk to the COM/Serial Port just like you SSH into remote system. Folks ask questions like "How to connect to a serial port as simple as using SSH?"

On Linux you'll use things like "screen /dev/ttyS0" for COM0. With Windows, however, the historical guidance has always been to use Putty. It'll work but it's somewhat old, quirky, and it doesn't integrate well with the Windows Terminal and a more modern workflow.

Say I have a small embedded microcontroller device that talks over a COM Port (usually via a USB->COM bridge) like an Arduino.

Let's assume this device talks to the COM port as if it were a terminal and it's outputting stuff I want to see. I'll use this great little CLI example app for Arduino from Mads Aasvik to simulate such a device.

Here's what it looks like under Arduino's Serial Monitor, for example. This is a Windows app doing serial communication with its own interface wrapping around it. I want to do this at a command line, and bonus points if it's in Windows Terminal.

Serial port monitor in Arduino talking to a Command Line Interface

Setup WSL1

If you have Windows 10 you can the Windows Subsystem for Linux quickly with this command at a Admin prompt:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Then go to the Windows Store and get any small Linux. Ubuntu or Kali will do for our purposes. Run it and set your user and password.  (I tried Alpine but it still has issues with screen and /dev/null/utmp)

NOTE: If you are using WSL2 and have set it as default, run wsl --list -v and ensure that your new distro is using WSL1 as only WSL1 will let us talk to the COM Ports. You can change it to WSL1 with "wsl --set-version DISTRONAME 1" from any command prompt.

To test this out now, run your new distro from any command line prompt like this. Add the "screen" app with sudo apt update" and "sudo app install screen".

You can see here that my Arduino serial device is on COM4. On Linux that device is /dev/ttyS4

Arduino is on COM4

That means that I should be able to talk it from any WSL1 Linux Distro on Windows like "screen /dev/ttyS4 9600" where 9600 is the speed/baud rate.

> wsl --list -v
NAME STATE VERSION
* Ubuntu-18.04 Stopped 2
kali-linux Stopped 1
Ubuntu-20.04 Stopped 2
WLinux Stopped 2

Get Minicom on your WSL1 distro

Screen is somewhat persnickety for Serial Port work so try Minicom. Minicom is a nice little text com program. Install with apt install minicom and run for the first time with "sudo minicom -s" to set your default. Note I've change the default port from /dev/modem to /dev/ttyS4 and the speed, in my case, to 9600.

Setting up Minicom on WSL

Then I hit enter and save settings as the dft (default) in minicom. You can also turn on Local Echo with "Ctrl-A E" and toggle it if needed. Now I can talk to my Arudino with minicom.

Ensure dialout permissions to talk to the COM port

NOTE: If you get "cannon open /dev/ttyS4: Permission denied, you may need to add your user to the dialout group. This way we don't need to sudo and get no prompt when running minicom!

> wsl -d kali-linux minicom
minicom: cannot open /dev/ttyS4: Permission denied
> wsl -d kali-linux
$ groups scott
scott : scott adm cdrom sudo dip plugdev
$ sudo gpasswd --add scott dialout
[sudo] password for scott:
Adding user scott to group dialout

I can now run minicom on my configured COM port 4 (/dev/ttyS4) with wsl -d DISTRONAME minicom without sudo.

Here I'm talking to that Arduino program. This embedded app doesn't need to me hit enter after I type, so remember your own embedded devices will vary.

Serial port shell with WSL and Minicom

Make a nice menu

Bonus points, now I'll add a menu item for Minicom by changing my Windows Terminal settings AND I'll get more points for adding a nice serial port icon!

Cool icon in Windows Terminal for Serial Ports

I hit settings and add a new profile like this at the top under profiles in the "list." Again, your distro name will be different.

{
"guid": "{61c54bbd-a2c6-5271-96e7-009a87fa45cf}",
"name": "Minicom on Serial COM4",
"hidden": false,
"commandline": "wsl -d kali-linux minicom",
"startingDirectory": "%USERPROFILE%",
"icon": "C:/Users/scott/Desktop/serial_port_icon_138204.png"
},

To review:

  • Use a WSL1 distro
  • Install minicom, run with minicom -s once to make settings
    • Make sure you are using the right /dev/ttyS0 device for your situation
    • Ensure your flow control, baud, etc are all correct in minicom
    • Add your user to the dialout group so you don't have to sudo minicom
  • Make a menu item in Windows Terminal
    • or run minicom manually in your WSL1 instance whenever you like

Hope this helps!


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

What is .NET? How does it work? Is it a language or a Platform?

August 14, 2020 Comment on this post [6] Posted in DotNetCore
Sponsored By

If you want to learn about .NET, I worked with my friends to make a whole series of videos at https://dot.net/videos that go into lots of details about C# the language, .NET the platform, ASP.NET the Web Platform and all the cool stuff you can make with it. There are a ton of free .NET videos and tutorials for you to explore (like 100, and they are easy, short, and binge worthy!)

But if you just have a few minutes and you're learning about .NET and just want to know WTF is .NET?!? Check out my YouTube. I'll explain the whole thing is a tight 20 min, from C# to F#, NuGet, and more. I'll show code, draw on the screen, and by the end you'll have a good sense of where .NET fits into the world versus things like Java, Node, Rust, Go, and more.

I hope you enjoy it! Please subscribe to my YouTube and explore my playlists and recent videos!


Sponsor: Have you tried developing in Rider yet? This fast and feature-rich cross-platform IDE improves your code for .NET, ASP.NET, .NET Core, Xamarin, and Unity applications on Windows, Mac, and Linux.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Free Books for Learning and Getting Started with Cloud-Native .NET Apps

August 12, 2020 Comment on this post [68] Posted in DotNetCore
Sponsored By

What is Docker? Can I use it with .NET?If you haven't been over to the Architecture section of the .NET site lately, I'd encourage you to go check it out. There is a TON of free learning content, books, code, and more!

Containers for Beginners

We've just put up a new Hello World tutorial for making your first microservice, and there's a video series on Docker and Containers as well. There are step-by-step instructions for installing .NET and building your first microservice using Docker. When you're done, follow how to deploy your microservice easily to Azure and Azure Kubernetes Service (AKS).

Intermediate - Cloud-native microservices

If you have about an hour, you can try out this new Learn Module for free - Create and deploy a cloud-native ASP.NET Core microservice. you can do it ALL in the browser with no software installation!

Imagine you're a software developer for an online retailer named eShopOnContainers. The retailer uses a cloud-native, microservices-based architecture developed using .NET Core for its online storefront. A new project is underway to add support for accepting coupon codes at checkout. Your assignment on the project is to finish writing a containerized ASP.NET Core web API to manage coupon codes—a web API that will be referred to as the coupon service.

This module explores completing the coupon service, adding it to the existing solution, and deploying it to the multi-container Kubernetes cluster.

Learning objectives

  • Examine existing ASP.NET Core microservices running in Azure Kubernetes Service (AKS).
  • Implement a new ASP.NET Core microservice and containerize it.
  • Publish the Docker image to Azure Container Registry (ACR).
  • Deploy the Docker container to the existing AKS cluster.

Free Books

Everyone loves free books. There are a number of free Cloud-Native Free Resources to download.

Cloud-native e-book - Formats: PDF | Online

 cloud-native-azure

This free e-book defines cloud native, introduces a sample app built using cloud-native principles, and covers topics common to most cloud-native applications. The audience for this guide is developers, development leads, and architects who are interested in learning how to build applications designed for the cloud. A secondary audience is technical decision-makers who plan to choose whether to build their applications using a cloud-native approach.

gRPC for WCF Developers e-Book - Formats: PDF | Online

 grpc-for-wcf-devs

This free e-book explains gRPC, relating each concept to the equivalent features of WCF, and offers guidance for migrating an existing WCF app to gRPC. This guide was written for developers working in .NET Framework or .NET Core who have previously used WCF, and who are seeking to migrate their applications to a modern RPC environment for .NET Core 3.0 and later versions. More generally, if you are upgrading, or considering upgrading, to .NET Core 3.0, and you want to use the built-in gRPC tools, this guide is also useful.

Serverless apps e-book - Formats: PDF | Online

 serverless-apps-cover-v3

Updated to Azure Functions 3.0! This guide focuses on cloud native development of applications that use serverless. The book highlights the benefits and exposes the potential drawbacks of developing serverless apps and provides a survey of serverless architectures. This guide was written for developers and solution architects who want to build enterprise applications with .NET that may use serverless components either on premises or in the cloud. It's useful to developers, architects, and technical decision makers interested in:

  • Understanding the pros and cons of serverless development
  • Learning how to approach serverless architecture
  • Example implementations of serverless apps

.NET Microservices e-book - Formats: PDF | Online

 cover-small

Updated to .NET Core 3.1! This guide is an introduction to developing microservices-based applications and managing them using containers. It discusses architectural design and implementation approaches using .NET Core and Docker containers.

We wrote this guide for developers and solution architects who are new to Docker-based application development and to microservices-based architecture. This guide is for you if you want to learn how to architect, design, and implement proof-of-concept applications with Microsoft development technologies (with special focus on .NET Core) and with Docker containers.

You will also find this guide useful if you are a technical decision maker, such as an enterprise architect, who wants an architecture and technology overview before you decide on what approach to select for new and modern distributed applications.

ASP.NET Core e-book - Formats: PDF | Online

aspnet

Updated to .NET Core 3.1! This guide provides end-to-end guidance on building web applications using ASP.NET Core and Azure.

The audience for this guide is developers, development leads, and architects who are interested in building modern web applications using Microsoft technologies and services in the cloud.

A secondary audience is technical decision makers who are already familiar ASP.NET or Azure and are looking for information on whether it makes sense to upgrade to ASP.NET Core for new or existing projects.

We have even more free Books and Guides coming , I'll share them very soon! Check out https://dotnet.microsoft.com/learn/dotnet/architecture-guides for more.


Sponsor: Have you tried developing in Rider yet? This fast and feature-rich cross-platform IDE improves your code for .NET, ASP.NET, .NET Core, Xamarin, and Unity applications on Windows, Mac, and Linux.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Reviewing the Elecrow CrowPi2 Raspberry Pi Laptop and STEM Education Platform

August 07, 2020 Comment on this post [4] Posted in Hardware
Sponsored By

11540c45729eb73fd9676faf6b05914c_originalI love the Raspberry Pi and I am a fan of the CrowPi from Elecrow. I have two of their first CrowPi device and I use them in demonstrations and talks all the time, especially when talking to students.

They have a Kickstarter ending this week for the new CrowPi2. It's an update of the original CrowPi which was basically a Raspberry Pi in a tiny suitcase...instead the CrowPi2 looks like a laptop! The magical part is that the full exploration and sensor board is hidden underneath a wireless keyboard with trackpad, held on with magnets!

The CrowPi folks sent me an early CrowPi2 because I was a vocal supporter of the previous version, so I did a LIVE video unboxing on twitter as well as a follow up software video on the CrowPi2. I am not being paid for this review and I always am honest with y'all about the stuff I like. I plan on buying a few for my kids' public school science class.

This blog post in Chromium on a Raspberry Pi CrowPi2

It's more than "just a laptop shaped case" for the Raspberry Pi, the CrowPi2 has an integrated 1080p screen, 22 onboard sensors (that can be connected and disconnected with a switch), a microphone and 2MP webcam, speaker, as well as support for both 5v battery and 12v external power.

The keyboard is also quiet clever and very thin. It's held on with magnets and is charged with any micro-USB connector. Hidden underneath is an upgrade of the original CrowPi sensor board!

Sensors hidden under the keyboard

Here's a close up of the sensor board:

20+ Sensors on the CrowPi2

The part I was the most surprised with was that there's 20+ projects already setup out of the box. I usually get a device like this and maybe there's some sample code on the desktop that you can run with Python. The CrowPi2 is more polished in that it has a whole front-end introductory UI that lets you run the samples right away - and they are cool samples! I show a few of the LIVE samples in my Video on Twitter.

The plastic in the early version I got is a little soft, and I might have preferred it in black versus silver, but it's light and drops in a backpack easily. It's somewhat thick (remember this is a Raspberry PI, not an iPad or a millimeter thin laptop) so to be conscious if you think you're getting an Ultrabook. This is a Raspberry Pi-based laptop and learning platform. Would be a great starter for any kid as the Pi4 is pretty legit and it'll even run Chromium!

NOTE: I did try to join a Zoom web-based meeting over Chromium and while the speaker and mic were detected, I wasn't able to get Chromium to see the webcam. I'll report back on this as clearly all the parts are there to allow this little laptop to join at least a web Zoom meeting! That would be even cooler.

UPDATE! I was able to enter a web-based Zoom meeting! There's a little USB cable underneath that snakes out then in again to allow access to the webcam. Very clever! I don't think this is a reliable option for Zoom meetings, but I can confirm that the webcam works!

IMG_5022

Here's a side view of the CrowPi2, as well as how the Raspberry Pi mounts inside.

CrowPi2 from the Side

Raspberry Pi mounted inside

There is even a cool little retractable tray in the back of the CrowPi2 that you can use for a battery (with a micro-USB cable you can run the entire device) or for holding wires, LEDs, and resisters for projects.

Cool tray in the back of the CrowPi2

The real magic is the sample projects - they are quite cool. They've added AI and Machine Learning lessons with Thonny PI, loaded MineCraft Pi. There are games, sensor tests, and they basically exercise the whole main sensor board with Python.

NOTE: I've also installed .NET Core on Raspberry Pi and it works great since it's an ARM Machine. You can even run Docker!

The basic kit is very reasonably priced compared to the much more barebones kits you see on Amazon. While I wouldn't call it a "premium" kit due to the plastic case, it's definitely the best Raspberry Pi kit I've ever used.

Playing Games on the CrowPi

You can go support the new CrowPi2 over on their KickStarter ending this week, it's pretty darn cool.


Sponsor: Bug in prod? Get to the bottom of it, fast, with live production log search in Seq 2020.1.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.