Scott Hanselman

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

November 13, 2019 Comment on this post [8] Posted in Linux Win10
Sponsored By

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.

Accessing WSL files from Explorer

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.bat

C:\temp> dir | wsl grep foo
09/27/2016 02:26 PM 14 foo.bat

C:\temp> wsl ls -la > out.txt

C:\temp> wsl ls -la /proc/cpuinfo
-r--r--r-- 1 root root 0 Sep 28 11:28 /proc/cpuinfo

C:\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:

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 --all
Windows Subsystem for Linux Distributions:
Ubuntu-18.04 (Default)
Ubuntu-16.04
Pengwin

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  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, elsewhere

mkdir ~/AppData/Local/MyDistro
wsl --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!

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
November 15, 2019 4:49
I'm really digging WSL, even if I only use it to run a local redis while developing on windows. Some things though that I haven't been able to determine:
  1. Do existing WSL installs get the benefit of WSL2? I have an ubuntu install that was created some time ago
  2. If the answer is no, can you "upgrade" from WSL1 to WSL2. Does that even make sense in the world of "WSL"?
;
November 15, 2019 8:59
@Brendan you can convert WSL1 distros to WSL2. This needs to be done to get the benefits of WSL2 (AFAIK) wsl --set-version Use this command to convert a distro to use the WSL 2 architecture or use the WSL 1 architecture. : the specific Linux distro (e.g. “Ubuntu”) : 1 or 2 (for WSL 1 or 2);
November 15, 2019 9:00
Brendan Green: "Set a distro to be backed by WSL 2 using the command line In PowerShell run:
wsl --set-version  2
and make sure to replace with the actual name of your distro. (You can find these with the command:
wsl -l
). You can change back to WSL 1 at anytime by running the same command as above but replacing the '2' with a '1'. Additionally, if you want to make WSL 2 your default architecture you can do so with this command:
wsl --set-default-version 2
" Installation Instructions for WSL 2;
November 15, 2019 12:05
I haven't used this yet but will WSL 2 mean Docker Desktop will loose the 2GB VM? I ask this because one sound bite, early on, implied the linux kernal is baked into windows so why would docker need that VM?;
November 15, 2019 12:28
Looks like the "X Server like X410" in the post is broken.;
November 15, 2019 15:45
Will there be a Remote Development for Visual Studio? Will there be Visual Studio extensions for SSH, WSL, and containers? That is all great that it can be done with VS Code, but my main development is Visual Studio. For which I do deployment to Linux and Containers. Having Remote Development with WSL with Visual Studio would be great.;
Guy
November 17, 2019 19:49
Learned !!;
November 18, 2019 17:34
It is getting better every time! You can remove the Google+ icon / integration 😇;

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

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

