EarTrumpet 2.0 makes Windows 10’s audio subsystem even better…and it’s free!

Last week I blogged about some new audio features in Windows 10 that make switching your inputs and outputs easier, but even better, allow you to set up specific devices for specific programs. That means I can have one mic and headphones for Audition, …

EarTrumpetLast week I blogged about some new audio features in Windows 10 that make switching your inputs and outputs easier, but even better, allow you to set up specific devices for specific programs. That means I can have one mic and headphones for Audition, while another for browsing, and yet another set for Skype.

However, while doing my research and talking about this on Twitter, lots of people started recommending I check out "EarTrumpet" - it's an applet that lets you control the volume of classic and modern Windows Apps in one nice UI! Switching, volume, and more. Consider EarTrumpet a prosumer replacement for the little Volume icon down by the clock in Windows 10. You'll hide the default one and drag EarTrumpet over in its place and use it instead!

EarTrumpet

EarTrumpet is available for free in the Windows Store and works on all versions of Windows 10, even S! I have no affiliation with the team that built it and it's a free app, so you have literally nothing to lose by trying it out!

EarTrumpet is also open source and on GitHub. The team that built it is:

  • Rafael Rivera - a software forward/reverse engineer
  • David Golden - lead engineer on MetroTwit, the greatest WPF Twitter Client the world has never known.
  • Dave Amenta - ex-Microsoft, worked on shell and Start menu for Windows 8 and 10

It was originally built as a replacement for the Volume Control in Windows back in 2015, but EarTrumpet 2.0's recent release makes it easy to use the new audio capabilities in the Windows 10's April 2018 Update.

Looks Good

It's easy to make a crappy Windows App. Heck, it's easy to make a crappy app. But EarTrumpet is NOT just an "applet" or an app. It's a perfect example of how a Windows 10 app - not made by Microsoft - can work and look seamlessly with the operating system. You'll think it's native - and it adds functionality that probably should be built in to Windows!

It's got light/dark theme support (no one bothers to even test this, but EarTrumpet does) and a nice acrylic blur. It looks like it's built-in/in-box. There's a sample app so you can make your apps look this sharp up on Rafael's GitHub and here's the actual BlurWindowExtensions that EarTrumpet uses.

Works Good

Quickly switch outputEarTrumpet 1.x works on Windows "RS3 and below" so that's 10.0.16299 and down. But 2.0 works on the latest Windows and is also written entirely in C#. Any remaining C++ code has been removed with no missing functionality.

EarTrumpet may SEEM like a simple app but there's a lot going on to be this polished AND work with any combination of audio hardware. As a podcaster and remote workers I have a LOT of audio devices but I now have one-click control over it all.

Given how fast Windows 10 has been moving with Insiders Builds and all, it seems like there's a bunch of APIs with new functionality that lacks docs. The EarTrumpet team has reverse engineered the parts the needed.

Modern Resource Technology (MRT) Resource Manager

