Subscribe: Scott Hanselman's Computer Zen
Added By: Feedage Forager Feedage Grade A rated
Language: English
app  azure  cloud  core  don  dotnet  linux windows  linux  make  net core  net  new  sdk  ubuntu  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


Exploring the preconfigured browser-based Linux Cloud Shell built into the Azure Portal

Mon, 22 May 2017 01:37:36 GMT

At BUILD a few weeks ago I did a demo of the Azure Cloud Shell, now in preview. It's pretty fab and it's built into the Azure Portal and lives in your browser. You don't have to do anything, it's just there whenever you need it. I'm trying to convince them to enable "Quake Mode" so it would pop-up when you click ~ but they never listen to me. ;) Click the >_ shell icon in the top toolbar at The very first time you launch the Azure Cloud Shell it will ask you where it wants your $home directory files to be persisted. They will live in your own Storage Account. Don't worry about cost, remember that Azure Storage is like pennies a gig, so assuming you're storing script files, figure it's thousandths of pennies - a non-issue. It's pretty genius how it works, actually. Since you can setup an Azure Storage Account as a regular File Share (sharing to Mac, Linux, or Windows) it will just make a file share and mount it. The data you save in the ~/clouddrive is persistent between sessions, the sessions themselves disappear if you don't use them. Today it's got bash inside a real container. Here's what lsb_release -a says:scott@Azure:~/clouddrive$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS Release: 16.04 Codename: xenial Looks like Ubuntu xenial inside a container, all managed by an orchestrator within Azure Container Services. The shell is using xterm to make it all possible inside the browser. That means you can run vim, top, whatever makes you happy. Cloud shells include vim, emacs, npm, make, maven, pip, as well as docker, kubectl, sqlcmd, postgres, mysql, iPython, and even .NET Core's command line SDK. NOTE: Ctrl-v and Ctrl-c do not function as copy/paste on Windows machines [in the Portal using xterm], please us Ctrl-insert and Shift-insert to copy/paste. Right-click copy paste options are also available, however this is subject to browser-specific clipboard access When you're in there, of course the best part is that you can ssh into your Linux VMs. They say PowerShell is coming soon to the Cloud Shell so you'll be able to remote Powershell in to Windows boxes, I assume. The Cloud Shell has the Azure CLI (command line interface) built in and pre-configured and logged in. So I can hit the shell then (for example) get a list of my web apps, and restart one. Here I'm getting the names of my sites and their resource groups, then restarting my son's hamster blog. scott@Azure:~/clouddrive$ az webapp list -o table ResourceGroup Location State DefaultHostName AppServicePlan Name -------------------------- ---------------- ------- ------------------------------------------ ----------------- ------------------------ Default-Web-WestUS West US Running DefaultServerFarm thisdeveloperslife Default-Web-WestUS West US Running DefaultServerFarm hanselmanlyncrelay Default-Web-WestUS West US Running DefaultServerFarm myhamsterblogscott@Azure:~/clouddrive$ az webapp restart -n myhamsterblog -g "Default-Web-WestUS" Pretty cool. I'm going to keep exploring, but I like the way the Azure Portal is going from a GUI and DevOps dashboard perspective, but it's also nice to have a CLI preconfigured whenever I need it. Sponsor: Did you know VSTS can integrate closely with Octopus Deploy? Watch Damian Brady and Brian A. Randell as they show you how to automate deployments from VSTS to Octopus Deploy, and demo the new VSTS Octopus Deploy dashboard widget. Watch now! © 2017 Scott Hanselman. All rights reserved.       [...]

Suggestions and Tips for attending your first tech conference

Wed, 17 May 2017 18:15:18 GMT

