Scott Hanselman

Creating a question friendly environment

November 05, 2020 Comment on this post [0] Posted in Musings
Sponsored By

christina-wocintechchat-com-MkxWUzCuYkE-unsplashA few years back I had a lovely podcast conversation with technical leader Keavy McMinn.

Sometimes I wonder if anyone listens to the show. Then a nice comment will come in when someone listen to an episode years ago and is still thinking about particular quote or line.

Last week I got an email asking about a blog post or podcast that I might have written, and the person wanted me to dig up the quote on a specific topic. It turns out it was from that podcast episode with Keavy. Keavy talks a lot about technical leadership on her blog and you should check it out.

I recently added Transcripts to all 400 HOURS of the podcast and you can search the entire 15 year episode archive in one place at Podscribe!

One of the topics around leadership I've been thinking about a lot lately is how to make work a "question friendly environment." You may hear the term "safe space" to refer to this kind of thing.

"We are missing out on valuable opportunities to connect and grow in our understanding of people if we aren’t giving one another permission to ask each other ignorant questions" - from Viewpoint

Some people come up at your later in career might say, "you should just ask your question don't be a wimp." However, when we do this I think we forget what it was like to be just a few years out of school. You know you don't know anything, but you really don't know how much you don't know.

In my opinion, the number one thing that we can do make more senior engineers, is to give the junior engineers a really good place to ask lots of dumb questions. That means replying to them with patience, providing them with resources to learn and explore, not scoffing or rolling our eyes. You too were once early in career, Dear Reader. Being given a place and permission to ask questions without judgment is a huge gift!

Permission to ask

As a manager, we need to explicitly offer the permission to ask. Talk about permission to ask questions up front, and model that behavior so that others know it's OK. Make sure that folks know you're not going to "flip the bozo bit" just because someone asked a question about DNS.

From Scott Ginsberg, If you want to build this type of environment, there are four key tasks ahead:

1. List the reasons why employees might (not) ask questions.
2. Maintain a question-friendly attitude.
3. Affirm your employees when they ask questions.
4. Reinforce a question-friendly environment.

Make it so that questions can also be asked anonymously. Take their technical questions and consider them from their perspective. They may be missing historical context but they add a new diverse point of view or a fresh technical spin.

What are you doing in your technical teams and at your company to make sure that folks feel they can ask technical questions without judgment?


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

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

How to allow executable .exe files to be downloaded with ASP.NET Core and UseStaticFiles middleware

November 03, 2020 Comment on this post [9] Posted in ASP.NET | DotNetCore
Sponsored By

In the long process of upgrading this blog and moving it to Azure I've been slowly fixing small bugs and also dealing with the dozens of microsites I have hanging off of hanselman.com. Some were forgotten, and some just keep chugging along. https://www.babysmash.com/ is one of them.

BabySmash is a silly WPF app I wrote 15 years ago for my baby, natch. He's now learning to drive a car, but it still gets thousands of downloads a month. The code is on Github.

The ClickOnce application and manifests hangs off of http://hanselman.com/babysmash, but the /setup.exe returns a 404.

I had assumed that using this simple code in my Startup.cs's Configure() method would enable static files like setup.exe:

app.UseDefaultFiles();
app.UseStaticFiles();

This was naive I suppose as ASP.NET Core is very much locked down by default so you are really encouraged to be specific and there are few unsafe defaults.

UseStaticFiles includes a parameter for options, so I needed to update the list of mappings from extension to mime/type. So this little helper function:

private StaticFileOptions GetStaticFileOptions()
{
var p = new FileExtensionContentTypeProvider();
p.Mappings[".exe"] = "application/octet-stream";
return new StaticFileOptions { ContentTypeProvider = p };
}

and then you pass that StaticFileOptions class into UseStaticFiles.

app.UseStaticFiles(GetStaticFileOptions());

Clearly a "secure by default" decision, but also one that's easily extended for my needs.


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

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

Using an Xbox Adaptive Controller and Xbox Copilot to get back into gaming after surgery

October 29, 2020 Comment on this post [0] Posted in Gaming
Sponsored By

Xbox Adaptive Controller addonsThanks for the kind words on my post earlier this week. Lots of great tips both in the comments and were sent to me privately. I'm still alternating meds, struggling at physical therapy every day, but I'm fortunate to have my wife (a medical/surgical nurse) here to tell me when it's supposed to hurt and when it's not.

