101

linux magazine uk 11

  • Upload
    -

  • View
    247

  • Download
    0

Embed Size (px)

DESCRIPTION

linux magazine uk 11

Citation preview

Page 1: linux magazine uk 11
Page 2: linux magazine uk 11
Page 3: linux magazine uk 11

INTROCOMMENT

11 · 2001 LINUX MAGAZINE 3

General ContactsGeneral Enquiries 01625 855169Fax 01625 855071

www.linux-magazine.co.ukSubscriptions [email protected] Enquiries [email protected] [email protected]

Editor John [email protected]

CD Editor Richard [email protected]

Contributors Alison Davis, Dean Wilson,Colin Murphy, Alison Raouf,Richard Smedley, Kim Hawtin,Richard Ibbotson

International Editors Harald [email protected] [email protected] [email protected]

International Contributors Simon Budig, Mirko Dölle,Björn Ganslandt, Georg Greve,Jo Moskalewski, Christian Perle,Frank Haubenschild,CarstenZerbst, Tim Schürmann,Stefanie Teufel, Berhard Bablok,Winfried Trümper, FionnBehrens, Lars Martin, MichaelEngel, Andreas Grytz, PatriciaJung, Karsten Gunther,Christian Wagenknecht

Design Renate Ettenberger vero-design,Tym Leckey

Production Bernadette Taylor, Stefanie Huber

Operations Manager Pam Shore

Advertising 01625 855169Carl Jackson Sales [email protected] Henry Account [email protected]üro [email protected]

PublishingPublishing Director Robin Wilkinson

[email protected]

Subscriptions and back issues01625 850565

Annual Subscription Rate(12 issues) UK: £44.91. Europe (inc Eire) :£73.88 Rest the World: £85.52Back issues (UK) £6.25

Distributors COMAG, Tavistock Road, WestDrayton, Middlesex England UB7 7QE

Print R. Oldenbourg

Linux Magazine is published monthly by Linux New Media UKLtd, Europa House, Adlington Park, Macclesfield, Cheshire,England, SK10 4NP. Company registered in England.

Copyright and Trademarks (c) 2001 Linux New Media UK Ltd

No material may be reproduced in any form whatsoever in wholeor in part without the written permission of the publishers. It isassumed that all correspondence sent, for example, letters, e-mails,faxes, photographs, articles, drawings, are supplied for publicationor license to third parties on a non-exclusive worldwide basis byLinux New Media unless otherwise stated in writing.

ISSN 14715678

Linux is a trademark of Linus Torvalds

Linux New Media UK Ltd is a division of Linux New Media AG,Munich, Germany

DisclaimerWhilst every care has been taken in the content of the magazine, thepublishers cannot be held responsible for the accuracy of theinformation contained within it or any consequences arising from theuse of it. The use of the CD provided with the magazine or anymaterial providied on it is at your own risk. The CD is comprehensivelychecked for any viruses or errors before reproduction.

Technical SupportReaders can write in with technical queries which may beanswered in the magazine in a future issue, however LinuxMagazine is unable to directly provide technical help or supportservices either written or verbal.

We pride ourselves on the origins of our magazinewhich come from the very start of the Linuxrevolution. We have been involved with Linux

market for six years now through our sister European-based titles Linux Magazine (aimed atprofessionals) and Linux User (for hobbyists), and through seminars, conferences and events.

By purchasing this magazine you are joining an information network that enjoys the benefit ofall the knowledge and technical expertise of all the major Linux professionals and enthusiasts. Noother UK Linux magazine can offer that pedigree or such close links with the Linux Community.We're not simply reporting on the Linux and open source movement - we're part of it.

CURRENT ISSUES

RETAILSALES

I was going to write about Steve Ballmer theMicrosoft CEO calling Linux a cancer, but theirlatest missive for the retail industry is farfunnier. They have produced a white paper onwhy the retail industry should not use Linux.Split into ten different areas, it is morehumorous than my daily UserFriendly cartoon.Each section is filled with lies and untruths.

For example in one section they complainthat Linux has so many installation versions.This is obviously bad to Microsoft as they say‘with so many different distributions available,there are bound to be proprietariesintroduced beyond the free operating systemto allow vendors to distinguish themselves.’Hmmm choice is bad then. Never mind thatMicrosoft’s whole ethos is about introducingproprietary technology.

‘Microsoft, unlike Linux, has one standardgraphical user interface across its limitednumber of operating systems.’ So one size fitsall and again choice is a bad thing.

In the section – Less Secure :’”Opensource” means that anyone can get a copy ofthe source code. Developers can find securityweaknesses very easily with Linux. The sameis not true with Microsoft Windows.’

To be honest they are correct. We do getthe source and we do find security

weaknesses. Unfortunately they then miss thepoint by a mile. We also post fixes and areopen about problems. If everyone knows thenit is harder to exploit. The same cannot be saidfor Microsoft. It is all very well for me to readabout problems in my TechNet subscriptionbut the majority of people do not know andso can be compromised.

They do raise some good points such aslimited device driver support and untestedwaters in retail. Device drivers are always aproblem as Linux has not yet caught all thehardware developers support. Untestedwaters is both a disadvantage with noprevious market penetration but also anadvantage as we have not yet made errors inthe market.

Although the paper is aimed atpersuading buyers to steer clear of Linux, Ithink most are bright enough to read betweenthe lines for themselves.

Happy hacking

John Southern, Editor

003welcomesbd.qxd 29.06.2001 19:25 Uhr Seite 3

Page 4: linux magazine uk 11

NEWS

6 LINUX MAGAZINE 11 · 2001

Red Hat has announced the keynote schedule of thecompany’s first Red Hat TechWorld conference. Theconference, to be held in Brussels on 17 and 18September 2001, will give open source companiesand users a chance to meet, demonstrate their newproducts and learn more about other newtechnologies being developed in the open sourcespace.

Keynote speakers will include Bob Young, co-founder and chairman of Red Hat, who will explainwhy he believes open source is inevitable, andMatthew Szulik, Red Hat chief executive andpresident, who will discuss how open source canhelp solve the technical education problem. MichaelTiemann, Red Hat chief technology officer, willdiscuss how Linux can move from its revolutionarystandpoint to be accepted as part of theestablishment. Glyn Moody, author of the book‘Rebel Code’ will discuss the contribution hackershave made to technological progress by writingsoftware and then giving it away.

Technical track speakers Stephen Tweedie, MarkCox, Gary Thomas, Owen Taylor, Havoc Pennington,Tom Tromey and Alex Larsson will be speaking onsuch open source topics as embedded, e-commerce, development tools, applicationsolutions, application development, Red HatNetwork, application solutions and deployment.

Red Hat chief technology officer MichaelTiemann said: ”It is a very exciting time for the opensource movement, with the adoption of Linux andopen source accelerating at such speed on a globalscale. Red Hat TechWorld Brussels will bringtogether the technology, the developers and theusers, and provide a learning and networkingenvironment in which to share ideas andknowledge. We look forward to hosting the firstRed Hat TechWorld event and providing a forum foreveryone to get together and share theirexperiences with open source and with Red Hattechnologies.”

Infohttp://www.redhat-techworld.com

Brussels sprouts Red Hat conference

Knocked for sixCompaq has announced six new initiatives to meetglobal customer demand for commercially viableLinux enterprise solutions. These include: high-performance Beowulf clustering, a program forinteroperability and portability between Linux andUNIX, investment and participation in a Linux lab,training and certifying system engineers,contributing SSI clustering technology to the opensource community, and fostering development ofLinux applications for handheld devices.

Compaq has drawn on more than twentyyears of high performance and high availabilityclustering experience to build high performancetechnical computing clusters on AlphaServer. Nowthe company is partnering with leading Linuxplayers to deliver Beowulf clustering solutions onits ProLiant server platform, enabling enterprises ofall sizes to build supercomputer-like clusters of 16to 512 or more nodes.

To further the development of its Linuxsolutions, Compaq is working closely with Oracle,with plans to participate in Oracle’s Linux Lab tooptimise kernel development and performance.”Oracle and Compaq continue to deliver leadingedge solutions to the enterprise,” said, MikeRocha, senior vice president, Oracle. ”Workingtogether in the Linux lab capitalises on ourrespective strengths and expertise in developingmore reliable and scalable next-generation Linuxapplications.” ■

SuSE’s oracleOpen source solutions provider SuSE Linux hasannounced that its Linux operating system hasnow been validated for Oracle’s Oracle9i databasetechnology.

The validation means that SuSE can now offerits e-business infrastructure to customers using theOracle9i database.

Dirk Hohndel, president of SuSE, expressed hisdelight at working with Oracle to deliver an opensource e-business solution: ”Oracle9i Databaseprovides a powerful software infrastructure for thee-business needs of thousands of companiesaround the world. Using SuSE Linux, thesecompanies have one of the most secure,affordable and reliable operating systems in theworld as an alternative to more expensive systemssuch as WindowsNT and proprietary UNIXsystems. We are pleased to be the first Linuxcompany to have validated our operating systemagainst Oracle9i Database and we look forward toour extensive collaboration on future products.”

Doug Kennedy, vice president of globalpartnerships, Systems Platform Division at OracleCorporation, said: ”We ask our Linux partners touse an extensive set of criteria to validate and testtheir operating systems with Oracle9i Database.This brings enormous value to customers becauseit gives them the affordability and reliability ofLinux together with the power of Oracle9iDatabase.” ■

006newssbd.qxd 29.06.2001 19:30 Uhr Seite 6

Page 5: linux magazine uk 11

NEWS

11 · 2001 LINUX MAGAZINE 7

Ask SleepycatSearch engine provider Ask Jeeves has chosenSleepycat’s Berkley DB embedded database for themanagement of its question answering data. AskJeeves’ Web Properties handles high transactionvolumes to deliver information to users on Ask.com,AJKids.com, and DirectHit.com.

Ask Jeeves developers will now use Berkeley DBto help them build high performance Web-basedsolutions, said Ed Boudrot, product manager for AskJeeves: ”We perform somewhere on the order of 8-10 billion transactions with Berkeley DB on amonthly basis without failure. We selected BerkeleyDB to store information because of its flexiblearchitecture, extremely high transaction rate, and itsability to scale. In addition, our experience withSleepycat’s customer support has been outstanding.When we have a technical matter to solve, theSleepycat team is responsive and effective.”

Michael A. Olson, vice president of marketing atSleepycat Software, said: ”By combining itsinnovative natural language and popularity searchtechnology with Berkeley DB, Ask Jeeves hasbecome the 15th most popular Web property onthe Internet. We’ve worked hard to provide anembedded database that scales well and remainsfast and reliable at any size. Ask Jeeves’ decision todeploy Berkeley DB convinces us that we’ve madethe right choices.”

InfoThe Sleepycat technology is available fordownload at the company’s website,http://www.sleepycat.com

DataPiped, courtesy of Ensim

Hosting automation provider EnsimCorporation has announced that DataPipeis its first service provider customer for itsoutsourced data centres initiative incollaboration with Compaq.

Mark Linesch, vice president of ServiceProvider Solutions, Compaq IndustryStandard Server Group said that workingwith partners such as Ensim enabledCompaq to deliver highly optimisedProLiant server platforms to customers:”With this initiative Compaq and Ensimcontinue to drive greater simplification andinnovation in the growing Linux Service

Provider market and deliver customers thereturn on investment they require to becompetitive.”

DataPipe has deployed Ensim’s flagshipproduct, ServerXchangeT, with CompaqProLiant servers to optimise hostingautomation of the Compaq systems andthe applications that run on them.

Robb Allen, chief executive ofDataPipe, said: ”As part of our growthequation, deploying ServerXchange on ourCompaq ProLiant servers has streamlinedour operations and certainly created newrevenue opportunities.”

The Ensim-Compaq initiative meansthat DataPipe will now be able to optimisethe provisioning and management of itsCompaq ProLiant server infrastructureusing Compaq Intelligent ManageabilityTools and Ensim ServerXchange. DataPipecan also create a reseller channel using theServerXchange three-layer control panel forthe service provider, reseller and end-user.■

ConnectivityThe NetLinOS initiative, created by Cyclades Corporation, has launched itsNetLinOS Web portal. The Web portal is intended as a centre on the Internetfor those involved in initiatives related to Linux-based network connectivity tokeep up to date with related developments, encouraging the development of newLinux based network appliances.

Visitors to the NetLinOS Web Portal can learn more about the initiative and view a list of productsdesigned and tested by the NetLinOS team. There are also ”how-to-build” tutorials for all products listedand visitors can access a database of hardware and software components used in developing Linux-basednetwork connectivity products.

Ivan Passos, leader of the NetLinOS project, explained how the portal came into being: ”We wanted tocreate a place on the Internet where visitors can view, contribute to, and communicate about the latestdevelopments involving network connectivity in Linux. The idea is not to compete with current efforts in thisarena, but to consolidate these efforts by using software already developed, contributing new code andfocusing on hardware and software integration to allow the development of commercial products.”

Infohttp://www.netlinos.org/

006newssbd.qxd 29.06.2001 19:30 Uhr Seite 7

Page 6: linux magazine uk 11

NEWS

8 LINUX MAGAZINE 11 · 2001

A step in the right directionTwenty four technology suppliers to cable, satellite and telecommunications operators have allied to formthe TV Linux Alliance, a group whose aim is to define a standards-based Linux environment to improveproducts, shorten time to market and speed up development cycles in the digital set-top box market.

Members of the TV Linux Alliance include ACTV, ATI Technologies, Broadcom Corporation, ConcurrentComputer Corporation, Conexant, Convergence Integrated Media, DIVA, Excite@Home, iSurfTV, LiberateTechnologies, Lineo, MontaVista, Motorola, nCUBE, OpenTV, Pace Micro Technology, Qpass, ReplayTV,STMicroelectronics, Sun Microsystems, TiVo, Trintech, TV Gateway and WorldGate. The Alliance’s new Linuxspecification will be available later this year.

Yankee Group analyst Adi Kishore said the new alliance would be in a position to provide networkoperators with a standardised offering from the Linux community for digital TV set-tops. He added:

”A common solution built around a single framework will reduce the integration issues that resultin lengthy deployment time-frames for advanced interactive applications, as well as middleware

solutions and set-top boxes.”Jerry Krasner, executive director, Electronics Market Forecasters, commented:

”The world of digital television is rapidly changing and the formation ofthis alliance will ensure that network operators have access to a

solid offering set from the Linux community for digital TV set-tops. No single company has been able to own the digital

TV market. The talents and technologies of thesecompanies rallying around a single framework for a

robust Linux solution should keep competition at theoperating system layer thriving while insuring thatadvanced interactive applications and middlewareproviders along with set-top manufacturers canget solutions to market more quickly.”

Infowww.TVLinuxAlliance.org

Endeavors Technology has unveiled the new betaversion of its secure cross-platform, cross-devicepeer-to-peer collaboration tool. Magi Enterprisev2.0 is aimed at VARs, OEMs and integrators.

Magi Enterprise v2.0 uses SSL and certificateauthority to address business concerns aboutsharing sensitive company information. Thesolution offers such features as file sharing,community index and search, chat and instantmessaging. Also included is a software developer’skit, enabling companies to create a peer-to-peercollaborative network and integrate applicationsfor tracking such processes as knowledgemanagement, productivity, revenue growth andprofitability.

Anne Zieger, principal analyst with enterprisepeer-to-peer research firm PeerToPeerCentral.com,

said: ”Without strong security protections in place,corporate managers are unlikely to take peer topeer seriously. But once secure platforms becomeavailable, peer-to-peer has a bright future in theenterprise. Solutions like Magi Enterprise –designed to offer highly secure file sharing andcommunication options – should be among thefirst to be adopted by IT departments.” JimLowrey, security architect for EndeavorsTechnology, adds: ”Peer-to-peer computing facesa mix of security issues not faced by traditionalsecure-computing paradigms. Magi Enterpriseaddresses these issues and now provides the vitalinfrastructure required by IT managers to constructsecure information processing systems withoutexposing an organisation’s systems and data totheft, attack, or compromise.” ■

Beta Endeavors

006newssbd.qxd 29.06.2001 19:30 Uhr Seite 8

Page 7: linux magazine uk 11

NEWS

11 · 2001 LINUX MAGAZINE 9

Caldera serves up 64Caldera has announced that a preview of itsOpenLinux Server 64 is now available. OpenLinuxServer 64, the result of work by Caldera and othermembers of the IA-64 Linux project to develop a64-bit operating system for the next generation ofStandard High Volume (SHV) server platforms,provides an enterprise class Linux server platformfor Intel Itanium-based systems, featuring Internetservices such as Web servers, file and print serversand network infrastructure, as well as theperformance platform for Linux enterprisesolutions.

Caldera chief executive Ransom Love said:”Itanium systems represent the next generationof high-end computing platforms. OpenLinuxServer 64 supplements Caldera’s range ofplatforms that span from desktop to data centre.As a Linux leader, we have the expertise toprovide an operating system such as OpenLinuxServer 64 that exploits Itanium’s capacity ofsupporting mission-critical businessapplications.”

Victor Krutul, manager of Software Programsat Intel, said: ”Itanium-based systems deliverworld-class operation for the most demandingenterprise and high-performance computingapplications. Caldera OpenLinux Server 64 willprovide business-focused customers with a smoothmigration path to deploy Itanium systems as theirapplication needs grow.” Caldera plans to makethe operating system generally available towardsthe end of the third quarter of 2001. ■

Corporate IT infrastructures in the UK are unequalto the demands being placed on them, newresearch has revealed. The research, conducted byMORI at the request of Hewlett-Packard,questioned IT decision makers in UK corporates.

In the past six months, according to theresearch, four in ten large companies reported thatpeak demands on their IT infrastructure hadoutstripped capacity. The respondents werepessimistic about the prospects for the future, withseventy-five percent saying they believed thesituation would remain unchanged or worsen. ITdecision makers look to outsourcing as a possiblesolution, with eighty percent of companiessurveyed currently considering outsourcing partsof their IT infrastructure to a service provider.

”It is clear that IT decision makers are feelingthe effects of peak demands more than ever, andcompanies are increasingly having to takeprecautions and invest in order to deliver the bestpossible service,” said Chris Franklin, UNIX ServerCategory Manager for HP. ”What the industryneeds is a cost effective, flexible, and securesolution which can deploy compute resourcesimmediately in a simple and effective manner,regardless of the overall peak demand.”

Franklin added that security continued to bean important consideration for organisations: ”Byembracing a utility computing model, UKcompanies can also benefit from a scalableInternet infrastructure with capacity on demandand instant Internet connectivity.” ■

New SuSE OS releasedSuSE Linux has announced the release of itsoperating system for Intel’s Itanium based systems.SuSE Linux 7.2 for Itanium systems is based on thelatest Linux technology, including the new LinuxKernel 2.4.4. As well as the operating system itself,the package features 1,500 applications on six CD-ROMs, enabling the set-up of intranet and Internetsolutions as well as set-up and protection ofheterogeneous networks.

For professional users there are tools for settingup WWW, proxy, mail, and news servers in Linux.Victor Krutul, manager of Operating SystemPrograms at Intel commented: ”End-users anddevelopers will be able to take advantage of the 64-bit capabilities of Itanium-based platforms and thetechnical competence of SuSE with the release ofSuSE’s 7.2 Linux. Linux on Itanium-based systemswill provide high performance, reliability, andflexibility to IT professionals.” ■

Notworking

006newssbd.qxd 29.06.2001 19:30 Uhr Seite 9

Page 8: linux magazine uk 11

NEWS

10 LINUX MAGAZINE 11 · 2001

Hewlett-Packard has announced new features forits e-utilica ‘out-of-the-box’ service provider solutionfor corporate networks. New features include theability to operate within multi-operating systemenvironments and on top of an existing ITinfrastructure.

e-utilica is now available with a range of bundlesto suit the requirements of the individual company,including extra storage, servers and software. e-

utilica comes with out-of-the-boxintegrated tools for

monitoring of usageto help IT

departments

forecast requirements.Chris Franklin, UNIX Server Category Manager

for HP UK said he saw an increasing demand withinthe corporate space for on-tap applications,processing power and storage-capacity on demand.”With e-utilica, we’re delighted to be offeringcorporates the unique opportunity to be as flexibleas they like, creating real business benefits within acost-effective and secure environment.”

Franklin added that, ”There is clearly a need foron-tap computing and we’re delighted to be theonly vendor offering customers the flexibility tosuccessfully adapt within today’s demanding andunpredictable business environment”. ■

New Matrox releaseMatrox Graphics has announced the release of itsnew open source graphical user interface (GUI)-based utility.

The Matrox PowerDesk for Linux enablesMatrox Linux users to manage their desktop,confire Matrox Dualhead display features such asmulti-display, clone and TV output, and makemonitor adjustments to change resolutionsettings, pixel depths and refresh rates.

”As the adoption of Linux among corporateand novice users grows, we wanted to provideconsumers with a desktop interface that is easy touse and free of the sometimes complex codingrequired under the OS,” said Alain Thiffault,Matrox global software manager. ”PowerDesk forLinux will dramatically increase productivity byallowing Linux users to change their desktopsettings using our point and click GUI, which is farmore efficient then the current text-basedapproach.”

InfoPowerDesk for Linux runs under XFree86versions 4.0.2 and 4.0.3 and is compatible withMatrox G200, G400 and G450-based graphicscards. It can be downloaded from the Matroxdriver page athttp://www.matrox.com/mga/support/drivers/home.cfm

Getting the messageInternet messaging solution provider Sendmail hasannounced that it has enabled its solution forLinux on the IBM eServer z900 and S/390 platform.The product becomes generally available in thethird quarter of this year. Until then, theSendmail/zSeries Early Support Program isavailable, offering early customers a productdiscount, as well as free set-up services, includinginstallation and configuration.

Rich Lechner, vice president of IBM eServermarketing, commented: ”Sendmail Internetmessaging solutions take advantage of thescalability, reliability and agility of the eServerz900. By exploiting the power of Linux on the IBMmainframe platform, Sendmail provides therobustness and scalability needed for today’smessaging and mail infrastructure with theindustry’s lowest total cost of computing.” ■

Double feature

006newssbd.qxd 29.06.2001 19:31 Uhr Seite 10

Page 9: linux magazine uk 11

NEWS

11 · 2001 LINUX MAGAZINE 11

Red Hat has announced that RedHat Linux 7.1 for the Itanium

Processor is now awailable. The new release featuresRed Hat Linux 7.1 with the new 2.4 kernel. It featuresnew configuration tools and security enhancementsand is configured to support eight or more Itaniumprocessors running as a single system image.

The release also provides default settings forsecurity that keep ports closed and Internet utilitiesinactive until needed. A new firewall screen enablesusers to customise their security settings by turningthe various features on or off.

Updates to the operating system includeimproved device support and improved multi-threaded network stack and virtual file system. Arevised scheduler enables the operating system tohandle more processes.

Michael Tiemann, chief technical officer at RedHat, said: ”Intel recognised very early that Linux wasgoing to be a very important operating system inthe future, and we are pleased that they chose towork with Red Hat as a strategic technologydeveloper. Red Hat Linux 7.1 for the ItaniumProcessor will enable the enterprise and technicalcomputing communities to take full advantage ofIntel’s new technology running on the industry’sstandard Linux platform”.

Victor Krutul, Linux Technology Manager forIntel commented: ”With the release of Red HatLinux 7.1 for the Itanium processor-based systems,developers should be confident that the technology,support and leadership is in place to successfullydevelop, deploy and manage 64-bit Linuxapplications and services.” ■

Expanded missionLinux solutions and services company MissionCritical Linux has announced the expansion of itsPreConfigured Solutions Program to includesystems built on Intel’s Itanium architecture. Theprogram currently combines Mission CriticalLinux’s convolo cluster software with hardwarefrom OEMs including IBM and Hewlett-Packard.The expanded program will enable the company todeliver a mission critical management servicessolution for customers who require an enterprisestandard high-availability solution.

Backed by Mission Critical Linux’s round theclock support, the PreConfigured SolutionsProgram is aimed at financial services, datacentres, securities, telecommunications, and high-tech industries, providing them with a Linux-basedsolution that can provide seamless high-availabilityfor applications like Web servers, email, Samba,NFS, and databases such as Postgres, Oracle,Informix, and DB2.

Moiz Kohari, chief executive of Mission CriticalLinux said, ”Working with industry-leading OEMson Itanium-based platforms, we see this expandedoffering as providing enterprise customers with acomprehensive answer to their IT needs. When youcombine Convolo, our deep Linux expertise, andthe Intel Itanium processor, you have a powerfulcombination of the hardware, software, andaround-the-clock support businesses demand.”

Victor Krutul, manager of Operating SystemsPrograms at Intel, said ”Linux solutions based onMission Critical Linux will allow companies to takefull advantage of the performance and scalabilitybuilt into Itanium-based platforms. The processorwas designed with business-critical environmentsin mind, and we think Linux and Intel Itaniumarchitecture is a powerful combination.” ■

Itanium Red Hat

Sharp choiceSharp has selected Lineo Embedix as the operatingsystem for the next generation of Sharp handhelddevices. Lineo announced that Embedix waschosen for its low hardware requirements, broadfeature support, and for its ability to bring theproduct quickly to market using the Linuxoperating system.

The new Sharp operating system platform willbe able to run software written in SunMicrosystems’ Java software language thatsupports a variety of operating systems. The firstLinux-based handhelds are expected to beavailable in autumn 2001 in North America.

Hiroshi Uno, general manager, mobile systemsdivision, Sharp Corporation said: ”Sharp hasdecided to use Linux because it is an openoperating system. And we selected Lineo, theleading provider of the Linux-based embeddedoperating system, Embedix, to run on ourupcoming PDA for the worldwide market. Linuxwill allow tens of thousands of Linux developers towrite applications for our devices.”

Sharp is also working with Tao Group andAmiga Corporation to develop content, softwareand processing power for the Sharp handhelddevice. ■

006newssbd.qxd 29.06.2001 19:31 Uhr Seite 11

Page 10: linux magazine uk 11

Network Appliance

The new Omni Server is avaiable in three flavours.The first being the Standard model with a 533processor and 64MB Ram and 20GB hard drive. Thesecond is the professional model which is boostedup to a 667 processor, 128MB Ram and 40GB harddisk with the top of the range Enterprise modelhaving twin 667MHz processors.

The test model was a small footprint(290x350x92mm WDH) incorporating a 24x CDdrive and a CF IDE expansion slot on the front.Various LEDS and a power switch. The back revealsthe usual keyboard, mouse and monitor connectionsand the main selling point the onboard 8 point hub.The test model did not have the smart card readerattached but the internal COM2 port header

allowed us to test this for the usual card reader fromTowitoko once we downloaded the drivers. Verysimilar to the Sun Blade 100 workstation for addedsecurity and authentication. Rather than a 533 itcame with a 550 Cryix. Memory is via 168 pinDIMM’s with a maximum of 512MB supported.

On connecting power and starting the unit itloads the Trustix linux. This is preconfigured to act asa full web hosting device with Apache and as afirewall. Administration of the unit is either viaconnecting a monitor, keyboard, mouse etc,. orusing a browser over a network and Webmin.

This latter option is probably the way most userswill use the device enabling it to just be added to anetwork with power and network connectionssimilar to Colbalts Raq or Qube3. As a serverappliance the Omni Server helps to intergrate all thenecessary tools and applications to enable acompany to quickly be on the web.

Via the printer module we quickly setup aprinter onto the parallel port to then act as theoffice printer. This worked fine across the network.

The main selling point has to be the inclusion ofa eight port hub. On closer inspection this turns outto be seven ports to connect to ( the eighth beingused by the omni itself) and a seperate connectorfor a 2 port Davicom LAN card (again one portbeing used by the server) running at 10/100. Byincluding the two networks a good fiewall can bemade

ON TEST OMNISERVER

14 LINUX MAGAZINE 11 · 2001

All in one server

RAQBEATER

Network appliances seem

to be the comming thing

at the moment. The new

Omni Server from

RainbowCyber aims to

solve many problems in a

simple box.

014Omnisbd.qxd 29.06.2001 19:44 Uhr Seite 14

Page 11: linux magazine uk 11

Webmin is a good choice toship with the server and duringthe tests we ran workedflawlessly. We successfullyused ssh to connect and assecurity was good failed toTelnet in.

The installed softwarewas Trustix Secure Linux 1.1although 1.2 is nowavailable and is also fullywebmin compliant. Squidfor caching was alsoincluded.

The Samba moduleworked and having a 20GBdrive meant that a MySQL database had plenty ofroom to act as a web catalog. All the software ranfirst time as expected and as it motherboard is fittedwith a Award BIOS it acts as any server you choose.

Opening up the unit showed spare connectorsfor a floppy disk (it will boot from floppy if needed)as well as secondary IDE connector. Two PCI slotsgive room to expand for items such as an ADSLmodem or other network cards.

As a test we set up the unit to act as a webpagehosting server, connect to the rest of our officenetwork and handle the mail traffic in twentyminutes. Not bad when we actually wasted some

time trying to connect with DCHP running ratherthan just using the IP address.

Admin was done by connecting with a RedHatbox though we also got it working with a Windowsbox (well it was lying around and I wanted to seeWebmin running on IE) and any browser would do.Support for the unit is provided by LinuxSure.

Overall a nice simple to use server. This wouldsuit any company that is short of space or just wantsto do away with the hassle. The ability toadministrate remotely opens up lots of possibilitiesand I can already see them being installing at manysites to allow a single knowledgeableconsultant/engineer to look after. ■

ON TESTOMNISERVER

11 · 2001 LINUX MAGAZINE 15

Info:

http://www.omniserver.co.ukRainbow Cyber Services Ltd,0208 994 0053http://www.linuxsure.comCost £850 for the standardmodel, £1175 for theProfessional model.

014Omnisbd.qxd 29.06.2001 19:44 Uhr Seite 15

Page 12: linux magazine uk 11

ON TEST SUSE 7.2

16 LINUX MAGAZINE 11 · 2001

What’s new in 7.2? Well,apart from the useful andnever ending list of the latest updates for softwaresuch as Sendmail or Fetchmail or Emacs there is the

2.4.4 kernel with increased USB support andsupport for Iptables and NAT. There are severalbonuses for the people who are graphical usersrather than command line GNU shock troops. Anevaluation version of Evolution which is Ximianslatest assault on the desktop brightens up the daywith it’s many features which combine a personalorganiser with an email application to help theindividual who is lost without Outlook Express.Other goodies are a release of Anjunta which is theGNOME IDE programing tool.

After a quick look through some excellentmanuals the graphical installation method withYaST2 compares favourably with those that areavailable with distributions such as Red Hat orMandrake or Linux by Libranet. The experiencedUNIX person may not like that and may prefer touse the updated and original YaST which nowshows many useful features that were not there before.

Going from penguins one to penguin numbereight in the install screens doesn’t require a greatdeal of skill. As Ruediger Berlich who is theManaging Director of SuSE Ltd likes to show at his

Geeko’s latest

SUSE 7.2 PROFESSIONAL

EDITION ON TESTRICHARD IBBOTSON

What is it that is attracting so many people to SuSE 7.2 and away from the other distributions?

There’s the absolute quality of the software coupled with the excellent technical support in the

United Kingdom and from other countries through the Internet which is in fact in pain old

fashioned English. There’s also the SuSE English list out there on the Net. Other things that

help are that there is a low cost personal version and a professional version as well. There is

more than enough software for most types of engineer or scientist or home user. In fact there’s

so much software on seven CDs and on one DVD disk that it takes a long time to understand

what to do with all of it. Just to finish it off there’s an endless ftp site with many updates for

the latest release and for the others that have been around for a long time. The SuSE

distribution is the software that runs the Linux Magazine office so it must be good .

Initial installation

016Susesbd.qxd 29.06.2001 16:05 Uhr Seite 16

Page 13: linux magazine uk 11

ON TESTSUSE 7.2

11 · 2001 LINUX MAGAZINE 17

many public appearances the average MS Windowsuser can quickly understand what to do. Dual bootor a quick replacement of the Windows partitionwith Linux is easy to do. Something that is reallygood about the SuSE distribution is that you canquickly and easily install Reiser FS or Ext2 filesystems. Either one is easily configured at installation.

The test machine was a notebook with an Intelprocessor. The 2.4.4 kernel modules and thePCMCIA modules worked fine on this hardware asdid USB and Irda with a mobile phone for email andWeb pages. For X-windows configuration eitherSaX or SaX2 can be used. Configuration is a pointand click experience which should take only a fewseconds. The test install did just that. Xfree 4.0.3provides anti-aliasing and so the TrueType fonts aremore rounded and easier on the eyes. Ten minutesof installation and a few more to key in networkand ISP data produced a working laptop that couldbe used on a network or dial-up system without aproblem. If you are someone who has to use soundor listen to music then you are very well catered for.The Alsa sound system is an SuSE sponsoredproject. Alsa works well on just about any personalcomputer and very well on notebooks. Theapplications manual gives extensive informationabout the applications. There are many applicationsfor sound management. If you are a professionalmusician then you should consider using thisdistribution. It’s so much better for sound than mostpropieretary brands of software.

There is also a choice of an enterprise classfirewall or a personal firewall both of which can beused in whatever way the user wants to use them in

addition to the usual open source security tools.AMaVIS has finally been included with thisdistribution. This is a high quality virus scanner thatall mail that goes through a gateway machine or ona mailserver. There is a loopback mounted filesystem which increases the security of the systemeven further. Kerberos 5 is supported in this releasewhich makes it popular amongst MS Windowsusers. Staying with MS Windows for a moment.Samba 2.2 is released with this version of SuSELinux. If you want an internal file server that is virusproof and doesn’t crash at all then you should thinkvery seriously about using Samba on a mixed Win

Using Mozilla.

Just one of the fourteendesktops available.Here XFce is running.

016Susesbd.qxd 29.06.2001 16:05 Uhr Seite 17

Page 14: linux magazine uk 11

ON TEST SUSE 7.2

18 LINUX MAGAZINE 11 · 2001

2000 network. Many people have been able to geta good night’s sleep for the first time in years afterinstalling and configuring Samba and the 2.2version is quite amazing once it’s up and running.

If you want it, KDE 2.1.2 provides a well finisheddesktop. All of the desktops and the minimalistwindow managers are available at login so that youcan choose whatever you want or just stay with thedesktop that you like the most. The new GNOMEwindow manager has been much improved in SuSE7.2 with many more options available than therewere in the last release. GNOME has quite definitelycaught up with KDE2 in the way it looks and feels.

Once an installation is finished, a broken machinecan be rescued with the SuSE rescue system whichcan be run from a floppy disk or from the firstinstallation CD.

To say some more about YaST2: All of thecommand line hacking that used to be a part ofLinux is now largely gone. YaST2 provides a fool-proof way of configuring your system. In thepresent day it’s highly likely that training will not beavailable for the system administrator. This makesgraphical management systems like YaST2 verypopular and in fact they may be essential within thecommercial world for people who quite simply donot have the time to read a book or go to nightclasses. YaST2 is particularly good for ISDN andADSL configuration and once configured is rocksolid for years.

Only in distributions like Debian is the old andtraditional UNIX command line preserved. If you area purist then you will presumably stay with Debian.However, the SuSE package management systemcompares favourably with the Debian one and Ican’t say which one I prefer. There is much evidenceto support the claim that both the Debian and RPMpackage management systems will eventually bemerged into something that will be as good as theDebian one.

To get back to the manuals once again. I feelthat these are worth a second mention. After all,you are paying for the books and not the software.Other distributions provide some excellent bookswith their CDs. SuSE have come up with a range ofdocuments that will keep the first time user or theexperienced Linux user well informed in just theright way. It’s easy to start out with the first

YaST2 running onthe KDE desktop

Enlightenment desktop

016Susesbd.qxd 29.06.2001 16:05 Uhr Seite 18

Page 15: linux magazine uk 11

ON TESTSUSE 7.2

11 · 2001 LINUX MAGAZINE 19

installation manual and then graduate towards thelevel of an intermediate level system administratoror novice programmer in this way. In fact manypeople I know learned about Linux by getting holdof a CD and then started by reading the docs thatcome with the software.

There are six books in total in the professionalversion. You can start with the quick installmanual which provides the cartoons that mostexperienced computer users can understand –and certainly the newbies should be able to get togrips with Linux using this easy- to-understandbooklet. It’s the kind of thing that Microsoftshould have done years ago and didn’t bother todo. The next one along that would suit thebeginner is the applications book. This is ratherlike the kind of publication that you can get withthe Caldera Open Linux 2.4 release. There’s a lotof information in this book that explains the kindof things that many people miss.

The other three manuals are an endless treasuretrove of the kind of information that you just can’tget from anywhere else without paying lots ofmoney for it.

The configuration manual shows how to usepoint and click to do most things. There is a lengthyexplanation of how to use file managers and othergraphical interfaces. The network manual describessome simple and more advanced networkingconcepts. It’s the kind of thing that you just cannot

obtain from anywhere in simple English rather thancomplex terms that are not understandable. The finalvolume is the reference manual. This is packed full ofthings that the other distributions have not botheredto include into their own documentation and booksthat accompany their software. It’s worth buying theprofessional version just for this book alone.

Just a final word here: SuSE GmbH is the onlyLinux software distributor that has actually taken thetime to study British English as it is and then theyhave produced a completely British distributionwithout all of the Americanisms that you can see inother distributions. This should mean something tothe average Linux user. They have also spent a greatdeal of time and money translating their originalGerman product into many other languages thusmaking SuSE Linux the distribution with the bestdocumentation. The SuSE support database can beviewed on any of their computers and the samedatabase can be accessed on their own websitefrom you desktop, notebook or palmtop. So, youget not only man pages but also nice pictures aswell as easy to understand instructions from SuSEand both the KDE and GNOME developmentteams in addition to the printed manuals.

SuSE Ltd will be at the Linux Expo at Olympiaand at Birmingham NEC in September. We willlook forward to seeing you there. This review likemost of the Sheffield Linux User’s Group websitewas produced with SuSE software. ■

About the AuthorRichard Ibbotson is theChairman and Organiser forSheffield Linux User’sGroup.You can view theirwebsite athttp.www.sheflug.co.uk

Useful links

http://www.suse.co.ukhttp://www.suse.co.uk/uk/suse_linux.htmlhttp://www.suse.de/enhttp://www.suse.comhttp://www.namesys.comhttp://www.alsa-project.orghttp://www.ximian.comhttp://www.kde.org

1/2 ad

016Susesbd.qxd 29.06.2001 16:05 Uhr Seite 19

Page 16: linux magazine uk 11

Adding another dimension

Could you please explain the paragraph entitled ”Basic 3D elements”in the article ”OpenGL course: part2”. I cannot make head-nor-tail ofthe discussion - certainly not when referring to Picture 2. And at thebottom of page 2, reference is made to ‘10 of the primitive typesmentioned above’. Which 10 types are these? Only five types werementioned in the text - points, lines, triangles, quadrangles andpolygons. Am I missing something here? Paul Keith via email

Linux Magazine

We made a mistake and did not print the correct picture. The 10primitive types should be:• 1 Points •2 Lines • 3 Line_Strip (lines joined to one another) • 4Line_Loop (lines joined to one another making a loop) • 5 Triangle • 6Triangle_Strip (ajoining triangles) • 7 Triangle_Fan (adjoining triangleswith one common point) • 8 Quads • 9 Quad_Strip • 10 Polygon

Star Letter