This last week Joseph Phillips tweeted that he was going to his first big tech conference and wanted some tips and suggestions. I have a TON of tips, but I know YOU have more, so I retweeted his request and prompted folks to reply. This was well timed as I had just gotten back from OSCON and BUILD, two great conferences. What suggestions to you offer to someone who is attending their first big tech conference? @2joephillips— Scott Hanselman (@shanselman) May 15, 2017 The resulting thread was fantastic, so I've pulled some of the best recommendations out. As per usual, the Community has some great ideas and you should check them out! @saraford - Whenever you get a biz card write down why you met them or what convo was about. It might seem obvious at time but you wont remember at home @arcdigg - Meet people and speakers. Tech is part of your success, but growing your network matters too. Conf can give you both or not. Up to you! @marypcbuk - if approaching people is hard for you, just ask 'what do you work on?' @ohhoe - don't be afraid to introduce yrself to people! let them know its yr first conference, often people will introduce you to other people too :) @IrishSQL - connect with a few attendees/speakers online prior to event, and bring plenty of business cards. When u get one, write details on back @arcdigg - Backpack and sneakers beat cute laptop bag and heels (ed: dress comfortably) @scribblingon - You might feel left out & think everyone knows everyone else. Don't be afraid to approach people & talk even if seems random sometimes :) If you liked someone's talk, strike a convo & tell them that!! @arcdigg - Plan session attendance in advance, have a backup in case the session is full. @jesslynnrose - Reach out to some other folks who are using the hashtag before you get there, events can be cliquey, say hi and make friends before you go! @thelarkinn - Never feel afraid to say hi to maintainers, and speakers!!!! Especially if you want to help! @everettharper - Pick 3 ppl you want to meet. Prep 1 Q for each. Go early, find person #1 in the 1st hr before crowds. 1/3 done = momentum for rest of day! @jorriss - Meet people. Skip sessions. You'll get more from meeting and talking with people then sitting in the sessions. #hallwaytrack @stabbycutyou - Leave room in your schedule, Meet people, Eavesdrop on hallway convos, Take notes, Present on them at your job @patrickfoley - Don't forget to sleep. Evidence that long-term memories get "written" then @david_t_macknet - Drinking will not help you remember it better or have a better time mingling. Most of us are just as introverted & the awkwardness fades. @carlowahlstedt - Don't feel like you have to go to EVERY session. @davidpine7 - Try your best to NOT be an introvert -- in our industry that can be challenging, but if you put yourself out will not regret it! @frontvu - Don't rely on the conference wifi @shepherddad - Put snacks in your bag or pocket. @sod1102 - Find out if there will be slides (and even better!) video available post conference, then don't worry about missing stuff and relax & enjoy @rnelson0 - Take notes. Live tweet, carry a notebook, jot it all down at 1am before sleeping, whatever method helps you remember what you did. @hoyto - Sit [at] meal tables with random people and introduce yourself. @_s_hari - Ask speaker when *not* to use product/methodology that they're speaking on. If they cannot explain that, then it's just a marketing session @EricFishor - Don't be afraid to discreetly leave or enter an on going session. It's up to you to seek out sessions that interest you. @texmandie - If you get to meet and talk to your heroes, don't freak out - they're normal people who happen to do cool stuff @wilbers_ke - Greatest connections happen in the hallways, coffee queue and places with animated humans. Minimize seated conference halls @CJohnsonO365 - CLEAR YOUR SCHEDULE. Don’t try to get “regular” work done during the conference— you’ll[...]

BUILD 2017 Conference Rollup for .NET Developers

Mon, 15 May 2017 05:59:40 GMT

