Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > NZ Computing > Command-line power

Reply
Thread Tools

Command-line power

 
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      05-10-2008
The difference between a command line and a GUI is that the command line
inherently allows you to compose a sequence of simpler actions into a more
complex action that can be invoked just as easily as the simpler ones,
whereas in a GUI you cannot do anything that the GUI designers did not
originally envisage.

Consider a simple example: listening to streaming radio over the Internet.
On my Eee, I can enter a URL into the GUI-based SMPlayer, or I can type it
into a command line. However, suppose I'm listening to the news on National
Radio, and I want to skip the sports section, but I don't want to lose the
weather report that comes after. As soon as I hear "and now, here's
sport..." I stop the player, and enter the following command:

sleep 90; mplayer mms://204.61.215.51/rnz-natrad

Now I can happily spend the next minute and a half checking up on my
favourite news websites, reading USENET or whatever, and the streaming
playback will automatically resume around the last few seconds of the
sports news, or within the promo that follows.

How's that for efficient use of your time.
 
Reply With Quote
 
 
 
 
Gordon
Guest
Posts: n/a
 
      05-10-2008
On 2008-05-10, sam <(E-Mail Removed)> wrote:
> Lawrence D'Oliveiro wrote:
>> The difference between a command line and a GUI is that the command line
>> inherently allows you to compose a sequence of simpler actions into a more
>> complex action that can be invoked just as easily as the simpler ones,
>> whereas in a GUI you cannot do anything that the GUI designers did not
>> originally envisage.
>>
>> Consider a simple example: listening to streaming radio over the Internet.
>> On my Eee, I can enter a URL into the GUI-based SMPlayer, or I can type it
>> into a command line. However, suppose I'm listening to the news on National
>> Radio, and I want to skip the sports section, but I don't want to lose the
>> weather report that comes after. As soon as I hear "and now, here's
>> sport..." I stop the player, and enter the following command:
>>
>> sleep 90; mplayer mms://204.61.215.51/rnz-natrad
>>
>> Now I can happily spend the next minute and a half checking up on my
>> favourite news websites, reading USENET or whatever, and the streaming
>> playback will automatically resume around the last few seconds of the
>> sports news, or within the promo that follows.
>>
>> How's that for efficient use of your time.

>
> Do you really do that ?


Some do, and more. Now how is you mind, blown
 
Reply With Quote
 
 
 
 
Gordon
Guest
Posts: n/a
 
      05-10-2008
On 2008-05-10, Lawrence D'Oliveiro <(E-Mail Removed)_zealand> wrote:
> The difference between a command line and a GUI is that the command line
> inherently allows you to compose a sequence of simpler actions into a more
> complex action that can be invoked just as easily as the simpler ones,
> whereas in a GUI you cannot do anything that the GUI designers did not
> originally envisage.


Envisage, I would say chose not to include. For is it not possible for a GUI
to include *every* CLI command, should the programmer so decide to make it
so?

Read, there are some switches of the the command line which will never be
used by most of the users in a blue moon. The GUI programmer leaves them
out.

Exception to the rule is MS, who programmers pack in so much stuff into the
GUI that most of it users never use most of the options.

For this version of the programme has more, so you *must* but it.

 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      05-10-2008
In article <(E-Mail Removed)>, Gordon did write:

> For is it not possible for a GUI to include *every* CLI command, should
> the programmer so decide to make it so?


If you tried to do this, the GUI would become unwieldy long before you had
come anywhere close to including everything. And even then, you couldn't do
it. For instance, how would you implement a GUI equivalent
to "$(...)"--substituting the output of one command as parameters to
another?
er
 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      05-10-2008
In article <(E-Mail Removed)>, Don Hills did write:

> It's not a fault of GUIs, though - more a fault of the deigner/programmer.


It is a fundamental limitation of GUIs--you simply cannot put in every
single function that users might need.

Here's another example: creating a ZIP archive from a bunch of files. How
ways does your ZIP utility let you select files? What happens when they're
not enough?

The open-source command-line zip utility doesn't provide very complicated
ways to select files. But then, it doesn't need to. Instead, you have
the "find" command, which is a general-purpose utility whose sole purpose
is to select files according to various criteria and feed their names to
something else. And if its built-in functions aren't enough, it also has
the ability to use external programs in its filtering criteria.

For instance, zip up all .c files within the current directory and all its
subdirectories that were modified within the last 7 days:

zip newsource.zip $(find . -name \*.c -mtime -7 -print)

Zip up all files containing the string "INCLUDEME":

zip included.zip $(find . -exec grep -Fq INCLUDEME {} ';' -print)

It's all about tools that are not necessarily very powerful individually,
but that can be combined in very powerful ways.
 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      05-10-2008
In article <(E-Mail Removed)>, Brian Mathews did
write:

> So how is this all possible for the Average computer uses..


You mean, the Dimdows users who are expected to be able to handle Registry
edits?
 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      05-10-2008
In article <(E-Mail Removed)>, Brian Mathews did
write:

