Issue 11
Issue 11
Table of Contents Issue 11................................................................................................................................................................1 .................................................................................................................................................................1 Reinventing .................................................................................................................................................................3 the wheel........................................................................................................................................3 Interview with Simon Peter, creator of klik....................................................................................................5 Klik is a fantastic system which allows users to install an application without worrying about dependencies and without being root. I was lucky enough to talk to its author.....................................5 Getting started with Knoppix Linux................................................................................................................9 Knoppix—the live CD that does it all....................................................................................................9 ODF in action...................................................................................................................................................15 Using OpenDocument format text in OpenOffice, KOffice and AbiWord..........................................15 Simple package management with Synaptic.................................................................................................21 A package management GUI for Debian-based distributions..............................................................21 Battle for Wesnoth...........................................................................................................................................29 The Battle for Wesnoth is on in the days that never were....................................................................29 Sun Ultra 3 Mobile Workstation review........................................................................................................35 Portable power computing....................................................................................................................35 Writing device drivers in Linux: A brief tutorial.........................................................................................39 A quick and easy intro to writing device drivers for Linux like a true kernel developer!....................39 Stylish XML......................................................................................................................................................59 Part one: using CSS to make your XML documents look pretty..........................................................59 Towards a free matter economy (Part 5).......................................................................................................63 Discovering the future, recovering the past..........................................................................................63 The day my father blew himself up................................................................................................................73 Open standards, free software, and old documents...............................................................................73
i
Issue 11
ii
Issue 11 By Tony Mobily Issue 11 of Free Software Magazine is finally here and it's packed with great articles including: our own Tony Mobily interviewing Simon Peter the creator of klik. Robin Monks gets us started with Knoppix and Marco Marongiu takes Synaptic Package Manager out of the box. We also have Alan Berg (with the much required assistance of his son Nelson) fighting his way through the Battle for Wesnoth. And, of course, much more... Source URL: http://www.freesoftwaremagazine.com/issues/issue_011
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
Issue 11
1
Issue 11
2
Reinventing the wheel By Tony Mobily Most IT people seem to have a really bad habit: reinventing the wheel. While sometimes this is “justified” by ethical requirements (see the big Gnome vs. KDE mess), often the problem is caused by ignorance. In this case, I don’t mean to use the word “ignorance” as a derogatory term, but simply as meaning “a lack of knowledge”. For example, I could easily believe that there are still one or two people out there who, in order to open a JPG file, will write their own routines, simply because they are not aware of the existence of libjpeg. I am also quite sure that there are one or two people out there who, in order to print 1000 envelopes, will do everything with a text file or a word processor (OpenOffice, Abiword, etc.) rather than using a specialised label printing program. Finally, I am absolutely, 100% sure that there is at least one person out there who will develop a content management system (CMS) in house to be used in a magazine. Okay, it’s time to show my cards: that person is me. I am talking about our own web site (http://www.freesoftwaremagazine.com). I am the person responsible for creating the technological structure behind it. In my case, I reinvented the wheel mainly because of server requirements: we could only serve static pages, in order to cut down the hosting costs. This ruled out the use of Drupal (http://drupal.org/), for example (or any other content management system, for that matter). I created a complex back-end which allowed our editors to do a peer-review on each article, and eventually publish it (as a static file). Later on, it became clear that this was no longer working out. Static files were fine in the beginning; however, as the web site grew (and we added blogs, newsletters, book reviews, and so on), its limitations became impossible to overcome. I am writing this editorial while taking a break from configuring (and in fact programming) Drupal so that it duplicates our current CMS abilities. Our requirements are quite intense (see: the peer-review system for each article, with word-for-word comparison between revisions, blogs, display of issues, multiple authors, etc.). However, it’s more than doable—in fact, if you are reading this editorial on line, then you’re looking at the new system. This editorial has three purposes. The first one, is my reminder to everybody out there who’s thinking about reinventing some kind of wheel: don’t. And I mean: don’t. Consider how much each constraint will cost you in terms of time, and then decide if it was worth it. The second purpose, is to announce that our web site has indeed changed; we have taken the opportunity to improve the web site’s layout and features and we’ll make more improvements over time. Hopefully, you won’t find the transition as painful as we did. Lastly, I would like to thank the Drupal community. They have created a terrific content management system, and they deserve a medal for their hard work. Thank you Drupal!
Biography Tony Mobily (/user/2" title="View user profile.): Tony is the founder and the Editor In Chief of Free Software Magazine
Copyright information Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. Source URL: http://www.freesoftwaremagazine.com/articles/editorial_11
Reinventing the wheel
3
Issue 11
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
4
Interview with Simon Peter, creator of klik Klik is a fantastic system which allows users to install an application without worrying about dependencies and without being root. I was lucky enough to talk to its author. By Tony Mobily It's the year 2006, and installing applications in GNU/Linux can still be a nightmare (especially if they are not available in your distribution's repository). Simon Peter is the developer of klik, a piece of software that tries to resolve this problem. Simon kindly accepted to answer a few questions for FSM. TM: Hello Simon! Please tell our readers about yourself... Since this is a computer magazine, I should probably start with my computing history: I used one of the first Macs when they came out, later built my own PC at the expense of having to use Windows, switched to Linux in 2002. I’m 27 years old, native to Germany, and I studied Economics and Business Administration in Germany and the US.
Simon Peter TM: Can you briefly explain what klik is? It’s probably the easiest way to download and run software on your PC. TM: When did you start working on klik? What inspired you? I had the idea in April 2003 when I was thinking of ways to use additional software that didn’t come with the Knoppix Live CD. Back then, I had no idea of how it could be accomplished. In January 2004, klik came into existence, and since then it has been growing into what it is today, thanks to the feedback and help of many users. Today, there is a community of contributors and supporters on the #klik channel on irc.freenode.net, and together we help to drive klik forward. The ease of the first Mac inspired me: On the Mac in 1986, you could simply copy an application file to your hard disk and it would run. If you wanted it no more, you could simply move the application icon to the trash. In contrast, Linux 2003 required you to become root, type in cryptic commands, and understand what “broken packages” meant. And you never knew what went on “behind the scenes”: what files were installed all over the place on the system. I just wanted to have the same simplicity on Linux that the original Mac had. Plus, I wanted to store my applications wherever I had some space left—be it on a CD-ROM, a DVD, or a USB stick. Linux couldn’t do that: it required me to install everything to /usr. I felt like the machine was in command of me, not the other way around (as it should be). I felt it was time for a radically different approach: One file per application.
Interview with Simon Peter, creator of klik
5
Issue 11 TM: Software installation in Linux is renowned for being susceptible to the “dependency hell” problem. In your documentation, you write: “No dependencies besides base system. No other dependencies are necessary besides what comes already with the base system (distribution).”. However... sometimes, what “comes already with the base system” depends on what the user installed in the first place. I might not have libjpeg in my system, and klik application might need it. What happens in that case? Is there an automatic way of dealing with this sort of problem? Klik assumes that a certain set of libraries is part of your base system. Those are the libraries that are required by many applications and thus come with every major desktop distribution (e.g., libstdc++5, QT, KDE/GNOME, etc.). More “exotic” libraries that cannot be expected to be part of a user’s base system are downloaded by klik as part of the respective application. TM: Do applications tend to use more RAM when they run, as they are bundled with all the dependencies? No, they don’t, since klik uses shared libraries like any Linux distribution. It simply downloads the required libraries along with the applications, so that they are available in case they are not already part of the base system. By the way, applications aren’t bundled with all dependencies, but only with those that cannot be expected to be part of the base system. Is this a waste of hard disk space? No, since klik applications are stored in compressed form, they often use even less space than traditionally installed applications. Really, most users don’t care about dependencies as long as their software works. My favorite story is about the 71 year-old grandmother who uses klik (http://dot.kde.org/1126867980/1126871329/)... TM: How is the base system made aware of the fact that a klik application is installed? One of the design principles of klik is that applications you download shouldn’t change the base system. Hence, klik doesn’t register file types, or change anything else on your system. This means that you need to open documents from within the respective application, or drag them onto the application’s icon. (This is a feature, not a bug—klik is designed not to ever “mess” with your system, regardless of how many applications you try out.) TM: You say you see this as a “feature”. However, I believe people will always want to be able to double-click on a document, for example, and start OpenOffice automatically (even though OpenOffice is installed as a klik application). I guess this is up to the distributions (in particular, Nautilus and Konqueror should be able to do that). Do you see this as an important point? Do you know if GNOME and KDE already allow for this, or if they will? You can set up GNOME/KDE to associate files with klik applications, just like with any other application. But that’s not the point: you then lose the ability to move your applications, e.g. onto a CD-ROM. Plus, if you have multiple versions of an application or multiple applications that work with a certain type of file, it would probably get more confusing rather than doing any good. Personally, I always open files with the open dialog of the respective application. If you don’t like that, you can drag documents to the respective application’s icon. Or, if you really want, you can set up a file association yourself. Klik is intentionally designed in a way that doesn’t “register” applications with the base system. Only in this way, can you try out software and be assured that it doesn’t change your base system. I really dislike systems that “register” everything, because this tends to mess with your system, especially if you frequently try out lots of new software. If each application is contained in a mountable image, how do maintainers set what icons are associated with that application? This is neither necessary nor possible. (In the near future, KDE and Gnome will be able to display the icon that is contained inside the compressed image, just like they can display a thumbnail of a JPG file.) TM: So, in other words, the CMG file will contain an image in a pre-determined spot, and Konqueror (KDE) and Nautilus (GNOME) will be able to extract it?
without worrying 6 about dependencies and withoutbeing root. I was lucky enough to talk to its author.
Issue 11 Yes. But “display”, not “extract”. The image will be displayed from its location within the .cmg file. (This way, the one app = one file approach still holds.) TM: Every time I run an application, the system will mount the associated file system in /tmp/app. Does this mean that I will have ten mounted file systems if I run 10 applications? Could this cause problems if an application crashes (and the file system stays mounted!)? How does klik deal with these sort of issues? Currently, klik mounts the compressed images in /tmp/app. As soon as the respective application closes (or crashes), klik unmounts the image. (So far the theory. In practice, when an application stays in an infinite loop, klik can’t unmount the image—then you have to kill the application manually. But this is true in any case.) TM: In order for klik to work, you add seven entries in /etc/fstab. Each running application will “use” one entry. Does this mean that you can run seven applications at the most?
Correct. By default, the kernel is configured in a way that allows only for eight loop-mounts (klik leaves one as reserve). But this number can be easily increased using a kernel option. You’ll find the details in the klik wiki (http://klik.atekon.de/wiki/index.php/Troubleshooting#When_I_try_to_run_more_than_7_klik_apps.2C_I_get_mountin TM: Is there an alternative to adding entries to /mnt/fstab, or an alternative to mounting altogether? Yes, it’s called userland-mounting (FUSE), and will be used in future distributions that support klik, such as the next release of Kanotix. This will remove the need for fstab entries altogether. TM: How does klik deal with upgrading? Klik has no automatic mechanism for upgrading. When you feel that you’d like a newer version of an application, you just klik it again. (You can keep both the old and the new version at the same time—which makes klik pretty unique!) TM: So, you type klik://xvier, you end up downloading the program Commute. This seems to confuse some people. What happens internally when you type klik://xvier? And... why is it a host name cannot be specified in such a URL? Does this mean that everything that comes from klik:// will come from klik’s repository? How does that work if a program is available for several distributions? To browse all existing applications, please go to our home page (http://klik.atekon.de/)—there you will find a large “warehouse” with thousands of applications, most of them with descriptions, user comments, and even screenshots. klik:// URLs contain no host name. This is an important security feature because it prevents klik from downloading software from random places. Klik only downloads so-called “recipes” from the klik server. Recipes tell the klik client what software to download (and from where), and how to re-package it as a .cmg file. Most of the time, one recipe fits all supported distributions (so no need for different packages for different distributions). TM: Companies wanting to distribute proprietary software have had a problem with Linux, because there hasn’t been an easy and universal way of distributing an application. They could choose between tar.gz, tar.gz containing proprietary installers, RPM (for several distributions), debian packages... But now, they can just give away a .cmg file that will “just work”. Is this correct? Do you think companies will start doing that soon? (I am thinking for example of interactive CDROMs, CD dictionaries, etc.). The easiest thing for software publishers to do is put up either a .deb, .rpm, or .tgz package. Klik maintainers can then write a klik recipe (basically just entering the download URL and some easy instructions). This is the way in which klik://skype, klik://realplayer10, and klik://opera work. Note that the software is still downloaded from the original vendor’s web site, klik does not need to store or host a .cmg file since it is created by the klik client on-the-fly.
Klik is a fantastic system which allows users to install anapplication without worrying about 7depende
Issue 11 TM: So... you don’t think vendors would benefit by distributing CMG files rather than the “usual” ones? Yes, sure. But instead of pushing vendors to learn and adopt the .cmg format themselves, they can just continue to to what they do already, and klik does the rest—I’m not sure that we’d have Skype klik-able today if we needed active vendor involvement for it. TM: What about vendors who give away interactive CDs and would like to have them available for Windows, OS X and Linux for example? Wouldn’t a .cmg file be the solution? (Besides, there could be no recipe for an application that is distributed in CD format!) Sure, that could be interesting. (The .cmg format isn’t finalized yet though, and is still subject to change.) TM: I see klik as a major revolution for GNU/Linux. With klik, everything is changed: people can now install whatever they like with no effort and without root access, AND companies can distribute proprietary software that works on multiple distributions with little to no effort. The response you are having seems to confirm my feeling: you did indeed start a revolution. Well... how does that feel? Sounds like a plan! ;-)
Notes and resources [1] klik’s home page (http://klik.atekon.de/)
Biography Tony Mobily (/user/2" title="View user profile.): Tony is the founder and the Editor In Chief of Free Software Magazine
Copyright information Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. Source URL: http://www.freesoftwaremagazine.com/articles/simon_peter_interview
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
without worrying 8 about dependencies and withoutbeing root. I was lucky enough to talk to its author.
Getting started with Knoppix Linux Knoppix—the live CD that does it all By Robin Monks Getting started with Knoppix Linux doesn’t have to be costly. Chances are you already have everything you need. The requirements are simple. Any computer newer than 5 years old with a working bootable CD or DVD drive should be able to run Knoppix. Many consider Knoppix to be the most popular live CD. Knoppix has at least one of everything, configures automatically, and is a great way to get your feet wet in Linux. What makes Knoppix so good for trying out Linux is that it’s all contained on a single disk, called a “live CD”. Nothing needs to be installed to your PC. Just place it into your CD drive and reboot, the entire OS then boots and runs entirely from the CD. Knoppix also includes at least one of every kind of software, which makes it great for seeing the whole spectrum of free software Linux software available. What makes Knoppix so good for trying out Linux is that it’s all contained on a single disk, called a “live CD” The only major live CD drawback is that since it is run entirely from the CD, and all possible configurations are supported by the kernel, load times are drastically longer than for programs loaded from a hard disk. Keep this in mind when using Knoppix and remember that any Linux distribution will be faster on a hard drive.
Getting your Live CD The most common way to get a live CD is to download an .iso (a standard format CD image file) and burn it to a blank CD-R. It’s advisable to have access to a high speed internet connection to download Knoppix, as the .iso files are just under 700MB. You can also buy these live Linux CDs cheaply from such places as CheapBytes (http://www.cheapbytes.com/) and BudgetLinuxCDs (http://www.budgetlinuxcds.com/). First, you’ll need to download Knoppix. CD or DVD edition is fine (I’ll deal with the CD edition, so I won't discuss the extra programs that are on the DVD edition). Head over to knoppix.org (http://knoppix.org) and pick up the latest edition. Once you have the .iso you can use most any CD burning application to burn it (check your application’s help) no matter what operating system you use. If your CD Burner didn’t have burning software included (some inexpensive and second hand ones don’t), you can use CDBurnerXP Pro (http://www.cdburnerxp.se/) (note that although it is freeware, it does not fall under this magazine’s definition of “free software”) or, if you are using Linux already, the free software cdrecord or K3B (http://k3b.org).
Booting up Knoppix Now that you have Knoppix downloaded and burned on your CD, it’s time to boot. Insert your freshly minted CD into your CD drive, restart, and cross your fingers. Most new BIOSs will automatically detect and boot from the CD, but if you have an older BIOS (or an incorrectly configured one) you might not be able to boot. If the CD fails to boot, check your BIOS configuration (normally this requires pressing delete or a function key while booting) to ensure that the boot order is something like Floppy-CD-HD and try again. If the CD still fails to boot, get the Smart Boot Manager floppy (http://btmgr.sourceforge.net/about.html) and try booting from that. Once Knoppix starts booting it will detect your hardware and load all the kernel modules it needs to use for the hardware it found. Because it has to do this each run, and can’t save any settings, it will take a few minutes to finish. After booting, you should be greeted with a Knoppix customized KDE desktop. Now on to the fun stuff...
Getting started with Knoppix Linux
9
Issue 11
The Knoppix desktop
Meet your desktop One of the primary parts of your Linux computer, like most systems, is the desktop. Linux is unique in that there are many desktop environments to choose from, including KDE(K Desktop Environment) and Gnome. Knoppix uses KDE (http://kde.org), hence the K in the name. You can also get Gnoppix, which uses, you guessed it, Gnome. One of the primary parts of your Linux computer, like most systems, is the desktop The Desktop is your GUI “portal” to what you can do with Linux. It may extend beyond the edges of the screen if the desktop size requested is larger than your hardware supports. When the Desktop is larger than the screen, moving your mouse pointer to an edge of the screen will scroll the Desktop to expose any portion of it hidden in that direction, hiding the opposite portion. KDE’s “taskbar”, called the panel, resides at the bottom of the Desktop. The panel includes shortcuts to most used applications, a clock, shortcuts to various applets, plus shortcuts to each of a configurable number of additional desktops. The leftmost button on the panel, with the K symbol, is the application menu, which lists all the programs available while running KDE. Knoppix offers immense choice, so these menus are bulging, from games to development environments to office software and much, much more! Once KDE has started you’ll be greeted with an introduction to Knoppix displayed in Konqueror (http://www.konqueror.org/), the default KDE web browser. Glance over this, and then close or minimize the window. You’ll now be presented with various desktop icons, which are access shortcuts to available disk drives, memory sticks, CD/DVD drives, etc. Since the system is booted from a CD/DVD, that drive becomes the primary filesystem, also referred to as "/", called “root”. Folders open in Konqueror and can be navigated in a manner similar to Windows Explorer. Knoppix also has various desktop environments other than KDE on the CD, such as Fluxbox and Windowmaker (look under the “Knoppix Cheatcodes” section in the documentation on the CD).
10
Knoppix—the live CD that does it all
Issue 11
The (bulging) Knoppix application menu
Choices, choices, choices and more choices Knoppix, like Linux, offers immense choice As I said above, Knoppix, like Linux, offers immense choice. Nowhere is this more evident than in the bulging application menu. Packed with most common Linux programs, it can give a great feel for the selection and quality of programs available with Linux.
Frozen Bubble Feeling overwhelmed? A few good places to start with include Frozen Bubble (http://glenn.sanson.free.fr/fb/play.html), under games. It’s been an instant free software classic and should quickly relieve any apprehension you might have about using Linux on your Desktop. Next stop, OpenOffice (http://openoffice.org). It can open most proprietary file formats, including MS Office’s DOC and PPT extensions, and has a lot of power to handle your office needs. I wrote most of this article in it! For the graphics folks, look toward GIMP (http://gimp.org/), and for desktop publishing, Scribus (http://www.scribus.org.uk/). Also take a look in the internet menu at Firefox (http://getfirefox.com) and Thunderbird (http://getthunderbird.com), just like you remember them. Also, if you choose to keep a home portion on a USB key or other removable media, you can install themes and extensions, and have Thunderbird read your email from a POP server (just make sure to check the option to leave the mail on the server when you setup your mail account if you want to read your email on another system as well).
Knoppix—the live CD that does it all
11
Issue 11
Scribus Knoppix also includes many powerful Linux/KDE tools and utilities, and has a fully functioning shell for the really techy folks. Knoppix also has a wide range of development tools, including compilers.
Make the switch How can you make it your main OS you ask? Thankfully, it’s easy! Just click on the shell in the panel to open the KDE shell and type sudo knoppix-installer. The step by step wizard will then guide you through the rest of the process. But please note this will erase all data currently on the hard drive, including your old OS so only do this when you are very sure you want to make Linux your main desktop. There are less documented ways to dual boot Knoppix with another OS available at Knoppix.net (http://www.knoppix.net/wiki/Hard_Drive_Install_FAQ). Once you install Knoppix it acts just like a normal Debian system. Because of the relatively small download size and the wide range of available software, Knoppix is usually the easiest way to get a Debian system. Knoppix is usually the easiest way to get a Debian system It is also possible to create a permanent home folder on a hard drive partition or USB drive. Although you won’t see the dramatic speed improvement of a hard drive install, it will let you keep the data you create between sessions.
Going further Knoppix is probably the quickest and easiest way to try out Linux, and I hope you will. Linux is a vast world of almost infinite possibilities that Knoppix makes easy to explore. For more experienced Linux users, Knoppix makes a great way to try out different configurations. If something goes wrong, a simple reboot will bring it all back to normal. From a simple system on-the-go, to a full-fledged OS, to a recovery system, to a quick test drive, it’s all only a boot away with Knoppix.
Thanks The author would like to thank Felix Miata for his kind assistance and suggestions
Biography Robin Monks (/user/35" title="View user profile.): Robin Monks is a volunteer contributor to Mozilla (http://mozilla.org), Drupal (http://drupal.org), GMKing (http://gmking.org) and Free Software Magazine and has been helping free software development for over three years. He currently works as an independent contractor for CivicSpace LLC (http://civicspacelabs.org)
12
Knoppix—the live CD that does it all
Issue 11
Copyright information Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html. Source URL: http://www.freesoftwaremagazine.com/articles/knoppix_intro
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
Knoppix—the live CD that does it all
13
Issue 11
14
Knoppix—the live CD that does it all
ODF in action Using OpenDocument format text in OpenOffice, KOffice and AbiWord By Tom Kuipers, Alan Berg Numerous office suites and word processors support the OpenDocument format (ODF). ODF is an open standard for saving and exchanging office documents. The standard has been developed to provide an open alternative to proprietary, for example Microsoft Office, document formats. In this article we will take a visual tour through different free software editors and examine their core abilities in creating, editing and saving an ODF document. The exercise may on the surface seem trivial, but in reality it has important implications. We demonstrate on a small scale that which may happen in real world situations when a document is shared by different users in multiple environments: home, work, on the road. Note: If you have a reasonable internet connection then the authors recommend downloading the live CD’s mentioned in the resource section. This will allow you to preview all the software mentioned and experiment with the Gnome and KDE desktop environments.
The Ubuntu live OpenOffice combination To start the tour let us focus on OpenOffice, a well respected professional office suite. Along with text documents the application also has the ability to save spreadsheets, charts and presentations in ODF. In this article, for the sake of simplicity, we will concentrate on manipulating text documents. Please note, all documents mentioned within this article are contained in a tar file referenced in the resources section. The recipe: After booting from the Ubuntu live CD (version 5.10), we started up OpenOffice Writer from within the Gnome desktop environment and created a new word processor document. The document contained multiple paragraphs, different headings, various fonts, a table and a picture. We considered the document stereotypical of its type. After finishing writing the document, we saved via selecting Save from the File menu. By default OpenOffice.org loads and saves files in the OpenDocument file format. Notice that the file type has been set to OpenDocument Text (.odt) (shown in figure 1). Further, please note that OpenDocument Spreadsheets are saved with extension .ods, and OpenDocument Presentations as .odp files. We saved the edited document as demo.odt. We plan later to modify the document from within other applications. Due to the fact that we are running from a Live CD we cannot guarantee write access to the hard drive. Therefore we recommend storing file on a USB pen drive. However, on a positive note, the Knoppix live CD (version 4.02) had no troubles guessing type and mounting the windows partitions on my home computer.
Figure 1: Saving a document in OpenDocument Text format with OpenOffice
ODF in action
15
Issue 11
Slax 5.0.6 with KOffice Slax, another excellent live CD distribution, is derived from Slackware. We deployed the Standard Edition which employs KDE 3.4 (the K Desktop Environment). The word processor we had available and tested was KWord version 1.4 part of the well regarded KOffice suite. The recipe: Let us first test if we can now open the previously created document demo.odt in this new environment. Go to the File menu and select Open. The dialog window displays a list of supported filters (file types), but does not display the file type extensions. To open our demo.odt file we point the operating system to the USB stick. First, double click on the System desktop icon, then go to Storage Media. The USB stick gets mounted when you click on the Removable Device icon.
Mounting a USB stick In KWord .odt files are referred to as OASIS OpenDocument Text. An aside: OASIS is the originating standards body. OASIS is a not-for-profit, global consortium that drives the development, convergence and adoption of e-business standards. OASIS has developed many interesting standards spread across a wide spectrum of problem domains. At the University of Amsterdam we provision our premier E-learning environment via XML based communications adhering to OASIS enterprise standards. This group really understands how to write high quality standards for mission critical systems. When you open the document you will notice that the document looks different from how it was saved in OpenOffice. The picture which was centered is now aligned to the left. Additionally there is extra white space below the image. All these minor changes accumulate into generating a two page document instead of the original single page. Although the document can be read without problems and all content is available, this is not what you would expect from an open standard for exchanging office files. However, that said, in the short term the software market is rapidly evolving. It would not surprise the authors if the compatibility issue is vastly improved or removed within months. To continue the roundtrip it is now necessary that we make changes to the demo document. We are now highly motivated to see how other popular word processors handle the document. We now insert an extra paragraph above the picture and centre the picture. The modified document is then saved, by clicking Save from the File menu or pressing Ctrl+S. Now we do not have to specify the file format, because the word processor automatically saves the file to .odt format.
Windows XP with Abiword An important benefit of standards is the enabling of easy and transparent exchange of data. You are not tied to a specific application or vendor. This interoperability does not just exist on the application level but also on platform level as well. To demonstrate this we open the document created and edited in the previous steps, but now on a Windows platform. For this purpose we use the standalone word processor AbiWord running under
16
Using OpenDocument format text in OpenOffice, KOffice andAbiWord
Issue 11 Windows XP. An important benefit of standards is the enabling of easy and transparent exchange of data AbiWord has ambitions to become a fully cross-platform word processor. Currently AbiWord runs on most UNIX systems, Windows 95 and later, and MacOS X. Recently (January 2006) the released version 2.4.2 has native support for opening OpenDocument (.odt) files. However, earlier versions had read support enabled by installing a specific OpenDocument import plugin. When we visit the Open item within the File menu a dialog window appears. The dialog shows a list of file types containing the option OpenDocument (.odt). Without problems we can point to the USB stick and open demo.odt.
Opening an OpenDocument Text with AbiWord on Windows XP Remarkably, the document doesn’t look the same as it did when it was last saved with KWord (KOffice). So, just like when we moved from OpenOffice to KWord, our sample document suffers from non-trivial layout differences. Again, while we haven’t lost content, parts of the formatting details have been lost. While the image is still centered as it should be, the paragraph wraps around the image. If rendered consistently, then the paragraph should begin underneath the picture. When exchanging documents, data loss is obviously not acceptable. We consider losing the layout as a form of data loss as well, and therefore the loss of layout is a serious matter When exchanging documents, data loss is obviously not acceptable. We consider losing the layout as a form of data loss as well, and therefore the loss of layout is a serious matter. Some may say that included images are not that important as long as they are shown. They may argue that the primary focus of a word processor is the processing of text and that dealing with pictures is of secondary concern. But we think format is an integral part of office documents that combine text, graphics, charts etc. The formatting is the key attribute of a word processor over a text editor. Within AbiWord it is not possible to save a document in ODF. There is no plugin available that offers this functionality. The developers prefer to use the RTF (Rich Text Format) document file format as the best method to share documents with other word processing software. As becomes clear from a mailing list discussion (http://www.abisource.com/mailinglists/abiword-dev/2003/Apr/0167.html), the reason for this lies in technical issues in the underlying data structure. The internal data representation of a document in AbiWord matches RTF more closely. It is the author’s personal views that market momentum for ODF will speak out and motivate developers into complying with a standard way of doing business. Documenting an OpenDocument document OpenDocument files are stored in JAR (Java Archive) format. JAR files which are really just compressed ZIP files. An ODF document is actually a collection of XML files and other data files such as images. To show the
Using OpenDocument format text in OpenOffice, KOffice andAbiWord
17
Issue 11 contents of our sample demo.odt file using a terminal, type unzip -v demo.odt and view the expanded content.
Market survey Standards are only truly useful once applied in a wide context. This means there is a need for applications that fully adopt the ODF. On a positive note, current support is not only limited to well known word processors. Numerous vendors offer standards based compatibility, including large companies such as IBM and its Workspace Collaboration Services and the commercial office suite StarOffice from Sun. Corel’s WordPerfect lacks support at the present time but is expected to adopt ODF in the near future. Note: Corel was among the original members of the OASIS committee that developed the specification. Despite all of this we are not there yet. As we have seen from the experiments, consistent rendering of detailed formatting between word processors is a significant issue. This one issue will act as a drag on market penetration unless vigorously dealt with. Currently, most of the standalone word processors only offer the ability to import .odt formatted documents. Momentum is building based on user demand. So, you’d expect that when this official standard gains in popularity, software manufacturers will try harder to create consistent exporting features. This will in turn boost the use of open standards file formats. Adoption not only depends on support from word processors, but also from a range of other applications. For instance the fact that the Google Desktop search application understands ODF is promising. The market is converging.
Conclusion The importance of the OpenDocument Text format is best reflected in the differences between open and proprietary formats. Take for example the Microsoft .doc format. The proprietary format is not fully documented and other vendors are hindered in this subtle way from implementing the .doc format functionality in their products. This implies that users risk “vendor lock in”. In this situation, customers become completely dependent upon a single software vendor. And worse still, they are dependent on that vendor for future support of the numerous versions of the format. In the proprietary world you are almost forced to upgrade every so often to newer versions. Users that store their data in an open format avoid this situation leaving them free to switch to other software while still being able to access their original data. Organizations and individuals are recognising that office documents should be accessible now and in the future. This can only be realistically accomplished by storing data in a vendor-neutral, open standard format. In the middle term, the real investment is not in the software to create and use office documents, but is the content of documents that are created. As an open standard, ODF has the advantages of: freedom of choice between software vendors, durability, and exchangeability As an open standard, ODF has the advantages of: freedom of choice between software vendors, durability, and exchangeability. The disadvantage in the short term is consistent rendering and initial issues in newly written software. However, ensuring middle term success will require sustained momentum in the market place and this in turn demands compatibility. We believe this is now happening and, thankfully, very rapidly.
Resources • Ubuntu Linux (http://www.ubuntulinux.org) • OpenOffice (http://www.openoffice.org) • Slax (http://slax.linux-live.org) • KOffice (http://www.koffice.org) • AbiWord (http://www.abisource.com)
Biography Tom Kuipers (/user/71" title="View user profile.): Tom Kuipers, MA., is a developer at the University of Amsterdam. His fields of expertise include ColdFusion, Java, JSF, XML, XSLT, CMS, streaming media and electronic learning environments. He likes to play with his casemodded Linux box.
18
Using OpenDocument format text in OpenOffice, KOffice andAbiWord
Issue 11 Alan Berg (/user/8" title="View user profile.): Alan Berg Bsc. MSc. PGCE, has been a lead developer at the Central Computer Services at the University of Amsterdam for the last seven years. In his spare time, he writes computer articles. He has a degree, two masters and a teaching qualification. In previous incarnations, he was a technical writer, an Internet/Linux course writer, and a science teacher. He likes to get his hands dirty with the building and gluing of systems. He remains agile by playing computer games with his kids who (sadly) consistently beat him. You may contact him at reply.to.berg At chello.nl
Copyright information This article is made available under the "Attribution-NonCommercial-NoDerivs" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-nc-nd/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/odf_programs
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
Using OpenDocument format text in OpenOffice, KOffice andAbiWord
19
Issue 11
20
Using OpenDocument format text in OpenOffice, KOffice andAbiWord
Simple package management with Synaptic A package management GUI for Debian-based distributions By Marco Marongiu If you don’t like using the command line, and you want to manage your program installations without typing a command, then read on: this article is for you!
Ladies and Gentlemen: Synaptic! Synaptic is a graphical user interface (GUI) for managing software packages on Debian-based distributions. If you are using Debian or Ubuntu you will easily find Synaptic in the System Tools menu or in the Administration menu. Synaptic uses the GTK graphic libraries (GNOME’s ones) . So, if you are using GNOME on your debian-based distro you will probably have Synaptic installed as well. Synaptic is a graphical user interface for managing software packages on Debian-based distributions
Figure 1: Depending on your GNOME version, you will find Synaptic in the Administration menu or in the System Tools menu To manage package installations you need administration privileges; so you need to either be root or to authenticate as such. Normally, you will see a window like the one in figure 2 where you can type in the root’s password.
Figure 2: You need adiministration privileges to run Synaptic
Simple package management with Synaptic
21
Issue 11
Exploring Synaptic Once Synaptic has started, you will see an interface like the one shown in figure 3.
Figure 3: Once Synaptic starts, this is what you’ll see You have a menu on top, then a panel with a few buttons, whose functionality will become clear as you read further into the article. On the left, there are four buttons at the bottom that will determine what is shown in the menu above them. In figure 3, the “Status” button is pressed; so, you can select the packages you see in the list by status. If you select “All” (like in the figure) you’ll have a complete list of available and installed packages. “Installed” shows just the installed ones and so on. The right side of the window is divided into an upper and a lower portion; there is a packages list in the upper part and when you select a package in the list, you get a description of it in the lower part. Packages can also be grouped by functionality (e.g. text editors, documentation, tools for managing images, etc.). Just press the “sections” button and you can select the packages you like among a number of different sections.
Figure 4: Packages can be selected by functionality using the “Sections” button
Let’s work! Now that you have a basic idea of the tool you have in your hands, it’s time to go deeper and see how to use it. The first thing you probably want to do is install something. However, it’s better to use a little patience and do first things first. As you may know, programs are made by human beings, and human beings aren’t perfect; therefore, a number of bugs are found every day in computer programs, and free software is no exception. The difference
22
A package management GUI for Debian-based distributions
Issue 11 with free software is that very often patches are out a few hours or days after a security problem is spotted, and you’d better apply them. Keeping the system safe So, the thing you should always do as soon as you launch Synaptic for the first time in a day is update the package information from your repositories and see if there are any packages that need a security upgrade. On the command line that would mean issuing a couple of commands; in Synaptic it’s just a matter of a few clicks. First, you have to click the “Reload” button, which updates the information of the available packages. Then, pressing “Mark All Upgrades” will automatically select all the packages that need an upgrade. Finally, press “Apply” and confirm you really want to upgrade the selected packages. After a while you’ll see all the security patches applied and you can safely do all other package management operations.
Figure 5: Downloading the upgrades Default upgrade or smart upgrade? Depending on what you are doing, when you ask for an upgrade you may be shown a window like the one in figure 6.
Figure 6: default upgrade or smart upgrade? If you are using a plain, vanilla distribution (you haven’t installed any packages that come from repositories other than those of your distribution) you shouldn’t need anything more than a default upgrade. You definitely need a smart upgrade when you are changing your distribution version (for example, if you’re upgrading from the old Debian “Woody” to the newer “Sarge” release). Otherwise, doing a default upgrade should always be enough.
A package management GUI for Debian-based distributions
23
Issue 11 Installing new software Now I’ll show you how you can install software with Synaptic through a practical example. Since I have an MP3-enabled car stereo, I rip my CDs so that I can listen to them while driving. That way, I have only a few disks to carry instead of having the car filled with them. In doing this, I became interested in MP3 streaming a-la-shoutcast. So I decided to install the Icecast (http://www.icecast.org/) software (a free software alternative to shoutcast) and test it. If you want to have more information about Icecast, you can look it up using the “Search” button; after you find it, you can select it and press the “Properties” button to examine it in depth.
Figure 7: Selecting Icecast for installation Installing Icecast with Synaptic is simple: just look it up in the packages list (by hand or using the “Search” functionality; right-click on it and then select the “Mark for installation” menu item (see figure 7).
Figure 8: Installing Icecast in three steps You will be shown a list of packages, in case Icecast needs other packages that are not installed on the system yet; this situation is technically called a “dependency” (see the text box entitled “Dependencies and conflicts” for more information). You are asked to mark the other packages for installation as well, or to abort the installation (step 1 in figure 8). In my case, I just needed one more package: libcurl3-gnutls. I accepted it, applied the changes, and was asked to confirm again the list of packages to be installed (step 2). At this point you just have to look at the text window (step 3) to see what’s going on and close it when you are done! Dependencies and conflicts Some packages have dependencies. If you need to install one of these packages—for example, called package A—on your system, you are first required to have installed any other packages which package A depends upon. These other packages are referred to as “depenencies” of package A. For example, the package of word processor will need packages that contain fonts to work properly.
24
A package management GUI for Debian-based distributions
Issue 11 Conversely, if you have package A and dependency 1 installed already, and you want to remove dependency 1, what happens? Since package A needs dependency 1, chances are that package A will not even work any more. This situation is called a “broken dependency”, and synaptic helps you avoid such nasty situations by warning you of what you are doing and asking you to remove package A with dependency 1. In opposition to the concept of dependency you have the concept of “conflict”—a relationship which means one package requires other packages to not be installed in order to work properly. In other words, if package A will not work when package B is installed, package A and package B are said to be in “conflict”. For example, in my distribution the package gaim (an instant messenger software that supports AIM, ICQ, MSN and about half a dozen of other protocols) conflicts with two other packages (gaim-gnome and gaim-common). This means that if you try to install gaim and either of the two conflicting packages (gaim-gnome or gaim-common) are installed, Synaptic will ask you to remove them. Installing a software package with Synaptic is just a matter of a few mouse clicks Of course, you still don’t have your own home-made net radio, but that would definitely be the subject of another article. So, I’ll leave you alone with that (or you can try and install another package of your choice that is more useful to you). Removing installed software If you are a Linux novice, you probably want to experiment a lot with it. This often leads to installing tons and tons of different packages. You play with them and then forget all but a few of them. You have a big hard disk, so this may be not a problem at first. But, big doesn’t mean infinite, and the time will come when you have to remove something. Synaptic comes in handy here, too. And since it happens that I have to remove the Skype package from my distribution, I’ll show you how to use Synaptic to remove a package. In the beginning, I was happy that the Skype people offered a package repository for their software, so that I could keep it up to date. The deb package for Skype is expressly made for the Debian “Sarge” distribution, and in the beginning it installed okay on the testing distro too. Unfortunately, that came to an end and some conflicts eventually arose. I then had to remove the Skype package and install it using other means. As with before, look up Skype in the package list; then, right-click on it and select “Mark for Removal” if you just want to remove the software, or “Mark for Complete Removal” if you want to remove both the software and all configuration files (see the textbox for details about configuration files). Configuration files Programs can behave differently depending on certain variables; for example, when your graphical session starts it needs to know certain things, e.g.: • screen resolution • background image • whether or not to allow the administrator to log in This information is stored in and taken from “configuration files” (files that are read by programs upon startup and that tell them how to do certain things). System-wide configuration files are almost always in the /etc directory or in a subdirectory of /etc. If you need an example, and you have a configured network card in your PC, have a look at the file /etc/network/interfaces.
A package management GUI for Debian-based distributions
25
Issue 11
Figure 9: Selecting Skype for removal Then, as before, click “Apply” and confirm that you really want to modify the system the way you asked, and again watch the text window to see your installation of Skype go away. That’s all you need to do! Wrecking the system (ack! NO!) In this particular case I was lucky and removing Skype was all that was needed. But, what if you are removing a package that is needed by other packages? Suppose that you’ve decided to clean up your system and remove a ton of packages that you installed a long time ago and don’t need anymore. Unfortunately, you don’t remember exactly what you did install when you experimented, and you resolve to review all of the installed packages with Synaptic. You read the description of each package, one by one, and you hit a package named “mypackage” whose description is quite obscure to you: you decide to wipe it out, and mark it for removal.
Figure 10: Are you sure you want to remove that package, and all packages that depend on it? Synaptic stands for a while, consuming a lot of CPU, and then it displays a window like the one in the figure 10. So what’s going on? Since removing “mypackage” would break any packages that are dependent on it, Synaptic is asking you for confirmation to remove those packages as well. Don’t panic! Nothing has happened yet. You just have to review the list of packages to be removed and decide if you want to proceed or not. In case you accidentally hit “Mark”, don’t worry: nothing will happen until you also hit the “Apply” button. So, even if you went wrong the first time, you still have a chance to undo the unwanted changes. If in doubt, just close the program abandoning all changes and start all over again. Figure 10 was obtained pretending I was removing the libc6 package, which is fundamental to the system. Synaptic stood about one minute eating CPU cycles before providing me with the list of packages to remove (nearly the entire system!). If you want to experiment you can do the same thing, possibly with other packages
26
A package management GUI for Debian-based distributions
Issue 11 and without removing anything, just to be safe. Nothing will happen until you hit the “Apply” button
What are packages, anyway? I’ve shown you nearly everything you need to know about Synaptic, but this article won’t be complete without a quick peep behind the scenes. If you want to get the most from Linux you should get to know more about what goes on under the hood of your graphical interface. In this case, that means having at least a basic idea of what a packages really is. In modern Linux distributions, bundled software is organised in packages. You can think of a package as an archive file composed of: • a name for the package • a number of files that are part of a piece of software • a number of scripts that help the system manage installation, configuration and removal of the software • information about the dependencies of the package (e.g. dependency information in the xchat-common package states that, if you install it, you will be asked to install xchat as well, otherwise the files in xchat-common would be pretty useless...) Two formats are quite popular at the moment: the RPM and the DEB. RPM stands for Redhat Package Manager, and was created by the people at Red Hat. DEB was created by the people of the Debian Project. I am not going to delve into the details of the package format or start a religious war about which format is better than the other. Suffice it to say that, together with the attention to detail of the Debian people, the DEB format is at the foundation of the robustness of the Debian distribution and is a solid base for all Debian-based distributions, like Ubuntu. The DEB format is at the foundation of the robustness of the Debian distribution and is a solid base for all Debian-based distributions, like Ubuntu Package management in the old days In the early days, package management in the Debian distribution was the business for two tools: dpkg (low-level, command line interface) and dselect (console-based interface). While I use dpkg from time to time, I never loved dselect. But I had nothing else... Then came APT (the Advanced Package Tool) and apt-get (a higher level command line utility). While I had to be careful about package dependencies when using dpkg, apt-get did all the dirty work automatically. In other words, if you’re installing a package, it will ask you to install the dependencies as well; if you remove something, it will warn you that you are going to make other packages unusable and proposes to remove them as well. Applying the latest security patches is just a matter of issuing a couple of commands; and the same holds for upgrading the whole distribution to a new release So, the bad times were over: I could finally give up dselect and rely on apt-get. But if you’re not a command-line junkie you will probably find this solution suboptimal as well. That’s why we have Synaptic!
Summing up Having read this article you should now know how to use Synaptic to look for packages and install or remove them. You’ve also had a quick peep behind the scenes so you should also have a basic understanding of what’s actually happening. Now it’s time for you to experiment. Have fun and enjoy Synaptic!
Biography Marco Marongiu (/user/26" title="View user profile.): Born in 1971, Marongiu graduated in applied mathematics in 1997; he's now a full-time system administrator for a European ISP. He's also a Perl programmer and technical writer and lecturer by passion, and is interested in web and XML related
A package management GUI for Debian-based distributions
27
Issue 11 technologies. Marongiu has been a Debian User since version 1.1.10 and he helped found the GULCh Linux Users Group (Gruppo Utenti Linux Cagliari), the first one in Sardinia. He recently became a father to his first son Andrea, and he's been trying to reorganise his life since, so that he can start writing technical articles again and holding seminars.
Copyright information This article is made available under the "Attribution-NonCommercial" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-nc/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/synaptic_intro
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
28
A package management GUI for Debian-based distributions
Battle for Wesnoth The Battle for Wesnoth is on in the days that never were By Alan Berg, Nelson Berg Free software games have long ago evolved from the command line. In this article I’ll describe one thoroughly addictive, turn based, graphical online game named “The Battle for Wesnoth� (http://www.wesnoth.org/). To be honest, though, I am limited by my middle aged perspective and lack of knowledge of what is in the frame. So, I have asked my ten-year-old son to dive into the depths of gamesmanship and help his poor old father in his senile dotage. I will be doing the writing but Nelson will do the playing. His fingers are faster and his aim is crueller. I will observe, explain and ask from him his wisdom. Let us begin, unleash the dogs of war, warm up the pop corn. It is my turn. Nelson I will not be beaten. Free software games have long ago evolved from the command line
Starting point The Battle for Wesnoth is a free software online game that can be learnt efficiently offline. The game is graphical and role based. There are two versions (at the time of writing) that you may download. The first is stable, version 1.02 and the second is somewhat less stable, but has a few more features that are being put through a test phase. For practice the stable version is the best to start with. Depending on your operating system, there are different ways of installing the game. For Windows, download the installer and just run. In a few seconds everything is working. On starting Wesnoth you are given a number of options as shown in figure 1:
Figure 1: Screen grab of start options The tutorial, the top most button, is an excellent starting point. Once in the tutorial, you will find yourself guided through a basic scenario (as shown in figure 2), by the computer controlled character named Delfador. Delfador sets you a series of minor tasks that quickly build up the skills you need to flawlessly interact with the game arena. My son required no supervision to use the tutorial and, despite an inherent lack of patience common to his generation, he managed to master the basics of the game in less than ten minutes. Whenever he made a mistake that made a scenario impossible to fulfil he was sent back a couple of turns in the tutorial. This method proved to be a highly effective means of communicating tactics.
Battle for Wesnoth
29
Issue 11
Figure 2: Delfador the teacher speaks The game is role based and everyone has to take his, her or its turn. Figure 3 is a screen grab of the area of play as seen at the beginning of the beginner’s tutorial.
Figure 3: Part of the tutorial map The map is divided into a hexagonal grid (as shown in figure 3). The beautifully rendered graphics smooth out the appearance of the grid, but honestly the matrix does exist! Depending on how much money you have you may recruit from a range of fighting figures, each figure with its own specialisations, strengths and weaknesses. Some figures can move distances fast, others can heal or use brute force to bludgeon their way through a retreating army. Finding the right balance of recruits and using the right tactics to emphasise the core strengths of your army require practice and a sense of tactics. Thus, this is an easy game to learn, but note that you will never quite finish with the learning curve. Promising for the game, is the fact that the learning curve is a feature common to many famous cult games. At the beginning of the game you are given a pot of gold and the first few turns are all about moving your recruits into their right placements. You may order your recruits about by clicking on them. Special actions like chatting or labelling a piece of ground are achieved by right clicking. The interface is simple and quick to learn to use. During fighting, the figures gain experience and are slowly promoted—increasing level and skill factors, morphing their iconic representations during their evolution. After quickly learning the basics through the tutorial you are ready to make it out into the unprotected, unforgiving and violent world After quickly learning the basics through the tutorial you are ready to make it out into the unprotected, unforgiving and violent world that we all belong to. You have plenty of choices for confrontation divided into two categories; campaign and multiplayer. Multiplayer is the most fun, but building up experience is easier in the protective havens of the campaign option. Figure 4 is a screen grab of the campaign options. Basically a campaign is a set of scenarios based around a story. A scenario can be considered a goal that needs to be achieved—for example reaching a certain location or killing a certain figure. Once you have chosen the
30
The Battle for Wesnoth is on in the days that never were
Issue 11 campaign you wish, a story is presented in a combination of words and pictures. The story fills in the background details of the campaign and is intended to motivate you to fight to your last ounce of artificial blood against the evil that unfolds. A campaign is played against the computer. A feature of great worth is the ability to download campaigns via the “Get more campaigns option”. You may, with this feature, go online and choose updated or new stories. Downloading extends the value of Wesnoth and allows the online community to participate and personalise. I look forward to an online voting system, perhaps as part of the game. Voting would enhance the market place for new campaigns.
Figure 4: Select your campaign After playing a few campaigns and generally routing the enemy (yeah that’s what they all say!) I decided to face off against a few humans. Therefore with shaking hands and a nervous laugh I selected multiplayer, as shown in figure 5. The most applicable option for me was the joining of an official server. Once connected you may choose a game to play, observe or start a new game. Observing allows you to see the action without participating. You may chat as well, but you have no influence on the figures on the map. Hanging around the lounge, a meeting point for players, I noticed two generic user populations. The first group of players had agreed elsewhere to play with their associates and known competitors. Group two players choose a random game and interacted with other strangers. Therefore, Wesnoth is not just a game, but also an excuse to make social contact with like minded battlers. The chatting feature adds an extra level. In the heat of battle, you can choose to chat with your allies or taunt your enemies. My son particularly liked the label feature where you can place text against locations on the map. He spent twenty minutes in one game writing the word “mine” over objects only to have the label deleted by others. A waste of time you may think or pure psychological warfare, only the winner will know. AI v Human is a good start point for practice. But don’t expect too much intelligence from the computer. You may even host your own game, fun for a cultural version of a LAN party. Yes, force your friends to play in costumes with pointy hats!
Figure 5: Choosing an option in multiplayer mode
The Battle for Wesnoth is on in the days that never were
31
Issue 11
Observing from a distance Okay, I admit it on my home network my son beat me. I’m still more intelligent than he is. Only he didn’t realise that, and the game was on his side, and anyway who cares. At first Nelson played the game because of the promise of a little extra pocket money. But as soon as he had got the hang of things he went online. As I write he is sitting next to me with my laptop fighting, labelling and chatting. Dynamic and active and learning some basic English words on the way. Okay so the words include kill, retreat, and run. But the chatting in general is clean and all the interacting partners are honestly doing their best to capture the spirit of the occasion. The multiplayer feature adds great value to the game and he continuously switches the chat option “Send to allies” thus fostering a real feeling of competition through medieval insults and modern day slang. To find out what he thought about the battle of Wesnoth I asked Nelson a number of pertinent questions: AB: What was your first impression of the game? NB: First, I thought it just was a game with just a few figures in it—rather limited. But later, I saw the figures rise to another level and I could then use much stronger attacks. I liked the feeling of progress a lot. AB: And the graphics? NB: A little on the old fashioned side. AB: Did you win? NB: Not yet. Apart from against you. AB: (Ahem)... okay, moving on... Do you have any ideas on how the game can be improved? NB: Adding shops for buying things that make you stronger, weapons, healing magic, daisy cutters. AB: Would you consider adding your own campaigns to the game if you could? NB: Yes. As long as it doesn’t take too much time to learn. AB: Is there anything else you would like to add? NB: No, I am busy playing. Go away! So as you can see from the conversation, Nelson likes playing the game, but does see some room for improvement with the graphics and feature enhancements. Myself, I think that the multiplayer feature makes the game. It is well worth giving it a test run through the tutorial on a rainy Sunday morning. Just remember to feed the cat, you may lose yourself in the multiplayer mode. Remember to feed the cat, you may lose yourself in the multiplayer mode
Mapping Wesnoth The Battle for Wesnoth, the game itself is a mature and well polished product. Creation of personalised campaigns is still a little on the raw side. But, I have no doubt that this minor weakness will be changed for the better in the coming months. To build a campaign yourself requires the creation of resources such as maps, figures and music, and the configuration of these resources into a scenario. A campaign is generated out of a series of these self-created scenarios. Maps are easily rendered via the inbuilt editor. The editor allows you to place land types on the map and save the it in text or binary format. Text format costs a little bit more disc space, but with practice the text is readable by your standard ten-year-old. Map generation is the obvious and simple part. Building a campaign is somewhat harder. A tool that simplifies this process is “CampGen”. Campgen is a Python script based on WxWidgets, a free software, cross-platform, native UI framework (see figure 6).
32
The Battle for Wesnoth is on in the days that never were
Issue 11
Figure 6: Screen grab of CampGen
Conclusions The game is interactive, community orientated and has a rich set of features Wesnoth is well worth trying out. The game is interactive, community orientated and has a rich set of features. A layman given enough time can make, via the help of tools, new scenarios and campaigns. The battle for Wesnoth is thus a living entity slowly expanding through the energy of its online community. I expect it to become more successful and look forward to playing version 2 with a mature set of tools for campaign generation.
Notes and resources Community forum (http://forum.wesnoth.org/) External Utilities (Campgen) (http://www.wesnoth.org/wiki/ExternalUtilities) Getting started information (http://www.wesnoth.org/wiki/GettingStarted) WxWidgets (http://www.wxwidgets.org/)
Biography Alan Berg (/user/8" title="View user profile.): Alan Berg Bsc. MSc. PGCE, has been a lead developer at the Central Computer Services at the University of Amsterdam for the last seven years. In his spare time, he writes computer articles. He has a degree, two masters and a teaching qualification. In previous incarnations, he was a technical writer, an Internet/Linux course writer, and a science teacher. He likes to get his hands dirty with the building and gluing of systems. He remains agile by playing computer games with his kids who (sadly) consistently beat him. You may contact him at reply.to.berg At chello.nl Nelson Berg (/user/81" title="View user profile.): Nelson Berg is an intelligent and aggressive game player and seven days a week ten-year-old son of Alan Berg (/user/8) In his spare time he performs brain surgery and works for a secret organization that protects the world and sometimes the Universe.
Copyright information This article is made available under the "Attribution-NonCommercial-NoDerivs" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-nc-nd/2.5/.
The Battle for Wesnoth is on in the days that never were
33
Issue 11 Source URL: http://www.freesoftwaremagazine.com/articles/wesnoth_interview_player
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
34
The Battle for Wesnoth is on in the days that never were
Sun Ultra 3 Mobile Workstation review Portable power computing By Martin Brown Sun have made some headlines in recent months through the release of their Ultra 20 workstation and a number of new servers based on the AMD CPUs. For some this is seen as major change of direction for a company that is well known for the use (and continued interest and development) of the SPARC (Scalable Processor Architecture) CPU. With so many new machines being based on the AMD CPU it will be surprising to some that Sun’s new mobile units are based on SPARC technology. The Sun Ultra 3 Mobile Workstation is based an 64-bit UltraSPARC CPU. There are two main models, a 15” unit that comes with a UltraSPARC IIi CPU at 550 or 650MHz, and a 17” model with a 1.2GHz UltraSPARC IIIi CPU. Both are standard CPUs—these are not cut down or restricted versions designed to work within a laptop—and that is a key parameter for identifying the target market for the unit.
The 17” Workstation Each mobile workstation supports up to 2GB DDR ECC SDRAM—unusual for a laptop, but common in the equivalent desktop and server environments on which the mobile workstation is based. The RAM is backed up by up to 80GB of hard drive storage and a full range of ports, including Gigabit Ethernet (100Mbps on the UltraSPARC IIi models), four USB ports (2 USB 2.0 and 2 USB 1.1), PS/2 ports for keyboard and mouse and two serial ports (RS-422). The unit also includes a set of stereo speakers and full-audio capability with microphone and line in and dual headphone sockets through a set of four jacks on the back of the unit. Wireless networking at 11Mbps (802.11b) is also available as an option. The displays are either a 15” unit at 1400x1050 or a 17” widescreen unit at 1440x900. The displays are coupled to the mobile equivalent of a high-performance 2D graphics card supporting 24-bit colour. For a Sun workstation the lack of 3D support is unusual, but there are obvious limitations to supporting high-end 3D hardware in a unit that is tightly packed with enough heat-generating electronics as it is. You can also connect the unit up to a monitor through the standard VGA connector on the rear. The CD-RW/DVD-ROM combo drive is a useful addition, and it has the added bonus that the drive can be used independently of the computer for audio playback. A set of buttons on the front left of the unit are used to control the drive. Also on the front, on the right hand side, is a smart-card reader slot which works with Sun’s security software to enable authorized use and network authentication only by those with a suitable smart-card.
Sun Ultra 3 Mobile Workstation review
35
Issue 11
The 17” Workstation, closed Prices range from $3400 for a basic, UltraSPARC IIi/15” model up to over $9000 for the UltraSPARC IIIi/17” model. I tested a 17” unit with 1GB of RAM, the UltraSPARC IIIi CPU and a 60GB hard drive, just below the top end of the scale.
First impressions What probably isn’t clear from the specifications is the size of the mobile workstation. It dwarfs my Sony Vaio with a 15” display. It even makes my 17” Powerbook feel svelte and handy by comparison. The Ultra 3 Mobile Workstation is slightly wider and deeper than the Powerbook, and over 1.5” thick. There is also a fairly large power brick when you want to power the unit from the wall. Big it may be, but it is a lot smaller than a comparable Ultra IIIi desktop unit, and it comes with a handy built-in display! However, you shouldn’t judge everything by its outer dimensions or appearance. It is the components under the hood that make the difference. The Ultra 3 Mobile Workstation isn’t marketed as a laptop. In fact, I’ve had my wrist slapped on that count a couple of times. The correct description for the unit is in the title—“mobile workstation”. And that is exactly what you are getting. Big it may be, but it is a lot smaller than a comparable Ultra IIIi desktop unit, and it comes with a handy built-in display! To get the level of power that is on offer within this unit would be difficult, even when looking at some of the “desktop replacement” units available within the Intel/AMD space. Actually, a desktop unit with the configuration of this workstation would be impressive. In a portable unit it is astounding. And key to that power is the Ultra IIIi CPU. The use of a SPARC CPU in a laptop is not new—Tadpole have been producing laptops based around different SPARC processors for many years. The main appeal with this unit is the full-blown, 64-bit, CPU—normally only found in a workstation or server that has been squeezed into a portable form factor.
Software and binary compatibility The UltraSPARC CPU provides full binary compatibility between your laptop and SPARC-based server environments. The unit comes with a standard version of Solaris 10 installed and therefore includes the Sun Java Desktop System and Gnome for the user interface. Also included is a suite of software designed to aid developers, including Sun Studio 10, Studio Enterprise and Studio Creator. You can also see a market for this unit from users moving in the other direction—the execution of existing applications in a mobile environment. The SPARC CPU is frequently used within military and government departments. Having a mobile unit that is binary compatible with existing applications and environment would save on redevelopment costs. I can also imagine a workstation like this being used in environments where server power is required in a portable size, for example as a server for trade shows or for use in training environments.
36
Portable power computing
Issue 11 You get the distinct impression though that Sun see their key market as developers who want a portable, binary compatible, workstation for developing Solaris software You get the distinct impression though that Sun see their key market as developers who want a portable, binary compatible, workstation for developing Solaris software. This is probably best demonstrated by the software bundle included with the laptop. The large screen makes it easy to work with multiple documents and the resulting code you develop can be executed on SPARC based servers without any recompilation or changes required.
Using a mobile workstation The unit is really too heavy, and more importantly too hot (especially since you’ll cover the vents), to keep on your lap for extended periods of time. The CPU consumes a fair amount of power and generates a lot of heat, which in turn means that the fan needs to run permanently to keep the unit cool. The fan is variable speed, but even when the computer is comparatively idle it can be a bit noisy. To be fair, it is no noisier than a typical workstation, but within a mobile unit the fan is right there under your keyboard, not under your desk. This is certainly not a portable that you can discretely use in the corner of Starbucks without drawing at least some attention to yourself. Your first impression of the unit will be that the boot-up time seems particularly long. An old Ultra 60 workstation takes less than a minute to boot; the Ultra 3 Mobile Workstation almost twice that. I suspect this is related directly to the speed limitations of the hard drive (a typical lower performance 2.5” unit) rather than the computer as a whole. That theory is certainly borne out when using the laptop, which feels snappy and responsive, even when opening large applications like Sun Studio or StarOffice. Moving windows and resizing them is also very quick and easy. Aside from the obvious form factor difference it is quite easy to forget you are using a laptop at all. Supporting either Solaris or OpenSolaris, the basic environment will be familiar to any Solaris user. Office applications, email and web browsing are obviously not the key markets for this unit. Although, they do demonstrate how practical a unit like this could be as the only laptop a developer, technician or engineer would ever need. I used the laptop almost exclusively for four weeks as my main desktop machine for a combination of my writing activities and development needs. StarOffice worked fine, internet browsing was great in Firefox—albeit with a few crashes on the beta version I was running at the time. Not once did I feel frustrated by having to wait for different tasks to complete—even when running disk intensive commands in a shell. Using the unit for its main market—software development—is where it really shines. I tested the binary compatibility by copying over applications that I’d built within Solaris 10 running on an Ultra 60 workstations, and had no problems either within the original Solaris 10 or OpenSolaris. Running large redevelopment and compilations was also not a problem. I tried a variety of different builds, mostly of free software like GCC, emacs and even Firefox and Mozilla and still didn’t experience any problems. Even with a large compilation running in the background the machine remained usable—at times it seemed almost unfazed by what was going on in the background. As a portable development unit it is a dream To get a feel for server projects I deployed a few applications of different sorts onto the system to check for performance. First, a web-drive and database heavy application, Cheffy (http://cheffy.com), which relies on a large MySQL database. The extra memory and CPU power available made a big difference here compared to executing within a comparable Intel laptop running Gentoo Linux. Even complex queries came back very quickly—in fact quicker than they do on the Dual Intel CPU server normally used for development. It is obviously not a solution designed for this use for the long term, but in the environments mentioned earlier it is a capable alternative. I also tried a number of web-service-driven applications (using Apache’s Geronimo and Axis2 platforms) as well as some Sun Studio bound Java applications. Again, I had no problem either running the applications, building them or continuing to use the laptop while these tasks were running in the background.
Portable power computing
37
Issue 11 With all this power under the hood, you may be wondering about battery life. I had mixed experiences, but in all my tests I got almost 90 minutes out of the battery, even when it was compiling a large project like Mozilla or QT. For more typical developer use—that’s lots of typing, occasional web browsing and sporadic builds—I got between 2.5 and 3.5 hours.
Conclusions The Sun Ultra 3 Mobile Workstation is not intended as a replacement for your typical Intel Centrino or Apple laptop and comparisons to these are pointless. The name really does say it all—it is a mobile workstation and should be treated as such for any comparisons. The unit is very fast, has a useful array of ports that will come in handy to most engineers for connecting up to servers and devices that have otherwise given up on their traditional displays. All Sun computers, for example, support serial-based consoles, vital on a server without keyboard and display support. As a portable development unit it is a dream. The ability to effectively run both a client and a deployment environment on the same machine at reasonable speeds certainly makes a difference to your ability to work while mobile. The size of the display and the speed of the unit make it ideal for working with multiple source files, or within environments like Sun Studio or Eclipse, both of which ran perfectly. The binary compatibility is obviously key for those who need a portable SPARC unit, but I could just as easily see it being used as a Java or script based development platform. As a tool for a free software junkie like me there is little to fault As a tool for a free software junkie like me there is little to fault. Running OpenSolaris and the ability to run the free software tools I use means that I could happily choose this unit over a more traditional Intel, AMD or Apple laptop. There are only two issues: size and price. It is an expensive unit, but the expense can be forgiven once you consider its power and the longevity that Sun hardware typically provides. To put that statement into context, my Ultra 60 workstation is 8 years old this year, but still feels quick and responsive in comparison to a 12 month old Intel-based workstation. I have no doubt that in 8 years time Ultra 3 Mobile Workstations will still be running and will still feel as powerful. Sadly, I wont be able to confirm that as the review unit needs to be returned.
Biography Martin Brown (/user/6" title="View user profile.): Martin â“ MCâ“ Brown is a member of the documentation team at MySQL and freelance writer. He has worked with Microsoft as an Subject Matter Expert (SME), is a featured blogger for ComputerWorld, a founding member of AnswerSquad.com, Technical Director of Foodware.net and, and has written books on topics as diverse as Microsoft Certification, iMacs, and free software programming.
Copyright information This article is made available under the "Attribution-NonCommercial-NoDerivs" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-nc-nd/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/sun_workstation
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
38
Portable power computing
Writing device drivers in Linux: A brief tutorial A quick and easy intro to writing device drivers for Linux like a true kernel developer! By Xavier Calbet “Do you pine for the nice days of Minix-1.1, when men were men and wrote their own device drivers?” Linus Torvalds
Pre-requisites In order to develop Linux device drivers, it is necessary to have an understanding of the following: • C programming. Some in-depth knowledge of C programming is needed, like pointer usage, bit manipulating functions, etc. • Microprocessor programming. It is necessary to know how microcomputers work internally: memory addressing, interrupts, etc. All of these concepts should be familiar to an assembler programmer. There are several different devices in Linux. For simplicity, this brief tutorial will only cover type char devices loaded as modules. Kernel 2.6.x will be used (in particular, kernel 2.6.8 under Debian Sarge, which is now Debian Stable).
User space and kernel space When you write device drivers, it’s important to make the distinction between “user space” and “kernel space”. • Kernel space. Linux (which is a kernel) manages the machine's hardware in a simple and efficient manner, offering the user a simple and uniform programming interface. In the same way, the kernel, and in particular its device drivers, form a bridge or interface between the end-user/programmer and the hardware. Any subroutines or functions forming part of the kernel (modules and device drivers, for example) are considered to be part of kernel space. • User space. End-user programs, like the UNIX shell or other GUI based applications (kpresenter for example), are part of the user space. Obviously, these applications need to interact with the system's hardware . However, they don’t do so directly, but through the kernel supported functions. All of this is shown in figure 1.
Figure 1: User space where applications reside, and kernel space where modules or device drivers reside
Writing device drivers in Linux: A brief tutorial
39
Issue 11
Interfacing functions between user space and kernel space The kernel offers several subroutines or functions in user space, which allow the end-user application programmer to interact with the hardware. Usually, in UNIX or Linux systems, this dialogue is performed through functions or subroutines in order to read and write files. The reason for this is that in Unix devices are seen, from the point of view of the user, as files. On the other hand, in kernel space Linux also offers several functions or subroutines to perform the low level interactions directly with the hardware, and allow the transfer of information from kernel to user space. Usually, for each function in user space (allowing the use of devices or files), there exists an equivalent in kernel space (allowing the transfer of information from the kernel to the user and vice-versa). This is shown in Table 1, which is, at this point, empty. It will be filled when the different device drivers concepts are introduced. Table 1. Device driver events and their associated interfacing functions in kernel space and user space. Events User functions Kernel functions Load module Open device Read device Write device Close device Remove module
Interfacing functions between kernel space and the hardware device There are also functions in kernel space which control the device or exchange information between the kernel and the hardware. Table 2 illustrates these concepts. This table will also be filled as the concepts are introduced. Table 2. Device driver events and their associated functions between kernel space and the hardware device. Events Kernel functions Read data Write data
The first driver: loading and removing the driver in user space Iâ&#x20AC;&#x2122;ll now show you how to develop your first Linux device driver, which will be introduced in the kernel as a module. For this purpose Iâ&#x20AC;&#x2122;ll write the following program in a file named nothing.c <nothing.c> = #include <linux/module.h> MODULE_LICENSE("Dual BSD/GPL");
Since the release of kernel version 2.6.x, compiling modules has become slightly more complicated. First, you need to have a complete, compiled kernel source-code-tree. If you have a Debian Sarge system, you can follow the steps in Appendix B (towards the end of this article). In the following, Iâ&#x20AC;&#x2122;ll assume that a kernel version 2.6.8 is being used.
40
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Issue 11 Next, you need to generate a makefile. The makefile for this example, which should be named Makefile, will be: <Makefile1> = obj-m := nothing.o
Unlike with previous versions of the kernel, it’s now also necessary to compile the module using the same kernel that you’re going to load and use the module with. To compile it, you can type: $ make -C /usr/src/kernel-source-2.6.8 M=`pwd` modules This extremely simple module belongs to kernel space and will form part of it once it’s loaded. In user space, you can load the module as root by typing the following into the command line: # insmod nothing.ko The insmod command allows the installation of the module in the kernel. However, this particular module isn’t of much use. It is possible to check that the module has been installed correctly by looking at all installed modules: # lsmod Finally, the module can be removed from the kernel using the command: # rmmod nothing By issuing the lsmod command again, you can verify that the module is no longer in the kernel. The summary of all this is shown in Table 3. Table 3. Device driver events and their associated interfacing functions between kernel space and user space. Events User functions Kernel functions Load module insmod Open device Read device Write device Close device Remove module rmmod
The “Hello world” driver: loading and removing the driver in kernel space When a module device driver is loaded into the kernel, some preliminary tasks are usually performed like resetting the device, reserving RAM, reserving interrupts, and reserving input/output ports, etc. These tasks are performed, in kernel space, by two functions which need to be present (and explicitly declared): module_init and module_exit; they correspond to the user space commands insmod and rmmod , which are used when installing or removing a module. To sum up, the user commands insmod and rmmod use the kernel space functions module_init and module_exit. Let’s see a practical example with the classic program Hello world: <hello.c> =
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
41
Issue 11 #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void) { printk("<1> Hello world!\n"); return 0; } static void hello_exit(void) { printk("<1> Bye, cruel world\n"); } module_init(hello_init); module_exit(hello_exit);
The actual functions hello_init and hello_exit can be given any name desired. However, in order for them to be identified as the corresponding loading and removing functions, they have to be passed as parameters to the functions module_init and module_exit. The printk function has also been introduced. It is very similar to the well known printf apart from the fact that it only works inside the kernel. The <1> symbol shows the high priority of the message (low number). In this way, besides getting the message in the kernel system log files, you should also receive this message in the system console. This module can be compiled using the same command as before, after adding its name into the Makefile. <Makefile2> = obj-m := nothing.o hello.o
In the rest of the article, I have left the Makefiles as an exercise for the reader. A complete Makefile that will compile all of the modules of this tutorial is shown in Appendix A. When the module is loaded or removed, the messages that were written in the printk statement will be displayed in the system console. If these messages do not appear in the console, you can view them by issuing the dmesg command or by looking at the system log file with cat /var/log/syslog. Table 4 shows these two new functions. Table 4. Device driver events and their associated interfacing functions between kernel space and user space. Events User functions Kernel functions Load module insmod module_init() Open device Read device Write device Close device Remove module rmmod module_exit()
The complete driver â&#x20AC;&#x153;memoryâ&#x20AC;?: initial part of the driver Iâ&#x20AC;&#x2122;ll now show how to build a complete device driver: memory.c. This device will allow a character to be read from or written into it. This device, while normally not very useful, provides a very illustrative example
42
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Issue 11 since it is a complete driver; it's also easy to implement, since it doesn’t interface to a real hardware device (besides the computer itself). To develop this driver, several new #include statements which appear frequently in device drivers need to be added: <memory initial> = /* Necessary includes for device drivers */ #include <linux/init.h> #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> /* printk() */ #include <linux/slab.h> /* kmalloc() */ #include <linux/fs.h> /* everything... */ #include <linux/errno.h> /* error codes */ #include <linux/types.h> /* size_t */ #include <linux/proc_fs.h> #include <linux/fcntl.h> /* O_ACCMODE */ #include <asm/system.h> /* cli(), *_flags */ #include <asm/uaccess.h> /* copy_from/to_user */ MODULE_LICENSE("Dual BSD/GPL"); /* Declaration of memory.c functions */ int memory_open(struct inode *inode, struct file *filp); int memory_release(struct inode *inode, struct file *filp); ssize_t memory_read(struct file *filp, char *buf, size_t count, loff_t *f_pos); ssize_t memory_write(struct file *filp, char *buf, size_t count, loff_t *f_pos); void memory_exit(void); int memory_init(void); /* Structure that declares the usual file */ /* access functions */ struct file_operations memory_fops = { read: memory_read, write: memory_write, open: memory_open, release: memory_release }; /* Declaration of the init and exit functions */ module_init(memory_init); module_exit(memory_exit); /* Global variables of the driver */ /* Major number */ int memory_major = 60; /* Buffer to store data */ char *memory_buffer;
After the #include files, the functions that will be defined later are declared. The common functions which are typically used to manipulate files are declared in the definition of the file_operations structure. These will also be explained in detail later. Next, the initialization and exit functions—used when loading and removing the module—are declared to the kernel. Finally, the global variables of the driver are declared: one of them is the major number of the driver, the other is a pointer to a region in memory, memory_buffer, which will be used as storage for the driver data.
The “memory” driver: connection of the device with its files In UNIX and Linux, devices are accessed from user space in exactly the same way as files are accessed. These device files are normally subdirectories of the /dev directory.
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
43
Issue 11 To link normal files with a kernel module two numbers are used: major number and minor number. The major number is the one the kernel uses to link a file with its driver. The minor number is for internal use of the device and for simplicity it wonâ&#x20AC;&#x2122;t be covered in this article. To achieve this, a file (which will be used to access the device driver) must be created, by typing the following command as root: # mknod /dev/memory c 60 0 In the above, c means that a char device is to be created, 60 is the major number and 0 is the minor number. Within the driver, in order to link it with its corresponding /dev file in kernel space, the register_chrdev function is used. It is called with three arguments: major number, a string of characters showing the module name, and a file_operations structure which links the call with the file functions it defines. It is invoked, when installing the module, in this way: <memory init module> = int memory_init(void) { int result; /* Registering device */ result = register_chrdev(memory_major, "memory", &memory_fops); if (result < 0) { printk( "<1>memory: cannot obtain major number %d\n", memory_major); return result; } /* Allocating memory for the buffer */ memory_buffer = kmalloc(1, GFP_KERNEL); if (!memory_buffer) { result = -ENOMEM; goto fail; } memset(memory_buffer, 0, 1); printk("<1>Inserting memory module\n"); return 0; fail: memory_exit(); return result; }
Also, note the use of the kmalloc function. This function is used for memory allocation of the buffer in the device driver which resides in kernel space. Its use is very similar to the well known malloc function. Finally, if registering the major number or allocating the memory fails, the module acts accordingly.
The â&#x20AC;&#x153;memoryâ&#x20AC;? driver: removing the driver In order to remove the module inside the memory_exit function, the function unregsiter_chrdev needs to be present. This will free the major number for the kernel. <memory exit module> = void memory_exit(void) { /* Freeing the major number */ unregister_chrdev(memory_major, "memory");
44
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Issue 11 /* Freeing buffer memory */ if (memory_buffer) { kfree(memory_buffer); } printk("<1>Removing memory module\n"); }
The buffer memory is also freed in this function, in order to leave a clean kernel when removing the device driver.
The “memory” driver: opening the device as a file The kernel space function, which corresponds to opening a file in user space (fopen), is the member open: of the file_operations structure in the call to register_chrdev. In this case, it is the memory_open function. It takes as arguments: an inode structure, which sends information to the kernel regarding the major number and minor number; and a file structure with information relative to the different operations that can be performed on a file. Neither of these functions will be covered in depth within this article. When a file is opened, it’s normally necessary to initialize driver variables or reset the device. In this simple example, though, these operations are not performed. The memory_open function can be seen below: <memory open> = int memory_open(struct inode *inode, struct file *filp) { /* Success */ return 0; }
This new function is now shown in Table 5. Table 5. Device driver events and their associated interfacing functions between kernel space and user space. Events Load module Open device Read device Write device Close device Remove module
User functions Kernel functions insmod module_init() fopen file_operations: open
rmmod
module_exit()
The “memory” driver: closing the device as a file The corresponding function for closing a file in user space (fclose) is the release: member of the file_operations structure in the call to register_chrdev. In this particular case, it is the function memory_release, which has as arguments an inode structure and a file structure, just like before. When a file is closed, it’s usually necessary to free the used memory and any variables related to the opening of the device. But, once again, due to the simplicity of this example, none of these operations are performed. The memory_release function is shown below:
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
45
Issue 11 <memory release> = int memory_release(struct inode *inode, struct file *filp) { /* Success */ return 0; }
This new function is shown in Table 6. Table 6. Device driver events and their associated interfacing functions between kernel space and user space. Events Load module Open device Read device Write device Close device Remove module
User functions Kernel functions insmod module_init() fopen file_operations: open
fclose rmmod
file_operations: release module_exit()
The â&#x20AC;&#x153;memoryâ&#x20AC;? driver: reading the device To read a device with the user function fread or similar, the member read: of the file_operations structure is used in the call to register_chrdev. This time, it is the function memory_read. Its arguments are: a type file structure; a buffer (buf), from which the user space function (fread) will read; a counter with the number of bytes to transfer (count), which has the same value as the usual counter in the user space function (fread); and finally, the position of where to start reading the file (f_pos). In this simple case, the memory_read function transfers a single byte from the driver buffer (memory_buffer) to user space with the function copy_to_user: <memory read> = ssize_t memory_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) { /* Transfering data to user space */ copy_to_user(buf,memory_buffer,1); /* Changing reading position as best suits */ if (*f_pos == 0) { *f_pos+=1; return 1; } else { return 0; } }
The reading position in the file (f_pos) is also changed. If the position is at the beginning of the file, it is increased by one and the number of bytes that have been properly read is given as a return value, 1. If not at the beginning of the file, an end of file (0) is returned since the file only stores one byte. In Table 7 this new function has been added. Table 7. Device driver events and their associated interfacing functions between kernel space and user space.
46
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Issue 11 Events Load module Open device Read device Write device Close device Remove modules
User functions insmod fopen fread
Kernel functions module_init() file_operations: open file_operations: read
fclose rmmod
file_operations: release module_exit()
The “memory” driver: writing to a device To write to a device with the user function fwrite or similar, the member write: of the file_operations structure is used in the call to register_chrdev. It is the function memory_write, in this particular example, which has the following as arguments: a type file structure; buf, a buffer in which the user space function (fwrite) will write; count, a counter with the number of bytes to transfer, which has the same values as the usual counter in the user space function (fwrite); and finally, f_pos, the position of where to start writing in the file. <memory write> = ssize_t memory_write( struct file *filp, char *buf, size_t count, loff_t *f_pos) { char *tmp; tmp=buf+count-1; copy_from_user(memory_buffer,tmp,1); return 1; }
In this case, the function copy_from_user transfers the data from user space to kernel space. In Table 8 this new function is shown. Device driver events and their associated interfacing functions between kernel space and user space. Events Load module Open device Close device Write device Close device Remove module
User functions insmod fopen fread fwrite fclose rmmod
Kernel functions module_init() file_operations: open file_operations: read file_operations: write file_operations: release module_exit()
The complete “memory” driver By joining all of the previously shown code, the complete driver is achieved: <memory.c> = <memory <memory <memory <memory <memory <memory <memory
initial> init module> exit module> open> release> read> write>
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
47
Issue 11
Before this module can be used, you will need to compile it in the same way as with previous modules. The module can then be loaded with: # insmod memory.ko It’s also convenient to unprotect the device: # chmod 666 /dev/memory If everything went well, you will have a device /dev/memory to which you can write a string of characters and it will store the last one of them. You can perform the operation like this: $ echo -n abcdef >/dev/memory To check the content of the device you can use a simple cat: $ cat /dev/memory The stored character will not change until it is overwritten or the module is removed.
The real “parlelport” driver: description of the parallel port I’ll now proceed by modifying the driver that I just created to develop one that does a real task on a real device. I’ll use the simple and ubiquitous computer parallel port and the driver will be called parlelport. The parallel port is effectively a device that allows the input and output of digital information. More specifically it has a female D-25 connector with twenty-five pins. Internally, from the point of view of the CPU, it uses three bytes of memory. In a PC, the base address (the one from the first byte of the device) is usually 0x378. In this basic example, I’ll use just the first byte, which consists entirely of digital outputs. The connection of the above-mentioned byte with the external connector pins is shown in figure 2.
Figure 2: The first byte of the parallel port and its pin connections with the external female D-25 connector
The “parlelport” driver: initializing the module The previous memory_init function needs modification—changing the RAM memory allocation for the reservation of the memory address of the parallel port (0x378). To achieve this, use the function for checking the availability of a memory region (check_region), and the function to reserve the memory region for this device (request_region). Both have as arguments the base address of the memory region and its length. The request_region function also accepts a string which defines the module.
48
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Issue 11 <parlelport modified init module> = /* Registering port */ port = check_region(0x378, 1); if (port) { printk("<1>parlelport: cannot reserve 0x378\n"); result = port; goto fail; } request_region(0x378, 1, "parlelport");
The “parlelport” driver: removing the module It will be very similar to the memory module but substituting the freeing of memory with the removal of the reserved memory of the parallel port. This is done by the release_region function, which has the same arguments as check_region. <parlelport modified exit module> = /* Make port free! */ if (!port) { release_region(0x378,1); }
The “parlelport” driver: reading the device In this case, a real device reading action needs to be added to allow the transfer of this information to user space. The inb function achieves this; its arguments are the address of the parallel port and it returns the content of the port. <parlelport inport> = /* Reading port */ parlelport_buffer = inb(0x378);
Table 9 (the equivalent of Table 2) shows this new function. Device driver events and their associated functions between kernel space and the hardware device. Events Kernel functions Read data inb Write data
The “parlelport” driver: writing to the device Again, you have to add the “writing to the device” function to be able to transfer later this data to user space. The function outb accomplishes this; it takes as arguments the content to write in the port and its address. <parlelport outport> = /* Writing to the port */ outb(parlelport_buffer,0x378);
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
49
Issue 11 Table 10 summarizes this new function. Device driver events and their associated functions between kernel space and the hardware device. Events Kernel functions Read data inb Write data outb
The complete “parlelport” driver I’ll proceed by looking at the whole code of the parlelport module. You have to replace the word memory for the word parlelport throughout the code for the memory module. The final result is shown below: <parlelport.c> = <parlelport <parlelport <parlelport <parlelport <parlelport <parlelport <parlelport
initial> init module> exit module> open> release> read> write>
Initial section In the initial section of the driver a different major number is used (61). Also, the global variable memory_buffer is changed to port and two more #include lines are added: ioport.h and io.h. <parlelport initial> = /* Necessary includes for drivers */ #include <linux/init.h> #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> /* printk() */ #include <linux/slab.h> /* kmalloc() */ #include <linux/fs.h> /* everything... */ #include <linux/errno.h> /* error codes */ #include <linux/types.h> /* size_t */ #include <linux/proc_fs.h> #include <linux/fcntl.h> /* O_ACCMODE */ #include <linux/ioport.h> #include <asm/system.h> /* cli(), *_flags */ #include <asm/uaccess.h> /* copy_from/to_user */ #include <asm/io.h> /* inb, outb */ MODULE_LICENSE("Dual BSD/GPL"); /* Function declaration of parlelport.c */ int parlelport_open(struct inode *inode, struct file *filp); int parlelport_release(struct inode *inode, struct file *filp); ssize_t parlelport_read(struct file *filp, char *buf, size_t count, loff_t *f_pos); ssize_t parlelport_write(struct file *filp, char *buf, size_t count, loff_t *f_pos); void parlelport_exit(void); int parlelport_init(void); /* Structure that declares the common */ /* file access fcuntions */ struct file_operations parlelport_fops = { read: parlelport_read,
50
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Issue 11 write: parlelport_write, open: parlelport_open, release: parlelport_release }; /* Driver global variables */ /* Major number */ int parlelport_major = 61; /* Control variable for memory */ /* reservation of the parallel port*/ int port; module_init(parlelport_init); module_exit(parlelport_exit);
Module init In this module-initializing-routine Iâ&#x20AC;&#x2122;ll introduce the memory reserve of the parallel port as was described before. <parlelport init module> = int parlelport_init(void) { int result; /* Registering device */ result = register_chrdev(parlelport_major, "parlelport", &parlelport_fops); if (result < 0) { printk( "<1>parlelport: cannot obtain major number %d\n", parlelport_major); return result; } <parlelport modified init module> printk("<1>Inserting parlelport module\n"); return 0; fail: parlelport_exit(); return result; }
Removing the module This routine will include the modifications previously mentioned. <parlelport exit module> = void parlelport_exit(void) { /* Make major number free! */ unregister_chrdev(parlelport_major, "parlelport"); <parlelport modified exit module> printk("<1>Removing parlelport module\n"); }
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
51
Issue 11
Opening the device as a file This routine is identical to the memory driver. <parlelport open> = int parlelport_open(struct inode *inode, struct file *filp) { /* Success */ return 0; }
Closing the device as a file Again, the match is perfect. <parlelport release> = int parlelport_release(struct inode *inode, struct file *filp) { /* Success */ return 0; }
Reading the device The reading function is similar to the memory one with the corresponding modifications to read from the port of a device. <parlelport read> = ssize_t parlelport_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) { /* Buffer to read the device */ char parlelport_buffer; <parlelport inport> /* We transfer data to user space */ copy_to_user(buf,&parlelport_buffer,1); /* We change the reading position as best suits */ if (*f_pos == 0) { *f_pos+=1; return 1; } else { return 0; } }
52
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Issue 11 Writing to the device It is analogous to the memory one except for writing to a device. <parlelport write> = ssize_t parlelport_write( struct file *filp, char *buf, size_t count, loff_t *f_pos) { char *tmp; /* Buffer writing to the device */ char parlelport_buffer; tmp=buf+count-1; copy_from_user(&parlelport_buffer,tmp,1); <parlelport outport> return 1; }
LEDs to test the use of the parallel port In this section I’ll detail the construction of a piece of hardware that can be used to visualize the state of the parallel port with some simple LEDs. WARNING: Connecting devices to the parallel port can harm your computer. Make sure that you are properly earthed and your computer is turned off when connecting the device. Any problems that arise due to undertaking these experiments is your sole responsibility. The circuit to build is shown in figure 3 You can also read “PC & Electronics: Connecting Your PC to the Outside World” by Zoller as reference. In order to use it, you must first ensure that all hardware is correctly connected. Next, switch off the PC and connect the device to the parallel port. The PC can then be turned on and all device drivers related to the parallel port should be removed (for example, lp, parport, parport_pc, etc.). The hotplug module of the Debian Sarge distribution is particularly annoying and should be removed. If the file /dev/parlelport does not exist, it must be created as root with the command: # mknod /dev/parlelport c 61 0 Then it needs to be made readable and writable by anybody with: # chmod 666 /dev/parlelport The module can now be installed, parlelport. You can check that it is effectively reserving the input/output port addresses 0x378 with the command: $ cat /proc/ioports To turn on the LEDs and check that the system is working, execute the command: $ echo -n A >/dev/parlelport This should turn on LED zero and six, leaving all of the others off. You can check the state of the parallel port issuing the command:
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
53
Issue 11 $ cat /dev/parlelport
Figure 3: Electronic diagram of the LED matrix to monitor the parallel port
Final application: flashing lights Finally, Iâ&#x20AC;&#x2122;ll develop a pretty application which will make the LEDs flash in succession. To achieve this, a program in user space needs to be written with which only one bit at a time will be written to the /dev/parlelport device. <lights.c> = #include <stdio.h> #include <unistd.h></p> int main() { unsigned char byte,dummy; FILE * PARLELPORT; /* Opening the device parlelport */ PARLELPORT=fopen("/dev/parlelport","w"); /* We remove the buffer from the file i/o */ setvbuf(PARLELPORT,&dummy,_IONBF,1); /* Initializing the variable to one */ byte=1; /* We make an infinite loop */ while (1) { /* Writing to the parallel port */ /* to turn on a LED */ printf("Byte value is %d\n",byte); fwrite(&byte,1,1,PARLELPORT); sleep(1); /* Updating the byte value */ byte<<=1; if (byte == 0) byte = 1; } fclose(PARLELPORT); }
It can be compiled in the usual way: $ gcc -o lights lights.c
54
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Issue 11 and can be executed with the command: $ lights The lights will flash successively one after the other! The flashing LEDs and the Linux computer running this program are shown in figure 4.
Conclusion Having followed this brief tutorial you should now be capable of writing your own complete device driver for simple hardware like a relay board (see Appendix C), or a minimal device driver for complex hardware. Learning to understand some of these simple concepts behind the Linux kernel allows you, in a quick and easy way, to get up to speed with respect to writing device drivers. And, this will bring you another step closer to becoming a true Linux kernel developer.
Figure 4: Flashing LEDs mounted on the circuit board and the computer running Linux. Two terminals are shown: one where the “parlelport” module is loaded and another one where the “lights” program is run. Tux is closely following what is going on
Notes and resources A. Rubini, J. Corbert. 2001. Linux device drivers (second edition) (http://www.xml.com/ldd/chapter/book/). Ed. O’Reilly. This book is available for free on the internet. Jonathan Corbet. 2003/2004. Porting device drivers to the 2.6 kernel (http://lwn.net/Articles/driver-porting). This is a very valuable resource for porting drivers to the new 2.6 Linux kernel and also for learning about Linux device drivers. B. Zoller. 1998. PC & Electronics: Connecting Your PC to the Outside World (Productivity Series). Nowadays it is probably easier to surf the web for hardware projects like this one. M. Waite, S. Prata. 1990. C Programming. Any other good book on C programming would suffice.
Appendix A. Complete Makefile <Makefile> = obj-m := nothing.o hello.o memory.o parlelport.o
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
55
Issue 11
Appendix B. Compiling the kernel on a Debian Sarge system To compile a 2.6.x kernel on a Debian Sarge system you need to perform the following steps, which should be run as root: 1. Install the “kernel-image-2.6.x” package. 2. Reboot the machine to make this the running kernel image. This is done semi-automatically by Debian. You may need to tweak the lilo configuration file /etc/lilo.conf and then run lilo to achieve this. 3. Install the “kernel-source-2.6.x” package. 4. Change to the source code directory, cd /usr/src and unzip and untar the source code with bunzip2 kernel-source-2.6.x.tar.bz2 and tar xvf kernel-source-2.6.x.tar. Change to the kernel source directory with cd /usr/src/kernel-source-2.6.x 5. Copy the default Debian kernel configuration file to your local kernel source directory cp /boot/config-2.6.x .config. 6. Make the kernel and the modules with make and then make modules.
Appendix C. Exercises If you would like to take on some bigger challenges, here are a couple of exercises you can do: 1. I once wrote two device drivers for two ISA Meilhaus (http://meilhaus.de/) boards, an analog to digital converter (ME26) and a relay control board (ME53). The software is available from the ADQ (http://adq.sourceforge.net) project. Get the newer PCI versions of these Meilhaus boards and update the software. 2. Take any device that doesn’t work on Linux, but has a very similar chipset to another device which does have a proven device driver for Linux. Try to modify the working device driver to make it work for the new device. If you achieve this, submit your code to the kernel and become a kernel developer yourself!
Comments and acknowledgements Three years have elapsed since the first version (http://es.tldp.org/Presentaciones/200103hispalinux/calbet/html/t1.html) of this document was written. It was originally written in Spanish and intended for version 2.2 of the kernel, but kernel 2.4 was already making its first steps at that time. The reason for this choice is that good documentation for writing device drivers, the Linux device drivers book (see bibliography), lagged the release of the kernel in some months. This new version is also coming out soon after the release of the new 2.6 kernel, but up to date documentation is now readily available in Linux Weekly News (http://lwn.net/Articles/driver-porting) making it possible to have this document synchronized with the newest kernel. Fortunately enough, PCs still come with a built-in parallel port, despite the actual trend of changing everything inside a PC to render it obsolete in no time. Let us hope that PCs still continue to have built-in parallel ports for some time in the future, or that at least, parallel port PCI cards are still being sold. This tutorial has been originally typed using a text editor (i.e. emacs) in noweb format. This text is then processed with the noweb tool to create a LaTeX file ( .tex ) and the source code files ( .c ). All this can be done using the supplied makefile.document with the command make -f makefile.document. I would like to thank the “Instituto Polit?ico de Bragan?rdquo;, the “N?o Estudantil de Linux del Instituto Polit?ico de Bragan?(NUX)”, the “Asociaci?e Software Libre de Le?SLe?rdquo; and the “N?o de Estudantes de Engenharia Inform?ca da Universidade de ?ora” for making this update possible.
Biography
56
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Issue 11 Xavier Calbet (/user/42" title="View user profile.): Xavier Calbet (xcalbet AT googlemail DOT com) is a long time free software user who started using Linux distributions in the ancient times when Slackware had to be installed using tens of floppy disks. He is currently working on his two pet projects: a meteorological field and satellite image display system, SAPO (http://sourceforge.net/projects/sapo), and the best available free numerical computer language to date, PDL (Perl Data Language) (http://pdl.perl.org/).
Copyright information Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html. Source URL: http://www.freesoftwaremagazine.com/articles/drivers_linux
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
57
Issue 11
58
A quick and easy intro to writing device drivers for Linux like atrue kernel developer!
Stylish XML Part one: using CSS to make your XML documents look pretty By David Horton Creating custom markup with XML is pretty easy to do, but making it look good is another feat entirely. Fortunately, a little knowledge of cascading style sheets can go a long way toward making XML easier on the eyes.
Basic XML Before diving into the subject of styling XML, you need to know a little about what an XML document is and how to create a very simple one using a text editor. Issue one of Free Software Magazine has an excellent article (http://www.freesoftwaremagazine.com/free_issues/issue_01/focus_format_xml) by Kay Ethier and Scott Abel introducing many of the terms and technologies surrounding XML. There are also plenty of tutorials available on the web showing you how to create your own markup with XML. Once you feel comfortable with the basics of XML, read on and let’s start styling. Feel free to try experimenting with the CSS provided in the download area with this article. Working with XML is a lot like using HTML except that there are no predefined tags
Unstyled XML A popular theme of many beginning XML tutorials is to take a recipe for some kind of delicious food and describe it using XML. Since I like to cook I’m going to stick with this theme and show you examples using an XML version of my muy delicioso pico de gallo recipe. So grab some tortilla chips and margaritas and let’s get started. I’ll start with a handwritten recipe for pico de gallo. In the past, good old pen and paper is how I would record and share all of my recipes. Then one day, when I was feeling particularly ambitious, I decided to start storing my recipes electronically as XML documents. It wasn’t particularly difficult, I just typed the recipes up in my favorite text editor and thought up some tags to describe the different elements. Working with XML is a lot like using HTML except that there are no predefined tags. And, since the recipes are now stored as an electronic document, I can also share them on the internet.
Paper-based recipe converted to XML One of the cool features of modern web browsers is that they can now handle XML documents just as easily as the traditional HTML. In fact, I can even open up my pico de gallo recipe using Mozilla Firefox (http://www.getfirefox.com/) which makes sharing XML documents over the internet very easy. No more passing around handwritten copies, instead I can just refer people to my web site.
Stylish XML
59
Issue 11 Unfortunately, the XML recipe displayed in the browser looks just as unattractive as it does in the text editor. Can you imagine trying to share this kind of recipe with family and friends? I can hear the conversation now, “Yeah, Mom, just ignore the stuff between the angle brackets... Right, the ones that look like greater-than and less-than... Because it’s XML and it’s cool, that’s why...”
XML without styling
Styling with CSS The simplest answer to improving the look of XML in the Firefox browser is to use Cascading Style Sheets (CSS). This is the same CSS that is used for web pages and can be a very attractive choice if you fancy yourself as somewhat of an HTML guru. All I have to do to jazz up my pico de gallo recipe is to link it to a CSS file. One of the cool features of modern web browsers is that they can now handle XML documents just as easily as the traditional HTML XML uses the xml-styleheet processing instruction to reference style sheets. In the specific case of my pico de gallo recipe, I would place the line <?xml-stylesheet href="recipe-style.css" type="text/css"?> near the top of the XML file. For you web gurus out there this probably conjures up images of the HTML syntax <LINK rel="recipe-style.css" type="text/css"> which is not surprising since it works in much the same way.
XML with CSS style sheet linked The big difference between using CSS for XML and using CSS for HTML is that browsers don’t have any built-in styles for XML. With HTML, if you specified a level-one heading, you knew the text between the <h1> and </h1> tags was going to be displayed in a large, bold font and you could then use CSS to do some tweaking like changing the color to bright red. But, when it comes to my XML recipe there is no <h1> tag. In fact, all of the tags are made up so I can’t really expect the browser to have built-in styles for them. Every single aspect of the document layout is up to me and must be defined within my CSS file. This includes such
60
Part one: using CSS to make your XML documents look pretty
Issue 11 mundane styling tasks as telling the browser to place each individual ingredient on a new line and not run them together. While this may sound like a big hassle, it’s actually not too difficult when taken one step at a time.
Defining block elements As a first step, I decide which elements need to start on a new line or, in CSS speak, need to be formatted as a block element. This is easier than you might think, because we humans are smarter than computers. For my pico de gallo recipe, I can simply refer to the handwritten recipe and look at how my brain unconsciously decided how to format it. Thinking in terms of where I placed line breaks it’s easy to see that the title, individual ingredients and the preparation instructions all qualify as block elements. Anything that I could do with HTML and CSS I can do with XML and CSS as long as I view my document in a modern, XML-capable browser Once the block elements are determined, the next step is to record this information in recipe-style.css. CSS defines styles using the format selector { property: value; } so to make the recipe title a block element I just need to add the line title { display: block; } to my CSS file. Each element that I want to style needs to be recorded this way so I should add similar lines for the ingredient and preparation elements. With these three simple CSS directives, my pico de gallo recipe should be much more legible.
Block elements styled with CSS
Tweaking the style The final step is to tune the aesthetics of the recipe. You may have noticed that the CSS-styled XML is still kind of boring, even compared to my handwritten recipe. Mainly it’s because everything looks the same. Same font. Same line spacing. Same everything. I can improve the look of my recipe by defining more CSS properties in the recipe-style.css file. For example, I might want to put some emphasis on the recipe’s title to make it stand out and catch the eye. This can be accomplished by using the font-weight property so that the title appears in bold. I can visually separate different sections of the recipe by applying CSS margin properties to the elements “ingredientlist” and “preparation”. If I want to get really fancy, I can even place labels on various sections using CSS’s :before pseudo-element. Anything that I could do with HTML and CSS I can do with XML and CSS as long as I view my document in a modern, XML-capable browser.
Part one: using CSS to make your XML documents look pretty
61
Issue 11
The final CSS-styled XML recipe
Pros and cons of XML/CSS My pico de gallo recipe is looking pretty good and it didn’t take too much effort to get it that way thanks to the XML/CSS capabilities of the Firefox browser. However, if I share my recipes on the internet there is no way I can guarantee everyone else is going to be using the latest release of Firefox to view them. If somebody visits my site using an older, proprietary browser or a text-only browser this XML/CSS thing is not going to work. In that case, I’m going to have to come up with a format that their browser can handle. Luckily, there is another type of style sheet for XML documents called eXtensible Style sheet Language (XSL) that can help in this situation. XSL can do wonderful things including transforming my XML recipe into an HTML or PDF file that older browsers can deal with. But for that you’ll have to wait for part two of this article.
Biography David Horton (/user/13" title="View user profile.): David Horton got started with GNU/Linux in 1996 when he needed a way to share a single dial-up internet connection with his college room-mates. He found the solution he needed with an early version of Slackware and a copy of the PPP-HOWTO from The Linux Documentation Project. Ten years later he is older and wiser and still hooked on GNU/Linux. Many of Dave's interests and hobbies can be explored on his website (http://www.happy-monkey.net).
Copyright information This article is made available under the "Attribution-Sharealike" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-sa/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/stylish_xml
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
62
Part one: using CSS to make your XML documents look pretty
Towards a free matter economy (Part 5) Discovering the future, recovering the past By Terry Hancock I think the health of our civilization, the depth of our awareness about the underpinnings of our culture and our concern for the future can all be tested by how well we support our libraries.—Carl Sagan, Cosmos Libraries have been around for a lot longer than software, and librarians long ago learned many of the data management lessons that have only now begun to surface in the world of software and databases. By contrast, software is a young, rapidly changing field, and this has affected its outlook. Five years may seem like an eternity in software development, but in the archival business, it’s just the blink of an eye. What libraries have not dealt with historically, however, is the dismaying array of data storage mechanisms and file formats that software data represents, the troublesome transience of the tools needed to access that data, and the overwhelming quantity of the data that is produced.
Finding your way For uncontrolled data sources, such as the world wide web at large, we have no real choice except to use machine indexing systems such as Google, but if we want a free-design database to be a maximally reusable resource, we need to make use of metadata. If we want a free-design database to be a maximally reusable resource, we need to make use of metadata Metadata, “information about information” is the key to library science. There are many decisions about data sources that cannot be easily made by machine, and metadata tagging allows the librarian to classify works so that they can be retrieved later. Typically these include the familiar “subject”, “title”, and “keyword” indexes that were once the mainstay of library card catalogs, and now of electronic OPACs used by modern libraries [1]. Schemas For a long time, libraries have used the highly rigorous but somewhat difficult MARC database system [2], which is not exactly a relational or object database, but is somewhat in between, and requires special handling to be managed properly. Since then, however, computer science development has led to more manageable database design styles, and the increasing quantity of digital and multimedia library resources has begun to make the conventional book-publishing orientation of MARC obsolete. Librarians are, therefore, developing more streamlined, agile metadata database systems, such as the FRBR [3], which is a pure relational database schema designed to encapsulate the minimal (but complete) requirements for library use, and the even more streamlined Dublin Core (DC) metadata system [4]. MARC, FRBR, and DC provide “schemas” or lists of the types of metadata elements that can be recorded for a work. Vocabularies A perhaps less obvious need is the “controlled vocabulary”. There are many ways to express a single subject—is the study of extra-terrestrial life to be called “bioastronomy”, “exobiology”, or “xenobiology”? People have used all three terms, and, through their usage, established different emphases. Should each be given its own category, or should they be treated as synonyms and stored together? Which term will we use for that category? It’s a common mistake to underestimate the importance and difficulty of selecting appropriate taxonomic vocabularies. This is because we are all biased towards our own fields of endeavor and tend to have only a vague idea of the structure of other disciplines. Consider, for example, the domain-specific controlled
Towards a free matter economy (Part 5)
63
Issue 11 vocabulary represented by the “Trove” system [5], which you use if you look for software projects on the Sourceforge site. It’s an excellent system for finding software, provided that the paradigms of computing don’t change too much. However, should entirely new software types evolve, or should the system be used for things outside of the realm of software, the Trove categories become much less useful. Fortunately, library associations have done a lot of work on broad, inter-domain classification. For example, in the English language, there is the AACR [6], used in Canada and the United States. It seems like a wise idea to use these standards whenever possible.
Libraries had been in use for a long time before the advent of computers, and librarians have therefore learned important lessons about how information should be cataloged. As our databases become more full-text, more diverse in format, and broader in content, we increasingly encounter the same challenges that have formed the basis of library and information science for centuries (Der B?rwurm, by Carl Spitzweg from Wikimedia Commons (PD))
Agility and human nature One of the problems in applying professional library methods to software works and the results of community based production, is that they are fairly labor intensive, and rely on a class of professional experts to do the classifying. Considering the quantity of data on a site like Sourceforge, it’s not hard to see that hiring librarians to manage the problem would be a daunting prospect. Fortunately there are other ways to assign metadata to files. Creator tagging Perhaps the most obvious solution is to have authors assign metadata to their own works. It’s an obvious solution; it’s the typical starting point for most systems; and, for things like title, attribution, and licensing it is really the only way to do it, because the creator is the one who chooses those properties. It’s not without problems, however. An author is not always the best person to trust about their own data. Vendors tend to puff up their projects; authors can have greatly inflated (or deflated) egos; and people are often just lazy or inept with the submission mechanisms [7]. It seems clear that we can’t always rely on the people who create works to be good at classifying them. Expert tagging The library solution is to have items cataloged by professionals who train in doing just that. Even when creators determine their own subject headings, it is usually the case that the schema (what data to record) and the vocabulary (what options are available for each field) are decided by experts. Despite some claims to the contrary, Wikipedia is a remarkably successful case of well-organized self-organization
64
Discovering the future, recovering the past
Issue 11 Social or consensus tagging A recently successful model, employed by community sites such as Wikipedia, and used by companies such as Amazon, is to rely on reader feedback to improve the metadata as it is being used. Many properties of such sites—the ability to edit them, the feedback forms (“Is this page useful?”), and other features—make this feasible. Despite some claims to the contrary, Wikipedia is a remarkably successful case of well-organized self-organization. Even if it were to fall short in quality and accuracy compared to a professionally cataloged encyclopedia, such as Encyclopedia Britannica, it would still represent a considerable achievement—and yet, studies have suggested that it does not fall far short of such works. [8] Artificial intelligence For purely objective data such as file format, checksum, or size, automatic cataloging is the obvious solution. Advances in search technology and artificial intelligence have allowed us to go much further than this, though. AI-based text analysis and data-mining has been a popular theme for some time, and Google’s search engine benefits from some of this technology. However, in the last year or so, we have started to see more ambitious and original AI techniques being used on non-text data. For example, the free software package “SmartDJ” [9] is a playlist manager that find songs that “sound alike”, by analyzing the recordings themselves, and “imgSeek” [10] is a tool that recognizes similar images, so that a rough sketch of an expected image can be used to search for the image. No doubt these applications are still primitive, but they show a promising possibility for future indexing systems. Putting them together Together, these methods can be usefully understood as a continuous spectrum, based on types of metadata and who should be most trusted to establish them (see figure). It’s easy to imagine a system based on creating a metadata stub for a package, starting with creator-provided title, attribution, and licensing, and then allowing that stub to be further constructed by the actions of the different interested parties managing the overall database system. A promising tool for this kind of task is “Resource Description Framework” (RDF) [11]. This is the basis of the so-called “Semantic Web” [12], and is useful because it provides a completely extensible and decentralized system for assigning metadata. Such projects as “IkeWiki” [13] are already providing ways to make such RDF tagging easy to apply to dynamic websites.
There are a wide variety of sources of metadata schemas and controlled vocabularies for classifying information that a free design based economy will need to archive both as supplier and consumer. Some popular examples are referenced here. The data can be usefully thought of as occupying a spectrum from “most personal” information, which can only be supplied by the creator, to “completely objective” information which can be derived by machine. Other important methodologies have been created for the space in between, and the scope of what can be machine-processed has increased
Discovering the future, recovering the past
65
Issue 11
Signal to noise Nearly all of the data that passes through our websites, mail servers, and even development projects is dross. Most data is only temporarily valuable, or even unwanted “spam”. If we were to institute a policy of saving all of that data, we wouldn’t only require exponentially increasing data storage mechanisms, but we’d also be hindering the recovery of data through an extremely low “signal to noise” ratio. What is needed is an effective information sieve that only captures the permanently valuable information, and allows the rest to spill through. Community based rating systems, such as Slashdot’s “moderator points” system are likely to be useful in solving this problem, although it really calls for more than a simple score. For example, an announcement of an upcoming meeting may be very important at the time, but have little permanent value. A more specific rating system is probably called for, which tells why a post is important as well as how important it is. An RDF-based representation might be appropriate for this purpose.
Technical hurdles Internet bandwidth, server uptime, and data storage capacity are the primary physical costs of maintaining a large online archive of free design data, and if the data is to remain free, it is counter-productive to recover this cost through charging patrons directly for access to it. Fortunately, there are two existing solutions for these problems.
Sourceforge originally maintained all of its own download servers, but as the site grew, it had to find a way to scale. Their solution is shown here, with a series of commercial mirror sites providing bandwidth, and of course, getting a small banner ad in return. People who use this service are likely to appreciate the companies’ direct contribution of bandwidth to their needs, so this is a very positive kind of advertisement Conventional mirroring The older technique, as demonstrated by Sourceforge is to simply have “big pipes” and provide for the necessary bandwidth. When the bandwidth gets too high, the site can recruit mirrors. Sourceforge attracts sponsors in this way, who use the opportunity to advertise to users (see figure), who, seeing the immediate benefit of the sponsorship are likely to be very positively influenced by the ads. Swarming downloads and peer-to-peer A more recent development is the use of peer-to-peer networks and so-called “swarming downloads” which use the internet in a much more distributed way. In this model, patrons effectively pay for their own download bandwidth via their local ISPs, rather than burdening the server. The cost is so distributed, however, that it is not noticeable. This system is exemplified by Bit Torrent [14], which allows a file to be “shared” to a peer-to-peer network from a “seed” site which takes the place of the conventional FTP server. This system scales particularly well,
66
Discovering the future, recovering the past
Issue 11 because it shows the highest gain for the packages with the highest demand. Encouraging the growth of a free design community will involve making existing data more available as much as making more designs Torrent feeds require special clients however, so they are not yet ubiquitous. Therefore, it is very likely that an archive will have to provide both methods, though it seems desirable to find ways to encourage the peer-to-peer method.
A “swarming download” system, like BitTorrent solves this bandwidth scaling problem in a different, more community-based way. Rather than relying on a few suppliers with “big pipes”, the swarming downloads system creates a peer-to-peer (P2P) network, moderated by a controlling or “seed” site, which only has to supply comparatively few feeds of data to client computers, which then aid in the dissemination process by serving their piece of the data to the other requesting clients. In this way, swarming downloads are most efficient for data that is most widely requested, so they scale very well (an obvious objection is that some clients may be modified to “leech” or not serve data, but BitTorrent provides a simple “market” method of resolving this problem—good citizens are rewarded with better bandwidth)
Free design sources There are already a number of sources for free design data, so encouraging the growth of a free design community will involve making existing data more available as much as making more designs. Furthermore, since new designs build on old ones, building a good archive of design data is important to new innovation as well as to end users. Government projects Perhaps the most obvious source of public good works are public agencies. Under United States’ law, any work which is done completely by government employees is automatically in the public domain. This includes much work of the data developed by such organizations as NASA [15], the Forest Service [16], the USGS [17], DOE [18], USDA [19], and even the DOD [20]. Other countries often have similar rules. In the European Union (EU), public funding may require publication of results under a free license, for example. NASA, obviously of particular importance to our project, already provides some online access to search their documents [21], although many of them are not yet digitally imaged. So, it may be necessary to pay document processing fees to access the full text of the documents. One of the desirable possibilities for our community based project, would be to begin effectively mining these resources and making them more accessible to the free design community.
Discovering the future, recovering the past
67
Issue 11
A recent search for a NASA contractor’s report turned up an abstract, a price code (A02) for the document, and a link to this PDF pricelist (the document is not proprietary, this is a document-processing fee). If I knew I needed this document, or were I a contractor with plenty of money to spend on library research, this document processing fee would not be prohibitive. But a casually interested space enthusiast will never be inspired by it to contribute to a community-based development project. Imaging such documents and getting them into a searchable online form is an important project for anyone who wants to spur future innovation based on them Community based projects There is an increasing body of hardware development that is managed in community collaborative websites, such as the Open Cores project [22], which works on integrated circuit “IP Cores”. These are relocatable elements of IC chips which can be used in large “Application Specific Integrated Circuits” (ASIC) and are therefore obvious candidates for creating commodity reusable designs. Among the projects successes are free versions of all the major simple gate chips (e.g. 7400 series) and complex projects such as RISC CPUs and micro-controllers. These are all critical areas of development, if we want to see “completely free” designs, since computer control systems are an important part of so many advanced hardware projects. All of the progress in launch vehicles, spacecraft, and spacesuits, developed by NASA during the 1960s and 1970s that got us to the moon and built the reusable Space Shuttle, is now in the public domain These technologies are early adopters of a free collaboration environment because the technologies lend themselves to software collaboration tools, because the people doing the work have seen successful free software projects, and because the complex designs benefit significantly from the kind of collaborative testing and development that goes into software.
Open hardware, like this FPGA “softcore” single board computer from SSV Embedded Systems (middle) [23], is becoming increasingly popular. There are both industry releases, such as Sun’s recent decision to go open hardware with its new SPARC T1 processor [24], and community-based production projects, like Open Cores, which has a wide variety of “IP Cores” or hardware designs which may be combined to master integrated circuit chips
68
Discovering the future, recovering the past
Issue 11 Industry commoditization Perhaps the most surprising trend has been initiated by electronics and computer manufacturing companies, who have decided to free the design of older model hardware. This has been done in order to provide a “future proofing” value proposition to customers, or simply to develop goodwill, especially among customers who already see the benefit of using free software such as embedded Linux systems. There are also a few high-profile cases, such as Sun Microsystem’s recent decision to offer the Verilog source code and other design information for the UltraSPARC T1 CPU under the GPL [24]. This move is presumably meant to bolster Sun’s hardware platform as a “commodity” design, just like the enormously successful Intel architecture machines. A rich public domain It is startling to think that all of the progress in launch vehicles, spacecraft, and spacesuits, developed by NASA during the 1960s and 1970s that got us to the moon and built the reusable Space Shuttle, is now in the public domain, regardless of whether it was developed by government agencies or contractors. However, patents, unlike copyrights, have relatively short durations of 20 years or less in most countries (including the US), so anything developed before 1986 is effectively “fair game” at this point. This data is old, and there are in many cases smarter, more modern ways to design new equipment, based mainly on improvements in computerized micro-controllers and materials science. Nevertheless, the older designs are often an excellent starting place. For example, the requirements and industrial materials available for the creation of spacesuits have not changed significantly since 1970, and most of that data is already available to the public domain, even if the sources on the subject matter remain somewhat inaccessible. The primary need, therefore, is to get that information into a more usable form through document imaging, text extraction [25], metadata tagging, and cataloging. It’s important for a major free design project to embrace the existing library standards and institutions
Much of the design data for developing a future in space is already available under free licensed or public domain terms, either because of government funding, or patent expiration. This set of illustrations from an Apollo procedures manual (which is available online [26]) gives a taste of what is available. Unfortunately, much of this data is still only available in hard copies in only a few places in the world. The process of digitally imaging and extracting, or adding metadata to make it searchable, is an enormous project. But, it is one which is increasingly possible, given the availability of community-based production, artificial intelligence tools, an interested community, and cooperation from the present custodians of the data
Bricks and mortar Even today, libraries reach many more people than the internet, and have a more direct impact on many more. Technology users, who are not primarily in computer science fields, are not as well represented online, and they include many of the people we are interested in, both as developers and consumers of new free design. There’s also the possibility of bringing people to the free design community via internet-connected computers
Discovering the future, recovering the past
69
Issue 11 in libraries. So, it’s important for a major free design project to embrace the existing library standards and institutions, particularly if the project wants to appeal to a broad audience. What we should do is provide a “library interface” that allows such an archive to act like an ordinary brick and mortar library as well as an internet resource.
Even today, when card catalogs are becoming a thing of the past, books are not obsolete, and neither are libraries. The library network reaches many more people than does the internet alone. A truly effective free-design archive should strive to cooperate as much as possible with existing brick-and-mortar library systems, by leveraging such hooks as “Interlibrary Loan” [27] and making information usable from kiosk-type systems in libraries. (Joe Crawford, Wikimedia Commons (CC-By)) Imagine this scenario: a library patron in a far away library would be able to search the archive via their own library’s OPAC or website. The archived materials would appear as books in a remote library collection. Using the Interlibrary Loan mechanism [27], the patron could then request the “book” from the librarian, who would then request it from the archive. The patron would pay the cost to have the book delivered, based on processing fees. Using appropriate print-on-demand technology, the book is printed digitally and sent to the library. The book might then belong to the patron, or become part of the local library’s collection. This scenario would require a number of individual technology problems to be solved, but none is a show-stopper. The FRBR provides an interface to the OPAC system (MARC records can be generated). There is apparently nothing stopping an electronic archive from joining an interlibrary loan organization. Systems developed for free software documentation have been developed to automate document preparation. Print-on-demand service has become a viable business model [28], with a number of vendors providing the service; and finally, the electronic commerce and shipping industries are entirely capable of handling the transaction fees and shipping. It’s not enough to innovate. We must also remember what we innovated and forget the irrelevant details so they don’t pollute the ocean of information Joining a library association is also a good idea politically. Librarians are perceived as a mild-mannered group, but they can be fierce in the protection of free speech and free expression rights. There is clearly a lot to be gained by the internet community at large, community-based information production projects, and library associations joining together as defenders of the free interchange of knowledge.
Libraries of the future It’s not enough to innovate. We must also remember what we innovated and forget the irrelevant details so they don’t pollute the ocean of information our data must be found in. Accurate metadata, achieved by combining a variety of different methods, based on the most-reliable sources for each, is essential to ensuring the long-term accessibility of the data we need. There is already a substantial volume of free design data in existence, from community, industry, academic, and government sources, but it is often underutilized because of short-falls in document imaging and recognition, and (most importantly) metadata tagging. Twenty-first
70
Discovering the future, recovering the past
Issue 11 century developments in artificial intelligence and community-based technologies are making it possible to construct means of solving the technical problems, though. So, this puts us in a good position to start building the digital design libraries of the future.
Notes and resources [1] Online Public Access Catalog (http://en.wikipedia.org/wiki/OPAC) [2] MAchine Readable Cataloging (http://www.loc.gov/marc) [3] Functional Requirements for Bibliographic Referencing (http://www.ifla.org/VII/s13/frbr/frbr.htm) [4] Dublin Core (http://dublincore.org) initiative [5] Trove (http://sourceforge.net/softwaremap/trove_list.php) categorization system [6] Anglo-American Cataloging Rules (http://www.collectionscanada.ca/jsc) [7] Cory Doctorow Metacrap (http://www.well.com/~doctorow/metacrap.htm) [8] Jim Giles Internet encyclopaedias go head to head (http://www.nature.com/news/2005/051212/full/438900a.html), Nature, 2005 [9] SmartDJ (http://rudd-o.com/projects/smart-dj) [10] imgSeek (http://www.imgseek.net) [11] Resource Description Framework (http://www.w3.org/RDF) [12] Semantic Web (http://www.semanticweb.org) [13] IkeWiki (http://ikewiki.salzburgresearch.at) [14] Bit Torrent (http://www.bittorrent.com) [15] US National Aeronautics and Space Administration (http://www.nasa.gov) [16] US Forest Service (http://www.fs.fed.us) [17] US Geological Survey (http://www.usgs.gov) [18] US Department of Energy (http://www.energy.gov) [19] US Department of Agriculture (http://www.usda.gov) [20] US Department of Defense (http://www.defenselink.mil) [21] NASA Technical Report Service (http://ntrs.nasa.gov) [22] Open Cores (http://www.opencores.org) [23] SSVâ&#x20AC;&#x2122;s DIL/NetPC ADNP/ESC1 (http://www.dilnetpc.com/dnp0046.htm) Single-Board Computer (SBC) [24] OpenSPARC (http://www.sun.com/processors/opensparc) [25] Optical Character Recognition (http://software.newsforge.com/article.pl?sid=05/12/15/1848236) [26] Apollo Apollo Extravehicular mobility unit. Volume 1: System description (http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19730064705_1973064705.pdf)
Discovering the future, recovering the past
71
Issue 11 [27] Interlibrary Loan (http://en.wikipedia.org/wiki/Interlibrary_loan) [28] Print on Demand (http://en.wikipedia.org/wiki/Print_On_Demand), e.g.Lulu (http://www.lulu.com/)
Biography Terry Hancock (/user/5" title="View user profile.): Terry Hancock is co-owner and technical officer of Anansi Spaceworks (http://www.anansispaceworks.com/), dedicated to the application of free software methods to the development of space.
Copyright information This article is made available under the "Attribution-Sharealike" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-sa/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/free_matter_economy_5
Published on Free Software Magazine (http://www.freesoftwaremagazine.com)
72
Discovering the future, recovering the past
The day my father blew himself up Open standards, free software, and old documents By Anthony Taylor The Commonwealth of Massachusetts is the visible front of the current standards battle royale: in this corner, at 220 pounds, Open Document Format (ODF)! In the other corner, the 800 pound gorilla, Microsoft Office 12 XML format! Hopefully, we won’t get caught in the explosion.
The day my father blew himself up I was four years old the day of the explosion. I’d like to say I remember it well, but I don’t; I don’t remember my mother’s fear, or the excitement or terror. Sometimes I think I remember my father’s absence, or staying with Grandpa while Dad was away, but I can’t be sure of those memories. The older I get, the surer I am I invented a lot of my own history. This is all true. Dad recalls the explosion with great clarity. It starts with a drill, a drill designed to bite holes into solid rock. The drills were big machines, driven by air. Each drill drove a shaft of steel with a ten-pound bit on the end. As the steel made its way into the rock, the driller added another ten-foot section of steel. After much noise and dust and physical labor, the driller had made a thirty-foot hole down into solid rock. Dozens of holes made up a pit, named for the large gap in the rock left behind after the explosion turned solid rock into gravel, and the gravel was turned into road. After drilling this particular pit, the crew fed the explosives down the holes. In one hole, Dad fed a cardboard-wrapped tube of explosive, but it didn’t slide to the bottom of the hole. He dropped another tube on top the first one, hoping to knock the first tube loose. It failed. The two tubes of powder did their job as they exploded, breaking up solid rock and shooting brand-new jagged-edged gravel like shrapnel into the air, into my father’s head, into part of his brain On June 18th, 1971, it was standard practice to use a wooden pole to unblock a stuck hole. They kept such poles handy. Dad prodded the stuck explosives. They did not break free. Dad tells me, “Some folks would use the drill to ream out a clogged hole. The bit would just eat right through the powder. You lost the powder, but saved the hole.” As the holes were drilled in patterns designed to break the solid rock into gravel, each hole was important. Sheer muscle was not going to open the hole. Dad attached the wooden pole to his drill, and used its might to push the powder down the hole. The two tubes of powder did their job as they exploded, breaking up solid rock and shooting brand-new jagged-edged gravel like shrapnel into the air, into my father’s head, into part of his brain. “I was following a common procedure,” Dad says to me. “These days the procedure’s a bit different.” I can only imagine.
The importance of being standard Standards exist for many reasons: to provide uniformity, to outline a best practice, to facilitate the sharing of information. In the computer world, the sharing of information is of paramount importance. Without acceptable standards outlining methods of information sharing, computing as we know it would not exist. If processing power is the heart of computing, information is its soul. Without information, computers are merely the dry bones of a useless technology.
The day my father blew himself up
73
Issue 11 Information has economic and social worth only to the extent that it is both useful and available. A useful piece of information known to only a few can benefit only those few; worthless information known to everyone helps no-one. Beyond that, the worth of information is not universal. The fact that a wooden pole can be used to set off explosives does me very little good, but would have been quite valuable to my father. If we are to make full use of computers, we must facilitate the sharing of information. Even the slightest inhibitor to sharing will reduce the effectiveness and eventual economic worth of our information. Procedural standards such as the one with which Dad blew himself up are used to proscribe a safe, acceptable practice. These standards are inherently different from information-sharing standards; however, the lesson learned the day of my father’s accident are still valid.
Drilling right-of-way in Southeast Alaska Not everything that is labelled a standard is safe. Sometimes the cost of following a standard is higher than we might imagine. Dad says to me, “DuPont claimed there was no way a wooden pole could set off that powder. They didn’t believe me until they went out to the pit and saw the pole in the middle of the crater.”
The first standard Some standards seem almost axiomatic. ASCII is perhaps the best-known of all computer standards, one of the oldest, and one we take for granted. The most fundamental aspect of information sharing is the representation of the building blocks of information. In the early 1960s, that meant choosing a method to encode individual characters. Until that time, there was no universal standard for sharing information between computers. And now, a history lesson: Alfred Vail invented Morse code before 1844. This was one of the first electronic character encoding schemes, and certainly the first to gain widespread acceptance. As telegraphy equipment evolved, so did the encoding schemes—from Baudot’s code thirty years later, through Murray’s code around the turn of the century, to ITA2 in the 1930s and the U.S. Army’s FIELDATA in the late 1950s. Each of these codes contributed to the development of serial data communication by providing an encoding standard for the Roman alphabet, along with transmission control codes. [1] By 1963, the American Standards Association produced a new character encoding format, the American Standard Code for Information Interchange (ASCII). The X3.4 committee, which produced the ASCII-1963 standard, was composed of representatives from the computing industry, including AT&T and IBM. Virtually every computer today uses ASCII
74
Open standards, free software, and old documents
Issue 11 ASCII is a 7-bit (not 8-bit, as is often assumed) encoding scheme, based on the serial communications encoding schemes that came before. The telegraphy coding solutions from the prior 100 years of work provided the solution to an emerging computer problem. About the same time, in 1963 through 1964, IBM developed the Extended Binary Coded Decimal Interchange Code (EBCDIC), an 8-bit encoding scheme, based on the Binary Coded Decimal (BCD) scheme used in most IBM computers at the time. EBCDIC was designed to facilitate punch card codes, which was important at the time. Some versions of the brand-new IBM S/360 had no operating system, and loaded specialized programs at system startup, via punch cards. Although an X3.4 committee participant, IBM eschewed the use of ASCII in favor of EBCDIC for many years. At the launch of the IBM S/360, IBM had few ASCII peripherals, and many EBCDIC peripherals; so, IBM chose EBCDIC for their peripheral communication standard. The huge success of the S/360 further slowed IBM’s move to ASCII peripherals. Eventually, competitors also created and sold EBCDIC peripherals, entirely to support IBM’s S/360 (and, later, S/370 and S/390) mainframe installations. More recently, both Fujitsu-Siemens (with BS2000/OSD) and HP (with MPE) adopted EBCDIC. Virtually every other computer today uses ASCII. Character codes: the future ASCII has proven robust and simple, but it is limited to the Roman character set, and so is unsuitable for today’s international computing environment. A new standard is emerging for data communications: Unicode. International in scope and unencumbered by restrictions on its use, Unicode is quickly becoming the accepted standard for internationalization and localization of computer software.
Blood-stained eye Blown back in the explosion, Dad realized two things: first, he was the one who knew first aid; second, he wasn’t breathing. So, he couldn’t tell Kenny how to get him breathing again. The standard operating procedure of the day required the pit boss to know basic first aid; no other member of the crew required first aid training. Valuable information was kept solely by one person, to be turned worthless in a single explosion. “I couldn’t think of any other way to tell Kenny what to do,” Dad tells me, “so I started breathing again.” Then he says, “I could feel rocks rolling down my throat.” He couldn’t open his eyes, but he heard the voices around him, heard the fear. When they talked of calling in a helicopter to transport him out, Dad knew he wouldn’t fit in the bubble. He imagined himself strapped to the skid, imagined the wind blowing down over the wound in his head. “No helicopters,” he calmly told them. “Drive me into camp, and call a plane.” At the time, Thorne Bay was simply a logging camp, semi-permanent and small. There were no hospitals on Prince of Wales Island. The closest medical facility was in Ketchikan, 65 miles away, on a different island. Dad tells me, “We got into camp. It was your grandfather’s birthday; that’s how I remember the date. I told Kessler not to touch me.” Kessler said, “But I have to clean you up, Gary.” “Leave him alone,” Granddad said. “Just don’t touch him.” They drove him down to the dock then, and put him on the float plane. Thirty minutes later he was loaded into the back of an ambulance.
Open standards, free software, and old documents
75
Issue 11 “I was awake for everything,” Dad says. “I remember they put me in the ambulance with my head facing the back.” They gunned the engine, and raced for the hospital, up a steep hill. “They hit that hill, and I felt the blood rush up to my head.” There was a quick sharp pain in his right eye. “I felt the blood vessel pop right then. The hemoglobin stained the retina, and I haven’t been able to see out of that eye since.”
Networks of Babel In 1969, computer networks were small, custom-built systems, used mostly to distribute terminals around campuses. That year saw the founding of ARPANet, a project intended to provide inter-computer communication across the United States. By the end of 1969, ARPANet boasts four nodes. The ARPANet project eventually produced the protocols and standards that provide the bones and ligaments of the internet, but was considered simply an “academic” platform for the next two decades. In 1983, Novell produced the first business-oriented, PC-based local area network (LAN). Based on the IPX protocol, Novell’s Netware product became the dominant business networking software in the mid- to late1980s. IPX itself was based on the Xerox Network Services (XNS) protocol. Also in 1983, Sytec Inc. developed IBM’s network protocol, NetBIOS and NetBEUI. NetBIOS handled high-level session-oriented tasks such as computer name resolution; NetBEUI was designed to exchange packets of information, similar to IPX. Neither IPX nor NetBEUI were designed for wide-area networks such as the internet. In fact, NetBEUI was not designed to be routable at all. Today, the internet has about 375,000,000 hosts, every single one of which runs TCP/IP Microsoft adopted NetBIOS over NetBEUI as their networking standard in 1985, with the MS-Net and MS LAN Manager products. For a decade, there were more computers running either IPX or NetBEUI than any other protocol. The fight for dominance between them heated up, with Microsoft determined to replace Novell as the dominant supplier of networking software.
A driller and his chuck tender aren’t wearing hard hats MS-Windows NT 3.1 was released in 1993, and directly challenged Novell’s Netware server product. Both NT 3.1 and NT 3.5 installed IPX as the default transport protocol for NetBIOS. Twenty years before, in the last month of 1974, Vint Cerf, Yogen Dalal, and Carl Sunshine released Request for Comment (RFC) 675, “Specification of Internet Transmission Control Program.” Over the next six years, TCP developed into two separate protocols: IP and TCP. These standards, introduced in RFCs, were developed in an open fashion over the course of many years.
76
Open standards, free software, and old documents
Issue 11 The most recent RFCs for TCP/IP are RFC-791 (IP) and RFC-793 (TCP). At the beginning of 1991, the internet consisted of about 375,000 hosts. 1991 was the year everything changed. 1991 was the year of the World Wide Web. Today, the internet has about 375,000,000 hosts, every single one of which runs TCP/IP. How did that happen? In 1991, most businesses were using either IPX or NetBEUI for networking, both of which were designed and deployed for business. Today, IPX is almost dead, and NetBEUI is a faint memory even among us old-timers. The answer is, like most answers to simple questions, very complex. Partly, the internet was itself a unique beast, a network-of-networks allowing cheap and instantaneous communications across the world. Partly, the World Wide Web gave muscle and skin to the skeleton of the internet, providing an easy and rich means of grabbing and providing information. Mostly, though, TCP/IP was a well-designed standard that was open for implementation. No one company held the keys, no one company had an advantage over any other. With the release of MS-Windows NT 3.51 in 1995, Microsoft switched the default NetBIOS transport protocol from IPX to TCP/IP. Novell switched from IPX to TCP/IP with the release of Netware 5.0, in 1998. Even among the business LAN giants, TCP/IP (and open standards) won out.
The battle that wasnâ&#x20AC;&#x2122;t The internet was growing tremendously before Sir Tim Berners-Lee gave us the World Wide Web, but nothing short of the internet itself is a greater success than the Web. In a time when private networks like AOL and Compuserve were controlling access to information, the Web was designed to release control. Berners-Lee developed the first HTTP server while at CERN. He also designed the hypertext markup language (HTML), and developed a simple text-only client. He released his code to the public, via the internet. Tellingly, he used two open standards in his work: TCP/IP for the transport protocol, and ASCII for the character encoding. He could very well have made different choices, considering IPX was the most-used networking transport protocol (though not at CERN), and most document formats used binary codes for document markup and layout. The commercial precursors to the modern internet used proprietary access methods, and gave the public very little ability to provide information. AOL, Compuserve, Delphi, Prodigy, Genie, and a slew of others all had their own access methods and on-line protocols. Each was an island of information, generally exchanging only email. Delphi became the first major online service to allow full access to the internet. Over the next few years, every other surviving online provider followed suit. This shift from proprietary service to internet service provider was a result of the growing media coverage of the internet, especially the attention given to the World Wide Web. Without open and freely-implemented communications standards, the Web would not exist as it does today In 1993, the National Center for Supercomputing Applications (NCSA) released the Mosaic web browser. Mosaic provided support for in-line images and other multimedia, greatly influencing the HTML specification. It soon became obvious HTML needed standards oversight to curtail the use of non-standard markup tags. The Internet Engineering Task Force (IETF) released the first HTML specification working draft in June 1993. No standard was released until November 1995, however, with the publication of IETF RFC 1866.
Open standards, free software, and old documents
77
Issue 11 By this time, Berners-Lee had founded the World Wide Web Consortium (W3C). They released their first HTML standard in January of 1997, for HTML 3.2. There was no real battle for the Web standards. A few skirmishes broke out in the early days, especially during the early days of Microsoft’s Internet Explorer, but there was no real battle. Although different browsers implement the W3C standards with varying degrees of success, HTML and HTTP have proved extremely resilient to nonstandard modification, mostly due to the early open standardization efforts. Without open and freely-implemented communications standards, the Web would not exist as it does today. The Web is arguably more responsible for the wide-spread adoption of home computers than any other factor. Many businesses exist solely as a result of the Web. Open standards increased one market, and created other markets wholecloth. This is important.
The lobotomy effect Speaking of his eye, Dad says, “I don’t notice it anymore. I just can’t see out of the one eye.” The medical facility in Ketchikan was inadequate. Tiny rocks had pierced his skull above his right eye, and the closest neurosurgeon was in Seattle. Dad was on the next plane South. The surgery they performed was similar to the partial lobotomies they used to give violent criminals. A small part of Dad’s skull above his right eye was cut away. They removed the damaged portion of the brain, and wired the square of skull back into place. Simple as that. I’m told my father is much mellower since the surgery, a lot less quick to anger. I don’t remember much about pre-explosion Dad. I do remember him working rocks out from under the skin of his forehead for years. But in any case, I imagine being blown up changes a person.
A note on control The free flow of information is just that: free. Free of cost, free of regulation, free of control. There is very little money to be made from information if it is all freely available. A company that wishes to make money must either provide some other service, such as searching or organization, or create an information bottleneck, some sort of roadblock in the otherwise free flow. The only way to introduce a roadblock is to control access to information. Before the internet, this was done by controlling the distribution channels of the physical media on which the information was imprinted. Since the advent of the internet, and the open standards on which it is based, the distribution channel is inherently uncontrollable. As a result, corporations wishing to extract money from the flow of information must use existing laws that control “ownership”, or invent new laws that give them the control over the access to information. This assault is currently underway. In the United States, this is accomplished through laws such as the DMCA, and in regulations such as the Broadcast Flag requirements set forth by the FCC (which has been overturned; media companies are currently trying to enact broadcast restrictions as law, rather than as an FCC regulation). Other bills designed to restrict the flow of information are proposed every few months. Some will most likely become law. Other legal avenues are also available. Patents are used to restrict access to specific file formats, allowing the patent holder to extract a fee before allowing access to information stored in that format. One common technique is the “submarine patent”, a patent which is left unenforced on a format until it becomes a de-facto standard, and is then aggressively enforced. This technique was used quite successfully by Unisys and their LZW patent. GIF, introduced in 1987, was the primary graphic format of the early 1990s; it
78
Open standards, free software, and old documents
Issue 11 used LZW compression on images. Although the GIF specification was widely released and known, Unisys waited until December of 1994 to enforce their patent. Forgent Networks is currently threatening the JPG image compression format in the same manner. JPG has been a widely-used format since the early 1990s, and replaced GIF as the primary image format on the Web. Software patents provide one more means of controlling access to information. They are the tool of choice for the internet highwayman.
The new old battlefront Standards are most important when information must be shared with others. Without an open, neutral, unencumbered specification, there are artificial roadblocks in the simple sharing of information. These roadblocks interfere with the free flow of information, decreasing both the economic and social benefits of that information. Recently, the Information Technology Department (ITD) of the Commonwealth of Massachusetts released its Enterprise Technical Reference Model (ETRM). The ETRM covered only the executive branch of the Massachusetts government. Version 3.5 of the ETRM required all documents created by the executive branch to use the Open Document Format (ODF), an open and enencumbered specification that has been submitted to both the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC) for ratification as an officially-recognized publicly-available standard (PAS). As of November 25, 2005, the Commonwealth of Massachusetts is undergoing a political debate concerning the adoption of ODF, versus Microsoft’s Office XML file format. Many consider Microsoft’s format “open enough”. Others claim it is the de-facto standard, and as such deserves the honor of becoming Massachusetts’ primary document format. What is “open enough”? Is it when other commercial vendors may license the format from Microsoft, but free software cannot? Or is openness achieved only when anyone may implement the standard in any fashion, at any time? Eric Kriss, Secretary of Administration and Finance of the Commonwealth of Massachusetts, has stated the goal of using an open format was to ensure sovereignty. Sovereignty is the fundamental (and perhaps most important) issue. While the public does not directly control ODF, we are able to provide input and feedback in the future development of the standard. As Microsoft controls future MS-Office formats, the public has no control whatsoever. ODF allows free, unfettered implementation, by anyone, at any time, for any purpose. Microsoft’s XML format is potentially encumbered by Microsoft-owned patents, and is certainly encumbered by a license that shuts out free software developers. Which format best meets the goal of sovereignty? I believe there are also pragmatic reasons to adopt open standards. At the core, open communication standards ensure the ability to communicate seamlessly and effortlessly. Open standards promote competition, which contributes to both the economy and further advances in computing. Information encoded using an open standard today will still be available two decades from now. This is not true of proprietary, closed formats. First, no real competition is possible, as one corporation controls the format. Secondly, as the format is not open, nor openly-published, future compatibility is not guaranteed. I have documents written in IBM Works for OS/2; I am able to access them only because I know how to extract readable ASCII characters from a binary document. Documents written in Microsoft Works in 1993 are similarly difficult to open. Governments especially require document longevity. What if the Declaration of Independence had been written in Microsoft Works RE (Revolutionary Edition)?
Open standards, free software, and old documents
79
Issue 11
The sound of inevitability Practices changed after my father’s explosion. Everyone on the crew was required to know first aid. They no longer prodded explosives with wooden poles. And so on. Microsoft’s resistance to the Open Document Format is understandable. If everyone is able to freely exchange information written in productivity software from any vendor, there is no MS-Office lock-in. There is no more loss of document layout when converting from one format to another. There is only a single, agreed-upon format, and the final layout is dependent solely upon the quality of the vendor’s implementation. I believe we can learn from history. I believe historically, free, unencumbered standards win out over proprietary specifications in almost all cases. I believe it is all but inevitable. I mention a few such cases, some contentious, and some not. There are other cases, such as IBM’s failed attempt to regain control of the PC market with their proprietary Micro Channel Architecture bus, or Microsoft’s attempt to use ActiveX to take control of the web. I won’t even mention Macromedia Flash. The explosion is happening around us, this very day. For many years proprietary document formats have interfered with the uninhibited exchange of data. That problem will only grow worse, and the solution is not found in a single product. Products come and go, and even Microsoft Office does not use a single document standard. Each version of MS-Office uses a new, incompatible document format. When the shockwave has passed, and we pick the grit out of our scalps, I believe we will do what we have always done from the earliest days of computing: we will use an open, freely implementable standard. This is as inevitable as spam. Eventually, like ASCII, most of us will forget there was anything else.
Notes and resources [1] Tom Jennings, “ASCII: American Standard Code for Information Infiltration” (http://www.wps.com/projects/codes/)
Biography Anthony Taylor (/user/9" title="View user profile.): Tony Taylor was born, causing his mother great discomfort, and has lived his life ever since. He expects to die some day. Until that day, he hopes to continue writing, and living out his childhood dream of being a geek.
Copyright information This article is made available under the "Attribution-Sharealike" Creative Commons License 2.5 available from http://creativecommons.org/licenses/by-sa/2.5/. Source URL: http://www.freesoftwaremagazine.com/articles/standards_battleground
80
Open standards, free software, and old documents