I was somewhat excited to find a copy of Mandrake onyour coverdisc and impatiently tried to install it. After

creating the boot floppy and following the installationinstruction, the installation told me that the disc did not

seem to be a Mandrake installation disc? I have tried allthe methods described. Can you help me? Also the DOS method iswrong because it tells me there is no such file as autoboot.bat. I woulddearly like to install this product and maybe one day escape fromWindows! I am running Windows Me on a 733mhz Pentium III with27GB hard drive CD-ROMrw and DVD.S Monty via email

Linux Magazine

As you may have guessed, we had one or two similar letters. The truthis we made a mistake and incorrectly mastered the CD without theRockridge extensions, thus making the CD into a non-bootable disc. Itwas nothing to do with Mandrake. All our fault and for that I apologise.However remiss we were, can I point out to the two gentlemen who sokindly took the time to call me at home that swearing at my children isnot perhaps the best response as I now have your number. Hopefully bynow everyone who has requested a replacement has received one. Ifanyone still requires a replacement copy then just write or email.

Not browsing

I am trying to access your CD through Windows Internet Explorer -unfortunately. But only the Index Contents or Start page will open.Any selection made from the index causes the ”Page cannot bedisplayed” error page to pop up. Other browser type CD formats workfine, have I missed something?Ron via Email

Linux Magazine

Trying to access a CD-ROM with a browser can be a trying experience.We have used the ISO 9660 standard when writing the CD. In realwords, when we save data on the CD it is saved with / ( Slash ) as theseparator between directories.

UNIX, Linux, Mac, PowerPC, Alpha, Sun, SGI and, moreimportantly, the Internet use this separator (as inhttp://www.microsoft.com). Unfortunately, Microsoft Explorer doesnot want to play fair and so treats ‘/’ as part of a name. I expect youare getting something like:

d:\./LinuxMagazine/kthemes/index.html (local)

at the bottom of your explorer screen, when you hover over ahypertext link.

What would be required for Internet Explorer to read the file would be:

d:\LinuxMagazine\kthemes\index.html

As we are aimed at Linux OS, we would continue to use the ISO9660 standard but that does not help you. What you need to do toread the magazine CD-ROM under Internet Explorer is open each pageindividually by using the menu:• File • Open • Browse At this point you can then step down through the directories. Both theother two browsers under Windows that I have tried (Netscape andOpera) work fine and treat the ‘/’ as a directory separator. Honestly, itis easier if you change to Linux.Hope this helps. ■

The 10 primitives

LETTERS

20 LINUX MAGAZINE 11 · 2001

WRITE ACCESS

020letterssbd.qxd 29.06.2001 19:47 Uhr Seite 20

Page 17: linux magazine uk 11

Background

Jakarta is a selection of open source, Java-relatedtechnologies, such as XML parsers, XSLT processors,regular expressions and portal management.

Due to many projects being implemented inJava, they’re mostly OS independent, which allowstheir widespread use.

Apache is the Web server of choice. It deliversthe content of over half of the sites on the Web, butuntil recently it lacked an integrated way of servingdynamically generated Java content. With the risingpopularity of the Tomcat server (from the Apache-Jakarta project) this need has begun to be met.

Tomcat is a product of the Apache-Jakartaproject that functions as a Java Servlet and JavaServer pages engine and is one of the most up-to-date implementations of the Java servlet. A Javaservlet is a small application that receives andresponds to http requests.

Although Tomcat can be run as a stand-aloneservlet engine, its true power becomes clear whencoupled with Apache to help cut down:• Running the built in Tomcat Web server in

addition to Apache.• Forcing the user to enter non-standard details

such as the port number in each request.• Doubling the effort required to administer the

servers.• Exposing more potential security risks.Using the two projects together means that you canharness Apaches features such as:• Multiple virtual hosts.• Fast delivery of static content (Tomcat is

optimised for servlet processing).• An almost infinite number of configuration

options for multiple virtual Web servers thatApache users require.

Installing JavaThis tutorial assumes that you already have anApache site that you would like to expand by

adding Java servlets, this will be achieved by addingthe Java Software Development Kit (J2SDK) andTomcat to the established site. It will not require arecompilation of your existing Apache set up if yourApache allows the use of DSOs. The JavaDevelopment Kit is available fromhttp://java.sun.com. Download the newest versionfrom this site (J2SDK at the time of going to press).

Although the J2SDK is free, you do have to signan agreement before you can get the software.Once you have this on the computer that you haveApache installed on, you’ll need to install theJ2SDK. This procedure varies between Red Hat andDebian-based distributions; here we will cover theRed Hat install.

Installing the Java SDK is simple. You should runthe following command:

# sh j2sdk-1_3_1-linux-i386-rpm.bin

You’ll be confronted with a licensing agreement tobe accepted in order to install. If you agree to thelicense the package will decompress, leaving aready-for-install rpm. Next, login as root and installthe rpm with a command similar to:

# rpm -i jdk-1.3.1.i386.rpm

1.3.1 in the filename will vary depending upon theversion of the J2SDK you want to install.

FEATURETOMCAT

11 · 2001 LINUX MAGAZINE 21

Tomcat for Apache

EFFICIENT, FLEXIBLE AND OPEN SOURCE,

CHOOSE ANY THREEDEAN WILSON AND KIM HAWTIN

Web sites used to be a way

of claiming a personal piece

of the new frontier, a

number of html pages and a

CGI script made a website.

These days with the advent

of P2P sites and e-Commerce

solutions Java is coming into

the limelight both on its own

merits and as a rival to

Microsoft’s .net platform.

Java’s success in this field is

based upon its ability to act

as middleware between

different vendors software

and Open Source projects

such as Apache, Enhydra,

Cocoon and Tomcat.

What is a DSO?

A DSO is a Dynamic Shared Object, in the past whenever you wished to add newfunctionality to an existing Apache web server install you would be required toreconfigure, re-compile and perform a fresh install of the Apache binaries. Withthe inclusion of DSO’s in the Apache server this process has been simplified intocompiling an external module into a DSO that Apache can pick up andincorporate at run time without the base web server needing to be recompiled. Ifyou are running a Debian based distribution then you’ll need the Apache-devpackage, if its Red Hat based then you’ll need the web server source fromApache.

021Tomcatsbd.qxd 29.06.2001 19:54 Uhr Seite 21

Page 18: linux magazine uk 11

Next, add the Java binaries to your path. Youcan do this on a per user basis or a system widelevel. To add Java to the path for a single user edit.bash_profile in their home directory. Check for theline that has PATH=$PATH at the start and add thepath of the Java runtime binaries to the PATHenvironment variable.

The second step involves adding a line to set theJAVA_HOME environment variable. Both variablesneed to be explicitly exported. A simplified exampleis as follows:

PATH=$PATH:/usr/java/jdk1.3.0_02/bin/javaJAVA_HOME=/usr/java/jdk1.3.0_02/export PATH JAVA_HOME

jdk1.3.0_02 is the version of the softwaredownloaded. To do this on a system wide level youneed to enter the same changes as before but in the/etc/profile file. We recommend system-levelapplication so that they apply to all users. This willmake running Tomcat a much simpler task. You’llneed to logout and log back in for theenvironmental changes to take effect.

You can test that the Java binaries installedcorrectly by entering the simple test program(Boxout HelloWorld.java). Be sure to make the nameof the file the same as the name you entered in thepublic class line at the top of the sample code

otherwise the java compiler will give an error similarto ”class HellWorld is public, should be declared in afile named HellWorld.java”. To test the code youwill need to type:

# javac HelloWorld.java

The compiler will then generate a file named”HelloWorld.class”, if you then type:

# java HelloWorld

You’ll see ”Hello World” printed on the terminal.This means the J2SDK was successfully installed. Ifan error occurs work through the steps again.

Installing Tomcat

The precompiled version of Tomcat is athttp://jakarta.apache.org/ tomcat/index.htmlDownload the newest stable binary; at the time ofwriting this was Tomcat 3.2.2. Move thecompressed tar file to ”/usr/local/”. Extract asshown. This creates jakarta-tomcat-3.2.2. Thencreate a symlink in the jdk external library directory(below) for the Tomcat servlet jar file and run theTomcat startup script :

# mv jakarta-tomcat-3.2.2.tar.gz /usr/local/# tar -zxvf jakarta-tomcat-3.2.2.tar.gz# ln -s /usr/local/jakarta-tomcat-3.2.2/lib/Uservlet.jarU/usr/java/jdk1.3.0_02/jre/lib/ext/servlet.jar# cd jakarta-tomcat-3.2.2/bin# ./startup.sh

Once you have run the startup.sh script Tomcat willoutput diagnostic messages to the terminal. Tomcatwill run in the background as a daemon butcontinue to print messages to that terminal. Anyerror messages at this stage mean you’ve set up theJAVA_HOME or the PATH statements in the userprofiles incorrectly. To restart Tomcat run./shutdown.sh, then repeat the previous steps. Thenrun startup.sh again. Open up a browser and pointit to http://localhost:8080/index.html. If Tomcat isinstalled correctly you should see a Tomcat testpage.

In order to test that your environment iscorrectly set up and you are ready to move to thefinal stage of integrating Apache with Tomcat youshould enter and run the sample servlet presentedin the Sidebar. Open up your editor of choice andenter the sample code remembering to name thefile ServletHello.java. You should then compile thejava source:

# javac ServletHello.java

The compiler should create the ServletHello.classfile. You then need to copy the class file to theTomcat directory structure so that the Tomcat servercan execute it when the request HTTP request isissued from your webbrowser. You should executethe following:

FEATURE TOMCAT

22 LINUX MAGAZINE 11 · 2001

Resources

For the best place to learnmore about the Apache and

Jakarta projects:http://www.apache.org/

http://jakarta.apache.org/For more information on Java

Servlets see:http://java.sun.com/

For ideas on how to use JavaServlets or information onTomcat configuration see:

http://www.oreilly.com/catalog/jservlet2/

http://www.jguru.com/

Listing 1:HelloWorld.javapublic class HelloWorld{public static void main(String[] args){System.out.println(”Hello Java World”);

}}

Listing 2:ServletHello.java/* ServletHello.java: Hello world example servlet */import java.io.*;import javax.servlet.*;import javax.servlet.http.*;//Import all required class’spublic class ServletHello extends HttpServlet{public void doGet(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException{response.setContentType(”text/html”);//This sets the type of the responsePrintWriter toClient = response.getWriter();//This sets the output character streamtoClient.println(”<html>”);toClient.println(”<head>”);toClient.println(”<title> This is a test page</title>”);toClient.println(”</head>”);toClient.println(”<body>”);toClient.println(”<p>Welcome to tomcat!</p>”);toClient.println(”</body></html>”);}

}

021Tomcatsbd.qxd 29.06.2001 19:54 Uhr Seite 22

Page 19: linux magazine uk 11

# cp ServletHello.class U/usr/local/jakarta-tomcat-3.2.2/webapps/exaUmples/WEB-INF/classes/

Point your web browser at the following:

http://localhost:8080/examples/servlet/ServlUetHello

You should be rewarded with a page with thefollowing text ”Welcome to Tomcat!”, if therequest succeeded. If you get a ‘file not found error’or 404, then check the output of Tomcat on theterminal you started it on. An example of this is:

Ctx( /examples ): 404 R( /examples + /servletU/ServletHell + null) null

ServletHell in this case is probably a typo. Check theURL that you entered in your browser. If these errorspersist compare the name of the Java class yourequested in your browser to the name of the classfile you copied into the Tomcat directory tree.

Configuring Apache

In order for the Apache server to be able tocommunicate with the Tomcat Server you need todownload a DSO called mod_jk.so. This is availableas part of the Jakarta project and can bedownloaded from:

http://jakarta.apache.org/builds/jakarta-tomUcat/release/v3.2.2/bin/linux/i386/"

You should have two options, a mod_jk.so-eapi andmod_jk.so-noeapi. Download the mod_jk.so-eapiversion. This then needs to be moved to the correctplace under the Apache directory tree. The Tomcatand Apache configuration files need to be updatedto reflect the new functionality.

# mv mod_jk.so-eapi /usr/lib/apache/mod_jk.so

By moving the module to this location Apacheknows that it needs to load it when restarted. Youthen need to make the changes to the Apache andTomcat configuration files before restarting theApache server. In httpd.conf (Which you can find byissuing a locate httpd.conf) you need to make thefollowing amendments. At the end of theLoadModule section you should put the following line:

LoadModule jk_module modules/mod_jk.so

Add to the end of the AddModule section:

AddModule mod_jk.c<IfModule mod_jk.c>JkWorkersFile /usr/local/src/jakarta-tomcatU-3.2.2/conf/workers.propertiesJkLogFile logs/jk.logJkLogLevel warnJkMount /examples/* ajp13</IfModule>

You need to ensure that the path to theworkers.properties file is correct, you can check thisby issuing a locate workers.properties commandand editing the path in the configuration file asrequired. You also need to create a log file for the jkmodule, this can be done with a simple:

touch /usr/local/src/jakarta-tomcat-3.2.2/loUgs/jk.log

Configuring Tomcat

For each context in your Tomcat configuration fileyou need to add a JkMount line to your httpd.conffile. This is so that Apache can forward requests tothe correct Tomcat handler for processing. Apachesupports the Ajp12 protocol used with JServ.Tomcat uses the new Ajp13 protocol for newfunctionality, and so you need to add support forthe new protocol.

In the configuration file for Tomcat, server.xmlyou need to add after the existing Ajp12 section thefollowing request handler:

<!-- Apache AJP13 support. This is also useUd to shut down tomcat. --><Connector className="org.apache.tomcat.seU

rvice.PoolTcpConnector"><Parameter name="handler"

value="org.apache.tomcat.service.connector.UAjp13ConnectionHandler"/>

<Parameter name="port" value="8009"/></Connector>

After adding these lines to your configuration fileyou will need to restart the Tomcat server with theshutdown.sh and startup.sh scripts. Once theTomcat server has successfully re-initialised you canopen your web browser and point it at:

http://localhost/examples/servlet/ServletHello

You should see the servlet output sent straight toyour browser from Apache.

Server Initialisation

So that Apache and Tomcat start and stop like otherservers, we recommend that you add Tomcat to theApache initialisation script or create a separateinitialisation script .

Conclusion

We’ve only covered the basic Tomcat and Apacheset-ups. Servlets and Java Server Pages are powerfultools for producing dynamic content for Web-basedapplications. The joint use of Tomcat and Apachegives all the strengths of Apache’s fast static contentdelivery and near infinite configuration options andTomcats flexible content delivery to produce anopen source solution that rivals the best commercialofferings. ■

About the Authors:Dean Wilson: ProfessionalDeveloper, using Linux as aserious alternative tocommercial offerings.Kim Hawtin: UNIX SystemsAdministrator, dabbling in allthings network-related,preferably without wires.

FEATURETOMCAT

11 · 2001 LINUX MAGAZINE 23

Contexts in Tomcat

Tomcat can manage multipleweb applications. Each webapplication is a collection offiles such as Java Servlets,html, JSP files and otherresources that are required forthe web application tofunction. Each web applicationcan be deployed separately, ina context. This is useful to testyour Java servlet withdifferent versions ofsupporting Jar files. Forexample using severaldifferent XML parsers, or XSLTprocessors.

021Tomcatsbd.qxd 29.06.2001 19:54 Uhr Seite 23

Page 20: linux magazine uk 11

Ever more powerful hardware, and the resultingpossibility of being able to solve ever more complexproblems with the aid of software, led in the 1960sto the term software crisis being coined. Softwaredevelopers realised that development tasks could nolonger be managed without the implementationand the support of powerful tools. At the start ofthe 80s CASE (Computer Aided SoftwareEngineering) joined in battle against the bogeymanof the software crisis.

Software development problems

Studies proved that about 50 per cent of the errorsdetected during a software development processoccurred in the analysis and specification phase. Afurther 26 per cent come in the design phase andonly about 25 per cent of the errors found stemmedfrom faulty implementation.

Obviously, and especially in the initial phases ofsoftware development, people were not workingwith enough attention to detail. CASE tools offer,especially for these early phases of development, a

transparent and visual method to enable developersto view the system being created as a whole. Thismeans they will not lose themselves at the earlyphases of development in implementation details.

The CASE tools presented here use UnifiedModelling Language (UML) for the notation ofsoftware models. UML diagrams copy theconnections of object-oriented systems visually andthus increase an understanding of the system justbefore the actual implementation.

But CASE tools offer more than just a purelyvisual support for the development process. Theycan be used for documentation purposes and offerthe option of creating code entities out of classdiagrams (and vice versa) (forward and reverseengineering), and in roundtrip engineeringmodifications which are made in the source text actdirectly on the visual model.

End of the software crisis?

So does this mean that CASE tools are a powerfulweapon against the much complained about

FEATURE CASE TOOLS

24 LINUX MAGAZINE 11 · 2001

CASE Tools compared

CRISISMANAGEMENT

FRANK HAUBENSCHILD

Tools for computer aided

software engineering are

treated as resources

to counter the

software crisis. But

another question

to be answered is

whether the time

spent on breaking in

is proportionate to the

benefits.

024case-toolswip.qxd 29.06.2001 19:56 Uhr Seite 24

Page 21: linux magazine uk 11

software crisis? Will all software projects now becompleted by the promised deadline and meetcustomer requirements with the system realised?Well, not exactly, no. Many developers see CASEtools as more of a blot on the landscape, whichhinders them in their creativity.

In the case of smaller projects, with a fewhundred lines of code, this may well be fine, butprojects with over 10,000 lines of code anddevelopers working in parallel can be very hard tocontrol without CASE tools, so the CASE toolsavailable under Linux will be looked at more closelybelow.

Class diagrams with Dia

Unlike the other test candidates, the GPL programDia is not strictly speaking a proper CASE-Tool. It isreally for drawing diagrams of all kinds. Theprototype is the commercial program Visio, wellknown in the Windows world.

For hobby-developers who want to create classdiagrams and application cases and do not need touse code-generation, reverse engineering and thelike, Dia is a good choice. It impresses by its simpleand intuitive user guidance. Compared with thebyte code-interpreted tools Together and ArgoUML,its rapidity also stands out.

Dia supports the following diagram types: UML(use case, class, sequence), ER (entity relationship),SADT, flow charts, networks and integrated circuits.New types of diagram can be added using simpleXML files. The program loads diagram types inadvance on start-up or dynamically, as required. Diacan load and store diagrams in XML and exports theformats EPS, SVG, WPG, CGM, PNG and TeXmacros. XML files can either be saved direct in theASCII format or compressed.

Note: You can download the command line-oriented tool Dia2code, which converts the classdiagrams created under Dia into corresponding C++or Java classes from the fifth URL listed below.

Overall, Dia is a stable tool which is good to usefor the software development process on a small

scale. People who want to avoid long break-inperiods, and do not need the function overkill ofRational Rose or Together, are well served. Forprofessional implementation in softwaredevelopment, however, Dia is not suitable.

ArgoUML

ArgoUML is an open source project andcompletely implemented in Java. The tool also runs,due to this principle, on any platform with a virtualmachine for Java 1.2. Since it is byte code-interpreted, though the speed of execution is notexactly electrifying.

ArgoUML meets the OMG standard for UML1.3 and supports as diagram types class, statemachine, use case, collaboration, activity andobject/ component/ deployment diagrams. It is onlysequence type diagrams that are not supported inthe current version 0.8.1 – but these are planned forthe next release. Also, ArgoUML supports the XML-based swap format XMI. ArgoUML uses it asstandard memory mechanism and thus makes it

FEATURE CASE TOOLS

1/4 Red Hat

Figure 1: Dia in the Use-case-Modelling.

024case-toolswip.qxd 29.06.2001 19:56 Uhr Seite 25

Page 22: linux magazine uk 11

possible to swap model data with other UML toolsand in this way creates the basis for an openstandard.

For code generation, ArgoUML supports onlyJava. UML diagrams can be saved in GIF, Postscript,EPS, PGML and SVG formats. One plus point is thewide variety of setting options for the print output.

After downloading and unpacking the tarballfrom the second URL listed below, all the necessaryjar files are saved to the current directory. As long asyou have installed JRE 1.2 or higher, ArgoUML canbe started with the command

java -jar argouml.jar

After starting, you will be looking at a nice, tidyprogram interface.

The GUI of ArgoUML is split into four mainparts. In the left upper corner there is the navigationpanel in the form of a tree structure, via which onecan access all previously installed elements of themodel.

If you click on an element there, the propertiesof the element will be displayed in the detail panel(bottom right), and the element itself (for example aclass) will be selected in the master window – the

editing panel top right. The detail panel itself is inturn divided into eight index cards – for exampleunder Source there is a preview of the generatedJava source text of the selected UML element.

Developers who manage to-do lists with the aidof yellow Post-it stickers, and can hardly see theirmonitor for notes, will be glad of the to-do panel inthe bottom left corner. Here the developer canmanage to-dos sorted according to priority and thushas a constant overview of all items stilloutstanding. Apart from any to-dos you addyourself, ArgoUML also automatically adds to-dosto the list in accordance with design criteria andanalyses of the model. These could be missingmethods or class names.

If you go to http://www.ArgoUML.org andfollow the Tours link, you’ll find a good introductionto the most important features of the program. Buteven without a tutorial, thanks to the intuitive userinstructions you will quickly get on your feet andcan then defend yourself against the bogeyman ofthe software crisis. Apart from the speed ofexecution and the lack of one or two features,ArgoUML makes a very good impression and istherefore recommended for both hobby-developersas well as for the semi-professional domain. For theprofessional domain, there is no code generationfor additional languages (especially C++), nor teamsupport or reverse and roundtrip engineering.

Together Solo and TogetherControl CenterTogether Soft offers its Together 4.2 product rangein two versions. Both are byte code-interpreted,which, like ArgoUML, guarantees a sluggish rate ofexecution on ordinary hardware. Together Softtherefore also recommends P-III systems with500MHz and 512MB RAM. As a virtual Javamachine, JDK 1.3 is required.

Together supports class diagrams and UMLdiagram types (use case, sequence, collaboration,state, activity, component and deployment) formodelling. Code generation can be done in Javaand C++, and reverse and roundtrip engineering aswell as team support are provided. A project experthelps the developer to set up a new project. Here,for example, target language and directory settingscan be adjusted.

The version Together Solo offers automaticdocumentation generation to HTML or RTF andsupports the development of larger softwareprojects via CVS. Together Solo also importsRational Rose model files and exports UMLdiagrams as GIF or WMF. In addition to these thereare EJB and forward and reverse engineering forsequence diagrams.

Diagrams and UML elements can be linked toeach other. So for example classes can be linked tostatus diagrams, to get a better overview of thecomplete architecture. Apart from the target

FEATURE CASE TOOLS

26 LINUX MAGAZINE 11 · 2001

[top]Figure 2: Clear GUI

from ArgoUML.

[below]Figure 3: Together Control

Center offers a wide variety ofpossible diagram types.

024case-toolswip.qxd 29.06.2001 19:56 Uhr Seite 26

Page 23: linux magazine uk 11

languages Java and C++, Together Solo supports the generationof IDL (Interface Definition Language) from class diagrams.

The high-end product Together Control Center supports, inaddition to all the aforementioned UML diagrams, EJBAssembler and XML structure diagrams. It also excels due to theoption of creating ER diagrams and offers JDBC roundtripengineering for class and ER diagrams. Amendments to ERdiagrams take effect directly on the database schemata of theDBMS below.

Another option is that of direct import of existing relationsfrom a database as ER diagrams. Via a dialog window, thenecessary settings (server type, database name, host, port,username and password) can be made for databasecommunication. Databases supported are Oracle 7.3.x/8.x, DB2,MySQL, MS SQL, Cloudscape, ODBC/Access 97 andSequeLink/Oracle. Together Control Center also includes adebugger for Java – and is thus maturing into a complete IDE.

Overall the Together products make a very good impression.In terms of user guidance and handling Together leaves nothingto be desired and in this field is definitely, together withArgoUML, ahead by a nose. Together is obviously intended forthe professional domain, because of the enormous range offunctions – which is also underlined by the respectable price ofaround £2800 (inclusive of one year’s support) for TogetherControl Center. Version 5.0 is launching just as we go to press.

Rational Rose

Since the end of March the CASE tool Rational Rose, whichstems from the Windows world, has been available for Linux.

1/2 hochPositiveInternet

What matters when it comes to CASE tools?

Depending on the size of the system to be realisedand the number of developers involved in it,requirement profiles always differ. A hobby-developer, who wants to write a little tool with just afew hundred lines of code, will certainly not want tospend several thousand on a high-end product. Thelist below shows a few requirements, depending onthe domain of application.

Main CASE-Tool featuresMinimum RequirementsSupport for common UML diagram types Simple, intuitive user guidance Easy-to-use diagram-layouterSemi-professional requirementsReverse Engineering Roundtrip Engineering Flexible documentation creation (for example inHTML) Code generation (support for several targetlanguages)Professional requirementsDatabase support Team support for larger projects Open architecture for any/ potential expansions In heterogeneous environments, support for asmany platforms as possible

024case-toolswip.qxd 29.06.2001 19:56 Uhr Seite 27

Page 24: linux magazine uk 11

After registering, you can download the roughly 80MB TGZ file. You will then receive, via email, a 15-day licence key and can test the program withoutrestrictions. Rational specifies as platform Red HatLinux 6.2 with Kernel 2.2.12.20.

After unpacking Rose is installed with theinstallation script rs_install. The binary rose startsfrom the directory ./bin. Developers who havealready worked with Rose under Windows willimmediately feel at home, because the Linux GUImatches the one from the Windows world.

In comparison with ArgoUML and Together, theuser instructions and the handling are limpingbehind – many features and setting options canonly be found after a long search. For example thesource text generated from the diagrams cannot be

viewed directly, but has to be created manually bymeans of non-intuitive dialogs.

Of the CASE tools in the test field, Rosesupports most languages: Java, C++, ADA 83, ADA95 and CORBA IDL and DDL for databaseapplications. Rose offers both roundtrip and reverseengineering. While reverse engineering a small Javasample project, Rose abruptly crashed, despite acorrectly set CLASSPATH, without an error message– this is something the manufacturers must fix.Diagram types supported are class, use case,collaboration, sequence, component, state chart,deployment and activity. For notation UML, Boochand OMT can be used.

As to be expected for implementation in theprofessional domain, Rose has multi-user capability

Figure 4: It is only the look-and-feel of KDE that hints at

Linux – otherwise Rational Rose’s Linux GUI matches the one

from the Windows world.

FEATURE CASE TOOLS

28 LINUX MAGAZINE 11 · 2001

CASE tools in overview Product Dia 0.86 ArgoUML 0.8.1 Together Together Rational

Solo 4.2 Control Center 4.2 Rose 2001Manufacturer Alexander Larsson University of California Together Soft Together Soft RationalInternet www.lysator.liu. www.ArgoUML.org www.togethersoft.com www.togethersoft.com www.rational.com

se/~alla/diaPrice (approx.) GPL free £1600 £2800 £5500Diagram types

Use case + + + + +Class + + + + +State - + + + +Deployment - + + + +Activity - + + + +Collaboration - + + + +Sequence + - + + +Entity-Relationship - - - + +

Code generation only via Dia2code Java Java, C++, IDL Java, C++, IDL C++, IDL, Java,(C++, Java) Ada 83, Ada 95

Team support - - + + +Reverse engineering - - + + +Roundtrip engineering - - + + +Other expandable open source, Version 5.0 just out Java debugger, Look & Feel

by XML XMI support, Version 5.0 just out matchesneeds JRE 1.2 Windows version

024case-toolswip.qxd 29.06.2001 19:57 Uhr Seite 28

Page 25: linux magazine uk 11

and supports developer groups. Rose makes aprivate working area for all developers, in whicheach has an individual via of the whole model.Modifications are thus restricted to the privateworking area until they are checked in to the CMVC(Configuration Management and Version ControlSystem).

Models created with Rose can be put on anintranet or the Internet via a Web publisher asHTML files. As for notations, there is a choice ofUML, Booch and OMT. Diagrams automaticallyintegrate themselves as JPEG graphics. So forexample for an API the complete documentationcan be place don the Net. Using a preview functionthe result can be approved before the actual HTMLgeneration.

Netscape Navigator 4.74 comes with it as Webbrowser. As to be expected, model data storedunder Windows (MDL files) can also be used underLinux without any problems.

Overall Rose for Linux gives a stable impression –apart from the problem of reverse engineering ofJava. In terms of speed it leaves the byte code-interpreted CASE tools ArgoUML and Together farbehind. Because of the enormous range of functionsof Rose and the wide variety of platforms supported(Windows, Sun Solaris, HP-UX, AIX, Irix, CompaqTrue 64 Unix) it is recommended for the pro.

But a minus point for the product is its highprice of around £5,500 per commercial single user.Here’s a thought for the manufacturer: A freeversion for non-commercial use would be a goodidea.

Conclusion

Each of the CASE tools presented here has bothadvantages and disadvantages – whether one ortwo missing features or ergonomic weakness in theinterface. ArgoUML and Together are in the lead inthe field of operability. Together and Rose arerestricted by the very cost of their licences to theprofessional domain. The free ArgoUML, though,scarcely needs to hide behind these programs, butthe professional one is certainly lacking a fewfeatures.

All in all, CASE tools should be used morefrequently in development. Because once they getused to them, developers will see them not as a bloton the landscape, but rather as helpful colleagues.■

Info

Dia: http://www.lysator.liu.se/~alla/diaArgoUML: http://www.ArgoUML.orgTogether Soft: http://www.togethersoft.comRational: http://www.rational.comDia2code: http://dia2code.sourceforge.net

FEATURE CASE TOOLS

1/8 Wired4life

024case-toolswip.qxd 29.06.2001 19:57 Uhr Seite 29

Page 26: linux magazine uk 11

For long enough, UNIX users have been used to notbeing able to simply switch their systems off.However, failsafe systems which work with a logsimilar to databases, continuously recording anychanges, have been available for a few years. TheReiser filesystem was introduced to the Linux worldwith SuSE 6.2, after Stephen Tweedie’s Ext3filesystem had already been available in a highlyexperimental and unstable form since the end of1999.

SGI had already announced months ago that itwould be porting XFS, known from the Irixenvironment, to Linux, and for the last few weeks ithas been available as source code to everyone.

What makes XFS interesting are a number offeatures not previously available, or at least not inthis combination:• full 64-bit support• quotas• extended attributes, ACLs• maximum file size 16TB on 4K pages and 64TB

on 16K pages. If the block device layer has beenconverted to 64 bit, files up to a size of 9exabytes (9 x 10^18 byte) are addressable.

• xfsdump and xfsrestore for filesystem back up.Usefully, dumps created on Irix can be restored onLinux and vice versa - despite differentendianness.

FEATURE FILESYSTEMS

30 LINUX MAGAZINE 11 · 2001

Version 1.0 of the XFS journaling filesystem has been available for

download on the SGI website since 1 May – including as a patch

for the 2.4.2 kernel. The obvious thing would seem to be, therefore, to

try building it into the SuSE Linux 7.1 kernel.

SGI XFS on SuSE 7.1

CRASHPROOF

HARALD MILZ

030XFSsbd.qxd 29.06.2001 18:31 Uhr Seite 30

Page 27: linux magazine uk 11

• A data management API (DMAPI/XDSM) allowsimplementation of hierarchical storagemanagement systems without any further kernelmodifications.

• Using xfs_growfs, filesystems can grow whilemounted (in fact, they have to be mounted to beable to grow). The number of inodes can bechanged during operation.

• The log can be situated in a separate partition ora different logical volume. This will only improvethroughput if the log is kept on a differentphysical disk.

Patching the kernel

In order to put XFS on their machine, the user mustfirst build the two patches linux-2.4-xfs-1.0 .patch.gzand linux-2.4.2-core-xfs-1.0 .patch.gz into the kernelin the normal way. The SGI website recommendsusing a standard kernel from ftp.kernel.org. RPMsand an installer are available for Red Hat.

However, our point of interest is the comparisonwith Reiser FS, up to now the only log-basedpopular filesystem - and it therefore seems sensibleto test it with the SuSE 2.4.2 kernel. What could beawkward is the fact that this kernel already containsa whole variety of patches which make furthermodifications impossible, or at least difficult.

No need to worry though - apart from onereject for one makefile, the core patch runs withoutany problems. The reject can be safely ignored; thecorresponding patch is already contained in SuSE’s2.4.2.

The page buffer and XFS options must beactivated as part of the kernel configuration, andpossibly also DMAPI. All other XFS options areprimarily for error detection and are not required inour case. However, the core patch does produceone stumbling block. The top makefile suddenlycontains the line:

CC = $(CROSS_COMPILE)gcc \-V egcs-2.91.66

This call will fail unless you happen to have thatversion of egcs installed. SuSE 7.1 normally comeswith release 2.95.2, so this line should becommented out. This is the most obvious exampleof Red Hat imitation.

Enormous XFS module

Finally, the kernel is converted as usual with

make dep bzimage modules modules_install

make modules_install creates a new directory/lib/modules/2.4.2-XFS for the modules. This is alsowhere the three new modules pagebuf.o,xfs_support.o and xfs.o are located.

After updating /etc/lilo.conf, calling lilo andrebooting, the modules can be loaded:

xfs 403600 0 (unused)xfs_support 8400 0 [xfs]pagebuf 23040 0 [xfs]

As you can tell from the number of pages itoccupies, the XFS module itself is pretty extensive.

In order to be able to actually install and use afilesystem, the tools in the xfsprogs package have tobe translated and installed in /usr/local. e2fsprogs-devel must be installed before you can runconfigure, and two lines must be commented out ininclude/liblvm.h:

/*#include ”lvm_log.h”#include ”lvm_config.h”*/

If you like, you can build an RPM package from thexfsprogs.

Man page muddle

When trying to access the XFS man page you willdiscover an annoying similarity in names as the Xfontserver man page appears. The XFS man page isactually called man 5 xfs.

Filesystem performance is most easily measuredusing the tried and tested filesystem benchmarkBonnie. This benchmark tests I/O-access speed witha large file. First of all it performs a character-oriented write, then it repeats the operation (rewrite)and finally it performs a block-oriented write.Reading is character-oriented to start with and thenblock reads. To finish off, there are random searches.

FEATUREFILESYSTEMS

11 · 2001 LINUX MAGAZINE 31

ListingKernel messages during mountpage_buf cache Copyright (c) 2000 Silicon Graphics, Inc.XFS filesystem Copyright (c) 2000 Silicon Graphics, Inc.Start mounting filesystem: lvm(58,14)Starting XFS recovery on filesystem: lvm(58,14) (dev: 58/14)Ending XFS recovery on filesystem: lvm(58,14) (dev: 58/14)

Log space requiredseneca:/mnt # df /dev/vg01/xfstest Filesystem 1k-blocks Used Available Use% Mounted on/dev/vg01/xfstest 650560 13752 636808 3% /mntseneca:/mnt # du -s -k .13368 .

Newly created 64MB filesystemFilesystem 1k-blocks Used Available Use% Mounted on/dev/vg00/testlv 65528 32840 32688 51% /mnt/dev/vg01/xfstest 60736 80 60656 1% /mnt

030XFSsbd.qxd 29.06.2001 18:31 Uhr Seite 31

Page 28: linux magazine uk 11

Bonnie should be included in most distributions, soanyone ought to be able to use it.

The results (see box ”Bonnie results”) relate tothe following test environment: AMD K6-II/350 onTyan S1590S board, VIA Apollo chip set withVT82C586B IDE controller. The SCSI controller was aSymbios Logic 53C875 with a SYM53C8XX driver.Hard disks: IBM DJNA-352030 (EIDE, UDMA-33),IBM DNES-309170W (Fast-20 Wide SCSI). In eachcase Bonnie was running with a 512MB test file,about double the size of the main memory, toexclude possible cache effects. The first three linesrelate to the EIDE disk, the last three to the SCSI disk.

Reiser FS appears to perform better in terms ofspeed, particularly when writing large blocks, but atthe price of a considerable CPU load. If an actualapplication is CPU intensive and wants to writelarge blocks, it is entirely possible that a systemusing XFS would provide a greater throughput. Onthe other hand, XFS seems to have a slightadvantage in the random seeks - especially usefulwhen running an OLTP database. There is hardly anydifference between the other variables - thevariations are within tolerance levels.

Lame duck on IDE: Ext2

A comparison with the venerable Ext2 on the sametest partitions also produces significant results.While quite markedly lagging behind on the IDEdisk, Ext2 does play one or two trumps on the SCSI

disk, and is considerably faster when readingblocks, but not when writing them, contrary towhat you might expect. It could not be determinedwhy Ext2 was so much slower on the IDE disk, butthe fact was confirmed through additional tests.

As a little endurance test, XFS was subjected toeight hours of furious copying activity with amultitude of small files. It survived without theslightest problem. Another interesting comparisonis to see how long it takes to delete firstly lots ofsmall files and secondly a really large one (filledfrom /dev/zero). The purpose was primarily to seehow quickly the filesystem deletes indirect andmultiple indirect blocks. Reiser FS with its treestructure claims to be much faster than the bitmap-oriented Ext2. The result can be seen in thediagram.

Finally for the question of how failsafe XFS is. Asimple test is a find|cpio, copying the kernel sourcetree into the XFS filesystem, and pressing resethalfway through the process. The subsequent mountshows that the filesystem takes less than one secondfor the repairs (see ”Kernel messages during mount”).

Space saving: XFS

Compared to Reiser FS, XFS uses considerably lessspace for its log. If you create the filesystem withthe default values, the log is also situated on theblock device, but it still requires far less space(Listing, section ”Log space required”). With ReiserFS, even a newly created filesystem alreadypermanently occupies about 32MB. The underlyinglogical volume has a size of exactly 64MB (see thirdsection of Listing).

Another feature: mkfs.xfs realises if a logicalvolume already contains a formatted filesystem (notonly XFS, Ext2 is also recognised), and requires theoption -f to carry on formatting regardless.

Further endurance tests are needed to seewhether XFS is suitable for everyday use - so far itwould appear that XFS lives up to SGI’s promises. Atthe time of writing there wasn’t any news onwhether SuSE is working on an official patch forSuSE 7.1 - requests for information regarding thisquestion drew a blank. Possibly it will take untilversion 7.2 in the middle of this year beforeanything happens in this respect. ■

FEATURE FILESYSTEMS

32 LINUX MAGAZINE 11 · 2001

Bonnie results———-Sequential Output———— —-Sequential Input— —Random—-Per Char- —Block—- -Rewrite— -Per Char- —Block—- —Seeks—

Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU

XFS-IDE 512 2933 99.5 16210 28.7 5463 15.1 2755 89.1 15384 19.7 222.7 3.7Reiser-I 512 2832 99.4 18695 65.1 5279 16.0 2783 88.9 16348 23.4 218.0 4.1EXT2-IDE 512 2919 98.6 14652 26.7 4045 12.7 2643 83.3 10546 11.5 159.9 2.3

XFS-SCSI 512 2932 99.5 15241 28.7 5529 14.2 2795 90.8 15380 20.0 215.8 3.6Reiser-S 512 2838 99.5 18533 61.2 5360 15.1 2733 87.6 15412 21.8 209.4 3.5EXT2-SCS 512 2967 99.4 22915 38.8 5251 12.6 2670 84.2 15018 16.5 213.0 2.6

Info

XFS-Homepage: http://linux-xfs.sgi.com/projects/xfs/

