Subscribe: Scott Hanselman's Computer Zen
http://www.hanselman.com/blog/SyndicationService.asmx/GetAtom
Added By: Feedage Forager Feedage Grade A rated
Language: English
Tags:
app  azure  cloud  code  containers  core  docker  dotnet  kubernetes  linux  net core  net  new  run  visual studio  windows 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Scott Hanselman's Computer Zen

Scott Hanselman's Blog



Scott Hanselman on Programming, User Experience, The Zen of Computers and Life in General



 



The 2017 Christmas List of Best STEM Toys for kids

Sat, 09 Dec 2017 06:52:03 GMT

In 2016 and 2015 I made a list of best Christmas STEM Toys for kids! If I may say so, they are still good lists today, so do check them out. Be aware I use Amazon referral links so I get a little kickback (and you support this blog!) when you use these links. I'll be using the pocket money to...wait for it...buy STEM toys for kids! So thanks in advance! Here's a Christmas List of things that I've either personally purchased, tried for a time, or borrowed from a friend. These are great toys and products for kids of all genders and people of all ages. Piper Computer Kit with Minecraft Raspberry Pi edition The Piper is a little spendy at first glance, but it's EXTREMELY complete and very thoughtfully created. Sure, you can just get a Raspberry Pi and hack on it - but the Piper is not just a Pi. It's a complete kit where your little one builds their own wooden "laptop" box (more of a luggable), and then starting with just a single button, builds up the computer. The Minecraft content isn't just vanilla Microsoft. It's custom episodic content! Custom voice overs, episodes, and challenges. What's genius about Piper, though, is how the software world interacts with the hardware. For example, at one point you're looking for treasure on a Minecraft beach. The Piper suggests you need a treasure detector, so you learn about wiring and LEDs and wire up a treasure detector LED while it's running. Then you run your Minecraft person around while the LED blinks faster to detect treasure. It's absolute genius. Definitely a favorite in our house for the 8-12 year old set. Suspend! by Melissa and Doug Suspend is becoming the new Jenga for my kids. The game doesn't look like much if you judge a book by its cover, but it's addictive and my kids now want to buy a second one to see if they can build even higher. An excellent addition to family game night. Engino Discovering Stem: Levers, Linkages & Structures Building Kit I love LEGO but I'm always trying new building kids. Engino is reminiscent of Technics or some of the advanced LEGO elements, but this modestly priced kit is far more focused - even suitable for incorporating into home schooling. Gravity Maze I've always wanted a 3D Chess Set. Barring that, check out Gravity Maze. It's almost like a physical version of a well-designed iPad game. It included 60 challenges (levels) that you then add pieces to in order to solve. It gets harder than you'd think, fast! If you like this, also check out Circuit Maze. Osmo Genius Kit (2017) Osmo is an iPad add-on that takes the ingenious idea of an adapter that lets your iPad see the tabletop (via a mirror/lens) and then builds on that clever concept with a whole series of games, exercises, and core subject tests. It's best for the under 12 set - I'd say it's ideal for about 6-8 year olds. 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.       [...]



Accelerated 3D VR, sure, but impress me with a nice ASCII progress bar or spinner

Mon, 04 Dec 2017 04:32:03 GMT

