Subscribe: Scott Hanselman's Computer Zen
Added By: Feedage Forager Feedage Grade A rated
Language: English
allowance  app  azure  build  core  don  dotnet  driver  json  make  net core  net  new  nuget  switch  web  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


Visual Studio 2017 can automatically recommend NuGet packages for unknown types

Fri, 24 Mar 2017 08:03:31 GMT

There's a great feature in Visual Studio 2015.3 and Visual Studio 2017 that is turned off by default. It does use about ~10 megs of memory but it makes me so happy that I turn it on. It's under C# | Advanced in Tools Options. Or you can just type "Advanced" in the Quick Launch Bar (via Ctrl+Q if you like) to jump there. I turn on "Suggest usings for types in NuGet packages" and "Suggest usings for types in reference assemblies." For example, if I am typing some code and start referencing a Type that isn't in my project but could know how sometimes you just need a using statement to bring in a namespace? In this Web App, I already have Json.NET so it recommends a using statement to bring it into scope. But in this Console App, I have no packages beyond the defaults. When I start using a type like JObject from a popular NuGet, Visual Studio can offer to install Json.NET for me! Or another example: And then I can immediately continue typing with intellisense. If I know what I'm doing, I can bring in something like this without ever using the mouse or leaving the line. Good stuff!  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.       [...]

Options for CSS and JS Bundling and Minification with ASP.NET Core

Sat, 18 Mar 2017 00:10:11 GMT

