河北快3

Scott Hanselman

Easily rename your Git default branch from master to main

June 8, '20 Comments [38] Posted in Open Source
Sponsored By

河北快3The that "Master-slave is an oppressive metaphor that will and should never become fully detached from history" as well as "In addition to being inappropriate and arcane, the master-slave metaphor is both technically and historically inaccurate." There's lots of more accurate options depending on context and it costs me nothing to change my vocabulary, especially if it is one less little speed bump to getting a new person excited about tech.

However, I've dozens of git repositories that have 'master' as the main branch. Changing that would be a hassle right?

image

Let's see. I'll just "git branch -m master main" and then push it back! Remember that ! Even better I can "git push -u origin main河北快3" to set the upstream at the same time.

D:\github\WindowsTerminalHere [master]
> git branch -m master main
D:\github\WindowsTerminalHere [main]
> git push -u origin main
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'main' on GitHub by visiting:
remote: https://github.com/shanselman/WindowsTerminalHere/pull/new/main
remote:
To https://github.com/shanselman/WindowsTerminalHere.git
* [new branch] HEAD -> main

That was easy.

NOTE: Changing the default branch to "main" also has the benefit of starting with "ma" so that autocomplete <TAB> muscle memory still works. Another great option for your main github branch is "latest." The goal is to just be unambiguous.

河北快3Now I just need to change my default branch in my GitHub settings for my repository.

image

I can also update the tracking branch manually as seen here, but if you use git push -u origin main河北快3 it'll do both.

git branch -u origin/main main

The last thing to think about is if you have a CI/CD, GitHub Action, Azure DevOps pipeline or some other build system that pulls a specific branch. You'll just change that to main. However, usually unless your CI explicitly calls for a branch by name, changing master to main will "just work!"

NOTE: For more complex repos also .

image

This is because -m is --move and all your reflog is unchanged!

TL;DR in conclusion:

git branch -m master main
git push -u origin main

Updating local clones

If someone has a local clone, then can like this:

$ git checkout master
$ git branch -m master main
$ git fetch
$ git branch --unset-upstream
$ git branch -u origin/main
$ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

From the tweet above (Thanks Brad from XUnit.net!), these steps

  1. Go to the master branch
  2. Rename master to main locally
  3. Get the latest commits from the server
  4. Remove the link to origin/master
  5. Add a link to origin/main
  6. Update the default branch to be origin/main

You can add "git new" that will default to whatever starting branch you like.

git config --global alias.new '!git init && git symbolic-ref HEAD refs/heads/main'

Hope this helps! Other good names are latest, trunk, and stable!


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

About Scott

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


  Newsletter
Sponsored By
Hosting By

Mirroring your Presence Status from the Microsoft Graph in Teams to LIFX or Hue bias lighting

May 21, '20 Comments [4] Posted in Open Source | Win10
Sponsored By

During the last week - that you - we snuck in a . We planned the whole thing out like a live stage play (I have a background in theatre) and one of the things that mattered to me was .

If you're going to watch something you for an extended time you'll need a little visual interest. Ya gotta mix it up! So I partnered with and to accomplish two things:

  • Can we change room lighting to match Teams/Skype/Slack/Whatever presence status?
  • Can we change room lighting to match the Windows Theme/Background accent color?
    • If I'm not mirroring my pretense status, pull the accent color out and change the light.

河北快3Here's what it looked like in the keynote:

Purple light and Purple background
Green light and green background

The PresenceLight app is open source and and you can get it on the or in Chocolatey, WinGet, or download a nightly build.

So what's needed? We need an API to pull presence from and an API to push 河北快3our chosen color to. So that's the that . On the lighting side, using LIFX as an example, they have a .

RANDOM: If you're looking for my wallpapers from the BUILD keynote, I've .

河北快3Here's what the app looks like. You can auth against Phillips Hue, Yeelight or LIFX. The .

PresenceLight

Check out Isaacs with code samples and explanations! The LIFX folks also set up a 10% off coupon "BUILD" for use . I'm sure they'll sell out, but the .


Sponsor: This week's sponsor is...me! This blog and my podcast has been a labor of love for over 18 years. Your sponsorship pays my hosting bills for both AND allows me to buy gadgets to review AND the occasional taco. !

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.


  Newsletter