Further comparison tests:http://slashdot.org/developers/

01/05/10/1747213.shtml

With the loss of a whole file tree,XFS is slow compared to

Reiser FS and Ext2. With large filesit is much faster than the rivals.

XFS 63 s

Reiser FS 20 s

Ext2 39 s

XFS 3,2 s

Reiser FS 5,2 s

Ext2 6,4 s

0 5 s 10 s 20 s 30 s 40 s 50 s 60 s 70 s

Large

Data F

ile

File

Tree

030XFSsbd.qxd 29.06.2001 18:31 Uhr Seite 32

Page 29: linux magazine uk 11

FEATURE TCL

34 LINUX MAGAZINE 11 · 2001

Object-oriented Tcl

OBJECTIVITYCARSTEN ZERBST

With this article, Linux Magazine is starting anoccasional series of reports on news from the Tclworld. We will be introducing tools and

extensions that enable particularly simple orelegant Tcl solutions. As the development model of

Tcl has changed recently, the first part will start withnew additions and amendments. Following that, we willbe introducing the object-oriented extension [incr Tcl].

For years the scripting language Tcl has beenlabelled ”the IT industry’s best kept secret”. Althoughthe Tcl programming community is growing, this self-deprecating description is quite accurate. While itscompetitors Perl or Python are on everyone’s lips, Tclploughs on in obscurity without much fuss.

There are reasons for that. For one thing, there isstill no equivalent to Perl-CPAN or Python.org, thesearch for Tcl extensions or documentation for a specificproblem can thus be quite difficult. The ‘The Story SoFar’ box examines the current state of affairs, how itcame about, and what the near future is likely to bring.

The many changes in recent months have meantthat many extensions and a lot of information havebecome even harder to find. The developers’information page is now at Active State. It containsmany links to documentation, extensions andprograms. Another option is the Tcl foundry atSourceforge. For many everyday problems it’s alsoworth having a look at the Tcl’ers Wiki. If you’re stilldrawing a blank, the newsgroup news://comp.lang.tclis the last resort for any questions on Tcl.

One old criticism of Tcl that keeps reappearing,and not just on the Tcl newsgroup, is its lack ofobject orientation. Fortunately, it is easily upgradedusing an extension - the sophisticated and verypopular OO-extension [incr Tcl], which is the subjectof this month’s article.

Doubleplus good: [incr Tcl]

With scripting languages you frequently wish forthe blessings of object-oriented development:classes, inheritance, data encapsulation and soforth. Although Tk does already feel pretty object-oriented, Tcl does not support any OO features

apart from namespaces. This is where the extension[incr Tcl] comes in. Not only is its name similar toC++, the Tcl command incr is the equivalent of the++ in C, but [incr Tcl] aims to extend the baselanguage with OO features, just like C++. Thisextension is available from Sourceforge, but it is alsoincluded in most Linux distributions.

Prior to use, the extension must be loaded into atclsh or wish, this is done with the command packagerequire Itcl. All [incr Tcl] commands are defined in thenamespace itcl, you can either use their full names orimport them into the current namespace. In thefollowing text we will be describing programming withthis extension using a type 1 font editor as an example.

Class-wise

Classes are the basic components of object-orientedprogramming. We will be assuming a certain degreeof familiarity with the concept of classes. Beforeobjects can be created and used, it is necessary todefine a class. The assignment of classes determineswhich variables and methods exist, and what theirtasks are. To define class variables it is sufficient tolist their names with the command variable.

Methods are defined in a similar way to normalTcl procedures: the name is followed by the inputparameters and then by a body containing the actualsource code. Within this body, class variables can beaccessed directly. The variable this, containing areference to the current object, is also available there.In addition, two special methods can be defined:constructor and destructor. They are invoked whenobjects are created or deleted. Their structure is againsimilar to that of normal procedures, but thedestructor has no input variables.

Our example in Listing 1 shows the definition of theclass point. Each point has an x- and a y-coordinate setby the constructor. Point objects can also be moved.

The classes defined with [incr Tcl] can be used ina similar way to Tk widgets. As you can see inListing 2, the creation of a new object is invokedusing classname objectname ?parameter?. Theobject name can either be specified explicitly or

Tcl is the IT industry’s best kept secret - and very much alive.

The object-oriented extension with the unwieldy name of [incr Tcl]

that we are going to introduce at the start of our Tcl series, has

contributed a great deal to Tcl’s popularity.

Listing 1: Class definitions with methods and variablespackage require Itclnamespace import itcl::*class Point {public variable xpublic variable yconstructor {_x _y} {set x $_xset y $_y

puts ”constructor: $this, $x:$y”}destructor {}public method move {dx dy} {set x [expr {$x + $dx}]set y [expr {$y + $dy}]return [list $x $y]

}}

034Tclsbd.qxd 29.06.2001 18:34 Uhr Seite 34

Page 30: linux magazine uk 11

FEATURETCL

11 · 2001 LINUX MAGAZINE 35

assigned automatically using #auto. The object isnow available as a new command under this name,with the syntax objectname method ?arguments?.The methods cget, configure and isa are availablefor each object.

The first two are used to return and set variablesdefined as public. The method isa checks whetheran object is a member of a particular class. We alsohave the method move that we defined ourselves.The commands delete object objectname anddelete class classname delete objects or classes.

Family ties

The outline of type 1 fonts consists of straight linesand curves. Each straight line is defined by twointersections, each curve by two intersections andtwo check points. In order to be able to distinguishbetween the two different point types, each onewill be assigned its own class.

In the example in Listing 3 both classes inheritfrom the point class using the keyword inherit. Theconstructor passes the required variables to the baseclass. Additional variables and methods can beadded in the definition of the derived classes - suchas the method coordinates in the class Intersectionin Listing 3.

So far we are lacking the ability to represent theobjects on canvas. Normally this method would beplaced in the point class. In order to demonstrate

multiple inheritance we have defined a special classdraw in the example.

As you can see from Checkpoint, multipleinheritance is also pretty simple to use. However, itis not altogether without problems. Just ask yourselfthe question: ”What happens if two base classeseach contain a method with the same name?” In[incr Tcl] the method from the first base class on theinherit list is used, which is not necessarily what youwant. Another problem that can occur withmultiple inheritance is diamond inheritance (seeFigure 1). This case is not supported in [incr Tcl].

A type 1 font does not only consist of individualpoints, however, and we are still missing outlines.This is an opportunity to introduce another featureof object-oriented programming - delegation.

This describes a process where a class assignstasks to objects in another class. In our case astraight line is defined by two intersections anddoes not have to concern itself with representationand data storage. Whenever the line requiresintersection coordinates it can request them fromthe intersection objects. The necessary intersectionsare stored in the Line class (Listing 4).

Mine!

As part of data encapsulation a class should be able todetermine who can access its variables and methods.[incr Tcl] supports three different levels of access:

The story so far

John Ousterhout, the spiritual father of the language, was alsoits main developer for many years. He designed its basics whilea professor at Berkeley University, before leaving for SunMicrosystems with a team of developers. There, the teamcreated the bytecode compiler and took the first steps towardsUnicode. Before internationalisation was completed with Tcl8.1, Ousterhout left Sun to set up his own company, Scriptics.Scriptics’ aim was to sell development tools (Tcl Pro) andprofessional support for Tcl. This was meant to finance furtherdevelopment of the language, amongst other things. Releases8.1 to 8.3 were developed under the auspices of Scriptics.However, sales of Tcl Pro were apparently not sufficient tofinance full-time Tcl developers.

This is the classic dilemma of open source companies, Pythonhave had similar problems recently. Scriptics was renamedAjuba Solutions, its new emphasis being the sale of B2B(business to business) products for integrating databases intothe Internet using XML. As a result, Ajuba’s developers seem tohave got to know XML too well - the whole company was takenover by Interwoven, a large manufacturer of B2B software, whowas not interested in developing Tcl any further.

So what is the situation for Tcl about half a year later?Ousterhout had already moved the home of the Tcl sources toSourceforge in the days of Ajuba. Apart from the interpreter,you can find about 200 other projects there that develope Tcltools or extensions, including the Tcl-Pro-Suite tools. Since

Interwoven did not want to market Scriptics’ crown jewels, theygenerously issued them as Open Source.

However, the issue of where the sources were stored was onlypart of the problem. It was also necessary to transfer developmentcontrol from the hands of a benevolent dictator to thedevelopment community. The solution was the Tcl Core Team (TCT).Tcl users decided on the Internet who should be a member of theTCT and thereby determined the direction of future development.Development suggestions (mostly including the solution) aresubmitted as Tcl Improvement Proposals (TIP). After a discussion onthe public mailing list TCT members vote on the proposals.

Thanks to this process, development has speeded upsignificantly. However, the loss of full-time Tcl developers paid forby Scriptics has, of course, left a large gap. This is where a companycalled Active State stepped in. They are already known to users ofPerl and Python for support and porting, with Tcl they now offerall of the three major scripting languages. In the meantime, ActiveState has also picked up two prominent Tcl developers, namelyJeffrey Hobbs and Andreas Kupries.

Active State will be offering a ”batteries included” distribution inthe foreseeable future, putting an end to the constant need tosearch for suitable extensions. At the moment they are working onTcl version 8.4, a new alpha release of which is meant to be availableon Sourceforge by the time this issue goes to print. On the TCTmailing list and in the newsgroup comp.lang.tcl there are alreadyfirst rumblings about Tcl 9.0. Overall, we can expect a lot of activity.

JohnOusterhout,father of Tcl. Stillseems to behaving problemswith ”Tcl/Tk forDummies”.

Figure 2: The type 1editor is based onthe program excerptsin this article.

034Tclsbd.qxd 29.06.2001 18:34 Uhr Seite 35

Page 31: linux magazine uk 11

FEATURE TCL

36 LINUX MAGAZINE 11 · 2001

• public: The method or variable is accessible toanyone.

• protected: Protected elements can only be usedwithin the class itself or in classes that have beenderived from it.

• private: Only accessible within the class itself.Up to now, the coordinates of a point could be

modified at will using configure, without anyvalidation of the values being performed. Oncethe coordinates have been defined as protected,they can only be changed using the methodmove.

class Point {protected variable xprotected variable y# ...

}

The derived classes can still access variables directly,without being dependant on specific methods. Ifthe coordinates had been assigned a level ofprivate, however, even the derived classes wouldnot be able to access them directly.

All in all

[incr Tcl] is a simple way of defining classes includinginheritance, in which variables and methods can beprotected against access at different levels. Itsfeatures - including multiple inheritance - aremodelled on C++. In fact, [incr Tcl] classes can eveninherit from C++ classes. A particularly goodexample of this if the CORBA extension Combat byFrank Pilhofer.

Using objects will be familiar to any user whohas worked with Tk before. The features of [incr Tcl]can therefore be used without too much additionallearning effort being required. Namespaces, whichwere first developed in [incr Tcl] have already foundtheir way into normal Tcl several years ago, which iswhy we have not dealt with them here. Additionalliterature on [incr Tcl] can be found athttp://www.tcltk.org/

The examples above, and an editor derived fromthem (Figure 2), can be found at http://www.tu-harburg.de/~skfcz/tcltk.html However, at themoment, there isn’t any source text to represent theletters on canvas. We will be looking at the optionsof the canvas widget in the next instalment of Tcl. ■

