Scott Hanselman

How to download over 80 free 101-level C#, .NET, and ASP.NET for beginners videos for offline viewing

September 27, 2019 Comment on this post [5] Posted in DotNetCore | Learning .NET
Sponsored By

Earlier this week I announced over 80 new free videos in our .NET Core 3.0 launch video series - Announcing free C#, .NET, and ASP.NET for beginners video courses and tutorials

Three questions came up consistently:

  • My work or country blocks YouTube! What about me?
  • How can I download these and watch them offline?
  • I have very low bandwidth. Can I get smaller versions I can download over 3G/4G?

Here's some answers for you!

My work or country blocks YouTube! What about me?

First, we have updated http://dot.net/videos to include links to BOTH YouTube *and* to the same videos hosted on Microsoft's Channel 9, which shouldn't be blocked by you country or company!

How can I download these and watch them offline?

Good question! Here's how to download a whole series with PowerShell! Let's say I want to download "C# 101."

First, head over to https://dot.net/videos.

C# 101 videos

Second, click "Watch on Channel 9" there at the bottom of the series you want, in my case, C# 101.

Note that there's a link there in the corner that says "RSS" - that's Really Simple Syndication!

RSS Videos for Channel 9 Videos

Right click on the one you want, for example MP4 Low for people on low bandwidth connections! (Question #3 gets answered too, two for one!), and say "Copy Link Address." Now that link is in your clipboard!

Next, I made a little PowerShell script and put it here in a Gist. If you want, you can right click on this link here and Save Link As and name it something like DownloadVideos.ps1. Maybe save it in C:\temp or c:\users\YOURNAME\Desktop\DotNetVideos. Whatever makes you happy. Make sure you saved it with a *.ps1 extension.

Finally, open up the PS1 file in a text editor and check lines 2 and 3. Put in a path that's correct for YOUR computer, again, like C:\temp, or your downloads folder.

#CHECK THE PATH ON LINE 2 and the FEED on LINE 3
cd "C:\users\scott\Downloads"
$a = ([xml](new-object net.webclient).downloadstring("https://channel9.msdn.com/Series/CSharp-101/feed/mp4"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $url.Segments[-1]
$file
if (!(test-path $file)) {
(New-Object System.Net.WebClient).DownloadFile($url, $file)
}
}

Make sure the RSS link that you copied earlier above is correct on line 3. We need a Local Folder and we need our Remote RSS Link.

NOTE: If you're an expert you might think this PowerShell script isn't fancy enough or doesn't do x or y, but it'll do pretty nicely for this project. You're welcome to fork it or improve it here.

And finally, open up PowerShell on your machine from the Start Menu and run your downloadvideos.ps1 script like in this screenshot.

What about getting Low Bandwidth videos I can download on a slow connection!

The low bandwidth videos are super small, some smaller than a JPEG! The largest is just 20 megs, so the full C# course is under 200 megs total.

You can download ALL the videos for EACH playlist by visiting http://dot.net/videos, getting the RSS URL for the video playlist you want, and running the PS1 script again with the changed URL on line 3.

Hope this helps!


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 bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Announcing free C#, .NET, and ASP.NET for beginners video courses and tutorials

September 24, 2019 Comment on this post [14] Posted in DotNetCore | Learning .NET | Open Source
Sponsored By

If you've been thinking about learning C#, now is the time to jump in! I've been working on this project for months and I'm happy to announce http://dot.net/videos 

There's nearly a hundred short videos (with more to come!) that will teach you topics like C# 101, .NET, making desktop apps, making ASP.NET web apps, learning containers and Dockers, or even starting with Machine Learning. There's a ton of great, slow-paced beginner videos. Most are less than 10 minutes long and all are organized into Playlists on YouTube!

If you are getting started, I'd recommend starting with these three series in this order - C#, .NET, then ASP.NET. After that, pick the topics that make you the happiest.

Lots of .NET learning videos and tutorials up on YouTube, free!

If you don't have access to YouTube where you are, all these videos are also on Channel 9 *and* can be downloaded locally via RSS feed! https://channel9.msdn.com/Browse/Series

Lots of .NET learning videos and tutorials up on YouTube, free!

If you like these, let me know what other topics you'd like us to cover! We are just getting started and already have intermediate and advanced C# classes in the works!


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 bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

What's the difference between a console, a terminal, and a shell?

September 20, 2019 Comment on this post [14] Posted in Linux | Open Source | Win10
Sponsored By

I see a lot of questions that are close but the questions themselves show an underlying misunderstanding of some important terms.

  • Why would I use Windows Terminal over PowerShell?
  • I don't need WSL for bash, I use Cygwin.
  • Can I use conemu with PowerShell Core or do I need to use Windows Terminal?

Let's start with a glossary and clarify some words first.

Terminal

The word Terminal comes from terminate, indicating that it's the terminating end or "terminal" end of a communications process. You'll often hear "dumb terminal" when referring to a text-based environment where the computer you are sitting next to is just taking input and showing text while the real work happens at the other end in a mainframe or large computer.

TTY or "teletypewriter" was the first kind of terminal. Rather than a screen you'd have a literal typewriter in front of you. When you type on it, you're seeing the text on a piece of paper AND inputing that text into a computer. When that computer replies, you'll see the typewriter automatically type on the same paper.

Photo by Texas.713 used under CC

When we refer to a Terminal in the software sense, we're referring to a literal software version of a TTY or Terminal. The Windows Terminal is that. It's really good at displaying textual output. It can take input and pass it on. But the Terminal isn't smart. It doesn't actually process your input, it doesn't look at your files or think.

Console

Folks in the mid 20th century would have a piece of furniture in their living room called a console or console cabinet. A Console in the context of computers is a console or cabinet with a screen and keyboard combined inside it. But, it's effectively a Terminal. Technically the Console is the device and the Terminal is now the software program inside the Console.

image

In the software world a Terminal and a Console are, for all intents, synonymous.

Shell

A shell is the program that the terminal sends user input to. The shell generates output and passes it back to the terminal for display. Here's some examples of Shells:

  • bash, fish, zsh, ksh, sh, tsch
  • PowerShell, pwsh
  • cmd, yori, 4dos, command.com

Here's an important point that should make more sense now that you have these terminals - Your choice of shell doesn't and shouldn't dictate your choice of terminal application.

Aside: WSL and WSL2 (the Windows Subsystem for Linux) are a complete local Linux (or many Linuxes) that run on Windows 10. They are full and real. WSL2 ships a real Linux kernel and runs in on Windows. Cygwin is NOT a Linux. Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to Linux on Windows - but it is not Linux. It's a simulacrum. It's GNU utils compiled against Win32. It's great, but it's important for you to know what the difference is. Cygwin may let you run your bash shell scripts but it will NOT run Apache, Docker, or other real ELF-binaries and Linux apps.

Your Choice of Windows Consoles?

There are a number of shells that ship with Windows. Here's a few I'm running now. Note the "chrome" or the border and title around them? Those shells are all hosted by a the legacy Windows console you have never heard of called conhost.exe. You can go to the command prompt, type powershell, cmd, or ubuntu and any number of shells will run. Conhost does the work of input and output.

Now, forget that conhost exists, because it sucks - it's super old.

Shells that come with Windows

Pseudo Console, Pseudo Terminal, PTY, Pseudo TTY (ConPTY)

Pseudo Terminals are terminal emulators or software interfaces that emulate terminals. They pretend to be terminals like the ones above. *Nix systems have long had a pseudo-terminal (PTY) infrastructure and now Windows as a pseudoconsole (ConPTY) as well.

Window's new ConPTY interface is the future of consoles and terminals on Windows. If you choose a 3rd party (non-built-in) console applications for Windows, make sure it supports ConPTY and it'll be a better experience than some of the older consoles that use screen scraping or other hacks.

image

Back to your choice of Windows Consoles

Remembering there's a lot of shells you can use in Windows, there's a lot of 3rd party consoles you can use if you don't like conhost.exe (and you shouldn't).

All of these Terminals support ALL the shells above and any shells I've missed. Because a shell isn't a terminal. Pick the one that makes you happy. I use PowerShell Core and Ubuntu in WSL2 in the Windows Terminal.

Windows Terminal

Hope this helps clear things up.


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

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 bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Patching the new Cascadia Code to include Powerline Glyphs and other Nerd Fonts for the Windows Terminal

September 18, 2019 Comment on this post [6] Posted in Linux | Win10
Sponsored By

Microsoft released a nice new ligature-friendly open source font this week called Cascadia Code. It'll eventually be shipped with the open source Windows Terminal (you can get it from the store fee) but for now you can just download and install the TTF.

I've blogged about Fira Code and Monospaced Programming Fonts with Ligatures before. Just like keyboards, mice, monitors, text editors, and all the other things that we as developers put in our toolkits, Fonts are a very personal thing. Lots of folks have tweeted me, "why is this better than <font I use>." I dunno. Try it. Coke vs. Pepsi. If it makes you happy, use it.

I use Cascadia Code for my Terminals and I use Fira Code for my code editor. ¯\_(ツ)_/¯

That said, one important thing that you may want to know about is that you have FULL control of your fonts! Lots of folks want certain glyphs, or a fancy bash prompt, or they use posh-git, or PowerLine, or all of the above.

Right now Cascadia Code doesn't include every glyph in the world, but don't let that hold you back. Fix it.

For example, if I go install "Oh my Posh" and spice up my PowerShell Core prompt, it might look like this with Cascadia Code today.

Cascadia Code with no Nerd Fonts

But if I patch Cascadia Code on my own machine to include Nerd Fonts and other glyphs, I'll get this lovely prompt in Windows Terminal:

Cascadia Code with Nerd Fonts and PowerLine

So you have the power to do a lot of things. Don't be satisfied. Nest, and make your prompt your own! There are lots of Nerd Fonts but I want to patch Cascadia Code today (I'm sure they'll do it themselves one day, but I'm impatient) and make it look the way I want. You can to!