Sponsored By
Hosting By

Developing on Docker with the new and improved Visual Studio Container Tools (and WSL2)

May 19, '20 Comments [6] Posted in Docker | VS2019
Sponsored By

I've been spending a lot of time with Docker lately. is great and getting better every day. Now that WSL2 (Windows Subsystem for Linux) is rolling out stable over the coming weeks and Docker Desktop supports WSL to host Linux containers directly, I'm finding myself using Visual Studio to develop my sites under Docker.

are actively improving as well and the latest release is pretty sweet. You likely already HAVE this as the Containers tool window is now included in Visual Studio 2019 starting with version 16.4 Preview 2 and above!

NOTE:河北快3 Be sure to check out the as well!

河北快3First thing that is impressive is that Visual Studio now tries to help you get to a successful place with helpful guidance, as sometimes set up can be daunting.

河北快3When you create or open a Docker-enabled project:

  • VS container tools help you install Docker Desktop
  • VS container tools make sure Docker Desktop is running

Start Docker Desktop?

You've got the Container Tools already if you've installed the Web or Azure Workload in Visual Studio 2019 and it is included in the !

河北快3You can Docker-enable a project with a checkbox when you create it OR you can right click Add Docker Support after the fact.

Enable Docker Support

When working with .NET Core the Container Tools will make a great multi-stage Dockerfile that encapsulates best practices. It uses Docker layering to build within Docker using the .NET SDK but then publishing into a smaller runtime container for the smallest possible resulting image for maximum density.

Multistage Dockerfile

Multi-container Debugging

河北快3Debugging real systems with multiple containers has been a challenge in the past. VS2019 now has Container Orchestrator Support built-in. This screenshot shows Docker Compose appearing itself as a Debug Target within the standard VS2019 toolbar!

Docker Compose

河北快3Once you have a bunch of containers running, the Containers Tool finds a nice balance between showing you the text logs and getting out of your way but also giving you a GUI to start and stop and manage multiple running containers.

You can see below the images I have, the Solution Containers. I can even right click and Attach to Process within a running Linux container! Again, all using WSL2 and wicked fast.

Docker Container Tools

Coming soon to Visual Studio! Native WSL2 debugging

河北快3I like my containers BUT if you just want to dev on Linux directly (no containers) then this is one of the "coming soons" that you'll be the most excited about - WSL 2 Debugging! Coming soon to the Marketplace as a preview with a plan to ship in future Visual Studio tooling releases, you'll be able to just select WSL2 (Linux) as a compilation and debug target! That means dev/test/run native Linux on Windows right from VS.

河北快3Remember that WSL2 uses a real Linux kernel so there's no emulators here. The WSL2 Linux starts up in about a second and you'll be debugging FAST. !

WSL2 in Visual Studio

河北快3That means breakpoints and full debugging on Linux from Visual Studio 2019 on Windows. Scott Hunter and I talked about this and showed a demo in our "" talk at BUILD this year !

河北快3If you want all these nice Container Tools either install VS2019 or just run the Visual Studio Installer and UPDATE your existing installation.


Sponsor: This week's sponsor is...me! This blog and my podcast has been a labor of love for over 18 years. Your sponsorship pays my hosting bills for both AND allows me to buy gadgets to review AND the occasional taco. !

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.


  Newsletter
Sponsored By
Hosting By

Review of the Surface Book 3 for Developers

May 14, '20 Comments [25] Posted in Reviews
Sponsored By

I was offered a Surface Book 3 to use as a loaner over the the last 5 weeks. I did a short video teaser on Twitter where I beat on the device with a pretty ridiculous benchmark - running Visual Studio 2019 while running Gears of War and Ubuntu under WSL and Windows Terminal. I have fun. ;)

Size and Weight

My daily driver has been a Surface Book 2 since 2017. The new Surface Book 3 is the exact size (23mm thick as a laptop) and weight (3.38 and 4.2 lbs.) as the SB2. I have had to add a small sticker to one otherwise I'd get them confused. The display resolutions are 3000×2000 for the 13.5-inch model and 3240×2160 for the 15-inch one that I have. I prefer a 15" laptop. I don't know how you 13" people do it.