Maria and I were updating the NerdDinner sample app (not done yet, but soon) and were looking at various ways to do bundling and minification of the JSS and CS. There's runtime bundling on ASP.NET 4.x but in recent years web developers have used tools like Grunt or Gulp to orchestrate a client-side build process to squish their assets. The key is to find a balance that gives you easy access to development versions of JS/CSS assets when at dev time, while making it "zero work" to put minified stuff into production. Additionally, some devs don't need the Grunt/Gulp/npm overhead while others absolutely do. So how do you find balance? Here's how it works. I'm in Visual Studio 2017 and I go File | New Project | ASP.NET Core Web App. Bundling isn't on by default but the configuration you need IS included by default. It's just minutes to enable and it's quite nice. In my Solution Explorer is a "bundleconfig.json" like this:// Configure bundling and minification for the project.// More info at[ { "outputFileName": "wwwroot/css/site.min.css", // An array of relative input file paths. Globbing patterns supported "inputFiles": [ "wwwroot/css/site.css" ] }, { "outputFileName": "wwwroot/js/site.min", "inputFiles": [ "wwwroot/js/site" ], // Optionally specify minification options "minify": { "enabled": true, "renameLocals": true }, // Optionally generate .map file "sourceMap": false }] Pretty simple. Ins and outs. At the top of the VS editor you'll see this yellow prompt. VS knows you're in a bundleconfig.json and in order to use it effectively in VS you grab a small extension. To be clear, it's NOT required. It just makes it easier. The source is at Slip this UI section if you just want Build-time bundling. If getting a prompt like this bugs you, you can turn all prompting off here: Look at your Solution Explorer. See under site.css and site? There are associated minified versions of those files. They aren't really "under" them. They are next to them on the disk, but this hierarchy is a nice way to see that they are associated, and that one generates the other. Right click on your project and you'll see this Bundler & Minifier menu: You can manually update your Bundles with this item as well as see settings and have bundling show up in the Task Runner Explorer. Build Time Minification The VSIX (VS extension) gives you the small menu and some UI hooks, but if you want to have your bundles updated at build time (useful if you don't use VS!) then you'll want to add a NuGet package called BuildBundlerMinifier. You can add this NuGet package SEVERAL ways. Which is awesome. Add it from the Manage NuGet Packages menu Add it from the command line via "dotnet add package BuildBundlerMinifier" Note that this adds it to your csproj without you having to edit it! It's like "nuget install" but adds references to projects!  The dotnet CLI is lovely. If you have the VSIX installed, just right-click the bundleconfig.json and click "Enable bundle on build..." and you'll get the NuGet package. Now bundling will run on build...c:\WebApplication8\WebApplication8>dotnet buildMicrosoft (R) Build Engine version 15Copyright (C) Microsoft Corporation. All rights reserved. Bundler: Begin processing bundleconfig.json Bundler: Done processing bundleconfig.json WebApplication8 -> c:\WebApplication8\bin\Debug\netcoreapp1.1\WebApplication8.dllBuild succeeded. 0 Warning(s) 0 Error(s) ...even from the command line with "dotnet build." It's all integrated. This is nice for VS Code or users of other editors. Here's how it would work entirely from the command prompt:$ dotnet new mvc$ dotnet add package BuildBundlerMinifier$ dotnet restore$ dotnet run Advanced: Using Gulp to handle Bundling/Minifying If you outgrow this bundler or just like Gulp, you can right click and Convert to Gulp! Now you'll get a gulpfile that uses the bund[...]

ZEIT now deployments of open source ASP.NET Core web apps with Docker

Wed, 15 Mar 2017 20:13:41 GMT

ZEIT is a new cloud service and "now" is the name of their deployment tool. ZEIT World is their DNS service. If you head over to you'll see a somewhat cryptic animated gif that shows how almost impossibly simple it is to deploy a web app with ZEIT now. You can make a folder, put an index.html (for example) in it and just run "now." You'll automatically get a website with an autogenerated name and it'll be live. It's probably the fastest and easiest deploy I've ever seen. Remember when Heroku (then Azure, then literally everyone) started using git for deployment? Clearly being able to type "now" and just get a web site on the public internet was the next step. (Next someone will make "up" which will then get replaced with just pressing ENTER on an empty line! ;) ) Jokes aside, now is clean and easy. I appreciate their organizational willpower to make an elegant and simple command line tool. I suspect it's harder than it looks to keep things simple. All of their examples use JavaScript and node, but they also support Docker, which means they support open source ASP.NET Core on .NET Core! But do they know they do? ;) Let's find out. And more importantly, how easy is it? Can I take a site from concept to production in minutes? Darn tootin' I can. First, make a quick ASP.NET Core app. I'll use the MVC template with Bootstrap.C:\Users\scott\zeitdotnet>dotnet new mvcContent generation time: 419.5337 msThe template "ASP.NET Core Web App" created successfully. I'll do a quick dotnet restore to get the packages for my project.C:\Users\scott\zeitdotnet>dotnet restore Restoring packages for C:\Users\scott\zeitdotnet\zeitdotnet.csproj... Generating MSBuild file C:\Users\scott\zeitdotnet\obj\zeitdotnet.csproj.nuget.g.props. Generating MSBuild file C:\Users\scott\zeitdotnet\obj\zeitdotnet.csproj.nuget.g.targets. Writing lock file to disk. Path: C:\Users\scott\zeitdotnet\obj\project.assets.json Restore completed in 2.93 sec for C:\Users\scott\zeitdotnet\zeitdotnet.csproj. NuGet Config files used: C:\Users\scott\AppData\Roaming\NuGet\NuGet.Config C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config Feeds used: C:\LocalNuGet C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ Now I need to add a Dockerfile. I'll make one in the root that looks like this:FROM microsoft/aspnetcoreLABEL name="zeitdotnet"ENTRYPOINT ["dotnet", "zeitdotnet.dll"]ARG source=.WORKDIR /appEXPOSE 80COPY $source . Note that I could have ZEIT build my app for me if I used the aspnetcore Dockerfile that includes the .NET Core SDK, but that would not only make my deployment longer, it would also make my docker images a LOT larger. I want to include JUST the .NET Core runtime in my image, so I'll build and publish locally. ZEIT now is going to need to see my Dockerfile, and since I want my app to include the binaries (I don't want to ship my source in the Docker image up to ZEIT) I need to mark my Dockerfile as "Content" and make sure it's copied to the publish folder when my app is built and published. Always I'll add this my project's csproj file. If I was using Visual Studio, this is the same as right clicking on the Properties of the Dockerfile, setting it to Content and then "Always Copy to Output Directory." Now I'll just build and publish to a folder with one command:C:\Users\scott\zeitdotnet>dotnet publishMicrosoft (R) Build Engine version 15.1.548.43366Copyright (C) Microsoft Corporation. All rights reserved. zeitdotnet -> C:\Users\scott\zeitdotnet\bin\Debug\netcoreapp1.1\zeitdotnet.dll And finally, from the .\bin\Debug\netcoreapp1.1\ folder I run "now." (Note that I've installed now and signed up for their service, of course.)C:\Users\scott\zeit[...]

Nintendo Switch and The Legend of Zelda: Breath of the Wild are an ABSOLUTE JOY

Sun, 12 Mar 2017 02:15:18 GMT

