Scott Hanselman

Psychic Weight - Dealing with the things that press on your mind

August 24, 2016 Comment on this post [42] Posted in Musings
Sponsored By
Close up view of man on his phone 

I was really stressed out ten years ago. I felt that familiar pressure between my eyes and felt like all the things that remained undone were pressing on me. I called it "psychic weight." I have since then collected my Productivity Tips and written extensively on the topic of productivity and getting things done. I'm going to continue to remind YOU that Self-Care Matters in between my technical and coding topics. The essence of what I learned was to let go.

The Serenity Prayer:

God, grant me the serenity to accept the things I cannot change,
Courage to change the things I can,
And wisdom to know the difference.

Everyone has stress and everyone has pressure. There's no magic fix or silver bullet for stress, but I have found that some stressors have a common root cause. Things that stress me are things I think I need to do, handle, watch, take care of, worry about, sweat, deal with, or manage. These things press on me - right between my eyes - and the resulting feeling is what I call psychic weight.

For example: When the DVR (Digital Video Recorder) came out it was a gift from on high. What? A smart VCR that would just tape and hold all the TV Shows that I love? I don't have to watch shows when the time and day the shows come on? Sign me up. What a time saver!

Fast forward a few years and the magical DVR is now an infinite todo list of TV shows. It's a guilt pile. A failure queue. I still haven't watched The Wire. (I know.) It presses on me. I've actually had conversations with my wife like "ok, if we bang out the first season by staying up tonight until 4am, we should be all ready when Season 2 drops next week." Seriously. Yes, I know, Unwatched TV is a silly example. But you've binge-watched Netflix when you should have been working/reading/working out so you can likely relate.

But I'm letting go. I'll watch The Wire another time. I'll delete it from my DVR. I'm never going to watch the second season of Empire. (Sorry, Cookie. I love you Taraji!) I'm not going to read that pile of technical books on my desk. So I'm going to declare that to the universe and I'm going to remove the pile of books that's staring at me. This book stack, this failure pile is no more. And I'm not even mad. I'm OK with it.

Every deletion like this from your life opens up your time - and your mind -for the more important things you need to focus on.

What are your goals? What can you delete from your list (and I mean, DROP, not just postpone) that will free up your internal resources so you can focus on your goal?

Delete those emails. Declare email bankruptcy. They'll likely email you again. Delete a few seasons of shows you won't watch. Delete Pokemon Go. Make that stack of technical books on your desk shorter. Now, what positive thing will you fill those gaps with?

You deserve it. Remove psychic weight and lighten up. Then sound off in the comments!

* Image Copyright Shea Parikh / used under license from getcolorstock.com


Sponsor: Aspose makes programming APIs for working with files, like: DOC, XLS, PPT, PDF and countless more.  Developers can use their products to create, convert, modify, or manage files in almost any way.  Aspose is a good company and they offer solid products.  Check them out, and download a free evaluation.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Announcing PowerShell on Linux - PowerShell is Open Source!

August 18, 2016 Comment on this post [28] Posted in Open Source | PowerShell
Sponsored By

I started doing PowerShell almost 10 years ago. Check out this video from 2007 of me learning about PowerShell from Jeffrey Snover! I worked in PowerShell for many years and blogged extensively,  ultimately using PowerShell to script the automation and creation of a number of large systems in Retail Online Banks around the world.

Fast forward to today and Microsoft is announcing PowerShell on Linux powered by .NET Core and it's all open source and hosted at http://GitHub.com/PowerShell/PowerShell.

Holy crap PowerShell on Linux

Jeffrey Snover predicted internally in 2014 that PowerShell would eventually be open sourced but it was the advent of .NET Core and getting .NET Core working on multiple Linux distros that kickstarted the process. If you were paying attention it's possible you could have predicted this move yourself. Parts of PowerShell have been showing up as open source:

Get PowerShell everywhere

