linux magazine uk 20

Page 1



COMMENT

General Contacts General Enquiries Fax Subscriptions Email Enquiries Letters CD

01625 855169 01625 855071 www.linux-magazine.co.uk subs@linux-magazine.co.uk edit@linux-magazine.co.uk letters@linux-magazine.co.uk cd@linux-magazine.co.uk

Editor

John Southern jsouthern@linux-magazine.co.uk

Assistant Editor

Colin Murphy cmurphy@linux-magazine.co.uk

Sub Editor

Gavin Burrell gburrell@linux-magazine.co.uk

Contributors

Alison Davies, Richard Ibbotson, Dean Wilson, Frank Booth, Jack Owen, Steve Cobrin, Steven Goodwin, Janet Roebuck, David Tansley, Bruce Richardson

International Editors

Harald Milz hmilz@linux-magazin.de Hans-Georg Esser hgesser@linux-user.de Ulrich Wolf uwolf@linux-magazin.de

International Contributors Björn Ganslandt, Georg Greve, Jo Moskalewski, Anja Wagner, Patricia Jung, Stefanie Teufel, Christian Perle, Nico Lumma, Carsten Zerbst, Tim Schurmann Marianne Wachholz, Design

Advanced Design

Production

Rosie Schuster

Operations Manager

Debbie Whitham

Advertising

01625 855169 Kenny Leslie Sales Manager kleslie@linux-magazine.co.uk Verlagsbüro Ohm-Schmidt Osmund@Ohm-Schmidt.de

Publishing Publishing Director

Robin Wilkinson rwilkinson@linux-magazine.co.uk Subscriptions and back issues 01625 850565 Annual Subscription Rate (12 issues) UK: £44.91. Europe (inc Eire) : £59.80 Rest the World: £77.00 Back issues (UK) £6.25

Distributors

COMAG, Tavistock Road, West Drayton, Middlesex England UB7 7QE

Print

R. Oldenbourg

Linux Magazine is published monthly by Linux New Media UK Ltd, 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 whole or in part without the written permission of the publishers. It is assumed that all correspondence sent, for example, letters, emails, faxes, photographs, articles, drawings, are supplied for publication or license to third parties on a non-exclusive worldwide basis by Linux 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 Disclaimer Whilst every care has been taken in the content of the magazine, the publishers cannot be held responsible for the accuracy of the information contained within it or any consequences arising from the use of it. The use of the CD provided with the magazine or any material providied on it is at your own risk. The CD is comprehensively checked for any viruses or errors before reproduction. Technical Support Readers can write in with technical queries which may be answered in the magazine in a future issue, however Linux Magazine is unable to directly provide technical help or support services either written or verbal.

Current issues

RIGHTS AND WRONGS T

he European Union Copyright Directive is aiming to restrict our rights by limiting the usage of copyrighted works to whatever the owner decides. So you could buy a CD and it would only be legal to play it on a music centre but not on a PC, or to copy it to some other format, like compact cassette, to play in the car. Within the directive (Passed in May 2001) was the phrase “Rights-Management Information”. This means that your private usage is limited. A side effect will enable proprietary file formats to limit what you can do. We could end up with a licence saying you cannot use our software if you criticise us, or any of our friends and so ending any form of free speech and democracy. But no one would do that now, would they? It is May and so before the summer sun takes its toll and forces us outside and away from our screens, a flourish of Linux activity is about to occur. Lots of projects are churning new versions. Mozilla is soon to launch version 1.0, which will mean the browser will have come a long way in usability and stability. Next we can all install the latest distributions to keep up with security and applications. The fact that they usually come with new toys is either a distraction or bonus depending on your mood and who is in the room with you. We also have the annual Linux Installdays arranged by the Dorset user group where we can all help spread the word and help one another. Happy Hacking

John Southern Editor

We pride ourselves on the origins of our magazine which come from the very start of the Linux revolution. We have been involved with Linux market for six years now through our sister European-based titles Linux Magazine (aimed at professionals) 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 of all the knowledge and technical expertise of all the major Linux professionals and enthusiasts. No other 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.

Issue 20 • 2002

LINUX MAGAZINE

3


NEWS

LINUX NEWS Linux wants YOU If you’re looking to do a Linux install for the first time, but have been put off by a fear of the unknown, then the Linux Install Day 2002 is just for you. Experienced Linux users around the country will be setting up workshops, giving new and inexperienced users the chance to go through Linux installations, even on their own hardware if they have managed to bring it along, or, at the very least answer questions and give encouragement for later.

Two big days have been planned, Sunday 19 May and Sunday 9 June, though some of the local Linux User Groups have chosen Saturdays or other days around that time. The UK has 60 or more such groups, just see our User Group pages in the back of the magazine, and most will be arranging something around the Install Day.

Info Linux Install Day 2002: http://www.linuxinstallday.org/

SmoothWall – IPCop clarification In last month’s Linux Magazine we ran a feature on IPCop (Issue 19, pages 24-25). We failed to mention that the current version of IPCop (v0.1.1) is fruit born out of the SmoothWall project. IPCop started life as a fork from the SmoothWall project after disagreements over licensing. The current IPCop is mainly the work of Laurence Manning, the principle author of SmoothWall, and Pierre-Yves Paulus also from SmoothWall. While the IPCop project is trying to move the project on in a different direction, we feel it is important to also

appreciate the history, time and commitments made. If that wasn’t not bad enough, when we ran an interview with Richard Morrell from SmoothWall in Issue 15 we managed to misspell the names of Ted Ts’o and Joe Arruda. Apologies all round.

Info SmoothWall: http://www.smoothwall.org/ Slashdot discussion:http://slashdot.org/articles/ 02/03/17/1332207.shtml IPCop: http://www.ipcop.org/

Secure console management Minneapolis-based Digi International, which has offices in Bristol, has introduced the new PortServer CM – a product line focused on the demanding requirements of data centre managers. The PortServer CM enables system administrators to monitor and control IT equipment such as UNIX and Linux servers, routers, network switches, intelligent power supplies and telephone switches, through serial console ports. Administrators can securely access any mix of these devices via TCP/IP connections over Ethernet LANs or dial-up modem 6

LINUX MAGAZINE

Issue 20 • 2002

connections. Administrators will find the embedded Linux OS a comfortable and flexible environment from which to manage and monitor their IT equipment. The PortServer CM incorporates Secure Shell (SSH v2 or v1), a robust, standardsbased security protocol, to protect against unauthorised monitoring, i.e. sniffing, by unauthorized users. The PortServer CM also provides access to approved users on a per port basis. Access to the PortServer CM may be further restricted through the use of the firewall functionality of the IP filtering feature. Additional features of the PortServer CM

include clustering, the ability to manage up to 512 console ports from one master PortServer CM. The radius client provides port specific access and moves all the user information to a central server on the network. For direct access to a specific port, the user can choose to Reverse Telnet or assign each port a separate IP address. The PortServer provides a Web-based GUI that supports HTTPS for those who prefer to securely manage the device through a browser.

Info Digi International: http://www.digi.com


NEWS

Programming with Qt Qt remains one of the niftiest toolkits for building graphical user interfaces (GUIs) in Linux, Unix and even Windows. Its applications are environmentportable, it’s included in most recent Linux distributions, it’s much easier to use than the standard Motif toolkit for Unix systems, and it provides Windows users with native-looking interfaces. Frustrated by the lack of a good tutorial-style manual when Qt made its debut, author Matthias Kalle Dalheimer crafted the first edition of “Programming with Qt,” which has become a much thumbed-through tome on many a programmer’s bookshelf. Dalheimer’s motivation for updating “Programming with Qt” for Version 3 was the fact that “the Qt landscape has changed considerably since the first edition was published. It is no longer a niche product, but one that is widely used. Especially the embedded version, Qt/Embedded, has brought Qt into many new places, so the need of a good tutorial-style introduction (but also of some more advanced programming topics that I also cover) is even more pressing than before.” “Programming with Qt, 2nd Edition” shows how to use all of the Qt GUI elements, and covers advanced topics like 2D transformations and drag-

Panasonic takes stake in MontaVista Matsushita Electric Industrial (MEI) has, through its subsidiary, Panasonic Digital Concepts Center (PDCC), taken a stake in the embedded Linux specialist MontaVista Software. “As embedded applications become more network-oriented, consumer electronics companies are looking to Linux as a robust and cost-effective development platform,” said Charles C. Wu, Managing Director of Investments for PDCC. “Panasonic Digital Concepts Centre recognises the tremendous traction that MontaVista has gained in the increasingly important area of embedded software solutions. We look forward to a strategic relationship that will meld MontaVista Software’s strengths with Panasonic’s global leadership in consumer electronics.” MEI joins a list of high-profile 8

LINUX MAGAZINE

investors, including IBM, Sony, US Venture Partners and others, who also invested in MontaVista Software in its third round of funding announced earlier this year. “Consumer electronics and communications infrastructure are the two markets we believe hold the most opportunity for Linux,” said Jim Ready, MontaVista CEO and embedded industry pioneer. “Manufacturers of high-volume, competitively priced consumer electronics devices especially appreciate the non-proprietary nature of Linux, which does not lock them in to paying royalties and licensing fees.”

Info MontaVista Software: http://www. mvista.com/ Funding information: http://www. mvista.com/news/2002/MV_Fund.html

Issue 20 • 2002

and-drop. The book contains exercises and fully worked-out answers to make learning easy, debugging hints, and instructions for reading and writing XML documents. Among the many features adding value to the second editions a new chapter on network programming. What’s Dalheimer’s prediction for the future of Qt? “This might seem pretty bold, but I believe that in one or two years from now, at least in the embedded space, Qt will be the most often used toolkit which in turn will also give its desktop (Windows, Unix/Linux and Mac OS X) versions another boost. Consequently, I would expect ‘Qt programming experience mandatory’ in job ads to be as common as the ‘Java programming experience mandatory’ or ‘MFC programming experience mandatory’ is today.”

Info O’Reilly (UK): http://www.oreilly.com/catalog/prowqt2/

Dates announced for Linux Expo UK 2002 Clear your diaries now, as the 9-10 October see the return of the Linux Expo UK 2002 to Olympia in London, following on from the success of last years bash. Now in its fourth year, Linux Expo is the UK’s largest exhibition and conference dedicated to this open source revolution. It brings together all the major players in the Linux computing sphere to provide the definitive review of all the latest products and services emerging around this rapidly developing technology. If you are evaluating the importance and impact of Linux technology on your IT infrastructure, you can meet over 80 international players who are leading the Linux revolution. From development tools, e-commerce, security and Internet tools to Linux-based training and support; this is your unique opportunity to discuss your Linux issues directly with the industry leaders.

Info Linux ExpoUK 2002: ttp://www.linuxexpouk.co.uk/


NEWS

Fire and Lightning Lightning, the Swiss-based network security appliances and solutions company, has introduced its MultiCom Enterprise Ethernet. This enterpriselevel firewall appliance delivers stateful inspection firewall technology, unlimited node security, and IPSec VPN connectivity. The MultiCom Enterprise Ethernet responds to the demands of medium and large businesses wishing to securely connect to the Internet and to remote sites through secure, extended networks. Gilles Trachsel, Product Marketing Manager of Lightning said: “Lightning presents the MultiCom Enterprise Ethernet to the enterprise sector as a cost-effective alternative to current firewall appliances on the market. This product responds to the demands of our customers requiring a highquality, cost-effective solution that offers maximum security, high performance, integrated switching and separate DMZ interface.”

Info Lightning Instrumentation: http://www.lightning.ch/

Software Ag Linux commitment Software Ag is showing off its Tamino XML Server, now that it runs on Red Hat Linux 7.2, SuSE Linux 7.2 and SuSE Linux Enterprise Server 7 for IA-32. This enhanced Linux support underscores its commitment to the popular Open Source operating systems. The IBM S/390 mainframe family has been supported by SuSE Linux Enterprise Server 7 and Tamino XML Server since last year. Tamino XML Server is a high-performance platform for managing data via the Internet and Intranets. Software Ag’s XML server manages information of all types – within and across organisations. In particular unstructured data, whose content was previously very difficult to standardise, can be managed efficiently with Tamino. XML enables the universal and platform-independent exchange of business documents and data between customers and business partners.

Info Software Ag: http://www.softwareag.co.uk/casestudies/ Issue 20 • 2002

LINUX MAGAZINE

9


NEWS

Wireless injection for the NHS Remote heart monitoring, doctors given access to patient records and ambulances guided by satellite navigation systems, all from a single hand held device: according to Compaq, this is the future for the health care system in the UK. At Healthcare 2002, Compaq will deliver its vision of how the implementation of wireless technology will deliver a tangible and compelling return on investment (ROI) with the Compaq iPAQ at the core of communications and working methods throughout health care operations. Illustrating how health care organisations can cut costs while increasing the time doctors are able to spend with patients, Compaq will outline how it is working with York NHS Trust. There, a wireless network is already giving health professionals fast, always-on access to essential information, such as electronic patient records, while they are on their rounds in wards and other clinical areas. Following the success of these initial steps, the hospital is now looking at ways that wireless technology can further transform the organisation. Sue Rushbrook, head of systems and network services, York Health said, “One of the crucial elements to ensuring the successful implementation and real time usage of the Electronic Patient Record is the clinician’s ability to access it at the point of health care delivery. The deployment of one single mobile device that is capable of delivering voice and data services to enable this ease of access is now a realistic option.”

Running weblogs with Slash Visionaries have the ability to draw pieces together to reveal a broader vista than we might otherwise be able to see, but they are usually not the force for change that creates the vision. Invention itself is the work of one or more individuals who pause to look at the pieces of a puzzle and ask, “Hey, what if?” Slash, the Open Source software that drives the popular http://www.slashdot.org site, evolved as the Slashdot creators asked this question while their site took shape: “What if you could build a program to manage a Web site, where people could organise and create things through a browser instead of HTML editors and FTP clients? What if you let readers publish their thoughts, and comment on stories and on the comments of other users?” Slashdot has subsequently triggered a revolution of its own, drawing hundreds of thousands of users and dozens of imitators. In O’Reilly’s just-released book, “Running Weblogs with Slash” coauthors Brian Aker and Dave Krieger show readers how to make this popular, powerful, and free system work for their own sites. “Running Weblogs with Slash” was written for anyone who wants to get a weblog up and running. As Rob Malda, creator of Slash, writes in the foreword, “Hopefully, what we’ve learned over the years will make it easier for you to tell your story.”

Info

Info

Compaq: http://www.compaq.com/

O’Reilly: http://www.oreilly.com/catalog/runblogslash/

Turbo10 takes pole position Turbo10 Search Engine has been ranked as the UK’s number one engine by Search Engine Spy, the UK’s leading search engine industry watchdog. According to Search Engine Spy, Turbo10 is a “refreshing change from many search engines mixing design, speed and content to create a truly superb search engine.” Nigel Hamilton, Turbo10’s Co-founder and Managing Director said, “We are delighted to be ranked number one on Search Engine Spy. It confirms that our formula of speed, simplicity and relevant results is working.” Turbo10 Search Engine recently announced its launch into the Deep Net, enabling users for the first time to search specialist information sources previously overlooked by traditional search engines. London based, Turbo10 is the first search engine to bridge the gap between the surface Web and the Deep Net. Crawler-based search engines like Alta Vista and Google only search static Web pages – the surface web. But the surface 10

LINUX MAGAZINE

Web only represents a small proportion of the information available on the Net. Turbo10 has created unique search engine adapter technology, called the Turbo10 Trawler to connect to the Deep Net - a vast array of specialist databases that range from business associations, universities, libraries, and government departments. “By delving into the Deep Net we are broadening the depth and range of search results for the online searcher. The Trawler connects in real-time, so unlike crawler-based engines, we search in the present not the past.” Nigel Hamilton, a former Computer Science University Lecturer, said. The Turbo10 Trawler can query up to 10 different databases, retrieve the results, rank and display them in a consistent interface.

Info Turbo10: http://turbo10.com/ Search Engine Spy: http://www.searchenginespy.co.uk/

Issue 20 • 2002

Red Hat Linux Advanced Server Red Hat Linux Advanced Server, the first enterprise-class Linux operating system, is designed for demanding enterprise environments that are migrating away from UNIX. In addition, Red Hat will unveil unprecedented enterprise application support for Red Hat Linux Advanced Server at a partner and customer launch event today in New York City. Red Hat Linux Advanced Server products will enable large companies to accelerate their migration from costly, proprietary UNIX to far more cost-effective Linux running on Intel-based server systems. A recent total cost of ownership (TCO) analysis by IDC research showed that Linux reduces per-user costs by almost half in internet/intranet/extranet environments when compared to RISC/UNIX solutions. In collaborative computing these savings can exceed 75 per cent. Red Hat Linux Advanced Server now brings this breakthrough TCO to database and application workloads that are common in large enterprises.

Info Red Hat Europe: www.redhat.com/


NEWS

K-splitter

GETTING BETTER The time has come

What exactly is a PIM?

to spring-clean the

The acronym PIM is on everyone’s lips at the moment and lots of people have a PDA in their pockets but when anyone asks what these abbreviations actually mean, many have to shrug regretfully. The KDE developers of the PIM-gang (or to be more precise Personal Information Management-gang) want to correct this sorry state of affairs at once. At http://pim.kde.org/glossary/glossary.php (Figure 1) the developers around Klaus Stärk have compiled a glossary which should cast some light on the dark jungle of acronyms and concepts. This domain cannot yet be reached via the main navigation, since the makers believe that they have not yet collected enough content. They are therefore asking all users of programs such as KOrganizer to send in any and all KDE words, which they have ever wanted explained. In order to speed things up, Klaus Stärk has added a form at the end of the site, via which you can send your contributions directly to him.

hard drive, because whether it’s the beta version of KDE 3.0 or the new releases of Kivio, KOffice or Quanta Gold – a number of interesting updates will be demanding space on your home computer

