Subscribe: Scott Hanselman's Computer Zen
Added By: Feedage Forager Feedage Grade A rated
Language: English
app  containers  core  css  kubernetes  linux  net core  net  run  services  smidge  studio  visual studio  visual  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


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, but you should check out my practice video where I show a live demo of Kubernetes in Visual Studio: height="315" src="" 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. You use Visual Studio, or Visual Studio code, or the command line, and you use the languages and platforms that you prefer. In the demo I switch between .NET Core[...]

Lightweight bundling, minifying, and compression, for CSS and JavaScript with ASP.NET Core and Smidge

Wed, 08 Nov 2017 21:07:56 GMT

Yesterday I blogged about WebOptimizer, a minifier that Mads Kristensen wrote for ASP.NET Core. A few people mentioned that Shannon Deminick also had a great minifier for ASP.NET Core. Shannon has a number of great libraries on his GitHub including not just "Smidge" but also Examine, an indexing system, ClientDependency for managing all your client side assets, and Articulate, a blog engine built on Umbraco. Often when there's more than one way to do things, but one of the ways is made by a Microsoft employee like Mads - even if it's in his spare time - it can feel like inside baseball or an unfair advantage. The same would apply if I made a node library but a node core committer also made a similar one. Many things can affect whether an open source library "pops," and it's not always merit. Sometimes it's locale/location, niceness of docs, marketing, word of mouth, website. Both Mads and Shannon and a dozen other people are all making great libraries and useful stuff. Sometimes people are aware of other projects and sometimes they aren't. At some point a community wants to "pick a winner" but even as I write this blog post, someone else we haven't met yet is likely making the next great bundler/minifier. And that's OK! I'm going to take a look at Shannon Deminck's "Smidge" in this post. Smidge has been around as a runtime bundler since the beginning of ASP.NET Core even back when DNX was a thing, if you remember that. Shannon's been updating the library as ASP.NET Core has evolved, and it's under active development. Smidge supports minification, combination, compression for JS/CSS files and features a fluent syntax for creating and configuring bundles I'll start from "dotnet new mvc" and then:C:\Users\scott\Desktop\smidgenweb>dotnet add package smidge Writing C:\Users\scott\AppData\Local\Temp\tmp325B.tmpinfo : Adding PackageReference for package 'smidge' into project 'C:\Users\scott\Desktop\smidgenweb\smidgenweb.csproj'.log : Restoring packages for C:\Users\scott\Desktop\smidgenweb\smidgenweb.csproj......SNIP...log : Installing Smidge : Package 'smidge' is compatible with all the specified frameworks in project 'C:\Users\scott\Desktop\smidgenweb\smidgenweb.csproj'.info : PackageReference for package 'smidge' version '3.0.0' added to file 'C:\Users\scott\Desktop\smidgenweb\smidgenweb.csproj'. Then I'll update appSettings.json (where logging lives) and add Smidge's config:{ "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Warning" } }, "smidge": { "dataFolder" : "App_Data/Smidge", "version" : "1" } } Let me squish my CSS, so I'll make a bundle:app.UseSmidge(bundles =>{ bundles.CreateCss("my-css", "~/css/site.css");}); I refer to the bundle by name and the Smidge tag helper turns this: into this Notice the generated filename with version embedded. That bundle could be one or more files, a whole folder, whatever you need. Her eyou can see Kestral handling the request. Smidge jumps in there and does its thing, then the bundle is cached for the next request!info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1] Executing action method Smidge.Controllers.SmidgeController.Bundle (Smidge) with arguments (Smidge.Models.BundleRequestModel) - ModelState is Validdbug: Smidge.Controllers.SmidgeController[0] Processing bundle 'my-css', debug? False ...dbug: Smidge.FileProcessors.PreProcessManager[0] Processing file '/css/site.css', type: Css, cacheFile: C:\Users\scott\Desktop\smidgenweb\App_Data\Smidge\Cache\SONOFHEXPOWER\1\bb8368ef.css, watching? False ...dbug: Smidge.FileProcessors.PreProcessManager[0] Processed file '/css/site.css' in 19msdbug: Smidge.Controllers.SmidgeController[0] Processed bundle 'my-css' in 73msinfo: Microsoft.AspNetCore.Mvc.Internal.VirtualFileResultExecutor[1] Executing FileResult, sending file The minified resu[...]

WebOptimizer - a Bundler and Minifier for ASP.NET Core

Wed, 08 Nov 2017 09:05:12 GMT

ASP.NET Core didn't have a runtime bundler like previous versions of ASP.NET. This was a bummer as I was a fan. Fortunately Mads Kristensen created one and put it on GitHub, called WebOptimizer. WebOptimizer - ASP.NET Core middleware for bundling and minification of CSS and JavaScript files at runtime. With full server-side and client-side caching to ensure high performance. I'll try it out on a default ASP.NET Core 2.0 app. First, assuming I've installed I'll run C:\Users\scott\Desktop> cd squishywebC:\Users\scott\Desktop\squishyweb> dotnet new mvcThe template "ASP.NET Core Web App (Model-View-Controller)" was created successfully.This template contains technologies from parties other than Microsoft, see for details.SNIPRestore succeeded. Then I'll add a reference to the WebOptimizer package. Be sure to check the versioning and pick the one you want, or use the latest.C:\Users\scott\Desktop\squishyweb> dotnet add package LigerShark.WebOptimizer.Core --version 1.0.178-beta Add the service in ConfigureServices and add it (I'll do it conditionally, only when in Production) in Configure. Notice I had to put it before UseStaticFiles() because I want it to get the first chance at those requests.public void ConfigureServices(IServiceCollection services){ services.AddMvc(); services.AddWebOptimizer();}// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.public void Configure(IApplicationBuilder app, IHostingEnvironment env){ if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseWebOptimizer(); app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); });} After running "dotnet run" I'll request site.css as an example and see it's automatically minimized: You can control the pipeline with globbing like this:public void ConfigureServices(IServiceCollection services){ services.AddMvc(); services.AddWebOptimizer(pipeline => { pipeline.MinifyJsFiles("js/a", "js/b", "js/c"); });} If I wanted to combine some files into an output "file" that'll be held/cached only in memory, I can do that also. To be clear, it'll never touch the disk, it's just a URL. Then I can just refer to it with a within my Razor Page or main =>{ pipeline.AddCssBundle("/css/mybundle.css", "css/*.css");}); WebOptimizer also supports automatic "cache busting" with a ?v= query string created by a TagHelper. It can even compile Scss (Sass) files into CSS. There's plugins for TypeScript, Less, and Markdown too! WebOptimizer is open source and lives at Go check it out, kick the tires, and see if it meets your needs! Maybe get involved and make a fix or help with docs! There are already some open issues you could start helping with. 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.       [...]

The perfect Nintendo Switch travel set up and recommended accessories

Thu, 02 Nov 2017 18:02:38 GMT

I've had a Nintendo Switch since launch day and let me tell you, it's joyful. Joyous. It's a little joy device. I love 4k Xboxen and raw power as much as the next Jane or Joe Gamer, but the Switch just keeps pumping out happy games. Indie games, Metroidvania games like Axiom Verge, Legend of Zelda: Breath of the Wild (worth the cost of the system) and now, super Mario Odyssey. Even Doom and Wolfenstein 2 are coming to the Switch soon!

I've travelled already with my Switch all over. Here's what I've come up with for my travels - and my at-home Switch Experience. I owe and use these items personally - and I vouch for their awesomeness and utility.

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.