Ok, but where do you GET IT? http://microsoft.com/powershell is the homepage for PowerShell and everything can be found starting from there.

The PowerShell open source project is at https://github.com/PowerShell/PowerShell and there are alphas for Ubuntu 14.04/16.04, CentOS 7.1, and Mac OS X 10.11.

To be clear, I'm told this is are alpha quality builds as work continues with community support. An official Microsoft-supported "release" will come sometime later.

What's Possible?

This is my opinion and somewhat educated speculation, but it seems to me that they want to make it so you can manage anything from anywhere. Maybe you're a Unix person who has some Windows machines (either local or in Azure) that you need to manage. You can use PowerShell from Linux to do that. Maybe you've got some bash scripts at your company AND some PowerShell scripts. Use them both, interchangeably.

If you know PowerShell, you'll be able to use those skills on Linux as well. If you manage a hybrid environment, PowerShell isn't a replacement for bash but rather another tool in your toolkit. There are lots of shells (not just bash, zsh, but also ruby, python, etc) in the *nix world so PowerShell will be in excellent company.

PowerShell on Windows

Related Links

Be sure to check out the coverage from around the web and lots of blog posts from different perspectives!

Have fun! This open source thing is kind of catching on at Microsoft isn't it?


Sponsor: Do you deploy the same application multiple times for each of your end customers? The team at Octopus have been trying to take the pain out of multi-tenant deployments. Check out their 3.4 beta release.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Visual Studio's most useful (and underused) tips

August 17, 2016 Comment on this post [93] Posted in VS2015
Sponsored By

There was a cool comment in my last blog post (one of many, as always, the comments > the content).

Btw, "until I realized that the Solution Explorer tree nodes are searchable." This one is a saver!

The commenter, Sam, noticed a throwaway bit in the middle of the post where I noted that the Solution Explorer was text-searchable. There's a lot of little tricks like this in Visual Studio that even the most seasoned developers sometimes miss. This phenomenon isn't limited to Visual Studio, of course. It's all software! Folks find non-obvious UX all the time in Windows, OSX, iPhone, everyday. If UX were easy then everything would be intuitive but it's not so it ain't. ;)

There's an old joke about Microsoft Office, which is known for having a zillion features.

"Most of the exciting new Office features you discover have always been in Office." - Me and Everyone Else

Here's some exceedingly useful stuff in Visual Studio (It's free to download and use, BTW) that folks often miss.

Search Solution Explorer with Ctrl+;

You can just click the text box above the Solution Explorer to search all the the nodes - visible or hidden. Or, press "Ctrl + ;"

Ctrl ; will filter the Solution Explorer

Even stuff that's DEEP in the beast. The resulting view is filtered and will remain that way until you clear the search.

Ctrl ; will filter the Solution Explorer and open subnodes

Quick Launch - Ctrl+Q

If there is one feature that no one uses and everyone should use, it's Quick Launch. Someone told me the internal telemetry numbers show that usage of Quick Launch in the single digits or lower.

Do you know that you (we) are constantly digging around in the menus for stuff? Most of you use the mouse and go Tools...Options...and stare.

Just press Ctrl+Q and type. Need to change the Font Size?

Find the Fonts Dialog quickly

Want to Compare Files? Did you know VS had that?

Compare Files

What about finding a NuGet package faster than using the NuGet Dialog?

image

Promise me you'll Ctrl+Q for a few days and see if you can make it a habit. You'll thank yourself.

Map Mode for the Scroll Bar

I love showing people features that totally surprise them. Like "I had NO IDEA that was there" type features. Try "map mode" in the Quick Launch and turn it on...then check out your scroll bar in a large file.

Map Mode for the Scroll Bar

Your scrollbar will turn into a thumbnail that you can hover over and use to navigate your file!

Map Mode turns your Scrollbar into a Scroll Thumbnail

Tab Management

Most folks manage their tabs like this.

  • Open Tab
  • Repeat
  • Declare Tab Bankruptcy
  • Close All Tabs
  • Goto 0

