Fortune

From

Revision as of 23:29, 7 February 2012 by Perspectoff (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Fortune

Fortunoid

Fortunoid is a Plasma Widget that serves as a frontend GUI for the fortune package.

Installing the Fortunoid widget package (in Kubuntu/KDE) by

sudo apt-get install plasma-widget-fortunoid

will also install the fortune package. If only the fortune package is desired (which can be run in a command-line terminal), it can be installed by itself:

sudo apt-get install fortune
or
sudo apt-get install fortune-mod

The fortune module can be customized.

  • The quotations themselves are stored in the /usr/share/games/fortunes folders.
  • There are multiple categories of quotations, and the file for each category can be edited directly.
  • When using the command-line, categories of quotations can be selected merely by specifying them. Example:
fortune zippy science
  • There are many options for the command-line fortune utility (see here). Any or all of these command-line options can be entered as an argument in the Fortunoid widget.

Adding categories of fortunes (fortune modules)

  • See this list of the original fortune modules (categories).
  • Other modules can often be found by a Google search for fortune-mod.
  • Wikiquotes is an online repository for quotations. A webpage can easily be copied to a text file, for conversion into a fortune data file (see below). An example page is Wikiquotes -- Zen proverbs.
  • See this brief tutorial.
  • Make sure fortune-mod is installed:
sudo apt-get install fortune-mod
  • Change to the fortune directory:
cd /usr/share/games/fortunes
  • Edit a category text file with quotations separated by % symbols:
I reject your reality and substitute my own...
%
This is one of those "What the hell am I doing?" moments, over!
%
We got a robot in the water, he's stuffed with tuna and it's just another day here at Mythbusters.

Then, for example, save this text file as newcategory1.

  • It is also possible to include a URL as the text in a quotation. (Most browsers will then automatically change the text into an actual link.) In this way, a list of random URL links can be displayed through the Fortune module.
My reality comes from http://ubuntuguide.org
%
When I wonder "What the hell I am doing?" I go to Kubuntuguide at http://ubuntuguide.org/wiki/Kubuntuguide
%
MediaWiki is the premier wiki. Vist their website: http://www.mediawiki.org/wiki/MediaWiki
  • There is also a UTF-8 file which is merely a symbolic link to the text file:
sudo ln -s newcategory1 newcategory1.u8
  • Convert the text file into a data file for use by fortune.
sudo strfile newcategory1 newcategory1.dat
  • Select newcategory1 as a command-line option or as an argument in Fortunoid.

Using Fortune in Drupal

  • A Drupal plugin for Fortune is available. While this is a nice module, the disadvantage of it is that it displays the quotations in Monotext; there is no ability to select font size and type.

On a server with Drupal installed, download the module:

cd /etc/drupal/6/all/sites/modules
sudo wget http://ftp.drupal.org/files/projects/fortune-6.x-1.0.tar.gz
sudo tar zxvf fortune-6.x-1.0.tar.gz
sudo rm fortune-6.x-1.0.tar.gz

Note: The module can also be placed in a particular subsite's module folder (if there are multiple Drupal subsites on the server), instead of in the sites/all/modules folder.

Enable the module:

Drupal -> Administer -> Site building -> Modules -> Other -> Fortune (ticked) -> Save configuration
  • Load the module (update) and set permissions in Drupal as usual.
  • Configure the Fortune settings:
Drupal -> Administer -> Site configuration -> Fortune
-> Select the categories of quotations desired -> Submit
  • Add the Fortune Block on your site:
Drupal -> Administer -> Site building -> Blocks -> Fortune -> Configure
-> Show block on only the listed pages (ticked): list of pages you wish Fortune block shown on -> Save

Using Fortune in MediaWiki

Personal tools
Sponsor