跟随,学习,进步

Scott Hanselman

Scott Hanselman

https://www.hanselman.com/blog/

Scott Hanselman on Programming, The Web, Open Source, .NET, The Cloud and More

转到作者网站

Advice to my 20 year old self

I had a lovely interaction on Twitter recently where a young person reached out to me over Twitter DM. She said: If you could go back and give your 20-something-year-old self some advice, what would you say? I’m about to graduate and I’m sort of terrified to enter the real world, so I’ve sort of been asking everyone. What a great question! Off the top of my head - while sitting on the tarmac waiting for takeoff and frantically thumb-typing - I offered this brainstorm. FirstAvoid drama. In relationships and friendsDiscard negative peopleThere’s 8 billion people out thereYou don’t have to be friends with them allDon’t let anyone hold you back or downWe waste hours and days and years with negative peopleCollect awesome people like PokémonNetwork your butt off. Talk to everyone niceMake sure they aren’t transactional networkersNice people don’t keep scoreThey generously share their networkAnd ask for nothing in return but your professionalismDon’t use a credit card and get into debt if you canWhatever you want to buy you likely don’t need itGet a laptop and an iPad and buy experiencesDon’t buy things. Avoid wanting thingsMolecules are expensiveElectrons are basically freeIf you can avoid want now, you’ll be happier laterNone of us are getting out of this aliveAnd we don’t get to take any of the stuffSo ask yourself what do I wantWhat is happiness for youAnd optimize your existence around that thingEnjoy the simple. street food. Good friendsIf you don’t want things then you’ll enjoy people of all typesUse a password system like @1Password and manage your digital shit tightlyBe focusedAnd it will be okDoes this help? What's YOUR advice to your 20 year old self? Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today! © 2019 Scott Hanselman. All rights reserved.


Remote Debugging a .NET Core Linux app in WSL2 from Visual Studio on Windows

With Visual Studio Code and WSL (Windows Subsystem for Linux) you can be in a real Linux environment and run "code ." from the Linux prompt and Visual Studio Code will launch in Windows and effectively split in half. A VSCode-Server will run in Linux and manage the Language Services, Debugger, etc, while Windows runs your VS Code instance. You can use VS Code to develop on remote machines over SSH as well and it works great. In fact there's a whole series of Remote Tutorials to check out here. VS Code is a great Code Editor but it's not a full IDE (Integrated Development Environment) so there's still lots of reasons for me to use and enjoy Visual Studio on Windows (or Mac). I wanted to see if it's possible to do 'remote' debugging with WSL and Visual Studio (not Code) and if so, is it something YOU are interested in, Dear Reader. To start, I've got WSL (specifically WSL2) on my Windows 10 machine. You can get WSL1 today on Windows from "windows features" just by adding it. You can get WSL2 today in the Windows Insiders "Slow Ring." Then I've got the new Windows Terminal. Not needed for this, but it's awesome if you like the command line. I've got Visual Studio 2019 Community I'm also using .NET Core with C# for my platform and language of choice. I've installed from https://dot.net/ inside Ubuntu 18.04, under Windows. I've got a web app (dotnet new razor) that runs great in Linux now. From the WSL prompt within terminal, I can run "explorer.exe ." and it will launch Windows Explorer at the path \\wsl$\Ubuntu-18.04\home\scott\remotewebapp, but VS currently has some issues opening projects across this network boundary. I'll instead put my stuff at c:\temp\remotewebapp and access it from Linux as /mnt/c/temp/remotewebapp. In a perfect world - this is future speculation/brainstorming, Visual Studio would detect when you opened a project from a Linux path and "Do The Right Thing(tm)." I'll need to make sure the VSDbg is installed in WSL/Linux first. That's done automatically with VS Code but I'll do it manually in one line like this:curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l ~/vsdbg We'll need a launch.json file with enough information to launch the project, attach to it with the debugger, and notice when things have started. VS Code will make this for you. In some theoretical future Visual Studio would also detect the context and generate this file for you. Here's mine, I put it in .vs/launch.json in the project folder. VS will make a launch.json also but you'll need to add the two most important parts, the $adapter and $adapterArgs part as I have here.{ // Use IntelliSense to find out which attributes exist for C# debugging // Use hover for the description of the existing attributes // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md "version": "0.2.0", "configurations": [ { "$adapter": "C:\\windows\\sysnative\\bash.exe", "$adapterArgs": "-c ~/vsdbg/vsdbg", "name": ".NET Core Launch (web)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. "program": "/mnt/c/temp/remotewebapp/bin/Debug/netcoreapp3.0/remotewebapp.dll", "args": [], "cwd": "/mnt/c/temp/remotewebapp", "stopAtEntry": false, // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser "serverReadyAction": { "action": "openExternally", "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)" }, "env": { "ASPNETCORE_ENVIRONMENT": "Development" }, "sourceFileMap": { "/Views": "${workspaceFolder}/Views" }, "pipeTransport": { "pipeCwd": "${workspaceRoot}", "pipeProgram": "bash.exe", "pipeArgs": [ "-c" ], "debuggerPath": "~/vsdbg/vsdbg" }, "logging": { "engineLogging": true } } ]} These launch.json files are used by VS and VS Code and other stuff and give the system and debugger enough to go on. There's no way I know of to automate this next step and attach it to a button like "Start Debugging" - that would be new work in VS - but you can start it like this by calling a VS2019 automation command from the "Command Window" you can access with View | Other Windows | Command Window, or Ctrl-Alt-A. Once I've typed this once in the Command Window, I can start the next Debug session by just pressing Up Arrow to get the command from history and hitting enter. Again, not perfect, but a start.DebugAdapterHost.Launch /LaunchJson:C:\temp\remotewebapp\.vs\launch.json Here's a screenshot of me debugging a .NET Core app running in Linux under WSL from Windows Visual Studio 2019. Thanks to Andy Sterland for helping me get this working. So, it's possible, but it's not falling-off-a-log automatic. Should this setup and prep be automatic? Is development in WSL from Visual Studio (not Code) something you want? There is great support for Docker development within a container including interactive debugging already, so where do you see this fitting in...if at all? Does this add something or is it more convenient? Would you like "F5" debugging for WSL apps within VS like you can in VS Code? Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


Defragmenting your Calendar and your Outlook