河北快3Basically if you are a Surface Book 2 user the size and weight are the same. The Surface Book 3 is considerably more power in the same size machine.

CPU and Memory

河北快3They gave me an i7-1065G7 CPU to test. It bursts happily over 3.5 Ghz (see the compiling screenshot below) and in my average usage hangs out in the 2 to 1.8 range with no fan on. I regularly run Visual Studio 2019, VS Code, Teams, Edge (new Edge, the Chromium one), Ubuntu via WSL2, Docker Desktop (the WSL2 one), Gmail and Outlook as PWAs, as well as Adobe Premiere and Audition and other parts of the Creative Suite. Memory usually sits around 14-18 gigs unless I'm rendering something big.

Task Manager with a Surface Book 3

It's a 10th gen Intel chip and as the Surface Book 3 can detach the base from the screen, it's both a laptop and tablet. I gleaned from Anandatech that TDP is between 10 and 25W (usually 15W) depends on what is needed, and it shifts frequencies very fast. This is evident in the great battery life when doing things like writing this blog post or writing in Edge or Word (basically forever) versus playing a AAA game or running a long compile, building containers, or rendering a video in Premiere (several hours).

FLIP THE SCREEN AROUND? You can also when docked even reverse the screen! Whatever do you mean? It's actually awesome if you want an external keyboard.
Flip the screen around

All this phrased differently? It's fast, quickly, when it needs to be but it's constantly changing the clock to maximize power/thermals/battery.

SSD - Size and Speed

The device I was loaned has a Toshiba KXG60PNV2T04 Hard Drive 2TB NVMe M.2 that's MASSIVE. I'm used to 512G or maaybe a 1TB drive in a Laptop. I'm getting used to never having to worry about space. Definitely 1TB minimum these days if you want to play games AND do development.

I ran a CrystalBenchmark on the SSD and it did 3.2GB/s sequential reads河北快3! Sweet. I feel like the disk is not the bottleneck with my development compile tests below. When I consulted with the Surface team last year during the conception of the Surface Book 3 I pushed them for faster SSDs and I feel that they delivered with this 2TB SSD.

GPU - Gaming and Tensorflow

The 13.5-inch model now comes with an NVIDIA GeForce GTX 1650 Max-Q GPU with 4GB of GDDR5 memory in its Core i7 variant, while the 15-inch unit features a NVIDIA GeForce GTX 1660 Ti Max-Q with 6GB of GDDR6 memory. When running the Gears 5 Benchmark while plugged in (from the Extras menu, Benchmark) is has no issues with the default settings doing 60fps for 90% of the benchmark with a few dips into the 57 range depending what's on screen.

It's not a gaming machine, per se, but it does have a NVIDIA GeForce GTX 1660 Ti so I'm basically able to 1080p 60fps AAA games. I've played Destiny 2, Gears of War 5, and Call of Duty Modern Warfare on default settings at 60 fps without issue. The fan does turn on but it's very manageable. I like that whenever we get back into hotels I'll be able to play some games and develop on the same machine. The 15" also includes an Xbox Wireless Adapter so I just paired my controller with it directly.

Gears at 60fps

I was also able to run Tensorflow with CUDA on the laptop under Windows and it worked great. I ran a model against some video footage from my dashcam and 5.1 gigs of video RAM was used immediately and the CUDA engine on the 1660Ti is visible working in Taskman. The commercial SKU has an NVIDIA Quadro RTX 3000 that is apparently even more tuned for CUDA work.

NVidia CUDA engine is engaged

Developer Performance

When I built my Intel i9 Ultimate Desktop 3.0 machine and others, I like to do compile tests to get a sense of how much you can throw at machine. I like big project compiles because they are a combination of a lot of disk access and a lot of parallel CPU work. However, some projects do have a theoretical maximum compile speed because of the way the dependences flesh out. I like to use Orchard Core for benchmarks.

