21 October 2007

#42. Apply for Minor Irritations

Hello again from the Tool Bar & Grill kitchen, where this week we’re whipping up some healing salves to soothe those minor irritants that sometimes can flare up into major inflammations. No, not jock itch or crabs – this is a software blog, remember?

We already know that I am especially picky about my computing experience, almost to the point of anal retentiveness (some might say far beyond). But clearly I’m not the only one, or utilities like the ones I review today would not exist. So bless you, free utility programmers, for writing prescriptions for my computer. This blog’s for you!

A Cat To Chase the Mouse

I thought only I could be bothered by the mouse pointer obstructing the text right where I’m typing. But there’s at least one other short-leashed touch-typer out there, and he did something about it – he wrote MouseAway.

Like an invisible cat, this tiny free utility detects when the mouse pointer is over the typing cursor and chases it away, relocating it a couple of lines down and a bit to the side. I tried MouseAway with Word, Excel, a text editor, and ToDoList in Windows XP, and it worked as promised.

It worked a little too well, in fact, because it’s very difficult to Ctrl-click a hyperlink when the mouse pointer keeps jumping away as you approach the link. And MouseAway doesn’t work in Web browsers, where it also would have been most welcome.

Subject to those two minor shortcomings, I recommend MouseAway. You can find it at http://www.geocities.com/mtetrode.

Open Up Those Open and Save Dialogs

There’s another itchy programmer out there, too. He was clearly frustrated by Windows’ inflexible Open and Save dialog boxes, which are too narrow to show long files names and file properties and cannot be resized. The intrepid irritated developer didn’t take it lying down. He fought back by developing OpenWide, a little utility that fixes the Open And Save dialogs.

Using OpenWide, you can specify the exact height and width of the Open and Save dialogs and their position on screen, or you can drag a sample dialog to the desired size and place.

OpenWide also can set the default pane style (list, detail, thumbnail, etc.) and the initial focus (so, for example, the file list has the focus instead of the File Name box). You can even drag a folder onto the dialog’s title bar to open that folder in the dialog. And if you right-click the window’s title bar, a Locate Current Folder with Explorer option opens a Windows Explorer window to the current folder. Now that’s handy.

OpenWide worked great in a number of applications, but strangely, did not work for me in Word and Excel under Windows XP. If you don’t mind that, OpenWide is available free from http://lingo.atspace.com/openwide.html.

By the way, Filebox Extender (reviewed in #16, 15 April 2007) also lets you expand the Open and Save dialogs by specifying a percentage of their original size.

I hope today’s post has helped provide you a with calmer, more comfortable computing, as it has me. And now for a special treat – another great Linux lesson from my co-host, Mark Lautman:

Waiter, Where's My \t?

by Mark Lautman

We had an unfortunate incident here in the Linux Room at the Tool Bar and Grill last week. I might as well tell you now before you read about it in the papers.

A temperamental customer started yelling at one of our waiters. “Hey, I didn't order \b(e[g]{2}s)\b, I ordered (b[na]{5}s)!”

“You ordered \2?” said the waiter. “I could have sworn you ordered \1!”

One thing lead to another, a few insults and shoves here and there, and the bouncers at the Tool Bar removed the surly customer. It turns out it was all a misunderstanding. After all, the funny punctuation marks in their conversation were regular expressions.

One common example of regular expressions is searching for a paragraph or tab character in Word. If you search for ^t in Word, you find all the tab characters; if you search for ^p, you find all the paragraph markers. The ^t and the ^p are regular expressions.

Why would you want to use regular expressions? Suppose you saved a web page as HTML, and you want to get rid of all those tags and just keep the text. You need to find and delete character sequences such as <td colspan=“3”>. That's a difficult thing to do in regular search-replace, particularly with all the variations in HTML tags, but with regular expressions you can search for them all by using a syntax like <.*> in Linux or \<*\> in Word.

It is hard to overstate the power of regular expressions when doing search and replace operations. In fact, since learning regular expressions, my life has become much easier: I don't work, I drink, I smoke, and party until about 4:00 AM. There's also no need to balance my checkbook.

Tutorials: If you're new to regular expressions (regular expressions), it's best to take a tutorial. Here are some that I've read.

Regular Expressions – A Simple User Guide is a wonderful way to become familiar with the terminology and use of regular expressions. The explanations on the first page are very clear and detailed.

ZVON, which as a collection of amazing tutorials on a variety of topics (and have saved my gnarly behind more than once), has a concise and readable tutorial Regular Expressions Tutorial. The best thing about ZVON's tutorials is that they are ad-free.

Regular-Expressions.info has fabulous explanations and examples, but the language is intended for programmers.

Validators: The syntax for complex regular expressions is very cryptic. I've often made an attempt to surgically find and remove text from large files, only to delete everything and then some. To help fine-tune your skills at regular expressions, as well as test regular expressions before you actually use them in a script, you can practice by using some on-line validators.

The Regular Expression Validator lets you type a regular expression and then a sequence of characters to see if the regular expression will find it. Regular Expression Checker is also an online validator. You can also find some on-line validators for Windows.

Regular expressions come in a variety of flavors, such as traditional, POSIX, PERL, and the special syntax in Word. If you use a validator, make sure it checks the syntax that your own program uses. In many cases, it’s best to just check the regular expression within the word processor itself.

Thank you, Mark! Did I overlook your favorite utility? Do you want to find out where Mark parties at night? Click “Post a comment” below or writing to jonathanstoolbar@gmail.com. And please visit here every week for more great utilities, Web sites, and Linux learning. And tell all your friends about the Tool Bar & Grill, too.

1 comment:

  1. proxomitron has its own variation of regex. i keep some disabledfilters in the list for certain testing.

    xnews and agent ransack have small expression test utils built in, but those have no history/memory/autofill, so not so useful.
    and i keep my own text file reference for when occasionally i sweep the .rc in xnews to delete any erimcpih or h(1|2|3|i|0|o)p ... or ...
    you get the idea.