November 08, 2019 Comment on this post [15] Posted in Musings
Sponsored By

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.

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
November 13, 2019 3:53
Just to be a little picky about the typewriter. The metal bar does the line feed and carriage return. You could also set it to advance 1 or 2 lines (or more) when pushed. When the carriage reached the end of the line after typing, you would push the bar, which would do the line feeds, and then continue pushing the bar, which would force the carriage to return to the beginning of the carriage to start typing the new line. If you gave the bar a small push, it just did the line feed without returning the carriage to start position. The roller was used to position the paper to any vertical position, which was very useful when filling out forms. When programming a DOS terminal screen if you just put in a line feed, it would move the cursor down to the next line and the next characters would be written there. If a CR was written alone the next character would be written at the start of the line you are on. It is possible on a manual typewriter to do a carriage return without a line feed by pushing the left of the carriage just below where the metal bar meets the carriage.;
November 13, 2019 6:12
"What would you suggest I do for the next video in the series?" I thought of unicode, UTF and you mentioned the same :) Lot of people get confused about it. I am waiting for this.;
November 13, 2019 6:43
I don't know what crappy school you're going to but we learned this stuff when they handed us our schedule.;
November 13, 2019 7:28
In my school (around 1982 ... boy I'm old) printers had carriages that needed to return, and lines to be fed. So naturally we learned about that. But I have no clue why they didn't teach us anything about Unicode then... So was that a crappy school ? ;
November 13, 2019 8:01
Hmm... For the next episode, you ask? Well, I really want to know why Microsoft is using the term "boot partition" for a partition that does NOT contain the bootloader and "system partition" for a partition that does NOT contain the system root! Maybe... talk the origin of ".NET". That's your area, right? Of course, there is always the simpler topic of "why do we refer to the web platform (CSS3, SVG, JavaScript, etc.) as HTML5?" The answer is the phenomenon of metonymy in the English language. It is for the same reason that the term "Win32" is used to refer to the whole body of Microsoft's unmanaged code API. If you want something more difficult, try this: Why does Microsoft use the metonymic "x86" tag for 32-bit Windows SKUs instead of the official "IA-32", or the technically correct "i386" tag that Microsoft was already using until the time of Windows Vista? If you're looking for something more technical, maybe the origin of the "DWord"/"QWord" data types.;
November 13, 2019 9:00
Would love to hear some tales about clever hacks used on old hardware, like how they got x to work on 286 etc. Other cool topic would be why modern CPUs still boot in 16 bit real mode with 1MB memory limit.;
PCh
November 13, 2019 9:30
Great! :D I would request a video about why floating point numbers in general are imprecise. (IEEE encoding and all). As it's a thing that many developers overlook and wonder why their code comparing their float variables to e.g. 0 doesn't work. ;
November 13, 2019 12:34
Great video! To be honest I can't really explain in detail the difference between 32 and 64-bit architecture. So a deeper dive into that would be interesting to see. ;
November 13, 2019 13:27
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?
Am I the only one who thought of "Who's line is it anyway" at that point :D;
November 13, 2019 13:55
I never studied Computer Science either. When I was a teenager I read The New Turing Omnibus by AK Dewdney which I loved and which taught me a lot. It's a collection of columns from Scientific American addressing computer science topics for the non-expert, with coding/maths challenges, written by a computer science lecturer. You do need to concentrate - don't skim-read it unless you already know CS. "Wonderfully concise discussions . . . full of wit . . . It is nearly the perfect book for the noncomputer scientists who want to learn something about the field." --Nature ;
November 14, 2019 8:03
There are already great videos on youtube explaining unicode/utf8/16/32 Example: https://www.youtube.com/watch?v=MijmeoH9LT4 And same about floating point imprecision as suggested in the comments above. https://www.youtube.com/watch?v=PZRI1IfStY0" No need to make the same content twice with a different narrator :);
November 14, 2019 17:52
The first video was really interesting from a historical perspective. Associating the carriage return with an actual typewriter made my geek mind that much smarter. I would personally love some more hardware topics and topics related to the low-level functioning of the web. What really happens when you open your browser, type a URL and hit enter? Everyone knows the basic DNS query, Http Get, the Web server returns a result and browser renders it stuff but few actually understand and know the history of OSPF protocols and how they actually work. We recently used Dijkstra for an AI-based project so knowing this stuff helps even today in real-world projects. But then I am a self-thought programmer who didn't go to a formal engineering college so I wouldn't know if that's something they actually teach in schools. But it might still make an interesting topic though.;
November 14, 2019 21:53
Great video! thanks;
November 14, 2019 23:47
Two sources to consult - The Jargon File and Encyclopedia of Computer Science (1978 version) if you want to know the details. I had one 3 hour course for 2 semesters in college on computer history covering everything from before 1900 to 1979 which helped immensely. It helps to tag new technologies like gRPC (2015) as rediscoveries of the original technology - 1981 C language IDL files. Nestor, William Allan. Wulf, David Alex Lamb, IDL, Interface Description Language, Technical Report, Carnegie-Mellon University, 1981 I'd expect IDL to be based on a much older EDI specification pre-dating ANSI X12. ;
Bob
November 15, 2019 1:34
Should I download 32-bit version or 64-bit of this software? Boy, if I had a nickel every time I heard that! Love to see and hear a deep-dive on this from you, specially in a format of teaching a kid in a primary school :);

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