Listing 3: Inheritance and multiple inheritanceclass Draw{constructor {} {}destructor {}public method draw {} {if {[$this isa Checkpoint]} {

# draw Checkpoint} elseif ...

}}class Intersection {inherit Pointconstructor {_x _y} {Point::constructor $_x $_y

} {# constructor for Intersection

}public method coordinates{} {return [list $x $y]

}}classCheckpoint {inherit Point Drawconstructor {_x _y} {Point::constructor $_x $_yDraw::constructor

} {# constructor for Checkpoint

}}

Info

Developer’s information page:http://tcl.activestate.com

Tcl foundry at Sourceforge:http://sourceforge.net/foundry

/tcl-foundryTcl’ers Wiki:

http://mini.net/cgi-bin/wikit/0.htmlTcl newsgroup:

news://comp.lang.tcl[incr Tcl] at Sourceforge:

http://sourceforge.net/projects/incrtcl/

Combat, a Tcl CORBAextension:

http://www.fpx.de/Combat/The Tcl Tk homepage:http://www.tcltk.org/

The type 1 editor:http://www.tu-

harburg.de/~skfcz/tcltk.html

The author

Carsten Zerbst is a member ofstaff at Hamburg Technical

University. Apart fromresearching service integration

on board ships he alsoinvestigates Tcl in all its forms.

Listing 2: the interactive pointclass% Point p1 10 10p1% p1 cget -x10% p1 configure -x 200% p1 cget -x200% Point #auto 20 20point0% point0 move 10 2020 30% point0 isa Point1% point0 isa Oink0% delete object p1 point0% delete class Point

Figure 1: Valid and invalid relations betweenclasses in [incr Tcl]. Inheritance, multipleinheritance and delegation are permitted, butdiamond inheritance is not.

Listing 4: Delegationclass Line {private variable k1private variable k2constructor {_k1 _k2} {

foreach k {$_k1 $k2} {if {![ $k isa nodal point]} {

error “Node $k is not a nodal Upoint!”

}}set k1 $_k1set k2 $_k2

}}

034Tclsbd.qxd 29.06.2001 18:34 Uhr Seite 36

Page 32: linux magazine uk 11

Linux started out as, and hopefully will always be, acollaborative effort. People from around the worldwe able to bring together their best efforts anddevelop something that many like to think hasbecome greater than the sum of its parts.

Support can also be thought of as acollaborative resource, information, understandingand just plain, good old fashioned help can befound in a variety of places, so, just because youhave some problem to solve doesn’t mean that you

should feel isolated because of it. Someone,somewhere out there is more than likely to be ableto help you, or at least be able to share in yoursuffering and offer sympathy - which is better thannothing. The trick is to be able to find them.

The internet played a huge part in allowing thedevelopment of Linux, and it is true that a lot ofsupport can be found there as well.

The Web page

Each distribution seems keen to develop it’s owncommunity, which can be seen from their webpages. Mandrake are developing their ‘MandrakeExpert’ web portal where you can pose questions to‘experts’ who have put themselves forward as beingwilling to help on their specialist subjects, whileSuSE have their ‘Support DataBase’ which is allowsyou to search for solutions to problems that peoplehave previously suffered with. Other distributionswill offer similar resources so you should alwayscheck the support options as your first port of call.Non-distribution specific information can also beeasily found on the web.

Hardware compatibility has never beensomething that you can assume with Linux andmany web pages are now set up to help theunsuspecting through this minefield. Compatibilitydatabases like www.LinuxHardware.net will helpyou decide if that second hand scanner you’ve seenis going to work on your machine, or www.linuxprinting.org will help you locate that driverwhich will allow you to get your hands of theprinthead of your GDI printer, so you can changethe ink cartridge without having to take the caseapart.

[below]Websites can

be helpful

FEATURE LINES OF SUPPORT

38 LINUX MAGAZINE 11 · 2001

Helping yourself in the quest for solutions

TO NAGGINGPROBLEMS

COLIN MURPHY

Things go wrong, sometimes they were never right, but with a bit of

effort maybe you can fix that gripe or at least learn to live with a

foible with a workaround. Here is a little reminder to the various

sources of solutions to nagging problems for the Linux user.

038Helpsbd.qxd 29.06.2001 19:59 Uhr Seite 38

Page 33: linux magazine uk 11

The mailing list

Almost all of the distribution manufactures will runone or more mailing lists which you can all upon forsupport and sometimes this can also be a valuablesource of support. A mailing list is an email baseddiscussion group, so a message sent to the mailinglist is copied to all of the people who subscribe tothat list. Some lists can be very busy, sometimeswith hundreds of messages a day, with only a smallpercentage of which will be relevant to to any onepersons interests - this is especially true of listswhich are quite general in there subject matter,”[email protected]” for instance. Toget around this some mailing lists have a moredefined subject area, Suse run a list for discussionjust about Lotus Domino or instance. You do getthe chance, in most cases, to search the archives forpast solutions to your problem.

Mailing lists are not just the domain of Linuxdistributors, applications often will have mailing listsupport and other specific areas of interest mayhave mailing lists dedicated to them.

For distribution specific mailing lists, a searchfrom the distributors web page will be the best wayto find what’s available or for something moresubject specific a web search through somethinglike Google on ”Subject” + ”mail list” will usuallybring useful results.

Busy, or ‘high bandwidth’, mailing lists can be across to bare, but they do provide you with thelatest news, of developments, or of problems justdiscovered or solutions just found. They are alsovery good at providing a sense of community and ofthe spirit that goes with it.

Internet relay chat

If time is of the essence then IRC might be yoursupport solution. Web pages can take some time totrawl through to find just the snippet of informationthat you require and you might have to wait a dayor more for a reply from a mailing list. It doesdepend much more on luck than judgment though

as it does rely completely on who is about at thetime. Simply connect your IRC client - I like Xchat,just one of many - to a server likeirc.openprojects.net, join one of the rooms like#LinuxHelp and ask your question. A lot dependsnow on your conversation skills. Expressing yourproblem with unfamiliar terms can be a struggle,but most are patient and some are quite skilled inextracting the information from you that they needto solve your problem. It can be fun as well - it’squite nice to find yourself in a position where youcan answer other peoples problems, making yourealise that maybe you are about to outgrow you‘Newbie’ handle. It has made me reconsider myabilities to solve my own problems, occasionallywith some success.

Magazines

Most magazines will have some kind of onlineforum or maybe their own IRC #room in which topose your problems. Letters pages must be theslowest route to solving a problem, but maybe thetopic has been covered in the past, in letters orfeature articles, so keeping a magazine library canbe a useful asset.

Your local user group

LUGs are a valuable asset to the Linux communityand you really should try and make use of them if atall possible. This magazine has a list of user groupsand you should see if there is one that is in strikingdistance to you. If not, maybe the potential is therefor a group but it just needs a nucleus for it to formaround - maybe you could be that nucleus and startyour own group. The rewards you get from a LUGdo depend on the amount of effort you put into it,you do need to ask your questions and make yourpresence known, which is easily achieved inamongst friendly company. Some LUGs have thefacilities for you to bring your own equipmentalong, so that you can go through your problemsfirst hand. An ideal solution to any problem. ■

[left]Beware of highbandwith lists

[right]XChat in action

FEATURELINES OF SUPPORT

11 · 2001 LINUX MAGAZINE 39

038Helpsbd.qxd 29.06.2001 19:59 Uhr Seite 39

Page 34: linux magazine uk 11

KNOW HOW RECOVERY CD

40 LINUX MAGAZINE 11 · 2001

DIY Recovery CDs

SPEEDYRECOVERY

BERNHARD BABLOK

What gave rise to this whole story was a friendwhose Windows operating system went out onstrike after his wife had installed a game forchildren. At this point, it would be fairer to pointout that this was due neither to the fact that awoman had loaded it, nor that this is because it wasrunning under Windows. Even under Windows neatinstallation routines can be written, but once thesystem has been corrupted, usually the only remedyis re-installation.

Under Windows this is as simple or complicatedas it is under Linux; so it’s not a job which can beperformed by real computer amateurs. A remedy isprovided by the little project proposed here, withthe aid of which even beginners can create a self-booting CD, which will, after asking ”Do you reallywant to ...” make the system workable once more.Configuration work no longer comes into it.

And for all those who often install and comparesoftware, such a solution is interesting, too; becausethis is a simple way to guarantee identical initialconditions. And those who feel that they wouldhappily shoot their system dead, can also be helpedby it. Anyone who has to look after educational PCshas probably already implemented a similarprocedure in order to get round the constantinstallation orgies.

First off, a warning: A recovery CD is nosubstitute for data back up. The proceduredescribed here depends completely on thehardware. For example, if the hard disk is replaced,the CD is usually unusable. Another, somewhatmore demanding approach (which will be discussedat the end), does get round this problem. But thereagain, the emphasis lies on the restoration of thesystem and not the user data.

Pulling an image

off the hard disk

and if necessary

burning it back without

any problems onto the disk – even

the Linux distributions which fit onto

one diskette come with all the

resources to do this. This article shows

the few commands which are necessary.

040CDRecover.qxd 29.06.2001 20:02 Uhr Seite 40

Page 35: linux magazine uk 11

Create an image

In order to create an image of a hard disk, this mustof course be mounted. So that leaves two options:Install the hard disk in a second computer or bootfrom diskette or CD – either with a mini-distributionor a special boot CD and back up the image viathe network.

In the first variant the creation of the imagedoes go somewhat more quickly, but screwing itinto the hardware is not always desirable. Thesecond variant requires a Linux-supported networkcard. This could even be an old ISA-NE2000 card ora cheap PCI clone for around £10.

One very useful, single-disk version of Linux isTomsrtbt. This packs almost everything the heartcould desire onto one oversized diskette. It can bedownloaded via http://www.toms.net/rb/ or amirror. It is also very simple to adapt it to your ownrequirements to recompose the diskette aftermaking your own modifications, since the necessaryscripts are also present.

Once the computer has rebooted, the image iscreated using the following command:

# dd if=/dev/hda bs=... count=... | \rsh -l burner myhost \"bzip2 -c > /home/burner/image/hda.bz2"

The command assumes that an image of the firsthard disk is to be dragged to the IDE adapter. UnderSCSI that would be the hard disk /dev /sda. Similarly,

the designations for additional hard disks must bealtered. The command rsh is in fact normallyfrowned upon, but the computer, with the CDburner, must nevertheless still be physicallyaccessible. This is why the security loophole (due torsh) can be ignored in this case.

For the above command to function, a userburner must be installed on the computer myhost,which allows remote access via a suitable entry in/home/burner/.rhosts:

$ cat .rhostsfloppy.bablokb-local.de root

Floppy is the hostname of the computer booted viathe diskette.

The dd command reads out the hard disk. Thenecessary parameters bs= (block size) and count=can be determined using an fdisk -l. On a testcomputer, an old laptop with a 2.1GB hard disk, thecommand showed that the hard disk possesses 525cylinders, each with 8064 - 512 bytes. This meansthe dd command reads:

# dd if=/dev/hda bs=8064b count=525 | ...

The character b here stands for 512 bytes.Additional figures stand for other factors (which canbe viewed via dd --help). Here, 525 blocks 4MB involume have been read out. Since 525 = 5 x 5 x 7 x3, an equivalent alternative would be the block size56448b (7 x 8064 = 56448) with the count 75.

KNOW HOWRECOVERY CD

11 · 2001 LINUX MAGAZINE 41

The system guard showing memory and CPU load.The drop in the middle was while writing zeros.

040CDRecover.qxd 29.06.2001 20:02 Uhr Seite 41

Page 36: linux magazine uk 11

Simple inefficiency

It is simple to create the image via the aforementionedcommand, but inefficient and very slow. But on theother hand it is also valid indefinitely. It functionsregardless of how many operating systems are on thehard disk, and regardless of the file systems used. It isprecisely this latter which is now always a game ofchance under Linux. Reiser FS, Ext3 JFS, each with andwithout logical volume manager or software Raid arejust a few of the more recent developments which arecausing more and more problems for classic rescuedisks and backup programs.

In the figure below the KDE-2 system monitorcan be seen on the destination computer duringthe creation of the image. In the lower part thebytes received and in the upper part the CPUloading are displayed. Notice the gaps that appearin the network traffic. These are due to the factthat dd is either reading or writing. Whenever anew block is being read by the hard disk, thenetwork and the destination computer take abreak.

Otherwise the slowest link in the chain is bzip2,which processes the arriving data in 900k blocks. If

the sending computer is faster than the destinationcomputer, it makes sense to compress the databefore sending.

The whole image creation in this case tookmore than an hour, and the destination computer,at 700MHz, is comparatively fast. More later onadditional details about this figure.

Restore

Once the image has been created, it goes onto aCD. How that works is explained in the ”Creatingthe recovery CD” box. Restore then functions againafter a boot with a floppy local via the followingtwo commands:

# mount /dev/hdc /mnt# bunzip2 -c /mnt/hda.bz2 > /dev/hda

Of course, a restore via the network would also bepossible:

# rsh -l burner myhost \”bunzip2 -c /home/burner/image/hda \.bz2” $ /dev/hda

In the last case it is vital to make sure the output

KNOW HOW RECOVERY CD

42 LINUX MAGAZINE 11 · 2001

Creating the recovery CD

The recovery CD is created in the usual way under Linux viaMkisofs/Cdrecord. The file structure appears as follows:

build| hda.bz2|| boot

| hal91.img

The command

# mkisofs -b boot/hal91.img -c boot/hal91.cat -o reccd.isobuild

creates the bootable CD-ROM image. The option -b refers tothe bootable diskette image. Another file, the bootcatalogue, also has to be created (option -c), but isotherwise unimportant. The output file is specified via -o. Ifhda.bz2 is a link to the image, the -f option must also bestated. If the ISO image has been created, the CD can beburnt using CDrecord or one of its front-ends. In our case, itlooks like this:

# cdrecord -v -isosize fs=8m speed=4dev=x,y,z reccd.iso

fs is a buffer memory, speed the rate of the burner and devthe device of the burner, which can be determined viacdrecord -scanbus. These three parameters must be adaptedby each person to suit their own circumstances.

Exchange the /linuxrc with HAL91A Linux boot diskette almost always consists of three parts: abootloader, the kernel and a pre-compressed file system.

The file linuxrc is in the root directory of this file system. Toget to the system, the following steps are necessary:

# mkdir /tmp/floppy.mnt# mount -o loop hal91.img /tmp/floppy.mnt

The diskette image is mounted via a loop device. The abilityto mount such loop devices has to be compiled into thekernel, but this is usually the case with standard kernels indistributions. Then the compressed file system is unpackedand also mounted via a loop device:

# gunzip -c /tmp/floppy.mnt/initrd.gz > initrd# mkdir /tmp/initrd.mnt# mount -o loop initrd /tmp/initrd.mnt

Now we have access to linuxrc and can edit the file asdescribed in the article:

# emacs /tmp/initrd.mnt/linuxrc

After that all the steps are to be executed more or lessbackwards:

# umount /tmp/initrd.mnt# gzip -9c initrd > /tmp/floppy.mnt/initrd.gz# umount /tmp/floppy.mnt

The HAL91 kernel does not support SCSI devices. So anyonewho has a SCSI device should also swap the kernel. In HAL91it is called vmloop. Since for our purposes the kernel hardlyhas to be able to do anything, apart from access thecorresponding block device and CD-ROM support, the swapshould not be a problem.

040CDRecover.qxd 29.06.2001 20:02 Uhr Seite 42

Page 37: linux magazine uk 11

diversion is not in quotation marks, otherwise thehard disk will be overwritten by myhost.

But the original objective has not yet quite beenreached, because a normal user cannot beexpected to cope with booting by floppy andcomposing cryptic commands. Luckily, everythingcan be done automatically.

A CD as floppy substitute

Bootable CDs in accordance with the El Torritostandard do none other than make the Bios believethey are a bootable diskette. The recovery CD willthus, together with the hard disk image, alsocontain an image of our boot diskette. Since theTomsrtbt floppy is a portrait format diskette itcannot be used for this purpose.

But mini-distributions are as common aspebbles on the beach. The best suited for therecovery CD is for example the boot diskette calledHAL91.

Directly after booting, the kernel executes thefile /linuxrc. We are thus replacing this file fromHAL91 with our own version, which basicallycontains the two commands mentioned above(mount and bunzip2). How this works in detail isexplained at greater length in the listing ”Amodified /linuxrc”.

Since the restore is a fairly destructive matterand because a normal user is accustomed to theconstant challenges ”Do you really want to ...”, it isadvisable to give the user a last opportunity to stop.The listing shows one option for this.

Space problems

One important question has not yet been dealtwith: What will fit onto a CD? The aforementionedlaptop hard disk has three partitions. The first with acapacity of 1GB contains a freshly installedWindows 98. In addition to this there is a Linuxpartition of 800MB with a Mandrake 7.2 installationand a swap partition with the remaining space.

Originally the computer was only installed inthis configuration in order to test which stunts werenecessary to install Windows 98 as an addon to aLinux computer – in almost all tests it is only thereverse case which is investigated and evaluated.

Of the FAT32 partition, 210MB was occupied.The Ext2 partition on the other hand 674MB. Animage was created, as described above. Surprisingly,this had more than 635MB and thus did fit ontoone CD, but was much too big for this specificexample.

To check the process, the content of bothpartitions was backed up with a classic tar -cvpI. Thecompressed Tar archive of the Windows partition was87MB in size, the Linux archive 195MB. Then thehard disk was repartitioned (one big Ext2 partition)and formatted. A newly created image of this almostempty hard disk still came to a solid 616MB.

The reason for this astonishing size lies in thefact that repartitioning and reformatting onlychanges the administrative information of the harddisk and partitions. The actual data remainsunaffected. Before the created Tar archives wereplayed back, the whole hard disk was overwrittenwith zeroes:

# dd if=/dev/zero of=/dev/hda bs=... count=...

An image of the empty Ext2 partition, with this pre-processing, only comes to just under 109KB, anenormous difference from the 616MB determinedat first. Equally, after restoration to its originalcondition (with Windows 98 and Mandrake Linux)the image came to a reasonable size of just under283MB. In the ”System loading” display, you cansee quite clearly when the zeroes are transferredand compressed. In the central part the CPU loadingdrops dramatically, while the network is moreheavily loaded.

30GB on one CD

The compressed Tar archives show that a Windowsinstallation can be reduced to just under 41 percent, while with Linux it is even possible to attain avalue of under 30 per cent. This is probably due tothe high proportion of text files (for example HTML

KNOW HOWRECOVERY CD

11 · 2001 LINUX MAGAZINE 43

Comparison of bzip2 with gzip Command\File zero random opt-kde2.tarbzip2 (bytes) 113 105.321.149 27.893.829gzip (bytes) 101.801 104.874.289 31.631.186bzip2 (time) 20.4s 264s 150sgzip (time) 8.1s 48s 88sbunzip2 (time) 4.2s 89s 42sgunzip (time) 4s 12s 5.7s

Listing: a modified /linuxrc 01: #!/bin/sh02:03: PATH=”/bin:.”04: TERM=linux05: export PATH TERM06:07: mount /proc/ /proc -t proc08:09: mount -o ro /dev/hdc /mnt10: echo ”Should the hard disk be overwritten (all data will be lost)?”11: until [ ”x$answer” = ”xYES” -o ”x$answer” = ”xNO” ]; do12: echo -n ”Confirm with YES or stop with NO! ”13: read answer14: if [ ”x$answer” = ”xYES” ] ; then15: echo ”overwriting the hard disk. Please wait...”16: bunzip2 -c /mnt/hda.bz2 > /dev/hda17: elif [ ”x$answer” = ”xNO” ] ; then18: echo ”Stop!”19: fi20: done21: umount /mnt22: echo ”Please remove the CD-ROM and press CTRL-ALT-DEL”23: sh

040CDRecover.qxd 29.06.2001 20:03 Uhr Seite 43

Page 38: linux magazine uk 11

Info

Homepage of Tomsrtbt:http://www.toms.net/rb/

HAL91 Homepage:http://home.tu-

clausthal.de/~incp/hal91/

Freshmeat:http://www.freshmeat.net

Sourceforge:http://www.sourceforge.net

MkCDrec Homepage:http://mkcdrec.ota.be

Partimage Homepage:http://www.partimage.org

Source of Sfdisk, also part ofMkCDrec: ftp://win.tue.nl

KNOW HOW RECOVERY CD

44 LINUX MAGAZINE 11 · 2001

documentation, scripts, configuration files)under Linux.

An empty (zeroed) 30GB harddisk in compressed condition

could take up some 1.5MB.If 2GB of the hard disk aretaken up by a Linuxsystem, then the image

should still fit onto arecovery CD. For Windows the

limit is around 1.5GB. Mind you,these are operating systems and

programs. If compressed applications files, maybe inMP3 format, are present, the calculation will lookvery different. If there are several operating systemson the hard disk, space on the CD will also soon runout. But a recovery CD, as described here, is notsuited to such systems anyway.

Optimisations

It may just be acceptable to wait more than an hourfor the image of a 2.1GB disk. But for a really largehard disk the whole process adds up to more than awhole day. So which optimisation options exist?

As described, bzip2 and bunzip2 are ultimatelyresponsible for the time taken to create the imageand to do the restore. A highly practical alternative isto use gzip/gunzip for this task. In the ”Comparison”table, sizes and times for compression anddecompression of three files are listed.

The file zero consists of 100MB zeroes (createdfrom /dev/zero), the file random out of 100MBrandom numbers (created out of /dev/urandom)and the file opt-kde2.tar is an uncompressed Tararchive from the /opt /kde2 directory of mycomputer. The archive also comes to almost 100MB.It is apparent from the table that with real data atime gain of about 40 per cent balances out areduction in size of some 10 per cent. When thedata is already compressed, the performance gap iseven more marked, plus in this case bzip2 also hasthe greater overhead.

But it is only in the case of blank data that areally significant difference can be noted in the sizeof files: bzip2 reduces the 100MB zeroes in thezero-file to a total of 113 bytes, while gzip stillproduces a result which is almost three powers often higher.

With an image, which typically contains datafrom these three basic types, the result is obviouslysomewhat less extreme. The time saving is only about30 per cent, while the size increases by 10 per cent.In the case of large, still mostly vacant disks, though,the calculation may look rather different again.

Relay race

Another problem is the large number of programsneeded to get the image onto the hard disk of thedestination computer. dd reads the data out and

writes it into a pipe. From there it reads rsh, only toimmediately write it back into a socket. On theother side the rshd daemon then reads the datafrom the socket, writes it into a pipe, from where itis then met by bzip2. A real relay race is taking placehere between the programs. The ideal would thusbe a network-capable dd, which writes the datadirectly into a socket, interacting with an equallynetwork-capable bzip2, which can read the dataout of a socket. Since the sources are open, theseexpansions should not mean any great expense. Soif anyone is looking for an interesting programmingtask, they could try their hand at this.

One more important optimisation would be add which can read and write at the same time. Thesource computer in this case could send at fullnetwork bandwidth and the throughput from bzip2would then be the only bottleneck.

Short of just rewriting dd (which would certainlybe the better solution), the variant was alsoinvestigated where the program buffer isinterconnected between dd and rsh and/or beforebzip2. It stores the data in a ring buffer in the mainmemory and can read and write at the same timefrom there. The only thing to watch for here is thatthe memory volume allocated by dd and buffercombined will still fit into the RAM.

With this double buffering on both sides of thenetwork it is possible to achieve a time saving ofabout 25 per cent with bzip2 and 10 per cent withgzip. Unfortunately buffers are seldom found onrescue floppies. Which is one good reason to simplycreate your own bootable CD with a comprehensiveLinux system yourself.

Regardless of these optimisations, there is onehole in the solution described here. There may be(and in the case of large disks, absolutely certainly) ahuge amount of useless zeroes being read,transferred and compressed. At block device level,though, there are only bytes, no contents. Anintelligent alternative definitely requires knowledgeabout the contents at file system level.

Alternatives

A short search of the Internet at Freshmeat andSourceforge also brings some correspondingsolutions to light. The Belgian project MkCDreccreates, from a running Linux system, a recovery CD– or several, if everything will not fit onto one CD.This is intended for system administrators andtherefore not automated, but that could probablybe easily altered.

The number of file systems supported is limited.In normal Linux systems, however, MkCDrec has thegreat advantages of efficiency and flexibility. Thefiles are ultimately backed up with Tar. This meansthat only actually existing data are stored, plus ifyou do a restore a different partitioning is possible.All in all an extraordinary tool, which is continuallybeing improved and, for all those who do not

040CDRecover.qxd 29.06.2001 20:03 Uhr Seite 44

Page 39: linux magazine uk 11

necessarily need a solution for inexpert users, theright choice.

A different approach is offered by Partimage.This is a low-level tool for backing up partitions. Atthe moment FAT16/32, Ext2 and Reiser-FS partitionsare supported. The contents of the partitions areanalysed and only the used blocks are backed up.

The current production version is however evenslower than the dd solution. Firstly, reading the usedblocks is very slow but the compression is donebeforehand on the source computer. On the creditside, Partimage offers an intuitive interface,including such things as progress indicators, and theoption of distributing the image over several media.In an emergency it would be possible to back up apartition on diskettes.

The latest beta version also has a client-servermode, implementing a whole range of optimisationoptions, such as simultaneous reading and writingor the encrypted transfer of data to the server.

This version is described as quite stable, butsuffers from the lack of documentation for the log-in mechanism.

Building on the basis of Partimage, thefollowing procedure for the creation of anoptimised recovery CD would be possible, if onlythe supported file systems are present:• Reading out the partition information, maybe

with Sfdisk. The program allows the partitioninformation to be output in a format which canbe used by Sfdisk again as input.

• For each partition a corresponding image file iscreated via Partimage.

• The images are burnt, together with the Sfdiskinput file, onto the CD.

• The /linuxrc program of the boot image of the CDrepartitions the hard disk via Sfdisk – using thecorresponding input file – and writes all theimages back onto the hard disk.

The advantage of the last procedure, apart fromfaster image creation and faster restore is the optionof backing up larger hard disks, possibly withseveral operating systems, on several CDs.

Conclusion

As you have seen, there are various approacheswhen it comes to restoring a hard disk. All themeans necessary for this are either supplied withsimple distributions or are freely available on theInternet.

But a final pointer - all the solutions consideredare unsuitable as back up procedures for normaluser data. Who wants to restore a whole hard diskor partition just because a corrupted file has to bereplaced? ■

KNOW HOWRECOVERY CD

11 · 2001 LINUX MAGAZINE 45

1/2 ad

040CDRecover.qxd 29.06.2001 20:03 Uhr Seite 45

Page 40: linux magazine uk 11

Rescue diskettes are as common as sand on thebeach. But they all have a whole series ofdrawbacks. They are always too small, slow anderror-prone. And with fairly modern PCs, they areno longer needed now that it is possible to bootdirect from CD. So what could be more obviousthan to make your own bootable Linux CD?

Those who are saying, but such a thing alreadyexists, are of course right (see Info box). But oftenthese CDs are lacking one very special, absolutelyvital program. There are other reasons for making

your own CD. Such CDs are ideal for presentations,training courses, kiosk systems. Or to proudly showoff to your best mate your own brand new KDEinstallation on his computer.

This article presents a procedure which is easy touse and with whose help, at very little effort, afunctioning Linux installation can be transferredonto a bootable CD. The first paragraphs below,though, bring you some theory about the bootprocedure itself, but are of interest anywayregardless of the topic. On this basis, there follows adescription of how to use the build system to createbootable CDs.

All beginnings are easy – theboot procedure After switching on the computer, it looks in theplaces defined in the Bios for executable code.Normally these are the diskette, the CD-ROM driveand the first hard disk. This executable code is verysimple, since at this time there are no operatingsystem resources available, in particular no filesystem. Its task is to load and to start the operatingsystem kernel.

This simple code is also contained in the Linuxkernel, hence you can copy the kernel directly ontoa diskette (dd if=bzImage of=/dev/fd0) and start itfrom there. The kernel then initialises all thesubsystems and starts the program file /sbin/init onthe root partition (to be precise, the following filesare sought in this order: /sbin/init, /etc/init, /bin/initand /bin/sh).

KNOW HOW BOOT CDS

46 LINUX MAGAZINE 11 · 2001

Creating boot CDs

QUICKRECOVERY

BERNHARD BABLOK

Bootable Linux CDs are highly practical in case of emergency. But

producing one yourself does require some knowledge about the boot

procedure and the tool presented here.

046CdBootbd.qxd 29.06.2001 20:06 Uhr Seite 46

Page 41: linux magazine uk 11

The root partition is defined when the kernel iscompiled (in the top level makefile) and has bydefault the same value as the current root partitionon which the compilation is running. This value canbe modified later by means of rdev(8) utilities.Anyone interested in the details of the bootprocedure must definitely take a look in the file/usr/src/linux /init/ main.c.

The program /sbin/init is the primary process ofa running Linux system (it has the process ID 1). Itreads its configuration file /etc/inittab and starts,depending on the inputs, the corresponding scriptsand gettys (or the Xdm for graphical log-ins).

The drawback to the procedure described is itslack of flexibility. The root partition is fixed, plus noadditional parameters can be assigned to thekernel. This means that in practice almostexclusively, a two-stage procedure is used. Insteadof starting the kernel directly, the Bios loads abootloader. This then loads the kernel and transfersto it the arguments – either from a configuration fileor from a command line. The commonestbootloaders (Lilo, Chos, Grub and others) can doeven more. These are boot managers, with whichdifferent operating systems and/ or kernels can alsobe loaded.

Where are the files – the initialramdisk

Even with the bootloader, one question remainsunanswered. On a completely new system, there isno formatted root partition, so nor is there a filesystem with /sbin/init and /etc/inittab. The kernelthat has just been successfully started would thuscome to a stop with a kernel panic. The solution tothis problem is an initial ramdisk. This is a Linux filesystem, which is loaded into the memory either bythe kernel itself (classic ramdisk) or by thebootloader (initial ramdisk: initrd). The typicalemergency diskette thus contains exactly twocomponents: a kernel and a zipped file containing acomplete file system.

If one is using a bootloader, two arguments arenecessary for the kernel: root=/dev/ram andinitrd=path to file. Without a bootloader one has topatch the kernel (again with the aid of rdev), inorder to define the start address of the ramdisk. Thelast procedure, though, has now become fairlyuncommon, since in this case both the kernel aswell as the ramdisk has to be copied onto a blankdiskette to the right offsets.

The boot procedure with this is slightlymodified. Firstly, the bootloader loads the kerneland the initial ramdisk. The kernel unpacks it to anormal ramdisk and mounts it as root file system.Next – if present – the file /linuxrc is executed.

When this program has finished, the correctpartition is mounted, as described above, as root-partition and then /sbin/init is called up. First theinitial ramdisk is either unmounted from the file

system using umount (and the memory space isreleased) or – if the /initrd directory exists –remounted to /initrd.

Stocktaking with Linuxrc

The pivot of any initial installation is the programLinuxrc. It may be a shell script, but usually, in thebig distributions, is a very time-consuming Cprogram and is responsible for the partitioning,selection and installation of the packages.

For a bootable CD-ROM, Linuxrc must do threemain things: depending on the existing hardware,load the right modules, find a CD-ROM drive withthe boot CD and convince the kernel that thecorresponding device is the right root partition. Butthe latter is very simple. Linuxrc has only to write thedevice number (which consists of major and minornumbers) of the root partition in/proc/sys/kernel/real-root-dev.

For everything to work, the kernel must beconfigured and compiled with both ramdisk andinitrd support. The default size of ramdisks haschanged in one of the most recent kernels and isnow only 4MB. This can be modified both duringthe kernel configuration and also via a kernel bootparameter during run time.

Creating the initial ramdisk

There are various ways to create an initial ramdisk.The necessary steps are listed in the printed listing.Firstly, a RAM device is pre-filled with zeroes, then afile system is made. After that, the RAM device ismounted completely as normal and all the necessarydata is copied into the mounted directory. Thecontent of the whole device is then copied by meansof dd and gunzip compressed into a file. Dependingon whether only one start diskette is to be made or acomplete rescue system, the content of the disk isvery simple or correspondingly comprehensive.

In the case of a rescue system the size shouldalso be optimised such that apart from the kernel,

Bootscreen of Bernhard’s bootable Linux CD.

KNOW HOWBOOT CDS

11 · 2001 LINUX MAGAZINE 47

046CdBootbd.qxd 29.06.2001 20:06 Uhr Seite 47

Page 42: linux magazine uk 11

every byte is put to good use. A well-known trickhere is to write a program which acts differentlydepending on with which program name it is calledup. If it is called up as cat, it acts like cat and so on.The individual program commands are then nothingbut hard links to this program.

This saves a lot of space, because the start-upcode, which every program needs, now only needsentering once. The drawback to this is that onecannot simply delete a few programs to make spacefor a tool of one’s own on the ramdisk.

A CD-ROM as root directory

A CD-ROM as root directory obviously has theadvantage of size, but the major disadvantage,compared with a ramdisk, that it is read-only.Unfortunately a running Linux system requires writeaccess to many different directories, sometimes asearly as the start phase:• /var: Here for example important files are made or

perpetuated under /var/run and /var/log. • /etc: In /etc/mtab, all mounts are stored. • /dev: This is where pipes are created. • /tmp: Many programs create files or sockets here. • /home: This is a hotchpotch of all possible

configuration files. One possible solution would be to mount a ramdiskamong each of these directories, make a file systemand copy the contents of the CD into it. But onequickly realises that this will cause problems. So thekernel should mount the CD as root partition, butunder /dev there are still no devices, so they shouldfirst be created in a ramdisk from the contents ofthe CD. The process is similar with the directory /etc.The program /sbin/init reads the /etc/inittab, buthere too there are still no directories and files, sinceonly the first script started by /sbin/init can make thefiles and directories.

A ramdisk for the /var

Even if it does not work like this, this approach is notcompletely wrong and highly practicable for /var,/tmp and /home. So as not to create three ramdisksand end up with a bit of waste, though, /tmp isreplaced by a symbolic link to /var/tmp, and similarly/home by a link to /var/home. The creation of theramdisk, the mounting under /var and the playing inof a complete directory hierarchy (from a Tar archive)is done here at as early a stage as possible, after/sbin/init has passed control to the first boot script (inSuSE for example it is the script /sbin /init.d/boot).

The /proc/mounts trick

For /etc though, we do need a different solution.Here one can use the trick of replacing the file/etc/mtab with a symbolic link to /proc/mounts. Thelast file may not contain all the information, likemtab, but still enough to be able to work normally.If you output both files with cat, you will see hardlyany difference.

As the result of this trick, /etc can stay on theCD. If write access is also needed for additional files,these could be replaced by symbolic links to filesunder /var, such as ln -s /var/etc/foo/etc/foo.

The /dev problem

As the last remaining directory we have to create/dev. As yet, there is no completely satisfactorysolution to this. One highly efficient option is to use

KNOW HOW BOOT CDS

48 LINUX MAGAZINE 11 · 2001

Listing 1: Creating a ramdisk 1: dd if=/dev/zero of=/dev/ram bs=1k count=20482: mke2fs -vm0 /dev/ram 20483: mount /dev/ram /mnt4: cp -a foo/* /mnt5: dd if=/dev/ram bs=1k count=2048 | gzip -v9U> ramdisk.gz

The devfs file system

Devfs is, like Proc, a virtual file system, which can be mounted by the kernelat the same time as the root file system. The great disadvantage of Devfs isthat most programs cannot cope with it. So SuSE supplies a Devfs kernelpatch (not yet even working properly) for the 7.0, but Yast cannot copewith a running Devfs system.

But Devfs is to be an option from kernel 2.4 on, so there will certainly besome changes here. The distributors must be assuming that systems will runwith Devfs. The boot scripts of Red Hat 7 are already prepared for this.

The principle of Devfs is simple. Instead of identifying the devices bymeans of major and minor numbers, as is currently the case, each driver(similar to when loading the corresponding module) logs on explicitly andis then assigned its name. Contrary to today’s systems, in which one caneasily reach over 2000 virtual devices under /dev, with Devfs it is only theactual devices which appear there.

The advantages are obvious: a clear, structured /dev directory withmeaningful names (who knows what /dev/hdj13 really means), no moreadministration of major and minor numbers (these are necessary so thatseveral modules don’t get tangled up) and support of hot-pluggabledevices.

The greatest flame wars in kernel history were probably those to do withDevfs and for a long time it was only available as an unofficial patch.Opponents claimed, in particular, that the kernel gets bigger due to theadditional administration of the devices. All the more surprising was thefact that in the course of the last developer series (kernel 2.3.x) LinusTorvalds did include Devfs in the official kernel, although with the label”experimental”.

Devfs solves a problem in a generic way, which subsystems such as USBalso have to solve. And high-end devices with PCI devices which can beswapped on the fly also demand a solution which allows devices to log onand off.

To run a system neatly using Devfs, it would have to support all drivers inuse. But this is generally not yet the case, which is why there is a Devfsdaemon, which, when accessing classic device names, converts these intothe Devfs names. There will probably be a consolidation of the whole set ofproblems in the 2.5 kernel series, since it makes little sense to supportdynamic devices at several places in the kernel.

046CdBootbd.qxd 29.06.2001 20:06 Uhr Seite 48

Page 43: linux magazine uk 11

the Devfs file system. What this is all about isexplained in more detail in the box of the samename.

Since the time and effort spent getting a systemto run, at least for the first time, with Devfs, is fairlyconsiderable, an alternative is used in this project. Interms of memory consumption, it is certainly notideal but on the other hand can be used withoutany manipulation of the installation. It exploits thefact that the initial ramdisk, as described above, isremounted on the directory /initrd, if this directoryexists. This occurs as the last action, before the newroot system is mounted. If one now replaces /dev onthe CD with a symbolic link to /initrd/dev, one hasall the devices which were already available on theinitial ramdisk.

The situation thus created is fairly pathological.Mounting the CD makes use of a device from theinitial ramdisk. This in turn is mounted on adirectory on the CD. The effect is that there is nooption, during the system power down, ofperforming a clean dismantling of the file systems.And because Linux bars mounted CD-ROMs, youcan only get to the CD again after switching off.

The bootable CD

After this excursion into the shallow end of booting,all that remains is to put together the pieces of thepuzzle to make a bootable CD. What furthersimplifies the matter is the fact that a bootable CDto the El-Torrito standard does nothing more thanemulate a diskette. So to this end, one creates adiskette with bootloader, kernel and initial ramdisk(which essentially contains only the special Linuxrcdescribed above), copies the diskette into a file(such as dd if=/dev/fd0 of=bootdsk.img) and tellsthe burn program which file is the disketteemulation.

Under Linux, though, the last line is not quitecorrect. The actual burn program Cdrecord does notin fact create any CD file systems (ISO9660 filesystems), as the program Mkisofs is responsible forthat. It creates the file system and at the same timecopies all files into it which one wants on the CD.The result is a file with a maximum of 650MB,which is transferred by Cdrecord via a CD burneronto a medium (details on this can be found in lastmonth’s CD writer test).

With a Bios which is error-free the selection ofthe bootloader does not come into it, since the CDnow booting is emulating a booting diskette.Stupidly, though, not every Bios is error-free, withthe result that the Lilo may be loaded by the CD,but it wants to use Bios commands to load thekernel from a real instead of the emulated diskette.This is why the use of Syslinux has taken over asbootloader for bootable CDs. This loader needs an(obviously immortal) DOS file system on the disketteand as a result does not find the kernel directly viathe Bios.

An easier life

This points the way to a bootable Linux CD. All youneed do is replace a few directories and files withsymbolic links, write a little Linuxrc program, createa boot diskette and burn the whole thing onto CD.Unfortunately, a system with all the remounteddirectories is hard to maintain. In particular, bending/dev can have some unpleasant side effects, if youwant to boot the system which served as modelagain from the disk.

But since almost all steps towards a bootableCD are independent of the distribution used, itseems a good idea to create a makefile forautomation purposes. A makefile, in the executionof the idea, actually turned into an entire hierarchy,though the principle remains the same. For this youwill need a computer with enough space for twoLinux systems: an active system for the work and asecond system to serve as model for the CD.

The model system is installed and configuredcompletely normally. Of course, one must hold backa bit, because even 650MB soon fills up. The modelsystem is then worked on from the second partition.This splits the procedure into two parts. In the firststep, only those modifications are performed whichare not destructive in the sense that the system canno longer be booted. So for example, moving/home to /var/home is no problem at all. On theother hand potentially destructive operations areperformed almost on the fly during the creation ofthe CD.

Anyone wanting to play around with thisconcept a bit can download the files fromhttp://www.bablokb.de/bblcd/. Extensivedocumentation comes with them. The system maynot be perfect yet, but the basic functions arealready in place. There are also professional systems(for example Webpads), which work with bootableLinux CDs. An update of the system is no problemeven for amateurs with this, as a simple change ofCD handles the system update.

If you have a weakness for cool gadgets, youcan also get hold of blank CDs in visiting cardformat. These are really expensive for just under20MB of available space, but for a personal Linuxrescue system in your trouser pocket, it’s worth it. ■

Info

Bernhard’s bootable Linux CD: http://www.bablokb.de/bblcd/H.P.Anvin: The most overfeatured rescue disk ever created:http://www.kernel.org/pub/dist/superrescue/Homepage of Gibraltar, a firewall system which can be started from a CD:http://gibraltar.vianova.at/The bootable visiting card of Innominate:http://www.innominate.de/level2.phtml?parent=101A CD-based rescue system: http://rescuecd.sourceforge.net/The classic. The most you can fit on a diskette: http://www.toms.net/rb/home.html

The author Bernhard Bablok works forAGIS mbH as a systemsprogrammer in the systemsmanagement division. Whenhe is not listening to music,cycling or walking, he isinvolved with topicsconcerning object orientation.He can be contacted at [email protected].

KNOW HOWBOOT CDS

11 · 2001 LINUX MAGAZINE 49

046CdBootbd.qxd 29.06.2001 20:06 Uhr Seite 49

Page 44: linux magazine uk 11

While in the past, computers were driven to thelimits of their capacity by database applications

or scientific calculations, nowadays it’s gameswhich are the greatest guzzlers of resources.In particular since the screen display hasbecome ever more realistic, even the fastest

processors have broken into a sweat over thenecessary calculations. Instead of moving flat

figures over a painted background (as used to bethe case) games scenes are now depicted in 3D - invirtual space there are now several thousand objectsspread around, with different structures, form andcolours. But since a monitor can still only show two-dimensional images, the game scene must thus bephotographed for each individual monitor imagefrom the point of view of the player or, morecorrectly, it must be rendered.

To give the CPU a bit of breathing space, sub-tasks to do with rendering have gradually beenfarmed out to the graphics card chip. Now, insteadof tracing each individual beam of light, theprocessor need only tell the graphics card theposition and nature of the individual objects (whichare split up into small, triangular areas) - and thegraphics card takes care of the rest.

One of the biggest manufacturers of suchgraphics chips with 3D hardware acceleration is thechip forge Nvidia (http://www.nvidia.co.uk), whichis where many graphics cards manufacturers, suchas Elsa for example, go for their chips. Since everychip manufacturer uses his own, well-protectedinstruction set, a special driver is necessary to makeuse of the 3D characteristics. Nvidia has beenoffering Linux drivers for quite some time now,which you will find on the company’s FTP server atftp://ftp1.detonator.nvidia.com/pub/drivers/english/XFree86_40/.

The driver consists of two parts: The GLXpackage, which guarantees connection to the X-server, and the kernel module, which allows directaccess to the graphics card. Nvidia supplies ready-adjusted packages for the commonest distributions.By the way, you will not find the drivers on our coverCD, since this is not possible for licensing reasons -they have not been disclosed. For reasons of spaceand time, though, we are limiting ourselves to

versions 7.1 and 7.0 from SuSE and Red Hat 7.0.Since the Nvidia driver requires at least XFree864.0.1, the use of older distributions is problematicand not recommended. Generally, the system shouldalways be the very latest, which is why you cannotget away without regular updates for the driver, theX-system and the kernel. The use of the latest driveris absolutely vital, as Nvidia is still struggling withproblems of stability, from simple graphics errors tocomplete crashes of the Linux system.

SuSE 7.1

During installation, YaST2 offers you, at the X-installation, the option of selecting the 3D driver,but you can ignore this. Integration is done later viaSaX2 or by manual adaptation of the configurationfile. As we closed for press, the latest version of theNvidia driver was Version 0.9-769, thecorresponding packages are called NVIDIA_GLX-0.9-769.suse71.rpm and NVIDIA_kernel-0.9-769.suse71.rpm. If newer drivers come out in themeantime, you should give these preference. Thetwo packages should be stored in the /tmpdirectory, which facilitates the description of thenext steps.

We are assuming a SuSE-7.1 standardinstallation. To prepare the 3D installation you mustof necessity leave the graphical user interface andchange over to a text console. The first text consolecan be reached using [Ctrl+AltF1], and there youshould log in as root. After that, use init 3 to switchthe graphical user interface off completely and youcan start the actual installation.

You no longer need the mesasoft package forsoftware rendering, and can delete it using rpm -emesasoft. Next, the kernel and then the GLXpackage from Nvidia are installed:

rpm -i —force /tmp/NVIDIA_kernel-0.9-769.susUe71.rpmrpm -i —force /tmp/NVIDIA_GLX-0.9-769.suse71.rpm

The kernel package must be installed by --force,because it overwrites the Nvidia modules suppliedby SuSE. When installing the GLX package, RPMmay possibly complain about the lack of the file

KNOW HOW 3D INSTALLATION

50 LINUX MAGAZINE 11 · 2001

Installing 3D Support for Nvidia cards

HOUSE OFCARDS

MIRKO DÖLLE

In order to

enjoy the smooth

flow in most games,

you will need 3D

hardware support. Here

we explain the

installation for Nvidia-

based graphics cards.

0503Dsbd.qxd 29.06.2001 20:08 Uhr Seite 50

Page 45: linux magazine uk 11

switch2nv_glx, but this is not a problem. The nextthing is to set a missing link for GLX:

ln -s /usr/lib/libGL.so.1 /usr/lib/libGL

In order to activate the 3D support, you can eitheredit the X configuration file by hand or use SaX2.

Installation with SaX2

Call up sax2 -f and refuse the first 3D supportoffered, since otherwise SaX2, especially in the caseof GeForce-3 based cards such as the Elsa Gladiac920, will not start. The settings which SaX2 nowoffers you should also be rejected and instead ofthese, you should select Change Configuration fromthe menu at bottom right. Then comes a query, asto whether any allegedly missing componentsshould be installed. Say no to this.

In the dialog which follows, accept your formerX-settings with Use / change the currentconfiguration and click on Next until you reachGraphics Device Setup. The corresponding modulesmust be selected here. Click on Properties, Expert.You will be offered, under Driver, the nv module.Instead, choose nvidia from the pull-down menu, asshown in Figure 2. With OK you will come back intothe graphics device setup. There you should click onLoad 3D modules, tick glx and again confirm withOK. With Next you will reach the monitor selection,where, under Properties, apart from your monitormodel, you can also set the resolution required. Ifyou have finished this, click on Finish.

In the window that follows, save the settingsfirst as in the tests, there were some SaX2 crashes,for which no configuration had been written. Aftersaving, do not leave SaX2, but start the test mode.Here you can make the final fine adjustments. TheSave Configuration button then brings you back toSaX2, which you can then shut down.

That completes the installation, and with init 5you can get back to the graphical user interface.

In rare cases, it can happen that games, despiteapparently correct installation, do not run 3D-accelerated, or even complain about the absence of thelibrary libGL. If this happens, call up switch2nvidia_glxas root. On one occasion, it was even necessary to playin the GLX package again using rpm -i --force --nodepsNVIDIA_GLX-0.9-769.suse71.rpm.

In order to return, in the worst-case scenario, toyour original configuration, all you need to do isrename the file /etc/X11/XF86Config.saxsave againas XF86Config.

Manual installation

Editing the configuration file directly in an editor,such as mcedit, goes much faster than with SaX2.Using mcedit /etc/X11/XF86Config you can edit thecentral configuration file of the X-window system.First, look for the section Modules and there addthe entry Load ”glx”:

Section "Module"...Load "freetype"Load "glx"

EndSection

This means the GLX-Module will be loaded on thenext startup. Now you must enter the Nvidiamodule in the section Device. SuSE has the modulenv in there as standard. Here is the changed section:

Section "Device"Driver "nvidia"Identifier "Device[0]"

EndSection

Store the file with [F2] and leave mcedit with [F10].That’s the end of installation, init 5 brings you backto the graphical log-in.

SuSE 7.0

Installation with SuSE 7.0 issignificantly more time-consuming: Since there is noNvidia driver for version 4.0of XFree86 which isincluded in SuSE 7.0, youwill have to downloadaround 30MB from theInternet. Updating the X-server is a subject thatbrings its own set ofproblems. If it goes awry the graphical log-in will nolonger function. Which is why you should notperform the update without some thought.

You can obtain the RPM packages fromftp://ftp.gwdg.de/pub/linux/suse/ftp.suse.com/suse/i386/X/XFree86/XFree86-4.0.2-SuSE/. To update onXFree86 4.0.2 you will need the RPM packagesxshared, xmodules, xf86, xloader and xfntscl. Alsoadvisable is xfnt100, and for installation, also,intlfonts-ttf and sax2 from the sax2 subdirectory.

To update, you must also switch off thegraphical user interface. To do so, change, using[Ctrl+Alt+F1] to the first text console, log on as rootand call up init 2. After that, install the RPMpackages in the sequence mentioned above usingrpm -Uhv –force –nodeps packagename.rpm. Solong as no error messages have popped up, you canmove on to the installation of the 3D support.

To do this, first install the correspondingpackages from Nvidia, in our case these wereNVIDIA_GLX-0.9-769.suse70xfree86-4.0.2.i386.rpm and NVIDIA_kernel-0.9-769.suse70xfree86-4.0.2.i386.rpm. The procedurecorresponds to that of SuSE 7.1.

Installation with SaX2

Manual installation after the update is very difficult –there is no configuration file to rely on. For thisreason, you should use SaX2. The procedure is

KNOW HOW3D INSTALLATION

11 · 2001 LINUX MAGAZINE 51

Figure 1: The Elsa Gladiac 920 with GeForce-3 chip functions onlywith the latest driver version (from 0.9-769). The installationprograms from SuSE and Red Hat do not yet recognise it, but in case of doubt the settings for older models likeGeForce 2 will work.

0503Dsbd.qxd 29.06.2001 20:08 Uhr Seite 51

Page 46: linux magazine uk 11

identical to the installation under SuSE 7.1, exceptthat you must additionally control the proposedsettings for mouse and keyboard. On the whole,though, these can be taken over. After the end ofinstallation, return to the graphical log-in with init 3.

In order to revive the old XFree86 in case oferror, insert the first SuSE CD (or DVD) in the textconsole and, as root, call up yast. Under Defineinstallation/start, Change/create configuration youwill find a listing of the SuSE series. The packagesrequired are in the series ”x”, marked with [i]. Nowgo to the package thus marked and press the [R]key, which will change the marking to [R]. With[F10] you can then leave the series and select Startinstallation. At the end of installation, leave YaSTand use init 3 to return to the graphical log-in.

Red Hat

Installation under Red Hat 7.1 is something we willhave to owe you, sadly, as the packages offered byNvidia were produced for the wrong kernel version.By and large, the procedure with Red Hat 7.1 issimilar to that described below.

Red Hat 7.0 already comes with XFree86 4.0.1and therefore needs no X-update like SuSE 7.0.Should your graphics card not be recognised duringinstallation, for example because you are using aGeForce 2 GTS or GeForce 3 and this is not yetdetected, select a previous model, such as GeForce2. The Nvidia packages necessary for installation ofthe 3D support are NVIDIA_GLX-0.9-769.i386.rpmand NVIDIA_kernel-0.9-769.rh70-up.i386.rpm.Both packages should be saved in /tmp to simplifymatters.

With Red Hat, too, you must first swap thegraphical user interface for the text console: Afterswitching over with [Ctrl+Alt+F1] log on as root andswitch off X with init 3.

Additional preparations are not needed, and thenext thing to do is install the kernel and the GLXpackage from Nvidia:

rpm -i /tmp/NVIDIA_kernel-0.9-769.rh70-up.i3U86.rpmrpm -i /tmp/NVIDIA_GLX-0.9-769.i386.rpm

RPM will tell you that diverse files have beenrenamed by way of avoiding conflict. But moreabout that later, for the moment we can ignore themessages.

Manual installation

This leaves the manual entry of the correct server in/etc/X11/XF86Config-4. The GLX-Module is alreadyentered in the case of Red Hat as standard, so allyou need do now in the section Device is to swap nvfor nvidia. The result should look like this:

Section "Screen"Identifier "Screen0"...Driver "nvidia"...

EndSection

That completes the 3D installation, init 5 brings youback again to the graphical log-in. On our systemVersion 0.9-769 of the driver turned out not to bevery stable. If you have problems with crashes in 3Dgames, you might want to try out the forerunner -version 0.9-6. The installation procedure differs onlyin that RPM now comes with the parameter ”--force”.

Uninstallation

The message displayed during the installation of theGLX package about the renaming of four files wasintended for any later uninstallation and concernstwo files in each of the directories /usr/lib and/usr/X11R6/lib/modules/extensions: ”xxx” is placedbefore their names and the ending ”.RPMSAVE”attached, so if you want to uninstall you mustrename them as before. No other changes arenecessary.

Prospect

Naturally there are other graphics chips with 3Dsupport than those from Nvidia. For a few verywidespread chips, including ATI Rage 128, ATIRadeon, 3Dfx and Matrox, the DRI Project(http://dri.sourceforge.net/) makes ready-madedriver packages available for self-compilation – youcan find the main ones on our cover CD. But sincethe drivers require Kernel 2.4 together withXFree86 4.0.1 or higher, the only suitable bases arethe latest distributions from SuSE, Red Hat orMandrake. We will come back to this topic in alater issue. ■

KNOW HOW 3D INSTALLATION

52 LINUX MAGAZINE 11 · 2001

Links

Nvidia-driver for XFree86 4.0.1or higher:

ftp://ftp1.detonator.nvidia.com/pub/drivers/english/XFree86_40/

Update to XFree86 4.0.2 forSuSE 7.0:

ftp://ftp.gwdg.de/pub/linux/suse/ftp.suse.com/suse/i386/X/XFree8

6/XFree86-4.0.2-SuSE/

Figure 2: The nvidia module is the hardware-

accelerated variant.

0503Dsbd.qxd 29.06.2001 20:08 Uhr Seite 52

Page 47: linux magazine uk 11

Railroad Tycoon is a graphical strategy game, theaim of which is to build a railway empire. This youcan do in a wide range of geographical andhistorical contexts, each of which provide their ownunique challenges. These range from the almostridiculous scenario of running a passenger trainservice in Antarctica to coping with the stresses andstrains of running the all important supply servicesto Second World War-torn England.

You take on the responsibility of decidingroutes, laying track between locations, building andmaintaining infrastructure and running services.

You will find, depending on the type of scenarioinitially chosen, locations which provide resourcesand those that require them. The cattle farmsrequire grain to boost milk production, the milk isrequired by populated areas, those areas withpeople provide passengers, mail and have otherrequirements still. So the first skill needed is to seewhere opportunities lie for bringing togetherresources and those with a need for them. Then tolay efficient and well maintained track betweenthem, while keeping another eye open for furtheropportunities. That would make for a game good

enough, but Railroad Tycoon goes further, as yourgame progresses so does the scenarios develop overtime – new technologies come into play, allowingyou to combine new and different resources. Butthe gameplay doesn’t even stop here as you also getto dabble in the world of high finance, where youcan sell shares and issue bonds for your railwaycompany and also buy and trade stocks of othercompanies playing against you.

The game itself is presented and packaged in amost professional way. The box, rich with artworkcontains a 120 page instruction manual and userguide, a full colour fold out aide-memoire detailingthe profitable route for resources to take throughthe maze of demands made by the world and the allimportant CD-ROM. When the game starts, at leastfor the first time, you are played a full motionrailway themed video trailer to get you in the mood.

The Installation Process

This is clearly laid out in the user guide and involvesnothing more than running a script and answering afew questions. You can customise the install to

COVER FEATURERAILROAD TYCOON II GOLD EDITION

11 · 2001 LINUX MAGAZINE 53

Life would truly be

unbearable should you be without the

facility of diversion, and here, and here in this game

we have a great diversion, but will it suit you? If you

like a game that involves the challenge of developing strategies against

a complex and changing environment then yes, I reckon it will.

In the age of steam become a

RAILWAYBARON

COLIN MURPHY

053Railroadsbd.qxd 29.06.2001 16:09 Uhr Seite 53

Page 48: linux magazine uk 11

include the larger and more fancy introductory videoclips and options on what sets of scenarios save onhard disk space, should that be a scarce commodity initself. It did not set up a desktop icon by default, forKDE at least, but this was easily done by right- clickingon the desktop and creating a new link to the application.

The minimum install size is some 200MB withgraphics displayed at 1024x768 and 16 or 8-bit colourdepth. Sound is nice to have, as you are offered audiofeedback, but you don’t have to rely on this. Thegame play isn’t’t very processor intensive and onlycalls for a minimum spec of a Pentium 133.

Playing the Game

Even though the game comes with acomprehensive, but still readable manual, it alsofeatures a very handy tutorial scenario to allow theeager player to start to enjoy the game without anyunnecessary delay.

The tutorial will show you how to manipulatethe basic features of the game, such as laying trackand building stations. From here you get to seehow to set up train services and organise the cargothat they will carry from one town to another inexactly the same way you would in a real game.

The screen initially shows an isometric view ofthe landscape with trees and some buildingrepresentations shown. Using the mouse you clickand drag between any two objects to lay a track.After the track is laid you then need to add stationsand sundries, such as water towers and post offices.Next you need to buy a train to run on your line andchoose the make up of the carridges and wagonsthat will be transported. You need to choose thecorrect cargo to move between towns such as ironore from the mine to the steel foundry along withcoal from the pit. This allows you in turn totransport from the foundry to the tool factory steel.

Each cargo moved increases revenue for yourcompany but also increases the wear and tear onthe train and track.

The game can be played with others over aTCP/IP network, be it local or through the Internet,or pit your wits against computer-controlled playerswhich you can configure to match your skill level.The winner being decided on the final profitachieved over a set period of play.

COVER FEATURE RAILROAD TYCOON II GOLD EDITION

54 LINUX MAGAZINE 11 · 2001

Info:

Publisher- Loki Gameshttp://www.lokigames.comCost - £15.00 from SuSE or

Linux Emporium.

The main gamein play.

Choosing the consistof each train

053Railroadsbd.qxd 29.06.2001 16:09 Uhr Seite 54

Page 49: linux magazine uk 11

At any point you can purchase new track, trains orcargo and modify the wagon make up of each train.

When running short of money you have theoption to enter the world of business dealing whereyou can raise capital or should you be flushed youcan attempt a takeover or merger with rivals.

One curiosity though is that if the CD-ROM hasbeen left in the drive then a Rhythm and Blues trackis played ad nauseum – never has a CD beensnatched from a drive bay with such vigor!

The plus and minus keys control the speed ofthe game and the graphical view shows tiny trainmodels moving back and forth. This is just one ofthe keyboard shortcuts which you will find outabout by taking the time to read through the paperdocumentation as well, knowing some of thesekeypresses really improves the game flow.

The only criticism of the game was when youchoose the cargo combinations you have to say atwhat station these will be left. The map for thissection may contain lots of towns, but being soclose due to the map scale it is often difficult tohighlight the correct one with the mouse.

When laying track you need to be careful of theroute over the landscape that is taken, as if over steepterrain then most fuel and time are used as well as agreather chance of the train breaking down, givingrise to further costs or a replacement train.

The more that a train is used the greater thechances are of a breakdown. Breakdowns cause thegoodwill of the company to be hurt and so in turn theshare value. Adding more roundhouses at stations meansthat the trains are more likely to be maintained for longer.

After playing all the available scenarios you have abuilt in map editor so you finally can make a railway onthe moon if you choose.

Along with the manual there is also the strategyguide on disk in html format. This is not simple andelectronic version but rather a game walk throughshowing how and why certain gamesplay occurred. It alsosets out how the computer plays and what strategies touse to win.

While playing events will occur. This is where someaction has occurred that you maybe able to utilisesuch as a remote town offering a bonus to anycompany willing to connect a railway line to it or aline being bombed during a war.

Once you are familiar with all the game techniquesyou can then play in the advanced scenarios. Here youreceive no income for moving unwanted goods, only acost as your fuel is used up. This level does allow you tobe ruthless with your opponents. You can not only buyrailways but the surrounding industries such as thedairy farms or ports. Once owned, you can then dealon margin profits where the rival railway companieshave to pay you a percentage for the goods. You canalso use your personal wealth to buy rival stock sogiving you more voting power when you attempt todo a takeover or merger. Failed mergers need to wait ayear before reattempting. This stops you quicklyincreasing the bid to buy at a minimum cost.

Should you be less than financially astute, thenyou also have the option of playing the game in‘sandbox’ mode, where the financial distractions areremoved from the overall game, more than enoughfor some of us. The game is very configurable,allowing you to make changes to things like thecolour depth of the display, so the game will workon less than up-to-date hardware, or to change theskill level of your computer opponents so that youcan enjoy a challenging game and not just awhitewash on one side or the other.

The cutesy graphics similar to SimCity games donot distract and with the speed control it is sometimeslike watching a Hornby railway in you X session.

Overall, the game has caused many a lost hourand it continues to eat up free time. Each time youthink you have mastered the game you realise thatthere is another layer of dealing and so the gamebecomes more and more devious. ■

COVER FEATURERAILROAD TYCOON II GOLD EDITION

11 · 2001 LINUX MAGAZINE 55

Building stations

Profit or loss?

053Railroadsbd.qxd 29.06.2001 16:09 Uhr Seite 55

Page 50: linux magazine uk 11

On this month’s cover CD you will find a copy of theLinux beta of Creatures. New games releases can beseen as part of the Linux advance on the desktop.However online gaming on Unix and itspredecessors can be traced back over 30 years.

MUD Slinging

Of course the stereotype of a Unix sysadmininvolves science fiction and Dungeons & Dragons asmuch as beards and sandals. It is no surprise to findMulti User Dungeons (MUDs) have long been apopular pastime in the Unix community

The first MUD to appear on the internet wasMUD1, in 1979, created at Essex University byRichard Bartle and Roy Trubshaw. It was written inMACRO-10 - the machine code for DECsystem-10,with the first external players logging in accrossArpaNet, from the USA, early the following year.

MUDs quickly became popular pastimes amongstthose with the connectivity (usually research studentsand systems administrators). Although everything inthe games could be effected by telnet access, manymore advanced client programs were written during

the 1980s. This has continued in recent years as Linuxand the internet has brought a whole new generationto the pleasures of pretending to be lost in some darkdungeon, surrounded by powerful adversaries.

Mud on the desktop

Those running KDE may want to try Kmud (seefigure 1), which integrates into the desktop as wellas offering all the usual features such as intelligentbrowsing of input history and an automapper.Papya is a more tradional client for Gtk. Again it hasa strong feature list and benefits from a simplePlugin system if you wish to add your own modules,as well as being fairly configurable. For adevelopment upon traditional clients, mcl - MUDClient for Unix runs under a virtual console on theLinux desktop. It is fast, supports embedded Python(and Perl) and makes life easier with features suchas automatic login, aliases and Macro keys, as wellas some support for peer-to-peer chat protocols.

Graphic detail

Bioware have taken a different approach to thetraditional MUD game by implementing the Dungeons& Dragons 3rd edition ruleset in a realtime 3Droleplaying game, using the latest rendering andgraphics techniques. Of course it needs a morepowerful PC than any MUD client, but there is sometime to save as the simultaneous PC / Macintosh /Linux release is still a long time in coming. It isrefreshing to find a company which is taking its time toget a product right rather than rushing it out the door.

COVER FEATURE ONLINE GAMING

56 LINUX MAGAZINE 11 · 2001

Taking play seriously:

ONLINE GAMINGRICHARD SMEDLEY

[left]Figure 1: Follow theyellow brick road...

[right]Figure 2:

Strange fruit

Before the advent of the console and the home

computer, gaming was ususally a social

occasion, involving two or more people. With the

Internet gamers are once more locked in combat

with each other, rather than pitted solo against

the rudimentary AI running on their PC.

056Onlinesbd.qxd 29.06.2001 16:32 Uhr Seite 56

Page 51: linux magazine uk 11

Creature feature

Also soon to be released is the Linux version ofCreatures Docking Station. The creatures inquestion are cute artificial life forms, à laTamagochi, known as Norns. They can feedthemselves, communicate and be taught what isright and wrong. With the launch of DockingStation populations of Creatures can now interact,and be swapped. Digital DNA means a better Norncan be bred - you can get to play eugenics withoutthe moral outcry. Docking Station is a hybrid of agame client and a web site. Users can send Nornsdirectly between each other, and then track wherethey are on the web. You can also receive a Nornfrom a random other user, and then start a chatsession with them to tell them how it is getting on.

The installation should delight many a Linuxnewbie, or indeed anyone who has previouslysuffered RPM hell, or hunted high and low for theright versions of libraries needed. After downloadingand untarring the beta version from the site, justenter the directory and run the install script:

./dstation-install

It will grab the latest updates for you. So far it hasbeen tested successfully on Debian, Mandrake,Redhat, Slackware and SuSE. On the cover CD youwill find the application untarred and ready toinstall. If you need to be root to install anything, youwill be prompted for the password. Of course thereare security implications to all of this, but then youare safe behind a hardened firewall, aren’t you?

On the Board

Chess has brought people together for deep andstudied confrontation for centuries. It has proved arelatively simple challenge for AI developers withchess programs now available to play at

international master standard. Nevertheless part ofthe satisfaction that many gain from games of skillarises from pitting themselves against the cunning ofanother human player, probing for weaknesses andlaying traps. The popularity of the game has lead toa thriving online community with many servers

On an Internet Chess Server (ICS) one can playonline with players across the world, or againstmachine opponents, watch beginners orgrandmasters or just hang out and chat. The FreeInternet Chess Server (FICS) is justly popular withthe Internet Chess Club a good alternative.

The XBoard interface provide front ends to mostof the chess servers on the web, and very many chess”engines” - programs that play chess. GNU Chess andCrafty will be found on most distribution disks, andplay a fairly good game. Machine ”intelligences” tendto be strong tactically, but weak strategically though.

Go?

The Japanese game of Go, based upon the ChineseWei Qi, is better suited to an ”intuitive” approach,rather than a computer’s brute force problem-solving. It makes a good basis for AI research, butmeanwhile load up one of the Linux Go clients,connect to one of the international Go servers anddiscover this ancient and fascinating game. Wehave included a number of clients and Go links onthe cover CD as, for obvious reasons, it is very hardto do a web search for ”Go”. ■

COVER FEATUREONLINE GAMING

11 · 2001 LINUX MAGAZINE 57

Figure 3.Too cute by half

[links]Figure 4: Digital DNAgives rise to diversity

[rechts]Figure 5: Travelling is easywith the Warp

simple

or graphical

InfoLinks to MUD clients: http://www.kyndig.com/links/ClientsYou will find some of them on the cover CD.mcl - MUD Client for Unix: http://www.andreasen.org/mcl/index.shtmlMud server: http://www.circlemud.org/Creatures docking station: http://ds.creatures.net/linux/beta.plNever Winter Nights: http://www.neverwinternights.com/ICS: http://www.chessclub.com/FICS: http://www.freechess.org/A good source of info: http://www.tim-mann.org/chess.htmlThe code to DeepThought can be downloaded from http://www.tim-mann.org/DT_eval_tune.tar.gzGo servers - NNGS: http://nngs.cosmic.org/IGS The Internet Go Server: http://igs.joyjoy.net/kiseido Go server: http://www.kiseido.com/

056Onlinesbd.qxd 29.06.2001 16:32 Uhr Seite 57

Page 52: linux magazine uk 11

The new version of XPilot on the other hand couldbe played via the Internet. And it ran, as the namesuggests, under the X windows system. To be moreprecise, there is an XPilot server and a client, whereonly the client needs X11. In the meantime, clientsfor variants of Windows have now becomeavailable, although they leave a lot to be desired insome aspects.

But XPilot also disrupted network operations inmany a university, because the administrators didnothing but play all day, thus giving denial-of-service a new twist. XPilot was a game of its time:impressive coloured vector graphics, tedious-to-

learn keyboard controls, barely synchronised,croaking sound. What a crass thing compared totoday’s Ego-shooters. The facts about XPilot aresummarised according to modern criteria as agames rating in Figure 1. Hardly any points and yetstill 90% gaming fun? Yes, even today XPilot stillhas its attractions, which go beyond pure retro-computing or feelings of nostalgia.

Installation and preparation

The game gets under your skin, not through realisticgraphics nor through particular brutality or acomplex frame handling. It’s just the dexterity, therapidity and the strategy of other human co-playersthat give the game its allure. Put another way: XPilotis terribly boring to play on your own. On the otherhand you need solid training to have any chance inthe shark-infested Internet. It’s best to start trainingon your own local server, on which you will not bebothered by the overwhelming Nordic Empire (top-level domains .dk, .se, .no and .fi).

Before launching into the game, you shouldmake sure that you are using at least Version 4.3.0.The version number is always stated at the start of

Figure 1:An objective game rating.

COVER FEATURE XPILOT

58 LINUX MAGAZINE 11 · 2001

Like so many things for me, it began long

ago. Doom could just be played within

a local network, at the same

time crippling it; provided

you had already received

higher orders of IPX

configuration under DOS.

And what you experienced then

actually made Doom superfluous: as the result of the IPX

broadcast storm triggered by the game, some of the secretaries

who were being hindered in their work turned into raging

monsters. Often, it was hard to tell the difference between game

and reality.

Multi-player Fun

XPILOTWINFRIED TRÜMPER

058xpilotsbd.qxd 29.06.2001 16:50 Uhr Seite 58

Page 53: linux magazine uk 11

the program. You can build the files from a tararchive, and install yourself. This procedure is easyand is explained in Box 1.

On start-up, the server (started with/usr/games/xpilots), immediately contacts the meta-server named meta.xpilot.org and enters itself therein the list of active servers. So other players becomeaware of your server and can connect to it. Theoptions +reportToMetaServer and -onePlayerOnlyprevent this action, if you want to be leftundisturbed. The client is now started with/usr/local/games/bin/xpilot &. The meta-server canbe queried directly by the XPilot client, if you simplyomit a host name at the start. Click on the Internetbutton and you get a list of world-wide servers,sorted according to the number of players.

Of the many options for the server process, -mapFileName is one of the most important, becauseyou use this to specify the file name of the worldmap. The world newbie-demo was developedespecially for this article, and it contains all thecomponents with the exception of the balls. Copy amap file newbie-demo.xp into the current directory,and then start the XPilot server on the commandline: xpilots -mapFileName ./newbie-demo.xp.Beware: The cannons on the walls fire whenapproached, and you must activate the protectiveshields promptly by using the space bar.

Pilot, salute the sun for me!

When starting the client, specify on the commandline as parameter localhost, so that the local serveris contacted. The complete command to start theclient is /usr/local/games/bin/xpilot localhost &. Theclient reads its settings, by the way, from the file~/.xpilotrc, which you can edit either manually withan editor or from the configuration menu of theclient (under Menu/Config). Firstly, the clientpresents you with an internal command line, whichyou can explore yourself with the help command.By pressing the Enter key, finally, you can start thegame. If you left out the localhost when starting,click now, to get into the world newbie-demo, inthe client window on Local, and you should see the

message ”The following local XPilot servers werefound”. You will be offered your local server, andwith a click on Join, you start at training camp.

Steering the ship can be done with either themouse and/or using the keyboard. Newer Windowskeyboards like to protect the user from himself, bylocking up completely if you press several keys.Simultaneous turning, acceleration and shooting([a]/[i]+[Shift]+[Return]) is impossible with this typeof keyboard, and in this case it is advisable to havemouse control right from the start, to have any kindof a chance. The next time you buy a keyboard youwill automatically watch for such characteristics.

Moving with the ship is simple, in principle. Turnleft with [a], turn right with [s], accelerate with [Shift]and fire with [Return] – not to be confused with[Enter] on the number block, which toggles back andforth between mouse and keyboard control. Oh yes,and to couple and decouple the ball, press [f]. This canbecome necessary, in order to drive the ball and at thesame time fight an opponent. There is no braking,because otherwise the game would become toocomplicated. To stop, make an abrupt U-turn. Youshould avoid colliding with walls, opposing playersand their shots. Protective shields only help up to acertain speed, so it’s always better to rely on your ownskill. The shields, the deployment of items andmovement also require (lots of) fuel, which you mustpromptly refill. If you can’t find any fuel tanks lyingaround, you can search the world for built-in petrolstations, fly to them and with the [f] key, fill up. Amassitems by switching off the shields using the space bar(if active) and flying over them. A list of all items in theserver versions from 4.1.0 on is shown in Table 1.

Some items get used up over time or with use,regardless of whether successfully used or not. Themore items of a type are attached to the ship, thestronger, too, is their effect. Bear in mind thepossibility of modifying the weapons. A smartguided missile finds the enemy automatically, whilean invisible enemy can be tracked down by a heat-seeking missile. The keys for modification can befound in Table 2.

The keyboard assignment is a science in itself,and so is the question as to whether you want to

COVER FEATUREXPILOT

11 · 2001 LINUX MAGAZINE 59

Figure 2: Training in the world ofnewbie-demo.

Box 1: Installationinstructions for XPilotAs root system administrator,change to the directory/usr/local/src/ and unpack thearchive there:

cd /usr/local/srctar xzf /tmp/xpilot/xpilot-4.U3.1.tar.gz

Change to the source directoryand compile the sources asfollows:

cd xpilot-4.3.1xmkmf -amake

A final

make install

copies all files to the designatedplaces in the file system, theserver to /usr/games/xpilots andthe client to/usr/local/games/bin/xpilot.

058xpilotsbd.qxd 29.06.2001 16:50 Uhr Seite 59

Page 54: linux magazine uk 11

COVER FEATURE XPILOT

60 LINUX MAGAZINE 11 · 2001

Table 1: Items

Symbol Description Key

Fuel Needed for propulsion and weapons. Can be used to repair your own base. Can also fill your tanks none

Tanks To take on additional fuel. Also accelerates refueling. Each tank holds only a limited quantity of fuel.

Can also be used as a weapon, by decoupling them. The tanks, together with the fixed-installation main tank,

form a unit, whose fill level is displayed on the right in the HUD [R]

Aircraft cannons The cannons built into the ship. Can be added to with a fan and a tail gun [Return]

Fan canon (wides) Scatters the shots from the on-board cannons in a wide angle. The angle can be adjusted

with the [z] key in four steps [Return]

Tail gun (rearshots) A cannon at the stern of the ship. [Return]

Afterburner Better use of fuel. Makes the propulsion of the ship more effective none

Boost Gives more push for a short time. Gets used up at the same time [J]

Tractor beam For fatal pulling or pushing of other players [T]

Autopilot Keeps the ship in its present position. Useful for beginners for refueling [H]

Extra shields Extra strong protective shields protect against contact with walls, hostile ships and their

weapons. Release with [G], activate with the space bar. As long as the shields are active, you cannot fire your

own weapons nor pick up any items. Nor do the extra shields help against a collision with a cannon or a

treasure chest [G]

Laser A beam of light of greater or lesser length. Can atomise or maim an opponent [-]

Laser reflector Reflects back the laser beams of other players to some extent. The probability of being hit by

someone is cut by half for each reflector [I]

Cloak Makes your own ship more or less invisible for other players. The exhaust gases, however, continue to

be visible. Flying through wormholes, bombardment and ECM can nevertheless make you visible, despite the

cloak, for a short time [Del]

Sensor Makes other invisible players more or less visible, i.e. is the opposite to cloaking none

Transporter beam For stealing items from other players [T]

Mines Explode when other players approach or by remote detonation. In mobile or stationary design. Mines

can be reprogrammed with ECM [Tab] [+]

Missiles Can be used in three types. Unguided missile, or torpedoes, simply fly in a straight line – until they

hit something. Heat-seeking missiles track active powerplants by the heat they give off - and their own too, so

be careful. Programmed or smart missiles track down the players whose name they have in their radar. With

ECM the smart missiles of other players can be reprogrammed. Invisible players cannot be traced [#] [‘] [=]

ECM (electronic counter measures) Act upon the on-board electronics of the opponent, blinding him as a

result, cause the loss of the ball, destroy part of his laser and reprogram mines, missiles and robots in the

immediate vicinity. The strength of their action depends on the distance. The maximum range is eleven blocks [[]

Deflector Sometimes fends off shots and other dangerous items from the ship. Less effective than protective

shields [O]

Hyperjump Displaces the ship at random to another point in the world. Gets completely used up at the same

time [Q]

Phaser Dematerialises your own ship, so that you become invulnerable and can fly right through other things.

On the other hand, you cannot pick up any items or fire weapons. The effect lasts up to four seconds [P]

058xpilotsbd.qxd 29.06.2001 16:50 Uhr Seite 60

Page 55: linux magazine uk 11

play using mouse or keyboard. In any case, youshould configure the keys at the beginning suchthat they match the original settings.

You should make use of three overriding keyboardfunctions:• Alternative client configuration, to which you can

switch in special situations with the [Esc] key. Forexample: in close fighting, to zoom closer to theevents

• Macro keys for weapons configuration. Forexample: I B3 Z1

• Talk macros for often-used phrases. For detailssee the file README.talkmacros, in thesubdirectory doc of the XPilot sources

Unfortunately these functions can only be assignedby editing the .xpilotrc in a text editor

Psychological weapons

Apart from control of the ship and the deploymentof the weapons, psychological strategy also plays arole. Which also brings us to the first ground rule: Ifyou ever fail, you are never personally to blame, butthe client, the network connection or theunbelievable luck of your opposing player. Here area few typical expressions, with which you can

indicate this: lucky, pure luck, never!, pathetic, stray,no way!, die!, hands off, damn, forget it, hey, doh,oh my.

It is almost superfluous to refer to the possibilityof communication with other players. The chat lineis simply part of a network game on the Internet forthis and is activated with the [M] (message) key. Thelanguage of XPilot players has a few peculiarities.So-called ”item-wussies” are players with a passionfor collecting items, ”suiciders” commit suicide outof cowardice and ”(base) sitters” are participantswho never attack. You can even talk to the server,which understands the commands /advance, /help,/kick, /lock, /password, /pause, /queue, /reset, /set,/team and /version. For example: m/help set. In thisway, you can configure the server without a restart;although for most operator commands, you doneed an ID, defined in the world map with thecommand /password.

Now, are you fed up with the world mapsnewbie-demo.xp and the factory-set default.xp?Then it’s time to get busy with the many XPilotworlds. An illustrated overview can be found at thehttp://www.undue.org/homepages/matt/xpilot/maps.html. There are three basic types of XPilot world:Duels, Racing and Ball Hunt. You should start withthe individual fighting as in the standard map, and

COVER FEATUREXPILOT

11 · 2001 LINUX MAGAZINE 61

Figure 3: Key configuration.

058xpilotsbd.qxd 29.06.2001 16:50 Uhr Seite 61

Page 56: linux magazine uk 11

then later you can try racing and finally learn thenoble art of the ball game.

By far the most popular XPilot world is BloodsMusic 2. Two teams of four players each try to stealthe ball of the opposing team and to place it in theirown garage. This is by no means simple, since theball weighs pretty heavily. Yes, indeed, in XPiloteverything obeys the laws of physics and is alsocalculated accordingly: gravity, mass, angle ofricochet, etc. If the theft succeeds, then there are awhole lot of points for the team and the samenumber of minus points for the opposing team,which is why they will try anything to protect theirown ball.

This includes the deployment of on-boardcannons, whose strike costs the opponent one oftheir four lives per round and brings them back totheir home base. But beware: Bloods Music 2 is theplayground of the XPilot gods and therefore onlyrecommended for experienced players.Fortunately, however, there are a whole lot of otherinteresting world maps, such as on the following:Tourmination, New Dark, Hell, Hi There, Teamball,The Caves, Pizza and Mad Cow Disease (see Figure4). The latter, due to its special originality, is mypersonal favourite, even if one has seen all the gagsafter a few rounds.

If you ever draw up a world map yourself, thentake into account the problems of non-local players,soft walls, against which one is not immediatelysmashed to pieces and a low image refresh rate of12 frames per second. The construction of worlds isbeyond the scope of this article but is certainlypossible, with a text editor and a bit of hard work.

XPilot client and server communicate with eachother on the basis of the UDP/IP protocol, which hasthe advantage over TCP/IP of error tolerance. If evera UDP packet does not arrive, then the Linux kerneldoes not attempt a re-transmission, because thetransmission takes a long time measured by humanreaction times, and in the meantime the player

would miss out on the rest of the events in thegame, which would by now be queueing up in theform of new UDP packets. With XPilot one soonlearns how fast human reaction time is - about20ms. In the local Ethernet (10 Mbit/s) the run timesfor data packets, at 2ms, are usually less than that,while on the Internet one often plays beyond the 20ms limit. Lag is the name for this delay in XPilotjargon. And if the lag is to blame for the fact thatone loses control over the ship in a crucial situation,then in the client chat line will quickly fill with vulgarexpressions that cannot be printed here.

Run times to the server can be measured withping, which states the run times in the time=column. Over 60ms means you have a severedisadvantage, and over 100ms means you areplaying more out of politeness or else training. So-called lag-training helps for the team cups whichtake place several times a year, at which teams fromvarious European countries compete against eachother for two days. Then, of course, one has tocontend with the delay to far distant servers.

wt@backstage:~> ping -c 5 wonder2.e.kth.sePING wonder2.e.kth.se (130.237.48.16): 56 daUta bytes64 bytes from 130.237.48.16: icmp_seq=0 ttl=U51 time=44.3ms

If you run into problems with XPilot, therec.games.computer.xpilot newsgroup is a helpfulplace to start. There you can ask questions. I haveforewarned people. The newsgroup is also the rightplace to start looking for addiction counseling. Forexample, you should try to break free from XPilot, ifafter the game you see red triangles before youreyes for long periods, potential feelings ofdizziness... XPilot sickness is the specialist term forthese kinds of complaints. An article called ”XPilot -how can I break free from it?” is already beingwritten. But until that appears, you can still play acouple of rounds. ■

COVER FEATURE XPILOT

62 LINUX MAGAZINE 11 · 2001

Figure 4: Extract from Mad

Cow Disease.

The author

Winfried Trümper developsbang-on concepts for the

further development of UNIX,such as sql4txt, docfs, shobj or

file-rc. Since he is unable tolive from this and from playing

Xpilot alone, he ekes out aliving by Perl programmingand system administration.

He can be contacted [email protected].

Info

http://www.xpilot.org/http://www.undue.org/homep

ages/matt/xpilot/maps.htmlhttp://bau2.uibk.ac.at/erwin/N

M/www/

Table 2: Modification of weaponsAction KeyImplosion Weapons implode and as a result draw all the surrounding players towards [i]them (possibly to their doom). Pressing again switches back to explosion modeAngle of scatter the firing angle can be selected in four stages (Z0-Z3). If your ship is [z]equipped with lots of fan cannons and if other players are already deriding you for being like the sun, then a smaller scatter angle will soon put a stop to this jeeringBig In four stages (B0-B3) the weapon is topped up with additional fuel, so that the [b]weapons become heavier, and because of this they fly more slowly and also suffer more damageVelocity Weapons and particles fly faster, but also disappear faster. Here again, four [v]stages from V0 to V3 are possibleFragmentation / cluster Very nasty modification, which not only causes mines and [c]missiles to produce pressure waves, but also to leave behind a hail of shrapnelNuclear Several mines or missiles are combined into one and this results, especially as [n]”full nuclear weapons” (FN), in extremely destructive weapons. Get out of the dust promptly, otherwise you will get hit by something, tooMultiplication Mines and missiles are shot off in smaller but multiple form. Can be [x]selected from single (X0) to quadruple (X4)

058xpilotsbd.qxd 29.06.2001 16:50 Uhr Seite 62

Page 57: linux magazine uk 11

COVER FEATUREJAGGED ALLIANCE 2

11 · 2001 LINUX MAGAZINE 63

The Canadian company Tribsoft has gone to thetrouble of converting the game to Linux, which hasin turn been brought to us by Titan, among others.The game itself is almost more complex than thestory of its development – but let’s start at the beginning.

Whenever there is a TV report about distantcountries, in which dictators are oppressing peopleby the thousand this all somehow seems very faraway. Anyway, there’s nothing you can do about it.

Jagged Alliance 2 deals with just such a country.An evil tyrant named Deidranna is keeping thesmall, poverty-stricken country of Arulco enslavedwith great harshness and in dire conditions, and sheis also squeezing the last drops from her tormentedsubjects, in order to spend the money thus obtained on the army and her terrorist state.

The former ruler, long believed dead, is in hidingabroad and commissions you, as an experiencedmercenary, to liberate the land from its ruler withhired troops. To do this, you receive precisely 40,000dollars start-up capital. This whole process is packedinto a very well-made and very long introductory film.

The game comes in a typical DVD plastic case,whose hard plastic holder does not exactlymollycoddle the CD, which is clamped in so hard asto be bomb-proof. It is only on closer inspectionthat you discover the second CD, which is necessaryfor installation, in a paper cover hidden behind the

manual. After starting the installation program, youare met with a simple shell script which has fourinstallation variants, requiring between 305 and850MB of space on the hard disk. And yet,considering the free-of-charge, easy-to-useinstallation tool, a somewhat more click-friendlyinstallation wouldn’t have hurt.

The instructions come in the form of a 50-page,illustrated booklet, which gives a comprehensiveintroduction to all aspects of the game. Especially usefulat the beginning is the short reference on the first threepages of the instructions, because there are quite a lotof functions and keys to memorise. The objective of thegame – liberation of the country piece by piece, gainingnew confederates, money and sources of raw materials– can only be achieved, even at the easiest level of thegame, with brains and hard work.

After the intro sequence, the extremelyhomespun graphics with a skimpy, unalterableresolution of 640x480, seems more than a littleunpleasant. But as we all know, strategy gamesoften are not primarily defined by their graphics. So,if you aren’t put of by this glitch, you will soon findout that JA2 is a game whose playing levels set newstandards for Linux software.

On the other hand it would be unfair to JaggedAlliance to force it into the strategy gamespigeonhole. Even if you would like to think that inthe end all computer games come down either tosomeone racing around somewhere and chasingsomething or some kind of resources being

This game looks set to

become a classic on

Linux computers. With

JA2, Sirtech has come

up with a hitherto

unknown but successful

mixture of action game

and strategy

simulation, which has

won the hearts of many

gamers, and not

without good reason;

its predecessor, Jagged

Alliance, was named

1995 strategy game of

the year.

Figure 1: The comprehensiveintro film describes thesituation at the start of thegame.

Here come the Linux games!

JAGGED ALLIANCE 2

FIONN BEHRENS

063ja2sbd.qxd 29.06.2001 16:52 Uhr Seite 63

Page 58: linux magazine uk 11

COVER FEATURE JAGGED ALLIANCE 2

64 LINUX MAGAZINE 11 · 2001

managed somewhere far above – Jagged Allianceoffers both and more, although with the emphasison strategy. In fact, this successful combination oflarge-scale strategy and direct contact with thedetailed handling of role-playing elements hasdefined its own, new genre.

The game primarily runs on four levels:• The first of these is the laptop. This links the

player with a virtual Internet, in which you can dosuch things as obtain information, buy arms, hiremercenaries and send emails. For the mediumterm, an indispensable aid.

• Then there is a sort of complete overview, in whichyou can determine the composition of the groupsof mercenaries, map out routes and switch to allother overviews. But the map in this overview hasan over-ground and also three underground levels,all of which you have to keep an eye on.

• Thirdly, a sort of action mode, in which whenthere is contact with the enemy you have to sendyour fighters one after the other to face theopponent in best role-playing tradition. Eachmercenary also has, as in a role-playing game,quite specific characteristics and strengths, thetype and quality of which jointly determine theoutcome of each round of fighting. This is amode where good tactics are especially necessaryotherwise you will soon lose a few valuablecomrades.

• At the fourth level there are the steadilyinterspersed inter-sequences, which move the

action forward each time minor stages and gameobjectives are achieved and thus support andsteer the player in their task.

Many additional elements enlarge the variationoptions almost to infinity – so you can constructyour own implements from individual componentsand combine these in turn with up to four others.Ingredients such as chewing gum, steel piping,super glue and the like are used here. So noproblem adorning your own favourite cannon witha bit of DIY with laser pointers, tripod, aimingtelescope and range extenders – McGyver says hi.

Of course, at the beginning, due to the lowamount of start-up capital, there is no change ofhiring an army of top class fighters. What you haveto do, given the resources, is to buy and to plantactics carefully and circumspectly. The first contactswill occur shortly with the scattered rebels,supporting them in the first instance with adviceand deeds, and soon with people, too. Later thecitizens of Arulco will also be joining up and trainingas militiamen and allowing their mines to beexploited for the good cause, so that then at lastthe much-needed money comes into the treasury.

Each individual mercenary and militiaman hasan individual set of equipment, with which,depending on his special abilities he can repair otherpeople’s armour, open locks, heal the casualties orbuild things - and much more besides. This issomewhere that the patient player can open upendless prospects for optimisation. Even the good

Figure 2: The ”SirOS” Laptop:Whether email, Web or

finances - this helps.

Figure 3: There’s a niceloading image for all key

scenarios.

URLs

Sirtechhttp://www.sirtech.com/

Tribsofthttp://www.tribsoft.com/store.

htmlTitan http://www.titan-

computer.com

Evaluation:Long-term playing fun: 90%

Graphics: 35%Sound: 80%

Control: 85%Multiplayer: 0%

Originality 90%Complexity: 95%

Overall rating: 80%

063ja2sbd.qxd 29.06.2001 16:52 Uhr Seite 64

Page 59: linux magazine uk 11

COVER FEATUREJAGGED ALLIANCE 2

11 · 2001 LINUX MAGAZINE 65

organisation of a simple contact with the enemywith some well thought-out series of moves andwell-distributed people can easily take half an hour.Thankfully the game has a function up its sleeve, forimpatient colleagues who prefer to concentrate onglobal events, to dice automatically for entireenemy encounters.

The sound is well done and finely adjusted tothe events – noises always come from where theyare created, the background music is unobtrusivebut not boring, although now and then it doesstutter a bit. But to compensate, JA2 alsosupports ESD of its own accord. This means thatany system sounds or your own favourite musiccan be listened to alongside the game on any oldsound card.

In this game, we sorely missed the option ofmulti-player scenarios. It is precisely in the domainof strategy games with non–linear time sequencesthat others have shown that such a thing is easilypossible and can also be highly entertaining. Thefact that this option is missing is something thatmust be chalked up as a big minus point.

A game of this kind of complexity does ofcourse also require a high-class interface foroperation. This is where SirTech, with its successfuldivision of the meagre space, has done wonders.Details such as a directory of inventory by mapsectors and sensibly arranged tables with colourhighlighting of entries which are strategicallyimportant or relevant to decision-making turn thegame into a pleasure. What is urgently needed,though, is a keyboard pattern, because youcurrently have to remember more keys than with aflight simulator for fluid play.

Lastly, the successful integration of the variousgame levels give Jagged Alliance 2 that certainsomething. You can change completely naturallyfrom the tactical overview to the action mode,never getting the feeling of overlooking somethingor losing perspective. Whenever things get tight,you can stop the game time and decide at leisurewhatever needs deciding. And the fact that thefight actions are term-based also means that youdon’t have to worry that your opponent might drillyou a new hole in your hat while you’re ponderingthe next step.

Conclusion

This game could keep you occupied for a month.Although from a technical point of view the gamesometimes seems outdated and the paltry resolutioncannot be described as anything but anachronisticTribsoft, by converting it to Linux, – if you overlookthe Spartan installation and a few memory leaks, thecorrection of which is already in progress – has comeup with a solid and tidy product. No obvious bugs orcrashes occurred during our test.

From the point of view of game playing, thisspecial class of mercenary simulation, which hasalready been awarded prizes many times and all overthe world, is a real cracker, which defines its ownparticular style – a definite buy for strategy fans.

A list of reference sources for this game andLinux-specific discussion forums can be found onthe Tribsoft website. And by the way, the porting ofthe Unfinished Business game expansion onto Linuxhas already been announced for the near future.We can hardly wait. ■

Figure 4: Strategic andpersonal decisions takeplace in the globaloverview and on thevirtual laptop.

Figure 5: The action mode -right in the thick of it,whether a rebel pub orDeidranna’s humanexperimentation clinic.

063ja2sbd.qxd 29.06.2001 16:52 Uhr Seite 65

Page 60: linux magazine uk 11

So far we have always been familiar with images asa screen full of pixels. Most of the slightly moreambitious image processing programs on the otherhand offer another method for flexible handling ofvarious image elements - layers. Imagine layers astransparent sheets of film. An image consists ofseveral films which are laid one on top of the otherin a pile. The films have transparent areas throughwhich the underlying films become visible.

Let’s take a look at a simple example of how towork with layers. Start Gimp and open a newimage. Use <Image>/Dialogs/Layers, Channels andpaths... or [Ctrl+L] to open the central control pointfor working with layers (See Figure 1).

The main part of the dialog is the white area inthe middle. Here you can see the individual layerslisted line by line. The eye at the beginning of theline shows whether the layer is visible at the moment(with a click on this you can make a layer invisible),the cross indicates coupled layers, which can only bemoved together. Then follows a small preview,

which is sufficient for a rough orientation, and finallythe name of the layer. It is worthwhile, especiallywhen there are lots of layers, to select meaningfulnames – with a double-click on the name, a smalldialog opens in which you can change the name.

The current layer is marked in blue. All paintingoperations and every plugin command works onthis layer. With a single click on the preview or thename of the layer you can change to another layerwith which you’d like to work.

At the lower end of the dialog you will see sixbuttons, with which you can execute basic layeroperations. With the first button you create a newlayer, the second and third buttons move the layerup or down, the fourth creates a copy of the currentlayer, the fifth anchors a floating selection, andthe sixth deletes a layer. Other important operationscan be found by clicking with the right mousebutton on the layer names.

A hard shadow

Sometimes you want to make an image or agraphical element stand out a bit from thebackground. A standard procedure for this is to laya hard shadow behind the element. And now youcan learn how to do this; this is a good way to startlearning how to work with layers. Create a newimage, for example 500x500 in size.

Open the layers dialog and click on the bottomleft button, to create a new layer. In the dialog thatappears, select a transparent background, name itanything you like and accept the default size. Aftera click on OK the second layer in the layers dialogappears. Transparency in Gimp is symbolised by agrey chessboard pattern. Since the layer is empty,nothing changes in the image window.

Paint in this layer as you like with the paintingtools. Make sure a few areas remain transparent, sothat later the effect can be seen (Figure 2). Duplicatethe layers by clicking on the fourth button (the onewith the two sheets of paper). Now make the upperlayer invisible by clicking on the eye symbol and

SOFTWARE WORKSHOP GIMP

66 LINUX MAGAZINE 11 · 2001

Image processing with Gimp: Part 3

LAYER BYLAYER

SIMON BUDIG

This time we’ll be

dealing with layers.

Layers are the method

of choice when it

comes to organising

and arranging image

data easily.

Figure 1: The dialog for layers,channels and paths

066gimpNewsbd.qxd 29.06.2001 20:17 Uhr Seite 66

Page 61: linux magazine uk 11

activate the middle layer with a click on the name.Then activate the Keep transp. button in the upperarea of the layers dialog. This will protect thetransparency of the layer. Similarly to the first part ofour workshop, you can now paint around the imagein black and the form of the motif is retained.

To create the hard shadow, we now completelyfill the motif with black. The fastest way to do this isto use drag & drop. Click in the colour fields of thetoolbox on the small black-white symbol, in order toreset the colours, then press (and hold down) themouse button in the black colour field and drag thecolour into the image window (Fig. 3). Since thetransparency of the layer is currently protected, thecontours of the motif are retained.

Now activate the Move tool (the one with thecompass rose as symbol), click in the black area ofthe layer and drag the layer a few pixels down andto the right. If you now make the uppermost layerin the layers dialog visible again, you will see ashadow-like effect (Figure 4).

But since it is in the nature of shadows that theyare rarely so sharp-edged, we shall now dot the i:Make sure the middle layer is activated and turn off thetransparency protection. Then select <Image>/Filter/Blur/Gaussian blur (IIR)... and a radius of 10. Now theshadow gets a soft edge that fades out (Figure 5).

Since we have spread our image over threedifferent layers, it is possible to move the shadowlater to change the direction of illumination. Youcan make it even softer by reducing the coveringpower of the shadow layer. To do this, use the slideruler in the upper part of the layer dialog.

Lighting effects

It is possible to achieve lighting effects in exactly thesame way (preferably against a dark background). InFigure 6 you can see a spiral, which we have madeglow with the above technique.

Duplicate the layer with the spiral three times.Activate Keep transparency in each of the middlethree layers and fill in the second layer with white, themiddle one with a luminescent turquoise (#00ffff) andthe fourth layer with a luminescent green (#00ff00).Now deactivate the transparency protection again.

With the very useful Gaussian Blur plugin, youcan make the middle three layers go out of focus.For example, try the radii 5 for the white, 10 for theturquoise and 20 for the green spiral. As a result weget a pale bluish luminescent spiral.

To strengthen the green luminescence a bit now,activate the layer with the green spiral. With <Image>/Image/Color/Curves... activate the curve tool whichwill be familiar from the last part. From the top listhere, select the Alpha channel and drag the middleof the curve upwards slightly. This makes the semi-transparent area of the layer a bit stronger, and theluminescence becomes more visible (Figure 7).

Contrary to the hard shadow from above, here wehave done without displacing the layers with the glow

effect. Obviously this is easy to do. But a small problemarises here, in that the three layers with the differentluminous colours should not really be displaced withrespect to each other. So as not to have to move eachlayer individually by exactly this same distance, you canclick on the area between the eye and the preview andmake a cross visible. This cross means that this layerwill also be moved in all actions with the Move tool.

To move all the layers with the luminous effectin parallel, activate this cross on all the affectedlayers. Activate one of these layers and move all theaffected layers together. A little tip: The Move toolalways moves the layer with a picture elementunder the mouse pointer. In case of doubt, this isthe background layer. If you do not want this, holddown the [Shift] key and the activated layer willalways be moved.

Masked

To further confuse matters, apart from the two optionsaddressed in the keyword Transparency of definingtransparency, there is also a third – the layer mask.

SOFTWAREWORKSHOP GIMP

11 · 2001 LINUX MAGAZINE 67

Floating selection: we came across this in the first part, in a general way, statingonly that a floating selection can be moved back and forth without destroyingthe underlying image data. Here you can now see what’s really going on behindit. A temporary layer is being made. This is treated separately and merged backinto the image as soon as the floating selection is anchored. With the layersdialog you can also create a real layer.Transparency: If an image consists of several layers, all (except perhaps thelowest) automatically have an alpha channel, meaning that each pixel has, inaddition to the Red/Green/Blue colour information, an additional value,representing the covering power (from 0 to 255). Also, each layer has a globalcovering power, which affects all pixels of this layer and defines the maximumcovering power. It is defined using the sliding ruler in the layers dialog.

Figure 2: A layer in front of a solid background

066gimpNewsbd.qxd 29.06.2001 20:17 Uhr Seite 67

Page 62: linux magazine uk 11

The layer mask is a separate greyscale image,which can be used in addition to the normal alphachannel to make certain areas of the layertransparent. A layer mask is created with Add layermask in the context menu in the layers dialog. Nowyou will see a second preview image, and with themouse one can, by clicking on the respectivepreview image, select whether to paint in the layeror the layer mask.

Using the tiger image from last month. We nowwant to release the tiger, so that he can more easilybe transplanted into a different environment. Loadthe image into Gimp and give it an alpha channel,via <Image>/Layers/Add Alpha Channel. Now youcan paste a layer mask onto the image in the layersdialog via the context menu. Right click on theimage in the layers list and choose the Apply LayersMask. In the dialog which appears, select White (fullcovering power). If you now paint in the image withblack as foreground colour and any painting tool,the image becomes transparent at the

corresponding places. making sure that the blackbackground is noe invisible with no eye symbolagainst the layer

What’s interesting about this is that the originalimage data are not altered by this. If you paint withwhite as foreground colour in the layer mask, theoriginal image reappears. So you can snip away,without destroying the image, until the desiredcontour can be seen, and in Figure 8 you can see thefirst steps. Incidentally, it is advisable to appraise thecontour against both a black and a white background.Perfectionists will also view it in front of other colours.

If one now has several image elements releasedin this way, these can be combined any way you likeand you can also create abstruse images. Flying fishin the middle of a primeval jungle are no longer aproblem. At this point, drag and drop within Gimpalso comes in handy. By dragging the layers out ofthe layers dialog into different image windows, onecan copy them simply into other images.

Transparent GIFs

At this point we must address a very frequentlyasked question: How does one use Gimp to createGIFs, which are transparent at certain places? Lotsof people come to grief at the point at which theywant to define the transparency colour.

The answer is simple: you don’t even need todefine a transparency colour – Gimp does it for you.If a certain area of an image is to be transparent,give the image an alpha channel and etch someholes, for example, in the image. If the image isthen saved as a GIF, Gimp will ensure that onecolour is reserved for the transparency.

Bear in mind that in this process, information islost. Gimp can save several degrees of transparencyin its own format, while the GIF format can onlyhandle completely covering or completelytransparent pixels. If you have painted your imagewith nice soft contours, these will be lost when youexport it in the GIF format (see Figure 9). Here, insome circumstances, help can be provided by the

SOFTWARE WORKSHOP GIMP

68 LINUX MAGAZINE 11 · 2001

The authorSimon Budig would like

readers to approach him withtopic requests – otherwise this

series will soon peter out...

Figure 3: Fill the layer using drag’n’drop

Figure 4: A sharp hard shadow looks more artificial...

Figure 5: ...than a soft-focus shadow

Figure 6: X Files here we come...

066gimpNewsbd.qxd 29.06.2001 20:17 Uhr Seite 68

Page 63: linux magazine uk 11

plug-in Semi-Flatten (<Image>/Filter/Colours/Semi-Flatten) to some extent: This plug-in ensures that allsemi-transparent pixels (thus those which the GIFformat would ruin) are made non-transparent, bycounting them against the background colour. Ifone has selected a colour here which matches the”average” colour of the web page background, thiseffect can be considerably weakened.

In Figure 9 the three different variants can beseen. At top left there is a brushstroke with cleananti-aliasing. In the middle this stroke has simply notbeen converted into the GIF-type indexed format ofGimp (colour chart with maximum of 256 colours).The clean edge has given way to steps. On the rightbelow the brushstroke has been prepared, with theSemi-Flatten plug-in, for a web page with a scarletbackground. Of course one should now only showthe image against a red background - otherwise itlooks very ugly. But against a red background onecan enjoy impeccable anti-aliasing.

Future prospects

In the next part we will make a foray into the Gimpmenus. We will look at a few gems among theplugins and see how these can be combined tomake a few nice effects. ■

SOFTWAREWORKSHOP GIMP

11 · 2001 LINUX MAGAZINE 69

Figure 9: Problems with the alpha channel in GIFs

Alpha channel: refers to that part of a layer which contains information on transparency. Thealpha channel can be manipulated deliberately (with the curve tool) or protected (Retaintransparency in the layers dialog).Release: is the name for the technique of separating a motif from the background. In our case thetiger is separated from the landscape. The main motif can then later be inserted into other images.GIF: is a file format which is very widely used on the WWW. Images saved in the GIF format candefine one (of the maximum 256) colours as ”transparent”. This means a pixel can be eithertransparent – or again, not. Gimp’s model of transparency goes further: A pixel can have one of 256levels of transparency. Since the GIF format unfortunately has a few licensing problems (LZWcompression), you should avoid it as far as possible in your own web projects and instead use PNG orsimilar. Unfortunately support for PNG is not yet available in every web browser.

Figure 7: With the curve dialog, you can increase the glow

Figure 8: With the layer mask it is easy to release image elements

066gimpNewsbd.qxd 29.06.2001 20:17 Uhr Seite 69

Page 64: linux magazine uk 11

Graphics and images can be displayed by acomputer in two ways. Firstly an image can bebroken down into lots of little dots, called pixels inthe same way as your monitor and printer composean image. Unfortunately, enlarging these halftoneor bitmap images leads to fairly clumsy andunattractive block structures.

With the other option, which is certainly verypopular in the field of technical drawing, the imagesare composed from individual geometric elementssuch as lines or circles. Apart from the advantagethat these vector graphics take up relatively littlespace on the hard disk – you need only store theposition and size of the individual element – thesegraphics can also be enlarged by as many factors asyou like. The disadvantage of such images lies intheir often fairly complex structure: photos eithercannot be shown at all, or with difficulty.

One and only

In KOffice there is only one painting programspecialising in vector graphics, and that isKIllustrator. A counterpart responsible for halftonegraphics is being developed by the Koffice team andshould also find its way into the free Office packagesoon. Since it may be some time before thathappens, this part of our five-part Workshop will be

devoted totally to KIllustrator. Apart from thespreadsheet, Kspread, this is one of the mostmature and stable components of the entire OfficeSuite. The online help is equally satisfactory.Nevertheless you should still bear in mind thatKIllustrator, like all the applications collected intothe Office package, is still at the development stage.You should therefore not entrust any importantdata to this painting program. It is still worthwhilegetting to know the application a bit better, since,especially under Linux, this type of vector paintingprogram is rare.

The interface

In order to be able to join in with the followingsmiley example, you should start KIllustrator via theKDE Start menu under Office programs/KIllustratoror the Koffice desktop (cf. also the first part of thisWorkshop). Close the window that appears afterthe start with a click on OK, which will thenautomatically create a new, empty page.

Unlike its other Office colleagues, the interfaceis sparing with the overloaded toolbars and on thewhole looks very tidy. The use of KIllustrator is verymuch oriented towards its commercial, largearchetypes, such as Corel Draw. Anyone who hasalready worked with this type of program will soonfeel at home with KIllustrator.

In the centre of the window, you will see thework area. The big white rectangle representsprecisely one printable page. All objects that we aregoing to create next must always be on this page –any objects outside it are neither displayed norprinted by KIllustrator. In order to modify the page

KNOW HOW KOFFICE WORKSHOP

70 LINUX MAGAZINE 11 · 2001

Koffice Workshop Part 4

EXERCISESWITH K

TIM SCHÜRMANN

In the last three parts of our Koffice Workshop, only

relatively dry figures and texts have played the leading

role. This time we will do something a bit more creative

and with the aid of the vector painting program

KIllustrator, conjure up a happy smiley face.

Workshop summary 1. Word processing with KWord – Part 1: A business letter2. Word processing with KWord – Part 2: A newspaper3. Tables and diagrams with KSpread and KChart4. Graphics and images with KIllustrator5. Presentations with KPresenter

070killstratorsbd.qxd 29.06.2001 16:56 Uhr Seite 70

Page 65: linux magazine uk 11

settings, select from the menu Layout/Page. There,apart from the page size, you can also modify itsorientation and/or set the size of any margins.

But back to the interface: On the upper margin,immediately beneath the menu bar, you will find asymbol bar which offers rapid access to the file andclipboard functions. With the size list, which isroughly in the centre of the symbol bar, the view ofthe displayed page can be enlarged or reduced. Onthe left side of the KIllustrator window there isanother tool bar, which allows rapid selection of thevarious painting and drawing tools. Alternatively,you will also find all the tools listed here in themenu under Tools. These are incidentally arrangedhere in the same order as their symbol icons.

The last object bar to be mentioned is the colourpalette positioned on the right edge of the screen.With its help, the colours of the individual graphicselements can be changed quickly and easily.

Feint lines and the grid

Our smiley face initially consists of a yellow circlewith a black rim. Before we start the drawingprocess, you should first make sure that the grid isactivated. This aid provided by KIllustrator works ina similar way to the little squares on graph paper. Itis meant to help the user in the optimal andmillimetre-accurate alignment of all graphicalobjects. To this end it can not only be made visible,but also be set up such that its gridlines suck in allgraphical objects. To activate the grid, select fromthe menu Layout/Grid....

Mark the two empty boxes there and then clickOK. The blue grid squares should now be shown onthe white paper area.

For our face, select the ellipse tool from thetoolbar or the menu (Tools/Ellipse). Bring the mousecursor in the left upper third of the paper to a gridjunction, then hold down the mouse button anddraw a circle. When you do so, watch how the circleis drawn in and held by the respective gridlines.

Once you have drawn a circle roughly, like theone shown in Figure 3, release the mouse buttonand activate the mouse tool (the arrow or viaTools/mouse). The circle should now have beenselected automatically, which is shown by the littlebox around it. As soon as you move the mouse overa box like this your mouse cursor changes its form.Now hold down the left mouse button, and byslowly moving the pointer, you can change the sizeof the circle. Click just once briefly on one of thesepoints, though, and KIllustrator switches over into asecond editing mode, recognisable by the nowaltered marking symbols. Like the change in size justdescribed, the object can be rotated about its ownaxis in this mode. Bear in mind that rotation canonly be done with the four arrows at the vertices. Aclick on one of the other arrows would twist theobject. Since rotating a circle makes relatively littlesense, you should try this function out some time

on a rectangle. This can be created via thecorresponding symbol from the symbol bar inexactly the same way as a circle. The centre – aboutwhich the object rotates – is incidentally defined bythe small circle in the centre of the figure. In orderto modify this point, place the mouse on the smallcircle in such a way that the pointer turns into adouble arrow. Now hold down the left mousebutton and move the point to its new position. Toget back to the old mode, simply double-click onone of the edge markings. If you ever go completelywrong with the drawing, this is how you canremove the marked object via Edit/Delete from thepicture again.

To deselect an object, simply click, with themouse tool activated, on an empty area on yourpage. Or else you can select an existing object

KNOW HOWKOFFICE WORKSHOP

11 · 2001 LINUX MAGAZINE 71

Figure 1: The KIllustrator screen

Figure 2:Setting up the grid

Figure 3:The finished circle

070killstratorsbd.qxd 29.06.2001 16:57 Uhr Seite 71

Page 66: linux magazine uk 11

again, by clicking on it with the left mouse button.What counts is that when you do so, you hit therespective precisely, which gets a bit fiddly,especially with small objects or those with a thinedge. Incidentally, you must do a very similar thing ifyou want to move the object: Move the mousecursor to the corresponding candidate, hold downthe left mouse button and then move the completeobject to its new position.

Colour

The smiley face is now to get a yellow coat of paint. Todo this, simply click, with the circle selected, with theleft mouse button on the yellow colour fill in thecolour palette on the left edge of the window. A clickwith the right mouse button would mean that insteadof the fill colour, you would be changing the colour ofits border. But for the sake of our example, leave thelatter black. It could be a bit wider. To modify this,either click on the filled circle with the right mousebutton and select Properties, from the context menu,or with the circle selected pick Edit/Properties. In anycase, a window should now open with which you canalter a few attributes of the circle.

To make the outline look thicker, enter 4mm aswidth in the Outline tab. Here incidentally you alsohave the option of modifying the type of line, so for

example the smiley face could be made to lookfrayed. After a click on OK the circle should nowhave a thick, black outline. Now all the face islacking is the eyes, nose and mouth.

The eyes have it

First the eyes. We shall make these out of twosmallish, black-filled circles. When you do this,proceed exactly as for the face, by first selecting thecircle tool, then painting a small circle at eye level andfilling this in with a click on the colour black in thecolour palette. You could now draw a second eye inthe same way – but so that we get a second eye thatlooks exactly the same, the first eye should then becopied. To do this, mark the black circle just drawn,select from the menu Edit/Copy and thenEdit/Duplicate. Apparently, nothing has happened inyour drawing. But click on the first eye with themouse tool and move it to the position of the secondeye, so you can see that KIllustrator inserts the copyat exactly the place at which the original is located.

That completes the two eyes, so now we can goon to the nose. Before we create this with a line,you should first turn off the grid again. To do this,call up the corresponding window via Layout/Gridand unmark the two small boxes. After a click onOK the grid should disappear from the background.

Instead of the grid, a feint line should be usedto create the nose. A feint line works like a line inthe grid, except that the user can now define theposition of each individual feint line himself.KIllustrator enables you to create vertical andhorizontal feint lines in two ways: Firstly, you cancreate a feint line rapidly using the mouse. For ourexample, place the mouse cursor on the left, verticalruler, hold down the left mouse button and drawthe feint line on your page. Move the mouse to thecentre of the incomplete face. If you are not surewhether the feint line is in the right place, do not letgo of the left mouse button. It is very fiddly to makeany modification later via a corresponding window.If the feint line is roughly in the centre between thetwo eyes, release the mouse button. Similarly, youcan also make horizontal feint lines via the top ruler.Another, considerably more accurate, option forcreating feint lines can be obtained by selectingLayout/helplines. Here you can create feint linesdirectly by entering their position values. In additionto this, this dialog serves to delete and change thepositions of individual lines.

Back to our face: Using Layout/Align to Helplines,switch on the pulling power of the feint lines. Thiswill make it much simpler to position a straight noseprecisely. For the drawing procedure, activate the linetool (fourth symbol from top in the toolbar or underTools/Line). Position the mouse cursor roughlybeneath the eyes and click once with the left mousebutton. Move downwards along the feint line, until asimple nose is drawn. Then quickly and briefly pressthe right mouse button. This has the effect that the

KNOW HOW KOFFICE WORKSHOP

72 LINUX MAGAZINE 11 · 2001

Figure 4:Our circle is given a

broader outline

Figure 5:The second eye is

created by copyingand inserting

070killstratorsbd.qxd 29.06.2001 16:57 Uhr Seite 72

Page 67: linux magazine uk 11

drawing process is regarded as complete.If you would like to draw the line further in

order to give the face a hooked nose for instance,press the left mouse button. You will now getanother line, whose beginning lies exactly at theend of the first line. Please bear in mind that the linethus produced with a kink represents anindependent object and not two separate linesproduced by KIllustrator.

Kiss me

Now all that’s missing is the mouth. This should be asemi-circle, which is why it will now be created withthe aid of the Bezier curve tool. To do this, selectthis tool from the toolbar (fifth symbol from top orfrom the menu Tool/Bezier). Working with this toolturns out to be somewhat more complicated thanwith the simpler tools previously introduced, hencethese step-by-step instructions: With the Bezier toolselected, move to the point on the face at which theleft corner of the mouth should begin. Click oncewith the left mouse button. You will get a feint line,with which you can define the degree of curvature.Bring this feint line with the mouse into a positionwhere the mouse cursor is at bottom right (seeFigure 7).

Click again with the left mouse button and thenposition the mouse cursor on the vertical,continuous feint line, roughly where the mouth is tohave its lowest point. Click again with the leftmouse button and bring the feint line that appearsas horizontally as possible. After one click with theleft mouse button, move the pointer to the placewhere the right upper corner of the mouth shouldappear. Click one last time with the left mousebutton and adapt the feint line, which againappears so that it produces a smiling mouth.

To complete the drawing, press the right mousebutton. If your mouth does not look all that great,you can re-edit it, as incidentally you can with anyother geometric objects, with the point tool (secondsymbol from top in the toolbar or from theTools/Point menu). To do this you must first selectthe object with the mouse tool. If you now turn onthe point tool, all the changeable node points willbe displayed and can be moved with the mouse toany other position. There is even a new toolbaropened under the toolbar, with which you can addadditional node points or again, remove them fromthe object. You should experiment a bit with thesenode functions on our mouth, until the smileydisplays an almost perfect smile.

Layers

One important functional characteristic ofKIllustrator has so far not been mentioned – thelayers (referred to as levels in the online help). Eachgraphical object (the individual eyes, the nose andthe mouth in our example) is located on a separate

layer. You could imagine this as a sort of transparentfilm, with precisely one geometric element to befound on each sheet of film. In our smiley examplethe left eye is on one layer which lies over the bigyellow circle, but under the layer on which the righteye is located.

In order to become a bit more familiar with this

KNOW HOWKOFFICE WORKSHOP

11 · 2001 LINUX MAGAZINE 73

Figure 6:The nose was createdby a line. In thebackground thevertical feint line canbe made out.

Figure 7:The left corner of themouth is createdwith the aid of theBezier curve tool

Figure 8: The smiley face isfinished

070killstratorsbd.qxd 29.06.2001 16:57 Uhr Seite 73

Page 68: linux magazine uk 11

concept of layers, you should selected the bigyellow circle with the mouse tool. Now selectArrange/To front. This means you are placing thelayer on which this circle lies in the foreground.Then select Arrange/Back one, until the circle isback in its original position.

With the corresponding entries from the menuArrange or via the context menu of the right mousebutton (mark the object with the mouse tool, thenpress the right mouse button) you can bring thelayers of the corresponding object into thesequence you desire.

Grouping

When you are making rather more complexdrawings in KIllustrator, it can often happen thatyou displace an element without meaning to.Another problem crops up if you want to modifyseveral elements, which are part of a larger object,at the same time but relative to each other. For asolution to these problems Killustrator offersgrouping of the elements concerned. This is doneby combining several individual objects into a singlelarge object. To combine the elements of our smileyface into such a group, all the objects must first bemarked. You do this by drawing a frame with themouse tool around all the elements involved. Place

the mouse cursor at top left on the blank paper.Now hold down the left mouse button and draw aframe that surrounds all the elements of the facecompletely. As soon as you release the mousebutton again, all the elements of the smiley shouldhave been selected. To create the group, now selectArrange/Group from the menu. Check thatKIllustrator has performed the grouping correctly, bymoving the face around the paper as a test. If thegrouping procedure was successful, all the elementsforming part of the face should move at the sametime. Henceforth this group of objects alwayscounts as a graphical element.

If you want to cancel this grouping later on, allyou need to do is select the group concerned withthe mouse tool and then select Arrange/Ungroup.

Text

Before coming to the end of this Workshopinstallment, another interesting affect should bementioned, which plays an important role inconnection with the editing of text. First, cancel thegrouping of the face, as described above. The nextthing we will do is align Smiley with the mouth. Todo this, first activate the text tool (Tools/Text orsecond symbol from the bottom in the toolbar),click roughly above the mouth and then type theword Smiley. When you have finished, activate themouse tool again and click on the text with theright mouse button. From the context menu whichappears, select Properties and on the Font list of thenewly opened window, a larger font. After a clickon OK, select Arrange/Text Along Path. The mousecursor should now have changed into a thick, blackarrow. Click with the point of this arrow on themouth. KIllustrator should then align Smiley alongthe mouth. At this point it should be mentionedthat on our test system the application of thisfunction led to a crash of the complete application.This unfortunately shows that KIllustrator is still in development.

Equally interesting is the overlay function. Inorder to get a better look at the result of thisfunction, open a new blank drawing page. On thispage, draw both a rectangle and a circle. The twoobjects should not intersect, and the circle shouldbe placed on the right beneath the rectangle. Nowactivate the mouse tool and draw up a markingframe, completely enclosing both objects. SelectExtra/Blend and leave the value set by KIllustrator.After clicking on OK Killustrator tries to overlay thetwo shapes. New geometric forms are createdwhich carry the first outline into that of the otherobject (see Figure 10).

This little affect ends the fourth part of our five-part Workshop on KOffice. In the last part you willget another chance to apply the vector paintingprogram skills you have acquired in this installment.This will involve the presentation programKpresenter. ■

KNOW HOW KOFFICE WORKSHOP

74 LINUX MAGAZINE 11 · 2001

Figure 9:The yellow circle hasbeen moved forward

by one layer

Figure 10:Example of overlay

Info

Koffice Homepage:http://koffice.kde.org

Homepage of the KDE Project:http://www.kde.org

070killstratorsbd.qxd 29.06.2001 16:57 Uhr Seite 74

Page 69: linux magazine uk 11

Ever since a well-known Swedish furniture store wasassociated with the work of the artist Carl Larsson,his home town of Falun became world famous. Yetthe town of Falun has an interesting industrialhistory of its own. It is the home of the world’s oldestlimited company, Stora Kopparberg AB.

Stora Kopparberg is a copper mining company.Copper has been mined in the area for over 600years. The copper from Falun has typically beenused as a wood preservative and it is this copperthat gives Scandinavian wooden houses theirdistinctive colour. The copper mines of the MiddleAges were open cast but over the centuriesmineshafts were dug and now the area is riddledwith a mixture of active and disused copper mines.

Today’s environmental requirements are muchstricter than in the past when old mineshafts couldbe used for dumping chemical and other types of

waste. The result was that by the year 2000 thetown’s waste water, as well as the industrial waste,contained a significant cocktail of heavy metalsand other contaminants. Sweden’s laws dictatethat all the local authority’s actions are open to thepublic and so the performance of the watertreatment works is automatically published on theInternet every hour. Heavy metals are difficult tohandle at any time but with the realisation thatany mishap is public information within the hour,Falun Kommun authority didn’t want to take anychances. They chose the stability and trustedprocess control of Linux.

Falun Kommun opted for the proven ABACUS4for their process control software. ABACUS4 is thelatest version of the ABACUS process controlsoftware originally developed at the end of the1960s. The first industrial installation of ABACUS

CASE STUDYFALUN

11 · 2001 LINUX MAGAZINE 75

Keeping it clean...

WATER TREATMENT

CLIVE DE SALIS AND ESSIE ANDERSSON

The Linux operating

system is now being

successfully used in

industrial process plant

control. In Sweden,

Linux’s capabilities as

both a highly stable

operating system and

reliable ISP software

prove ideal to meet an

unusual requirement.

075Abacussbd.qxd 29.06.2001 17:00 Uhr Seite 75

Page 70: linux magazine uk 11

was commissioned in 1971 and used Data Generalhardware which had ferrite cores for memoryblocks. Each ferrite ring had the capacity of 1 bitand a large, heavy group of them were put togetherto make a memory block which added a massive 1Kmemory. In addition to memory faults we knowabout these days, corrosion of the ferrite rings wasan extra consideration. The last ferrite core basedABACUS control system still running was finallyreplaced in 1998 on a paper mill in the UK havingrunning without fault for 27 years. During the1970s the software was further developed andported to DEC PDP 11 series hardware running onthe RSX operating system on which it was renamedABACUS II. In this form the system became widelyused in boiler houses, paper plants, the steelindustry, chemical and pharmaceutical productionas well as other applications. At the beginning of1990 the software was again ported – this time toDEC’s VAX range of computers from where it wenton to be available on the famous DEC MicroVAXrange of computers. In 1997 the ABACUS processcontrol software was ported over to PC hardwarerunning on the Slackware distribution of Linux on

which it has continued to run for all industrialapplications. Based upon Linux, it is now known asABACUS4. It has been successfully run on the RedHat distribution in the laboratory but in industry it iscurrently run on Slackware 7. Details of theABACUS4 software can be found onwww.abacus4.com

The waste water treatment process FalunKommun chose was a High Density Sludge (HDS)process instead of the old-fashioned method of justneutralising the acid mine drainage water byaddition of lime. The HDS-process can be designedin different ways, but the main point is that yourecycle the sludge in the process, which results ingetting a very dense and easily dewatered sludge.This product is later dried on the site beforedisposal, thereby minimising the volume of sludgeto be disposed of.

In the two first steps in the HDS process in Falunthe acid mine drainage water is mixed in rapidmixing tanks with sludge to adjust the pH to pH 4.3in tank one and then again to around pH 6.0 in tanktwo. The second, third and fourth tanks are allaerated by membrane aerators. In the third tanklime is added take the pH to pH 8.3. The fourth tankhas been installed in order to ensure stable products(sludge and water) out of the process. The changein pH between tank three and tank four should beminimal to ensure complete oxidation of ferrousiron and stability of the sludge.

The quality of the contaminated acid minedrainage water in Falun varies, not only accordingto the season, but also from which depth in themine you pump it. The main ingredients in thewater are sulphur, ferrous iron and zinc. pH for thiscontaminated water varies between 2.5 and 4.0, soit is normally highly acidic.

Due to the fact that almost all the iron exists inthe ferrous form it is very important with efficientaeration to get all the iron oxidized into ferric iron.

CASE STUDY FALUN

76 LINUX MAGAZINE 11 · 2001

A traditionalSwedish home.

The old mine buildingsare painted with copper

paint – the traditionalcopper mines product.

075Abacussbd.qxd 29.06.2001 17:00 Uhr Seite 76

Page 71: linux magazine uk 11

If this procedure was not carried out, the sludge andthe water would not be in a stable condition whenthey left the treatment plant.

From the treatment plant in Falun a 99.9%reduction of the content of iron and zinc in the acidmines drainage water and a stable sludge with 55-60% solids is achieved.

The ABACUS4 process control system uses highquality standard industrial input/output (I/O) unitsfor the digital and analogue I/O. A number ofindustrial standard protocols are available inABACUS4 and for Falun Profibus communicationswas chosen giving up-to-date Fieldbus technologyaround the site. Process control decisions are thentaken within the PCs running the ABACUS4software on the Linux Slackware platform. The data,running conditions, alarms and reports arepresented to the operators on PC-based operatorworkstations running ABACUS4 on the processplant network.

The UK and Ireland firm Rowan House Limitedwas involved in the process control site. Beingchemical engineers, they advised and assisted MCHKonsulting in Sweden on the process controltechniques to be applied to the process usingAbacus4, http://www.rowanhouse.co.uk/.

The control of the process had to overcomesignificant problems. Each step of the process has tobe adjusted to respond to changes in the dissolvedheavy metal content and composition but, as withmost water treatment processes, the time delays aresignificant. A truly distributed process controlsystem (DCS) was used and configured to maximisethe reliability and availability of the system foroptimum safety. The selection of a DCS alsofacilitated optimum response to process changes.The use of Abacus4 enabled the alarm reportingand operator interfaces to also be distributed ratherthan needing to rely on a central computer. Acentral computer for the display of information andalarm reporting would have run the risk of failing toreport process alarm conditions in the unusual eventthat it was offline for any reason. Since the plantperformance is public information every hour, theoperators need to know that they can always seewhat is happening even if one of the computers isoffline for maintenance or software changes.

The water treatment site is often unmanned.Alongside distributed alarm handling, the Abacus4control system makes use of the telephones. SMS textmessaging is used to allow critical alarms to be sent astext messages to the duty operator’s mobile phonewhilst the site is unmanned. If the duty operator failsto reply to the Abacus4 system the message is alsosent to other operators on the duty list. The textmessages are followed by a pre-recorded voicemessage being transmitted by the Abacus4 DCS bytelephone until someone responds to the alarm.These back up alarm systems are essential because theperformance of the plant is being automaticallydisplayed on a website by the Abacus4 DCS every

hour for public information. The result of failure torespond to an alarm would become well knownthroughout the town in a short space of time. Whichis an excellent incentive.

Basic plant performance data is automaticallyposted on a website in compliance with Sweden’stough anti-secrecy laws. The performance can beseen by anyone logged onto the town’s intranet.Falun Kommun’s intranet is permanently linked tothe Internet, allowing high-speed Internet access toeveryone in the town. The performance of thetown’s waste water treatment can also be seenfrom anywhere in the world on: http://www.users.wineasy.se/bbab/framby-reports/. ■

CASE STUDYFALUN

11 · 2001 LINUX MAGAZINE 77

Informationavailable from theAbacus4 system.

Abacus4 controlsystem view.

075Abacussbd.qxd 29.06.2001 17:00 Uhr Seite 77

Page 72: linux magazine uk 11

In the last issue, we became familiar with the ifconstruction and the test comparison program. Thismade it possible for us to make the programsequence independent of external circumstances forthe first time. Depending on the situation, othercommands were executed. Bash knows additionalcontrol structures, which are especially necessary forlarger comparisons and for multiple call-ups ofindividual commands (loops).

Parameter recognition

We shall begin with a small script. Like almost everyother Linux program, our script will use theparameters -h or –>-help to output a briefexplanation of the permissible options and thenstop by itself. To do this, we use an if construct,covered last month:

#!/bin/bashif [ "$1" = "-h" -o "$1" = "—>-help" ]; thenecho "call up:"echo " $0 [-h|—>-help]"echo "Parameter:"echo " -h, —>-help: brief explanation"fi

It becomes relatively fiddly and involved when wehave to check several parameters and also wish toignore upper and lower cases:

#!/bin/bashif [ "$1" = "-h" -o "$1" = "-H" -o -z "${1#—>U-[hH][eE][lL][pP]}" ]; thenecho "-h"elif [ "$1" = "-v" -o "$1" = "-V" ]; thenecho "-v"elif [ "$1" = "-q" -o "$1" = "-Q" ]; thenecho "-q"fi

The test on –>-help in the second line needs someexplanation. So as not to have to test –>-help in allvariants of upper and lower case, we use the patternrecognition from part 3 of our course. With ${1#–>-[hH][eE][lL][pP]} we search through the variable $1 fora string which begins with a double minus sign andcontains an upper or lower case ‘h’, upper or lowercase ‘e’ and so on. If there is a —>-help in $1 in anyupper or lower case combination, it is removed –leaving a blank character string. This is where the testparameter -z comes into play. It supplies a true valueif the following character string is empty – thus aversion of –>-help has been found. Words which onlybegin with –>-help (for example –>-helper) fail thetest, because the ending would be left over.

Simplification using case

As can be seen from the previous example: Large-scale parameter tests can hardly be conducted in

PROGRAMMING PROGRAMMING CORNER

78 LINUX MAGAZINE 11 · 2001

Control structures

CHECKPOINTCHARLIE

MIRKO DÖLLE

After the introduction to control structures

and the presentation of simple comparison

options in the last month’s Programming

Corner, this time we will be concerned with

series comparisons, loops, keyboard inputs

and small selection menus.

078PcornerNewsbd.qxd 29.06.2001 20:19 Uhr Seite 78

Page 73: linux magazine uk 11

this manner. There is an urgent need forsimplification. The method of parametercomparison is always the same: We check in eachcase whether the first parameter meets a certaincondition. For such serial comparison, there is thecase construction:

#!/bin/bashcase $1 in-h|-H|—>-[hH][eE][lL][pP])echo "-h";;

-v|-V)echo "-v";;

-q|-Q)echo "-q";;

esac

The case construct consists of the bracketingkeywords case and esac (like the final fi for if, esac isalso the reversal of the letters of case), a characterstring (here $1), which will be tested, and theindividual blocks with the respective cases. Theseblocks begin with the pattern which is limited by afinal round bracket, and end with a double semi-colon – in between are the instructions which are tobe carried out for the respective case.

In our example we have three different cases, -h, -v and -q. The pattern of the first case consists ofthree parts, one of which must be true. Thepatterns themselves are practically identical to thosefrom our if construct, although considerably clearer.

Apart from the square brackets which can beused to specify permitted characters or characterranges, there are also the wildcards ? for anycharacter and * for any sequence of characters. Thismakes it possible to distinguish the various networkdevices from each other:

case $device ineth*)echo "Ethernet";;

ppp*)echo "Modem";;

ippp*)echo "ISDN";;

lo)echo "Loopback";;

*)echo "Unknown"

esac

The last pattern, ”*”, applies to any character string– which is why this case construct in fact wouldalways have to return ”Unknown”. But the casesare processed from top to bottom, and the only oneto be executed is the first one that fits. All the

others are ignored. So in the case of ”ppp0” only”Modem” is output, but not ”Unknown”. Thescript is then continued, after dealing with the case,after the esac keyword.

Loops

With loops it is possible to have program segmentsexecuted many times, for example, to evaluate allcommand line parameters one after the other. TheBash knows three kinds of loop constructs: for,while and until. In principle the three loops areinterchangeable with each other: Anything whichcan be solved using for, can in any case also bewritten using while. Nevertheless you should decidewhich loop construct is most appropriate for whichproblem.

for

The for loop is suitable for applications where a listof variables is laid down and has to be processedindividually. This is practical for example forevaluating the command line parameters with ourcase construct:

#!/bin/bashfor P in $@; docase $P in-h|-H|—>-[hH][eE][lL][pP])echo "-h";;

-v|-V)echo "-v";;

-q|-Q)echo "-q";;

*)echo "Unauthorised parameter $P";;

esacdone

$@ provides a list of all command line parameters,which for then enters in sequence in the variable P,in order then to execute the body of the loop withour case construct.

If you’re already familiar with otherprogramming languages, you will be slightlysurprised at the way the for loop works (in Perl forexample it works in a completely different way).Usually, a start and an end value are stated, then thesize of the increments by which the start value is tobe raised. The loop is then run through until the endvalue is reached – which is usedto read in the valuesfrom 1 to 10 of a field, for instance.

This is not expressly provided for in the Bash,but we can remedy this by using the utility programseq from the sh_utils package (or sh-utils). seqsupplies us with a number sequence from aspecified starting value to an end value, there is theoption of setting the size of the increments, and the

PROGRAMMINGPROGRAMMING CORNER

11 · 2001 LINUX MAGAZINE 79

078PcornerNewsbd.qxd 29.06.2001 20:19 Uhr Seite 79

Page 74: linux magazine uk 11

number format can also be changed. In order tooutput ”Hello world” 10 times, we could use thefollowing script, where the number of therespective run-through is placed in front in squarebrackets:

#!/bin/bashfor i in ̀ seq 1 10`; doecho "[$i] Hello world"done

Unfortunately there is no manual page for seq, butyou will find relatively exhaustive help via the —>-help parameter. For home use, the invocations bymeans of seq Start End and seq Start Step size Endare sufficient to cover most cases.

while

Certainly the most frequently used loopconstruction is while. In this case, the body of theloop is executed until the specified condition is true.One potential application is that of reading in anylong field:

#!/bin/bashi=1whileread -e -p "[$i]> ";dofield[$i]="$REPLY": $[i+=1]doneecho ${field[*]}

The condition in this case is an invocation of read,but, exactly as with the if construct, test or anyother program can be used. If the return value ofthe program is 0, the condition is true, otherwisefalse.

The read command is new, with which we readinputs from the keyboard for the first time (exactstandard input). The input is – unless otherwisespecified – stored in the variable REPLY. Theparameter -e activates the ReadLine extension, andyou can edit the input line as usual with the cursorkeys, and the tab completion of program namesalso works. The second parameter -p ”[$i]> ”defines the prompt, which is displayed at the

beginning of the input line. In this case the elementnumber is in the array, $i in square brackets with asmaller symbol and blank space following. Unlikeecho there is no line break attached to the prompt,the cursor stays behind.

The rest of the script is quickly explained, whilechecks each time whether read is true – whatexactly happens if something were to be entered.The input has put read into the variable REPLY,whose content we store in the body of the loop aselement number $i of our array field. Then i isincreased, so as not to overwrite the stored values,and the loop starts again from the beginning.

It is only when, instead of a value, [Ctrl+D] ispressed, the return value of read does not equal 0,the condition is thus not met. The loop ends, andthe next instruction after the done belonging tothe loop is executed. In our case it is the output ofall elements of our array field, which we achieveby specifying a start in place of the elementnumber.

Program simplification

The example just shown is still very exhaustive andeven relatively complicated as it is written. There is amuch shorter and faster way:

#!/bin/bashwhileread -e -p "[$[i+=1]]> " field[$i];do:doneecho ${field[*]}

The most unusual thing, at first glance, is the emptybody of the loop, containing only the colon as zerofunction. But this is necessary, since the bodycannot be empty. There is no need to restore REPLYin the field element, because by specifying thevariable name field[$i] as last parameter of read, thevalues entered are stored immediately in the arrayand not in REPLY first. Incrementing the variable i by1 is also transferred into the condition and inaddition the initialisation has been done away withby the 1. The crux of the matter is that newvariables are empty by default, but have thearithmetical value 0. The instruction $[i+=1] firstincrements the variable by 1 and then delivers thevalue. So we begin as before at element number 1.

until

until incidentally does the same as while, exceptthat the loop is executed as long as the condition isfalse – otherwise there is no difference. Thefollowing example is something you will be familiarwith from the presentation of the while loop, thecondition has been inverted by means ofexclamation marks – true becomes false and viceversa.

PROGRAMMING PROGRAMMING CORNER

80 LINUX MAGAZINE 11 · 2001

Table 1: read parameters-a Field Allows the input of several values separated by spaces. The values are stored

in the array Field , incrementing from element 0 on -e Activates the ReadLine support. This makes it possible for example to edit the

input line with cursor keys or tab completion-r Deactivates the backslash-enter special treatment. Normally it is possible to

continue an entry on the next line by means of a backslash at the end of aline, without the line break having any effect

-p Prompt Replaces the standard input challenge with the character string Prompt,without attaching a line break.

Name Stores the input directly in the variable Name and not, as usual, in REPLY

078PcornerNewsbd.qxd 29.06.2001 20:19 Uhr Seite 80

Page 75: linux magazine uk 11

#!/bin/bashi=1until! read -e -p "[$i]> ";dofield[$i]="$REPLY": $[i+=1]doneecho ${field[*]}

In Listing 1 you will find the rough draft of a script,which apart from -h and –>-help also understands theparameters -q and –>-quiet respective as well as -vwhich means the same as –>-verbose. -q and -v areoften used either to suppress all outputs except forserious error messages and/or to comment all actions.The default setting is the verbose mode via thevariable QuietMode, by setting this to 1 in the secondline. Even if at first sight this looks nonsensical: Since 0is true, we set QuietMode with 1 to false.

Selection menus

The select construction offers an option which isfrequently underestimated. This makes it possible toconstruct complex selection menus. Here is a simpleexample for choosing between apples, pears andplums:

#!/bin/bashField=("apples" "pears" "plums" "end")select fruits in ${field[*]}; docase $REPLY in${#field[*]})return;;

*)echo "$Fruits";;

esacdone

The content of our array is hidden behind ${field[*]},in this case four elements, which select numbers insequence and outputs one after another:

1) Apples2) Pears3) Plums4) End#?

Now select queries the number of the desiredaction, for which read is implicitly used. The resultof the selection is as usual available later in thevariable REPLY. In addition select copies thecorresponding element in our array into the variableP and executes the body. Once this has beenprocessed, select shows the selection again.

The rest of the procedure in the body is definedby means of case. The first pattern looks fairlyunusual at first, but ${#field[*]} is concealing onlythe number of elements contained – which is thesame as the number of the last entry. This allows us

to reliably recognise when the user has selected thelast entry, without having to know its actual numberor name – thus the selection can be expanded atwill, as long as the last entry stands for ”exit menu”.

In order to leave select, you must either press[Ctrl+D] or, as shown in the example, call up returnor break. To this extent, select also differs from allother loops – it has neither a condition nor a list,after the processing of which the loop ends.

Unlike read, you cannot give select the promptwhich is to be output as parameter – the standardreturn prompt from the variable PS3 is used, whichyou can adapt manually:

#!/bin/bashfield=("apples" "pears" "plums" "end")PS3="Which fruits? > "select fruits in ${field[*]}; docase $REPLY in${#field[*]})return;;

*)echo "$fruits";;

esacdone

That ends the fifth part of Programming Corner.part 6 will be on the structuring and modularisationof scripts by means of functions and modules. Usinga small management program we will then recap allthe previous lessons in part 7 and show thepotential applications of the individual commandsand constructs. ■

PROGRAMMINGPROGRAMMING CORNER

11 · 2001 LINUX MAGAZINE 81

Listing 1#!/bin/bashQuietMode=1for P in $@; docase $P in-h|-H|—>-[hH][eE][lL][pP])echo "Command:"echo " $0 [-h|—>-help]|[-q|—>-quiet]|[-v|—>-verbose]"echo "Parameter:"echo " -h, —>-help: This brief explanation"echo " -q, —>-quiet: Only report serious errors"echo " -v, —>-verbose: Extensive messages"exit;;

-v|-V|—>-[vV][eE][rR][bB][oO][sS][eE])QuietMode=1;;

-q|-Q|—>-[qQ][uU][iI][eE][tT])QuietMode=0;;

*)echo "error: Unknown parameter $i"exit;;

esacdoneecho $QuietMode

078PcornerNewsbd.qxd 29.06.2001 20:19 Uhr Seite 81

Page 76: linux magazine uk 11

GTK+ and Gnome allow the development ofprofessional graphical interfaces in Linux. The booktakes the reader through the basics of programmingin GTK+ and Gnome, covering the GIMP toolkit,gIDE, Glade, Glib and GDK. It is aimed at the Linuxbeginner as well as at the more experiencedprogrammer wanting to develop Linux applicationswith graphical interfaces. The book gives details ofwhere to download any packages needed to runthe examples and explains concepts in a clear andconcise manner. Some basic knowledge of Cprogramming is assumed. The book is written in avery personal manner, almost giving you a tutorleaning over your shoulder to guide you through

tricky programming moments. Once you’ve workedyour way through all the exercises you will have noexcuse not to use graphical interfaces at everyopportunity. One or two errors have crept into thecommands but in case of difficulty there is a websitewhere any problems picked up have been corrected.

InfoPublished by WroxPriced at £28.00Author Peter Wrighthttp://www.wrox.com

BOOK REVIEW

82 LINUX MAGAZINE 11 · 2001

Many people, these days are looking forcertification in Linux to match those in Microsoft orUnix systems, to meet those needs the LinuxProfessional Institute (LPI) has introduced a series ofexams leading to various levels of certification andexamination. The LPI is widely regarded as being theleader in independent certification andexamination.

‘LPI Linux Certification in a Nutshell’ preparescandidates for both of the level 1 exams. It is aimedat junior to mid level Linux administrators, but alsoany new Linux users who need a detailedintroduction to Linux that applies to using Linux inreal life instead of theory.

The book is split into two parts. Part 1 coveringthe exam 101 and part 2 covering exam 102. Eachpart contains an exam overview, a study guide,topic sections, review sections, a practice test and ahighlighter’s index. Part 1 covers GNU and Unixcommands; Devices and file systems; Boot,initialisation, shutdown and Run levels;Documentation and Administration tasks.

Part 2 covers Hardware and Architecture;Installation and Package management; Kernel; Textediting and printing; Shells; X windows system;Networking fundamentals; Networking services andSecurity.

The tutorials take the reader through thevarious Objectives of the exams and the practicetests allow you to see how you are progressing(answers are given). The Highlighters Index is auseful quick reference and revision guide. The bookwill be very useful for anyone taking the exams andalso to anyone who wants to learn more aboutLinux concepts and functions, whether they aretrying for certification or not.

InfoPublished by O’ReillyPriced at $39.95Author Jeffrey Deanhttp://www.oreilly.com

LPI LINUX CERTIFICATION IN A NUTSHELL

ALISON DAVIES

BEGINNING GTK+/GNOMEPROGRAMMING

ALISON DAVIES

082booksbd.qxd 29.06.2001 17:02 Uhr Seite 82

Page 77: linux magazine uk 11

BEGINNERS KORNER

84 LINUX MAGAZINE 11 · 2001

A whole new typeface

Fonts and Linux – never a marriage made inheaven. With the new XFree86 version though, thatcould change, because with this properly installed youcan finally get true anti-aliasing under KDE, too.

There are a few conditions, though: XFree86 ina version greater than or equal to 4.02, and also thepackage Freetype2 must both be present on yourcomputer. Unfortunately, that’s not all, because theXfree driver for your video card must support theRendering Extension. You can winkle out of yoursystem to what extent your driver does so with a

stefanie@diabolo[~]> xdpyinfo | grep RENDER

If, after entering this line you are not confrontedwith a shining RENDER, for the time being you willnot see any smooth fonts under KDE.

Finally, make sure that /usr/X11R6/lib/libXft.so.1.0 links to Freetype. This is easy to checkwith an ldd libXft.so.1.0. If the output does notinclude anything from the Freetype library, you haveunfortunately picked up an Xfree package whichdoes not include Xft (”X FreeType”-) support. Butfear not, because this support is at least included inthe more recent Mandrake and SuSE packages.

Now all you need is qt in Version 2.3.0 with Xftsupport compiled in to complete your anti-aliasing.If you cannot find this, you can also compile thislibrary yourself from the sources. You will find theseon the FTP server of the Troll at ftp://ftp.trolltech.com/qt/source/. But please don’t forget to add onan -xft to the .configure command.

Everything present on your computer so far?Then all that stands between you and the new fontmiracle is a few changes in diverse configurationfiles. One more little tip before you get cracking:Please do not delete any entries or files whatsoever,

but merely decomment entries and rename old files.If there are problems with the new configuration,you will then have the option of setting yourcomputer back to its original condition in seconds.

The first thing to do is to get rid of all fontservers which may be running on your system. To dothis, decomment everything in your XF86Config filein FontPath which bears any similarity to aunix/:7100. Because you are so conveniently doingsome decommenting, please place another # at thestart of the lines /usr/X11R6/lib/X11/fonts/truetypeand /usr/X11R6/X11/fonts/Type1, if they exist. Insertthe following in the section Modules:

Load "type1"Load "freetype"

If you have bad luck – as I did with my Red Hat 7.0 –in the font path there will now be the font serverwe have just decommented and absolutely nothingelse. In this case you will have to enter the paths toyour font directories by hand. This should looksomething like this:

Section "Files"RgbPath "/usr/X11R6/lib/X11/rgb"# FontPath "unix/:7100"FontPath "/usr/X11R6/lib/X11/fonts/100dpi:U

unscaled"FontPath "/usr/X11R6/lib/X11/fonts/75dpi:uU

nscaled"# FontPath "/usr/X11R6/lib/X11/fonts/truetype"# FontPath "/usr/X11R6/lib/X11/fonts/Type1"FontPath "/usr/X11R6/lib/X11/fonts/100dpi"FontPath "/usr/X11R6/lib/X11/fonts/75dpi"FontPath "/usr/X11R6/lib/X11/fonts/misc"FontPath "/usr/X11R6/lib/X11/fonts/local"FontPath "/usr/X11R6/lib/X11/fonts/misc:unU

scaled"Fontpath "/usr/X11R6/lib/X11/fonts/Speedo"ModulePath "/usr/X11R6/lib/modules"

EndSection

Who says there is no place for gossip and scandal in a Linux

magazine? K-splitter broadcasts news from the K-World and noses

around here and there behind the scenes.

K-splitter

SMOOTHOPERATOR

STEFANIE TEUFEL

anti-aliasing: Aliasing meansthe staircase effect at the

edges of graphics, especially oftext or lines, caused by the factthat with pixels it is really onlypossible to show straight lines

exactly if they are vertical orhorizontal. The

countermeasure – theinsertion of shading pixels into

the stairs – is called anti-aliasing.

084ksplittersbd.qxd 29.06.2001 17:05 Uhr Seite 84

Page 78: linux magazine uk 11

BEGINNERSKORNER

11 · 2001 LINUX MAGAZINE 85

In /usr/X11R6/lib/X11/XftConfig you must nowenter the two font paths which you have justdecommented in the Xfree configuration file – evenif in a somewhat different form, as follows:

dir "/usr/X11R6/lib/X11/fonts/Type1"dir "/usr/X11R6/lib/X11/fonts/truetype"

If you don’t yet possess any TrueType fonts, the timehas now come to get your hands on some. A neatpackage can be found athttp://keithp.com/~keithp/fonts/truetype.tar.gz,which you should simply unpack into the directory/usr/X11R6/lib/X11/fonts. Now all you need to do isset the variable export QT_XFT=true in a file such asthe /etc/profile or the /etc/profile.local. That’s it.

For owners of a SuSE 7.1 the following methodhas been tried and proven: Install the packages qt-experimental and ttmkfdir if these are not alreadyon your computer. Then copy all the TrueType fontswhich you would like to use later into/usr/X11R6/lib/X11/fonts/truetype. Anyone who hasnot to date monkeyed around with/etc/X11/XF86Config and/usr/X11R6/lib/X11/XftConfig is as good as finished,because then these are correctly configured.Nevertheless, make sure as a precaution thatXftConfig contains both of the dir lines mentionedabove and the path to the font server isdecommented in the /etc/XF86Config. After that,change to the directory/usr/X11R6/lib/X11/fonts/truetype, and there enterthe following:

# ttmkfdir -o fonts.dir# SuSEconfig -module fonts

Now anchor the entry export QT_XFT=true in thefile /etc/profile.local, and next time you start KDE

everything will be smoothed out, as you can see inFigure 1.

Thematic

Beautifying your KDE 2.1 desktop with your ownthemes should soon no longer be a problem,because at http://www.ibm.com/developerworks/ anew online tutorial explains to design-madhobbyists what KDE themes are all about. Thetutorial is free to use, although a brief registration isnecessary. For those who would rather enjoy thetutorial at leisure offline: No problem, there is also adownload version. ■

Figure 1: No moreedges or corners

Figure 2: Construction ofthemes made easy

084ksplittersbd.qxd 29.06.2001 17:05 Uhr Seite 85

Page 79: linux magazine uk 11

BEGINNERS KORNER

86 LINUX MAGAZINE 11 · 2001

”I’ve had my fingers burned before” - this sayingmay have gone through your head more than onceif burning data or audio CDs under Linux has beengiving you a hard time. But, like so many things,there has been progress on the burner front, too.With Koncd the perfect home-baked CD is just afew mouse clicks away.

There really is nothing more to it than an easy-to-use graphical user interface for the programscdrecord and mkisofs, with which command linefetishists have already been enjoying going for theburn under Linux for some time now. The latest

version of the program can be found either onour CD or at http://www.koncd.de/.

Stoke the fire

After installing your new burnersoftware, you will find an entry in the K

menu, Applications/KOnCD, with whichyou will be able to start the program with

ease in future. But before you actually shootoff, you should first check a couple of things

which could stand between you and your home-burnt CDs.

If you would like to use koncd as a normal user,you will in all probability founder for the lack ofexecution rights over cdrecord. Because this programcan usually only execute root. So change thepermissions - as Superuser - as follows:

chown root /usr/bin/cdrecord chmod 4711 /usr/bin/cdrecord

Also, for safety’s sake, test whether cdrecord

recognises your burner and the CD-ROM drive. Todo this, enter the following in the console:

cdrecord -scanbus

cdrecord should then reward you with an output asin Box 1.

Should you have an ATAPI burner rather than aSCSI device, you will need to select the ATAPI-SCSIemulation in the kernel. In the most commondistributions this is present as a module, which youcan simply load in with the command

modprobe -k ide-scsi

That’s about it. Now take a deep breath,and start the program.

Burn, baby, burnThe main window (Figure 1), looks - to put it politely- a bit on the lean side, but as with everything in life,with koncd it’s the inner values that count. And itcertainly has them, because with koncd you can notonly copy or burn audio CDs, but also master CDs,produce multi-session and bootable CDs, burn on-the-fly or delete CD-RWs.

First click on the Settings button, to checkwhether burner (writer) (Figure 2) and CD drive(reader) have been set correctly. If not, adjust thedevices using the pulldown menu.

After that, it’s up to you what you want to do.

Koncd is the KDE Tool of the Month. With this cdrecord

front-end, you can burn CDs easily.

[left]Figure 1: Cleared up

[right]Figure 2: The burner and writer

should match

K-tools

FURNACESTEFANIE TEUFEL

Box 1: Cdrecord scans the busCdrecord 1.9 (i686-pc-linux-gnu) Copyright U (C) 1995-2000 Jörg SchillingLinux sg driver version: 2.1.38Using libscg version ‘schily-0.1’scsibus0:

0,0,0 0) *0,1,0 1) *0,2,0 2) ‘TEAC ‘ ‘CD-ROM CD-532SU

‘ ‘1.0A’ Removable CD-ROM0,3,0 3) ‘YAMAHA ‘ ‘CRW4260 U

‘1.0j’ Removable CD-ROM0,4,0 4) ‘EXABYTE ‘ ‘EXB-8200 U

‘ ‘2600’ Removable Tape0,5,0 5) *0,6,0 6) *

086Ktools2sbd.qxd 29.06.2001 20:22 Uhr Seite 86

Page 80: linux magazine uk 11

BEGINNERSKORNER

11 · 2001 LINUX MAGAZINE 87

For now we shall make your mind up for you anddecide that you want to copy a CD.

The double whammy

To do this, click in the start window on the Copy CDbutton, after which you will immediately beconfronted with a window as in Figure 3. A wholelot of settings, but: What do they mean?

Before you plunge with me into the optionsjungle, it’s best to start with the simple things in life,er, programs. The control button Erase CDRW onlyconcerns you if you can use rewriteable CDs. WithNone that’s exactly what happens,. the CD is notdeleted. The setting All deletes the complete CD,which - depending on the speed of the burner - cantake one or two minutes. With Fast you delete onlythe TOC, (”Table Of Contents”) from the CD, Trackerases the first track on the CD, and Leave opendoes not close the last session.

In the pulldown menu Speed you can adjustthat of the burner. One little tip, especially whenburning audio CDs, you should not squeeze themaximum from your burner. Because the faster youburn, the less precise the track becomes, and in theworst case scenario it can happen that instead ofmusic you hear nothing but crackling.

But now to the options: If you select DummyMode, the burn procedure is not really executed.With ISO-Size Koncd uses the size details for thestandard CD, one click on Ignore medium size, andKoncd won’t even think about it - which can bequite useful when overburning. Eject CD after writeautomatically ejects your brand-new CD after theburn procedure. With No fixiating no table ofcontents is created. Warning: Unfixed multi-sessionCDs are not readable in some CD-ROM drives.Finally with Force Mode Koncd cheerfully carries onburning even if errors crop up during the process.

Now all you need to do is click on the Startbutton, to start the burn procedure and watchkoncd go to work. The first status message thenshows the progress of the burn procedure whilesecond keeps tabs on the buffer memory of theburner. If this falls to 0 per cent, the burn procedureis interrupted. If so, try it at a lower burn rate - it’s agood thing there’s the Dummy Mode option...

The sorry remnants

If you want to clear data from your hard drive to CD(repeat after me, ”backups are good!”) - you haveto proceed slightly differently. In this case, select theMaster CD button from the root window, andprepare yourself for even more options (Figure 4).

You have already met one or two of the options,so at this point we will just introduce the newcomers.

A click on the button next to the Source-Dirfield opens the Koncd file manager, in which youcan assemble the data you want to burn. The filemanager is split into two windows: On the left you

will find the local directory structure and on theright the window belonging to the ISO imagedirectory, that is all the directories and files whichare to be burnt onto the CD later.

The assembly is simple. Create the directoriesyou want, then in the left window mark the files ordirectories to be saved and in the right window thedirectory, into which they are to be burnt. One clickon Add and your selection is added. A final click onOK brings you back to the root window. The ISOimage you have created should now be in the inputfield Image-File.

If you can do without bootability on your CD, theBootable CD field need concern you no further.Otherwise specify the boot image file here which is tobe burnt onto the start of the CD, in order to make itstartable. What’s more important for most peoplemay be the field Image Type. If you want to read theCD under both Linux and Windows 9x or NT, thenchoose the type Rock-Ridge+Win9x/NT (Figure 5).

The options on the right side under CDIdentification are more to do with cosmetic features.In the field Volume-ID you can give your newcreation a name. Under Windows this appears in theExplorer under the respective drive letter. Publisherand Preparer would be suitable spots for your name.Since both these entries are to be stored in the tableof contents of the CD, this can be very sensiblewhen it comes to copyrights. In the field App.-IDenter for example the date when you burnt the CD.

The items in the Options area are much moreimportant. The options Create CD-Image and WriteCD must be selected in order to burn the CD. If youdeselect Write CD, only an image file will becreated, which you can burn later or with anotherprogram. A click on Bootable CD helps you with abootable CD, Multisession makes Koncd burn theCD in multi-session mode, meaning you can addmore data to the CD later on.

The item Leave image leaves the image filecreated on the hard drive, instead of deleting it afterburning. It makes sense to get rid of this disk spaceguzzler if you want to burn several CDs with thesame content. But now, at last, it’s high time to lighta fire under your burner. ■

Figure 4: When mastering a CD thereare even more options to watch

Figure 5: The best of both worlds

Figure 3: Copy your data!

086Ktools2sbd.qxd 29.06.2001 20:22 Uhr Seite 87

Page 81: linux magazine uk 11

BEGINNERS GNOMOGRAM

88 LINUX MAGAZINE 11 · 2001

GNOME and GTK as the basic programs for GNOME have been

attracting more and more followers in recent years. There are now

programs for almost every task and new ones are being added

daily. Each month in the Gnomogram column, we present the pearls

among the GNOME tools and report on the latest GNOME rumours.

This month, we cover GUADEC 2001, Eazel Reef, Progeny 1.0,

Etherape, Gnoetry and Adapting Sawfish.

GNOME News

GNOMOGRAMBJÖRN GANSLANDT

GUADEC 2001

GUADEC (the GNOME User And DeveloperEuropean Conference) took place in Copenhagenthis year and gave GNOME developers theopportunity to discuss the future of GNOME and tosign posters and each other. Since GNOME 1.4 wascompleted shortly before GUADEC, one of the mainpoints of discussion was GNOME 2.0. And it was notonly GNOME followers who got a word in – therewere also several KDE developers present, withwhom better interoperability between GNOME andKDE was being worked on. There were evenstrenuous efforts being made to replace GNOME’santiquated sound daemon ESD by KDE’s aRts. Itremains to be seen whether this solution will everbecome a reality, since aRts takes over too manytasks, according to some GNOME developers, whicha multimedia framework like Gstreamer ought tohandle. Presented for the first time was the GUADECDirectFB, which allows GTK applications directaccess to the framebuffer, thus an abstraction of thegraphics hardware. DirectFB also offers features suchas window management and an alpha-channel fortransparent windows. To make it easier for new

developers to get on board GNOME, it was decidedto expand the existing technical documentationconsiderably. Of course, working with GNOME isalso to be made easier for users, especially thosewho are disabled. Although there is still a great dealto be done in this direction, it was already possible topresent features on GUADEC such as speech output.And the development of a GNOME Office Suite, forwhich plans have long existed, was finally resolved.Under the name GNOME Office, several existingprograms will be combined and harmonised witheach other until the launch of GNOME 2.0. Imagesof GUADEC and the associated parties can be foundat the second site listed below; also, by the time thisissue comes out all the lectures should be availableat the third site below as MPEG-2.

Eazel Reef

Since the technology currently in use by Eazel is veryrestricted by services over the Internet, a base has beencreated under the name Reef, which is considerablymore powerful, at least on paper. The user receivesService View Bundles via Reef, containing script codeand other data such as images. Python will be deployedin the first instance as a script language, but in thelonger term other languages will also be supported. Forcommunication between the local script and the serverboth SOAP, which also forms the basis for Microsoft’s.NET, and XML-RPC are being discussed.

Progeny 1.0

Progeny is a commercial distribution, developed onthe basis of Debian Woody and in which the Debianco-founder Ian Murdock played an important role.The long-term objective of the development, apartfrom the provisions of services, is simple managementof Linux networks. But Progeny now also offers a few

Figure 1: GUADEC 2001 (photo: http://canvas.gnome.org

/~gman/guadec/)

088gnomogramsbd.qxd 29.06.2001 20:25 Uhr Seite 88

Page 82: linux magazine uk 11

BEGINNERSGNOMOGRAM

11 · 2001 LINUX MAGAZINE 89

improvements for GNOME users. Instead of thenormal Debian front-end for Debconf, Progeny usesso-called configlets, which can be written in Python.These configlets are partly integrated into the GNOMEcontrol centre and offer features similar to Ximian’sset-up tools. Anyone who has already installed Debiancan simply upgrade via apt-get to Progeny 1.0 –otherwise ISO images of the distribution can be foundat archive.progeny.com/progeny/images/.

Etherape

Etherape, which is based on Etherman, illustratesnetwork traffic between your own computer andthe local network and/or the Internet. To do so,Etherape represents each computer by a node anddraws a connection corresponding to the amountof data volume between the individual nodes. Thecolour of this connection shows the protocol beingused, and you can define which protocol levelsEtherape should concentrate on. As data sources,apart from Ethernet, PPP and FDDI interfaces, theoutput from Tcpdump can also be used. This makesit possible to keep re-displaying network trafficwhich has been recorded once. Since only theconnections which lead to your own computer canbe analysed via a PPP or SLIP interface, Etherapeuses the -m ip option, or the command interape tooffer the possibility of adapting the display andpositioning your own computer in the centre of theillustration. There are also modes for Ethernet, FDDIor TCP, where in the last type of illustration thenetwork traffic from port to port is shown.

Gnoetry

As the name suggests, Gnoetry creates poetry, largelyunassisted. To do so the program analyses existingtexts statistically and then generates a text withsimilar characteristics. Gnoetry masters a wide varietyof forms of poetry and is also capable of convertingthe rhyme schemes of western poets or metricpatterns respectively to Japanese poems.Unfortunately quite often the rhymes are flawed, andit does happen that a syllable gets overlooked. Sincethe objective of the project is a joint production byman and machine, the lines of the poem can beregenerated as often as you like, until the poem isperfect. Gnoetry comes with only English texts assources, since different languages vary too much forthem to be interchanged without a lot of effort. Norare any contemporary texts included for copyrightreasons. But with the aid of a 5MB bonus pack atleast a large number of classics can be added.

Adapting Sawfish

One of the great advantages of Sawfish is that thiswindow manager can be expanded by means ofscripts in Lisp dialect Rep. To do this you can makeuse of modules from /usr/share/sawfish/VERSION/

lisp/, by loading them from the file ~/.sawfishrc withthe command

(require 'module)

In this file, there should also be the line

(require 'sawmill-defaults)

which, among other things, adds GNOMEadaptations. New modules can be found at sitessuch as items nine and ten listed below. They mustfirst be compiled with the command

sawfish --batch compiler -f compile-batch ModUul.jl

before they are integrated. Sometimes there arealso code snippets, which must be copied directlyinto ~/.sawfishrc. If you want to expand Sawfishyourself you should take a look atsawmill.sourceforge.net/prog-manual.html, whereall relevant functions and variables are explained. ■

[above]Figure 2: Etherape shows where datais really coming from

[left]Figure 3: Gnoetrycreating a sonnet

URLs

guadec.gnome.orggnome.wlug.westbo.se/guadec/gnome.orgmail.gnome.org/archives/gnome-hackers/2001-April/msg00002.htmlprogeny.comarchive.progeny.com/progeny/images/etherape.sourceforge.netwww.beardofbees.com/gnoetry.htmlwww.sics.se/~lofgren/sawmill/adraken.themes.org/map.phsawmill.sourceforge.net/prog-manual.html

The authorBjörn Ganslandt is a student.When he is not involved intrying out new programs hereads books or plays thesaxophone.

088gnomogramsbd.qxd 29.06.2001 20:25 Uhr Seite 89

Page 83: linux magazine uk 11

BEGINNERS ANSWER GIRL

Read rights: For the contentof a file to be made accessible

with the aid of a pager such asless or an editor to the eyes ofa user, it must carry, from thepoint of view of this user, the

r- (“read”-) flag. This can beset with the command chmod

for the owner of the file(chmod u+r filename), theowner group (g+r) and allothers (o+r). In the case ofdirectories the read rightallows the content of the

directory to be displayed withls. Other rights include write(w) and execution rights (x).

These can be shown using ls -l(“long listing”).

90 LINUX MAGAZINE 11 · 2001

Little graphical helpers such as Qtrans, (presented inLinux Magazine Issue 8 May 2001 on p96) also offeroffline help, but sadly the dictionary formats usedthere make no allowance for simple browsing withless & co. on the command line. For the DICT-protocol there is certainly also the command linetool dict, although DICT, despite its open format,does have one major drawback: without the dictdserver nothing whatsoever will happen.

All in all, not exactly ideal for users who like touse their dictionaries for browsing, or would like tocontinue to use vocabulary lists created by thesweat of their own brow. Pure ASCII files areunbeaten, so long as we stick to the Latin alphabet:Browsed through with less, you can use the lesscommand /search term to look specifically forcertain search terms.

Wanted: ASCII glossaries

You can find collections of ASCII dictionaries on theInternet. Anyone hunting for collected English-German glossaries, for instance, will strike lucky athttp://www.wh9.tu-dresden.de/~heinrich/dict/dict_leo_ftp/leo_ftp/.

Once downloaded and copied into a jointdirectory (anyone having root rights will create/usr/dict/eng_deu) the browsing can commence(assuming you have read rights):

[trish@lillegroenn ~]$ cd /usr/dict/eng_deu[trish@lillegroenn eng_deu]$ less *

When it comes to the letter z, less asks for leave tospeak in the last line:

(END) - Next: EXERCISE.VOC

How on earth can we get to the next fileEXERCISE.VOC? Pressing h brings up a Help page,from which we can read:

CHANGING FILES[...]:n * Examine the (N-th) next file from theUcommand line.:p * Examine the (N-th) previous file fromUthe command line.

The less-command :n thus brings us to the next file,while with :p we can jump back a file at a time.Unfortunately, forward searches are always limitedwith /searchterm and backwards searches with

The Answer Girl

ALL IN THETRANSLATION

PATRICIA JUNG

The world of everyday

computing, even under

Linux, is often good for

surprises. Time and again

things don’t work, or not as

they are supposed to.

The Linux Magazine’s

Answer Girl demonstrates

how to deal elegantly with

such little problems.

090answergirlsbd.qxd 29.06.2001 20:28 Uhr Seite 90

Page 84: linux magazine uk 11

BEGINNERSANSWER GIRL

?searchterm to the currently displayed file. But hereagain the h (or the man page) comes to ourassistance:

SEARCHING[...]

Search patterns may be modified by oneUor more of:[...]

^E or * Search multiple files (pass thUru END OF FILE).

To try it out we close the Help mode with q, go back,using :x to the first file and once in there, with 1G(“Goto line 1“) to the first line. If we now enter/*yesterday instead of /yesterday, and with n jump tothe next occurrence of yesterday, the end of a file isno longer the end of the search. We also searchthrough all the files stated on the command line. Afterentering the asterisk less reports with EOF-ignore inthe last status line, that it is remembering, for thissearch, to ignore the end of a file (“End of file“).

Not browsing, but searching

Browsing was an important argument in favour ofASCII vocabulary lists, but we don’t want to dowithout a targeted search. For this purpose, grep isour friend:

[trish@lillegroenn eng_deu]$ grep yesterday *BOOK.VOC:yesterday gesternEXERCISE.VOC:gestern - yesterday[...]eng2ger.voc:gestern — yesterday[...]

No matter how delighted we may otherwise be thatgrep tells us where it was found - for our referencepurposes we are not exactly dying to know in whichfile grep found it. Luckily man grep declares...

-h, --no-filenameSuppress the prefixing of filenames on outU

putwhen multiple files are searched.

that it is possible to turn off the mention of thefilename with the flag -h:

[trish@lillegroenn eng_deu]$ grep -h yesterday *yesterday gesterngestern - yesterday[...]gestern — yesterday[...]

But this brings the disadvantage that the vocabularyis distributed throughout several, sometimesthematic, ASCII files with the filename endings .vocor .VOC, even more to the fore: The various files usedifferent conventions, to separate phrase andtranslation from each other. In order to filter outduplicates, there is only one thing left to do: Wemust tailor all the files to a single convention.

Egalitarianism

eng2ger.voc separates the German vocabularieswith two hyphens and a space before and after itsrespective English translations:

erst gestern --only yesterday

Since this is by far the largest file, it is advisable totransfer its convention to the other files.

In the case of EXERCISE.VOC this is not so hard:This file retains it with a hyphen (-) between thespaces, which we quickly replace with sed:

[trish@lillegroenn eng_deu]$ sed -e „s/ - / U-- /“ EXERCISE.VOC > EXERCISE.VOC_

The sed command s quickly and simply substitutesthe first occurrence of SpaceMinusSpace in eachline with SpaceMinusMinusSpace. We actuallyreceive the result of this command, applied toEXERCISE.VOC, as the standard output. But sincewe would rather see it in a file, we use > to divertthe output into the file EXERCISE.VOC_. After wehave checked that the new file looks reasonable, a

[trish@lillegroenn eng_deu]$ mv EXERCISE.VOCU_ EXERCISE.VOC

is sufficient to overwrite the old with the new file.The file BOOK.VOC imposes higher demands.

Here a simple space serves as the dividing symbol:

yesterday gestern

So that there can be no confusion with spacesbetween words in phrases, these are marked by anunderscore, which fortunately does not occur aspart of a word:

yearn sich_sehnen

11 · 2001 LINUX MAGAZINE 91

090answergirlsbd.qxd 29.06.2001 20:28 Uhr Seite 91

Page 85: linux magazine uk 11

BEGINNERS ANSWER GIRL

So here we have to replace twice: the first space ineach case by SpaceMinusSpace (s/ / — /) andglobally, every occurrence of _ by space (s/_/ /g).Combined, this looks like so:

[trish@lillegroenn eng_deu]$ sed -e “s/ / -- U/“ -e “s/_/ /g“ BOOK.VOC > BOOK.VOC_

Compare and contrast

Before we overwrite BOOK.VOC with BOOK.VOC_,we would like to check the new file, thus compareit with the original. But diff is not suitable for this,as it outputs all lines which are different, and that’sall of them... What we need is a word-based diff:wdiff. If this does not come with the distribution, itis available fromhttp://rpmfind.net/linux/rpm2html/search.php?query=wdiff orhttp://packages.debian. org/stable/text/wdiff.html.

[trish@lillegroenn eng_deu]$ wdiff --helpUsage: wdiff [OPTION]... FILE1 FILE2[...]-3, --no-common inhibit output of commonUwords

With the option -3 you can thus avoid having wdiffoutput words which have stayed the same. If wesend the entire output through less again, we arealso preventing something slipping by us when welook through:

[trish@lillegroenn eng_deu]$ wdiff -3 BOOK.UVOC BOOK.VOC_ | less[...]========================================={+--+}=========================================[-you can-] {+--you can+}[...]

wdiff’s output does, admittedly, take some gettingused to: The = line functions merely as a dividingline. In [- -]there are strings from BOOK.VOC,which have been replaced in BOOK.VOC_ by thecharacter string in the {+ - brackets. The {+--+}means that in BOOK.VOC_ simply two minussymbols have been added – spaces are easier toignore for the word-based diff.

The output is more readable in the so-calledless mode, which does not really have very muchto do with less. But nevertheless,

[trish@lillegroenn eng_deu]$ wdiff -3l BOOK.UVOC BOOK.VOC_ | less[...]=========================================--=========================================you_can --you can[...]

waives the unwanted bracketing and thus makesthe output easier to read.

But we have no desire to go through the entireless output, and we ponder the following: If wehave done everything right, wdiff -3 will throw outexactly the same number of -- lines as BOOK.VOC(and BOOK.VOC_) has lines (lines: -l):

[trish@lillegroenn eng_deu]$ wc -l BOOK.VOCUBOOK.VOC_29018 BOOK.VOC29018 BOOK.VOC_58036 total

If we filter all the distracting dividing lines out ofthe wdiff output, we should in fact again end upwith 29018 lines (grep -v seeks out all the lineswith no ==):

[trish@lillegroenn eng_deu]$ wdiff -3l BOOK.UVOC BOOK.VOC_ |grep -v “==“| wc -l29023

So that did not go quite as planned - where do thefive extra lines come from? Clever as we are, wewill simply display all the lines which contain nodouble minus:

[trish@lillegroenn eng_deu]$ wdiff -3l BOOK.UVOC BOOK.VOC_ | grep -v “==“ | grep -v “--“| wc -lUsage: grep [OPTION]... PATTERN [FILE]...Try ̀ grep —help’ for more information.

0

But we’ve certainly done something wrong here...Of course – minus signs serve as symbols for theshell that there is an option to follow, and thestrength of the double quotes is not enough tohide our minus search pattern from the shell.

Luckily we can remember the old Bash trick, oftelling a command with a – that there are nofurther options to follow:

[trish@lillegroenn eng_deu]$ man bash[...]OPTIONS[...]- A single - signals the end of options and

disables further option processing. Any arguments after the - are treated as filenames and arguments. An argument of -- is equivalent to an argument of -.[...]

With a

[trish@lillegroenn eng_deu]$ wdiff -3l BOOK.UVOC BOOK.VOC_ | grep -v “==“ | grep -v — “--”Uwc -l

5

thus we come to the missing five lines. But wheredid they come from?

[trish@lillegroenn eng_deu]$ wdiff -3l BOOK.UVOC BOOK.VOC_ | grep -v “==“ | grep -v — “--“

92 LINUX MAGAZINE 11 · 2001

090answergirlsbd.qxd 29.06.2001 20:28 Uhr Seite 92

Page 86: linux magazine uk 11

BEGINNERSANSWER GIRL

arrow_keys

sensing_mark

Three empty lines, which wdiff has somehowincluded, but what is going on with arrow_keys andsensing_mark? The same command without the loption for wdiff provides information, and

[trish@lillegroenn eng_deu]$ wdiff -3l BOOK.UVOC BOOK.VOC_ | less

lets us track down the corresponding point bycomparison with the less command /arrow_keys.Look at this:

[-arrow_keys-]{+arrow keys —+}

The fault (for the empty lines, too) lies clearly withwdiff.

With all this toing and froing we had almostforgotten why we dragged out wdiff in the firstplace: We wanted to check if, in the lines where wereplaced underscores, everything had gonesmoothly. Here we would prefer to take wdiffwithout the l option, because then we couldexclude all lines in which a {+--+} occurs:

[trish@lillegroenn eng_deu]$ wdiff -3 BOOK.VUOC BOOK.VOC_ | grep -v “==“ | grep -v „{+--+}“U| less

Everything in order? Then we simply overwrite theold BOOK.VOC with the converted content fromBOOK.VOC_:

[trish@lillegroenn eng_deu]$ mv BOOK.VOC_ BOUOK.VOC

Grep and paste

As if we hadn’t already gone to enough trouble,technic.voc presents us with a disproportionatelydifficult task: Here stand the original and thetranslation, each on their own line, and the pair isseparated from the rest of the vocabularies by anempty line in each case:

Ab-; Abfallwaste

abfuehrendischarge

[...]

With sed on a command line, nothing more willcome of this, because here we must replace linebreaks with “ -- “ and additionally eliminate emptylines. It also becomes difficult to construct a halfwaycomprehensible one-liner with Perl for this. Butluckily the file is so regularly constructed that – oncewe have removed the empty lines – an odd, and thefollowing even line, always go together.

We can get rid of the empty lines by using grepto seek out all those lines in which at least one lettera-z and/or A-Z occurs:

[trish@lillegroenn eng_deu]$ grep [a-zA-Z] tUechnic.voc

Now it gets a bit more difficult. But then weremember the cut command, with which columnscan be extracted from text files. Where’s there’s a cut,there must also be a paste, which combines severalcolumns into a file. In fact, we find it with man paste.

With -d we can specify a column delimiter –unfortunately only a single letter, but we can stillreplace that later with sed. What matters is onlythat the Delimiter does not occur in technic.voc.How would # work? Let’s count:

[trish@lillegroenn eng_deu]$ grep -c “#“ tecUhnic.voc0

The hash symbol (“#“) occurs precisely 0 times inthis dictionary file and is therefore ideally suited as atemporary column delimiter for paste.

The rest is perfectly simple: paste wants to haveas argument just the two files which serve as firstand additional column(s). Now we have no files atall, but the manpage tells us that paste is alsosatisfied with the standard input (from the Pipe ofgrep), if instead of a filename we insert a -.

In fact we can settle quite happily for thestandard input STDIN (“standard input“); this has inparticular the nice property that a line disappearsfrom STDIN as soon as it has been read out once. Ifwe twice replace paste in an admittedly dastardlymove for STDIN, we obtain precisely the effect wewant: In the first column are the odd lines, in thesecond column the even lines:

[trish@lillegroenn eng_deu]$ grep [a-zA-Z] tUechnic.voc | paste -d “#“ - -Ab-; Abfall#wasteabfuehren#discharge[...]

To remove the hash symbol from this is one of oureasiest exercises, and we immediately divert theresult into the technic.voc_ file:

[trish@lillegroenn eng_deu]$ grep [a-zA-Z] tUechnic.voc | paste -d “#“ - - | sed -e “s/#/ U-- /“ > technic.voc_

The result technic.voc_ ...

Ab-; Abfall -- wasteabfuehren -- discharge[...]

... can thus at the same time be renamed intechnic.voc.

This means we have a sufficient selection ofdictionary files (BOOK.VOC, EXERCISE.VOC,eng2ger.voc and technic.voc) in place – I will leave

Pipe: written on the commandline as |, takes the standardoutput of the commandsstanding to the left of it andfeeds the command to theright-hand side.

11 · 2001 LINUX MAGAZINE 93

090answergirlsbd.qxd 29.06.2001 20:28 Uhr Seite 93

Page 87: linux magazine uk 11

BEGINNERS ANSWER GIRL

converting the rest to your inventive powers – andcan finally turn to a small script, which takes over thetranslation of words entered on the command line.

Look me up

Like (almost) every shell script it begins by specifyingwhich Shell we are using. Naturally the one withwhich we are most familiar, and that will usually bethe Linux standard shell bash:

#!/bin/bash -vx

94 LINUX MAGAZINE 11 · 2001

Turn around once

Of the four vocabulary files used here, BOOK.VOC displays one major difference from the others: The English term is on theleft, the German match on the right. Since the wb script from Listing 1 does not recognise that for example gestern –yesterday from eng2ger.voc and yesterday – gestern from BOOK.VOC is a duplicate for our purposes, it is presumably simplestjust to swap the columns in BOOK.VOC.

Like all the text modification exercises covered in this Answer Girl, there are several ways to achieve this goal. A few ofthem will be listed at this point by way of example.

Cut and paste

With cut columns can be extracted from a text file, which, with paste can be – and in reverse order, too - added back again.We explicitly specify the column delimiters with the option -d (“delimiter“). Unfortunately this can only be one character, nota character string, and that makes the whole thing somewhat fiddly:

[trish@lillegroenn eng_deu]$ sed -e “s/ -- /%/“ BOOK.VOC | cut -d “%“ -f 1 > /tmp/BOOK.VOC.1[trish@lillegroenn eng_deu]$ sed -e “s/ -- /%/“ BOOK.VOC | cut -d “%“ -f 2 > /tmp/BOOK.VOC.2[trish@lillegroenn eng_deu]$ paste -d “%“ /tmp/BOOK.VOC.2 /tmp/BOOK.VOC.1 | sed -e “s/%/ -- /“ > /tmp/BOOK.VOC.paste

In the first two lines we replace the true column delimiters in each case “--” with the working delimiter %. Line one, with cut -f 1, then fetches out everything on the left of the delimiting symbol, and writes it into the temporary file /tmp/BOOK.VOC.1.The same thing happens with the second column (-f 2) on the right of the delimiting symbol in line two – the output of thiscutting-out action with cut lands in /tmp/BOOK.VOC.2. If we give paste as first argument in the third line the second and assecond argument the first temporary file, we have swapped the columns from BOOK.VOC. Now just replace the percentagesign again with “--” and save the result of the swap action in /tmp/BOOK.VOC.paste. If everything has gone smoothly, theoriginal file can be overwritten with this.

Pearls and expressions

It is of course less fiddly, too - but then we step into the area of independent script languages such as Perl. Perl can be usedvery well with the -p option as a more powerful sed substitute. As with sed the -e option (“execute“) introduces a Perlcommand to be executed on the command line.

[trish@lillegroenn eng_deu]$ perl -pe ‘s/(^.*)( -- )(.*$)/$3$2$1/’ BOOK.VOC > /tmp/BOOK.VOC.perl

Everything (.*) from the start (^) of a line to the end ($) is to be replaced by a revised version. So that the content of the linesdoes not get lost, we save it in round brackets: the start of the line before the delimiter string “--” in the first buffer, “--” inthe second and the rest up to the end of the line in the third buffer. The whole thing is now replaced by the content of thethird buffer ($3), followed by the delimiter string from the second ($2) and the former line start from the first buffer ($1).

Make sure that you set the Perl Substitute command in single quotes (‘). Double quotes cause the shell to assume that$3$2$1 means the contents of shell, not Perl, variables.

As if it were (k)not a problem

The most elegant way is via awk. Contrary to paste, this tool can also manage with multi-character column dividers. All thesame, the delimiter here is specified with the option -F (“Field separator“).

[trish@lillegroenn eng_deu]$ awk -F “--” ‘{print $2 “--” $1}’ BOOK.VOC > BOOK.VOC.awk

The awk-“program“ in single quotes normally consists of a pattern, on which a command block is applied in braces. Since wemean the entire file, we need not specify any explicit pattern and settle for the bracket block.

In this we instruct awk to output the content of the second column ($2), then the delimiter string “--” and finally thecontent of the first column.

090answergirlsbd.qxd 29.06.2001 20:28 Uhr Seite 94

Page 88: linux magazine uk 11

BEGINNERSANSWER GIRL

Errors often occur when developing a script, whichis why we will first switch on the debug options -vx.

Provided /usr/dict/eng_deu contains onlyconverted dictionary files, we shall hold thisdictionary directory in the variable WBDIR:

WBDIR=/usr/dict/eng_deu

As with any script intended for more than oneperson, we begin with a call up test: If the userenters more or less than one search term asargument (thus “not equal“) to one...

if [ $# -ne 1 ]; then

... we simply spit out how our script ought to be used:

echo “Usage: $0 string“

Nicely enough, in the variable # a shell script recallsthe number of arguments with which it was calledup. In the variable 0 (null) can be found the resetargument, thus the command name itself (ifapplicable, with specified path).

On the other hand...

else

...we search in the vocabulary lists in thedirectory $WBDIR for the first command lineargument ($1):

grep -hw “$1“ $WBDIR/*

With the “Word option“ -w we ensure that greponly outputs something when the search word popsup as such (and not for example as part of anotherword) in the vocabulary lists.

In order to exclude typing errors in upper andlower case, we can also force grep to ignoredifferences between upper and lower case letters:

grep -hwi “$1“ $WBDIR/*

which means we really are finished and can closethe if construction:

fi

Issue execution rights to our wb script

[trish@lillegroenn /tmp]$ chmod ugo+x wb

and test:

[trish@lillegroenn /tmp]$ ./wb #!/bin/bash -vx

WBDIR=/home/trish/dict+ WBDIR=/home/trish/dict

if [ $# -ne 1 ]; thenecho “Usage: $0 string“

elsegrep -hwi “$1“ $WBDIR/*

fi

+ [ 0 -ne 1 ]+ echo Usage: ./wb string“Usage: ./wb string

Thanks to the verbosity option -v (“verbose“) theBash displays every single line, which it remembersto execute. The lines with the initial plus aresomething for which we can thank the -x(“extensive“) option, which also states each timewhat the shell really sees internally, if it hasperformed all the replacements (read out thecontents of variables). Last of all - and unfortunatelynot especially marked out - we also find the outputwith which we would have been faced without thedebug options in the wilderness - in this instance:Usage: ./wb string.

And the variant with one search word functions:

[trish@lillegroenn /tmp]$ ./wb yesterday[...]yesterday -- gesternonly yesterday -- erst gesternyesterday -- gesterngestern -- yesterdayvorgestern -- the day before yesterday[...]

No doppelgangers

This output clearly shows that we still have someplans for the script: We want to get rid of theduplicates. This is really quite a simple matter: sortthe output with sort (thanks to -f — “fold“ - withequal value for upper and lower case letters) anduse uniq to throw out the doppelgangers:

grep -hwi “$1“ $WBDIR/* | sort -f | uniq

Unfortunately, there is something wrong with this,because the test run produces

[trish@lillegroenn /tmp]$ ./wb yesterday[...]gestern -- yesterdayonly yesterday -- erst gesternvorgestern -- the day before yesterdayyesterday -- gesternyesterday -- gestern[...]

which may be sorted, but it is still not free fromduplicates. An investigation using ./wb yesterday >/tmp/test of the output diverted into the file/tmp/test with an editor comes up with: The soledifference between the two “yesterday -- gestern“lines is the Whitespace characters.

OK, then we’ll standardise all these (‘[:blank:]’)sfirst into spaces (‘ ‘) and simplify all space sequenceswith the tr option -s (“squeeze“) into a single one ineach case:

grep -hwi “$1“ $WBDIR/* | tr -s ‘[:Ublank:]’ ‘ ‘ | sort -f | uniq

Shell: The command lineinterface between users andtheir input devices and theoperating system. Most UNIXshells have a more or lesspowerful programminglanguage built in.$: Shells such as the Bourneshell (sh), Korn shell (ksh) orthe Bourne-Again-Shell (bash,under Linux also known as sh)reveal the content of avariable, if one places a dollarsymbol before their name.Whitespace: Collective termfor characters which misleadthe eye into believing “Thereis no character here“. Theseinclude space and tabcharacters.

11 · 2001 LINUX MAGAZINE 95

090answergirlsbd.qxd 29.06.2001 20:28 Uhr Seite 95

Page 89: linux magazine uk 11

BEGINNERS ANSWER GIRL

And yet the double line is still proving problematic: Ofcourse, because now we have, in one output noneand in the other precisely one space at the end of theline, which is bothering uniq.

So, with a sigh, we again pull out sed and replacea single space at the end of the line ($) with nothing

grep -hwi „$1“ $WBDIR/* | tr -s ‘[:Ublank:]’ ‘ ‘ | sed -e „s/ $//“ | sort -f | uniq

Et voila – at last the wb script (Listing 1) is ready togo to work. Now the debug options can go, androot can copy it to /usr/local/bin to be used byanyone. Since this directory is usually included in thePATH variable, it is now also sufficient to call up wbwithout specifying the path. ■

96 LINUX MAGAZINE 11 · 2001

Listing 1: The dictionary script wb

#!/bin/bash

WBDIR=/home/trish/dict

if [ $# -ne 1 ]; thenecho “Usage: $0 \“string string ...\“”echo “ $0 string“echo “ $0 regexp“

elsegrep -hwi “$1“ $WBDIR/* | tr -s ‘[:blank:]’ ‘ ‘ | sed -e “s/ $//“ | sort -f | uniq

fi

Value addedSharp-eyed readers may be wondering how, in Listing 1, one proposed line suddenly turned into three echo lines. Anyonewho has experimented a little with the script (or grep) will know that one can suggest to the shell, by including several stringsin quotes, that despite everything, there is only one argument involved.

As soon as users want to search for an expression consisting of several words, they simply have to place it in double quotes:

[trish@lillegroenn /tmp]$ wb “sich erinnern“recollect -- sich erinnern anremember -- sich erinnernsich erinnern --remember[...]

We should of course document this type of use:

echo “Usage: $0 \“string string ...\“”

So that echo does not wrongly interpret the quotes to be output as the delimitation of its own argument, they have to beescapt (stripped of their special position in the shell) with \.

The last echo line

echo “ $0 regexp“

on the other hand intends that grep, right from the start, looks not only for character strings, but also for regular expressions(“regexps“). This means for example that the user can elegantly skate over any uncertainties in terms of spelling:

[trish@lillegroenn /tmp]$ wb “ye.*y“ erst gestern -- only yesterdayFreibauern -- yeomanrygelbliche -- yellowlygestern -- yesterdayhefig -- yeasty[...]

searches for the translation of words beginning with ye and ending in y. The dot here stands for any character, and thefollowing * signals that any number of (at least none) should pop up from this.

The only thing to watch here is that with regular expressions, too, the saying applies: “Some are more equal than others.“Although the ground rules are the same, such as not all perl regexps can also be used with grep. It’s therefore often worthtaking a look at the grep man page...

090answergirlsbd.qxd 29.06.2001 20:28 Uhr Seite 96

Page 90: linux magazine uk 11

The majority of children positively enjoylearning to read and write, but it’s not just theslower or less interested ones who benefit froma little encouragement. Below we survey someof the large number of programs that benefitchildren in the learning of the three Rs. Youwill find most of the code on the cover CD.

The write thing

Typing tutors reinforce spelling as well as improvingkeyboard interaction. The classics are Typist andTypespeed, to which can be added Sam Hart’s TuxType. The excellent, Curses-based Typist, updated asa GNU package gtypist, is a little dull for youngerchildren. For those with a strong desire to learntouch typing on a qwerty or dvorak keyboard,however, it is well worth a look.

Typespeed has more entertainment value as youare challenged to type a word as it whizzes accrossthe screen. You can use the regular Englishdictionary or, if you are bringing your kids up as truegeeks, UNIX command words. It is a great challengefor older children or adults and has the advantage ofrunning on the command line and so needing verylittle in the way of resources.The speed and vocabulary put it beyond most under10s, although it’s a simple matter to make a juniorversion. Alternatively give xletters a go.

Whilst not really a touch-typing tutor, TuxTypingis certainly great fun for the kids. An SDL game, itfeatures funny sound effects and graphics (seefigure 2) which keep the young amused as theysend Tux chasing after his dinner by typing thecharacters or words written on fishes which fall fromthe sky. The graphics are appealingly cartoon-likeand the game makes an interesting counterpoint toGCompris (see Linux Magazine 9).In the same genrecan be found Linux Letters and Numbers

(LLN). LLN is a fun gamefor aged two and up. Clickon a letter and up pops apicture of somethingbeginning with thatletter (click on ”Z” forexample, and you may getzebra.png). You can add extra images of yourown.

It’s only words

Those who feel safest with a Graphic User Interface(GUI) may never have noticed the package bsdgames on their distribution disk, a collection of oldtext-based games which run from the commandline, or in an Xterm. As well as fun games likerobots and tetris there are the word games boggleand hangman.

Nineword is a Gtk version of those boggle-typepuzzles seen in newspapers, where words of four ormore letters must be made from the nine available.There is always a nine letter word to find.

Still with traditional games a Gnome clone ofScrabble - Gnerudite has been developed. It onlysupports one player for now, but has many usefulfeatures including a cheat mode to swap some ofyour letters if you are stuck.

SOFTWAREKIDS FOR LINUX

11 · 2001 LINUX MAGAZINE 97

Reading, wRiting and aRithmetic

EASYAS ABC

RICHARD SMEDLEY

Computers may never replace pen and paper,

but they can certainly complement

traditional methods of learning the basics.

SDL

Simple DirectMedia Layer is a cross-platform library for games development,providing fast access to the audio device and video card frame buffer. It supports allthe major desktop platforms and has bindings for most popular programminglanguages. Civilization: Call To Power and Mind Rover are among the better-knowngames dependent upon the library.The libsdl homepage contains a collection of bad jokes that your co-workers donot want to hear, so do not click on the link in this box.

097Kidssbd.qxd 29.06.2001 18:37 Uhr Seite 97

Page 91: linux magazine uk 11

GutenbergOnce your children are happily reading and writingit is time to switch off the computer (unless you arealways on) and head off down the library. Do notforget the library on the Net, though: ProjectGutenburg. Worthy of an article on its ownaccount, if you have yet to discover thismonumental venture then point your browser to it.

Starting with Alice Through The Looking Glassand Peter Pan, your children can work their waythrough every out of copyright text listed until theyhave finished the complete works of Shakespeareand Milton.

On the cover CD we have Project Gutenbook, aGPL’d Perl-Gtk browser for Project Gutenburg,which allows you to browse the archive, select anddownload a book, then read it. Those inspired tohelp out with the code may (or may not) be pleasedto know that the next release will be in Python.

Sum thing for everyone

We reviewed the flashcard arithmetic game,MathWar, a couple of months ago. Variations onthis theme are provided by Addpsx, first_math andMath Literature. Viewers of Channel 4’s Countdownprogram may like to practice with Anton, which

SOFTWARE KIDS FOR LINUX

98 LINUX MAGAZINE 11 · 2001

Info

SEUL/edu: http://www.seul.org/edu/linuxforkids website (no connection

with this column)http://www.linuxforkids.org/

linuxforkids cdrom available fromhttp://www.linuxemporium.co.uk

Debian junior: http://www.debian.org/devel/debian-jr/

Project Gutenburg: http://promo.net/pgProject Gutenbook (also on the CD):

http://www.gutenbook.org

[above left]Figure 1:

Easy as ABC...

[above right]Figure 2:

catch a falling word

[right]Figure 3:

A genius at vectordrawing

takes six random digits and asks you to combinethem with the four basic arithmetical operators toproduce a three figure target number. The programwill also present you with the best solution.

Of course there is a lot more to getting childreninterested in mathematics than putting themthrough their paces with arithmetical quizzes. Xaoswill introduce them to the beauty of fractals whilstsnowflake allows the creation of a graphicalcryptographic key, in the form of a snowflakepattern, from any series of characters – such as achild’s name.

Returning to the beauty of a challenge,Groundhog involves rotating tiles to align pipes,allowing little coloured balls to return along thepipes to the correct coloured cups. Not a strictlymathematical puzzle, perhaps, however gtans, a Gtkversion of Tangram, certainly is as some geometryrubs off on players along with creative puzzle-solving. Both games are suitable for quite youngchildren. For a stronger geometry ”fix”, try the GNUprogram Dr Genius. The name is one of those self-recursive acronyms beloved of geeks, standing for DrGenius Refers to Geometric Exploration andNumeric Intuitive User System (ouch). It combinesvector drawing with a strong interactive elementwhich many children will find involving. Now dive inand try some of these programs, but don’t forget tolet the kids have a go, too.

Resources

Many of the applications reviewed here can befound collected together on the Linux for Kids Website, along with arcade and strategy games and artapplications. Software is reviewed and rated, and anISO image of all the freely-distributable code isavailable. This CD may also be purchased cheaply inthe UK. Debian users (including Progeny andStormix) can find many of these applicationspackaged up by the Debian junior project, which wewill be examining in depth in a future issue. ■

097Kidssbd.qxd 29.06.2001 18:37 Uhr Seite 98

Page 92: linux magazine uk 11

SOFTWAREDESKTOPIA

The unwritten law

Anyone who has spent long enough over the pastfew years sitting in front of Microsoft Windows hasaccepted one tool on its desktop as part of hismental furniture. The clock is on the right at thebottom in the tray of the taskbar. KDE follows thispattern (GNOME, with its more recent versions, nolonger does) – it appears to be a current standard.But what do you do if you want to automaticallyhide this toolbar, but still want to know the time?And nor, by any means, does every UNIX desktophave this type of start menu or taskbar withintegrated timepiece.

Nevertheless, GNOME and KDE turn out in thisinstance to be considerably more flexible thanWindows: Their clocks are swappable applets,which can be moved, configured, removed oradded. But even these options for the twoenvironments do not exhaust the possibilities on aUNIX desktop: Larger clocks, which are easier toread, can still be placed anywhere on the desktopand thus make more room in any Start menu whichmay be in use. In any case, anyone who, in the oldUNIX tradition, screws his desktop together out ofumpteen individual tools, must certainly give somethought to the right clock. But separating the wheatfrom the chaff can be a very time-consumingventure, though constructing a clock serves foryoung programmers as a test bed for latersuccessful projects. A small and by no meanscomplete overview of some interesting clocks andtheir specialities is given here.

Basic training camp

First of all there are the two simple clocks whichbelong to the X Window system, xclock and oclock.Both are thus available practically everywhere andcan be configured completely via start parametersor Xresources.

While oclock presents itself as a simple,analogue and round clock (although withoutwindow frames and with a transparentbackground!), there is a strange feature in thesquare xclock, called up with the suffix ”-digital”,this also starts as such. But there is no need to findany deeper meaning behind this. Both displayvariants are very unfriendly and outmoded inappearance – essentially, they can also only beconfigured in terms of their foreground andbackground colours. If you want to use your owncolour scheme, you’d be better off with the plainoclock. Here each element can be assigned its owncolour – whether it’s the hour hand, or thenumberless dial frame.

11 · 2001 LINUX MAGAZINE 99

Jo’s Desktop

Only you can decide how your Linuxdesktop looks. With deskTOPia weregularly take you with us on a journeyinto the land of window managers anddesktop environments, presenting theuseful and the colourful, viewers andpretty toys.

Sometimes your internal clock is not

enough. And anyone who prefers not

to wear a watch on their wrist can

simply distribute clocks about their

environment. The Linux desktop is

the perfect place to start.

Jo’s alternative desktop

ROCK AROUNDTHE CLOCK

JO MOSKALEWSKI

Figure 1: xclock’s standard look

Figure 2: xclock -digital

099desktopiasbd.qxd 29.06.2001 20:31 Uhr Seite 99

Page 93: linux magazine uk 11

SOFTWARE DESKTOPIA

Punctuality

A far more elegant hermaphrodite is the buici-clock,which mainly comes with the Debian distribution(the program author is part of this project). Simplyround and frameless – like xclock, this too can onlybe configured in terms of position and size. Thecolours are pre-set and unchangeable – but since itsappearance is based on a railway station clock, thisis not a failing, but deliberate.

Finishing touch

Both buici- and oclock are really easy to use on thedesktop, all they need are the clearly-defined areaof the clock face. There is no background paintedaround them by these applications, and nor is therea window frame to spoil the picture. The digitalclocks described below are more difficult to designhere. Since these are usually letters, these have atext colour as well as a background colour. Certainlyinstead of the latter it would be nicer to have simpletransparency – but each and every programmerseems to be shirking this task more or lesssuccessfully. This is where the only thing that willhelp is a background colour that is similar to thedesktop image, or at least matching. Plus, acompletely different problem now arises. Since theyare not transparent anyway, the creators also forgoan unframed representation. Anyone who nowwants to not only click away or minimise his clock,but also wants to look at it on all virtual desktops,would be well advised to take a look in the WindowManager documentation. If this offers no solution,xnodecor may help (see box).

Goliath

With the xdaliclock the program author hasattempted to get round these problems at the nutsand bolts end – but by doing so, he has also createda few new ones. But the nice thing about this clockis that the numbers fade into each other (alsopossible when colouring). The only thing is, thenumbers have ended up really huge. Unfortunatelythis is also embedded into the program, so thatthere is no longer any option here for individualadaptation. But the author must be given credit forhaving planned in at least one ”transparent” mode– and also the windowless representation on thedesktop background – from the ground up.Unfortunately, it falls a bit short in the execution,which can easily be checked with a:

xdaliclock -root -transparent

xdaliclock immediately takes over the entire desktop– and at the same time it comes out, nottransparent, but coloured. If the clock is only calledup with the option -transparent and the drama withthe windows is left to the listing in the box, this onlyworks for a short time: xdaliclock reports back inlively fashion every minute to the window manager,and the magic of the transparency is countered bymarked representation errors.

David

For sheer undiluted joy, however, go to dclock: This,too, is digital, overlaps (apart from the seconds) thefigures with each other, is freely configurable interms of size, scope of representation and colour –and also offers an alarm function. One wouldalmost be tempted to say its perfect, butunfortunately there is no transparent mode. Figure8 shows this clock once with the standard defaultsin the window, and once completely configured andintegrated into the desktop (includingimplementation of xnodecor). The followingcommand parameters are especially interesting withthis clock:• -bg [color]: background colour• -fg [color]: foreground colour• -led_off [color]: colour of the inactive segments

of the LED display• -fn [font]: font for the date• -geometry -0-0: off in the corner with ...• -miltime -date ”%A, %d %B %Y”: • -seconds: displays seconds• -noblink: blinking ”:” avoid• -notails: 6 & 9 without ”crossbars”• -fade -fadeRate 100: fade in the figures• -slope [X]: place figures slanted by X%• -smallsize 0.5: show seconds half as high as

minutes• -nobell: switch off half-hourly ”alarm” ■

100 LINUX MAGAZINE 11 · 2001

Window frames? No thanks

If you find that your favourite clock is adorned with a nice window frameby your window manager and the latter offers no option for changing thiscondition then we recommend that you use xnodecor . This is very easy touse. To start the clock, you should not use the works-installed Autostartfunction of many desktop interfaces, but the user’s own start file ~/.xinitrcor ~/.xsession. This will start the clock first, and thus hide it from thewindow manager, which is only then to be started. Example of a start file:

dclock -geometry -0-0 &xnodecor -w dclocktwm

[left]Figure 4: Freshlypainted: oclock

[right]Figure 5: Stylish:

buici-clock

[top]Figure 6: xdaliclock

[below]Figure 7: Colorcycling &

overlapping numbers

Figure 3: Round object: oclock

Fig. 8: Two-fold copy of the dclock

099desktopiasbd.qxd 29.06.2001 20:31 Uhr Seite 100

Page 94: linux magazine uk 11

SOFTWAREOUT OF THE BOX

Following the release of Pingus, the open-sourceclone of the classic game Lemmings, the idea aroseof making the cute little penguins romp arounddirectly in the Root Window of the X-desktop.Robin Hogan has made it happen with XPenguins.

South Pole post

Before the penguins can start to romp around, theX11-Header files and the XPM library togetherwith header files must be installed. In manydistributions the corresponding packages are calledx11dev or x11-devel and xpm and xpmdev or xpm-devel. With an RPM-based distribution, such asMandrake, you can see if they’re installed with:

rpm -qa | grep -i xpmrpm -qa | grep -i x11

The XPenguins homepagehttp://xpenguins.seul.org/ has the source archivexpenguins-1.2.tar.gz ready for download. Once thisfile is on your hard drive, you can move on tocompile and install:

tar xzf xpenguins-1.2.tar.gzcd xpenguins-1.2makesu (enter root password)cp xpenguins /usr/local/bincp xpenguins.1 /usr/local/man/man1exit

Go Penguins!

If everything has gone smoothly with the compiling,you can let the penguins out in a terminal windowwith the command xpenguins -delay 100 &(Figures 1, 2 and 3). Of course, you can also enterthe same thing with a KDE or GNOME menu link.The option -delay 100 makes sure the little Linuxmascots don’t move too hectically across the screen.The command man xpenguins displays additionaloptions. If you unexpectedly get sick of the

11 · 2001 LINUX MAGAZINE 101

There are thousands of tools and utilities for Linux. ”Out of

the box” takes the pick of the bunch and suggests a little

program each month which we feel is either absolutely

indispensable or unduly ignored. This month we honour two

choice little morsels for the desktop, XPenguins and XCruise.

To Infinity and beyond

PENGUINS IN SPACE!

CHRISTIAN PERLE

Root Window: The background in the X Window system is managed as aseparate window. This window is known as the Root Window.Header files: Header files (also called Include files) list the functions available ina library together with parameters. The C-Compiler needs this information tocompile a program. In the most common distributions a header packet for alibrary usually carries the suffix dev or devel in its name.XPM: The ”X-PixMap” library. A collection of service functions to display colourgraphics (pixmaps) with the X Window System.Compile: A program in source code form cannot be executed by the operatingsystem. It is only by compiling (translating) it with a Compiler that it can beturned into a form which can be executed by the processor. One great advantageof the source code form is that the program can be compiled onto variousplatforms (Intel, Sparc, Alpha, etc.), if it has been programmed to be sufficientlyportable.&: The commercial ”And” (ampersand), entered as the last symbol in thecommand line serves to execute a command in the background. Otherwise theshell stays blocked until the command is ended.

Figure 1: Who’s that walking on the window?

Figure 2: Can penguins fly? - Yes, they can!

101ootbsbd.qxd 29.06.2001 20:35 Uhr Seite 101

Page 95: linux magazine uk 11

SOFTWARE OUT OF THE BOX

penguins, enter the deadly command killallxpenguins.

Deep Space

What was still a computer cliché in the film JurassicPark is starting to become a reality with XCruise:flying through the file system. Yusuke Shinyama ofJapan gives the user a three-dimensional view of thedirectory structure on the hard disk. Files are shownas planets, directories as galaxies and symboliclinks as wormholes.

XCruise does not act as a real file manager, asno manipulations such as deleting, renaming orcopying are possible. But anyone interested in justbrowsing the file system and seeing how files arelinked by means of symlinks, can fly around to herheart’s content. But - of course - the program mustfirst be installed.

The requirements for compiling XCruise areeven more modest than those for XPenguins. Onlythe X11 header files have to be installed. The sourcearchive can be obtained from the site http://tanaka-www.cs.titech.ac.jp/~euske/prog/index-e.html. tocompile and install, enter the following commands:

tar xzf xcruise-0.24.tar.gzcd xcruise-0.24xmkmf -amakestrip xcruisesu (enter root password)cp xcruise /usr/local/bin ; exit

Navigation

Once installation is complete, start XCruise with thecommand xcruise & in a terminal window. Control itwith the left and middle mouse buttons to fly back

and forth. Specify the direction of flight using thecross-hairs. You can also freeze the image with fand quit the program with q.

The file system is displayed according to aspecific scheme: directories are white or blue rings(galaxies), and you can fly into these. Normal filesare shown as filled-in circles (planets) with variouscolours and symlinks as green threads (wormholes),which link the respective file or directory objectstogether, even across vast distances. Once you flyclose enough to a directory, its content becomesvisible. In Figure 4 you can see the approach to the/etc directory.

The size of a file defines the diameters of theplanets displayed. If a planet appears coloured inviolet, the user has no read privileges for theassociated file. Files with similar names have theresult that their planets are located close to eachother. Figure 5 shows a whole bundle of symlinks,which all point from /etc/alternatives to /usr.

For anyone who has now acquired a taste forthis and is on the look-out for more desktopgimmicks, Jo Moskalewski’s Desktopia column isjust a couple of pages away. ■

102 LINUX MAGAZINE 11 · 2001

Symbolic Link: (Symlink forshort) Unix file systems offer

the option of makingreferences to files; these

references appear at differentplaces in the directory tree and

provided they have equalrights, allow access to the

original file as long as this hasnot been deleted or renamed.

With the command ln -s foobar the file foo can also be

accessed under the name bar.Alternatives: A speciality of

the Debian distribution. Forexample, when several clonesof the vi editor are installed -such as elvis, vim and nvi - it is

possible to use this mechanismto select an alternative (such

as elvis) as default.vi: The standard text editor

under Unix systems. It iscertainly not exactly intuitive

to learn, but it does offermany useful functions. A vi

reference sheet can be foundat http://www.bembry.org/tech/linux/vi.shtml

Figure 3: A labyrinth can quickly be constructed out of xterms (Screenshot from the

Project homepage)

Figure 4: /etc in your visor

Figure 5: All roads lead to /usr

101ootbsbd.qxd 29.06.2001 20:35 Uhr Seite 102

Page 96: linux magazine uk 11

Presented with an old laptop with no OS, no CDdrive and no network card, I pulled out my QNX4demo diskette and an old serial modem and fiveminutes later I was browsing Project Gutenburgwith the Voyager Web Browser. The browser, GUI,TCP/IP and OS, along with a web server, dialer, wordprocessor, Tower of Hanoi game and vector graphicsdemo fit on a single 1.44Mb floppy disk and madebig news when QNX first did this a couple of yearsago. It is still useful for getting online quickly today,when confronted with an old PC and no easy installmethod for a Linux distro.

Of course the demo disk is more than just agimmick. It is a demonstration of how flexible amodular (unix-type) architecture, running on a

microkernel can be. As well as being a Real Time OS(see last month’s column), QNX Neutrino - the latestversion of the OS.

Why QNX

The big advantage that QNX has over manyembedded and RealTime rivals is self-hosting - thedevelopment platform and target platform are thesame (see figure. 1). Combine this with an openand familiar API (Posix) and free (in every sense ofthe word) development tools, courtesy of GNU andthe Free Software community and you have an easyto develop for and powerful platform. If the RealTime variants of Linux (see last month’s column) are

COMMUNITY FREEWORLD

106 LINUX MAGAZINE 11 · 2001

Microkernel architecture

The microkernel includes only a small set of core services within the kernel, including thread services, message passing,condition variables, semaphores, signals, and scheduling. The kernel can be extended by dynamically plugging in service-providing processes, such as file systems, device drivers, POSIX message queues, and networking. These services run in userspace and benefit from protected memory.Throughout the 1980’s microkernel architecture was taught as state-of-the-art in OS theory classes at universities accross theworld. The Hurd, the kernel for the Free Software Foundation’s GNU OS was started in this period. However getting multi-threaded servers to pass messages to each other is particularly difficult to implement correctly, and although the underlieing Machmicrokernel was (eventually) available as a free, debugged base, Hurd development was (and still is) fairly slow. Ten years ago,when Linus Torvalds wanted to run Unix on his i386, the quickest solution seemed to be a monolithic kernel. Although the puristspoured scorn on the idea at the time, readers of this publication have a fair idea of the subsequent success of the Linux kernel :-)We will, nonetheless, return to microkernel architecture in greater depth in future columns. As QNX Neutrino shows, donecorrectly it has great potential for a GNU-based OS.

Figure 1: Fast, light and

flexible.

Small in stature, but big at heart

QNX, ANYSIZE YOUWANT

RICHARD SMEDLEY

The Hurd is unfortunately a long way from a finished product, and many Linux fans

continue to mock the idea of microkernel architecture. Nevertheless one company has

successfully shunned monolithic kernels for decades: QNX.

106freeworldsbd.qxd 29.06.2001 20:36 Uhr Seite 106

Page 97: linux magazine uk 11

not yet powerful or stable enough for you, and yourcustomer base will bear the licence cost (and theyusually will in traditional embedded fields) then youmay find yourself severely tempted.

QNX Neutrino has become the OS of choicefor everything from fledgling Internet Appliancesto what the Guiness Book of Records calls ”themost intelligent robot” in the world, Cog, at MIT’sArtificial Intelligence Lab. Designed to mimic theway humans react with and learn from theirenvironment, Cog uses a QNX-based distributedcontrol system to support its ”realtime visual andauditory requirement” - camera ”eyes” andmicrophone ”ears” are placed in the sameposition as on a human face and Cog learns aboutits environment in a similar fashion to a baby. Thedistributed architecture and transparentnetworking enable the eight QNX nodes to beaccessed and developed simultaneously bystudents and researchers in the lab, or fromhome. The performance has impressed the AI labenough to move all of its robot research onto theplatform.

No X word

Another advantage is the embedded GUI, Photon.The X server/ client architecture, common to all Unixsystems, has many advantages but is far too big formost embedded systems. The modular approach tothe GUI means that it has the smallest possiblememory footprint, whatever the application, andcan be used in many multimedia applications.Naturally it works over TCP/IP too.

The ability to distribute components across anetworked environment is inherent in the system.With no user involvement QNX Neutrino can sharedisks, modems or even processors accross yournetwork. Whilst it scales up to huge distributed SMPsystems, it is also an advantage in systems withlimited resources. In the home entertainment sectorthis ability could speed the long-heralded”convergence” of comms, computer and audio-visual equipment into a low-cost distributed

environment where every multimedia service isavailable ”on tap” around the house, and thesystem just works.

QNX vs. Linux

With a proven track record in everything from life-critical medical instruments and emergency callcentres to traffic control and supermarket POS(Point-of-Sale) QNX Neutrino is a tough competitorfor the embedded Linux solutions providers.Although the licence is restrictive, it is a lot moreopen than most of the proprietary Unices, enablingone to dig into the code and construct just thesystem one needs. However the truly free Linux-based Real Time solutions, as well as Freealternatives such as ECOS, are strongly competitivewith QNX Neutrino. The embedded space continuesto be every bit as interesting as the Desktop market,and it will be an interesting test of the Free Softwaremodel to see how the Open-Source-but-not-freemodel of QNX holds up. ■

Figure 2: More than justa toy

COMMUNITYFREEWORLD

11 · 2001 LINUX MAGAZINE 107

Microkernel on a mini disk

QNX has a modular microkernel architecture which means that distributions canbe custom made with only the services needed. Even the Photon Windowingsystem on the demo disk only occupies 45K with additional processes loaded aneeded. As there is no room for the myriad of common drivers needed forcompatibility with desktop PCs, a ”flat” driver uses the frame-buffer memory ofthe graphics card, mapping it into the high-memory space of the processor.The largest application on the disk, at 400K, is the HTML3.2-compliant browser,Voyager. This understands frames, Javascript and animated GIFs. The full version in theNeutrino distribution has all the plug-ins (Real Player, Flash, et al.) that are needed.If you want to give it a go, visit the site and download the appropriate version.There is one for network connections and one for computers with a serial, ISA orpcmcia modem. Untar the download then copy the image to the floppy by simplyrunning the makedemo shellscript included. It is as simple as that.Now stick the floppy in the drive of any PC - Minimum specification is a 386PC with 8Mbof RAM and a colour VGA display - and switch on. The OS boots and loads a compressedimage to RAM from where processes are decompressed and loaded on-the-fly asneeded. It will not overwrite your hard disk - you don’t even need a hard disk to run it.

Licensed to what?

It is with some trepidation that one approaches the maze of licences around QNX in all itsforms. The QNX Community License and QNX Open Community License enable derivativeworks to be based upon QNX code, and royalties collected from customers for use of thecode. Those who wish to probe the intricacies of the Custom License Certificate (CLC)Program should head over to http://licensing.qnx.com.In addition to proprietary RTOS code QNX development is very much dependent upon GPLutilities such as awk, rcs, gmake, gzip, and sed. The company see their product - and theirlicensing model (with its ”traditional” view of IP - Intellectual Property) as very muchcomplementary to Linux. Indeed there is a great deal of sharing of applications anddevelopers between the two platforms. However, for many, the licences will be the stickingpoint. Readers may be pleased to note that next month’s posix compliant column will returnto GPL’d OS’s.

Info

QNX demo and ISOs of full systemfrom http://www.qnx.com/(Register at http://get.qnx.com/)Hurd: http://www.gnu.org/Debian GNU/Hurd:http://www.debian.org/

106freeworldsbd.qxd 29.06.2001 20:36 Uhr Seite 107

Page 98: linux magazine uk 11

COMMUNITY BRAVE GNU WORLD

108 LINUX MAGAZINE 11 · 2001

Welcome to another issue of Georg’s Brave GNU World. This

month I’ll make the philosophical background a central

issue focusing on the question of commercial Free Software.

But first I’d like to introduce a few projects.

TuxFamily.org

Julien Ducros has started the ”TuxFamily.org”project with a group of volunteers. The inspirationfor this was the American SourceForge project,which provides a central infrastructure fordevelopment and presentation (like Web server, FTPserver, CVS server and so on) to projects.

It is the belief of Julien Docrus that theEuropean and African community also need such aservice on their continent. This is what the FrenchTuxFamily project wants to provide.

TuxFamily itself is clearly oriented stronglytowards Free Software. The software used forhosting (vhffs) is published under the GNU GeneralPublic License itself. Additionally the TuxFamily onlyaccepts projects that qualify as Free Software.

So projects looking for a new home mightconsider joining the TuxFamily.

Chrooted SSH CVS-Server HOWTO

Very often relatively small companies are doing goodwork for Free Software whilst being almostcompletely unknown outside their respectivecountries. The French company Idealx is one of them.

On the community homepage of Idealx severalinteresting modules and documents about FreeSoftware can be found. They solve several standardproblems and of course everything is availableunder the GNU General Public License and the GNUFree Documentation License.

Among the packages is a Python module whichallows creating calendars in CGI-scripts. A XML-customizable CVS-notify script to automatizeactions during check-in of new versions or a bindingof Erlang to Python can also be found.

A very interesting document is also a Howtowritten by Olivier Berger and Olivier Tharan, whichdeals with the set-up of a very secure and well-insulated CVS server.

Programmers normally know of the advantagesof the ”Concurrent Version System” (CVS), butCVS is a tool many people underestimate, so I’ll givea short introduction.

It should be common knowledge that softwareis normally written in the form of source code. Thissource code is improved by one or several authorsduring the development process. When doing this,the problem of coordination of several developersarises because normally every developer will besitting at his personal machine to make changesthere. This means that source code often changessimultaneously at different places.

To solve this problem, CVS (like other ”versioncontrol systems”) has a central gathering point, theso-called ”repository.” Every developercommunicates directly with the repository, receivingupdates by others or submitting their own changes.Of course it can happen that two authors changethe same part, but the different ways to resolve oravoid such conflicts are not important right now.

What is important is that the CVS repositorydoes not just contain the current version, it alsosaves every change. That way the development

The monthly GNU Column

BRAVE GNU WORLD

GEORG C.F. GREVE

108Gnuworldsbd.qxd 29.06.2001 20:38 Uhr Seite 108

Page 99: linux magazine uk 11

process can be tracked step by step later. Also, it isis possible to go back to old versions in order tofork a project and have different developmentprocesses run in parallel with the option to mergethem again later.

All this is not just relevant to developers.Considering the fact that source code are simpleASCII files in most cases, it is immediately obviousthat this can be used for any sort of data, especiallyif it can be expressed in text-only form.

Web sites, documents, email-archives and muchmore are perfect areas for the use of CVS.

The neuralgic point of a CVS server are itsaccess rights. There are several possibilities for thisthat have different levels of security. In most casesan account on the CVS server requires an accounton the system and some methods of authenticationtransmit passwords in clear text, so they can easilybe read by others.

Even when this is being avoided by using SSH, itis very often not desireable to give every CVS-userfull access to the system.

The Howto mentioned above describes verywell how to configure several CVS servers in parallel

COMMUNITYBRAVE GNU WORLD

11 · 2001 LINUX MAGAZINE 109

Autogen

The Chrooted web site

108Gnuworldsbd.qxd 29.06.2001 20:38 Uhr Seite 109

Page 100: linux magazine uk 11

on a server while only granting users the necessaryrights to access the specific repository. This shouldallow the majority of intermediate users to install asecure CVS server on their machine in order to usethe advantages of CVS mentioned above.

AutoGen

It is always a pleasure to introduce new GNU-Projects. The one I would like to introduce thismonth is AutoGen by Bruce Korb. It is a tooldesigned to make creating and maintainingprograms with large amounts of repetitive text quitecomfortable.

A classic example for this are loops for thecommandline evaluation. In the worst case, text isrepeated with cut & paste for every option in orderto put the values in some place where otherfunctions that need them will be able to find them.Since this is very much a standard problem,AutoGen has template called ”AutoOpts” for this.

AutoGen does bear certain similarities with m4,the traditional UNIX macro processor. But it issuperior to m4 in many aspects like a simplified wayof adding new parameters to functions. AlsoAutoGen supports nested collections of values.Because of this, Gary V. Vaughan, the most activedeveloper of AutoGen besides Bruce Korb, would liketo see autoconf start using AutoGen instead of m4.

According to Bruce one of the special strengthsof AutoGen is the clear separation of templates anddefinitions, because this makes the templates muchmore flexible. Also all data is address by names, notpositions, which allows restructuring and resortingfiles. On top of this old definitions can becomeobsolete without having to change old files which

increases compatibility. And of course all definitionscan be nested.

Through variables marking the locations forreplacements it can be defined with the help of keywords which parts are being left out or repeated.AutoGen also has much better ways of controllingthe output than the C-preprocessor.

When asked about the disadvantages ofAutoGen, Bruce Korb says that it is widely unknownand it is also much too easy to let templates looklike hieroglyphs. The static evaluation of definitionsis currently the biggest limitation of AutoGen, but itis planned to make this dynamic in future versions.

Besides this AutoGen is pretty much finishedand so mostly feedback to increase the portability isneeded. So far it is known to run on GNU/Linux,BSD, SVR4-5, HPUX, SCo OpenServer and Solaris aswell as Windows NT provided CygWin is installed.

Although AutoGen itself is licensed under theGNU General Public License, some add-ons areunder the LGPL and FreeBSD license or publicdomain.

Free Software andCommercialization

I have received mail about this topic for instanceby Tommy Scheunemann, who asked about”Industy and GPL” and on the discussion mailing listof the FSF Europe a pretty controversial debateabout whether it was legitimate to make moneywith Free Software has taken place. This made meaware that there are still some open questions inthis area.

Before the question about commerce and theinteraction with industry can be understood, it is

COMMUNITY BRAVE GNU WORLD

110 LINUX MAGAZINE 11 · 2001

Where all your GNU funshould begin

108Gnuworldsbd.qxd 29.06.2001 20:38 Uhr Seite 110

Page 101: linux magazine uk 11

mandatory to take a look at the definition of FreeSoftware. The first step is always to understand that”free” in Free Software does not stand for ”gratis”but rather for ”freedom.”

But what freedom does this refer to? The mostprecise definition for Free Software are the fourfreedoms of the Free Software Foundation. The”Debian Free Software Guidelines” were derived ofthese and have provided the base for the ”OpenSource Definition”. Technically, all three definitionswere written to describe the same licenses. Becausethe four freedoms are the most compact definition Iwill only be talking about them, however.

The first freedom is to be able to use a programfor any purpose. Restricting the use in any waywould immediately mean a program does notqualify as free software.

The second freedom allows to study a programin order to learn how it works and to change itaccordingly to ones own needs. Having access tothe source code is a precondition for this.

Freedom No.3 allows to make copies and passthem on while Freedom No.4 is the sum offreedoms 2 and 3. It says that you must have thefreedom to pass on improvements for the benefit ofothers. Like freedom 2 this requires access to thesource code.

It is important to be aware that having thefreedom to do something also includes the freedomto not do it - which applies especially to freedoms 2,3 and 4. There is no obligation to copy or modify aprogram and also no obligation to pass it along. Infact the requirement to make changes public waswhat let the ”Apple Public Source License” fail toqualify as a Free Software license.

The question whether a piece of software isFree Software or not is decided by its license. Of thelicenses for Free Software, the GNU General PublicLicense is the most widely used. Besides the GNULesser General Public License, which is a variation ofthe GPL, the FreeBSD license has the biggestpractical importance.

So what about commercialisation? FreeSoftware very deliberately does not make adifference between commercial and non-commercial use. A limitation for commercialpurposes would even violate the first freedom - soFree Software is always also commercial. Combinedwith the knowledge that there is no requirement topass it on, it immediately becomes clear that FreeSoftware can even be sold.

It should be clear now that Free Software can becommercial although it doesn’t have to.

The currently predominant commercial modelfor software in the industry is the proprietary one,where the price is artificially raised by limiting thesefreedoms. So a company could be tempted to takeaway the freedoms to shortly increase its bottomline.This happens in two ways. Licenses like the FreeBSDlicense are based on the assumption that noone

would put his personal interests above the interestsof the public. They deliberately allow proprietaryrelicensing.

The GNU licenses have a ”proprietarisationprotection” to avoid this. If you directly base yoursuccess on the work of others, you cannot releasethe result under a proprietary license.

The only program to go back to the proprietaryscheme in this case is to write modules that aretechnically isolated from the original program,which requires additional work and is not alwayspossible.

In both cases the proprietarised end-product isnormally sold as ”value-added” software with thegoal to convince the user to give up his or herfredoms. This can happen commercially or non-commercially.

So despite the protection offered by the GPL, inthe end only the awareness of the users can preventthe return to the proprietary model.

To summarize: without question there iscommercial Free Software just as there is non-commercial Free Software. It is a question of choice.Instead of being distracted by this question weshould rather make sure to not lose track of thefreedom as it is the fundament of the wholemovement.

Enough for this month

Okay, that’s it for this issue. I hope the question ofcommercial Free Software has become clearer nowand I managed to explain things in anunderstandable way.

As usual I am requesting comments, questions,ideas, inspirations and project introductions to theusual address. ■

COMMUNITYBRAVE GNU WORLD

11 · 2001 LINUX MAGAZINE 111

Info

Send ideas, comments and questions to Brave GNU World [email protected] page of the GNU Project http://www.gnu.org/Home page of Georg’s Brave GNU World http://brave-gnu-world.org”We run GNU” initiative http://www.gnu.org/brave-gnu-world/rungnu/rungnu.en.html”Tuxfamily.org” home page http://www.tuxfamily.orgSourceforge home page http://www.sourceforge.netIdealx community home page http://www.idealx.orgChrooted SSH CVS-server HOWTO http://www.idealx.org/prj/idx-chrooted-ssh-cvs/dist/Concurrent Versions System (CVS) home page http://www.gnu.org/software/cvs/AutoGen home page http://autogen.sourceforge.netGNU m4 home page http://www.gnu.org/software/m4/The FSF Free Software Definition http://www.fsf.org/philosophy/free-sw.htmlDebian Free Software Guidelineshttp://www.debian.org/social_contract#guidelinesOpen Source Definition http://www.opensource.org/docs/definition.htmlFree Software licenses http://www.fsf.org/philosophy/license-list.html

108Gnuworldsbd.qxd 29.06.2001 20:38 Uhr Seite 111