10101 lines
372 KiB
HTML
10101 lines
372 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||
<HTML>
|
||
<HEAD>
|
||
<TITLE> Linux Gazette Table of Contents LG #70</TITLE>
|
||
<META NAME="robots" CONTENT="noindex, nofollow">
|
||
</HEAD>
|
||
|
||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
||
ALINK="#FF0000" >
|
||
<center>
|
||
<!-- A HREF="http://www.linuxgazette.com/">
|
||
<H1><IMG SRC="../gx/newlogo.jpg" ALT="LINUX GAZETTE" border="0"></H1></A> -->
|
||
<A HREF="http://www.linuxgazette.com/">
|
||
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.png"
|
||
WIDTH="600" HEIGHT="124" border="0"></H1></A>
|
||
<H2>September 2001, Issue 70
|
||
Published by <I>Linux Journal</I></H2>
|
||
|
||
<A HREF=../index.html>Front Page</A> |
|
||
<A HREF=../index.html>Back Issues</A> |
|
||
<A HREF=../faq/index.html>FAQ</A> |
|
||
<A HREF=../mirrors.html>Mirrors</A> |
|
||
<A HREF="http://www.linuxgazette.com/search.html">Search (www.linuxgazette.com)</A>
|
||
<!-- *** BEGIN mirror site search link *** -->
|
||
<!-- <A HREF="http://www.linuxgazette.com/search.html">(SITE.COM
|
||
mirror)</A> -->
|
||
<!-- *** END mirror site search link *** -->
|
||
|
||
</CENTER>
|
||
|
||
<!--=================================================================-->
|
||
|
||
<table>
|
||
<TR>
|
||
<TD COLSPAN="3" WIDTH="100%" BGCOLOR="#000000"><IMG
|
||
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=30 VSPACE=2 HEIGHT=1
|
||
WIDTH=1 ALIGN=LEFT></TD>
|
||
<TD></TD>
|
||
</TR>
|
||
<tr><td>
|
||
<table>
|
||
<tr>
|
||
<td VALIGN="top"><H1><font color="#BB0000">Visit Our Sponsors:</font></H1></td></tr>
|
||
|
||
|
||
|
||
<!-- *** BEGIN sponsors *** -->
|
||
<TR><TD>
|
||
<A HREF="http://www.penguincomputing.com"><IMG ALT="Penguin Computing" SRC="../gx/sponsors/penguincomputing.gif" BORDER="0" VSPACE="10"></A>
|
||
</TD></TR>
|
||
|
||
<TR><TD>
|
||
<A HREF="http://www.linuxnetworx.com"><IMG ALT="Linux NetworX" SRC="../gx/sponsors/linuxnetworx.gif" BORDER="0" VSPACE="10"></A>
|
||
</TD></TR>
|
||
|
||
|
||
<!-- *** END sponsors *** -->
|
||
|
||
|
||
|
||
|
||
</table>
|
||
</td>
|
||
<!--==================================================================-->
|
||
<TD ROWSPAN="3" WIDTH="2" BGCOLOR="#000000" NOSAVE><IMG
|
||
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=1 HEIGHT=1 WIDTH=1%></TD>
|
||
<td VALIGN=top>
|
||
<H1><font color="#BB0000">Table of Contents:</font></H1>
|
||
|
||
|
||
|
||
|
||
<!-- *** BEGIN toc *** -->
|
||
<UL>
|
||
<LI> <a HREF="lg_mail70.html">The MailBag</A>
|
||
<LI> <a HREF="lg_bytes70.html">News Bytes</A>
|
||
<LI> <a HREF="lg_answer70.html">The Answer Gang</A>
|
||
<LI> <a HREF="lg_tips70.html">More 2-Cent Tips</A>
|
||
<LI> <a HREF="adam.html">The Weekend Mechanic</A> , <EM>by Thomas Adam</EM>
|
||
<LI> <a HREF="arndt.html">How to use an Atari ST machine as a Linux terminal</A> , <EM>by Matthias Arndt</EM>
|
||
<LI> <a HREF="chung.html">Downloading without a Browser</A> , <EM>by Adrian J Chung</EM>
|
||
<LI> <a HREF="ghosh.html">Bootstrapping a Linux system - an Analysis</A> , <EM>by Subhasish Ghosh</EM>
|
||
<LI> <a HREF="ghosh2.html">GNOME Programming in Linux using GTK+</A> , <EM>by Subhasish Ghosh</EM>
|
||
<LI> <a HREF="mcgucken.html">Homer's Open Source Odyssey 2001: Classical Computing and a Brief History of Open Source</A> , <EM>by Elliot McGucken</EM>
|
||
<LI> <a HREF="spiel.html">Numerical Workbenches, part II</A> , <EM>by Christoph Spiel</EM>
|
||
<LI> <a HREF="tranter.html">CSL, The Common Sound Layer</A> , <EM>by Jeff Tranter</EM>
|
||
<LI> <a HREF="williams.html">Using Aggregate Functions and Operators in PostgreSQL</A> , <EM>by Branden R Williams</EM>
|
||
<LI> <a HREF="lg_backpage70.html">The Back Page</A>
|
||
</UL>
|
||
|
||
<!-- *** END toc *** -->
|
||
|
||
|
||
|
||
|
||
</td>
|
||
</tr>
|
||
<TR>
|
||
<TD COLSPAN="3" WIDTH="100%" BGCOLOR="#000000"><IMG
|
||
SRC="../gx/hammel/cleardot.gif"
|
||
ALT="-------------------------------------------------------------"
|
||
HSPACE=30 VSPACE=2 HEIGHT=1 WIDTH=1 ALIGN=LEFT></TD>
|
||
<TD></TD>
|
||
</TR>
|
||
</table> <!-- ******************************************* -->
|
||
|
||
<H3 ALIGN="center"><EM>Linux Gazette</EM> Staff and The Answer Gang</H3>
|
||
<BLOCKQUOTE>
|
||
<STRONG>Editor:</STRONG> Michael Orr<BR>
|
||
<STRONG>Technical Editor:</STRONG> Heather Stern<BR>
|
||
<STRONG>Senior Contributing Editor:</STRONG> Jim Dennis<BR>
|
||
<STRONG>Contributing Editors:</STRONG>
|
||
Ben Okopnik, Dan Wilder, Don Marti
|
||
</BLOCKQUOTE>
|
||
|
||
<TABLE WIDTH="100%"><TR>
|
||
<TD WIDTH="100%" BGCOLOR="#000000"><IMG
|
||
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=30 VSPACE=2 HEIGHT=1
|
||
WIDTH=1 ALIGN=LEFT></TD>
|
||
</TR></TABLE>
|
||
|
||
<P> <!-- ************************************************** -->
|
||
<table>
|
||
<tr><td>
|
||
<A HREF="issue70.txt.gz">TWDT 1 (gzipped text file)</A><BR>
|
||
<A HREF="issue70.html">TWDT 2 (HTML file)</A><BR>
|
||
are files containing the entire issue: one in text format, one in HTML.
|
||
They are provided
|
||
strictly as a way to save the contents as one file for later printing in
|
||
the format of your choice;
|
||
there is no guarantee of working links in the HTML version.
|
||
</td></tr>
|
||
<!--==================================================================-->
|
||
<TR>
|
||
<TD COLSPAN="3" WIDTH="100%" BGCOLOR="#000000"><IMG
|
||
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=30 VSPACE=2 HEIGHT=1
|
||
WIDTH=1 ALIGN=LEFT></TD>
|
||
<TD></TD>
|
||
</TR>
|
||
<tr><td>
|
||
<center>
|
||
<I>Linux Gazette</I><img alt="[tm]" src="../gx/tm.gif">,
|
||
<A HREF="http://www.linuxgazette.com/">http://www.linuxgazette.com/</A><BR>
|
||
This page maintained by the Editor of <I>Linux Gazette</I>,
|
||
<A HREF="mailto: gazette@ssc.com"> gazette@ssc.com</A>
|
||
<P>
|
||
<H5>Copyright © 1996-2001 Specialized Systems Consultants, Inc.</H5>
|
||
</center>
|
||
</td></tr>
|
||
<TR>
|
||
<TD COLSPAN="3" WIDTH="100%" BGCOLOR="#000000"><IMG
|
||
SRC="../gx/hammel/cleardot.gif" ALT="" HSPACE=30 VSPACE=2 HEIGHT=1
|
||
WIDTH=1 ALIGN=LEFT></TD>
|
||
<TD></TD>
|
||
</TR>
|
||
</table>
|
||
<center>
|
||
<H1><A NAME="wanted"><IMG ALIGN=MIDDLE ALT="" SRC="../gx/mailbox.gif">
|
||
The Mailbag</A></H1> <BR>
|
||
<!-- BEGIN wanted -->
|
||
</center>
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<center><H3><font color="maroon">HELP WANTED : Article Ideas</font></H3></center>
|
||
<P>
|
||
<P> Send tech-support questions, answers and article ideas to The Answer Gang
|
||
<<A HREF="mailto:linux-questions-only@ssc.com"
|
||
>linux-questions-only@ssc.com</A>>. Other mail (including
|
||
questions or comments about the <EM>Gazette</EM> itself) should go to
|
||
<<A HREF="mailto:gazette@ssc.com">gazette@ssc.com</A>>. All material
|
||
sent to either of these addresses will be considered for publication in the
|
||
next issue. <EM>Please send answers to the original querent too, so that s/he
|
||
can get the answer without waiting for the next issue.</EM>
|
||
|
||
<P> Unanswered questions might appear here. Questions with
|
||
answers -- or answers only -- appear in The Answer Gang, 2-Cent Tips, or here,
|
||
depending on their content. There is no guarantee that questions will
|
||
<em>ever</em> be answered, especially if not related to Linux.
|
||
|
||
<P> <STRONG>Before asking a question, please check the
|
||
<A HREF=../faq/index.html><I>Linux Gazette</I> FAQ</A> to see if it has been
|
||
answered there.</STRONG>
|
||
|
||
<P> <HR> <P>
|
||
<!--====================================================================-->
|
||
|
||
<!-- BEGIN HELP WANTED : Article Ideas -->
|
||
|
||
<UL>
|
||
<!-- index_text begins -->
|
||
<li><A HREF="#wanted/1"
|
||
><strong>Arcane information ...</strong></a>
|
||
<li><A HREF="#wanted/3"
|
||
><strong>Portals</strong></a>
|
||
<li><A HREF="#wanted/5"
|
||
><strong>Migrating to SAGU</strong></a>
|
||
<!-- index_text ends -->
|
||
</UL>
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="wanted/1"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
|
||
<FONT COLOR="navy">Arcane information ...</FONT></H3>
|
||
|
||
<P><em>
|
||
Bryan Anderson wrote an article in August 2001 Linux
|
||
Gazette titled 'Make your Virtual Console Log In Automatically'.
|
||
</em></P>
|
||
<P><STRONG>
|
||
Many years ago, before the Web when terminals mattered a lot more, I
|
||
spent many hours combing through kernel code and experimenting to
|
||
figure out process groups, sessions, controlling terminals, job
|
||
control, SIGINT, SIGHUP, and the like. I could write a long article on
|
||
it, but I think it's really arcane information.
|
||
</STRONG></P>
|
||
|
||
<p>Thu, 2 Aug 2001 16:39:28 -0700
|
||
<BR>brad harder (<a href="mailto:linux-questions-only@ssc.com">bharder from methodlogic.net</a>)</p>
|
||
|
||
<P>
|
||
I'd be interested to read what Bryan has to say about this subject ...
|
||
</P>
|
||
<P>
|
||
-bch
|
||
</P>
|
||
|
||
<p>Thu, 16 Aug 2001 13:27:50 +0200
|
||
<BR>Yann Droneaud (<a href="mailto:linux-questions-only@ssc.com">ydroneaud from meuh.eu.org</a>)
|
||
|
||
<P>
|
||
Hi,
|
||
</P>
|
||
<P>
|
||
I read the article written by Bryan Anderson in August 2001 Linux
|
||
Gazette titled 'Make your Virtual Console Log In Automatically'. The
|
||
last section about process groups and controlling terminal was too short
|
||
for me.
|
||
</p><p>
|
||
I would be happy if Bryan could write a technical article about this
|
||
subject as it's suggested by him and the editor.
|
||
I'm wondering his knowledge could help me.
|
||
</p><p>PS: my currently knowledge is based on a approxmilty reading of bash
|
||
source code and the GNU libc manual (info).
|
||
</P>
|
||
<P>
|
||
--
|
||
Yann Droneaud
|
||
</P>
|
||
|
||
<!-- end 1 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="wanted/3"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
|
||
<FONT COLOR="navy">Portals</FONT></H3>
|
||
Tue, 14 Aug 2001 22:44:16 -0500
|
||
<BR>Vic Ward (<a href="mailto:linux-questions-only@ssc.com">vward from uswest.net</a>)
|
||
|
||
<P>
|
||
What combination of open source software should be used to create a
|
||
portal site? How could a beginner build and test such a site?
|
||
</P>
|
||
|
||
<p><em>A handful of the Answer Gang are just starting to give him links
|
||
to some related software, but an article from someone out there
|
||
who has already had the experience would be even better.</em></p>
|
||
|
||
<!-- end 3 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="wanted/5"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
|
||
<FONT COLOR="navy">Migrating to SAGU</FONT></H3>
|
||
Wed, 22 Aug 2001 02:11:23 -0300 (EST)
|
||
<BR>Cesar Brod (<a href="mailto:linux-questions-only@ssc.com?cc=cesar@brod.com.br">cesar from brod.com.br</a>)
|
||
|
||
<P>
|
||
I work as technology consultant for a small University Centre in the South
|
||
of Brazil ... we have migrated all of our academic/administrative system
|
||
into Free Software, developing the SAGU system.
|
||
</p>
|
||
<P>
|
||
BTW, I am a guest speaker at the Annual Linux Showcase, where I will be
|
||
presenting our SAGU system.
|
||
</P>
|
||
<P>
|
||
Well, let me know if you like the idea and I will produce an article.
|
||
</P>
|
||
<p><em>Thanks, Cesar, we'd love to see your article. It falls solidly into
|
||
the "real life experiences" category defined in our
|
||
<a href="http://www.linuxgazette.com/faq/index.html#questions_author"
|
||
>author guidelines</a>. You should look there for the
|
||
upcoming deadlines, and submit to
|
||
<a href="mailto:gazette@ssc.com">gazette@ssc.com</a>.
|
||
</em></p>
|
||
|
||
<p>You may find also interesting we host a "Source Forge" site at
|
||
"<A HREF="http://codigoaberto.org.br"
|
||
>http://codigoaberto.org.br</A>"
|
||
where we have more than 80 hosted projects, from people all over Brazil.
|
||
</P>
|
||
<P>
|
||
Cesar Brod
|
||
<br>Univates/Brod Tecnologia
|
||
</P>
|
||
<p><em>
|
||
Gentle Readers: If you have broad reaching projects that you
|
||
think make Linux fun and more useful, we encourage you to
|
||
consider submitting an arttcle too!
|
||
</em></P>
|
||
|
||
<!-- end 5 -->
|
||
<P> <hr> </p>
|
||
<a name="mailbag"></a>
|
||
<!-- =================================================================== -->
|
||
<center><H3><font color="maroon">GENERAL MAIL</font></H3></center>
|
||
<P> <HR> <P>
|
||
<!--====================================================================-->
|
||
|
||
<!-- BEGIN GENERAL MAIL -->
|
||
|
||
<UL>
|
||
<!-- index_text begins -->
|
||
<li><A HREF="#mailbag/1"
|
||
><strong>Re: Mistake regarding CUP</strong></a>
|
||
<li><A HREF="#mailbag/11"
|
||
><strong>more on CUP</strong></a>
|
||
<li><A HREF="#mailbag/16"
|
||
><strong>Thank you everyone</strong></a>
|
||
<li><A HREF="#mailbag/18"
|
||
><strong>Learning Perl, part 5 (LG #69)</strong></a>
|
||
<li><A HREF="#mailbag/19"
|
||
><strong>[wls@wwco.com: Learning Perl: thank you]</strong></a>
|
||
<!-- index_text ends -->
|
||
</UL>
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="mailbag/1"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
|
||
<FONT COLOR="navy">Re: Mistake</FONT></H3>
|
||
Thu, 2 Aug 2001 10:12:54 -0700
|
||
<BR>Michael P. Plezbert and Xavier Prat
|
||
|
||
<p><em>This is an exchange regarding CUP
|
||
<ul>
|
||
<li><a href="../issue69/lg_mail69.html#gaz/1">The letter "Mistake"
|
||
and its script</a> published in last month's Mailbag
|
||
<li>The original article: <a href="../issue41/lopes/lopes.html"
|
||
>Compiler Construction Tools, Part III</a>
|
||
by Christopher Lopes, in 1999
|
||
</ul>
|
||
<br>
|
||
Michael has taught the compiler course at Washington Univeersity, and
|
||
programming languages is one of his areas of study.
|
||
<br>
|
||
</em></p>
|
||
|
||
<P><STRONG>
|
||
On Thu, 28 Jun 2001 18:16:59 +0100 Xavier wrote:
|
||
</STRONG></P>
|
||
<FONT COLOR="#000066"><EM>
|
||
<P><STRONG>
|
||
I just look at your issue 41 (I know that is not really recent ...) but
|
||
in the article of Christopher Lopes which is talking about CUP, there is
|
||
a mistake...
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
I tested it and I see that it didn't walk correctly for all the cases. In
|
||
fact it is necessary to put a greater priority to the operator ' - ' if
|
||
not, we have 8-6+9 = -7 because your parsor realizes initially (6+9 = 15)
|
||
and after (8-15= -7). To solve this problem it is enough to create a
|
||
state between expr and factor which will represent the fact that the
|
||
operator - has priority than it +.
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
Cordially.
|
||
<br>Xavier Prat.
|
||
</STRONG></P>
|
||
</EM></FONT>
|
||
|
||
<P>
|
||
On Wed, Aug 01, 2001 at 05:56:21PM -0500, Michael P. Plezbert wrote:
|
||
</P>
|
||
<P><STRONG>
|
||
I just couldn't let this slip by.
|
||
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
|
||
height="24" width="20" align="middle">
|
||
</STRONG></P>
|
||
<P><STRONG><BLOCKQuote>
|
||
You do NOT want to give the minus operator a greater priority than the
|
||
plus operator, because then expressions like a+b-c would parse as a+(b-c),
|
||
which generally is not what you want. (Algebraically, plus and minus are
|
||
usually given the same priority, so a+b-c means (a+b)-c.)
|
||
</BLOCKQuote></STRONG></P>
|
||
<P><STRONG>
|
||
In fact, giving the minus operator a higher priority in the CUP file
|
||
(using CUP's priority capability) will not change anything given the
|
||
grammar as written in the original article, since the grammar is
|
||
unambiguous with regard to plus and minus.
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
The problem is that the lines in the grammar
|
||
</STRONG></P>
|
||
<Pre>
|
||
expr ::= factor PLUS expr
|
||
| factor MINUS expr
|
||
</Pre>
|
||
<P><STRONG>
|
||
cause the plus and minus operators to be right-associative, when we want
|
||
them to be left-associative.
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
The fix is to changes the lines to be
|
||
</STRONG></P>
|
||
<Pre>
|
||
expr ::= expr PLUS factor
|
||
| expr MINUS factor
|
||
</Pre>
|
||
<P><STRONG>
|
||
This will make the grammar associate the plus and minus operators in the
|
||
usual way.
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
(This may have been what the author of the previous mail meant, but the
|
||
text was unclear and the link to the CUP file was broken.)
|
||
</STRONG></P>
|
||
<p><STRONG>
|
||
Michael
|
||
</STRONG></P>
|
||
<p><em>That broken link had been my fault (sorry) but it was fixed immediately
|
||
when you let us know. Thanks! -- Heather</em></p>
|
||
|
||
<!-- end 1 -->
|
||
<P>
|
||
Michael is right...
|
||
The fix is just to transform the rules of expr for PLUS and MINUS become
|
||
left-associative. Thing which I had made in my preceding fix, but it's true
|
||
that to give a higher priority to MINUS is, in fact, totaly useless...
|
||
</P>
|
||
<P>
|
||
thanks.
|
||
<br>Xavier PRAT.
|
||
</P>
|
||
|
||
<!-- end 10 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="mailbag/11"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
|
||
<FONT COLOR="navy">Re: Mistake ...</FONT></H3>
|
||
Fri, 10 Aug 2001 08:40:29 -0700
|
||
<BR>Waldemar Olenycz
|
||
</P>
|
||
<P><STRONG>
|
||
Eh folks !!
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
Why don't you just remove all the factor productions (which is
|
||
clearly school boy junk ...)
|
||
and leave nothing between <expressions> and <terms> so that the
|
||
precedence directives
|
||
can work freely, and there will be no problem :
|
||
</STRONG></P>
|
||
<P><STRONG><BLOCKQuote>
|
||
ex.
|
||
</BLOCKQuote></STRONG></P>
|
||
<P><STRONG>
|
||
precedence left MINUS, PLUS;
|
||
precedence left TIMES, DIVIDE;
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
and
|
||
</STRONG></P>
|
||
<Pre>
|
||
expr ::= term
|
||
| expr MINUS expr
|
||
| expr PLUS expr
|
||
| expr TIMES expr
|
||
| expr DIVIDE expr
|
||
</Pre>
|
||
<p><em>We needed a bit more clarity, originally we weren't sure what he was
|
||
replying to:</em></p>
|
||
<blockquote>
|
||
<P>
|
||
Generally the examples given along with developement
|
||
packages or with teaching-manuals, should be merely
|
||
considered as simple hints and if used 'as-is', extreme
|
||
care should be taken ...
|
||
</P>
|
||
<P>
|
||
In the case of modern LALR parser generators with
|
||
the feature of precedence-directives :
|
||
</P>
|
||
<P><ol>
|
||
<li> the factor-type productions often present in examples
|
||
(in grammars with expression-productions),
|
||
are error prone and uselessly over-clobber
|
||
grammars.
|
||
<li> thus factor-type productions should simply be left out
|
||
so that precedence rules can work freely as expected.
|
||
</ol>
|
||
</blockquote>
|
||
<P><STRONG>
|
||
Enjoy
|
||
<br>Waldemar
|
||
</STRONG></P>
|
||
|
||
<!-- end 11 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="mailbag/16"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
|
||
<FONT COLOR="navy">Thank you everyone</FONT></H3>
|
||
Fri, 10 Aug 2001 13:39:29 -0700
|
||
<BR>Lindsey Seaton (<a href="mailto:gazette@ssc.com">hetshepsut from yahoo.com</a>)
|
||
|
||
<P>
|
||
On Fri, Aug 10, 2001 at 01:34:54PM -0700, Lindsey Seaton wrote:
|
||
</P>
|
||
<P><STRONG>
|
||
Thank you everyone who helped to answer my question. The web page that was
|
||
linked in one of the e-mails was very helpful and added to my "favorites"
|
||
list for future referance.
|
||
</STRONG></P>
|
||
<P>
|
||
Thanks for letting us know. And when you know a bit more about Linux and
|
||
are able to answer this question for somebody else, please do so. That's
|
||
what keeps the Linux community active.
|
||
</P>
|
||
|
||
<!-- sig -->
|
||
|
||
|
||
<!-- sig -->
|
||
|
||
|
||
<!-- end 16 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="mailbag/18"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
|
||
<FONT COLOR="navy">Learning Perl, part 5 (LG #69)</FONT></H3>
|
||
Sat, 25 Aug 2001 13:11:48 -0400
|
||
<BR>Paulo Jorge (<a href="mailto:gazette@ssc.com?cc=paulojjs@yahoo.com">paulojjs from yahoo.com</a>)
|
||
<br>Reply from Ben Okopnik
|
||
|
||
<STRONG>
|
||
<P>
|
||
I was reading your article in the Linux Gazette about programming perl
|
||
and I have a little problem in a simple script.
|
||
This is the script that should open <TT>/var/log/messages</TT> and search for
|
||
some text:
|
||
</P>
|
||
<Pre>
|
||
#!/usr/bin/perl -w
|
||
use strict
|
||
|
||
open(MESS, "</var/log/messages") or die "Cannot open file: $!\n";
|
||
while(<MESS>) {
|
||
print "$_\n" if /(fail|terminat(ed|ing)|no)/i;
|
||
}
|
||
close MESS;
|
||
</pre>
|
||
<P>
|
||
when I run the script the result is the following:
|
||
<p><code>
|
||
$ ./logs.pl
|
||
<br>syntax error at ./logs.pl line 4, near ") or"
|
||
<br>Execution of ./logs.pl aborted due to compilation errors.
|
||
</code></P>
|
||
<P>
|
||
Do you have a clue about what's going on?
|
||
</P>
|
||
<P>
|
||
I have a RedHat Linux with perl 5.6.0
|
||
</P>
|
||
</STRONG></P>
|
||
<P>
|
||
I believe I've actually mentioned this type of error in one of the
|
||
articles. It's a very deceptive one... and yet shared by <EM>all</EM> languages
|
||
that ignore whitespace, due to the way the parser has to look at the
|
||
code.
|
||
</P>
|
||
<P>
|
||
Look at line 4 carefully. Look at it again. Can't find anything wrong?
|
||
That's because there isn't anything. Instead, take a look at the
|
||
previous line of code, line 2 - it's missing a semicolon at the end!
|
||
When that happens, Perl figures that you simply continued your statement
|
||
further down - so, what it sees is
|
||
</P>
|
||
<P><tt>use strict open(MESS, "</var/log/messages")</tt></P>
|
||
<P>
|
||
at which point it realizes "Uh-oh. We've gone past anything that looks
|
||
like valid syntax for the 'use' function - PANIC TIME!"
|
||
</P>
|
||
<P>
|
||
The lack of a terminator on a previous line is always an error on the
|
||
<EM>current</EM> line.
|
||
</P>
|
||
|
||
<!-- end 18 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="mailbag/19"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
|
||
<FONT COLOR="navy">Learning Perl: thank you</FONT></H3>
|
||
Mon, 27 Aug 2001 08:39:07 +0000
|
||
<BR>Walt Stoneburner (<A HREF="mailto:gazette@ssc.com?cc=wls@wwco.com"
|
||
>wls from wwco.com</A>)
|
||
<P>
|
||
Hey,
|
||
</P>
|
||
<P>
|
||
Just wanted to drop a quick line and say thank you for your Learning
|
||
Perl series in Linux Gazette. I very much enjoyed your writing style,
|
||
technical depth, and approach ... I picked up a lot of useful tips, and
|
||
I've been using Perl for quite a while.
|
||
</P>
|
||
<P>
|
||
Keep up the excellent work.
|
||
</P>
|
||
<P>
|
||
--
|
||
Walt Stoneburner
|
||
</P>
|
||
|
||
<!-- end 19 -->
|
||
|
||
<P> <hr> </p>
|
||
<a name="gaz"></a>
|
||
<!-- =================================================================== -->
|
||
<center><H3><font color="maroon">GAZETTE MATTERS</font></H3></center>
|
||
<P> <HR> <P>
|
||
<!--====================================================================-->
|
||
|
||
<!-- BEGIN GAZETTE MATTERS -->
|
||
|
||
<UL>
|
||
<!-- index_text begins -->
|
||
<li><A HREF="#gaz/1"
|
||
><strong>Mirror searches</strong></a>
|
||
<!-- index_text ends -->
|
||
</UL>
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="gaz/1"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/envelope.gif">
|
||
<FONT COLOR="navy">Mirror searches</FONT></H3>
|
||
Wed, 29 Aug 2001 11:40:54 -0700
|
||
<BR>Mike Orr (<a href="mailto:gazette@ssc.com">LG Editor</a>)
|
||
|
||
<P>
|
||
Per the request of one of our mirrors in Germany, I have added a
|
||
provision for our mirror sites who want to run their own search
|
||
engine. Starting with this issue, the Search link on the home page
|
||
and the TOC page has changed from "Search" to "Search (www.linuxgazette.com)".
|
||
</P>
|
||
<P>
|
||
Mirrors with their own search engine may replace the text between
|
||
</P>
|
||
|
||
<blockquote><pre><!-- *** BEGIN mirror site search link *** -->
|
||
</pre></blockquote>
|
||
<P>
|
||
and
|
||
</P>
|
||
|
||
<blockquote><pre><!-- *** END mirror site search link *** -->
|
||
</pre></blockquote>
|
||
<P>
|
||
with a link to "<TT>(SITE.COM mirror)</TT>" on the TOC page, and
|
||
"Search <TT>(SITE.COM mirror)</TT>" on the home page.
|
||
</P>
|
||
|
||
<!-- sig -->
|
||
|
||
<!-- end 1 -->
|
||
|
||
<P> <hr> </p>
|
||
<!-- *** BEGIN copyright *** -->
|
||
<H5 align="center">This page edited and maintained by the Editors
|
||
of <I>Linux Gazette</I>
|
||
<a href="http://www.linuxgazette.com/copying.html"
|
||
>Copyright ©</a> 2001
|
||
<BR>Published in issue 70 of <I>Linux Gazette</I> September 2001</H5>
|
||
<H6 ALIGN="center">HTML script maintained by
|
||
<A HREF="mailto:star@starshine.org">Heather Stern</a> of
|
||
Starshine Technical Services,
|
||
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
|
||
</H6>
|
||
<!-- *** END copyright *** -->
|
||
<H4 ALIGN="center">"Linux Gazette...<I>making Linux just a little more fun!</I>"</H4>
|
||
<HR>
|
||
|
||
<center>
|
||
<table cellpadding=7><tr><td>
|
||
<IMG SRC="../gx/bytes.gif" border=1 ALT="News Bytes">
|
||
</td><td>
|
||
<H3>Contents:</H3>
|
||
<ul>
|
||
<li><a HREF="#distro">Distro News</A>
|
||
<li><a HREF="#general">News in General</a>
|
||
<li><a HREF="#software">Software Announcements</a>
|
||
</ul>
|
||
</td></tr></table>
|
||
|
||
<STRONG>Selected and formatted by <A HREF="mailto:michael.conry@softhome.net">Michael Conry</A></STRONG>
|
||
</center>
|
||
|
||
|
||
<P> Submitters, send your News Bytes items in
|
||
<FONT SIZE="+2"><STRONG>PLAIN TEXT</STRONG></FONT>
|
||
format. Other formats may be rejected without reading. You have been
|
||
warned! A one- or two-paragraph summary plus URL gets you a better
|
||
announcement than an entire press release.
|
||
|
||
|
||
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<font color="green">
|
||
September 2001 <I>Linux Journal</I>
|
||
</font>
|
||
</H3>
|
||
|
||
<IMG ALT=" " SRC="misc/bytes/lj-cover89.png" WIDTH=200 HEIGHT=268
|
||
ALIGN="left" HSPACE="20">
|
||
|
||
<P>
|
||
The September issue of <A HREF="http://www.linuxjournal.com/"><I>Linux
|
||
Journal</I></A> is on newsstands now.
|
||
This issue focuses on Security. Click
|
||
<A HREF="http://www.linuxjournal.com/lj-issues/issue89/index.html">here</A>
|
||
to view the table of contents, or
|
||
<A HREF="http://www.linuxjournal.com/subscribe/index.html">here</A>
|
||
to subscribe.
|
||
|
||
<P>
|
||
<FONT COLOR="green">All articles through December 1999 are available for
|
||
public reading at
|
||
<A HREF="http://www.linuxjournal.com/lj-issues/mags.html">http://www.linuxjournal.com/lj-issues/mags.html</A></FONT>.
|
||
Recent articles are available on-line for subscribers only at
|
||
<A HREF="http://interactive.linuxjournal.com">
|
||
http://interactive.linuxjournal.com/</A>.
|
||
|
||
<BR CLEAR="all">
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<font color="green">
|
||
September/October 2001 <I>Embedded Linux Journal</I>
|
||
</font>
|
||
</H3>
|
||
|
||
<IMG ALT=" " SRC="misc/bytes/elj-cover05.png" WIDTH=200 HEIGHT=268
|
||
ALIGN="left" HSPACE="20">
|
||
|
||
<P> Click
|
||
<A HREF="http://embedded.linuxjournal.com/magazine/issue05/">here</A>
|
||
to view the table of contents. US residents can subscribe to <I>ELJ</I> for <STRONG>free</STRONG>; just
|
||
<A HREF="http://www.linuxjournal.com/subscribe/index.html">click here</A>.
|
||
Paid subscriptions outside the US are also available; click on the above link
|
||
for more information.
|
||
|
||
<BR CLEAR="all">
|
||
|
||
|
||
|
||
|
||
|
||
<a name="distro"></a>
|
||
<p><hr><p>
|
||
<!-- =================================================================== -->
|
||
<center><H3><font color="green">Distro News</font></H3></center>
|
||
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Debian
|
||
</FONT>
|
||
</H3>
|
||
The <a href="http://www.debian.org/">Debian</a> Project has announced the
|
||
new
|
||
<a href="http://www.demudi.org/">
|
||
Debian Multimedia Distribution</a>
|
||
<hr width="20%" noshade>
|
||
The German "Lebensmittelzeitung" has reported that Globus, a German
|
||
supermarket chain, converted about 480 computers in their cash desk system
|
||
to Debian GNU/Linux. The entire system is designed so that two cashiers can
|
||
share one computer (a 486/25MHz is used most of the time). The story is
|
||
available in
|
||
<a href="http://www.lz-net.de/news/webtechnews/pages/show.prl?params=recent=1&type=3&id=23136">
|
||
German</a>.
|
||
<hr width="20%" noshade>
|
||
More news available from
|
||
<a href="http://www.debian.org/News/weekly/">
|
||
Debian Weekly News</a>
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">SuSE
|
||
</FONT>
|
||
</H3>
|
||
|
||
<a href="http://www.suse.de/en">SuSE Linux</a> has
|
||
<a href="http://www.suse.de/en/news/PressReleases/iseries_developer_edition.html">
|
||
announced</a>
|
||
that it is the first provider to deliver a Linux operating system
|
||
for
|
||
<a href="http://www.ibm.com/">IBM</a>
|
||
eServer iSeries, IBM's high-performance, integrated
|
||
business server for small to mid-sized enterprises.
|
||
In "SuSE Linux Developer Edition for IBM eServer iSeries", SuSE
|
||
now offers system administrators and application developers the
|
||
possibility to make use of SuSE Linux right from the outset - as
|
||
an operating system basis and development platform for e-business
|
||
applications across the enterprise.
|
||
IBM ships the new eServer iSeries with Version 5 Release 1 of its
|
||
OS/400 operating system, which now enables the use of several
|
||
operating systems at the same time.
|
||
|
||
<a name="general"></a>
|
||
<p><hr><p>
|
||
<!-- =================================================================== -->
|
||
<center><H3><font color="green">News in General</font></H3></center>
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Upcoming conferences and events
|
||
</FONT>
|
||
</H3>
|
||
|
||
<P> Listings courtesy <EM>Linux Journal</EM>. See <EM>LJ</EM>'s
|
||
<A HREF="http://noframes.linuxjournal.com/events/">Events</A> page for the
|
||
latest goings-on.
|
||
|
||
<P> <hr> <P> <A NAME="dmca"></A>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Sklyarov, DMCA, FTAA update
|
||
</FONT>
|
||
</H3>
|
||
|
||
<P> As LG went to press, several events unfolded in the Sklyarov/DMCA case:
|
||
|
||
<UL>
|
||
<LI> A US grand jury indicted Dmitry Sklyarov for creating and selling an
|
||
"encryption circumvention" device, illegal under the Digital Millenium
|
||
Copyright Act of 1998. Fair-use advocates were wondering whether
|
||
the Justice Department would drop the charge now that the original complaintant,
|
||
Adobe Systems, Inc, has withdrawn its complaint. But the grand jury surprised
|
||
advocates further by expanding the charge to also indict Dmitry's employer,
|
||
Elcomsoft, with "conspiracy". Even though Elcomsoft is located in
|
||
Russia and the product is legal there, the Justice Department claims US
|
||
jurisdiction because Elcomsoft used a US web payment organization to accept
|
||
orders. Also the extent of the charge is surprising: Dmitry could face a
|
||
prison term of 25 years and a US$2,250,000 fine. Elcomsoft could face a
|
||
US$2,500,000 fine.<P>
|
||
|
||
<LI> Dmitry pled not guilty to the charges. The next step is a court trial,
|
||
which will likely take several months. In the meantime, Dmitry is free on
|
||
US$50,000 bail but may not leave northern California. <P>
|
||
|
||
<LI> The US Copyright Office issued a report saying:
|
||
<OL>
|
||
<LI> it's too early to tell
|
||
whether the DMCA is a success
|
||
<LI> the Office sees insufficient reeason to
|
||
amend the law at this time regarding the "first sale doctrine" (which allows
|
||
the purchaser of a book/CD/videotape to resell it, lend it or give it away as
|
||
a used item). Librarians want to extend this doctrine to digital media;
|
||
publishers do not.
|
||
<LI> the Office thinks the law <EM>should</EM> be amended to allow users to
|
||
make backup copies of software and content they've purchased.
|
||
</OL>
|
||
Many fair-use advocates feel the Office failed to address significant issues
|
||
regarding free speech, and some blamed themselves for arguing their cause on
|
||
Slashdot but failing to write comments to the Copyright Office during the
|
||
public comment period, giving the Office the impression that there was little
|
||
public concern.
|
||
<BR>
|
||
<A HREF="http://www.loc.gov/copyright/reports/studies/dmca/dmca_study.html">
|
||
The Copyright Office report</A> (3 files in PDF format
|
||
covering the report itself, public comments and a public hearing).
|
||
<BR>
|
||
<A HREF="http://www.washingtonpost.com/wp-dyn/articles/A16744-2001Aug29.html">A Washington Post article.</A> <P>
|
||
|
||
<LI> Protests continue in Moscow (Russia), London (England), Boston, San
|
||
Francisco, Los Angeles, Reno, and Black Rock City, Nevada. In Seattle,
|
||
activists have started an education campaign at public libraries, which
|
||
consists of passing out flyers, inviting people to sign a petition, and talking
|
||
to the librarians and staff.
|
||
|
||
</UL>
|
||
|
||
<hr width="20%" noshade>
|
||
|
||
<P>
|
||
The
|
||
<a href="http://www.eff.org/">
|
||
Electronic Frontier Foundation</a> (EFF) is
|
||
<a href="http://www.eff.org/alerts/20010816_eff_ftaa_alert.en.html">
|
||
speaking out</a> against industry
|
||
attempts to get controversial provisions from the US Digital Millenium
|
||
Copyright Act (DMCA) put into the Free Trade of the Americas
|
||
(FTAA) agreement. (The FTAA is a still-unfinished treaty that would
|
||
create a free-trade zone covering North and South America.) "The FTAA
|
||
organization is considering treaty language that mandates nations pass
|
||
anti-circumvention provisions similar to the DMCA, except the FTAA
|
||
treaty grants even greater control to publishers than the DMCA." If you
|
||
feel strongly about this, the EFF invites you to try to change the
|
||
situation and provides suggestions for the sort of letters you could write.
|
||
|
||
<hr width="20%" noshade>
|
||
|
||
<P> Because LG is a monthly publication, we cannot adequately address all
|
||
the developments in the DMCA controversy. We refer you instead to the
|
||
<A HREF="http://lwn.net/"></A>Linux
|
||
Weekly News</A> editorials, the <A HREF="http://www.eff.org/">EFF home
|
||
page</A>, and the various activist sites such as <A
|
||
HREF="http://nodmca.org/">nodmca.org</A> and
|
||
<A HREF="http://www.freesklyarov.org/">freesklyarov.org</A>.
|
||
|
||
<P> <A HREF="http://lwn.net/2001/0830/">LWN's August 30 editorial</A> raises
|
||
the irony of Dmitry possibly getting a longer prison sentance than "mere armed
|
||
robbers, rapists and child molesters". It states, "One way or another, we are
|
||
now seeing the degree of repression that the US is willing to apply to ensure
|
||
that certain kinds of software are not written.... It takes very little
|
||
imagination to picture a future where the general-purpose computer has been
|
||
replaced by a
|
||
<A HREF="http://www.trustedpc.org/">'trusted computing platform'</A>, and
|
||
systems which do not 'seal data within domains' are treated as 'circumvention
|
||
devices'. At what point, exactly, does Linux become an illegal device under the
|
||
DMCA? In a world where programmers face 25-year sentences for code that was
|
||
legal where they wrote it, this vision should not be seen as overly paranoid."
|
||
|
||
<P> An <A HREF="http://lwn.net/2001/0802/">older LWN editorial</A> discusses
|
||
attempts in <STRONG>Canada</STRONG> to insert DMCA-like provisions into its
|
||
copyright law.
|
||
|
||
<hr width="20%" noshade>
|
||
|
||
<P> Meanwhile, Slashdot reports on an
|
||
<A HREF="http://www.npr.org/programs/atc/features/2001/aug/010830.webcasting.html">NPR article</A>
|
||
saying that many US radio stations are pulling the plug on their webcasting
|
||
"due to concerns about advertising, royalties and the DMCA". Slashdot then
|
||
reports on a
|
||
<A HREF="http://www.cnn.com/2001/TECH/internet/08/30/digital.music/index.html">CNN article</A>
|
||
about a study saying "people don't and won't purchase heavily restricted music
|
||
online at higher prices for a less useful item." Slashdot then adds,
|
||
"This is apparently a revelation to the music industry."
|
||
<IMG ALT=":)" SRC="../gx/dennis/smily.gif" WIDTH="20" HEIGH="24">
|
||
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Total Impact and Terra Soft Solutions Partner to Offer
|
||
PowerPC Linux Products
|
||
</FONT>
|
||
</H3>
|
||
|
||
<a href="http://www.totalimpact.com">
|
||
Total Impact</a>, manufacturer of
|
||
G3/G4 computers, and
|
||
<a href="http://www.terrasoftsolutions.com">
|
||
Terra Soft Solutions</a>, a developer of
|
||
PowerPC Linux technologies, have announced a partnership for the tight
|
||
integration and sales of Total Impact's
|
||
<a href="http://www.totalimpact.com/briQ.html">
|
||
briQ</a> with Terra Soft's
|
||
<a href="http://www.yellowdoglinux.com/">Yellow Dog</a>
|
||
and
|
||
<a href="http://www.blacklablinux.com/lab_contact.shtml">
|
||
Black Lab</a> Linux operating systems.
|
||
Total Impact is now bundling the full Yellow Dog Linux 2.0 package with each
|
||
unit sale of the briQ, enhanced with the installation of Black Lab Linux
|
||
upon request. Terra Soft offers the briQ as a stand-alone Yellow Dog Linux
|
||
computational node or integrated into a 4 and 8 node cluster with Black Lab
|
||
Linux installed and configured.
|
||
<p>
|
||
Total Impact has also just
|
||
announced availability of its new
|
||
<a href="http://www.totalimpact.com/Centricity.html">
|
||
Centricity</a> line of Render Engines <20> beta
|
||
tests are "creating anticipation that Centricity systems will revolutionize
|
||
high performance computing with their small size, high processing speeds,
|
||
low power requirements and ease of use".
|
||
|
||
|
||
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">New I/O Module
|
||
</FONT>
|
||
</H3>
|
||
|
||
<P>
|
||
<a href="http://www.men.de">
|
||
MEN Micro's</a>
|
||
new PC-MIP mezzanine card
|
||
featuring a 48-bit TTL I/O interface, may allow embedded system designers
|
||
to quickly
|
||
implement basic digital I/O without an involved development process. For
|
||
simple digital I/O, such as a control switch or an actuator, the new PC<50>
|
||
MIP card can be easily added to a single-board-computer (SBC) or a PC<50> MIP
|
||
carrier card, assuring a rapid completion of the system's development.
|
||
Through the MEN Driver Interface System (MDIS), the P13 is supported by
|
||
drivers for a wide range of operating systems, including VxWorks, OS-9,
|
||
WindowsNT and Linux.
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">New Keyspan USB Products at Linux World
|
||
</FONT>
|
||
</H3>
|
||
<p>
|
||
<a href="http://www.keyspan.com/">
|
||
Keyspan</a> has announced new versions of its USB PDA
|
||
Adapter and its High Speed USB Serial Adapter.
|
||
In addition to "off-the shelf" support for Linux 2.4, Keyspan's
|
||
Serial-to-USB Adapters also support Windows 98, Windows Me and Windows
|
||
2000, as well as Mac OS 8.6 or higher. Beta drivers for Mac OS X are
|
||
also
|
||
<a href="http://www.keyspan.com/support/macosx/">
|
||
available</a>.
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Alabanza Gets Smarts!
|
||
</FONT>
|
||
</H3>
|
||
|
||
<a href="http://www.alabanza.com/">Alabanza Corporation</a>,
|
||
the leading provider of automated Web hosting software,
|
||
announced that it is using
|
||
<a href="http://www.smarts.com/">SMARTS
|
||
</a>InCharge Service Assurance Solutions to sustain service levels and
|
||
improve the user experience for Alabanza's 500 worldwide customers and
|
||
their quarter-million Web sites. Alabanza, has been an early adopter of,
|
||
and is 100 percent dedicated to the Linux operating system. Alabanza said
|
||
it agreed to partner with SMARTS in order to immediately identify and fix
|
||
problems before they affect service delivery. Alabanza's entirely
|
||
Linux-based Automated Web Hosting Software Suite is used by hundreds of Web
|
||
designers and developers, systems integrators, ISPs and telecommunications
|
||
carriers.
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Sair Linux and GNU Newsletter #9
|
||
</FONT>
|
||
</H3>
|
||
<P>
|
||
<a href="http://www.linuxcertification.com/">
|
||
SAIR Linux and GNU Certification's</a> quarterly newsletter, SAIR Linux and
|
||
GNews issue 9, is available for you to view
|
||
<a href="http://www.linuxcertification.com/news/newsletter_9.php">
|
||
online</a>.
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">IBM
|
||
</FONT>
|
||
</H3>
|
||
|
||
<P><a href="http://www.ibm.com/">IBM</a> has
|
||
announced the new IBM "Start Now" Solutions for e-business, a family of
|
||
offerings to help small and medium businesses (SMB) rapidly implement
|
||
powerful, cost-effective, e-business solutions.
|
||
The eight Start Now Solutions, including three Linux-based solutions,
|
||
"fulfill the requirements of e-business--from initial Internet access,
|
||
through e-mail, research and information, Web site management, simple and
|
||
complex e-commerce, business intelligence, integrated activities and new
|
||
business opportunities".
|
||
For more information on IBM Start Now solutions, visit
|
||
<a href="http://www.ibm.com/software/smb">
|
||
http://www.ibm.com/software/smb</a>.
|
||
|
||
<hr width="20%" noshade>
|
||
IBM has also announced the availability of a free Software
|
||
Evaluation Kit for Linux. This kit will help developers create new
|
||
applications for the explosive Linux market. With the number of
|
||
Linux-based applications growing over 40 percent this year, this evaluation
|
||
kit will help drive new applications for a variety of industries, including
|
||
finance, retail, and education.
|
||
More information from
|
||
<a href="http://www.ibm.com/linux/software">www.ibm.com/linux/software</a>
|
||
and
|
||
<a href="http://www.ibm.com/linux/">www.ibm.com/linux/</a>.
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Book "Advanced Linux 3D Graphics Programming" available
|
||
</FONT>
|
||
</H3>
|
||
|
||
<P> The book "Advanced Linux 3D Graphics Programming" is now available for
|
||
purchase. It is the follow-up volume to the first book "Linux 3D Graphics
|
||
Programming". This second volume provides programmers who are experienced in
|
||
both Linux and fundamental 3D graphics concepts with a well-rounded perspective
|
||
on 3D theory and practice within the context of programming larger interactive
|
||
3D applications such as games. It covers such topics as texture and light
|
||
mapping, creating compatible morph targets in Blender, creating and importing IK
|
||
animations into a 3D engine, BSP trees (node and leaf based), portals,
|
||
level editing, particle systems, collision detection, digital sound, content
|
||
creation systems, and more. A table of contents is viewable
|
||
<a href="http://www.linux3dgraphicsprogramming.org/book.shtml">
|
||
online</a> and if you like what you see,
|
||
<a href="http://www.wordware.com/Merchant2/agent.mv?AG=Norman&SC<53>SK&S=wwpub&A<>PR&Q=1&P56228538">
|
||
purchase online</a>.
|
||
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">unixboulevard.com
|
||
</FONT>
|
||
</H3>
|
||
|
||
<P>
|
||
<a href="http://www.unixboulevard.com">
|
||
UnixBoulevard.com</a> is a free and upcoming site designed to be a choice web
|
||
location for those individuals and organizations that use, manage Unix based
|
||
servers or Networks. The site provides product and technical support
|
||
information as well as a forum for UNIX community members to interact.
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">CDW is offering free VXA media for Linux
|
||
</FONT>
|
||
</H3>
|
||
|
||
<a href="http://www.cdw.com/">CDW</a> a direct solutions
|
||
provider of complete, customized technology solutions, is offering 5 free
|
||
33/66GB VXA V17 tapes for data storage and backup with the purchase of a
|
||
<a href="http://www.vxa.com">
|
||
VXA</a>
|
||
RakPak or VXA AutoPak. The promotion offers up to 660GB of free media at a
|
||
value of more than $350 and runs through the end of September.
|
||
The offer is available by visiting CDW at
|
||
<a href="http://www.cdw.com">http://www.cdw.com</a> and entering
|
||
"VXA with free media" in the SmartSearch box on the upper right hand corner
|
||
of the page.
|
||
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">GX Technology Uses Linux NetworX Cluster System
|
||
in Oil and Gas Exploration
|
||
</FONT>
|
||
</H3>
|
||
|
||
<P>
|
||
<a href="http://www.linuxnetworx.com">
|
||
Linux NetworX</a>, a provider of powerful and
|
||
easy-to-manage cluster computing solutions, announced today that seismic imaging
|
||
solutions company
|
||
<a href="http://www.gxt.com">
|
||
GX Technology</a> has purchased an 84-processor Evolocity computer
|
||
cluster to be used in its oil and gas exploration
|
||
efforts. This is the third cluster computer system provided to GX Technology
|
||
by Linux NetworX.
|
||
|
||
<P> Linux NetworX optimized the Evolocity cluster to work with GX Technology's seismic
|
||
imaging applications to perform processes such as wave equation and Kirchhoff
|
||
pre-stack depth migration and prestack time migration. The 42-node Evolocity
|
||
system includes 84 1.2 GHz AMD Athlon MP processors, with each node containing
|
||
1.5 GB of memory, and two 10/100 Ethernet networks for redundancy. GX Technology
|
||
also utilizes the Linux NetworX ClusterWorX management software tools, and signed
|
||
an on-going service agreement to ensure system stability.
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Linux Links
|
||
</FONT>
|
||
</H3>
|
||
|
||
<a href="http://www.thedukeofurl.org">
|
||
The Duke of URL</a>:
|
||
<ul>
|
||
<li><a href="http://www.thedukeofurl.org/reviews/misc/linuxguide12">
|
||
Linux Buyer's Guide #12</a>
|
||
<li><a href="http://www.thedukeofurl.org/reviews/misc/slackware80">Review of
|
||
Slackware Linux 8.0</a>
|
||
</ul>
|
||
|
||
<P>
|
||
Linux project in Mexican schools (Red Escolar)
|
||
<a href="http://www.wired.com/news/technology/0,1282,45737,00.html">
|
||
fails</a>, largely due to "winmodem" issues it seems. More positively,
|
||
Linux seems to be
|
||
<a href="http://www.wired.com/news/school/0,1383,45862,00.html">
|
||
finding a role
|
||
</a> in a Colorado school district.
|
||
News courtesy <a href="http://www.slashdot.org">Slashdot</a>.
|
||
<p>
|
||
<a href="http://www.canadacomputes.com/">
|
||
CanadaComputes.com</a> have a
|
||
<a href="http://www.canadacomputes.com/v3/story/1,1017,7178,00.html?tag<61>&sby">
|
||
round up</a> of the Linux web browsers currently available.
|
||
|
||
<P> <I>Linux Journal</I> web articles:
|
||
<UL>
|
||
<LI> <A HREF="http://www.linuxjournal.com/articles/linux_review/0055.html">
|
||
Vi IMproved--Vim and Happy Hacking Keyboard Lite 2</A>, a book and keyboard
|
||
review by Don Marti.
|
||
<LI> You Can Get There from Here, Marcel's latest series.
|
||
<A HREF="http://www.linuxjournal.com/articles/sysadmin/0064.html">part 1</A>
|
||
|
||
</UL>
|
||
|
||
<p><a href="http://suite101.com/">
|
||
Suite101.com</a> have added a new
|
||
<a href="http://suite101.com/welcome.cfm/linux">
|
||
Linux</a> site aimed at explaining to Windows users what it might be like
|
||
if they changed to Linux.
|
||
|
||
|
||
<p>
|
||
<a href="http://www.theregister.co.uk/">The Register</a> have
|
||
<a href="http://www.theregister.co.uk/content/55/20714.html">
|
||
reported</a> that
|
||
several Red Hat 6.2 systems with default installation were cracked in 72
|
||
hours during a security research
|
||
<a href="http://project.honeynet.org/">
|
||
project</a> that intentionally left them online for intruders to find.
|
||
|
||
<p>
|
||
<a href="http://www.systemlogic.net/agurusworld/19/">Evaluation
|
||
</a>
|
||
of Windows XP beta compared to Linux Mandrake 8.0 from the point of view of
|
||
usability and aesthetics. The review says Windows is getting better than
|
||
it used to be; Microsoft is learning some of Linux's tricks.
|
||
|
||
<P> RPM
|
||
<a href="http://www.userfriendly.net/linux/RPM/search.php">Search page
|
||
</a>on the User Friendly site.
|
||
|
||
<P>
|
||
<a href="http://www.slashdot.org/">Slashdot</a>
|
||
had a recent Slashdot talkback
|
||
<a href="http://slashdot.org/askslashdot/01/08/13/0151247.shtml">
|
||
thread</a> on which is the best Linux distribution for a newbie.
|
||
|
||
<P>
|
||
<A HREF="http://www.anandtech.com/IT/showdoc.html?i=1527&p=1">
|
||
The State of Corporate IT: A case for Linux</A>.
|
||
"By many accounts, the largest cost of ownership increases that
|
||
corporations have faced have been licensing related. As NT has become a
|
||
mainstay, licensing terms have become more specific and more expensive."<BR>
|
||
This story traces a 7,000-employee company that switched from Unix/Novell
|
||
to NT for "ease of administration and a lower cost of ownership, but years
|
||
into the transition, administering and licensing costs soared....
|
||
While the previous Unix and Novell platforms had handled file, print and mail
|
||
servers on a single server, NT now needed one machine for each service plus a
|
||
dedicated backup for each.....
|
||
Red Hat brought a single Pentium class system for a site visit and thanks to
|
||
the early legwork their engineers had done, were able to integrate the box into
|
||
the network and take over all file and print server requests for one busy
|
||
segment within four hours. The system ran for the next 10 business days without
|
||
any downtime, something NT machines had not been able to do very often....
|
||
Red Hat had proven to be a helpful ally. Instead of trying to push a
|
||
whole-scale replacement of the infrastructure, they had worked to supplement
|
||
it.... Some months later, with the market still soft and the bottom line
|
||
increasingly important to shareholders, the team feels they made the right
|
||
decision."
|
||
Courtesy Slashdot.
|
||
|
||
|
||
<P>
|
||
The
|
||
<a href="http://latimes.com/">Los Angeles Times</a> have a
|
||
<a href="http://latimes.com/technology/la-000064605aug09.story">
|
||
science fiction story</a>
|
||
about a future world in which Windows is everywhere,
|
||
causing worldwide catastrophe. Courtesy
|
||
<a href="www.slashdot.org">Slashdot</a>.
|
||
|
||
|
||
|
||
<a name="software"></a>
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<center><H3><font color="green">Software Announcements</font></H3></center>
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Loki
|
||
</FONT>
|
||
</H3>
|
||
<p>
|
||
<a href="http://www.timegatestudios.com">
|
||
TimeGate Studios, Inc.</a> and
|
||
<a href="http://www.lokigames.com/">
|
||
Loki Software</a>
|
||
are
|
||
excited to announce that the demo for Kohan: Immortal Sovereigns on the
|
||
Linux platform is now available for free download at
|
||
<a href="http://www.lokigames.com/products/demos.php3">
|
||
http://www.lokigames.com/products/demos.php3</a>
|
||
For more information, please visit the official
|
||
<a href="http://www.kohan.net">game site</a>.
|
||
Pre-orders can be placed from the Loki
|
||
<a href="http://www.lokigames.com/orders/">
|
||
webstore</a>.
|
||
|
||
<hr width="20%" noshade>
|
||
|
||
<P>
|
||
<a href="http://www.nostarch.com/">
|
||
No Starch Press</a> and
|
||
<a href="http://www.lokigames.com/">
|
||
Loki Software</a> have announced
|
||
the launch of the complete and authoritative guide to developing
|
||
games for Linux. PROGRAMMING LINUX GAMES: LEARN TO WRITE THE GAMES
|
||
LINUX PEOPLE PLAY (August 2001, 1-886411-49-2, $39.95, paperback, 432
|
||
pp., <a href="http://www.nostarch.com/?plg">
|
||
http://www.nostarch.com/?plg</a>) guides readers through
|
||
important Linux development tools and gaming APIs, with a special
|
||
focus on Simple DirectMedia Layer (SDL). Written by the gaming
|
||
masters at Loki Software, this book is the ultimate resource for
|
||
Linux game developers.
|
||
Available in bookstores, from Loki Software
|
||
(<a href="http://www.lokigames.com/orders">http://www.lokigames.com/orders</a>),
|
||
or from No Starch Press
|
||
(1-800-420-7240, <a href="http://www.nostarch.com">http://www.nostarch.com</a>).
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">eVe Visual Search Toolkit for Linux
|
||
</FONT>
|
||
</H3>
|
||
|
||
<P>
|
||
<a href="http://www.evisionglobal.com">
|
||
eVision</a> is excited to announce the release of version 2.1 public beta
|
||
of the eVe visual search Java-based SDK for Linux. The toolkit lets Linux
|
||
developers create search applications that use images and visual similarity
|
||
rather than keywords and text.
|
||
The user selects a sample query image or partial image, then the search
|
||
engine finds and ranks other images that are visually similar with respect
|
||
to the objects in the image and attributes such as color, texture, shape
|
||
and 3D shading. This technology can be applied to image content, video
|
||
content, audio content and any other digital pattern.
|
||
You can sign up to download a free 500 image limited version of the
|
||
SDK at
|
||
<a href="http://www.evisionglobal.com/developers/sdk/">
|
||
http://www.evisionglobal.com/developers/sdk/</a>
|
||
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Great Bridge WebSuite for Developers
|
||
</FONT>
|
||
</H3>
|
||
|
||
|
||
<P><a href="http://www.greatbridge.com">
|
||
Great Bridge</a>, a provider of commercial service and
|
||
support for the open source database
|
||
<a href="http://www.postgresql.org/">
|
||
PostgreSQL</a>, has announced this morning
|
||
an open source application development platform that uses the world's most
|
||
advanced open source tools.
|
||
Great Bridge WebSuite is an integrated open source platform that combines
|
||
the PostgreSQL database, PHP scripting language and Apache Web server for
|
||
building high-performance Web-based applications.
|
||
|
||
<P> <hr> <P>
|
||
<!-- =================================================================== -->
|
||
<H3><IMG ALT=" " SRC="../gx/bolt.gif">
|
||
<FONT COLOR="green">Free APStripFiles Utility
|
||
</FONT>
|
||
</H3>
|
||
|
||
<P>
|
||
<a href="http://www.appligent.com">
|
||
Appligent, Inc.</a> is offering a new utility free of charge.
|
||
APStripFiles is a command line application that removes attached or embedded
|
||
files from PDF documents. It enables you to protect your systems from malicious
|
||
unwanted PDF file attachments.
|
||
<P> APStripFiles for AIX, HP-UX, Sun Solaris and Red Hat Linux can be
|
||
downloaded free from,,
|
||
<a href="http://www.appligent.com/newpages/freeSoftware_Unix.html">
|
||
http://www.appligent.com/newpages/freeSoftware_Unix.html</a>
|
||
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <P>
|
||
<H5 ALIGN=center>
|
||
Copyright © 2001, Michael Conry and
|
||
the Editors of <A HREF="mailto:gazette@ssc.com"><I>Linux Gazette</I></A>.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
<center>
|
||
<H1><A NAME="answer">
|
||
<img src="../gx/dennis/qbubble.gif" alt="(?)"
|
||
border="0" align="middle">
|
||
<font color="#B03060">The Answer Gang</font>
|
||
<img src="../gx/dennis/bbubble.gif" alt="(!)"
|
||
border="0" align="middle">
|
||
</A></H1>
|
||
<BR>
|
||
<H4>By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and the Gang,
|
||
the Editors of Linux Gazette...
|
||
and You!
|
||
<br>Send questions (or interesting answers) to
|
||
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a>
|
||
</H4>
|
||
<p><em><font color="#990000">There is no guarantee that your questions
|
||
here will <b>ever</b> be answered. Readers at confidential sites
|
||
must provide permission to publish. However, you can be published
|
||
anonymously - just let us know!
|
||
</font></em></p>
|
||
</center>
|
||
|
||
<p><hr><p>
|
||
|
||
<H3>Contents:</H3>
|
||
<dl>
|
||
<dt><a href="#tag/greeting"
|
||
><strong>¶: Greetings From Heather Stern</strong></A></dl>
|
||
|
||
<DL>
|
||
<!-- index_text begins -->
|
||
<dt><A HREF="#tag/1"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
><strong>Scary disk error</strong></a>
|
||
<dt><A HREF="#tag/2"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
><strong>question please please please answer</strong></a>
|
||
<dt><A HREF="#tag/3"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
></a>ssh NAT/Firewall Piercing Trick --or--
|
||
<dd><A HREF="#tag/3"
|
||
><strong>Piercing the Veil</strong></a>
|
||
<br>Using OpenSSH Remote Tunnels to Get Back In
|
||
<dt><A HREF="#tag/4"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
><strong>Every time Modem Hangup When Connect time 3.3 min.</strong></a>
|
||
<dt><A HREF="#tag/5"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
><strong>Bash</strong></a>
|
||
<dt><A HREF="#tag/6"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
><strong>question</strong></a> about fingerd
|
||
<dt><A HREF="#tag/7"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
><strong>Kernel Compilation</strong></a>
|
||
<dt><A HREF="#tag/8"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
><strong>Re: Linux solution to syncing with Exchange Address books as a client</strong></a>
|
||
<dt><A HREF="#tag/10"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
><strong>Password aging</strong></a>
|
||
<dt><A HREF="#tag/11"
|
||
><img src="../gx/dennis/qbub.gif" height="28" width="50"
|
||
alt="(?)" border="0"
|
||
><strong>inetd and figlet</strong></a>
|
||
<!-- index_text ends -->
|
||
</DL>
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<A NAME="tag/greeting"><HR WIDTH="75%" ALIGN="center"></A>
|
||
<H3 align="left"><img src="../gx/dennis/hbubble.gif"
|
||
height="50" width="60" alt="(¶) " border="0"
|
||
>Greetings from Heather Stern</H3>
|
||
<!-- begin hgreeting -->
|
||
<!-- end hgreeting -->
|
||
<!-- . . . . . . . . . . . . . . . . . . . -->
|
||
<a name="tag/1"><HR WIDTH="75%" ALIGN="center"></a>
|
||
<!-- begin 0 -->
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>Scary disk error</H3>
|
||
|
||
|
||
<p><strong>From Mike Orr
|
||
</strong></p>
|
||
<p align="right"><strong>Answered By Ben Okopnik
|
||
<br></strong></p>
|
||
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Just got a disturbing disk error. It was on my 486 laptop, which I've
|
||
only used for reading and writing text files on the past few years because
|
||
of its limited capacity (16 MB RAM, 512 K HD).
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
1) I was in vi, and it caught a SEGV. Fortunately, it was able save its
|
||
recovery file. I restarted vi, recovered the file, saved it, deleted the
|
||
recovery file and went on typing. Then,
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Could be memory, could be HD...
|
||
</BLOCKQUOTE>
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
2) I got an oops. Something about paging. I figured, common enough oops,
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Ah. This sounds like memory.
|
||
</BLOCKQUOTE>
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
even though it's never happened on that computer, so I pulled out the power
|
||
cable for a second and rebooted. (The battery had long ago stopped holding
|
||
any charge.) Linux found that the HD had been mounted uncleanly (no duh)
|
||
and started fsck. Fsck found two deleted files with zero dtime and fixed
|
||
them. I was glad I had saved the file after recovering it since I'd
|
||
deleted the recovery file. Then--
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
3) "Kernel panic: free list corrupted". I rebooted. Again the same error.
|
||
What do you run when fsck doesn't work?? Is all my data gone bye-bye?
|
||
Not that it was that much, and I was about to blast away the current
|
||
(<A HREF="http://www.debian.org/">Debian</A>) installation anyway and practice installing Rock Linux. (If,
|
||
of course, the disk is good enough to be reformattable.)
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
4) A happy ending. I rebooted again to make sure I had the panic
|
||
message right, and this time fsck completed and I got a login prompt.
|
||
Quickly I tarred up my data and copied it onto a floppy.
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
I wonder if this will make Wacky Topic of the Month.
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Had that happen... oh, can't even remember now. Something crunchy
|
||
happened, and required multiple fsck's. It would get a little further
|
||
every time, and finally got it straightened out. IIRC, it took three or
|
||
four reboots to get it - and I had exactly the same "if the salt have
|
||
lost his savour, wherewith shall it be seasoned?" moment. Pretty scary
|
||
to think that "fsck" doesn't work, just at the moment when it's the
|
||
only thing that _can._ As far as I'm concerned, "fsck" should have a
|
||
default "auto-restart" mode that can be interrupted with a 'Ctrl-C';
|
||
when it stops like that, the typical user's response isn't going to be
|
||
"reboot and try again" - it's "Ohmygawd, MY MACHINE IS BROKEN!"
|
||
</BLOCKQUOTE>
|
||
<p><strong><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Doesn't fsck automatically restart sometimes? I know I've seen it do
|
||
this, although the last time was early in the kernel 2.2 days. Is it an
|
||
ex-feature? Or maybe <A HREF="http://www.debian.org/">Debian</A> did it with a 'while' loop or something.
|
||
</strong></p>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Can't say. I've only had "fsck" run in 'repair mode' three times, all
|
||
in the dim dark past; never saw it restart. I'm pretty sure all three
|
||
were in, or before, the 2.0 days.
|
||
</BLOCKQUOTE>
|
||
<p><strong><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Of course, you can't interrupt an oops with a Ctrl-C. When an oops
|
||
happens, the machine halts and must be reset.
|
||
</strong></p>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Hmm. Normal disk repair (fixing up inode dtimes and such) shouldn't
|
||
produce an oops; theoretically, there is a large but fixed number of
|
||
things that can be wrong, and there is supposed to be a programmatic
|
||
response to each of them. The only reasons I could see for an oops to
|
||
occur while "fsck" is running are 1) bad memory - which is an unrelated
|
||
issue - or 2) the inode that contains "fsck" itself is damaged. Other
|
||
than those, I can't see why a loop of the sort I suggested can't be
|
||
written... really, I can't see ANY reason for "fsck" to freeze in the
|
||
first place. It just sounds like some unaccounted-for cases that come up
|
||
- and even that should be "catchable".
|
||
</BLOCKQUOTE>
|
||
|
||
<p><strong><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Sorry, I wasn't thinking clearly. An oops is most likely bad memory, a
|
||
bad disk or cosmic rays. A kernel panic (in my experience) is more likely
|
||
to be a programming, configuration or environment issue. In either case, the
|
||
machine halts and you can't recover except by resetting it. What is
|
||
curious is, is there a certain moment during disk activity where a SEGV
|
||
or oops would leave the filesystem in a "free list corrupted" state?
|
||
Intuitively, there must be.
|
||
</strong></p>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Mmmm... sure. I'm not a kernel expert by any means, but if the machine
|
||
crashes while the free list is being updated, that would make it
|
||
corrupt. Not that it's really a big deal, the way it would be if
|
||
individual inode pointers got fried - but it's certainly a much better
|
||
mechanism than FAT, where a couple of K worth of mis-written data can
|
||
fry your entire drive contents.
|
||
</BLOCKQUOTE>
|
||
|
||
<p><strong><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
The next question is, is it possible to
|
||
retrieve the data after such an error (short of running a sector-by-sector
|
||
analysis)? Apparently there is, and fsck does it, although it takes a
|
||
couple runs to finish the repair.
|
||
</strong></p>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Sure; it would be a inode-by-inode analysis ("anything that's not a
|
||
superblock, and is not owned by a file, and <a few other considerations
|
||
that I can't think of at the moment> must be free space"), but a
|
||
corrupted free list isn't that big of a thing. It's <EM>much</EM> easier to
|
||
find out which blocks are really free, rather than trying to find which
|
||
ones aren't _and_ how they're connected to the rest of the structure.
|
||
</BLOCKQUOTE>
|
||
<p><strong><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Too bad fsck can't somehow avoid causing a kernel panic or that the kernel
|
||
can't figure out the situation enough to provide a more reassuring error
|
||
message.
|
||
</strong></p>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Agreed. That kind of tools, the "fall back if all else fails" kind,
|
||
should run flawlessly.
|
||
</BLOCKQUOTE>
|
||
|
||
<P><FONT COLOR="#000099"><EM><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
The worst fsck case Jim Dennis ever had against required him to run
|
||
fsck 6 times, but it <EM>did</EM> eventually succeed in cleaning up the mess
|
||
he had made. (He had told his video controller to use the address
|
||
range which the hard disk controller actually owned. Typos can be
|
||
<EM>really</EM> bad for you at that level.) The moral here is, if at first
|
||
fsck does not succeed, don't give up all hope. You may prefer to
|
||
reformat afterwards anyway, but you should get a decent chance to
|
||
rescue your important data first. -- Heather
|
||
</EM></FONT></P>
|
||
|
||
<!-- end 1 -->
|
||
<!-- . . . . . . . . . . . . . . . . . . . -->
|
||
<a name="tag/2"><HR WIDTH="75%" ALIGN="center"></a>
|
||
<!-- begin 2 -->
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>question please please please answer</H3>
|
||
|
||
|
||
<p><strong>From Lindsey Seaton
|
||
</strong></p>
|
||
<p align="right"><strong>Answered By Frank Rodolf, madeline, Thomas Adam
|
||
<br></strong></p>
|
||
|
||
<!-- sig -->
|
||
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Excuse me. I have a question
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
As a computer project, I was assigned to get on the computer and
|
||
find out what linux is and what it is used for. I don't know if it's
|
||
an orginization or if it's part of HTML script or anything. Please
|
||
e-mail me back with the answer please. I just know so little about
|
||
computers and one name can mean so many different things on
|
||
the internet. I had only just now I had been spelling it wrong (linex)
|
||
until I found out it was spelled linux.
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Frank]
|
||
There are so many possible answers to that question, I won't even start
|
||
to try to answer it.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
What I can do, is send you to the list of Frequently Asked Questions
|
||
(FAQ). The question you ask is the very first question in there. You
|
||
can find it here:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><BLOCKQuote>
|
||
<A HREF="http://www.linuxdoc.org/FAQ/Linux-FAQ/index.html"
|
||
>http://www.linuxdoc.org/FAQ/Linux-FAQ/index.html</A>
|
||
</BLOCKQuote></BLOCKQUOTE>
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Thank you for your help.
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Frank]
|
||
I hope the link helps you!
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Madeline]
|
||
I just looked at the FAQ and noticed that they're really not too helpful
|
||
for a beginner. So here's a more straightforward answer:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Like Windows and Mac OS, Linux is an operating system, which is a program
|
||
that is in charge of organizing and running everything on your computer.
|
||
Here is a definition of operating system:
|
||
<A HREF="http://www.webopedia.com/TERM/o/operating_system.html"
|
||
>http://www.webopedia.com/TERM/o/operating_system.html</A>
|
||
</BLOCKQuote>
|
||
<BLOCKQUOTE>
|
||
Unlike Windows and Mac OS, Linux is free, and the programming code that
|
||
was used to create it is available to everyone. As a result, there are
|
||
many versions of linux (such as <A HREF="http://www.redhat.com/">Red Hat</A>, Gnome, and <A HREF="http://www.suse.com/">SuSE</A>) which are
|
||
somewhat different but with the same foundation (called a "kernel"--this
|
||
kernel is updated every so often by the creator of Linux, Linus Torvalds,
|
||
and company). Linux is usually the operating system of choice for computer
|
||
programmers and scientists because it is very stable and well-designed
|
||
(not crashing randomly and often as Windows tends to do).
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
I hope this helps.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Madeline
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Mike]
|
||
Thanks, Madeline, I was about to say something similar.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Many people also find Linux and other Unix derivatives more flexible
|
||
than other operating systems.
|
||
</BLOCKQUOTE>
|
||
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Thomas Adam]
|
||
I don't really remember this address as being
|
||
advertised as a "do your research/homework" one.
|
||
Nevertheless, I can try and answer your question....
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Firstly, your question is far too broad. There have
|
||
been numerous books written about the history and use
|
||
of Linux, and it is beyond the scope of my knowledge
|
||
to tell you everything.
|
||
</BLOCKQUOTE>
|
||
<p><em>Considering that Thomas is "The Weekend Mechanic" and has
|
||
written several articles for the </em>Linux Gazette</em>
|
||
over the years, that's saying something significant. -- Heather</em></p>
|
||
<BLOCKQUOTE>
|
||
Linux was created by scratch in ~1991, by Linus
|
||
Torvalds, a very gifted person for Finland. His goal
|
||
was to create a Unix like operating system. Thus, he
|
||
was assisted by numerous loosly-knit programmers over
|
||
the world, to produce the kernel, the "heart" of the
|
||
operating system. Essentially, this is what "Linux"
|
||
refers to.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Linux is an operating system, and is an alternative
|
||
to the de facto operating system "MS-Windows". Linux
|
||
is a Unix-like operating system (as I have already
|
||
said). There are many different "distibutions" of
|
||
Linux, which use different means of distributing data,
|
||
either in RPM format, .tgz format etc.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
If you are interested, you could try Linux out (by
|
||
using a floppy based distibution, such as HAL91
|
||
available from the following:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><BLOCKQuote>
|
||
<A HREF="http://www.itm.tu-clausthal.de/~perle/hal91"
|
||
>http://www.itm.tu-clausthal.de/~perle/hal91</A>
|
||
</BLOCKQuote></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
and then you can run Linux off a floppy disk. Bear in
|
||
mind however, that this will offer no GUI frontend.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
I hope this has answered a little of your question,
|
||
even if it is brief.
|
||
</BLOCKQUOTE>
|
||
|
||
<!-- end 3 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<A NAME="tag/3"><HR WIDTH="75%" ALIGN="center"></A>
|
||
<!-- begin 4 -->
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>Piercing the Veil</H3>
|
||
<H4 ALIGN="center">Using OpenSSH Remote Tunnels to Get Back In</H4>
|
||
|
||
|
||
<p align="right"><strong>Answered By Jim Dennis
|
||
<br></strong></p>
|
||
|
||
<!-- sig -->
|
||
|
||
<!-- ::
|
||
Piercing the Veil
|
||
~~~~~~~~~~~~~~~~~
|
||
Using OpenSSH Remote Tunnels to Get Back In
|
||
:: -->
|
||
<BLOCKQUOTE>
|
||
Problem: You're using a system at work that's on an internal
|
||
(non-routable) IP address (as per RFC191
|
||
<IMG SRC="../gx/dennis/smily.gif" ALT="8)"
|
||
height="24" width="20" align="middle">, or that's behind a
|
||
set of proxy servers or IP masquerading routers. You want to
|
||
work from home, but you can't get into your system.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
WARNING: This hack may be a violation of the usage policies
|
||
either of the networks involved! I'm describing how to use
|
||
the tool, you assume all responsibility for HOW you use it.
|
||
(In my case I'm the one who sets the policy; this is just a
|
||
convenient trick until I get around to setting up a proper
|
||
<A HREF="http://www.xs4all.nl/~freeswan/">FreeS/WAN</A> IPSec gateway).
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Let's assume that you have a Linux desktop or server "inside"
|
||
and another one "at home" (obviously this trick will work
|
||
regardless of where "inside" and "at home" really are). Let's
|
||
also assume that you have OpenSSH installed at both ends. (It
|
||
should work with any version of SSH/Unix and possibly with
|
||
some Windows or other clients, I don't know).
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
As root on your internal machine, issue the following
|
||
command:
|
||
</BLOCKQUOTE>
|
||
<pre>
|
||
ssh -f -R $SOMEPORT:localhost:22 $YOURSELF@$HOME 'while :; do sleep 86400; done'
|
||
</pre>
|
||
<BLOCKQUOTE>
|
||
... this will authenticate you as $YOURSELF on your
|
||
machine, $HOME and will will forward tcp traffic to
|
||
$SOMEPORT on $HOME back trough the tunnel to port 22
|
||
(the SSH daemon) on localhost (your "inside" machine at
|
||
work). You could forward the traffic to any other port,
|
||
such as telnet, but that would involve configuring your
|
||
"inside" machine to allow telnet and (to be prudent)
|
||
configuring its TCP wrappers, ipchains etc, to disabled
|
||
all telnet that didn't come through (one of) our tunnels.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
The fluff on the end is just a command for ssh to run,
|
||
it will loop around forever (the : shell built-in command
|
||
is always "true") sleeping for a whole day (86400 seconds)
|
||
at a time. The -f causes this whole command to fork into
|
||
the background (becomming a daemon) after performing any
|
||
authentication (allowing you to enter passwords, if you
|
||
like).
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
To use this tunnel (later, say from home) you'd log into
|
||
$HOME as yourself (or any other user!) and run a command
|
||
like:
|
||
</BLOCKQUOTE>
|
||
<pre>
|
||
ssh -p $SOMEPORT $WORKSELF@localhost ...
|
||
</pre>
|
||
<BLOCKQUOTE>
|
||
or:
|
||
</BLOCKQUOTE>
|
||
<pre>
|
||
ssh -p $SOMEPORT -l $WORKSELF localhost
|
||
</pre>
|
||
<BLOCKQUOTE>
|
||
... Notice that you use the -p to force the ssh client
|
||
to connect to your arbitrarily chosen port (I use 1022, 2022,
|
||
etc. since they end in "22" which is the IANA recognized ssh
|
||
protocol port). The -l (login as) or the form $WORKSELF@ are
|
||
equivalent. Note that you user name at work needn't match
|
||
your name at home, but you must use the "REMOTE" username
|
||
to connect to the forwarded port.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
That bears repeating since it looks weird! You have to
|
||
use the login name for the remote system even though the command
|
||
looks like your connecting to the local host (your connection
|
||
is being <EM>FORWARDED</EM>).
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
If you use these commands you can log into a shell and
|
||
work interactively. You can add additional arguments to
|
||
execute non-interactive commands, you can set up your
|
||
ssh keys (ssh-keygen, append $HOME/~/.ssh/identity.pub
|
||
to $WORK~/.ssh/authorized_keys) so that you can gain access
|
||
without typing your password (though you should configure
|
||
your ssh key with a passphrase and use ssh-agent to manage
|
||
that for you; then you only have to enter you passphrase
|
||
once per login session to access all of your ssh keyed
|
||
accounts).
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
You can also copy files over this tunnel using the scp command
|
||
like so:
|
||
</BLOCKQUOTE>
|
||
<pre>
|
||
scp -P $SOMEPORT $WORKSELF@localhost:$SOURCEPATH $TARGET
|
||
</pre>
|
||
<BLOCKQUOTE>
|
||
... not that this is an uppercase "P" to select the port,
|
||
a niggling difference between the syntax of the ssh client
|
||
and that of the scp utility. Of course this can be done
|
||
in either direction; this example copies a remote file to
|
||
a local directory or filename, we're reverse the arguments
|
||
to copy a local file to the remote system.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
As I hinted before, you are actually double encrypting this
|
||
session. You tunnel to the remote system is encrypted, and
|
||
<EM>in this case</EM> the connections coming back are to a copy of
|
||
the sshd back on your originating machine; which does it's
|
||
encryption anyway. However, the double encryption doesn't
|
||
cost enough CPU time to be worth installing a non-encrypting
|
||
telnet or rsh and configuring it to <EM>only</EM> respond to requests
|
||
"from" localhost (from the tunnels).
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
One important limitation of this technique: Only one remote
|
||
user/session can connect through this tunnel at a time. Of
|
||
course you can set up multiple tunnels to handle multiple
|
||
connections.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
This is all in the man pages, and there are many references
|
||
on the net to using ssh port forwarding, but finding an example
|
||
of this simple trick was surprisingly difficult, and it is a
|
||
bit tricky to "grok" which arguments go where. Hopefully you
|
||
can follow this recipe to pierce the corporate (firewall) veil
|
||
and get more work done. Just be sure you clear it with your
|
||
local network and system administrators!
|
||
</BLOCKQUOTE>
|
||
|
||
<!-- . . . . . . . . . . . . . . . . . . . -->
|
||
<a name="tag/4"><HR WIDTH="75%" ALIGN="center"></a>
|
||
<!-- begin 4 -->
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>Every time Modem Hangup When Connect time 3.3 min.</H3>
|
||
|
||
|
||
<p><strong>From sunge
|
||
</strong></p>
|
||
<p align="right"><strong>Answered By Karl-Heinz Herrmann, Frank Rodolf
|
||
<br></strong></p>
|
||
|
||
<strong>
|
||
<p>
|
||
Dear TAG members,
|
||
</p>
|
||
<p>
|
||
When I use ppp-on script connect to my ISP, almost EVERY time the modem will hangup when the
|
||
</p>
|
||
<p>
|
||
connect time is 3.3 minutes:
|
||
</p>
|
||
<pre>$tail -n 10 <TT>/var/log/messages</TT>
|
||
...
|
||
Jul 15 19:37:37 localhost pppd[1703]: Hangup (SIGHUP)
|
||
Jul 15 19:37:37 localhost pppd[1703]: Modem hangup
|
||
Jul 15 19:37:37 localhost pppd[1703]: Connection terminated.
|
||
</pre>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [K.-H.]
|
||
this is what you would get by a modem-initiated hang up. pppd just gets told
|
||
that the connection is closed.
|
||
</BLOCKQUOTE>
|
||
<pre>
|
||
Jul 15 19:37:37 localhost pppd[1703]: Connect time 3.3 minutes.
|
||
Jul 15 19:37:37 localhost pppd[1703]: Sent 4656 bytes, received 6655 bytes.
|
||
Jul 15 19:37:37 localhost pppd[1703]: Exit.
|
||
$
|
||
</pre>
|
||
<p>
|
||
But if I use Kppp, modem will NOT hangup.
|
||
</p>
|
||
<p>
|
||
Thank you.
|
||
<br>Regrads,
|
||
<br>--
|
||
<br>sunge
|
||
</p>
|
||
</strong>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [K.-H.]
|
||
kppp and ppp-on will probably set the modem differently. Especially there is
|
||
one register Sx which contains the time in minutes(?) after which the modem
|
||
will hang up if no data transfer occurs.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
I guess your startup causes about 0.3min traffic after which no further
|
||
traffic occurs and your timeout with ppp-on is set to 3 minutes. kppp may have
|
||
that set to a longer time.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
The init string is something like AT ..... Sx=3
|
||
I'm not sure anymore, but the register number x was something like 6 or 9...
|
||
see the modem manual for details.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
K.-H.
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Frank]
|
||
Hi there!
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Just a small addition to what Karl-Heinz wrote.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
The register (at least in a standard Hayes compatible register set)
|
||
would be number 19 and the number after the = does indeed indicate the
|
||
number of minutes of inactivity before disconnecting.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Grtz,
|
||
<br>Frank
|
||
</BLOCKQUOTE>
|
||
|
||
<!-- sig -->
|
||
|
||
|
||
<!-- end 5 -->
|
||
<!-- . . . . . . . . . . . . . . . . . . . -->
|
||
<a name="tag/5"><HR WIDTH="75%" ALIGN="center"></a>
|
||
<!-- begin 5 -->
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>Bash</H3>
|
||
|
||
|
||
<p><strong>From Chris Twinn
|
||
</strong></p>
|
||
<p align="right"><strong>Answered By Ben Okopnik
|
||
<br></strong></p>
|
||
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
I am trying to write a little bash script to update the crontab on
|
||
RH7. Problem is that when I put
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
<tt>linetext = $1" * * * * " root bash /etc/cron.hourly/myscript</tt> or
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Don't do that; you can't have any spaces around the '=' sign in variable
|
||
assignment.
|
||
</BLOCKQUOTE>
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
<tt>linetext=$1" * * * * " root bash /etc/cron.hourly/myscript</TT>
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
I get back "2 configure ipchaser 2 configure ipchaser" which is an ls
|
||
of that current directory fronted by the number 2 in my variable at
|
||
each point of the star's.
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Sure; it's doing exactly what you've asked it to do. Text in the weak
|
||
(double) quotes is interpreted/interpolated by the shell; "*" does
|
||
indeed mean "all files in the current directory". However, strong
|
||
(single) quotes treat the enclosed text as a literal string; so does
|
||
quoting it on assignment <EM>and</EM> output.
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>linetext=$1' * * * * root bash /etc/cron.hourly/myscript'
|
||
linetext="$1 * * * * root bash /etc/cron.hourly/myscript"
|
||
</pre></blockquote>
|
||
<BLOCKQUOTE>
|
||
Either one of the above would result in "$linetext" containing
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>2 * * * * root bash /etc/cron.hourly/myscript
|
||
</pre></blockquote>
|
||
<BLOCKQUOTE>
|
||
(this assumes that "$1" contains '2'.) Note that you have to echo it as
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>echo "$linetext"
|
||
</pre></blockquote>
|
||
<BLOCKQUOTE>
|
||
not
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>echo $linetext
|
||
</pre></blockquote>
|
||
<BLOCKQUOTE>
|
||
Otherwise, "bash" will still interpret those '*'s.
|
||
</BLOCKQUOTE>
|
||
|
||
<p><em>... he cheerfully reported back, his problem is solved ...</em></p>
|
||
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Wicked.
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
On this side of the pond, the expression is "Duuuuude."
|
||
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
|
||
height="24" width="20" align="middle">
|
||
</BLOCKQUOTE>
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Many Many Thanks.
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Good to know you found it useful, Chris.
|
||
</BLOCKQUOTE>
|
||
|
||
|
||
<!-- end 6 -->
|
||
<!-- . . . . . . . . . . . . . . . . . . . -->
|
||
<a name="tag/6"><HR WIDTH="75%" ALIGN="center"></a>
|
||
<!-- begin 6 -->
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>question</H3>
|
||
|
||
|
||
<p><strong>From <em>Anonymous</em>
|
||
</strong></p>
|
||
<p align="right"><strong>Answered By Mike Orr, Nick Moffitt
|
||
<br></strong></p>
|
||
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
I have a question about the "finger" option on telnet. I know that you ccan
|
||
find out when someone has logged in by entering "finger name" But I was
|
||
wondering if it possible to find out who has tried to finger your e-mail
|
||
account??
|
||
<br>Please keep my name anonymous.
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Mike]
|
||
The short answer:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><BLOCKQuote>
|
||
If you are the sysadmin, you can run "fingerd" with the "-l" option to
|
||
log incoming requests; see "man fingerd". Otherwise, if you have Unix
|
||
progamming experience, it <EM>may</EM> be possible to write a script that logs
|
||
information about the requests you get. If you're merely concerned
|
||
about security, the correct answer is to turn off the "fingerd" daemon
|
||
or read the "finger" and "fingerd" manpages to learn how to limit what
|
||
information your computer is revealing about you and about itself.
|
||
However, you have some misconceptions about the nature of "finger" which
|
||
we should also address.
|
||
</BLOCKQuote></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
The long answer:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><BLOCKQuote>
|
||
"finger" and "telnet" are two distinct Internet services. "http" (WWW)
|
||
and "smtp" (sending e-mail) are two other Internet services. Each
|
||
service is completely independent of the others.
|
||
</BLOCKQuote></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Depending on the command-line options given and the cooperation of the remote
|
||
site, "finger <A HREF="mailto:user@host"
|
||
>user@host</A>" may tell you:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
(1) BASIC USER INFORMATION: the user's login name, real name,
|
||
terminal name and write status, idle time, login time, office location and
|
||
office phone number.
|
||
</BLOCKQuote>
|
||
<BLOCKQUOTE>
|
||
(2) EXTENDED USER INFORMATION: home directory, home phone number, login shell,
|
||
mail status (whether they have any mail or any unread mail), and the contents
|
||
of their "~/.plan" and "~/.project" and "~/.forward" files.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
(3) SERVER INFORMATION: a "Welcome to ..." banner which also shows some
|
||
informations (e.g. uptime, operat<61>ing system name and release)--similar
|
||
to what the "uname -a" and "uptime" commands reveal on the remote system.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Normally, ".plan", ".project" and ".forward" are regular text files.
|
||
".plan" is normally a note about your general work, ".project" is a note
|
||
about the status of your current project(s), and ".forward" shows
|
||
whether your incoming mail is being forwarded somewhere else or whether
|
||
you're using a mail filter (it also shows where it's being forwarded to
|
||
and what your mail filter program is, scary).
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
I've heard it's possible to make one of these files a named pipe
|
||
connected to a script. I'm not exactly sure how it's done. (Other TAG
|
||
members, please help.) You use "mkfifo" or "mknod -p" to create the
|
||
special file, then somehow have a script running whose standard output
|
||
is redirected to the file. Supposedly, whenever "finger" tries to read
|
||
the file, it will read your script's output. But I don't know how your
|
||
script would avoid a "broken pipe" error if it writes when there's
|
||
nobody to read it, how it would know when there's a reader, or how the
|
||
reader would pass identifying information to the script. Each Internet
|
||
connection reveal's the requestor's IP, and if the remote machine is
|
||
running the "identd" daemon, one can find out the username. But how
|
||
your "finger" script would access that information, I don't know, since
|
||
it's not running as a subprocess of "finger", so there's no way for
|
||
"finger" to pass it the information in environment variables or
|
||
command-line arguments.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
However, "finger" is much less useful nowadays than it was ten years
|
||
ago. Part of this is due to security paranoia and part to the fact
|
||
that we use servers differently nowadays.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
(1) Re security, many sysadmins have rightly concluded that "finger" is a big
|
||
security risk and have disabled "fingerd" on their servers, or enable it
|
||
only for intranet requests (which are supposedly more trustworthy).
|
||
Not only is the host information useful to crackerz and script kiddiez,
|
||
but users may not realize how much information they're revealing.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Nick]
|
||
The notion that fingerd is a security risk because it reveals
|
||
usernames is a bit misleading. It's true that having information
|
||
about login status can be useful (don't try to hack in while root is
|
||
on, and don't crack jack242's account while he's logged in, either!),
|
||
the real problem is in the implementations of many finger servers.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Part of this lay in the fact that finger daemons ran as the
|
||
superuser, or root. On systems that have shadow passwords enabled,
|
||
only root can read the file that has the encrypted password data. A
|
||
malicious user wishing to obtain the superuser's password data could
|
||
simply create a symbolic link from ~/.plan to <TT>/etc/shadow</TT>, and finger
|
||
his or her own account (stolen or otherwise) to display the
|
||
information!
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
This is due to the fact that fingerd was written in an era
|
||
when most computers on the Internet were run by research institutions.
|
||
The security was lax, and people didn't write software with resilience
|
||
to mischief in mind. In fact, adding <EM>features</EM> was the main push
|
||
behind most software development, and programs like fingerd contain
|
||
some extremely dangerous features as a result.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
There are, however, some modern implementations that take
|
||
security into consideration. I personally use cfingerd, and have it
|
||
configured with most of the options off. Furthermore, I restrict it
|
||
to local traffic only, as was suggested earlier. I also know that
|
||
my file security is maintained, since cfingerd will not follow
|
||
symbollic links from .plan or .project files, and it runs as "nobody"
|
||
(the minimal-privilege account that owns no files).
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Mike]
|
||
(2) Re how we use servers, in 1991 at my university, we had one Unix
|
||
computer (Sequent/Dynix) that any student could get an account on.
|
||
Users were logged in directly from hardwired text terminals, dialup or
|
||
telnet. You could use "finger" to see whether your friends were logged
|
||
in. Since you knew where your friends normally logged in from, you had
|
||
a fair idea where they were at the moment and could meet them to hack
|
||
side-by-side with them or to read (Usenet) news or to play games
|
||
together. (Actually, you didn't even need to use "finger". "tcsh" and
|
||
"zsh" would automatically tell you when certain "watched" users logged
|
||
in and out.) You could even use "w" to find out which interactive
|
||
program they were currently running. But soon demand went above 350
|
||
simultaneous users, especially when the university decided to promote
|
||
universal e-mail use among its 35,000 students and 15,000 staff. The
|
||
server was replaced by a cluster of servers, and every user logging in
|
||
to the virtual host was automatically placed on one of the servers at
|
||
random. Since "finger" and "w" information--as well as the tcsh/zsh
|
||
"watch" service--are specific to a certain server, it was a pain to
|
||
check all the servers to see if your friends were on any of them. About
|
||
this time, people started using X-windows, and each "xterm" window would
|
||
show up in "finger" as a separate logged-in user. Also, finger access
|
||
became disabled outside the intranet. "finger" became a lot less
|
||
convenient, so it fell into disuse.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
(3) "finger" only monitors login sessions. This includes the "login"
|
||
program, "telnet", "xterm", "ssh" (and its insecure cousins "rsh" and
|
||
"rlogin"). It does not include web browsing, POP mail reading, irc or
|
||
interactive chat, or instant messaging. These servers <EM>could</EM> write
|
||
login entries, but they don't. Most users coming from the
|
||
web-browser-IS-my-shell background never log in, wouldn't know what to
|
||
do at the shell prompt if they did log in, don't think they're missing
|
||
anything, and their ISPs probably don't even have shell access anyway.
|
||
That was the last nail in the coffin for "finger".
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
So in short, "finger" still works, but its usefulness is debatable.
|
||
Linus used to use his ".plan" file to inform people of the current
|
||
version of Linux and where to download it. SSC used to use it to
|
||
propagte its public PGP key. There are a thousand other kinds of
|
||
useful information it could be used for. However, now that everybody
|
||
and his dog has a home page, this ".plan" information can just as easily
|
||
be put on the home page, and it's just as easy (or easier for some
|
||
people) to access it via the web than via "finger".
|
||
</BLOCKQUOTE>
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<A NAME="tag/7"><HR WIDTH="75%" ALIGN="center"></A>
|
||
<!-- begin 7 -->
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>Kernel Compilation</H3>
|
||
|
||
|
||
<p><strong>From Anthony Amaro Jr
|
||
</strong></p>
|
||
<p align="right"><strong>Answered By Heather Stern
|
||
<br></strong></p>
|
||
|
||
<!-- sig -->
|
||
|
||
<P><STRONG>
|
||
I have 2 computers currently, one running redhat 6.2 with 2.4.5 kernel
|
||
(compiled from source) and another running redhat 7.1 stock. Why is it
|
||
that after I do an almost identical install on both machines package wise,
|
||
I am able to sucessfully compile and install the 2.4.5 kernel (from
|
||
kernel.org) on the 6.2 machine but when I try to compile on the redhat
|
||
7.1 machine it the compiler stops with errors? It seems hard to believe
|
||
that a <EM>newer</EM> version of red hat would be incompatable with the kernel
|
||
that make it linux!!!
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
Thanks!
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
Anthony Amaro Jr.
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Heather]
|
||
Well, it used to be a Well Known Answer that RH had shipped a gcc which was
|
||
too d*** new to successfully build kernels. What that obviously means is
|
||
the folks back in the RedHat labs prepared their kernel RPMs on another
|
||
machine, one which wasn't running their distro-to-be.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><em>
|
||
answer 1: you can compile a kernel on a different system, then copy it, the
|
||
matching System.map and modules across to your misbehaving one.
|
||
</em></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
However, I don't know if this 7.0 problem remains in 7.1. (I'd bet they
|
||
got a lot of complaints about it.) Soooo... with you having said nothing
|
||
about what <EM>kind</EM> of error messages... how would we know either?
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><em>
|
||
answer 2: "it's broken" is not enough detail for us to help "make it work".
|
||
</em></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Good luck, tho...
|
||
</BLOCKQUOTE>
|
||
|
||
<!-- end 8 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<A NAME="tag/8"><HR WIDTH="75%" ALIGN="center"></A>
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>Re: Linux solution to syncing with Exchange Address books as a client</H3>
|
||
|
||
|
||
<p><strong>From Alan Maddison (published in 2c Tips, Issue 68)
|
||
</strong></p>
|
||
<p align="right"><strong>Answered By Anthony E. Greene
|
||
<br></strong></p>
|
||
|
||
<!-- sig -->
|
||
|
||
<P><STRONG>
|
||
I hope that you can help me find a solution before I'm forced back
|
||
to NT. I have to find a Linux solution that will allow me to
|
||
connect to an Exchange server over the WAN and then sync address
|
||
books.
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Anthony]
|
||
The closest thing I can think of for this is to configure your
|
||
standards-compliant mail client to access the Exchange Global Address List
|
||
(GAL) via LDAP. This is a built-in capability of Exchange server that often
|
||
goes unused. If the LDAP interface is enabled, you can get to the Exchange
|
||
GAL using the LDAP abilities in Netscape, Pine, Balsa, Eudora, Outlook,
|
||
Outlook Express, Windows Address Book (part of Outlook Express). The latest
|
||
version of Mozilla may also support LDAP.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
If you want to export the GAL for use in an LDAP server, you will need both
|
||
Outlook and Outlook Express installed.
|
||
</BLOCKQUOTE>
|
||
|
||
<blockQuote><ul>
|
||
<LI>Open Outlook.
|
||
|
||
|
||
<LI>Open the Address Book and select the Global Address List
|
||
|
||
|
||
<LI>In the Global Address List, select all the addresses you want to
|
||
export and copy them to your Personal Address Book. This is a memory
|
||
and CPU intensive process. I would advise selecting 100-200 or so at
|
||
a time. Do not select distribution lists; they are not exportable.
|
||
|
||
|
||
<LI>After all the desired addresses have been copied to your Personal
|
||
Address Book, leave Outlook open and open Outlook Express.
|
||
|
||
|
||
<LI>Select File->Import to import addresses from your Outlook Personal
|
||
Address Book.
|
||
|
||
|
||
<LI>After the import is complete, close Outlook.
|
||
|
||
|
||
<LI>Select File-> Export to export your address book to a comma separated
|
||
values (CSV) formatted text file. I will assumed you exported the
|
||
following fields: Name, First Name, Last Name, Title, Organization,
|
||
Department, Email Address, Phone, and Fax.
|
||
|
||
|
||
<LI>After the export is complete, copy the CSV file to a box with Perl
|
||
installed and run the following script (csv2ldif.pl):
|
||
</ol></blockQuote>
|
||
<p align="center">See attached <tt><a href="misc/tag/csv2ldif.pl.txt">csv2ldif.pl.txt</a></tt></p>
|
||
<BLOCKQUOTE>
|
||
Take the resulting LDIF file and import it into your LDAP server using its
|
||
import tools.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Tony
|
||
</BLOCKQUOTE>
|
||
|
||
<!-- end 8 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<A NAME="tag/9"><HR WIDTH="75%" ALIGN="center"></A>
|
||
<!-- begin 9 -->
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>internet cafe</H3>
|
||
|
||
|
||
<p><strong>From gianni palermo
|
||
</strong></p>
|
||
<p align="right"><strong>Answered By Heather Stern, Huibert Alblas
|
||
<br></strong></p>
|
||
|
||
<P><STRONG>
|
||
Dear sir,
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
please send me through email on how to setup an internet cafe in
|
||
detail using red hat linux and windows nt cause I am planning to setup
|
||
one. I got some tips from my friends but I want to consult a professional
|
||
like you. hoping yuo'll send me the details. thank you sir...
|
||
<br>Gianni Palermo
|
||
</STRONG></P>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Heather]
|
||
We've had this question asked of us a few times before. I even popped it
|
||
into the "Help Wanted" section in Issue 61:
|
||
<A HREF="../issue61/lg_mail61.html"
|
||
>http://www.linuxgazette.com/issue61/lg_mail61.html</A>
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
...but nobody gave us any hints beyond what I had there. Maybe you can get
|
||
away with very minimal services, like running all the stations from CD-based
|
||
Linux distros. There are a bunch of them listed at LWN but some of them or
|
||
more of a giant rescue disc than a usable system. You might try these:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Knoppix
|
||
<DD><A HREF="http://www.knopper.net/knoppix"
|
||
>http://www.knopper.net/knoppix</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
RunOnCD
|
||
<DD><A HREF="http://my.netian.com/~cgchoi"
|
||
>http://my.netian.com/~cgchoi</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
DemoLinux
|
||
<DD><A HREF="http://www.demolinux.org"
|
||
>http://www.demolinux.org</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Virtual Linux
|
||
<DD><A HREF="http://sourceforge.net/projects/virtual-linux"
|
||
>http://sourceforge.net/projects/virtual-linux</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
...or only offering web access:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Public Web Browser mini-HOWTO
|
||
<DD><A HREF="http://www.chuvakin.org/kiodoc/Public-Web-Browser.html"
|
||
>http://www.chuvakin.org/kiodoc/Public-Web-Browser.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
If you want to get more serious you'll need to look harder. Sadly Coffeenet
|
||
was forced out of business by his landlord, so you can't get his codebase
|
||
easily (besides, it would be a moderately ancient Linux by now). Since
|
||
<A HREF="http://www.valinux.com/">VA Linux</A> is now going into the consultancy and software biz instead of
|
||
hardware, maybe you can buy some of their E-mail Garden expertise.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Of course you wanted to know where to get started. So I'll give you a bunch
|
||
of pointers, but for the rest you'll have to do your own homework. If you
|
||
really want to you could start up an "Internet Coffee House HOWTO" and add
|
||
it to the LDP. I'd sure enjoy pointing to it if it existed.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
There are other important points beyond merely the technical setup to consider
|
||
but I'll have to assume you're making business plans and selecting a good
|
||
location on your own.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Here's what seem to be the most helpful HOWTOs right now for the topic. Most
|
||
of them are also available at the Linux Documentation Project home page.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
For being diskless, if you want to go that route:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Diskless HOWTO
|
||
<DD><A HREF="http://www.linuxdoc.org/HOWTO/Diskless-HOWTO.html"
|
||
>http://www.linuxdoc.org/HOWTO/Diskless-HOWTO.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Thinclient HOWTO
|
||
<DD><A HREF="http://www.linuxdoc.org/HOWTO/Thinclient-HOWTO.html"
|
||
>http://www.linuxdoc.org/HOWTO/Thinclient-HOWTO.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Network Boot HOWTO
|
||
<DD><A HREF="http://www.linuxdoc.org/HOWTO/Network-boot-HOWTO/index.html"
|
||
>http://www.linuxdoc.org/HOWTO/Network-boot-HOWTO/index.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
KIosk HOWTO
|
||
<DD><A HREF="http://www.linuxdoc.org/HOWTO/Kiosk-HOWTO.html"
|
||
>http://www.linuxdoc.org/HOWTO/Kiosk-HOWTO.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Getting the connection going:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
ISP Setup RedHat HOWTO
|
||
<DD><A HREF="http://www.chuvakin.org/ispdoc/ISP-Setup-RedHat.html"
|
||
>http://www.chuvakin.org/ispdoc/ISP-Setup-RedHat.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Domain mini-HOWTO
|
||
<DD><A HREF="http://caliban.physics.utoronto.ca/neufeld/Domain.HOWTO"
|
||
>http://caliban.physics.utoronto.ca/neufeld/Domain.HOWTO</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
DSL HOWTO
|
||
<DD><A HREF="http://www.linuxdoc.org/HOWTO/DSL-HOWTO/index.html"
|
||
>http://www.linuxdoc.org/HOWTO/DSL-HOWTO/index.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
DSL HOWTO "prerelease version"
|
||
<DD><A HREF="http://feenix.burgiss.net/ldp/adsl"
|
||
>http://feenix.burgiss.net/ldp/adsl</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
DHCP mini-HOWTO
|
||
<DD><A HREF="http://www.oswg.org/oswg-nightly/oswg/en_US.ISO_8859-1/articles/DHCP/DHCP.html"
|
||
>http://www.oswg.org/oswg-nightly/oswg/en_US.ISO_8859-1/articles/DHCP/DHCP.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Protecting yourself from abuse:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
The Bandwidth Limiting HOWTO
|
||
<DD><A HREF="http://www.linuxdoc.org/HOWTO/Bandwidth-Limiting-HOWTO/index.html"
|
||
>http://www.linuxdoc.org/HOWTO/Bandwidth-Limiting-HOWTO/index.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Security HOWTO
|
||
<DD><A HREF="http://www.linuxsecurity.com/Security-HOWTO"
|
||
>http://www.linuxsecurity.com/Security-HOWTO</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Advocacy HOWTO
|
||
<DD><A HREF="http://www.datasync.com/~rogerspl/Advocacy-HOWTO.html"
|
||
>http://www.datasync.com/~rogerspl/Advocacy-HOWTO.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Maybe some things that might make your stations more attractive:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Sound HOWTO
|
||
<DD><A HREF="http://www.linuxdoc.org/HOWTO/Sound-HOWTO/index.html"
|
||
>http://www.linuxdoc.org/HOWTO/Sound-HOWTO/index.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
XFree86 Touchscreen HOWTO
|
||
<DD><A HREF="http://www.linuxdoc.org/HOWTO/XFree86-Touch-Screen-HOWTO.html"
|
||
>http://www.linuxdoc.org/HOWTO/XFree86-Touch-Screen-HOWTO.html</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE><DL><DT>
|
||
Printing HOWTO
|
||
<DD><A HREF="http://www.linuxprinting.org/howto"
|
||
>http://www.linuxprinting.org/howto</A>
|
||
</DL></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Last, but certainly not least:
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><BLOCKQuote>
|
||
Coffee HOWTO
|
||
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
|
||
height="24" width="20" align="middle">
|
||
<A HREF="http://www.linuxdoc.org/HOWTO/mini/Coffee.html"
|
||
>http://www.linuxdoc.org/HOWTO/mini/Coffee.html</A>
|
||
</BLOCKQuote></BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
It's a lot to read, but I hope that helps!
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Halb]
|
||
Ok,
|
||
I don't know if this is exactly what you mean, but try:
|
||
<a href="http://www.dnalounge.com/backstage/src/kiosk/"
|
||
>http://www.dnalounge.com/backstage/src/kiosk/</a>
|
||
</blockquote>
|
||
|
||
<blockquote>Its description:</blockquote>
|
||
|
||
<FONT COLOR="#000066"><EM>
|
||
|
||
<BLOCKQUOTE>
|
||
One of the things I want to do here at the DNA Lounge is have public
|
||
kiosks that people can use for web browsing, IRC, AIM, and so on. When
|
||
most people set up kiosks, they tend to try and lock them down so that
|
||
you can only run a web browser, but that's a little too limiting, since
|
||
I want people to be able to run other applications too (telnet, ssh,
|
||
irc, and so on.) So really, I wanted to give access to a complete
|
||
desktop system. But do so safely and reliably.
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE>
|
||
I decided to set them up as Linux systems running the GNOME desktop,
|
||
preconfigured with all the common applications people might want to run.
|
||
However, I needed to figure out a way to make the system robust enough
|
||
that one user couldn't screw it up for another, on purpose or
|
||
accidentally. The system would need to be locked down enough that it was
|
||
easy to reset it to a working state.
|
||
</BLOCKQUOTE>
|
||
|
||
|
||
<BLOCKQUOTE>
|
||
So, I had the following goals:
|
||
</BLOCKQUOTE>
|
||
|
||
<blockQuote><ul>
|
||
|
||
<LI>When the machine boots up, it should automatically log itself in
|
||
as "guest", and go to the desktop without requiring a login dialog.
|
||
|
||
<LI>It should be possible to pull the plug on the machine at any time
|
||
without loss of data: at no time should fsck need to run.
|
||
|
||
<LI>Logging out or rebooting should reset the machine to a default
|
||
state, clearing out any changes a previous user might have made.
|
||
|
||
<LI>Small form factor: I wanted flat screens, and I wanted them
|
||
without spending a fortune.
|
||
|
||
</ul></blockQuote>
|
||
|
||
</EM></FONT>
|
||
|
||
<BLOCKQUOTE>
|
||
Its not using WinNT, but looks like you don't need to...
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
Have fun:
|
||
<br>Halb
|
||
</BLOCKQUOTE>
|
||
|
||
<!-- end 9 -->
|
||
<!-- . . . . . . . . . . . . . . . . . . . -->
|
||
<a name="tag/10"><HR WIDTH="75%" ALIGN="center"></a>
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>Password aging</H3>
|
||
|
||
|
||
<p><strong>From Trevor Lauder
|
||
</strong></p>
|
||
<p align="right"><strong>Answered Mike Ellis, Ben Okopnik, Heather Stern
|
||
<br></strong></p>
|
||
<P><STRONG>
|
||
How do I disable password aging without the shadow suite?
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Mike Ellis]
|
||
Are you sure password aging is turned on without the shadow suite? AFAIK,
|
||
password aging is only supported under Linux when shadow passwords are
|
||
used. I also believe that most recent (post '99 ???) distributions come
|
||
with shadow passwords enabled by default, although I've only really played
|
||
with RedHat and Suse so I may be wrong here.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
So - have you got shadow passwords? The easiest way to tell is to look at
|
||
the password and shadow files. these are both colon-delimited data files.
|
||
If you don't have shadow passwords enabled, the file <TT>/etc/passwd</TT> will look
|
||
like this:
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>root:HTf2f4YWjnASU:0:0:root:/root:/bin/bash
|
||
</pre></blockquote>
|
||
<BLOCKQUOTE>
|
||
The first field gives you the user name - I've only quoted the root user
|
||
here, your password file will have many more users in it, but each line
|
||
should follow the pattern shown above. The second field contains the users
|
||
password, encrypted ...
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben] Let's go for
|
||
"... encrypted with the standard Unix 'crypt' function."
|
||
</BLOCKQuote>
|
||
<BLOCKQUOTE>
|
||
There. That's better. When the choice is <br>a) give extra info that may be
|
||
unnecessary or <br>b) shroud everything in mystery as a true High Priest
|
||
should, I go with the Open Source version...
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Mike Ellis]
|
||
The remaining
|
||
fields specify the users UID, GID, real name, home directory and default
|
||
shell - nothing for password aging.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
If you have shadow passwords enabled, the <TT>/etc/passwd</TT> file will look more
|
||
like this:
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>root:x:0:0:root:/root:/bin/bash
|
||
</pre></blockquote>
|
||
<BLOCKQUOTE>
|
||
Notice that the second field, which used to contain the password crypt,
|
||
now has the single letter 'x'. The password crypt is now stored in the
|
||
<TT>/etc/shadow</TT> file, which might look like this:
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>root:$1$17yvt96W$HO11W48wZuy0w9cPtQJdt0:11284:0:99999:7:::
|
||
</pre></blockquote>
|
||
<BLOCKQUOTE>
|
||
Again, the first field gives the user name, and the second is the
|
||
password crypt. These two examples use different crypt algorithms, hence
|
||
the different length of the password field - this is not relevant to this
|
||
discussion.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
The remaining fields in the shadow file enable the password aging -
|
||
according to "man 5 shadow", these fields are (in order)
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><code><font color="#000033"><br> Days since Jan 1, 1970 that password was last changed
|
||
<br> Days before password may be changed
|
||
<br> Days after which password must be changed
|
||
<br> Days before password is to expire that user is warned
|
||
<br> Days after password expires that account is disabled
|
||
<br> Days since Jan 1, 1970 that account is disabled
|
||
<br> A reserved field
|
||
</font></code></blockquote>
|
||
<BLOCKQUOTE>
|
||
The manual page also reads:
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><tt>"The date of the last password change is given as the number of days
|
||
since Jan 1, 1970. The password may not be changed again until the proper
|
||
number of days have passed, and must be changed after the maximum number
|
||
of days. If the minimum number of days required is greater than the
|
||
maximum number of day allowed, this password may not be changed by the
|
||
user."
|
||
</tt></blockquote>
|
||
<BLOCKQUOTE>
|
||
So, to disable password aging (as in the example) set the fourth field to
|
||
zero and the fifth to a large number (e.g. 99999). This says that the
|
||
password can be changed after no time at all, and must be changed after
|
||
274 years, effectively disabling the aging.
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
To actually _disable_ password aging, make all the fields after the fourth
|
||
one null, i.e.
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>ben:ShHh!ItSaSeCrEt!:11504:0:::::
|
||
</pre></blockquote>
|
||
<BLOCKQUOTE><BLOCKQUOTE><CODE>
|
||
If you do that, "chage -l" reports the following:
|
||
</CODE></BLOCKQUOTE></BLOCKQUOTE>
|
||
|
||
<blockquote><pre>ben@Baldur:~$ chage -l ben
|
||
Minimum: 0
|
||
Maximum: -1
|
||
Warning: -1
|
||
Inactive: -1
|
||
Last Change: Jul 01, 2001
|
||
Password Expires: Never
|
||
Password Inactive: Never
|
||
Account Expires: Never
|
||
</pre></blockquote>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Mike Ellis]
|
||
You can edit the shadow file
|
||
directly (e.g. using vi/emacs) which is only really recommended for expert
|
||
users. A safer alternative, although less flexible, is to use a tool to
|
||
do the work for you, such as the usermod command, or linuxconf.
|
||
Unfortunately usermod doesn't allow you to disable aging, only to change
|
||
the dates on which the password expires. linuxconf is better, and should
|
||
probably be your first port of call unless you are quite experienced.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
The "proper" tool for modifying "<TT>/etc/passwd</TT>" and "<TT>/etc/shadow</TT>" is
|
||
'vipw' ("vipw -s" edits "<TT>/etc/shadow</TT>".) You might want to define the
|
||
EDITOR variable before using it, though - it uses "vi" by default, and
|
||
that can be pretty ugly if you're not used to it...
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Heather Stern]
|
||
I certainly hope Linuxconf has gotten more stable; when it first came out,
|
||
about half the people I knew who had tried it (to be fair, not very many)
|
||
had managed to get burned by it - either by major config files eaten if a
|
||
failure occurred while it was doing something (it wasn't "idempotent" as
|
||
Debian says, able to be interrupted gracefully), or by features that needed
|
||
to be tweaked, not being revealed by it or handled incorrectly because the
|
||
tool's author hadn't thought of them. Like my "doesn't start at 0" address
|
||
range of less than 255 addresses.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>On the other hand, if you edit the file directly you
|
||
<strong>MUST</strong> get the number of colons right. Otherwise
|
||
nobody whose login is described after the line you get wrong, will
|
||
be able to get in... unless by chance you have more than one wrong,
|
||
and your other mistakes make them line up properly again, in which
|
||
case there will be a block of people who cannot login. This can
|
||
be very hard to debug if you don't know to look for it...
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Mike Ellis]
|
||
Before attempting any modifications on your system, make sure you've read
|
||
the manual pages for the password file (man 5 passwd), the shadow file
|
||
(man 5 shadow) and the usermod command (man usermod). It is quite easy to
|
||
leave yourself in a situation where it is impossible to log in after one
|
||
small typo... The examples I've shown are from RedHat systems I happen to
|
||
have laying around - your system may have a different version of the
|
||
password system which is subtly different and which blind copying of my
|
||
examples would break.
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE>
|
||
Hope it helps!
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Amen to that. Also, make sure that you have your boot floppy close to
|
||
hand, or at least know how to boot with the 'single' option.
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Heather]
|
||
Or at least glance at the "Root password" Tip in this month;s 2c Tips
|
||
column before making your changes.
|
||
</BLOCKQUOTE>
|
||
|
||
<!-- end 10 -->
|
||
<!-- . . . . . . . . . . . . . . . . . . . -->
|
||
<a name="tag/11"><HR WIDTH="75%" ALIGN="center"></a>
|
||
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
|
||
height="50" width="60" alt="(?) " border="0"
|
||
>inetd and figlet</H3>
|
||
|
||
|
||
<p><strong>From Nick Moffitt
|
||
</strong></p>
|
||
<p align="right"><strong>Answered By Ben Okopnik, Heather Stern, Don Marti
|
||
<br></strong></p>
|
||
|
||
<!-- sig -->
|
||
|
||
<P><STRONG><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
I run a server machine, and I have telnet disabled in favor of
|
||
OpenSSH. What I have done is add the following line to my
|
||
/etc/inetd.conf:
|
||
</STRONG></P>
|
||
|
||
<pre><strong>telnet stream tcp nowait nobody.nogroup /usr/sbin/tcpd /usr/bin/figlet Unauthorized access prohibited. Go away.
|
||
</strong></pre>
|
||
<P><STRONG>
|
||
The idea is to print out a "NO TRESSPASSING" sign in big block letters
|
||
using the figlet utility. It works great, and when I run "telnet
|
||
localhost" from this machine, I see:
|
||
</STRONG></P>
|
||
<P><STRONG><BLOCKQuote>
|
||
----8<----
|
||
</BLOCKQuote></STRONG></P>
|
||
|
||
<pre><strong>Trying 127.0.0.1...
|
||
Connected to localhost.
|
||
Escape character is '^]'.
|
||
_ _ _ _ _ _
|
||
| | | |_ __ __ _ _ _| |_| |__ ___ _ __(_)_______ __| |
|
||
| | | | '_ \ / _` | | | | __| '_ \ / _ \| '__| |_ / _ \/ _` |
|
||
| |_| | | | | (_| | |_| | |_| | | | (_) | | | |/ / __/ (_| |
|
||
\___/|_| |_|\__,_|\__,_|\__|_| |_|\___/|_| |_/___\___|\__,_|
|
||
|
||
_ _ _ _ _ _
|
||
__ _ ___ ___ ___ ___ ___ _ __ _ __ ___ | |__ (_) |__ (_) |_ ___ __| |
|
||
/ _` |/ __/ __/ _ \/ __/ __| | '_ \| '__/ _ \| '_ \| | '_ \| | __/ _ \/ _` |
|
||
| (_| | (_| (_| __/\__ \__ \ | |_) | | | (_) | | | | | |_) | | || __/ (_| |_
|
||
\__,_|\___\___\___||___/___/ | .__/|_| \___/|_| |_|_|_.__/|_|\__\___|\__,_(_)
|
||
|_|
|
||
____
|
||
/ ___| ___ __ ___ ____ _ _ _
|
||
| | _ / _ \ / _` \ \ /\ / / _` | | | |
|
||
| |_| | (_) | | (_| |\ V V / (_| | |_| |_
|
||
\____|\___/ \__,_| \_/\_/ \__,_|\__, (_)
|
||
|___/
|
||
Connection closed by foreign host.
|
||
</strong></pre>
|
||
<P><STRONG>
|
||
----8<----
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
This is all well and good, but when I try telnetting from a remote
|
||
machine, it's a crap shoot. Sometimes I'll get the whole banner, and
|
||
sometimes I'll get nothing. One machine reliably prints out the correct
|
||
text up until it ends as follows:
|
||
</STRONG></P>
|
||
<P><STRONG><BLOCKQuote>
|
||
----8<----
|
||
</BLOCKQuote></STRONG></P>
|
||
|
||
<pre><strong> ____
|
||
/ ___| ___ __ ___ ____ _ _ _
|
||
| | _ / _ \ / _` \ \ /\ / / _` | | | |
|
||
| |_| | (_) | | (_| |\ V V / (_| Connection closed by foreign host.
|
||
</strong></pre>
|
||
<P><STRONG>
|
||
----8<----
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
What could be causing this, and how should I fix it?
|
||
</STRONG></P>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Arrgh. I haven't looked at the actual code of "inetd", but I'm cringing
|
||
at the idea of running a text-printing app from <TT>/etc/init.d</TT> (vs.
|
||
spawning a listener process, which is what it's supposed to do.) It
|
||
seems to me that you're bound to run into problems with gross hackage of
|
||
that sort.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Heather]
|
||
I thought I recalled this is what the fingerd was for. In this case it'd
|
||
be wickedly apropos (wicked being the operative word) to twist finger to
|
||
doing what you want... so you can give some poor telnet-using sap "the
|
||
finger" as it were.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE>
|
||
If you are going to hack source anyway, hack source of something that's
|
||
closer to doing the right job, I'd think.
|
||
</BLOCKQUOTE>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
If I was going to do something like that, I think I would leave
|
||
in.telnetd running - there isn't even a process other than inetd until
|
||
someone requests one - have "<TT>/etc/hosts.deny</TT>" set up to deny everyone,
|
||
and set up my "BANNER" line in "<TT>/etc/default/telnetd</TT>" to print out that
|
||
message.
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Heather]
|
||
Does that give you the message before, or after it offers a login attempt?
|
||
If before, then surely he can hack a copy of telnetd whose login prompt
|
||
is completely bogus, and that will never let anyone in.
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
Actually, I found something that might be even better for the purpose.
|
||
These days, "telnetd" is actually "in.telnetd" - Wietse Venema's
|
||
wonderful wrapper - and uses "<TT>/usr/lib/telnetd/login</TT>" to negotiate the
|
||
login process. It's something that's _supposed_ to do real-time
|
||
interaction with the user. Move "login" to "login.old"; replace it with
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>#!/bin/sh
|
||
figlet 'Go away!'
|
||
</pre></blockquote>
|
||
<BLOCKQUOTE>
|
||
It should work fine. Should be fairly secure, too.
|
||
</BLOCKQUOTE>
|
||
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Don]
|
||
When I try this telnetting from ssc.com to my test machine I get
|
||
nothing, and using this figlet_wrapper script instead of calling
|
||
figlet directly fixes it for me.
|
||
</BLOCKQUOTE>
|
||
|
||
<blockquote><pre>#! /bin/sh
|
||
|
||
/usr/bin/figlet $* && sleep 1
|
||
</pre></blockquote>
|
||
<p><strong><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Aha, yeah. That seems to do the trick.
|
||
</strong></p>
|
||
<BLOCKQUOTE><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Don]
|
||
I tried rebuilding figlet with a bunch of fflush(0)s in it, and it
|
||
seems like I'm getting more text but not all of it.
|
||
</BLOCKQUOTE>
|
||
|
||
<strong><p><IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
>
|
||
Yeah, I got the same thing when I tried that. I had
|
||
considered doing something to tcpd that would make it handle leftover
|
||
buffers more correctly, but putting in the sleep seems to work well
|
||
enough for me.
|
||
</p></strong>
|
||
<strong><p>
|
||
Thanks!
|
||
</p></strong>
|
||
|
||
<!-- end 11 -->
|
||
<center>
|
||
<H1><A NAME="tips"><IMG ALIGN=MIDDLE ALT="" SRC="../gx/twocent.jpg">
|
||
More 2¢ Tips!</A></H1> <BR>
|
||
<!-- BEGIN tips -->
|
||
|
||
Send Linux Tips and Tricks to <A HREF="mailto:gazette@ssc.com">gazette@ssc.com</A></center>
|
||
<UL>
|
||
<!-- index_text begins -->
|
||
<li><A HREF="#tips/1"
|
||
><strong>Globally adding X startup commands on Debian</strong></a>
|
||
<li><A HREF="#tips/1b"
|
||
><strong>.Xauthority files for Debian startx</strong></a>
|
||
<li><A HREF="#tips/1c"
|
||
><strong>for remote X client access: USE SSH with X11 forwarding!</strong></a>
|
||
<li><A HREF="#tips/2"
|
||
><strong>2C Tip Root Password</strong></a>
|
||
<li><A HREF="#tips/5"
|
||
><strong>2C Answers: RH7.1 switch to KDE login as default</strong></a>
|
||
<li><A HREF="#tips/6"
|
||
><strong>2 cent tip: a quick email address finder</strong></a>
|
||
<li><A HREF="#tips/7"
|
||
><strong>djbdns? Feh! Get a free-software name server instead</strong></a>
|
||
<li><A HREF="#tips/9"
|
||
><strong>Your article about rbl going commercial?</strong></a>
|
||
<li><A HREF="#tips/11"
|
||
><strong>Printer setup on Slackware 8?????</strong></a>
|
||
<li><A HREF="#tips/18"
|
||
><strong>Seg Fault</strong></a>
|
||
<li><A HREF="#tips/20"
|
||
><strong>SMTP Auth with Debian potato and exim</strong></a>
|
||
<li><A HREF="#tips/22"
|
||
><strong>Source control</strong></a>
|
||
<li><A HREF="#tips/24"
|
||
><strong>Kernels?? on a Sparc</strong></a>
|
||
<li><A HREF="#tips/27"
|
||
><strong>portal for a newbie?</strong></a>
|
||
<!-- index_text ends -->
|
||
</UL>
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/1"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">Globally Adding X Startup Commands on a Debian System</FONT></H3>
|
||
Tue, 14 Aug 2001 16:03:41 -0700 (PDT)
|
||
<BR>Jim Dennis (<a href="mailto:linux-questions-only@ssc.com">The Answer Guy</a>)
|
||
<p>
|
||
Sometimes you'd like to configure an application so that it
|
||
starts for any user who uses 'startx' (or logs in through xdm?).
|
||
For example, I have a policy on my systems that all users should
|
||
be running xautolock (a program that invoke an xscreensaver or
|
||
xlock module after a period of mouse/keyboard inactivity).
|
||
</p><p>
|
||
|
||
On a Debian Woody/Sid (2.2 or later) system this can be done by
|
||
copying or linking a file into <tt>/etc/X11/Xsession.d/</tt>. This would
|
||
be a script similar to one you'd add to <tt>/etc/init.d/</tt>. For example
|
||
I added a file called <tt>60xautolock</tt> consisting of the single line:
|
||
</p><p>
|
||
<code>
|
||
/usr/bin/X11/xautolock -time 2 -corners 00-+ -cornerdelay 2 &
|
||
</code>
|
||
</p><p>
|
||
I suspect it should be marked as executable; I just set the perms on
|
||
mine to match the others therein.
|
||
|
||
</p><p>
|
||
(BTW: this xautolock enables a "blank now" hot spot in the lower right
|
||
corner of the screen, and a "never blank" hot spot in the lower right;
|
||
so a user can blank the screen with a 2 second delay by shoving their
|
||
mouse pointer far into the corner; it also sets the automatic blanking
|
||
to occur in 2 minutes: the default of 10 min. is way too long!)
|
||
</p>
|
||
<!-- end 1a -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/1b"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">.Xauthority files for Debian startx</FONT></H3>
|
||
Tue, 14 Aug 2001 16:03:41 -0700 (PDT)
|
||
<BR>Jim Dennis (<a href="mailto:linux-questions-only@ssc.com">The Answer Guy</a>)
|
||
|
||
|
||
<P>
|
||
Here's another <A HREF="http://www.debian.org/">Debian</A> tip:
|
||
</P>
|
||
|
||
</p><p>
|
||
Debian normally configures xdm to invoke the X server with the
|
||
<tt>-auth</tt> argument. This allows one to configure their X session to
|
||
allow remote clients, or local clients under other user IDs to
|
||
connect to the X server (to run in your X session).
|
||
</p><p>
|
||
|
||
This is useful even if you've accepted the recommendation to configure
|
||
Xfree86 4.x with the "<tt>-nolisten tcp</tt>" option (to disable remote clients
|
||
from direct X protocol access). It allows you to run X under you're
|
||
own user ID while allowing root to open programs on your display
|
||
(particularly handy if you want to run ethereal, which will refuse to run
|
||
SUID/root but which needs access to X and root permission to sniff on
|
||
your network interfaces).
|
||
</p><p>
|
||
|
||
The problem is that Debian doesn't normally invoke X with the
|
||
<tt>-auth</tt> option
|
||
when you use the startx script. Of course you could use
|
||
<tt>xhost +localhost</tt>;
|
||
but this allows <em>any</em> local user to access your X session; rather than
|
||
allowing you to control it in a more fine-grained fashion.
|
||
</p><p>
|
||
|
||
The solution is to edit the <tt>/etc/X11/xinit/xserverrc</tt> file, inserting
|
||
one command and adding an option to another:
|
||
</p><pre>
|
||
|
||
#!/bin/sh
|
||
/usr/bin/X11/xauth add :0 . $(dd if=/dev/urandom count=2 2> /dev/null | md5sum)
|
||
exec /usr/bin/X11/X -dpi 100 -nolisten tcp -auth $HOME/.Xauthority
|
||
## . . . . . . . . . . . . . . . . . . . . ^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
||
</pre><p>
|
||
... last comment line (starting with ##) underscores the addition
|
||
to that command. The xauth command is being used to create the
|
||
<tt>~/.Xauthority</tt> file.
|
||
|
||
</p><p>
|
||
For root to gain access to this session you'd issue a command like:
|
||
|
||
</p><p>
|
||
<code>
|
||
xauth -f ~$YOU/.Xauthority extract - `hostname`/unix:0 | xauth merge -
|
||
</code>
|
||
</p><p>
|
||
... from a root shell (perhaps by opening an xterm and using the
|
||
su or sudo commands). (Hint: obviously anyone who can read your
|
||
<tt>.Xauthority file</tt> can use it to gain access to your X sessions;
|
||
so maintaining these on NFS home directories is BAD; yet another reason
|
||
why NFS stands for "no freakin' security").
|
||
</p>
|
||
<!-- end 1b -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/1c"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">for remote X client access: USE SSH with X11 forwarding!</FONT></H3>
|
||
Tue, 14 Aug 2001 16:03:41 -0700 (PDT)
|
||
<BR>Jim Dennis (<a href="mailto:linux-questions-only@ssc.com">The Answer Guy</a>)
|
||
|
||
</p><p>
|
||
That's the easiest and most secure means available for supporting
|
||
remote X clients; if you call the OpenSSH client with the <tt>-X</tt>
|
||
(enable/request X11 forwarding) and if the remote ssh daemon allows it;
|
||
and if you
|
||
have your DISPLAY variable set (which is always the case when you start
|
||
an xterm under X; since it's how the X libraries linked into xterm
|
||
"found" your X server) then the remote daemon will spawn off a proxy
|
||
--- an instance of the daemon that will "pretend" to be an X server on
|
||
display number 10, 11, or higher. That daemon will automatically relay
|
||
Xprotocol events to your client which will relay them through the local
|
||
Unix domain socket to your server. This is all automatic with most versions
|
||
of ssh (except for the newer OpenSSH client which defaults to disabling X11
|
||
forwarding and thus requires the -X switch).
|
||
|
||
</p><p><em>Please make sure you use capital X, as <tt>-x</tt> in lowercase
|
||
tells it to disable this feature, even if the local sysadmin has
|
||
chosen to okay a tunneled X connection by default. -- Heather
|
||
</em></p><p>
|
||
This allows you to run X with ports 6000 (and up) <em>closed</em>; (preventing
|
||
remote systems from even seeing that you're running it; much less giving
|
||
them the opportunity to attack your X server) and still allows you to
|
||
easily support remote X clients.
|
||
|
||
</p><p>
|
||
SSH X11 forwarding also works through NAT/IP masquerading and any
|
||
firewall that allows other ssh traffic.
|
||
</p>
|
||
|
||
<!-- end 1c -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/2"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">2C Tip Root Password</FONT></H3>
|
||
Wed, 22 Aug 2001 23:29:43 -0700
|
||
<BR>Yan-Fa Li (<a href="mailto:linux-questions-only@ssc.com">yanfali from best.com</a>)
|
||
|
||
<p><em>This matter has come up many times before, and will surely come up many
|
||
times in the future. I hope by putting Yan-Fa's crisp description and
|
||
our extra notes in Tips, that more people who need it, will find it
|
||
easily. -- Heather</em></p>
|
||
|
||
<strong>
|
||
<P>
|
||
There's a simpler way to put a new root password on a linux
|
||
system if you've forgotten it and have physical access.
|
||
Which I haveto assume this person has since they're messing
|
||
with partitions.
|
||
</P>
|
||
<P>
|
||
If you have lilo installed, interrupt the boot up process
|
||
at the lilo prompt and type:
|
||
<br>kernelImageName <tt>single</tt>
|
||
<br><em>(one example would be <tt>linux</tt> as your kernelImageName.)
|
||
-- Heather</em>
|
||
</P>
|
||
<P>
|
||
This will boot you up in single user mode and allow you to
|
||
chance the password. This has the added advantage of running
|
||
all the standard run level 1 processes, including mounting
|
||
of partitions.
|
||
</P>
|
||
<P>
|
||
Yan-Fa Li
|
||
</P>
|
||
</strong>
|
||
|
||
<p>Things to look out for, however:</p>
|
||
<ul>
|
||
<li>That actually depends on how your system is configured.
|
||
For instance, the default <A HREF="http://www.debian.org/">Debian</A>
|
||
configuration makes you type in the root password before going into
|
||
single-user mode. -- Mike
|
||
<br>That feature is called sulogin. -- Heather
|
||
<li>Another way to do this: at the bootprompt, enter
|
||
<br>kernelImageName <tt>init=/bin/sh</tt>
|
||
<br>No password required, unless you've been so prudent as to
|
||
include
|
||
<br><tt>password=something
|
||
<br>restricted</tt>
|
||
<br>in your lilo.conf before running lilo.
|
||
<br>-- Dan Wilder
|
||
</ul>
|
||
|
||
<!-- end 2 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/5"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">2C Answers: RH7.1 switch to KDE login as default</FONT></H3>
|
||
Wed, 22 Aug 2001 23:32:34 -0700
|
||
<BR>Yan-Fa Li (<a href="mailto:linux-questions-only@ssc.com?cc=yanfali@best.com">yanfali from best.com</a>)
|
||
|
||
<P>
|
||
If you like to get your hands dirty you can also edit the
|
||
<TT>/etc/sysconfig/desktop</TT> file (or create it if it doesn't
|
||
exist) and put in the line: DESKTOP=<A HREF="http://www.kde.org/">KDE</A>
|
||
</P>
|
||
<P>
|
||
This has the added advantage of changed the XDM to KDM instead
|
||
of GDM.
|
||
</P>
|
||
<P>
|
||
Y
|
||
</P>
|
||
|
||
<!-- end 5 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/6"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">2 cent tip: a quick email address finder</FONT></H3>
|
||
Mon, 20 Aug 2001 02:30:03 +1200
|
||
<BR>Timothy Musson (<a href="mailto:linux-questions-only@ssc.com?cc=trmusson@ihug.co.nz">trmusson from ihug.co.nz</a>)
|
||
|
||
<P>
|
||
Hi,
|
||
</P>
|
||
<P>
|
||
From the Department of Scripting Newbieville, here's a tiny function
|
||
I've added to my <tt>.bashrc</tt> and ended up using quite often:
|
||
</P>
|
||
<Pre>
|
||
addy ()
|
||
{
|
||
if [ $# -eq 1 ]
|
||
then
|
||
grep -i "$1" "$HOME/.mail_aliases" | mawk '{ print($3) }'
|
||
else
|
||
echo "Usage: addy <searchstring>"
|
||
fi
|
||
}
|
||
</Pre>
|
||
<P>
|
||
Given a search string (part of a name, nickname or address) as
|
||
input, it'll output any matching email addresses it finds in an
|
||
email aliases file (<tt>~/.mail_aliases</tt>, in this case). The alias file
|
||
contains lines in the format used by mutt - for example:
|
||
</P>
|
||
<Pre>
|
||
alias nickname whoever@wherever (Real Name)
|
||
</pre>
|
||
<P>
|
||
If you use WindowMaker and have xmessage, you can add something
|
||
similar to a menu by adding the following, as a single line, to the
|
||
menu config file of your choice:
|
||
</P>
|
||
<Pre>
|
||
"Find email address..." SHEXEC "xmessage -nearmouse
|
||
`grep -i \'%a(Email address finder,Enter search string:)\'
|
||
.mail_aliases | mawk '{ print($3) }'`"
|
||
</Pre>
|
||
<P>
|
||
Thanks to everyone involved with Linux Gazette - you're great!
|
||
<br>Tim
|
||
</P>
|
||
|
||
<!-- end 6 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/7"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">djbdns? Feh! Get a free-software name server instead</FONT></H3>
|
||
Wed, 1 Aug 2001 09:59:13 -0700
|
||
<BR>Rick Moen (<a href="mailto:linux-questions-only@ssc.com?cc=rick@linuxmafia.com">rick from linuxmafia.com</a>)
|
||
|
||
<P><STRONG>
|
||
Hmm, Answer Gang recommended djbdns without mentioning that it's
|
||
proprietary software? Ouch. Bad gang, no biscuit.
|
||
</STRONG></P>
|
||
<em>
|
||
<P>
|
||
I said "some" and I didn't mention how many people are currently signed
|
||
onto TAG. It's more than two. Maybe next time I'll gather the whole
|
||
flaming thread from across its 3 mailing lists.
|
||
</P>
|
||
<P>
|
||
However I've cc'd the Gang at large so a few more people can take
|
||
a bushwhack at me
|
||
<IMG SRC="../gx/dennis/smily.gif" ALT=":D"
|
||
height="24" width="20" align="top">
|
||
</P>
|
||
<P>
|
||
I ragged on his philosophy a tiny bit and noted that <strong>I</strong>
|
||
won't use it. Even, a technical rather than religious/copyright reason
|
||
not to.
|
||
</P>
|
||
<P>
|
||
But I was also slaving over hot perl scripts and HTML mashed taters
|
||
trying to get the mailbag and tips sections cooked. If you smell smoke
|
||
coming out of my ears that's surely my melted brain
|
||
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
|
||
height="24" width="20" align="middle">
|
||
<br>-- Heather
|
||
</P>
|
||
</em>
|
||
<STRONG>
|
||
<dl><dt>
|
||
If you want the canonical list
|
||
<dd>open-source alternatives to djbdns
|
||
(plus open-source alternatives to other DJBware proprietary offerings),
|
||
look towards the end of
|
||
<dd><A HREF="http://linuxmafia.com/~rick/faq/#djb"
|
||
>http://linuxmafia.com/~rick/faq/#djb</A> .
|
||
</dl></STRONG>
|
||
<P>
|
||
Thanks Rick! Everyone else, I hope you find this particular 2c tip
|
||
especially handy. I'd enjoy hearing some folks will tell us how useful
|
||
or annoying they find these things.
|
||
</P>
|
||
|
||
<!-- end 8 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/9"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">Your article about rbl going commercial?</FONT></H3>
|
||
Wed, 1 Aug 2001 10:43:26 -0700 (PDT)
|
||
<BR>Steven W. Orr (<a href="mailto:linux-questions-only@ssc.com?cc=steveo@syslang.net">steveo from syslang.net</a>)
|
||
|
||
<P><STRONG>
|
||
I see no signs that they want any money from me. Can you point me to a URL
|
||
that wants payment?
|
||
</STRONG></P>
|
||
<P>
|
||
Sure.
|
||
</P>
|
||
<P>
|
||
Here's the subscription policy page, clarifying that their stuff is
|
||
subscription-only now, and why:
|
||
</P>
|
||
<P><BLOCKQuote>
|
||
<A HREF="http://www.mail-abuse.org/subscription.html"
|
||
>http://www.mail-abuse.org/subscription.html</A>
|
||
</BLOCKQuote></P>
|
||
<P>
|
||
Here's the Fee Structure page that it points to:
|
||
</P>
|
||
<P><BLOCKQuote>
|
||
<A HREF="http://www.mail-abuse.org/feestructure.html"
|
||
>http://www.mail-abuse.org/feestructure.html</A>
|
||
</BLOCKQuote></P>
|
||
<P>
|
||
(note, you really want tables support to read that)
|
||
</P>
|
||
<P>
|
||
... so it merely depends on who you are.
|
||
</P>
|
||
|
||
|
||
<!-- end 10 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/11"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">Printer setup on Slackware 8?????</FONT></H3>
|
||
Fri, 3 Aug 2001 14:14:28 +0200
|
||
<BR>Question From: Danie Robberts (<a href="mailto:linux-questions-only@ssc.com?cc=DanieR@PQAfrica.co.za">DanieR from PQAfrica.co.za</a>)
|
||
|
||
<strong>
|
||
<P>
|
||
Which tool must I now use to set up a printer? it used to be printtool on
|
||
older systems (RedHat/Mandrake)
|
||
</P>
|
||
<P>
|
||
Please !
|
||
</P>
|
||
<P>
|
||
Danie Robberts
|
||
</P>
|
||
</strong>
|
||
|
||
<p>The Answer Gang replied with a few distro specific notes:
|
||
<ul>
|
||
<li>On RH it is still printtool (symlinks to printconf-gui)
|
||
<br>-- Mike at cyborg-group
|
||
<li>Slackware:
|
||
apsfilter is what you will probably want to use. You can find it
|
||
in <TT>/usr/lib/apsfilter</TT>. There is a setup program that you can run.
|
||
It's not as friendly as printtool, but it should get you going.
|
||
<br>-- Daniel S. Washko
|
||
<li>Slackware:
|
||
Look in <TT>/usr/doc/apsfilter-6.1.1</TT>. The setup program should be
|
||
<br><tt>/usr/lib/apsfilter/SETUP</tt>
|
||
<br>but I have no idea what replaced printtool. I always used apsfilter.
|
||
<br>-- Andrew Higgs
|
||
</ul>
|
||
|
||
<!-- end 17 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/18"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">Seg Fault</FONT></H3>
|
||
Fri, 03 Aug 2001 15:08:03 -0500
|
||
<BR>Thomas Witt (<a href="mailto:linux-questions-only@ssc.com">twitt from csesoftware.com</a>)
|
||
|
||
<P>
|
||
Not really sure how to get this where it needs to go.
|
||
</P>
|
||
<P><em>
|
||
This is the right place. It will be published in next month's 2-Cent Tips,
|
||
unless Heather has too much other material. -- Mike
|
||
</em></P>
|
||
<P>
|
||
I have recently had the same problem with random seg faults that you
|
||
addressed in August TAG.
|
||
</P>
|
||
<P>
|
||
I bought a new computer, pieced it together, and put 384M in it. When I
|
||
initially installed linux, it was dog slow, and running top, I noticed that
|
||
I only had 64M visible (I think, incredibly less that 384 to be sure).
|
||
I did a little checking and learned that the motherboard has a
|
||
known problem of not seeing all the memory. So I entered the line
|
||
"mem=384M". I then started getting random seg faults. I couldn't figure
|
||
it out for a long time.
|
||
</p><p>Even though I had a graphics card with on-board
|
||
memory, my bios still alotted 64M to the AGP device on the
|
||
motherboard. I reduced this (couldn't get rid of it, or set to 0), and
|
||
allowed for the use in my <tt>lilo.conf</tt> entry, and all is wonderful now.
|
||
</P>
|
||
<P>
|
||
Sorry about the verbosity.
|
||
</P>
|
||
<P>
|
||
-Tom
|
||
</P>
|
||
|
||
<!-- end 19 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/20"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">SMTP Auth with Debian potato and exim</FONT></H3>
|
||
Wed, 1 Aug 2001 17:20:38 -0400 (EDT)
|
||
<BR>Question from: Chuck Peters (<a href="mailto:linux-questions-only@ssc.com?cc=cp@ccil.org">cp from ccil.org</a>)
|
||
<br>Tip from: Faber Fedor
|
||
|
||
<P><STRONG>
|
||
Hi,
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
I have done some reading and searching but the solution to our problem
|
||
still eludes me.
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
I volunteer for a non-profit freenet ccil.org and would like to setup smtp
|
||
authenication so that CCIL users who buy connectivity from other ISP's
|
||
will continue to use our stable and reliable mail sevices. The system our
|
||
mail runs on is a <A HREF="http://www.debian.org/">Debian</A> potato box running the default smtp server exim.
|
||
<br>Can you point me to a HOWTO?
|
||
</STRONG></P>
|
||
<P><STRONG>
|
||
Thanks,
|
||
<br>Chuck
|
||
</STRONG></P>
|
||
|
||
<P>
|
||
Are you asking how to allow users of your systems to access mail on your system
|
||
even though they are not in your domain? If so, you want a program called
|
||
pop-before-smtp (here's one URL I found over on google:
|
||
<A HREF="http://rpmfind.net/linux/RPM/PLDtest/i686/pop-before-smtp-1.21-3.noarch.html"
|
||
>http://rpmfind.net/linux/RPM/PLDtest/i686/pop-before-smtp-1.21-3.noarch.html</A> ).
|
||
</P>
|
||
<P>
|
||
It's easy to setup and allows your users to access their email from anywhere
|
||
in the world.
|
||
</P>
|
||
<P>
|
||
-- Sincerely,
|
||
Faber Fedor
|
||
</P>
|
||
|
||
<!-- end 21 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/22"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">Source control</FONT></H3>
|
||
Mon, 6 Aug 2001 10:02:17 -0700
|
||
<BR>Mike Orr (<a href="mailto:linux-questions-only@ssc.com">LG Editor</a>)
|
||
|
||
<P>
|
||
Has anybody tried Subversion? According to the web page
|
||
(<A HREF="http://subversion.tigris.org"
|
||
>http://subversion.tigris.org</A>), it's at Milestone 2 alpha
|
||
development, and aims to have all CVS features plus:
|
||
</P>
|
||
<P><ul>
|
||
<li> versioning of directories, permissions, etc.
|
||
<li> symbolic and hard links.
|
||
<li> better merge algorithm to minimize conflicts requiring human intervention.
|
||
<li> natively client/server.
|
||
</ul></P>
|
||
<P>
|
||
It was recommended by someone on the Cheetah (<A HREF="http://www.cheetahtemplate.org"
|
||
>http://www.cheetahtemplate.org</A>)
|
||
mailing list.
|
||
</P>
|
||
|
||
<p><em>At print time, it reached its Milestone 3, is now self hosted (they use
|
||
their own code and not CVS anymore), and they hope to be feature
|
||
complete in early October.
|
||
</em></p>
|
||
<p><em>Compare also Bitkeeper, (<a href="http://www.bitkeeper.com/">www.bitmover.com</a>), a project by Larry McVoy and others aimed toward successful source
|
||
control of big, complicated projects. -- Heather</em></p>
|
||
|
||
<!-- end 23 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/24"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">Kernels?? on a Sparc</FONT></H3>
|
||
Tue, 14 Aug 2001 11:23:53 +0200
|
||
<BR>Danie Robberts / PQN (<a href="mailto:linux-questions-only@ssc.com">DanieR from PQAfrica.co.za</a>)
|
||
|
||
<strong>
|
||
<P>
|
||
Hi,
|
||
</P>
|
||
<P>
|
||
Can you use the same source for compiling a kernel on both an Intel based
|
||
machine as well as a Sun?
|
||
</P>
|
||
<P>
|
||
I would like to know before I break my Sun
|
||
</P>
|
||
<P>
|
||
thanx
|
||
<br>Danie
|
||
</P>
|
||
</strong>
|
||
|
||
<!-- end 24 -->
|
||
<P>
|
||
It should automatically detect the architecture it's compiling on and
|
||
produce the right kernel.
|
||
</P>
|
||
<P>
|
||
However, whenever you install a new kernel, you always want to have a plan
|
||
of escape in case the new kernel doesn't boot. That means making sure
|
||
your old kernel is still ready to go and you know how to switch back to it.
|
||
Popular ways to do this are to put the new kernel on a boot floppy, leaving
|
||
the hard-disk setup alone, or arranging for LILO to boot one or the other
|
||
from its menu. I'm not sure if Sun computers have LILO (Alphas use a multi-OS
|
||
program called MILO instead), but they should have something equivalent.
|
||
-- Mike</P>
|
||
|
||
<em>
|
||
<P>
|
||
I can answer that. They use SILO, which works a little differently from LILO,
|
||
but in a way, it makes it much easier to have multiple kernels.
|
||
</P>
|
||
<P>
|
||
Booting a Sparc takes more code than a PC does, but the disk partitioning
|
||
utilities available to linux are not real clear on that concept. So SILO
|
||
installs a <strong>tiny</strong> first stage loader whose only job in the
|
||
whole world is to find the second stage. The second stage has more room
|
||
than LILO does, so it is also smart enough to read its own config file.
|
||
Thus SILO doesn't need to be re-invoked all the time when you make
|
||
configuration changes.
|
||
</P>
|
||
<P>
|
||
But I wouldn't change what you let the bootprom memorize, until you are dead
|
||
certain the new one works.
|
||
</P>
|
||
<P>
|
||
I'll add that the Sparc <A HREF="http://www.debian.org/">Debian</A> disc
|
||
might make an acceptable rescue disc if you get really screwed up, but
|
||
it's still better to be careful. -- Heather
|
||
</P>
|
||
</em>
|
||
|
||
<!-- end 26 -->
|
||
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
|
||
<P> <A NAME="tips/27"><HR WIDTH="75%" ALIGN="center"></A> <P>
|
||
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
|
||
<FONT COLOR="navy">portal for a newbie?</FONT></H3>
|
||
Tue, 14 Aug 2001 22:44:16 -0500
|
||
<BR>Vic Ward (<a href="mailto:linux-questions-only@ssc.com">vward from uswest.net</a>)
|
||
|
||
<strong>
|
||
<P>
|
||
What combination of open source software should be used to create a
|
||
portal site? How could a beginner build and test such a site?
|
||
</P>
|
||
</strong>
|
||
|
||
<p>The Gang replies:</p>
|
||
<ul>
|
||
<li>Metadot
|
||
(<A HREF="http://freshmeat.net/projects/metadotportalserver"
|
||
>http://freshmeat.net/projects/metadotportalserver</A>)
|
||
<br>is a nice portal software....
|
||
I use it at <A HREF="http://www.gmnow.net"
|
||
>http://www.gmnow.net</A>
|
||
<br>-- Guy
|
||
<li>Mike Orr mentions several ...
|
||
<br><em> The best ones are based on a widely-used
|
||
programming language and allow customization in that language, in case
|
||
the default features are not adequate. You could also write your own in
|
||
Python, PHP or as a Java servlet.</em>
|
||
<ul>
|
||
<li>Python-based:
|
||
<UL><LI>Zope (<A HREF="http://www.zope.org" >http://www.zope.org</A>).
|
||
<br>You can use the default portal user interface or design your own
|
||
using Zope's tools.
|
||
<LI>There are also Zope Products like Squishdot you can plug in that
|
||
offer an alternate user interface, talkback features, etc.
|
||
<LI>Webware (<A HREF="http://webware.sourceforge.net"
|
||
>http://webware.sourceforge.net</A>)
|
||
is not a portal but provides modular tools to build one.
|
||
</UL>
|
||
<li>PHP-based:
|
||
PHP Nuke (<A HREF="http://phpnuke.org"
|
||
>http://phpnuke.org</A>). Warning: low on documentation.
|
||
</ul>
|
||
</Ul>
|
||
|
||
<strong>
|
||
<P>
|
||
Thank you for the reply. It is very helpful. Gives me a lot of new places
|
||
to look.
|
||
</P>
|
||
<P>
|
||
peace
|
||
</p>
|
||
</strong>
|
||
|
||
<!-- end 30 -->
|
||
<P> <hr> </p>
|
||
<!-- *** BEGIN copyright *** -->
|
||
<H5 align="center">This page edited and maintained by the Editors
|
||
of <I>Linux Gazette</I>
|
||
<a href="http://www.linuxgazette.com/copying.html"
|
||
>Copyright ©</a> 2001
|
||
<BR>Published in issue 70 of <I>Linux Gazette</I> September 2001</H5>
|
||
<H6 ALIGN="center">HTML script maintained by
|
||
<A HREF="mailto:star@starshine.org">Heather Stern</a> of
|
||
Starshine Technical Services,
|
||
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
|
||
</H6>
|
||
<!-- *** END copyright *** -->
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more <FONT COLOR="red">lovable!</FONT></I>"
|
||
<IMG ALT="" SRC="../gx/adam/heart.png" WIDTH="30" HEIGHT="25">
|
||
</H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<P ALIGN=CENTER><IMG ALT="[picture of mechanic]" SRC="../gx/adam/mechanic.png" ALT="Weekend Mechanic Logo" ALIGN=BOTTOM WIDTH=399 HEIGHT=135 BORDER=0></P>
|
||
|
||
<H1 ALIGN=CENTER><FONT COLOR="maroon">The Weekend Mechanic</FONT></H1>
|
||
|
||
<H4 ALIGN=CENTER>By <A HREF="mailto:thomas_adam16@yahoo.com">Thomas
|
||
Adam</A></H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<!-- END header -->
|
||
|
||
|
||
|
||
|
||
|
||
<!-- ---------------- -->
|
||
<!-- Begin Content Listing -->
|
||
<!-- ---------------- -->
|
||
|
||
<H2>Table of Contents</H2>
|
||
<UL>
|
||
<LI><A HREF="#preamble">Welcome
|
||
to the August edition</A>
|
||
<LI><A HREF="#apache">A brief
|
||
introduction: Apache</A>
|
||
<LI><A HREF="#progupx">Program
|
||
Review: upx</A>
|
||
<LI><A HREF="#progbb">Program
|
||
Review: bb</A>
|
||
<LI><A HREF="#closing">Closing Time</A>
|
||
</UL>
|
||
|
||
<!-- -------------- -->
|
||
<!-- End Content Listing -->
|
||
<!-- --------------- -->
|
||
|
||
<HR>
|
||
|
||
<!-- ----------- -->
|
||
<!-- Begin Preamble -->
|
||
<!-- ----------- -->
|
||
|
||
<H2><A NAME="preamble"></A>Welcome to the August edition</H2>
|
||
|
||
<P>Hello there, dear readers. How have you all been? Not too busy I
|
||
trust. I on the other hand have been busy over the last month or so.
|
||
I have just completed my A-level exams, which I found to be quite
|
||
tiring. That was why I was unable to write the Weekend Mechanic last
|
||
month. For those of you who are currently doing, or are thinking of
|
||
taking A-levels, I would advise you that although they are good fun
|
||
they require lots of hard work.</P>
|
||
|
||
<P>As a result of completing my A-levels (these are university entry
|
||
exams) I have also left school. Although for me this is rather sad,
|
||
it does mean that I shall have lots of time to develop my Linux
|
||
ideas. Thus, over the holidays I am hopefully going to be teaching
|
||
an evening class about using Linux. It is something that I am looking
|
||
forward to.</P>
|
||
|
||
<P>But I don't wish to delve too much into the future. Going back to
|
||
the world of computing one thing that happened recently which I
|
||
found quite amusing was that a young computer cracker (age 19
|
||
years, whose name I cannot remember) from Wales (UK), had gotten
|
||
a load of credit-card details and posted them onto another website.
|
||
Amongst the credit-card details obtained was that of Bill Gates. This
|
||
young cracker then used his credit-card, ordered a consignment of
|
||
viagra, and sent it to Bill Gates!!!</P>
|
||
|
||
<P>You'd have thought that the Welshman would have had something
|
||
better to do.........</P>
|
||
|
||
<!-- ---------- -->
|
||
<!-- End Preamble -->
|
||
<!-- ---------- -->
|
||
|
||
<HR>
|
||
|
||
<!-- ------------------->
|
||
<!-- Begin Apache -->
|
||
<!-- Begin Content Listing -->
|
||
<!-- ---------------- --->
|
||
|
||
<H2><A NAME="apache"></A>A Brief Introduction: Apache</H2>
|
||
<UL>
|
||
<LI><A HREF="#aboutinst">Installation</A>
|
||
<LI><A HREF="#runapache">Running
|
||
Apache</A>
|
||
<LI><A HREF="#configlochost">Using
|
||
Apache: http://localhost</A>
|
||
<LI><A HREF="#configpublic">Using
|
||
Apache: per-user webspaces</A>
|
||
<LI><A HREF="#configalias">Using
|
||
Apache: Aliases</A>
|
||
<LI><A HREF="#configsecure">Using Apache: Secure
|
||
Directories</A>
|
||
|
||
</UL>
|
||
|
||
<!-- -------------- -->
|
||
<!-- End Content Listing -->
|
||
<!-- -------------- --->
|
||
|
||
<HR>
|
||
|
||
<!-- ------------- -->
|
||
<!-- Begin Installation -->
|
||
<!-- ------------- -->
|
||
|
||
<H2><A NAME="aboutinst"></A>Installation</H2>
|
||
|
||
<P>The internet is growing at an alarming rate. Indeed, with nearly
|
||
every ISP there is the opportunity of being able to publish your own
|
||
web pages. The ability to do this is through the use of a computer
|
||
(the host), and a webserver program such as Apache. Although there
|
||
are other webservers, Apache is the most widely used on the internet
|
||
and is the most stable.</P>
|
||
|
||
<P>"But why would you want to use it on a local machine?",
|
||
I hear you cry. Well running the Apache httpd daemon on your Linux
|
||
box means that it is a great way of storing information, especially
|
||
if you have a lot of HTML pages. I happen to have Apache running
|
||
because I have a local copy of all the LDP Howto's, and of course a
|
||
copy of the <I>Linux Gazette</I> archives!!</P>
|
||
|
||
<P>So the first thing to do is to test whether or not you have
|
||
Apache installed. If you are using a distribution that uses the RPM
|
||
file format, type in the following:</P>
|
||
|
||
<PRE>rpm -qa | grep -i apache</PRE>
|
||
|
||
<P>If successful you should see a line similar to:</P>
|
||
|
||
<PRE>apache-1.3.12-95</PRE>
|
||
|
||
<P>This means that the Apache webserver has been installed. If you do
|
||
not have Apache on your system then you must install it. Many
|
||
distributions come with Apache so the chances are it is on
|
||
your distribuion CD. If it is not, or your distribution does not
|
||
support the rpm format, then you must download the source files in
|
||
tarred/gzipped format (*.tar.gz) available from <A HREF="http://www.apache.org/" TARGET="_blank">www.apache.org</A>.
|
||
Once you have downloaded the files you can usually install apache in
|
||
the following way:</P>
|
||
|
||
<P>1. Log in as Root</P>
|
||
<P>2. Gunzip/untar the file:</P>
|
||
|
||
<PRE>tar xzvf /path/to/tarfile/apache*.tar.gz</PRE>
|
||
|
||
<P>3. cd to the newly created Apache directory:</P>
|
||
|
||
<PRE>cd Apache*</PRE>
|
||
|
||
<P>4. Run the "configure" script:</P>
|
||
|
||
<PRE>./configure</PRE>
|
||
|
||
<P>5. That will take a minute. Hopefully, that should be successful, and
|
||
a makefile, called "Makefile" should exist in the
|
||
directory. If not, it is likely that you do not have any compiler
|
||
programs (such as C, C++, g++), or you header files, or kernel source
|
||
files installed. It might also be possible that your make utility is
|
||
not installed. If this is true then you must install them.</P>
|
||
|
||
<P>So once configure has finished the thing you have to do now is
|
||
to "make" the file, by typing in the following:</P>
|
||
|
||
<PRE>make</PRE>
|
||
|
||
<P>This step may take some time, especially if you have an old machine.</P>
|
||
|
||
<P>Assuming there were no errors from the make, the last thing you have to do
|
||
is to install the compiled files by typing:</P>
|
||
|
||
<PRE>make install</PRE>
|
||
|
||
<P>And hopefully that should have installed Apache. If you do encounter
|
||
errors while installing/compiling Apache read the documentation that
|
||
comes with it. One caveat that I will mention is that during the
|
||
"make" process it is normal for the information to be
|
||
echoed to the screen. If you find that you are getting repeated
|
||
errors while compiling Apache, one work around is to issue the
|
||
following command:</P>
|
||
|
||
<PRE>make -k all</PRE>
|
||
|
||
<P>The above command will force make to continue, even
|
||
if it encounters errors <I>en route</I>. Although I only recommend
|
||
using it as an absolute last resort. Invariably reading Apache's
|
||
documentation should solve most compiler issues.</P>
|
||
|
||
<!-- End Installation Section -->
|
||
|
||
<!-- --------------------- -->
|
||
|
||
<!-- Begin Running Apache -->
|
||
<H2><A NAME="runapache"></A>Running Apache</H2>
|
||
|
||
<P>Now that everything has been installed the next thing to do is to
|
||
start Apache. This is accomplished by starting the "httpd"
|
||
daemon. By default (or at least for me anyway) Apache is
|
||
automatically run during your run-level so if you have not already
|
||
rebooted your machine type what follows still as user "root":</P>
|
||
|
||
<PRE>httpd</PRE>
|
||
|
||
<P>Hopefully your prompt should have been returned with nothing echoed
|
||
to the screen. To check that the "httpd" daemon is running,
|
||
we can use our old friend "ps", thus:</P>
|
||
|
||
<PRE>ps aux | grep -i httpd</PRE>
|
||
|
||
<P>What the above command does, is to list all the processes (including
|
||
those that are not attached to a tty), and then filters the list
|
||
(pipes "|") it to the <I>grep</I> command, which will match
|
||
for the expression "apache". The switch <B>-i</B> ignores
|
||
case sensitivity.</P>
|
||
<P>You should see a number of lines, but one which looks similar to
|
||
the following:</P>
|
||
|
||
<PRE>wwwrun 1377 0.0 2.0 4132 1340 ? S 11:09 0:00 httpd</PRE>
|
||
|
||
<P>This means that Apache is up and running. If you find that the result
|
||
of that command simply returns "root blah blah <I>grep -i httpd</I>"
|
||
then you must run httpd again. If you keep getting the same message, switch to <I>init 6</I></P>
|
||
|
||
<!-- End Running Apache -->
|
||
|
||
<! -- ------------------ -->
|
||
|
||
<!-- Begin Using Apache: http://localhost/ -->
|
||
|
||
<H2><A NAME="configlochost">Using Apache: http://localhost/</A></H2>
|
||
|
||
<P>OK, now were are getting somewhere. Having ensured that the
|
||
"httpd" daemon is active, we can actually start playing
|
||
with it. Open up a copy of a Web browser (such as Netscape) and
|
||
enter the following URL:</P>
|
||
|
||
<PRE>http://localhost</PRE>
|
||
|
||
<P>Hopefully you should see a web page of sorts. This usually differs
|
||
between different Linux distributions. On my SuSE box I am presented
|
||
with the SuSE Support Database with the SuSE chameleon mascot in the
|
||
top middle of the page!</P>
|
||
|
||
<P>The page that you are looking at is the main page at the site
|
||
"localhost". This page is stored in the following
|
||
directory:</P>
|
||
|
||
<PRE>/usr/local/httpd/htdocs</PRE>
|
||
|
||
<P>This directory has a special name. It is called <B><I>DocumentRoot</I></B>.The
|
||
actual path may vary slightly on some systems, but invariably it is
|
||
similar to the above. In this directory you should notice some
|
||
files, in particular *.html files. The file that is loaded when you go
|
||
to "http://localhost/" is the file <I>index.html</I>. What
|
||
I have done, is created a sub-directory in "htdocs" called
|
||
"oldhtdocs", and copied all the files into it. That way, I
|
||
can start afresh, and know that I have the originals if I need them.</P>
|
||
|
||
<P>You may find, that reading and writing to the <B>DocumentRoot</B>
|
||
folder has been disallowed to non-root users. To get around this
|
||
issue the following command as root, replacing "/path/to/htdocs"
|
||
with the correct pathway:</P>
|
||
|
||
<PRE>chmod +rw /path/to/htdocs</PRE>
|
||
|
||
<P>Knowing now, where the files are located for "http://localhost/"
|
||
is all very well, but how do you configure apache? Hang on there
|
||
reader......the file you are looking for is called <I>httpd.conf</I>
|
||
and is located usually in "/etc/httpd" or it maybe in the
|
||
directory "/usr/local/apache". On SuSE and Mandrake
|
||
systems, the latter is the default place. In the sections that
|
||
follow I shall be using the "httpd.conf" file to carry out
|
||
various customisations.</P>
|
||
|
||
<!-- End Using Apache: http://localhost/ -->
|
||
|
||
<!-- --------------------------- -->
|
||
|
||
<!-- Begin Using Apache: Per-user web space -->
|
||
|
||
<H2><A NAME="configpublic"></A>Using Apache: Per-user webspace</H2>
|
||
|
||
<P>How many of you have gone to URL's that contain the tilde symbol
|
||
(~) followed by a name and then a (/)? I would imagine that nearly
|
||
everyone has, at sometime. But how many of you were aware of
|
||
what it meant?? The tilde symbol within a URL indicates a "subdomain"
|
||
that is owned by a user on the computer system, off the main domain name.
|
||
Thus, at school, I had my own webserver, with a valid URL:</P>
|
||
<PRE>http://linuxservertom.purbeck.dorset.local/~thomas_adam/</PRE>
|
||
|
||
<P>What this was doing, was actually retrieving files stored in a
|
||
special folder under the user account, of user "thomas_adam".
|
||
This ability, gives users on a network, a space on which to house
|
||
their own web pages. So how is all this achieved? Well, it is quite
|
||
simple really....</P>
|
||
|
||
<P>All users, who are allowed their own webspace, have to be put in
|
||
the group <I>nogroup</I> (or <I>www-data</I> under Debian, etc). This can be
|
||
done, by editing the file "/etc/group" (as root), and locating the
|
||
line for "nogroup". Then at the end of the line, add the users' name
|
||
separated by a comma. Then save the file.</P>
|
||
|
||
<P>In a user's home directory, a directory called <B><I>public_html</I></B>
|
||
has to be created, thus (as user root type):</P>
|
||
|
||
<PRE>cd /home/auser/ && mkdir public_html</PRE>
|
||
|
||
<P>Where "auser" is the name of a valid user on the system.
|
||
Then the permissions have to be set. This is done by typing in the
|
||
following:</P>
|
||
|
||
<PRE>chmod 755 /home/auser/public_html</PRE>
|
||
|
||
<P>Then the last thing to do, is to set the group of that newly created
|
||
folder to <I>nogroup</I>. This can be done, by typing:</P>
|
||
|
||
<PRE>chown auser.nogroup /home/auser/public_html</PRE>
|
||
|
||
<P>Where "auser" is the name of the valid user.....substitute
|
||
as appropriate. The same procedure can be applied to all users. It
|
||
might also be an idea to play about with "useradd" so
|
||
that when you add new users, the "public_html" directory
|
||
with the permissions are set automatically.</P>
|
||
|
||
<P><I> [Actually, you don't <EM>have</EM> to do all that user and group
|
||
stuff, if you instead make sure the <I>public_html</I> directory and
|
||
all its files are world readable:
|
||
|
||
<PRE>chmod -R a+r /home/auser/public_html</PRE>
|
||
|
||
The important thing is that Apache has read access to the files. -- Mike Orr]
|
||
</I></P>
|
||
|
||
<P>So the next thing to do, is to make sure that Apache is aware of
|
||
what we have done. Open up the "httpd.conf" file, and lets
|
||
take a look......</P>
|
||
|
||
<P>By default, I think that the configuration that tells the Apache
|
||
about the public_html directive is commented out, or at least it was
|
||
in mine. From the beginning of the document, search for the keyword
|
||
<B>UserDir</B>. You should find something that looks like the
|
||
following:</P>
|
||
|
||
<PRE><IfModule mod_userdir.c>
|
||
UserDir public_html
|
||
</IfModule>
|
||
</PRE>
|
||
|
||
<P>If any of the above lines have a hash (#) symbol preceeding them,
|
||
delete them. The above lines tell Apache that the directory
|
||
"public_html" is to be used for html files for each user.</P>
|
||
|
||
<P>Directly below this are more related lines that tell apache what sort of
|
||
restrictions to apply. In the case of the following lines they are read-only.
|
||
If any of these are commented out, uncomment them.</P>
|
||
|
||
<PRE><Directory /home/*/public_html>
|
||
AllowOverride FileInfo AuthConfig Limit
|
||
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
|
||
<Limit GET POST OPTIONS PROPFIND>
|
||
Order allow,deny
|
||
Allow from all
|
||
</Limit>
|
||
<LimitExcept GET POST OPTIONS PROPFIND>
|
||
Order deny,allow
|
||
Deny from all
|
||
</LimitExcept>
|
||
</Directory></PRE>
|
||
|
||
<P>So now all that remains is to start to write the web pages. The only
|
||
other thing which you will find extremely useful is that if you
|
||
noticed my example earlier:</P>
|
||
|
||
<PRE>http://linuxservertom.purbeck.dorset.local/thomas_adam/</PRE>
|
||
|
||
<P>I had not specified a ".html" file to load. This is because
|
||
I had already told Apache a default file to look for within it. Such
|
||
a file is known as a <B>DirectoryIndex</B>, and you can specify
|
||
default files to load. Locate the following in your "httpd.conf"
|
||
file:</P>
|
||
|
||
<PRE><IfModule mod_dir.c>
|
||
DirectoryIndex index.html index.shtml lwm.html home.html
|
||
</IfModule></PRE>
|
||
|
||
<P>What this is telling Apache is that when a URL is specified, such as
|
||
the example above, with no extension file after it (*.htm*), then it
|
||
will look for a default file(s) specified after the flag
|
||
"DirectoryIndex". Thus in your "public_html"
|
||
file, if there was a file called "index.html", then this
|
||
would be loaded on default. You are able to specify multiple files
|
||
as in my example above. If Apache cannot find anyone of the above
|
||
files then the directory listing is displayed instead (unless you specify
|
||
a file to load).</P>
|
||
|
||
<P>One thing that I would like to mention at this point, is if you
|
||
have specified a hostname in "/etc/hosts", you can
|
||
substitute that name in place of "http://localhost". It is
|
||
for convienience that I use it here. Furthermore in "httpd.conf",
|
||
I would recommend that you find the following flag and substitute
|
||
<I>localhost</I> for the first part of your host name:</P>
|
||
|
||
<PRE>ServerName grangedairy</PRE>
|
||
|
||
<P>Thus my host name is <I>grangedairy.laptop</I>, I have simply put
|
||
<I>grangedairy</I>. The reasons for doing this will become apparant
|
||
from reading the <A HREF="#configalias">Alias Section</A></P>
|
||
|
||
<P>The last thing you have to do is with any changes that you make
|
||
to "httpd.conf", you have to stop and restart it. This can
|
||
be achieved by typing in the following (as root):</P>
|
||
|
||
<PRE>
|
||
killall httpd
|
||
httpd
|
||
</PRE>
|
||
|
||
<!-- End per-user web space -->
|
||
|
||
<!-- ------------------- -->
|
||
|
||
<!-- Begin config-alias -->
|
||
|
||
<H2><A NAME="configalias"></A>Using Apache: Aliases</H2>
|
||
|
||
<P>In this section, I shall be covering the rather short topic of
|
||
<I>Aliases</I>. Using the "httpd.conf" file, we can see a
|
||
list of aliases if we search for the keyword "alias".
|
||
Hopefully you should see a list which looks similar to the
|
||
following:</P>
|
||
|
||
<PRE>Alias /howto /usr/share/doc/howto/en/html/
|
||
Alias /mini /usr/share/doc/howto/en/html/mini/
|
||
Alias /lg /usr/share/doc/lg/
|
||
Alias /hilfe /usr/share/doc/susehilf/
|
||
Alias /doc /usr/share/doc/
|
||
Alias /cgi-bin-sdb /usr/local/httpd/cgi-bin/
|
||
Alias /sdb /usr/share/doc/sdb/
|
||
Alias /manual /usr/share/doc/packages/apache/manual/
|
||
Alias /htdig /opt/www/htdocs/htdig/
|
||
Alias /opt/kde/share/doc/HTML /opt/kde/share/doc/HTML/
|
||
Alias /opt/gnome/share/gnome/help/ /opt/gnome/share/gnome/help/
|
||
Alias /errors/ /usr/local/httpd/errors/
|
||
Alias /icons/ /usr/local/httpd/icons/
|
||
Alias /admin /usr/local/httpd/admin/
|
||
Alias /lwm /usr/share/doc/lg/lwm/</PRE>
|
||
|
||
<P>As you can see, what the above is saying, is that if the URL ends in
|
||
a "/howto" for example, then Apache is to get its web pages
|
||
from the directory "/usr/share/doc/howto/en/html". Once
|
||
again the default web page that it will load up is taken from
|
||
<I>DirectoryIndex</I>, as we saw earlier.</P>
|
||
|
||
<PRE>http://grangedairy/howto</PRE>
|
||
|
||
<P>You may remember that earlier I had said that you should specify a
|
||
<I>ServerName</I> flag in "httpd.conf". This was done so
|
||
that when you typed in the URL with one of the above aliases, you do
|
||
not need to put an extra forward slash at the end of the URL. You
|
||
see, originally, the above aliases, were alised thus:</P>
|
||
|
||
<PRE>Alias /howto/ /usr/share/doc/howto/en/html/
|
||
Alias /mini/ /usr/share/doc/howto/en/html/mini/</PRE>
|
||
|
||
<P>with extra forward slashes after the alias name. I soon got tired of
|
||
having to add this in myself and so I was able to tell Apache how to
|
||
do this for me. By setting the <I>ServerName</I> flag apache now
|
||
knows the name of my machine so that when I go to:</P>
|
||
|
||
<PRE>http://grangedairy/howto</PRE>
|
||
|
||
<P>It automatically appends the forward slash at the end. Cool, eh?? So
|
||
if you have done the same as me you can delete the trailing forward
|
||
slashes from the alias name because hopefully, you should not need
|
||
them!</P>
|
||
|
||
<!-- End config-alias -->
|
||
|
||
<! -- ---------------- -->
|
||
|
||
<!-- Begin Secure-directories -->
|
||
|
||
<H2><A NAME="configsecure"></A>Using Apache: Secure Directories</H2>
|
||
|
||
<P>The final part to my Apache tutorial is how to set up and create
|
||
"secure directories", i.e. those that require user
|
||
authentication before they are loaded. You will have noticed earlier
|
||
that in my listing examples of <I>Aliases</I>, there was one for
|
||
"/admin". This is in fact a secure directory.</P>
|
||
|
||
<P>You can set up secure directories in the same way that you would an
|
||
ordinary alias except this time, you have to tell Apache a little
|
||
bit about the directory itself and how it is to be parsed. So say
|
||
that you wanted to set up a secure directory <B><I>mysecuredir</I></B>,
|
||
at location "/usr/local/httpd/mysecuredir/" You would do
|
||
the following:</P>
|
||
|
||
<P>1. Add "/mysecuredir" to alias list:</P>
|
||
<PRE>alias /mysecuredir /usr/local/httpd/mysecuredir</PRE>
|
||
|
||
<P>2. Change to the location of the folder that you have specified in the <I>
|
||
alias</I> list, thus:</P>
|
||
<PRE>cd /usr/local/httpd</PRE>
|
||
|
||
<P>3. Create the directory "mysecuredir" by typing in:</P>
|
||
<PRE>mkdir mysecuredir && cd mysecuredir</PRE>
|
||
|
||
<P>This has created the directory, and changed to it.</P>
|
||
|
||
<P>4. Now the work begins. There are two files that we shall be using .htaccess
|
||
and htpasswd. The first file (.htaccess) is the one that we shall set up first. It is
|
||
this file that will store the information about how the "mysecuredir" is
|
||
to be used.</P>
|
||
|
||
<P>So at the console, use an editor such as <I>nano (a pico clone), jed, emacs,</I>
|
||
etc, to create the .htaccess file, and enter the following information, exactly as shown
|
||
because apache is case-sensitive in parsing commands!:</P>
|
||
|
||
<PRE>
|
||
AuthType Basic
|
||
AuthName "Restricted Directory"
|
||
AuthUserFile /usr/local/httpd/admin/htpasswd
|
||
require valid-user
|
||
</PRE>
|
||
|
||
<P> (Since ,htaccess starts with a period, it won't show up in
|
||
ordinary directory listings. Use "ls -a" to see it.)
|
||
|
||
<P>The commands above are the most common ones used to create a secure directory.
|
||
The table below will give a short description of the commands and how you can customise
|
||
them.<P>
|
||
|
||
<TABLE BORDER=2 WIDTH=100%>
|
||
<TBODY>
|
||
<TH>Option Tag</TH>
|
||
<TH>Meaning</TH>
|
||
<TR>
|
||
<TD WIDTH=25% ALIGN="middle"><B>AuthType</B></TD>
|
||
<TD ALIGN="left">This sets the authentication type. Basic is usally always used.</TD>
|
||
</TR>
|
||
<TR>
|
||
<TD WIDTH=25% ALIGN="middle"><B>AuthName</B></TD>
|
||
<TD ALIGN="left">Sets the name on the "login" box of the directory that you are
|
||
trying to connect to (see the screenshot below).</TD>
|
||
</TR>
|
||
<TR>
|
||
<TD WIDTH=25% ALIGN="middle"><B>AuthUserFile</B></TD>
|
||
<TD ALIGN="left">This is the file that is used to check for authentication, i.e. it
|
||
stores your username and password (encrypted of course). You must ensure
|
||
that you use the full path to the htpasswd file.</TD>
|
||
</TR>
|
||
<TR>
|
||
<TD WIDTH=25% ALIGN="middle"><B>require valid-user</B></TD>
|
||
<TD ALIGN="left">This says that access is only allowed to those who have a valid entry
|
||
in the htpasswd file.</TD>
|
||
</TR>
|
||
</TBODY>
|
||
</TABLE>
|
||
|
||
<P> Note: for additional security, put the htpasswd file somewhere that is
|
||
<EM>not</EM> accessible via URL--somewhere outside your web directory and
|
||
outside your alias directories. A .htaccess file must be in the URL-accessible
|
||
directory it's protecting, but the htpasswd file may be anywhere.
|
||
You may also share the same htpasswd file among several .htaccess directories
|
||
if desired.
|
||
|
||
<P>Ok, now that we have told apache how to handle the directory we now need to create the password file:</P>
|
||
|
||
<P>5. To create the <I>htpasswd</I> file you have to type in the following command (in the same directory
|
||
as the ".htaccess" file:</P>
|
||
|
||
<PRE>htpasswd -c htpasswd username</PRE>
|
||
|
||
<P>Whereby you replace "username" with your username. To keep adding users to the file, issue the same command, but remove the "-c" flag.</P>
|
||
|
||
<P>6. Now edit our friend <I>/etc/httpd/httpd.conf</I> and at the bottom of the alias list, add the following:</P>
|
||
|
||
<PRE>
|
||
<Directory /usr/local/httpd/*>
|
||
AllowOverride AuthConfig
|
||
</Directory>
|
||
</PRE>
|
||
|
||
<P>You may have to modify it slightly, but that will ensure that if apache meets any ".ht*" files
|
||
it will use them to apply security on them. To turn off this, for the above, change <I>AllowOverride AuthConfig</I>
|
||
to <I>AllowOverride None</I>.</P>
|
||
|
||
<P>Now stop and restart the <I>httpd</I> daemon</P>
|
||
|
||
<P>Ok now you are all set to try it out. Having saved the files go to your web browser and type in the following:</P>
|
||
|
||
<PRE>http://servername/mysecuredir</PRE>
|
||
|
||
<P>Making sure that you replace "servername" with either your hostname, or "localhost".
|
||
If successful you should see a dialog box similar to
|
||
<A HREF="misc/adam/screenshot.jpg">this screenshot</A>.</P>
|
||
|
||
<P>Once you have entered the correct details you should then be off and away. You may find however that
|
||
you can connect to the "mysecure" directory without having to supply any credentials. If this happens,
|
||
you need to check the following in your "/etc/httpd/httpd.conf" file.....
|
||
|
||
<P>It may be that apache has not been configured to recognise the use of ".ht*" files.
|
||
You can tell Apache to undo this, by setting the <I>AccessFileName</I> tag, thus:</P>
|
||
|
||
<I>AccessFileName .htaccess</I>
|
||
|
||
<P>Well, that concludes this entire section. I did consider writing a few words about the use of perl and cgi, but I
|
||
decided that Mark Nielsen has done a better job over the last few months. Furthermore, Ben Opoknik has been
|
||
creating yet another excellent tutorial, this time on Perl, so if you are interested in cgi programming,
|
||
I would start by reading these two series of articles :-)</P>
|
||
|
||
<!-- ------------------------- -->
|
||
<!-- End Secure-directories -->
|
||
<!-- End A brief introduction: Apache -->
|
||
<!-- --------------------------- -->
|
||
|
||
<HR>
|
||
|
||
<!-- -------------------------- -->
|
||
<!-- Begin PR: upx -->
|
||
<! -- -------------------------- -->
|
||
|
||
<H2><A NAME="progupx"></A>Program Review: Upx</H2>
|
||
|
||
<P>I stumbled across this program quite by accident. I was originally doing some research at school for the
|
||
acting network administrator (hi Dave!) which involved the use of power management, as we were having
|
||
some problems with monitors "sleeping (room D25)" but I digress.....</P>
|
||
|
||
<P>UPX (Ultimate Packer for eXecutables) is a compression program. What this program actually does, is
|
||
compress binary executable files which are self contained, and which do not slow down execution or memory
|
||
performance. A typical use for this type of program is best suited to laptop users, where harddrive space is of
|
||
enormous concern. Since I use my laptop for most things and only have a 3.2GB harddrive, I have found that
|
||
compressing the files stored in <CODE>"/usr/bin"</CODE> has cut the size of that directory in half!</P>
|
||
|
||
<P>Since it will only compress binary files, it is no good trying to compress the files stored in "/etc" for
|
||
example. I have found that compressing the following directories is ok:</P>
|
||
|
||
<PRE>
|
||
/usr/bin
|
||
/usr/X11R6/bin
|
||
/usr/local/bin
|
||
</PRE>
|
||
|
||
<FONT COLOR="red">
|
||
<P>One caveat that I should mention, is that I would NEVER use "upx" to compress the files stored in
|
||
both <B>"/bin"</B> and <B>"/usr/sbin"</B> When I rebooted my computer, I found that Init would
|
||
not run. Out came "Tom's root/boot" and I later discovered that the compression of these files was causing
|
||
the main Init program problems for some reason........</P>
|
||
</FONT>
|
||
|
||
<P>So to use the program, download the package from <A HREF="http://wildsau.idv.uni-linz.ac.at/mfx/upx.html" TARGET="_blank">
|
||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html</A>. I think you have the choice of either downloading the source
|
||
packages, or a pre-compiled executable.</P>
|
||
|
||
<P>I simply downloaded the pre-compiled package, unpacked it, and copied the main upx program to "/usr/bin".
|
||
then you are ready to start compressing files.</P>
|
||
|
||
<P>To compress a file, you have to type in the following:</P>
|
||
|
||
<PRE>upx /path/to/program/progname</PRE>
|
||
|
||
<P>and that will compress the program specified. You can also compress all files in the directory, by typing:</P>
|
||
|
||
<PRE>upx /path/to/programs/*</PRE>
|
||
|
||
<P>and UPX will happily go through all files, and instantly disregard those which are not Linux/386 format.</P>
|
||
|
||
<P>Here's a <A HREF="misc/adam/shupx.png">screenshot</A>
|
||
of UPX in action.</P>
|
||
|
||
<P>To decompress files, you have to use the "-d" flag, thus:</P>
|
||
|
||
<PRE>upx -d /path/to/prog/*</PRE>
|
||
|
||
<P>A common list of command-line options, are:</P>
|
||
|
||
<PRE>
|
||
Usage: upx [-123456789dlthVL] [-qvfk] [-o file] file..
|
||
|
||
Commands:
|
||
-1 compress faster -9 compress better
|
||
--best compress best (can be very slow for big files)
|
||
-d decompress -l list compressed file
|
||
-t test compressed file -V display version number
|
||
-h give this help -L display software license
|
||
|
||
Options:
|
||
-q be quiet -v be verbose
|
||
-oFILE write output to `FILE'
|
||
-f force compression of suspicious files
|
||
--no-color, --mono, --color, --no-progress change look
|
||
|
||
Backup options:
|
||
-k, --backup keep backup files
|
||
--no-backup no backup files [default]
|
||
|
||
Overlay options:
|
||
--overlay=copy copy any extra data attached to the file [default]
|
||
--overlay=strip strip any extra data attached to the file [dangerous]
|
||
--overlay=skip don't compress a file with an overlay
|
||
</PRE>
|
||
|
||
<P>Overall, the performance of the compressed files have been ok, and I have not noticed any loss in functionality.
|
||
The only program that did take a long time to load up once it had been compressed was <B>netscape</B> but that
|
||
did not bother me too much (netscape uses so much memory, I am used to waiting for it to load).</P>
|
||
|
||
<!-- -------------------------- -->
|
||
<!-- End PR: upx -->
|
||
<! -- -------------------------- -->
|
||
|
||
<HR>
|
||
|
||
<!-- -------------------------- -->
|
||
<!-- Begin PR: bb -->
|
||
<! -- -------------------------- -->
|
||
|
||
<H2><A NAME="progbb"></A>Program Review: bb</H2>
|
||
|
||
<P>In issue 67 of the Linux Gazette, Mike Orr,
|
||
<A HREF="../issue67/orr.html">reviewed</A> <B>cowsay/cowthink</B>, a
|
||
configurable talking cow that
|
||
displays messages in speech bubbles. Everything is written in Perl (my
|
||
second-favourite scripting language, after
|
||
bash) and is displayed in ASCII. I was so impressed with the cows that I decided to look for more ASCII programs. Out came my SuSE distribution CD's and I found the program <B>bb</B>.......</P>
|
||
|
||
<P><B>bb</B> is a fully-working ASCII demo,
|
||
which uses ANSI C and is SVGA compatible. <B>bb</B> makes use of the
|
||
aa_lib package (ASCII art library) so you will have to install it along with
|
||
the main package. The demo produces a range of different simulated pictures,
|
||
from random tumbling characters (going through different shades of grey), to an
|
||
ASCII simulated mandlebrot fractual!! (which incidentially inspired the colour
|
||
version of <B>Xaos</B>). </P>
|
||
|
||
<P>You can get <B>bb</B> from
|
||
<A HREF="ftp://ftp.bonn.linux.de/pub/misc/bb-1.2.tar.gz">
|
||
ftp://ftp.bonn.linux.de/pub/misc/bb-1.2.tar.gz</A>.</P>
|
||
|
||
<P> <B>bb</B> used to have
|
||
a home page, but unfortunately it's gone. However, project <B>aa</B>
|
||
(the ASCII Art library) is what <B>bb</B> is based on, and it has a home
|
||
page at
|
||
<A HREF="http://aa-project.sourceforge.net/">http://aa-project.sourceforge.net/</A>.
|
||
The <B>aa</B> page also discusses <B>aview</B> (an ASCII art viewer),
|
||
<B>aatv</B> (to view TV programs on your text console), <B>ttyquake</B>
|
||
(a text version of Quake), <B>Dumb</B> (a Doom clone), <B>apron</B> (an
|
||
mpeg1 player), and other programs. <B>ttyquake</B> does require the
|
||
graphical Quake to be installed, so it uses the original Quake game
|
||
files. One commentator writes of <b>ttyquake</B>, "people are starving to
|
||
death in this world... and somebody had time for this....."
|
||
|
||
<P><B>bb</B> is best run from the console, but it can be run from within an
|
||
X-terminal window, as shown by <A HREF="misc/adam/bbscreenshot.png">this
|
||
screenshot</A>.</P>
|
||
|
||
<P>The valid command-line options for <B>bb</B> are:</P>
|
||
|
||
<PRE>
|
||
Usage: bb [aaoptions] [number]
|
||
|
||
Options:
|
||
-loop play demo in infinite loop
|
||
|
||
AAlib options:
|
||
-driver select driver
|
||
available drivers:linux curses X11 stdout stderr
|
||
-kbddriver select keyboard driver
|
||
available drivers:curses X11 stdin
|
||
-mousedriver select mouse driver
|
||
available drivers:X11 gpm cursesdos
|
||
|
||
Size options:
|
||
-width set width
|
||
-height set height
|
||
-minwidth set minimal width
|
||
-minheight set minimal height
|
||
-maxwidth set maximal width
|
||
-maxheight set maximal height
|
||
-recwidth set recomended width
|
||
-recheight set recomended height
|
||
|
||
Attributes:
|
||
-dim enable usage of dim (half bright) attribute
|
||
-bold enable usage of bold (double bright) attribute
|
||
-reverse enable usage of reverse attribute
|
||
-normal enable usage of normal attribute
|
||
-boldfont enable usage of boldfont attrubute
|
||
-no<attr> disable (i.e -nobold)
|
||
|
||
Font rendering options:
|
||
-extended use all 256 characters
|
||
-eight use eight bit ascii
|
||
-font <font> select font(This option have effect just on hardwares
|
||
where aalib is unable to determine current font
|
||
available fonts:vga8 vga9 mda14 vga14 X8x13 X8x16
|
||
X8x13bold vgagl8 line
|
||
|
||
Rendering options:
|
||
-inverse enable inverse rendering
|
||
-noinverse disable inverse rendering
|
||
-bright <val> set bright (0-255)
|
||
-contrast <val> set contrast (0-255)
|
||
-gamma %lt;val> set gamma correction value(0-1)
|
||
|
||
Ditherng options:
|
||
-nodither disable dithering
|
||
-floyd_steinberg floyd steinberg dithering
|
||
-error_distribution error distribution dithering
|
||
-random <val> set random dithering value(0-inf)
|
||
Monitor parameters:
|
||
-dimmul <val> multiply factor for dim color (5.3)
|
||
-boldmul <val> multiply factor for dim color (2.7)
|
||
The default parameters are set to fit my monitor (15" goldstar)
|
||
With contrast set to maximum and bright set to make black black
|
||
This values depends at quality of your monitor (and setting of controls
|
||
Defaultd settings should be OK for most PC monitors. But ideal monitor
|
||
Needs dimmul=1.71 boldmul=1.43. For example monitor used by SGI is very
|
||
close to this values. Also old 14" vga monitors needs higher values.
|
||
</PRE>
|
||
|
||
<P>I really do think that if you're into ASCII art, you should give this demo a
|
||
go. It lasts for approximately 5 minutes.</P>
|
||
|
||
<!-- -------------------------- -->
|
||
<!-- End PR: bb -->
|
||
<! -- -------------------------- -->
|
||
|
||
<HR>
|
||
|
||
<!-- -------------------------- -->
|
||
<!-- Begin Closing Time -->
|
||
<! -- -------------------------- -->
|
||
|
||
<H2><A NAME="closing">Closing Time</A></H2>
|
||
|
||
<P>Well, you've made it to the end of this months article. Looking ahead to next month, I am going to be writing an
|
||
article about how to write efficient manual pages (anyone remember groff processing??) and whatever else I can think of.
|
||
However it would be nice to hear from anyone who has article suggestions, as I am running out of ideas.....slowly. If there
|
||
is anything you feel would be good to include in the LWM, drop me a note :-)</P>
|
||
|
||
<P>Also, in case anyone is interested, all the screenshots that have appeared in this document, have been using made using
|
||
the "GNU Image Manipulation Program" and are of the <B>FVWM2</B> window manager, running the M4 preprocessor <B>AnotherLevel</B>.
|
||
|
||
<P>As a final notice, I would like to say that as I am no longer at school anymore, my "n6tadam@users.purbeck.
|
||
dorset.sch.uk" account is invalid, and I now have a new account (see below).</P>
|
||
|
||
<P>So until next time....<B>happy linuxing!</B></P>
|
||
|
||
<!-- -------------------------- -->
|
||
<!-- End Closing Time -->
|
||
<! -- -------------------------- -->
|
||
|
||
<HR>
|
||
|
||
<!-- ** Begin table comments, etc. Oh wakey wakey you idiot Thomas ** -->
|
||
<TABLE BORDER=0 ALIGN="center" WIDTH=60%>
|
||
<TH></TH>
|
||
<TH></TH>
|
||
<TH></TH>
|
||
<TR>
|
||
<TD WIDTH=10%><IMG ALT="" SRC="../gx/adam/mail.png" ALIGN="left" WIDTH="64" HEIGHT="64"></TD>
|
||
<TD WIDTH=80% ALIGN="center"><FONT COLOR="red" SIZE="5">Send Your Comments</FONT></TD>
|
||
<TD WIDTH=10%><IMG ALT="" SRC="../gx/adam/mail.png" ALIGN="left" WIDTH="64" HEIGHT="64"></TD>
|
||
</TR>
|
||
</TABLE>
|
||
|
||
<P ALIGN="center"><FONT SIZE="3">Any comments, suggestions, ideas, etc can be
|
||
mailed to me by clicking the e-mail address link below:</FONT></P>
|
||
|
||
<P ALIGN="center"><FONT SIZE="3"><A
|
||
HREF="mailto:thomas_adam16@yahoo.com"><thomas_adam16@yahoo.com></A></FONT></P>
|
||
|
||
<CENTER>
|
||
|
||
</CENTER>
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P>
|
||
<HR>
|
||
<!-- P -->
|
||
|
||
<H5 align=center>Copyright <20> 2001, Thomas Adam.<BR>Copying license <A
|
||
href="http://www.linuxgazette.com/copying.html">copying.html</A>
|
||
|
||
<BR>
|
||
Published in Issue 70 of <I>Linux Gazette</I>, September 2001
|
||
|
||
</H5>
|
||
<!-- *** END copyright *** -->
|
||
</BODY>
|
||
</HTML>
|
||
|
||
|
||
|
||
|
||
<!-- *** BEGIN bio *** -->
|
||
<SPACER TYPE="vertical" SIZE="30">
|
||
<P>
|
||
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Thomas Adam</H4>
|
||
<EM>My name is Thomas Adam. I am 18, and am currently studying for A-Levels
|
||
(=university entrance exam). I live
|
||
on a small farm, in the county of Dorset in England. I am a massive Linux
|
||
enthusiast, and help with linux proxy issues while I am at school. I have been
|
||
using Linux now for about six years. When not using Linux, I play the piano,
|
||
and enjoy walking and cycling.</EM>
|
||
|
||
|
||
<!-- *** END bio *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <!-- P -->
|
||
<H5 ALIGN=center>
|
||
|
||
Copyright © 2001, Thomas Adam.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
||
</H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<center>
|
||
<H1><font color="maroon">How to use an Atari ST machine as a Linux terminal</font></H1>
|
||
<H4>By <a href="mailto:matthiasarndt@gmx.net">Matthias Arndt</a></H4>
|
||
</center>
|
||
<P> <HR> <P>
|
||
|
||
<!-- END header -->
|
||
|
||
|
||
|
||
|
||
<H3>Abstract</H3>
|
||
<P>
|
||
This article should help you with connecting your old trusty ST to your Linux box as a terminal.
|
||
</P>
|
||
|
||
<H3>Introduction</H3>
|
||
<P>
|
||
Before I start, many things mentioned in this article apply to other boxes than an Atari ST as well. For sure, you could use an Amiga or a Sinclair QL as a terminal as well. (Linus had a Sinclair QL, by the way, before he got his PC.)
|
||
</P>
|
||
|
||
<P>
|
||
Actually I started computing on the Atari ST about more than 10 years ago when my brother bought an Acorn Archimedes and I got his old 520STM. So this is why I love ST emulators and the good old games today. Now I still have a functioning ST (actually a newer 1040STFM I bought secondhand) and I thought about using it for more than as a video game system.
|
||
</P>
|
||
|
||
<P>
|
||
This lead me to use it as a terminal on my Linux box. I must admit, I do not have any reason to connect a second terminal to my Linux box as I'm using it alone. Simply, it's experimenting and ST nostalgia :).
|
||
</P>
|
||
|
||
<P>
|
||
|
||
Now this solution can be used to transfer files and programs to the ST and finally to give the ST limited Internet access. If the terminal emulator is good enough, you can use lynx and w3m to surf the web, read mail with mutt and read news with tin or slrn.
|
||
You can even play 2-player games for the console like Nettris with this solution.
|
||
|
||
</P>
|
||
|
||
<P>
|
||
But now lets face it.
|
||
</P>
|
||
|
||
<H3>What is a terminal?</H3>
|
||
|
||
<P>
|
||
A terminal is simply a display with keyboard, only capable of displaying incoming text, perhaps with special attributes coded into so-called escape sequences and capable of sending the keystrokes to the remote end.
|
||
</P>
|
||
|
||
<P>
|
||
In general a hardware terminal is dumb. It cannot do anything more than that.
|
||
</P>
|
||
|
||
<P>
|
||
In ancient times of computing, terminals were used to connect multiple users to a mainframe.
|
||
</P>
|
||
|
||
<P>
|
||
If you have such an old-style terminal or you can get one, you can connect it in the same way as described here.
|
||
</P>
|
||
|
||
<P>
|
||
The functions of a terminal--receiving, transmitting and displaying--can easily be achieved using software. And this is the way we go here. We use special terminal software to make the ST acting as an old-time terminal.
|
||
</P>
|
||
|
||
<H3>Hardware needed</H3>
|
||
|
||
<P>
|
||
You need the following hardware for this project:
|
||
</P>
|
||
<OL>
|
||
<LI>an Atari ST computer with preferably 1MB of memory or more
|
||
<LI>either a monochrome monitor for the ST (SM124 rocks!) or a colour display with good display quality and hopefully capable of 60Hz
|
||
<LI>a null modem cable that connects to the serial socket of the ST and the PC
|
||
<LI>finally a Linux or similar Unix box with enough hardware to support more than one user (anything with a 486er or more should work perfectly)
|
||
</OL>
|
||
|
||
<P>
|
||
As stated above in general you can substitute the Atari ST machine with any other computer that has a RS232 socket and a 80column display.
|
||
</P>
|
||
|
||
<P>
|
||
You can use real terminals in the same fashion, although you cannot download or upload software then.
|
||
</P>
|
||
|
||
<H3>Software requirements</H3>
|
||
|
||
<OL>
|
||
<LI>a Linux kernel with serial support
|
||
<LI>a getty capable of using serial lines (agetty or mgetty both work well)
|
||
<LI>lrzsz for ZModem transfer (optional)
|
||
<LI>kermit for Kermit file transfers (optional)
|
||
<LI>software for the ST
|
||
<UL>
|
||
<LI>a terminal program preferably more than the VT52 emulator
|
||
<LI>file transfer software like XYZ.TTP (optional)
|
||
<LI>Serial Fix software because the RS232 handling routines in the TOS (the STs OS) are buggy
|
||
</UL>
|
||
</LI>
|
||
<LI>many useful console applications to be used from the terminal (supplied with your Linux distribution)</LI>
|
||
</OL>
|
||
<SMALL>If you use another machine than an Atari ST, you need a terminal program capable of either VT100 or ANSI emulation and file transfer.</SMALL>
|
||
|
||
<P>
|
||
The kernel shouldn't be a problem. If you can use your external serial modem to connect to the net, everything should work out of the box.
|
||
</P>
|
||
|
||
<P>
|
||
In most cases, the kernel will have serial support compiled in or supplied as a kernel module. If not, you must compile a new kernel. I will not handle this in detail here, there are several HOWTOs on this subject available.
|
||
</P>
|
||
|
||
<H3>putting the login prompt on the serial line</H3>
|
||
|
||
<P>
|
||
This step is required to give the ST a login prompt over the serial line.
|
||
</P>
|
||
|
||
<P>
|
||
First you need a suitable getty. Such a program is used to display a prompt and the input prompt for the username on the line. In invokes the program /bin/login then to login the user to the system.
|
||
</P>
|
||
|
||
<P>
|
||
The getty processes are all spawned by the init process. Init knows form the file <EM>/etc/inittab</EM> which getty processes to spawn.
|
||
</P>
|
||
|
||
<P>
|
||
Most distributions ship either agetty or mgetty, or both. I use agetty and so this focuses on using agetty.
|
||
</P>
|
||
|
||
<P>
|
||
Now <B>become root</B> and open <EM>/etc/inittab</EM> with your favourite editor.
|
||
</P>
|
||
|
||
<P>
|
||
The next step is to add a line to the file to spawn a new getty process.
|
||
This looks like this:<BR>
|
||
<PRE>S0:12345:respawn:/sbin/agetty -w -h -L 19200 ttyS0 ansi</PRE>
|
||
</P>
|
||
|
||
<P>
|
||
Looks ugly, huh? No fear, I'll tell you the meaning of its components.
|
||
</P>
|
||
|
||
<P>
|
||
I assume the parts of the line with <EM>1</EM> being the left most (S0).
|
||
Now in numbered order:
|
||
</P>
|
||
|
||
<OL>
|
||
<LI>S0 - this one is a unique indicator of the line, it is just a mark but it must be unique in the whole <EM>/etc/inittab</EM> file
|
||
<LI>12345 - these are the run levels at which the getty should be called
|
||
<LI>respawn - this tells init to restart the getty process after completion
|
||
<LI>/sbin/agetty ... - this line is the actually command line used to launch the getty process described in the following part
|
||
</OL>
|
||
|
||
<P>
|
||
Now save the file and leave your editor. Type <EM>init q</EM> in your shell to tell init to reread its inittab file.
|
||
</P>
|
||
|
||
<H3>agetty and its command-line arguments</H3>
|
||
|
||
<P>
|
||
First, give the full path to agetty. If you don't know where it is located, try a <EM>locate bin/agetty</EM> in a shell.</P>
|
||
|
||
<P>
|
||
Then you may have one or more of the following command-line arguments.
|
||
(See the previous section for an example.)
|
||
</P>
|
||
|
||
<P>
|
||
<EM>-w</EM> tells agetty to wait for a CR (ASCII 13) on the line before displaying the prompt
|
||
</P>
|
||
<P>
|
||
<EM>-h</EM> tells agetty to use hardware flow control on the line (aka RTS/CTS)
|
||
</P>
|
||
|
||
<P>
|
||
<EM>-L</EM> tells agetty that this is a local line. It will not monitor the carrier then.
|
||
</P>
|
||
|
||
<P>
|
||
<EM>##</EM> This is the baud rate to be used. 19200, 9600 and 2400 are good values. The ST cannot handle more than 19200.
|
||
</P>
|
||
|
||
<P>
|
||
<EM>ttyS?</EM> This is the serial device to be used. Use: ttyS0 for COM1, ttyS1 for COM2 and so forth. Make sure not to use your modem port. If you only have one serial port, you'll have to switch between modem and terminal. in such a case it is better to use mgetty as this can handle both incoming and outgoing calls at once on one line (intended for modem usage however).
|
||
</P>
|
||
|
||
<P>
|
||
<EM>ansi</EM> is the terminal type to used. You could try <EM>vt100</EM> or <EM>atari</EM> as well depending on the capability of your terminal software.
|
||
</P>
|
||
|
||
<P>
|
||
When in doubt, running <EM>man agetty</EM> in your shell will help you.
|
||
</P>
|
||
|
||
<H3>ST setup</H3>
|
||
|
||
<P>
|
||
First of all connect the both machines with the null modem cable. The ST has a socket with a phone symbol next to it. This is the serial port.
|
||
</P>
|
||
|
||
<P>
|
||
You may need an adapter cable that converts DB25 to DB9 or vice versa because the ST has a broad port while most PCs have a small one. Null modems may be found in your local computer store. Buy one that fits to your PCs serial port and an adaptor that connects the null modem to the ST.
|
||
</P>
|
||
|
||
<P>
|
||
Now load the terminal program on the ST. Make sure to set it to the same baud rate as given to agetty and to 8N1. Press <EM>Return</EM> several times. You should get the login prompt of your Linux box on the ST screen and you should be able to login and to use line oriented shells and programs.
|
||
</P>
|
||
|
||
<P>
|
||
You can try curses-based programs to check the capabilities of your terminal software. With good terminal software, you should be able to use lynx, w3m, mutt and vi. Some terminal emulators are even able to display the Midnight Commander correct and with colours.
|
||
</P>
|
||
|
||
<H3>recommended ST software</H3>
|
||
<P>
|
||
The VT52 emulator supplied with your ST can be used for simple tasks and for testing. It lacks a decent ANSI terminal and file transfer options.
|
||
</P>
|
||
|
||
<P>
|
||
If you're ST is equipped with more than 1MB of RAM, you should give Rufus or Connect a try.
|
||
</P>
|
||
|
||
<P>
|
||
ST Term works well with half-Meg STs. The VT52 Emulator together with an ANSI enhancer is a good choice as well due to memory problems.
|
||
</P>
|
||
|
||
<P>
|
||
<EM>ANSITERM</EM> features full ANSI support including colours and 80 column display in low resolution. However you'd better use a good monitor or your eyes will be ruined.
|
||
</P>
|
||
|
||
<P>
|
||
<EM>TAZ</EM> runs in medium and monochrome resolution. It features even 16 colours with page flipping and palette switching technology in medium resolution. However this mode requires a monitor capable of 60Hz.<BR>
|
||
The interface looks much like minicom or telix and is pleasing.<BR>
|
||
I recommend this program because the terminal emulation is very good and it has nifty features. It may even run with halfmeg STs, haven't tried it.
|
||
</P>
|
||
|
||
<P>
|
||
Make sure to use 80 columns because most programs do not work well with less.
|
||
</P>
|
||
|
||
<P>
|
||
If you have one, the monochrome monitor is definitely better. However you'll miss colours. With <EM>TAZ</EM> you shouldn't have many problems.
|
||
</P>
|
||
|
||
<P>
|
||
The following FTP server has several ST programs available for download.
|
||
<A HREF="ftp://wuarchive.wustl.edu/systems/atari/umich.edu/" TARGET="_blank">ftp://wuarchive.wustl.edu/systems/atari/umich.edu/</A>
|
||
</P>
|
||
|
||
<H3>transferring files</H3>
|
||
<P>
|
||
This feature is one of the main reasons to connect the ST via null modem. Either to save your old ST files or to use software downloaded from the net.
|
||
</P>
|
||
|
||
<P>
|
||
You should use the ZModem protocol because it's:
|
||
</P>
|
||
<UL>
|
||
<LI>standard
|
||
<LI>error proof
|
||
<LI>easily available on your Linux box
|
||
</UL>
|
||
|
||
<P>
|
||
Make sure you have a ZModem receiver and sender on the ST end.
|
||
</P>
|
||
|
||
<P>
|
||
To transfer a file from the Linux box to the ST, simply type:
|
||
<PRE>sz filename</PRE> at your shell prompt.
|
||
Now invoke the receiving process on the ST end. Some terminals are able to
|
||
autostart a Zmodem download.
|
||
</P>
|
||
|
||
<P>
|
||
The other way round is as easy. Type: <PRE>rz</PRE> at your shell prompt. Then activate the ZModem upload function of your terminal software.
|
||
</P>
|
||
|
||
<P>
|
||
If it hangs, press <B>Ctrl-C</B> several times. If all fails, kill the rz/sz process on the Linux box.
|
||
</P>
|
||
|
||
<H3>Conclusion</H3>
|
||
|
||
<P>
|
||
If you have the right hardware handy, this is a straightforward thing and pretty easy to setup. I found that the trickiest part was to find suitable terminal software for the ST end.
|
||
</P>
|
||
|
||
<H3>other systems as terminals</H3>
|
||
<P>
|
||
You are not limited to connect an Atari ST as a terminal. Of course, you can use a Commodore Amiga or a Sinclair QL as well. The system used should be able to match into the following pattern:
|
||
</P>
|
||
<UL>
|
||
<LI>80 column display
|
||
<LI>standard RS232 port
|
||
<LI>terminal software available
|
||
</UL>
|
||
|
||
<P>
|
||
You can do the same things with them as with the ST.
|
||
</P>
|
||
|
||
<P>
|
||
I hope this all helped you to have some more fun with your old machine and to learn a little bit more about pre-cheap-Ethernet remote working.
|
||
</P>
|
||
|
||
|
||
|
||
|
||
<!-- *** BEGIN bio *** -->
|
||
<SPACER TYPE="vertical" SIZE="30">
|
||
<P>
|
||
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Matthias Arndt</H4>
|
||
<EM>I'm a Linux enthusiast from northern Germany.
|
||
I like plain old fifties rock'n'roll music, writing
|
||
stories and publishing in the Linux Gazette, of course.
|
||
Currently I'm studying computer science in conduction with
|
||
economics.</EM>
|
||
|
||
<!-- *** END bio *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <!-- P -->
|
||
<H5 ALIGN=center>
|
||
|
||
Copyright © 2001, Matthias Arndt.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
||
</H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<center>
|
||
<H1><font color="maroon">Downloading without a Browser</font></H1>
|
||
<H4>By <a href="mailto:ajchung@email.com">Adrian J Chung</a></H4>
|
||
</center>
|
||
<P> <HR> <P>
|
||
|
||
<!-- END header -->
|
||
|
||
|
||
|
||
|
||
<p> Ever had to download a file so huge over a link so slow that you'd need to
|
||
keep the web browser open for hours or days? What if you had 40 files linked
|
||
from a single web page, all of which you needed -- will you tediously click on
|
||
each one? What if the browser crashes before it can finish? GNU/Linux comes
|
||
equipped with a handy set of tools for downloading in the background,
|
||
independent of the browser. This allows you to log out, resume interrupted
|
||
downloads, and even schedule them to occur during off-peak Net usage hours.
|
||
|
||
<H3>When interactivity stands in the way</H3>
|
||
|
||
<p>
|
||
Web browsers are designed to make the Web interactive -- click and
|
||
expect results within seconds. But there are still many files that
|
||
can take longer than a few seconds to download, even over the quickest
|
||
of connections. An example are the ISO images that are popular among
|
||
those burning their own GNU/Linux CD-ROM distro. Some web browsers,
|
||
especially poorly coded ones, do not behave very well over long
|
||
durations, leaking memory or crashing at the most inopportune moment.
|
||
Despite the fusion of some browsers with file managers many still do
|
||
not support the multi-selection and rubber banding operations that make
|
||
it easy to transfer several files all in one go. You also have to
|
||
stay logged in until the entire file has arrived. Finally, you have
|
||
to be present at the office to click the link initiating the download,
|
||
thus angering coworkers with whom office bandwidth is being shared.
|
||
|
||
<p>
|
||
Downloading of large files is a task more suitable for a different
|
||
suite of tools. This article will discuss how to combine various
|
||
GNU/Linux utilities, namely <tt>lynx</tt>, <tt>wget</tt>, <tt>at</tt>,
|
||
<tt>crontab</tt>, etc. to solve a variety of file transfer situations.
|
||
A small amount of simple scripting will also be employed, so a little
|
||
knowledge of the <tt>bash</tt> shell will help.
|
||
|
||
<H3>The <tt>wget</tt> utility</H3>
|
||
|
||
<p>
|
||
All the major distributions include the <tt>wget</tt> downloading
|
||
tool.
|
||
|
||
<p><pre>
|
||
bash$ <b>wget http://place.your.url/here</b>
|
||
</pre>
|
||
|
||
<p>This can also handle FTP, date stamps, and recursively mirror
|
||
entire web-site directory trees -- and if you're not
|
||
careful, entire website and whatever other sites they link to:
|
||
|
||
<p><pre>
|
||
bash$ <b>wget -m http://target.web.site/subdirectory</b>
|
||
</pre>
|
||
|
||
<p>
|
||
Due to the potential high loads this tool can place on servers, this
|
||
tool obeys the "robots.txt" protocol when mirroring. There are
|
||
several command options to control what exactly gets mirrored,
|
||
limiting the types of links followed and the file types downloaded.
|
||
Example: to follow only relative links and skip GIF images:
|
||
|
||
<p><pre>
|
||
bash$ <b>wget -m -L --reject=gif http://target.web.site/subdirectory</b>
|
||
</pre>
|
||
|
||
<p>
|
||
<tt>wget</tt> can also resume interrupted downloads ("<tt>-c</tt>"
|
||
option) when given the incomplete file to which to append the
|
||
remaining data. This operation needs to be supported by the server.
|
||
|
||
<p><pre>
|
||
bash$ <b>wget -c http://the.url.of/incomplete/file</b>
|
||
</pre>
|
||
|
||
<p>
|
||
The resumption and mirroring can be combined, allowing one to mirror a
|
||
large collection of files over the period of many separate download
|
||
sessions. More on how to automate this later.
|
||
|
||
<p>
|
||
If you're experiencing download interruptions as often as I do in my
|
||
office, you can tell <tt>wget</tt> to retry the URL several times:
|
||
|
||
<p><pre>
|
||
bash$ <b>wget -t 5 http://place.your.url/here</b>
|
||
</pre>
|
||
|
||
<p>
|
||
Here we give up after 5 attempts. Use "<tt>-t inf</tt>" to never give
|
||
up.
|
||
|
||
<p>
|
||
What about proxy firewalls? Use the <tt>http_proxy</tt> environment
|
||
variable or the <tt>.wgetrc</tt> configuration file to specify a proxy
|
||
via which to download. One problem with proxied connections over
|
||
intermittent connections is that resumptions can sometimes fail. If a
|
||
proxied download is interrupted, the proxy server will cache only an
|
||
incomplete copy of the file. When you try to use "<tt>wget -c</tt>"
|
||
to get the remainder of the file the proxy checks its cache and
|
||
erroneously reports that you have the entire file already. You can
|
||
coax most proxies to bypass their cache by adding a special header to
|
||
your download request:
|
||
|
||
<p><pre>
|
||
bash$ <b>wget -c --header="Pragma: no-cache" http://place.your.url/here</b>
|
||
</pre>
|
||
|
||
<p>
|
||
The "<tt>--header</tt>" option can add any number and manner of
|
||
headers, by which one can modify the behaviour of web servers and
|
||
proxies. Some sites refuse to serve files via externally sourced
|
||
links; content is delivered to browsers only if they access it via
|
||
some other page on the same site. You can get around this by
|
||
appending a "Referer:" header:
|
||
|
||
<p><pre>
|
||
bash$ <b>wget --header="Referer: http://coming.from.this/page" http://surfing.to.this/page</b>
|
||
</pre>
|
||
|
||
<p>
|
||
Some particularly anti-social web sites will only serve content to a
|
||
specific brand of browser. Get around this with a "User-Agent:"
|
||
header:
|
||
|
||
<p><pre>
|
||
bash$ <b>wget --header="User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)" http://msie.only.url/here</b>
|
||
</pre>
|
||
|
||
<p>
|
||
(Warning: the above tip may be considered circumventing a content
|
||
licensing mechanism and there exist anti-social legal systems that
|
||
have deemed these actions to be illegal. Check your local
|
||
legislature. Your mileage may vary.)
|
||
|
||
|
||
<H3>Downloading <tt>at</tt> what hour?</H3>
|
||
|
||
<p>
|
||
If you are downloading large files on your office computer over a
|
||
connection shared with easily angered coworkers who don't like their
|
||
streaming media slowed to a crawl, you should consider starting your
|
||
file transfers in the off-peak hours. You do not have to stay in the
|
||
office after everyone has left, nor remember to do a remote login from
|
||
home after dinner. Make use of the <tt>at</tt> job scheduler:
|
||
|
||
<p>
|
||
<blockquote><tt>
|
||
bash$ <b>at 2300</b><br>
|
||
warning: commands will be executed using /bin/sh<br>
|
||
at> <b>wget http://place.your.url/here</b><br>
|
||
at></tt> <em>press Ctrl-D</em>
|
||
</blockquote>
|
||
|
||
<p>
|
||
Here, we want to begin downloading at 11.00pm. Make sure that the
|
||
<tt>atd</tt> scheduling daemon is running in the background for this
|
||
to work.
|
||
|
||
<H3>It'll take how many days?</H3>
|
||
|
||
<p>
|
||
When there is a lot of data to download in one or several files, and
|
||
your bandwidth is comparable to the carrier pigeon protocol, you will
|
||
often find that the download you scheduled to occur has not yet
|
||
completed when you arrive at work in the morning. Being a good
|
||
neighbour, you kill the job and submit another <tt>at</tt> job, this
|
||
time using "<tt>wget -c</tt>", repeating as necessary over as many
|
||
days as it'll take. It is better to automate this using a
|
||
<tt>crontab</tt>. Create a plain text file, called
|
||
"<tt>crontab.txt</tt>", containing something like the following:
|
||
|
||
<p><pre>
|
||
0 23 * * 1-5 wget -c -N http://place.your.url/here
|
||
0 6 * * 1-5 killall wget
|
||
</pre>
|
||
|
||
<p>
|
||
This will be your <tt>crontab</tt> file which specifies what jobs to
|
||
execute at periodic intervals. The first five columns say <EM>when</EM>
|
||
to execute the command, and the remainder of each line says <EM>what</EM> to
|
||
execute. The first two columns indicate the time of day -- 0
|
||
minutes past 11pm to start <tt>wget</tt>, 0 minutes past 6am to
|
||
<tt>killall wget</tt>. The <tt>*</tt> in the 3rd and 4th columns
|
||
indicates that these actions are to occur every day of every month. The
|
||
5th column indicates on which days of the week to schedule each
|
||
operation -- "1-5" is Monday to Friday.
|
||
|
||
<p>So every weekday at 11pm your download will begin, and at 6am every
|
||
weekday any <tt>wget</tt> still in progress will be terminated. To
|
||
activate this <tt>crontab</tt> schedule you need to issue the command:
|
||
|
||
<p><pre>
|
||
bash$ <b>crontab crontab.txt</b>
|
||
</pre>
|
||
|
||
<p>
|
||
The "<tt>-N</tt>" option for <tt>wget</tt> will check the timestamp of
|
||
the target file and halt downloading if they match, which is an
|
||
indication that the entire file has been transferred. So you can just
|
||
set it and forget it. "<tt>crontab -r</tt>" will remove this schedule.
|
||
I've downloaded many an ISO image over shared dial-up connections
|
||
using this approach.
|
||
|
||
<H3>Dynamically Generated Web Pages</H3>
|
||
|
||
<p>
|
||
Some web pages are generated on demand since they are subject to
|
||
frequent changes sometimes several times a day. Since the target is
|
||
technically not a file, there is no file length and resuming a
|
||
download becomes meaningless -- the "<tt>-c</tt>" option fails to work.
|
||
Example: a PHP-generated page at Linux Weekend News:
|
||
|
||
<p><pre>
|
||
bash$ <b>wget http://lwn.net/bigpage.php3</b>
|
||
</pre>
|
||
|
||
If you interrupt the download and try to resume, it starts over from
|
||
scratch. My office Net connection is at times so poor that I've
|
||
written a simple script detecting when a dynamic HTML page has been
|
||
delivered completely:
|
||
|
||
<p><pre>
|
||
#!/bin/bash
|
||
|
||
#create it if absent
|
||
touch bigpage.php3
|
||
|
||
#check if we got the whole thing
|
||
while ! grep -qi '</html>' bigpage.php3
|
||
do
|
||
rm -f bigpage.php3
|
||
|
||
#download LWN in one big page
|
||
wget http://lwn.net/bigpage.php3
|
||
|
||
done
|
||
</pre>
|
||
|
||
<p>
|
||
The above <tt>bash</tt> script keeps downloading the document unless
|
||
the string "<tt></html></tt>" can be found, which marks the
|
||
end of the file.
|
||
|
||
<H3>SSL and Cookies</H3>
|
||
|
||
<p>
|
||
URLs beginning with "<tt>https://</tt>" must access remote files
|
||
through the Secure Sockets Layer. You will find another download
|
||
utility, called <a href="http://curl.haxx.se"><tt>curl</tt></a>, to be
|
||
handy in these situations.
|
||
|
||
<p>
|
||
Some web sites force-feed cookies to the browser before serving the
|
||
requested content. One must add a "<tt>Cookie:</tt>" header with the
|
||
correct information which can be obtained from your web browser's cookie
|
||
file. For <tt>lynx</tt> and <tt>Mozilla</tt> cookie file formats:
|
||
|
||
<p><pre>
|
||
bash$ <b>cookie=$( grep nytimes ~/.lynx_cookies |awk '{printf("%s=%s;",$6,$7)}' )</b>
|
||
</pre>
|
||
|
||
<p>
|
||
will construct the required cookie for downloading stuff from <a
|
||
href="http://www.nytimes.com/">http://www.nytimes.com</a>, assuming
|
||
that you have already registered with the site using this browser.
|
||
<tt>w3m</tt> uses a slightly different cookie file format:
|
||
|
||
<p><pre>
|
||
bash$ <b>cookie=$( grep nytimes ~/.w3m/cookie |awk '{printf("%s=%s;",$2,$3)}' )</b>
|
||
</pre>
|
||
|
||
<p>
|
||
Downloading can now be carried out thus:
|
||
|
||
<p><pre>
|
||
bash$ <b>wget --header="Cookie: $cookie" http://www.nytimes.com/reuters/technology/tech-tech-supercomput.html</b>
|
||
</pre>
|
||
|
||
<p>
|
||
or using the <tt>curl</tt> tool:
|
||
|
||
<p><pre>
|
||
bash$ <b>curl -v -b $cookie -o supercomp.html http://www.nytimes.com/reuters/technology/tech-tech-supercomput.html</b>
|
||
</pre>
|
||
|
||
<H3>Making Lists of URLs</H3>
|
||
|
||
<p>
|
||
So far, we've only been downloading single files or mirroring entire
|
||
website directories. Sometimes one is interested in downloading a
|
||
large number of files whose URLs are given on a web page but are not
|
||
interested in performing a full scale mirror of the entire site. An
|
||
example would be downloading of the top 20 music files on a site that
|
||
displays the top 100 in order. Here the "<tt>--accept</tt>" and
|
||
"<tt>--reject</tt>" options wouldn't work since they only operate on
|
||
file extensions. Instead, make use of "<tt>lynx -dump</tt>".
|
||
|
||
<p><pre>
|
||
bash$ <b>lynx -dump ftp://ftp.ssc.com/pub/lg/ |grep 'gz$' |tail -10 |awk '{print $2}' > urllist.txt</b>
|
||
</pre>
|
||
|
||
<p>
|
||
The output from lynx can then be filtered using the various GNU text
|
||
processing utilities. In the above example, we extract URLs ending in
|
||
"<tt>gz</tt>" and store the last 10 of these in a file. A tiny
|
||
<tt>bash</tt> scripting command will automatically download any URLs
|
||
listed in this file:
|
||
|
||
<p>
|
||
<blockquote><tt>
|
||
bash$<b> for x in $(cat urllist.txt)</b><br>
|
||
><b> do</b><br>
|
||
><b> wget $x</b><br>
|
||
><b> done</b><br>
|
||
</tt></blockquote>
|
||
|
||
<p>
|
||
We've succeeded in downloading the last 10 issues of <a
|
||
href="http://www.linuxgazette.com/"><I>Linux Gazette</I></a>.
|
||
|
||
<H3>Swimming in bandwidth</H3>
|
||
|
||
<p>
|
||
If you're one of the select few to be drowning in bandwidth, and your
|
||
file downloads are slowed only by bottlenecks at the web server end,
|
||
this trick can help "shotgun" the file transfer process. It requires
|
||
the use of <tt>curl</tt> and several mirror web sites where identical
|
||
copies of the target file are located. For example, suppose you want
|
||
to download the Mandrake 8.0 ISO from the following three locations:
|
||
|
||
<p>
|
||
<pre><tt><b>
|
||
url1=http://ftp.eecs.umich.edu/pub/linux/mandrake/iso/Mandrake80-inst.iso
|
||
url2=http://ftp.rpmfind.net/linux/Mandrake/iso/Mandrake80-inst.iso
|
||
url3=http://ftp.wayne.edu/linux/mandrake/iso/Mandrake80-inst.iso
|
||
</b></tt></pre>
|
||
|
||
<p>
|
||
The length of the file is 677281792, so initiate three simultaneous
|
||
downloads using <tt>curl</tt>'s "<tt>--range</tt>" option:
|
||
|
||
<p><pre><tt>
|
||
bash$ <b>curl -r 0-199999999 -o mdk-iso.part1 $url1 &</b>
|
||
bash$ <b>curl -r 200000000-399999999 -o mdk-iso.part2 $url2 &</b>
|
||
bash$ <b>curl -r 400000000- -o mdk-iso.part3 $url3 &</b>
|
||
</tt></pre>
|
||
|
||
<p>
|
||
This creates three background download processes, each transferring a
|
||
different part of the ISO image from a different server. The
|
||
"<tt>-r</tt>" options specifies a subrange of bytes to extract from
|
||
the target file. When completed, simply <tt>cat</tt> all three parts
|
||
together -- <b><tt>cat mdk-iso.part? >
|
||
mdk-80.iso</tt></b>. (Checking the md5 hash before burning to CD-R is
|
||
well recommended.) Launching each <tt>curl</tt> in its own window
|
||
while using the "<tt>--verbose</tt>" option allows one to track the
|
||
progress of each transfer.
|
||
|
||
<H3>Conclusion</H3>
|
||
|
||
Do not be afraid to use non-interactive methods for effecting your
|
||
remote file transfers. No matter how hard web designers may try to
|
||
force you to surf their sites interactively, there will always be free
|
||
tools to help automate the process, thus enriching our overall Net
|
||
experience.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- *** BEGIN bio *** -->
|
||
<SPACER TYPE="vertical" SIZE="30">
|
||
<P>
|
||
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Adrian J Chung</H4>
|
||
<EM>When not teaching undergraduate computing at the University of
|
||
the West Indies, Trinidad, Adrian writes scripts to automate web email
|
||
downloads, and experiments with interfacing various scripting
|
||
environments with homebrew computer graphics renderers and data
|
||
visualization libraries.</EM>
|
||
|
||
<!-- *** END bio *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <!-- P -->
|
||
<H5 ALIGN=center>
|
||
|
||
Copyright © 2001, Adrian J Chung.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
||
</H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<center>
|
||
<H1><font color="maroon">Bootstrapping a Linux system - an Analysis</font></H1>
|
||
<H4>By <a href="mailto:subhasish_ghosh@linuxmail.org">Subhasish Ghosh</a></H4>
|
||
</center>
|
||
<P> <HR> <P>
|
||
|
||
<!-- END header -->
|
||
|
||
|
||
|
||
|
||
<p>Everyday millions of Linux users all over the world switch on
|
||
their computers, wait for a few seconds (or minutes depending on
|
||
their CPU speeds) to see their favorite operating system booting,
|
||
and finally get the "<strong>login</strong>" prompt.
|
||
That's it. It causes immense pleasure just to log into your
|
||
favorite operating system and work. Doesn't it? Well, as for me,
|
||
surely it does. (Though I need to switch on my own computer after
|
||
every two months, cause I let it run all the time!). </p>
|
||
|
||
<p>As many of the readers must have noticed, when the computer is
|
||
bootstrapping itself, a lot of messages come up on the screen.
|
||
These can be viewed later by issuing the command: cat
|
||
/var/log/dmesg | more (cause it usually produces a lot of
|
||
output). Now, the question is: Hey, what do these messages mean
|
||
in reality? That's easy to answer: Look into any Linux textbook,
|
||
and you will find it's mentioned something like this: "it
|
||
refers to the Kernel Boot messages" and so on. But, is that
|
||
all? And what is meant by "Kernel Boot messages"? </p>
|
||
|
||
<p>Life has taught me a lot of things. Patience is one of them.
|
||
And to understand the internal workings of Linux requires a lot
|
||
of patience and sacrifice cause it requires the proper
|
||
understanding of the "Linux Kernel Architecture". Most
|
||
Linux users don't have either that much time to understand the
|
||
"Linux Kernel Architecture", or maybe are not that much
|
||
interested in it, while some may have other important things to
|
||
do in life.</p>
|
||
|
||
<p>I am <strong>NOT</strong> going to explain the "Linux
|
||
Kernel Architecture" in this article cause it would require
|
||
a whole book to do so. Rather, in this article, I explain in
|
||
detail one of the most fundamental concepts of a computer-system
|
||
- <strong>Bootstrapping</strong> a computer running Linux. In
|
||
other words, I would explain (at least try to do so) the entire
|
||
process from the time one switches on the computer till the
|
||
"login" prompt appears on the screen (assuming he/she
|
||
is using CLI mode). In short, we would see how the Linux Kernel,
|
||
and thus the whole system, is "bootstrapped". </p>
|
||
|
||
<p>Please Note: </p>
|
||
|
||
<ol>
|
||
<li>A basic understanding of the internal workings and
|
||
operations of the Linux Kernel is assumed on behalf of
|
||
the readers.</li>
|
||
<li>All the files mentioned in this article refer to Linux
|
||
Kernel 2.4.2-2. Though the files are common for all Linux
|
||
Kernels and can be found on any Linux system, I have used
|
||
Red Hat Linux 7.1 Distribution Release.</li>
|
||
</ol>
|
||
|
||
<p><font size="5"><strong>1. Bootstrapping. What's that?</strong></font></p>
|
||
|
||
<p>Traditionally, the term "<strong>bootstrap</strong>"
|
||
refers to a person who tries to stand up (usually while lying
|
||
down cause he was tired!) by pulling his/her own boots. In
|
||
operating systems, the term refers to the process in which a part
|
||
of the operating system is brought into the Main Memory, with the
|
||
processor executing it. The internal data structures of the Linux
|
||
Kernel are also initialized, values are set to the constituent
|
||
variable(s), and processes are created (that usually spawn other
|
||
significant processes later). Computer bootstrapping is a long
|
||
and complicated task, cause when the computer is switched on, all
|
||
the hardware devices are in a unpredictable state, while the RAM
|
||
is inactive and in a random state. Thus, the thing to be kept in
|
||
mind is, the process called "bootstrapping" is highly
|
||
dependent on the computer architecture. </p>
|
||
|
||
<p>Please note: </p>
|
||
|
||
<ol>
|
||
<li>Here we discuss IBM's PC architecture.</li>
|
||
<li>A friend of mine who lives nearby kicks his CPU to
|
||
start it. I call this "bootslapping" instead of
|
||
"bootstrapping". But the process
|
||
described here still applies! </li>
|
||
</ol>
|
||
|
||
<p><font size="5"><strong>2. BIOS. What's that? What does it do?</strong></font>
|
||
</p>
|
||
|
||
<p>When a computer is powered on, initially, it's practically
|
||
useless. Cause the RAM chips contain random data, aren't
|
||
initialized, and there's no operating system present. To begin
|
||
the "bootstrapping", a special hardware circuit raises
|
||
the logical value of the RESET pin of the CPU. Then, some CPU
|
||
registers, which include registers like <strong>cs</strong> (a
|
||
Segmentation Register - code segment register, which points to a
|
||
segment containing program instructions) and <strong>eip</strong>
|
||
( when a processor-detected exception is generated by the CPU,
|
||
that is, in other words, an exception raised by the CPU when the
|
||
CPU detects an anomalous condition while executing an
|
||
instruction, they are further of three types, namely
|
||
"faults", "traps" and "aborts",
|
||
depending on the value of the eip register that is saved on the
|
||
Kernel Mode stack when the CPU control unit raises the
|
||
exception.) are set to fixed values. Then, the code found at
|
||
physical address 0xfffffff0 is executed. This address is mapped
|
||
by the hardware to some read-only, permanent memory-chip, a
|
||
special kind of memory which is usually called <strong>ROM</strong>
|
||
(Read-Only Memory). <strong>BIOS</strong> (Basic Input/Output
|
||
System) is a set of programs that is stored in ROM. It consists
|
||
of several interrupt-driven low-level procedures used by various
|
||
operating systems to handle the hardware devices that constitute
|
||
the computer-system. Microsoft DOS is one such OS. </p>
|
||
|
||
<p>The question that now comes up is: Then, does Linux use the
|
||
BIOS to initialize the hardware devices attached to the computer
|
||
system? Or, is it anything else that performs the same task? If
|
||
yes, what's it? Well, the answer is not that simple, cause the
|
||
answer needs to be understood carefully. Starting with the 80386
|
||
model, Intel microprocessors perform address translation (from
|
||
Logical Address --> Linear Address --> Physical Address) in
|
||
two different ways called the "<strong>Real mode</strong>"
|
||
and "<strong>Protected mode</strong>". Real mode exists
|
||
mainly to maintain processor compatibility with older models. In
|
||
fact, all BIOS procedures are executed in Real mode. But, the
|
||
Linux Kernel executes in the Protected mode and NOT in the Real
|
||
mode. Thus, once initialized, Linux does NOT make any use of BIOS
|
||
but provides its own device drivers for every hardware device on
|
||
the computer. </p>
|
||
|
||
<p>The question that now comes up is: When Linux uses
|
||
"Protected mode", why can't BIOS use the same mode?
|
||
BIOS uses the Real mode, cause it utilizes Real mode addresses
|
||
for its operation, and Real mode addresses are the only ones
|
||
available when the computer is switched on. A Real mode address
|
||
is a seg segment and an off offset; thus the corresponding
|
||
physical address is given by seg*(2*8)+off. (Please note: Since a
|
||
Segment Descriptor is 8 bytes long, its relative address inside
|
||
the GDT or the LDT is obtained by multiplying the most
|
||
significant 13 bits of the Segment Selector by 8).</p>
|
||
|
||
<p>So, does this mean Linux never uses BIOS during the entire
|
||
process of "bootstrapping"? Well, the answer is <strong>No</strong>,
|
||
Linux is forced to use BIOS in the bootstrapping phase when it
|
||
has to retrieve the Kernel image from disk or some other external
|
||
device.</p>
|
||
|
||
<p>To sum up this section, let's look closely at the main
|
||
operations that the BIOS performs during the bootstrapping
|
||
sequence. They are as follows: </p>
|
||
|
||
<ol>
|
||
<li>It carries out an exhaustive series of tests on the
|
||
hardware. This is to check what devices are present,
|
||
which are working properly and which aren't. This step is
|
||
usually called POST (Power-On Self-Test). The version
|
||
banner and a series of messages are displayed during this
|
||
step. (Remember my friend who uses
|
||
"bootslapping" instead of
|
||
"bootstrapping"? Well, the POST on his system
|
||
doesn't show any errors!!)</li>
|
||
<li>Then, it initializes the Hardware. This step is a very
|
||
significant one, cause it guarantees that all hardware
|
||
devices are operating without conflicts on the IRQ lines
|
||
and I/O ports. When this step's about to be over, it
|
||
displays a table of installed PCI devices.</li>
|
||
<li>Then comes the turn of the "operating system".
|
||
The BIOS searches for the operating system to boot.
|
||
Depending on the BIOS setting, this step may want to
|
||
access the boot sector of a floppy disk, any hard disk or
|
||
any CD-ROM in the system.</li>
|
||
<li>As soon as a valid device is found, the BIOS copies the contents
|
||
of its first sector into RAM, starting from the physical
|
||
address 0x00007c00, then jumps to that address and
|
||
executes the code just loaded. That's all. These are the
|
||
operations that the BIOS is scheduled to perform. Once
|
||
this is over, it's the Boot Loader that takes over. So,
|
||
let's now move on to the next section.</li>
|
||
</ol>
|
||
|
||
<p><font size="5"><strong>3. Boot Loader. What's that? What does
|
||
it do?</strong></font></p>
|
||
|
||
<p>The BIOS invokes (note: NOT executes) a special program whose
|
||
main (rather only) task is to load the image of an operating
|
||
system Kernel into RAM. This program is called the <strong>Boot
|
||
Loader</strong>. Before we proceed any further, let's take a
|
||
brief look in the different ways a system can be booted:</p>
|
||
|
||
<ul>
|
||
<li>Booting Linux from a Floppy disk </li>
|
||
<li>Booting Linux from a Hard disk </li>
|
||
</ul>
|
||
|
||
<p><font size="4"><em><strong>1. Booting Linux from a Floppy disk
|
||
:</strong></em></font> When booting from a floppy disk, the
|
||
instructions stored in the first sector of the floppy disk is
|
||
loaded in RAM and executed. These instructions then copy all the
|
||
remaining sectors containing the Kernel image into RAM. </p>
|
||
|
||
<p><font size="4"><em><strong>2. Booting Linux from a Hard disk :</strong></em></font>
|
||
When booting from the hard disk, the booting procedure is
|
||
different. The first sector of the hard disk, called the Mater
|
||
Boot Record (MBR) includes the partition table and a small
|
||
program. This program loads the first sector of the partition
|
||
containing the operating system to be started. Linux is highly
|
||
flexible and sophisticated piece of software, thus it replaces
|
||
this small program in the MBR with a sophisticated program called
|
||
LILO (LInux boot LOader). LILO allows users to select the
|
||
operating system to be booted. </p>
|
||
|
||
<p>Now, let's take a more deeper and detailed look into these 2
|
||
different ways of booting a system. </p>
|
||
|
||
<p><font size="5"><strong>4. Booting Linux from Floppy Disk.</strong></font>
|
||
</p>
|
||
|
||
<p>The Linux Kernel fits into a single 1.44-MB floppy disk. (In
|
||
fact, there exists a type of Red Hat Linux installation known as
|
||
"stripped-off" type, which requires approx. 2 MB
|
||
physical RAM and approx. 1.44 MB hard disk space for running a
|
||
Red Hat Linux system. That's what Linux is all about, after all.
|
||
Isn't it?) But the only way to store a Linux Kernel on a single
|
||
floppy disk is to compress the "Linux Kernel Image".
|
||
The point to remember here is that, compressing is done at
|
||
compile time, while decompressing is done at boot time by the
|
||
loader.</p>
|
||
|
||
<p>When you're booting Linux from a floppy disk, the boot loader in case of
|
||
booting Linux from a floppy disk is very simple. It has been coded in the
|
||
assembly-language file
|
||
/usr/src/linux-2.4.2/arch/i386/boot/bootsect.S. When we
|
||
compile the Linux Kernel source, and obtain a new kernel image, the executable
|
||
code yielded by this assembly language file is place at the beginning of the
|
||
Kernel image file. This makes it easy to produce a floppy disk containing the
|
||
Linux Kernel.</p>
|
||
|
||
<p>Copying the kernel image starting from the first sector of the
|
||
disk can create the floppy. When the BIOS loads the first sector
|
||
of the floppy disk, it actually copies the code of the boot
|
||
loader. The boot loader, which is invoked by BIOS (by jumping to
|
||
the physical address 0x00007c00) performs the following
|
||
operations:</p>
|
||
|
||
<ol>
|
||
<li>Moves itself from address 0x00007c00 to address
|
||
0x00090000.</li>
|
||
<li>Using address 0x00003ff4, sets up the "Real
|
||
Mode" stack.</li>
|
||
<li>Sets up the disk parameter table. This is used by BIOS to
|
||
handle the floppy device driver.</li>
|
||
<li>Displays the message "Loading" by invoking a
|
||
BIOS procedure.</li>
|
||
<li>Then, invokes a BIOS procedure to load the setup( ) code
|
||
of the Kernel Image from the floppy disk. It puts this
|
||
into RAM starting from address 0x00090200.</li>
|
||
<li>Invokes a BIOS procedure finally. This procedure loads
|
||
the rest of the Kernel image from the floppy disk and
|
||
puts the image in RAM starting from either address
|
||
0x00010000 (called "low address" for small
|
||
Kernel Images compiled with "make zImage") or
|
||
address 0x00100000 (called "high address" for
|
||
big Kernel Images compiled with "make
|
||
bzImage").</li>
|
||
<li>Then, it finally jumps to the setup( ) code. </li>
|
||
</ol>
|
||
|
||
<p><font size="5"><strong>5. Booting Linux from Hard Disk.</strong></font></p>
|
||
|
||
<p>The Linux Kernel is mostly loaded from the hard disk. This
|
||
requires a two-stage boot loader. On Intel systems, the most
|
||
commonly used Linux boot loader is named LILO. For other
|
||
architectures, other Linux boot loaders exist. LILO may either be
|
||
installed on the MBR (Please note: During Red Hat Linux
|
||
Installation there comes a step where the user has to either
|
||
write LILO to the MBR or put it in the boot sector) or in the
|
||
boot sector of an active disk partition.</p>
|
||
|
||
<p>LILO is broken into 2 parts, otherwise it would be too large
|
||
to fit into the MBR. The MBR or the disk partition boot sector
|
||
includes a small boot loader, which is loaded into RAM starting
|
||
from address 0x00007c00 by the BIOS. This small program moves
|
||
itself to the address 0x0009a000, then sets up the Real Mode
|
||
stack, and then finally loads the second part of the LILO boot
|
||
loader. (Please note: The Real Mode stack ranges from 0x0009b000
|
||
to 0x0009a200).</p>
|
||
|
||
<p>The second part of LILO reads all the available operating
|
||
systems from disk and offers the user a prompt so that he/she can
|
||
choose any one of them from that available list. After the user
|
||
has chosen any one Kernel (on my system, one can opt for any 1
|
||
Linux Kernel out of 8 Custom Kernels!) to be loaded, the boot
|
||
loader may either copy the boot sector of the corresponding
|
||
partition into RAM and execute it or directly copy the Kernel
|
||
image into RAM.</p>
|
||
|
||
<p>Since the Linux Kernel image must be booted, the Linux boot
|
||
loader performs essentially the same operations as the boot
|
||
loader integrated into the Kernel image. The boot loader, which
|
||
is invoked by BIOS (by jumping to the physical address
|
||
0x00007c00) performs the following operations:</p>
|
||
|
||
<ol>
|
||
<li>Moves itself from address 0x00007c00 to address
|
||
0x00090000.</li>
|
||
<li>Using address 0x00003ff4, sets up the "Real
|
||
Mode" stack.</li>
|
||
<li>Sets up the disk parameter table. This is used by BIOS to
|
||
handle the hard disk device driver.</li>
|
||
<li>Displays the message "Loading Linux" by
|
||
invoking a BIOS procedure.</li>
|
||
<li>Then, invokes a BIOS procedure to load the setup( ) code
|
||
of the Kernel Image. It puts this into RAM starting from
|
||
address 0x00090200.</li>
|
||
<li>Invokes a BIOS procedure finally. This procedure loads
|
||
the rest of the Kernel image and puts the image in RAM
|
||
starting from either address 0x00010000 (called "low
|
||
address" for small Kernel Images compiled with
|
||
"make zImage") or address 0x00100000 (called
|
||
"high address" for big Kernel Images compiled
|
||
with "make bzImage").</li>
|
||
<li>Then, it finally jumps to the setup( ) code. </li>
|
||
</ol>
|
||
|
||
<p><font size="5"><strong>6. The setup( ) function. What does it
|
||
do?</strong></font> </p>
|
||
|
||
<p>Now, time has come to take a deeper look into some of the
|
||
essential assembly language functions that are indispensable for
|
||
the "bootstrapping" process. Here we look at the setup(
|
||
) function.</p>
|
||
|
||
<p>The setup( ) function can be found in the file
|
||
/usr/src/linux-2.4.2/arch/i386/boot/setup.S. The code of the
|
||
setup( ) assembly language function is placed by the linker
|
||
immediately after the integrated boot loader of the Kernel, that
|
||
is, at offset 0x200 of the Kernel Image file. This allows the
|
||
boot loader to locate the code easily and copy it onto the RAM
|
||
starting from the physical address 0x00090200.</p>
|
||
|
||
<p>Now the question that comes up is: What does this setup( )
|
||
function do? As its name suggests, it's supposed to set up
|
||
something. But what? And how?</p>
|
||
|
||
<p>As we all know, for the kernel to operate properly, all the
|
||
hardware devices in the computer must be detected, and then
|
||
initialized in an orderly fashion. What the setup( ) function
|
||
does is initialize all the hardware devices and thus creates
|
||
an environment for the Kernel to operate in.</p>
|
||
|
||
<p>But, hang on a second. Didn't we see a few minutes earlier,
|
||
that the BIOS was supposed to do all this stuff? Yeah, you are
|
||
right. 100%. Although the BIOS already initialized most hardware,
|
||
the Linux Kernel does <em><strong>NOT</strong></em> rely on it
|
||
and initializes all of the hardware in its own fashion. But, if
|
||
someone asks, well, why does Linux operate in such a way? The
|
||
answer to this question is both very easy yet extremely difficult
|
||
to explain. The Linux Kernel had been so designed to enhance
|
||
portability and robustness. This is one of the many features that
|
||
makes the Linux Kernel the best out of all the Unix and Unix-like
|
||
Kernels available and makes it unique in so many ways. A proper
|
||
understanding of why and exactly how the Linux Kernel implements
|
||
this feature is beyond the scope of this topic and would require
|
||
an extremely detailed coverage of the essential features of the
|
||
Linux Kernel Architecture.</p>
|
||
|
||
<p>The setup( ) code mainly performs the following tasks:</p>
|
||
|
||
<ol>
|
||
<li>First, total amount of physical RAM available to the
|
||
system is detected. It invokes a BIOS procedure for
|
||
detecting the RAM.</li>
|
||
<li>Sets the Keyboard repeat delay and rate.</li>
|
||
<li>The Video adapter card is detected.</li>
|
||
<li>The Disk Controller is reinitialized and hard disk
|
||
parameters are determined.</li>
|
||
<li>Checks for an IBM Micro Channel bus (MCA).</li>
|
||
<li>Checks for a PS/2 pointing device (bus mouse).</li>
|
||
<li>Checks for Advanced Power Management (APM) BIOS support.</li>
|
||
<li>Now checks the position of the Kernel Image loaded in
|
||
RAM. If loaded "low" in RAM (when using zImage,
|
||
at physical address 0x00010000) it is moved to
|
||
"high" in RAM (at physical address 0x00001000).
|
||
But, if the Kernel image is a "bzImage" loaded
|
||
in "high" of RAM already, then it's NOT moved
|
||
anywhere.</li>
|
||
<li>Sets up the Interrupt Descriptor Table (IDT) and a Global
|
||
Descriptor Table (GDT).</li>
|
||
<li>If floating point unit (fpu) is present, it's now reset
|
||
at this step.</li>
|
||
<li>PIC (Programmable Interrupt Controller) is reprogrammed
|
||
at this step.</li>
|
||
<li>The CPU is switched from "Real mode" to
|
||
"Protected mode" by setting the PE bit in the
|
||
cr0 status register.</li>
|
||
<li>Jumps to the stratup_32( ) assembly language function.</li>
|
||
</ol>
|
||
|
||
<p>Now from here on, the going gets a bit tougher as the
|
||
"bootstrap" process gets a bit more complicated. I hope
|
||
you put aside everything and carefully try to understand from
|
||
here on.</p>
|
||
|
||
<p><font size="5"><strong>7. The startup_32( ) function - 1st
|
||
function. What does it do?</strong></font></p>
|
||
|
||
<p>Okay, let's get to the confusing point straight away. There
|
||
exist <strong>two</strong> functions called <strong>startup_32()</strong>.
|
||
Although both these two startup_32()
|
||
functions are assembly language functions and are required for
|
||
"bootstrap" process, they are totally different
|
||
functions. The one we refer to here is coded in
|
||
/usr/src/linux-2.4.2/arch/i386/boot/compressed/head.S file. After
|
||
setup() code is executed, the function has been moved either to
|
||
physical address 0x00100000 or to physical address 0x00001000,
|
||
depending on whether the Kernel Image was loaded "high"
|
||
or "low" in RAM.</p>
|
||
|
||
<p>This function when executes, performs the following
|
||
operations:</p>
|
||
|
||
<ol>
|
||
<li>The segmentation registers are initialized along with a
|
||
provisional stack.</li>
|
||
<li>The area of uninitialized data of the Kernel is filled
|
||
with zeroes. It is identified by symbols _edata and _end.</li>
|
||
<li>It then executes a function decompress_kernel( ). This
|
||
function is used to decompress the Linux Kernel image. As
|
||
a result, the "Uncompressing Linux . . ."
|
||
message is displayed on the screen. After the Linux
|
||
Kernel image has been decompressed correctly, the
|
||
"OK, booting the kernel." message is shown. One
|
||
very significant question here is: Okay, we understand
|
||
the Linux Kernel image is decompressed. But, where is it
|
||
loaded? The answer is: If the Linux Kernel image was
|
||
loaded "low", then the decompressed kernel is
|
||
placed at physical address 0x00100000. Otherwise, if the
|
||
Linux Kernel image was loaded "high", the
|
||
decompressed kernel is placed in a temporary buffer
|
||
located after the compressed image. The decompressed
|
||
kernel image is then finally moved to its final position,
|
||
which starts at physical address 0x00100000.</li>
|
||
<li>Finally code execution jumps to the physical address
|
||
0x00100000.</li>
|
||
</ol>
|
||
|
||
<p>Now, after the 4th operation (as mentioned above is over),
|
||
code execution is taken over by the other startup_32( ) function.
|
||
In other words, the second one takes over the bootstrapping
|
||
process.</p>
|
||
|
||
<p><font size="5"><strong>8. The startup_32( ) function - 2nd
|
||
function. What does it do?</strong></font></p>
|
||
|
||
<p>The decompressed Linux kernel image begins with another
|
||
startup_32( ) function. This function exists in
|
||
/usr/src/linux-2.4.2/arch/i386/kernel/head.S file.</p>
|
||
|
||
<p>The question that must come up here is: Hey, using two
|
||
different functions having the same name… Doesn't this cause
|
||
problem? The answer is: Well,<strong> no</strong> it doesn't at
|
||
all. Cause both functions are executed by jumping to their
|
||
initial physical addresses and hence they are executed in their
|
||
own execution environments. No problem at all!</p>
|
||
|
||
<p>Now, let's look at the second startup_32( ) function
|
||
functionality. What does it do? This function when executes, it
|
||
essentially sets up the execution environment for the first Linux
|
||
process (process 0). The function performs the following
|
||
operations:</p>
|
||
|
||
<ol>
|
||
<li>The segmentation registers are initialized with their
|
||
final values.</li>
|
||
<li>Sets up the Kernel Mode stack for process 0.</li>
|
||
<li>It then invokes and executes a function setup_idt( ) that
|
||
fills the IDT (Interrupt Descriptor Table) with null
|
||
interrupt handlers.</li>
|
||
<li>The system parameters obtained from BIOS is put in the
|
||
first page frame.</li>
|
||
<li>The "Model" of the processor is identified.</li>
|
||
<li>Loads the gdtr and idtr registers with the addresses of
|
||
the GDT and IDT tables.</li>
|
||
<li>It finally makes a jump to the start_kernel( ) function.</li>
|
||
</ol>
|
||
|
||
<p><font size="5"><strong>9. The start_kernel( ) function. What
|
||
does it do?</strong></font></p>
|
||
|
||
<p>The start_kernel( ) function completes the "<strong>initialization</strong>"
|
||
of the Linux Kernel. All the essential Kernel components are
|
||
initialized when this function executes. And this in fact is the
|
||
last step of the entire "bootstrapping" process.</p>
|
||
|
||
<p>The following takes place when this function executes:</p>
|
||
|
||
<ol>
|
||
<li>The paging_init( ) function is executed that initializes
|
||
the Page Tables.</li>
|
||
<li>The mem_init( ) function is executed that initializes the
|
||
Page Descriptors.</li>
|
||
<li>The trap_init( ) and init_IRQ( ) functions are executed
|
||
that initializes the IDT for the final time.</li>
|
||
<li>The kmem_cache_init( ) and kmem_cache_sizes_init ( )
|
||
functions are executed that initializes the Slab
|
||
Allocator.</li>
|
||
<li>The time_init( ) function is executed that initializes
|
||
the System Date & Time.</li>
|
||
<li>The Kernel thread for process 1 is created by invoking
|
||
the kernel_thread( ) function. This in turn creates the
|
||
other kernel threads and executes /sbin/init program.</li>
|
||
</ol>
|
||
|
||
<p>The "Linux version 2.4.2 …" message is
|
||
displayed right after the beginning of start_kernel( ). Many
|
||
other messages are displayed also. At the very end, the very
|
||
familiar login prompt appears on the console. This tells the user
|
||
that the Linux Kernel is up and running, and just raring to
|
||
go…. And dominate the world!</p>
|
||
|
||
<p><font size="5"><strong>10. Conclusion</strong></font></p>
|
||
|
||
<p>This sums up our long and tedious journey of the entire "<em><strong>bootstrapping</strong></em>"
|
||
process of a Linux system, or in other words, of a computer
|
||
system running Linux operating system. As the readers would
|
||
rightly note, I have NOT explained most of the other components
|
||
and terms that I have had used. A few include IDT, GDT, eip
|
||
register, cs register and so on. The full explanation of all
|
||
these terms would make it impossible to complete the article in
|
||
just a few pages, and would make the entire topic rather very
|
||
boring. So, I really hope the readers would understand the fact
|
||
that in this article I provide everyone with a glimpse of the
|
||
processes and other various things that take place when a Linux
|
||
system boots. In depth coverage of all the associated functions
|
||
like paging_init( ) and mem_init( ) is beyond the scope of this
|
||
topic.</p>
|
||
|
||
|
||
<!-- *** BEGIN bio *** -->
|
||
<SPACER TYPE="vertical" SIZE="30">
|
||
<P>
|
||
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Subhasish Ghosh</H4>
|
||
<EM>I am
|
||
20 years old, currently a computer-systems engineering student in
|
||
India. I am a Microsoft Certified Professional (MCP), MSCD, MCP
|
||
certified on NT 4.0, recently completed Red Hat Linux Certified
|
||
Engineer (RHCE) Training. I have been working with Linux for a
|
||
long time, have had programmed using C, C++, VC++, VB, COM, DCOM,
|
||
MFC, ATL 3.0, Perl, Python and Linux programming using GTK+.
|
||
Currently busy learning the Linux Kernel Architecture in detail
|
||
and doing Linux Kernel Programming.</EM>
|
||
|
||
<!-- *** END bio *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <!-- P -->
|
||
<H5 ALIGN=center>
|
||
|
||
Copyright © 2001, Subhasish Ghosh.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
||
</H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<center>
|
||
<H1><font color="maroon">GNOME Programming in Linux using GTK+</font></H1>
|
||
<H4>By <a href="mailto:subhasish_ghosh@linuxmail.org">Subhasish Ghosh</a></H4>
|
||
</center>
|
||
<P> <HR> <P>
|
||
|
||
<!-- END header -->
|
||
|
||
|
||
|
||
|
||
<p>This article provides us with an overview of
|
||
GNOME Programming in Linux using GTK+ Toolkit. Please note: It is
|
||
assumed that the reader knows the basics of getting around in
|
||
Linux, knows how to use the GNOME environment, and possesses the
|
||
required level of C and/or C++ programming experience.</p>
|
||
|
||
<p>The code samples that have been provided along
|
||
with the text, have been checked on a computer system with the
|
||
following configuration: Compaq Presario 4010 Series computer
|
||
system, 15.5 GB Hard Disk Space, 96 MB RAM, 400 MHz Intel Celeron
|
||
Processor, Red Hat Linux 7.1 Distribution Release underlying
|
||
kernel: 2.4.2-2</p>
|
||
|
||
<p>This article has been divided into the following
|
||
sections for easy understanding of the subject matter:</p>
|
||
|
||
<p>1. <a
|
||
href="#What is GNOME all about? An Introduction.">What is GNOME
|
||
all about? An Introduction</a>.<br>
|
||
2. <a href="#The GNOME Architecture">The GNOME Architecture.</a><br>
|
||
3. <a href="#GTK+ - An Introduction">GTK+ - An Introduction</a><br>
|
||
4. <a href="#A basic program">A basic program.</a><br>
|
||
5. <a href="#Signals & Callbacks">Signals & Callbacks</a><br>
|
||
6. <a href="#Containers">Containers</a><br>
|
||
7. <a href="#Buttons">Buttons</a><br>
|
||
8. <a href="#Entry Widgets">Entry Widgets</a><br>
|
||
9. <a href="#List boxes and Combo boxes">List boxes & Combo
|
||
boxes</a><br>
|
||
10. <a href="#Menus & Toolbars">Menus & Toolbars</a><br>
|
||
11. <a href="#Dialog boxes">Dialog boxes</a><br>
|
||
12. <a href="#Conclusion & Links for Further study">Conclusion
|
||
& Links for Further study</a></p>
|
||
|
||
<p><font size="5"><strong>1. </strong></font><a
|
||
name="What is GNOME all about? An Introduction."><font size="5"><strong>What
|
||
is GNOME all about? An Introduction.</strong></font></a></p>
|
||
|
||
<p>Before entering into the exciting world of Gnome
|
||
programming in Linux, let's try to understand what Gnome actually
|
||
refers to. GNOME is the acronym for "<strong>GNU's Not Unix
|
||
Network Object Model Environment</strong>". Though it sounds
|
||
a bit complicated, Gnome is a software project with a simple aim:
|
||
To provide all Linux users with an extremely user-friendly, yet a
|
||
powerful and complete programming Desktop environment. GNOME is
|
||
currently the default Desktop system installed with the latest
|
||
releases of Red Hat and Debian Distribution releases of Linux. </p>
|
||
|
||
<p>For more specific info on GNOME and it's various
|
||
wonderful features, make sure you check out the GNOME Project
|
||
home page at <a href="http://www.gnome.org">http://www.gnome.org</a>
|
||
which provide readers with a wealth of information on GNOME,
|
||
including online documentation, news; and one could also download
|
||
the binaries and source code of GNOME compatible with most Linux
|
||
systems.</p>
|
||
|
||
<p>Now let's look at GNOME from both a
|
||
"Linux programmer's" as well as a "Linux System
|
||
Administrator's" point of view. The basic question that
|
||
comes to mind is: do they think and feel the same when they talk
|
||
about GNOME? The answer to this question is not so easy to
|
||
answer. Most Linux system administrators currently are/or have
|
||
been Linux programmers in the past or so, which makes it quite
|
||
difficult to answer this question. For an average Linux system
|
||
administrator, the GNOME environment provides a wealth of tools
|
||
that makes his/her administrative job so simple. Meanwhile, the
|
||
the GNOME programmer has a responsibility to continue
|
||
providing these facilities by designing even better programs. So,
|
||
they are in perfect harmony with each other as far as their
|
||
respective works are concerned.</p>
|
||
|
||
<p>Now let's take a bit closer look at Gnome's
|
||
functionality. GNOME is actually a programming layer that is
|
||
placed in between the X Window System (or X) and the Window
|
||
Manager software. Thus, as mentioned earlier, it provides Linux
|
||
GUI programmers with an enormous functionality that they can then
|
||
harness to design Linux based programs. But most significant of
|
||
all, the reason why GNOME is nearly indispensable for all
|
||
Linux/Unix developers is because GNOME provides these
|
||
developers/programmers with an Integrated Framework which was
|
||
specifically designed for building open-source applications with
|
||
a consistent graphical user interface.</p>
|
||
|
||
<p>The GNOME Project started in August, 1997. Some
|
||
of the initial founders included, amongst others, Peter Mattis,
|
||
Spencer Kimball, Richard Stallman, and Erik Troan and Mark Ewing
|
||
of Red Hat, Inc.</p>
|
||
|
||
|
||
<p><font size="5"><strong>2. </strong></font><a
|
||
name="The GNOME Architecture"><font size="5"><strong>The GNOME
|
||
Architecture</strong></font></a></p>
|
||
|
||
<p>
|
||
GNOME's extremely powerful, yet flexible architecture is what
|
||
provides GNOME its terrific functionality. The
|
||
base toolkit in GNOME is named <strong>GTK+</strong>(the GIMP
|
||
toolkit). It was originally written for using in <strong>GIMP</strong>(GNU
|
||
Image Manipulation Program). The proper understanding of GTK+ is
|
||
extremely necessary for the understanding of GNOME Programming. <strong>GTK+
|
||
is an object-oriented, cross-platform language-neutral toolkit
|
||
that is primarily used for creating applications independently of
|
||
GNOME</strong>. Then the question that comes up is: Then why was
|
||
GTK+ chosen as the toolkit for GNOME? The answer is simple: It
|
||
was for its support for many programming languages including C,
|
||
C++, PERL, Python, ADA etc. But it is helpful to keep in mind
|
||
always that both GNOME as well as GTK+ was written using C; so we
|
||
would be dealing here with C only.</p>
|
||
|
||
<p>Another question that should come up in the
|
||
reader's mind is: Hey, what do these things called
|
||
"Toolkits" contain? Toolkits like GTK+, Qt (the KDE
|
||
Environment is based on Qt) are collections of widgets. Which
|
||
brings us to the question: What are "Widgets"?</p>
|
||
|
||
<p><strong>Widgets</strong> are GUI objects like
|
||
buttons, menus, dialog boxes and other such objects or
|
||
object-related general functions. This can be compared with
|
||
Active Template Library (ATL 3.0) on the Microsoft Platform, which
|
||
provides Component Object Model (COM) developers with a ready-made
|
||
framework for creating COM Objects and Components (ActiveX EXEs
|
||
& ActiveX DLLs).</p>
|
||
|
||
<p><font size="5"><strong>3. </strong></font><a
|
||
name="GTK+ - An Introduction"><font size="5"><strong>GTK+ - An
|
||
Introduction</strong></font></a></p>
|
||
|
||
<p>Now let's take a closer look into some of the
|
||
features of GTK+:</p>
|
||
|
||
<ol>
|
||
<li><p>The set of libraries used by GTK+:
|
||
GLIB (GIMP Library) and GDK (GIMP Drawing Toolkit).</p>
|
||
</li>
|
||
<li><p>GLIB defines data types and provides
|
||
functions that deal with error handling and memory
|
||
routines.</p>
|
||
</li>
|
||
<li><p>GDK is the platform dependent layer that
|
||
is present in between the native graphics API and GTK+.</p>
|
||
</li>
|
||
<li><p>That's not all. GNOME adds further
|
||
functionality to GTK+ by adding a separate layer of GNOME
|
||
specific widgets and libraries.</p>
|
||
</li>
|
||
<li><p>Thus, GNOME comes with a full-featured,
|
||
object-oriented extensive widget set enabled
|
||
architecture.</p>
|
||
</li>
|
||
<li><p>Other than functionality of GTK+, we also
|
||
have the added benefits of a Custom implementation of the
|
||
CORBA system called ORBit in GNOME architecture, allowing
|
||
software objects to communicate easily and effectively.</p>
|
||
</li>
|
||
<li><p>GLIB defines its own set of basic data
|
||
types. Most of these are equivalent to the standard C
|
||
data types.</p>
|
||
</li>
|
||
</ol>
|
||
<div align="center"><center>
|
||
|
||
<table border="3" cellpadding="4" cellspacing="4">
|
||
<tr>
|
||
<td>GLIB data type</td>
|
||
<td>C language type</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">gchar</td>
|
||
<td align="center" bgcolor="#00FFFF">char</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">gshort</td>
|
||
<td align="center" bgcolor="#00FFFF">short</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">glong</td>
|
||
<td align="center" bgcolor="#00FFFF">long</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">gint</td>
|
||
<td align="center" bgcolor="#00FFFF">int</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">gboolean</td>
|
||
<td align="center" bgcolor="#00FFFF">boolean</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">gpointer</td>
|
||
<td align="center" bgcolor="#00FFFF">void*</td>
|
||
</tr>
|
||
</table>
|
||
</center></div>
|
||
|
||
<p>8. A vital requirement for proper understanding
|
||
of GTK+ is the concept of "Widget Hierarchy". Widgets
|
||
in GTK+ belong to a hierarchy so that functions that are common
|
||
to a set of widgets need only be implemented once. </p>
|
||
|
||
<p>For example, the function gtk_widget_show. This
|
||
leads to removal of duplicate code, thus leading to better and
|
||
faster program development. New widgets are derived from existing higher-level
|
||
widgets so that only the unique features of this widget are to be
|
||
written by the programmer. For example, let's look closely at
|
||
this particular widget hierarchy: </p>
|
||
|
||
<p>GtkObject --> GtkWidget --> GtkContainer
|
||
--> GtkBin --> GtkWindow --> GnomeApp</p>
|
||
|
||
<p>Thus, if you look carefully, you can see that
|
||
GnomeApp widget is derived from the higher-level GtkWindow, which
|
||
itself has been derived from the higher-level GtkBin and so on.
|
||
If we take into the consideration the essential features of the
|
||
C++ programming language, well, this reminds us of the concept of
|
||
"Inheritance". Doesn't it? Well, surely it does. And it
|
||
is this feature of the "Widget Hierarchy" that
|
||
incorporates the derived functionality in GTK+.</p>
|
||
|
||
<p>Let's now take a brief look at the widget
|
||
creation functions. For these functions to operate correctly, one
|
||
must make sure that all the GNOME and GTK+ libraries are
|
||
correctly installed. Another important thing to be kept in mind
|
||
is that the library's path must be correctly set before trying to
|
||
compile any code.</p>
|
||
|
||
<p>Let's first consider the widget creation
|
||
function, gnome_app_new(). This function as shown returns a
|
||
GtkWidget pointer, which is the generic widget. This maybe shown
|
||
as:</p>
|
||
|
||
<p>GtkWidget *ghosh;<br>
|
||
ghosh = gnome_app_new(………);</p>
|
||
|
||
<p>Please note that this also means that if we want
|
||
to call a GnomeApp specific function such as gnome_app_set_menus(),
|
||
then we have to use a macro to perform the cast from a
|
||
GtkWidget type to a GnomeApp type; which is only possible because
|
||
GnomeApp is derived from GtkWidget (see hierarchy above).</p>
|
||
|
||
<p><font size="5"><strong>4. </strong></font><a
|
||
name="A basic program"><font size="5"><strong>A basic program</strong></font></a></p>
|
||
|
||
<p>The best way to learn Linux programming is to
|
||
understand the internal workings of the kernel and by doing
|
||
programming yourself. So, let's now look at a small program to
|
||
understand the subject matter better.</p>
|
||
|
||
<p>Boot your system in Linux, and if you are in the
|
||
CLI (command line interface) mode, switch over to gnome, using the
|
||
command "switchdesk gnome", and then issue a
|
||
"startx" command to boot into the X Window System GUI
|
||
mode. Once into the GNOME environment, open the GNOME Terminal,
|
||
create a file named myapp.c using vi, and type in the following:</p>
|
||
|
||
<blockquote>
|
||
<p>/* A sample GNOME program<br>
|
||
Created By: Subhasish Ghosh<br>
|
||
Date: 8th August, 2001<br>
|
||
*/</p>
|
||
<p>#include <gnome.h></p>
|
||
<p>int main(int argc, char *argv[ ])<br>
|
||
{<br>
|
||
</p>
|
||
<blockquote>
|
||
<p>GtkWidget *ghosh;<br>
|
||
gnome_init("sample", "0.1", argc,
|
||
argv);<br>
|
||
ghosh = gnome_app_new("sample", "My
|
||
Window");<br>
|
||
gtk_widget_show(ghosh);</p>
|
||
<p>gtk_main();<br>
|
||
return 0;</p>
|
||
</blockquote>
|
||
<p>} </p>
|
||
</blockquote>
|
||
|
||
<p>Now, to compile the program myapp.c, make sure
|
||
you type in: (note the back-ticks carefully)</p>
|
||
|
||
<p><strong># gcc myapp.c -o myapp `gnome-config
|
||
--cflags --libs gnomeui`</strong></p>
|
||
|
||
<p>Note, GNOME comes with a shell script named <strong>gnome-config</strong>
|
||
that supplies the compiler with the correct flags required for
|
||
compilation. Once compiled, run the program using the command:</p>
|
||
|
||
<p><strong># ./myapp</strong> &<br>
|
||
and press enter.</p>
|
||
|
||
<p>An empty window will appear on the screen, which
|
||
you can move, resize, as well close. Now, let's take a closer
|
||
look at the code. At the top, we introduced a few commented
|
||
lines, describing the program, it's creator and date of creation.
|
||
Though not necessary, it's a good programming practice to include
|
||
those to each and every program. Then, we included the header
|
||
file, gnome.h, that takes care of all necessary GNOME and GTK+
|
||
library functions and definitions. Then comes "ghosh",
|
||
which is a GtkWidget pointer. This would point to our new Window
|
||
object. The function gnome_init is then called. It initializes
|
||
libraries, and is used for correct session management. The ID
|
||
passed to this gnome_init function is "sample", the
|
||
version number being "0.1", and then the usual command
|
||
line arguments of main. These are necessary for the internal
|
||
workings of GNOME. Then comes the function gnome_app_new(),
|
||
which when executed, creates our window. This takes two arguments,
|
||
as shown in the sample code: "sample" and "My
|
||
Window". "sample" is the application name,
|
||
and "My Window" is the window title. But please
|
||
note: Though the name of this function is gnome_app_new(); it
|
||
does NOT create any sort of new application or so. It creates a
|
||
top-level window, that's all. The next function called is
|
||
gtk_widget_show(), which makes our window visible. Next comes
|
||
gtk_main() which is a very important function, as it makes sure
|
||
that GNOME functions such as events nd button presses are executed, by
|
||
handing on the functionality to GNOME.</p>
|
||
|
||
<p>So, that's the internal workings of our first
|
||
GNOME program.</p>
|
||
|
||
<p><font size="5"><strong>5. </strong></font><a
|
||
name="Signals & Callbacks"><font size="5"><strong>Signals
|
||
& Callbacks</strong></font></a></p>
|
||
|
||
<p>Now let's take a deeper look into the GNOME
|
||
programming environment: "Signals" and
|
||
"Callbacks". What are these and what are they
|
||
used for? Do we really need them? Every single time the mouse
|
||
moves, enters and leaves widgets, buttons are pressed, toggle
|
||
buttons are toggled on or off, and such things are done, a signal
|
||
is sent to the application. This signal can be passed to a
|
||
callback function. So, though not always, yet at times,
|
||
applications need to connect to these events for taking certain
|
||
actions. In GNOME/GTK+, we call a function called
|
||
gtk_signal_connect to connect signals to handler functions.</p>
|
||
|
||
<p>The gtk_signal_connect function has the following
|
||
4 parameters:</p>
|
||
|
||
<ol>
|
||
<li><p>GtkObject *object -- Which widget the
|
||
callback is associated with.</p>
|
||
</li>
|
||
<li><p>const gchar *name -- The signal to be
|
||
handled.</p>
|
||
</li>
|
||
<li><p>GtkSignalFunc func -- The function to be
|
||
called when the signal is sent.</p>
|
||
</li>
|
||
<li><p>gpointer data -- Any arbitrary data to be
|
||
given to the signal handling function.</p>
|
||
</li>
|
||
</ol>
|
||
|
||
<p>It should be noted that various kinds of widgets
|
||
emit different signals. The signals from buttons are as follows:</p>
|
||
|
||
<ol>
|
||
<li><p>clicked -- Button clicked (pressed &
|
||
released).</p>
|
||
</li>
|
||
<li><p>pressed -- Button pressed down by mouse.</p>
|
||
</li>
|
||
<li><p>released -- Button released.</p>
|
||
</li>
|
||
<li><p>enter -- Mouse moved over the Button
|
||
area.</p>
|
||
</li>
|
||
<li><p>leave -- Mouse moved out of the Button
|
||
area.</p>
|
||
</li>
|
||
</ol>
|
||
|
||
<p>We will look into signals and callbacks playing a
|
||
vital role in the applications that we would develop later.</p>
|
||
|
||
<p><font size="5"><strong>6. </strong></font><a
|
||
name="Containers"><font size="5"><strong>Containers</strong></font></a></p>
|
||
|
||
<p>Next, we look into another vital component of
|
||
GNOME programming: containers. GTK+ uses containers a great deal,
|
||
because GTK+ is actually a "<strong>container-based</strong>"
|
||
toolkit. That means we have a parent container within which we
|
||
have to place our other widgets. Windows are single widget
|
||
containers. Thus, the important point to keep in mind is that
|
||
GTK+ utilizes invisible "packing boxes" which can hold
|
||
multiple widgets to create windows layouts. These "packing
|
||
boxes" are of two types: horizontal and vertical, created by
|
||
using the functionality of the functions gtk_hbox_new and
|
||
gtk_vbox_new, respectively. We would see these functions in
|
||
action soon, in the applications that we create later. For now,
|
||
let's take a look into the parameters of these two functions. They
|
||
have the following parameters:</p>
|
||
|
||
<ol>
|
||
<li><p><strong>homogeneous</strong> : type
|
||
--> gboolean : Forces all widgets in the box to occupy
|
||
the same area as the largest widget in the box. </p>
|
||
</li>
|
||
<li><p><strong>spacing</strong> : type -->
|
||
gint : Determines the space between adjacent widgets.</p>
|
||
</li>
|
||
<li><p><strong>expand</strong> : type -->
|
||
gboolean : Allows the packing box to expand to fill the
|
||
remaining space.</p>
|
||
</li>
|
||
<li><p><strong>fill</strong> : type -->
|
||
gboolean : Allows that particular widget to expand to
|
||
fill the remaining space.</p>
|
||
</li>
|
||
<li><p><strong>padding</strong> : type -->
|
||
gint : Determines the width of a frame surrounding the
|
||
widget.</p>
|
||
</li>
|
||
</ol>
|
||
|
||
<p><font size="5"><strong>7. </strong></font><a
|
||
name="Buttons"><font size="5"><strong>Buttons</strong></font></a></p>
|
||
|
||
<p>Next we come to another very vital component:
|
||
Buttons. GTK+ provides 4 different kinds of buttons:</p>
|
||
|
||
<ol>
|
||
<li><p>Simple push buttons --> To perform an
|
||
action on clicking.</p>
|
||
</li>
|
||
<li><p>Toggle buttons --> With a particular
|
||
state: Up/Down</p>
|
||
</li>
|
||
<li><p>Check boxes --> With a particular
|
||
state: On/Off </p>
|
||
</li>
|
||
<li><p>Radio buttons --> For making only one
|
||
selection from a group of options.</p>
|
||
</li>
|
||
</ol>
|
||
|
||
<p>Creating radio buttons is very similar to check
|
||
boxes, and all that we need to do extra is to specify a group the
|
||
radio button belongs to. Radio buttons are derived from check
|
||
buttons, which are derived from toggle buttons, so this means
|
||
that we have the same set of functions to read and modify their
|
||
state and also use the same old events. Please note: For more
|
||
information of specific functions, consult the <em><strong>GTK+
|
||
Reference Documentation</strong></em> available at: <a
|
||
href="http://www.gtk.org">http://www.gtk.org</a></p>
|
||
|
||
<p><font size="5"><strong>8. </strong></font><a
|
||
name="Entry Widgets"><font size="5"><strong>Entry Widgets</strong></font></a></p>
|
||
|
||
<p>For creating single-line text widgets, which are
|
||
commonly called "Entry widgets", we utilize a function
|
||
called gtk_entry_new(). Entry widgets are mainly used to enter
|
||
small amounts of information. Let's know take a look at a program
|
||
that creates a "Login Window", and outputs the password
|
||
field, when the activate signal occurs, when the button is
|
||
pressed. Type in the following and execute the program as has
|
||
been explained above.</p>
|
||
|
||
<p>/* Creating a Login GNOME-style using GTK+
|
||
Toolkit:<br>
|
||
Created By: Subhasish Ghosh<br>
|
||
Date: Wednesday, August 8, 2001<br>
|
||
*/</p>
|
||
|
||
<p>#include <gnome.h></p>
|
||
|
||
<p>static void enter_pressed(GtkWidget *button,
|
||
gpointer data)<br>
|
||
{<br>
|
||
GtkWidget *text_entry = data;<br>
|
||
char *string = gtk_entry_get_text(GTK_ENTRY(text_entry));<br>
|
||
g_print(string);<br>
|
||
}</p>
|
||
|
||
<p>int main(int argc, char *argv[])<br>
|
||
{<br>
|
||
GtkWidget *app;<br>
|
||
GtkWidget *text_entry;<br>
|
||
GtkWidget *label;<br>
|
||
GtkWidget *hbox; gchar *text;</p>
|
||
|
||
<p>gnome_init("example", "0.1",
|
||
argc, argv);<br>
|
||
app = gnome_app_new("example", "entry
|
||
widget");<br>
|
||
gtk_container_border_width(GTK_CONTAINER(app), 5);</p>
|
||
|
||
<p>hbox = gtk_hbox_new(FALSE, 0);</p>
|
||
|
||
<p>/* we now create a Label: */<br>
|
||
label = gtk_label_new("Password: ");<br>
|
||
gtk_misc_set_alignment(GTK_MISC(label), 0, 1.0);<br>
|
||
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);</p>
|
||
|
||
<p>text_entry = gtk_entry_new();<br>
|
||
gtk_entry_set_visibility(GTK_ENTRY(text_entry), FALSE);<br>
|
||
gtk_box_pack_start(GTK_BOX(hbox), text_entry, FALSE, FALSE, 0);</p>
|
||
|
||
<p>gtk_signal_connect(GTK_OBJECT(app),
|
||
"delete_event", GTK_SIGNAL_FUNC(gtk_main_quit), NULL);<br>
|
||
gtk_signal_connect(GTK_OBJECT(text_entry), "activate",
|
||
GTK_SIGNAL_FUNC(enter_pressed), text_entry);</p>
|
||
|
||
<p>gnome_app_set_contents(GNOME_APP(app), hbox);<br>
|
||
gtk_widget_show_all(app);<br>
|
||
gtk_main( );<br>
|
||
return 0;<br>
|
||
}</p>
|
||
|
||
<p>This program when executed, a login window should
|
||
appear on the screen. Type in any text (assuming it to be a
|
||
password), press enter and observe what happens.</p>
|
||
|
||
<p><font size="5"><strong>9. </strong></font><a
|
||
name="List boxes and Combo boxes"><font size="5"><strong>List
|
||
boxes and Combo boxes</strong></font></a></p>
|
||
|
||
<p>List boxes and Combo boxes play the same role as
|
||
they play on the Microsoft platform. List box widgets hold a list
|
||
of strings that allow users to select one or more entries;
|
||
concerned the widget is so configured. Combo boxes are entry
|
||
widgets with an added pull-down menu that allow users to select
|
||
options also.</p>
|
||
|
||
<p><font size="5"><strong>10. </strong></font><a
|
||
name="Menus & Toolbars"><font size="5"><strong>Menus &
|
||
Toolbars</strong></font></a></p>
|
||
|
||
<p>The various widgets that we have come across
|
||
until now are simple widgets that don't provide some
|
||
extra-ordinary functionality. We now look at some specific GNOME
|
||
programming libraries that offer more complicated widgets with
|
||
rich functionality.</p>
|
||
|
||
<p>Just hang on for a second, someone may ask:
|
||
"Hey, we were doing pretty well with ordinary code and all
|
||
the stuff that you discussed earlier. What's the use of this
|
||
so-called "specific GNOME programming libraries"? Are
|
||
they indeed useful? Or are you just including them here for
|
||
making your article a bit longer?"</p>
|
||
|
||
<p>Well, here's the reason for considering specific
|
||
GNOME programming libraries. With plain GTK+ code, though nearly
|
||
everything can be done, which we usually would do using specific
|
||
GNOME programming libraries, but using simple and plain GTK+ code
|
||
often leads to much code repetition, inefficient code blocks and
|
||
such other things, making the whole program a bloated
|
||
one. Now, to prevent this from happening, we use specific GNOME
|
||
programming libraries that provide a great deal of extra
|
||
functionality and much lower programming overhead.</p>
|
||
|
||
<p>So, let's talk about "Menus" and
|
||
"Toolbars". GNOME lets us create menus
|
||
and toolbars for our GnomeApp widgets that can be docked and
|
||
undocked from the window. First you fill up arrays with the
|
||
necessary information, then call gnome_app_create_menus
|
||
or gnome_app_create_toolbar.</p>
|
||
|
||
<p>The menus and toolbar items each have properties, defined in
|
||
arrays.
|
||
A few such properties include type,
|
||
string, callback pointer, etc. Most of the time the menu
|
||
entries are pretty simple, and we can just use one of a set of
|
||
macros provided by GNOME to create the structure for us. So
|
||
let's check out a few of the most used top-level macros.</p>
|
||
|
||
<p>Please note: These macros are the ones
|
||
that create top-level menus when passed an array containing
|
||
any or all of the following GnomeUIInfo structures.</p>
|
||
<div align="center"><center>
|
||
|
||
<table border="3" cellpadding="4" cellspacing="4">
|
||
<tr>
|
||
<td align="center" bgcolor="#FFFFFF"><u>Menu</u></td>
|
||
<td align="center" bgcolor="#FFFFFF"><u>Macro</u></td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">File</td>
|
||
<td align="center" bgcolor="#00FFFF">GNOMEUIINFO_MENU_FILE_TREE(tree)</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">Edit</td>
|
||
<td align="center" bgcolor="#00FFFF">GNOMEUIINFO_MENU_EDIT_TREE(tree)</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">View</td>
|
||
<td align="center" bgcolor="#00FFFF">GNOMEUIINFO_MENU_VIEW_TREE(tree)</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">Settings</td>
|
||
<td align="center" bgcolor="#00FFFF">GNOMEUIINFO_MENU_SETTINGS_TREE(tree)</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">Windows</td>
|
||
<td align="center" bgcolor="#00FFFF">GNOMEUIINFO_MENU_WINDOWS_TREE(tree)</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">Help</td>
|
||
<td align="center" bgcolor="#00FFFF">GNOMEUIINFO_MENU_HELP_TREE(tree)</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" bgcolor="#00FFFF">Game</td>
|
||
<td align="center" bgcolor="#00FFFF">GNOMEUIINFO_MENU_GAME_TREE(tree)</td>
|
||
</tr>
|
||
</table>
|
||
</center></div>
|
||
|
||
<p>Within the top-level menu there exists over
|
||
thirty macros for creating common menu items. The macros
|
||
associate small images (pixmaps) and accelerator keys with each
|
||
menu item. A callback function is required to be called when the
|
||
item is selected and a data pointer is to be passed to that
|
||
function.</p>
|
||
|
||
<p>Let's look at some of these common menu items and
|
||
their respective macros.</p>
|
||
|
||
<p><strong><u>File</u></strong> -->><br>
|
||
New --> GNOMEUIINFO_MENU_NEW_ITEM (label, hint, cb, data)<br>
|
||
Open --> GNOMEUIINFO_MENU_OPEN_ITEM (cb, data)<br>
|
||
Save --> GNOMEUIINFO_MENU_SAVE_ITEM (cb, data)<br>
|
||
Print --> GNOMEUIINFO_MENU_PRINT_ITEM (cb, data)<br>
|
||
Exit --> GNOMEUIINFO_MENU_EXIT_ITEM (cb, data)</p>
|
||
|
||
<p><strong><u>Edit</u></strong> -->><br>
|
||
Cut --> GNOMEUIINFO_MENU_CUT_ITEM (cb, data)<br>
|
||
Copy --> GNOMEUIINFO_MENU_COPY_ITEM (cb, data)<br>
|
||
Paste --> GNOMEUIINFO_MENU_PASTE_ITEM (cb, data)</p>
|
||
|
||
<p><strong><u>Settings</u></strong> -->><br>
|
||
Preferences --> GNOMEUIINFO_MENU_PREFERENCES_ITEM (cb, data)</p>
|
||
|
||
<p><strong><u>Help</u></strong> -->><br>
|
||
About --> GNOMEUIINFO_MENU_ABOUT_ITEM (cb, data)</p>
|
||
|
||
<p>Like menu bars, toolbars require an
|
||
array using the GNOMEUIINFO_ITEM_STOCK (label, tooltip, callback,
|
||
stock_id) macro. Here, "stock_id" is the id of a
|
||
predefined icon that we want to use for that item.</p>
|
||
|
||
<p>Let's look at this example, and see how the
|
||
arrays and macros work in reality.</p>
|
||
|
||
<p>#include <gnome.h></p>
|
||
|
||
<p>static void callback (GtkWidget *button, gpointer
|
||
data)<br>
|
||
{<br>
|
||
g_print("Item Selected");<br>
|
||
}</p>
|
||
|
||
<p>GnomeUIInfo file_menu[ ] = {<br>
|
||
GNOMEUIINFO_ITEM_NONE ("A menu item", "This is the
|
||
Status bar info", callback),<br>
|
||
GNOMEUIINFO_MENU_EXIT_ITEM (gtk_main_quit, NULL),<br>
|
||
GNOMEUIINFO_END<br>
|
||
};</p>
|
||
|
||
<p>GnomeUIInfo menubar[ ] = {<br>
|
||
GNOMEUIINFO_MENU_FILE_TREE (file_menu),<br>
|
||
GNOMEUIINFO_END<br>
|
||
};</p>
|
||
|
||
<p>GnomeUIInfo toolbar[ ] = {<br>
|
||
GNOMEUIINFO_ITEM_STOCK ("Print", "This is another
|
||
tooltip", callback, GNOME_STOCK_PIXMAP_PRINT),<br>
|
||
GNOMEUIINFO_ ITEM_STOCK ("Exit", "Exit the
|
||
application", gtk_main_quit, GNOME_STOCK_PIXMAP_EXIT),<br>
|
||
GNOMEUIINFO_END<br>
|
||
};</p>
|
||
|
||
<p>int main (int argc, char *argv[ ])<br>
|
||
{</p>
|
||
|
||
<p>GtkWidget *app;</p>
|
||
|
||
<p>gnome_init ("example", "0.1",
|
||
argc, argv);<br>
|
||
app = gnome_app_new ("example", "A Sample Toolbar
|
||
and Menu");</p>
|
||
|
||
<p>gnome_app_create_menus (GNOME_APP (app),
|
||
menubar);<br>
|
||
gnome_app_create_toolbar (GNOME_APP (app), toolbar);</p>
|
||
|
||
<p>gtk_widget_show_all (app);<br>
|
||
gtk_main();<br>
|
||
return 0;</p>
|
||
|
||
<p>}</p>
|
||
|
||
<p>This program creates a small window with
|
||
an embedded menu and toolbar. You can click,
|
||
dock, undock and drag it around the screen.</p>
|
||
|
||
<p><font size="5"><strong>11. </strong></font><a
|
||
name="Dialog boxes"><font size="5"><strong>Dialog boxes</strong></font></a></p>
|
||
|
||
<p>Let's now look at the widget that displays
|
||
textual information to the user in the GNOME environment. Yes, we
|
||
are referring to the Dialog box. When we need to create dialog
|
||
boxes, we call the gnome_message_box_new function and pass it the
|
||
message text, also mention the type of dialog box we need, and
|
||
the buttons we want on it. All of this mentioned in a NULL
|
||
terminated list. Then we bind the "clicked" signal of
|
||
the dialog widget that we have just created to a handling
|
||
function that is passed the button that the user pressed as an
|
||
integer. Finally, we call the gtk_widget_show function for
|
||
displaying a non-modal box.</p>
|
||
|
||
<p>Let's look at this code extract from a program,
|
||
which creates a simple question dialog box, adds three buttons
|
||
and responds to the user's code.</p>
|
||
|
||
<p>static void messagebox_clicked(GnomeDialog *dlg,
|
||
gint button, gpointer data)<br>
|
||
{</p>
|
||
|
||
<p>switch (button)<br>
|
||
{</p>
|
||
|
||
<p>case 1: /* user pressed apply */ <br>
|
||
return;</p>
|
||
|
||
<p>case 0: /* user pressed ok */</p>
|
||
|
||
<p>case 2: /* user pressed close */<br>
|
||
gnome_dialog_close(dlg);</p>
|
||
|
||
<p>}</p>
|
||
|
||
<p>}</p>
|
||
|
||
<p>GtkWidget *dlg;</p>
|
||
|
||
<p>dlg = gnome_message_box_new("Hi, pal, how
|
||
are you doing??? I am fine!",<br>
|
||
GNOME_MESSAGE_BOX_QUESTION,<br>
|
||
GNOME_STOCK_BUTTON_OK,<br>
|
||
GNOME_STOCK_BUTTON_APPLY,<br>
|
||
GNOME_STOCK_BUTTON_CLOSE,<br>
|
||
NULL);</p>
|
||
|
||
<p>gtk_signal_connect (GTK_OBJECT(dlg),
|
||
"clicked", GTK_SIGNAL_FUNC(messagebox_clicked), NULL);</p>
|
||
|
||
<p>gtk_widget_show (dlg);</p>
|
||
|
||
<p><font size="5"><strong>12. </strong></font><a
|
||
name="Conclusion & Links for Further study"><font size="5"><strong>Conclusion
|
||
& Links for Further study</strong></font></a></p>
|
||
|
||
<p>This sums up our journey of the exciting world of
|
||
GNOME programming using GTK+ toolkit.</p>
|
||
|
||
|
||
<p>Please note: GNOME Programming is not at all
|
||
difficult. Once you have a little understanding, it's
|
||
really easy to grasp. There is still much more to learn after this
|
||
article, but if done diligently, it can definitely be mastered.</p>
|
||
|
||
<p>For more information and detailed coverage of
|
||
this topic, check out the following links: </p>
|
||
|
||
<p><a
|
||
href="http://www.linuxheadquarters.com/howto/programming/gtk_examples/index.shtml">http://www.linuxheadquarters.com/howto/programming/gtk_examples/index.shtml</a></p>
|
||
|
||
<p><a
|
||
href="http://www.ibiblio.org/pub/Linux/docs/HOWTO/mini/other-formats/html_single/Programming-Languages.html">http://www.ibiblio.org/pub/Linux/docs/HOWTO/mini/other-formats/html_single/Programming-Languages.html</a></p>
|
||
|
||
<p><a
|
||
href="http://linuxheadquarters.com/howto/programming/gtk_examples/window/window.shtml">http://linuxheadquarters.com/howto/programming/gtk_examples/window/window.shtml</a></p>
|
||
|
||
<p><a
|
||
href="http://developer.gnome.org/doc/GGAD/ggad.html">http://developer.gnome.org/doc/GGAD/ggad.html</a></p>
|
||
|
||
<p><a
|
||
href="http://wolfpack.twu.net/docs/gtkdnd/index.html">http://wolfpack.twu.net/docs/gtkdnd/index.html</a></p>
|
||
|
||
|
||
|
||
|
||
|
||
<!-- *** BEGIN bio *** -->
|
||
<SPACER TYPE="vertical" SIZE="30">
|
||
<P>
|
||
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Subhasish Ghosh</H4>
|
||
<EM>I am
|
||
20 years old, currently a computer-systems engineering student in
|
||
India. I am a Microsoft Certified Professional (MCP), MSCD, MCP
|
||
certified on NT 4.0, recently completed Red Hat Linux Certified
|
||
Engineer (RHCE) Training. I have been working with Linux for a
|
||
long time, have had programmed using C, C++, VC++, VB, COM, DCOM,
|
||
MFC, ATL 3.0, Perl, Python and Linux programming using GTK+.
|
||
Currently busy learning the Linux kernel Architecture in detail
|
||
and doing Linux kernel Programming. </EM>
|
||
|
||
<!-- *** END bio *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <!-- P -->
|
||
<H5 ALIGN=center>
|
||
|
||
Copyright © 2001, Subhasish Ghosh.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
||
</H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<center>
|
||
<H1><font color="maroon">Homer's Open Source Odyssey 2001: Classical Computing and a
|
||
Brief History of Open
|
||
Source</font></H1>
|
||
<H4>By <a href="mailto:mcgucken@jollyroger.com">Elliot McGucken</a></H4>
|
||
</center>
|
||
<P> <HR> <P>
|
||
|
||
<!-- END header -->
|
||
|
||
|
||
|
||
<P> Today we are continuing along on the same open-source journey
|
||
Homer set out upon three thousand years ago, when he shared the words of
|
||
<EM>The Odyssey</EM> with an audience and enriched them with the knowledge of a
|
||
classic's ineffable truths. The story was passed along from generation to
|
||
generation as part of an oral tradition for a few hundred of years, before
|
||
it was transcribed around 700 BC. The invention of the printing press
|
||
and movable type by Gutenberg circa 1445 aided in the sharing of
|
||
classical information, and suddenly the Bible, as well as works such as
|
||
<EM>The Odyssey</EM>, found a far greater audience.
|
||
|
||
<P>
|
||
With the advent of the
|
||
Internet the content and the audience have augmented vastly. And of even
|
||
greater significance, with the new paradigms afforded by information
|
||
technology, classical computing has joined the ranks of immortal art,
|
||
science, and literature. In the past few years, we have played witness to
|
||
a revolutionary era of humanity's cultural journey, wherein technology and
|
||
ideas have merged in a brave new digital world, rendering knowledge as
|
||
affordable as it is eternal.
|
||
|
||
<P> Software is labor immortalized, as a programmer's algorithm, once
|
||
written, may continue to function for eternity. Thus now, in addition to
|
||
inheriting the cultural riches of our predecessors, we may also inherit
|
||
the functionality of their programs. In a world where commerce is defined
|
||
by the movement of information, that machinery--the hardware and
|
||
software--which moves the information embodies work, and thus the
|
||
innovations of one's predecessors will not only bestow aesthetic riches,
|
||
but they shall also provide a wellspring of eternal labor. A hundred
|
||
years from now Hamlet shall still be contemplating the correct course of
|
||
action, and the Linux kernel, along with Apache, shall still be providing
|
||
the fundamental labor which transports Hamlet all about the watery globe.
|
||
|
||
<P> In software, language has becomes action. Never before has an
|
||
individual commanded so much wealth, so many man-hours of innovation. In
|
||
the past decade, those man-hours have increased geometrically, as the
|
||
network has enabled the collaboration of thousands of the best and
|
||
brightest programmers.
|
||
|
||
<P> Whereas in Jefferson's day it took three days and a horse's labor
|
||
to deliver a letter from Philadelphia to Washington, today one can
|
||
instantaneously send a message to the far corners of the watery globe by
|
||
utilizing the inherited wealth born of the millions of hours that millions
|
||
of scientists have spent theorizing, millions of innovators have spent
|
||
innovating, and millions of engineers have spent engineering--one can use
|
||
this collective wealth for free. All one has to do is log on to the new
|
||
paradigm of classical computing.
|
||
|
||
<P> Over two-thousand-five-hundred years ago the Greeks developed an architecture
|
||
which was passed along to the Romans via open-source methods. In
|
||
1675, about seventy years after Shakespeare penned Hamlet, Newton claimed
|
||
he saw further because he "stood upon the shoulders of giants," and he
|
||
invented calculus. A hundred years later a poet by the name of
|
||
William Blake penned the verse wherein he saw the world in a grain of sand
|
||
and found eternity within an hour. Since then, via the open source of
|
||
modern physics, space has become time, time has become space, and Blake's
|
||
grain of sand has become a silicon chip, which holds not only entire
|
||
worlds, but also all of the art, music, and poetry ever known to humanity.
|
||
And these vast open-source riches, from condensed matter physics, to the
|
||
complete works of Shakespeare, are free to all. Thus it is that those who
|
||
open books or log on are granted an inheritance as never before.
|
||
|
||
<P> The very freedoms which are so fundamental to our everyday existence
|
||
were passed down by a classical open-source method. The Declaration of
|
||
Independence has inspired the likes of Ghandi and the students in
|
||
Tiannamen Square, and the noble document's author, Thomas Jefferson, once
|
||
stated stated that there was nothing new within its words, but that he had
|
||
merely edited the better parts of history. Concerning the Declaration of
|
||
Independence, Jefferson wrote:
|
||
|
||
<BLOCKQUOTE>
|
||
Neither aiming at originality of principle or sentiment, nor yet copied
|
||
from any particular and previous writing, it was intended to be an
|
||
expression of the American mind, and to give to that expression the proper
|
||
tone and spirit called for by the occasion. All its authority rests then on
|
||
the harmonizing sentiments of the day, whether expressed in conversation,
|
||
in letters, printed essays, or in the elementary books of public right, as
|
||
Aristotle, Cicero, Locke, Sidney, &c.
|
||
</BLOCKQUOTE>
|
||
|
||
<P>
|
||
|
||
The classics represent the center and circumference of humanity's
|
||
open-source movement. Like calculus, the transistor, the
|
||
microprocessor, C, and Linux, they were created for little in the way
|
||
of stock options, and shared not so much for fame and fortune, but
|
||
because they had to be, because they worked and accomplished the task
|
||
of helping us find words for our thoughts, music for our feelings,
|
||
solutions for our technical hurdles, and meaning for our lives.
|
||
|
||
<P>
|
||
|
||
Not too long ago John Doerr of Kleiner Perkins said that the Internet age
|
||
had fostered the greatest legal creation of wealth. Instead I would argue
|
||
that it has afforded the greatest inheritance of wealth, for on the
|
||
Internet we are standing upon the shoulders of giants with names like
|
||
Shockley, Bohr, Faraday, Einstein, Jefferson, Dirac, Aristotle, Moses,
|
||
Copernicus, Shakespeare, and Newton. And as Newton himself acknowledged
|
||
that he had stood upon the shoulders of giants, so it is that today we are
|
||
standing upon the shoulders of giants who stood upon the shoulders of
|
||
giants.
|
||
|
||
<P> Recorded culture is humanity's single greatest invention, and it is a
|
||
tower built from the open source of the ages, with foundations thousands
|
||
of years deep, reaching back to the dawn of civilization and language
|
||
itself. Today we are standing upon the shoulders of countless innovators
|
||
and educators: all the typesetters and teachers throughout the ages who
|
||
kept the language alive and the aesthetic beacon lit, all the prophets and
|
||
poets, all the inventors and innovators who built the first presses, who
|
||
pioneered quantum mechanics, and who selflessly pushed forward the
|
||
open-source technology, philosophy, and software of the Internet age.
|
||
Venture Capital is a very recent innovation, and because individuals,
|
||
rather than money, invent new technologies, VC has played little if any
|
||
role in the development of the internet, as it was used primarily for
|
||
seeding pyramid schemes wherein savvy MBAs could momentarily pretend
|
||
they were high-tech entrepreneurs.
|
||
|
||
<P>
|
||
We are standing upon the shoulders of the Founding Fathers
|
||
who humbly recognized our fundamental freedom in the face of mysteries
|
||
greater than ourselves, who penned an open-source Constitution in homage
|
||
to those higher laws which grant us our natural freedoms. An open-source
|
||
Constitution which could be amended by the people, and which has been
|
||
freely distributed about the globe, and adapted and adopted in country
|
||
after country, in city after city, in heart after heart. An open-source
|
||
Constitution in which they set in words the laws which today encourage
|
||
innovators by allowing them to own their ideas via copyrights, patents,
|
||
and trademarks.
|
||
|
||
<P> In fact, the only place where the word "right" is mentioned in the
|
||
Constitution is in relation to intellectual property:
|
||
|
||
|
||
<BLOCKQUOTE>
|
||
The Congress shall have Power To promote the Progress of Science and
|
||
useful Arts, by securing for limited Times to Authors and Inventors the
|
||
exclusive Right to their respective Writings and Discoveries;
|
||
</BLOCKQUOTE>
|
||
|
||
<P>
|
||
|
||
But when more and more intellectual property is inherited rather than
|
||
created, when more and more lawyers and hypesters are employed by
|
||
corporations to convince judges and juries of the grandiose merits of
|
||
some trifling innovation, is the true innovator benefiting?
|
||
|
||
<P>
|
||
As the contemporary innovator stands upon more and more giants, perhaps
|
||
the patenting process devolves into a game of semantics, wherein some
|
||
"innovators" attempt to claim credit for others' monuments by calling a
|
||
rose by a different name. For instance, when Jeff Bezos patented
|
||
"one-click shopping", he was in essence giving a new name to the cookie
|
||
technology which is intrinsic to the browser, which maintains state and
|
||
stores the identity of the user. Jeff Bezos had nothing to do with the
|
||
development of that technology, yet he was still awarded the patent.
|
||
|
||
<P>
|
||
|
||
<STRONG>
|
||
Patents are supposed to encourage innovation by protecting the inventor's
|
||
rights to profit from their inventions, but it is hard to imagine how far
|
||
along we'd be today if every aspect of the C language had been patented
|
||
as it evolved, if every new subroutine or algorithm was handed to the
|
||
lawyers before it was presented to other programmers, or if Tim Berners Lee
|
||
had patented the fundamentals of the Internet. With hundreds of
|
||
Internet companies penning patents and creating dubious boundaries, erecting
|
||
fences on a wide open frontier which they did not discover nor create, it
|
||
is more likely that
|
||
lawyers will profit as opposed to innovation.</STRONG>
|
||
|
||
<P>
|
||
|
||
The realm of open source and "classical computing" may represent a
|
||
hybrid paradigm, wherein programming is closer in essence to physics
|
||
and mathematics than it is to inventing the world's first functional
|
||
airplane, or the first light bulb. One cannot patent scientific laws
|
||
nor mathematical concepts, and thus physics and mathematics have always
|
||
been open-source endeavours.
|
||
|
||
<P>
|
||
|
||
In programming the fundamental algorithms are immutable ideals, and
|
||
though they may be used as machines to ferry information about the
|
||
globe, when one attempts to patent the machine, one is perhaps trying
|
||
to take too much credit for the algorithms developed by others, or for
|
||
immutable ideals which were always there. It
|
||
seems that more and more innovations in contemporary information
|
||
technology are dwarfed by the giants upon which they are based, for
|
||
what sole inventor or invention can be greater than the open platform
|
||
upon which it is invented, such as Linux and C++?
|
||
|
||
<P>
|
||
|
||
The GNU General Public License takes the "standing upon the shoulders of
|
||
giants" aspect of software development into account, as it states:
|
||
<blockquote>
|
||
Finally, any free program is threatened constantly by software patents.
|
||
We wish to avoid the danger that redistributors of a free program will
|
||
individually obtain patent licenses, in effect making the program
|
||
proprietary. To prevent this, we have made it clear that any patent must
|
||
be licensed for everyone's free use or not licensed at all.
|
||
</blockquote>
|
||
|
||
If one builds upon code developed under the GNU License, the new code
|
||
inherits the GNU Copyleft, thereby keeping the source open, and
|
||
acknowledging the former giants of innovation and good will.
|
||
|
||
<P>
|
||
|
||
When the division between the legal mind and the innovating mind grows, as
|
||
has been encouraged by the fact that only lawyers can practice law (except
|
||
for the cases where one represents oneself), what can quickly happen is
|
||
that the laws founded to encourage innovation begin to encourage lawyers
|
||
at the innovator's expense, as it is difficult for the typical inventor to
|
||
keep up with the ever-evolving game of legal semantics. Indeed, the men
|
||
who penned the Constitution believed that the common man would be capable
|
||
of comprehending the law--otherwise what good could laws be in a
|
||
democratic republic? Perhaps innovators should be made to file and defend
|
||
their own patents, or patent nothing at all, and lawyers should only be
|
||
allowed to file patents for that which they themselves have invented.
|
||
This would keep well-funded corporations from hiring legions of lawyers to
|
||
file ambiguous patents with sweeping claims. For if the legal system can
|
||
determine that Microsoft has a monopoly in the arena of the desktop
|
||
operating system, then certainly that same legal system should recognize
|
||
that lawyers have monopolized the legal system, taxing all innovation as
|
||
the arbiters of others' copyrights, patents, and trademarks.
|
||
|
||
<P>
|
||
|
||
All the major innovations upon which the Internet is based were made
|
||
before 1995, from TCP/IP to Sendmail, Apache, Perl, Mosaic, and Netscape.
|
||
None of these innovations were patented. After 1995 we encountered the
|
||
irony that although the Internet was built by individuals seeking truth
|
||
and beauty in functionality, it was hyped by hundreds of corporations led
|
||
by MBAs and "visonary" CEOs who had very little to do with true
|
||
innovation, who registered thousands of trademarks and patented spurious
|
||
technological innovations, and who ultimately created thousands of
|
||
worthless companies which lost far more than they ever made, except for
|
||
the insiders and the bankers.
|
||
|
||
|
||
<P>
|
||
|
||
And yet, it is a misconception that the open-source movement in general
|
||
opposes intellectual property rights, although at times a few adherents
|
||
or government bureaucrats seem to be drawn towards the open-source
|
||
movement because they believe it supports a form of communism. Rather,
|
||
most
|
||
open-sourcers are opposed to the patenting of other's innovations and
|
||
trying to pass them off as one's own in a game of legal semantics.
|
||
|
||
<P>
|
||
|
||
Benjamin Franklin, an open-sourcer who was certainly not a communist,
|
||
turned down the opportunity to patent the Franklin Stove, "on the
|
||
principle that 'as we enjoy great advantages from the inventions of
|
||
others, we should be glad of an opportunity to serve others by any
|
||
invention of ours; and this we should do freely and generously." But
|
||
at the same time, he didn't believe that the government should fund the
|
||
development of the Franklin stove, nor did he ever speak out against
|
||
the rights which inventors should have to their own innovations, nor
|
||
did he ever contend that the government should have the role of
|
||
redistributing his Franklin stove. Open source is about the
|
||
individual--it is about the innovator, the end-user, not about the
|
||
administrators nor the hypesters, who so often seek to ride on the
|
||
coattails of others' achievements, whether they reside in a corporate
|
||
or government bureaucracy.
|
||
|
||
<P>
|
||
Regarding the ownership of intellectual property via copyrights, Mark Twain
|
||
once addressed the United States Congress with:
|
||
<blockquote>
|
||
I am aware that copyright must have a limit, because that is required by
|
||
the Constitution of the United States, which sets aside the earlier
|
||
Constitution, which we call the decalogue. The decalogue says you shall
|
||
not take away from any man his profit. I don't like to be obliged to use
|
||
the harsh term. What the decalogue really says is, "Thou shalt not steal,"
|
||
but I am trying to use more polite language.
|
||
</blockquote>
|
||
|
||
Twain goes on to offer a good defense of the protection of "ideas which
|
||
did not exist before" as property:
|
||
<blockquote>
|
||
I put a supposititious case, a dozen Englishmen who travel through South
|
||
Africa and camp out, and eleven of them see nothing at all; they are
|
||
mentally blind. But there is one in the party who knows what this harbor
|
||
means and what the lay of the land means. To him it means that some day a
|
||
railway will go through here, and there on that harbor a great city will
|
||
spring up.
|
||
<P>
|
||
That is his idea. And he has another idea, which is to go and trade his
|
||
last bottle of Scotch whiskey and his last horse-blanket to the principal
|
||
chief of that region and buy a piece of land the size of Pennsylvania.
|
||
That was the value of an idea that the day would come when the Cape to
|
||
Cairo Railway would be built.
|
||
<P>
|
||
Every improvement that is put upon the real estate is the result of an
|
||
idea in somebody's head. The skyscraper is another idea; the railroad is
|
||
another; the telephone and all those things are merely symbols which
|
||
represent ideas. An andiron, a wash-tub, is the result of an idea that did
|
||
not exist before.
|
||
<P>
|
||
So if, as that gentleman said, a book does consist solely of ideas, that
|
||
is the best argument in the world that it is property, and should not be
|
||
under any limitation at all.
|
||
|
||
</blockquote>
|
||
<P>Although Twain would like to keep his intellectual property in this case,
|
||
while Franklin aims to give his away, they both seem to agree that intellectual
|
||
property is property, and that individuals should have the right to choose what
|
||
they do with it. And as patents and copyrights have limits, eventually the source
|
||
of all intellectual property becomes open.
|
||
<P>
|
||
|
||
|
||
The Wright brothers' names are still on the fundamental patents which
|
||
describe the design of the navigational systems on all modern airplanes.
|
||
Such fundamental patents as this help inspire the innovators in their life
|
||
times, allowing them to reap the benefits of what they develop, and too,
|
||
when they expire, the open knowledge, which one can improvise upon without
|
||
the fear of a lawsuit, allows for further innovations. To determine the
|
||
"right" duration of a patent or a copyright will always be a difficult
|
||
task, and perhaps modern technological innovations, most of which are
|
||
based on yesteryear's far greater monuments of innovation, should be
|
||
granted patents with a shorter duration.
|
||
|
||
|
||
<P>
|
||
Another common misconception is that Red Hat Linux and Microsoft are at
|
||
opposite ends of the open-source spectrum, but they are in fact very similar.
|
||
Both operating systems developed by the publicly-traded
|
||
companies were mostly written in the open source of the C computing
|
||
language (the language itself is an open specification), both were built upon
|
||
the open-source science and technology found within the silicon chip, and both
|
||
benefit from intellectual property rights to their respective trademarks,
|
||
copyrights, and patents. Both use the open source of the English language, and
|
||
both openly share volumes of useful information on their web sites. Microsoft
|
||
chooses to keep more of their coding proprietary, thus guaranteeing better pay
|
||
for their programmers, while Red Hat opens the source, thereby allowing anyone
|
||
to contribute, but lowering the direct monetary compensation of those who do.
|
||
|
||
<P> Also, Microsoft has offered a far better return for the common
|
||
investor and worker, not just for the insiders. Perhaps there is not as
|
||
much money to be made out of a global network of open-source programmers
|
||
as Red Hat and other public linux companies once trumpeted. Perhaps the
|
||
true wealth of the open-source movement is inherited by the webmasters who
|
||
utilize the code, by the entrepreneurs who download the open-source tools
|
||
and applications to power entire portals of their own creation. Like the
|
||
free market, it seems that in the long run the Internet favors the rugged
|
||
individual, the renaissance man, over the bureaucracy led by the
|
||
administrator and hypester.
|
||
|
||
<P> For certain user-friendly applications, such as office suites and
|
||
other software used by non-programmers, Microsoft has the upper hand, as
|
||
paying programmers to write word-processing applications and office suites
|
||
makes sense. The majority of hard-core programmers probably don't care
|
||
about font colors and integration with PowerPoint and spreadsheets quite
|
||
as much as they care about streamlining Apache or enhancing Linux
|
||
security.
|
||
|
||
<P> But when it comes to servers, the open-source paradigm provides a
|
||
superior system, as the more technically-inclined--the ones who actually
|
||
build and configure the servers--are allowed to get under the hood and
|
||
enhance the performance. Whereas a typical author or MBA would probably
|
||
never want to hack away at PowerPoint or Microsoft Word to get cooler
|
||
fonts, those who have built and configured their own servers don't mind
|
||
spending a few sleepless nights to add functionality. And by
|
||
sharing their accomplishments on the Internet, they may receive that
|
||
priceless respect from fellow gurus, and benefit themselves while
|
||
benefiting others, as the improvements that they bestow upon their fellow
|
||
programmers may in turn be improved upon, while the bugs may be fixed by
|
||
any one of thousands of experts.
|
||
|
||
<P> There is a beauty in efficiency and functionality, and the
|
||
programmer's aesthetic is very similar to Einstein's, who once said,
|
||
"Everything should be made as simple as possible, but not more so."
|
||
There is room for both Microsoft and Linux, and as Eric Raymond pointed
|
||
out in a recent Wall Street Journal article, there is little need for the
|
||
government to interfere--Linux will continue to spread throughout the
|
||
server market, as it contains all the inherent advantages of open source.
|
||
|
||
<P> If history has demonstrated anything, it is that truth, beauty,
|
||
and freedom are the favored traditions, and thus classical computing, born
|
||
upon the ancient open-source paradigm, shall prosper throughout the rest
|
||
of eternity.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- *** BEGIN bio *** -->
|
||
<SPACER TYPE="vertical" SIZE="30">
|
||
<P>
|
||
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Elliot McGucken</H4>
|
||
<EM> As a Ph.D. physicist and the CEO of "The World's Classical Portal" at
|
||
<A HREF="http://jollyroger.com">jollyroger.com</A> I rely on everything open
|
||
source, from forums, to shopping carts, to linux, apache, php, perl, and the
|
||
condensed matter physics which affords the silicon computer chip. I first
|
||
encountered Linux in 1994, when I used it to run VLSI design software on my
|
||
home PC. </A>
|
||
|
||
|
||
<!-- *** END bio *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <!-- P -->
|
||
<H5 ALIGN=center>
|
||
|
||
Copyright © 2001, Elliot McGucken.<BR>
|
||
Copying license <A
|
||
HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
||
</H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<center>
|
||
<H1><font color="maroon">Numerical Workbenches, part II</font></H1>
|
||
<H4>By <a href="mailto:cspiel@hammersmith-consulting.com">Christoph Spiel</a></H4>
|
||
</center>
|
||
<P> <HR> <P>
|
||
|
||
<!-- END header -->
|
||
|
||
|
||
|
||
|
||
<p>In
|
||
<A HREF="../issue69/spiel.html">Part I</A> ,
|
||
we looked at the most basic operations of the numerical
|
||
workbenches GNU/Octave 2.1.34, Scilab 2.6, and Tela 1.32. This
|
||
time we will talk about matrices, have a look at some of the predefined
|
||
functions, learn how to write our own functions, and introduce flow control
|
||
statements. The article closes with a brief discussion of the applications'
|
||
input and output facilities.</p>
|
||
|
||
<h2><a name="matrices">Matrices</a></h2>
|
||
|
||
<p>Vectors help a lot if data depend on a single parameter. The different
|
||
parameter values are reflected by different index values. If data depend on
|
||
two parameters, vectors are a clumsy container and a more general structure,
|
||
which allows for two independent indices is needed. Such a structure is called
|
||
a matrix. Matrices are packed like a fresh six-pack: they are rectangular
|
||
storage containers and no bottle -- oops -- element is missing.</p>
|
||
|
||
<p>Matrices are, for example, built from scalars as the next transcript of a
|
||
GNU/Octave session demonstrates.</p>
|
||
|
||
<pre>
|
||
octave:1> # temperature rain sunshine
|
||
octave:1> # degF inches hours
|
||
octave:1> weather_data = [ 73.4, 0.0, 10.8; ...
|
||
> 70.7, 0.0, 8.5; ...
|
||
> 65.2, 1.3, 0.7; ...
|
||
> 68.2, 0.2, 4.1]
|
||
weather_data =
|
||
</pre>
|
||
|
||
<pre>
|
||
73.40000 0.00000 10.80000
|
||
70.70000 0.00000 8.50000
|
||
65.20000 1.30000 0.70000
|
||
68.20000 0.20000 4.10000
|
||
</pre>
|
||
|
||
<p>Three new ideas appear in the example. First, we have introduced some
|
||
comments to label the columns of our matrix. A comment starts with a pound
|
||
sign ``<code>#</code>'' and extends until the end of the line. Second,
|
||
the rows of a matrix are separated by semi-colons ``<code>;</code>'', and
|
||
third, if an expression stretches across two or more lines, the unfinished
|
||
lines must end with the line-continuation operator ``<code>...</code>''.</p>
|
||
|
||
<p>Similarly to vectors, matrices can not only be constructed from scalars, but
|
||
from vectors or other matrices. If we had some variables holding the weather
|
||
data of each day, like</p>
|
||
|
||
<pre>
|
||
weather_mon = [73.4, 0.0, 10.8]
|
||
weather_tue = [70.7, 0.0, 8.5]
|
||
weather_wed = [65.2, 1.3, 0.7]
|
||
weather_thu = [68.2, 0.2, 4.1]
|
||
</pre>
|
||
|
||
<p>we would have defined <code>weather_data</code> with</p>
|
||
|
||
<pre>
|
||
weather_data = [weather_mon; weather_tue; weather_wed; weather_thu]
|
||
</pre>
|
||
|
||
<p>or, on the other hand, if we had the data from the various instruments
|
||
as</p>
|
||
|
||
<pre>
|
||
temperature = [73.4; 70.7; 65.2; 68.2]
|
||
rain = [0.0; 0.0; 1.3; 0.2]
|
||
sunshine = [10.8; 8.5; 0.7; 4.1]
|
||
</pre>
|
||
|
||
<p>we would have defined <code>weather_data</code> with</p>
|
||
|
||
<pre>
|
||
weather_data = [temperature, rain, sunshine]
|
||
</pre>
|
||
|
||
<p>The fundamental rule is: <em>Commas separate columns, semi-colons separate
|
||
rows.</em></p>
|
||
|
||
<p>The scalars living in matrix <code>m</code> are accessed by applying
|
||
two indices: <code>m(row, column)</code>, where <em>row</em> is the row-index,
|
||
and <em>column</em> is the column index. Thus, the amount of rain fallen on
|
||
Wednesday is fetched with the expression</p>
|
||
|
||
<pre>
|
||
octave:10> weather_data(3, 2)
|
||
ans = 1.3000
|
||
</pre>
|
||
|
||
<p>Entries are changed by assigning to them:</p>
|
||
|
||
<pre>
|
||
octave:11> weather_data(3, 2) = 1.1
|
||
weather_data =
|
||
</pre>
|
||
|
||
<pre>
|
||
73.40000 0.00000 10.80000
|
||
70.70000 0.00000 8.50000
|
||
65.20000 1.10000 0.70000
|
||
68.20000 0.20000 4.10000
|
||
</pre>
|
||
|
||
<p>Now that we have defined <code>weather_data</code> we want to work with it.
|
||
We can apply all binary operations that we have seen in last month's article
|
||
on vectors. However, for this particular example, computing</p>
|
||
|
||
<pre>
|
||
rain_forest_weather_data = weather_data + 2.1
|
||
siberian_summer_weather_data = weather_data / 3.8
|
||
</pre>
|
||
|
||
<p>does not make much sense, though the computer will not complain at all. In
|
||
the first example it would dutifully add <code>2.1</code> to every element of
|
||
<code>weather_data</code>, in the second it would -- obedient like a sheepdog
|
||
-- divide each element by <code>3.8</code>.</p>
|
||
|
||
<p>Say we want to do something meaningful to <code>weather_data</code> and
|
||
convert all temperatures from degrees Fahrenheit to degrees Celsius. To that
|
||
end, we need to access all elements in the first column. The vector of
|
||
interest is</p>
|
||
|
||
<pre>
|
||
octave:16> temp = [weather_data(1, 1); ...
|
||
> weather_data(2, 1); ...
|
||
> weather_data(3, 1); ...
|
||
> weather_data(4, 1)]
|
||
temp =
|
||
</pre>
|
||
|
||
<pre>
|
||
73.400
|
||
70.700
|
||
65.200
|
||
68.200
|
||
</pre>
|
||
|
||
<p>Obviously, the row-indices <code>[1, 2, 3, 4]</code>
|
||
form a vector themselves. We can use a shortcut and write this vector of
|
||
indices as</p>
|
||
|
||
<pre>
|
||
temp = weather_data([1, 2, 3, 4], 1)
|
||
</pre>
|
||
|
||
<p>In general, any vector may be used as index vector. Just watch out that no
|
||
index is out of range. Ordering of the indices does matter (for example <code>
|
||
weather_data([2, 1, 4, 3], 1)</code> puts Tuesday's temperature in front) and
|
||
repeated indices are permitted (for example <code>weather_data([3, 3, 3, 3, 3,
|
||
3, 3], 1)</code> holds Wednesday's temperature seven times).</p>
|
||
|
||
<p>In our example, the index-vector can be generated by a special built-in,
|
||
the range generation operator ``<code>:</code>''. To make a vector that
|
||
starts at <em>low</em> and contains all integers from <em>low</em> to <em>
|
||
high</em>, we say</p>
|
||
|
||
<pre>
|
||
low:high
|
||
</pre>
|
||
|
||
<p>For example</p>
|
||
|
||
<pre>
|
||
octave:1> -5:2
|
||
ans =
|
||
</pre>
|
||
|
||
<pre>
|
||
-5 -4 -3 -2 -1 0 1 2
|
||
</pre>
|
||
|
||
<p>Our weather data example now simplifies to</p>
|
||
|
||
<pre>
|
||
temp = weather_data(1:4, 1)
|
||
</pre>
|
||
|
||
<p>Accessing a complete column or row is so common that further shortcuts
|
||
exist. If we drop both, <em>low</em> and <em>high</em> from the
|
||
colon-operator, it will generate all valid column indices for us. Therefore,
|
||
we reach at the shortest form to get all elements in the first column.</p>
|
||
|
||
<pre>
|
||
octave:17> temp = weather_data(:, 1)
|
||
temp =
|
||
</pre>
|
||
|
||
<pre>
|
||
73.400
|
||
70.700
|
||
65.200
|
||
68.200
|
||
</pre>
|
||
|
||
<p>With our new knowledge, we extract the sunshine hours on Tuesday,
|
||
Wednesday, and Thursday</p>
|
||
|
||
<pre>
|
||
octave:19> sunnyhours = weather_data(2:4, 3)
|
||
sunnyhours =
|
||
</pre>
|
||
|
||
<pre>
|
||
8.50000
|
||
0.70000
|
||
4.10000
|
||
</pre>
|
||
|
||
<p>and Tuesday's weather record</p>
|
||
|
||
<pre>
|
||
octave:20> tue_all = weather_data(2, :)
|
||
tue_all =
|
||
</pre>
|
||
|
||
<pre>
|
||
70.70000 0.00000 8.50000
|
||
</pre>
|
||
|
||
<p>Now it is trivial to convert the data on the rain from inches to
|
||
millimeters: Multiply the second column of <code>weather_data</code> by 25.4
|
||
(Millimeters per Inch) to get the amount of rain in metric units:</p>
|
||
|
||
<pre>
|
||
octave:21> rain_in_mm = 25.4 * weather_data(:, 2)
|
||
rain_in_mm =
|
||
</pre>
|
||
|
||
<pre>
|
||
0.00000
|
||
0.00000
|
||
27.94000
|
||
5.08000
|
||
</pre>
|
||
|
||
<p>We have already seen that vectors are compatible with scalars</p>
|
||
|
||
<pre>
|
||
1.25 + [0.5, 0.75, 1.0]
|
||
</pre>
|
||
|
||
<p>or</p>
|
||
|
||
<pre>
|
||
[-4.49, -4.32, 1.76] * 2
|
||
</pre>
|
||
|
||
<p>Scalars are also compatible with matrices.</p>
|
||
|
||
<pre>
|
||
octave:1> 1.25 + [ 0.5, 0.75, 1.0; ...
|
||
> -0.75, 0.5, 1.25; ...
|
||
> -1.0, -1.25, 0.5]
|
||
ans =
|
||
</pre>
|
||
|
||
<pre>
|
||
1.75000 2.00000 2.25000
|
||
0.50000 1.75000 2.50000
|
||
0.25000 0.00000 1.75000
|
||
</pre>
|
||
|
||
<pre>
|
||
octave:2> [-4.49, -4.32, 1.76; ...
|
||
> 9.17, 6.35, 3.27] * 2
|
||
ans =
|
||
</pre>
|
||
|
||
<pre>
|
||
-8.9800 -8.6400 3.5200
|
||
18.3400 12.7000 6.5400
|
||
</pre>
|
||
|
||
<p>In each case the result is the scalar applied to every element in the
|
||
vector or matrix.</p>
|
||
|
||
<p>How about vectors and matrices? Obviously, an expressions like</p>
|
||
|
||
<pre>
|
||
[7, 4, 9] + [3, 2, 7, 6, 6]
|
||
[2, 4; 1, 6] - [1, 1, 9, 4]
|
||
</pre>
|
||
|
||
<p>do not make any sense. In the first line the vectors disagree in size (3
|
||
vs. 5 elements), in the second line they have different shapes
|
||
(2 columns and 2 rows vs. 4 columns and 1 row). To make
|
||
sense, vectors or matrices that are used in an addition or subtraction must
|
||
have the same shape, which means the same number of rows and the same number
|
||
of columns. The technical term for ``shape'' in this context is dimension. We
|
||
can query the dimension of anything with the built-in function <code>
|
||
size()</code>.</p>
|
||
|
||
<pre>
|
||
octave:22> size(weather_data)
|
||
ans =
|
||
</pre>
|
||
|
||
<pre>
|
||
4 3
|
||
</pre>
|
||
|
||
<pre>
|
||
octave:23> size(sunnyhours)
|
||
ans =
|
||
</pre>
|
||
|
||
<pre>
|
||
3 1
|
||
</pre>
|
||
|
||
<p>The answer is a vector whose first element is the number of rows, and whose
|
||
second element is the number of columns of the argument.</p>
|
||
|
||
<p>Multiplication and division of matrices can be defined in two flavors, both
|
||
of which are implemented in the numerical workbenches.</p>
|
||
|
||
<ul>
|
||
<li>Element by element multiplication or division of two vectors or matrices
|
||
of same dimensions: The number in the first row and first column of the first
|
||
matrix is multiplied by the number in the first row and first column of the
|
||
second matrix and so on for every element.
|
||
|
||
<pre>
|
||
a = [3, 3; ...
|
||
6, 4; ...
|
||
6, 3]
|
||
b = [9, 3; ...
|
||
8, 2; ...
|
||
0, 3]
|
||
</pre>
|
||
|
||
<pre>
|
||
octave:1> a .* b
|
||
ans =
|
||
</pre>
|
||
|
||
<pre>
|
||
27 9
|
||
48 8
|
||
0 9
|
||
</pre>
|
||
|
||
<p>The element-by-element operators are preceded by a dot: element-by-element
|
||
multiplication ``<code>.*</code>'' and element-by-element division
|
||
``<code>./</code>''.</p>
|
||
</li>
|
||
|
||
<li>Matrix multiplication as known from Linear Algebra: <em>
|
||
c</em> = <em>a</em> * <em>b</em>, where <em>a</em> is a <em>
|
||
p</em>-times-<em>q</em> matrix and <em>b</em> is a <em>
|
||
q</em>-times-<em>r</em> matrix. The result <em>c</em> is a <em>
|
||
p</em>-times-<em>r</em> matrix.
|
||
|
||
<p>Example:</p>
|
||
|
||
<pre>
|
||
a = [3, 3; ...
|
||
6, 4; ...
|
||
6, 3]
|
||
</pre>
|
||
|
||
<pre>
|
||
b = [-4, 0, 1, -4; ...
|
||
-1, -3, 2, 0]
|
||
</pre>
|
||
|
||
<pre>
|
||
octave:1> a * b
|
||
ans =
|
||
</pre>
|
||
|
||
<pre>
|
||
-15 -9 9 -12
|
||
-28 -12 14 -24
|
||
-27 -9 12 -24
|
||
</pre>
|
||
|
||
<p>Although we have not seen <code>for</code>-loops yet (they will be discussed
|
||
<a href="#flow control statements">farther down</a>), I would like to write
|
||
the code behind the matrix multiplication operator ``<code>*</code>'' to
|
||
give the reader an impression of the operations involved.</p>
|
||
|
||
<pre>
|
||
for i = 1:p
|
||
for j = 1:r
|
||
sum = 0
|
||
for k = 1:q
|
||
sum = sum + a(i, k)*b(k, j)
|
||
end
|
||
c(i, j) = sum
|
||
end
|
||
end
|
||
</pre>
|
||
|
||
<p>Compare these triply nested <code>for</code>-loops with the simple
|
||
expression <code>c = a * b</code>.</p>
|
||
</li>
|
||
|
||
<li>Matrix division? You cannot divide by a matrix! However, operator
|
||
``<code>/</code>'' is defined for vectors and matrices. But writing <em>
|
||
x</em> = <em>b</em> / <em>a</em>, where <em>a</em> and <em>
|
||
b</em> are matrices or vectors has nothing to do with division at all! It
|
||
means: please solve the system of linear equations
|
||
|
||
<pre>
|
||
x * a = b
|
||
</pre>
|
||
|
||
<p>for <em>x</em>, given matrix <em>a</em> and the
|
||
right-hand-side(s) <em>b</em>. Here ``<code>*</code>'' denotes matrix
|
||
multiplication as defined in the previous item, and the same rules for
|
||
compatible dimensions of <em>a</em> and <em>b</em> apply.</p>
|
||
|
||
<pre>
|
||
a = [-2, 3, 1; ...
|
||
7, 8, 6; ...
|
||
2, 0, -1]
|
||
</pre>
|
||
|
||
<pre>
|
||
b = [-26, 5, -6; ...
|
||
24, 53, 26]
|
||
</pre>
|
||
|
||
<pre>
|
||
octave:1> x = b / a
|
||
x =
|
||
</pre>
|
||
|
||
<pre>
|
||
7.00000 -2.00000 1.00000
|
||
7.00000 4.00000 5.00000
|
||
</pre>
|
||
|
||
<p>Isn't that an easy way to solve a system of linear equations? Imagine you
|
||
had to write the code which does exactly that.</p>
|
||
|
||
<p>Finally, let us verify the result by multiplying with <em>a</em> again</p>
|
||
|
||
<pre>
|
||
octave:2> x*a
|
||
ans =
|
||
</pre>
|
||
|
||
<pre>
|
||
-26.0000 5.0000 -6.0000
|
||
24.0000 53.0000 26.0000
|
||
</pre>
|
||
|
||
<p>which, as expected, recovers <em>b</em>.</p>
|
||
</li>
|
||
</ul>
|
||
|
||
<p><strong>Details</strong></p>
|
||
|
||
<ul>
|
||
<li>For convenience GNU/Octave and Scilab define an alternative matrix
|
||
division operator ``<code>\</code>''. <em>x</em> = <em>
|
||
a</em> \ <em>b</em> solves the linear system of equations
|
||
|
||
<pre>
|
||
a * x = b
|
||
</pre>
|
||
|
||
<p>for <em>x</em>, given matrix <em>a</em> and the
|
||
right-hand-side(s) <em>b</em>. This is the form most users prefer,
|
||
because here <em>x</em> is a column vector, whereas
|
||
operator ``<code>/</code>'' returns <em>x</em> as row-vector.</p>
|
||
</li>
|
||
|
||
<li>operator ``<code>\</code>'' has the dotted cousin ``<code>.\</code>''
|
||
and the relation <em>a</em> ./ <em>b</em> == <em>
|
||
b</em> .\ <em>a</em> holds.</li>
|
||
</ul>
|
||
|
||
<p><strong>Differences</strong></p>
|
||
|
||
<ul>
|
||
<li>Scilab and Tela use C++-like comments
|
||
|
||
<pre>
|
||
// This is a Scilab or a Tela comment
|
||
</pre>
|
||
</li>
|
||
|
||
<li>Tela does not need or understand the line continuation operator
|
||
``<code>...</code>''
|
||
|
||
<pre>
|
||
weather_data = #(73.4, 0.0, 10.8;
|
||
70.7, 0.0, 8.5;
|
||
65.2, 1.3, 0.7;
|
||
68.2, 0.2, 4.1)
|
||
</pre>
|
||
|
||
<p>In interactive mode, Tela does not handle multi-line expressions as the
|
||
above. Multi-line expressions must be read from a file (with <code>
|
||
source("filename.t")</code>).</p>
|
||
</li>
|
||
|
||
<li>In Tela the operators ``<code>*</code>'' and ``<code>/</code>'' work
|
||
element by element, this is, they work like ``<code>.*</code>'' and
|
||
``<code>./</code>'' do in GNU/Octave and Scilab. Matrix multiplication
|
||
(<em>a</em> * <em>b</em> in GNU/Octave or Scilab) is written as
|
||
|
||
<pre>
|
||
a ** b
|
||
</pre>
|
||
|
||
<p>or</p>
|
||
|
||
<pre>
|
||
matmul(a, b)
|
||
</pre>
|
||
|
||
<p>solving systems of linear equations (<em>b</em> / <em>a</em> in
|
||
Octave or Scilab) as</p>
|
||
|
||
<pre>
|
||
linsolve(a, b)
|
||
</pre>
|
||
</li>
|
||
</ul>
|
||
|
||
<h2><a name="builtin matrix functions">Built-In Matrix Functions</a></h2>
|
||
|
||
<p>Ugh -- far too many to mention! The workbenches supply dozens of predefined
|
||
functions. Here I can only wet the reader's
|
||
appetite.</p>
|
||
|
||
<dl>
|
||
<dt><strong><a name="item_Generating_Special_Matrices">Generating Special
|
||
Matrices</a></strong><br>
|
||
</dt>
|
||
|
||
<dd>Several matrices occur often enough in computations that they have been
|
||
given their own generating functions. These are for example, <em>
|
||
m</em>-times-<em>n</em> matrices filled with zeros: <code>zeros(m, n)</code>
|
||
or ones: <code>ones(m, n)</code>, or <em>n</em>-times-<em>n</em> diagonal
|
||
matrices, where the diagonal consists entirely of ones: <code>eye(n)</code> or
|
||
the diagonal is set to numbers supplied in a vector: <code>diag([a1, a2, ...,
|
||
I<an>])</code>.</dd>
|
||
|
||
<dt><strong><a name="item_Analyzing_Matrices">Analyzing
|
||
Matrices</a></strong><br>
|
||
</dt>
|
||
|
||
<dd>Getting the smallest or largest element in matrix <em>a</em>: <code>
|
||
min(a)</code>, <code>max(a)</code>, or totaling matrix <em>a</em>: <code>
|
||
sum(a)</code>.
|
||
|
||
<p><strong>Differences:</strong> GNU/Octave's <code>min(a)</code>, <code>
|
||
max(a)</code>, and <code>sum(a)</code> return the column-wise result as a row
|
||
vector. To get the minimum, maximum, and sum of all elements in
|
||
matrix <em>a</em>, use <code>min(min(a))</code>, <code>
|
||
max(max(a))</code>, <code>sum(sum(a))</code>.</p>
|
||
</dd>
|
||
|
||
<dt><strong><a name="item_Linear_Algebra">Linear Algebra</a></strong><br>
|
||
</dt>
|
||
|
||
<dd>We mentioned that systems of linear equations, like <em>
|
||
x</em> * <em>a</em> = <em>b</em>, are solved for <em>x</em>
|
||
with the slash operator ``<code>/</code>''. But many more linear algebra
|
||
functions exist, for example singular value decomposition: <code>
|
||
svd(a)</code>, or eigenvalue computation: <code>eig(a)</code>.
|
||
|
||
<p><strong>Differences:</strong> In Tela uses <code>SVD(a)</code> instead of
|
||
<code>svd(a)</code>, and instead of <code>eig(a)</code>, Scilab uses <code>
|
||
spec(a)</code> to compute the eigenvalue spectrum.</p>
|
||
</dd>
|
||
</dl>
|
||
|
||
<p>One note on performance: basically, all three applications are
|
||
interpreters. This means that each expression is first parsed, then the
|
||
interpreter performs desired computations, finally calling the functions
|
||
inside of the expressions -- all in all a relatively slow process in
|
||
comparison to a compiled program. However, functions like those shown above
|
||
are used in their compiled form! They execute almost at top speed. What the
|
||
interpreter does in these cases is to hand over the complete matrix to a
|
||
compiled Fortran, C, or C++ function, let it do all the work, and then
|
||
pick up the result.</p>
|
||
|
||
<p>Thus we deduce one of the fundamental rules for successful work with
|
||
numerical workbenches: prefer compiled functions over interpreted code.
|
||
It makes a tremendous difference in execution speed.</p>
|
||
|
||
<h2><a name="user defined functions">User Defined Functions</a></h2>
|
||
|
||
<p>No matter how many functions a program may provide its users, they are never
|
||
enough. Users always need specialized functions to deal with their problems,
|
||
or they simply want to group repeated, yet predefined operations. In other
|
||
words, there always is a need for user-defined functions.</p>
|
||
|
||
<p>User functions are best defined in files, so that they can be used again in
|
||
later sessions. For GNU/Octave, functions files end in <em>.m</em>, and are
|
||
loaded either <a href="#automagical_explanation">automagically</a> or with
|
||
<code>source("<em>filename.m</em>")</code>. Scilab calls its
|
||
function files <em>.sci</em>, and requires them to be loaded with <code>
|
||
getf("<em>filename.sci</em>")</code>. Tela functions are stored
|
||
in <em>.t</em>-files and loaded with <code>
|
||
source("<em>filename.t</em>")</code>. As big as the differences
|
||
are in loading functions, all workbenches use quite similar syntax for the
|
||
definition of functions.</p>
|
||
|
||
<p>GNU/Octave and Scilab</p>
|
||
|
||
<pre>
|
||
function [res1, res2, ..., resM] = foo(arg1, arg2, ..., argN)
|
||
# function body
|
||
endfunction
|
||
</pre>
|
||
|
||
<p>Tela</p>
|
||
|
||
<pre>
|
||
function [res1, res2, ..., resM] = foo(arg1, arg2, ..., argN)
|
||
{
|
||
// function body
|
||
};
|
||
</pre>
|
||
|
||
<p>where <em>arg1</em> to <em>argN</em> are the functions' arguments (also
|
||
known as parameters), and <em>res1</em> to <em>resN</em> are the return
|
||
values. Yes, trust your eyes, multiple return values are permitted, what might
|
||
come as a surprise to most readers who are acquainted with popular programming
|
||
languages. However, this is a necessity, as no function is allowed to change
|
||
any of its input arguments.</p>
|
||
|
||
<p>Enough theory! let us write a function that takes a matrix as input and
|
||
returns a matrix of the same dimensions, with the entries rescaled to lie in
|
||
the interval (0, 1).</p>
|
||
|
||
<pre>
|
||
### Octave
|
||
</pre>
|
||
|
||
<pre>
|
||
function y = normalize(x)
|
||
## Return matrix X rescaled to the interval (0, 1).
|
||
</pre>
|
||
|
||
<pre>
|
||
minval = min(min(x))
|
||
maxval = max(max(x))
|
||
</pre>
|
||
|
||
<pre>
|
||
y = (x - minval) / (maxval - minval)
|
||
endfunction
|
||
</pre>
|
||
|
||
<p>Now define a Scilab function that returns the spectral radius on a matrix.
|
||
We use <code>abs()</code> which returns the magnitude of its (possibly
|
||
complex) argument.</p>
|
||
|
||
<pre>
|
||
// Scilab
|
||
</pre>
|
||
|
||
<pre>
|
||
function r = spectral_radius(m)
|
||
// Return the spectral radius R of matrix M.
|
||
</pre>
|
||
|
||
<pre>
|
||
r = max(abs(spec(m)))
|
||
endfunction
|
||
</pre>
|
||
|
||
<p>Finally, we write a Tela function which computes the Frobenius norm of a
|
||
matrix.</p>
|
||
|
||
<pre>
|
||
// Tela
|
||
</pre>
|
||
|
||
<pre>
|
||
function x = frobenius(m)
|
||
// Return the Frobenius norm X of matrix M.
|
||
{
|
||
x = sqrt(sum(abs(m)^2))
|
||
};
|
||
</pre>
|
||
|
||
<p><strong>Details:</strong></p>
|
||
|
||
<a name="automagical_explanation"></a>
|
||
<p>GNU/Octave's ``automagical'' function file loading works the following way:
|
||
if Octave runs into an undefined function name it searches the list of
|
||
directories specified by the built-in variable <code>LOADPATH</code> for files
|
||
ending in .m that have the same base name as the undefined function; for
|
||
example, <code>x = my_square_root(2.0)</code> looks for the file <em>
|
||
my_square_root.m</em> in the directories listed in <code>LOADPATH</code>.</p>
|
||
|
||
<h2><a name="flow control statements">Flow Control Statements</a></h2>
|
||
|
||
<p>All code we have written thus far executes strictly top-to-bottom, we have
|
||
not used any flow control statements such as conditionals or loops.</p>
|
||
|
||
<p>Before we manipulate the flow of control, we should look at logical
|
||
expressions because the conditions used in conditionals and loops depend on
|
||
them. Logical expressions are formed from (1.) numbers,
|
||
(2.) comparisons, and (3.) logical expressions catenated with
|
||
logical operators.</p>
|
||
|
||
<ol>
|
||
<li>Zero means logically false, any number not equal to zero means logically
|
||
true, hence C-programmers should feel at home.</li>
|
||
|
||
<li>The usual gang of comparison operators exist: less-than
|
||
``<code><</code>'', less-or-equal ``<code><=</code>'', greater-than
|
||
``<code>></code>'', greater-or-equal ``<code>>=</code>'', and equal
|
||
``<code>==</code>''.
|
||
|
||
<p><strong>Differences:</strong> The inequality operator varies quite a bit
|
||
among the programs. (Octave cannot decide whether it feels like C, Smalltalk,
|
||
or Pascal. Scilab wants to be Smalltalk and Pascal at the same time. :-)</p>
|
||
|
||
<pre>
|
||
!= ~= <> # Octave
|
||
~= <> // Scilab
|
||
!= // Tela
|
||
</pre>
|
||
</li>
|
||
|
||
<li>Complex logical expressions are formed with logical operators ``and'',
|
||
``or'' and ``not'' whose syntax is borrowed from C. However, each program uses
|
||
its own set of operators. Thus, we have to list some
|
||
|
||
<p><strong>Differences:</strong></p>
|
||
|
||
<pre>
|
||
and or not
|
||
---- ---- ----
|
||
& | ! ~ # Octave
|
||
& | ~ // Scilab
|
||
&& || ! // Tela
|
||
</pre>
|
||
</li>
|
||
</ol>
|
||
|
||
<p>We are all set now for the first conditional, the <code>
|
||
if</code>-statement. Note that the parenthesis around the conditions are
|
||
mandatory (as they are in C). The <code>else</code>-branches are optional in
|
||
any case.</p>
|
||
|
||
<pre>
|
||
# Octave // Scilab // Tela
|
||
</pre>
|
||
|
||
<pre>
|
||
if (cond) if cond then if (cond) {
|
||
# then-body // then-body // then-body
|
||
else else } else {
|
||
# else-body // else-body // else-body
|
||
endif end };
|
||
</pre>
|
||
|
||
<p><em>cond</em> is a logical expression as described above.</p>
|
||
|
||
<p><code>while</code>-statements:</p>
|
||
|
||
<pre>
|
||
# Octave // Scilab // Tela
|
||
</pre>
|
||
|
||
<pre>
|
||
while (cond) while cond while (cond) {
|
||
# body // body // body
|
||
endwhile end };
|
||
</pre>
|
||
|
||
<p>Again, <em>cond</em> is a logical expression.</p>
|
||
|
||
<p><code>for</code>-statements in Octave and Scilab walk through the columns
|
||
of <em>expr</em> one by one. Most often <em>expr</em> will be a vector
|
||
generated with the range operator ``<code>:</code>'', like <code>for i =
|
||
1:10</code>. Tela's <code>for</code>-statement is the same as C's.</p>
|
||
|
||
<pre>
|
||
# Octave // Scilab // Tela
|
||
</pre>
|
||
|
||
<pre>
|
||
for var = expr for var = expr for (init; cond; step) {
|
||
# body // body // body
|
||
endfor end };
|
||
</pre>
|
||
|
||
<p>Here come some examples which only show things we have discussed so
|
||
far.</p>
|
||
|
||
<p>Octave</p>
|
||
|
||
<pre>
|
||
function n = catch22(x0)
|
||
## The famous catch-22 function: it is
|
||
## impossible to compute that it will
|
||
## stop for a specific input. Returns
|
||
## the number of loops.
|
||
</pre>
|
||
|
||
<pre>
|
||
n = 0
|
||
x = x0
|
||
while (x != 1)
|
||
if (x - floor(x/2)*2 == 0)
|
||
x = x / 2
|
||
else
|
||
x = 3*x + 1
|
||
endif
|
||
n = n + 1
|
||
endwhile
|
||
endfunction
|
||
</pre>
|
||
|
||
<p>Scilab</p>
|
||
|
||
<pre>
|
||
function m = vandermonde(v)
|
||
// Return the Vandermonde matrix M based on
|
||
// vector V.
|
||
</pre>
|
||
|
||
<pre>
|
||
[rows, cols] = size(v)
|
||
m = [] // empty matrix
|
||
if rows < cols then
|
||
for i = 0 : (cols-1)
|
||
m = [m; v^i]
|
||
end
|
||
else
|
||
for i = 0 : (rows-1)
|
||
m = [m, v^i]
|
||
end
|
||
end
|
||
endfunction
|
||
</pre>
|
||
|
||
<p>Tela</p>
|
||
|
||
<pre>
|
||
function vp = sieve(n)
|
||
// Sieve of Erathostenes; returns vector of
|
||
// all primes VP that are strictly less than
|
||
// 2*N. 1 is not considered to be a prime
|
||
// number in sieve().
|
||
{
|
||
vp = #(); // empty vector
|
||
if (n <= 2) { return };
|
||
</pre>
|
||
|
||
<pre>
|
||
vp = #(2);
|
||
flags = ones(1, n + 1);
|
||
for (i = 0; i <= n - 2; i = i + 1)
|
||
{
|
||
if (flags[i + 1])
|
||
{
|
||
p = i + i + 3;
|
||
vp = #(vp, p);
|
||
for (j = p + i; j <= n; j = j + p)
|
||
{
|
||
flags[j + 1] = 0
|
||
}
|
||
}
|
||
}
|
||
};
|
||
</pre>
|
||
|
||
<h2><a name="input/output">Input/Output</a></h2>
|
||
|
||
<p>We have been using with the workbenches a lot. At some point we would like
|
||
to call it a day, but we do not want to lose all of our work. Our functions
|
||
are already stored in files. It is time to see how to make our data
|
||
persist.</p>
|
||
|
||
<h3><a name="simple input and output">Simple Input and Output</a></h3>
|
||
|
||
<p>All three applications at least have one input/output (I/O) model that
|
||
borrows heavily from the C programming language. This model allows close
|
||
control of the items read or written. Often though, it is unnecessary to take
|
||
direct control over the file format written. If variables must be saved just
|
||
to be restored later, simplified I/O commands will do.</p>
|
||
|
||
<ul>
|
||
<li>Octave offers the most flexible solution with the <code>
|
||
save</code>/<code>load</code> command pair.
|
||
|
||
<pre>
|
||
save filename varname1 varname2 ... varnameN
|
||
</pre>
|
||
|
||
<p>saves the variables named <em>varname1</em>, <em>varname2</em>, ..., <em>
|
||
varnameN</em> in file <em>filename</em>. The complementary</p>
|
||
|
||
<pre>
|
||
load filename varname1 varname2 ... varnameN
|
||
</pre>
|
||
|
||
<p>command restores them from <em>filename</em>. If <code>load</code> is given
|
||
no variable names, all variables form <em>filename</em> are loaded. Handing
|
||
over names to <code>load</code> selects only the named variables for
|
||
loading.</p>
|
||
|
||
<p>Note that the <code>save</code> and <code>load</code> commands do not have
|
||
parenthesis and their arguments are separated by spaces not commas. Filename
|
||
and variable names are strings.</p>
|
||
|
||
<pre>
|
||
save "model.oct-data" "prantl" "reynolds" "grashoff"
|
||
load "model.oct-data" "reynolds"
|
||
</pre>
|
||
|
||
<p>By default <code>load</code> does not overwrite existing variables, but
|
||
complain with an error if the user tries to do so. When it is save to discard
|
||
of the values of existing variables, add option ``<code>-force</code>''
|
||
to <code>load</code>, like</p>
|
||
|
||
<pre>
|
||
load -force "model.oct-data" "reynolds"
|
||
</pre>
|
||
|
||
<p>and variable <code>reynolds</code> will be loaded from file <em>
|
||
model.oct-data</em> no matter whether it has existed before or not.</p>
|
||
</li>
|
||
|
||
<li>Scilab's simple I/O parallels that of GNU/Octave:
|
||
|
||
<pre>
|
||
save(filename, var1, var2, ..., varN)
|
||
</pre>
|
||
|
||
<p>However, the variables <em>var1</em>, ..., <em>varN</em> are not strings,
|
||
but appear literally. This means that the name of a variable is not stored in
|
||
the file. The association between name and contents is lost!</p>
|
||
|
||
<p>The complementary function</p>
|
||
|
||
<pre>
|
||
load(filename, varname1, varname2, ..., varnameN)
|
||
</pre>
|
||
|
||
<p>restores the contents of <em>filename</em> in the variables named <em>
|
||
varname1</em>, <em>varname2</em>, ... <em>varnameN</em>.</p>
|
||
</li>
|
||
|
||
<li>Tela lets the users save her variables with the
|
||
|
||
<pre>
|
||
save(filename, varname1, varname2, ..., varnameN)
|
||
</pre>
|
||
|
||
<p>function, preserving the association between variable name and variable
|
||
contents. The complementary</p>
|
||
|
||
<pre>
|
||
load(filename)
|
||
</pre>
|
||
|
||
<p>function loads all variables stored in <em>filename</em>. It is not
|
||
possible to select specific variables.</p>
|
||
</li>
|
||
</ul>
|
||
|
||
<h3><a name="matrix oriented i/o">Matrix Oriented I/O</a></h3>
|
||
|
||
<p>As we use matrices so often, specialized functions exist to load and save
|
||
whole matrices. Especially loading a matrix with a single command is
|
||
convenient and efficient to read data from experiments or other programs.</p>
|
||
|
||
<p>Let us assume, we have the ASCII file <em>datafile.ascii</em> which
|
||
contains the lines</p>
|
||
|
||
<pre>
|
||
# run 271
|
||
# 2000-4-27
|
||
#
|
||
# P/bar T/K R/Ohm
|
||
# ====== ====== ======
|
||
19.6 0.118352 0.893906e4
|
||
15.9846 0.1 0.253311e5
|
||
39.66 0.378377 0.678877e4
|
||
13.6 0.752707 0.00622945e4
|
||
12.4877 0.126462 0.61755e5
|
||
</pre>
|
||
|
||
<p>and sits in the current working directory. The file's five leading lines
|
||
are non-numeric. They are skipped by the workbenches, but possibly aid the
|
||
user in identifying her data. I have intentionally taken a data set which is
|
||
not neatly formatted, as are most data files. Matrix-loading functions split
|
||
the input at whitespace not at a specific column, thus they are happy with
|
||
<em>datafile.ascii</em>.</p>
|
||
|
||
<p>We load the data into GNU/Octave with</p>
|
||
|
||
<pre>
|
||
octave:1> data = load("datafile.ascii")
|
||
data =
|
||
</pre>
|
||
|
||
<pre>
|
||
1.9600e+01 1.1835e-01 8.9391e+03
|
||
1.5985e+01 1.0000e-01 2.5331e+04
|
||
3.9660e+01 3.7838e-01 6.7888e+03
|
||
1.3600e+01 7.5271e-01 6.2294e+01
|
||
1.2488e+01 1.2646e-01 6.1755e+04
|
||
</pre>
|
||
|
||
<p>or into Scilab</p>
|
||
|
||
<pre>
|
||
-->data = fscanfMat("datafile.ascii")
|
||
data =
|
||
</pre>
|
||
|
||
<pre>
|
||
! 19.6 0.118352 8939.06 !
|
||
! 15.9846 0.1 25331.1 !
|
||
! 39.66 0.378377 6788.77 !
|
||
! 13.6 0.752707 62.2945 !
|
||
! 12.4877 0.126462 61755. !
|
||
</pre>
|
||
|
||
<p>or into Tela</p>
|
||
|
||
<pre>
|
||
>data1 = import1("datafile.ascii")
|
||
>data1
|
||
#( 19.6, 0.118352, 8939.06;
|
||
15.9846, 0.1, 25331.1;
|
||
39.66, 0.378377, 6788.77;
|
||
13.6, 0.752707, 62.2945;
|
||
12.4877, 0.126462, 61755)
|
||
</pre>
|
||
|
||
<p>In all three examples data will contain a 5-times-3 matrix with all the
|
||
values from <em>datafile.ascii</em>.</p>
|
||
|
||
<p>The complementary commands for saving a single matrix in ASCII format
|
||
are</p>
|
||
|
||
<pre>
|
||
save("data.ascii", "data") # GNU/Octave
|
||
fprintfMat("data.ascii", data, "%12.6g") // Scilab
|
||
export_ASCII("data.ascii", data) // Tela
|
||
</pre>
|
||
|
||
<p>Note that Scilab's <code>fprintfMat()</code> requires a third parameter
|
||
that defines the output format with a C-style template string.</p>
|
||
|
||
<p>Of course none of the above save commands writes the original header, the
|
||
lines starting with hash-symbols, of <em>datafile.ascii</em>. To write these,
|
||
we need the ``low-level'', C-like input/output functions, which featured in
|
||
each of the three workbenches.</p>
|
||
|
||
<h3><a name="clike input/output">C-like Input/Output</a></h3>
|
||
|
||
<p>For a precise control of the input and the output, C-like I/O models are
|
||
offered. All three applications implement function</p>
|
||
|
||
<pre>
|
||
printf(format, ...)
|
||
</pre>
|
||
|
||
<p>Moreover, GNU/Octave and Tela follow the C naming scheme with their C-style
|
||
file I/O:</p>
|
||
|
||
<pre>
|
||
handle = fopen(filename)
|
||
fprintf(handle, format, ...)
|
||
fclose(handle)
|
||
</pre>
|
||
|
||
<p>whereas Scilab prefixes these functions with an ``<code>m</code>'' instead
|
||
of an ``<code>f</code>''</p>
|
||
|
||
<pre>
|
||
handle = mopen(filename)
|
||
mprintf(handle, format, ...)
|
||
mclose(handle)
|
||
</pre>
|
||
|
||
<p>Whether the function is called <code>fprintf()</code> or <code>
|
||
mprintf()</code>, they work the same way.</p>
|
||
|
||
<p><EM>Next Month: Graphics, function plotting and data plotting.</EM></p>
|
||
|
||
|
||
|
||
|
||
|
||
<!-- *** BEGIN bio *** -->
|
||
<SPACER TYPE="vertical" SIZE="30">
|
||
<P>
|
||
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Christoph Spiel</H4>
|
||
<EM>Chris runs an Open Source Software consulting company in Upper
|
||
Bavaria/Germany. Despite being trained as a physicist -- he holds a PhD in
|
||
physics from Munich University of Technology -- his main interests revolve
|
||
around numerics, heterogenous programming environments, and software
|
||
engineering. He can be reached at
|
||
<A HREF="mailto:cspiel@hammersmith-consulting.com">cspiel@hammersmith-consulting.com</A>.</EM>
|
||
|
||
<!-- *** END bio *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <!-- P -->
|
||
<H5 ALIGN=center>
|
||
|
||
Copyright © 2001, Christoph Spiel.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
||
</H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<center>
|
||
<H1><font color="maroon">CSL, The Common Sound Layer</font></H1>
|
||
<H4>By <a href="mailto:tranter@pobox.com">Jeff Tranter</a></H4>
|
||
</center>
|
||
<P> <HR> <P>
|
||
|
||
<!-- END header -->
|
||
|
||
|
||
|
||
|
||
<H2>The Problem</H2>
|
||
|
||
Imagine you're writing a cool new game for Linux, and like any modern
|
||
game, it has to support sound. There are a number of sound toolkits
|
||
out there, but if you're like many game programmers, you just talk
|
||
directly to the audio device, <TT>/dev/dsp</TT>, which gives you
|
||
maximum flexibility and performance.
|
||
|
||
<P>
|
||
|
||
Your game is looking good, so you pass a copy to a friend to try out.
|
||
Strangely, the sound doesn't work. It turns out your friend runs the
|
||
GNOME desktop, and under GNOME the sound device is taken over by the
|
||
<TT>esd</TT> sound server. GNOME applications are supposed to talk to
|
||
<TT>esd</TT>, not directly to the sound device. So you go back, learn
|
||
the <TT>esd</TT> API, and add an option to your program to work with
|
||
<TT>esd</TT>.
|
||
|
||
<P>
|
||
|
||
You now pass the game over to a second friend to test, and again sound
|
||
doesn't work for her. She likes to run the KDE desktop, and under KDE
|
||
the sound device is managed by the <TT>artsd</TT> sound server. So you
|
||
spend a couple more evenings learning the <TT>artsd</TT> sound API and
|
||
adding support to your game so it can work with KDE too.
|
||
|
||
<P>
|
||
|
||
A third friend has heard about this great game and wants to try it
|
||
too. He is running Solaris on a Sun workstation, but that's okay, he
|
||
can just recompile the code for his architecture. Unfortunately sound
|
||
does not work properly, because the Solaris sound device and APIs are
|
||
not the same as on Linux. You could work on adding support for Solaris
|
||
too (if you had access to a Solaris machine), but what about the
|
||
friend who runs AIX, and the one who uses the Network Audio Server
|
||
(NAS), and the one who uses the ALSA kernel drivers? Just providing
|
||
basic support for sound is getting to be a lot of work. It's too bad
|
||
you can't just write the program once and have it work on all
|
||
platforms.
|
||
|
||
<P>
|
||
|
||
Enter CSL, the Common Sound Layer.
|
||
|
||
<H2>What is CSL?</H2>
|
||
|
||
CSL is intended to solve just this problem. CSL is the Common Sound
|
||
Layer, a C-based API for sound programming. CSL is intended to address
|
||
the problem of providing sound support in applications independently
|
||
of the underlying sound drivers. It also hopes to become the common
|
||
library for sound support under the KDE and GNOME projects.
|
||
|
||
<P>
|
||
|
||
It currently works on Linux systems using the OSS sound drivers and
|
||
the aRts sound library (which runs on both KDE and GNOME desktop
|
||
environments). Applications that use CSL have no further dependencies
|
||
on any libraries or other components.
|
||
|
||
<P>
|
||
|
||
CSL was designed to provide similar performance to platform-specific
|
||
code, with support for latency management and full duplex. This makes
|
||
it particularly suitable for real-time type applications such as
|
||
games.
|
||
|
||
<P>
|
||
|
||
CSL is somewhat unique in that, despite all the talk of "desktop wars"
|
||
between KDE and GNOME, it is being co-operatively developed by Stefan
|
||
Westerfeld, a KDE developer, and Tim Janik, a GNOME developer.
|
||
|
||
<H2>Features</H2>
|
||
|
||
CSL is currently available as preview version 0.1.2 which includes:
|
||
|
||
<UL>
|
||
<LI> a C API for digital audio playback and recording
|
||
<LI> back ends for the Linux kernel OSS sound drivers and for aRts on KDE and GNOME
|
||
<LI> network transparency and authentication when used with aRts
|
||
<LI> support for multi-threaded programs
|
||
<LI> API documentation generated using <A HREF="http://www.doxygen.org">Doxygen</A>
|
||
<LI> a HOWTO/FAQ document
|
||
<LI> several utility and example programs
|
||
</UL>
|
||
|
||
<P>
|
||
|
||
CSL has some limitations, mostly by design: it is a C API only, so
|
||
don't expect an object-oriented interface. It is a low-level API for
|
||
digital audio only (no MIDI, no mixer, no codecs for complex formats
|
||
like MP3). If you want features like 3D sound, you should look at
|
||
something like <A HREF="http://www.openal.com">OpenAL</A>.
|
||
|
||
<P>
|
||
|
||
Currently, it supports only the OSS sound drivers or the aRts
|
||
sound server. (aRts ships with KDE, and there is a GNOME version. Many
|
||
multimedia applications like xmms and the RealVideo player will work
|
||
under aRts as well).
|
||
|
||
<P>
|
||
|
||
While CSL is not finished yet, the API is quite stable and most of the
|
||
functionality is there.
|
||
|
||
<H2>Obtaining and Installing CSL</H2>
|
||
|
||
In order to use CSL, you need a Linux system with working sound drivers
|
||
(either OSS or something compatible with it like OSS/4Front or ALSA
|
||
with OSS emulation). If you want aRts support, you need aRts version
|
||
0.5.4 or later, which is included in KDE 2.2, or a standalone version
|
||
can be obtained from <A
|
||
HREF="http://www.arts-project.org">http://www.arts-project.org</A>. If
|
||
you are running GNOME, there is a special version of aRts for GNOME
|
||
available there are well. Other than that, you only need the usual
|
||
development tools like <TT>gcc</TT>, <TT>gld</TT>, and the GNU auto
|
||
tools.
|
||
|
||
<P>
|
||
|
||
CSL is currently only provided in source format. You need to download
|
||
the tar archive from <A
|
||
HREF="http://www.arts-project.org/download/csl-0.1.2.tar.gz">http://www.arts-project.org/download/csl-0.1.2.tar.gz</A>
|
||
(there may be a newer version available by the time you read this).
|
||
|
||
<P>
|
||
|
||
Building and installing CSL follows the usual GNU build procedure,
|
||
documented in the file <TT>INSTALL</TT>. Briefly, you need to run the
|
||
commands:
|
||
|
||
<PRE>
|
||
%./configure
|
||
% make
|
||
% make install
|
||
</PRE>
|
||
|
||
<P>
|
||
|
||
The last must be done as user root.
|
||
To test CSL, you can run two of the included utility programs.
|
||
The <TT>testsine</TT> program generates raw samples for a 440 Hertz
|
||
sine wave and <TT>cslcat</TT> accepts raw sound sample from standard
|
||
input and sends them to the audio output device. Piping them together
|
||
like this
|
||
|
||
<PRE>
|
||
% tests/testsine | csl/cslcat
|
||
</PRE>
|
||
|
||
<P>
|
||
|
||
should produce one second of a 440 Hertz sine wave tone (the above
|
||
command assumes you are in the main CSL source directory).
|
||
|
||
<P>
|
||
|
||
If you have any raw sound files, you can try playing one with the
|
||
<TT>cslcat</TT> utility, for example:
|
||
|
||
<PRE>
|
||
% cslcat -r 44100 -w 8 -c 1 /usr/lib/games/koules/start.raw
|
||
</PRE>
|
||
|
||
<P>
|
||
|
||
You can also try the programs in the <TT>examples</TT> directory.
|
||
|
||
<H2>An Example</H2>
|
||
|
||
I'll go through a short but complete example program that uses CSL.
|
||
This is based on the program <TT>cslpcm1.c</TT> that is included in
|
||
the CSL release (I've removed comments and error checking code here
|
||
for brevity). There are additional examples included with CSL that
|
||
illustrate more of the API functions. A text version of the program is
|
||
available <A HREF="misc/tranter/cslexample.c.txt">here</A>.
|
||
|
||
<P>
|
||
|
||
<PRE>
|
||
1 #include <unistd.h>
|
||
2 #include <stdio.h>
|
||
3 #include <fcntl.h>
|
||
4 #include <csl/csl.h>
|
||
5
|
||
6 int main (int argc, char **argv)
|
||
7 {
|
||
8 const int size = 1024;
|
||
9 CslDriver *driver;
|
||
10 CslPcmStream *stream;
|
||
11 CslOptions options;
|
||
12 short buffer[size];
|
||
13 int i, j, fd;
|
||
14
|
||
15 options.n_channels = 2;
|
||
16 options.rate = 44100;
|
||
17 options.pcm_format = CSL_PCM_FORMAT_S16_LE;
|
||
18 csl_driver_init (NULL, &driver);
|
||
19 csl_pcm_open_output (driver, "cslpcm1", options.rate, options.n_channels, options.pcm_format, &stream);
|
||
20 fd = open("/dev/urandom", O_RDONLY);
|
||
21 for (i = 0; i < 500; i++)
|
||
22 {
|
||
23 read(fd, buffer, size);
|
||
24 for (j = 0; j < size; j++)
|
||
25 buffer[j] = CLAMP(buffer[j], -4000, 4000);
|
||
26 csl_pcm_write (stream, size, buffer);
|
||
27 }
|
||
28 csl_pcm_close (stream);
|
||
29 csl_driver_shutdown (driver);
|
||
30 return 0;
|
||
31 }
|
||
</PRE>
|
||
|
||
<P>
|
||
|
||
In line 4 we include <TT><csl/csl.h></TT>, the header file that
|
||
defines all of the CSL API functions.
|
||
|
||
<P>
|
||
|
||
In lines 9-11 we declare variables to hold some of the important CSL
|
||
data types. A <TT>CslDriver</TT> is a handle associated with a
|
||
particular backend driver. A <TT>CslPcmStream</TT> is a PCM audio
|
||
stream, associated with a <TT>CSLDriver</TT>, opened for either input
|
||
or output, and with specific sampling parameters. It is used much like
|
||
a file descriptor. The type <TT>CslOptions</TT> stores options for a
|
||
<TT>CslPcmStream</TT>. For convenience, CSL can parse standard command line
|
||
options for sampling parameters and put them in a <TT>CslOptions</TT> variable.
|
||
|
||
<P>
|
||
|
||
Lines 15-17 set the PCM options: number of channels, sampling rate,
|
||
and data format. In this case two channels (stereo), at a 44100 sample
|
||
per second rate, using 16-bit signed little-endian samples.
|
||
|
||
<P>
|
||
|
||
Line 18 obtains a handle to a <TT>CslDriver</TT>. We could have
|
||
specified the backend to use (e.g. "oss" or "arts") but the special
|
||
value of NULL instructs CSL to select a driver automatically. You can
|
||
also ask CSL to return a list of available drivers.
|
||
|
||
<P>
|
||
|
||
In line 19, using the driver handle, we pass the sampling options and
|
||
receive a handle to the <TT>CslPcmStream</TT>, in this case an output
|
||
stream for sound playback. If we wanted to perform sound recording we
|
||
would have opened an input stream.
|
||
|
||
<P>
|
||
|
||
In line 20 of the example we open the Linux random device. We are going to use it
|
||
to obtain random numbers which we will send to the sound device.
|
||
|
||
<P>
|
||
|
||
Lines 22-27 form a loop in which we read data from
|
||
<TT>/dev/urandom</TT> into a buffer and then write the data to the PCM
|
||
stream using <TT>csl_pcm_write</TT>. Because the data is random, it
|
||
can contain large sample values which may be quite loud. We use the
|
||
convenience macro <TT>CLAMP</TT> provided by CSL to constrain the
|
||
value within a smaller range (recall that here we are working with
|
||
16-bit signed values). The result of writing the random data to the
|
||
sound device should be a hissing sound from the speaker. This white
|
||
noise of no particular frequency confirms that the random number
|
||
generator device is indeed a good source of random data.
|
||
|
||
<P>
|
||
|
||
In lines 28-29, after looping 500 times (which corresponds to about 3
|
||
seconds), we clean up by closing the stream and shutting down the
|
||
driver.
|
||
|
||
<P>
|
||
|
||
By studying this and the other examples, and looking at the HTML API
|
||
documentation, you should quickly get a feel for how to use the library.
|
||
|
||
<H2>Porting Applications to CSL</H2>
|
||
|
||
It is relatively straightforward to port applications that use the OSS
|
||
sound drivers to CSL. You will then have an application that will work
|
||
nicely under systems running aRts, and still work with the kernel
|
||
sound drivers. As an example, I ported a sound application I had
|
||
written (<TT>wave</TT>), which consisted of about 550 lines of C code,
|
||
in about an hour. Many of the CSL API functions, like
|
||
<TT>csl_pcm_write</TT>, are similar to the underlying C library
|
||
functions commonly used for sound programming, like <TT>write</TT>.
|
||
|
||
<H2>Current Status and Future Plans</H2>
|
||
|
||
CSL is currently in a preview release. Work remains to finish some
|
||
missing features, perform testing, and fix bugs. Possible work in the
|
||
future includes implementing support for <TT>artsc</TT> (the C API for
|
||
arts) and the <TT>esound</TT> API used by GNOME. Stable releases
|
||
should also be made available as binary packages.
|
||
|
||
<H2>Conclusions</H2>
|
||
|
||
I believe CSL offers a solution to the problem of incompatible sound
|
||
support, especially on Linux desktop environments, and therefore deserves
|
||
attention from multimedia developers. I invite you to try CSL,
|
||
consider using it in your existing or new applications, and maybe even
|
||
help contribute to it.
|
||
|
||
<H2>References</H2>
|
||
|
||
<OL>
|
||
<LI> CSL HOWTO and FAQ (included in CSL source code)
|
||
<LI> CSL API Documentation (included in CSL source code, generated using <A HREF="http://www.doxygen.org">Doxygen</A>)
|
||
<LI> <A HREF="http://www.arts-project.org/download/csl-0.1.2.tar.gz">Source code for CSL 0.1.2</A>
|
||
<LI> <A HREF="http://www.arts-project.org/doc/csl-0.1.2.html">Release announcement for CSL 0.1.2</A>
|
||
<LI> <A HREF="http://www.arts-project.org/doc/gnome-arts-0.1.2.html">Release announcement for GNOME aRts 0.1.2</A>
|
||
<LI> <A HREF="http://www.arts-project.org">Home page for the aRts Project</A>
|
||
</OL>
|
||
|
||
<P>
|
||
|
||
There is a mailing list for CSL. You can join the list by sending a
|
||
message with the word <EM>subscribe</EM> as the message body to
|
||
<TT>csl-request@space.twc.de</TT>. The mailing list is archived at <A
|
||
HREF="http://www.mail-archive.com/csl@space.twc.de">http://www.mail-archive.com/csl@space.twc.de</A>.
|
||
|
||
|
||
|
||
|
||
<!-- *** BEGIN bio *** -->
|
||
<SPACER TYPE="vertical" SIZE="30">
|
||
<P>
|
||
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Jeff Tranter</H4>
|
||
<EM>Jeff Tranter has been using Linux since 1992. He is the author of the
|
||
Linux Sound and CD-ROM HOWTOs and the O'Reilly book </EM>Linux
|
||
Multimedia Guide<EM>. He has worked in a number of diverse areas of
|
||
Linux, most recently on the KDE desktop environment focusing on
|
||
multimedia. He is currently employed at a new Linux company,
|
||
<A HREF="http://www.xandros.com">Xandros Corporation</A>.</EM>
|
||
|
||
|
||
<!-- *** END bio *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <!-- P -->
|
||
<H5 ALIGN=center>
|
||
|
||
Copyright © 2001, Jeff Tranter.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
||
</H4>
|
||
|
||
<P> <HR> <P>
|
||
<!--===================================================================-->
|
||
|
||
<center>
|
||
<H1><font color="maroon">Using Aggregate Functions and Operators in PostgreSQL</font></H1>
|
||
<H4>By <a href="mailto:brw@brw.net">Branden R Williams</a></H4>
|
||
</center>
|
||
<P> <HR> <P>
|
||
|
||
<!-- END header -->
|
||
|
||
|
||
|
||
|
||
<b>Preface:</b><br>
|
||
This article assumes the reader can
|
||
do basic SELECT, INSERT, UPDATE, and DELETE queries to and from a SQL
|
||
database. If you are not sure on how these functions work, please read a
|
||
tutorial on how these types of queries work. Specifically if you can use
|
||
a SELECT query, then you are armed with enough information to read through
|
||
this document with a high level of understanding. That said, lets get on
|
||
to aggregate functions!
|
||
</p>
|
||
<p>
|
||
<b>Summary:</b><br>
|
||
In the beginning of this rather extensive article, I will cover how to use the five most common and
|
||
basic aggregate functions on PostgreSQL. Those functions are count(),
|
||
min(), max(), avg(), and sum(). Then I will cover how to use several common operators
|
||
that exist for your use in PostgreSQL. Depending on your development
|
||
environment, a good philosophy to practice is letting your DataBase
|
||
Management System (DBMS) craft your results so that they are immediately
|
||
usable in your code with little or no processing. Good examples for
|
||
the reasoning behind this philosophy are exhibited when using aggregates. Finally, I will cover how to use several common operators with our
|
||
aggregate function counterparts that exist for your use in PostgreSQL.
|
||
Depending on your development environment, a good philosophy to practice is
|
||
letting your DataBase Management System (DBMS) craft your results so that they
|
||
are immediately usable in your code with little or no processing. In this article, I will demonstrate how to use some simple
|
||
operators in your queries to craft data exactly as you need it.
|
||
</p>
|
||
<p>
|
||
<b>What is an aggregate function?</b><br>
|
||
An aggregate function is a function such as count() or sum() that you can
|
||
use to calculate totals. In writing expressions and in programming, you
|
||
can use SQL aggregate functions to determine various statistics and
|
||
values. Aggregate functions can greatly reduce the amount of coding that
|
||
you need to do in order to get information from your database.
|
||
</p>
|
||
<p>
|
||
(Excerpt from the PostgreSQL 7.1 manual)<br>
|
||
<tt>aggregate_name (expression)<br>
|
||
aggregate_name (ALL expression)<br>
|
||
aggregate_name (DISTINCT expression)<br>
|
||
aggregate_name ( * )<br></tt>
|
||
</p>
|
||
<p>
|
||
where aggregate_name is a previously defined aggregate, and expression is
|
||
any expression that does not itself contain an aggregate expression.
|
||
</p>
|
||
<p>
|
||
The first form of aggregate expression invokes the aggregate across all
|
||
input rows for which the given expression yields a non-NULL value.
|
||
(Actually, it is up to the aggregate function whether to ignore NULLs or
|
||
not --- but all the standard ones do.) The second form is the same as the
|
||
first, since ALL is the default. The third form invokes the aggregate for
|
||
all distinct non-NULL values of the expression found in the input rows.
|
||
The last form invokes the aggregate once for each input row regardless of
|
||
NULL or non-NULL values; since no particular input value is specified, it
|
||
is generally only useful for the count() aggregate function.
|
||
</p>
|
||
<p>
|
||
Consider this example. You are writing a program which tracks sales of
|
||
books. You have a table called the "sale" table that contains the book
|
||
title, book price, and date of purchase. You want to know what the total
|
||
amount of money that you made by selling books for the month of March
|
||
2001. Without aggregate functions, you would have to select all the rows
|
||
with a date of purchase in March 2001, iterate through them one by one to
|
||
calculate the total. Now if you only have 10 rows, this does not make a
|
||
big difference (and if you only sell 10 books a month you should hope
|
||
those are pretty high dollar!). But consider a bookstore that sells on
|
||
average 2000 books a month. Now iterating through each row one by one
|
||
does not sound so efficient does it?
|
||
</p>
|
||
<p>
|
||
With aggregate functions you can simply select the sum() of the book price
|
||
column for the month of March 2001. Your query will return one value and
|
||
you will not have to iterate through them in your code!
|
||
</p>
|
||
<p>
|
||
<b>The SUM() function.</b><br>
|
||
The sum() function is very useful as described in the above example.
|
||
Based on our fictitious table, consider the following.
|
||
</p>
|
||
<pre>
|
||
table sale (
|
||
book_title varchar(200),
|
||
book_price real,
|
||
date_of_purchase datetime
|
||
)
|
||
</pre>
|
||
<p>
|
||
Without aggregate functions:<br>
|
||
<tt>SELECT * FROM sale WHERE date_of_purchase BETWEEN '03/01/2001' AND
|
||
'04/01/2001';</tt>
|
||
</p>
|
||
<p>
|
||
This returns all rows which correspond to a sale in the month of March
|
||
2001.
|
||
</p>
|
||
<p>
|
||
With aggregate functions:<br>
|
||
<tt>SELECT SUM(book_price) AS total FROM sale WHERE date_of_purchase BETWEEN
|
||
'03/01/2001' AND '04/01/2001';</tt>
|
||
</p>
|
||
<p>
|
||
This returns a single row with a single column called total containing the
|
||
total books sold in the month of March 2001.
|
||
</p>
|
||
<p>
|
||
You can also use mathematical operators within the context of the sum()
|
||
function to add additional functionality. Say for instance, you wanted to
|
||
get the value of 20% of your sum of book_price as all of your books have a
|
||
20% markup built in to the price. Your aggregate would look like:
|
||
</p>
|
||
<p>
|
||
<tt>SELECT SUM(book_price) AS total, SUM(book_price * .2) AS profit FROM sale
|
||
WHERE date_of_purchase BETWEEN '03/01/2001' AND '04/01/2001';</tt>
|
||
</p>
|
||
<p>
|
||
If you look on a grander scale, you will see even more uses for the sum()
|
||
function. For example calculating commissions, generating detailed
|
||
reports, and generating running statistical totals. When writing a
|
||
report, it is much easier to have SQL do the math for you and simply
|
||
display the results than attempting to iterate through thousands or
|
||
millions of records.
|
||
</p>
|
||
<p>
|
||
<b>The count() function.</b><br>
|
||
Yet another useful aggregate function is count(). This function allows
|
||
you to return the number of rows that match a given criteria. Say for
|
||
example you have a database table that contains news items and you want to
|
||
display your current total of news items in the database without selecting
|
||
them all and iterating through them one by one. Simply do the following:
|
||
</p>
|
||
<p>
|
||
<tt>SELECT COUNT(*) AS myCount FROM news;</tt>
|
||
</p>
|
||
<p>
|
||
This will return the total number of news articles in your database.
|
||
</p>
|
||
<p>
|
||
<b>The MAX() and MIN() functions.</b><br>
|
||
These two functions will simply return the maximum or minimum value in a
|
||
given column. This may be useful if you want to very quickly know the
|
||
highest priced book you sold and the lowest price book you sold (back to
|
||
the bookstore scenario). That query would look like this.
|
||
</p>
|
||
<p>
|
||
<tt>SELECT MAX(book_price) AS highestPrice, MIN(book_price) AS lowestPrice
|
||
FROM sale WHERE date_of_purchase BETWEEN '03/01/2001' AND '04/01/2001';</tt>
|
||
</p>
|
||
<p>
|
||
Again, this simply prevents you from having to select EVERYTHING from the
|
||
database, iterate through each row one by one, and calculate the
|
||
result by hand.
|
||
</p>
|
||
<p>
|
||
<b>The AVG() function.</b><br>
|
||
This particular aggregate is definitely very useful. Any time you would
|
||
like to generate an average value for any number of fields, you can use
|
||
the avg() aggregate. Without aggregates, you would once again have to
|
||
iterate through all rows returned, sum up your column and take a count of
|
||
the number of rows, then do your math. In our bookstore example, say you
|
||
would like to calculate the average book price that was sold during March
|
||
2001. Your query would look like this.
|
||
</p>
|
||
<p>
|
||
<tt>SELECT AVG(book_price) AS avg_price FROM sale WHERE date_of_purchase
|
||
BETWEEN '03/01/2001' AND '04/01/2001';</tt>
|
||
</p>
|
||
<p>
|
||
<b>What is an operator?</b><br>
|
||
An operator is something that performs on operation or function on the
|
||
values that are around it. For an example of this, let's look at
|
||
Mathematical Operators. If you wanted to subtract the values from
|
||
two fields in a select statement, you would use the subtraction (-)
|
||
operator.
|
||
</p>
|
||
<p>
|
||
<tt>SELECT salesperson_name, revenue - cost AS commission FROM sales;</tt>
|
||
</p>
|
||
<p>
|
||
What will be returned is the results of the revenue each sales person
|
||
brought in minus the cost of the products that they sold which will yield
|
||
their commission amount.
|
||
</p>
|
||
<p>
|
||
<table border=1 cellpadding=5>
|
||
<tr><th>salesperson_name</th><th>commission</th></tr>
|
||
<tr><td>Branden Williams</td><td>234.43</td></tr>
|
||
<tr><td>Matt Springfield</td><td>87.74</td></tr>
|
||
</table>
|
||
</p>
|
||
<p>
|
||
Operators can be VERY useful when you have complex calculations or a
|
||
need to produce the exact results you need without having your script
|
||
do any text or math based processing.
|
||
</p>
|
||
<p>
|
||
Let's refer to our bookstore example. You are writing a program which
|
||
will show you the highest margin books (largest amount of profit per book)
|
||
so that your marketing monkey can place them closer to the door of the
|
||
store. Instead of doing your math on the fly while iterating through
|
||
your result set, you can have the result set display the correct
|
||
information for you.
|
||
</p>
|
||
<p>
|
||
<pre>table inventory (
|
||
book_title varchar(200),
|
||
book_cost real,
|
||
selling_price real
|
||
)</pre>
|
||
</p>
|
||
<p>
|
||
SELECT book_title, selling_price - book_cost AS profit ORDER BY
|
||
profit DESC;
|
||
</p>
|
||
<p>
|
||
Which will produce results similar to the following.
|
||
</p>
|
||
<p>
|
||
<table border=1 cellpadding=5>
|
||
<tr><th>book_title</th><th>profit</th></tr>
|
||
<tr><td>How To Scam Customers Into Buying Your Books</td><td>15.01</td></tr>
|
||
<tr><td>How To Crash Windows 2000</td><td>13.84</td></tr>
|
||
</table>
|
||
</p>
|
||
<p>
|
||
Now your marketing guy can very quickly see which books are the highest
|
||
margin books.
|
||
</p>
|
||
<p>
|
||
Another good use for operators is when you are selecting information
|
||
from one table to another. For example, you may have a temporary
|
||
table that you select product data into so that it can be proofread
|
||
before it is sent into some master data table. Shopping Carts make
|
||
great examples of this. You can take the pertinent information from
|
||
your production tables and place it in a temporary table to be then
|
||
removed, quantity increased, or discounts added before it is placed
|
||
into your master order table.
|
||
</p>
|
||
<p>
|
||
In an example like this, you would not want to select out your various
|
||
kinds of information, perform some functions to get them just right,
|
||
and then insert them back into your temporary table. You can simply
|
||
do it all in one query by using operators. It also creates less of
|
||
a headache when you are dealing with very dynamic data. Let the
|
||
database handle as much of your dynamic data as it can.
|
||
</p>
|
||
<p>
|
||
Now I would like to go into some specific operators and their functions.
|
||
To see a complete list of operators, in your pgsql interface window
|
||
type '\do'.
|
||
</p>
|
||
<p>
|
||
<b>The +, -, *, and / operators.</b><br>
|
||
These are the basic math operators that you can use in PostgreSQL.
|
||
See above for good examples on how to use them. A few additional
|
||
examples are here.
|
||
</p>
|
||
<p>
|
||
<ul>
|
||
<li> Calculating tax (SELECT subtotal * tax AS taxamount)
|
||
<li> Calculating unit cost (SELECT extendedcost / quantity AS unitcost)
|
||
</ul>
|
||
</p>
|
||
<p>
|
||
Many more uses for math operators will be revealed in the next article
|
||
in this series which combines operators with aggregate functions.
|
||
</p>
|
||
<p>
|
||
<b>Inequality (<, >, <=, >=) operators.</b><br>
|
||
You most likely have used these in the WHERE clause of a specific
|
||
SQL query. For instance.
|
||
</p>
|
||
<p>
|
||
<tt>SELECT book_title FROM inventory WHERE selling_price >= '30.00';</tt>
|
||
</p>
|
||
<p>
|
||
This query will select all books that have a selling price of
|
||
$30.00 or more. You could even extend that to our profit example
|
||
earlier and do the following.
|
||
</p>
|
||
<p>
|
||
<tt>SELECT book_title, selling_price - book_cost AS profit WHERE
|
||
selling_price - book_cost >= '14.00' ORDER BY profit DESC;</tt>
|
||
</p>
|
||
<p>
|
||
Which will only produce the following results.
|
||
</p>
|
||
<p>
|
||
<table border=1 cellpadding=5>
|
||
<tr><th>book_title</th><th>profit</th></tr>
|
||
<tr><td>How To Scam Customers Into Buying Your Books</td><td>15.01</td></tr>
|
||
</table>
|
||
</p>
|
||
<p>
|
||
This can allow you to set thresholds for various kinds of queries
|
||
which is very useful in reporting.
|
||
</p>
|
||
<p>
|
||
<b>The || (concatenate) operator.</b><br>
|
||
When doing any sort of text concatenation, this operator comes in
|
||
handy. Say for instance, you have a product category which has
|
||
many different products within it. You might want to print out
|
||
the product category name as well as the product item on the
|
||
invoice.
|
||
</p>
|
||
<p>
|
||
<tt>SELECT category || CAST(': ' AS VARCHAR) || productname AS title
|
||
FROM products;</tt>
|
||
</p>
|
||
<p>
|
||
Notice the use of the CAST() function. Concatenate will require
|
||
knowledge about the elements it is operating on. You must tell
|
||
PostgreSQL that the string ': ' is of type VARCHAR in order for
|
||
your operator to function.
|
||
</p>
|
||
<p>
|
||
Your results may look like:
|
||
</p>
|
||
<p>
|
||
<table border=1 cellpadding=5>
|
||
<tr><th>title</th></tr>
|
||
<tr><td>Music CDs: Dave Matthews, Listener Supported</td></tr>
|
||
<tr><td>DVDs: Airplane</td></tr>
|
||
</table>
|
||
</p>
|
||
<P>In the previous articles, I showed you some simple ways to use operators and
|
||
aggregate functions to help speed up your applications. The true power of
|
||
operators and aggregate functions come when you combine their respective powers
|
||
together. You can cut down on the lines of code your application will need
|
||
by simply letting your database handle that for you. This article will arm
|
||
you with a plethora of information on this subject.</P>
|
||
<P>
|
||
<b> Our Scenario:</b><br>
|
||
You are hired to create a web-based shopping application. Here is your database
|
||
layout for your order table.</P>
|
||
<pre>
|
||
create table orders (
|
||
orderid integer (autoincrement),
|
||
customerid integer,
|
||
subtotal real,
|
||
tax real,
|
||
shipping real
|
||
)
|
||
|
||
create table orderdetail (
|
||
orderid integer,
|
||
productid integer,
|
||
price real,
|
||
qty integer
|
||
)
|
||
|
||
create table taxtable (
|
||
state varchar(2),
|
||
rate real
|
||
)
|
||
|
||
create table products (
|
||
productid integer,
|
||
description varchar(100),
|
||
price real
|
||
)
|
||
|
||
create table cart (
|
||
sessionid varchar(30),
|
||
productid integer,
|
||
price real,
|
||
qty integer
|
||
)
|
||
</pre>
|
||
<p>
|
||
In this example, I will use database driven shopping carts instead of storing the cart information in a session. However, I will need a sessionID to keep up with the changes in the database. Our <tt>cart</tt> table contains the current pre-checkout shopping cart. <tt>Orders</tt> and <tt>Orderdetail</tt> contain the completed order with items. We can calculate each order's Grand Total by adding up the sub parts when needed for tracking or billing. Finally, <tt>products</tt> is our product table which contains a price and description.
|
||
</p>
|
||
<p>
|
||
The point of this exercise is to pass as much of the computation back to the database so that your application layer does not have to perform many trips to and from the database, as well as to reduce the lines of code required to complete your task. In this example, several of your items are stored in a database table so they may be dynamic. Those items are the basis of your subtotal, tax and shipping calculations. If you do not use operators and aggregates (and potentially subqueries), you will run the risk of making many trips around the database and putting added overhead into your application layer. I will break down the calculation of each of those items for you, as well as an example of how to put it all together in the end.
|
||
</p>
|
||
<p>
|
||
<b>The subtotal calculation.</b><br>
|
||
This is a rather simple calculation, and will only use an aggregate function and simple operator to extract. In our case.
|
||
</p>
|
||
<p>
|
||
<tt>SELECT SUM(price*qty) AS subtotal FROM cart WHERE sessionid = '9j23iundo239new';</tt>
|
||
</p>
|
||
<p>
|
||
All we need is the sum of the results from every price * qty calculation. This shows how you can combine the power of operators and aggregates very nicely. Remember that the SUM aggregate will return the total sum from every calculation that is performed on a PER ROW basis. Don't forget your order of operations!
|
||
</p>
|
||
<p>
|
||
<b>The tax calculation.</b><br>
|
||
This one can be kind of tricky without some fancy SQL. I will be using <tt>COALESCE</tt> to determine the actual tax rate. <tt>COALESCE</tt> takes two arguments. If the results of the first argument are <tt>null</tt>, it will return the second. It is very handy in situations like this. Below is the query. Note: _subtotal_ is simply a placeholder.
|
||
</p>
|
||
<p>
|
||
<tt>SELECT _subtotal_ * COALESCE(tax, 0) AS tax FROM tax WHERE state = 'TX';</tt>
|
||
</p>
|
||
<p>
|
||
In the final query, I will show you how all these will add up so try not to get confused by my nifty placeholders.
|
||
</p>
|
||
<p>
|
||
<b>The shipping calculation.</b><br>
|
||
For simplicity, we will just assume that you charge shipping based on a $3 fee per item. You could easily expand that to add some fancy calculations in as well. By adding a weight field to your products table, you could easily calculate shipping based on an algorithm. In our instance, we will just count the number of items in our cart and multiply that by 3.
|
||
</p>
|
||
<p>
|
||
<tt>SELECT COUNT(*) * 3 FROM cart AS shipping WHERE sessionid = '9j23iundo239new';</tt>
|
||
</p>
|
||
<p>
|
||
<b>Tying it all together.</b><br>
|
||
Now that I have shown you how to get the results for those calculations separately, lets tie them all together into one big SQL query. This query will handle all of those calculations, and then place them into the <tt>orders</tt> table for you.
|
||
</p>
|
||
<p>
|
||
<tt>INSERT INTO orders (customerid, subtotal, tax, shipping) VALUES (customerid, (SELECT SUM(price*qty) FROM cart WHERE sessionid = '9j23iundo239new'), (SELECT SUM(price*qty) FROM cart WHERE sessionid = '9j23iundo239new') * (SELECT COALESCE(tax, 0) FROM tax WHERE state = 'TX'), (SELECT COUNT(*) * 3 FROM cart WHERE sessionid = '9j23iundo239new'));</tt>
|
||
</p>
|
||
<p>
|
||
Additionally, if you had a Grand Total field in your orders table, you could complete this by adding up the sub items in either a separate query, or inside your <tt>INSERT</tt> query. The first of those two examples might look like this.
|
||
</p>
|
||
<p>
|
||
<tt>UPDATE orders SET grandtotal = subtotal+tax+shipping WHERE orderid = 29898;</tt>
|
||
</p>
|
||
<p>
|
||
To move the rest of the items from the cart table to the orderdetail table the following two queries can be issued in sequence.
|
||
</p>
|
||
<p>
|
||
<tt>INSERT INTO orderdetail (orderid, productid, price, qty) values SELECT _yourorderid_, productid, price, qty FROM cart WHERE sessionid = '9j23iundo239new';</tt><br>
|
||
<tt>DELETE FROM cart WHERE sessionid = '9j23iundo239new';</tt>
|
||
</p>
|
||
<p>
|
||
<b>Conclusion:</b><br>
|
||
Aggregate functions can greatly simplify and speed up your applications by
|
||
allowing the SQL server to handle these kinds of calculations. In more
|
||
complex applications they can be used to return customized results from
|
||
multiple tables for reporting and other functions. Operators can greatly enhance the quality of the results that you return
|
||
from your database. The correct use of operators and aggregate functions can not only increase the speed and accuracy of your application, but it also can greatly reduce your code base by removing unneeded lines of code for looping through result sets, simple calculations, and other line hogs.
|
||
|
||
<P> I hope that you enjoy reading and learning from this article as much as I enjoyed writing it!
|
||
|
||
|
||
|
||
|
||
|
||
<!-- *** BEGIN bio *** -->
|
||
<SPACER TYPE="vertical" SIZE="30">
|
||
<P>
|
||
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Branden R Williams</H4>
|
||
<EM>Branden is currently a consultant for
|
||
<a href="http://www.elliptix.net">Elliptix</a>, an e-business and security
|
||
consulting firm he co-founded this year. He has over 10 years of experience in
|
||
various Internet-related technology disciplines including Unix administration,
|
||
network infrastructure design and deployment, and many scripting and
|
||
programming languages. For the last six years, Branden has been designing,
|
||
building and deploying enterprise-scale e-commerce applications. His real-world
|
||
experience is backed up by a Bachelors of Business Administration in Marketing
|
||
from the University of Texas, Arlington. Branden can also be reached at
|
||
<a href="mailto:brw@brw.net">brw@brw.net</a>. </EM>
|
||
|
||
<!-- *** END bio *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <!-- P -->
|
||
<H5 ALIGN=center>
|
||
|
||
Copyright © 2001, Branden R Williams.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
<H4 ALIGN="center">
|
||
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
||
</H4>
|
||
|
||
<P> <hr> <P>
|
||
|
||
<H1><font color="maroon">The Back Page</font></H1>
|
||
|
||
<ul>
|
||
<li><a HREF="#wacko">Wacko Topic of the Month</a>
|
||
<li><a HREF="#nottag">Not The Answer Gang</a>
|
||
<li><a HREF="#spam_nigeria">World of Spam: Nigeria-related</a>
|
||
<li><a HREF="#spam">World of Spam: Other</a>
|
||
</ul>
|
||
|
||
<a name="wacko"></a>
|
||
<P> <hr> <P>
|
||
<!--====================================================================-->
|
||
|
||
<center><H3><font color="maroon">Wacko Topic of the Month</font></H3></center>
|
||
|
||
<P> <hr> <P>
|
||
<!--====================================================================-->
|
||
|
||
<P> <STRONG>buthead</STRONG> is a program to copy all but the first N lines of
|
||
standard input to standard output. It's a new Debian package. Think Beavis
|
||
and...
|
||
|
||
|
||
|
||
<a name="nottag"></a>
|
||
<P> <hr> <P>
|
||
<!--====================================================================-->
|
||
|
||
<center><H3><font color="maroon">Not The Answer Gang</font></H3></center>
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
<H3 ALIGN="center">Internet café</H3>
|
||
|
||
<p align="right"><FONT COLOR="#000000"><strong>Answered By Don Marti, Heather Stern
|
||
</strong></FONT></p>
|
||
|
||
<STRONG>
|
||
Dear sir,<BR>
|
||
please send me through email on how to setup an internet cafe in detail using red hat linux and windows nt cause I am planning to setup one. I got some tips from my friends but I want to consult a professional like you. hoping you'll send me the details. thank you sir...</STRONG></P>
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Don]
|
||
|
||
Cleanliness is important! Wash the coffee pot every day for peak
|
||
flavor, and wash your hands before serving food and beverages.
|
||
|
||
<P> To make the cafe inviting to customers, wipe up spills from tables
|
||
or floors when there are no customers in line.
|
||
|
||
<P> Shop around at local bakeries to find the best baked goods.
|
||
If you tell them you are opening an Internet cafe, many bakeries
|
||
will bring you a free sample plate of breakfast pastries.
|
||
|
||
<P> Get plenty of change and small bills in the morning in case the first
|
||
few customers only have large bills.
|
||
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Heather]
|
||
|
||
Last, but certainly not least:
|
||
|
||
<A HREF="http://www.linuxdoc.org/HOWTO/mini/Coffee.html">
|
||
The Linux Coffee HOWTO</A>.
|
||
<IMG ALT=":)" SRC="../gx/dennis/smily.gif" WIDTH="20" HEIGHT="24">
|
||
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
<H3 ALIGN="center">Mail story</H3>
|
||
|
||
<p align="right"><FONT COLOR="#000000"><strong>Answered By Heather Stern
|
||
</strong></FONT></p>
|
||
|
||
|
||
<P> <EM>Ben Okopnik says:</EM>
|
||
<BR>
|
||
|
||
<STRONG>
|
||
I'm gettin' middlin' crazy with the e-mail blahs; I seem to be wandering
|
||
in this maze of little passages, all alike...
|
||
</STRONG></P>
|
||
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Heather]
|
||
|
||
You are in a maze of twisty little RFC 822 headers, mostly alike. To the
|
||
south you see a door with the label "MX" hastily taped over what appears to
|
||
be the letter "A". To the north is another RFC822 header. There is a
|
||
trophy case here.
|
||
|
||
<PRE>
|
||
> look trophy
|
||
</PRE>
|
||
|
||
The trophy case has clearly seen better days. It has different sections
|
||
with small faded labels like "MIME" and "base 64 encoded". It appears to
|
||
contain a scroll.
|
||
|
||
<PRE>
|
||
> get scroll
|
||
</PRE>
|
||
|
||
It's in the trophy case.
|
||
|
||
<PRE>
|
||
> open trophy
|
||
</PRE>
|
||
|
||
With what, your bare hands?
|
||
|
||
<PRE>
|
||
> open trophy with hands
|
||
</PRE>
|
||
|
||
The trophy case contains a scroll. Its lid is open.
|
||
|
||
<PRE>
|
||
> get scroll
|
||
</PRE>
|
||
|
||
The scroll tube "Mapping DUNGEO for precocious 6 year olds." It looks like
|
||
this tube has been opened before.
|
||
|
||
<PRE>
|
||
> s
|
||
</PRE>
|
||
|
||
You have arrived at the SMTP reception area. The host appears to be
|
||
waiting for something.
|
||
|
||
<PRE>
|
||
> ehlo starshine.org
|
||
</PRE>
|
||
|
||
EHLO starshine.org, pleased to meet you!
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
<H3 ALIGN="center">Reboot</H3>
|
||
|
||
<p align="right"><FONT COLOR="#000000"><strong>Answered By Rory Krause
|
||
</strong></FONT></p>
|
||
|
||
<P>
|
||
Quote from Rory as he disappeared into the server room when a server
|
||
ran out of swap space, "It needs a rootie tootie rebootie."
|
||
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
<H3 ALIGN="center">Taking care of Ben Okopnik</H3>
|
||
|
||
<p align="right"><FONT COLOR="#000000"><strong>Answered By Iron, Faber Fedor
|
||
</strong></FONT></p>
|
||
|
||
<STRONG>
|
||
... work fine, just as they will in procmail. Note that "pchs.com" will
|
||
work (without "\.") - but will also match "pchsxcom", etc.
|
||
I'm so confused!
|
||
</STRONG></P>
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
|
||
|
||
When it comes to regexes, you're not the first... nor will you be the
|
||
last. <ominous laugh:>
|
||
<IMG ALT=":)" SRC="../gx/dennis/smily.gif" WIDTH="20" HEIGHT="24">
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Iron]
|
||
|
||
|
||
We really need to do something about that Ben Okopnik... Now he's being
|
||
diabolical about regexes. I wonder when he's gonna start writing a virus.
|
||
<flips dark shades down so he can exit incognito>
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
|
||
|
||
Not <STRONG>meeee!</STRONG> I'm only a <EM>part-time</EM> ax-murderer!
|
||
|
||
<P> -Ben Okopnik, white hat firmly in place<BR>
|
||
-=-=-=-=-=-
|
||
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Faber]
|
||
|
||
This man can't hold down *any* job full-time, can he? :-)
|
||
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
|
||
Ah-hah. I *thought* some of Faber's mannerisms and turns of phrase
|
||
sounded familiar.
|
||
Dad, are you using pen names *again*?
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Iron]
|
||
|
||
Son, when are you going to stop playing around with them computer
|
||
contraptions and get a REAL job?
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
|
||
<Jaw hits floor> Mike, you're welcome to give Pop his brain back any
|
||
time you're done using it. I'm sure he could still get some wear out of
|
||
it...
|
||
|
||
<P> The phrasing - even though the original was in Russian - was
|
||
word-for-word exact. I guess the folks at Alcoholics Anonymous aren't
|
||
the only ones who get those "you mean my experience isn't unique?"
|
||
shocks.
|
||
|
||
<P> <walks off, shaking head>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
<H3 ALIGN="center">How to spoof e-mail</H3>
|
||
|
||
<p align="right"><FONT COLOR="#000000"><strong>Answered By Ben Okopnik
|
||
</strong></FONT></p>
|
||
|
||
|
||
<P> <EM>Faber Fedor asks:</EM>
|
||
<BR>
|
||
|
||
<STRONG>
|
||
I was wondering if anyone here could explain how email spoofing occurs.
|
||
Specifically, email sent from bozo@spam.com TO bozo@spam.com. If it's
|
||
being sent To: bozo@spam.com, how does it show up in <EM>my</EM> mailbox?
|
||
Is there a "broadcast" address for email at a site?
|
||
</STRONG></P>
|
||
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
<PRE>
|
||
From: <random_name@anywhere.com>
|
||
To: <random_name@stupid_ISP_that_permits_open_relaying.shmuck>
|
||
Bcc: <list_of_harvested_addresses>
|
||
Subject: MONEY!! MONEY!! MONEY!!!!!!
|
||
|
||
Dear <Insert Name Here>:
|
||
|
||
Wouldn't *YOU* like to make a bazillion dollars? This program requires
|
||
no effort, no time, and NO brain. You don't even have to know the
|
||
details of what will happen. Simply send me all your money, and I'll
|
||
take care of everything!!!
|
||
|
||
<List of testimonials follows>
|
||
</PRE>
|
||
|
||
|
||
|
||
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
<H3 ALIGN="center">Phone service</H3>
|
||
|
||
<p align="right"><FONT COLOR="#000000"><strong>Answered By Iron
|
||
</strong></FONT></p>
|
||
|
||
<STRONG>
|
||
I am moving from Canada to XXXXX Illinois and I cant seem to find
|
||
anywhere the names of telephone companies who do installations and basic
|
||
service I dont need long distance,I would like to get that information please
|
||
as soon as possible as i am moving September 4th/2001 and I would like the
|
||
phone installed in my apartement before I move in.And i know here in Canada
|
||
you want to know something you call the press,and you can always get your
|
||
answers.
|
||
</STRONG></P>
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Iron]
|
||
|
||
And you think everybody in "the press" knows everything? Have you ever
|
||
tried e-mailing a random publication in Vancouver or Halifax to see whether
|
||
they'd tell you how to get in touch with the local phone company?
|
||
|
||
<P> Try typing "XXXXX Illinois telephone" into a search engine and see
|
||
what it says. Many cities have a general links page maintained by some
|
||
public or private organization. Or find the city's Chamber of Commerce
|
||
and ask them.
|
||
|
||
<PRE>
|
||
You've reached the Linux Gazette Answer Gang....
|
||
Linux ::::::::: a modern operating system not much like any of:
|
||
--- DOS -- Windows -- Solaris -- MacOS -- alien starships ---
|
||
... except occasionally, an ability to run on the same hardware.
|
||
Gazette ::::::: published more regularly than "almanac." In our case:
|
||
--- a monthly web-based magazine, home: www.linuxgazette.com
|
||
Answer Gang ::: Not the "lazy college student's UNstudy group"
|
||
--- nor the "hey d00dz help me cRaK my neighBoorZ klub"
|
||
|
||
We're just a batch of (mostly) cheerful volunteers who want to make LINUX
|
||
a little more fun. If you want fascinating answers to non-computing questions
|
||
try asking Cecil Adams, buy a Tarot deck, or run the 'fortune' program on
|
||
your nearest Linux box and see if it actually has any meaning for you.
|
||
</PRE>
|
||
|
||
|
||
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
<H3 ALIGN="center">College grants</H3>
|
||
|
||
<p align="right"><FONT COLOR="#000000"><strong>Answered By Iron
|
||
</strong></FONT></p>
|
||
|
||
<STRONG>
|
||
I am majoring in CIS and i am looking for any grant money i can find to help
|
||
pay for me to go to school. If you know of any sites or places i could write
|
||
would you please send me a reply.
|
||
</STRONG></P>
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Iron]
|
||
|
||
I know one place you shouldn't write, and that is this address.
|
||
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
<H3 ALIGN="center">Skull</H3>
|
||
|
||
<p align="right"><FONT COLOR="#000000"><strong>Answered By Ben Okopnik
|
||
</strong></FONT></p>
|
||
|
||
<STRONG>
|
||
I'm a Red Hat user (don't look at me like that, Ben!)
|
||
</STRONG></P>
|
||
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Iron]
|
||
|
||
Ben, are you intimidating people again?
|
||
<PRE>
|
||
|
||
<P>
|
||
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
|
||
HEIGHT="28" WIDTH="50" BORDER="0"
|
||
> [Ben]
|
||
|
||
______
|
||
.-" "-.
|
||
/ \
|
||
_ | | _
|
||
( \ |, .-. .-. ,| / )
|
||
> "=._ | )(__/ \__)( | _.=" <
|
||
(_/"=._"=._ |/ /\ \| _.="_.="\_)
|
||
"=._ (_ ^^ _)"_.="
|
||
"=\__|IIIIII|__/="
|
||
_.="| \IIIIII/ |"=._
|
||
_ _.="_.="\ /"=._"=._ _
|
||
( \_.="_.=" `--------` "=._"=._/ )
|
||
> _.=" "=._ <
|
||
(_/ \_)
|
||
</PRE>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<a name="spam_nigeria"></a>
|
||
<P> <hr> <P>
|
||
<!--====================================================================-->
|
||
|
||
<center><H3><font color="maroon">World of Spam: Nigeria-related</font></H3></center>
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
|
||
(Urgent and confidential)<BR>
|
||
(Re: TRANSFER OF ($ 152,000.000.00 USD
|
||
(ONE HUNDRED AND FIFTY TWO MILLION DOLLARS
|
||
|
||
<P> Dear sir,<BR>
|
||
We want to transfer to overseas ($ 152,000.000.00 USD)
|
||
One hundred and Fifty two million United States
|
||
Dollars) from a Prime Bank in Africa, I want to ask
|
||
you to quietly look for a reliable and honest person
|
||
who will be capable and fit to provide either an
|
||
existing bankaccount or to set up a new Bank a/c
|
||
immediately to receive this money,even an empty a/c
|
||
can serve to receive this money, as long as
|
||
you will remain honest to me till the end for this
|
||
important business trusting in you and believing in
|
||
God that you will never let me down either now or in
|
||
future.
|
||
|
||
<P> The amount involved is (USD 152M) One hundred and
|
||
Fifty two million United States Dollars, only I want
|
||
to first transfer $52,000.000 [fifty two million
|
||
United States Dollar from this money into a
|
||
safe foreigners account abroad before the rest, but I
|
||
don't know any foreigner,
|
||
|
||
<BLOCKQUOTE><EM>
|
||
[Doesn't know any foreigner, huh? -Iron.]
|
||
</EM></BLOCKQUOTE>
|
||
|
||
|
||
I am only contacting you as
|
||
a foreigner because this money can not be approved to
|
||
a local person here, without valid international
|
||
foreign passport, but can only be approved to any
|
||
foreigner with valid international passport or drivers
|
||
license and foreign a/c because the money is in us
|
||
dollars and the former owner of the a/c Mr. Allan P.
|
||
Seaman is a foreigner too, [and the money can only be
|
||
approved into a foreign a/c However, we will sign a
|
||
binding agreement, to bind us together
|
||
|
||
|
||
<P> With my influence and the position of the bank
|
||
official we can transfer thismoney to any foreigner's
|
||
reliable account which youcan provide with assurance
|
||
that this money will be intact pending our physical
|
||
arrival in your country forsharing. The bank official
|
||
will destroy all documents of transaction
|
||
immediately we receive this money leaving no trace to
|
||
any place and to build confidence you can come
|
||
immediately to discuss with me face to face after
|
||
which I will make this remittance in your presence and
|
||
three of us will fly to your country at least two
|
||
days ahead of the money going into the account.
|
||
|
||
<P> I will apply for annual leave to get visa immediately
|
||
I hear from you that you are ready to act and receive
|
||
this fund in your account. I will use my position and
|
||
influence to obtain all legal approvals for onward
|
||
transfer of this money to your account with
|
||
appropriate clearance from the relevant ministries
|
||
and foreign exchange departments.
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
|
||
I am Dr. Mrs. Mariam XXXXX, wife to the late Nigerian Head of state,
|
||
General XXX XXXXX who died on the Xth of XXX 1998 while still on active
|
||
service for our Country. I currently have within my reach the sum of 18.92
|
||
million U.S dollars cash which l intend to use for investment purposes outside
|
||
Nigeria.
|
||
This money came as a result of a payback contract deal between my husband
|
||
and a Russian firm in our country's multi-billion dollar Ajaokuta steel plant
|
||
....
|
||
Your URGENT response is needed. Please include your personal phone and fax
|
||
number.
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
Subject: URGENT & CONFIDENTIAL<BR>
|
||
ATTENTION: THE PRESIDENT,<BR>
|
||
|
||
|
||
<P> I AM AN ACCOUNTANT AND MEMBER OF THE TENDER COMMITTEE OF MY CORPORATION,
|
||
THE NIGERIA NATIONAL PETROLEUM CORPORATION (NNPC).
|
||
|
||
<P> AFTER DUE CONSULTATION WITH OTHER MEMBERS OF THE COMMITTEE I HAVE
|
||
SPECIFICALLY BEEN MANDATED TO ARRANGE WITH YOU FOR A POSSIBLE TRANSFER OF SOME
|
||
FUNDS ...
|
||
RESULTING FROM VARIOUS CONTRACTS ...
|
||
|
||
<P> WE EXPECT TO LOBBY TOP OFFICIALS FOR THEM TO APPROVE THE PAYMENT.
|
||
|
||
<P> NOTE THAT WE HAVE PUT IN MANY YEARS OF METICULOUS SERVICE TO THE GOVERNMENT
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
i am chief babatope babs, the secretary to the federal government of nigeria
|
||
contract award and monitoring committee in the nigerian national petroleum
|
||
corporation (n.n.p.c).
|
||
|
||
<p> sometime ago, a contract was awarded to a conglomerate of foreign companies
|
||
in n.n.p.c by my committee. these contracts were over - invoiced to the tune of
|
||
us$22.35million. this was done delibrately; the over-invoicing was a deal by
|
||
members of my committee to benefit from the project. we now desire to transfer
|
||
this money, which is presently in a suspense account of the n.n.p.c in our apex
|
||
bank into an overseas account
|
||
|
||
<BLOCKQUOTE><EM>
|
||
[A </EM>suspense<EM> account? Does he mean a </EM>suspended<EM>
|
||
account? -Iron.]
|
||
</EM></BLOCKQUOTE>
|
||
|
||
it does not matter whether or not your company does contract projects of the
|
||
nature described here. the assumption is that you won a major contract and
|
||
subcontracted it out to other companies, more often than not, big trading
|
||
companies or firms of unrelated fields win major contracts and subcontracts to
|
||
more specialised firms for execution of such contracts.
|
||
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
<P> Subject: Son of Babs
|
||
|
||
<BLOCKQUOTE><EM>
|
||
[This was another message similar to the one above, but from Babs'
|
||
son. It said that Babs was
|
||
killed on duty several years ago. -Iron.]
|
||
</EM></BLOCKQUOTE>
|
||
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
<P> I HOPE MY LETTER DOES NOT CAUSE YOU TOO MUCH EMBARRASSMENT AS
|
||
I WRITE TO YOU IN GOOD FAITH BASED ON THE CONTACT ADDRESS GIVEN TO ME BY A
|
||
FRIEND WHO ONCE WORKED AT THE NIGERIAN EMBASSYIN YOUR COUNTRY.
|
||
|
||
<P> I REPRESENT MOHAMMED XXXXX, SON OF THE LATE GEN. XXX XXXXX, WHO WAS THE
|
||
FORMER MILITARY HEAD OF STATE IN NIGERIA. HE DIED IN 1998. SINCE HIS DEATH, THE
|
||
FAMILY HAS BEEN LOSING A LOT OF MONEY DUE TO VINDICTIVE GOVERNMENT OFFICIALS
|
||
WHO ARE BENT ON DEALING WITH THE FAMILY. BASED ON THIS THEREFORE, THE FAMILY
|
||
HAS ASKED ME TO SEEK FOR A FOREIGN PARTNER WHO CAN WORK WITH US AS TO MOVE OUT
|
||
THE TOTAL SUM OF US$75,000,000.00 ( SEVENTY FIVE MILLION UNITED STATES DOLLARS
|
||
), PRESENTLY IN THEIR POSSESSION.
|
||
|
||
|
||
|
||
|
||
<a name="spam"></a>
|
||
<P> <hr> <P>
|
||
<!--====================================================================-->
|
||
|
||
<center><H3><font color="maroon">World of Spam: Other</font></H3></center>
|
||
|
||
<P> <HR> <P>
|
||
<!--======================================================================-->
|
||
<P>
|
||
|
||
Subject: Can you handle big bucks?
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
<TT>Content-Type: application/octet-stream; name="Setup.exe"</TT>
|
||
|
||
<BLOCKQUOTE><EM>
|
||
[Yeah, like I'm really going to open an attachment called
|
||
Setup.exe. -Iron.]
|
||
</EM></BLOCKQUOTE>
|
||
|
||
|
||
<HR NOSHADE WIDTH="80%"> <!-- ************************************** -->
|
||
|
||
Subject: RE: what happened to your email
|
||
|
||
<P>
|
||
Just a short little note today from me - just meant to help you since you've
|
||
been posting to FFA pages like mine.
|
||
|
||
<P> If you are posting and advertising all over the place and not getting the
|
||
results you want - THERE IS A GOOD REASON WHY you're not getting results!
|
||
|
||
<P> If you are ARE "signing up" people - but THEY never do anything that makes
|
||
you OR them money - THERE IS A GOOD REASON WHY that's happening.
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
Have you ever considered opening your own High Quality on-line Singles/Dating
|
||
Service or significantly enhancing your existing Web Site with a
|
||
Singles/Dating/Matchmaking area?
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
DATA
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
Subject: Hi. Just seeing how you're getting on.
|
||
|
||
<P> Have you got your internet business up and running yet?
|
||
Is it making you money?
|
||
If not then you need to check out this opportunity.
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
Subject: I LOVE YOU AND I DON'T WANT YOU TO DIE!!!!!!!!!.
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
Subject: I Thought of You When I Saw This Program!
|
||
|
||
<P> " THE KARMA PROGRAM! "
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
Subject: Bulletproof Website Hosting Available..
|
||
|
||
<P> BULK FRIENDLY offshore website hosting only $500 per month.<BR>
|
||
Bulk Email advertise your website, RISK FREE!<BR>
|
||
Never have your website shutdown again!<BR>
|
||
More hits and business than you can imagine.
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
I am sending you this to see if you might be interested in testing E Mail marketing for your company. Based on our experience, targeted E Mail
|
||
marketing should dramatically reduce your marketing costs while simultaneously boosting your sales.
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
Subject: FREE Secrets to Wealth on the Web
|
||
|
||
<P> Every month over 1,000,000 new web-sites come on-line. Websites
|
||
from people who want to make a living from internet commerce. But
|
||
they haven't the slightest idea how to go about it.
|
||
|
||
<P> Would you like to be able to get a list of these people?
|
||
Newcomers to the Net are ideal prospects for anyone offering
|
||
Internet Marketing services and training of any kind. Would you
|
||
like to get the tools to trace them, take them by the hand, and
|
||
sell them your unique internet marketing program?
|
||
|
||
<P> These newbies will welcome your offer with outstretched arms!
|
||
(Remember your own desperation when you entered the net??)
|
||
|
||
<P> Imagine! You can offer them a free manual that provides the
|
||
step-by-step information they have been searching for ever since
|
||
they came on line, when they buy the necessary software to become
|
||
successful from you.
|
||
|
||
<P> Do you think you'll have any problems selling to these people???
|
||
|
||
<P> When you realize that newcomers to the Internet want and need
|
||
your help, it should be clear that here is the answer to all of
|
||
your promotion fantasies! Here is the Mother-lode! The source of
|
||
more business than you ever dreamed of! If you could reach these
|
||
people, it would be almost like getting the combination to your
|
||
bank's safe!
|
||
|
||
<P> The question is though, how do you find these people?
|
||
|
||
<P> There is no main gate to the Internet, that everyone goes through
|
||
when they first get online... There's no "newbie" lounge where
|
||
they all congregate... or is there?
|
||
In fact, there is a place where most Internet newcomers gather,
|
||
if they are hoping to establish a web-based home business. You
|
||
can find them there any time of the day or night... I can show
|
||
you where they are!
|
||
|
||
<P> None of the internet Marketing Gurus has ever been able to tell
|
||
you where to catch these people when they're entering the net! I
|
||
can and I will!
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
This email is being sent to you on behalf of your current webspace provider.
|
||
|
||
<BLOCKQUOTE><EM>
|
||
[It was, huh? Do you even know who my webspace provider is? -Iron.]
|
||
</EM></BLOCKQUOTE>
|
||
|
||
<P> If you would like to receive this excellent offer all you have to do is
|
||
send your details to the following email address and your username and password
|
||
will be emailed to you within 5 business days. Then you will be able to login
|
||
at the members area of XXXXX.com and configure your account (add domains,
|
||
setup scripts etc.).
|
||
|
||
<P> Please send all of the following details:
|
||
|
||
<P>
|
||
Your Full Name<BR>
|
||
Your Full Address<BR>
|
||
Your Phone Number<BR>
|
||
Your Email Address<BR>
|
||
Your Credit Card Number<BR>
|
||
Your Credit Card Expiry Date<BR>
|
||
Your Credit Card Type (eg. visa, mastercard etc.)<BR>
|
||
|
||
<P> Send all of the above to XXXXX@techieXXX.com
|
||
|
||
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
SUBJECT: Are You In Need Of A Lifestyle Change...
|
||
|
||
<HR NOSHADE WIDTH="80%" ALIGN="center"> <!-- ***************************** -->
|
||
|
||
Note the compiling of previous customers' e-mail addresses.
|
||
|
||
<P> Are you ready to upgrade your web site for e-commerce or drastically
|
||
improve your current shopping cart system?...
|
||
|
||
<UL>
|
||
<LI>
|
||
The admin area allows all orders to be saved to a permanent database where
|
||
previous customers can be searched by any of the criteria from the order. A
|
||
list of previous customer's email addresses can be compiled in this area as
|
||
well.
|
||
</UL>
|
||
|
||
<P> Don't be the one to waste valuable time with an inferior shopping cart
|
||
program that isn't tailored to your business. XXXXX was developed and by an
|
||
experienced web development company that specializes in helping people like you
|
||
sell and market products over the Internet.
|
||
|
||
<P> Due to our ISP's terms of service agreement, we are unable to advertise the
|
||
web address of the Atomicart demonstration web site in this message, so contact
|
||
us today at XXX XXX XXXX and we will provide you with demonstration web
|
||
addresses. When you call, you will speak directly with a software engineer not
|
||
a salesperson.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<HR> <!-- ************************************************************** -->
|
||
|
||
<P> Happy Linuxing!
|
||
|
||
<P> Mike ("Iron") Orr<br>
|
||
Editor, <A HREF="http://www.linuxgazette.com/"><i>Linux Gazette</i></A>, <A
|
||
HREF="mailto:gazette@ssc.com">gazette@ssc.com</a>
|
||
<BR CLEAR="all">
|
||
|
||
<!-- *** END Not Linux *** -->
|
||
|
||
<!-- *** BEGIN copyright *** -->
|
||
<P> <hr> <P>
|
||
<H5 ALIGN=center>
|
||
Copyright © 2001, the Editors of <I>Linux Gazette</I>.<BR>
|
||
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
||
Published in Issue 70 of <i>Linux Gazette</i>, September 2001</H5>
|
||
<!-- *** END copyright *** -->
|
||
|
||
|
||
</BODY></HTML>
|