Re: Great SWT Program
- From: blmblm@xxxxxxxxxxxxx <blmblm@xxxxxxxxxxxxx>
- Date: 19 Nov 2007 12:21:12 GMT
In article <9d87e995-615b-48af-9a2d-77bfa87bd232@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<twerpinator@xxxxxxxxx> wrote:
On Nov 16, 6:20 am, blm...@xxxxxxxxxxxxx <blm...@xxxxxxxxxxxxx> wrote:
[ snip ]
I sure would, if vi(m) were incapable of editing more than one file.
Fortunately, that's not the case. (I seem to remember that even
"real" vi had this capability, but I might be misremembering.)
Too bad it won't let you flip between them in a natural and convenient
way, or even in a way consistent with other tools you use, unlike
multiple document windows open in a proper window interface.
Of course you'd then be stuck with primitive,
awkward, and annoying pre-GUI methods of switching among open
documents...
Yeah. ":n<enter>" to go to the next file.
How primitive. Much more work than alt-tab, especially when you
consider the need to also switch into and back out of command mode.
Four keypresses rather than two. Doesn't seem like "much more work"
to me. As for switching into command mode -- normally I *am* in
command mode.
And didn't a : indicate a command to operate on an external file, or
to launch via the shell, or something of the sort, earlier?
So once again you know better than I do how this application
actually works .... (":" indicates that what comes next is an
'ex' command. Some of those commands do involve external files
and/or programs. Some of them don't.)
Uh-huh. I'd have to know more about how you did the mass selection
(all the files in a folder, or did they have some common trait
that made it easy to select en masse) and about what you mean by
"didn't have the trait in question" to propose a Unix-y solution.
I'm betting that there is none or else the only ones involve a lot of
typing and even debugging of some sort. Trying to do any sort of
complex mass file manipulation from a command line has always put me
in mind of fumbling around and bumping into furniture in the dark.
Whereas trying to do it from a GUI always strikes me as unbelievably
tedious. But apparently I've been unaware of some of the capabilities
of graphical file browsers and selection dialogs. I don't suppose
you also don't know everything .... No, no, of course not.
But unless there's something automation-resistant about which
files are to be selected, I'm pretty sure I could come up with
something no more complicated than what you just mentioned,
and without consulting any reference materials.
Bull -- if it involved any kind of regexp or scripting you'd need to
refer to the reference manual for the syntax and semantics of the
language involved, unless you're superhuman in some way. :P
Not superhuman, but experienced with my tools of choice.
A Unix-y approach would be to use the output of the script (if
it's a list of files) as input/argument to another program.
More awkwardness. First the other program needs to be commandline-
oriented, accept a list of files as a parameter, etc.;
Which mostly they do.
second the list
needs to not hit any length limits;
Which in practice doesn't seem to happen very often, and if it
does one can use "xargs".
third this will all happen
frighteningly blind,
So before doing anything that might be difficult or inconvenient
to undo, I'll first preview it in some way (e.g., echoing the
list of selected filenames rather than applying some command
to them -- and no, that doesn't mean I have to type the whole
selection command(s) again, since my shell keeps a history of
previously-typed commands).
so if the list is obviously incorrect the first
thing you see is "deleting UselessFile1 ... deleting UselessFile2 ...
deleting UselessFile3 ... deleting ImportantFileIWantToKeep.txt ...
^C" Too late for ImportantFileIWantToKeep.txt of course, but at least
you stopped it before it deleted anything else it shouldn't have, hmm?
That may require sub-millisecond reflexes with a modern machine mind
you. Most likely it's either already done or at least deleted dozens
more files by the time you hit ctrl-C. If you even *see* the
incorrectly-included file's name flash by at warp speed. If the thing
even produces feedback at all. What if the prompt just goes away for a
few seconds while the drive light buzzes, then a new prompt appears?
If I want to be sure I see the output, I'll either redirect it to
a file, or pipe it into a pager such as "less". For "rm", I'm apt
to do "rm -v" (for "verbose"), so I do get a list of what's being
deleted.
OK, it running amok deleting things IS a worst-case scenario, but
those are important to consider when designing a system to be robust
and to provide the best possible opportunities for error recovery to
its operators. Making trucking the list to the process that deletes
stuff or whatever a manual step provides an opportunity for an
operator to notice problems before they become irreversible ones.
True. Of course, that's not the only way to make an opportunity to
correct potential problems.
Direct viewing of the file contents, as with my 80-notepads example,
ensures the operator knows exactly what'll get deleted, so if the
number of files isn't outrageously large I'll tend to prefer such an
approach to anything that involves a greater degree of blindness.
Errors creep in the less double-checking, noticing stuff, etc.
opportunities the user has.
It would seem so. But the double-checking mechanism -- for
example, "rm -i" (prompt on every file) isn't perfect either,
since one becomes so accustomed to typing 'y', 'y' [ "yeah, yeah,
enough already!" ] that it's easy to delete the wrong thing. Or
that's my experience anyway.
[ snip ]
--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.
.
- Follow-Ups:
- Re: Great SWT Program
- From: twerpinator
- Re: Great SWT Program
- References:
- Re: Great SWT Program
- From: twerpinator
- Re: Great SWT Program
- From: blmblm
- Re: Great SWT Program
- From: twerpinator
- Re: Great SWT Program
- Prev by Date: Re: Why can't i declare a static variable in a static method?
- Next by Date: Re: Great SWT Program
- Previous by thread: Re: Great SWT Program
- Next by thread: Re: Great SWT Program
- Index(es):
Relevant Pages
|