But you DO have both "pinned tabs" and "preview tabs" available.

Pin things you want to keep open

If you pin useful tabs, just like in your browser those tabs will stay to the left and stay open. You can not just "close all" and "close all but this" on a right click, but you can also "close all but pinned."

image

Additionally, you don't always have to double-click in the Solution Explorer to see what's in a file. That just creates a new tab that you're likely going to close anyway. Try just single clicking, or better yet, use your keyboard. You'll get a preview tab on the far right side. You'll never have more than one and preview tabs won't litter your tab list...unless you promote them.

Navigate To - Ctrl+, (Control+Comma)

Absolutely high on the list of useful things is Ctrl+, for NavigateTo. Why click around with your mouse to open a file or find a specific member or function? Press Ctrl+, and start typing. It searches files, members, type...everything. And you can navigate around with your keyboard before you hit enter.

There's basically no reason to poke around in the Solution Explorer if you already know the name of the item you want to see. Ctrl+, is very fast.

image

Move Lines with your keyboard

Yes I realize that Visual Studio isn't Emacs or VIM (unless you want it to be VsVim) but it does have a few tiny tricks that most VS users don't use.

You can move lines just by pressing Alt-up/down arrows. I've never seen anyone do this in the wild but me. You can also Shift-Select a bunch of lines and then Alt-Arrow them around as a group.

Move those lines with ALT-ARROW

You can also do Square Selection with Alt and Drag...and drag yourself a nice rectangle...then start typing to type on a dozen lines at once.

Perhaps you knew these, maybe you learned a few things. I think the larger point is to have the five to ten most useful features right there in your mind ready to go. These are mine. What are your tips?


Sponsor: Do you deploy the same application multiple times for each of your end customers? The team at Octopus have been trying to take the pain out of multi-tenant deployments. Check out their 3.4 beta release.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Visual Studio 2015 - Fixing "Dependencies npm not installed" from fsevents with node on Windows

August 14, 2016 Comment on this post [31] Posted in ASP.NET | nodejs
Sponsored By

Maria and I were doing some work together on Thursday and I did a clone of one of her ASP.NET Core repositories and opened it in Visual Studio 2015 Community Edition on my local machine. Some of the JavaScript tool libraries didn't load so I went back into Solution Explorer to see if there was a problem and I saw this weird error that said (or at least, I read it as) "npm not installed."

image

That's weird, since I have npm installed. I dropped out to the command line and ran:

C:\Users\scott>npm --version
3.10.5

I also ran "where" to see where (and how many) npm was installed. Side note: WHERE is super useful and not used as often as it should be by y'all.

C:\Users\scott>where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
C:\Users\scott\AppData\Roaming\npm\npm
C:\Users\scott\AppData\Roaming\npm\npm.cmd

This looks OK as two of those npms are shell scripts and not run on Windows. Just to make sure you have the version of npm you want, Felix made a VERY useful npm-windows-upgrade utility that you run like this, ironically with npm.

npm install --global --production npm-windows-upgrade
npm-windows-upgrade

I've used this tool many times with success. It also lets you choose the exact version you want and it's very smart.

However, then I realized that Visual Studio wasn't saying that npm wasn't installed, it was saying a dependency in the npm tree below wasn't installed. That hyphen - is intended to mean something. For the record, I think this is not intuitive and is a poor UX. Perhaps it should say "package(s) not installed" but you get the idea now.

I started manually opening the tree up one item at a time looking for the bad package - while quietly swearing to myself - until I realized that the Solution Explorer tree nodes are searchable.

image

This is UX issue number two, for me. I think the "broken" library should also include the BANG (!) or warning icon over it. Regardless, now I know I can quickly do a string search.

So what's up with the fsevents library?

I can check the Visual Studio Output Window and I see this:

npm WARN install Couldn't install optional dependency: Unsupported
npm WARN EPACKAGEJSON asp.net@0.0.0 No description