> On Sat, 10 May 2008 17:45:39 +1200, Lawrence D'Oliveiro
> <(E-Mail Removed)_zealand> wrote:
>
> For instance, how would you implement a GUI equivalent
>>to "$(...)"--substituting the output of one command as parameters to
>>another?

>
> But do we need to..
>
> CLI is for Nerds, not Real People


Well, on the one hand you've got your minimum-wage drones in their dead-end
McJobs, having done some Tech course on "Word and Excel" or something,
mindlessly clicking away at the same tasks over and over.

And on the other hand you've got someone who's spent a few minutes thinking
about how to organize things more efficiently, and is able to sit back and
just watch the computer does what it does best--the mindless, repetitive
stuff.

Which type would you rather be? It's your own choice.
 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      05-10-2008
In article <q/(E-Mail Removed)>, Don Hills did write:

> There don't appear to be enough people in NZ who know what PuTTY is.


It's a tool for those restricted to OSes too poor to run proper SSH.
 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      05-10-2008
In article <482578a1$(E-Mail Removed)>, sam did write:

> Yup thats what employers are crying out for these days, geeks that can
> pause mplayer from the console.


OK, here's another actual work-related multimedia example.

A client of mine wants to pull high-def video footage off these JVC cameras
with hard drives, to do some workflow processing on them. If you plug in
the camera via USB, it shows up as a hard drive, with the video as a
sequence of MPEG-2 files. One problem: the camera insists on starting a new
file every 18 minutes of recording, so a long clip gets broken up into a
sequence of segments. Whereas we really want the whole clip in one file.

Now, the client knows nothing about command-line stuff. So it's my job to
put up a simple GUI menu with an option that says "Import Video". They
click that, choose the source video directory and destination filename, and
everything else should happen automatically.

Enter my favourite multi-purpose multimedia workhorse, FFmpeg. That can
convert just about any video or audio codec and file format to any other,
while performing various useful transformations en route. Among its myriad
of options are a file format called "image2pipe" (just a simple sequence of
video frames) and a codec called "copy" (which just does a bit-by-bit copy
without trying to encode or decode anything).

So, for each video segment file in turn, I can extract the video frames and
write them to standard output using a command like

ffmpeg -i srcfile -f image2pipe -vcodec copy -y /dev/stdout

To concatenate the video from several files, just extract them in turn:

ffmpeg -i srcfile1 ... ; ffmpeg -i srcfile2 ... etc

Now I can embed the above sequence in place of the ellipsis in the following
command:

ffmpeg -i <(...) -vcodec copy -y dstfile

and it will create "dstfile" as the concatenation of the video streams
of "srcfile1", "srcfile2" etc.

I won't go into the detail of how the audio tracks are similarly processed,
but putting this all together into a Python script sequence to generate the
full command line, we get

ImportCmd = \
(
"ffmpeg -v 0 -i <(%(src_video)s)"
" %(audio_parms)s -i <(%(src_audio)s)"
" -vcodec copy -acodec %(audio_codec)s -y %(dstfile)s"
%
{
"src_video" :
"; ".join
(
[
"ffmpeg -v 0 -i %(srcfile)s -f"
" image2pipe -vcodec copy"
" -y /dev/stdout"
%
{"srcfile" : ShellEscape(SrcFile)}
for
SrcFile in SrcFiles
]
),
"src_audio" :
"; ".join
(
[
"ffmpeg -v 0 -i %(srcfile)s"
" %(audio_parms)s -y /dev/stdout"
%
{
"srcfile" : ShellEscape(SrcFile),
"audio_parms" : AudioParms,
}
for
SrcFile in SrcFiles
]
),
"dstfile" : ShellEscape(DstFile),
"audio_parms" : AudioParms,
"audio_codec" : "mp2",
}
)

And all triggered by the click of a single button.
 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      05-11-2008
In article <48264196$(E-Mail Removed)>, sam did write:

> Lawrence D'Oliveiro wrote:
>
>> In article <q/(E-Mail Removed)>, Don Hills did write:
>>
>>> There don't appear to be enough people in NZ who know what PuTTY is.

>>
>> It's a tool for those restricted to OSes too poor to run proper SSH.

>
> openssh runs fine in cygwin


Ah, Cygwin ... Viagra for Windows.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
High Power 560Watt Power Supply HPC-560-A12C @ ThinkComputers.org Silverstrand Front Page News 0 02-21-2006 10:25 PM
AOpen Prima Power AO700-12ALN 700W Power Supply Review Silverstrand Front Page News 5 08-29-2005 11:38 AM
HEC Ace Power 580UB 580Watt power supply Silverstrand Front Page News 0 07-23-2005 03:04 PM
Determine power requirements system... possible problem with power supply? Willem van der Berg Computer Support 4 10-03-2004 10:40 PM
Looking for SATA power cable to IDE power cable adapter Jack B. Pollack Computer Support 3 02-12-2004 08:50 PM



Advertisments