Announcing .NET Jupyter Notebooks

November 06, 2019 Comment on this post [13] Posted in DotNetCore Open Source
Sponsored By

Graphs in Jupyter NotebooksJupyter 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

Install the .NET Kernel

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

    dotnet try jupyter install

  • Test installation

    jupyter kernelspec list

    You should see the .net-csharp and .net-fsharp listed.

jupyter kernelspec list
  • 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

.NET C# and F# in Jupyter Notebooks
  • Now you can write .NET and and prose side by side, and just hit Shift-Enter to run each cell.

    Example C# code in Jupyter Notebooks

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.

C# and F# samples and docs

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.

Nightscout

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.

installing nuget packages in Jupyter Notebooks

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.

Querying the Nightscout repository

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.

Issue report over the last year

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
     68223835-86614680-ffbb-11e9-9161-bcafd6c3133d
  • 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.

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.

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
November 08, 2019 11:00
Awesome development. I really wanted a good JupyterKernel for C# for a long long time now. I also tried to write my own :) ICSharp.Kernel github Does this official kernel have a Github repo? I would love to contribute... ;
November 08, 2019 11:38
@gyurisc this is hosted in the Try .NET repository: https://github.com/dotnet/try (specifically https://github.com/dotnet/try/tree/master/Microsoft.DotNet.Interactive.Jupyter) and it'd be great to have more community contributions;
November 08, 2019 14:57
Scott, please, ask MS to decrease its magical stuff delivery speed. Before digging into something, another miracle comes to the playground. Such a great job. Congrats.;
November 09, 2019 12:30
Really great achievement. This builds a bridge between development and data science. Would be cool if C# Notebooks could be edited in Visual Studio Code as python ones are.;
November 09, 2019 13:09
Аренда строительной техники по лучшей цене [url=https://abnpro.ru/]бетононасосы автомобильные[/url];
November 10, 2019 1:46
Scott, you know your community! One big .NET happy family :-) F# and C# for the win!;
November 11, 2019 10:52
How does this compare with LinqPad? I use that all the time for simple exploratory work, and the almost-universal `.Dump()` extension methods are brilliant for data display (Though, admittedly, not as nice graphically as this one). I'm a little cautious because every time I've tried to install Python on my PC, I've ended up breaking the installation, ripping it out and giving up :P;
November 11, 2019 20:04
This is wonderful. Hoping there efforts to get Intellisense and debuggging working. Someday, with client-side Blazor, we could in-line these interactive tools right in the post. Hope this project takes off. Would love to help! Posted as well.;
November 13, 2019 7:26
Hi all of you. I want to share by a Binder image my c# notebooks and I followed this tuto: This tuto Everything ok, but when I open my badge/Binder image there´s no kernel installed!!, but the Dockerfile was ok, the builder I think its also ok and if I check the jupyter terminal theres only one kernel!!(the python default). So it is placing the kernels in the wrong way?? Becasue if you do locally it place the kernel in a differente place but it is able to read it! I mean: `Anacaconda prompt` (base) C:\Users\enrique.cervino>jupyter kernelspec list Available kernels: .net-csharp C:\Users\enrique.cervino\AppData\Roaming\jupyter\kernels\.net-csharp .net-fsharp C:\Users\enrique.cervino\AppData\Roaming\jupyter\kernels\.net-fsharp python3 C:\Users\enrique.cervino\AppData\Local\Continuum\anaconda3\share\jupyter\kernels\python3 Local & Roaming?? In local is able to recognise that but in remote maybe it isnt?? I have made two questions on `Reddit` and `Stackoverflow`, here the links with images: Stackoverflow Reddit ;
November 13, 2019 11:02
I fixed, the linsk above(reddit and stack) give you the answer, but in a simple way better start the dockerfile with and specific image and not use the tag `lasted´ something like: FROM jupyter/scipy-notebook:45f07a14b422 from the binder docs: Here’s an example of a Dockerfile FROM statement that would work. FROM jupyter/scipy-notebook:cf6258237ff9 The following examples would not work: FROM jupyter/scipy-notebook or FROM jupyter/scipy-notebook:latest;
November 13, 2019 17:53
Why wasn't C# and F# included with Azure Data Studio?;
November 14, 2019 22:40
This is really cool! Is it something Microsoft is officially supporting or a side-project?;
November 16, 2019 18:02
Installation instructions are confusing. In this part: .NET IN ANACONDA LOCALLY .NET Core 3.0 SDK and 2.1 as currently the dotnet try global tool targets 2.1. What am I supposed to install? 3.0 SDK? 2.1? both? Can you create a working Docker image with Jupyter/.Net?;
Zir

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

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

November 01, 2019 Comment on this post [8] Posted in VSOnline
Sponsored By

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.

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.

VS Online for the Browser

I'll make a plan. I changed mine to fall asleep (suspend) in 5 minutes, but the default is 30. Pricing is here.

Creating a 4 Core, 8 Gig of RAM environment

Now it's making my environment.

Sweet. VS Online

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.

I'm in VS Code but it's not, it's VS Online in a browser

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 https
dotnet 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.

Connecting to the forwarded port

Now I've hit a breakpoint! That's bonkers.

Hello World IN THE CLOUD

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.

VS Code attached to VS Online

When I hit localhost:500x it's forwarded up to the cloud:

Port forwarding

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.

Suspending a VS Online Environment

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!

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
November 08, 2019 20:51
I thought the environments were Debian Linux. I also thought that --trust didn't work on Linux ("On Linux there isn't a standard way across distros to trust the certificate, so you'll need to perform the distro specific guidance for trusting the development certificate."). I spent a few hours trying to figure out how to get a web app working because it seemed like it just wouldn't port forward or would trust the cert. So I'm confused that it seemed incredibly easy for you. I was just about to start asking around if I should expect dotnet new razor to work. Next up I want to see if I can install .NET Core 3.0 SDK on it.;
November 09, 2019 3:09
How can I get VS online in the browser to work with my github.com private repo? Would love to use this on my android table running the edge browser.;
November 09, 2019 3:17
nevermind, realized I just needed to specify the repo at enviroment creation and it prompted me to authenticate against github for my private repo, awesome!;
November 09, 2019 4:04
I get this error message, any ideas why? Microsoft.AspNetCore.Server.Kestrel[0] Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Error -99 EADDRNOTAVAIL address not available';
November 11, 2019 2:52
guessing I'm just posting here as I work through this... changed from the default port to 4000 in the launch.json of my .net core 2.2 MVC app it now launches into another browser window, but the next issue is the Azure AD post login redirect is failing when the URL I am logging in from is now https://345fbe0c6e60cc710c4fb084d5d825166224-4000.app.online.visualstudio.com wondering how anyone else got around this?;
November 11, 2019 16:31
Is there a good database story for this yet? Any way to spin up SQL local db or SQL Express inside the environment? Or do I have to spin up SQL Azure instance just for dev? ;
November 12, 2019 8:16
this is amazing :) but... no netcore3 support? 'The current .NET SDK does not support targeting .NET Core 3.0.' is that planned?;
November 15, 2019 10:20
I haven't given it a try yet but sounds interesting as the online browser version can really make things must similar and provide more remote access to users. ;

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

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

October 29, 2019 Comment on this post [3] Posted in Hardware
Sponsored By

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.

MakeCode

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!

Christella Cidolit, Fatou Mounezo, Jonathan Wang, Lea Akkari, Luke Slevinsky, Michelle Yao, and Rachel Phinnemore

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:

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).

Device Simulator Express

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!

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
November 02, 2019 13:23
Thanks for sharing! ;
November 02, 2019 13:23
Thanks for sharing! ;
November 12, 2019 14:12
Thanks for posting. I just ordered a Circuit Playground Express today, based on your interview about circuit python. It's going to start life as a smart-ish Christmas ornament, but I'm also hoping to spark the interest of my 6 year old.;

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

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