Orchard Core is a fully-featured CMS with 143 projects loaded into Visual Studio.河北快3 MSBUILD and .NET Core supports both parallel and incremental builds.

  • A warm build of Orchard Core on IRONHEART my i9 desktop takes just under 10 seconds.
    • My 6 year old Surface Pro 3 builds it warm in 62 seconds.
  • A totally cold build (after a dotnet clean) on IRONHEART takes 33.3 seconds.
    • My Surface Pro 3 builds it cold in 2.4 minutes.

I'll do the same build on both my Surface Book 2 and this new Surface Book 3 to compare. I've excluded the source folders from Defender as well as msbuild.exe and dotnet.exe. I've also turned off the Indexer.

  • A cold build (after a dotnet clean) on this Surface Book 3 takes 46 seconds.
    • A warm build is 16.1 seconds
  • A cold build (after a dotnet clean) on my Surface Book 2 takes 115 seconds.

河北快3It's WAY faster than my Surface Book 2 which has been my daily driver when mobile for nearly 3 years!

河北快3Benchmarks are all relative and there's raw throughput, there's combination benchmarks, and all kinds of things that can "make a chart." I just do benchmarks that show if I can do a thing I did before, faster.

.NET working hardAll the CPUs are working

You can also test various guesses if you have them by adding parameters to dotnet.exe. For example, perhaps you're thinking that 143 projects is thrashing to disk so you want to control how many CPUs are used. This has 4 physical cores and 8 logical, so we could try pulling back a little

dotnet build /maxcpucount:4

河北快3The result with Orchard Core is the same, so there is likely a theoretical max as to how fast this can build today. If you really want to go nuts, try

dotnet build -v diag

And dig through ALL the timing info!

Webcam Quality

河北快3Might be odd to add this as its own section but we're all using our webcams constantly right now. I was particularly impressed with the front-facing webcam. A lot of webcams are 720p with mediocre white balance. I do a lot of video calls so I notice this stuff. The SB3 has a 1080p front camera for video and decent light pickup. When using the Camera app you can do up to 5MP (2560x1920) which is cool. Here's a pic from today.

WIN_20200514_15_16_32_Pro

Ports and Power and Sound and Wi-Fi

河北快3The Surface Book 3 has just one USB-C port on the right side and two USB 3.1 Gen 2s on the left. I'd have liked one additional USB-C so I could project on stage and still have one additional USB-C available...but I don't know what for. I just want one more port. That said, the NEW Surface Dock 2 adds FOUR USB-C ports, so it's not a big deal.

河北快3It was theoretically possible to pull more power on the SB2 than its power supply could offer. While I never had an issue with that, I've been told by some Destiny 2 players and serious media renderers that it could happen. With the SB3 they upped the power supply with 65W for the base 13.5-inch version and a full 127W for the 15-inch SKUs so that's not an issue any more.

I have only two Macs for development and I have no Thunderbolt devices or need for an eGPU so I may not be the ideal Thunderbolt consumer. I haven't needed it yet. Some folks have said that it's a bummer the SB3 doesn't have it but it hasn't been an issue or sticking point for any of my devices today. With the new Surface Dock 2 (below) I have a single cable to plug in that gives me two 4k monitors at 60Hz, lots of power, 4 USB-C ports all via the Dock Connector.

I also want to touch on sound. There is a fan inside the device and if it gets hot it will run. If I'm doing . It comes and goes and while it's audible when the fan is on, when the CPU is not maxed out (during 70% of my work day) the Surface Book 3 is absolutely silent, even when running the monitors. The fan comes on with the CPU is bursting hard over 3Ghz and/or the GPU is on full blast.

One other thing, the Surface Book 3 has Wi-Fi 6 even though I don't! I have a Ubnt network and no Wi-Fi 6 mesh points. I haven't had ANY issues with the Wi-Fi on this device over Ubnt mesh points. When copying a 60 gig video file over Wi-Fi from my Synology NAS I see sustained 280 megabit speeds.

The New Surface Dock - Coming May 26th

I'm also testing a pre-release Surface Dock 2. I suspect they wanted me to test it with the Surface Book 3...BUT! I just plugged in every Surface I have to see what would happen.

河北快3My wife has a Surface Laptop 2 she got herself, one son has my 6 year old old Surface Pro 3 while the other has a Surface Go he got with his allowance. (We purchased these over the last few years.) As such we have three existing Surface Docks (original) - One in the kids' study/playroom, one in the Kitchen as a generalized docking station for anyone to drop in to, and one in my office assigned me by work.

