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  code  core  install  linux  net core  net  new  prompt  raspberry  run  scott hanselman  scott  shell  spinner  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



 



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

Thu, 11 Jan 2018 23:51:46 GMT

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 ANSI/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. I then rebuild again, and get a few warnings, but nothing major. Nice. 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. 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.       [...]



Exploring the Azure IoT Arduino Cloud DevKit

Mon, 08 Jan 2018 23:59:05 GMT

Someone gave me an Azure IoT DevKit, and it was lovely timing as I'm continuing to learn about IoT. As you may know, I've done a number of Arduino and Raspberry Pi projects, and plugged them into various and sundry clouds, including AWS, Azure, as well as higher-level hobbyist systems like AdaFruit IO (which is super fun, BTW. Love them.) The Azure IoT DevKit is brilliant for a number of reasons, but one of the coolest things is that you don't need a physical one...they have an online simulator! Which is very Inception. You can try out the simulator at https://aka.ms/iot-devkit-simulator. You can literally edit your .ino Arduino files in the browser, connect them to your Azure account, and then deploy them to a virtual DevKit (seen on the right). All the code and how-tos are on GitHub as well. When you hit Deploy it'll create a Free Azure IoT Hub. Be aware that if you already have a free one you may want to delete it (as you can only have a certain number) or change the template as appropriate. When you're done playing, just delete the entire Resource Group and everything within it will go away. Right off the bat you'll have the code to connect to Azure, get tweets from Twitter, and display them on the tiny screen! (Did I mention there's a tiny screen?) You can also "shake" the virtual IoT kit, and exercise the various sensors. It wouldn't be IoT if it didn't have sensors! This is just the simulator, but it's exactly like the real MXChip IoT DevKit. (Get one here) They are less than US$50 and include WiFi, Humidity & Temperature, Gyroscope & Accelerometer, Air Pressure, Magnetometer, Microphone, and IrDA, which is ton for a small dev board. It's also got a tiny 128x64 OLED color screen! Finally, the board also can go into AP mode which lets you easily put it online in minutes. I love these well-designed elegant little devices. It also shows up as an attached disk and it's easy to upgrade the firmware. You can then dev against the real device with free VS Code if you like. You'll need: Node and Yarn: Runtime for the setup script and automated tasks. Azure CLI 2.0 MSI - Cross-platform command-line experience for managing Azure resources. The MSI contains dependent Python and pip. Visual Studio Code (VS Code): Lightweight code editor for DevKit development. Visual Studio Code extension for Arduino: Extension that enables Arduino development in Visual Studio Code. Arduino IDE: The extension for Arduino relies on this tool. DevKit Board Package: Tool chains, libraries, and projects for the DevKit ST-Link Utility: Essential tools and drivers. But this Zip file sets it all up for you on Windows, and head over here for Homebrew/Mac instructions and more details. I was very impressed with the Arduino extension for VS Code. No disrespect to the Arduino IDE but you'll likely outgrow it quickly. This free add on to VS Code gives you intellisense and integration Arduino Debugging. Once you have the basics done, you can graduate to the larger list of projects at https://microsoft.github.io/azure-iot-developer-kit/docs/projects/ that include lots of cool stuff to try out like a cloud based Translator, Door Monitor, and Air Traffic Control Simulator. All in all, I was super impressed with the polish of it all. There's a LOT to learn, to be clear, but this was a very enjoyable weekend of play. 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.       [...]



ASP.NET Single Page Applications Angular Release Candidate

Mon, 08 Jan 2018 02:51:00 GMT

I was doing some Angular then remembered that the ASP.NET "Angular Project Template" has a release candidate and is scheduled to release sometime soon in 2018. Starting with just a .NET Core 2.0 install plus Node v6 or later, I installed the updated angular template. Note that this isn't the angular/react/redux templates that came with .NET Core's base install. I'll start by adding the updated SPA (single page application) template:dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0-rc1-final Then from a new directory, justdotnet new angular Then I can open it in either VSCode or Visual Studio Community (free for Open Source). If you're interested in the internals, open up the .csproj project file and note the checks for ensuring node is install, running npm, and running WebPack. If you've got the Angular "ng" command line tool installed you can do the usual ng related stuff, but you don't need to run "ng serve" because ASP.NET Core will run it automatically for you. I set development mode with "SET ASPNETCORE_Environment=Development" then do a "dotnet build." It will also restore your npm dependencies as part of the build. The client side app lives in ./ClientApp. C:\Users\scott\Desktop\my-new-app> dotnet buildMicrosoft (R) Build Engine version 15.5 for .NET CoreCopyright (C) Microsoft Corporation. All rights reserved. Restore completed in 73.16 ms for C:\Users\scott\Desktop\my-new-app\my-new-app.csproj. Restore completed in 99.72 ms for C:\Users\scott\Desktop\my-new-app\my-new-app.csproj. my-new-app -> C:\Users\scott\Desktop\my-new-app\bin\Debug\netcoreapp2.0\my-new-app.dll v8.9.4 Restoring dependencies using 'npm'. This may take several minutes... "dotnet run" then starts the ng development server and ASP.NET all at once. If we look at the "Fetch Data" menu item, you can see and example of how Angular and open source ASP.NET Core work together. Here's the Weather Forecast *client-side* template:

Loading...

Date Temp. (C) Temp. (F) Summary
{{ forecast.dateFormatted }} {{ forecast.temperatureC }} {{ forecast.temperatureF }} {{ forecast.summary }}
And the TypeScript:import { Component, Inject } from '@angular/core';import { HttpClient } from '@angular/common/http';@Component({ selector: 'app-fetch-data', templateUrl: './fetch-data.component.html'})export class FetchDataComponent { public forecasts: WeatherForecast[]; constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) { http.get(baseUrl + 'api/SampleData/WeatherForecasts').subscribe(result => { this.forecasts = result; }, error => console.error(error)); }}interface WeatherForecast { dateFormatted: string; temperatureC: number; temperatureF: number; summary: string;} Note the URL. Here's the back-end. The request is serviced by ASP.NET Core. Note the interface as well as the TemperatureF server-side conversion.[Route("api/[controller]")]public class SampleDataController : Controller{ private static string[] Summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; [HttpGet("[action]")] public IEnumerable WeatherForecasts() { var rng = new Random(); return Enumerable.Range(1, 5).Select(index => new WeatherForecast { DateFormatted = DateTime.Now.AddDays(index).ToString("d"), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }); } [...]