Starting with FontForge in Ubuntu under WSL

Using WSL2 and Ubuntu, I installed the Nerd Fonts Patcher and ran it on my downloaded version of Cascadia code like this:

scott@IRONHEART:/mnt/d/github/nerd-fonts$ fontforge -script font-patcher /mnt/c/Users/scott/Downloads/Cascadia.ttf
Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
Based on sources from 11:21 UTC 24-Sep-2017-ML-D.
Based on source from git with hash:
The following table(s) in the font have been ignored by FontForge
Ignoring 'DSIG' digital signature table
Warning: Mac string is a subset of the Windows string in the 'name' table
for the License string in the English (US) language.
Adding 53 Glyphs from Seti-UI + Custom Set
╢████████████████████████████████████████╟ 100%
Adding 198 Glyphs from Devicons Set
╢████████████████████████████████████████╟ 100%

Done with Patch Sets, generating font...

Generated: Cascadia Code Nerd Font

Cool! I could even go nuts and add -c and add thousands of glyphs. It just depends on what I need. I could just go --powerline and --fontawesome and call it a day. It's up to you! Salt your Fonts to taste!

Now I can install my local modified TTF like any other, then go into my profile.json in Windows Terminal and set the font face to my new personal custom "CascadiaCode Nerd Font!" Boom. All set.