We use these individual Surfaces (varying ages, sizes, and powers) along with my work-assigned Surface Book 2 plus this loaner Surface Book 3, so it's kind of a diverse household from a purely Surface perspective. My first thought was - ? Stuff just works .

RANDOM NOTE:河北快3 What happens when you plug a Surface Pro 3 (released in 2014) into a Surface Dock 2? Nothing, but it does get power. However, the original Surface Dock is great and still runs 4096 x 2160 @30Hz or 2960 x 1440 @60Hz via mini DisplayPort so the Pro 3 is still going strong 6 years out and the kids like it.

河北快3So this Surface Dock 2 replaces the original Dock my office. The Surface Dock 2 has

  • 2x front-facing USB-C ports (I use these for two 4k monitors)
  • 2x rear-facing USB-C ports
  • 2x rear-facing USB-A 3.2 (10Gbps) ports
  • 1x Gigabit Ethernet port
  • 1x 3.5mm audio in/out port
  • Kensington lock slot - I've never used this

First, that's a lot of USB-C. I'm not there yet with the USB-C lifestyle, but I did pick up at Amazon and I can happily report that I can run both my 4k monitors at 60hz plus run the main Surface Book 3 panel. The new Dock and its power supply can push 120 watts of power to the Surface with a total of 199 watts everything connected to the dock. I've got a few USB-C memory sticks and one USB-C external hard drive, plus the Logitech Brio is USB 3, so 6 total ports is fine with 4 free after the two monitors. I also Gigabit wired the whole house so I use the Ethernet port quite happily.

河北快3Initially I care about one thing - my 4k monitors. Using the USB-C to DisplayPort cables I plugged the dock into two Dell P2715Q 4ks and they work! I preferred using the direct cables rather than any adapters, but I also tested a adapter I got in 2018 with some other Dell monitors in the house and that worked with the Surface Book 3 as it had previously with the Book 2.

SURPRISE NOTE: How does the super-thin Surface Pro X do when plugged into a Surface Dock 2? Amazing. It runs two 4k monitors at 60 Hz. I don't know why I was shocked, . It's a brand new device, but it's also the size and weight of an iPad so I was surprised. It's a pretty amazing little device - I'll do another post on just the ARM-based Surface Pro X another time.

One final thing about the new Dock. The cable is longer! The first dock had a cable that was about 6" too short and now it's not. It's the little things and in this case, a big thing that makes a Dock that much nicer to use.

Conclusion

All in all, I'm very happy with this Surface Book 3 having been an existing Surface Book 2 user. It's basically 40-50% faster, the video card is surprisingly capable. The SSD is way faster at the top end. It's a clear upgrade over what I had before, and when paired with the Surface Dock 2 and two 4k monitors it's a capable developer box for road warriors or home office warriors like myself.


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

About Scott

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


  Newsletter
Sponsored By
Hosting By

Windows PowerToys FancyZones is the essential window manager for Windows 10

May 12, '20 Comments [7] Posted in Open Source | Win10
Sponsored By

Last year Microsoft rebooted PowerToys and it's open source and on GitHub. It's a few months later and PowerToys is getting even better. You can download and install it from releases.

FancyZones is one of the highlights of PowerToys. I'll do other blog posts on the other awesome apps and applets, but FancyZones is special.

Fancy Zones Editor

FancyZone is a Windowing Manager for Windows, ahem. That means it helps you MOVE AND SNAP your windows to known regions, which is way easier than MOVE AND ENDLESSLY FIDDLE WITH your windows.

You likely have a limited number of things you do with your machine - believe it or not - and you likely find yourself in a finite number of "layouts." You likely do this naturally but you're wasting time getting your windows into those configurations.

Default Fancy Zones layouts

FancyZones solves all that. You may a layout or layouts and then shift drag your windows to a zone and they pop/snap into place.

It's absolutely essential for large monitors and once you get used it to you'll be hooked. Go get all the open source PowerToys here


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

About Scott

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


  Newsletter
Sponsored By
Hosting By

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