Brains are funny things

Occasionally, when I’m reading lots of text, my brain will stop braining right and do something stupid. This usually involves taking words from the lines of text above or below the one I’m reading, and inserting those words into the string. Today was an especially interesting example.

I was reading headlines from Slashdot on my RSS reader.  The headlines were:

“Chat with Microsoft Beat Journalist Preston Gralla”
“Former Microsoft Exec to Lead Healthcare.gov”
and “Lawmakers Out To Kill the Corn-Based Ethanol Mandate”

My brain, however, read this:

“Former Microsoft Exec to Kill Journalist Preston Gralla”

I honestly don’t understand how that even happened.

I hate people who use StackOverflow for doing their homework

There was a post in one of the subject areas I monitor on StackOverflow this morning, and it just stinks of someone doing homework for a class they haven’t really been paying attention in.  Without shaming anyone in particular, here’s a similar [but fictional] post:

To anyone familiar with PowerShell, is this a valid variable name?

$[!@*/things] is a valid variable name.

That’s the whole question – conveniently phrases as a true-or-false statement.  You know, like on a homework assignment.

I immediately assumed this was someone doing an assignment or exam for a class they haven’t studied for – or perhaps ever even attended – but I thought that there were also other possible reasons to ask a question like this.  What if their native language isn’t English?  Maybe through some weird translating, the question would end up looking like this?  Yeah, that’s kind of stretch.

Now, there are a couple of ways to discover the answer to this question.  One could search the web for articles about variable names in PowerShell.  One could also look at the PowerShell man pages on variable names directly from a PowerShell prompt.

But there’s an even easier way:  try it out yourself.  And that’s what I recommended in my first response.

Why not open up a PowerShell prompt and try it yourself?

[S]He responded within a minute:

Jerk!  I’m new at this stuff!

Well, OK.  That escalated quickly.  I replied:

I’m not trying to be a jerk, but I don’t understand what’s so hard about opening up a PowerShell prompt and trying this yourself.

And here’s where it becomes pretty obvious that this person isn’t interested in learning anything – they just want their question answered.

Maybe because I’m computer illiterate.

I’ve met plenty of computer illiterate people in my life, and not a single one of them decided to start getting more familiar with these dreadful boxen by learning a scripting language as the first order of business.  I responded:

If you’re computer illiterate, learning PowerShell is probably not a good place to start with getting more acquainted with computers, but here, I’ll walk you through it. Open a PowerShell prompt on your computer, and type this: $[!@*/things] = “foo” Then hit Enter and see if it works.

You’ll notice that I still haven’t answered their question.  Here’s why.

Throughout my life as a “computer guy”, there’s been one persistent theme I’ve noticed in people who are not that tech savvy:  they’re terrified that by clicking the wrong thing or making the wrong choice, they’re going to break something that can never be fixed.

My parents, my friends, and even some of my co-workers have all exhibited this behavior.  And I’m not suggesting that it’s stupid or anything else like that.  I feel exactly the same way about the inner workings of my car – I’m unlikely to touch anything in the engine compartment because I don’t want it to break the whatsits (that’s part of a car, right?).  It’s natural to be hesitant when you’re dealing with something you don’t understand.

But that’s how you learn.  Depending on the exact question, my usual response is “try it and find out”. That’s how I learned everything I know about computers.  I tried it because I got rid of the fear.

So I’m encouraging this person to try it themselves.  Mostly because it would have taken them less time to try it themselves than to post the question to SO.  Also, I’m trying to run out the clock on their take-home exam, or whatever exactly is going on here, because it certainly isn’t someone who wants to learn the subject matter.

After Blogging Mint:

Incidentally, the answer is “no” – It’s not a valid name due to the use of special characters.  In order to make it work, you’d need to use curly braces instead of square brackets, but it would still be a terrible choice for a variable name.

Even After-er Blogging Mint:

The original poster deleted my comments.  Nice.

A Linux Tip from Marc

Marc IM’d me this morning with a quick Linux tip.  I’ve never had to use this – not yet, anyway – but I’m guessing that I will at some point, so I’m saving it here for safe-keeping.