UPDATE:  Alistair has created a forked version with the added glyphs. You may (or may not) be able to download his forked and renamed version from this Github comment. Slick!

Please also check out my YouTube video on blinging out your PowerShell prompt in the Windows Terminal!

Check out my YouTubes


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

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 bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Emulating a PlayStation 1 (PSX) entirely with C# and .NET

September 13, 2019 Comment on this post [15] Posted in Gaming | Open Source
Sponsored By

I was reading an older post in an emulator forum where someone was asking for a Playstation 1 (PSX) emulator written in C#, and the replies went on and on about how C# and .NET are not suited for emulation, C# is far too slow, negativity, blah blah.

Of course, that's silly. Good C# can run at near-native speed given all the work happening in the runtime/JITter, etc.

I then stumbled on this very early version of a PSX Emulator in C#. Now, if you were to theoretically have a Playtation SCPH1001.BIN BIOS and then physically owned a Playstation (as I do) and then created a BIN file from your physical copy of Crash Bandicoot, you could happily run it as you can see in the screenshot below.

Crash Bandicoot on a C#-based PSX Emulator

This project is very early days, as the author points out, but I was able to Git Clone and directly open the code in Visual Studio 2019 Community (which is free) and run it immediately. Note that as of the time of this blog post, the BIOS location *and* BIN files are hardcoded in the CD.cs and BUS.cs files. I named the BIN file "somegame.bin."

PSX Emualtor in C# inside Visual Studio

A funny note, since the code is unbounded as it currently sits, while I get about 30fps in Debug mode, in Release mode the ProjectPSX Emulator runs at over 120fps on my system, emulating a PlayStation 1 at over 220% of the usual CPU speed!

Just to make sure there's no confusion, and to support the author I want to repeat this question and answer here:

Can i use this emulator to play?

"Yes you can, but you shouldn't. There are a lot of other more capable emulators out there. This is a work in progress personal project with the aim to learn about emulators and hardware implementation. It can and will break during emulation as there are a lot of unimplemented hardware features."

This is a great codebase to learn from and read - maybe even support with your own Issues and PRs if the author is willing, but as they point out, it's neither complete nor ready for consumption.

Again, from the author who has other interesting emulators you can read:

I started doing a Java Chip8 and a C# Intel 8080 CPU (used on the classic arcade Space Invaders). Some later i did Nintendo Gameboy. I wanted to keep forward to do some 3D so i ended with the PSX as it had a good library of games...

Very cool stuff! Reading emulator code is a great way to not only learn about a specific language but also to learn 'the full stack.' We often hear Full Stack in the context of a complete distributed web application, but for many the stack goes down to the metal. This emulator literally boots up from the real BIOS of a Playstation and emulates the MIPS R3000A, a BUS to connect components, the CPU, the CD-ROM, and display.

An emulator has to lie at every step so that when an instruction is reached it can make everyone involved truly believe they are really running on a Playstation. If it does its job, no one suspects! That's why it's so interesting.

You can also press TAB to see the VRAM visualized as well as textures and color lookup tables which is super interesting!

Visualizing VRAM

One day, some day, there will be no physical hardware in existence for some of these old/classic consoles. Even today, lots of people play games for NES and SNES on a Nintendo Switch and may never see or touch the original hardware. It's important to support emulation development and sites like archive.org with Donations to make sure that history is preserved!

NOTE: It's also worth pointing out that it took me about 15 minutes to port this from .NET Framework 4.7.2 to .NET Core 3.0. More on this, perhaps, in another post. I'll also do a benchmark and see if it's faster.

I encourage you to go give a Github Star to ProjectPSX and enjoy reading this interesting bit of code. You can also read about the PSX Hardware written by Martin Korth for a trove of knowledge.


Sponsor: Develop Xamarin applications without difficulty with the latest JetBrains Rider: Xcode integration, JetBrains Xamarin SDK, and manage the required SDKs for Android development, all right from the IDE. Get 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.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

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