I dropped out to the command prompt into to the project's folder and run "npm ls" to see an ASCII tree that effectively is the same tree you see in Visual Studio. Note the screenshot with the ASCII tree below.

The output of "npm ls" is a nice ASCII tree

What's that "UNMET OPTIONAL DEPENDENCY?" for fsevents?

Looks like fsevents is a package that is only used on OSX, so it's an optional dependency that in the case of Windows is "unmet." It's a WARNING, of sorts. Perhaps it's more an "INFO" or perhaps, one could argue, it doesn't need to be shown at all on Windows.

A quick google shows that, well, the entire world is asking the same thing. So much so that it got pretty heated in this GitHub Issue asking a similar question.

Regardless, it seems to me that something inside Visual Studio really doesn't appreciate that warning/info/notOKness and says, "hey it's not installed." The part that is missing is that, well, it doesn't need to be installed, so Visual Studio should relax.

A Fix

Here's where it gets super interesting. Visual Studio (consider it from their point of view) needs to keep things consistent so it tests with, and ships with, a version of npm.

I can check that like this:

C:\>"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\npm.cmd" --version
3.3.4

Again, this makes sense. That way when working in a large group we can all be sure we're on the same version of stuff. When you get a new version of the Web Tools for Visual Studio, presumably this version of npm gets updated. This also means that unless you tell Visual Studio otherwise, the npm and node you get when running a build in VS is gonna be different than if you do it outside - if you stick with the default settings.

Fear not. It's easily updated. I went over to Tools | Option in Visual Studio:

Tools | Options | External Web Tools has its own list of node copies, and it doesn't include mine

See the Web\External there? I added my node installation like this and made sure it was at the top.

Tools | Options | External Web Tools has its own list of node copies, and I have ADDED my path now.

Then I right click on npm and Restore Packages and all is right with the world as now I'm using npm 3.10.5 rather than 3.3.4.

There are no npm errors anymore

The Output Window for 3.10.5 shows this different output, which apparently stresses Visual Studio out less than npm 3.3.4. (Actually I think VS is calling an npm library, rather than shelling out and parsing the "npm ls --json" payload, but you get the idea.)

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14

Adding my global npm/node folder fixes this issue for me and I can move on.

The Weird

BUT. In my fix I'm using npm globally - it's in my %PATH%. The change I made affects all Visual Studio projects on my machine, forever.

Maybe I need to be smarter? Maybe Visual Studio is already being smart. Note the second option there in the list? It's pointing to .\node_modules\bin. That's a LOCAL node-modules folder, right? Ah, I can just add specific version of npm to packages.json there if need be on a project by project basis without affecting my entire system OR changing my Visual Studio settings, right?

However, when I run my build, it's ignoring my project's locally installed npm!

PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\npm.CMD" install
npm WARN install Couldn't install optional dependency: Unsupported
npm WARN EPACKAGEJSON asp.net@0.0.0 No description
npm WARN EPACKAGEJSON asp.net@0.0.0 No repository field.
npm WARN EPACKAGEJSON asp.net@0.0.0 No license field.

How can I be sure it's ignoring that relative path? I can temporarily hardcode my local node_modules, like this. Note the PATH *and* the newer output. And it works.

PATH=D:\github\sample-NerdDinner\NerdDinner.Web\node_modules\.bin;node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
"D:\github\sample-NerdDinner\NerdDinner.Web\node_modules\.bin\npm.CMD" install
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14
npm WARN asp.net@0.0.0 No description
npm WARN asp.net@0.0.0 No repository field.
npm WARN asp.net@0.0.0 No license field.

In this screenshot below I have npm 3.10.6 installed in my project, locally, but it's not being used by Visual Studio if the path remains relative.

I am 99% sure that the relative path ".\node_modules\.bin" that's prepended to the PATH above either isn't being used OR is interfering in some way.