“If you open a file in VIM, work in it, and then find out that you don’t have rights to save it, do:

:w !sudo tee %

and it will write the file out.”

Visual Studio 2012 Unit Tests and IntelliTrace issues

I was working on some unit tests in Visual Studio 2012 at work, and I was having some problems.  So far, this was not significantly different than any other day, but this was a particularly frustrating problem.  Whenever I tried to debug my test to figure out why it wasn’t working, I got a different exception than when I ran the test without debugging.

Wonderful.

The new exception that I was getting looked like this:

Test method SomeNamespace.SomeTestClass.SomeTestMethod threw exception: Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: UnitTestIsolation instrumentation failed to initialize. Please restart Visual Studio and rerun this test.

Long story short, I did this to myself.  See, I like IntelliTrace. It’s neat. And by liking IntelliTrace, I caused this to happen.  So there you have it – just stop liking IntelliTrace, and you’ll be all set.

Actually, no, that’s probably not right.

Because I like IntelliTrace, I customized some of the settings and told it to collect IntelliTrace events and call information, because that’s more information than the default setting give me, which must be a good thing. I’m an American, after all, and more is always better.  Just ask a bald eagle.

Well, it turns out that this is what broke debugging of the unit tests.  I don’t really understand why, but reverting this setting back to the default made everything work again, even if it did make all bald eagles everywhere cry a little bit.

image

Visual Studio 2012^H3 Extensions that I use

Dearest Mike,

You always forget which extensions you install in Visual Studio, too, so I wrote us a list.

Extension Why we like it
.NET Reflector Visual Studio Extension Reflector just plain rocks.  If you need me to tell you why we like this, you need help.
Code Alignment You know how we like to make our code pretty.  This will help us reduce the number of times we have to hit the space bar to make that happen.
Indent Guides It’s nice to have a way to visually light stuff up, dude.  C’mon, you know this.You prefer to set up Page Width markers at columns 80 (no change), 100 (Line Color = Gold), and 120 (Line Color = Red).  You also change Behavior / Visible at Text to enabled.
Microsoft Code Digger Neat utility to help analyze code paths.
Productivity Power Tools 2013 Awesome extensions that will probably be part of future Visual Studio versions.  Love the code map.Also, here’s how we like it to be configured:Automatic Brace Completion, Colorized Parameter Help, Color Printing, Custom Document Well, HTML Copy, Middle-click Scrolling, and Organize VB Imports are all set to OFF.
Visual Studio Achievements Why not?
Serial Capture for Visual Studio Awesome if you’re dealing with SerialPort objects.  Not terribly useful if you aren’t, I suppose.
 Team Foundation Power Tools tf.exe just doesn’t have all of the features I want.  tfpt.exe (despite me always typing tftp.exe instead) does.  Scorch FTW!
 Web Essentials There’s, like, one feature in this whole thing that you use, but it’s worth it.

Your eternal companion,

You.

Turning on whitespace in Visual Studio

Mike, because you always forget this:

To turn on whitespace in Visual Studio, use ((CTRL+R) + (CTRL+W)).  Visual Studio apparently refers to these types of combinations as a chord, which you find comforting for some reason.

And because I’m sure we’re going to want to read this someday, here’s a link to all the shortcut keys in Visual Studio.

Oh, and Mike – you use the Visual C# 2005 keybindings.

Love, you.

 

 

sudo reboot

It’s not often that a blog gets rebooted… actually, that’s probably a complete fabrication.  I’m sure blogs do this all the time in an effort to “find themselves” or something like that.  I’ve been running BBG for slightly over a decade, and it’s time for another reboot because I’ve decided that I need to “find myself” again.  This will be the third – or fourth, depending on who you ask – reboot of the site since I initially launched it all those years ago.

Over the course of that decade, BBG has been many things – a place for me to test an ASP.NET blogging engine I was writing, a group blog from my friends, a soapbox for me, a place to write techie articles, and a place to post whatever drivel I thought was funny at the time.  So what comes next?

No idea.  Let’s find out.