I'm glad you have a 1080p 60fps accelerated graphics setup, but I'm old school. Impress me with a really nice polished ASCII progress bar or spinner! I received two tips this week about cool .NET Core ready progress bars so I thought I'd try them out. ShellProgressBar by Martijn Laarman This one is super cool. It even supports child progress bars for async stuff happening in parallel! It's very easy to use. I was able to get a nice looking progress bar going in minutes.static void Main(string[] args){ const int totalTicks = 100; var options = new ProgressBarOptions { ForegroundColor = ConsoleColor.Yellow, ForegroundColorDone = ConsoleColor.DarkGreen, BackgroundColor = ConsoleColor.DarkGray, BackgroundCharacter = '\u2593' }; using (var pbar = new ProgressBar(totalTicks, "Initial message", options)) { pbar.Tick(); //will advance pbar to 1 out of 10. //we can also advance and update the progressbar text pbar.Tick("Step 2 of 10"); TickToCompletion(pbar, totalTicks, sleep: 50); }} Boom. Be sure to check out the examples for ShellProgressBar, specifically ExampleBase.cs where he has some helper stuff like TickToCompletion() that isn't initially obvious. Kurukuru by Mayuki Sawatari Another nice progress system that is in active development for .NET Core (like super active...I can see they updated code an hour ago!) is called Kurukuru. This code is less about progress bars and more about spinners. It's smart about Unicode vs. non-Unicode as there's a lot of cool characters you could use in a Unicode-aware console that make for attractive spinners. Kurukuru is also super easy to use and integrated into your code. It also uses the "using" disposable pattern in a clever way. Wrap your work and if you throw an exception, it will show a failed spinner.Spinner.Start("Processing...", () =>{ Thread.Sleep(1000 * 3); // MEMO: If you want to show as failed, throw a exception here. // throw new Exception("Something went wrong!");});Spinner.Start("Stage 1...", spinner =>{ Thread.Sleep(1000 * 3); spinner.Text = "Stage 2..."; Thread.Sleep(1000 * 3); spinner.Fail("Something went wrong!");}); TIP: If your .NET Core console app wants to use an async Main (like I did) and call Kurukuru's async methods, you'll want to indicate you want to use the latest C# 7.1 features by adding this to your project's *.csproj file: latest This allowed me to do this:public static async Task Main(string[] args){ Console.WriteLine("Hello World!"); await Spinner.StartAsync("Stage 1...", async spinner => { await Task.Delay(1000 * 3); spinner.Text = "Stage 2..."; await Task.Delay(1000 * 3); spinner.Fail("Something went wrong!"); });} Did I miss some? I'm sure I did. What nice ASCII progress bars and spinners make YOU happy? And again, as with all Open Source, I encourage you to HELP OUT! I know the authors would appreciate it. 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.       [...]



Azure Cloud Shell - your own bash shell and container - right inside Visual Studio Code

Sun, 03 Dec 2017 01:42:10 GMT

Visual Studio Code has a HUGE extension library. There's also almost two dozen very nice Azure specific extensions as well as extensions for Docker, etc. If you write an Azure extension yourself, you can depend on the Azure Account Extension to handle the administrivia of the user logging into Azure and selecting their subscription. And of course, the Azure Account Extension is open source. Here's the cool part - I think, since I just learned it. You can have the Azure Account Extension installed (again, you can install it directly or you can get it as a dependency) you also get the ability to get an Azure Cloud Shell directly inside VS Code. That means a little container spins up in the Cloud and you can get a real bash shell or a real PowerShell shell quickly. AND the Azure Cloud Shell automatically is logged in as you and already has a ton of tools pre-installed. Here's how you do it. Install Visual Studio Code Install the Azure Account Extension run VS Code, then press Shift-Ctrl-P for the Command Palette Click Azure: Sign In It will pop up a message with a "copy & open" button. It'll launch a browser, then you enter a special code after logging into Azure to OAuth VS Code into your Account account. At this point, open a Cloud Shell with Shift-Ctrl-P and type "Bash" or "PowerShell"...it'll autocomplete so you can type a lot less, or setup a hotkey. Your Cloud Shell will appear along side your local terminals! Note that there's a "clouddrive" folder mapped to your Azure Storage so you can keep stuff in there. Even though the Shell goes away in about 20 min of non-use, your stuff (scripts, whatever) is persisted. There's a bunch of tools preinstalled you can use as well!scott@Azure:~$ node --versionv6.9.4scott@Azure:~$ dotnet --version2.0.0scott@Azure:~$ git --versiongit version 2.7.4scott@Azure:~$ python --versionPython 3.5.2scott@Azure:~$ lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 16.04.2 LTSRelease: 16.04Codename: xenial And finally, when you type "azure" or "az" for the various Azure CLI (Command Line Interface) tools, you'll find you're already authenticated/logged into Azure, so you can create VMs, list websites, manage Kubenetes clusters, all from within VS Code. I'm still exploring, but I'm enjoying what I'm seeing. Sponsor: Scale your Python for big data & big science with Intel® Distribution for Python. Near-native code speed. Use with NumPy, SciPy & scikit-learn. Get it Today© 2017 Scott Hanselman. All rights reserved.       [...]



How to download embedded videos with F12 Tools in your browser

Wed, 29 Nov 2017 20:52:53 GMT

I got an email this week asking how to download some of my Azure Friday video podcast videos from http://friday.azure.com as well as some of the Getting Started Videos from Azure.com.NOTE: Respect copyright and consider what you’re doing and WHY before you use this technique to download videos that may have been embedded for a reason.I told them to download the videos with F12 tools, and they weren't clear how. I'll use an Azure Friday video for the example. Do be aware that there are a ton of ways to embed video on the web and this doesn't get around ones that REALLY don't want to be downloaded. This won't help you with Netflix, Hulu, etc.First, I'll visit the site with the video I want in my browser. I'll use Chrome but this also works in Edge or Firefox with slightly different menus.Then press F12 to bring up the Developer Tools pane and click Network. In Edge, click Content Type, then Media.Click the "clear" button to set up your workspace. That's the International No button there in the Network pane. Now, press Play and get ready.Look in the Media list for something like ".mp4" or something that looks like the video you want. It'll likely have an HTTP Response in the 20x range.In Chrome, right click on the URL and select Copy as CURL. If you're on Windows pick cmd.exe and bash if you're on Linux/Mac.You'll get a crazy long command put into your clipboard. It's not all needed but it's a very convenient feature the browser provides, so it's worth using.Get Curl: If you don't have the "curl" command you'll want to download "curl.exe" from here https://curl.haxx.se/dlwiz/ and, if you like, put it in your PATH. If you have Windows, get the free bundled curl version with installer here.Open a terminal/command prompt - run cmd.exe on Windows - and paste in the command. If the browser you're using only gives you the URL and not the complete "curl" command, the command you're trying to build is basically curl [url] -o [outputfile.mp4]. It's best if you can get the complete command like the one Chrome provides, as it may include authentication cookies or other headers that omitting may prevent your download from working.GOTCHA: Make sure to remove the -H "Range:" headers (if any) to ensure you get the FULL download and not just a range of bytes!BEFORE you press enter, make sure you add "-o youroutputfilename.mp4." Also, if you can an error about security and certificates, you may need to add "--insecure."In the screenshot above I'm saving the file as "test.mp4" on my desktop.There are several ways to download embedded videos, including a number of online utilities that come and go, but this technique has been very reliable for me.Sponsor: Scale your Python for big data & big science with Intel® Distribution for Python. Near-native code speed. Use with NumPy, SciPy & scikit-learn. Get it Today© 2017 Scott Hanselman. All rights reserved.       [...]



Writing smarter cross-platform .NET Core apps with the API Analyzer and Windows Compatibility Pack

Sat, 25 Nov 2017 23:21:00 GMT

There's a couple of great utilities that have come out in the last few weeks in the .NET Core world that you should be aware of. They are deeply useful when porting/writing cross-platform code. .NET API Analyzer First is the API Analyzer. As you know, APIs sometimes get deprecated, or you'll use a method on Windows and find it doesn't work on Linux. The API Analyzer is a Roslyn (remember Roslyn is the name of the C#/.NET compiler) analyzer that's easily added to your project as a NuGet package. All you have to do is add it and you'll immediately start getting warnings and/or squiggles calling out APIs that might be a problem. Check out this quick example. I'll make a quick console app, then add the analyzer. Note the version is current as of the time of this post. It'll change.C:\supercrossplatapp> dotnet new consoleC:\supercrossplatapp> dotnet add package Microsoft.DotNet.Analyzers.Compatibility --version 0.1.2-alpha Then I'll use an API that only works on Windows. However, I still want my app to run everywhere.static void Main(string[] args){ Console.WriteLine("Hello World!"); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var w = Console.WindowWidth; Console.WriteLine($"Console Width is {w}"); }} Then I'll "dotnet build" (or run, which implies build) and I get a nice warning that one API doesn't work everywhere.C:\supercrossplatapp> dotnet buildProgram.cs(14,33): warning PC001: Console.WindowWidth isn't supported on Linux, MacOSX [C:\Users\scott\Desktop\supercrossplatapp\supercrossplatapp.csproj] supercrossplatapp -> C:\supercrossplatapp\bin\Debug\netcoreapp2.0\supercrossplatapp.dllBuild succeeded. Olia from the .NET Team did a great YouTube video where she shows off the API Analyzer and how it works. The code for the API Analyzer up here on GitHub. Please leave an issue if you find one! Windows Compatibility Pack for .NET Core Second, the Windows Compatibility Pack for .NET Core is a nice piece of tech. When .NET Core 2.0 come out and the .NET Standard 2.0 was finalized, it included over 32k APIs that made it extremely compatible with existing .NET Framework code. In fact, it's so compatible, I was able to easily take a 15 year old .NET app and port it over to .NET Core 2.0 without any trouble at all. They have more than doubled the set of available APIs from 13k in .NET Standard 1.6 to 32k in .NET Standard 2.0. .NET Standard 2.0 is cool because it's supported on the following platforms: .NET Framework 4.6.1 .NET Core 2.0 Mono 5.4 Xamarin.iOS 10.14 Xamarin.Mac 3.8 Xamarin.Android 7.5 When you're porting code over to .NET Core that has lots of Windows-specific dependencies, you might find yourself bumping into APIs that aren't a part of .NET Standard 2.0. So, there's a new (preview) Microsoft.Windows.Compatibility NuGet package that "provides access to APIs that were previously available only for .NET Framework." There will be two kinds of APIs in the Compatibility Pack. APIs that were a part of Windows originally but can work cross-platform, and APIs that will always be Windows only, because they are super OS-specific. APIs calls to the Windows Registry will always be Windows-specific, for example. But the System.DirectoryServices or System.Drawing APIs could be written in a way that works anywhere. The Windows Compatibility Pack adds over 20,000 more APIs, on top of what's already available in .NET Core. Check out the great video that Immo shot on the compat pack. The point is, if the API that is blocking you from using .NET Core is now available in this compat pack, yay! But you should also know WHY you are pointing to .NET Core. Work continues on both .NET Core and .NET (Full) Framework on Windows. If your app works great today, there's no need to port unless you need a .NET Core specific feature. Here's a great list of rules of thumb from the docs: Use .NET Core for your server application when:+ You have cross-platform need[...]



Trying out new .NET Core Alpine Docker Images

Wed, 22 Nov 2017 19:27:14 GMT

I blogged recently about optimizing .NET and ASP.NET Docker files sizes. .NET Core 2.0 has previously been built on a Debian image but today there is preview image with .NET Core 2.1 nightlies using Alpine. You can read about the announcement here about this new Alpine preview image. There's also a good rollup post on .NET and Docker. They have added two new images: 2.1-runtime-alpine 2.1-runtime-deps-alpine Alpine support is part of the .NET Core 2.1 release. .NET Core 2.1 images are currently provided at the microsoft/dotnet-nightly repo, including the new Alpine images. .NET Core 2.1 images will be promoted to the microsoft/dotnet repo when released in 2018. NOTE: The -runtime-deps- image contains the dependancies needed for a .NET Core application, but NOT the .NET Core runtime itself. This is the image you'd use if your app was a self-contained application that included a copy of the .NET Core runtime. This is apps published with -r [runtimeid]. Most folks will use the -runtime- image that included the full .NET Core runtime. To be clear: - The runtime image contains the .NET Core runtime and is intended to run Framework-Dependent Deployed applications - see sample - The runtime-deps image contains just the native dependencies needed by .NET Core and is intended to run Self-Contained Deployed applications - see sample It's best with .NET Core to use multi-stage build files, so you have one container that builds your app and one that contains the results of that build. That way you don't end up shipping an image with a bunch of SDKs and compilers you don't need. NOTE: Read this to learn more about image versions in Dockerfiles so you can pick the right tag and digest for your needs. Ideally you'll pick a docker file that rolls forward to include the latest servicing patches. Given this docker file, we build with the SDK image, then publish, and the result is about 219megs.FROM microsoft/dotnet:2.0-sdk as builder RUN mkdir -p /root/src/app/dockertestWORKDIR /root/src/app/dockertest COPY dockertest.csproj . RUN dotnet restore ./dockertest.csproj COPY . .RUN dotnet publish -c release -o published FROM microsoft/dotnet:2.0.0-runtimeWORKDIR /root/ COPY --from=builder /root/src/app/dockertest/published .ENV ASPNETCORE_URLS=http://+:5000EXPOSE 5000/tcpCMD ["dotnet", "./dockertest.dll"] Then I'll save this as Dockerfile.debian and build like this:> docker build . -t shanselman/dockertestdeb:0.1 -f dockerfile.debian With a standard ASP.NET app this image ends up being 219 megs. Now I'll just change one line, and use the 2.1 alpine runtimeFROM microsoft/dotnet-nightly:2.1-runtime-alpine And build like this:> docker build . -t shanselman/dockertestalp:0.1 -f dockerfile.alpine and compare the two:> docker images | find /i "dockertest"shanselman/dockertestalp 0.1 3f2595a6833d 16 minutes ago 82.8MBshanselman/dockertestdeb 0.1 0d62455c4944 30 minutes ago 219MB Nice. About 83 megs now rather than 219 megs for a Hello World web app. Now the idea of a microservice is more feasible! Please do head over to the GitHub issue here https://github.com/dotnet/dotnet-docker-nightly/issues/500 and offer your thoughts and results as you test these Alpine images. Also, are you interested in a "-debian-slim?" It would be halfway to Alpine but not as heavy as just -debian. Lots of great stuff happening around .NET and Docker. Be sure to also check out Jeff Fritz's post on creating a minimal ASP.NET Core Windows Container to see how you can squish .(full) Framework applications running on Windows containers as well. For example, the Windows Nano Server images are just 93 megs compressed. Sponsor: Get the latest JetBrains Rider preview for .NET Core 2.0 support, Value Tracking and Call Tracking, MSTest runner, new code inspections and refactorings, and the Parallel Stacks view in debugger.© 2017 Scott Hanselman. All rights reserved.       [...]



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

Mon, 20 Nov 2017 03:24:10 GMT

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. 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. 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. I can easily and quickly run busybox or real Ubuntu (although Windows 10 already supports Ubuntu natively with WSL): 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. I can even run nyancat! (Thanks Thomas!) docker run -it supertest2014/nyan 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.       [...]



Announcing Visual Studio and Kubernetes – Visual Studio Connected Environment

Wed, 15 Nov 2017 15:03:44 GMT

I've been having all kinds of fun lately with Kubernetes, exploring building my own Kubernetes Cluster on the metal, as well as using a managed Kubernetes cluster in Azure with AKS. Today at the Connect() conference in NYC I was happy to announce Visual Studio Connected Environment. How would one take the best of Visual Studio and the best of managed Kubernetes and create something useful for development teams? Ecosystem momentum behind containers is amazing right now with support for containers across clouds, operating systems, and development platforms. Additionally, while microservices as an architectural pattern has been around for years, more and more developers are discovering the advantages every day. You can check out videos of the Connect() conference at https://www.microsoft.com/connectevent, but you should check out my practice video where I show a live demo of Kubernetes in Visual Studio: height="315" src="https://www.youtube.com/embed/-shPHJIBL_8?rel=0" frameborder="0" width="560" allowfullscreen> The buzzword "cloud native" is thrown around a lot. It's a meaningful term, though, as it means "architecture with the cloud in mind." Applications that are cloud-native should consider these challenges: Connecting to and leveraging cloud services Use the right cloud services for your app, don't roll your own DB, Auth, Discovery, etc. Dealing with complexity and staying cognizant of changes Stubbing out copies of services can increase complexity and hide issues when your chain of invocations grows. K.I.S.S. Setting up and managing infrastructure and dealing with changing pre-requisites Even though you may have moved to containers for production, is your dev environment as representative of prod as possible? Establishing consistent, common environments Setting up private environments can be challenging, and it gets messier when you need to manage your local env, your team dev, staging, and ultimately prod. Adopting best practices such as service discovery and secrets management Keep secrets out of code, this is a solved problem. Service discovery and lookup should be straightforward and reliable in all environments. A lot of this reminds us to use established and mature best practices, and avoid re-inventing the wheel when one already exists. The announcements at Connect() are pretty cool because they're extending both VS and the Azure cloud to work like devs work AND like devops works. They're extending the developers’ IDE/editor experience into the cloud with services built on top of the container orchestration capabilities of Kubernetes on Azure. Visual Studio, VS Code and Visual Studio for Mac AND and through a CLI (command line interface) - they'll initially support .NET Core, node and Java on Linux. As Azure adds more support for Windows containers in Kubernetes, they'll enable .NET Full Framework applications. Given the state of Windows containers support in the platform, the initial focus is on green field development scenarios but lift-shift and modernize will come later. It took me a moment to get my head around it (be sure to watch the video!) but it's pretty amazing. Your team has a shared development environments with your containers living in, and managed by Kubernetes. However, you also have your local development machine which then can reserve its own spaces for those services and containers that you're working on. You won't break the team with the work you're doing, but you'll be able to see how your services work and interact in an environment that is close to how it will look in production. PLUS, you can F5 debug from Visual Studio or Visual Studio Code and debug, live in the cloud, in Kubernetes, as fast as you could locally. This positions Kubernetes as the underlayment for your containers, with the backplane managed by Azure/AKS, and the development experience behaving the way it always has[...]