I bought a Nintendo Switch last week with my allowance and I'm utterly smitten. It's brilliant. It's absolutely brilliant. Now, to be clear, I'm neither a hardcore gamer nor a journalist. However, I am someone who grew up on Mario, enjoys Retrogaming and my Xbox One, and most of all, I know genius when I see it. The Legend of Zelda: Breath of the Wild is a wonderful example of the very best that video games can offer as an art form in 2017. - Me It may be the best video game ever. And it is because it borrows so much from the decades of refinement whose shoulders it stands upon. Let's break this down into two halves. First, Zelda (which is available on WiiU and Switch), and later, the Switch itself. If you don't feel like reading this, just trust me and buy a Switch and Zelda and bask in the hundreds of hours of joy and wonder it will bring you. It's the most fun I've had with a video game in recent memory. I also profoundly recommend the gorgeous hardcover The Legend of Zelda: Breath of the Wild: The Complete Official Guide Collector's Edition. The maps, the art, and the gentle walkthroughs are more fun than googling. The kids and I have enjoyed exploring the wilderness with the giant map unfurled in front of us. Legend of Zelda: Breath of the Wild It's HUGE. It's estimated at 360 square kilometers. They are saying it's 1.5x the Skyrim map and may be larger than Witcher 3. A cynic could call Breath of the Wild derivative, but an optimist like me says, well, they stole every game mechanic that was awesome over the last few decades, and made the near-perfect game. I love that this is a console launch game that is polished and has at LEAST 100 hours or more for the completist. What is Zelda like? Just Cause - Fly off a cliff with a paraglider, fly over a raging river and land on an elk, tame it and ride it. Because you're awesome and you can. Witcher 3 - Massive map, armor sets, crafting and more. Assassin's Creed - Climbing's fun. Getting maps by unlocking towers and jumping off. Grand Theft Auto - The first massive sandbox without loading. You enter a new area and get a brief subtitle announcing you're in a new "neighborhood" and then you wander. Skyrim - The Elder Scrolls was the first video game I played where I climbed mountains "because they were there" and really had a sense of wonder when I got to the top. Draw distance! Shadow of the Colossus - There's amazing HUGE boss fights that involve climbing the enemy, racing after monsters with horses, and sometimes going inside them. Bard's Tale - Because I'm old. Complaints? Honestly, if I had to truly nit. And I mean really nit I'd say the durability of weapons, particularly swords, is annoying. I would make them last maybe 50% longer. Also, moving in and out of Shrines has a load screen that takes 10-15 seconds. But really, that's like saying "I wish Beyoncé was 5'8", not 5'7". I mean, REALLY. Beyoncé. Shush. The Nintendo Switch It's portable. Just like in the ad, you can pull the Switch out and leave. In my video below I also switch to portable AND have to re-sync the controllers, so there is one additional ceremony, but it's easy. Short #video of my #nintendoswitch playing Zelda going from big screen to portable and back.— Scott Hanselman (@shanselman) March 5, 2017 It feels like a console when it's plugged in. I've got it plugged into my TV and from my couch it looks as nice as any of my devices. Sure, it's not an Xbox One playing Tom Clancy: The Division. But it's a brilliant tradeoff for a device I can simply pick up and go outside with (which I've done, with considerable appreciation.) I'm surprised that folks are complaining about the gaming resolution, frame rates, battery life, older processor, or said "it's just like an iPad with an HDMI cable." Here's why: Resolution - Zelda runs at 720p (the native res of the touchscreen) at 30fps. It's just 6.5" and 720p is just fine when it's a foot or more from your face. Battery -[...]

Relationship Hacks - Mindfulness - Don't live your life by default

Thu, 09 Mar 2017 10:20:13 GMT

I'm setting a goal for myself to finish my half-finished book this year. In an attempt to make that happen (and because the recent podcast with my wife was wildly popular) I'm going to try to blog some guiding principles. Then I'll attempt to collect the feedback and comments, improve the posts, then move them into the book. Yesterday I posted about "An allowance system for adults." In this post on I want to touch briefly on the concept of "mindfulness." When I was younger I didn't know this term so I said "don't live your life by default." Phrased alternatively, "don't let your life happen by default." I mentioned it years ago on a podcast and Paul Apostolos did a very nice blog post where he paraphrased: Teach your children to make life choices rather than just let life happen to them. Now, to be clear, stuff happens and this isn't always possible. There's luck, there's planning, there's inherent privilege, but the root idea of mindfulness and awareness is crucial. As they say, "Luck Is what happens when preparation meets opportunity" I met with a young mentee today who is considering not just leaving her job but also moving to a totally different career. What I appreciated about her perspective and questions was that she clearly was going into the future fully aware of the possibilities. She embraced both the potential good and bad possibilities with a conscious and mindful awareness that was inspiring. She wasn't going to just "let whatever happen, happen." She wasn't going to just start the game and accept the defaults. She is opening up the options menu of life and trying to change the settings consciously. I'm doing my best to teach my kids this, hopefully by example. Yes there are things they can't change about themselves, but the one thing they can change (or try) is how they think and how they act. I catch them saying things like "I'm not good at math." They have tapes that are already starting to run in their little heads that feed them negativity and inaction. The defaults are just doing nothing. Humans (myself included) can be very lazy. I want them to build up their reservoirs of self-esteem and "I can do it" so they don't accept the defaults. Do you have any stories of where you "woke up" and realized you were coasting (perhaps for a week, perhaps for years) and were just accepting the defaults in your life? How did you break out of that thinking? Sponsor: Get next level application monitoring with Raygun - The revolutionary software intelligence platform for your web and mobile apps. Take a free trial today! © 2017 Scott Hanselman. All rights reserved.       [...]