The BUILD Conference was lovely this last week, as was OSCON. I was fortunate to be at both. You can watch all the interviews and training sessions from BUILD 2017 on Channel 9. Here's a few sessions that you might be interested in. Scott Hunter, Kasey Uhlenhuth, and I had a session on .NET Standard 2.0 and how it fit into a world of .NET Core, .NET (Full) Framework, and Mono/Xamarin. One of the best demos, IMHO, in this talk, was taking an older .NET 4.x WinForms app, updating it to .NET 4.7 and automatically getting HiDPI support. Then we moved it's DataSet-driven XML Database layer into a shared class library that targeted .NET Standard. Then we made a new ASP.NET Core 2.0 application that shared that new .NET Standard 2.0 library with the existing WinForms app. It's a very clear example of the goal of .NET Standard. Then, Daniel Roth and I talked about ASP.NET Core 2.0 Maria Naggaga talked about Support for ASP.NET Core. What's "LTS?" How do you balance purchased software that's supported and open source software that's supported? Mads Torgersen and Dustin Campbell teamed up to talk about the Future of C#! David Fowler and Damian Edwards introduced ASP.NET Core SignalR! There's also a TON of great 10-15 min short BUILD videos like: Get started with Unity and Visual Studio for Mac .NET Core and Visual Studio for Mac Windows High DPI Improvements for Desktop Miguel de Icaza and Scott Hunter on .NET Standard 2.0, UWP Support, and UI Futures on CH9 As for announcements, check these out: Announcing EF Core 2.0 Preview 1 Announcing .NET Core 2.0 Preview 1 Announcing ASP.NET Core 2.0.0-Preview1 and Updates for .NET Web Developers Visual Studio 2017 Tools for Azure Functions A Lap Around Python in Visual Studio 2017 Unity game development with Visual Studio for Mac Why you should use F# Announcing F# 4.1 and the Visual F# Tools for Visual Studio 2017 All Things Mobile at Microsoft Build And best of all...All .NET Core 2.0 and .NET Standard 2.0 APIs are now on at Enjoy! Sponsor: Test your application against full-sized database copies. SQL Clone allows you to create database copies in seconds using MB of storage. Create clones instantly and test your application as you develop. © 2017 Scott Hanselman. All rights reserved.       [...]

Managing dotnet Core 2.0 and dotnet Core 1.x versioned SDKs on the same machine

Fri, 12 May 2017 02:46:31 GMT

Tons of great announcements this week at the BUILD conference. I'll slowly blog my take on some of the cooler features, but for now here's a rollup of the major blog posts for developers: Announcing .NET Core 2.0 Preview 1 Announcing ASP.NET Core 2.0 Preview 1 for .NET Web Developers You can download and get started with .NET Core 2.0 Preview 1 right now, on Windows, Linux and macOS: .NET Core 2.0 Preview 1 Visual Studio 2017 Preview 15.3 for Windows - installs side by side with your existing released version Visual Studio Code If you already have .NET Core on your machine, you'll already be able to type "dotnet --version" at the terminal or command line. Go ahead and try it now. Mine says:C:\Users\scott> dotnet --version2.0.0-preview1-005977 Remember on Windows you can check out c:\program files\dotnet\sdk and see all the SDK versions you have installed: Typing dotnet will pick the most recent one...but it's smarter than that. Remember that you can set the current SDK version with a global.json file. Global.json's presence will override from the folder its in, all the way down. If I make a folder on my desktop and put this global.json in it:{ "projects": [ "src", "test" ], "sdk": { "version": "1.0.3" }} It will force my dotnet runner to use the .NET Core SDK version I asked for. That "projects" line isn't needed for the versioning, but it's nice to be able to select what folders have projects inside.C:\Users\scott\Desktop\test> dir Directory of C:\Users\scott\Desktop\test05/11/2017 09:22 PM .05/11/2017 09:22 PM ..05/11/2017 09:23 PM 45 global.json 1 File(s) 45 bytes 2 Dir(s) 85,222,268,928 bytes freeC:\Users\scott\Desktop\test> dotnet --version1.0.3 At this point - with a valid global.json - making a new project with dotnet new will make an app with a netcoreapp1.x version. If I move elsewhere and dotnet new I'll get a netcoreapp2.0. In this example, it's the pretense of that global.json that "pins" my SDK version. Alternatively, I could keep the dotnet.exe 2.0 SDK and install 1.x templates. This would mean I could create whatever I want AND pass in the version. First I'll add the 1.x templates into my 2.0 SDK. This just needs to happen once.dotnet new -i Microsoft.DotNet.Common.ProjectTemplates.1.x::1.0.0-* Now, even though I'm "driving" things with a .NET Core 2.0 SDK, I can pass in --framework to control the project that gets created!C:\Users\scott\Desktop\test> dotnet new console -o oneone --framework netcoreapp1.1The template "Console Application" was created successfully.C:\Users\scott\Desktop\test> dotnet new console -o twooh --framework netcoreapp2.0The template "Console Application" was created successfully. I can make libraries that target .NET Standard like this, passing in 2.0 or 1.6, or whatever netstandard I need.C:\Users\scott\Desktop\lib> dotnet new classlib --framework netstandard2.0The template "Class library" was created successfully. There's two options that are not exactly opposites, but they'll give you different levels of control, depending on your needs. You can control your SDK versioning folder by folder with global.json. That means your project's directories are "pinned" and know what SDK they want. When you type dotnet new using a pinned SDK, you'll get the new project results for that pinned SDK. Typing dotnet run will do the right thing. You can pass in --framework for templates that support it and dotnet new will create a template with the right runtime version. Typing dotnet run will do the right thing. This is .NET Core 2.0 Preview 1, but you should be able to install it side by side with your existing apps and have no issues. If you know these few internal details, you should be able to manage multiple apps with multiple versions without much trouble. Sponsor: Test your application against full-sized database copies. SQL Clone allows you to crea[...]