Am I misunderstanding how it should work? Perhaps I don't understand npm enough?

image

I'm going to continue to dig into this and I'll update this post when I have an answer. For now, I have a fix given my globally installed npm.

I've also passed my feedback/bug report onto the Visual Studio team in the form of an email with a link to this blog post. I hope this helps someone!


Sponsor: Big thanks to Redgate for sponsoring the feed this week. Could you deploy 1,000 databases?Imagine working in a 70-strong IT team, with 91 applications and 1,000+ databases. Now imagine deployment time. It’s not fiction, it’s fact. Read FlexiGroup's story.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Two tools for quick and easy web application load testing during development

August 10, 2016 Comment on this post [21] Posted in Open Source
Sponsored By

I was on the ASP.NET Community Standup this morning and Jon mentioned a new tool for load testing called "Netling." This got me to thinking about simple lightweight load testing in general. I've used large enterprise systems like SilkTest  as well as the cloud based load testing tools like those in Azure and Visual Studio. I've also used command-line tools like WCAT, an old but very competent load testing tool.

I thought I'd take a moment and look at two tools run locally. The goal is to see how easily I can do quick load tests and iterate on the results.

Netling

Netling is by Tore Lervik and is a nice little load tester client for easy and quick web testing. It's open source and on GitHub which is always nice. It's fun to read other people's code.

Netling includes both a WPF and Console client and is cleanly factored with a Core project that does all the work. With the WPF version you do test and then optionally mark that test as a baseline. Then you can make small changes as you like and do a quick retest. You'll get red (bad) or green (good) results if things get better. This should probably be adjusted to ensure it is visible for those with red-green color blindness. Regardless, it's a nice clean UI and definitely something you'll want to throw into your utilities folder and call upon often!

Do remember that it's not really nice to do load testing on web servers that you don't own, so be kind.

Note that for now there are no formal "releases" so you'll need to clone the repo and build the app. Fortunately it builds very cleanly with the free version of Visual Studio Community 2015.

Netling is a nice load tester for Windows

The Netling console client is also notable for its cool ASCII charts.

D:\github\Netling\Netling.ConsoleClient\bin\x64\Debug [master ≡]> .\netling.exe http://www.microsoft.com -t 8 -d 20

Running 20s test @ http://www.microsoft.com/
Threads: 8
Pipelining: 1
Thread afinity: OFF

1544 requests in 20.1s
Requests/sec: 77
Bandwidth: 3 mbit
Errors: 0
Latency
Median: 99.876 ms
StdDev: 10.283 ms
Min: 84.998 ms
Max: 330.254 ms





██
███
████████████████████ █ █ █
84.998 ms =========================================================== 330.254 ms

D:\github\Netling\Netling.ConsoleClient\bin\x64\Debug [master ≡]>

I'm sure that Tore would appreciate the help so head over to https://github.com/hallatore/Netling and file some issues but more importantly, perhaps chat with him and offer a pull request?

WebSurge

WebSurge is a more fully featured tool created by Rick Strahl. Rick is known in .NET spaces for his excellent blog. WebSurge is a quick free download for personal use but you should register it and talk to Rick if you plan on using it commercially or a lot as an individual.

WebSurge also speaks the language of the Fiddler Web Debugging Proxy so you can record and playback web traffic and generate somewhat sophisticated load testing scenarios. The session files are just test files that you can put in source control and share with other members of your team.

image

I realize there's LOT of choices out there.  These are just two really quick and easy tools that you can use as a developer to easily create HTTP requests and then play back at will and iterate during the development process.

What do YOU use for load testing and iterating on performance during development? Let us all know in the comments.


Sponsor: Big thanks to Redgate for sponsoring the feed this week. Could you deploy 1,000 databases? Imagine working in a 70-strong IT team, with 91 applications and 1,000+ databases. Now imagine deployment time. It’s not fiction, it’s fact. Read FlexiGroup's story.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.