Tuesday, November 24, 2009

My Phone Starts Giving Me Things I Never Had

This morning, my Android phone used Google's Turn-by-Turn navigation to coach me into work.

I'd wanted to play with voice navigation every since I got my Android phone, a few months ago, but all the available apps were pay services, so I waited. A few weeks ago, Google announced they'd provide it with Android 2.0, but my HTC Magic (T-Mobile myTouch) was still running 1.6.

Picture me, tapping my toe impatiently.

Yesterday, they back-ported the functionality to 1.6 and put it in the app store, and I grabbed it. This morning, I put in my destination, sat it in my lap, and set out.

Hearing it tell me directions as I drive is startling.

In one-quarter mile, turn right onto on-ramp, Highway 157, North.

Turn right onto on-ramp, Highway 157, North.


My father's Bell model 500 sits on my desk. When I got my first cell phone, I couldn't believe I was carrying a telephone in my pocket.

I shut off my land-line service, and jumped in with both feet. I quickly discovered I also had my watch, my alarm clock, and my pager in my pocket. My old pager was long gone, but I donated my alarm clock to the Salvation Army. My watch, a gift from an old girlfriend, went in a drawer.

The myTouch put my email reader in my pocket, too. To underscore this, Qwest, my DSL provider, had a service outage a week or so after I got it. No computer, but I could still read my email.

Having both persuaded me that I should take my Google Contacts seriously, so it now really does store all my email addresses and my phone numbers. The app that stores my library-card, my grocery-card, and other bar codes was also useful.

But all that was extensions to things I already had. The bubble level app was cute, but not important. Google Sky Maps was very, very cute, but not important.

Other stuff? Nice, if not quite ready for prime-time. Browser? Slooooow. Calendar? Too small to be useful. eBook reader? I'll let you know once there's a Kindle app.

Amazon Marketplace showed me the future of retail, but it's still mostly an "Oooh!"

The turn-by-turn directions though? Important.

I have a notebook full of maps I've printed to get places -- my own, personal atlas. No more. From now on, my phone can just tell me how to get where I want to go.

The phone in my pocket has replaced the GPS that I never owned.

Tuesday, November 17, 2009


I'm interested in translation tools. Google Translate now does translate-as-you-type, instead of waiting for you to finish typing and submitting the result.

It's claimed that it will also do phonetic translation of non-Roman scripts, but I'm not seeing that with Yiddish.

Thursday, November 12, 2009

The "help" Command, And Other Aids

In his latest Command-Line Kung Fu post, Hal Pomeranz talks about places to get help on Unix systems and their kin. (Technically, that's "their latest post," but his co-conspirators write about Microsoft stuff, which I don't care about.)

Hal concentrates on man(1), info(1), and apropos(1), and the --help flag. Good places to start, but there are other things worth mentioning.

So I will.

locate(1) is quite handy. I often find myself hunting for commands that don't have man entries of any kind, and are installed someplace bizarre. Once I find them, /path/to/command --help often tells me enough. If not, but they're in some special directory, there's sometimes a README or examples that do the trick.

Another frequent stop is the web. If command --help doesn't tell me what I want to know, the web's more likely to have a man page than my machine is. I'll now usually go there first.

If it's not an executable? How about type?
$ type ls
ls is aliased to `ls --color=auto'
$ type cdjob
cdjob is a function
cdjob ()
local d;
: ${1:?"usage $FUNCNAME %N"};
d=$(jobs $1 | perl -lane 'print "cd $1" if m/.*\(wd: (.*)\).*/');
test "$d" && eval $d
And what's type?
$ type type
type is a shell builtin
For information about type, do we have to pour through the zillion-page, bash man page? On-line?

Nope. Watch:
$ man type
No manual entry for type
$ type type
type is a shell builtin
$ help type
type: type [-afptP] name [name ...]
Display information about command type.
For each NAME, indicate how it would be interpreted if used as a
command name.
-a display all locations containing an executable named NAME;
includes aliases, builtins, and functions, if and only if
the `-p' option is not also used
-f suppress shell function lookup
-P force a PATH search for each NAME, even if it is an alias,
builtin, or function, and returns the name of the disk file
that would be executed
-p returns either the name of the disk file that would be executed,
or nothing if `type -t NAME' would not return `file'.
-t output a single word which is one of `alias', `keyword',
`function', `builtin', `file' or `', if NAME is an alias, shell
reserved word, shell function, shell builtin, disk file, or not
found, respectively
NAME Command name to be interpreted.
Exit Status:
Returns success if all of the NAMEs are found; fails if any are not found.
typeset: typeset [-aAfFilrtux] [-p] name[=value] ...
Set variable values and attributes.
Obsolete. See `help declare'.
Yes, there's really a help command. It gives help about shell builtins.

If I don't even have the command? (If, for example, it's part of someone else's script I've pulled down from somewhere?)

Here's what I get out of bash when I invoke als(1) on my Ubuntu box.
$ als
The program 'als' is currently not installed. You can install it by typing:
sudo apt-get install atool
als: command not found
Not help with the command, okay, but help getting it so I can then get help with it.

What would you pay? But wait. There's more.

If I guess at a command but mis-type it?
$ las
No command 'las' found, did you mean:
Command 'als' from package 'atool' (universe)
Command 'ls' from package 'coreutils' (main)
Command 'lfs' from package 'lustre-utils' (universe)
Command 'lms' from package 'lms' (universe)
Command 'les' from package 'atm-tools' (universe)
Command 'last' from package 'sysvinit-utils' (main)
Command 'laps' from package 'epix1' (universe)
Command 'lvs' from package 'lvm2' (main)
Command 'cas' from package 'amule-adunanza-utils' (universe)
Command 'cas' from package 'amule-utils' (universe)
Command 'as' from package 'binutils' (main)
Command 'ras' from package 'ras' (universe)
Command 'kas' from package 'openafs-kpasswd' (universe)
Command 'lat' from package 'lat' (universe)
las: command not found
I think that's nice. And I can use apt-cache show to tell me what each package is.

Wednesday, November 11, 2009

Valour-IT Fundraiser

If you're geeky enough to be reading this blog, you're geeky enough to appreciate the idea of a project that provides computers to wounded vets.

Monday, November 9, 2009

Checking Scripts for Syntax Errors

If I'm maintaining a lot of shell scripts in a directory, I usually want to syntax-check them before I check them in.

The file(1) command will mark most of them as shell scripts. The rest are, typically, libraries of shell functions that I name with .sh suffixes.

All shell scripts that file can find:

$ file * | awk -F: '/shell/{print $1}'

plus the libraries

$ file * | awk -F: '/shell/{print $1}' ; echo *.sh

now syntax check them

$ for i in $(file * | awk -F: '/shell/{print $1}' ; echo *.sh); do bash -n $i || echo $i fails; done

Just with command-line recall and editing.