Scott Hanselman

Towards a better console - PSReadLine for PowerShell command line editing

September 25, '14 Comments [19] Posted in Open Source | PowerShell
Sponsored By

Sometimes textmode is where it's at. I've long blogged about tools and techniques that will make your Windows console experience better. Perhaps you're a *nix person who is using Windows in your day job, or you wish the Windows PowerShell prompt was more nix-y. Or perhaps you're a PowerShell person who wants to take your command-line to the next level.

Well, just as NuGet is how we get .NET libraries quickly, and Chocolately is a kind of apt-get for Windows, PsGet is a way to easily add PowerShell modules to your prompt.

To install PsGet you run this script (feel free to vet it):

(new-object Net.WebClient).DownloadString("") | iex

Once you've got PsGet, the purpose of this post is to introduce you to PSReadLine.

To install PsReadLine with PsGet, just

install-module PsReadLine

If you want to install PsReadLine manually, you can from their readme. It does a LOT:

PsReadLine replaces the command line editing experience in PowerShell.exe. It provides:

  • Syntax coloring
  • Simple syntax error notification
  • A good multi-line experience (both editing and history)
  • Customizable key bindings
  • Cmd and emacs modes (neither are fully implemented yet, but both are usable)
  • Many configuration options
  • Bash style completion (optional in Cmd mode, default in Emacs mode)
  • Bash/zsh style interactive history search (CTRL-R)
  • Emacs yank/kill ring
  • PowerShell token based "word" movement and kill
  • Undo/redo
  • Automatic saving of history, including sharing history across live sessions
  • "Menu" completion (somewhat like Intellisense, select completion with arrows) via Ctrl+Space

But it doesn't replace it in a scary "moved my cheese" way, but in a comfortable familiar way, similar to how Bash works now. It will add things that you WILL miss when you move to another machine that doesn't have PsReadline. If you are already comfortable (or learning) PowerShell, this will feel comfortable immediately. It's not Dvorak. ;)

Some cool PsReadLine examples

Syntax coloring for things like keywords (cd) and common commands (git):

Syntax coloring with PSReadline

PowerShell often has you opening parentheses, brackets and things, and then you have to count them to close them. PsReadLine helps with that also:

Not only does it give you nice syntax-highlighting for things like function building, it also shows me with the red > that I haven't closed the block.

Forgot to close the block

When you are editing a multi-line script, you can also now backup to other lines!

multiline editing with PSReadline

If you are typing something like Get-Process and either want to autocomplete switches, or autocomplete results, you can press Ctrl-Space:


If you're advanced, check out get-PSReadlineKeyHandler and not only look at what functions are bound to which hotkeys, BUT also check out all the functions that AREN'T bound. You have a lot of power for customization here!


You can even set Emacs keybindings!

Set-PSReadlineOption -EditMode Emacs

Go check out on GitHub and give it a star!

Related Links

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Jump-Location - A Change Directory (CD) PowerShell Command that reads your mind

September 18, '14 Comments [26] Posted in Tools
Sponsored By

There's a lovely little utility called autojump for *nix consoles that makes the 'cd' command very smart. More that just auto-completion, it's a kind of "auto guessing." Hence, autojump. There is some beginning Windows support, but instead I turned to Tim Kellogg's open source PowerShell implementation "Jump-Location."

What a joy.

j this and j that

First, I was like "jump-location?" I'm not going to type that. But then, of course, duh. Aliases.

Jump-Location is aliased to just j, which means I can now do awesome stuff like this:

c:\> j sc
c:\users\scott> j g
c:\users\AppData\Local\GitHub> j des

But there's more. It's actually watching how long you are in a directory and keeping stats. You can see the weighted stats with "jumpstat" and the "database" is just a text file in ~\jump-location.txt.

If "j d" isn't enough to get me into C:\GitHub\DisProject then I can do "j g d" and I'm there. It's amazing.

Installation is easy, and I hope it gets on PsGet soon for even easier installation. Just unzip, unblock, ensure that your PowerShell execution policy allows scripts, and run ./install.ps1.

NOTE: Don't run install from your desktop, or a temp folder. Put the Jump-Location folder somewhere where it will live, and it's going to add a line like this to your user profile ("C:\Users\YOU\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1")  like this, so you'll want to install from a final path:

Import-Module 'C:\Users\Scott\Dropbox\utils\Jump-Location-0.5.1\Jump.Location.psd1'

I'm excited about this great little utility. Head over to and STAR it in GitHub, and give it a go! Tim, the author, is on Twitter at @kellogh. Other contributors include Sergey Vorobyev.

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

iOS8 3rd Party Keyboards Reviews - SwiftKey and Swype

September 18, '14 Comments [29] Posted in Reviews
Sponsored By

I've been running iOS8 for a while now in Beta, and today all my iDevices are running the released iOS 8. One of the most anticipated new features is the ability to create and add 3rd party keyboards. In the future I anticipate we'll see lots of interesting and creative keyboards, perhaps to draw an emoji with your finger, custom Chinese or Japanese IMEs (input method editors), and others.