a new version of Kivio mp, the expanded – and sadly, not Free – version of the flowchart and vector graphics software Kivio (http://www.thekompany.com/products/kivio/). The pro tool costs $99.95 as a CD set and $89.95 for the download version. For all those not wishing to buy a pig in a poke, or gamble the money at ftp://ftp. rygannon.com/pub/KiviompDemo/ there is a demo version for downloading and trying out. Apart from a few bugfixes the latest release also includes some new features. So for example, text can now be rotated and for drawings there is now a layer function. Plus, undo options have been implemented when adding and deleting pages and layers.

Software in flux It’s not only KDE that’s getting fit for spring, many of the programs around it are sparkling with new versions and features. theKompany.com has released

Figure 2: The pro tool Kivio mp in action

Bugfix A bug is a fault in software or hardware. The name stems from the days of big computers, when insects really did cause hardware failures. Manufacturers and developers usually go to a lot of trouble to correct the fault as quickly as possible with a “bugfix”; usually a piece of code to be played in by the user. Figure 1: A glossary of a completely different kind

12

LINUX MAGAZINE

Issue 20 • 2002

But these are not the only innovations from theKompany.com. The HTML editor Quanta Gold (Figure 3) has also made a version jump. In version 3.3.2 support for DTML (the Document Template Markup Language from Zope) and ColdFusion has been added. Furthermore Quanta Gold now has a plug-in interface. theKompany.com plans to create diverse plugins for this, for example a database wizard to make it simpler to create database-oriented Web sites. The CD set of Quanta Gold costs $49.95, while the download version at $39.95 will look good in the accounts. The demo version can be obtained from ftp://ftp.rygannon.com/pub/QuantaGoldDemo/. Further information can be found at http://www. thekompany.com/products/quanta/.


NEWS

part have provided a new version of the KDE Office Suite at http://download.kde.org/stable/koffice-1.1.1/ for download. Unlike their desktop colleagues, though, this release does not dish up so many new features, but on the other hand increased value has been attached to an improvement in performance and greater stability.

The Konqueror takes over Korea

Figure 3: Quanta Gold provides Web designers with the perfect graphical overview

Half-time for KDE 3.0 Since the first release of a beta version in midDecember last year, KDE 3.0 has grown out of the embryo stage. Especially good news is that in addition to the bugfixes, which are obligatory in original versions, the beta provides numerous improvements and innovations compared with the first alpha versions. For example a new clipboard system is included, with innovations that ought to please Windows migrants and operating system hoppers in particular. In future there will be two clipboards: the old, familiar X-variant and the clipboard in the style of Windows/Mac, on which text is no longer copied to the clipboard with the aid of the middle mouse button but via Ctrl+C. The development environment KDevelop has been expanded by “Cross-Compiler Functionality” and adapted to the requirements of Qt/embedded projects. The former makes it possible to create programs with Qt-based user interfaces for PDAs such as Compaq’s iPaq and the Sharp Zaurus. The new Kdevelop abilities come at just the right time for hobby developers because the Qt manufacturer Trolltech has started a programmer competition for the Sharp Zaurus (http://contest.trolltech.com/). Just how quickly such a porting can occur is proven by the team surrounding Benjamin C. Meyer, who has rewritten Kinkatta, his AOL-Aim chat-client, for the Qt embedded system. Source code and binaries for the porting, known as Kinkatta-Lite, should be available soon for testing on the homepage of the project at http://kinkatta.sourceforge.net/). In addition, the KDE 3 releases of Konqueror, KMail and the KDE standard terminal emulation Konsole have a few surprises in store for users who enjoy experimenting. Anyone wanting to know more about the innovations in the new version of the desktop environment not mentioned here can find a more detailed article in this issue (page 27). With all these innovations, the KOffice developers obviously did not want to be left behind and for their

Plug-in A program fragment which can be “plugged in”, as an expansion into a larger program. Prominent software with plug-in technology includes GIMP and XMMS.

While in the German Bundestag the debate is still going on as to whether Linux will be granted a permanent position on government computers, the Korean government has already done the deed. As the firm Hancom Linux http://www.hancom.com/ has announced with justifiable pride, 120,000 copies of the distribution HancomLinux Deluxe 2.0 have already been sold to the Korean government. These contain, in addition to many other software packages, KDE 2 and the – also Qt-based – Hancom office package.

In the news Thanks to Christopher Molnar, the steadily growing numbers on the KDE mailing lists are now also available on a news server, so that in future you will no longer have to log on to every conceivable list, but will be able to forage comfortably through the most interesting mail exchanges in your preferred newsreader. To do this in the KDE reader Knode, for example, under the menu item Settings/Configure Knode/Accounts/News click New, make a new access and christen it, for simplicity’s sake, KDE. In Server, enter news.uslinuxtraining.com. Now all you have to do is click on Account/Subscribe to Newsgroups, fish out the appropriate groups and fetch the articles. That’s about it – the mail is delivered, and overfull mailboxes are now a thing of the past. This does have one small drawback: access is restricted to readonly. So anyone wanting to take part in discussions will still have to be registered on the respective mailing lists.

Pipe of peace As a belated Christmas gift Mosfet announced at the end of last year that it has ported 20 effects for its new graphic multi-purpose weapon PixiePlus, which we presented at great length in Linux Magazine Issue 19, to KDE 3 and in future will again contribute code to the KDE Project. The KDE developers did not hang about for long and immediately integrated the work into the existing CVS tree. With that, the differences of opinion between the two parties, which have caused a few waves in the past year, will hopefully be banished from the world. Who knows, now this has happened, maybe we can look forward soon to some new colourful KDE styles from the Mosfet company. Issue 20 • 2002

LINUX MAGAZINE

13


NEWS

Gnomogram

JOLLY LITTLE HAT MAN This month Gnomogram takes a look at Gnumeric, File Roller, Truevision and the GNOME 2.0 Alpha release

GNOME 2.0 Alpha Almost on schedule, the Alpha version of GNOME 2.0 has now been let loose on the world under the name “Rolig Liten Hattgubbe”. The name comes from Swedish and means something like “jolly little hat man” – but the only people who will have fun with this version are programmers and passionate testers. The latter should take a look at GNOME news and consider installing GNOME 2.0 with a different ––prefix than GNOME 1, because otherwise GNOME 1 programs will be overwritten. However the purely GNOME 2.0 libraries can be installed in

parallel with the latest GNOME 1.4 libraries. Anyone wanting to test GNOME 2.0, without at the same time turning your entire system on its head, can take a little look at the GNOME developer site, into the development of GNOME 2.0. Also, the modifications visible to the user have been summarised at http://www106.pair.com/rhp/gnome-2-new.html. One particularly nice feature here is the new stock icons, which are already being used in some programs such as Evolution, as well as the new version of GDM.

Gnumeric Gnumeric, the second software package to be developed at Ximian (creators of Evolution), has now reached the magical version number 1.0. Despite intensive tests, however, yet another bug managed to creep in shortly before the release, which was promptly fixed in version 1.0.1. This means that now, after around three and a half years of development, there is a first-class spreadsheet available, which has nothing to fear from the competition. As with Evolution, one can immediately see Gnumeric’s similarity to its Microsoft equivalent. Every Excel user should feel at home in a very short time – especially since Excel documents can be both imported and exported. In addition to Excel, Gnumeric also gets on with Import Applixware, Lotus 123 and numerous other formats. Unfortunately, though, you will have to go without Excel

documents, unless you are prepared to compile Gnumeric with support for the still very primitive GNOME-Basic. The developers of GNOME-Basic affirm, by the way, that macroviruses in GNOMEBasic simply could not exist – only time will tell if they are right. For a long time the greatest point of criticism about Gnumeric was the lack of and/or highly unstable support for graphs. This problem has now been solved with the aid of the program Guppi. This tool, which specialises in graphs, provides its services via Bonobo and can be embedded in a document

Libraries required: Gnumeric: libxml >= 1.8.14, libole2 >= 0.2.4, Optional: bonobo >= 1.0.9, gb 0.0.17, gda >= 0.2.92, guile >= 1.5, guppi >= 0.40.0 Truevision: gtkglarea Fileroller: gdk-pixbuf >= 0.9.x, Oaf >= 0.6.5, Bonobo >= 1.0, Gnome VFS >= 1.0

14

LINUX MAGAZINE

Issue 20 • 2002

By using Gnumeric’s Autoformat substantial charts can be produced rapidly


NEWS

without any problem. Other data types, such as images, can also be embedded in the same way; for the latter the Bonobo component of the image viewer Eye of GNOME is required. There are a wide variety of ways to analyse data – Gnumeric offers functions from correlation analysis to the histogram. By using a target and/or solution search, initial values can be manipulated automatically so that a function outputs a specified value. Also useful is the option of defining complex filters. To do this, values and criteria are specified in the document, which Gnumeric applies one against the other. Unfortunately, many of the functions described are anything but self-explanatory – so it is worthwhile, in any case, taking a look in the Gnumeric documentation, which goes way beyond the usual Readme.

Truevision Truevision is a program for creating 3D scenes, similar to the well-known Windows 3D modeller Moray. Like Moray, Truevision does not calculate the finished 3D scene itself, but hands it over to the raytracer POVRay. As the name Raytracer suggests, POV-Ray calculates the path of rays of light through a scene, so as to achieve a near-photo-realistic image. But since it would be unbelievably time-consuming to simulate all the rays of light, virtual lines of sight are emitted from the camera. Where these strike an object, further rays are sent out in turn, in order to determine the illumination of the strike point. Together with other techniques such as Radiosity – a “run” of the objects with each other based on diffuse light – POV-Ray is thus able to calculate astounding images. All POV-Ray scenes are based on a range of objects, which can be created in the Create dialog of Truevision. Here, in addition to simple forms such as spheres or cylinders, can also be found various lights and atmospheric effects such as mist. Unfortunately some of the more complex POV-Ray objects such as blobs, prisms or the Julia fractal are still lacking – but no doubt these will follow in the subsequent versions. Already in this version, it is possible to create beautiful scenes without 3D fractals. The most important resources for this are the CSG operators (Constructive Solid Geometry), with the aid of which several simple objects can be linked, as with Boolean operators. So a new object is created from several objects or their intersection. In order to keep perspective with complex scenes, it is also possible to create layers from several objects, which can be scaled and moved around as a single entity. Also, by modifying the co-ordinates, this movement can of course also be done by mouse in one of the views. When doing so it can be useful that Truevision, in addition to the grid view, also

File Roller With the aid of File Roller archives can be simply created and unpacked in any conceivable format. Apart from the nice surfaces File Roller also has something else to make it better than its predecessors, such as Guitar – i.e. it’s possible to look at lots of files directly from the program. To do this, File Roller searches with Oaf for a suitable Bonobo component, which is started in a new window. If File Roller when viewing the no suitable component is found, the Truevision archive text viewer is used. Files can be displayed in the main window both listed in directories or completely. The program is also able, in the Add dialog, to add sub-directories recursively and offers the usual features such as skipping backup files and symbolic links.

offers a preview via OpenGL. Just as important as the object itself is the texture assigned to it. Truevision comes with a comprehensive collection of textures in a separate package (Truevision-Extramat). In the case of almost all surfaces there is a preview – if not, this can be computed in the material editor. The individual characteristics of what are sometimes highly complicated textures are shown, as in Moray, in a tree view. To understand all the options, it’s also worthwhile at this point taking a look in the POV-Ray documentation. One option that is completely lacking in Truevision is animation, and it is not exactly simple to create animations under POV-Ray anyway. Often individual scenes are quite enough to occupy the computer for some time. Anyone who has several computers, though, has the option of getting them to work together with the PVM patch.

URLs GNOME 2.0 news Info for GNOME 2.0 testers GNOME Developer’s Site What’s new in GNOME 2.0 Gnumeric homepage GNOME-Basic homepage Truevision homepage POV-Ray homepage POV-Ray documentation PVM patch for POV-Ray

File Roller

http://news.gnome.org/gnome-news/1011293794/ index_html http://news.gnome.org/gnome-news/1011290700/ index_html http://developer.gnome.org/dotplan/ http://www106.pair.com/rhp/gnome-2-new.html http://www.gnome.org/projects/gnumeric/ http://www.gnome.org/gb/ http://truevision.sourceforge.net http://www.povray.org http://www.povray.org/ftp/pub/povray/Official/Docs/ http://wwwmddsp.enel.ucalgary.ca/People/adilger/povray/pvmp ov.html http://fileroller.sourceforge.net

Issue 20 • 2002

LINUX MAGAZINE

15


LETTERS

Come and have your say

WRITE ACCESS A fair cop I read the IPCop review (April 2002) with great interest and found it useful but I do think the author should have found space to mention that IPCop is a fork of the GPL version of Smoothwall. I don’t think that significant information should be left out, particularly since you’ve had Smoothwall on your coverdisc and interviewed Richard Morrell. I know that it’s an awkward issue both because there is some bad feeling between the IPCop and Smoothwall teams and because the Smoothwall product has been the subject of a series of controversial accusations and counter-accusations within the UK Linux community. A way round this might have been to simply provide links to pages discussing the issues around the fork. Controversy aside, while forking a project is perfectly acceptable under the GPL, giving credit to the original developers is only courteous. Bruce Richardson, via email

Write to Linux Magazine Your views and opinions are important to us, so we do want to hear from you, about Linux-related subjects or anything else that you think would interest Linux users. Send your submissions to: By post: Letters Page Linux Magazine Europa House Adlington Park Macclesfield Cheshire SK10 4NP By email: Letters-page@linuxmagazine.co.uk Be sure to leave your postal address whichever method you choose.

16

LINUX MAGAZINE

LM It is true that Smoothwall and IPCop are inextricably linked. The significance of their relationship was underestimated and, at the time, it did not seem fitting, or necessary to mention it in an article that dealt with setting up and configuring IPCop. It was not our intention to mislead anyone about the history of IPCop and the fact that very significant parts of it have come from the Smoothwall project, and, if we have done so, we are sorry. In our News section we have included some clarification on this matter and we do hope to have an interview with Laurence Manning, the principle author of SmoothWall, in next month’s magazine.

We have all the time in the world I work in Denmark and my laptop clock is always wrong. How do I set it so it is an hour ahead of UK time and change this when I come home. William Worthington, via email LM GMT (Greenwich Mean Time), now referred to as UTC (Co-ordinated Universal Time) or Zulu time, is based about the fact that the sun directly overhead zero degrees longitude is at noon. This is a universal time so 16:00 UTC in London is 16:00 in Sydney. Local time however varies. In the UK we move to BST (British summer time) to gain extra daylight in the Issue 20 • 2002

Living in the Free world In interviews in the past, Richard M. Stallman warns of the fallacy of users who are willing to mix Free software, like GNU/Linux, and proprietary software, like StarOffice or VMware, pouring cold water on the idea that even some access to Free software can be beneficial in using more Free software. Surely this is wrong. Any use of Free software has got to be applauded, even in a mixed environment, because the use of Free software will lead to the use of more Free software, if available for the task at hand. This is the point, there isn’t always Free software available that will take on that task or that will do it well enough. What would RMS do, not finish our work out of principle? Does he live in the real world? Richard Stratford, via email LM RMS may not live in the real world, he is a man with very deep ideologies and he lives by them. He also sees much wrong with the world, and he feels passionately that he could make a change to one part of it, the closed software world. If necessary he will die of old age trying as he is often quoted as saying. He sees the world very much in black and white, whereas the rest of us have the luxury, or is it a complication, of see the shades of grey. You can take RMS and his views as inspiration – many do – but it is much harder to take him as an example of how things should be done. His skill set allows him to live in a different world. If he wants access to some software that is currently not Free, he’ll write it, in the real world that’s not usually possible.

lighter months and other countries have their own time zones. Denmark is in the Central European Timezone and so is UTC +1 while New York is in USA Eastern Standard, UTC -5. Check your current system time with the command “date”. As root you can change this. For example for 13 May 16:54 2003 you need date 051316542003. Unfortunately the system time will reset to your hardware clock time when you power down.


LETTERS

Change the hardware (BIOS) clock to your new system time with: hwclock ––systohc ––etc This assumes the hardware clock is set to UTC time. By doing this, local time will automatically take account of summer time. If the clock is still wrong then the usual reason is the internal battery has died and needs replacing. Now that you have the BIOS clock as UTC and the system clock shows local time you only need to change timezones on the computer when you change countries for all to be in order. In the etc directory you will find a text file called timezone. Simply edit this for your zone and reset.

Ready to receive How is Linux for supporting TV and Radio cards? I am considering the purchase of a PCI TV/Radio card, but am uncertain of what support I can expect to find. Is it even practice to start considering a Linux system for a hard disk VCR? Any advice is greatly received. John Warde, Leicester

Convergence of technologies I am very excited about the prospect of Linux (for PlayStation 2) and can see a whole new market opening up for both Linux users and games developers. I believe it to be the brink of something new and exciting, the melding of ‘consumer’ electronics and free spirited, out of the box development. Personal computers haven’t quite made it to ‘consumer electronic’ status yet, maybe their time is up. I doubt that on its first outing Linux (for PlayStation 2) will be anything other than clunky, but it will surely be the forerunner of some new technological leaps. I can’t begin to imagine how the future will unfold, and that’s the exciting bit. Steven Wells, via email LM You might be right, it is an exciting time and no one can predict the outcome – and they never will. It is true that Linux developers, be they professional or hobbyists, have less restraints as to how they can allow a project to flow. It takes only the slightest whiff of success before a project is picked up and carried off by its own momentum to reach far grander things than the original developers had dreamed of. Who is to say that something similar wont happen in this case, with a whole slew of ‘consumer’ software changing peoples lives. It’s a nice thought, anyway. Next month, we do hope to have a review of Linux (for PlayStation 2), what it’s capable of and, more importantly, what it’s not. Let’s hope it bolsters your ego rather than dampens it.

first need to write your script in a text editor and save it. Let’s start by opening up an editor and typing:

LM This is still a continual problem for Linux users and the availability of drivers can hold you back considerably. There are sites like http://www.linuxhardware.org/ that often can lead you the right way, and a search on Google will bring up yet more clues for you. Hard disk video recording does seem to be more feasible with the news that the guys at http://www.linuxtv.org have released version 1 of their Video Disk Recorder.

Stick to the script

#!/bin/sh echo Hello World Now save this as a file called test.sh. Do a listing to find the permissions such as: fred@space:~ > ls –l –rw–r– – r– – 1 27 May 3

fred 17:43

usersU test.sh

This tells us that fred has permissions to read and write to the file but not execute it. Change the permissions with:

This may sound like a stupid newbie question but how do I run scripts? I have looked everywhere. I know I am using a Bourne Again script editor but nothing seems to work. Please don’t ignore me. Everyone starts somewhere. Andrew Bailey, Glasgow

Now we can run the script by calling it:

LM The Bourne Again Shell (usually refer to as bash) should give you a prompt in a terminal window. You

fred@space:~ > ./test.sh Hello World#

fred@space:~ > chmod +744 test.sh fred@space:~ > ls –l –rwxr– – r– – 1 fred usersU 27 May 3 17:43 test.sh

Issue 20 • 2002

LINUX MAGAZINE

17


INTERVIEW

Sam Williams

FREEDOM UNBOUND Linux Magazine caught up with Sam Williams, author of “Free as in Freedom”, a biography of Richard Stallman and his crusade for Free software

Info Author Sam Williams Publisher O’Reilly (www.oreilly.com) Price £15.95 ISBN 0-596-00287-4

18

LINUX MAGAZINE

Linux Magazine – How long did it take you to write the book? Sam Williams – About a year from start to finish, a time that was full of love and treachery, some of the baser human emotions. About 18 months ago I was approached by an agent from a publishing company who was interested in doing a book about Richard Stallman, and negotiations were started. Unfortunately the book project fell through because of some of the unique licensing issues involved, but not the relationship that developed with the agent from the publishing company and me, we were later to get married. O’Reilly was the only publisher that could accommodate the content licence that we required in terms of the digital realm. About June last year they agreed, then from August until Christmas the main writing took place, although most of the main writing had already been organised in the form of research, I just had to go through my log. I spent about 30 days in a row writing everyday all day. LM – What did you know of Richard Stallman before you were asked to write the book? SW – I had interviewed him about three or four times before. My first encounter with him would have been the LinuxWorld trade show, March 1999, where the initial launch of GNOME 1.0 took place, with full press coverage. I was just clueless at the time, and I asked him “What does this mean for the Linux operating system?” and I remember him jumping down my throat for not calling it GNU/Linux, reminding me that it was disrespectful to all of those that had worked on the GNU project to not give it the more full title of GNU/Linux. At first, he seemed to me to be a prima donna, but as I got to know him more I came to realise that this was just how I was interpreting his quirky personallity. LM – Do enough people see past his quirky personality? SW – That was my approach to the book. The idea running through my head was that will people see RMS differently in a hundred years in the future, when his personality is not around to get in the he way. I felt that it would be a complete disservice not to focus on Issue 20 • 2002

that personality and how it has hampered him in some ways and given him strength in others. RMS will say it about himself that his primary asset is that of stubbornness, not everybody could say “I’m never ever going to use proprietary software again for the rest of my life”. Well, he said it, has the will to back it up, and, more importantly has the coding skills to go and write some thing and do that every day to build something that he can use and that other people can build upon. LM – Did you know about GNU before your introduction to RMS? SW – I knew about it but only in a general way, as part of doing research into Linux. I only got to know about it at the ‘99 LinuxWorld show. Here he really made his comeback, with all the tech media gathered, they called it the coming out party for Linux. He really used that platform skilfully, to make people aware that there had been work going on since ‘85 and the Linux OS wasn’t something that Linus Torvalds had pulled out of his brain, being disrespectful to the GNU project and not acknowledging how much effort is involved in developing an operating system of this size. So I knew a little about GNU by listening to some of his speeches, but it really was in the course of writing the book that my respect, both for him and the project, was raised. LM – What were the licensing issues that halted the book originally? SW – I was approached by a company who were interested in doing an electronic book about RMS, they wanted a subject that was going to appeal to the Internet community. I said I would do it, but then, during the course of researching the book I realised that RMS really detested the electronic book and its proprietary formats, with the texts of such books being ‘rented’ in a restricted form. The whole RMS argument was that software should give you liberty, and we were creating a product that would give readers less liberty than a paper book. Unfortunately, the publishers were not in the business of giving away their content. The subject matter would have made it a prime target for the cracker community, taking the challenge to make sure the text was made available. We couldn’t reach agreement on this, so the book deal fell through.


REPORT

Talking about freedom

BRADLEY M. KHUN T

he GNU project was set up in 1984 by Richard Stallman after he began to realise that what had once been a community of Free software users and programmers based around an emerging Internet had disappeared and had been replaced by an antisocial and unethical crowd of people who had all signed a nondisclosure agreement so that they could work on computers and operating systems such as the original VAX systems, which at that time were the latest thing. Things had to change. When RMS lectures about how the concept of the GNU project came to him he explains that Free software is about the following: ● You have the freedom to run the program, for any purpose. ● You have the freedom to modify the program to suit your needs. (To make this freedom effective in practice, you must have access to the source code, since making changes in a program without having the source code is exceedingly difficult.) ● You have the freedom to redistribute copies, either gratis or for a fee. ● You have the freedom to distribute modified versions of the program, so that the community can benefit from your improvements. It’s precisely this kind of morality that has shocked the present day proprietary software manufacturers and distributors who have all followed the nondisclosure model, which conspires to lock in the end user and make sure that they will never be able to make a choice over which type of software or program they will run on their computers at some time in the future. The proprietary software model generates vast sums of money for one person or for a very small group of people. The Free software model can actually help to make money for a business or an individual but it doesn’t generate the

kind of greed and avarice that you can expect from the proprietary model. As such it is seen to be somewhat more desirable and a good deal more forgiving of its end users – both from the point of view of the licence and from the point of view of what you can actually do with it once you have installed Free software. The goal of the GNU project was to give the end user freedom. It does that through the use of something called copyleft, which is a reference to copyright law.

Strong foundations The Free Software Foundation (FSF) came into being around 1985 after the EMACS project was started and it was realised that interest in the GNU project was growing. The FSF came into being as a tax-exempt charity, which could accept donations for Free software development. The EMACS project was eventually extended to include other Free software end eventually FSF books were produced to generate greater interest and further funding. In the present day both the FSF and the GNU project are such an amazing success that when IBM came to the conclusion that they would take a serious interest in GNU/Linux they asked the FSF to look after their licence for them into perpetuity. In more recent times Bradley has taken an interest in the DMCA (Digital Millennium Copyright Act) and the European Union directive to introduce the same legal structure within the EU. We are entering a world of digital media where you can get your books, music and movies digitally and the media companies want a leak-proof pipe from their media to you – without this you can make perfect verbatim copies of all the things they send you. Bradley quickly points out when asked about digital rights issues the FSF is not interested in supporting the pirating of copyrighted material, it’s all about questioning the freedom of the individual. In a similar way the DMCA assumes that you are a criminal and that without any real evidence you may be found to be guilty or not guilty. Issue 20 • 2002

Bradley teaches, hacks and provides documentation about Free software. In February 2001 he was appointed as the full-time Vice President of the FSF. He took a little out of his busy schedule to talk with Richard Ibbotson about the FSF and what they set out to achieve

Info Free Software Foundation: http://www.fsf.org GNU Project: http://www. gnu.org/gnu/thegnuproject. html Patent issues: http://www. patent.gov.uk/about/consult ations/conclusions.htm http://europa.eu.int/comm/i nternal_market/en/indprop/ comp/02-277.htm

LINUX MAGAZINE

19


FEATURE

A reason to celebrate

SuSE 8.0 The new release of SuSE 8.0 has finally arrived to the great relief of the developers involved and to the excitement of the end users and SuSE fans alike. Richard Ibbotson gives us a hands-on view of the new distro

S

uSE has introduced some major new innovations into its Professional and Personal versions of SuSE 8.0, which means that it’s well worth having a look at it. From when you first open up their glossy and well thought out manuals to the finish when you begin to click on the mouse and ooh and ah at the excellent and highly stable desktop you can be fairly certain that you are onto a good thing. The desktop users have got the latest and greatest in the shape of KDE 3.0, GNOME 1.4, XFCE 3.8, Windowmaker 0.80.0 and Enlightenment, as well as several other minimalist and lightweight desktops. You can also mix and match these to great effect and make any or all of them suit your own personal tastes. There are many universities and Government departments out there using these desktops to good effect. In recent times there are even commercial organisations using the Linux desktops rather than other products.

If you do need to dual boot a Linux partition with a Windows one, then that’s very easy to configure at the time that you run the SuSE Linux installation.

After booting from the floppy boot disk or the first CD you will be presented with several screens that will ask you about resizing your Windows partition. You are not committed to the final size of the partition until you are presented with a screen that will tell you that your partition will be re-sized. The installation process has been simplified quite a bit, whether it’s for the straightforward SuSE Linux installation or whether you do in fact need a dual boot machine. After placing the first CD in the computer, the installer will check all of the hardware on your system and find things like CD-RWs or LS120 drives, as well as floppy drives and all of your other hardware. It will then take you through an easy to understand graphical installation process, which will ask you questions and give you a few choices about what it is that you want to do with your newly installed machine. Boot configuration is sorted out for you for the next time you start the machine. The Xwindows configuration should be a trivial part of the installation process. Providing your graphics card and monitor are not much more than two years old everything should be fine, though many people have found that older hardware works just as well. If you do have problems consult people on one of the many LUG discussion

SuSE 8.0 welcome screen

Taking control of multimedia

Installation

20

LINUX MAGAZINE

Issue 20 • 2001


FEATURE

YaST2 for your PDA

lists or ask for some help from the SuSE support department. Basic configuration is part of the 60 or 90-day support scheme, which comes with every box of the software. The test machine that was used with the SuSE 8.0 software presented no problems at all for automatic configuration of a workstation and that was with a very much out of date Belinea monitor which would probably look much better sitting on a scrap heap than on a test bench.

SuSE Linux does have a great choice of desktop applications

Applications As is always the case, SuSE Linux does have a great choice of desktop applications. This includes many feature-rich wordprocessors, all of them Free, as well as organisers, email applications and a bewildering array of Web browsers, which quite simply leave the Microsoft stuff firmly in the last century. OpenOffice.org has now been included into the SuSE distribution. In time it will probably replace the present Star Office 5.2 due to the licensing conditions that affect Star Office 6.0. Other word processors are of course present, such as Kword 1.1.1. This can save in a variety of formats such as RTF, Abiword and one or two others. If you’re a Palm Pilot or Handspring fan then you might like to have a look at the latest version of Abiword. Not only does it do your normal run of the mill MS Word documents but it will also handle HTML and TeX and most important of all it will save with the Palm extension on any document so that you can use Jpilot or Kpilot to transfer your documents over to your PDA for the next day’s business or pleasure. There is a free version of Abiword for Windows that you can download from the Net. There’s also all of the expected Postscript and PDF utilities that will enable to you to produce those top class documents that people look at more than once. It’s great to know that Postscript is still used and will be in use for a long time to come. You can use the above for Web pages or, if you aren’t a highly trained TeX person, you can use something like Mozilla Composer to write a graphical Web page and then finish off with Quanta+ by hacking the code. There are other HTML authoring tools on the CDs – it’s best to have a look at them to find out what’s there.

Internet tools The wonderful array of text processing tools is backed up by the Internet-based tools. The Web browsers that are included are Mozilla 0.98 which also has Mozilla mail and Mozilla Composer for producing Web pages; Opera, which is small and light when compared with the others; Konqueror which is very popular just now; Galeon for the GNOME fans and several others. If you are a bit old fashioned then you can always use Netscape and Netscape mail. Speaking of mail applications. If you are a Eudora or Outlook person and you can’t cope

with anything else you are in for a few surprises with the new desktops that are around just now. Kmail is probably a good replacement for Eudora. Evolution 1.0.2 – that long-promised Outlook clone and PIM – is also now a part of SuSE 8.0. Other mailers that you can use include Balsa and Spruce, which are GUIbased applications that are easy to use. If you are a traditional Unix user you can of course use something like Pine or Mutt to do all of those things that you would have done on another platform. The development tools are all there for the aspiring programmer or hacker, who wants to either develop some software or just experiment with some ideas that might not work out. Tools like automake and the GCC compiler are present. There is also the IBM Java development tools and C++ compilers and many other tools. Glade and Anjunta provide for GNOME development on the desktop and Kdevelop for the KDE people. There is also a free version of Kylix for anyone who wants to risk such an adventure. For the purposes of leisure, or perhaps even for day-to-day use at work, there are tools for digital photography or listening to music or mixing it at the time of recording or you can watch your favourite DVDs or TV programmes on your computer. Listening to music from CD or MP3 is something of a joy when using Alsa sound tools and a good set of speakers.

WindowMaker desktop

Server-side up If you want a server rather than a desktop workstation or notebook installation then SuSE Linux does have NFS and NIS server software built in, as well as DNS software and the various bits and pieces of security software that are normally associated with servers. If you want a Samba server, version 2.23a is the one that comes with the CDs. This will allow you to set up shares on a Linux computer so that it servers files to a local network or to a remote Issue 20 • 2001

LINUX MAGAZINE

21


FEATURE

XFCE running

Get hold of the SuSE 8.0 Professional version network with SSL security protocols. This gives you a rock solid server that your MS Windows computers can connect to. For a reliable mail server that also has a spam filter and virus scanner, you’ll need to get hold of the SuSE 8.0 Professional version, which can build a mail server with an MTA such as Sendmail or Postfix. Both of these are well understood and they also come with a virus scanner (Amavis) built-in. If you don’t want to use Amavis there are many other Linux-based virus scanners out there, such as Sophos or the Trendmicro ones that you will have to pay for. There are many thousands of Apache Web servers out there on the Net, all of which are maintained by an army of technicians and system administrators. The SuSE distribution has a wealth of information about Apache and how to configure it. There is also a good choice of Apache modules and plenty of support for this application can be found from the SuSE list and through pay for professional services. The Apache configuration tool, Comanche, is also included.

In a nutshell

SuSE 8.0 Supplier Price Web For Against

SuSE To be confirmed http://www.suse.co.uk All-inclusive No YaST1 included

rating

22

LINUX MAGAZINE

The kernel people out there might want to know about the new 2.4.18 kernel that is a part of the 8.0 release. The usual selection of SuSE standard kernels for i386, i586/i686 uniprocessor and SMP (Symmetrical Multi-Processor) has been added to, with the first time inclusion of an nVidia kernel. This means that you have a great choice of PC hardware to run. Alpha and Sparc versions will come along later. You can still re-compile your kernel for your own requirements to improve the performance of your computer if that is what is required. YaST2, which has now replaced YaST1, performs package management and system updates, as well changes in configuration. YaST Update Online will allow you to manually or automatically connect to a SuSE server so that your machine can check for and download updates. There are quite a few system administrators out there who like to know what it is that is being installed into their computers on their networks. The manual update will allow to you say yes or no to a package before accepting that the Issue 20 • 2001

Memory info from the control centre

package is what you want to install. If you are also a Debian GNU/Linux fan you might prefer apt-get? If that’s the case you can use apt4rpm to get hold of your updates.

Net configuration Configuring your Net connection, whether it’s at home or in a commercial or Government environment, is well catered for. YaST2 can be used in console mode without Xwindows, so that you can take advantage of command line configuration and use YaST2 to help you with the difficult parts such as configuring an ISDN card or ADSL connection. ADSL is best configured with a cable modem through the Ethernet interface. You can also configure and use the BT Alcatel USB modems after recompiling the kernel and installing the Benoit Papillault software from the Net, which is available from Sourceforge. The SuSE firewall is included in the Professional version. You can use the SuSE security list to ask questions about things like how to configure /etc/hosts.deny or which parameters to put into the firewall when you set it up. There is also the personal firewall, which you might want to use on a notebook when you are travelling. For home use on a dial-up connection you should use the full version of the firewall so that you can find out with logged messages just who it is that is having a go at your systems. In present day circumstances this is no longer a joke and you should take notice of this.

Conclusion If there is something that hasn’t been mentioned above then it’s because there isn’t enough room to explain all of it here. If you have a specific need or wish then you should find that the SuSE 8.0 release will have already identified your problems and sorted them out. The Professional version comes to you in a well-presented box with a very full set of manuals. You get seven CDs and one DVD, which contains all of the software that is on the other CDs and a good bit more as well. The Personal version costs less but has everything that you might need for your own workstation to write letters and to send faxes.


ON TEST

Out of the cooker and into the boiling pot

MANDRAKE 8.2 S

ix months have passed since the last Mandrake boxed set was released, so now seems like as good a time as any to put on show the latest efforts of the MandrakeSoft developers and the community that has built up around them. Mandrake Linux takes upon itself the role of being the cutting edge Linux system for Intel, AMD and PowerPC processors. This is helped by the way MandrakeSoft communicates with its users through its Cooker project, while maintaining a firm belief in ease of use and accessibility for new or less experienced users. Because of this ease of use and the excellent array of programs and desktop utilities, Mandrake Linux is often thought of as being suitable for desktop use only. In truth, a full and wide ranging set of server applications come supplied with Mandrake Linux making it a versatile all rounder.

What’s available? Mandrake Linux 8.2 ships in three forms: ● The 8.2 ProSuite Edition features eight CDs (including two special server CDs), one DVD, and two comprehensive manuals. Also included is a subscription for two update CDs – to be received during the product life – which contain security and bug fixes. The ProSuite is aimed squarely at the high-end enterprise sector with requirements for a product that is highly dependable, secure and scalable. US$149. ● The PowerPack Edition features seven CDs packed with thousands of the best Open Source and commercial applications, an installation guide, plus a detailed reference manual. US$69. ● The Standard Edition includes three CDs plus an installation and user’s guide. Price to be confirmed. The MandrakeSoft Web site only quotes prices in US$, which we have quoted for you to use as a guide. No price was available on the Web site for the Standard Edition at the time of writing, but as a guide Linux Mandrake 8.1 Standard Edition was sold in the UK for £32.

You also have the opportunity to download the three disc set from the Mandrake Web site or from its various mirrors. You may even be able to buy copies of these downloaded sets from places line LinuxEmporium.

Sometime around

What’s new?

the latest boxed set

the end of April, shelves will have been packed with

Mandrake Linux 8.2 doesn’t come with any startlingly new packages, but should be considered a revamp of 8.1, with lots of improvements. The kernel has moved up to 2.4.18 and includes a special enterprise version for those of you that need support for large amounts of memory – greater that 1,024Mb – and are lucky enough to have multi-processor units. The use of this new kernel now means that Supermount can safely return to the distribution, the dropping of which has been the source of much consternation. As mentioned earlier, Mandrake Linux is well positioned to act in the role of server, something often forgotten or overlooked. To this end, a new version of Samba has been included, which now uses XFS to allow Windows file sharing with NT like ACLs (Access Control Lists).

release from MandrakeSoft, Mandrake Linux version 8.2. Will they still be there or have they all been snapped up? Colin Murphy has the answer

Cooker – bubbling under MandrakeSoft makes a big effort to enlist the help of the community, be it for actual development or for testing, with the main bulk of this done through its Cooker project. Cooker is a Mandrake Linux in development (if you were to look now, you will see what will be version 8.3) where new packages get added and access and compatibility to those packages gets improved. Because of this constant change, things will often be broken, or become unstable at best. Cooker is being made available for people to report what is wrong with it, so you should not consider using it for a working system, unless you like to live very dangerously! Cooker can be downloaded from the MandrakeSoft Web site, as well as from some mirrors. The rolling, automatic update is achieved with tools like URPMI – the same tool which is also used to update the stable version – you just point it at the Cooker directories instead. Occasionally, snapshots are made of a minimally unstable version of Cooker for those who still want to try out some of the most recent developments, but don’t want to invest time in maintaining it regularly, or have access to do that. To participate with Cooker you really should subscribe to the busy Cooker mailing list, details of which can be found at http://www.linuxmandrake.com/en/cookerdevel.php3.

Issue 20 • 2002

LINUX MAGAZINE

23


ON TEST

Figure 1: Here the onscreen prompts ask you about what security level you want

Figure 2: Disk partitioning can be confusing for the new user, but the graphical partition manager makes it less stressful

Figure 3: Groups of packages can be selected and then individually tailored to suit your needs

To help you with server-side applications you will also have access to Apache 1.3.23, PHP 4.1.2, MySQL 3.23.47, PostgreSQL 7.2, Sendmail 8.12.1 and a host of other servers. It was really most unfortunate that the freeze date for the development of Linux Mandrake 8.2 came just days before the fixed and final release of KDE3, which meant missing out on a big scoop that SuSE has picked up.

Ease of installation The accessibility of Mandrake Linux comes in part from the effort put in by the developers to make the installation as easy as possible, thanks to the DrakX program. If you’ve used Mandrake Linux before then the graphical installation will still be familiar to you, though there have been some pleasant tweaks. Should this be your first Mandrake install, or even your first Linux install, then you’re in for an equally pleasant surprise. The graphical installer can take on the role of hand holding assistant, or, should you need no hand holding, just give you something pretty to look at during the install. The graphical install screens give you plenty of information about what is happening 24

LINUX MAGAZINE

Issue 20 • 2002

and, more importantly, lots of contextual help on what information is required from you: from something as simple as selecting your security level (Figure 1) to something as complex – for a first time user – as reformatting your hard drive (Figure 2), or (Figure 3) showing how easy it is to customise the packages you want to install. It is worthwhile reading all of the information presented on these screens, even if you are comfortable with Mandrake installs, you will learn more about what is going on during the installation. Right from the start, the installation program will ask you to choose between a recommended install, where DrakX will make the bulk of the decisions for you, or an expert install, where you get the chance to tailor and control a lot of the options and paths during the installation. You don’t need to be an expert to use this class of installation, but you will need to be a lot more interactive, which is not such a bad thing in our judgment. A new minimal installation mode, which installs nothing but the base system, is now available. This installation mode leaves users with a functional, but very basic Mandrake Linux installation taking up only 65Mb on their hard disk. Since there will be no graphical servers, you will be left a command line when this minimum installation is first booted, though this does give you the opportunity to then continue to install whatever packages you wish – giving you full control over how you want to tailor your system. One command line tool to help you do this is URPMI, an automatic software management system, which provides a hassle-free way to install and upgrade applications, via a network if necessary.


ON TEST

Configuration The installation process takes in a lot of the configuration information so that you very nearly have a working system the first time you boot your machine, this applies to things like your network connections and printer setup, unlike some other Linux distributions which put you through a post install configuration process. Even so, there is always some configuration to do, things on your system change, maybe because you have added new hardware or want to run new services. Mandrake Linux makes use of yet more graphical wizardry, now allowing the less experienced users to shape and control their system. The Mandrake Control Center is a central repository for these graphical wizards and will be familiar to Mandrake Linux users of previous versions, but it has been overhauled and improved for version 8.2. The new ‘Mount Points’ section in the Control Center now allows you to set up and configure NFS mount points, Samba mount points and partition sharing as well as the familiar control that you had over the mount points on your fixed hard drives as well as removable media like CD-ROMs. To help you know how and what to configure, it’s good to see that the Mandrake documentation has been reworked. The documentation is available to you on your local system, enabling you to read and search with your favourite browser and is also included in dead tree format for when you have trouble getting to sleep. Access to such help makes a system much easier to access and understand.

What you get There are thousands of packages supplied with Mandrake Linux, here is a list of some of the ones

Figure 5: Mandrake Control Center set to configure some mount points

Figure 6: Setting configuration data to run services like an FTP server is straightforward with the help of the graphical wizard

most people will find a use for on a day to day basis in the field of multimedia and productivity: ● Mozilla 0.9.8 and Galeon 1.0.3: Web browsers. ● XMMS 1.2.6: play and manage MP3 and Ogg Vorbis files and CDs. ● Grip 2.98: rip your favourite CDs. ● GIMP 1.2.3, gPhoto2: so you can download and manipulate all of your digital data. ● Gnomemeeting 0.84: share good times with family and friends with this fully-featured video conferencing software. ● KOffice 1.1.1: KDE office suite. ● StarOffice 6.0: the full-featured and MS Office compatible office suite, though this is only available within the Mandrake Linux ProSuite and PowerPack Editions. If you are going for one of the lesser editions you will still have the chance to play with OpenOffice. At the heart of the system you will find improved support for FireWire devices as well as USB 2.0, i830 DRM, ATA133 and the GeForce 3 graphics chip set. You will also find:

Figure 4: Just one of the many configuration wizards available

● XFree86 4.2 ● Glibc 2.2.4 ● Gcc 2.96 and 3.0

Mandrake Linux 8.2 Supplier Price Web For Against

MandrakeSoft To be confirmed www.linux-mandrake.com/en/ Easy to install and configure Just missed out on KDE3

rating

Issue 20 • 2002

LINUX MAGAZINE

25


FEATURE

Red Hat updates

WORK REST & PLAY The new Red Hat Linux 7.2 Update pack is released. Jack Owen takes a look to see if its worth the time and money

T

he update pack arrived on the doormat and after fighting with the wrapping we were greeted with a single A5 piece of paper, three CD-ROMs and a credit card-sized Survival CD-ROM. The paper explains that the two update CDs are bootable and will update your current Red Hat distribution, while the Utilities/Games CD can be browsed and installed if you wish.

Up to date updates Having religiously followed the Red Hat Network Errata warning and updating packages when reminded, the autoboot disc ran smoothly without the need for intervention. Hundreds of packages are included and the most noticeable updates included KDE 2.2.2 and XFree86 4.1. In the background though are the more important changes such as Openssh and rsync. The latter we had already updated but this did not hinder the process. The second disc of the update pair contained the source rpm files and a copy of the rescue CD. Hopefully with Red Hat we will never need to find out if this works. The text file for this part of the CD is worth reading, not so you can remember it verbatim but so that when disaster happens you know what to expect on the CD. We particularly liked the cut down e3 editor and the graphical installer, Anaconda.

Fun with a capital F

Red Hat 7.2 Update Pack Supplier Web For Against

Red Hat www.europe.redhat.com Great Sys Admin disc If you donwload updates it’s inessential

rating

26

LINUX MAGAZINE

The third CD-ROM is the Utilities/Games CD. This CD is more of a bribe to keep you from straying to other newer distributions rather than an essential addition to the Red Hat package. To ease printing CUPs is provided along with the latest foomatic drivers. If security had still been an issue after updating then the new FireStarter firewall configurator will win you over. Gnomemeeting is also included, which we had been waiting to try out for Issue 20 • 2001

some time. The video conferencing software makes use of your webcam but can work with just voice input. Multimedia is also taken care of with Xine, vcdimager and GIMP plug-ins. Then we come onto games. Here Red Hat have realised that perhaps we all need a little time to unwind and have included the flight simulator FlightGear plus another twenty games to keep us happy. The Wine release included is from the very end of January.

Small and neat The final disc in the box is the credit card-sized Sys Admin CD. I have to say that just the kudos of having this meant everyone else in the department was jealous. It was quite noisy in the drive at first but quickly quietened down. This provides the same data as was on the second update disc, containing a 30Mb Red Hat distribution. With this you have the tools to check and recover filesystems. The monitoring software lets you check and manage a network while the editors and mail utilities will handle any communications problems quickly. The purpose of this CD, apart from making others envious, is that by always being able to carry it with you, you always have tools to hand. Yes, full distribution discs and a laptop are the ideal weapons of choice, but the quick and dirty fixes that this disc provides mean it will soon become invaluable.

Conclusion Rather than release yet another distribution and cause everyone to reinstall, this update pack is ideal. Security and peace of mind is taken care of and the update of packages is a nice bonus. The utilities and games add a little fun to make the updated Red Hat 7.2 system rival any of the newer distributions. Red Hat also gives the impression that it was aimed at the busy system administrator. By including the utilities CD it has shown that it’s not all about work and some joy can also be had. There again the credit card CD is worth the pack alone. Well, that’s enough of what is included. We’re off to play Parsec and maybe try out more programs under Wine.


ON TEST

KDE 3.0

SMALL CAUSE, LARGE EFFECT W

KDE 3.0, in its release

hen the digit before the decimal point of a version number changes, this usually suggests drastic modifications to the software. KDE 3.0 however proves that this doesn’t have to mean that users will hardly recognise their programs any more. The current version change is more like a leisurely step in comparison to the leap from KDE 1.x to 2.x. The change in optics will only immediately catch the eye of the most observant users and apart from this nothing particularly incisive has changed to the technology under the hood. So why the new major version number?

From right to left and back again The intention is that KDE’s versioning remains in synch with that of the underlying GUI Library. With KDE 3.0, this essentially concerns the porting of KDE 2.2.x to Qt 3.0.x. Now this in itself does not sound particularly mind-blowing, however it has quite interesting consequences: since the support for nonLatin alphabets, as well as bi-directional representation has improved in Qt 3, KDE also profits from this. A KDE 2 application like the KDE control centre on a SuSE 7.2 installation (not intended for the Israeli market) with an imported Hebrew KDE Internationalising Package only outputs question

candidate state, was one the stars of the Linux World Expo in New York. Patricia Young takes a closer look at the prerelease versions

marks (Figure 1), whereas the language conversion works perfectly with KDE 3. Not only can Hebrew program labels be surveyed (see Figure 2) without the additional installation of fonts, but also the arrangement of the menus and buttons automatically adapt to the right-to-left reading direction giving a mirror image of what European eyes are used to. The KDE control panel (bar) however was not obliging (at least in the latest CVS version before

Major version number This is generally defined as the number before the first decimal point of a version specification – in contrast to the “minor version numbers”, which follow thereafter. This main version number normally only changes with large re-organisations and improvements in functionality. If another decimal point follows the minor version number, the number following this usually defines a “maintenance release”, which in theory is only concerned with bug fixes. However, not all projects adhere to this unwritten rule. GUI Library A collection of source code for elements and graphic user surfaces (buttons, windows, menu bars, dialogs etc.), which programmers have prefabricated and made available as classes. The most common under Linux are GTK+ and Qt.

Figure 1: The transfer to Arab or Hebrew is not as simple with KDE 2.x

Bi-directional representation (or “Bidi” for short). There are times within texts written from right to left (such as Hebrew and Arabic), that terms may arise in languages written from left to right (e.g. English or Russian). The writing/representation direction must therefore change for a short while. This is a very demanding and sophisticated function of GUI programming.

Issue 20 • 2002

LINUX MAGAZINE

27


ON TEST

Figure 2: With KDE 3 however it’s a matter of course

going to press), so that the arrows in the mirrored start menu were pointing in the wrong direction. The fact that KDE 3 so miraculously gets the correct font is due to the reworked QFont class in Qt 3. The consequence of this is that the program no longer stubbornly outputs the same old backup symbols (which cover all characters) when it can’t find the correct font. Instead of this, it picks the suitable glyphs from the available system fonts and even mixes these together if necessary. Letting the old KDE code use the new QFont API was thereby one of the most difficult functions of the porting.

New features thanks to Qt The revised and completely new additions to Qt 3 account for the new features in KDE 3. The desktop environment thus receives, for example, Xinerama support without any extra hassle. As well as this, the new Qt 3 class QTextEdit (which already provides a simple Richtext editor) shortens

Class Contains “object-oriented programming” code, with which objects (for example a button, a font or a whole application) can be produced. In order that these very general objects can be individually created (so that they behave differently), they contain class implementation functions, with which the characteristics (properties) of an object (for example its colour) can be modified. Objects can also “do things” (an application can close itself, a button can execute an action), which can also be implemented by the functions (methods) of this class.

Figure 3: Overloaded main windows can be broken up

the code of several KDE programs. By the way, it is pretty self-evident that the KDE editor Kate is not based on QTextEdit. The new Qt classes that facilitate the access to SQL databases don’t leave any tracks on the KDE 3 core packages. This is more of an advantage for the KDE programs of other users. With its new releasable/movable windows, KDE 3 has added a feature, which Qt has had since its version 2.2. If a program window consists of several fragments, then those that have a small bar (as in Figure 3) can be dragged onto the desktop. These independent windows can even be shifted to separate virtual desktops. In particular where several monitors are used, with each one displaying another virtual desktop, you can improve the clarity of control of programs that need as much space as possible for the main window. Those of you who take the separation of windows too far should take a deep breath – the re-integration of window segments back into the main window requires a steady hand. Shifting the window fragments with the left mouse button, the tip of the cursor must be exactly aligned with an edge of the main window or one of the sub-windows integrated therein.

New applications The many small and larger bug fixes and detail improvements, which essentially constitute KDE 3,

Glyph A character from a font. API Application Programmer’s Interface. The answer to the question: “How can a class be used without having to know about the implementation details?” – expressed in a programming language. With C or C++, the API is concealed in a class, normally in the header files with the ending “.h”. An API is actually only complete with the appropriate API documentation, which describes what the class and its functions do as well as which function arguments have which meaning etc? Figure 4: Edutainment in KDE: Kgeo, Kvoctrain and Ktouch

28

LINUX MAGAZINE

Issue 20 • 2002


ON TEST

Xinerama: Representation of a virtual desktop on several monitors, whereby windows can be dragged from one to the other. Individual windows can also be situated “on the edge”, i.e. partly on one screen and partly on another (or several others). SQL database: A collection of data that is stored in the form of tables and can be accessed with the assistance of a Structured Query Language. Examples of Database Management Systems(DBMS) on the SQL basis are mySQL, PostgreSQL and Oracle. IMAP: Internet Message Access Protocol. This is one possible way of accessing emails stored on another computer with an appropriate utility program. From the user’s point of view, it looks as if the mail boxes have been processed locally. Figure 5: Pre school with Klettres

do not however hide the fact that the number of applications has not (naturally enough) remained constant. The new core package Kdeedu contains nine learning-software programs – one for every different level. The sensible and very applicable vowel trainer Kvoctrain is extremely useful for users of all levels – pupils and teachers alike – as are the geometry drawing program Kgeo (Figure 4) and the home planetarium Kstars. Pre-school children can learn the letters of the French alphabet with the Klettres–bear (Figure 5), and then practice touch-typing with Ktouch. Using these programs is not always child’s play – the mode of operation of some applications is not self evident without studying the documentation (which is not always available).

Easier operation At the top of the list of applications that have undergone the most improvement are (next to the mandatory Konqueror) two very different applications: Konsole and Kmail. The first now also responds to the following command line options: –tn terminal Typ, – – noframe, – – noscrollbar and nomenubar. While changing the terminal type (for example on vt100), it is possible to do without the shadow around the command line field on a Konsole with a missing frame in order to keep things as simple as possible. This is particularly interesting for people who operate remotely, potentially from machines with other operating systems. This can be switched on again (the same for a missing scroll bar) through the Settings menu item. There is even a quick variation that doesn’t need the menu bar: the key combination of Ctrl+Alt+M will do the trick. On the strange side for a program of such a modest range of functions is Konsole’s new “Tip of the day” feature. KMail for its part can now read mailboxes in the Maildir format (one email per file, whereby a higher ranking directory represents the mail folder). In particular, this will make fans of the Qmail mail server happy. On the other hand, the IMAP problem child

remains just that: we unfortunately could not test the announced improvements in the pre-version as the program constantly crashed when trying to establish a connection with the IMAP server.

Good things come in small packages The planning list for KDE 3 was long and not everything on that list was implemented. There was originally the idea of an icon server, which was to cache icons during a KDE session, i.e. make icons available that had already been used in an application. The target of this was to accelerate the loading time at the start of an application. However in the course of the discussions, it turned out that the problem could be solved without the use of an additional help program. If icons are only loaded when they are really needed by the application (instead of all at the beginning), this not only speeds up the starting time, but also saves yet another server. Whether all the new innovations and improvements are interesting enough to warrant a transfer to KDE 3.0 is for each individual user to decide. Several KDE and Qt versions can also peacefully co-exist next to each other if disk space in not a limiting factor. The decision not to put its users through any major changes (apart from transferring to a new library version) is testimony to the fact that the KDE team has become more mature and responsible.

Info Announcements on the new KDE releases: http://www.kde.org/announcements/ Planned features for KDE 3.0: http://developer. kde. org/development-versions/kde-3.0-features.html Co-existence assistance for KDE 2 and 3:http://www. pupeno.com.ar/runningkdes/ http://www.rons.net.cn/english/FSM/2kde3 http://www.kde.org/kde2-and-kde3.html

KDE 3.0 Supplier Web For Against

KDE.org http://www.kde.org Grows community spirit The benefits aren’t obvious

rating

Issue 20 • 2002

LINUX MAGAZINE

29


ON TEST

Run virtual machines under Linux

VMWARE 3.0 VMware is the oldest commercial PC emulator for Linux. It has just been brought out in its newest version

E

ven standard PCs, sold en masse through supermarkets and computer discount chains, are amply equipped today: Pentium 4s or AMD Athlons with 1.5GHz processors are common. The manufacturers are also generous when it comes to the working memory, with 256Mb RAM being pretty much a standard in today’s climate. Such a system can, operated under Linux, easily allow for a second operating system using an emulator, such as VMware.

3.0, which supports Windows XP. HansGeorg Esser puts it through its paces

It comes at a price VMware Workstation is anything but cheap. Those who use Linux mainly because most applications and updates can be acquired either cheaply or for free will not be too happy about the price tag of the version 3.0. It comes at £225 for the boxed version and £205 when downloaded from the Web server as a VMware archive (prices from http://www.greymatter.com or http://www.qbssoftware.com). If you qualify under the educational heading then http://www.pugh.co.uk has it for £139 for the boxed CD or £119 for the key. If you wish to purchase the product directly from USA, the prices are $329 (plus delivery) for the boxed

set and $299 for the download option. The good news for those of you who have the version 2.0 is that the update only costs £150/£120 (boxed/download version).

No-hassle installation We tested the installation of VMware Workstation 3.0 under SuSE Linux 7.3 on a Pentium 4 1.4GHz with 256Mb RAM. The rpm package was installed with a simple rpm –i .... As in the older VMware versions, the setup script command vmware-config.pl comes next. This installs the kernel modules necessary for operation and sets up the DHCP and Samba servers. These servers allow the guest operating system an automatic network configuration and (so that it is a Windows configuration) access to the user’s Linux home directory. The first use of the vmware command, that can now be carried out with normal user rights (no longer only with the administrator root rights), causes VMware to ask for the licence key. Using the licence key, as well as the details of user name and company, VMware generates a licence file, located under ~/.vmware/license.ws.3.0. Old VMware 2.0 licence keys can no longer be used. By the way, in contrast to older versions, only one key can be used. This key runs out at the end of thirty days and can only be substituted by a full-blooded (and fully paid for) licence. The VMware Configuration Wizard can be started as soon as the key has been activated. This initiates the set up of a new guest operating system. VMware Workstation 3.0 supports MS-DOS, Windows (3.11, 95, 98, Me, NT, 2000 Pro, 2000 Server, 2000 Advanced Server, XP Home, XP Professional), Linux and FreeBSD (Figure 1).

Windows XP as a guest

Figure 1: VMware Workstation 3.0 supports more guest operating systems than ever

30

LINUX MAGAZINE

Issue 20 • 2002

We were primarily interested in testing the XP installation, as it is well known that VMware works well with older Windows versions. We therefore selected XP Professional and took on all the standard settings for the virtual drive and the network installation. Confirming the specifications will cause the Wizard configuration to close. Clicking Power On in the VMware window will then activate the virtual PC, which, after the normal BIOS set-up run and self


ON TEST

Figure 2: Looks like a PC, acts like a PC: starting the virtual computer

test, is booted from the Windows CD (Figure 2) After the completely installed XP is started for the first time, there is not a lot to see, as the monitor is set to four bit colour depth –. Don’t panic – the VMware Tools, integrated into VMware, can easily remedy this. Simply select the menu point Settings/VMware Tools Install (Figure 3) in VMware. After confirmation by clicking Install in a dialog window, a new virtual drive is integrated and XP automatically starts the setup program (that is saved on it). XP seems to have some reservations about this graphic card drive and acknowledges this with a warning. Simply ignore this by clicking Continue Installation and the installation will continue without any further hitches. The new drive is activated immediately (no restart necessary!), so that moving the mouse outside the VMware window is not a problem and, thanks to an increase in the colour depth, the desktop display is back to what we would have expected. In contrast to the earlier versions, this is really neatly done. The only thing you will want to change before starting work is the screen resolution (for example to 1024x768). This can be achieved through the properties dialog (context menu on the empty desktop). See Figure 4.

Figure 3: The “Insertion” of the VMware Tools disk is done through the menu

Network Out of the box, VMware supplies a DHCP server on the vmnet1 virtual network interface. As the VMware network card is installed, XP is thereby supplied with an IP address and can access the host computer. VMware uses its own sub-network for this, which is separate from the normal network (which is created later). If you don’t want this, because for example you want to be able to access an Internet gateway in the local network, you can also assign the guest system an address in the local network. The change in configuration takes place quickly under Windows XP:

Figure 4: When the VMware Tools are installed, the resolution can also be set

● Open the system controls through Start/System Controls. ● Double click Network Connections. ● Click the LAN Connection icon. ● In the new window “Status of LAN Connection”, activate the Properties button. ● A second window appears. Choose the “Internet Protocol (TCP/IP)” point on the list and click Configure. ● In the third (and last) window, “Properties”, activate the IP address, sub-network, gateway and DNS server manual input, and enter the necessary data for the local network. The inputted IP address must naturally be up and running. ● Close all the windows (in the opposite order) by clicking OK or Close. A reboot is not necessary here. XP allows (as did its predecessor Windows 2000) changes to the network configuration without the necessity of a restart. If Issue 20 • 2002

LINUX MAGAZINE

31


ON TEST

everything has worked, you can check the network route in a console window: Start/All Programs/Accessories/Entry Request (Figure 6). You can then test the connection with the preinstalled Internet Explorer (Figure 7).

At long last, ISO images To have more than one CD constantly available has always be a simple matter under Linux. All you need is to create a one to one copy (an Image) of a CD using: dd if=/dev/cdrom of=/tmp/cd-image.iso This can then be mounted at any time with: mount –o loop /tmp/cd-image.iso /mnt/cdrom VMware Workstation 3.0 allows this for its guest systems with a similar amount of ease. The “CD-ROM Image” device type can be selected in the configuration editor under SCSI or IDE Devices. After entering the image file name and clicking install, the CD image will be available the next time the virtual Windows is started under its own drive ID (letter). Figure 9 shows the image as an extra “E: Drive”, although the normal DVD drive can of course continue to be used. Thanks to SCSI emulation, a whole selection of images can thus be permanently incorporated. From Windows’ point of view, the ISO images are genuine CDs in physical CD drives. – Software which checks whether it was really started from a physical CD and not from disk or from the net can therefore be persuaded to work in this way.

Figure 5: In order to be able to access the servers or gateways in the local network, simply modify XP’s network settings.

Figure 6: You can also check that the settings are correct by entering “route print” in the command line.

Raw disks – IDE and SCSI

Figure 7: If the connection is OK, XP’s Internet Explorer can also call up the Linux Magazine homepage

32

LINUX MAGAZINE

Issue 20 • 2002

Is there yet another “native” Windows installation on your system in a FAT or a NTFS partition? If so, then you will be pleased about the possibility of simply integrating the real disk like a virtual one. To do this, go into the configuration editor and simply assign a free IDE or SCSI device with the appropriate device file (e.g. /dev/hda for the first IDE drive) and the type “Raw Disk”. In principle, you can even do without the creation of a virtual drive and operate only with the real thing; a parallel boot up of the same Windows installation on the genuine and virtual computer will however probably fail due to large differences in hardware. The direct drive-access is


ON TEST

nevertheless advantageous, as this gives you the possibility of accessing the NTFS partitions of your computer from the guest system: NTFS filesystems can only be “read only” mounted under Linux, and even this often causes difficulties. In the test, the access to the real drive and two partitions created by Windows 2000 (NTFS and FAT) was possible without a problem. By the way, read and write rights are necessary for the direct drive-access to the appropriate device files. In the case of SuSE Linux 7.3, this could be achieved using one of two methods: ● Admission of the user into the “disk” group. All members of the group disk can access the drive because the /dev/hda file belongs to the root user and the disk group and has the “rw–rw– – – – “ rights. Open the /etc/group file as root and modify the line “disk: x: 6: “ to “disk: x: 6: username “, whereby username must be adapted accordingly. For this reason, the VMware manufacturer offers so-called “Guest OS Kits”. These allow a guest operating system to be created faster, as the complete installation procedure has already been executed by VMware. In the case of Windows 2000 Professional (the only presently available version), the whole installation is taken care of merely by the entry of the serial number.

Figure 9: Under XP, the image is displayed as the “E: Drive”, the DVD drive is denoted as D:

Performance Figure 8: VMware now supports the integration of ISO images

● The second possibility is simpler but is only recommended on a single-user computer, as this gives every user full read and write rights to the disk: chmod a+rw /dev/hda.

What else is new? The outstanding new feature of VMware workstation 3.0 is clearly the support of XP. We have already discussed some other features, and as well as these the new version also has: ● USB support, through which, for example, USB cameras that are not supported by Linux may be used, ● DVD support, ● NAT (network address translation): with this network alternative, the virtual machine shares the IP address with the Linux host. This on the one hand simplifies the set-up, but on the other hand leads to problems if both computers (host and guest) want to offer their services on the same port.

We installed VMware on a Pentium 4 1.4GHz. The program was executed both locally, as well as remotely from an available computer within the network. XP ran in the emulated computer at a sufficient rate in both cases; only in the remote access did the slowed screen construction lead to us waiting. Under normal application however, such as the start on the host computer, all features of the program worked smoothly. The improvements of VMware workstation 3.0 over the predecessor make an update into an interesting proposition. – Hard to understand is the sharp increase in price. This makes VMware, as well as the need for an additional Windows license, into an investment of sizable magnitude. With the new prices, VMware has signalled its departure from the private user market. Perhaps a 3.0 version of VMware Express will also appear on the market in the not-toodistant future. VMware Express 2.0, which was available until recently, permitted the installation of Windows only as a guest system and was markedly cheaper. Issue 20 • 2002

VMware 3.0 Supplier Price Web For Against

Vmware Inc. £225/205 http://www.vmware.com Stable, performs well Now very expensive

rating

LINUX MAGAZINE

33


ON TEST

The complete email solution?

CALDERA VOLUTION MESSAGING SERVER 1.0R There are now more and more commercial products joining the already gigantic range of Open Source MTAs, promising an integrated solution together with a Web interface. Nico Lumma investigates just one example, Caldera’s Volution Messaging Server

A

n MTA (Mail Transfer Agent) alone rarely comprises the complete mail infrastructure in companies these days. There is usually an IMAP server as well, and since the invention of the Web as the all-beatifying Internet service, electronic mail should as far as possible also be accessible via the Web. The idea is that people who don’t want to devote a great deal of time to assembling separate software components will, conversely, rather spend some money to get a total solution. Caldera’s product for this target group is called the Volution Messaging Server 1.0. As well as the product CD, the manufacturer and Linux distributor also supplies a somewhat slender manual, in which installation and configuration are explained. Caldera confidently insists that you use its own operating system for the mail solution: Open Linux Server 3.1 or Open Unix 8 must be installed on the prospective mailserver. The Linux distribution is nevertheless also available as an out of the box product by download. Caldera Open Linux Server 3.1 was installed in short order on the test server, which occurred very rapidly and efficiently thanks to the multi-tasking installation tool Lizard, which functions beautifully. When the Messaging Server product CD is then inserted in the drive, with the KDE desktop open, it is automatically recognised and KDE merely enquires as to whether autorun.sh should be started automatically. If this is agreed to, the installation of the necessary packages proceeds extremely briskly (Figure 1) and, at the same time, completely free from any configuration queries. Lastly, rpms are installed with the graphic progress indicator keeping the user informed about the activities of the installer.

Figure 1: Installation is done automatically

34

LINUX MAGAZINE

Issue 20 • 2002

Getting started Since 4 January it has been possible to download the Maintenance Pack 1.0.1 from the Caldera FTP site. The user only has to unpack a tar archive and execute install.sh – the rpms are then automatically refreshed. The Maintenance Pack fixes security problems in MTA Postfix, the Cyrus IMAP Server and the Web-mail solution IMP. It takes relatively little time to get Open Linux Server 3.1 and the Messaging Server – including updates – up and running. This is also speeded up by the fact that the installation completely skips the restarts, which are usual with other distributions. The Messaging Server is then configured via a Web interface, which can be found at https://Hostname/msg. The Apache Web server is automatically started on the Messaging Server and can make SSL-encrypted connections in its basic configuration. The admin area is reached in the usual way with the username-password combination admin/admin, which is why the first thing the system administrator should do is change the password of this user. The Web interface itself is very clear and divided into four main points: Domains, Users, Aliases and System (Figure 2). In the test environment there is only the domain, localhost, which is why it is a good idea to create at least one proper domain first of all (Figure 3), to which one can then add one or more users, who can also be given aliases. Domains, users and aliases which have been created can, of course, be changed or deleted. The LDAP server stores all the data. For both users and aliases, there is a search mask, with the aid of which one can find the corresponding entries quickly and easily. The menu item System offers the Admin the option of changing his password or getting an overview of the current processes in the Messaging Server. He can also grant users some access options. These include changing the respective password, adapting a user profile or making one’s own aliases. If a more detailed Postfix configuration is desired, though, the system administrator must rely on an editor and modify the corresponding configuration files. The Web-based configuration menu is also available to the individual user, although in this case it is only


ON TEST

Figure 2: The Admin area after logging in

possible to change a few personal settings or to install a vacation memo or a mail-forward. Options, such as mail-filters or more complex vacation configuration will, however, be sought in vain.

Outlook as the measure of all things? The item Client-Setup offers one very interesting feature, which allows Outlook/Outlook Express (98, 2000, XP) to be configured automatically. A click on Configure creates a Visual Basic script file with the personal configuration data of the user, which is then immediately executed and makes the corresponding settings in Outlook and sets up an account. At this point, there was an error message in the test, but nevertheless the corresponding data was saved for posterity in an Outlook account. This is how users of this Windows mail client obtain a completely configured email account and fully installed access to the LDAP server at no great expense. For other mail programs, the menu item Client-Setup allows all important data to be seen at a glance, in order then to enter it into the configuration of the Mail User Agent. Caldera explicitly points out that the Messaging Server is compatible with Outlook. This is certainly true, since Outlook speaks POP3, IMAP and SMTP like any other good mail client. But this statement suggests a range of functions similar to Microsoft’s Exchange Server – and that’s promising far too much. The Windows mail client can certainly call on

Figure 3: The options for making a domai.

the LDAP server of Messaging Server and via the free/busy function you can make your schedule available, but this extends only as far as showing others in the LAN when you are busy or have some time. The complete integration of the calendar feature with the server does not, however, exist. This would, for example, enable users to let other people enter and/or delete an appointment or to block times. The Web-mail client IMP (version 2.2.7) which comes as part of the package functions solidly, though it is unfortunately not integrated in the Messaging Server, but to be found at https://Hostname/horde/imp. IMP (Figure 4) offers all features one would expect of a Web-mail client: It can cope with several folders and subscribe to various IMAP folders, allows searches of the LDAP databank and can send attachments. However, it offers no option for filtering emails. It would also make sense to be able to apply Procmail or SIEVE rules actually on the server – here, too, Messaging Server has to pass.

Figure 4: The inbox under the IMP Web-mail client

Conclusion Even though Volution Messaging Server’s range of functions is fairly slender, it does look attractive for those who don’t want to configure this functionality themselves. The installation, during which only the required packages are installed, works without a hitch and getting started is equally smooth. However, a Web browser admin will run aground early on, doing everyday tasks such as entering a relay mailserver – without a text editor and Postfix know-how, nothing will work. Nor do the manual or online help provide any assistance. One tasty morsel is the automatic configuration script for Windows users, but this should be expanded as a matter of urgency for Linux users, too. Lastly, the high price for not very much in the way of functionality will play a part in the implementation decision, especially in view of the licensing policy, which, under the cheapest licence, allows it to be used by only 25 clients. Issue 20 • 2002

Volution Messaging Server Supplier Caldera Price $899 (plus $249 for Open Linux Server 3.1.1) Web http://www.caldera.com For Easy to install and get started Against Expensive, limited function range

rating

LINUX MAGAZINE

35


ON TEST

Acronis OS Selector 5.0 Deluxe

OS SELECTOR Steve Cobrin takes a look at the latest version of the partition and boot manager which includes support for Windows, XP NTFS, SuSE Linux 7.3 ReiserFS, and Red Hat Linux 7.2 Ext3 filesystems

A

cronis’ OS Selector is a very powerful product, which uses a simple GUI that combines a very powerful disk editor, partition manager and boot manager all in one. It understands Linux filesystems, including EXT3 and ReiserFS; it can copy, move and resize partitions; and though it may not be as user-friendly as competing products like PowerQuest’s Partition Magic, with which, unfortunately, it also shares the same licensing restrictions (use by one person on one machine only), it does have a few extra features. It’s questionable, though, whether these are enough to make the product a worthwhile purchase.

What’s in the box? The software comes boxed, with lots of impressive sounding product info on it. Inside the box were a CD, manual and a registration card containing the Product-ID used when configuring the software and registering with Acronis. The CD runs from Windows, can create install

LINUX MAGAZINE

Test machines Laptop 1: Pentium II MMX 200MHz, Hi-Grade Notino AS6000, 80Mb RAM, 6Gb IDE hard disk, floppy drive. When we tried to boot the CD on this Laptop, OS Selector immediately fell over with a program exception error. When a Partition Magic rescue floppy was used, it identified a disk error, fixed it and successfully came up. OS Selector still failed to run. We deleted all the existing partitions and tried again, still without success. We finally tried swapping the hard disk, all to no avail. Not an auspicious start. Laptop 2: Pentium III 750 MHz with SpeedStep, HiGrade UltiNote AS8400, 192Mb RAM, 20Gb IDE hard-disk, floppy drive, DVD drive. This time at least the OS Selector boot ran, and offered to install itself, however it needed a FAT32 or FAT16 partition to install in and had problems finding one until we ran the Disk Administrator option and created and formatted a partition for it – all of which is supposed to be automated. The system configuration that we were trying to achieve was as follows:

OS Selector Boot Menu

36

floppies and, best of all, is bootable and will take you straight through to install the software, or allow you to repair some conditions. The CD contains Adobe Acrobat 5, OS Selector itself (version 5.00 build 472 for this review) and a PDF version of the printed manual. Ok what should things look like? The DOS-like OS Selector screen displays on boot-up and offers the choice of booting via mouse or cursor keys to Windows XP or Linux. In the case of the Linux option it actually boots to LILO, where we choose the specific configuration of Linux we want. It is important to note, that you must still maintain an appropriate LILO or GRUB configuration, if you want to boot Linux, and that this may need to be recreated after any partitioning changes. This implies that you must ensure you maintain a Linux boot floppy.

Issue 20 • 2002


ON TEST

A unique feature of OS Selector is the support for Linux Ext3 and Reiser FS filesystems

14Mb

Primary hidden FAT16 OS Selector partition 4Gb Primary NTFS – Windows 2000 Standard server 4Gb Primary NTFS – Windows .NET server beta3 Extended Partition containing: 6Gb FAT32 Windows data partition 3.35Gb SuSE Linux 7.2 – root partition 805Mb Linux – /home partition 399Mb Linux – swap partition It should be noted that Partition Magic does NOT support the management of partitions containing Windows Server OSes, for that you need the significantly more expensive VolumeManager version. At various times OS Selector offered to select support for ASPLinux, a distribution we’d not heard of before – we chose not to. After setting up our partitions, it was interesting to note that Partition Magic thought that there was an error with our setup, as OS Selector created a partition that was on a cylinder boundary. It is unfortunate that partition managers can disagree as to what should be reported as an error. Also at one point it appeared as though our Linux Swap partition began before the start of our extended partition. It’s not clear whether OS Selector caused this – it certainly couldn’t fix it and in the end we had to fix it by recreating the partitions from fdisk running from a Linux Rescue disk. We really wanted each Windows OS to think it was the C: drive, and the FAT32 partition the D: drive. This is the sort of sneakiness we’ve previously managed by using PowerQuest’s Partition Magic and Windows 95 and 98SE. However, we just couldn’t work out how to do this with Windows 2K and OS Selector. Once OS Selector is installed and configured, its not always clear what partitions are being booted, and we never got the partition hiding features working properly. After selecting “Use Windows NT/2000/XP partitions hiding” against the .NET partition, things went badly and it wasn’t possible to boot anything but Linux. This would have been easily remedied if OS Selector had an option to allow booting from CD, whilst hiding selected partitions. I’ve only seen this available once on QuarterDeck’s Partition-It software, which seems to be no longer available. Well, eventually I decided to give in and reinstall, and let Win .NET and Win 2000 have their own unique drive letters. After that it all went quite well – the partitioning software is quite intuitive, although the GUI is much less elegant than that of Partition Magic. Laptop 3: Pentium III 1.2GHz with SpeedStep, Dell

Latitude C610, 512MB RAM, 30GB IDE hard-disk, floppy drive, DVD/CDRW combo drive. Having installed Windows XP and SuSE Linux 7.3 on the third laptop, all seemed well enough. Although Partition Magic complained of a partitioning error on the disk, OS Selector didn’t seem to care. It’s difficult to know whether to be worried or not about this, which in itself is quite worrying! Desktop PC: Dual Pentium III 400MHz, ASUS P2BS Motherboard with on-board SCSI Ultra 2, 256Mb RAM, 1x9Gb SCSI hard disk, one 1x18Gb SCSI hard disk. This is a machine on which we’d already had several versions of Windows and Linux installed, so there was a lot of legacy partitioning for OS Selector to configure; it really wasn’t very happy. The menu we got it to provide was: ● 1.Windows XP Professional Edition ● 2.Windows 2000 Professional Edition ● 3.Linux The interesting thing, with the NT-family of Windows is that they have their own boot loader, which will be automatically configured when Windows installs, so selecting either Windows options actually takes you to the same menu as defined by the BOOT.INI on the first Windows partition. Unfortunately for us, the Windows XP option refused to load, giving the message “NTLDR is missing”. We didn’t get any complaints or assistance from OS Selector throughout this process and the documentation is a bit light on troubleshooting.

Conclusion In general, OS Selector can only be recommended if you need the extra Linux filesystem and Windows Server support, and want to learn lots about the intricacies of partition and boot management. Otherwise we’d recommend Partition Magic and, if you’re feeling more frugal with your money or want get close to the bare metal, look to use existing Linux tools and freeware Windows tools. Issue 20 • 2002

OS Selector 5.0 Deluxe Supplier Price Web For Against

Acronis £35 to £49 www.acronis.com/products/oss50 Some unique features Non-Free software, bit glitchy

rating

LINUX MAGAZINE

37


COMMUNITY

FREE AS IN FREEDOM: RICHARD STALLMAN & THE FREE SOFTWARE FOUNDATION R

ichard Stallman is one of the personalities that every user of Free Software should know about, for without him there might not even be such a thing as Free Software. It was the GNU project, which he started some 20 years ago, that made it possible for Free kernels like Linux to become the Free operating system that we know and love, or at least read about. The 240 pages in this book go a long way to uncovering details about the man, giving answers to the question “what makes the man tick”, as well as giving an

insight into the ethics of the ‘hacking culture’ of the 1970s from which the GNU project grew. There is a nine page index allowing you to revisit the passages you’ve found most interesting and, even more usefully, the 13 chapters in this book have footnotes detailing reference material used by the author, enabling the committed Stallman researcher to follow up if they wish. The book also explains, and is published under, the GNU Free Documentation Licence, which is only fitting for a book about freedom.

Author Publisher Price ISBN

Sam Wiliams O’Reilly £15.95 0-596-00287-4

THE JOY OF LINUX

T

his is one book that really is a joy to read. It’s amusingly written and well

38

LINUX MAGAZINE

Issue 20 • 2002

illustrated with cartoons, some of which are just begging to be copied and pinned to the fridge to be read over a morning coffee. What better way to start the day than with the warm fuzzy feeling that you are among the righteous and chosen ones in your belief of Linux? Despite its obvious American bias (the chapter on the pros and cons of major distributions did not even touch on SuSE) the book gives a very fair overview of the current situation of Linux. An obligatory chapter covers the history and development of the operating system followed by more interesting anecdotes on using Linux for the first time, and how to cope. Other chapters cover the internal arguments in the Linux community, security, games, hardware, how to dual boot a machine and women in computing (yes really, this book is very PC in a non-

computing sense). A very comprehensive list of resource sites and books would be useful to anyone researching Linux or needing help in starting to use it and the final appendix contains the full GNU Public Licence should you have a burning desire to read it at any time. The authors do have certain prejudices but they are upfront about them, (If you are a vi user you should skip parts of chapter four) and they are prepared to admit that people hold other views. If you want some enjoyable bedtime reading to make you feel good about using Linux then this is the book for you. Author Publisher Price ISBN

M Hall & B Proffitt Prima Tech £21.99 0-7615-3151-3


KNOW HOW

The Linux daemon on steroids

XINETD f you are already familiar with inetd from UNIX or the earlier versions of Linux, just think of xinetd as inetd on steroids; it can do what inetd does plus a whole lot more.

I

In a previous article

xinetd in a nutshell

you can protect

xinetd is the main TCP/IP server and it controls the majority of network connections to your host, allows connections to be logged, provides general access controls and time-based access control. It also allows specific services to be bound to a specified interface to allow balance of network traffic to the host. It can also be used to forward services to another host as a sort of DIY fail-over service. xinetd’s job though, is mainly to determine what daemon should start for each incoming connection, like Telnet, FTP or rsh. We won’t look at all these features just yet. xinetd is shipped with most Linux distributions. Depending on your set-up you could just have one file, /etc/xinetd.conf, but this configuration can be a bit of a headache to administer. Most vendors now split the configuration up into many files, one file for each service and one main default configuration file, as shown in Figure 1. Be advised, if any changes are made to the xinetd configuration files the xinetd daemon must be restarted by either:

incoming TCP-based

$ /sbin/service xinetd restart Or alternately:

Listing 1: Listing of /etc/xinetd.d/telnet service telnet { flags= REUSE socket_type= stream wait= no user= root server= /usr/sbin/in.telnetd log_on_failure= USERID disable= yes }

we looked at TCP Wrappers and how

connections, like FTP and Telnet. In this month’s article David Tansley looks Figure 1: Listing of xinetd.conf and /etc/xinet.d directory

$ /etc/rc.d/init.d/xinetd restart

a bit more closely at securing your server with xinetd,

Or alternately:

or the Extended

$ /usr/bin/killall –TERM xinetd

Internet Service

The configuration basics The main default file, /etc/xinetd.conf, lets you set the defaults for logging successful and failed connections. In Figure 1, the instances is set to 60, this is the number of requests that a service can handle at a time. If the Linux machine is part of a big network, pump it up to 90. The log_type is how and where the logging will occur, as this is set to SYSLOG authpriv, then syslog will handle the logging, which is the default. Being logged as an authpriv means the content maybe privileged information, like usernames or IP addresses, but not the passwords. Depending on your Linux flavour these messages will either be logged into /var/log/messages or more probably to /var/log/secure. Lets now look at a typical service configuration file – as Telnet is a commonly used service this makes it a good choice. The flags option of REUSE, lets the TCP/IP socket (that’s the protocol Telnet uses) to be well, reusable, in simple terms all this means is that the service can be restarted on the fly. The socket_type STREAM is the type of TCP/IP used, stream is used for both Telnet and FTP connections. When a connection for Telnet is requested xinetd will either Issue 20 • 2002

Daemon to call it its proper name

LINUX MAGAZINE

39


KNOW HOW

operate a multithreaded (unlike MS Windows) or single service. The wait option says NO, so for every new connection a new instance of in.telnetd daemon will be created. If wait had been set to YES, then the incoming Telnet connection would wait until the in.telnetd daemon had finished serving the previous request, before it would service the next request. The user is ROOT, this means the service will run as root User ID. The actual server will be the Telnet daemon /USR/SBIN/IN/TELNETD. It would be good to log all failures to syslog, so log_on_failure will log the User ID as well as the IP Address of the failed connection. When xinetd is initially shipped it comes pretty much secure, with Telnet disabled, so if your machine is on a network and you cannot connect to your host simply change the disable entry from YES to NO.

Controlling services To disable a service there is no need to go around every services file located in /etc/xinetd.d and then edit the particular services file you wish to disable, this can be done globally through the defaults file /etc/xinetd.conf. Here’s how: simply put the service you want disabled on a new line that contains the following: disabled = <service to disable> <service to disable> <?.> So, to disable say Telnet and FTP you would create a entry like the following: disable = telnet ftp Notice that a space separates the services.Figure 2, shows the defaults file with FTP and Telnet disabled. As mentioned before, for the effect to take place you’ll need to restart xinetd.

IP-based control access You may want to allow connections to a service from the local network, but disallow it from any other network. This is accomplished using the keywords ONLY_FROM by just specifying the IP/Network address. If we want only Telnet to be accessible from the network address of 192.168.10.0. Edit the Telnet file in /etc/xinetd.d directory and insert the following: only_from = 192.168.10.0/24 The zero at the end of the IP address (192.168.10.0) is a wildcard. The /24 is the netmask. Normal fully qualified hostnames can also be used, (such as bumper.somedomain.com) as long as they are resolvable. Let’s now turn our attention to the FTP service. Imagine we have a local company who download extracts from their database and then FTPs it to our system, so that we can import it into our databases. The other company’s host IP address is 192.168.8.23; as our company is very security conscious, we only want this specific IP address to use the FTP service. You are not bound to use network addresses in specifying the entry in ONLY_FROM, though it is much easier to. You can just use the actual IP as in the following: only_from = 192.168.8.23 The following is an extract from the error log /var/log/secure, informing us that a host with an IP address of 192.168.1.12 tried to FTP to our Linux machine and failed. It also tells us the date and time and the process number (PID). Mar16 12:32:42 bumper xinetd[1380]: START: ftp pid=1383 from=192.168.1.12 Mar16 12:32:42 bumper xinetd[1383]: FAIL: ftp address from=192.168.1.12 Mar16 12:32:42 bumper xinetd[1380]: EXIT: ftp pid=1383 duration=0(sec)

Being a systems administrator, one of your firsts tasks each day should be to check the logs. To quickly check on failed accesses, use egrep. The following one-liner will print out lines that contain either FAIL or Auth* (for Authentication) from files ending in .log. $ egrep “FAIL | Auth*” *.log

Figure 2: Listing of /etc/xinetd.conf with FTP and Telnet disabled

40

LINUX MAGAZINE

Issue 20 • 2002

To specify more that one host IP address, the proper format is to enclose the non-network part in curly brackets, separating them with commas. For example suppose we wanted to specify the following hosts: 192.168.1.8, 192.168.1.20, 192.168.1.22 and 192.168.1.50 on the 192.168.1.0 network. We would use the following to include those IP addresses:


KNOW HOW

only_from = 192.168.1.{8,20,22,50} Similarly, to specify more that one network address, for instance to allow network addresses 192.168.8.0 and 192.168.10.0, use spaces to separate the entries, like the following: only_from = 192.168.8.0/24 192.168.10.0/24

Time-based control access You may have a security policy where FTP must be closed down when office hours are over. xinetd lets you specify in a HH:MM format when a service can be disabled. To disable FTP from 17:30 through to 09:30 the following morning, using the ACCESS_TIMES entry we could specify the following in the FTP (wu-ftpd) file: access_times = 17:30-09:30 Being more adventurous we can also specify that the service is to be disabled at lunch break times: access_times = 12:30-14:00

17:30-09:30

Unfortunately this format does not allow for a day number or day of week sequence. To disable it over a weekend you’ll have to edit the defaults file and insert a disable entry, like we have done previously. A better solution however, would be to make a couple of copies of xinetd.conf, one for normal working (xinetd.live) and the other with the daemons you wish disabled (xinetd.disable), then use cron to automate it. The following crontab entries would on a Friday at 17:30 copy the xinetd.disable over to xinetd.conf, and on Monday at 07:30 copy the original (xinetd.live) back, ready for business.

All you need to do is specify the IP address and the port of the forwarding machine. Assume the local host has an IP address of 192.168.1.10. We wish to forward all FTP connections to a backup FTP server, which has the IP address of 192.168.1.15, the FTP port number is 21. To see what port numbers match what service check the /etc/services file out. Using the redirect entry, our FTP (wu-ftpd) file would look like Figure 3. Your file may look slightly different. When a host tries to establish an FTP connection to our host, their screen will display a ‘Trying?192.168.1.10’ message, then the re-direction will kick in and a connection will be established to the backup server (192.168.1.15).

Info Xinted homepage http://synack.net/xinetd

Conclusion xinetd by itself enables you to create a fairly secure policy from daemons that are launched from xinetd. We have demonstrated how you can control your daemons, based on access via hosts and IP addresses and how to enable/disable the daemons, as well as simple time-based access control. We’ve also shown how you can implement basic redirection of services to another host. What we’ve shown this month has been without the involvement of TCP Wrappers, so if you do not have TCP Wrappers installed you’re not out on a limb security wise.

30 17 * * 5 /bin/cp /etc/xinetd.disable /etc/xinetd.conf >/dev/null 2>&1 32 17 * * 5 /sbin/service xinetd restart > /dev/null 2>&1 30 7 * * 1 /bin/cp /etc/xinetd.live /etc/xinetd.conf > /dev/null 2>&1 32 7 * * 1 /sbin/service xinetd restart > /dev/null 2>&1 Figure 3. Redirect entry in the FTP (wu-ftpd) file

A bit of redirection xinetd offers redirection (of sorts). This function allows you to redirect a service to another machine. Why do this? Well suppose your FTP directory structure got blitzed or perhaps the performance of your current machine is underachieving. You will want a quick solution to redirect all incoming connections to another host.

The author David has written two Linux-based books and several magazine articles and enjoys riding his motorbike when it’s not raining. David is a Senior Systems Analyst at ACE Europe, a leading Insurance company.

Issue 20 • 2002

LINUX MAGAZINE

41


KNOW HOW

Linux Networking Guide: Part 1

CREATING A CONNECTION Bruce Richardson presents the first part of our guide to configuring Linux networks from the command line. In this issue we look at how to connect a computer running Linux to a network

W

hatever the virtues of the applications that can be run on Linux, one of its greatest strengths is its power and flexibility as a network operating system. Some people (including me) believe that you haven’t really done grown up computing until you’ve done networked computing. This series of articles is designed to show how Linux networks can be configured using the simple command line tools and text configuration files common to all Linux systems, using tools that are common to kernels from 2.0.x to 2.4.x. Where of interest, examples of configuration from specific distributions will be given but the emphasis throughout will be on portability. The article will restrict itself to IPv4 only. This article describes how to choose and install a network card and how to configure and activate a network interface. Future articles will build on this to show how complex networks can be build from simple tools.

BNC versus RJ45 Older Ethernet networks (and cheap home network starter kits) use cards with BNC connectors, connected together with coaxial cable. BNC NICs can be identified by the stubby metal cylinder that is the connector. This kind of set-up is slow (maximum theoretical speed of 10Mbps) and fiddly (the cable must be terminated at each end, you may need to cut and crimp the cable yourself). However, it does have the advantage that you can connect more than two computers using just one cable: you simply add T-connectors to the cable at appropriate intervals. Newer networks use cards with RJ45 connectors, connected together with UTP cable. RJ45 nics have sockets which look similar to those on modems. The cards typically come in 10Mbps or 100Mbps (Fast Ethernet) speeds, 100Mbps being the standard at the time of writing (Gigabit Ethernet is mostly restricted to the core of high-performance networks). This kind of network is faster but a UTP cable can only be used to connect two devices. If you want more than two computers on your network you will need to connect them to a hub or switch. It is possible to get combo cards, which have both BNC and RJ45 connectors, though I’ve never seen one that was faster than 10Mbps.

42

LINUX MAGAZINE

Issue 20 • 2002

Network essentials To function as part of a network your computer needs, as a minimum: ● A physical connection to the network. There are quite a few ways to connect to a modern network but this article will concentrate on the most common way: the internal Network Interface Card, henceforth referred to as a NIC. ● An address on the network. It’s no use being able to talk to other computers if they can’t find a return address to talk back to. ● A way of determining how to reach any given address. That is to say, given an arbitrary address to connect to, can we find it on this network, can we reach it through this network or must we find some other route? This article covers items one and two. The next article will use item three as the basis for a demonstration of how a Linux box can be turned into a router and gateway for a network.

The physical connection There are several ways to connect a PC to a network but we’re going to look at internal network cards. If you’re doing this on a budget, maybe with second hand kit inherited from a kind benefactor, choice may not come into it. If you do have a choice then there are several things to consider: Price You get what you pay for. Cheap generic cards can be found for as little as £12 but don’t expect them to perform well at high loads or to autonegotiate connections reliably (if at all). It may also be difficult to identify the chipset on a generic card, which will make it difficult to find the correct driver. Personally, I would be sure to buy a reliable, wellknown brand and I wouldn’t consider spending less than £30 on a card. Network type What kind of network do you want to connect to or set-up? A BNC/Coax network or RJ45/Cat5 network, 10Mbps or 100Mbps (See the


KNOW HOW

BNC versus RJ45 boxout)? If you have the option, choose a Fast Ethernet set-up. It’s the current standard for connecting workstations and the equipment will be easier to configure and troubleshoot. Support Obviously you want a card that is supported by Linux but you should also try and find out how well the card is supported, whether the driver is stable or experimental etc. In this case the Internet is your friend. Find any identifying information about your network card (the make and model for reference, failing that the FCC ID number, which should be printed on the card somewhere, failing that any identifiable numbers on the card). Go to the Google Linux search and type in the information. You should find plenty of information to help make your decision. You may find it useful to cross-check whatever you find with the networking documentation accompanying the kernel source, which can normally be found in /usr/src/linux/documentation/networking.

Plugging your network together You can build a network out of all kinds of different parts. An IP packet doesn’t care about the type of cable it travels across or its speed. On your network you might have a 10Mbps link from your PC to a hub, a 100Mbps link from the hub to a switch further up the line and a Gigabit connection between the switch and the application servers. The physical connections are not hard to set up, since most modern networking kit automatically senses the speed of the device at the other end of the cable and will slow down to match slower kit (this is called auto-negotiation). There are even hubs with both RJ45 and BNC connectors. Do remember to use the right kind of cable. For 100Mbps speeds the UTP cable must be Cat 5 quality or higher. Cat 3 UTP is enough for 10Mbps but means you’d have to rewire before upgrading. The simplest type of network is formed by linking two computers together. If using a UTP cable you will need crossover cable rather than a standard UTP patch cable. You can also connect multiple computers through a hub or switch and can chain hubs and/or switches together to create as large a network as you like. Use crossover cable to chain hubs and switches but standard patch cable to connect PCs to hubs or to switches.

Installing and testing the card I’m going to assume you know how to install an extension card into a PC. Once it is in we can do some basic checks to see if the hardware is functioning properly. This is important: there’s no point going on to later steps if the card isn’t functioning, you’ll only waste a lot of time. Start the machine and have a look at the card. Any decent, recent card will have at least one status light, one of which will show if any power is getting to the card (another reason to avoid cheap or old kit). If your card seems to be getting power, get a cable and connect the card to another networking device, preferably one that has a connection status light (e.g. a hub or a good quality card in another PC). Don’t forget to use the right kind of cable for the connection (see the Plugging your network together boxout) and be sure that the devices match (i.e. both operate at the same speed or at least one is capable of auto-negotiation). A connection light should show on one or both devices. If you get no power light then either you need to reseat the card in its slot or the card is broken. If you get a power light but no connection light then you may have the wrong cable, one/both of the connected devices may not be functioning or the two devices may be mismatched (i.e. they are at operating at different speeds and the fast one isn’t autonegotiating): try changing the cable or the device you connect to until you get a working connection. If you can’t get a connection light after trying several different cables and devices then your card is probably broken. When troubleshooting a problem connection, it’s important to change one thing at a time. That way, if you do finally get a connection, you will be able to identify the problem component conclusively.

The software connection Before we can begin configuring the network interface we first have to make sure that we are using the right driver. Now, I absolutely recommend that you load NIC drivers as modules. It makes troubleshooting and testing so much easier: ● You can load and unload different modules, or the same modules with different parameters, as many times as you like with no need for a reboot. ● There is no need to recompile the kernel. Even if the module(s) you need (or want to test) aren’t in your current set, you can compile them separately from the kernel (though you will need the config used to compile the kernel). If the driver is compiled into the kernel and you want to try a different driver or change the parameters passed to the driver then you will need at least to reboot and (in the former case) to recompile the kernel as well. This can become tedious very quickly. Note: Do not panic! The default kernels that are installed with most distributions come with a selection of drivers that cover all the common network cards. You probably won’t have to do more than load and unload a few modules until you get it right. There’s not enough space here for a lesson in kernel/module compilation, so I will assume that you have a system with networking enabled in the kernel (as it is in all the default kernels shipped with any distribution I ever heard of) and with a selection of modules, which hopefully includes the one to match your card. Issue 20 • 2002

LINUX MAGAZINE

43


KNOW HOW

IP addresses and netmasks An IPv4 address is a 32 bit number, which is usually shown in dotted quad notation: four decimal numbers separated by full stops (e.g. 192.168.10.5). This number is further split into two parts, one identifying the network on which the host (machine) is located and one uniquely identifying the host within that network. You can’t tell which part is which just by looking at the address (some IP addresses are commonly split in particular ways but don’t rely on this). To identify the network and host parts of an IP address, you need to know the netmask for the network on which the IP address is located. The netmask specifies which bits of an address are the network address and which are the host address. The 32 bits may be divided in any permutation but it is most convenient and least confusing simply to split them into two blocks, with the high block of bits representing the network and the low block the host. Network bits have a value of 1 and host bits a value of 0, so that AND-ing an IP address and its netmask give you the network address. In our example network, the highest 24 bits of the address are the network address. So the netmask could be represented by the binary

number 11111111111111111111111100000000. This is obviously not convenient, so netmasks are usually shown in one of two ways: ● In dotted quad notation. Our example netmask would be 255.255.255.0 ● A slash and a decimal digit, appended to an IP address, the digit showing how many high bits comprise the network address. So 192.168.10.0/24 would indicate that the first three bytes are the network address and that the final, least significant byte is used to allocate host addresses. Since one address is reserved as a broadcast address, that leaves 255 host addresses we can use. So why all this trouble? The answer is that before an IP packet can be delivered to its destination we need to know if it is on the local network or a remote one. The network address may be further divided into a network number and a subnet number. This distinction will be explored in the next article: for the purposes of this article no distinction is made.

Select a module If you didn’t identify the correct driver when doing your Google search, now is the time. Compare the information you found then with the help in /usr/src/linux/documentation/networking. If you find more than one match, don’t panic, just repeat the process described below until you find one that works (you can leave fancy comparison-testing till you know more). Be sure to note any special parameters that may need to be passed to the module (another good reason not to buy cheap: decent modern cards usually autoconfigure).

Load the module Say you want to try the eepro100 module. Load it: # modprobe eepro100 Now, check the end of /var/log/messages for any messages from the module. If the module didn’t work then you will see obvious error messages: try

Debian network config file # /etc/network/interfaces –– configuration file for ifup(8), ifdown(8) # The loopback interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.10.10 netmask 255.255.255.0

44

LINUX MAGAZINE

another module or try reloading this one with different parameters. A successful load will give output like this: Apr 1 20:15:33 localhost kernel: Intel EtherExpress Pro 10/100 Apr 1 20:15:33 localhost kernel: assembly 689661-004 Apr 1 20:15:33 localhost kernel: self-test: passed Apr 1 20:15:33 localhost kernel: sub-system self-test: passed Apr 1 20:15:33 localhost kernel: registers self-test: passed Apr 1 20:15:33 localhost kernel: checksum self-test: passed Apr 1 20:15:33 localhost kernel: lock-up workaround activated.

eth0: U Board U General U Serial U Internal U ROM U Receiver U

Success! Light a cigar (away from the equipment). But note that eth0 in the first line, we need it for the next step. What does it mean? It’s the interface name assigned to the card.

Boo-boos If you compiled the driver into the kernel, smack yourself on the wrist and prepare for multiple reboots. Each time you reboot, check the messages that scroll past. Too fast? Once it’s finished booting, log in and check the contents of /var/log/dmesg. You should find the output from the driver somewhere in there.

Configuring the network interface Loading the correct driver gets us halfway there. Now we need to configure and activate the network Issue 20 • 2002


KNOW HOW

connection. For this example, I am going to assume we are connecting to a network with address 192.168.10.0/24 and that this computer will have the address 192.168.10.10 on that network. If this means nothing to you then you should read the boxout on IP addresses and netmasks. To do this, we use the ifconfig command, giving as parameters the interface name, the address and netmask: # ifconfig eth0 192.168.10.10 netmask U 255.255.255.0 If you get no feedback then in good *nix fashion this means that nothing went wrong. So now you should list the interfaces on your computer, by running the ifconfig command with no parameters. The output should include a record like this:

Red Hat interface config script # /etc/sysconfig/network-scIpts/ifcfg-eth0 DEVICE=eth0 USERCTL=no ONBOOT=yes BOOTPROTO= BROADCAST=192.168.10.255 NETWORK=192.168.10.0 NETMASK=255.255.255.0 IPADDR=192.168.10.10

Up and down OK, now that you have configured and activated your interface, you can deactivate it any time you like. To bring it down run: # ifconfig eth0 down

eth0 Link encap:Ethernet HWaddr U 00:01:02:87:18:AB inet addr:192.168.10.10 U Bcast:192.168.10.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 U Metric:1 RX packets:819780 errors:116 dropped:0 U overruns:0 frame:232 TX packets:593233 errors:0 dropped:0 U overruns:0 carrier:69 collisions:230 txqueuelen:100 RX bytes:873172906 (832.7 MiB) TX U bytes:48467017 (46.2 MiB) Interrupt:9 Base address:0xec00 Before you light yourself another cigar, let’s try pinging the address of another network host (the ping command sends a stream of IP packets to the requested address and reports their progress). On this example network, there’s a router at 192.168.10.1, so: # ping 192.168.10.1 PING 192.168.10.1 (192.168.10.1): 56 data bytes 64 bytes from 192.168.10.1: icmp_seq=0 U ttl=255 time=0.2 ms 64 bytes from 192.168.10.1: icmp_seq=1 U ttl=255 time=0.2 ms 64 bytes from 192.168.10.1: icmp_seq=2 U ttl=255 time=0.2 ms 64 bytes from 192.168.10.1: icmp_seq=3 U ttl=255 time=0.2 ms 64 bytes from 192.168.10.1: icmp_seq=4 U ttl=255 time=0.2 ms 64 bytes from 192.168.10.1: icmp_seq=5 U ttl=255 time=0.2 ms 64 bytes from 192.168.10.1: icmp_seq=6 U ttl=255 time=0.2 ms Success! You managed to connect to a network and talk to another host on the network – the aim of this introductory article. But we’re not finished yet.

Now run ifconfig with no arguments – you’ll see that the eth0 record has disappeared. You can bring the interface up again by running the above command but replacing down with up. Try it and then run ifconfig again to see if the interface has come back up with the same settings.

Achieving permanence What we have achieved so far is fair enough, but it won’t survive a reboot and even Linux boxes have to be shutdown once in a while (only for hardware maintenance, obviously). So what do you do if you want this interface to be configured automatically when the machine restarts? You could create a script to configure the interface and add it to the sysvinit scripts. But you don’t have to: while there is no definitive Linux standard for this, there is a semi-standard. Most distributions enable you to record the interface’s details in a text config file, to bring the interfaces so defined up and down with the ifup and ifdown tools and to specify which interfaces should be activated on startup. Example configuration files for Debian and Red Hat are shown in the two boxouts, Debian network config file and Red Hat interface config script. In both cases, the interface we created above would be configured and activated as part of the startup process.

Summary This article has shown you how to get a simple network connection up and running. I hope it has been enough to get you interested and experimenting. But there’s still a lot we haven’t covered. The next article will explain subnets and routes, show the difference between hubs, switches and routers, introduce the IP tool (brought in with the 2.2.x series of kernels) and explain how you can turn a Linux box into a network router/gateway. See you then. Issue 20 • 2002

LINUX MAGAZINE

45


KNOW HOW

Formatting, editing and packing

ODDS AND ENDS Windows collects a number of useful applications together under the heading of “Accessories”. Anja M. Wagner shows you how to find and use these and other odds and ends in KDE

T

he applications of KDE, and here we are referring to KDE 2.2 from SuSE Linux 7.3, are often very similar to those of Windows, which makes it easier to migrate – but some flows do differ.

Formatting diskettes For example, in Windows you format a diskette via the desktop and the option Format in the File menu. Try hunting for this option in KDE and you’ll be looking in vain. Instead, you must start a little tool named Kfloppy, which you will find under System/Tools/KFloppy. The diskette drive must not be mounted before formatting. Kfloppy offers a number of setting options. If you have a diskette drive, it bears the drive letter “A” and is recognised and selected as such by Kfloppy in the drop-down menu. This is a concession to users who are accustomed to Windows, because in fact there are no drive letters under Linux. If you have two diskette drives in your

FAT: FAT stands for File Allocation Table and refers to the filesystem of MSDOS and Windows 9x/Me. The table itself represents the table of contents of a data medium, thus for example a diskette. ext2: The Second Extended Filesystem (ext2) is used by Linux. It is a more modern filesystem than the Windows FAT system.

LINUX MAGAZINE

system, select the one holding the diskette for formatting – either drive A or B – in the drop-down menu. As well as the usual 3.5in diskettes the old 5.25in diskettes are also supported. In the second drop-down menu, select the memory capacity of the diskette. This is normally HD – High Density (1.44Mb). The older diskettes with DD, Double Density, have more or less disappeared from the market. They store only 720Kb of data. Which sort of diskette you are using is written on the diskette. When formatting a diskette, a filesystem is created on the data medium. Under Windows, only FAT is available. Kfloppy lets you choose between MS-DOS (thus FAT) and the Linux filesystem ext2. If you format diskettes in the DOS format, Linux has no problem accessing these data media – it does not work the other way round however: Windows cannot read an ext2-formatted diskette. As formatting methods, you can choose from fast or full formatting. Fast formatting deletes all data on the diskette, but only works if the diskette was already formatted. The full method also deletes hidden files, checks for errors and can also be used on unformatted diskettes – although these are no longer available. Once you have selected the appropriate settings, click on Format to begin the process – the full formatting can take some time, but you can check the progress via the blue bar.

Check memory capacity

Figure 1: Kfloppy offers many setting options

46

Figure 2: Completion message after full formatting and error check

Issue 20 • 2002

Diskettes are, like hard drives, partitions and CDs, storage media for your system. It is often important to find out how much total memory space is available on a storage medium and how much is already taken


KNOW HOW

Figure 5: Select which information KDiskFree is to display and which not

Figure 3: Windows shows the relation between occupied and free memory

up or still free. Under Windows all it takes is a rightclick in Windows Explorer on the corresponding drive, and a pie-chart shows the level occupied. In Konqueror, the standard file manager of KDE, this way does not exist. Instead a small tool comes into use every time: KDiskFree. You can find this under System/Info/Disk Free. This tool lists all data media on your system clearly in succession. It shows the drive designation, the type (for example “vfat” for Windows partitions and “ext2” for Linux partitions), the mount location (i.e. the location in the system, at which the device has been mounted in the directory tree), the overall memory capacity and the free memory space in absolute numbers, together with occupied space as a percentage. The ratio between free and occupied space is also shown in the form of a green bar. From KDiskFree, by the way, you can easily mount any drive in the system. Click with the right mouse button in the appropriate line and select Mount device in the pop-up menu. The green bar only appears for devices or drives mounted in the system. Select Options/Configure KDiskFree to change the display to suit your own requirements. On the General Settings tab the default setting displays all types of information – individual fields can be shut

Figure 4: KdiskFree shows clearly and informatively the size and occupied space of all drives in the system

down with one click. Another default setting is that KDiskFree activates a warning if the memory capacity of a drive is approaching its limit. The pop-up menu also includes the item Open filemanager. If you select this option, the file manager Konqueror opens at the position of the mount location. If, for example, there is a Windows partition in the system with the mount location /windows/C, Konqueror starts at this point, and you have access to your Windows directories and files.

Figure 6: With the option “Open filemanager” you quickly get to the mount location of a drive in the system

Changing a password Windows offers passwords for the various users of the system. You change a password there in the Control Panel via the option Passwords. You can do a similar thing under KDE to change your password. Via Administration/Tools/Change Password you come to a small tool, which first asks you for the old and then twice for a new password.

Figure 7: Changing your password at regular intervals enhances security

Issue 20 • 2002

LINUX MAGAZINE

47


KNOW HOW

Packing and unpacking files When working with data you will often have to unpack compressed archives. Certainly the most popular compression program in the Windows world is WinZip. KDE offers a number of alternatives. One of these is the classic Ark, which is now very similar to WinZip in look and feel. With this tool, which you will find under System/Tools, you can unpack both zipped files (*.zip) and the compressed files which are common in the Linux World with the endings tar.gz and tar.bz2. Figure 10: Packing files means creating a new archive and filling it with content

Figure 8: When starting the compression program Ark the main window is still empty

At first, the main window of Ark is empty. Click the Open button or in the menu list select File/Open and open a file to be unpacked in your system. If it is on a diskette, remember to mount the drive first. After confirming with OK, the files in the archive will now appear in the main window of Ark. If you want to unpack the entire contents of the archive into a common folder, you don’t need to mark anything. Click on Extract and via Browse select the destination folder. If the destination folder does not yet exist, click on the cog symbol on the far right in the toolbar and select New Directory. Activate the All option when all the files are to be unpacked. The Selected Files option is only active if you have previously marked one or more files in the main window of Ark. Confirm with OK, and straight away the files are unpacked. New archives are created via File/New. In the dialog window, specify the directory in which the new archive is to be stored, for example your home directory. In the text line, Location, enter the name and the archive ending. With the ending, e.g. .zip or .tar.gz, you are defining the archive type.

Figure 9: The destination directory, into which files are to be unpacked, can be created directly with Ark

48

LINUX MAGAZINE

Issue 20 • 2002

You can fill the new archive with content either via Action/Add File or Action/Add Directory. Select the files and directories in the window which opens, which are to be compressed in the archive. You can also drag the files and directories, if Konqueror is open, via drag and drop into the main window of Ark. The procedure ends with File/Close Archive.

The editor KWrite There is a wealth of editors to choose from in KDE. KWrite is very similar to the Windows editor, but offers a few additional abilities. Start the program via Office/Editors/Advanced Editor. The settings of KWrite are set, as in most KDE applications, via Settings/Configure editor in the menu list.

Figure 11: Very similar to the Windows editor but easier to use: KWrite

Here you can change the background colours and the colour of marked sections of text. Font type and size can be adapted to your individual requirements. When working with KWrite the text can also be enlarged or reduced with a click on the magnifying glass symbol in the toolbar. In the section Setting/Configure Editor/Edit you can define after how many characters a line should wrap – the default is 80 characters. The wrapping only becomes active, though, when you invoke Edit/Apply Word Wrap. The width of the tabulator indentation can be varied, as can the number of possible undo steps. One practical function is pre-set in the area Select: all text sections copied with the mouse are automatically buffered. So this saves you the command Copy and you can immediately insert the marked material at the corresponding position in the text. This works the same as under Windows. KWrite has a spellchecker. In the section headed


KNOW HOW

device section with the “mouse” driver, you have to insert, after the last option, the line: Option “ZAxisMapping” “4 5” In the line Option “Device”, for USB mice it must state: /dev/input/mice, for other mice /dev/psaux or /dev/imps/2. In the Option “Protocol” line it must also say imps/2.

Figure 12: Line break and tabulator width can be adjusted, as can the number of undo-commands

Settings/Configure Editor/Spelling you can choose between Ispell and Aspell. The Comment tool, which put KWrite close to an office program, is not yet implemented. It is easy to jump to a specific line via Edit/Go to Line. Individual words can be found with Edit/Find, and automatic replacements are possible, via Edit/Replace.

Activating the wheel function of the mouse Linux recognises all the common mice without any problem during installation. Unfortunately though, in the case of a wheel mouse, the wheel often does not work – a configuration file has to be amended to do so. This is where you can get to know how to work with the editor KWrite at the same time: Log in as Root and start the editor via Office/Editors/Advanced Editor. Activate, in the menu list, File/Open. In the directory tree, select the configuration file /etc/X11/XF86Config. In this file there are two “InputDevice” sections, one for the keyboard and one for the mouse. In the input

Figure 13: Changing the spellcheckers settings

Figure 14: Open the file XF86Config with an editor

The effect of the ZaxisMapping entry is that the movements of the mouse wheel are interpreted as pressing the fourth and fifth mouse buttons. For a current distribution such as SuSE 7.3 the configuration work is finished at that point. Start the X interface again (log out and then press Ctrl+Alt+Del), and the little wheel on your mouse will work. If you are still working with XFree86 3.x, you will have to start the tool imwheel in addition to the procedure described above. You do this for example when starting the work session with the fast starter Alt+F2. Enter “imwheel” and press Enter. We will present some more useful applications which Windows files under “Accessories” in the next issue.

One line has to be inserted into the file for the wheel mouse to work

Issue 20 • 2002

LINUX MAGAZINE

49


KNOW HOW

CVS: The Concurrent Versions System

LATEST AND GREATEST If you’re interested in helping to develop Open Source software then getting to know the Concurrent Versions System is the logical first step. Colin Murphy shows us how to get started with CVS

S

oftware development under Linux can be a real joy, thanks to the free movement of source code. Anyone can get involved in moving a project forward and you may not even need to have all that much programming experience to make a difference. In some cases you may not even have to code at all to get involved; what some projects desperately need are graphics designers and people to help write documentation. To get involved, you first need access to the project and for that you need access to the source code. Part of the beauty of Open Source programming is the opportunity it gives you to look at other people’s work and, if you feel up to it, to change it, possibly even to improve on it. What is even more useful is the chance to see the additions that other people have made to a code base for a project, to see how it grows and changes over time.

If you’re only just starting out in program development you may only have come across CVS very briefly, when exploring the very latest version of a piece of software, that cures a bug or adds a much-needed feature that’s just not present in the stable version. With that must come a warning: you must always remember that this is an unstable version and to treat it as such. By using it, you should also remember your contribution to the project – bug reports. For the most part you will be using CVS in a Server/Client mode, most likely via the Internet. CVS is a command line utility, though there are some graphical front-ends, which we will round the article up with in a moment. Firstly, do you have cvs on your system? You can quickly check this with:

Software bugs

which should return some details, otherwise you will have to find your disc set and install it. The current version is 1.11.1p1. You will need to know where the CVS repository is that you want to access – the project we’re going to pick is the CVS project itself, which seems only fitting. This lives at cvs.cvshome.org in the /cvs directory. It is to here that we need to login, usually using some sort of password server for cover. So:

Developing software and developing bugs in that software go hand in hand, and bugs are bound to appear in software development. When projects are open to a wide-ranging ‘team’ of developers, the danger that bugs will be introduced is increased. More importantly, the nature of these bugs may not even be noticed until much further along the project’s development cycle. Such bugs may not even be caused by bad or plain wrong programming – it’s more likely that a previously written piece of code proves not to tie up well enough to the project now. So how do program developers get around this major problem? What is needed is to keep copies of all of the old versions of the program development so that you have something to refer back to if and when something appears to be going wrong. Seeing as though a change to a piece of code correcting an error might be only a few bytes long, keeping a back-up of all previous pieces of code would result in a huge archive of very similar data. What is needed is a system that records just the changes made to the code base. Thankfully, that’s why we have CVS, or the Concurrent Version System, which maintains a central repository for people to access and modify. 50

LINUX MAGAZINE

Issue 20 • 2002

[colin@desk]$ cvs ––version

[colin@desk]$ cvs –d :pserver:guest@cvs.cvshome.org:/cvs login will give us access, once we have entered the password, which will be prompted for, usually you just need to hit the Enter key. Almost always, anonymous access is granted for people to download the project’s code, but the exact details of this can vary. Often the login will be anonymous@ (instead of guest@, as in the example above) and the password will be blank, as above. Depending on how often you are planning to take code from this CVS tree, you may want to consider setting the Environmental variable $CVSROOT for that tree, if you are only going to take code


KNOW HOW

Accessing CVS trees with LinCVS

infrequently, then typing it in each time is not too great a burden. You need to save the parameter that is passed by the ‘–d’ switch, in this case the :pserver:guest@cvs.cvshome.org:/cvs. To allow you to download the project, which is called ccsv in this case, you use the checkout command [colin@desk]$ cvs –d U :pserver:guest@cvs.cvshome.org:/cvs U checkout ccvs If all is going well you will then get to see a listing of all the files that are now being downloaded, which get stored in a directory with the project name in the directory you ran the cvs command from, in this case /home/colin/ccvs. [colin@desk]$ cd ccvs [colin@desk]$ ls will give me a listing of all the files and subsequent directories in the ‘cvs’ project. From here on, you are at the mercy of the project developers. Hopefully, if it is a good project, you will find that you now have some documentation that someone new to the project can read and understand. The important files to look out for are README and INSTALL. If there are not enough clues in these two files to take you further then you may be looking at a project that has yet to fully develop its documentation, either because it is small, or that no one wants to do the job. You still have the option of contacting the project developers by email, to ask for advice and, if you are let down here, then you at least know that the project isn’t worth bothering with. Sometimes, you may find that the project homepage has the option to allow you to ‘browse’ the cvs tree. If this is the case, it can sometimes be better to download some of the documentation files from this browsing session rather than download the whole tree only to find out that there is no documentation, or that it is in German, or some such.

Graphical front-ends Graphical front-ends are available for CVS, to take away some of this command line misery.

like add, remove and commit, diff against the repository or view of the log messages in list form, all of which is of much more use when you are actually contributing to the development of the project. After selection of a start directory, the program enables you to automatically find all CVS projects contained in sub directories using the “ProjectExplorer”, and enables the user to add them and displays the corresponding tree on the desktop. All features can be accessed by pull-down menus or a simple click on the right mouse button and may be applied to both single and multiple files or complete trees. Cervisia – with a clever tree display

Cervisia Cervisia is another graphical front-end for CVS clientside actions, which has some really neat features like retrieving directories and single files and examining their status and a graphical diff utility which highlights the differences between different revisions in the same repository.

LinCVS LinCVS is a German project, but thankfully with most pages also in English. It acts as a reliable graphical front-end for the CVS-client supporting both CVS versions 1.9 and 1.10, perhaps even older ones. It enables the user to check out, or download, a module from the CVS tree and import modules to the repository if you have been granted access rights. You can also update and retrieve the status of a working directory or single files and use common operations

Getting involved At best, this is supposed to be a two way process. Contributions are a start, but you may want to help further, with the documentation or, if you are up to it, the coding. CVS is used for uploading contributions and when you get to know a project’s development team well enough, they might even give you your own account and password, but more of that will have to be left for another article. Issue 20 • 2002

Info CVS homepage: http://www.cvshome.org/ The CVS homepage also contains a very good manual LinCVS: http://www. lincvs.org/ Cervisia: http://cervisia. sourceforge.net/

LINUX MAGAZINE

51


FEATURE

Workshop: Video editing with Broadcast 2000c

THE FINE ART OF CUTTING In this workshop Tim Schürmann shows us how to edit videos once they’ve been transferred onto a Linux system. For this we’ll be using the Free video editing program Broadcast 2000c.

T

o stave off the boredom that the mere mention of holiday videos instils, it’s a good idea to enhance your video before inviting the in-laws round to watch it. Since modern cameras usually store films in digital form, it seems like a good idea to transfer them into the computer and edit them there. By making use of the corresponding video editing programs, videos can also be professionally enhanced by adding a few skilfully placed effects. Under Linux, there are now two video editing systems courting the favour of users. One is the relatively simple to use, commercial program MainActor from the company MainConcept (http://www.mainconcept.de). The competing candidate goes by the name of Broadcast 2000c and is now available in its third version. Unlike MainActor, Broadcast 2000c is in fact available Free on the Internet. It may not be quite so simple to use, though, which is a good enough reason for a little workshop, to help make your first tentative steps into Broadcast a bit easier.

Requirements To be able to use Broadcast you will first need a video source. This can be a video camera or a video recorder. Your computer will also need to have a suitable hardware interface. Broadcast can cope with both TV cards for analogue sources and FireWire cards for digital sources. In either case Linux must support the corresponding hardware. If you wish to use an analogue camera or a video recorder, the way to go is to use a TV card. You should find how to operate this under Linux in the manual for your distribution under the heading of “Installing the TV card”. Incidentally, unlike MainActor, Broadcast is unable to edit video materials read in by dvgrab. On the software side you will need XFree86, which should not be Version 4.0.0. Users of SuSE Linux 7.0 will be affected by this problem; the only remedy for this is to change to a different version (e.g. the older version 3.x). Otherwise Broadcast refuses to start. You may need to consult the documentation on your distribution about this. Furthermore, the 52

LINUX MAGAZINE

Issue 20 • 2001

Enlightenment Sound-Daemon (the package esound) must be installed on your system. This software should not only come with all the most common distributions, but should also be installed as standard.

Installation Provided Broadcast comes with your distribution, you can use the corresponding package management tool. Otherwise you can find a ready-made rpm archive at http://www.heroinewarrior.com. Make sure before starting the program that both your selected interface card (TV or FireWire card) as well as your sound card will work under Linux.

Start If your distribution has no entry for Broadcast in the start menu, you can call up the program by opening a terminal window, entering bcast and then pressing Return. If your hardware has been installed correctly, four windows will now open: Bcast: Video out is responsible for a preview of the edited video material, Bcast: Levels shows the volume of the sound, Console lets you add effects to the video or sound material and the main window takes on the central role of the arranger.

A question of attitude The basic settings of Broadcast can be found in the main window under the Settings/Preferences... menu

Figure 1: When Broadcast starts for the first time, four windows open


FEATURE

Figure 2: You must set these values when working with a digital camera and a FireWire interface

item. Click in the left-hand area on the button marked Audio In. OSS should now be set under Record Driver. This is the right value if the sound is to be read in via your sound card. Generally, this is the case for all analogue sources. If you have a digital video camera, which transfers your data to the computer via a FireWire card, at this point you should select the value IEEE1394. Once the sound source has been correctly configured, it’s time for the image: click in the left-hand section on Video and under Record driver and select the desired recording source. In the case of a TV card this is Video4Linux, and for a FireWire card it’s IEEE1394 (see Figure 2). If you want to record the contents of the desktop, the selection to make at this point is Screencapture. But this latter only makes sense in very rare cases (e.g. for training videos) and, on the grounds of speed, should only be done at low screen resolutions. By the way, LML3 stands for a special video editing card, which is distributed by the firm Linux Media Labs (linuxmedialabs.com) on the Internet. Once you have made all the settings for the recording, close the settings window with a click on OK.

Quiet, please... Before the video material can be read in, first create a new project via File/New.... In the window which pops up, enter the values shown in Figure 3. The dimensions of your video (Track Size, Output Size) will depend on the material involved or on the size in which you later wish to output the video. The standard PAL resolution is 720x576 pixels. This is also used for digital video material. Owners of a digital camera should therefore select this resolution. If, during recording or playback, you find there are misfires or jumps, as an alternative you could also use a resolution of 352x288 pixels. This format is also used on VideoCDs and because of its smaller size it is a lot less greedy in terms of memory. After clicking on OK, the data entered here will be used as initial values. To start recording, click on the red symbol at the far left of the toolbar in the main window. A new

window will then appear, prompting you to enter a filename. The video film which is then recorded will be saved later in this file. Under the input box, there is a button to define the memory format. Quicktime should be specified here as standard. Apple’s memory format for video films acts as the standard format in Broadcast. Please note that in all other formats offered here either only the sound (WAV and PCM) or images (as a series of individual image files – JPEG list) are recorded. For our purposes, you should retain the default setting at this point. The rest of the buttons inside this window can be used to make detailed settings for the recording activity. Those working with analogue video material may be interested in the Video/Options settings. Here you can choose between different compression methods, which may have a positive effect on the hard drive space required. However, too powerful a compression will also be detrimental to image quality. If you’ve picked IEEE1394 as the recording source then this item will not be available to you: digital video is already compressed on the video tape in the so-called DV format and is therefore copied by Broadcast directly from the camera onto the hard drive. You should take note though, that one second of film in DV format takes up 3.5Mb of space. After clicking on Do it, a window will then open which offers symbols similar to those on a video recorder. If you’re using analogue material, which is played into the computer via a TV card, you must first select the correct input for the TV card. Click on the Channel button in the Video in window then click Add.... Again, a window will open, in which you can set the data of the channel thus created. Under Title, enter any name you like; under Norm select PAL; and under Frequency table select PAL_EUROPE. Under Issue 20 • 2001

Figure 3: A new project is created. For the project in this article, you should select these values

Figure 4: In the case of analogue video material you have to give details of the format in this window prior to recording

Analogue video The images in the film are recorded in the form of an electromagnetic signal on appropriate storage media, such as a magnetic videotape. Digital video Unlike analogue video, the film’s images are stored as a sequence of ones and zeroes. This allows the video material to be saved on the hard drive as a file and edited using the computer. PAL British transmission standard for colour TV signals.

LINUX MAGAZINE

53


FEATURE

Source you should finally set the input or channel from which you would like to record the video material. Which value must be selected here depends on your TV card and should be described in the associated instructions. Now click on OK, mark in the window Channels the newly created entry and click Select – which selects the channel. Close the window by clicking on OK.

...and action!

Figure 5: By using these two windows, you can store your video material on the hard drive: with the left one you control the recording, and the right shows a preview of the image just recorded

In order to start recording, first put your camera into playback mode and then click on the symbol with the red circle. To stop recording, click on the symbol with the black box. If you wish to tell Broadcast to only record for a specified length of time, first set the Recording Mode to Timed and under Duration enter the appropriate period of time. You can then start the recording by clicking the recording symbol. Owners of a digital camera, who are reading in their film via a FireWire card, should take note that Broadcast doesn’t co-operate perfectly with all devices. In our test there were some problems with Sony Digital 8 cameras: Broadcast flatly refused to read out the video material. Unfortunately the documentation has nothing to say about which cameras work and which don’t – all you can do here is give it a try. Before the film is saved, you can watch it with the aid of the other symbols in the preview window. Only when you feel it is satisfactory should you save it with a click on the Save button. Otherwise all you need do is start recording again. As soon as your film has been saved, it should have been added directly into the main window. Before you start editing there, you should firstly also record a second film. We will be fading these two video clips into each other, for practice.

Image for image If you’ve already recorded the two films and they’re not shown in the main window, first create a new, Figure 6: This is how the two videos added to the main window should look before editing

54

LINUX MAGAZINE

empty project via File/New... and load both videos via File/Append.... Contrary to Load, Append adds a video to the existing ones; Load on the other hand creates a new project, containing the single file selected by the user. Either way, there should now be two videos displayed in the main window. Each film is laid down on a track of its own; these are provided with the name “Video” and an incremental number. If you’ve added the videos via Append you should find two video tracks with the names Video 1 and Video 2. Similarly, in the main window you will find tracks for the sound (“Audio”), which are incrementally numbered in the same way. You can change the name of a track to suit your own requirements: to do this, simply click on the track name and enter a new one. Like a proper reel of film, a video also consists of individual images or frames. With the PAL standard used in the UK, the speed is 25 frames per second. Broadcast shows videos within the main window like film reels playing out. The start time is always shown on the left and the end is on the right. Since it can become fairly tedious with long films to get from one end of a film reels to the other, Broadcast supports various stages of enlargement: you can set these on the top edge with the triangular symbols (marked X, Y and T). Simply try out all the buttons here to see what happens. The time strip under the toolbar serves as an aid to orientation on which you can also read off later how long the finished edited film will run. Finally, one more tip: if you click on the Fit button in the toolbar the enlargement factor is automatically adjusted so that all videos fit easily into the main window. Before we come to the actual editing of our videos, let’s take another look at the bar at the left edge of the screen. Not only is the name of a track listed here, but there are also four symbols for each track. If the green rectangle is selected, this track will be picked during playback. In the same way, the red button says that an editing or recording function just executed should also be applied to this track. You can change the time bar in the right-hand section via the button marked with a D: if this is selected, in the case of a video track the individual images of the video saved there, or in the case of a soundtrack, the frequencies will be shown. Before selecting this button you should consider the fact that this type of display, especially on slow computers, can require a great deal of computing time.

Editing As already mentioned, both of our videos are to be played one after the other in the finished film, with a small fade leading from the first video into the second. There are two ways of doing this. If all you want is for the first video to slowly disappear and at the same time for the second one to fade in, you can Issue 20 • 2001


FEATURE

Figure 7: The marked film area (white). Also note the deselected recording button on the left side for video 1

use a menu function. For this to be applied, both films must be immediately one after the other in the same track. First, decide on the sequence. On all tracks, except for the track holding the second film, deselect the small red recording symbol already mentioned – by doing so you are making sure that only the second film will be cut out. On each film the start and finish should be marked by two small blue rectangles. Double-click between the two blue rectangles on the track of the second film: the latter should now be marked white. Alternatively, but a bit less precisely, you can also achieve this by first going to the start of the film with the mouse pointer, pressing the left mouse button, holding it down, dragging the mouse to the end of the film and then releasing the mouse button. Now click on the Cut button in the toolbar. Since we wish to add it to the track of the first film, deselect the red recording button again in all tracks, except for the track holding the video material for the first film. Now place the white mark, with a single mouse click, immediately behind the blue triangle on the end of the first film. Click on the button marked Paste in the toolbar, and the video which was previously cut out should now have been added behind the first film. In order to assign the fade, mark both videos with

Figure 8: By cutting and pasting, the second film has been moved into the track of the first film

Figure 9: The area marked white states which videos are affected by the fade function from the menu. We are specifying 25 images as the duration of the fade

the mouse. All you need do is include both videos in the marking (Figure 9). Now select the menu item Video/Feather Edits. A window now opens in which you can define the duration of the fade in images. For one second select 25 images. After clicking OK the fade will be calculated. To look at the film, first rewind it to the beginning with the video recorder symbols and start it with a click on the green triangle. The preview is outputted in the window of the same name. On slow computers, the result can be a bit jumpy on playback. This is because Broadcast calculates the fade in real time. Provided your film has audio tracks, you should repeat the procedure with the corresponding audio tracks. Here, too, you can fade the sound in and out – although the associated command is hidden behind the menu item Audio/Feather Edits.

The second way The fade described above is adequate for simple cases, but special effects cannot be done like this. In order to realise somewhat more extravagant fade effects, we need the film back on two different video tracks again. To do this you can either cut out the second film again and paste it onto its own original track, or create a new project and import both films again. Again, decide on the sequence of the two videos. You should also ensure that only the recording head of the track for the second film is activated. Mark the video, cut it and paste it a little before the end of the first film. The videos should now be on two different tracks, offset from each other slightly (Figure 10). The entire overlapping area will later act as the fade. Please note that Broadcast has inserted a blank space at the start of the now offset second film. Move the playback to the beginning and start it. You will note that the video on the lower track is always played back completely, while the one lying on top of it is only partly played back. This is because Broadcast stores the films as if they were in a stack – the same applies to the audio tracks. The sequence can be altered via the menu items Tracks/Move tracks up or Move tracks down. In the first case all tracks for which the record button is selected are moved up by one track, and in the second case they move down. In this menu you can also delete tracks or add them to each other (Concatenate tracks). For our example, make sure that the second film is located on a track below that of the first film (Figure 10). The “console” is responsible for adding effects. If you cannot see this, select Window/Show Console. In this you will find precisely one unit for each track with four green buttons and a slider. Each of the four buttons can record one effect, which will be applied Issue 20 • 2001

Figure 10: For a more complex fade the second film should be placed offset with respect to the first film

LINUX MAGAZINE

55


FEATURE

Figure 11: The area marked white shows how long and at which point our more complex fade should occur

to the whole track. Here is an example: click in the Video 1 area on the first button at top left and select Attach.... Another window opens, from which you can pick one of the effects on offer in the left-hand list, e.g. Whirl. Click on Attach to assign the effect to the track and close the window via Do it. With some filters a settings window will now be displayed. Start playback in the main window in order to view the results of the effect. You can get rid of the effect again by clicking in the console on the corresponding button and selecting Detach from the menu.

Consolidation measures Effects can thus be assigned to individual tracks with the aid of the console. Unfortunately this always affects the whole track and not an individual area, which is what we need for our fade. We are going to Figure 12: For the manage this with what seems at first glance to be a complex fade, select somewhat unusual trick: we divert the video material BandWipe. By clicking on the Attach button, onto a third track, on which there is a film which is you assign the effect exactly as long as our fade. Since we are laying the third track right at the bottom, the fade will then be played back in place of the other two videos. For our example this looks as follows: use Video/Add track to create a new, blank track. Make sure that this track is beneath all other video tracks and that the recording button is selected on Figure 13: The BandWipe fade is shown in the main window as a this track only. Now mark the area in which the fade small green box. It is the same is to take place (the area in which the videos overlap). length as the previous white marking From the menu, select Video/Paste Transition. A window opens in which you can select an effect for the fade. For our example select from the left-hand list BandWipe, click on Attach and then on Do it. In the main window the fade is marked as a green box. If you were to start playback now, nothing would change compared with the previous situation: the effect which was laid on the new video track does not yet “know” which video material it should use. To tell it, click in the console on the first green button (top left) of the area belonging to the first video and select Attach.... In the right-hand list mark the Video 3 entry, click on Attach under this list and then on Do it (Figure 14). By doing this we are making the track 56

LINUX MAGAZINE

Issue 20 • 2001

Figure 14: With these settings, you are making track 1 send the material saved on it to track 3

with the first video send its material to the Video 3 track. The effect saved there can then produce the fade from the material received.

Project management Now save the project via File/Save as.... Please note that at this point, Broadcast is only saving the arrangement of tracks and/or effects, not the actual videos. These remain in their original condition and can also be used several times. Unfortunately this also has the drawback that the original films must always stay in their positions on the hard drive. To create a finished video from the arranged film, use the menu command File/Render. A window opens which displays the same structure as the window shown when recording the video raw material. If you’ve made all the necessary settings (don’t forget to activate Render audio tracks and/or Render video tracks), you just need to click on Make it so!, and Broadcast calculates the finished film. You can play this back with an appropriate playback program on any computer. Please bear in mind that this computing process may take quite some time.

Figure 15: This window appears when rendering the finished video


PROGRAMMING

Perl: Part 2

THINKING IN LINE NOISE Not as loopy as it sounds All programming languages use flow control statements to influence the execution of code. Flow control statements come in two varieties, ‘conditional’ and ‘loops’; it may come as no surprise that Perl has an abundance of each. The simplest of the conditions is the if statement, which evaluates conditions and executes a branch of code dependent on the result. if ($count == 10) { print “Count is 10\n”; } In this example we test to see if ‘$count’ has a value of 10, if the condition is satisfied (i.e. $count does equal 10) the code block within the curly braces is run, otherwise the code block is skipped and program flow resumes after the closing brace of the code block.

It is sometimes desirable to execute an alternative code block if the condition is not met and for this we use else:

One of Perl’s tenets

if ($count != 10) { print “Count is not ten...\n”; } else { print “Count is 10\n”; }

initial hurdle of Perl’s

is to make simple tasks easy. With the extensive use of sigils behind us, Dean Wilson and

The above example tests the value of $count, if $count is not 10, then the message “Count is not ten...” is printed and program control is returned AFTER the last curly brace. If the condition is not met then the code block defined after the else statement is executed, and the message “Count is 10” is printed. Making a condition statement simple to read is the best way of ensuring that the logic tests work as expected. It is also worth considering swapping the values in a test condition where one is an immutable value, this means if you mistakenly code an assignment operator rather than the numeric equality test (= instead of ==) the code will return an error at compile time, rather than creating a time consuming bug.

Frank Booth move on to more practical aspects of the language; namely conditions, looping and files

if (10 == $count) { print “Count is 10\n”; } else { print “Count is not ten...\n”; } Sometimes it is necessary to test for more than one condition and take an action dependent upon the condition that is successful. Perl permits this by using the elsif statement to test several operations Issue 20 • 2002

LINUX MAGAZINE

57


PROGRAMMING

Don’t worry, it’s only there to keep the ‘C’ programmers happy

sequentially, note as soon as one set of conditions are satisfied only the code block belonging to that condition will be executed and the remaining conditions will not be evaluated. else can be added at the end of if and elsif statements as a catch-all that is executed when no other conditions are met.

expressions are evaluated, it’s not necessary, but it is good practice.

$traffic_light = ‘blue’;

if ( ( exists($music{‘ominous shaky violins’}) ) || ( $diary eq ‘Tracy family holiday’) ) { print “Warning, impending catastrophe with few casualties\n”; }

if (‘red’ == $traffic_light) { print “Stop!\n”; } elsif (‘amber’ == $traffic_light) { print “Lights about to go to red\n”; } elsif (‘flashing amber’ == $traffic_light) { print “Proceed with caution\n”; } elsif (‘green’ == $traffic_light) { print “Go\n”; } else { print “traffic lights are not $traffic_light\n”; }

Boolean tests can sometimes become difficult to understand if they contain negatives. Perl provides the condition operator unless to help reduce the confusion. Compare these statements: if ( !exists($valid{$user}) ) { print “Hey, you aren\’t allowed here!\n”; } # The same thing but easier to read unless ( exists($valid{$user}) ) { print “Hey, you aren’t allowed here!\n”;

The difference between the previous two conditions may be slight as we’ve not yet encountered compound conditions, which depend on the outcome of a sequence of conditions. Each condition is connected by either an && or the ||. If an event depends on two conditions being met we could use &&, in the example below I’ve used brackets to force the precedence in which

if ( ( exists($tb2{Virgil}) ) && ( $cliff_door eq ‘open’) ) { print “Lift off!\n”; }

In situations where the if/unless statement is used to perform a single task, and there is no else or elsif used, the code can be rewritten thus: print “$count is not 10\n” unless $count == 10; Note the brackets are not required around the condition, and that there are no curly braces around the code to be evaluated. This will only work for code that executes one line of code and does not use else or elsif (yes unless can use else and elsif too). Looping structures enable programmers to eliminate a lot of the repeated functionality within a program. The most common looping structure is the for loop, which comes in many guises. for ($i=0; $i < 5; $i++) { print “The standard C like ‘for’ declaration\n”; } @array = (1,2,3,4); foreach $count (@array) { print “$count: To iterate over each item in an array\n”; } for $count (1..4) { print “$count: To iterate over a range operator\n”; } for (1..4) { print “$_: use \$_, the default variable\n”; } print “$_: use \$_, the default variable\n” for 1..4;

Each of the above examples is a for loop, which will repeat four times. It is a matter of preference which method you prefer. The first method is possibly obscure, if you are new to programming. Don’t worry, it’s only there to keep C programmers happy. The loop declaration is split into three parts, any of which may be empty. The first section initialises the variables for the loop – this is on the first pass only so it is traditionally where variables 58

LINUX MAGAZINE

Issue 20 • 2002


PROGRAMMING

The truth is rarely pure and never simple

are set to their start value. After the first semi-colon is the condition section, which holds the conditions required to exit the loop. This is tested before each iteration: if this was empty the loop would be infinite, standard condition operators are used. Lastly the modifier section is evaluated after the condition section is failed. Using an array in a for or foreach loop (the two functions are interchangeable) is easy, just put the array in parentheses and the loop will iterate over every element of the array. A variable can be specified to hold the current value from the array, or the default variable ($_) can be used implicitly. The last example shows that as with the if and unless statements, the syntax of the for statement can be reversed if only a single action is desired. The rules for dropping the parenthesis and curly braces are the same as for the if/unless given above. The last commonly encountered loop is the while loop. The while loop executes until its conditional test is no longer met.

Condition statements evaluate whatever they’re given, that is the contents of the brackets: variables, strings, numbers and functions. Throughout the discussion of conditionals you may have noticed the references to truth and wondered what was considered to be ‘true’ in Perl. To illustrate the value of truth we will use comparison operators and some examples. Comparison operators are used to determine the outcome of conditions. These consist of two types of comparison: ‘relational operators’ and ‘equality operators’, both compare two values and return an outcome. The outcome of a comparison operation is called ‘true’ or ‘false’. In reality, as with most things, Perl has a wealth of values to represent ‘true’ or ‘false’. Most things are true with the exception of ‘’,undef, \0, 0 and eof (end of file). In the example below it can be seen that the order for equality operations is irrelevant. Put simply it either is or isn’t equal.

Comparison operators are used to determine the outcome of conditions

$value = 4; # Equality operators print “the value is 4\n” if $value == 4: print “the value is 4\n” if 4 == $value; For relational operations the value to the left of the operator is the subject of the comparison, and whether it is true or false depends upon its comparison against the right-most value (comparator). # Relational operators print “the value is greater than 3\n” if $value > 3; # This will not print as 3 is less than 4 print “the value is less than 3\n” if $value < 3;

$count = 0; while ( $count++ < 4 ) { print “$_: again using a default variable\n”; } # This code won’t run as $count is 0 which is ‘false’ $count = 0; while ( $count ) { print “$_: again using a default variable\n”; } $count = 3; print “$_: again using a default variable\n” while $count––;

There are additional, less used, control statements that will be introduced when their unique properties make them applicable.

String-wise comparisons These are the most commonly used comparison operators. The first operator on each line is used for comparing strings; the second for numeric values. Equality operators eq, == True if the values are equal ne, != True if the variables don’t match Relational Operators lt, < True if the value le, <= True if the value gt, > True if the value ge, >= True if the value

is is is is

less than the comparator less than or equal to the comparator greater than the comparator greater than or equal to the comparator

A simple aide-memoire is: string comparisons consist of letters.

Issue 20 • 2002

LINUX MAGAZINE

59


PROGRAMMING

Different operators are used to compare strings and numbers. It’s vital to ensure the right type of comparison is used to avoid introducing subtle bugs. When run, the code below shows one way in which the wrong comparison may used.

It’s vital to ensure the right type of comparison is used to avoid introducing subtle bugs

$count = ‘1’; $result =’’; if ( $count == $result =’It } else { $result =’It } print “$result if ( $count eq $result =’It } else { $result =’It } print “$result

1.0 ) { is’;

is not’; the same as the number 1.0\n”; ‘1.0’ ) { is’;

is not’; the same as the string 1.0\n”;

Numeric comparisons compare the numeric part of the value to the numeric part of the comparator. It is perfectly valid to compare the numeric parts of values in this fashion. print “There’ll be no green bottles\n” if $count < ‘1 Green Bottle’;

String comparisons act upon the entire value and use a comparison method called string-wise comparison. String-wise comparisons use the ASCII representation for a character to determine whether it is greater or lesser than the comparator. Any character of a lower ASCII value than its comparator is said to be greater than the comparator in a stringwise comparison. String comparisons don’t have magnitudes as numbers do, so ‘byzantine’ is less than ‘Roman’, this is because upper case characters occur earlier in ASCII representation.

IO, IO it’s off to work we go In Unix everything is a file so file handling is a very important part of any language using the Unix platform. Perl has one of the most comprehensive sets of file manipulation commands. The most common method of interacting with files is by opening a file and retaining what is called a ‘handle’ to the file. A file handle is a way of referring to a file when you wish to read or write to it.

open (HANDLE, ‘>afile’); print HANDLE “Hello\n”; close HANDLE; This example opens the file afile in the current directory for output (clobbering the existing file of that name) it then prints the line “Hello\n” to the file afile. After printing the line the file is closed and the program exits. While this is a simple example these basic principles hold true for most of Perl’s commonly used IO functionality. In the previous example we opened the file so we could write out to it. The way we plan to use a file is used is determined by the redirection prefix before its name. ‘<’ Read from a file. This is the default if no prefix is given. ‘>’ Over-write or create the file. ‘>’ Create a file if none exists, append to a file if it does. Printing a line to a file is achieved by using the print function and specifying the file-handle to be used. The default file-handle is the standard output (STDOUT), usually the screen. The example below illustrates this: print STDOUT “I’m on the big screen!\n”; print “I’m on the big screen too!\n”;

When the program has finished executing the filehandle is implicitly closed. However it’s good practice to close file-handles when you are done with them in case the file-handle name is reused in the same program.

File tests Common file tests include: –T True if file is a text file –e True if file exists –d True if file is directory –r True if file is readable –w True if file is writable. –x True if file is executable.

60

LINUX MAGAZINE

Issue 20 • 2002


PROGRAMMING

In the following example we read the contents of a file using a while loop to read every line of the file. For every line it prints the line number and the line. open ( I, ‘<file’ ) || die “file: $!\n”; while (<I>) { print “$. : $_”; } close I; The first line of the example uses a common Perl idiom to test whether the open file operation is successful. If it fails then the die function is called, exiting the program with an error message defined in the same fashion as a print function and setting the script’s return code. In the string passed to the die function we also pass $!, another of Perl’s internal variables. When used in string context, $! reports the system error string related to the last command. The $. is yet another of Perl’s internal variables and it contains the current line number of the file being read. When we concatenate $. and $_ in the print statement we iterate over every line in the file and print both the line number and the contents of the line to the screen. Before you open a file you often wish to determine some of the attributes of the file (often you want to know if it already exists) and to aid you in this Perl offers a large selection of file tests (Which are listed fully in perldoc perlfunc). if (–T $file) { open ( I, ‘<file’ ) || die “file: $!\n”; while (<I>) { print “$. : $_”; } close I; }

The previous example has been modified so that we only enumerate lines in a file if it is a text file; printing binary files to screen is seldom rewarding. Now that we have covered files and determining their type, let’s move on to a related topic, directories. In essence, working with directories is similar to opening files: opendir(DIRHANDLE, $dirpath) || die “Failed to open current directory: $!\n”; @Files = readdir DIRHANDLE; closedir DIRHANDLE; We start by calling opendir with the name of the directory handle we want to retain and the directory we want to open, as with the file operation open, opendir returns true if the directory was opened successfully. The array @Files is populated with the name of each file in $dirpath by calling the function readdir. Filenames in @Files

do not have a full path, only the filename itself. Finally, the directory handle is closed. As with closing file handles, this is done implicitly at the end of the script. This example is a more practical demonstration of reading directories: opendir(CURRENT, “.”) || die “Failed to open current directory: $!\n”; @Files = readdir CURRENT; closedir CURRENT; foreach $filename (@Files) { $linecount = 0; if (–T $filename) { open(TEXTFILE, “$filename”) || die “Failed to open: $!\n”; while(<TEXTFILE>) { $linecount++; } close TEXTFILE; print “$filename has $linecount lines.\n”; } }

The example above illustrates all the principles in this section. We start by trying to open the current directory and assign it to the handle ‘CURRENT’, if this fails we exit the program and display the reason for failure. If everything is fine @Files is populated with the name of each file in the directory and the directory handle is closed. The foreach loop is the main body of the program, it iterates through the array and each text-file (–T $filename determines this) the file is opened the number of lines it contains counted before closing the file and printing the total. The line count is not reported if the file is not text or it can’t be opened. If the file cannot be opened we print the failure message and exit the program. ■ Issue 20 • 2002

Before you open a file you often wish to determine some of the file attributes

LINUX MAGAZINE

61


PROGRAMMING

C: Part 7

LANGUAGE OF THE ‘C’ This month, C programmer in residence, Steven Goodwin, looks at library functions. Where they are, what they do, and how to use them

O

ne of the benefits of Open Source is that you don’t have to re-build an entire car (reinventing the wheel, chassis, engine and full leather interiors in the process) if you only want to add a cup holder to your dashboard! Libraries perform a similar function for the programmer. Most languages are supplied with a set of standard libraries, and C is no different. Our library routines range from basic string handling (like strcpy and strcmp) to a complete quicksort implementation. We have already seen atof (which converts a string into a number), but there are many others, some of which we shall cover here.

One to another With all data processing applications there is an input, a process and an output. It is extremely rare for the data in each stage to be in the same format. The input might be a file containing text strings with numbers; the processing might require floating point; and the output may go to the screen as text. Converting from strings is done with the ato* set of functions (see Table 1), for which you’ll need to include the stdlib.h header file. These take a NUL (sometimes called NULL) terminated string and return a single value of a

specific type. There is a different function to return integers, floating point numbers and long integrals. Each function reads characters from the string until it finds one it doesn’t like (a space or a letter, for example), at which point it stops and returns the number it’s worked out so far. As a side point, if you’re reading existing code, you might also find an atoll function, which converts text into a ‘long long’ (aka a QuadWord, or 8 bytes). Similarly, there are also functions like strtof, strtod and strtoq (meaning string to, as opposed to ASCII to) for converting into floats, doubles and quadwords, respectively. All these functions exist in the ISO 9x C standard. Converting back from an integer into a string is quite straightforward. We’ve already seen how printf can use a format specifier to take an int and output it as individual digits. So what we need is a function identical to printf, but which outputs into a string. Guess what? Someone’s already done it! char szNumberAsText[32]; int iNumber; sprintf(szNumberAsText, “%d”, iNumber);

Table 1: ato* functions

62

LINUX MAGAZINE

Function atoi

Return type int

atol

long

atof

double

Issue 20 • 2002

Comments This also supports the ‘e’ notation, which means the string ‘8e2’ will equate to 800 (8 x 102). However, it doesn’t support the decimal point in any form, so 1.5e4 becomes 1, not 15000 because it terminates at the dot. This functions as atoi. Under i386-based Linux machines, ints and longs both use 4 bytes, so are functionally equivalent. However, if you are using longs you should use atol, as it describes more accurately what you what to do, and makes your code easier to port. Naturally, this has to accept the ‘.’ as a decimal point for numbers like 3.1415927. However, atof also permits its use with numbers like 1.5e4, which in this case does become 15000.


PROGRAMMING

Listing 1 1 #include <stdio.h> 2 3 int main(int argc, char *argv[]) 4 { 5 int iBigNumber = 76543, iBiggerNumber = U 98765, iBiggestNumber = 196608; 6 short iShorterVariable; 7 8 iShorterVariable = (short) iBigNumber; 9 printf(“(short) %d = %d\n”, iBigNumber,U iShorterVariable); 10 iShorterVariable = (short) iBiggerNumber; 11 printf(“(short) %d = %d\n”, iBiggerNumber,U iShorterVariable); 12 iShorterVariable = (short) iBiggestNumber; 13 printf(“(short) %d = %d\n “, U iBiggestNumber, iShorterVariable); 14 15 return 0; 16 }

Listing 1: Output (short) (short) (short)

76543 = 98765 = 196608 =

11007 –32307 0

As always, make sure you declare a string variable with enough space to take the largest possible outcome. For those of you old enough to remember BASIC, this is as close to STR$ as C gets.

Beat mama Converting between variables (such as int and long) is done through type casting. Here, the compiler looks at the source variable and works out how to store the same value in the destination variable. The compiler will do this automatically when assigning between types as an implicit cast. To reduce misunderstandings (and compiler warnings) it is better to always use an explicit cast. Casting uses the bracketed type notation we’ve used before:

Some conversions cannot work, such as casting a structure into an integer, and some work but with side effects. The latter occurs when one variable (say an int) is being cast into another (a short) which has fewer bits in which to store the result.

Listing 1: An explanation Although the results may appear unpredictable, they are not. ‘The casting takes the least significant bits and copies them.’ as it can from the int to the short, 16 in our case. In the first example, 76543, this equates to 11007 because the difference (65536) is stored in bits above the first 16. This is best visualised by writing out the number as if it were binary, (see Table 2). The same effect can be seen with the last example (where 196608 becomes 0). The second example, however, has extra bit. Because the short variable is signed, the most significant bit (the 16th, 32768 one) actually represents minus 32768, producing:

The casting takes the least significant bits and copies them

–32768+256+128+64+8+4+1 = –32307 It is possible to check whether a particular number will lose precision before casting, but is easier (and generally quicker) to cast, cast back and see if the numbers still match! However, casting between integral types is not something you should do as a matter of course as it produces bugs, induced by this problem. Finally, when casting a float into any integral type (char, short, int or long) you will lose precision since the numbers after the decimal point cannot be stored. Floats are simply truncated, rounding down to the nearest whole number (an oft-used trick). It does this with special code (usually a specific CPU instruction), because floating point numbers are stored in IEEE format, not the binary one above. However, once in an integral format the numbers are subjected to the same casting rules as above.

Anywhere is One of the simplest input validating functions you might write for yourself is ‘IsADigit’, which simply tells you if the character you’ve read in is a digit, or not. You’d probably write something like this:

int iInteger=2002; short iShort; iShort = (short)iInteger;

Table 2: Effects of casting bits Lost by casting 131072 76543 0 98765 0 1 196608

65536 1 1 1

These are the 16 bits present in a short integer 32768 0 1 0

16384 0 0 0

8192 1 0 0

4096 0 0 0

2048 1 0 0

1024 0 0 0

512 1 0 0

256 0 1 0

128 1 1 0

64 1 1 0

Issue 20 • 2002

32 1 0 0

16 1 0 0

8 1 1 0

4 1 1 0

2 1 0 0

LINUX MAGAZINE

1 1 1 0

63


PROGRAMMING

Time is a many fingered creature: a stealer of days, a ravager of youth

Table 3: Some ctype.h functions Function

Comments

Successful cases

isupper islower isalpha isalnum

Upper case letters Lower case letters All alphabetic characters An alphabetic, or numeric character A decimal digit A hexadecimal digit Any printable character Whitespace character Standard punctuation Any control code Graphical character

A-Z a-z A-Z, a-z

isdigit isxdigit isprint isspace ispunct iscntrl isgraph

A-Z, a-z, 0-9 0-9 0-9, a-f, A-F Most ASCII codes 32-127 tab, newline, return & space !, “, #, $, %, &, ‘, etc All ASCII code before 32, & after 127 All ASCII from 33 to 126 inclusive. ...continued

int IsADigit(char c) { if (c >= ‘0’ && c <= ‘9’) return 1; else return 0; }

if (bWasLastWhiteSpace) *pName = toupper(*pName); bWasLastWhiteSpace = isspace(*pName); pName++; }

3am eternal I will not fault you for it. However, there is a set of functions that do this already and a lot more besides (see Table 3). Each function below takes a single character, and returns 0 for failure, and non-0 for success. You must include ctype.h to use them. The implementation for this is quite interesting, and explains why each returns non-0, as opposed to 1. Instead of 11 functions (the GNU extensions feature isblank, not covered here) there is one array. Each element in that array refers to a single character; the contents refer to a set of flags. These flags, “isupper”, “islower” and so on, can be checked individually (with a single bitwise and) eliminating the need for function calls, if statements and other processor-wasting instructions! The same idea is used for two other useful functions, also from ctype.h (see Table 4). These functions actually take an int (not a char) and return an int (not a char)! This usually has no impact on your code; it is to allow code like toupper(EOF) to return EOF on a system with unsigned chars (where EOF, being -1, doesn’t fit). char szName[128], *pName; int bWasLastWhiteSpace = 1; strcpy(szName, “capitalise all initial letters”); pName = szName; while(*pName) { Continued... 64

LINUX MAGAZINE

Issue 20 • 2002

Time is a many fingered creature: a stealer of days, a ravager of youth... and a function in C that returns the number of seconds since the January 1 1970! This base function is the root of many others that will work out the date, day of the week and year. This, and all other time related functions mentioned here require the time.h header to be included. time_t iCurrentTime; iCurrentTime = time(NULL);

/* method 1

*/ time(&iCurrentTime);

/* method 2 */

Two points here. The first is that the time function uses its own type, time_t. It is, however, a disguised long integer, so you can add 60 to it to get the time

Table 4: More ctype.h functions Function

Comments

toupper

Converts a letter from lower case to its upper case equivalent. Nonalphabetic characters remain unchanged. Converts a letter from upper case to its lower case equivalent. Nonalphabetic characters remain unchanged.

tolower


PROGRAMMING

Table 5: tm structure Element

Explanation

tm_sec tm_min tm_hour tm_mday tm_mon tm_year tm_wday tm_yday tm_isdst tm_gmtoff

Seconds Minutes Hours Day of the month Month of the year Year Day of the week Day of the year Is daylight savings time Seconds east of GMT (a.k.a. UTC) Time zone description

tm_zone

Comment

In 24 hour clock. The 3rd of February would return 3, here 0=January, 1=February, etc. Counted from 1900. So 2002 is 102. 0=Sunday, 1=Monday, etc. 0=January 1st, 1=Jan 2nd, etc. Can be -1, 0 or 1. Stored as a long, not an int. A text string, not an int.

Note: pEasyReadTime refers to some private data of the localtime function. This data gets (re-)written upon each call to localtime. Therefore, you should copy this data to a local variable if you do not intend to use it immediately after retrieving it. after one minute. Secondly, both instances of the function are identical. It returns the same number as it assigns to the pointer (if supplied). So use whichever is suitable for your purposes. Once we have this ‘time_t’ number we can pass it to other functions to make it more user friendly. time_t iCurrentTime; struct tm *pEasyReadTime; iCurrentTime = time(NULL); pEasyReadTime = localtime(&iCurrentTime); printf(“The current time is %.2d : %.2d \n”, pEasyReadTime->tm_hour, pEasyReadTime->tm_min); The tm structure has a number of useful elements, which can be seen in Table 5. To make this the date even more readable, it would be nice to retrieve the names of the month,

Listing 2 1 #include <stdio.h> 2 #include <stdlib.h> /* this is where U rand() lives */ 3 4 int main(int argc, char *argv[]) 5 { 6 int i; 7 8 for(i=0;i<10;i++) 9 printf(“%d “, rand()/(RAND_MAX/100 + 1)); 10 11 return 0; 12 }

or the day. This is amply supported with the strftime function. char szTimeString[64]; strftime(szTimeString, 64, “It’s %A today!!”, pt); This function works like an sprintf, formatting the text string given into the variable szTimeString. However, strftime has a special set of specifiers, specific to time. These are the same as those used to set the time using the date command (type date –help at the shell for a complete list). Table 6 has a brief list. The second parameter (64) is the maximum number of characters to write (including the NUL terminator). If the formatted string would exceed this number, no string is written, and the function returns 0. Otherwise, it returns the number of characters written.

Against all odds At some point in your life you’ll need a random number generator and at that point, you’ll need to use rand. This function attempts to defy logic – persuading a completely rigid, logical, structured system to produce an arbitrary number without any

Table 6: Time specifiers Format

Output

%a %A %b %B %T %Y

Name of day, abbreviated. Sun, Mon, etc. Name of day, in full. Sunday, Monday, etc. Name of month, abbreviated. Jan, Feb, etc. Name of month, in full. January, February, etc. The time in 24 hour format (HH:MM:SS) The year, in full. 2000, 2001, 2002.

Issue 20 • 2002

LINUX MAGAZINE

65


PROGRAMMING

patterns. It is a difficult mathematical problem, so thankfully it’s included in the standard libraries. The function, rand(), produces a random number between 0 and 2,147,483,647, which, for ease of use is defined as RAND_MAX. It is more useful, however, to limit this range to something with only 10 possibilities, say. Taking the modulus of rand() is highly unrandom (try it and see!), but it can be used effectively thus:

a random number (since that’s already been determined from the last seed), so what do you do? Cheat! Have a look at the time! If we use the include file time.h, we have access to a function called time, which returns the number of seconds since January 1 1970.

int iRandomNumber;

That should be random enough for most software. There is one annoying side effect with time seeding, which is that some bugs will only occur with a specific random sequence. In order to repeat this sequence we can store the result from time(0), and use it explicitly next time round.

iRandomNumber = rand() / (RAND_MAX/10 + 1); This produces numbers between 0 and 9, and is a good second step. I said second step for a reason. Try writing a program that prints 10 random numbers between 0 and 99. For an example see Listing 2. Run the program and note down the numbers. For example, ‘84 39 78 79 91 19 33 76 27 55’. Now run it again and look for any similarities between both sets of numbers. Confused? The random numbers, as supplied, are not random since they work through the same algorithm in both cases, starting from a given seed. In order to produce a different set of random numbers, we must change the seed. You can seed the generator with: srand(0); However, any constant number will produce the same sequence of numbers, and you can’t seed srand with

srand(time(0));

Two divided by zero The maths library is the only one I’m mentioning here that requires more than a simple #include <math.h> line – you must also link in the maths library, meaning you should compile with the –lm option, thus: gcc mathsprogram.c –lm There’s a complete set of maths functions, like sin, cos and tan, along with their inverse (asin, acos and atan) and hyperbolic versions (sinh, cosh, and tanh). Each requires the angles to be given in radians as a double (not a float), and within the correct range (where appropriate). There are also functions like abs

Listing 3 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 struct sTempElement { 5 float fTemp; 6 int iHour; 7 }; 8 9 int qs_CompareTemp(const void *p1, const void *p2) 10 { 11 struct sTempElement *pT1 = (struct sTempElement *)p1; 12 struct sTempElement *pT2 = (struct sTempElement *)p2; 13 14 if (pT2->fTemp < pT1->fTemp) return -1; 15 if (pT2->fTemp > pT1->fTemp) return 1; 16 return 0; 17 } 18 19 int main(int argc, char *argv[]) 20 {

66

LINUX MAGAZINE

Issue 20 • 2002

21 struct sTempElement TempEachHour[24] = { 22 {20,0}, {18,1}, {17,2}, {16,3}, {15,4}, {17,5}, {18,6}, {19,7}, 23 {20,8}, {21,9}, {22,10}, {23,11}, {24,12}, {25,13}, {26,14}, 24 {27,15}, {28,16}, {29,17}, {27,18}, {26,19}, {25,20}, {24,21}, 25 {23,22}, {22,23}, 26 }; 27 int i; 28 29 qsort(&TempEachHour[0], 24, sizeof(struct sTempElement), qs_CompareTemp); 30 31 printf(“Hottest Temperatures Today\n”); 32 33 for(i=0;i<24;i++) 34 printf(“#%.2d : %.1f Centigrade at %.2d:00\n”, i, TempEachHour[i].fTemp, TempEachHour[i].iHour); 35 36 return 0; 37 }


PROGRAMMING

(to find the absolute value; ignoring any sign), sqrt (square root of a positive number) and log (for natural logarithms). double fAngle, fTheta; fTheta = M_PI * 180; /* 180 degrees, converted to radians */ fAngle = sin(fTheta); printf(“sine(%f) = %f\n”, tTheta, fAngle);

qsort shortcut In the example given here, I’ve written the code explicitly returning –1, 0 or 1. In reality however, qsort considers any negative number to be equivalent to –1, and all positive numbers to be 1. So, in some cases it is possible to write: return pT2->iTemp – pT1->iTemp;

You also get access to a number of mathematical constants, such as M_PI, M_LN2 and M_LOG10E. Sneaking a peak into /usr/include/math.h will give you full details of these macros and the above functions. A decent maths book will give you full details of how to use them!

Sorted for E’s and Whizz Finally, something that will prevent an army of reinvented wheels – quicksort! The C language includes a fast, flexible version of quicksort that you can use to sort any array based on specific criteria designed by the programmer. To do this, qsort (as it is called) knows nothing about your data; it ‘simply’ shuffles your data around in memory according the rules laid down by the quicksort algorithm. Lines 4-6 define the structure for sorting. We’re including the time here because qsort sorts the entire structure. Meaning we might know that the warmest point in the day was 29 degrees centigrade, but not what time it was. We knew that information previously only because of its position in the array. Once the data is sorted, its order is lost, so we need to store this information explicitly. The magic works with lines 9 to 17. This is the callback function (first introduced in part 4) that qsort uses to arrange each entry. Because qsort can never know every type of structure you might want to use, it refers to each element as an anonymous block of memory. It does this by using a void * (pronounced ‘void pointer’), which describes a pointer, but without describing which particular type of data is at that memory location. The word ‘const’ tells the compiler (and the programmer) that the data to which p1 points cannot change (i.e. it remains constant) whilst in the function. We will cover this more fully later. Lines 11 & 12 perform some type casting, allowing us to refer to the individual elements within the structure. Casting pointers is the same as casting any other type, it just looks a little less pretty. pT1 and pT2 can now refer to structures directly, whereas void * can’t because it doesn’t (by definition) point to any specific type, and therefore has no knowledge of how to reference it. The callback function required by qsort should return one of three values, –1, 1 or 0. If, of the two elements given, the first belongs sooner in the list

In some cases though. Not this one! Why? Because we’re using floats and would have to cast the result to an integer. This in turn will cause precision errors in our data. How? Well, imagine if fTemp1 was 12.4, and fTemp2 was 12.2, our expression would evaluate to 0.2. This in turn would get truncated to 0 (as we are casting to an integral value). qsort would believe them to be equal and continue shuffling data accordingly – certainly not what we intended! If your memory stretches back to part three you might remember the strcmp function. It compares two strings. If the first string is ‘less than’ (i.e. first in the alphabet), it returns –1, and if it is greater (i.e. later), it returns 1. Equal strings return 0. It’s more than a coincidence I bring this point to bear at this time! The strcmp function is neatly moulded to make sorting strings very easy. I hope that shortcut saves you re-inventing another wheel! you should return -1. If the second appears later, return 1, or if they are identical, return 0 (see the qsort shortcut boxout). You can actually check any number of criteria you wish. For example, if two temperatures are the same, you could use the time of day as a tie-breaker. In this example we are sorting our array for hottest temperatures. We could sort for coldest by simply swapping the sign of the return variable. Lines 21-26 we’ve seen before, while 31-34 is simple code we could probably write in our sleep by now. Line 29, however, is the start of something good! The parameters of our beloved qsort function are (in order): the pointer to the first element in the array to sort, the number of elements in the array, the size of each element and finally the callback function declared above. qsort returns when the TempEachHour array has been sorted, element 0 holding the ‘greatest’ value; according to our rules in qs_CompareTemp. Finally, we output our results the screen and marvel at a good project, well done! Issue 20 • 2002

The author Steven Goodwin celebrated (really!) 10 years of C programming last year. Over that time he’s written compilers, emulators, quantum superpositions and four published computer games.

LINUX MAGAZINE

67


PROGRAMMING

Processing XML documents with Tcl and tDOM

FREEDOM There’s nothing to stop Tcl programmers from processing XML files with their own software. Carsten Zerbst takes a look at the tDOM package, which provides a fast, streamlined DOM implementation

X

ML is fast becoming the lingua franca of file formats. If you want to use XML within your own programs there is no need to write a parser, as many ready-made solutions are available for this purpose, not least for Tcl, which offers extensions enabling you to access XML document elements. One of these is tDOM, a package that is not only powerful but also unusually lean and fast. Access to the actual parser is usually via one of two types of API. With SAX (Simple API for XML) the parser reads the data and executes commands as soon as it reaches certain points in the text, even if it has not finished loading the document. In other words, this is an event-driven API. The alternative to SAX is DOM (Document Object Model). Here, the parser loads the complete document into memory first and stores its structural details in a tree structure. DOM offers more powerful document retrieval and editing facilities than SAX. This flexibility comes at the price of greater memory usage. Implementations of this API are available in various programming languages, for example C and Java. The DOM API basically uses three different classes: one for creating documents, one for the documents themselves and one class for the different elements. The idea behind DOM is that it uses element objects to represent each XML tag, all attributes and every text section. The elements have methods that enable them to inherit elements located above, below and next to them. Other methods provide information about the element.

Table 1: Document commands Command

Description

documentElement createElement tagname createTextNode text createCommentText text createCDATASection data createProcessingInstruction data

Returns the root element Creates an element called tagname Creates a text element Creates a comment Creates a CDATA element Creates a PI element

68

LINUX MAGAZINE

Issue 20 • 2002

DOM and XPath in a single package

The two main DOM packages available under Tcl are Steve Ball’s TclDOM and Jochen Löwers tDOM. In the following examples we are using tDOM; this package has an impressive functionality range and is very fast. Apart from the DOM specification it contains other useful things, such as an XPath implementation and a graphical query tool. Compiling and installing tDOM is pretty simple: unpack the sources, change to the unix sub-directory and perform the usual routine (configure, make, make install).

tDOM in action The dom command in tDOM creates new documents. dom parse string instructs the package to analyse a string of XML data and to create an XML document object from it. New empty documents are created using dom createDocument name. You will frequently come across files which at first glance appear as though they should be easy to process with DOM, but are not pure XML; HTML being a case in point. There is a solution to this. The option -html allows tDOM to read many HTML pages without requiring any manual intervention. The tDOM syntax is object-oriented in a similar way to Tk. The dom command’s return value is a domDoc class object representing the entire document. % set fd [open filename] % set doc [dom parse [read $fd]] % close $fd

Although this looks simple, it does in fact involve a lot of work. The raw data needs to be turned into a data structure with XML tags and attributes. tDOM does a pretty quick job of this. On a computer with a Duron processor (800 MHz, 512 Mb RAM) the normal parser takes only 80 milliseconds to read the 370Kb Mondial database. The Tcl interpreter and the XML document together take up a mere 2.5Mb of memory. By comparison, Java and JDom require 1900 milliseconds for the first read and 500 milliseconds for each subsequent read on the same


PROGRAMMING

machine, with the JVM taking up 15Mb of resident memory. The tDOM package uses James Clark’s Expat parser and therefore supports Unicode, as is normal for Tcl. However, as technical data, for example, often does not require Unicode the ISO-Latin-1 character set will in many cases be sufficient. tDOM contains a second, faster parser for this eventuality, which can be selected using the –simple option. The data now takes only 45 milliseconds to read. The memory requirement also depends on the size of the original file. tDOM needs about double to four times the size of the original file, other solutions in C and Java require up to 30 times.

address the third element specifically use //TYPENAME[3]. As the query may contain square brackets, these must be protected in Tcl (either with backslashes or curly brackets). Table 3 shows some examples of XPath queries. To get a quick overview of the XPath features, Jochen Löwer has written the xe tool, which displays the results of XPath queries in graphical format. The interface takes a bit of getting used to: the query is typed into to the upper window, highlighted with the mouse and submitted with the execute <sel.> button. The xe input consists of the desired file followed by the XPath query. xe displays the result, including child nodes, in the lower window, the branches of the tree can be expanded using the + symbol (see Figure 1).

Step by step Once the document has been read, the dom command returns a domDoc object. Using this element’s sub-commands, various element types can be created or the root element retrieved (see Table 1). The root element represents the top node, like the <html> tag in an HTML document. The type of the root node is domNode, the same as that of any other DOM element. The most important commands for the (domNode) elements are listed in Table 2. Using these commands, the program can navigate through the branches of the DOM tree and retrieve the information it contains. Creating new elements is a little more complicated. The DOM uses a two-step process. First, a document command creates a new element, for instance createTextNode creates a new element of the type TEXT_NODE. In the second step, this is appended to an element of the tree. % % % % %

set doc [dom createDocument html] set root [$doc documentElement] set node [$doc createTextNode “Hello”] $root appendChild $node puts [$root asHTML]

<html>Hello</html>

To the point The commands mentioned up to now are pretty much part of the normal DOM environment but rather unwieldy for addressing XML elements. Should you require the first td in the third table element with an attribute setting of rowspan=2 this will need quite a bit of work. Fortunately there is a far more elegant way in tDOM. The magic word is XPath, which enables you to search for nodes using a handy query language. This is another W3C specification. The command selectNodes query can search the sub-tree starting at any node within a document. Depending on the type of query the results are nodes, attributes or their values. To search for all elements of a particular type, use //TYPENAME. To

Web-grabbing XPath also makes Web-grabbing (the extraction of data from HTML files) very easy. The following example uses the BBC sports news ticker, from which we are going to read a news item. The last instalment of this series described how Tcl loads Web pages from the Internet. Here, we are concentrating on processing their HTML contents. As soon as the page is available, we want tDOM to retrieve the summary of the latest news item and the

Table 2: Element commands Command

Description

ownerDocument

Returns a reference to the document containing the element

Single node nodeName nodeType nodeValue Attributes attributes getAttribute attrName @attrName setAttribute attrName attrValue Child nodes parentNode childNodes appendChild child replaceChild old new removeChild child getElementsByTagName XPointer descendant count type descendant all type XPath selectNode query Outputting the DOM tree asXML asHTML

Returns the name of the node Type of node, e.g. element or attribute Node content for text nodes Lists attributes Retrieves single attribute Short for getAttribute Sets attribute Returns the node one level above in the tree Lists all child nodes Appends element as child node Replaces child element Deletes child element Searches the entire sub-tree for elements with a specific name Descendant elements by position and type Descendant elements by type XPath query Outputs sub-tree as XML Outputs sub-tree as HTML

Issue 20 • 2002

LINUX MAGAZINE

69


PROGRAMMING

Table 3: XPATH examples Query

Description

/option //option //option[3] /table/*

The option element directly below the root node All elements in the document called option The third option element All elements below table, where table must be located directly below the root node The first table element in a document The last table element All colspan attributes in a document All td elements with the attribute colspan All table elements that have a width attribute All table elements with a width attribute that has a value of 690 All elements with two tr child nodes All td and th elements contained within a tr element All img elements contained within a table–element Second img element in the first table

//table[1] //table[last()] //@colspan //td[@colspan] //table[@width] //table[@width=690] //*[count(tr)=2] //tr/td|th //table//img //table[1]//img[2]

Listing 1: Web-grabbing with tDOM #!/bin/sh # # \ exec tclsh8.3 $0 $@ package require tdom package require http set server “http://news.bbc.co.uk” set path “sport/” set url “$server/$path” if {[catch {http::geturl $url –timeout 15000} U token]} { puts stderr “Problem with network: $token” exit 1 } if {[http::ncode $token] != 200} { puts stderr “Problem with server, U [http::code $token]” exit 1 } set doc [dom parse –html [::http::data $token]] set root [$doc documentElement] set node [$root selectNodes U {//table[7]/tr[2]/td[2]/a}] set text [[$node childNode] nodeValue] puts “Latest news: $text”

tDOM, the universal XML tool

Figure 1: The BBC sports news pages in a Web browser. The DOM tree can be displayed via the context menu, with the selected element on the HTML page also highlighted in the DOM viewer

Info TclDOM http://tclxml.sourceforge.ne t/tcldom.html TDOM http://sdf.lonestar.org/~loe werj/tdom.cgi

70

LINUX MAGAZINE

reference to the complete story. But which element is the right one? We could either use xe and keep trying until the desired result appears, or we could get some help from Mozilla. If you press the right mouse button over the relevant text and select Inspect from the context menu a new window opens, displaying the DOM viewer (Figure 1 and 2). You can also reach the DOM inspector via Tasks/Tools/DOM Inspector in the SuSE 7.3 supplied Mozilla A simple count is sufficient in this case. The latest text is in the seventh table, in the second line, in the second column, within a <a href=””> element. It is advisable to save this page and design the relevant query in xe. Now you have all the information required for writing Listing 1. This calls the page and extracts the news item using tDOM. The script can be easily extended, for instance to load the full version of the news item. Issue 20 • 2002

Simple DOM, parser extensions and XPath are by no means all that tDOM offers. Recently tDOM has also learnt XSLT, confirming its position as the XML equivalent of the Swiss army knife. XSLT support is almost complete in the current version 0.7test, and DOM 2 with name spaces is also supported. Should you be interested in finding out more about the development of tDOM or have specific questions you will get to appreciate the tDOM mailing list. Overall, tDOM is a solid base for XML processing.

Figure 2: Mozilla shows the document’s DOM structure. The A element is selected in the left tree view; on the right the DOM inspector shows the href attribute with its value (a relative link).


BEGINNERS

Dr. Linux

TEST CASE Do you want to find

Stop root!

out what lies behind

Q

a command or who has just logged on? Marianne Wacholz shows how all this can be tested with a few inputs on the keyboard

Shell/bash The “mediator program”, which accepts your commands, processes them and finally passes them to the kernel for execution. Under Unix operating systems you can choose between diverse shells with varying functionality and operating philosophies. As a rule, on Linux systems the bash (“Bourne Again SHell”) is used as the standard shell, but other shells such as the csh (“CShell”) and/or the tcsh (an extended C-shell with the option of editing the command line) are also frequently installed.

72

LINUX MAGAZINE

I like to interrupt programs, which I start on a shell, with the key combination Ctrl+Z, in order to execute other commands in the meantime. Unfortunately this doesn’t work when I edit/configure files using su as root. Is there any other command to temporarily deactivate the root shell created by su and to bring it back again later? Dr. Linux: There is indeed and the command is suspend, which is entered in the bash (or csh/tcsh). suspend is a so-called shell built-in, meaning it is a command forming part of the scope of performance of the respective shell. It interrupts the superuser message with su in the same way as the key combination Ctrl+Z does with normal programs/processes, i.e. the root shell is put to sleep and instead you get back your original shell, on which you can carry out new commands completely as normal. First you will see the output Stopped followed by which command has just been stopped: perle@maxi:~> su Password: your_root password maxi:/home/perle # suspend [1]+Stopped su perle@maxi:~> [input tasks to be performed as Perle user]

Dr. Linux Complicated organisms, which is just what Linux systems are, have some little complaints all of their own. Dr. Linux observes the patients in the Linux newsgroups, issues prescriptions here for the latest problems and proposes alternative healing methods. get to know my system better so that I know what kind of command I have just put in. How do I do this?

To get back to the root shell, enter the command fg (foreground). You leave this in the usual way with the command exit:

Dr. Linux: With the shell function type plus the command name, you can see the origin of your selected program:

perle@maxi:~> fg su maxi:/home/perle # [other commands to be executed as root] maxi:/home/perle # exit exit perle@maxi:~>

perle@maxi:~> type suspend suspend is a shell builtin suspend is thus a built-in command of the shell, while... perle@maxi:~> type dir dir is aliased to ‘ls -l’

Knowing what you’re doing

Q

I start programs on a console by typing in their names. But basically, I’m often not clear as to whether this is a proper, compiled program or for example a shell script that I’m dealing with. I’d like to Issue 20 • 2002

... dir is an alias for the command ls -l. perle@maxi:~> type gimp gimp is /usr/bin/gimp


BEGINNERS

su This command enables you to change to a different user ID on the command line. When you do this, a new shell with the user identification of the user specified as argument is created. If the latter is missing, it allows su to work for a short period as superuser root. Provided you are not already logged on as root, you will need the password for the selected user. You can drop the new identity again by entering the command “exit” on the command line. If on the other hand, as in the case of gimp, this is a real file (or a link) in the filesystem, you can research more deeply with the command file. In the same simple way as using type, this identifies any unknown file types. For example, this means we can find out that /usr/bin/gimp is a proper binary program, while the command groups is an executable shell script: perle@maxi:~> file /usr/bin/gimp /usr/bin/gimp: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (uses shared libs), not stripped perle@maxi:~> file /usr/bin/groups /usr/bin/groups: Bourne shell script text

When file cannot tell what kind of file a given entry is (or if the file must not be displayed), you will receive in the output the keyword “data”. Separate details are provided by type with the output:

This is how you check, with the following example, whether you have writing rights with your current identity (–w stands for write) for the file /etc/fstab: perle@maxi:~> test –w /etc/fstab Anyone who is now perplexed and wondering where test displays the test result, will probably be disappointed by the answer: it doesn’t. This built-in is in fact designed to be able to formulate conditions in shell scripts along the lines of “If the writing rights for /etc/fstab match, then execute the following”, and hence one needs no verbal outputs on the standard output. On the other hand, the return value of the command is interesting. This is saved for the last respective command in the Variable $?. If it contains the value 0, then the test was successful; so it is possible to modify the content of the file. But if the command writes echo $?, with which one outputs the content ($) of the variable ? on the command line, a value not equal to 0 on the screen, then the test was not successful; ergo there are no writing rights for the corresponding file. This sounds much more complicated than it is though, just look at the two steps on the command line: perle@maxi:~> test –w /etc/fstab perle@maxi:~> echo $? 1 The output 1 is quite definitely not equal to 0; which means that the user making the query has no write privileges for the file with the Filesystem Table. Further useful options of test are:

command is hashed (Path/to/command) This means that the corresponding command has already been executed in the current session and has therefore been stored by the bash in the Hash table: perle@maxi:~> type gimp gimp is hashed (/usr/bin/gimp)

Checked out

Q

Although I do have a bit of experience already with my Linux system, it sometimes happens that I edit a file in an editor, but when I come to save my work I discover that I have no write privilege for it. Is there a neat little command, with which I can query rights in advance, without searching through the long directory lists created by ls –l?

Dr. Linux: The command with which you can get rapid and specific information about a file or directory is called simply test and is a shell built-in. It is called up as follows: test –option filename_or_directoryname

● -d: Is the argument file a directory (“directory”)? ● -e: Does the file even Exist? ● -r: Can I read it? Queries with test are, by the way, always processed in the following sequence: if you are the owner of the file, test checks the rights of the file owner. For non-owners on the other hand the built-in first evaluates the group rights, then the rights for the socalled “rest of the world”. If you want to know more about test, call up the corresponding documentation with man test and/or info test.

Who’s there?

Q

In which file can I find details on who has logged on?

Dr. Linux: Basically, on every Linux system, data is collected on the system start and the log-in activities of the users are kept in various databanks and log files. So there is no general answer to this question. Two commands which are simple to use are last and lastlog. Issue 20 • 2002

Alias A new name or else an abbreviation for a self-defined command. You can find out which alias commands in your system are “predefined” if you enter the command “alias” with no further details in the bash. Hash table: If a command is executed in a bash, then the shell remembers this command in the form of the path specification and saves it in the socalled Hash table. If you start the same program again, the bash reads the path specification from the Hash table, instead of first foraging through the entire search path for the corresponding executable file. This speeds up the execution of the command. Variable Many functions in the bash (and thus the whole system) are controlled by variables. Userdefined and system variables can be modified at any time for the current shell. On the other hand the user has read-only access to the so-called “special variables”. The command set will tell you which variables are set in the system (in addition to other information such as on shell functions) on the output screen.

LINUX MAGAZINE

73


BEGINNERS

Listing 1: Sample outputs from last... perle@maxi:~> last news tty3 web tty2 perle tty5 perle tty1 trish pts/7 chekov.linux-mag reboot system boot 2.4.10-4GB [...] wtmp begins Wed Jan 2 01:23:54 2002

Mon Mon Mon Mon Mon Mon

Jan Jan Jan Jan Jan Jan

7 7 7 7 7 7

19:04 – 19:04 (00:00) 19:04 still logged in 18:33 – 18:35 (00:02) 11:07 still logged in 11:06 still logged in 11:03 (08:00)

a command line. You will get a multi-column table, which is relatively simple to understand (Listing 1). In the first column, you will see the user name (“Who is logged in?”). Details of the terminal in use (tty, terminal type), the host to be used for remote log-ins (From), the date and the time (“Logged on since when?”) and finally the total duration of the log-in session follow. At the bottom of the table you will find information telling you since when log-ins have been being recorded in this file: Usually the system captures and archives /var/log/wtmp from time to time, so that the file does not get too big. Just as simple and clear is the output of lastlog. Here all the users the system has recorded are included in the output. From the point of view of security special users generated by the system usually have no home directory and are not even allowed to log in directly. This is the case, for example, with the games user. Because he has never logged onto the system as user, in the column headed “Latest log-in” (Latest) there is the short but sweet comment **Never logged in**.***

You can get your own information from the file /var/log/wtmp, which stores details of successful logins and log-outs by system users. But if you try to look at this file using an editor, you will see nothing but confusing symbols (see Figure 1). To coax out your details from the file, enter last on

Info Patricia Jung: “Command Line Juggler”, Linux Magazine Issue 19. Page 73 provides additional information on shell built-ins and aliases. Figure 1: /var/log/wtmp in an editor

Listing 2: ...and lastlog root [...] lp games irc ftp firewall postfix web perle man [...] cz

74

0LINUX MAGAZINE

Issue 20 • 2002

tty1

tty2 tty5

tty4

Sun Dec 16 22:06:26 +0100 2001 **Never logged in** **Never logged in** **Never logged in** **Never logged in** **Never logged in** **Never logged in** Mon Jan 7 19:04:04 +0100 2002 Mon Jan 7 18:33:15 +0100 2002 **Never logged in** Mon Dec

3 03:13:35 +0100 2001


BEGINNERS

K-tools:

SIMPLE SECURITY K

eeping a secret to oneself is not always easy – especially in mail traffic. Although many people would prefer not to think about it, emails are comparable to a postcard. Every intermediate station the mail passes can read the message if it really wants to. Maybe that hadn’t occurred to you? What a good thing there’s Geheimnis (it means “secret” in German). With the aid of this KDE front-end for the most common encryption programs, all your dark secrets will be hidden from even the most curious virtual postmen. You are even secure from snooping colleagues, because in addition to mails, the program can also be used to make child’s play of encrypting important files on your hard disk. To keep your mails and data secure in future, you now need nothing more than the latest release of the tool, which you will find on the homepage of the authors Chris Wiegand and Stefan Suchi at http://geheimnis.sourceforge.net/, plus a functional encryption program. In the case of the latter, by the way, you have more or less a free choice, since Geheimnis gets along with PGP 7.0, PGP 6.5, PGP 5.0, PGP 2.6.x and also GnuPG 1.0.x. Even using different versions and programs at the same time is no problem, since the tool allows different profiles to be created. SuSE users are especially lucky, since there is even an rpm package available for them to download. The owners of other distributions, unfortunately, will have to get their hands, or rather their compiler, dirty and install Geheimis after unpacking the sources (tar –xzvf geheimnis-1.96.tar.gz) and then: ./configure make make install

You should also carry out this Linux three-step in the geheimniskeepopen subdirectory which is created when you unpack. Please do not forget this, because Geheimnis needs this auxiliary program. To be specific, this is a simple Wrapper around a shell, which keeps the shell window open until the user explicitly closes it. This is necessary so that one can read the outputs of the active command line PGP program during all actions.

Keeping your emails

K-tools In this column we present tools, month by month, which have proven to be especially useful when working under KDE, solve a problem which otherwise is deliberately ignored, or are just some of the nicer things in life, which – once discovered – you wouldn’t want to do without.

Encrypted

secure has always been a fairly tricky business but Stefanie Teufel has the secret to security success

If you can hardly wait to finally make your data secure, you should waste no time in starting the program. To do this, enter either a simple geheimnis & in any terminal of your choice. Anyone who is familiar with the program from the good old days of KDE-1.x will be a little disappointed that Geheimnis in the current version 1.96 cannot yet dock in the panel. So a search for the old familiar menu item Applications/Geheimnis Dock Menu at present will sadly be in vain. The back-story to this is that the mechanism for docking has changed completely between KDE 1 and KDE 2, so the corresponding code will have to be completely rewritten. But don’t worry – according to the developers, the reimplementation of this practical feature is right at the top of their To-do list. PGP This abbreviation stands for Philip Zimmermann’s encryption and decryption program Pretty Good Privacy”. From the point of view of the user, PGP works as a “Public Key System”, which means that two different keys, which go together are used. Number one is the public key, which the user is supposed to circulate among the population as generously as possible, while Number Two is a secret key, which must only be in the possession of an authorised person, meaning you. With the public key of a third party, one codes messages to the latter in such a way that only the holder

of the related secret key (which is the third party) can then decrypt them. GnuPG A complete and Free substitute for PGP. Unlike PGP, GnuPG is Free software, which means the program’s source code is freely available, free from patents and free from restrictive licence conditions. Wrapper Wrappers are a type of software which encapsulates an object in such a way that it is easier and/or more secure when in use than the original, unwrapped object. An object in this case can be, for example, a program or a protocol.

Issue 20 • 2002

LINUX MAGAZINE

75


BEGINNERS

Geheimnis greets you in the first instance by telling you that it’s time to create a new profile, preferably a separate one for each encryption program you use (Figure 1).

Figure 1: Show your profile!

Click on the OK button to start. The next window (Figure 2) is also an advisory screen, in which you are prompted to enter the path to the subprogram geheimniskeepopen. Normally the program is found under /usr/local/bin. If you are unable to track it down there, a which geheimniskeepopen, or if necessary a locate geheimniskeepopen will help you. Enter the result in the window from Figure 3, which your new PGP tool opens for you automatically. Then tell Geheimnis which encryption program you would like to use. To do this, click in the section Profiles on the New button. In the window which then appears (Figure 4), you can seek out the appropriate program in a pull-down menu and give the baby a name in the box underneath. The name entered there appears, by the way, later in the profile selection.

Figure 3: Nice and clear, the secret central control

The lord of the rings It’s now time to think about the key. Click in the starting window (Figure 5) on menu item Key Management. Geheimnis then reads in – if you are already in possession of a key ring – all the necessary files and presents you with the result in a window as in Figure 6. Once loaded, you can potter about to your heart’s content with your keys. Move the cursor onto the key concerned, press the right mouse button, and decide for yourself if you want to delete, sign or otherwise process the key.

Figure 4: Which encryption program are you going to use?

Figure 2: Are you on the right path?

which and locate With the locate command, you search for files in your filesystem. The command does this by accessing a database (/var/lib/locatedb), which, with the command updatedb, is created (or updated). A list of all the matching files with full path specification is output. The which command on the other hand searches all the directories in the specified path for the specified command. Sign By signing a (public) key you are ensuring that this key does actually belong to the person whose name is on it. You should therefore only sign such keys as you have received personally on diskette from its owner, who is known to you, or for which the owner has personally provided you with the fingerprint e.g. by telephone. This “Fingerprint” is a series of characters generated from the key data, which marks the key unequivocally, but does not allow any information to be gathered about the key itself. When you sign a text or a file, PGP leaves the original data in clear text and attaches to it a signature also created from the text data (in 7-bit format for sending emails). When the receiver forms a test fingerprint from the data received with the same algorithm, he can then check if the data have reached him unaltered.

You can easily recognise your own, private key pair by the fact that firstly it is blue and secondly it consists of two keys. Keys marked in grey signal that these have been withdrawn by the owner (disabled), so should no longer be used. The standard setting is red. This colour tells you that you do not classify the key as verifiably genuine. Verified keys can be recognised, on the other hand, by their green colour. PGP newbies select the menu item Key management/Create key pair. In a terminal window which opens automatically you can now use geheimniskeepopen to track, with no worries, how Geheimnis executes the command which is necessary to generate a key, pgp –kg. Since PGP is usually highly talkative, you then only have to follow the instructions, to end up with your own personal key pair. It is just as simple as key management to encrypt and decrypt files. Drag the file to be encrypted out of

Figure 5: The main window

76

LINUX MAGAZINE

Issue 20 • 2002


BEGINNERS

Figure 6: Your virtual bunch of keys

Konqueror using drag and drop to the box labelled “Drag-n-drop files here” in the main window from Figure 5. This is where you then choose the box Encrypt/sign file. In the next window (Figure 7) you should then specify the appropriate profile and choose which public key should be used. Instead of encryption it is also possible to merely sign the file with your key. If you do this, people who are not working with PGP can also read the corresponding message. But in this case, bear in mind that they cannot check your signature for authenticity. If you do not wish to pass on a file, but simply keep it encrypted on your hard disk, you don’t need

to select a second key. In this case, activate the field Encrypt for self. If you don’t like the file name suggested by Geheimnis, simply change it. It is also possible to rename it later without any problem. But do take care to retain, if possible, at least the ending .pgp, since this is how the file remains linked to the program Geheimnis. In this way you are making sure that your PGP front-end will later automatically be started for decryption when you click on the file in Konqueror. That’s how easy cryptography can be.

Figure 7: It’s entirely up to you who can decrypt the file in future

Issue 20 • 2002

LINUX MAGAZINE

77


BEGINNERS

Desktopia

MOVING BACKDROPS All work and no play makes your desktop a very dull place, so Jo Moskalewski put aside more serious matters this month in favour of a little fun

W

hen looking for a home, the first thing you have to consider is whether it fulfils its basic purpose: a roof over your head, shelter from the wind and a warm place to sleep. These things alone may make a house, but they don’t make a home: comfort and cosiness are just as important. Take your own home for example, pictures may embellish the walls, there may be plants adorning the windowsills, and despite the adequate seating capacity at the dining table you probably also have a sofa, though this takes up more than a little of your living area. All these items are there more for their feelgood factor than for their functionality.

deskTOPia Only you can decide how your Linux desktop looks. With deskTOPia we regularly take you with us on a journey into the land of window managers and desktop environments, presenting the useful and the colourful, viewers and pretty toys.

The eyes have it Things are no different on your computer: letters need writing, emails need answering, and information needs to be researched on the Web. To do this, you need little more than a handful of applications; as a Linux user, you don’t even need a graphical user interface – the text console is perfectly adequate. Since a graphical user interface uses up valuable system resources, you could manage without one and reliably deal with all your tasks with a very much cheaper computer. Nevertheless, graphics are usually a must, because only then does the whole thing give you something to look at too.

Big Brother is watching you

78

LINUX MAGAZINE

Issue 20 • 2002

Xearth –pos “fixed –90.00 0.00” – 24 hour sunbathing at the South Pole

To make your desktop as cosy and welcoming as your home there is a wealth of applications which serve no functional purpose other than to give your eyes something interesting to look at. Xeyes, which comes as a part of every distribution, is a classic amongst irrational applications. Once started, via the xeyes command, it will never let your mouse out of its sight. Xeyes also includes all kind of options, which you can add on at the start. For example you can adjust all the colours and determine both position and size. Details on how to do this are revealed by the instructions, which can be viewed via the command man xeyes. Every time you make an erroneous command you get a short overview, which in line with tradition, can also be termed xeyes – –help.


BEGINNERS

The view from here

Sea of tranquillity

A somewhat more extravagant moving desktop classic is Xearth. Behind the name there hides a globe rotating as a background graphic. Xearth in the shell also answers to its own name and offers both the long (man xearth) as well as the short (xearth – –help) instructions and at the same time includes numerous options. For example there is the interesting option of being able to define one’s home town via degrees of longitude and latitude as the centre of the earth. The author’s home is at:

It’s not only high in the sky that you can find useful superfluities, a look under water also brings some movement to your desktop. Aquariums are said to exert a calming effect, and so Xfishtank is surely the Valium of backgrounds. Obviously you can define the colour of the water here, as well as its oxygen content and population. There’s no need to take a healthy mix ratio into account in the pixel world, although you should do when it comes to aesthetic features: With poison-green, de-oxygenated water and just one fish, you’re scarcely likely to achieve a calming effect. A manual here also points the way to be a successful aquarian once you depart from the default settings. One option which does work is –d, with which you a scanned-in coral reef – set in advance, for example, with xsetroot -bitmap korallenriff.xbm as an ordinary background graphic – can serve as the backdrop for your scaly pets. xfishtank makes the fish swim around on the desktop painting which you will then find – the header image shows the fishes in the xglobe universe. Without the option –d your fishes will be confronted by monotone water without decoration.

xearth -pos “fixed 48.42 9.00” Henceforth, the globe is no longer turned to the sunny side, but day and night travel over the computer’s home. If on the other hand you miss having the moon in the firmament, turn the tables with the parameter –pos moon and look at the earth from its satellite. From this point of view you can see which part of the blue planet is covered by clouds, or where the Moon is extinguished in the light of day. With the parameter –noroot this can also be done in an independent window (and thus independently of the desktop background).

Mars attacks! For many people it’s the rocks which are more remote from the Sun that are more fascinating than the Moon and Earth, such as Mars for example, which is currently very much in fashion. Straight away, someone came up with a cartography of the red planet, implemented this work in Xearth and named the combination Xmars. Anyone who now compiles this Martian source code will still come up with an earthly program file: rather than an xmars executable out pops a file with the name of its forefather – xearth. It would seem a good idea to rename it manually when you install it. Although Xmars may not be up to the current level of the countless Xearth options, there are still plenty of them. Another Xearth offshoot is Xglobe. This, just like KDE, is built on the Qt library and, being true to its origins, also has an adequate command parameter (–kde). This ensures KDE co-operation on all virtual desktops. Xglobe also offers a more realistic map of the world than the original, although it is somewhat more sparsely documented. The only remedy is tedious experimentation and the command xglobe –help | less, if you want to change from the (wellselected throughout) factory default settings. One –kde parameter is not an adequate argument to get KDE to co-operate. KDE would much rather be begged a little, which you can do in the background configuration dialog of the control centre: instead of an image or a colour, select Background Program, and then mark your preferred heavenly body tool in the Setup dialog.

Mars – helps you work, rest and play

Reality show XGlobe

Don’t hold back The xscreensaver presented in Linux Magazine Issue 16, can also be misused for animated backgrounds. The parameter –root is used for this, which you should append to the direct command for a screensaver module. The modules are to be found in an xscreensaver directory, reached via the command locate /xscreensaver/. So the following command starts the Matrix screen saver as an animated background:

Xearth or Xglobe as KDE background from the control centre

/usr/lib/xscreensaver/xmatrix –root You should, however, watch your CPU load because Xmatrix, like all other Xscreensavers, wasn’t developed with a view to such a deliberate misuse. So although /usr/lib/xscreensaver/xmatrix –root –delay 20000U –small –density 40 –trace may look very nice, it will easily take up more than half of the available CPU capacity even on a generously-sized computer.

Fish in space with xfishtank and xglobe

Info Xearth

http://www.cs.colorado.edu/~tuna/ xearth/ Xmars http://tallyho.bc.nu/~steve/xmars.html Xglobe http://www.cs.unc.edu/~scheuerm/ xglobe/ Xfishtank ftp://sunsite.unc.edu/pub/Linux/X11/ demos/xfishtank-2.1tp.tar.gz Xscreensaver http://www.jwz.org/xscreensaver

Issue 20 • 2002

Screensaver Xmatrix as animated background

LINUX MAGAZINE

79


BEGINNERS

OUT OF THE BOX

GOOD SOUND WITHOUT X Have you still got an old computer with 16Mb RAM and a Pentium 100 processor standing in the corner?

N

o matter how great XMMS may be it is nevertheless encumbered by a weight of library dependencies. In addition to the Xwindow system, a whole lot of additional files need to be installed. For Bram Avontuur’s mp3blaster, on the other hand, all you need is the text console, which provides an extremely clear display.

Christian Perle explains

Score

how you can turn it

Anyone wanting to compile mp3blaster themselves will have to get the source text in the form of a compressed tar archive from http://www.stack.nl/~ brama/mp3blaster/. You should also have installed the GNU C++ compiler g++, the ncurses library and the necessary header files. Thanks to the configure script there is not much to do when compiling the mp3blaster sources:

into a lean MP3 player with the help of a Linux-compatible soundcard and mp3blaster

tar xzf mp3blaster-3.0.tar.gz cd mp3blaster-3.0 ./configure make su (enter root password) make install-strip exit

Conductor If everything has worked, the executable program is now in the /usr/local/bin directory; in the make installText console Parallel to the graphical user interface (X), there are usually several consoles running on a Linux system in text mode. You can get to these from an active X with Ctrl+Alt+F1 to F6. You can get back to X in most distributions with Alt+F7. tar The “tape archiver”, the standard archiving program under Unix. With this program, whole directory structures are merged into a single file, which can be written or compressed e.g. on a magnetic tape (hence the name). ncurses A library for terminal-dependent output of text and control sequences for cursor positioning, colour changing etc. It replaces the older Termcap library.

80

LINUX MAGAZINE

Issue 20 • 2002

Out of the box There are thousands of tools and utilities for Linux. “Out of the box” takes the pick of the bunch and each month suggests a little program, which we feel is either absolutely indispensable or unduly ignored.

strip further files end up in the /usr/local/share/ mp3blaster directory. From there you can copy the sample configuration sample.mp3blasterrc_for_x with the command: cp /usr/local/share/mp3blaster/sample. U mp3blasterrc_for_x ~/.mp3blasterrc into your home directory. The program can be adapted via this file, which is something we will make use of later. The difference between the sample configurations sample.mp3blasterrc and sample.mp3blasterrc_for_x lies in the fact that the latter largely does without the use of function keys, which unfortunately work only in the text console, but not in an X terminal. Now enter mp3blaster as a shell command. Your new console MP3 player first reports for duty with the playlist editor. With [ 1 ] Select Files you can

Header files In header or include-files, there are lists of the functions available in a library together with parameters. The C(++) compiler needs this information for compiling a program. In the most common distributions a header package for a library usually includes the addition of “dev” or “devel” in its name. Configure script Used for the automatic evaluation of properties of the system, on which a source text is to be compiled. So for example configure finds out on its own which C(++) compiler is installed. With the aid of this tool it is possible to compile platform-overlapping software on different (usually Unix) systems, without having to make changes by hand.


BEGINNERS

change to file selection mode and also back again to the playlist. Both of these modes provide access to all the controls of the player. In playlist mode you control the playing (keys [p], [s], [4] and [6]) and order ([empty], [M] and [m]) of the playlist, while the file selection mode actually allows you to put together a playlist. Regardless of the mode, the display splits vertically into four areas. From top to bottom, these are an aid to the key functions, information on the play mode (playlist) or on sorting (file selection), details on the current group (this term refers to a collection of several songs) in playlist mode or of the “working directory” (file selection), plus whichever MP3 file is currently running. The column split into three on the right-hand side consists of details on the type of MP3 file and the play mode for the current group and a small mixer.

Tutti mp3blaster also differs from some other MP3 players by dividing the playlist into groups. The simplest method of creating a new playlist is via the selection item [ 5 ] Add Dirs As Groups. In this way the program creates a separate group for each subdirectory of the current file view. But what’s the point of this grouping? In the first place, you can make pre-selection for playing back in a random sequence (Shuffle). With [ 8 ] Toggle Play Mode mp3blaster enables you to change the global playing action (Shuffle all songs in all groups, play a group with subgroups, repeat a group without subgroups).

Frutti In playlist mode, using [ 2 ] Add Group you can also add new, blank groups and then fill these in the file selection mode. The name of each group can be changed at any time with [ 5 ] Set Group Title, even while MP3 files are being played. Adding songs to the group is also possible during playback. If you have created a playlist to your satisfaction, save it with [ w ] Write Playlist. The corresponding file will automatically respond to the file ending .lst. At the same time the Play Mode set will be saved with it. As the mp3blaster manpage reveals, the program includes various function toggles, which can be specified as options when you start the program. The flag –a (autolist) is very useful for playing back stored playlists. The argument file behind this is a playlist, whose pieces the player will play back without pausing. So the command

MP3 tags under control

Tuning fork You can make individual adjustments to the appearance and behaviour of mp3blaster via the file .mp3blasterrc in your home directory. Here, again, a look at the manpage will be helpful. If you specify: File.ID3Names = yes in file selection mode the program will additionally show the ID3 tags of the songs, when you change the display with [ f ] Toggle File Display. For setting and viewing these tags, by the way, mp3blaster comes with the independent program mp3tag.

Music on boot So, you want the boot procedure of your computer to be accompanied by music? Adventurers have the option of starting mp3blaster directly when the Linux system fires up. To do this we use the file /etc/inittab, which contains the basic configuration of init. Since the first seven text consoles in the most common distributions are taken up by login prompts and Xserver, for your MP3 player you should use the eighth console /dev/tty8. To do this, enter the line: M8:2345:respawn:/usr/local/bin/mp3blaster </dev/tty8 >/dev/tty8 as root in the /etc/inittab. This ensures the player starts during boot-up and after stopping with q is immediately started up afresh. There is still one cosmetic blemish to spoil things: the program is started – worrying in security terms – with root rights. A rapid remedy for this is to set the SUID bit and transfer the file /usr/local/bin/mp3blaster to the user “nobody”: chown nobody.nogroup /usr/local/bin/mp3blaster chmod 6755 /usr/local/bin/mp3blaster

mp3blaster –a all.lst automatically plays back the list all.lst, without you having to press [ 9 ] Start/Stop Playlist.

Now mp3blaster is executed with the rights of the (unprivileged) user nobody, which should prevent any unauthorised writing in system directories. Issue 20 • 2002

Manpage Like all Unix systems, Linux has a sort of online reference manual for the installed programs. This aid is invoked by man program name, e.g. man mp3blaster. Home directory The personal home directory of a user. This is where the user arrives after a successful log-in or with the command cd (without additional parameters). ID3 tag A small data suffix for MP3 files, in which additional information such as year of release, musical genre etc. can be stored. Many MP3 players evaluate this information and can display it. init This program is the first to be started by the kernel when booting up and takes over the rest of the initialisation procedure. SUID: The “Set User ID” bit. If this is set in the rights of an executable file, in principle it will be executed with the access rights of its owner. On security grounds, the SUID bit has no effect in shell scripts.

LINUX MAGAZINE

81


BEGINNERS

The best Web sites for Linux users

THE RIGHT PAGES Janet Roebuck takes

Linux Kernel Patch Archive

her monthly look at

http://linux-patches.rock-projects.com/ This is the best central resource for all manner of Linux kernel patches, from bugfixes to drivers – arranged by both kernel version and patch type.

the best sites that have lit up our browsers here at the Linux Magazine offices

Linux Chix http://www.linuxchix.org/ LinuxChix is a great place for women who use Linux and other Open Source operating systems and programs to get together.

Linux Telephony LDAP Config http://www.terminator.net/ldapconf/ LDAPconf is a plug-in module for linuxconf, providing configuration dialogs for OpenLDAP server and client.

http://www.linuxtelephony.org/ If you’re interested in telephony under Linux, then this comprehensive site provides all the info you need on everything from VoiceOverIP to PBX projects.

Reiser Home Linux Max http://www.linuxmax.net/ Delivering the latest news, tutorials and opinions on Open Source and Linux to help users enhance their Linux experience.

http://www.namesys.com/ Not to be outdone by Red Hat, the Reiser filesystem also has its own homepage.

Shaolinux temple http://www.shaolinuxtemple.org/ As the name might suggest, this is a meditation on all things Linux and is produced by the author between intensive hacking sessions. An excellent read.

Unmaintained Project list Ext3 Home http://beta.redhat.com/index.cgi?action=ext3 The place to find the latest on Red Hat’s development of the ext3 filesystem.

82

LINUX MAGAZINE

Issue 20 • 2002

http://unmaintained.sourceforge.net/ While Open Source programs can flourish under careful nurture, many promising projects have no family to call their own. Here you can get involved in unmaintained projects and give a good home to an orphaned program.


COMMUNITY

LINUX EXPO BIRMINGHAM 2002 T

his year’s Linux Expo will be take place in Birmingham on *29 and 30 May at the NEC. Following on from the very successful shows held in Paris, Amsterdam, Madrid, Montreal, Shanghai and Sao Paulo, this show is something that anyone with an interest in the development and promotion of Linux cannot afford to miss. Clamouring for the title of ‘Premier UK show for Open Source and GNU/Linux solutions’ this is bound to be a popular event, but you can still register for free on the show’s Web site: http://www.linuxexpobirmingham.com/EN/home/. This event is split up into two parts, so running alongside the expo will be a conference, which is an event in it’s own right.

opportunity to discuss issues face to face, which will hopefully allow you to build your confidence in the company and their products. Most importantly, there is always the chance to get some freebies. Users, especially those who are keen to make the migration away from other platforms now have the chance to see what is available for them and their situation. At this one meeting you can see and evaluate what products are available, get a good idea as to what is going to be made available in the future and get the chance to discuss your problems and issues with those people who are going to make the future. It is here also that you get a unique chance to meet people such as yourself, to discuss, share, and hopefully, collectively solve the problems you currently face.

On *May 29-30 2002, the Birmingham NEC will host this event dedicated to the UK Open Source, Free software and GNU/Linux solutions market

Linux Expo It is at the exposition where you will be able view and gain a better understanding of the Linux marketplace, with its wide range of products and services, and includes offerings from major players in the information technology arena, like Borland, to some of the small, niche service providers. It is thanks to expositions like this one which give rise to the chance to bring together people from a wide range of disciplines. Here you’ll get the chance to mix with hardware and software developers, users in both corporate and domestic markets and those who have wares, services and products to bring to the market place. Developers in GNU/Linux and other Free and Open Source projects, who have fundamentally made Linux what it is, will be able to attend thanks to the generosity of the organisers in providing the ‘Community Village’, a vital link and a not-to-bemissed chance to make contact with this most important sector of the Linux world. Companies, like IBM, will be there, offering you the chance to see their latest related products and allowing you to assess their commitment to the Linux phenomenon, with stand size being only one reflection of that commitment. Here you get the

The Expo Conference During the conference you will be able to hear the views of some of the people that have made Linux what it is and who are charged with the responsibility of designing its future. A cycle of nine conferences will be held, covering all of the important market topics and highlighting the major issues affecting the Linux world. This is another unique chance to meet the top specialists and hear what they have to say! For those with more practical needs, you are welcome to attend the Conference tutorial sessions, which are specially designed to provide technical information on a wide variety of subjects in convenient two-hour sessions. These include real, interactive, training sessions, which will prove to be popular, so you should look to make reserve a place by booking, which, again, can be done through the Web site.

Info Linux Expo 2002 Web site: http://www.linuxexpobirmingham.com/EN/home/

Issue 20 • 2002

*All dates correct at time of going to press. However we strongly recommended you check the Web site: www. linuxexpobirmingham.com to ensure you are not disappointed.

LINUX MAGAZINE

83


COMMUNITY

The monthly GNU Column

BRAVE GNU WORLD Trophy

Welcome to another issue of Georg CF Greve’s Brave GNU World with a mixture of projects that should provide some inspiration for most readers. This month will also begin by introducing some Free Software games

Andrew Mustun began developing Trophy in March 2000 in order to fill the hole that quitting his computer science studies had left. Trophy is a carracing game in 2D top-view, in which it’s not only passing the finish line first which matters. More specifically, it is also about passing the finish line at all, since, in true James Bond style, the cars are armed and more than willing to make use of their gadgets. Thanks to solid graphics and sound, Trophy is already a fairly complete game that should allow friends of action-heavy fun to enjoy themselves, although a powerful computer is recommended for smooth scrolling. Trophy was written in C++ and Andrew releases it under the GNU General Public License. Its biggest weakness is probably the lack of a network play option. Andrew plans to take care of this once he finds time for it again, since right now his newly taken up studies keep him quite busy. It should be noted that whilst preparing this article, Andrew did emphasise that he was a peace-loving individual who disapproves of guns in general and who also considers cars to be dangerous enough already without heavy weaponry; although as he still lacks a driving license at 25, he couldn’t drive a real car anyway. That shouldn’t take the fun out of wasting an

Choosing tracks in Trophy

90

LINUX MAGAZINE

Issue 20 • 2002

Cornering in Trophy

entertaining afternoon with Trophy, though. If you seek creative relaxation through designing more tracks with GIMP, that’s not a problem. The instructions on how to do so are on the Trophy homepage. Should the network option be missed overly much, interested developers are of course welcome to implement it themselves. Andrew would definitely appreciate help in this direction.

Adonthell The Adonthell project is busy creating a Free 2D role playing game similar to those on the early consoles like the SNES, although it is intended to have a much higher degree of freedom. Many games consist of two connected parts where each part can be understood individually. The importance of content like story, graphics, music and so on is immediately obvious. The technical component, which does the actual interfacing with the player, for instance, is commonly referred to as the “engine”. Usable analogies seem to be the relationship between programs and operating system or scores and musical instruments. This separation allows games to be written in an abstract form with language and possibilities determined by the engine. The Adonthell project not only develops a game with a fixed story, it also develops an engine for role playing games along with stories that are being


COMMUNITY

Bathtime in Adonthell

interpreted by this engine. It is planned that all releases will not only contain code fragments but also complete little games. Taking the usual fluctuations into account, the permanent team of Adonthell are Kai Sterker, Alexandre Courbot, James Nash, Benjamin WaltherFranks, Joel Vennin, Joseph Toscano and Mike Nieforth. Only three of these are programmers, the others are musicians, graphic artists or authors. Thanks to this combination and the fact that all members insist on meeting in person once a year, the game has a professional feel to it and gives a good example of lively cooperation over the Internet. The code and graphics of Adonthell are released under the GNU General Public License. The programming language used for the engine is C++. For game control, expansions and in-game scripting, the Python interpreter was embedded into the engine. This makes it possible to write games for the Adonthell engine without ever touching C++. For music, OGG Vorbis is being used. One of the priorities was to be able to package engine and games separately. You only need to install the engine and with some help of tools like map and dialogue editors, as well as a little Python, it is possible to create a complete game. To make this even more interesting, the Adonthell group also works on a complete world with its own history, customs and peculiarities. Alexandre Courbot, who answered the Brave GNU

Unhelpful help in Adonthell

World questionnaire, said the next step is to rewrite big parts of the code based on experience gathered. The team is also still looking for people willing to help with porting the project to other platforms. The game is known to run on GNU/Linux, FreeBSD, OpenBSD and BeOS, but in the long term, it is also planned to support proprietary operating systems in order to give their users a first taste of freedom. Internally development is moving towards a more client/server based architecture to allow networked playing. Even though it isn’t planned to support very large numbers of players, Adonthell should eventually be capable of allowing a medium number of players to interact in a persistent world. Since its first steps in 1999, Adonthell has come a fair way already and further development provides hope for more. Those with the right skills who are too impatient to wait are encouraged to help the process along. The Adonthell team welcomes all kind of support. All others can already spend one or two afternoons with “Waste’s Edge”, the first playable release.

XBindKeys Philippe Brochard wrote the program XBindKeys, which makes it possible to assign shell commands to keys under X11. This way frequently used programs like the mailer, browser or xterm can be launched by a single key combination without having to take a detour via the menu. Once you get used to being able to do certain things without having to take the hands off the keyboard, you won’t want to miss this capability. Some window managers support keybindings natively, but you’ll frequently find that not all of the available keys are freely assignable – like special keys only present on some keyboards. Philippe himself uses XBindKeys to bring up a shutdown menu when pressing the “power” key that his keyboard has. Everyone who tries out new window managers or

Config file for XBindKeys

Issue 20 • 2002

LINUX MAGAZINE

91


COMMUNITY

uses different window managers from time to time knows the problems associated with teaching the new window manager your favourite key combinations. XBindKeys solves both problems, and in combination with the mini-program MoveMouse, also written by Philippe, it can even be used to bring the mouse to previously specified positions with a single key press. XBindKeys and MoveMouse were both written in C and are available under the GNU General Public License, as Philippe feels them to be his contribution to the GNU System. The configuration of XBindKeys is done by directly editing the easily understood plain ASCII configuration file, or by using the GTK frontend XBindKeys-Config, written by Laurent Vuibert. As a side note it should be said that one should make sure XBindKeys gets started before the window manager; this ensures key presses reach XBindKeys instead of being intercepted by the window manager. There are no plans for further development since XBindKeys is stable and Philippe believes it should remain small and useful. This clearly sets a good example in the fight against the spread of “featureism.”

Access Road The area of IT security is without question complex but also important. Awareness of the possibility of bugs in programs is reasonably good by now, but it is also possible to create security problems by combining programs that are working and “bug free.” Complex environments and tasks sometimes require pretty complex and obscure information systems. Without access limitations, data could be abused or modified secretly. The problem of this becomes immediately apparent when thinking about computer-based hospitals, for instance. The opposite, a complete limitation of all access, is also not a good idea since it makes all work impossible. So the task at

Controling access

92

LINUX MAGAZINE

Issue 20 • 2002

hand is to design a system in a way that necessary usage is possible, while abuse becomes impossible. Since the conception of such systems is done by humans there is always a significant potential for error. Access Road by Patrick Thazard tries to model the complex environment of information systems and visualise it for the administrator. This does not increase security in itself, but it offers help in finding security problems that may have gone unnoticed otherwise. Patrick Thazard himself has been working as a computer security consultant since 1987 and wrote Access Road in Java under the GNU General Public License. The documentation is released under the GNU Free Documentation License. At the moment Access Road supports GNU/Linuxlike systems, simple routers and Solaris-like systems. Even though no data update has been made before the last release, Patrick is convinced it will already provide a very useful structure for other developers. Further plans including adding the interaction between GNU/Linux and Apache and then adding the interactions between operating system and the employed database management system. In the longterm expansions for modelling systems like CORBA or Windows 2000/XP should complete the system. Until then there is still quite a bit of work to do and Patrick is looking for other developers willing to support his work. Even if the approach of graphical modelling in general does have some potential weaknesses, this project seems to be quite fascinating and allows exploration in new ways.

GNU Cons GNU Cons offers an alternative to one of the senior programs, GNU Make. Anyone who has ever downloaded software as source code, or recompiled the Linux kernel, has already used GNU Make simply by entering the command make. Make was written in a time when it was still normal to compile programs by hand or with bash shell scripts and at the time it was a big step forward. If you’ve ever tried writing a makefile yourself, you will most certainly have found the syntax to be pretty hard to understand. This is why most developers copy working makefiles from other projects to modify them for their current purpose, or have makefiles automatically generated by programs like GNU Automake. On top of this, make tries to detect modifications by the time of their last modification only, which is problematic and fails for sure when trying to recompile with new compiler options. The name GNU Cons was chosen because with its help, programs can be “Cons-tructed” and its goal is to do the jobs done by make the way they should be done. A very central component for this is a good mechanism to detect whether files have been modified. As a result, GNU Cons does not only look at


COMMUNITY

access times, but also works with MD5 file signatures, allowing a very good means of identification. A good example of these capabilities is the behaviour of GNU Cons in the following scenario: the program “test” consists of the object files “test1.o”, “test2.o” and “test3.o”. After the first compilation of the program, the object file “test2.o” is damaged/corrupted deliberately. The next call of GNU Cons will rebuild “test2.o”. This will not re-link the program “test” again, since GNU Cons realised that the generated version of “test2.o” is identical to the one previously linked-in. Should GNU Cons be called with different computer options, all parts are recompiled and linked, since not only the results but also the parameters used to create them are part of the comparison. GNU Cons was written in Perl by Bob Sidebotham, who has since retired from working on it. Rajesh Vaidheeswarran and Steven Knight took over as maintainers of the stable (Rajesh) and development (Steven) versions. Being part of the GNU Project, GNU Cons is released under the GNU General Public License. Thanks to the use of Perl, GNU Cons runs on both Windows and Unix-derivates and its configuration files, the equivalent of the commonly used makefiles, allow the use of very dynamic and complex expressions to customise a program to a certain system as much as possible. GNU Cons is fully usable although it is rather C/C++ heavy. Other programming languages can be accessed with the Cons::Plus module by Johan Holmberg. Also configuration files are of course rather Perl-heavy, which is not exactly a plus for many people. At the end of this feature I would like to express my thanks to the GNU Cons team for coming up with extremely verbose answers to the standard Brave GNU World questions. Rajesh Vaidheeswarran and Erich Waelde provided huge amounts of information with many examples, which was very interesting for me even if I was only able to put small parts of it into the issue. I can only hope some of the most important advantages got across well enough to give interested developers an idea of why they ought to give Cons a try.

SCons The obvious similarities in name between GNU Cons and SCons are not coincidental. The design of SCons is largely based on GNU Cons and was written in August 2000 by Steven Knight, maintainer of the GNU Cons development version, for the Software Carpentry competition. After being a maintainer of Cons for some time already, he pursued the goal of combining the ideas of Cons with the power of Python for the competition. SCons is based on this work. Like Cons, it provides superior capabilities for detecting

modifications and resolving dependencies, but its configuration files are based on Python. Also SCons already supports parallel compilation with the ability to specify the number of threads by a command line option. SCons is still a fairly young project – the first alpha was released on December 13 2001 – which is why releases are still happening at very short intervals, often containing additional functions. So even though the project has been working with a strong regressive test-infrastructure to maintain backwardscompatibility and quality since day one, one may still experience roughness in everyday use. The list of planned expansions is still rather long and contains not only good support for Java, C# and Fortran, but also the ability to generate documentation in several formats (PDF, PostScript, TeX and more) and archival. SCons is being released under an X11-type of license, which is known not to protect the freedoms. It is possible that the GPL would have been the better choice for the long-term perspective, but SCons clearly qualifies as Free Software and taking a look at it or participating is clearly a good idea.

Finish Alright, so much for the Brave GNU World for this month. For the next issue I already have one project stowed up that I’m already looking forward to introducing, since it has my life much easier and I hope it’ll do the same for you. Until then I wish you all a good time and please don’t hold back on suggestions, ideas, comments, feedback and project introductions; preferrably by email.

Info Send ideas, comments and questions to Brave GNU World Homepage of the GNU Project Homepage of Georg’s Brave GNU World “We run GNU” initiative Trophy homepage Adonthell homepage OGG Vorbis homepage Join Adonthell Xbindkeys homepage MoveMouse homepage Xbindkeys-Config homepage Access Road homepage GNU Cons homepage GNU Make homepage SCons homepage

column@brave-gnu-world.org http://www.gnu.org http://brave-gnu-world.org http://www.gnu.org/brave-gnuworld/rungnu/rungnu.en.html http://trophy.sourceforge.net http://adonthell.linuxgames.com http://www.xiph.org/ogg/vorbis http://adonthell.linuxgames.com/ development/join.shtml http://hocwp.free.fr/xbindkeys/ xbindkeys.html http://hocwp.free.fr/movemouse.html http://www.netchampagne.com/ xbindkeys_config http://accessroad.sourceforge.net http://www.gnu.org/software/cons http://www.gnu.org/software/make http://www.scons.org

Issue 20 • 2002

LINUX MAGAZINE

93


COMMUNITY

Bristol: 5-7 July 2002

UKUUG LINUX DEVELOPERS’ CONFERENCE There’s something for everyone at this year’s Linux Developers’ Conference, where experts and newbies alike get to mingle with the leading

T

he fifth annual Linux conference is to be held this July at the University of Bristol. Prior to the full conference on the 5-7 July, a one-day tutorial runs on 4 July. This year’s event starts with a tutorial on how to write shared libraries by Ulrich Drepper, who is the glibc maintainer at Red Hat. This is followed by a tutorial on the Linux Terminal Server Project by Jim McQuillan, the project’s founder. The conference itself starts proper on the Friday afternoon but a CUPS and KDEPrint workshop will also be run in the morning. The main presentations

will then run through until about 2pm on Sunday, 7 July. The delegate fee includes all presentations, tea/coffee breaks and a sandwich lunch on the Saturday. There will be informal discussions on all three days. A conference banquet is also planned for the Saturday evening on the floating restaurant “Shoots”. At the time of going to press the talks were correct, but please check the Web site at http://www.ukuug.org/events/linux2002/ for confirmation and bookings. EARLYBIRD REGISTRATION CLOSES 31 MAY

lights of Linux development

Speakers David Axmark Mike Banahan Ruediger Berlich Marcus Brinkmann Stephen Coast Aaron Crane Ulrich Drepper Craig Duffy Nigel Edwards Philip Hazel Christoph Hellwig Josh Howlett Dave Jones Luke Leighton Gervase Markham Michael Meeks Richard J Moore

94

LINUX MAGAZINE

Issue 20 • 2002

Talks MySQL Linux Terminal Server Project GRID computing The GNU Hurd LEGO programming Using PHP in large Web sites glibc2.3 10 things to do with a dead PC in Bristol Securing Linux servers Exim 4 ABI: support for Non-mative applications University of Bristol’s Nomadic network Buried alive in patches – 2.5 kernel FreeDCE Bugzilla GNOME 2.0 RAS round up from IBM Technology Centre

Speakers Simon Myers Kurt Pfeifle Mark Probst Stephen Richter Alistair Riddoch & James Turner Julian Seward Sander Striker David Sugar David Sugar Bo Thorsen Marcelo Tosatti and others Wookey

Talks Using RT to track bugs, ideas and life KDEPrint MathMap image manipulation language Zope 3 Technologies for multiplayer games Valgrind – memory debugger Subversion – a CVS replacement Free telephony and GNU Bayonne DotGNU and you Linux on AMD’s x86 – 64 architecture Panel discussion – kernel Embedded systems the easy way


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.