That said, BEFORE the pain started I had a nerve block in my neck and my right side was basically "turned off" for a week. It's definitely preferable to the current pain situation but one of the bright spots is that it give me extreme compassion for those who are missing or unable to use one or more limbs.

I was hoping to use some of my convalescent time to play Xbox but I quickly discovered that it's VERY hard to play a FPS (first-person shooter) with one hand. Of course, tell an engineer that they can't do something and they'll just take it as a challenge, right?

I happened to have an Xbox Adaptive Controller (I bought a few just in case I wanted to set up some relatives or new friends who might need one, never realizing it would be me that needed one) so I hooked it up and tried to figure out how I could game given my paralyzed arm and a lot of free time.

The easiest and clearest way I can example the Xbox Adaptive Controller this - It's an Xbox Controller that pairs and talks to an Xbox like any other controller...but it's not a controller.

It's an Xbox Adaptive Controller Construction Kit.

It has headphone jacks - just 1/8" standard jacks - for every possible input, along with USB ports for Joysticks. You build - adapt - a controller that's ideal for you! It's magical.

Then, combine it with built in Xbox software called Copilot and you can link two controllers so that two can play as one. I was able to use an a standard Xbox Controller in my left hand while using the Xbox Adaptive Controller with my feet. Within an hour I was playing Call of Duty quite competently, I might say.

I even recorded it and put it in my YouTube so I have proof that I got at least one shot in during this round, LOL.

Go learn all about it, the Xbox Adaptive Controller is an extraordinary advice. Then go set it up for a friend or family member, they'll appreciate it very much.

Please take a moment to explore and subscribe to my YouTube. I'm nearing 100k subscribers there and I was told there would be snacks.


Sponsor: Need a multi-cluster load balancer and API gateway? Try VoltMesh: built for modern and distributed apps that require automation, performance and visibility. Start for free today.

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

How to deal with Extreme Physical Pain

October 27, 2020 Comment on this post [53] Posted in Musings
Sponsored By

francisco-gonzalez-M8UEJd58GcE-unsplashI'm in a LOT of pain right now. It's hard to say that, especially considering that everyone experiences pain be it emotional or physical. I don't want to make unneeded comparisons or consider my pain as being more important than anyone else's. I'm not burned. I'm not dying of cancer. I am blessed.

But I'm hurting. A lot. It's mine and it's now and it's not clear when it will stop.

It's hard to think. It's hard to move. I can't sleep. Oxycodone makes me feel sick. Advil does nothing.

I've just had my second frozen shoulder surgery (adhesive capsular release) in 4 years. Frozen shoulder is idiopathic (who knows why it happen) and it's known to be quite painful. I can attest that it is. I've been unable to move my right arm for nearly a year. Not just that I couldn't move it, I mean it couldn't be moved by anyone. I couldn't fit the deodorant in to my armpit because the whole joint was hardened.

I had cortisone shots. No result. I finally had formal capsular release surgery where the surgeon goes in there and tidies up, removes scar tissue.

Then the months of physical therapy and forced stretching starts.

I'm going to physical therapy five days a week for an hour a day, and working at home stretching myself for an other 1-2 hours. It's overwhelming and consuming. I just want to be able to pick up a cup from a high shelf. I have basic arm-usage requirements. This is going to be a marathon, and this is the second time this has happened.

Why am I telling you this?

A few reasons. I need the outlet. It's my blog. Because I appreciate you all and you've been here, some of you, for nearly 20 years. Not everything is code.

I had a nerve block in my neck that turned off my right side for a week. That was an extraordinary experience as it was an opportunity to experience a significant, albeit temporary, physical disability. Before I had no ability to move my arm but I had feeling. Now I had zero use of my right arm. It was a numb cadaver arm - dangerously dead weight. I used the time to play Xbox with my feet using the Xbox Adaptive Controller.

This nerve block is wearing off and it's gone from itching, to tingling, to the feeling of an ice pick shoved into my deltoid and armpit every few minutes.

I burst into tears at physical therapy today. The year just hit me all at once. It hurts. Between diabetes and this temporary paralysis, it’s been a week. 2020 is ass. It’s OK. Happens a few times a decade. Maybe it happens to you twice a week. Let it out, listen to your body.

Why am I telling you this?

It's OK to tell people you hurt. You're human. Talk about your pain. Cry. Yell. Sob. Talk some more.