Audit and Optimize your Windows 10 Search Indexing Options

Tue, 02 May 2017 17:36:04 GMT

I was getting frustrated with the speed (or lack of) of Windows Search within Windows 10 lately. I went over to my Indexing Options - just hit Start and type Indexing Options - and was surprised to see that there was over 1.5 MILLLION items indexed! That seems like a big number. Why so large?

I checked my "index these locations" list and didn't see anything weird, but I did note that Indexing does include c:\users\YOURNAME by default. That seems reasonable, because it is reasonable.

However, I also noted that I had a LOT of ".folders" (dot folders) under my C:\users\YOURNAME folder adding up to a few gigs of config text files, caches and general crap.

I was able to significantly lower the number of items indexed from over a million to a reasonable 215k items just by excluding (un-checking) folders that I knew didn't matter to me as much.

Go to Indexing Options and click Modify:


Go to your C drive (or wherever ~\YOURNAME is) and go to your top level User folder. I unchecked a bunch of the stuff that didn't matter to me.


For average users this won't matter, but for developers who install a bunch of utilities, have their Dropbox or OneDrive in the c:\users folder, a 5 min audit of your indexed files can give your Indexed Files a nice refresh.

Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test, build and debug ASP.NET, .NET Framework, .NET Core, or Unity applications. Learn more and get access to early builds!

© 2017 Scott Hanselman. All rights reserved.

Penny Pinching in the Cloud: Lift and Shift vs App Services - When a VM in the Cloud isn't what you want

Tue, 25 Apr 2017 22:49:31 GMT