It's a double-meeting that! Get it? "Outlook?" Seriously, though, sometimes folks comment on my busy schedule and I joke that I'm "playing tetris with Outlook" where appointments are falling blocks and I'm twisting and turning them and trying to make it all fit. I also often take some time and actively defrag my calendar. Defraggging your system's disk usually happens automatically - in the past it didn't - as background processes attempt to "reduce the fragmentation of (a file) by concatenating parts stored in separate locations on a disk." That's a techie explanation. Here's a basic one. Ever look at your bookshelf and you've got no system? Books all over, no plan. Even worse, imagine someone ripped a book in half along the spine and stored half the book on the top and the rest on the bottom shelf? Why, you'd be scandalized and you'd want to tidy up. Sometimes folks organize their books by color, sometimes by topic, usually by author. Point is, it can get messy, and you need to take a moment to get organized. The result is a nice tidy bookshelf that has less psychic weight and where the books you want are where you can get to them quickly. Defragment your schedule Why not do the same to our calendars? Often we'll just look for an open lot and a 30 min meeting will just drop in there, like an unwanted Tetris piece. If we had more time and energy we might be more aggressive and put the meeting (especially if it's a recurring meeting) in a specific slot. What slot though? What are we optimizing for? That's up to you, but I'd consider optimizing for context switching - specifically, avoiding context switches before and after meetings. For example, if you're a coder and you enjoy getting into the flow, avoid putting a meeting in the middle of that flow. If you are mentoring people - perhaps like me you have a half dozen - then put them all on the same day so your brain is in "mentoring mode." Batch up your code reviews. Make email management an appointment. Is Tuesday creative day? What about No-Meetings Mondays? Also, make sure you're color coding - just like the defragger! I use categories in my calendar and give meaning to each color so I can easily and quickly tell at a glance if this is a "Balanced Week" or if it's gonna feel weird. If you use colors that clash next to meetings with topics that clash then you can mentally prep yourself for the Context Switch. What do YOU want your defragmented calendar to look like? Typically it takes just willpower and awareness to defrag your calendar. And just like disk defragmenting, things might run slower for a bit while you're doing it, but the result will be neater and tidier and allow you to be more effective! It'll also, ahem, improve your Outlook. Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


The open source Carter Community Project adds opinionated elegance to ASP.NET Core routing

I blogged about NancyFX 6 years ago and since then lots of ASP.NET open source frameworks that build upon - and improve! - web development on .NET have become popular. There's more than one way to serve and angle bracket (or curly brace) my friends! Jonathan Channon and the Carter Community (JC was a core Nancy contributor as well) have been making a thin layer of extension methods and conventions on top of ASP.NET Core to make URL routing "more elegant." Carter adds and formalizes a more opinionated framework and also adds direct support for the amazing FluentValidation. One of the best things about ASP.NET Core is its extensibility model and Carter takes full advantage of that. Carter is ASP.NET. You can add Carter to your existing ASP.NET Core app by just "dotnet add package carter" and adding it to your Startup.cs:public class Startup{ public void ConfigureServices(IServiceCollection services) { services.AddCarter(); } public void Configure(IApplicationBuilder app) { app.UseRouting(); app.UseEndpoints(builder => builder.MapCarter()); }} At this point you can make a quick "microservice" - in this case just handle an HTTP GET - in almost no code, and it's super clear to read:public class HomeModule : CarterModule{ public HomeModule() { Get("/", async (req, res) => await res.WriteAsync("Hello from Carter!")); }} Or you can add Carter as a template so you can later "dotnet new carter." Start by adding the Carter Template with "dotnet new -i CarterTemplate" and now you can make a new boilerplate starter app anytime. There's a lot of great sample code on the Carter Community GitHub. Head over to https://github.com/CarterCommunity/Carter/tree/master/samples and give them more Stars! Carter can also cleanly integrate with your existing ASP.NET apps because, again, it's extensions and improvements on top of ASP.NET. Now how you can add Carter to a ASP.NET Core app that's using Controllers in the MVC pattern just like this:public void Configure(IApplicationBuilder app){ app.UseRouting(); app.UseEndpoints(builder => { builder.MapDefaultControllerRoute(); builder.MapCarter(); });} Then easily handle a GET by returning a list of things as JSON like this:this.Get<GetActors>("/actors", async (req, res) =>{ var people = actorProvider.Get(); await res.AsJson(people);}); &nbsp; Again, check out Carter on GitHub at and follow https://twitter.com/CarterLibs on Twitter! Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


Easily move WSL distributions between Windows 10 machines with import and export!