Until then, the primary thing folks have been waiting for is what Android and now Windows Phone have had for a while, the ability to type without lifting your thumb. You'll either love it or hate it, but you need to try it for a day. When done well, it's amazing and brilliant.

The Hassle of the Setup Process

3rd Party Keyboards install from the AppStore like any other app. When you run each for the first time they walk you through the process of installing their keyboard. This is easy for a techie, but for your non-Technical Relatives it might take a little coaching as you'll end up 3 or 4 deep inside Settings | General | Keyboards.

Multiple Keyboards

Swype - US$0.99

Swype worked great, exactly as advertised. I enjoyed using it very much and it's swiping feature works as advertised. I did feel its autocorrect somehow left something to be desired. Below you can see it getting confused as I swipe the word "autocorrect."

Swyping Adding new words

The deal breaker for me with Swype was two-fold. First, the spacebar is smaller than the default space bar. It's a small thing to be sure (as tiny keyboards are) but it had me adding periods . throughout . my text, as I hit that before I hit the space bar.

Secondly, the lower left corner of the iOS keyboard has always been the little 123 Icon. It lets you switch between ABC and 123, of course. Swype chose to move this over to the second spot. This flummoxed me all day. I'm sure I could train myself as it's just muscle memory, but it was an unusual choice, I thought, and this is just one place where Swype deviated their keyboard design from being "just a swiping solution."  They've moved other things as well.

Opening the proper Swype button in the lower corner with a press and hold brings up the Globe (usually not hidden in other keyboards) as well as the Dial Pad for numbers, and the Settings gear.

Swype has moved some things and this slowed me down quite a lot. This keyboard below moves all my symbols to new locations, with the Asterisk nowhere to be found!

Checking out the Swype menu What's with the random Emoji?

NOTE: One thing that ALL these keyboards thankfully fix is the "shift key problem" with the default iOS keyboard. They show lowercase letters when you're typing lowercase, and change the whole keyboard to uppercase when you press Shift. It's so painfully a problem with the default keyboard, it's really unfortunate that this wasn't changed in iOS8.

Swype also includes funky themes with background images if you're into that level of customization.

SwiftKey - Free, with registration and has optional $ IAPs

SwiftKey is free, but they intend to make money by selling us keyboard things. For now, I'm thrilled with the default, as seen below. It looks almost exactly like the default iOS keyboard, which is what I'm looking for. I don't want to relearn where things are when I just want swiping and a few other features.

SwiftKey keeps all the symbols and numbers exactly where they usually are, and adds a few nice touches like a gentle reminder than I can touch-and-hold on punctuation for additional choices.

SwiftKey Fantastic  swiping is amazing

One odd bug I saw with SwiftKey - If I turn off "Allow all Access," in Settings | General | Keyboards, SwiftKey ignored my white theme choice, showing me only a black keyboard with a reminder to turn on All Access. I presume this is a bug, as it's definitely wrong. Other than this one issue, I'm digging SwiftKey.


There is also a free Chinese keyboard called TouchPal that includes swiping input, keyboards, themes and a focus on Emoji. The Emoji are included in the keyboard, meaning your don't need to switch to the Emoji keyboard. That said, I installed it and my phone locked up. I rebooted and had no keyboard until I removed TouchPal. I think this experience speaks (IMHO) to the larger issue of stability with 3rd party keyboards on iOS, but this is only from my perspective as a user. I was unable to get TouchPal working.

Privacy Concerns

Here's the kicker for a lot of people. In order to make predictive text suggestions, sometimes these keyboards need to send what you're typing to their cloud engine. Be sure to read their privacy policies to make sure you're comfortable with how they use your data.

Here's part of SwiftKey's privacy policy. Note that you can opt out of their cloud service. They try not to collect passwords and payments, basing this on hints like "type=password" in HTML, I presume. They also allow you to delete all your cloud data at a later date if you like.

For users that opt in to SwiftKey Cloud, we will collect your email address, basic demographic information and information concerning the words and phrases that you use (“Language Modeling Data”) to enable services such as personalization, prediction synchronization and backup. We may use data provided by you to develop and improve our Products.

Where a field has been flagged by a website or app as denoting a password field or payment information, SwiftKey does not log, store or learn from this information.

Be educated, but I'm OK with using these keyboards for basic email. Of course, you can (and will) switch keyboards many times a day if you're like me.

Switching Keyboards


If you type technical (or Medical, or Legal, or whatever) things a lot, you'll likely find some very odd predications with these keyboards. Here SwiftKey has clearly looked at my history and is suggesting something totally wrong...and offering to Capitalize it also! Autocorrect has always been a problem, but don't expect a 3rd party keyboard to fix it...although these ones aim to try! Theoretically they'll learn even more from what I type.

Random suggestion More autocomplete

A number of times I've found myself looking at a text box with a flashing insert point waiting for a keyboard to pop up. These keyboards need to LOAD and sometimes that causes a pause, or when things go wrong, they just never show up. In a word, there's bugs all around, in both the Keyboards, I suspect, and in iOS8's handling of them.