Relationship Hacks: An Allowance System for Adults

Tue, 07 Mar 2017 05:25:15 GMT

I'm setting a goal for myself to finish my half-finished book this year. In an attempt to make that happen (and because the recent podcast with my wife was wildly popular) I'm going to try to blog some guiding principles. Then I'll attempt to collect the feedback and comments, improve the posts, then move them into the book. I got a Nintendo Switch yesterday. Bought it with cash, brought it home, set it up, and - with neither shame nor regret - showed my non-gamer spouse. "That's cool," she said. "Is that the new Nintendo 64 they were talking about on the radio?" No judgment. Not a comment about the $300 price tag. Nothing was said like "do we really need another game?" or "what credit card did you buy that with?" How is this possible? No fight (not even a lowercase F fight) and no tension. My wife and I give each other an allowance. In cash. Every two weeks when our paychecks are deposited, we each get an allowance. It's a $100 a week (yes, for some that's a lot, for others, it's not. It works for us.) and it's the same for each of us. We put all our money in one account, give ourselves the allowance, pay the bills, then if there is anything left over it goes it savings. Let me back up. We used to a bicker and judge each other for our purchases. If you'd log into our bank you'd see something like: Paycheck Mortgage Car Note $5 Starbucks $3 Subway $8 Chipotle $60 GameStop $70 Nordstrom HOLD UP. What is that GameStop? Well, what's this Nordstrom? Did you need to be getting that [widget?] You get the idea. We needed to remove all that noise at the bottom of the ledger as it was distracting us from the larger goals. Then my wife had the idea that we just needed to pay ourselves first. We can spend that money however we like - with promised zero judgment from the other spouse. That's crucial, otherwise the system doesn't work. The allowance for anything that isn't "necessarily living stuff." So it's not for toothpaste, but it IS for eating out when we don't need to eat out. I could have eaten at Chipotle each day this week, but that would come out of my allowance. Instead, I chose to eat at home all month and save my allowance for a Nintendo Switch. This works - of course - both ways. My wife has hobbies and social stuff that she does, and she uses her allowance for that. If you made it this far, perhaps you're thinking, "wow, you're a wimp" or "gee, he/she has you in their pocket." Wait. Step back and absorb. We are grown-ass people. This system works because we designed it for us. All arguments around "frivolous" spending are gone. This allows us the best of all worlds. It keeps credit card spending to an absolute minimum.  We are empowered and we empower each other with this system. There's a certain sense of power in carrying cash. You know exactly how much you have and exactly when you have to stop spending. We can decide if we want $200 shoes or a $100 meal or a $50 game. One spouse comes home excited about their purchase while the other greets them without resentment. The fixed allowance amount handles that. Additional spending is discussed on a case-by-case basis. But we've picked an amount that is large enough that I could buy something crazy like a Vive - if I am willing to forgo movies, excessive eating out, etc. It sets a good example for the kids as they watch us weigh the pros and cons of a purchase. Money is spent when it's in-hand and not on credit. My wife and I are in a mixed marriage. It's not that I'm White and she's Black, is that I'm a techie/geek/nerd and she's fairly normal. ;) Of course, this kind of mix isn't gender or race specific. I know lots of couples of varying combos and flavors that bump up against issues in their relationships because of budding resentment, missed or poorly set expectations, divergent points of view around problem solving, and more. I'd love to hear YOUR story of your partner and your "mix" a[...]

Exploring the new DevOps - Azure Command Line Interface 2.0 (CLI)

Thu, 02 Mar 2017 06:42:01 GMT