I got an interesting question today. This is actually an extremely common one so I thought I'd take a bit to explore it. It's worth noting that I don't know the result of this blog post. That is, I don't know if I'll be right or not, and I'm not going to edit it. Let's see how this goes! The individual emailed and said they were new to Azure and said: Question for you.  (and we may have made a mistake – some opinions and help needed)A month or so ago, we setup a full up Win2016 server on Azure, with the idea that it would host a SQL server as well two IIS web sites Long story short, they were mired in the setup of IIS on Win2k6, messing with ports, yada yada yada. ' All they wanted was: The ability to right-click publish from Visual Studio for two sites. Management of a SQL Database from SQL Management Studio. This is a classic "lift and shift" story. Someone has a VM locally or under their desk or in hosting, so they figure they'll move it to the cloud. They LIFT the site as a Virtual Machine and SHIFT it to the cloud. For many, this is a totally reasonable and logical thing to do. If you did this and things work for you, fab, and congrats. However, if, at this point, you're finding the whole "Cloud" thing to be underwhelming, it's likely because you're not really using the cloud, you've just moved a VM into a giant host. You still have to feed and water the VM and deal with its incessant needs. This is likely NOT what you wanted to do. You just want your app running. Making a VM to do Everything If I go into Azure and make a new Virtual Machine (Linux or Windows) it's important to remember that I'm now responsible for giving that VM a loving home and a place to poop. Just making sure you're still reading. NOTE: If you're making a Windows VM and you already have a Windows license you can save like 40%, so be aware of that, but I'll assume they didn't have a license. You can check out the Pricing Calculator if you like, but I'll just go and actually setup the VM and see what the Azure Portal says. Note that it's going to need to be beefy enough for two websites AND a SQL Server, per the requirements from before. For a SQL Server and two sites I might want the second or third choice here, which isn't too bad given they have SSDs and lots of RAM. But again, you're responsible for them. Not to mention you have ONE VM so your web server and SQL Server Database are living on that one machine. Anything fails and it's over. You're also possibly giving up perf as you're sharing resources. App Service Plans with Web Sites/Apps and SQL Azure Server An "App Service Plan" on Azure is a fancy word for "A VM you don't need to worry about." You can host as many Web Apps, Mobile Apps/Backends, Logic Apps and stuff in one as you like, barring perf or memory issues. I have between 19 and 20 small websites in one Small App Service Plan. So, to be clear, you put n number of App Services as you'd like into one App Service Plan. When you check out the pricing tier for an App Service Plan, be sure to View All and really explore and think about your options. Some includes support for custom domains and SSL, others have 50 backups a day, or support BizTalk Services, etc. They start at Free, go to Shared, and then Basic, Standard, etc. Best part is that you can scale these up and down. If I go from a Small to a Medium App Service Plan, every App on the Plan gets better. However, we don't need a SQL Server, remember? This is going to be a plan that we'll use to host those two websites. AND we can use the the same App Service Plan for staging slots (dev/test/staging/production) if we like. So just get the plan that works for your sites, today. Unlike a VM, you can change it whenever. SQL Server on Azure is similar. You make a SQL Server Database that is hosted on a SQL Server that supports the number of Database Throughput Units that I need. Again, because it's the capital-C Cloud, I can change the [...]

ASP.NET - Overposting/Mass Assignment Model Binding Security

Wed, 19 Apr 2017 03:31:13 GMT

This little post is just a reminder that while Model Binding in ASP.NET is very cool, you should be aware of the properties (and semantics of those properties) that your object has, and whether or not your HTML form includes all your properties, or omits some. OK, that's a complex - and perhaps poorly written - sentence. Let me back up. Let's say you have this horrible class. Relax, yes, it's horrible. It's an example. It'll make sense in a moment.public class Person{ public int ID { get; set; } public string First { get; set; } public string Last { get; set; } public bool IsAdmin { get; set; }} Then you've got an HTML Form in your view that lets folks create a Person. That form has text boxes/fields for First, and Last. ID is handled by the database on creation, and IsAdmin is a property that the user doesn't need to know about. Whatever. It's secret and internal. It could be Comment.IsApproved or Product.Discount. You get the idea. Then you have a PeopleController that takes in a Person via a POST:[HttpPost][ValidateAntiForgeryToken]public async Task Create(Person person){ if (ModelState.IsValid) { _context.Add(person); await _context.SaveChangesAsync(); return RedirectToAction("Index"); } return View(person);} If a theoretical EvilUser found out that Person had an "IsAdmin" property, they could "overpost" and add a field to the HTTP POST and set IsAdmin=true. There's nothing in the code here to prevent that. ModelBinding makes your code simpler by handling the "left side -> right side" boring code of the past. That was all that code where you did myObject.Prop = Request.Form["something"]. You had lines and lines of code digging around in the QueryString or Form POST. Model Binding gets rid of that and looks at the properties of the object and lines them up with HTTP Form POST name/value pairs of the same names. NOTE: Just a friendly reminder that none of this "magic" is magic or is secret. You can even write your own custom model binders if you like. The point here is that folks need to be aware of the layers of abstraction when you use them. Yes, it's convenient, but it's hiding something from you, so you should know the side effects. How do we fix the problem? Well, a few ways. You can mark the property as [ReadOnly]. More commonly, you can use a BindAttribute on the method parameters and just include (whitelist) the properties you want to allow for binding:public async Task Create([Bind("First,Last")] Person person) Or, the correct answer. Don't let models that look like this get anywhere near the user. This is the case for ViewModels. Make a model that looks like the View. Then do the work. You can make the work easier with something like AutoMapper. Some folks find ViewModels to be too cumbersome for basic stuff. That's valid. There are those that are "All ViewModels All The Time," but I'm more practical. Use what works, use what's appropriate, but know what's happening underneath so you don't get some scriptkiddie overposting to your app and a bit getting flipped in your Model as a side effect. Use ViewModels when possible or reasonable, and when not, always whitelist your binding if the model doesn't line up one to one (1:1) with your HTML Form. What are your thoughts? Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test, build and debug ASP.NET, .NET Framework, .NET Core, or Unity applications. Learn more and get access to early builds!© 2017 Scott Hanselman. All rights reserved.       [...]

