That's C# 9 top level programs. We should be able to remove even more. Skip the first command completely and do it all on one line, one file.
A hello world is either
using System;
Console.WriteLine("Hello World!");
or
System.Console.WriteLine("Hello World!");
or, scandalously
using System; using static System.Console;
WriteLine("Hello World!");
Not sure how I feel about that last one. Regardless...would this work in Visual Studio 2019? What if I was teaching a class and wanted to have one file per homework assignment, for example? Right now Visual Studio only supports one top-level program per project. Make sense why, but for learning, why not allow folks to choose from the run/debug menu?
I'm going to add a reference to SmallSharp like this (or in Visual Studio)
> dotnet add package smallsharp
Now here's what my homework looks like in Visual Studio 2019! There's one menu item per top level program!
This lovely prototype was done by Daniel Cazzulino (kzu) and you can learn more at https://github.com/devlooped/SmallSharp, or just try it out as I have here!
What do you think? How can small top-level programs help new people?
What about this?
> dotnet new microservice > dotnet run
Sound off in the comments. How tight and simple would that be?
Sponsor: Tired of not finding the code you're looking for? Get Sourcegraph universal code search and search code across ALL your repos, languages, and code hosts. Find and fix code fast with Sourcegraph. Try it now!
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.
The two Terminals can be pinned side by side if you like. Here you can see the Preview Terminal has a "Pre" badge in the taskbar.
Historically you've had to edit a settings.json file - usually with Visual Studio Code and it's lovely json schema support, natch - but as of Windows Terminal 1.6, you've got a preview of the long-awaited Settings UI.
Get the Terminal 1.6 Preview, press Ctrl+, to get your settings.json, then paste this down by the actions array at the bottom:
That'll make Ctrl+Shift+, bring up the new Settings UI!
Here is just one section! I thought I know all the settings but there's a TON I missed. You'll also notice all my Profiles on the left PLUS a Base Layer for inheritance. I was pleased to see the Grayscale vs ClearType (subpixel rgb anti-aliasing) choice, as well as some of the more obscure cursor options.
A real color schema editor is also overdue, so it was awesome to see that as well.
You can, of course, hop between JSON the UI. Here's the UbuntuLegit (from Kayla!) color schema as a UI, above, and as JSON, below.
I've been using Windows Terminal Preview as my primary lately, even over the "more stable" released version. Fortunately I can run both, but the Preview is my go-to right now.
Sponsor: Protect your apps from reverse engineering and tampering with PreEmptive, the makers of Dotfuscator. Dotfuscator has been in-the-box with Microsoft Visual Studio since 2003. Visit preemptive.com/hanselminutes for a professional-grade trial.
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.
If you have a TV, you can turn it into a fancy conference room monitor and pretend you have a Surface Hub 2S. Let's see the different ways we can make Teams/Zoom meetings more a "walking around and thinking" experience, and less a "hunched in front of the laptop" experience.
Cheapest/Good - Wire up to a big TV
You can just get a nice HDMI cable and plug it into your TV and duplicate or extend your laptop's screen. In this simple scenario you're using your Laptop's mic and webcam, and just using the screen of your TV. You can also check your audio output and use the TV speakers as output if you like.
Doing this is not just a nice change of pace, but it reminds you of the options you have to hold meetings! It's your space...how many ways can you change your boring meeting into a new perspective by using the same space in a new way?
Cheap/Better - Wireless to a big TV
If you want to be wireless, you can use Miracast (if your computer/laptop/Surface supports it) or AirPlay or AirServer to "throw" your screen wirelessly to your TV. Some Samsung Smart TV support wireless communications built-in!
You may be able to throw from Windows to a Smart TV with AirServer software. You may be able to throw with AirPlay on your Mac to an Apple TV.
You may be able to get a Miracast HDMI dongle (amzn link) and make a dumb TV smart. This is the solution I use. I throw my Surface screen over Miracast to the TV.
Less Cheap/Best (for me) - Wireless to a big TV with a wireless Webcam via my iPhone
I have a TV on my wall in my office, but it doesn't lend itself to wires and moving my laptop. I wanted to throw the screen over there AND also have a webcam on top of the TV. Ideally there'd be a webcam in the bezel of the TV, but there isn't.
What's an ideal and cheap webcam? My iPhone is already a great device with a long life battery, it's portable, and a webcam. You can get a number of apps that will enable you to use your iPhone (or Android) as a webcam.
Troubleshooting: The docs aren't amazing, so you'll want to not only install the software, but confirm that the EpocCamService is enabled in the Windows Firewall for both Private AND Public Networks (or ensure your network is the same type as the type that's enabled for this service.) I had to manually allow the EpocCam Service to work on Private Networks.
Then you'll get the iPhone side of the app and your iPhone will show up as a camera. With the Pro version ($7.99) you'll get higher quality and microphone support.
Now I just put my iPhone on the top of the TV, run the EpocCam software, and then on my PC I throw my video to the TV and select the EpocCam virtual Camera. Now I can wander around my office and pace and talk and think, which is great!
Once you familiarize yourself with these wireless options for throwing video and audio around, you'll find there is no right answer. There's only the answer that works for you! The results will be similar, but some of the solutions will fit better into your system or setup.
Here's some other ideas.
Use NDI Tools to throw formally throw video around your office and catch it with OBS or XSplit
Use a really long USB extension code and mount a cheap webcam on the top of the TV
Just use your iPhone or iPad or Android device and join Teams or Zoom with the phone itself! Then either wired (via adapter and HDMI) or wirelessly connect the device to your TV!
Sponsor: Protect your apps from reverse engineering and tampering with PreEmptive, the makers of Dotfuscator. Dotfuscator has been in-the-box with Microsoft Visual Studio since 2003. Visit preemptive.com/hanselminutes for a professional-grade trial.
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.
Tailscale is a zero config mesh "VPN" that runs atop other networks and effectively "flattens" networks and allows users/services to more easily (and securely) communicate with each other.
I have talked about this for SSH, but if you're an active developer and want to share the services and sites you're working on with your coworkers and collaborators, there's a non-trivial amount of setup, management, and maintenance to deal with.
Phrased differently, "wouldn't it be easier if we were all just on the same network and subnet?"
WSL1 shares its networking stack with Windows 10, so the "machine" is the same. Whatever YourMachineName is, running a service on 5000 is the same if it's a Windows service or an app running in Linux under WSL1. However, in WSL2, your Linux environment is "behind" your Windows host. While WSL2 makes it easy to hit http://localhost:5000 by transparent port-forwarding, your WSL2 Linux machine isn't really a peer on the same network as your other devices.
Using a zero-configuration networking system like Tailscale (and similar services) levels the playing field - and the network. Due to some characteristics of WSL2 there are a few gotchas. Here's how I got it working for me.
Here you startup the daemon. There's no systemd (yet) on WSL2, but if you're on a version over Windows 10 build 21286, there are ways run commands on startup in the Windows Subsystem for Linux. Personally, I just do this in a bash script.
Within the Tailscale machines admin panel, you can see all the machines living on your new Tailscale network. Note that I have scottha-proto listed as Windows, and scottha-proto-1 listed as Linux. The first is my Host machine and the second (the -1) is my Linux WSL2 instance! They are now on a flat network!
I was also able to invite a user from outside my network with the new (coming soon) Tailscale node sharing feature. My friend Glenn is NOT in my organization, but just like I use OneDrive or DropBox to create a link to access ONE entity but not the WHOLE system, I can do the same here.
Now I can have Glenn hit a service running in WSL2 from his house.
Make a Service and Bind it to the Tailscale Network
When I run the service - .NET or Node, or whatever - it essential that the service listen on the Tailscale network. Your Linux system in WSL2 is 'multi-homed' and is connected to multiple networks. By default my developer systems listen only on localhost.
So here I've got myself connecting to the Tailscale IP that's associated with my WSL2 instance and hitting my Linux service running within:
How far can we take this? Well, since I'm on the Tailscale network and Glenn has connected to it, the whole network is flat, so hitting my service is trivial! Here I am on Teams with my desktop on the bottom and Glenn's desktop on the top.
Cool. How far can we go?
Add Visual Studio Code and the Remote Development SSH Extension
Ok, so flat secure network, no limits! Can I make my WSL2 instance be treated as a remote development system for Glenn? Sure, why not?
To be clear - this is just me talking and experimenting, but there's something here. This can also be cross platform, Mac to Windows to WSL2, etc. You can also certainly use this section to create a VM in any cloud host or hoster, install Tailscale, stop worrying about port forwarding, and use it as a development box. Yes, you can just use WSL local, but this is fun and can be exploited in other cool ways.
On my WSL2 machine, I'll start up the ssh service. I could share public keys and do proper key-based login, but for this I'll do it by username.
I'll edit /etc/ssh/sshd_config and set the port, ListenAddress, and PasswordAuthentication to Yes. Here's an example:
Port 22 #AddressFamily any ListenAddress 0.0.0.0 ListenAddress ::
PasswordAuthentication yes
I made glenn a local super user just in my WSL2 instance:
sudo adduser glenn usermoid -aG sudo glenn
Glenn then installs the VS Code Remote Development pack and connects using Remote via SSH to my Tailscale IP. Here you can see VS Code from Glenn's machine is actually installing the VS Code Server and remote developers, and Glenn and code with VS Code architecturally split in half with the client on his Windows machine and the server on my WSL2 instance.
Note in the lower left corner, you can see his VS Code is connected to my WSL2 Linux instance's Tailscale IP!
Sponsor: This week's sponsor is...me! This blog and my podcast has been a labor of love for 19 years. Your sponsorship pays my hosting bills for both AND allows me to buy gadgets to review AND the occasional taco. Join me!
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.
Last year kind sucked, and the end of last year was particularly lame. I got off Twitter for a while and discovered TikTok. I went there as a creative outlet. If you choose to sign up you may get inundated with a bunch of stuff that makes no sense or has no relevance. However, within just a few days by searching for an “liking” topics that I wanted to hear about, I found a wonderful, joyful, diverse TikTok and have learned about everything from Sea Shanties to Indigenous Dances to Woodworking. It’s a lovely little community and I’ve enjoyed my week on it.
I've been trying out video lately, during these trying times, and have very much enjoyed both TikTok and YouTube as creative outlets. I sent out some of my favorite TikTok videos in my occasional newsletter this week.
Here’s some highlights of lovely things on TikTok I’ve found:
There’s also a massive reintroduction of Sea Shanties to the world and it all started on TikTok. Polygon has a fascinating article on ShantyTok. Here’s The Fresh Prince, as a Sea Shanty.
People in support roles for famous people have also taken to TikTok to talk about their experiences. We learn that some of our favs are not super nice, but it’s also lovely to hear when a favorite actor is even nicer in person than we’d guess.
I’ve found TikTok to also be an endless source of inspiration - particularly as a middle age person who is always trying to get into, and maintain, shape. Folks like Darryll keep me moving!
What kinds of creative outlets have you been exploring (to stay sane or otherwise) last year, and what are your plans for this year?
Sponsor: Looking for free secure coding training but don’t know where to turn? Check out Veracode Security Labs Community Edition to start hacking and patching real apps online. Try it today.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.