Here I am, keyboardless. I had to reboot at this point. Your mileage may vary.

Just Blank, no KeyboardStill no keyboard

Mark my words, I predict bug fixes for a the supporting APIs for 3rd Party Keyboards will be coming in the next minor update to iOS8.

NOTE: Neither of these keyboards includes a Microphone Button to start Siri's built-in dictation. As such, these keyboards won't work with my app, myEcho. This appears to be a limitation imposed by Apple, that won't allow us (developers) to invoke a dictation without using their button. If you want to dictate (which is almost a keyboard on its own...I'd like to see a giant "Dictate now" button, myself) then you'll need to switch to the built in iOS keyboard.
Press Microphone to Dictate to Siri

Final Recommendation

My recommendation? YOU should try them all and see which one makes you happy. If you are very much a touch typist and you want a swiping keyboard that doesn't deviate far from the default, I recommend SwiftKey.

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

How do you deal with anxiety when Live Coding in Technical Interviews?

September 16, '14 Comments [59] Posted in Musings
Sponsored By
Photo by Kevin Dooley used under Creative Commons

I received this question last week from a reader:

I've been a developer since 2005. I'm a solid developer with good experience. I've got a great opportunity for a new position coming up but I'm concerned about the tech interview. I seem to freeze like a deer in the headlights when asked to write code in front of people.

My resume is accurate and reflects my skills and experience but how do I prove I'm competent when I have this tendency to choke on tech questions when I'm put on the spot?

This is a great question. To level set, note that they aren't concerned that they don't have the skill. Their skills ARE up to the task. It's a case of anxiety around the live aspect of the tech interview

I would start with honesty. Talk to the hiring manager or the HR person. Offer to show them lots of code, your repos, examples. Offer to share more code than you'd ordinarily need to, as a way of making it clear you have nothing to hide. Everyone has something, be it anxiety, issues with public speaking, etc. Trying to hide an issue can make it worse.

Perhaps you could do a coding test where you *walk them through existing code* and explain. Explain to them that you have anxiety about whiteboard coding, BUT you want to make sure they get an accurate picture about your skill.

Also, practice! Talk to a friend and have them interview you and and have you code live. Folks don't ordinarily code live with an audience, so it's understandable why you might freeze or not perform at your best. If you don't do something often (like code live in front of an audience) then, darn it, do it often! Practice. 

Understand also that the interview may also want to see how you react under pressure. Do you get visibly angry? Wilt? Fall back on first principles? Denigrate yourself? Apologize? These reactions can be as important as your actual code. Usually interviewers are looking for thoughtfulness, analysis, patience, calm, and humility.

What do YOU think, Dear Reader? The comments on posts like this are usually better than my opinions!

* Photo by Kevin Dooley used under Creative Commons

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Fear Driven Development - FDD

September 13, '14 Comments [65] Posted in Musings
Sponsored By
Photo by Stacy Brunner

I had an interesting chat recently at a conference in the "hallway track." The hallway track is all the great conversations that happen in the hallway between sessions.

What drives your development processes? Are you a TDD house, where your tests drive development? Or, perhaps there's a chief architect who isn't a very nice person. We call this ADD - Asshole Driven Development. However, this chat was about FDD - Fear Driven Development.

Organizational Fear

Organization fear can have developers worried about making mistakes, breaking the build, or causing bugs that the organization increases focus on making paper, creating excessive process, and effectively standing in the way of writing code.

This "analysis paralysis" slows the entire project down. Every one is so afraid of the process that forward motion stops. There's a great post called "10 ways to lose a team" that covers many negative behaviors that can affect a team. Things like

  • Forbidding one-on-one meetings
  • Don't share information
  • Implying that everyone can be replaced
  • Micromanaging

All of these behaviors increase ambient fear and can cause a cloud of anxiety to loom over the organization.

Losing Your Job Fear

Other kind of Fear Driven Development is when an organization tries to get developers to stay far too late, work unreasonably hard, by implying that they'll lose their job at the sign of any problems with the project. Threatening jobs will never create a more productive team. It only perpetuates negative feelings and will always lead to people quitting. This also can cause management to believe that heroic effort is a common and acceptable part of the software development. An occasional "work push" is one thing, but if EVERY RELEASE cycle means a heroic effort at the cost of your personal relationships, you've got problems.

Fear of Changing Code

Another kind of Fear Driven Development is when your development organization (or your entire organization) is afraid of the code. Perhaps the code is older (legacy code) but more likely it's just not fully understood. It mostly works, but folks are afraid that a small change to the code could cost unpredictable side-effects. Fear of bug regressions - a closed/fixed bug coming back to life also stresses developers out.

Can you think of other flavors of Fear Driven Development?

* Photo by Stacy Brunner, used under Creative Commons

Sponsor: Many thanks to Aspose for sponsoring the blog feed this week! Aspose.Total for .NET has all the APIs you need to create, manipulate and convert Microsoft Office documents and a host of other file formats in your applications. Curious? Start a free trial 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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

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