How to set up a 10" Touchscreen LCD for Raspberry Pi

Thu, 21 Dec 2017 03:31:00 GMT

I'm a big fan of the SunFounder tech kits (https://www.sunfounder.com), and my kids and I have built several Raspberry Pi projects with their module/sensor kits. This holiday vacation we have two project we're doing, that coincidentally use SunFounder parts. The first is the Model Car Kit that uses a Raspberry Pi to control DC motors AND (love this part) a USB camera. So it's not just a "drive the car around" project, it also can include computer vision. My son wants to teach it to search the house for LEGO bricks and alert an adult so they'll not step on it. We were thinking to have the car call out to Azure Cognitive Services, as their free tier has more than enough power for what we need. For this afternoon, we are taking a 10.1" Touchscreen display and adding it to a Raspberry Pi. I like this screen because it works on pretty much anything that has HDMI, but it's got mounting holes on the back for any Raspberry Pi or a LattePanda or Beagle Bone. You can also use it for basically anything that can output HDMI, so it can be a small portable monitor/display for Android or iOS. It has 10 finger multitouch which is fab. The instructions aren't linked to from their product page, but I found them on their Wiki. There are a lot of small LCDs you can get for a Pi project, from little 5" screens (for about $35) all the way up to this 10" one I'm using here. If you're going to mount your project on a wall or 3D print a box, a screen adds a lot. It's also a good way to teach kids about embedded systems. When my 10 year old saw the 5" screen and what it could do, he realized that the thermostat on the wall and/or the microwave ovens were embedded systems. Now he assumes every appliance is powered by a Raspberry Pi!   Take a look at the pic at the top right of this post. That's not a Raspberry Pi, that's the included controller board that interfaces with your tiny computer. It's include with the LCD package. That controller board also has an included power adapter that points out 12V at 1500Ma which allows it to also power the Pi itself. That means you can power the whole thing with a single power adapter. There's also an optional touchscreen "matchbox" keyboard package you can install to get an on-screen visual keyboard. However, when I'm initially setting up a Raspberry Pi or I'm taking a few Pis on the road for demos and working in hotels, I through this little $11 keyboard/mouse combo in my bag. It's great for quick initial setup of a Raspberry Pi that isn't yet on the network. Once you've installed matchbox-keyboard you'll find it under MainMenu, Accessories, Keyboard. Works great! * This post includes some referral links to Amazon.com. When you use these links, you not only support my blog, but you send a few cents/dollars my way that I use to pay for hosting and buy more gadgets like these! Thanks! Also, I have no relationship with SunFounder but I really like their stuff. Check out their site. 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.       [...]



