









|
[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
[NMLUG] Random Questions #28
- Subject: [NMLUG] Random Questions #28
- From: _sarang_ at sarangworld.com (Sarang Gupta)
- Date: Sun Aug 28 14:58:50 2005
<% Greetings.random_greeting %>
% In tcsh, is there a shortcut to "echo ???????????????????????"
(echo "?{23}" doesn't work)
% What program reports the *number* of files in a given directory and its
subdirectories, similar to what du does for diskspace usage? [1]
% Can I edit my previous tcsh commands using pico/emacs? (tcsh equivalent
of mysql's "\e"?) [2]
% Can tcsh (or any shell) "cache" the output of commands? [3]
% I have millions of polygons, lines and points in 3D space, and want to
efficiently display the largest 500 polygons, the longest 500 lines, and
the "most important" 500 points for a given view. Is this a typical 3D
rendering problem? [4]
% Is there a pannable, zoomable world map that shows the largest cities in
a given area? [5]
Footnotes:
[1] I could've sworn there was a du option that did this, but I can't find
it anymore. It's easy to write a program (Perl 4-liner below) to do this,
but that seems inelegant.
unless(($aa)=@ARGV) {$aa=".";}
for (split("\n",`find $aa -type d`)) {$ab{"${_}/"}=`ls -A '$_'|wc -l`;}
for (keys %ab) {$i=$_; while($i=~s!(.*)/+.*?$!$1!){$ac{$i}+=$ab{$_};}}
for (keys %ac) {print "$ac{$_} $_\n";}
[2] tcsh has a fairly powerful command-line editor, but it'd be nice to
edit previous commands using a "real" editor (based on the $VISUAL or
$EDITOR variable) like pico or emacs.
[3] I sometimes run commands and then wish I'd redirected (to a file or
piped to tee, Mail, less, etc) the output, especially if the command takes
forever to run and the output's long enough to scroll off the screen.
Obviously, many caveats apply. The cache would be non-automatic-- you'd
have to request the "cached" output specifically, otherwise tcsh would
just run the command normally. Without this exclusion, you'd run into all
sorts of problems-- cached output of date, ls, ping, and many, many other
commands, is usually ridicoulous. You could exclude programs -- vt100
apps like pine, emacs -nw, screen, lynx, mysql would be excluded --
ideally, tcsh could figure out by itself which apps did terminal
manipulation and exclude them, but that's probably hard. I realize there
are other solutions: running all my tcsh sessions using "script", using
rxvt or screen's scrollback buffer, but they all seem a bit inelegant. I
also realize the OS does filesystem caching, so running "du" twice on a
large/deep directory runs faster the 2nd time. It would be nice to tell
tcsh: save the output of all commands (excluding certain ones) in
/var/cache/tcsh, using up to x MB, and let me recover this output on
request (provided it's not too late-- ie, newer commands haven't used up
the x MB I alloted and thus deleted the output of older commands). Final
thought: I sometimes wish I'd piped the output of a command to sort, head,
or so on, and don't really want to run the whole command over again with
"|sort" tacked on to it. With caching I could do something like:
show-cached-version-of 'really-complex-command' | sort
(really-complex-command is single-quoted as it may contain pipes,
redirects, and other tcsh-special symbols)
[4] The real question here is of course "how do I do this?", but I'd be
happy with a pointer to a resource. Obviously, the largest 500 polygons,
etc, will change as the view changes (and thus has to be recomputed
efficiently). For my app, distance isn't an issue-- a polygon with area 15
at a distance of 10 is still larger than a polygon with area 14 at
distance 2 (but I'm ok w/ it the other way too -- the distance from the
"camera" to any visible polygon will be nearly the same, so this won't be
an issue). Polygonal area and line length are well-defined: for points
(which are all the same size: 0), I've assigned an "importance level" to
each point which doesn't change. Additionally, all of the objects
(polygons, lines, points) are static and don't move around. I suspect this
problem has been solved for lines and polygons, but I'm not sure about
points, since the sorting function there is artificially defined.
[5] I sometimes want to see the largest cities in a given country/area.
There are many web resources for this, and many standalone apps w/ static
maps (eg, xearth), but it'd be nice to have a standalone zoomable/pannable
app, and seems fairly easy to create one using a free database of polygons
and placenames (like
http://earth-info.nga.mil/gns/html/cntry_files.html)-- I've actually done
this, but my app is lousy, and I can't imagine there isn't something
better out there. I looked on sf.net and didn't really see anything. Whirl
Wind is definitely overkill for this (and hasn't yet been ported to
Linux).
--
Sincerely, Sarang Gupta (_sarang_@sarangworld.com)
Backup Emails: saranghome@softhome.net, sarangorama@gmail.com
|
|