Docstoc

simpsons screensaver

Document Sample
simpsons screensaver Powered By Docstoc
					LINUXUSER                          Fortune




Fortune cookies for Linux



FORTUNE TELLER




                                                                                                                                            www.photocase.com
Fortune brings you a saying or a joke when you launch a terminal                                If you want to restrict fortune to a
                                                                                              single quotation database file, simply
session. Or you can attach a fortune to your email signature to                               specify the file as a parameter. Typing

brighten up your messges. BY HAGEN HÖPFNER                                                     fortune startrek linuxcookie




I
   f you want your fortune telling and            I will focus on the legacy version, but     will restrict Fortune to quotations from
   you can’t wait until your next Chi-         you can follow nearly all of the examples      Star Trek (including the stardate) on
   nese meal, why not configure your           if your distribution happens to include        various Linux-related subjects.
Linux computer to hand out virtual for-        the fortune-mod package instead.
tune cookies?                                                                                 Multifaceted and Verbose
                                               Say What?                                      If the supplied quotation databases are
Which Version?                                 The simplest way of running the tool is        not to your liking, you may find some-
Most Linux distributions include a for-        to give the fortune command, which out-        thing more to your taste on the Internet.
tune-cookie tool known as Fortune. The         puts a quotation or joke (Figure 1). The       The site at [2] is a good place to start.
package for Suse 9.3 is simply called for-     jokes are taken from database files that       Fans of the Simpsons might like the
tune. Gentoo users can give the emerge         are included with the program.
fortune-mod command to add the virtual         The database files typically re-
fortune teller to their software collection.   side below the /usr/share/for-
  The original Fortune tool was written        tune/ folder. Mandriva stores
in 1986 by Ken Arnold and has been ex-         the files in /usr/share/games/
tended ever since. In 1995, Amy A.             fortunes. But fortune -f gives
Lewis released an enhanced version on          you a quicker way of finding
which fortune-mod [1], which was re-           out which topics your version       Figure 1: Enter the Fortune command in a terminal win-
leased in 2004, is based.                      of Fortune covers.                  dow to display a quotation or joke.




80        ISSUE 63 FEBRUARY 2006                  WWW.LINUX - MAGAZINE.COM
                                                                                                Fortune               LINUXUSER




                                                                        in the Datfiles          sbin/strfile my_fortunes my_fortunes.dat
                                                                        folder. However,         command to create the index.
                                                                        the package does
                                                                        not include index        No Worries
                                                                        files for the collec-    Besides giving you a neat command line
                                                                        tions; that is, the      gadget, Fortune has other uses. For ex-
                                                                        .dat files are miss-     ample, you could add a call to Fortune at
                                                                        ing. When you            the end of your ~/.bashrc file, to have
                                                                        call fortune .           Fortune welcome you with a different
                                                                        /provierbios.            wacky saying each time you open a ter-
                                                                        fortune, the pro-        minal window.
                                                                        gram just outputs           Fortune is also useful in combination
                                                                        an error message         with a screen saver. On KDE, you can
                                                                        telling you that         combine Fortune with the Phosphor
                                                                        it can’t find the        screen saver, for example (Figure 2). If
                                                                        database.                you do not use KDE, the xlock -mode
Figure 2: Some screen savers, such as Phosphor on KDE, can inte-           Fortunately, the      marquee command will give you a
grate Fortune.                                                          tool you need to         screen saver with lots of variety.
                                                                        create an index,            Fortune is just as useful as a random
chalkboard database at [3]. To feed            strfile, is automatically installed along         signature generator for mail. For exam-
Fortune with Bart Simpson quotations,          with the Fortune program. strfile parses          ple, Kontact has an option for setting up
download and unpack the archive file,          files as blocks of text separated by sim-         a signature for each mail ID in Settings /
then launch the cookie server by enter-        ple percent signs. It uses this informa-          Configure KMail. To allow Fortune to add
ing                                            tion to create a file with an index for the       a citation or saying to your electronic
                                               text blocks. The syntax for our example           mail, double click on the identity and, in
  fortune U                                    would be                                          the Edit Identity window, select the Sig-
 ./fortune-simpsons-chalk boardU                                                                 nature tab. Check the Enable Signature
 /chalkboard                                      /usr/sbin/strfile U                            box in the Signature tab, then select Out-
                                                  provierbios.fortune U                          put of command in the Obtain Signature
If you intend to run Fortune with a num-          provierbios.fortune.dat                        text from: dropdown menu; type the For-
ber of databases that are not included by                                                        tune command in the box labeled Specify
default, it is a good idea to create a sepa-    The strfile tool is also useful if you want      command (Figure 3).
rate directory for each database: ~/.my_        to create a Fortune database from a file            It makes sense to run Fortune with the
quotations, for example. You could then         with your own quotations. First create a         -s -n 320 options for mail signatures. -s
copy the quotation database and the             text file with the required citations and        tells Fortune to keep output “short,” and
matching .dat file, e.g. chalkboard and         sayings. Follow each entry in the file           -n 320 tells Fortune to regard all citations
chalkboard.dat, to the new directory.           with a line containing a single percent          below 320 characters as short.
   To tell Fortune to parse this folder,        sign, as in                                         Other mail programs, such as Syl-
simply specify the path when calling the                                                         pheed, also have options for using the
program: fortune ~/.my_quotations. If             Four legs good, two legs bad.                  output from Fortune as a signature. But
you want to add a new quotation data-                            -- G. Orwell                    don’t worry if your mail program does
base to the existing files, simply specify        %                                              not have this ability. You can easily write
both paths at the command line. You can           Many a mickle makes a muckle.                  a script, or set up a cronjob, to call For-
use percentages to increase the odds of           %                                              tune at regular intervals and write the
Fortune giving you a quote from your fa-                                                         command output to a ~/.signature file.
vorite directory: fortune 90% ~/.my_            Then choose a name to store the file,            Then configure your mail program to use
quotations 10% /usr/share/fortune will          such as my_fortunes, and run the /usr/           the contents of the file as a signature. I
ensure that 90% of all quotations come
from your own collection. But make sure                                                                            INFO
that the percentages add up to 100%, or                                                           [1] fortune-mod: http://www.redellipse.
Fortune will protest.                                                                                 net/code/fortune
                                                                                                  [2] Fortune databases from Freshmeat:
More Sayings                                                                                          http://freshmeat.net/browse/895/
If you would like to add a non-English                                                            [3] Bart Simpson quotes:
Fortune database, take a look at the col-                                                             http://www.splitbrain.org/Fortunes/
lection at [4]. The page includes a Span-                                                             simpsons/fortune-simpsons-chalk-
ish Fortune database under fortunes-es_                                                               board.tgz
1.24.tar.gz. When you unpack the data-          Figure 3: Enabling Fortune as a signature         [4] Debian’s fortunes: http://packages.
                                                                                                      debian.org/unstable/games/
base, the quotation files will be located       generator in Kontact’s identity settings.




                                                    WWW.LINUX - MAGAZINE.COM                         ISSUE 63 FEBRUARY 2006                 81

				
DOCUMENT INFO
Shared By:
Stats:
views:196
posted:3/29/2009
language:English
pages:2