Visualizing your real-time blood sugar values AND a Git Prompt on Windows PowerShell and Linux Bash

Sun, 17 Dec 2017 06:32:00 GMT

My buddy Nate become a Type 1 Diabetic a few weeks back. It sucks...I've been one for 25 years. Nate is like me - an engineer - and the one constant with all engineers that become diabetic, we try to engineer our ways out of it. ;) I use an open source artificial pancreas system with an insulin pump and continuous glucose system. At the heart of that system is some server-side software called Nightscout that has APIs for managing my current and historical blood sugar. It's updated every 5 minutes, 24 hours a day. I told Nate to get NightScout set up ASAP and start playing with the API. Yesterday Nate added his blood sugar to his terminal prompt! I love this. He uses Linux, but I use Linux (Ubuntu) on Windows 10, so I wanted to see if I could run his little node up from Windows (I'll make it a Windows service). Yes, you can run cron jobs under Windows 10's Ubuntu, but only when there is an instance of bash running (the Linux subsystem shuts down when it's not used) and upstart doesn't work yet. I could run it from the .bashrc or use various hacks/workarounds to keep WSL (Windows Subsystem for Linux) running, but the benefit of running this as a Windows Service is that I can see my blood sugar in all prompts on Windows, like Powershell as well! I'll use the "non-sucking service manager (NSSM)" to run Nate's non-Windows-service node app as a Windows service. I ran "nssm install nsprompt" and get this GUI. Then I add the --nightscout parameter and pass in my Nightscout blood sugar website. You'll get an error immediately when the service runs if this is wrong. From the Log on tab, make sure the service is logged on as you. I login with my MSA (Microsoft Account) so I used my email address. This is to ensure that with the app writes to ~ on Windows, it's putting your sugars in c:\users\LOGGEDINUSER\. Next, run the service with "sc start NSPrompt" or from the Services GUI. Nate's node app gets blood sugar from Nightscout and puts it in ~/.bgl-cache. However, to be clear since I'm running it from the Windows side while changing the Bash/Ubuntu on Windows prompt from Linux, it's important to note that from WIndows ~/ is really c:\users\LOGGEDINUSER\ so I changed the Bash .profile to load the values from the Windows mnt'ed drives like this:eval "$(cat /mnt/c/Users/scott/.bgl-cache)" Also, you need to make sure that you're using a Unicode font in your console. For example, I like using Fira Code Light, but it doesn't have a single character ⇈ double-up arrow (U+21C8), so I replaced it with two singles. You get the idea. You need a font that has the glyphs you want and you need those glyphs displaying properly in your .profile text file. And boom. It's glorious. My current blood sugar and trends in my prompt. Thanks Nate! So what about PowerShell as well? I want to update that totally different prompt/world/environment/planet from the same file that's updated by the service. Also, I already have a custom prompt with Git details since I use Posh-Git from Keith Dahlby (as should you). I can edit $profile.CurrentUserAllHosts with "powershell_ise $profile.CurrentUserAllHosts" and add a prompt function before "import-module posh-git." Here's Nate's same prompt file, translated into a PowerShell prompt() method, chained with PoshGit. So I can now see my Git Status AND my Blood Sugar. My two main priorities! NOTE: If you don't use posh-git, you can remove the "WriteVcsStatus" line and the "Import-Module posh-git" and you should be set!function prompt { Get-Content $ENV:USERPROFILE\.bgl-cache | %{$bgh = @{}} {if ($_ -match "local (.*)=""(.*)""") {$bgh[$matches[1]]=$matches[2].Trim();}} $trend = "?" switch ($bgh.nightscout_trend) { "DoubleUp" {$trend="↑↑"} "SingleUp" {$trend="↑"} "FortyFiveUp" {$trend="↗"} "Flat" {$trend="→"} "FortyFiveDown" {$trend="↘"} "SingleDown" {$trend="↓"} "DoubleDown" {$trend="↓↓"} } $bg[...]



Setting up a managed container cluster with AKS and Kubernetes in the Azure Cloud running .NET Core in minutes

Thu, 14 Dec 2017 08:18:24 GMT

After building a Raspberry Pi Kubernetes Cluster, I wanted to see how quickly I could get up to speed on Kubernetes in Azure. I installed the Azure CLI (Command Line Interface) in a few minutes - works on Windows, Mac or Linux. I also remembered that I don't really need to install anything locally. I could just use the Azure Cloud Shell directly from within VS Code. I'd get a bash shell, Azure CLI, and automatically logged in without doing anything manual. Anyway, while needlessly installing the Azure CLI locally, I read up on the Azure Container Service (AKS) here. There's walkthrough for creating an AKS Cluster here. You can actually run through the whole tutorial in the browser with an in-browser shell. After logging in with "az login" I made a new resource group to hold everything with "az group create -l centralus -n aks-hanselman." It's in the centralus and it's named aks-hanselman. Then I created a managed container service like this:C:\Users\scott\Source>az aks create -g aks-hanselman -n hanselkube --generate-ssh-keys / Running ... This runs for a few minutes while creating, then when it's done, I can get ahold of the credentials I need with C:\Users\scott\Source>az aks get-credentials --resource-group aks-hanselman --name hanselkubeMerged "hanselkube" as current context in C:\Users\scott\.kube\config I can install Kubenetes CLI "kubectl" easily with "az aks install-cli"Then list out the nodes that are ready to go!C:\Users\scott\Source>kubectl get nodesNAME                       STATUS    ROLES     AGE       VERSIONaks-nodepool1-13823488-0   Ready     agent     1m        v1.7.7aks-nodepool1-13823488-1   Ready     agent     1m        v1.7.7aks-nodepool1-13823488-2   Ready     agent     1m        v1.7.7 A year ago, Glenn Condron and I made a silly web app while recording a Microsoft Virtual Academy. We use it for demos and to show how even old (now over a year) containers can still be easily and reliably deployed. It's up at https://hub.docker.com/r/glennc/fancypants/. I'll deploy it to my new Kubernetes Cluster up in Azure by making this yaml file:apiVersion: apps/v1beta1kind: Deploymentmetadata: name: fancypantsspec: replicas: 1 template: metadata: labels: app: fancypants spec: containers: - name: fancypants image: glennc/fancypants:latest ports: - containerPort: 80---apiVersion: v1kind: Servicemetadata: name: fancypantsspec: type: LoadBalancer ports: - port: 80 selector: app: fancypants I saved it as fancypants.yml, then run kubectl create -f fancypants.yml. I can run kubectl proxy and then hit http://localhost:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/overview?namespace=default to look at the Kubernetes Dashboard, proxyed locally, but all running in Azure. When fancypants is created and deployed, then I can find out its external IP with:C:\Users\scott\Sources>kubectl get serviceNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEfancypants LoadBalancer 10.0.116.145 52.165.232.77 80:31040/TCP 7mkubernetes ClusterIP 10.0.0.1 443/TCP 18m There's my IP, I hit it and boom, I've got fancypants in the managed cloud. I only have to pay for the VMs I'm using, and not for the VM that manages Kubernetes. That means the "kube-system" namespace is free, I pay for other namespaces like my "default" one. Best part? When I'm done, I can just delete the resource group and take[...]



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.       [...]