My colleague Tara and I were working on prepping a system for Azure IoT development and were using WSL2 on our respective machines. The scripts we were running were long-running and tedious and by the time they were done we basically had a totally customized perfect distro. Rather than sharing our scripts and having folks run them for hours, we instead decided to export the distro and import it on n number of machines. That way Tara could set up the distro perfectly and then give it to me. For example, when using PowerShell I can do this:C:\Users\Scott\Desktop> wsl --export PerfectWSLDistro ./PerfectWSLDistro.tar Then I can share the resulting tar and give it to a friend and they can do this! (Note that I'm using ~ which is your home directory from PowerShell. If you're using cmd.exe you'll want to include the full path like c:\users\scott\Appdata\Local\PerfectDistro)mkdir ~/AppData/Local/PerfectDistrowsl --import PerfectDistro ~/AppData/Local/PerfectDistro ./PerfectWSLDistro.tar --version 2 You can list our your WSL distros like this:C:\Users\Scott\Desktop> wsl --list -v NAME STATE VERSION* Ubuntu-18.04 Stopped 2 WLinux Stopped 2 Debian Stopped 1 PerfectDistro Stopped 2 It's surprisingly easy! Also, make sure you have the latest version of the Windows Terminal (and if you've got an old version and haven't deleted your profile.json, it's time to start fresh) it will automatically detect your WSL distros and make menu items for them! Also be sure to check out my YouTube video on developing with WSL2! Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


Programmatically change your system's mic and speakers with NirCmd and Elgato StreamDeck

I've got a lot of different sound devices like USB Headphones, a formal Conference Room Speakerphone for conference calls, and 5.1 Surround Sound speakers, as well as different mics like a nice Shure XLR connected to a PV6 USB Audio Mixer, as well as the built in mics in my webcams and other devices. There's lots of great audio apps and applets that can improve the audio switching situation on Windows. I like Audio Switcher and the similarly named https://audioswit.ch/er, for example. You can also automatically change your audio inputs automatically depending on the app. So if you always want to record your podcast with Audacity you can tell Windows 10 to always set (lie) the audio ins and outs on an app by app basis. The app will never know the difference. But I need to change audio a lot when I'm moving from Teams calls, recording Podcasts, and watching shows. I've got this Elgato Stream Deck that has buttons I can assign to anything. Combine the Stream Deck with the lovely NirCmd utility from NirSoft and I've got one click audio changes! The icons are just PNGs and there's lots available online. I created a bunch of batch files (*.bat) with contents like this:nircmdc setdefaultsounddevice "Speakers" 0 andnircmdc setdefaultsounddevice "Headphones" 0 The last number is 0, 1, or 2 where that means Console, Multimedia, or Communications. You can have one sound device for apps like Netflix and another for apps like Skype that identify as Communications. I just change all defaults, myself. You can also add in commands like "setsubunitvolumedb" and others to have preset volumes and levels for line-ins. It's ideal for getting reliable results. Then just use the Stream Deck utility to assign the icon and batch file using the "System | Open" widget. Drag it over and assign and you're set! If you can't figure out what the names of your sound devices are, you can call nircmd showsoundevices. It just took a few minutes to set this up and it'll save me a bunch of clicks every day. Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


Computer things they didn't teach you in school #2 - Code Pages, Character Encoding, Unicode, UTF-8 and the BOM

OK, fine maybe they DID teach you this in class. But, you'd be surprised how many people think they know something but don't know the background or the etymology of a term. I find these things fascinating. In a world of bootcamp graduates, community college attendees (myself included!), and self-taught learners, I think it's fun to explore topics like the ones I plan to cover in my new YouTube Series "Computer things they didn't teach you." BOOK RECOMMENDATION: I think of this series as being in the same vein as the wonderful "Imposter's Handbook" series from Rob Conery (I was also involved, somewhat). In Rob's excellent words: "Learn core CS concepts that are part of every CS degree by reading a book meant for humans. You already know how to code build things, but when it comes to conversations about Big-O notation, database normalization and binary tree traversal you grow silent. That used to happen to me and I decided to change it because I hated being left out. I studied for 3 years and wrote everything down and the result is this book." In the first video I covered the concept of Carriage Returns and Line Feeds. But do you know WHY it's called a Carriage Return? What's a carriage? Where did it go? Where is it returning from? Who is feeding it lines? In this second video I talk about Code Pages, Character Encoding, Unicode, UTF-8 and the BOM. I thought it went very well. What would you like to hear about next? Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


Cool WSL (Windows Subsystem for Linux) tips and tricks you (or I) didn't know were possible

It's no secret I dig WSL (Windows Subsystem for Linux) and now that WSL2 is available in Windows Insiders Slow it's a great time to really explore the options that are available. What I'm finding is so interesting about WSL and how it relates to the Windows system around it is how you can cleanly move data between worlds. This isn't an experience you can easily have with full virtual machines, and it speaks to the tight integration of Linux and Windows. Look at all this cool stuff you can do when you mix your peanut butter and chocolate! Run Windows Explorer from Linux and access your distro's files When you're at the WSL/bash command line and you want to access your files visually, you can run "explorer.exe ." where . is the current directory, and you'll get a Windows Explorer window with your Linux files served to you over a local network plan9 server. Use Real Linux commands (not Cgywin) from Windows I've blogged this before, but there are now aliases for PowerShell functions that allow you to use real Linux commands from within Windows. You can call any Linux command directly from DOS/Windows/whatever by just putting it after WSL.exe, like this!C:\temp> wsl ls -la | findstr "foo"-rwxrwxrwx 1 root root 14 Sep 27 14:26 foo.batC:\temp> dir | wsl grep foo09/27/2016 02:26 PM 14 foo.batC:\temp> wsl ls -la > out.txtC:\temp> wsl ls -la /proc/cpuinfo-r--r--r-- 1 root root 0 Sep 28 11:28 /proc/cpuinfoC:\temp> wsl ls -la "/mnt/c/Program Files"...contents of C:\Program Files... Use Real Windows commands (not Wine) from Linux Windows executables are callable/runnable from WSL/Linux because the the Windows Path is in the $PATH until Windows. All you have to do is call it with .exe at the end, explicitly. That's how "Explorer.exe ." works above. You can also notepad.exe, or whatever.exe! Run Visual Studio Code and access (and build!) your Linux apps natively on Windows You can run "code ." when you're in a folder within WSL and you'll get prompted to install the VS Remote extensions. That effectively splits Visual Studio Code in half and runs the headless VS Code Server inside Linux with the VS Code client in the Windows world. You'll also need to install Visual Studio Code and the Remote - WSL extension. Optionally, check out the beta Windows Terminal for the best possible terminal experience on Windows. Here's a great series from the Windows Command LIne blog: You can find the full series here: Part 1 Take your Linux development experience in Windows to the next level with WSL and Visual Studio Code Remote Part 2 An In Depth Tutorial on Linux Development on Windows with WSL and Visual Studio Code Part 3 Tips and Tricks for Linux development with WSL and Visual Studio Code Here's the benefits of WSL 2 Virtual machines are resource intensive and create a very disconnected experience. The original WSL was very connected, but had fairly poor performance compared to a VM. WSL 2 brings a hybrid approach with a lightweight VM, a completely connected experience, and high performance. Again, now available on Windows 10 Insiders Slow. Run multiple Linuxes in seconds, side by side Here I'm running "wsl --list --all" and I have three Linuxes already on my system.C:\Users\scott>wsl --list --allWindows Subsystem for Linux Distributions:Ubuntu-18.04 (Default)Ubuntu-16.04Pengwin I can easily run them, and also assign a profile to each so they appear in my Windows Terminal dropdown. Run an X Windows Server under Windows using Pengwin Pengwin is a custom WSL-specific Linux distro that's worth the money. You can get it at the Windows Store. Combine Pengwin with an X Server like X410 and&nbsp; you've got a very cool integrated system. Easily move WSL Distros between Windows systems Ana Betts points out this great technique where you can easily move your perfect WSL2 distro from one machine to n machines. wsl --export MyDistro ./distro.tar# put it somewhere, dropbox, onedrive, elsewheremkdir ~/AppData/Local/MyDistrowsl --import MyDistro ~/AppData/Local/MyDistro ./distro.tar --version 2 That's it. Get your ideal Linux setup sync'ed on all your systems. Use the Windows Git Credential Provider within WSL All of these things culminate in this lovely blog post by Ana Betts where she integrates the Windows Git Credential Provider in WSL by making /usr/bin/git-credential-manager into a shell script that calls the Windows git creds manager. Genius. This would only be possible given this clean and tight integration. Now, go out there, install WSL, Windows Terminal, and make yourself a shiny Linux Environment on Windows. Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


New YouTube Series: Computer things they didn't teach you in school

OK, fine maybe they DID teach you this in class. But, you'd be surprised how many people think they know something but don't know the background or the etymology of a term. I find these things fascinating. In a world of bootcamp graduates, community college attendees (myself included!), and self-taught learners, I think it's fun to explore topics like the ones I plan to cover in my new YouTube Series "Computer things they didn't teach you." BOOK RECOMMENDATION: I think of this series as being in the same vein as the wonderful "Imposter's Handbook" series from Rob Conery (I was also involved, somewhat). In Rob's excellent words: "Learn core CS concepts that are part of every CS degree by reading a book meant for humans. You already know how to code build things, but when it comes to conversations about Big-O notation, database normalization and binary tree traversal you grow silent. That used to happen to me and I decided to change it because I hated being left out. I studied for 3 years and wrote everything down and the result is this book." Of course it'll take exactly 2 comments before someone comments with "I don't know what crappy school you're going to but we learned this stuff when they handed us our schedule." Fine, maybe this series isn't for you. In fact I'm doing this series and putting it out there for me. If it helps someone, all the better! In this first video I cover the concept of Carriage Returns and Line Feeds. But do you know WHY it's called a Carriage Return? What's a carriage? Where did it go? Where is it returning from? Who is feeding it lines? What would you suggest I do for the next video in the series? I'm thinking Unicode, UTF-8, BOMs, and character encoding. Sponsor: Octopus Deploy wanted me to let you know that Octopus Server is now free for small teams, without time limits. Give your team a single place to release, deploy and operate your software.© 2019 Scott Hanselman. All rights reserved.


Announcing .NET Jupyter Notebooks

Jupyter Notebooks has been the significant player in the interactive development space for many years, and Notebooks have played a vital role in the continued popularity of languages like Python, R, Julia, and Scala. Interactive experiences like this give users with a lightweight tool (I like to say "interactive paper") for learning, iterative development, and data science and data manipulation. The F# community has enjoyed F# in Juypter Notebooks from years with the pioneering functional work of Rick Minerich, Colin Gravill and many other contributors! As Try .NET has grown to support more interactive C# and F# experiences across the web with runnable code snippets, and an interactive documentation generator for .NET Core with the dotnet try global tool, we're happy to take that same codebase to the next level, by announcing C# and F# in Jupyter notebooks. .NET in Jupyter Notebooks Even better you can start playing with it today, locally or in the cloud! .NET in Anaconda locally .NET Core 3.0 SDK and 2.1 as currently the dotnet try global tool targets 2.1. Jupyter : JupyterLab can be installed using Anaconda or conda or pip. For more details on how to do this please checkout the offical Jupyter installation guide. Install the .NET Kernel Open Anaconda Prompt (Installed with Anaconda Install the dotnet try global tool dotnet tool install --global dotnet-try Please note: If you have the dotnet try global tool already installed, you will need to uninstall the older version and get the latest before grabbing the Jupyter kernel-enabled version of the dotnet try global tool. Check to see if Jupyter is installed jupyter kernelspec list Install the .NET kernel! dotnet try jupyter install Test installation jupyter kernelspec list You should see the .net-csharp and .net-fsharp listed. To start a new notebook, you can either type jupyter lab Anaconda prompt or launch a notebook using the Anaconda Navigator. Once Jupyter Lab has launched in your preferred browser, you have the option to create a C# or a F# notebook Now you can write .NET and and prose side by side, and just hit Shift-Enter to run each cell. For more information on our APIs via C# and F#, please check out our documentation on the binder side or in the dotnet/try repo in the NotebookExamples folder. Features To explore some of the features that .NET notebooks ships with, I put together dashboard for the Nightscout GitHub repo. HTML output : By default .NET notebooks ship with several helper methods for writing HTML. From basic helpers that enable users to write out a string as HTML or output Javascript to more complex HTML with PocketView. Below I'm using the display() helper method. Importing packages : You can load NuGet packages using the following syntax. If you've used Rosyln-powered scripting this #r for a reference syntax will be familiar. #r "nuget:<package name>,<package version>" For Example #r "nuget:Octokit, 0.32.0" #r "nuget:NodaTime, 2.4.6" using Octokit; using NodaTime; using NodaTime.Extensions; using XPlot.Plotly; Do note that when you run a cell like this with a #r reference that you'll want to wait as that NuGet package is installed, as seen below with the ... detailed output. Object formatters : By default, the .NET notebook experience enables users to display useful information about an object in table format. The code snippet below will display all opened issues in the nightscout/cgm-remote-monitor repo.display(openSoFar.Select(i => new {i.CreatedAt, i.Title, State = i.State.StringValue, i.Number}).OrderByDescending(d => d.CreatedAt)); With the object formatter feature, the information will be displayed in a easy to read table format. Plotting Visualization is powerful storytelling tool and,a key feature of the Jupyter notebook experience. As soon as you import the wonderful XPlot.Plotly F# Visualization Package into your notebooks(using Xplot.Ploty;) you can begin creating rich data visualizations in .NET. The graphs are interactive too! Hover over the different data points to see the values. Learn, Create and Share To learn, create and share .NET notebooks please check out the following resources: Learn: To learn online checkout the dotnet/try binder image for a zero install experience. Create: To get started on your machine check out the dotnet/try repo. Select the option highlighted option&nbsp; Share: If you want to share notebooks you have made using the .NET Jupyter kernel, the easiest way is to generate a Binder image that anyone can run on the web. For more information on how to do this please check out the .NET Jupyter documentation. Checkout the online .NET Jupyter Notebook I created for to explore the NightScout GitHub project using C# and the Octokit APIs. The source is here https://github.com/shanselman/NightscoutDashboard&nbsp; but you can run the notebook live just by going to mybinder https://mybinder.org/v2/gh/shanselman/NightScoutDashboard/master?urlpath=lab&nbsp; We hope you enjoy this new .NET Interactive experience and that you're pleasantly surprised by this evolution of the .NET Try interactive kernel. Sponsor: Octopus Deploy wanted me to let you know that Octopus Server is now free for small teams, without time limits. Give your team a single place to release, deploy and operate your software.© 2019 Scott Hanselman. All rights reserved.


Trying out Visual Studio Online - Using the cloud to manage and compile your code is amazing

Visual Studio Online was announced in preview, so I wanted to try it out. I already dig the Visual Studio "Remote" technology (it's almost impossibly amazing) so moving the local container or WSL to the Cloud makes a lot of sense. Check out their blog post here. There's three quick starts. VS Online in the browser VS Online in VS Code VS Online in Visual Studio (in private preview so I don't have that but you can sign up!) Sweet. I'll start with with Browser version, which is the easiest one I'm guessing. I head to the login page. I'm using the new Edge browser. I see this page that says I have no "environments" set up. I'll make a plan. I changed mine to fall asleep (suspend) in 5 minutes, but the default is 30. Pricing is here. Now it's making my environment. I clicked on it. Then opened a new Terminal, ran "dotnet new web" and I'm basically in a thin VS Code, except in the browser. I've got intellicode, I can install the C# extension. Since I'm running a .NET app I had to run these commands in a new terminal to generate and trust certs for SSL.dotnet dev-certs httpsdotnet dev-certs https -- trust Then I hit the Debug menu to build and compile my app IN THE CLOUD and I get "connecting to the forwarded port" as its "localhost" is in the cloud. Now I've hit a breakpoint! That's bonkers. Now to try it in VS Code rather than online in the browser. I installed the Visual Studio Online extention and clicked on the little Remote Environment thing on the left side after running VS Code. This is amazing. Look on the left side there. You can see my Raspberry PI as an SSH target. You can see my new VS Online Plan, you can see my Docker Containers because I'm running Docker for Windows, you can see my WSL Targets as I've got multiple local Linuxes. Since I'm running currently in VS Online (see the HanselmanTestPlan1 in the lower corner in green) I can just hit F5 and it compiles and runs. It's a client-server app. VS Code is doing some of the work, but the heavy lifting is in the cloud. Same as if I split the work between Windows and WSL locally, in this case VS Code is talking to that 8 gig Linux Environment I made earlier. When I hit localhost:500x it's forwarded up to the cloud: Amazing. Now I can do dev on a little cheapo laptop but have a major server to the work in the cloud. I can then head over to https://online.visualstudio.com/environments and delete it, or I can let it suspend. I'm going to continue to explore this and see if I can open my blog and podcast sites in this world. Then I can open and develop on them from anywhere. Or soon from my iPad Pro! Go give Visual Studio Online a try. It's Preview but it's lovely. Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


Adafruit's Circuit Playground Express simulated Visual Studio Code's Device Simulator Express

I'm an unabashed Adafruit fan and I often talking about them because I'm always making cool stuff with their hardware and excellent tutorials. You should check out the YouTube video we made when I visited Adafruit Industries in New York with my nephew. They're just a lovely company. While you're at it, go sign up for the Adabox Subscription and get amazing hardware projects mailed to you in a mystery box regularly! One of the devices I keep coming back to is the extremely versatile Circuit Playground Express. It's under $25 and does a LOT. It's got 10 NeoPixels, a motion sensor, temp sensor, light sensor, sound sensor, buttons, a slide, and a speaker. It even can receive and transmit IR for any remote control. It's great for younger kids because you can use alligator clips for the input output pins which means no soldering for easy projects. You can also mount the Circuit Playground Express onto a Crickit which is the "Creative Robotics & Interactive Construction Kit. It's an add-on lets you #MakeRobotFriend using CircuitPython, MakeCode, or Arduino." The Crickit makes it easy to control motors and adds additional power options to drive them! Great for creating small bots or battlebots as my kids do. The most significant - and technically impressive, in my opinion - aspect of the Circuit Playground Express is that it doesn't dictate the tech you use! There's 3 great ways to start. Start your journey with Microsoft MakeCode block-based or Javascript programming. Then, you can use the same board to try CircuitPython, with the Python interpreter running right on the Express. As you progress, you can advance to using Arduino IDE, which has full support of all the hardware down to the low level, so you can make powerful projects. Start by exploring MakeCode for Circuit Playground Express by just visiting https://makecode.adafruit.com/ and running in the browser! Device Simulator Express for Adafruit Circuit Playground Express Next, check out the Device Simulator Express extension for Visual Studio Code! This was made over the summer by Christella Cidolit, Fatou Mounezo, Jonathan Wang, Lea Akkari, Luke Slevinsky, Michelle Yao, and Rachel Phinnemore, the interns at the Microsoft Garage Vancouver! This great extension lets YOU, Dear Reader, code for a Circuit Playground Express without the physical hardware! And when you've got one in your hards, it makes development even easier. That means: Device simulation for those without hardware Code deployment to devices Auto-completion and error flagging Debugging with the simulator You'll need these things: Visual Studio Code Node Python 3.7.4: Make sure you've added python and pip to your PATH in your environment variables. (1) Python VS Code extension: This will be installed automatically from the marketplace when you install... Device Simulator Express Fire up Visual Studio Code with the Device Simulator Express extension installed and then select "Device Simulator Express: New File" in the command palette (CTRL+SHIFT+P to open the palette). There's a lot of potential here! You've got the simulated device on the right and the Python code on the left. There's step by step debugging in this virtual device. There's a few cool things I can think of to make this extension easier to set up and get started that would be it a killer experience for an intermediate developer who is graduating from MakeCode into a Code editor like VS Code. It's early days and the interns are back in school but I'm hoping to see this project move forward and get improved. I'll blog more details as I have them! Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


Be a Technology Tourist

I was talking to Tara and we were marveling that in in 1997 15% of Americans had Passports. However, even now less than half do. Consider where the US is physically located. It's isolated in a hemisphere with just Canada and Mexico as neighbors. In parts of Europe a 30 minute drive will find three or four languages, while I can't get to Chipotle in 30 minutes where I live. A friend who got a passport and went overseas at age 40 came back and told me "it was mind-blowing. There's billions of people who will never live here...and don't want to...and that's OK. It was so useful for me to see other people's worlds and learn that." I could tease my friend for their awakening. I could say a lot of things. But for a moment consider the context of someone geographically isolated learning - being reminded - that someone can and will live their whole life and never need or want to see your world. Travel of any kind opens eyes. Now apply this to technology. I'm a Microsoft technologist today but I've done Java and Mainframes at Nike, Pascal and Linux at Intel, and C and C++ in embedded systems as a consultant. It's fortunate that my technology upbringing has been wide-reaching and steeped in diverse and hybrid systems, but that doesn't negate someone else's bubble. But if I'm going to speak on tech then I need to have a wide perspective. I need to visit other (tech) cultures and see how they live. You may work for Microsoft, Google, or Lil' Debbie Snack Cakes but just like you should consider getting a passport, you should absolutely visit other (tech) cultures. Travel will make you more well-rounded. Embrace the ever-changing wonders of the world and of technology. Go to their meet-ups, visit their virtual conferences, follow people outside your space, try to build their open source software, learn a foreign (programming) language. They may not want or need to visit yours, but you'll be a better and more well-rounded person when you return home if you're chose to be technology tourist. Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today! © 2019 Scott Hanselman. All rights reserved.


Create exceptional interactive documentation with Try .NET - The Polly NuGet library did!

I've blogged at length about the great open source project called "Polly" NuGet Package of the Week: Polly wanna fluently express transient exception handling policies in .NET? Adding Cross-Cutting Memory Caching to an HttpClientFactory in ASP.NET Core with Polly The Programmer's Hindsight - Caching with HttpClientFactory and Polly Part 2 Adding Resilience and Transient Fault handling to your .NET Core HttpClient with Polly and I've blogged about "Try .NET" which is a wonderful .NET Core global tool that lets you make interactive in-browser documentation and create workshops that can be run both online and locally (totally offline!) Introducing the Try .NET Global Tool - interactive in-browser documentation and workshop creator If you've got .NET Core installed, you can try it in minutes! Just do this:dotnet tool install --global dotnet-trydotnet try demo Even better, you can just clone a Try .NET enabled repository with markdown files that have a few magic herbs and spices, then run "dotnet try" in that cloned folder. What does this have to do with Polly, the lovely .NET resilience and transient fault handling library that YOU should be using every day? Well, my friends, check out this lovely bit of work by Bryan J Hogan! He's created some interactive workshop-style demos using Try .NET! How easy is it to check out? Let's give it a try. I've run dotnet tool install --global dotnet-try already. You may need to run update if you've installed it a while back.git clone https://github.com/bryanjhogan/trydotnet-polly.gitdotnet try That's it. What does it do? It'll launch your browser to a local website powered by Try .NET that looks like this! Sweet! Ah, but Dear Reader, scroll down! Let me try out one of the examples. You'll see a Monaco-based local text editor (the same edit that powers VS Code) and you're able to run - and modify - local code samples IN THE BROWSER! Here's the code as text to make it more accessible.RetryPolicy retryPolicy = Policy.Handle<Exception>() .Retry(3, (exception, retryCount) => { Console.WriteLine($"{exception.GetType()} thrown, retrying {retryCount}."); });int result = retryPolicy.Execute(() => errorProneCode.QueryTheDatabase());Console.WriteLine($"Received a response of {result}."); And the output appears below the sample, again, in a console within the browser:System.Exception thrown, retrying 1.System.InsufficientMemoryException thrown, retrying 2.Received a response of 0. You can see that Polly gives you a RetryPolicy that can envelop your code and handle things like transient errors, occasional flaky server responses, or whatever else you want it to do. It can be configured as a policy outside your code, or coded inline fluently like this. NOTE the URL! See that it's a .MD or Markdown file? Try .NET has a special handler that reads in a regular markdown file and executes it. The result is an HTML representation of your Markdown *and* your sample, now executable! What's the page/image above look like as Markdown? Like this:# Polly Retries Part 2### Retrying When an Exception OccursThe Polly NuGet package has been added and we are going to use the Retry Policy when querying database. The policy states that if an exception occurs, it will retry up to three times.Note how you execute the unreliable code inside the policy. `retryPolicy.Execute(() => errorProneCode.QueryTheDatabase());```` cs --region retryIfException --source-file .\src\Program.cs --project .\src\PollyDemo.csproj ```#### Next: [Retrying Based on a Result &raquo;](./retryIfIncorrectStatus.md) Previous: [Before You Add Polly &laquo;](../lettingItFail.md) Note the special ``` region. The code isn't inline, but rather it lives in a named region in Program.cs in a project in this same repository, neatly under the /src folder. The region is presented in the sample, but as samples are usually more complex and require additional libraries and such, the region name and project context is passed into your app as Try.NET executes it. Go check out some Try .NET enabled sample repositories. Just make sure you have the Try .NET global tool installed, then go clone and "dotnet try" any of these! https://github.com/bryanjhogan/trydotnet-polly https://github.com/dotnet/try-samples (there's like 5 sample areas in here, do "dotnet try" in the different directories!) If you're doing classwork, teaching workshops, making assignments for homework, or even working in a low-bandwidth or remote environment this is great as you can put the repositories on a USB key and once they've run once they'll run offline! Now, be inspired by (and star on GitHub) Bryan's great work and go make your own interactive .NET documentation! Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


How to make a pretty prompt in Windows Terminal with Powerline, Nerd Fonts, Cascadia Code, WSL, and oh-my-posh

I've blogged about Patching the new Cascadia Code to include Powerline Glyphs and other Nerd Fonts for the Windows Terminal but folks have asked very specifically, how do I make my prompt look like that? Step One - Get the Terminal Get Windows Terminal free from the Store. You can also get it from GitHub's releases but I recommend the store because it'll stay up to date automatically. Note that if you were an early adopter of the Windows Terminal and you've released updated beyond 0.5, I'd recommend you delete or zero-out your profiles.json and let the Terminal detect and automatically recreate your profiles.json. Step Two for PowerShell - Posh-Git and Oh-My-Posh Per these directions, install Posh-Git and Oh-My-Posh. This also assumes you've installed Git for Windows.Install-Module posh-git -Scope CurrentUserInstall-Module oh-my-posh -Scope CurrentUser Run these commands from PowerShell or PowerShell Core. I recommend PowerShell 6.2.3 or above. You can also use PowerShell on Linux too, so be aware. When you run Install-Module for the first time you'll get a warning that you're downloading and installing stuff from the internet so follow the prompts appropriately. Also get PSReadline if you're on PowerShell Core:Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck Then run "notepad $PROFILE" and add these lines to the end:Import-Module posh-gitImport-Module oh-my-poshSet-Theme Paradox Now that word Paradox there is optional. It's actually the name of a theme and you can (and should!) pick the theme that makes you happy and use that theme's name here. I like Agnoster, Paradox, or Fish, myself. Read more over here. https://github.com/JanDeDobbeleer/oh-my-posh Step Two for Ubuntu/WSL There's a number of choices for Powerline or Powerline-like prompts from Ubuntu. I like Powerline-Go for it's easy defaults. I just installed Go, then installed powerline-go with go get.sudo apt install golang-gogo get -u github.com/justjanne/powerline-go Add this to your ~/.bashrc. You may already have a GOPATH so be aware.GOPATH=$HOME/gofunction _update_ps1() { PS1="$($GOPATH/bin/powerline-go -error $?)"}if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"fi GOTCHA: If you are using WSL2, it'll be lightning fast with git prompts if your source code is in your Ubuntu/Linux mount, somewhere under ~/. However, if your source is under /mnt/c or /mnt anywhere, the git calls being made to populate the prompt are super slow. Be warned. Do your Linux source code/git work in the Linux filesystem for speed until WSL2 gets the file system faster until /mnt. At this point your Ubuntu/WSL prompt will look awesome as well! Fonts look weird? Uh oh! Step Three - Get a better font If you do all this and you see squares and goofy symbols, it's likely that the font you're using doesn't have the advanced Powerline glyphs. Those glyphs are the ones that make this prompt look so cool! At the time of this writing there is active talk of getting Powerline and other Nerd Fonts into Cascadia Code, the new font that ships with Windows Terminal. In the short term, you can get a forked version of Cascadia Code called Delugia Code and download that. Then from within Windows Terminal, hit "Ctrl+," to edit your profile.json and change the "fontFace" of your profile or profiles to this:"fontFace": "DelugiaCode NF", And that's it! Remember also you can get lots of Nerd Fonts at https://www.nerdfonts.com/, just make sure you get one (or generate one!) that includes the PowerLine Glyphs. Have fun! 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!© 2019 Scott Hanselman. All rights reserved.


Assert your assumptions - .NET Core and subtle locale issues with WSL's Ubuntu

I thought this was an interesting and subtle bug behavior that was not only hard to track down but hard to pin down. I wasn't sure 'whose fault it was.' Here's the story. Feel free to follow along and see what you get. I was running on Ubuntu 18.04 under WSL. I made a console app using .NET Core 3.0. You can install .NET Core here http://dot.net/get-core3 I did this:dotnet new consoledotnet add package Humanizer --version 2.6.2 Then made Program.cs look like this. Humanizer is a great .NET Standard library that you'll learn about and think "why didn't .NET always have this!?"using System;using Humanizer;namespace dotnetlocaletest{ class Program { static void Main(string[] args) { Console.WriteLine(3501.ToWords()); } }} You can see that I want the app to print out the number 3051 as words. Presumably in English, as that's my primary language, but you'll note I haven't indicated that here. Let's run it. Note that app this works great and as expected in Windows.scott@IRONHEART:~/dotnetlocaletest$ dotnet run3501 Huh. It didn't even try. That's weird. My Windows machine is en-us (English in the USA) but what's my Ubuntu machine?scott@IRONHEART:~/dotnetlocaletest$ localeLANG=C.UTF-8LANGUAGE= Looks like it's nothing. It's "C.UTF-8" and it's nothing. C in this context means the POSIX default locate. It's the most basic. C.UTF-8 is definitely NOT the same as en_US.utf8. It's a locate of sorts, but it's not a place. What if I tell .NET explicitly where I am?static void Main(string[] args){ Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); Console.WriteLine(3501.ToWords()); } And running it.scott@IRONHEART:~/dotnetlocaletest$ dotnet runthree thousand five hundred and one OK, so things work well if the app declares "hey I'm en-US!" and Humanizer works well. What's wrong? Seems like Ubuntu's "C.UTF-8" isn't "invariant" enough to cause Humanizer to fall back to an English default? Seems like other people have seen unusual or subtle issues with Ubuntu installs that are using C.UTF-8 versus a more specific locale like en-US.UTF8. I could fix this in a few ways. I could set the locale specifically in Ubuntu:locale-gen en_US.UTF-8update-locale LANG=en_US.UTF-8 Fortunately Humanizer 2.7.2 and above has fixed this issue and falls back correctly. Whose "bug" was it? Tough one but in this case, Humanizer had some flawed fallback logic. I updated to 2.7.2 and now C.UTF-8 falls back to a neutral English. That said, I think it could be argued that WSL/Canonical/Ubuntu should detected my local language and/or set locale to it on installation. The lesson here is that your applications - especially ones that are expected to work in multiple locales in multiple languages - take "input" from a lot of different places. Phrased differently, not all input comes from the user. System locale and language, time, timezone, dates, are all input as ambient context to your application. Make sure you assert your assumptions about what "default" is. In this case, my little app worked great on en-US but not on "C.UTF-8." I was able to explore the behavior and learn that there was both a local workaround (I could detected and set a default locale if needed) and there was a library fix available as well. Assert your assumptions! 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!© 2019 Scott Hanselman. All rights reserved.


Visual Studio for Nintendo Switch? - FUZE4 Nintendo Switch is an amazing coding app

I love my Nintendo Switch. It's a brilliant console that fits into my lifestyle. I use it on planes, the kids play it on long car rides, and it's great both portable and docked. NOTE: Check out my blog post on The perfect Nintendo Switch travel set up and recommended accessories But I never would have predicted "Visual Studio Core for Nintendo Switch" - now that's in a massive pair of air quotes because FUZE4 Nintendo Switch&nbsp;has no relationship to Microsoft or Visual Studio but it's a really competent coding application that works with USB keyboards! It's an amazing feeling to literally plug in a keyboard and start writing games for Switch...ON A SWITCH! Seriously, don't sleep on this app if you or your kids want to make Switch games. Per the Fuze website: This is not a complex environment like C++, JAVA or Python. It is positioned as a stepping stone from the likes of Scratch , to more complex real-world ones. In fact everything taught using FUZE is totally applicable in the real-world, it is just that it is presented in a far more accessible, engaging and fun way. If you're in the UK, there are holiday workshops and school events all over. If you're elsewhere, FUZE also has started the FuzeArena site as a forum to support you in your coding journey on Switch. There is also a new YouTube channel with Tutorials on FUZE Basic starting with Hello World! FUZE4 includes a very nice and complete code editor with Syntax Highlighting and Code bookmarks. You can plug in any USB keyboard - I used a Logitech USB keyboard with the USB wireless Dongle! - and you or the children in your life can code away. You just RUN the program with the "start" or + button on the Nintendo Switch. It can't be overstated how many asserts, bitmaps, sample apps, and 3D models that FUZE4 comes with. You may explore initially and mistakenly think it's a shallow app. IT IS NOT. There is a LOT here. You don't need to make all the assets yourself, and if you're interested in game makers like PICO8 then the idea of making a Switch game with minimal effort will be super attractive to you. &nbsp; &nbsp; FUZE and FUZE Basic also exists on the Raspberry Pi and there are boot images available to check out. It also supports the Raspberry Pi Sense Hat add-on board. They are also working on FUZE4 Windows as well so stay turned for that! If you register for their forums you can also check out their PDF workbooks and language tutorials. However, if you're like me, you'll have more fun reading the code for the included samples and games and figuring things out from there. FUZE4 on the Nintendo Switch is hugely impressive and frankly, I'm surprised more people aren't talking about it. Don't sleep on FUZE4, my kids have been enjoying it. I do recommend you use an external USB keyboard to have the best coding experience. You can buy FUZE4 as a digital download on the Nintendo Shop. Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger...With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


Video Interview: Between Two Nerds - Building Careers with Empathy

I was fortunate to be a guest on Steve Carroll's talk show "Careers Behind the Code," but Amanda Silver calls it "Between Two Nerds," so I'm going with that superior title. We also snuck a fern into the shot so that's cool. In the interview I talk about Empathy and why I think it's an essential skill for developers, designers, and program managers to develop - deeply. Steve also asked me about how I got my start in tech, and I tell the story about the day I showed up at home and the family van was gone. I wasn't sure how this interview would turn out, and I don't usually like talking about myself (I'm much more comfortable talking to YOU on my podcast) but folks seem to think the show turned out well. I also speak a little about "Living your Life by Default" and the importance of mindfulness, which is a partner to Empathy. Please do check out the interview and let me know what you think! Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger...With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.


Now is the time to make a fresh new Windows Terminal profiles.json

I've been talking about it for months, but in case you haven't heard, there's a new Windows Terminal in town. You can download it and start using it now from the Windows Store. It's free and open source. At the time of this writing, Windows Terminal is around version 0.5. It's not officially released as a 1.0 so things are changing all the time. Here's your todo - Have you installed the Windows Terminal before? Have you customize your profile.json file? If so, I want you to DELETE your profiles.json! Your profiles.json is somewhere like C:\Users\USERNAME\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState but you can get to it from the drop down in the Windows Terminal like this: When you hit Settings, Windows Terminal will launch whatever app is registered to handle JSON files. In my case, I'm using Visual Studio Code. I have done a lot of customization on my profiles.json, so before I delete or "zero out" my profiles.json I will save a copy somewhere. You should to! You can just "ctrl-a" and delete all of your profiles.json when it's open and Windows Terminal 0.5 or greater will recreate it from scratch by detecting the shells you have. Remember, a Console or Terminal isn't a Shell! Note the new profiles.json also includes another tip! You can hold ALT- and click settings to see the default settings! This new profiles.json is simpler to read and understand because there's an inherited default.// To view the default settings, hold "alt" while clicking on the "Settings" button.// For documentation on these settings, see: https://aka.ms/terminal-documentation{ "$schema": "https://aka.ms/terminal-profiles-schema", "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "profiles": [ { // Make changes here to the powershell.exe profile "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "name": "Windows PowerShell", "commandline": "powershell.exe", "hidden": false }, { // Make changes here to the cmd.exe profile "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "name": "cmd", "commandline": "cmd.exe", "hidden": false }, { "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "hidden": false, "name": "PowerShell Core", "source": "Windows.Terminal.PowershellCore" },... You'll notice there's a new $schema that gives you dropdown Intellisense so you can autocomplete properties and their values now! Check out the Windows Terminal Documentation here https://aka.ms/terminal-documentation and the complete list of things you can do in your profiles.json is here. I've made these changes to my Profile.json. I've added "requestedTheme" and changed it to dark, to get a black titleBar with tabs. I also wanted to test the new (not even close to done) splitscreen features, that give you a simplistic tmux style of window panes, without any other software.// Add any keybinding overrides to this array.// To unbind a default keybinding, set the command to "unbound""keybindings": [ { "command": "closeWindow", "keys": ["alt+f4"] }, { "command": "splitHorizontal", "keys": ["ctrl+-"]}, { "command": "splitVertical", "keys": ["ctrl+\\"]}] Then I added an Ubuntu specific color scheme, named UbuntuLegit.// Add custom color schemes to this array"schemes": [ { "background" : "#2C001E", "black" : "#4E9A06", "blue" : "#3465A4", "brightBlack" : "#555753", "brightBlue" : "#729FCF", "brightCyan" : "#34E2E2", "brightGreen" : "#8AE234", "brightPurple" : "#AD7FA8", "brightRed" : "#EF2929", "brightWhite" : "#EEEEEE", "brightYellow" : "#FCE94F", "cyan" : "#06989A", "foreground" : "#EEEEEE", "green" : "#300A24", "name" : "UbuntuLegit", "purple" : "#75507B", "red" : "#CC0000", "white" : "#D3D7CF", "yellow" : "#C4A000" }], And finally, I added a custom command prompt that runs Mono's x86 developer prompt.{ "guid": "{b463ae62-4e3d-5e58-b989-0a998ec441b8}", "hidden": false, "name": "Mono", "fontFace": "DelugiaCode NF", "fontSize": 16, "commandline": "C://Windows//SysWOW64//cmd.exe /k \"C://Program Files (x86)//Mono//bin//setmonopath.bat\"", "icon": "c://Users//scott//Dropbox//mono.png"} Note I'm using forward slashes an double escaping them, as well as backslash escaping quotes. Save your profiles.json away somewhere, make sure your Terminal is updated, then delete it or empty it and you'll likely get some new "free" shells that the Terminal will detect, then you can copy in just the few customizations you want. Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today! © 2019 Scott Hanselman. All rights reserved.


A wonderfully unholy alliance - Real Linux commands for PowerShell with WSL function wrappers

I posted recently about What's the difference between a console, a terminal, and a shell? The world of Windows is interesting - and a little weird and unfamiliar to non-Windows people. You might use Ubuntu or Mac and you've picked your shell like zsh or bash or pwsh, but then you come to Windows and we're hopping between shells (and now operating systems with WSL!) on a tab by tab basis. If you're using a Windows shell like PowerShell because you like it's .NET Core based engine and powerful scripting language, you might still miss common *nix shell commands like ls, grep, sed and more. No matter what shell you're using in Windows (powershell, yori, cmd, whatever) you can always call into your default Ubuntu instance with "wsl command" so "wsl ls" or "wsl grep" but it'd be nice to make those more naturally and comfortably integrated. Now there's a new series of "function wrappers" that make Linux commands available directly in PowerShell so you can easily transition between multiple environments. This might seem weird but it allows us to create amazing piped commands that move in and out of Windows and Linux, PowerShell and bash. It's actually pretty amazing and very natural if you, like me, are non-denominational in your choice of operating system and preferred shell. These function wrappers are very neatly designed and even expose TAB completion across operating systems! That means I can type Linux commands in PowerShell and TAB completion comes along! It's super easy to set up. From Mike Battista's Github Install PowerShell Core Install the Windows Subsystem for Linux (WSL) Install the WslInterop module with Install-Module WslInterop Import commands with Import-WslCommand either from your profile for persistent access or on demand when you need a command (e.g. Import-WslCommand "awk", "emacs", "grep", "head", "less", "ls", "man", "sed", "seq", "ssh", "tail", "vim") You'll do your Install-Module just one, and then run notepad $profile and add just a that single last line. Make sure you change it to expose the WSL/Linux commands that you want. Once you're done, you can just open PowerShell Core and mix and match your commands! From the blog, "With these function wrappers in place, we can now call our favorite Linux commands in a more natural way without having to prefix them with wsl or worry about how Windows paths are translated to WSL paths:" man bash less -i $profile.CurrentUserAllHosts ls -Al C:\Windows\ | less grep -Ein error *.log tail -f *.log It's a really genius thing and kudos to Mike for sharing it with us! Go try it now. https://github.com/mikebattista/PowerShell-WSL-Interop Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!© 2019 Scott Hanselman. All rights reserved.