Setting up a Shiny Development Environment within Linux on Windows 10

Thu, 13 Apr 2017 22:22:05 GMT

While I was getting Ruby on Rails to work nicely under Ubuntu on Windows 10 I took the opportunity to set up my *nix bash environment, which was largely using defaults. Yes, I know I can use zsh or fish or other shells. Yes, I know I can use emacs and screen, but I am using Vim and tmux. Fight me. Anyway, once my post was done, I starting messing around with open source .NET Core on Linux (it runs on Windows, Mac, and Linux, but here I'm running on Linux on Windows. #Inception) and tweeted a pic of my desktop. By the way, I feel totally vindicated by all the interest in "text mode" given my 2004 blog post "Windows is completely missing the TextMode boat." ;)' Also, for those of you who are DEEPLY NOT INTERESTED in the command line, that's cool. You can stop reading now. Totally OK. I also use Visual Studio AND Visual Studio Code. Sometimes I click and mouse and sometimes I tap and type. There is room for us all. 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. A number of people asked me how they could set up their WSL (Windows Subsystem for Linux) installs to be something like this, so here's what I did. Note that will I've been using *nix on and off for 20+ years, I am by no means an expert. I am, and have been, Permanently Intermediate in my skills. I do not dream in RegEx, and I am offended that others can bust out an awk script without googling. So there's a few things going on in this screenshot. Running .NET Core on Linux (on Windows 10) Cool VIM theme with >256 colors Norton Midnight Commander in the corner (thanks Miguel) Desqview-esque tmux splitter (with mouse support) Some hotkey remapping, git prompt, completion Ubuntu Mono font Nice directory colors (DIRCOLORS/LS_COLORS) Let's break them down one at a time. And, again, your mileage may vary, no warranty express or implied, any of this may destroy your world, you read this on a blog. Linux is infinitely configurable and the only constant is that my configuration rocks and yours sucks. Until I see something in yours that I can steal. Running .NET Core on Linux (on Windows 10) Since Linux on Windows 10 is (today) Ubuntu, you can install .NET Core within it just like any Linux. Here's the Ubuntu instructions for .NET Core's SDK. You may have Ubuntu 14.04 or 16.04 (you can upgrade your Linux on Windows if you like). Make sure you know what you're running by doing a:~ $ lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 16.04.2 LTSRelease: 16.04Codename: xenial~ $ If you're not on 16.04 you can easily remove and reinstall the whole subsystem with these commands at cmd.exe (note the /full is serious and torches the Linux filesystem):> lxrun /uninstall /full> lxrun /install Or if you want you can run this within bash (will take longer but maintain settings). NOTE that you'll need Windows 10 Creators Edition build 16163 or greater to run Ubuntu 16.04. Type "winver" to check your build.sudo do-release-upgrade Know what Ubuntu your Windows 10 has when you install .NET Core within it. The other thing to remember is that now you have two .NET Cores, one Windows and one Ubuntu, on the same (kinda) machine. Since the file systems are separated it's not a big deal. I do my development work within Ubuntu on /mnt/d/github (which is a Windows drive). It's OK for the Linux subsystem to edit files in Linux or Windows, but don't "reach into" the Linux file system from Windows. Cool Vim theme with >256 colors That Vim theme is gruvbox and I installed it like this. Thanks to Rich Turner for turning me on to this theme.$ cd ~/$ mkdir .vim$ cd .vim$ mkdir colors$ cd colors$ curl -O https://ra[...]