When I'm done yelling, I'm trying to sit quietly and meditate about this pain. What is it trying to tell me? Can I mentally follow the nerve from the location (referred pain or otherwise) to my brain and determine what the body wants me to know? Am I being told there's danger?

I'm finding that there is soft tissue tolerance - what I can handle - and that doesn't always line up with what I'm feeling. I'm feeling near intolerable pain in PT (physical therapy). Like torture with an unknown end date, it's taken me to the level of pain where vomiting is the only escape and then it starts again. However, I persist. I breathe. I try to listen and trust the process and know that if I want to regain the full use of my arms, this is a medically known and studied process. Physical therapy works if you do it.

The cognitive dissonance is overwhelming. Your body says you're actively dying but your conscious brain can - must - override it and let the pain flow freely. You observe it, rather than obstruct it.

I hate this process but I'm going to learn from it. I'm learning and listening to my body and how I react to something so extreme.

The pain is important to acknowledge because this pain is gonna make me better and stronger. But it still hurts. Here we go.

I hope that you, Dear Reader, are not in pain. But if you are, I hope it passes and that you come out better on the other side. I'm going to use this Bad Input for Good.

BTW: Thanks to Volterra for sponsoring the blog this week. I suspect they didn't know what blog post(s) their ad would land on, but I appreciate their support and understanding as not every blog post is about code. This one is about people and their pain. Give them a click.


Sponsor: Need a multi-cluster load balancer and API gateway? Try VoltMesh: built for modern and distributed apps that require automation, performance and visibility. Start for free today.

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

Using the ASP.NET Core Environment Feature to manage Development vs. Production for any config file type

October 22, 2020 Comment on this post [4] Posted in ASP.NET
Sponsored By

ASP.NET Core can understand what "environment" it's running under. For me, that's "development," "test," "staging," "production," but for you it can be whatever makes you happy. By default, ASP.NET understand Development, Staging, and Production.

You can the change how your app behaves by asking "IsDevelopment" to do certain things. For example:

if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

if (env.IsProduction() || env.IsStaging() || env.IsEnvironment("Staging_2"))
{
app.UseExceptionHandler("/Error");
}

There are helpers for the standard environments, or I can just pass in a string.

You can also make Environmental decisions with taghelpers like this in your Views/Razor Pages. I did this when I dynamically generated my robots.txt files:

@page
@{
Layout = null;
this.Response.ContentType = "text/plain";
}
# /robots.txt file for http://www.hanselman.com/
User-agent: *
<environment include="Development,Staging">Disallow: /</environment>
<environment include="Production">Disallow: /blog/private
Disallow: /blog/secret
Disallow: /blog/somethingelse</environment>

This is a really nice way to include things like banners or JavaScript when your site is running in a certain environment. These are easily set as environment variables if you're running in a container. If you're running in an Azure App Service you set the environment from the Config blade:

Now that I've moved this blog to Azure, we have a number of config files that are specific to this blog. Since the configuration features of ASP.NET are so flexible it was easy to extend this idea of environments to our own config files.

Our Startup class sets up the filesnames of our various config files. Note the second line, if we have no environment, we just look for the regular file name.

public Startup(IWebHostEnvironment env)
{
hostingEnvironment = env;

var envname = string.IsNullOrWhiteSpace(hostingEnvironment.EnvironmentName) ?
"." : string.Format($".{hostingEnvironment.EnvironmentName}.");

SiteSecurityConfigPath = Path.Combine("Config", $"siteSecurity{envname}config");
IISUrlRewriteConfigPath = Path.Combine("Config", $"IISUrlRewrite{envname}config");
SiteConfigPath = Path.Combine("Config", $"site{envname}config");
MetaConfigPath = Path.Combine("Config", $"meta{envname}config");
AppSettingsConfigPath = $"appsettings.json";

...

Here's the files in my Visual Studio. Note that another benefit of this naming structure is that the files nest nicely underneath their parent file.

Nested config files

The formalization of environments is not a new thing, but the adoption of it deeply into our application at every level has allowed us to move from dev to staging to production very easily. It's very likely that you have done this in your application, but you may have rolled your own solution. Take a look if you can remove code and adopt this built in technique.

Here's some articles I've already written on the subject of moving this blog to the cloud:

If you find any issues with this blog like

  • Broken links and 404s where you wouldn't expect them
  • Broken images, zero byte images, giant images
  • General oddness

Please file them here https://github.com/shanselman/hanselman.com-bugs and let me know!


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

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.