Internal Audio Interface: IAudioPolicyConfigFactory

  • Gets them access to new APIs (GetPersistedDefaultAudioEndpoint / SetPersistedDefaultAudioEndpoint) in RS4 that let's them 'redirect' apps to different playback devices. Same API used in modern sound settings.
      • Code here with no public API yet?

    Internal Audio Interface: IPolicyConfig

    • Gets them access to SetDefaultEndpoint API; lets us change the default playback device
    • Code here and no public API yet?

    Acrylic Blur (win32)

    From a development/devops perspective, I am told EarTrumpet's team is able to push a beta flight through the Windows 10 Store in just over 30 minutes. No waiting for days to get beta test data. They use Bugsnag for their generous OSS license to catch crashes and telemetry. So far they're getting >3000 new users a month as the word gets out with nearly 100k users so far! Hopefully +1 as you give EarTrumpet a try yourself!


    Sponsor: Check out dotMemory Unit, a free unit testing framework for fighting all kinds of memory issues in your code. Extend your unit testing with the functionality of a memory profiler.



    © 2018 Scott Hanselman. All rights reserved.
         

    Carriage Returns and Line Feeds will ultimately bite you – Some Git Tips

    What’s a Carriage and why is it Returning? Carriage Return Line Feed WHAT DOES IT ALL MEAN!?! The paper on a typewriter rides horizontally on a carriage. The Carriage Return or CR was a non-printable control character that would reset the typewriter to…

    Typewriter by Matunos used under Creative CommonsWhat's a Carriage and why is it Returning? Carriage Return Line Feed WHAT DOES IT ALL MEAN!?!

    The paper on a typewriter rides horizontally on a carriage. The Carriage Return or CR was a non-printable control character that would reset the typewriter to the beginning of the line of text.

    However, a Carriage Return moves the carriage back but doesn't advance the paper by one line. The carriage moves on the X axes...

    And Line Feed or LF is the non-printable control character that turns the Platen (the main rubber cylinder) by one line.

    Hence, Carriage Turn and Line Feed. Two actions, and for years, two control characters.

    Every operating system seems to encode an EOL (end of line) differently. Operating systems in the late 70s all used CR LF together literally because they were interfacing with typewriters/printers on the daily.

    Windows uses CRLF because DOS used CRLF because CP/M used CRLF because history.

    Mac OS used CR for years until OS X switched to LF.

    Unix used just a single LF over CRLF and has since the beginning, likely because systems like Multics started using just LF around 1965. Saving a single byte EVERY LINE was a huge deal for both storage and transmission.

    Fast-forward to 2018 and it's maybe time for Windows to also switch to just using LF as the EOL character for Text Files.

    Why? For starters, Microsoft finally updated Notepad to handle text files that use LF.

    BUT

    Would such a change be possible? Likely not, it would break the world. Here's NewLine on .NET Core.

    public static String NewLine {
        get {
            Contract.Ensures(Contract.Result() != null);
    #if !PLATFORM_UNIX
            return "\r\n";
    #else
            return "\n";
    #endif // !PLATFORM_UNIX
        }
    }

    Regardless, if you regularly use Windows and WSL (Linux on Windows) and Linux together, you'll want to be conscious and aware of CRLF and LF.

    I ran into an interesting situation recently. First, let's review what Git does

    You can configure .gitattributes to tell Git how to to treat files, either individually or by extension.

    When

    git config --global core.autocrlf true

    is set, git will automatically convert files quietly so that they are checked out in an OS-specific way. If you're on Linux and checkout, you'll get LF, if you're on Windows you'll get CRLF.

    99% of the time this works great.

    Except when you are sharing file systems between Linux and Windows. I use Windows 10 and Ubuntu (via WSL) and keep stuff in /mnt/c/github.

    However, if I pull from Windows 10 I get CRLF and if I pull from Linux I can LF so then my shell scripts MAY OR MAY NOT WORK while in Ubuntu.

    I've chosen to create a .gitattributes file that set both shell scripts and PowerShell scripts to LF. This way those scripts can be used and shared and RUN between systems.

    *.sh eol=lf
    *.ps1 eol=lf

    You've got lots of choices. Again 99% of the time autocrlf is the right thing.

    From the GitHub docs:

    You'll notice that files are matched--*.c, *.sln, *.png--, separated by a space, then given a setting--text, text eol=crlf, binary. We'll go over some possible settings below.

    • text=auto
      • Git will handle the files in whatever way it thinks is best. This is a good default option.
    • text eol=crlf
      • Git will always convert line endings to CRLF on checkout. You should use this for files that must keep CRLF endings, even on OSX or Linux.
    • text eol=lf
      • Git will always convert line endings to LF on checkout. You should use this for files that must keep LF endings, even on Windows.
    • binary
      • Git will understand that the files specified are not text, and it should not try to change them. The binary setting is also an alias for -text -diff.

    Again, the defaults are probably correct. BUT - if you're doing weird stuff, sharing files or file systems across operating systems then you should be aware. If you're having trouble, it's probably CRLF.

    * Typewriter by Matunos used under Creative Commons


    Sponsor: Check out JetBrains Rider: a cross-platform .NET IDE. Edit, refactor, test and debug ASP.NET, .NET Framework, .NET Core, Xamarin or Unity applications. Learn more and download a 30-day trial!



    © 2018 Scott Hanselman. All rights reserved.
         

    Automatically change your Audio Input, Output and Volume per application in Windows 10

    I recently blogged about an amazing little utility called AudioSwitcher that makes it two-clicks easy to switch your audio inputs and outputs. I need to switch audio devices a lot as I’m either watching video, doing a podcast, doing a conference call, …

    I recently blogged about an amazing little utility called AudioSwitcher that makes it two-clicks easy to switch your audio inputs and outputs. I need to switch audio devices a lot as I'm either watching video, doing a podcast, doing a conference call, playing a game, etc. That's at least three different "scenarios" for my audio setup. I've got 5 inputs and 5 outputs and I've seen PC audiophiles with even more.

    • I set up this AudioSwitcher and figured, cool, solved that silly problem.
    • Then I got "EarTrumpet" - it's an applet that lets you control the volume of classic and modern Windows Apps in one nice UI! Switching, volume, and more. Very "prosumer," which is me, so I dig it.

    A little birdie said that I should also look closer at Windows 10 itself. What? I know this OS like the back of my hand! Nonsense!

    Hit the Start Menu and search for either "Sound Mixer" or "App Volume"

    Sound mixer options

    There's a page that does double duty called App Volume and Device Preferences.

    You can also get to it from the regular Settings | Audio page:

    change the device or app volume

    See where it says "Change the device or app volume?" Ok, now DRINK THIS IN.

    You can set the volume in active apps on an app-by-app basis. Cool. NOT IMPRESSED ARE YOU? Of course not, because while that's a lovely feature it's not the hidden power I'm talking about.

    You can set the Preferred Input and Output device on an App by App Basis.

    App Volume and Device Preferences

    You can set the Preferred Input and Output device on an App by App Basis.

    Read that again. I'll wait.

    Rather than me constantly using the Audio Switcher (lovely as it is) I'll just set my ins and outs for each app.

    The only catch is that this list only shows the apps that are currently using the mic/speaker, so if you want to get a nice setup, you'll want to run apps in order to change the settings for your app.

    • Here I've got the system sounds running through Default (usually the main speakers and the default mic is a webcam)
    • The Speech Runtime (I use WIN+H to use Windows 10 built-in Dragon-Naturally-Style-But-Not free dictation in any app) uses the Webcam mic explicitly as it has the best recognition in my experience.
    • Skype for Business is now using the phone. You can certainly set these things in the apps themselves, but in my experience Skype for Business doesn't care about your feelings or your audio settings. ;)
    • I record my podcast with Zencastr so I've setup Chrome for my preferred/optimal settings.

    I can still use the AudioSwitcher but now my defaults are contextual so I'm switching a LOT LESS.

    Be sure to pick up "EarTrumpet" for even more advanced options!

    What do you think? Did YOU know this existed?


    Sponsor: Learn how .NET in 2018 addresses the challenges developers are working on with future-focused technology. Get the new whitepaper on "The State of .NET in 2018" by the Progress Telerik team!



    © 2018 Scott Hanselman. All rights reserved.
         

    Automatically change your Audio Input, Output and Volume per application in Windows 10

    I recently blogged about an amazing little utility called AudioSwitcher that makes it two-clicks easy to switch your audio inputs and outputs. I need to switch audio devices a lot as I’m either watching video, doing a podcast, doing a conference call, …

    I recently blogged about an amazing little utility called AudioSwitcher that makes it two-clicks easy to switch your audio inputs and outputs. I need to switch audio devices a lot as I'm either watching video, doing a podcast, doing a conference call, playing a game, etc. That's at least three different "scenarios" for my audio setup. I've got 5 inputs and 5 outputs and I've seen PC audiophiles with even more.

    • I set up this AudioSwitcher and figured, cool, solved that silly problem.
    • Then I got "EarTrumpet" - it's an applet that lets you control the volume of classic and modern Windows Apps in one nice UI! Switching, volume, and more. Very "prosumer," which is me, so I dig it.

    A little birdie said that I should also look closer at Windows 10 itself. What? I know this OS like the back of my hand! Nonsense!

    Hit the Start Menu and search for either "Sound Mixer" or "App Volume"

    Sound mixer options

    There's a page that does double duty called App Volume and Device Preferences.

    You can also get to it from the regular Settings | Audio page:

    change the device or app volume

    See where it says "Change the device or app volume?" Ok, now DRINK THIS IN.

    You can set the volume in active apps on an app-by-app basis. Cool. NOT IMPRESSED ARE YOU? Of course not, because while that's a lovely feature it's not the hidden power I'm talking about.

    You can set the Preferred Input and Output device on an App by App Basis.

    App Volume and Device Preferences

    You can set the Preferred Input and Output device on an App by App Basis.

    Read that again. I'll wait.

    Rather than me constantly using the Audio Switcher (lovely as it is) I'll just set my ins and outs for each app.

    The only catch is that this list only shows the apps that are currently using the mic/speaker, so if you want to get a nice setup, you'll want to run apps in order to change the settings for your app.

    • Here I've got the system sounds running through Default (usually the main speakers and the default mic is a webcam)
    • The Speech Runtime (I use WIN+H to use Windows 10 built-in Dragon-Naturally-Style-But-Not free dictation in any app) uses the Webcam mic explicitly as it has the best recognition in my experience.
    • Skype for Business is now using the phone. You can certainly set these things in the apps themselves, but in my experience Skype for Business doesn't care about your feelings or your audio settings. ;)
    • I record my podcast with Zencastr so I've setup Chrome for my preferred/optimal settings.

    I can still use the AudioSwitcher but now my defaults are contextual so I'm switching a LOT LESS.

    Be sure to pick up "EarTrumpet" for even more advanced options!

    What do you think? Did YOU know this existed?


    Sponsor: Learn how .NET in 2018 addresses the challenges developers are working on with future-focused technology. Get the new whitepaper on "The State of .NET in 2018" by the Progress Telerik team!



    © 2018 Scott Hanselman. All rights reserved.
         

    The year of Linux on the (Windows) Desktop – WSL Tips and Tricks

    I’ve been doing a ton of work in bash/zsh/fish lately – Linuxing. In case you didn’t know, Windows 10 can run Linux now. Sure, you can run Linux in a VM, but it’s heavy and you need a decent machine. You can run a shell under Docker, but you’ll need Hy…

    I've been doing a ton of work in bash/zsh/fish lately - Linuxing. In case you didn't know, Windows 10 can run Linux now. Sure, you can run Linux in a VM, but it's heavy and you need a decent machine. You can run a shell under Docker, but you'll need Hyper-V and Windows 10 Pro. You can even go to https://shell.azure.com and get a terminal anywhere - I do this on my Chromebook.

    But mostly I run Linux natively on Windows 10. You can go. Just open PowerShell once, as Administrator and run this command and reboot:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

    Then head over to the Windows Store and download Ubuntu, or Debian, or Kali, or whatever.

    What's happening is you're running user-mode Linux without the Linux Kernel. The syscalls (system calls) that these un-modified Linuxes use are brokered over to Windows. Fork a Linux process? It a pico-process in Windows and shows up in the task manager.

    Want to edit Windows files and edit them both in Windows and in Linux? Keep your files/code in /mnt/c/ and you can edit them with other OS. Don't use Windows to "reach into the Linux file system." There be dragons.

    image

    Once you've got a Linux installed (or many, as I do) you can manage then and use them in a number of ways.

    Think this is stupid or foolish? Stop reading and keep running Linux and I wish you all the best. More power to you.

    Want to know more? Want to look new and creative ways you can get the BEST of the Windows UI and Linux command line tools? Read on, friends.

    wslconfig

    WSL means "Windows Subsystem for Linux." Starting with the Windows 10 (version 1709 - that's 2017-09, the Fall Creators Update. Run "Winver" to see what you're running), you've got a command called "wslconfig." Try it out. It lists distros you have and controls which one starts when you type "bash."

    Check out below that my default for "bash"  is Ubuntu 16.04, but I can run 18.04 manually if I like. See how I move from cmd into bash and exit out, then go back in, seamlessly. Again, no VM.

    C:\>wslconfig /l /all
    
    Windows Subsystem for Linux Distributions:
    Ubuntu (Default)
    Ubuntu-18.04
    openSUSE-42
    Debian
    kali-rolling

    C:\>wslconfig /l
    Windows Subsystem for Linux Distributions:
    Ubuntu (Default)
    Ubuntu-18.04
    openSUSE-42
    Debian
    kali-rolling

    C:\>bash
    128 → $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 16.04.4 LTS
    Release: 16.04
    Codename: xenial
    128 → $ exit
    logout

    C:\>ubuntu1804
    [email protected]:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 18.04 LTS
    Release: 18.04
    Codename: bionic
    [email protected]:~$

    You can also pipe things into Linux commands by piping to wsl or bash like this:

    C:\Users\scott\Desktop>dir | wsl grep "poop"
    
    05/18/2018 04:23 PM <DIR> poop

    If you're in Windows, running cmd.exe or powershell.exe, it's best to move into Linux by running wsl or bash as it keeps the current directory.

    C:\Users\scott\Desktop>bash
    
    129 → $ pwd
    /mnt/c/Users/scott/Desktop
    129 → $ exit
    logout

    Cool! Wondering what that number is before my Prompt? That's my blood sugar. But that's another blog post.

    wsl.conf

    There's a file in /etc/wsl.conf that lets you control things like if your Linux of choice automounts your Windows drives. You can also control more advanced things like if Windows autogenerates a hosts file or processes /etc/fstab. It's up to you!

    Distros

    There's a half dozen distros available and more coming I'm told, but YOU can also make/package your own Linux distribution for WSL with packager/distro-launcher that's open sourced at GitHub.

    Coding and Editing Files

    I need to hit this point again. Do not change Linux files using Windows apps and tools. However, you CAN share files and edit them with both Windows and Linux by keeping code on the Windows filesystem.

    For example, my work is at c:\github so it's also at /mnt/github. I use Visual Studio code and edit my code there (or vim, from within WSL) and I run the code from Linux. I can even run bash/wsl from within Visual Studio Code using its integrated terminal. Just hit "Ctrl+P" in Visual Studio Code and type "Select Default Shell."

    Select Default Shell in Visual Studio Code

     

    On Windows 10 Insiders edition, Windows now has a UI called "Sets" that will give you Tabbed Command Prompts. Here I am installing Ruby on Rails in Ubuntu next to two other prompts - Cmd and PowerShell. This is all default Windows - no add-ons or extra programs for this experience.

    Tabbed Command Prompts

    I'm using Rails as an example here because Ruby/Rails support on Windows with native extensions has historically been a challenge. There's been a group of people heroically (and thanklessly) trying to get Ruby on Rails working well on Windows, but today there is no need. It runs great on Linux under Windows.

    I can also run Windows apps or tools from Linux as long as I use their full name with extension (like code.exe) or set an alias.

    Here I've made an alias "code" that runs code in the current directory, then I've got VS Code running editing my new Rails app.

    Editing a Rails app on Linux on Windows 10 with VS Code

    I can even mix and match Windows and Linux when piping. This will likely make Windows people happy and deeply offend Linux people. Or, if you're non-denominational like me, you'll dig it!

    $ ipconfig.exe | grep IPv4 | cut -d: -f2
    
    172.21.240.1
    10.159.21.24

    Again a reminder: Modifying files located not under /mnt/<x> with a Windows application in WSL is not supported. But edit stuff on /mnt/x with whatever and you're cool.

    Sharing Sharing Sharing

    If you have Windows 10 Build 17064 or newer (run ver from windows or "cmd.exe /c /ver" from Linux) and you can even share an environment variable!

    131 → $ cmd.exe /c ver
    

    Microsoft Windows [Version 10.0.17672.1000]

    There's a special environment variable called "WSLENV" that is a colon-delimited list of environment variables that should be included when launching WSL processes from Win32 or Win32 processes from WSL. Basically you give it a list of variables you want to roam/share. This will make it easy for things like cross-platform dual builds. You can even add a /p flag and it'll automatically translate paths between c:\windows style and /mnt/c/windows style.

    Check out the example at the WSL Blog about how to share a GOPATH and use VSCode in Windows and run Go in both places.

    You can also use a special built-in command line called "wslpath" to translate path names between Windows and WSL. This is useful if you're sharing bash scripts, doing cross-platform scripts (I have PowerShell Core scripts that run in both places) or just need to programmatically switch path types.

    131 → $ wslpath "d:\github\hanselminutes-core"
    
    /mnt/d/github/hanselminutes-core
    131 → $ wslpath "c:\Users\scott\Desktop"
    /mnt/c/Users/scott/Desktop

    There is no man page for wslpath yet, but copied from this GitHub issue, here's the gist:

    wslpath usage:
    
    -a force result to absolute path format
    -u translate from a Windows path to a WSL path (default)
    -w translate from a WSL path to a Windows path
    -m translate from a WSL path to a Windows path, with ‘/’ instead of ‘\\’

    One final note, once you've installed a Linux distro from the Windows Store, it's on you to keep it up to date. The Windows Store won't run "apt upgrade" or ever touch your Linuxes once they have been installed. Additionally, you can have Ubuntu 1604 and 1804 installed side-by-side and it won't hurt anything.

    Related Links

    Are you using WSL?


    Sponsor: Check out JetBrains Rider: a cross-platform .NET IDE. Edit, refactor, test and debug ASP.NET, .NET Framework, .NET Core, Xamarin or Unity applications. Learn more and download a 30-day trial!



    © 2018 Scott Hanselman. All rights reserved.
         

    Building 0verkill on Windows 10 Subsystem for Linux – 2D ASCII art deathmatch game

    I’m a big fan of the Windows Subsystem for Linux. It’s real Linux that runs real user-mode ELF binaries but it’s all on Windows 10. It’s not running in a Virtual Machine. I talk about it and some of the things you should be aware of when sharing files …

    I'm a big fan of the Windows Subsystem for Linux. It's real Linux that runs real user-mode ELF binaries but it's all on Windows 10. It's not running in a Virtual Machine. I talk about it and some of the things you should be aware of when sharing files between files systems in this YouTube video.

    WHAT IS ALL THIS LINUX ON WINDOWS STUFF? Here's a FAQ on the Bash/Windows Subsystem for Linux/Ubuntu on Windows/Snowball in Hell and some detailed Release Notes. Yes, it's real, and it's spectacular. Can't read that much text? Here's a video I did on Ubuntu on Windows 10.

    You can now install not only Ubuntu from the Windows Store (make sure you run this first from a Windows PowerShell admin prompt) - "Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux"

    I have set up a very shiny Linux environment on Windows 10 with lovely things like tmux and Midnight Commander. The bash/Ubuntu/WSL shell shares the same "console host" (conhost) as PowerShell and CMD.exe, so as the type adds new support for fonts, colors, ANSI, etc, every terminal gets that new feature.

    I wanted to see how far this went. How Linuxy is Linux on Windows? How good is the ASCII support in the console on Windows 10? Clearly the only real way to check this out would be to try to build 0verkill. 0verkill is a client-server 2D deathmatch-like game in ASCII art. It has both client and server and lots of cool features. Plus building it would exercise the system pretty well. It's also nearly 20 years old which is fun.

    PRO TIP: Did you know that you can easily change your command prompt colors globally with the new free open source ColorTool? You can easily switch to solarized or even color-blind schemes for deuteranopia.

    There's a fork of the 0verkill code at https://github.com/hackndev/0verkill so I started there. I saw that there was a ./rebuild script that uses aclocal, autoconf, configure, and make, so I needed to apt in some stuff.

    sudo apt-get install build-essential autotools-dev automake
    sudo apt-get install libx11-dev
    sudo apt-get install libxpm-dev

    Then I built it with ./rebuild and got a TON of warnings. Looks like this rather old code does some (now, in the modern world) questionable things with fprintf. While I can ignore the warnings, I decided to add -Wno-format-security to the CFLAGS in Makefile.in in order to focus on any larger errors I might run into.

    Changing CFLAGS in Makefile.in

    I then rebuild again, and get a few warnings, but nothing major. Nice.

    Building 0verkill

    I run the server locally with ./server. This allows you to connect multiple clients, although I'll just be connecting locally, it's nice that the networking works.

    $ ./server
    11. 1.2018 14:01:42  Running 0verkill server version 0.16
    11. 1.2018 14:01:42  Initialization.
    11. 1.2018 14:01:42  Loading sprites.
    11. 1.2018 14:01:42  Loading level "level1"....
    11. 1.2018 14:01:42  Loading level graphics.
    11. 1.2018 14:01:42  Loading level map.
    11. 1.2018 14:01:42  Loading level objects.
    11. 1.2018 14:01:42  Initializing socket.
    11. 1.2018 14:01:42  Installing signal handlers.
    11. 1.2018 14:01:42  Game started.
    11. 1.2018 14:01:42  Sleep

    Next, run the client in another bash/Ubuntu console window (or a tmux pane) with ./0verkill.

    Awesome. Works great, scales with the window size, ASCII and color looks great.

    Alone in 0verkill

    Now I just need to find someone to play with me...


    Sponsor: Get the latest JetBrains Rider for debugging third-party .NET code, Smart Step Into, more debugger improvements, C# Interactive, new project wizard, and formatting code in columns.



    © 2017 Scott Hanselman. All rights reserved.
         

    Docker and Linux Containers on Windows, with or without Hyper-V Virtual Machines

    Containers are lovely, in case you haven’t heard. They are a nice and clean way to get a reliable and guaranteed deployment, no matter the host system. If I want to run my my ASP.NET Core application, I can just type “docker run -p 5000:80 shanselman/…

    Containers are lovely, in case you haven't heard. They are a nice and clean way to get a reliable and guaranteed deployment, no matter the host system.

    If I want to run my my ASP.NET Core application, I can just type "docker run -p 5000:80 shanselman/demos" at the command line, and it'll start up! I don't have any concerns that it won't run. It'll run, and run well.

    Some containers naysayers say , sure, we could do the same thing with Virtual Machines, but even today, a VHD (virtual hard drive) is rather an unruly thing and includes a ton of overhead that a container doesn't have. Containers are happening and you should be looking hard at them for your deployments.

    docker run shanselman/demos

    Historically on Windows, however, Linux Containers run inside a Hyper-V virtual machine. This can be a good thing or a bad thing, depending on what your goals are. Running Containers inside a VM gives you significant isolation with some overhead. This is nice for Servers but less so for my laptop. Docker for Windows hides the VM for the most part, but it's there. Your Container runs inside a Linux VM that runs within Hyper-V on Windows proper.

    HyperV on Windows

    With the latest version of Windows 10 (or 10 Server) and the beta of Docker for Windows, there's native Linux Container support on Windows. That means there's no Virtual Machine or Hyper-V involved (unless you want), so Linux Containers run on Windows itself using Windows 10's built in container support.

    For now you have to switch "modes" between Hyper V and native Containers, and you can't (yet) run Linux and Windows Containers side by side. The word on the street is that this is just a point in time thing, and that Docker will at some point support running Linux and Windows Containers in parallel. That's pretty sweet because it opens up all kinds of cool hybrid scenarios. I could run a Windows Server container with an .NET Framework ASP.NET app that talks to a Linux Container running Redis or Postgres. I could then put them all up into Kubernetes in Azure, for example.

    Once I've turned Linux Containers on Windows on within Docker, everything just works and has one less moving part.

    Linux Containers on Docker

    I can easily and quickly run busybox or real Ubuntu (although Windows 10 already supports Ubuntu natively with WSL):

    docker run -ti busybox sh

    More useful even is to run the Azure Command Line with no install! Just "docker run -it microsoft/azure-cli" and it's running in a Linux Container.

    Azure CLI in a Container

    I can even run nyancat! (Thanks Thomas!)

    docker run -it supertest2014/nyan

    nyancat!

    Speculating - I look forward to the day I can run "minikube start --vm-driver="windows" (or something) and easily set up a Kubernetes development system locally using Windows native Linux Container support rather than using Hyper-V Virtual Machines, if I choose to.


    Sponsor: Why miss out on version controlling your database? It’s easier than you think because SQL Source Control connects your database to the same version control tools you use for applications. Find out how.


    © 2017 Scott Hanselman. All rights reserved.
         

    Recovering from the Windows 10 Insiders Fast 17017 volsnap.sys reboot GSOD/BSOD

    NOTE: I’m not involved with the Windows Team or the Windows Insider Program. This blog is my own and written as a user of Windows. I have no inside information. I will happily correct this blog post if it’s incorrect. Remember, don’t just do stuff to y…

    NOTE: I'm not involved with the Windows Team or the Windows Insider Program. This blog is my own and written as a user of Windows. I have no inside information. I will happily correct this blog post if it's incorrect. Remember, don't just do stuff to your computer because you read it on a random blog. Think first, backup always, then do stuff.

    Beta testing is always risky. The Windows Insiders Program lets you run regular early builds of Windows 10. There's multiple "rings" like Slow and Fast - depending on your risk tolerance, and bandwidth. I run Fast and maybe twice a year there's something bad-ish that happens like a bad video driver or a app that doesn't work, but it's usually fixed within a week. It's the price I pay for happily testing new stuff. There's the Slow ring which is more stable and updates like once a month vs once a week. That ring is more "baked."

    This last week, as I understand it, a nasty bug made it out to Fast for some number of people (not everyone but enough that it sucked) myself included.

    I don't reboot my Surface Book much, maybe twice a month, but I did yesterday while preparing for the DevIntersection conference and suddenly my main machine was stuck in a "Repairing Windows" reboot loop. It wouldn't start, wouldn't repair. I was FREAKING out. Other people I've seen report a Green Screen of Death (GSOD/BSOD) loop with an error in volsnap.sys.

    TO FIX IT

    The goal is to get rid of the bad volsnap from Windows 10 Insiders build version 17017 and replace that one file with a non-broken version from a previous build. That's your goal. There's a few ways to do this, so you need to put some thought into how you want to do it.

    NOTE: At the time of this writing, Fast Build 17025 is rolling out and fixes this, so if you can take that build you're cool, and no worries. Do it.

    volsnap.sys was a problem with 17017

    1. Can you boot Windows 10 off something else? USB/DVD?

    Can you boot off something else like another version Windows 10 USB key or a DVD? Boot off your recovery media as if you're re-installing Windows 10 BUT DO NOT CLICK INSTALL.

    When you've run Windows 10 Setup, instead click Repair, then Troubleshoot, then Command Prompt. It's especially important to get to the Command Prompt this way rather than pressing Shift-10 as you enter setup, because this path will allow you to unlock your possibly BitLockered C: drive.

    NOTE: If your boot drive is bitlockered you'll need to go to https://onedrive.live.com/RecoveryKey on another machine or your phone and find your computer's Recovery Key. You'll enter this as you press Troubleshoot and it will allow you to access your now-unencrypted drive from the command prompt.

    At this point all your drive letters may be weird. Take a moment and look around. Your USB key may be X: or Z:. Your C: drive may be D: or E:.

    2. Do you have an earlier version of volsnap.sys? Find it.

    If you've been taking Windows Insiders Builds/Flights, you may have a C:\Windows.old folder. Remembering to be conscious of your drive letters, you want to rename the bad volsnap and copy in the old one from elsewhere. In this example, I get it from C:\Windows.old.

    ren C:\windows\system32\drivers\volsnap.sys C:\windows\system32\drivers\volsnap.sys.bak
    
    copy C:\windows.old\windows\system32\drivers\volsnap.sys C:\windows\system32\drivers\volsnap.sys

    Unfortunately, *I* didn't have a C:\windows.old folder as I used Disk Cleanup to get more space. I found a good volsnap.sys from another machine in my house and copied it to the root of the USB key I booted off up. In that case my copy command was different as I copied from my USB key to c:\windows\system32\drivers, but the GOAL was the same - get a good volsnap.sys.

    Once I resolved my boot issue, I went to Windows Update and am now updating to 17025.

    PLEASE, friends - BACK UP YOUR STUFF. Remember the Backup Rule of Three.

    Here's the rule of three. It's a long time computer-person rule of thumb that you can apply to your life now. It's also called the Backup 3-2-1 rule.

    • 3 copies of anything you care about - Two isn't enough if it's important.
    • 2 different formats - Example: Dropbox+DVDs or Hard Drive+Memory Stick or CD+Crash Plan, or more
    • 1 off-site backup - If the house burns down, how will you get your memories back?

    Beta testing will cost you some time, and system crashes happen. But are they a nightmare data loss scenario or are they an irritant. For me this was a scary "can't boot" scenario, but I had another machine and my stuff was backed up.

    Don't take beta builds of anything on your primary machine that you care about and that makes you money.

    DISCLAIMER: I love you but this blog post has NO warranty. I have no idea what I'm doing and if this makes your non-bootable beta software machine even worse, that's on you, Dear Reader.


    Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test and debug ASP.NET, .NET Framework, .NET Core, Xamarin or Unity applications. Learn more and download a 30-day trial!



    © 2017 Scott Hanselman. All rights reserved.
         

    Use a second laptop as an extended monitor with Windows 10 wireless displays

    James Clarke from the Windows team rolled into a meeting today with two Surfaces…but one had no keyboard. Then, without any ceremony, he proceeded to do this: Now, I consider myself a bit of a Windows Productivity Tips Gourmand, and while I was awar…

    James Clarke from the Windows team rolled into a meeting today with two Surfaces...but one had no keyboard. Then, without any ceremony, he proceeded to do this:

    Holy Crap a Surface as a Second Monitor

    Now, I consider myself a bit of a Windows Productivity Tips Gourmand, and while I was aware of Miracast and the general idea of a Wireless Display, I didn't realize that it worked this well and that it was built into Windows 10.

    In fact, I'm literally sitting here in a hotel with a separate USB3 LCD display panel to use as a second monitor. I've also used Duet Display and used my iPad Pro as a second monitor.

    I usually travel with a main laptop and a backup laptop anyway. Why do I lug this extra LCD around? Madness. I had this functionality all the time, built in.

    Use your second laptop as a second monitor

    On the machine you want to use as a second monitor, head over to Settings | System | Projecting to this PC and set it up as you like, considering convenience vs. security.

    Settings | Projecting to this PC

    Then, from your main machine - the one you are projecting from - just hit Windows Key+P, like you were projecting to a projector or second display. At the bottom, hit Connect to a Wireless Display.

    Connect to a Wireless Display

    Then wait a bit as it scans around for your PC. You can extend or duplicate...just like another monitor...

    Connected to a Wireless Display

    ...because Windows thinks it IS another monitor.

    You can also do this with Miracast TVs like my LG, or your Roku or sometimes Amazon Fires, or you can get a Microsoft Wireless Display Adapter and HDMI to any monitor - even ones at hotels!

    NOTE: It's not super fast. It's sometimes pixelly and sometimes slow, depending on what's going on around you. But I just moved Chrome over onto my other machine and watched a YouTube video, just fine. I wouldn't play a game on it, but browsing, dev, typing, coding, works just fine!

    Get ready for this. You can ALSO use the second machine as a second collaboration point! That means that someone else could PAIR with you and also type and move their mouse. THIS makes pair programming VERY interesting.

     Allow input from the remote display

    Here's a video of it in action:

    Give it a try and let me know how it goes. I used two Surfaces, but I also have extended my display to a 3 year old Lenovo without issues.


    Sponsor: GdPicture.NET is an all-in-one SDK for WinForms, WPF, and Web development. It supports 100+ formats, including PDF and Office Open XML. Create powerful document imaging, image processing, and document management apps!



    © 2017 Scott Hanselman. All rights reserved.
         

    Ubuntu now in the Windows Store: Updates to Linux on Windows 10 and Important Tips

    I noticed this blog post about Ubuntu over at the Microsoft Command Line blog. Ubuntu is now available from the Windows Store for builds of Windows over 16215.

    image

    You can run “Winver” to see your build number of Windows. If you run Windows 10 you can certainly sign up for the Windows Insiders builds, or you can wait a few months until these features make their way to the mainstream. I’ve been running Windows 10 Insiders “Fast ring” for a while with a few issues but nothing blocking.

    The addition of Ubuntu to the Windows Store may initially seem confusing or even a little bizarre. However, given a minute to understand the larger architecture it make a lot of sense. However, for those of us who have been beta-testing these features, the move to the Windows Store will require some manual steps in order for you to reap the benefits.

    Here’s how I see it.

    • For the early betas of the Windows Subsystem for Linux you type bash from anywhere and it runs Ubuntu on Windows.
    • Ubuntu on Windows hides its filesystem in C:\Users\scott\AppData\Local\somethingetcetc and you shouldn’t go there or touch it.
    • By moving the tar files and Linux distro installation into the store, that allows us users to use the Store’s CDN (Content Distrubution Network) to get Distros quickly and easily. 
      • Just turn on the feature and REBOOT
        Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

    then hit the store to get the binaries!

    Ok, now this is where and why it gets interesting.

    Soon (later this month I’m told) we will be able to have n number of native Linux distros on our Windows 10 machines at one time. You can install as many as you like from the store. No VMs, just fast Linux…on Windows!

    There is a utility for the Windows Subsystem for Linux called “wslconfig” that Windows 10 has.

    C:\>wslconfig
    Performs administrative operations on Windows Subsystem for Linux

    Usage:
    /l, /list [/all] - Lists registered distributions.
    /all - Optionally list all distributions, including distributions that
    are currently being installed or uninstalled.
    /s, /setdefault <DistributionName> - Sets the specified distribution as the default.
    /u, /unregister <DistributionName> - Unregisters a distribution.

    C:\WINDOWS\system32>wslconfig /l
    Windows Subsystem for Linux Distributions:
    Ubuntu (Default) Fedora
    OpenSUSE

    At this point when I type “bash” at the regular Windows command prompt or PowerShell I will be launching my default Linux. I can also just type “Ubuntu” or “Fedora,” etc to get a specific one.

    If I wanted to test my Linux code (.NET, node, go, ruby, whatever) I could script it from Windows and run my tests on n number of distros. Slick for developers.

    TODOs if you have WSL and Bash from earlier betas

    If you already have “bash” on your Windows 10 machine and want to move to the “many distros” you’ll just install the Ubuntu distro from the store and then move your distro customizations out of the “legacy/beta bash” over to the “new train but beta although getting closer to release WSL.” I copied my ~/ folder over to /mnt/c/Users/Scott/Desktop/WSLBackup, then opened Ubuntu and copied my .rc files and whatnot back in. Then I removed my original bash with lxrun /uninstall. Once I’ve done that, my distro are managed by the store and I can have as many as I like. Other than customizations, it’s really easy (like, it’s not a big deal and it’s fast) to add or remove Linuxes on Windows 10 so fear not. Backup your stuff and this will be a 10 min operation, plus whatever apt-get installs you need to redo. Everything else is the same and you’ll still want to continue storing and sharing files via /mnt/c.

    NOTE: I did a YouTube video called Editing code and files on Windows Subsystem for Linux on Windows 10 that I’d love if you checked out and shared on social media!

    Enjoy!


    Sponsor: Seq is simple centralized logging, on your infrastructure, with great support for ASP.NET Core and Serilog. Version 4 adds integrated dashboards and alerts – check it out!


    © 2017 Scott Hanselman. All rights reserved.
         

    I noticed this blog post about Ubuntu over at the Microsoft Command Line blog. Ubuntu is now available from the Windows Store for builds of Windows over 16215.

    image

    You can run "Winver" to see your build number of Windows. If you run Windows 10 you can certainly sign up for the Windows Insiders builds, or you can wait a few months until these features make their way to the mainstream. I've been running Windows 10 Insiders "Fast ring" for a while with a few issues but nothing blocking.

    The addition of Ubuntu to the Windows Store may initially seem confusing or even a little bizarre. However, given a minute to understand the larger architecture it make a lot of sense. However, for those of us who have been beta-testing these features, the move to the Windows Store will require some manual steps in order for you to reap the benefits.

    Here's how I see it.

    • For the early betas of the Windows Subsystem for Linux you type bash from anywhere and it runs Ubuntu on Windows.
    • Ubuntu on Windows hides its filesystem in C:\Users\scott\AppData\Local\somethingetcetc and you shouldn't go there or touch it.
    • By moving the tar files and Linux distro installation into the store, that allows us users to use the Store's CDN (Content Distrubution Network) to get Distros quickly and easily. 
      • Just turn on the feature and REBOOT
        Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

    then hit the store to get the binaries!

    Ok, now this is where and why it gets interesting.

    Soon (later this month I'm told) we will be able to have n number of native Linux distros on our Windows 10 machines at one time. You can install as many as you like from the store. No VMs, just fast Linux...on Windows!

    There is a utility for the Windows Subsystem for Linux called "wslconfig" that Windows 10 has.

    C:\>wslconfig
    
    Performs administrative operations on Windows Subsystem for Linux

    Usage:
    /l, /list [/all] - Lists registered distributions.
    /all - Optionally list all distributions, including distributions that
    are currently being installed or uninstalled.
    /s, /setdefault <DistributionName> - Sets the specified distribution as the default.
    /u, /unregister <DistributionName> - Unregisters a distribution.

    C:\WINDOWS\system32>wslconfig /l
    Windows Subsystem for Linux Distributions:
    Ubuntu (Default) Fedora
    OpenSUSE

    At this point when I type "bash" at the regular Windows command prompt or PowerShell I will be launching my default Linux. I can also just type "Ubuntu" or "Fedora," etc to get a specific one.

    If I wanted to test my Linux code (.NET, node, go, ruby, whatever) I could script it from Windows and run my tests on n number of distros. Slick for developers.

    TODOs if you have WSL and Bash from earlier betas

    If you already have "bash" on your Windows 10 machine and want to move to the "many distros" you'll just install the Ubuntu distro from the store and then move your distro customizations out of the "legacy/beta bash" over to the "new train but beta although getting closer to release WSL." I copied my ~/ folder over to /mnt/c/Users/Scott/Desktop/WSLBackup, then opened Ubuntu and copied my .rc files and whatnot back in. Then I removed my original bash with lxrun /uninstall. Once I've done that, my distro are managed by the store and I can have as many as I like. Other than customizations, it's really easy (like, it's not a big deal and it's fast) to add or remove Linuxes on Windows 10 so fear not. Backup your stuff and this will be a 10 min operation, plus whatever apt-get installs you need to redo. Everything else is the same and you'll still want to continue storing and sharing files via /mnt/c.

    NOTE: I did a YouTube video called Editing code and files on Windows Subsystem for Linux on Windows 10 that I'd love if you checked out and shared on social media!

    Enjoy!


    Sponsor: Seq is simple centralized logging, on your infrastructure, with great support for ASP.NET Core and Serilog. Version 4 adds integrated dashboards and alerts - check it out!



    © 2017 Scott Hanselman. All rights reserved.