I'm a huge fan of the command line, and sometimes I feel like Windows people are missing out on the power of text mode. Fortunately, today Windows 10 has bash (via Ubuntu on Windows 10), PowerShell, and "classic" CMD. I use all three, myself. Five years ago I started managing my Azure cloud web apps using the Azure CLI. I've been a huge fan of it ever since. It was written in node, it worked the same everywhere, and it got the job done. Fast forward to today and the Azure team just announced a complete Azure CLI re-write, and now 2.0 is out, today. Initially I was concerned it had been re-written and didn't understand the philosophy behind it. But I understand it now. While it works on Windows (my daily driver) it's architecturally aligned with Mac and (mostly, IMHO) Linux users. It also supports new thinking around a modern command line with support for things like JMESPath, a query language for JSON. It works well and clearly with the usual suspects of course, like grep, jq, cut, etc. It's easily installed with pip, or you just get Python 3.5.x and then just "pip install --user azure-cli." Linux people (feel free to check the script) can just do this curl, but it's also in apt-get, of course. curl -L | bash NOTE: Since I already have the older Azure CLI 1.0 on my machine, it's useful to note that these two CLIs can live on the same machine. The new one is "az" and the older is "azure," so no problems there. Or, for those of you who run individual Docker containers for your tools (or if you're just wanting to explore) you candocker run -v ${HOME}:/root -it azuresdk/azure-cli-python: Then I just "az login" and I'm off! Here I'll query my subscriptions:C:\Users\scott\Desktop> az account list --output tableName CloudName Sub State IsDefault------------------------------------------- ----------- --- ------- -----------3-Month Free Trial AzureCloud 0f3 EnabledPay-As-You-Go AzureCloud 34c EnabledWindows Azure MSDN AzureCloud ffb Enabled True At this point, it's already feeling familiar. It's "az noun verb" and there's an optional --output parameter. If I don't include --output by default I'll get JSON...which I can then query with JMESPath if I'd like. (Those of us who are older may be having a little XML/XPath/XQuery déjà vu) I can use JSON, TSV, tables, and even "colorized json" or JSONC.C:\Users\scott\Desktop> az appservice plan list --output table AppServicePlanName GeoRegion Kind Location Status-------------------- ---------------- ------ ---------------- --------Default1 North Central US app North Central US ReadyDefault1 Southeast Asia app Southeast Asia ReadyDefault1 West Europe app West Europe ReadyDefaultServerFarm West US app West US ReadymyEchoHostingPlan North Central US app North Central US Ready I can make and manage basically anything. Here I'll make a new App Service Plan and put two web apps in it, all managed in a group:az group create -n MyResourceGroup # Create an Azure AppService that we can use to host multiple web apps az appservice plan create -n MyAppServicePlan -g MyResourceGroup# Create two web apps within the appservice (note: name param must be a unique DNS entry)az appservice web create -n MyWebApp43432 -g MyResourceGroup --plan MyAppServicePlanaz appservice web create -n MyWEbApp43433 -g MyResourceGroup --plan MyAppServicePlan You might be thinking this looks like PowerShell. Why not use PowerShell? Remember this isn't for Windows primarily. There's a ton of DevOps happening in Python on Linux/Mac and this fits very nicely into that. For those of us (myself included) who are PowerShell fans, P[...]

Temporary Fix: Logitech BRIO Camera broken on Windows 10 Insiders 15042

Sat, 25 Feb 2017 06:10:41 GMT

I just updated my Windows 10 to Insiders Fast Build 15042, and suddenly my glorious new Logitech BRIO 4k webcam doesn't work! Well, it's all beta software, but it turns out the issue is with something in the Logitech INF files for their drivers. I'm assuming they'll figure it out, but the nutshell is that the first install works, but the driver gets messed up on the upgrade. You can't just pull out the camera and put it in again, you need to DELETE the drivers and have them redownloaded by Windows Update/Device Manager. Here's a temporary fix (either until Logitech fixes it and it shows up in Windows Update or you take another Windows 10 upgrade): Go to device manager and right click the device and Uninstall Driver. If it has the checkbox "Delete this driver" then check it. That's required. IF (like me) you don't have that checkbox (I'm not sure why I don't) then you'll need to delete the Logitech driver from the DriverStore. You can do it manually but it's tricky and messy and hard. We need to delete this driver so it gets reinstalled cleanly. Unplug your webcam. Then, go get the latest copy of DriverStoreExplorer from here and delete JUST this one driver. Now, go back to Device Manager and plug in your Logitech BRIO webcam. Note you'll get some super old 2006 driver. Right click the BRIO in Imaging Devices and Update Driver. This will get you BACK to your original state. You still have a driver that will break when you next take a "major" Windows update or Insiders Build, but at least you have a solution until it magically gets fixed. Yay! Sponsor: Big thanks to Progress! They recently published a comprehensive whitepaper on The State of C#, discussing the history of C#, what’s new in C# 7 and whether C# is still a viable language. Check it out!© 2017 Scott Hanselman. All rights reserved.       [...]