Answering Programming Questions With howdoi

Every computer programmer asks themselves, often on a regular basis, “How do I…?” In my browser I begin to search for answers with a shortcut to DuckDuckGo. But when I am at my terminal (and/or using GNU Emacs) I like to use a Python program that I want to share with you today.

Introducing howdoi

The program name is self-explanatory. Its usage is equally simple. The project page provides examples, but allow me to share an example of my own from earlier today:

$ howdoi serialize lua tables

Lua alone doesn't have any such builtin, but implementing one is not
difficult.  A number of prebaked implementations are listed here:

This straight-forward, helpful output is one reason why howdoi has racked up over one-thousand stars on GitHub. Not only does it provide useful answers, but it works with Python 2 and 3, has a pre-built executable for Windows users, and caches answers for when you inevitably ask the same question later—I do that a lot.

If you use Emacs then take a look at this package by Arthur Nogueira Neves. It allows you to M-x howdoi on a region of text and tries to replace it with example code that best answers your question. While not perfect, I have been happy with how frequently it gives me a good idea of how to approach whatever programming task is at hand.

So consider installing howdoi. It is a terrific command-line tool for programmers. And if you use Emacs then also consider the package above.

P.S.: That Conkeror Shortcut

define_webjump("ddg", "")

I use this so that I can browse, for example, ddg !lua serialize tables. Those so-called bangs, i.e. !lua, are one reason I am a DuckDuckGo fan.


Add Your Thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s