...making Linux just a little more fun!

January 2005 (#110):


The Front Page

By Heather Stern

Happy Tux holding a plush Tux

Heather is Linux Gazette's Technical Editor and The Answer Gang's Editor Gal.


[BIO] Heather got started in computing before she quite got started learning English. By 8 she was a happy programmer, by 15 the system administrator for the home... Dad had finally broken down and gotten one of those personal computers, only to find it needed regular care and feeding like any other pet. Except it wasn't a Pet: it was one of those brands we find most everywhere today...

Heather is a hardware agnostic, but has spent more hours as a tech in Windows related tech support than most people have spent with their computers. (Got the pin, got the Jacket, got about a zillion T-shirts.) When she discovered Linux in 1993, it wasn't long before the home systems ran Linux regardless of what was in use at work.

By 1995 she was training others in using Linux - and in charge of all the "strange systems" at a (then) 90 million dollar company. Moving onwards, it's safe to say, Linux has been an excellent companion and breadwinner... She took over the HTML editing for "The Answer Guy" in issue 28, and has been slowly improving the preprocessing scripts she uses ever since.

Here's an autobiographical filksong she wrote called The Programmer's Daughter.

Copyright © 2005, Heather Stern. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

The Mailbag


HELP WANTED : Article Ideas
Submit comments about articles, or articles themselves (after reading our guidelines) to The Editors of Linux Gazette, and technical answers and tips about Linux to The Answer Gang.


Linux boots from RAMdisk,

Tue, 23 Nov 2004 20:57:34 -0500
keesan (keesan from cyberspace.org)

ASUS P5A-B motherboard with AMD-K6-2 300MHz cpu. Other people report assorted linux boot problems with this board and other ASUS boards.

I can boot my version of linux (Basixlinux 2, based on Slackware 7.1, or Basiclinux 3 with the SW71 kernel but libc5) from a 2-floppy lilo-boot version that uses RAMdisk, a loadlin-boot RAMdisk version, a loop version, or SW4.0 zipslack (UMSDOS). But if I try to boot BL2 or BL3 with loadlin from a hard drive installation, with the kernels compiled for them or with bare.i Slackware kernel, the boot process stops at the lines:

Linux NET4.0 for Linux 2.2
Based upon Swansea...
Net4:  Unix domain sockets 1.0 for Linux NET4.0

(The Basiclinux kernel gets me two lines further along to something about TCP).

I tried starting with FreeDOS, DR-DOS, and Win98 DOS (since I have three other computers that will boot linux with loadlin from Win9X DOS but not always from the others, and one that will boot loop linux from any DOS except Win9X). I do not have a hard drive version set up to boot with lilo. Is that likelier to work? I don't want to use lilo as I work in DOS more of the time.

I tried telling CMOS that there was no second drive because someone suggested that method to get linux to recognize a larger drive, but my drive is 3GB. I have DOS on a master drive and two linux partitions on the slave drive, with one linux in each, and RAMdisk and loop versions in DOS partitions.

I am able to mount the linux partitions when running from the RAMdisk or loop versions and then switch to run linux on them:

mount /dev/hdb1 /mnt
chroot /mnt

This puts hdb1 on / and I can then use linux on the ext2 partition.

[Kapil] But this is essentially what most initrd-based start up procedures do anyway! So, though I haven't used BasixLinux, I would guess that the problem is with the start scripts on your ext2 partition in /etc/rcS.d or some such.

This is a minor nuisance and I suppose I could put it in an rc file, or just use the smaller version unless I needed the larger one.

I am writing out of curiosity - why are so many computers difficult to boot with linux?

[Kapil] The glass could also be half full! Given the variety of hardware that Linux runs on it is surprising that so many computers boot with it at all. :-)

Is there a better fix for this one? Is there a better fix for the other three besides installing Win98 DOS on them (and having to use a boot floppy to defragment the DOS partitions after that) or rebooting with a Win98 boot disk to go from DOS to linux?

I also have one Northgate 386 SX 20MHz 4.7MB RAM laptop which has no cursor in linux. Cirrus video, 256K video RAM, mono VGA. The cursor is plain white when used in color VGA. The computer in theory can output to a color monitor in 800x600 resolution.

[Kapil] Is this with or without X? The question is not clear enough. Are you in graphics mode or text mode?

Does laptop video treat software cursors oddly? A cursor appears when I use a text editor. There is a cursor while booting to DOS and in DOS.

Another 386 with identical speed, RAM and video won't boot linux at all - the screen goes black and I need to reboot. What might cause this problem?

[Kapil] Try booting with the additional option "vesafb=off". Some of the older hardware may not respond well to being switched to graphic mode.

Thanks for your help a couple of years ago getting my first linux set up
to work with both TTL and VGA monitors.

On behalf of The Answer Gang, you're welcome... (/me turns to our Gentle Readers) and anyone among our readership who'd like to jump in on the problem (our header does say "...and You!" after all) is welcome to send replies to you, and encouraged to Cc: tag (The Answer Gang) at linuxgazette.net. -- Heather


Python conferences in the US and Europe

Sat Dec 18 16:26:34 2004
Mike Orr (LG Contributing Editor)
Mike sent this to his local Python user group, and to our Answer Gang. I think it's an interesting question, one all you pythonistas out there might be willing to express an opinion about. Reply to tag@lists.linuxgazette.net; Mike will let his pal know if we get some reasonable statistics, and juicy replies may end up in a future mailbag. -- Heather

I got an interesting call from a friend of mine, a PyCon regular who, as it turns out, lives in Sweden. There's been a discussion on the PyCon list about whether the $175 conference fee is too high, too low, or just right. That got her asking me what would it take to get more Americans to present a talk at EuroPython (in Sweden next July -- http://www.europython.org) and Python UK (in England next April -- http://www.accu.org/conference), and more Europeans to PyCon (in Washington DC next April -- http://pycon.org). I thought I'd throw the question out to y'all for ideas. Not everyone here is interested in Python, but the same thing applies to Linux and other free software projects.

She said that she could guess why why not many American presenters would go to Europe, but she wanted to ask somebody on this side of the pond in case there were factors she wasn't aware of. I said the main problem for Americans (besides the expense) is that most people only get two weeks' vacation per year, so they have to use the time selectively. She asked why that was, since in Sweden the minimum is six weeks and most people get nine. I said I don't know, it's just a longstanding tradition. She asked why people don't demand more. I said people are much more concerned about health care, and more vacation time is lower in their priorities.

She said that for her, the main problem with coming to American conferences is the expense. That seems to be outside our control since the conference fee is minimal already, and we can't do anything about airfares or accommodation fees. 'Course the falling dollar will help. :)

As far as I can tell, the most important thing is just to keep these conferences going, so that even if people can't attend next year, maybe they can do the year after, or maybe some overseas people will go to one and others to the next.

Another thing that's happening in the Python world is different kinds of events are emerging. These three are traditional conferences with speakers. In Seattle we've had a couple sprints (=weekend hacking sessions) without speakers, and I gather those are happening in Europe too. So maybe the answer is not just more opportunities for speakers, but more types of events.

Any other ideas?


GENERAL MAIL


Re: your comment suggested an article idea

Sun Dec 12 08:55:47 2004
Ben Okopnik (LG Editor)
Question by Edgar Howell
Edgar Howell is one of our article authors, see http://linuxgazette.net/authors/howell.html for his bio. -- Heather

As you noticed, the use of a wildcard in a command like mount really blew me away. The remark you added to my article compounded it. find, great. less, OK... mount?!

[Ben] [grin] Yeah, pretty amazing. It gets much more amazing when you install and enable "bash_completion"; all the... well, stuff that has multiple options becomes available at the prompt. E.g., typing "ssh " (note the space) and hitting 'Tab' twice shows me a list of all the hosts in my ~/.ssh/known_hosts; typing "mount " and hitting 'Tab' three times (since all the entries start with '/', which is displayed immediately) gives me a list of all the directories listed in "/etc/fstab"... obviously, completion happens when you have a unique string: I've been doing "ssh li<Tab><Enter>" for a session at linuxgazette.net for so long that I'd be lost without it. :)

If you count the couple of years I had used Coherent prior to graduating to SuSE Linux, I've probably been at *nix for 10 years or so. In other words off the steep part of the learning curve, but, boy, is there ever enough curve left!

[Ben] That's the lovely thing about Unix, to me. You keep gaining these chunks of power every time you learn something - and the chunks don't get any smaller with time. It can be a little tough on the ego for the folks who think that way... but to me, it's a fantastic opportunity to squeeze any amount of juice that I may need out of a system. It's not a question of "is it possible" any longer, but "where do I find the HOWTO?" instead.

Anyhoo, I would like to encourage you to do an article on obscure uses of wildcards on the command line.

[Ben] Um. Well... the problem is in defining "obscure". To me, they're not; they're just how shells operate. To someone else, they may well be obscure. Say... maybe looking at it in broader terms would be useful - an article, or even a series on CLI usage in general might be pretty good!
I'm sorta swamped for the moment - and actually "owe" about three articles to myself :) - but that one sounds like a really good idea.

Like ignoring the consequences of SuSE's apparent elimination of the need for mount -- there are still questions in my mind but, then, I bounce back and forth between root and any of several users a lot and may have messed things up -- what would "mount *" do?

[Ben] It would give you an error. :)

Try to mount every /dev? Cycle through /etc/fstab? root can mount stuff not in /etc/fstab. Permissions. Users. Mind-boggling.

[Ben] Essentially, you've answered your own question: "mount *" would just be too ambiguous. E.g., "ssh " or "ssh ben@" is not at all ambiguous: the host name is what has to come after either one of them, and it makes sense that hitting the completion key (Tab) would "complete" them or show the possible options. I assume you know that 'Tab' works to complete program names at the CLI, right? Filenames, too - "vi ~/.bash_p<Tab>" pulls up my "~/.bash_profile" every time.

Keep up the good work

[Ben] Thanks, Edgar! Heck, you might want to write the article yourself: read the Bash man page, and take a look at the "/etc/bash_completion" script. That should give you a good start.


LG #109 - Laundrette

Sun Dec 5 10:23:23 2004
Jimmy O'Regan (The LG Answer Gang)
Question by Mark W. Tomlinson

I had just settled in of a Saturday evening with a wee dram of Irish whiskey, a good Henry Clay cigar and Linux Gazette #109. I had worked my way to "Return of the Linux Laundrette" and reached the section "Re: [LG 87] help wanted #4". This piece caused me to drop my cigar (due to uncontrollable grinning, giggling and guffawing), setting my sweatpants on fire.

http://linuxgazette.net/109/lg_laundrette3.html#nottag2/14 for the terminally lazy :)

I'm fine, thanks - I extinguished the blaze by spilling my libation in my lap - followed, of course, by the water chaser. Be advised that I will be taking legal advice re: financial recovery for the loss of the whiskey...

Well, Ben and I have our own sideline business (http://linuxgazette.net/107/misc/laundrette/lg_hitsquad.html), so I can say with some confidence that it won't come to that, though some recovery may occur at some later date.

I don't know how you people manage to produce such an outstanding combination of useful Linux information, non sequiturs and a, ah, rather <veering> approach to humor (my kind!) - but I certainly hope you keep doing it for a long time to come.

Well, I'll be compiling it for a while to come: it's a lot of fun to go back over the offtopic threads every month, especially since there are so many of them --

Dec 01 08:44:05 <editorgal>     lucky sucker, the recent gang must be a treasure trove for laundrette bits.
Dec 01 08:45:29 <jimregan>      I felt kind of duty bound to take over the laundrette... 
cos most of the time all I do is perpetuate those threads 
[though I should have said 'perpetrate' :) ]
Dec 01 08:45:39 <editorgal>     lol

Sincerely,
Mark W. Tomlinson

Thanks for writing,
Jimmy


Math bug in Advanced Features of netfilter/iptables article

Mon Dec 6 03:59:45 2004
Barry O'Donovan (LG Author)
Question by Rich Price (PRICER from us.panasonic.com)

Hi Rich, all,

Advanced Features of netfilter/iptables by Barry O'Donovan [November 2004 (#10 8)] was a very informative article.

Thanks! It's always good to hear positive feedback.

But my "math flag" flew from my pocket when I saw his example for using the random module.

So did mine on reading the published article. I had actually planned to point it out with an Octave example demonstrating the difference between the right and wrong answer in this months article, but when it came to writing it I discarded the example as it didn't fit with my layout and completely forgot to add it as erratum.

If there is one thing I have learnt about statistics (and I've learnt quite a lot between my degree which was top heavy on stats and my research where I use the damn stuff every day) is that if the answer is simple, then it's just plain wrong!

If you wish to divide the packets evenly among the four servers then the example should look like this:

...............

-A PREROUTING -i eth0 -p tcp --dport 80 -m state --state NEW -m random --average 25 \ -j DNAT --to-destination 192.168.0.5:80
-A PREROUTING -i eth0 -p tcp --dport 80 -m state --state NEW -m random --average 33 \ -j DNAT --to-destination 192.168.0.6:80
-A PREROUTING -i eth0 -p tcp --dport 80 -m state --state NEW -m random --average 50 \ -j DNAT --to-destination 192.168.0.7:80
-A PREROUTING -i eth0 -p tcp --dport 80 -m state --state NEW -j DNAT --to-destination 192.168.0.8:80

...............

The reason is that, after 25% of the packets are NATed by the first rule, only 75% of them will be seen by the second rule. A third of them would equal 25% of the total. Likewise, the third rule will see only half of the total and half of that is 25% of the total.

Correct. A subtle and simple mistake that might cause many a sys-admin a prolonged headache!

When speaking of mistakes and statistics, I'm always reminded of a few quotes:

...............

"There are two kinds of statistics: the kind you look up and the kind you make up."

"I gather, young man, that you wish to be a Member of Parliament. The first lesson that you must learn is, when I call for statistics about the rate of infant mortality, what I want is proof that fewer babies died when I was Prime Minister than when anyone else was Prime Minister. That is a political statistic."

"You know how dumb the average guy is? Well, by definition, half of them are even dumber than that."

"Statistics in the hands of an engineer are like a lamppost to a drunk-they're used more for support than illumination."

"Numbers are like people; torture them enough and they'll tell you anything."

"There are three kinds of lies: lies, damn lies, and statistics."

"A statistician is a man who comes to the rescue of figures that cannot lie for themselves."

"First get your facts; then you can distort them at your leisure."

...............

Ahhhh.... statistics. So easy to love and hate all at once!

Cheers, Barry

P.S. Thanks also to John Macdonald and one of our French translators, Emmanuel Araman, who also pointed this out to me.


GAZETTE MATTERS


Re: Linux Gazette: checking in

Thu, 30 Dec 2004 13:52:39 +0530
Ben Okopnik (ben from linuxgazette.net)

I hadn't sent this to TAG - it was a semi-private query - but, for general info, I was checking in with all our Indian correspondents:

I sent the message out last night; so far, the first five people have responded. My best hopes and wishes go out to the rest, and to all.

[Breen] Thanks for that, Ben. Please let us know as you hear from more of our Indian friends.

I surely will, Breen. So far, we've got Vinayak's name to the five who had responded previously; Sayamindu Dasgupta's address bounced, but I found a phone number for him at http://peacefulaction.org which he listed in his author profile. He's OK; seems he's in Kolkata (West Bengal), and everything is all right there.

Folks, please keep them on your good wishes list or in your prayers, as appropriate. It may be a small thing in the face of something this huge, but... it's something. As Pramode said, "there are still human beings alive who can feel the sorrow in another person's eyes - that's the only consolation."

[Ben] Are you all OK? I'd appreciate a response if you get a chance. I'd imagine that many others here are just as concerned; I think that a lot of people may just be... too stunned by the magnitude of this to come up with a coherent response, and unsure of their own degree of connection to you all. Me, I figure that we're all human beings - and that no man is an island.

My heart goes out to you and all your countrymen in this difficult, terrible time.

[Kapil] Thanks for checking. Yes. It is truly a devastating event here. Relief agencies are doing what they can but every bit counts.

I'm going to be letting people around here (northern Florida) know that they can contribute to the Red Cross/Crescent India, and am going to send a contribution myself. [sigh] Sunil mentioned that there's now another warning out.

[Kapil] The strange aspect of the tragedy is that people in Chennai who were more than about 500 metres from the coast were almost unaware that anything had happened. Since we live somewhat inland we were quite unaffected.

[Nod] Tsunamis are like that. They're slow and quiet, definitely so at first; the traditional way to commit suicide during one is to follow the ocean as it recedes from the shore.

Folks - everyone - imprint this in your brain forever: if you ever see the ocean receding, RUN like hell for the high ground. You at least stand a chance of surviving, then.

[Kapil] P.S. There is no word for "tsunami" in any of the local languages which perhaps gives an idea of how unexpected the event was.
[Vinayak Hegde] You can add me to the list. :)

With great pleasure! I just went through our list of authors, and emailed everyone that was in India; you're just not listed as an author, so no contact info came up. Glad to hear you're OK, too!

[Vinayak Hegde] Thanks. Actually I am listed as a author :) . http://linuxgazette.net/authors/vinayak.html

[blink] Then I simply missed you. Ooops.

[Vinayak Hegde] I live far away from the coast (in Bangalore). We did mobilise help and have donated a lot of clothes/medicines for relief work. Though we are safe in center of the Indian peninsula, we were shocked by the images that were shown on television and splashed on the front pages of the newspapers. I also read that 5 endangered tribes living in the Andaman and Nicobar islands were wiped out forever and a few islands were washed away (literally).

[sigh] Damn. The only thing I'd ever heard about Andaman islanders was the fanciful stuff from Conan Doyle... and now, they're gone. Forever.

Contention from various quarters notwithstanding, this world is not particularly friendly to man. I realize that it does no good to rail against the weather, but... blood and hell, man! This is just appalling.

[Vinayak Hegde] Yeah. It's good to know that I am not the only Sherlock Holmes Fan on this List The Andamani Pymgy had a major role to play in "The Sign of Four". Who could forget the thrilling story?? :)
Link to the "Times of India" article here:
http://www.freerepublic.com/focus/f-news/1309884/posts

Oh, indeed. And what a picture he draws! Reminded me quite a lot of Jack London's "South Sea Tales", or perhaps "Adventure", and his descriptions of the Salomon islanders.

Any news about the latest warning that Sunil mentioned?

[Raj Shekar] Thanks a lot for writing. I am in Delhi, which was quite far from where the tsunami stuck. I will be making a donation to the Prime minister's fund and also write in to the local LUG to see if we can do more than just sitting. One of the members of the mailing list is working with the people who have been hit and has written down the things they need:
https://ssl.cpsr.org/pipermail/india-gii/2004-December/009559.html
  1. Children's clothes in decent form
  2. Medicines - Paracetamol, ORS packets, Doxycycline, Dettol, bandages
  3. Blankets - a few thousands
  4. Gloves & masks to help volunteers clear the debris & dead bodies.
  5. Money - to buy essentials, water pots (which will be bought closer to the areas)
Editor's note: Paracetomol is known as Acetominophen in the US, and might be under that name in other countries. -- Heather
I hope I will be able to find some (honest) agency who will be willing to take donations of medicine and blankets.
Thanks again for caring
[Jimmy] Wikipedia have an international list: http://en.wikipedia.org/wiki/Donations_for_victims_of_the_2004_Indian_Ocean_earthquake
[Hiran Ramankutty] I am absolutely fine. By god's grace I am not near the vicinity of the Tsunami. But hearing about the disaster itself gives enough sight of what would have happened.
Pray for all Tsunami victims.
[Krishnakumar R] I am fine. I had come home (Kerala in southern India) for a 10-day holiday. But as my native place is far from coastal area, I was not affected.
I can also vouch for Pramode. C . E , that he is safe, as I had met him in person day-before-yesterday.
Ben, I really appreciate the concern and the kindness you extend to all of us. Thank you very much.
It is during the dark times like this that we understand how precious our lives are; which we usually take for granted. Lets all extend our help in whatever way we can, to the victims of this tragedy.
[Ashwin N] I am fine. I stay in Bangalore which is very far from the coast.
This truly has turned into a catastrophe of immense proportion. Entire fishing communities have been washed away in some places :-(

Rajith is OK; by extension, Maxin B. John (whom I missed due to the name...) must be OK as well - they co-authored an article last month, so I figure they're in close touch.

[Rajith R] Thanks for checking in. I am ok and I live in Trivandrum. Even tough it is near sea here there were no problems.
As of press time there our very few of our Indian authors and TAG members who have not checked in - Raghu J Menon, and Krishna G Pai. Raghu lives in Kerala, and somehow it seems like everyone knows Pramode (hey Pramode, check in on 'em will ya? Thanks buddy). If you have news of our friends, please let us know.
May this New Year be better than our last, and whatever troubles we suffer draw us closer rather than tear us apart. With love to you all -- Heather

This page edited and maintained by the Editors of Linux Gazette
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

Published in Issue 110 of Linux Gazette, January 2005

More 2 Cent Tips!

See also: The Answer Gang's Knowledge Base and the LG Search Engine


Firewall

Hugo Mills (darksatanic, #hants on irc.blitzed.org)
13:04 <@darksatanic> I usually use it for debugging firewalls.
13:04 <@darksatanic> watch -n1 iptables -nvL \| sed -ne /^Chain INPUT/,/^$/p
13:05 <@darksatanic> There's a 2¢ tip for you...
13:07 <@darksatanic> The sed bit prints out just the chain you want.
13:08 <@darksatanic> My rules for the firewall are just a tad too big to fit on the screen,
13:09 <@darksatanic> so I use that (and things like it) to show only the chains I want.



Cygwin from a CD

Jimmy O'Regan (The LG Answer Gang)
(!) [Jimmy] This is a follow-up to http://linuxgazette.net/109/lg_tips.html#tips.2

Whoops. Having just looked back over the .reg file, I see that I have the path for X's fonts entered differently to the rest of the file: this /is not/ the reason why X doesn't work from a CD.

Saw this on Slashdot today: XliveCD (http://xlivecd.indiana.edu) is a CD image that autoruns an X session when put into a Windows machine (it's based on Cygwin).


Tip of the Day: regular expressions

Dave Whitinger (dave from lxer.com)

Forwarding to you a good tip by Robert Whitinger. If you ever run dry and need fresh tips for upcoming LGs let me know - we've got a ton of these fun ones.

[Ben] Thanks, Dave - we're always looking for 2-cent tips like these! I believe Heather has mentioned this in the Mailbag recently.

(And please keep up the great work!)

[Ben] [grin] Much appreciated; we'll do our best. Keep on reading, and let your friends know about us; the more folks read (and write for) us, the better we get.

best, dave

...............

I don't know about you, but I've spent a lot of time learning all the intricacies of the preg_... pcre functions. But whenever I go to the shell environment, the rules are different and so are the results.

Today, I found `pcregrep` and it behaves exactly like the perl compatible regular expression from php and perl since it does in fact use the same engine. Now I have only one regex syntax to know in detail, and my regexs work the same everywhere.

Now, I can say things like:

pcregrep -r ^[ae].*?log$ *

...............


Adding custom headers in Thunderbird

Andy Burns (andy.burns from adslpipe.co.uk)
Answered By Brian Bilbrey, Jimmy O'Regan
(!) [Jimmy] This is a follow-up to a 2c Tip in LG #109: http://linuxgazette.net/109/lg_tips.html#tips.1

I stumbled across your article on mozilla/thunderbird headers (I'm only an irregular reader)

I had a look an the "mheny" extension, because I like the idea of customising the viewed headers, but I found that it CAN also control the headers used at composition time. Not sure if you "summarized this out" of your article, or didn't find it to start with ;-)

Within the option dialog for mheny extension, select custom headers from the tree on the left, then pick composition from the drop list on the right, and you can select existing fields or add/remove custom fields, which then show up when you compose a message.

However (and I think this means it still doesn't fit your need) you can't add a default value for a field.

[Brian] And that's the bingo value: I did try mnenhy, but what I really want is a constant X-blah header containing a specific value every time I send an email via Mozilla Thunderbird.

Still a useful find, thanks ...

[Brian] But you got farther than I did, thanks for the heads up, I'll work some more with mnenhy when I get a chance. Of course, that I just spelled the name of the extension right twice only shows that I had to look it up twice, inside of a minute or two.
[Jimmy] I came across this: http://www.picklematrix.net/archives/000969.html it turns out it /is/ possible to add values to headers in Mozilla
add something like this to your prefs.js (not user.js):
user_pref("mail.identity.id2.headers", "tag");
user_pref("mail.identity.id2.header.tag", "X-gazette-tag: Jimmy");
(id1 is the 'local folders' identity)


Counting braces

Amod C Damle (amod_cd from rediffmail.com)

i am learning from your website "Linux Gazette" by which i am finding it easy to learn unix.

but i am having problems compiling and debugging the following program ... can you please help me out with its solution.

using UNIX filters and awk to write a shell script to filter out comment statements in a C program

a shell script to count the number of parentheses and braces in a C program

a shell script to recognize function calls in a C program

a shell script to generate code to do profiling of a C program (to insert counters to the C program)

using filter or just grep, sed and awk)

hoping for some guidence sincerely Amod Damle (ILLINOIS INSTITUTE OF TECHNOLOGY-CHICAGO)

[Sluggo] The first thing you should see is the TAG Posting Guidelines http://linuxgazette.net/tag/ask-the-gang.html in the FAQ section. There you'll see we don't do people's homework for them. How do we know it's homework? You don't want to do a useful task: who cares how many braces a C program has? You choose the tools first and then the strategy, and you insist on using kludgey tools. If I really wanted to count braces, I would write a Python program.
#!/usr/bin/env python
"""count-braces.py

Usage: count-braces.py <filename
Print the number of {}() characters in the input file.
"""
import re, sys

braceRx = re.compile( R"[{}()]" )
text = sys.stdin.read()
hits = braceRx.findall(text)
print len(hits)
[Ben] Jeez. Pythoneers. Always making things more complicated. :)
perl -0wne'print y/{()}//' file.c


JPEG to PS

Kapil Hari Paranjape (The LG Answer Gang)

Readers who wish to convert JPEG to Postscript for inclusion in a TeX/LaTeX document (or for any other reason) may want to use:

	convert file.jpg eps2:file.eps
	                    ^

Note the 2! This is better than the default "convert file.jpg file.eps" and performs the same function as "jpeg2ps" (which is in Debian non-free).

Explanation: The default postscript level for PS conversion is 1 which produces large and bad conversions since it produces pixelised bitmaps. In PS Level 2 and Level 3 the conversion of JPEG is inbuilt so the above procedure just adds a bit of postscript header stuff to the unchanged jpeg file. In other words this conversion is lossless.

You can also use "eps3" as the tag but beware that may be reasonably new postscript printers that are not level 3 compliant. (Ghostscript is level 3 compliant).


Setting the Clock on Linux

Walt R (wmreinemer from tns.net)
(!) [Jimmy] This is a follow-up to http://linuxgazette.net/109/lg_mail.html#mailbag.1

The following script is my interface to netdate. I modified the script found at website listed in the script. You have to be root to set the system and hardware clocks, yet you can query the time servers as a regular user.

Walt Reinemer

See attached netdate.sh.txt


SMTP-time despamming

Ben Okopnik (LG Editor)

Just saw this at Freshmeat; sounds really sweet, particularly the per-user configuration capability. Hopefully, the world is heading this way...

...............

 Mail Avenger 0.5.1
 by xxx - Sun, Nov 21st 2004 02:48 PDT

About: Mail Avenger is a highly-configurable, MTA-independent SMTP server. It allows you to reject spam during mail transactions, before spooling messages in your local mail queue. You can specify site-wide default policies for filtering mail, but individual users can also craft their own policies by creating avenger scripts in their home directories. It includes many features not supported by other SMTP servers, including mail-bomb protection, integration with kernel firewalls, TCP SYN fingerprint and network route recording, SMTP-level analysis of client implementations, SMTP callbacks to verify sender addresses, per-user mail scripts that run during SMTP transactions, virtual domain to user mapping for the purposes of filtering, SPF (sender policy framework), dynamic SPF query construction in mail filter scripts, support for easily issuing multiple concurrent, asynchronous DNS and SPF queries from filter scripts, and the ability to run spam filters such as spamassassin on message bodies before replying to SMTP DATA commands.

Changes: A critical memory handling bug was fixed in the avenger.local and deliver utilities.

...............


starting X automatically without [gkx]dm

Ben (LG Editor)

As past discussions in TAG have shown, I'm definitely not a fan of the various display managers; I believe that they take away, or obscure, too much of the control that a user has over X. However, starting X automatically from your ~/.bash_profile doesn't seem like a very smart move either: any time you get a login shell (e.g., logging into another console), you'd be firing off a new instance of X - or at least trying to, since it would die with a list of error messages.

The answer to this dilemma is a conditional start for X - in other words, we only want to execute it if it's not already running, i.e. only on the first login. To do this, just add the following line to the end of your ~/.bash_profile:

ps ax|grep -q "[ ]`which X`" || startx

For those who just have to know ([grin] I certainly would, if I were you): the above expression pipes the list of running processes, which is the output of the "ps" command, to 'grep', which searches it for the presence of a running X. To make the search more precise, the command substitution (`which X`) returns the full pathname to X as the search string. The character class preceding the search string ([ ]) is there to make 'grep' ignore its own entry in process table (an old 'grep' trick), and the "-q" option of 'grep' makes it return only a success/failure exit code instead of the actual matched string. The OR operator, '||', ties it all together into an expression that says "either X is running OR (execute) startx".


whois.sc

Jared Belkus (jared.belkus from gmail.com)

hi,

i was told to email this address about a useful website:

http://www.whois.sc

I use this whois website a lot because of the information it gives. If you sign up you can see all the domains that a server has.

thanks,
Jared Belkus

Just in case you're a sysadmin thinking, geez, just how many sites am I running on this machine again... did I miss any during that upgrade... -- Heather

This page edited and maintained by the Editors of Linux Gazette
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

Published in Issue 110 of Linux Gazette, January 2005

The Answer Gang

Linux Gazette 110: The Answer Gang (TWDT) The Answer Gang 110: ALINK="#FF0000">
LINUX GAZETTE
...making Linux just a little more fun!
(?) The Answer Gang (!)
By Jim Dennis, Karl-Heinz Herrmann, Breen, Chris, and... (meet the Gang) ... the Editors of Linux Gazette... and You!


We have guidelines for asking and answering questions. Linux questions only, please.
We make no guarantees about answers, but you can be anonymous on request.
See also: The Answer Gang's Knowledge Base and the LG Search Engine



Contents:

¶: Greetings From Heather Stern
(?)HTML page selector
(?)AMD64 Shuttle
(!)/dev/ub
(?)LG in developing countries
(?)Linux-friendly hardware
(?)installing a pcmcia-network card in Suse 9.0
(?)hi howtoopen .tgz or all zip
(!)Perl, WWW::Mechanize, and Mailman administration

(¶) Greetings from Heather Stern


(?) HTML page selector

From Sluggo

Here's a nifty HTML device for previous/next/goto page links similar to MS Access's record selector.

I had to use the "display:inline" style on the form to keep it from jumping to the next line. I also used that for the <DIV> to keep the gray background from spreading the entire screen width.

Attachments: snapshot3.png, pageLinks.html, pageLinks.css

BTW, the 'iv' program is a great fast-starting image viewer.

See attached pageLinks.html

See attached pageLinks.css

(!) [Ben] _Nice!_ I'll be playing with that gadget. Thanks, Mike! As to "iv", well...

ben@Fenrir:~$ su -c 'apt-get install iv'
Password:
Reading Package Lists... Done
Building Dependency Tree... Done
Package iv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  ida
E: Package iv has no installation candidate

In the spirit of exchange: if you want really nice pull-down (or pull-out) menus and don't mind JavaScript, take a look at Tigra Menu (http://www.softcomplex.com). A really nice, free implementation that works fine with every browser I've tested (which even the best CSS-based menus I could write - or find - don't.)

(?) It looks like that's a different program. The 'iv' I found was in Gentoo and its homepage is http://wolfpack.twu.net/IV

The Debian 'ida' program is from http://linux.bytesex.org/fbida

(http://packages.debian.org and the copyright file didn't list the home page, so I googled "ida graphics software" and found a listing at http://www.freebsdsoftware.org/ports.php?c=graphics&n=ida that links to the above page with the correct domain name and author's name (Greg Knorr). But the Debian package says the original is the Debian source, so maybe he's a Debian developer. Or maybe Debian no longer lists the external home page in the copyright file?


(?) AMD64 Shuttle

From Mike Orr

Answered By: William Park, Jimmy O'Regan, Huw Lynes

Searching for alternatives to my 450 MHz Master of Slowness. I could get a motherboard+chip for my empty case. Or I could get what I'm currently drooling over, a Shuttle. There's an Athlon 64 jobbie for $359 (SN85G4):

(!) [Huw] Downsides to the shuttle (I have a P4 one myself):
you pay a premium for the form factor and they can have heat problems.
they are noisier than you would expect. it's built on the nforce3 chipset.

(?) The ad seems to say it includes the CPU, although I'm surprised it doesn't say the speed. This compared to the $150-200 I'd spend on a regular motherboard and CPU. Which seems the better deal? Gentoo has an Am64 version. Does the 64 bit make enough difference to justify the $60 over a regular Athlon?

(!) [William] Unless you need 4GB+ memory, then you probably don't need 64-bit. Since you're asking such question, you definitely don't need it. :-)
I would advise against Shuttle. They have heat problem, and their power supply is not the quality stuff.
(!) [Huw] x86_64 is a better design than the old x86. Hypertransport makes enough of a differerence that an x86_64 system is pound for pound faster than a P4 system. But it really shines when you throw a lot of RAM at it. Being able to seamlessly address more than 2GB of memory is a very good thing. Of course with your budget that's just academic. If you still want one for the cool factor (which is justification enough IMHO) then get a motherboard based on one of the via chipsets not the nForce3. I'm basing this on what a dog the nForce2 was so it may not be entirely fair, plus I have a cheap via based Athlon64 at work that installed Fedora Core 1 (x86_64) out of the box with no fuss. This was decidedly different behaviour from some of the weird Opteron chipsets I've had to deal with.

(?) What would be the most politically correct video card for this puppy? Meaning, which manufacturers are doing a good job of making their specs open? Matrox G400 has been my reliable standby, but I had good luck with an nVIDIA chip recently, and my current computer has an ATI 3D Rage IIC.

(!) [William] Use what you have.
(!) [Huw] Sadly there are no politically correct graphics cards. Capitalist running-dogs like myself prefer nVidia. Mainly because their engineers are helpful.
<mind control> Buy the Athlon64, you don't need it, but you want it. </mind control>
(!) [Jimmy] Aw, you're not even trying. "Buy the Athlon64 now for the coolness, or invest in it for the ability to seamlessly address more than 2GB of memory" -- offer a choice that isn't, because the brain only listens to the 'or'. Standard sales trick.
(!) [Huw] The 2GB limit is a major pain though. A certain badly written renderer which we shall not name has a favourite trick whereby it runs full speed at the 2GB per process limit and then dies in a small shower of zombied process. When the 64bit version comes out it'll have to find a new trick.

(?) My main concerns are --

1) Speed

(!) [Huw] x86_64 is definately faster than straight x86 but I'm not sure it's worth the price difference given that you are not going to be doing anything to take advantage of it's extra features. Personally I'd buy a P4 and spend the difference on a DVD-RW.

(?) 2) Noise

(!) [Huw] The shuttles are not silent. The new PSU's are much quieter than the old ones. I know this because I was sufficiently irritated with the old one to upgrade. They are quieter than a standard off the shelf PC though.

(?) 3) Size

I don't anticipate having more than 640 MB of memory, so the 2 GB doesn't apply. I thought Shuttle had solved the heat problem in their later designs; if that's not the case, that's another strike against it.

(!) [Huw] The shuttle and its ilk are definite winners here.
Depends what's in the case. I have a P4, 512MB RAM, 120-GB PATA drive, CD-RW/DVD and a Fanless nVidia 5200. I haven't had any heat issues but I'm not sure I'd want to fill the spare PCI slot or put in a second hard drive. If you want to pack a lot of kit in then you are probably better off looking at more generic case designs.
Any gentle readers out there willing to give comparative heat and noise and raw high end power notes on the obviously smaller mini-itx form factor, write to The Answer Gang! -- Heather

(!) /dev/ub

From

Answered By Frodo

A few days ago, I changed to kernel 2.6.9 on one of my machines and suddenly none of the sd devices were made for my usb harddisks. Turned out, 2.6.9 now uses the /dev/ub/ structure instead... took me a while to figure that one out... lol

Low Performance USB Block driver (BLK_DEV_UB)

It does not seem to be enabled by default... guess I accidentally enabled it, but it actually does seem to work a bit better with some of my devices, when using USB 2.0 instead of USB 1.1

(some external harddisks seem to not be happy with the way Linux used to handle USB 2.0)

(!) [Heather] ooh so it isn't merely cosmetic. ok.

(!) am trying to find out, what exactly happened

what I do know, is that the "old" way did a usb to scsi thingie...

 config BLK_DEV_UB
 	tristate "Low Performance USB Block driver"
 	depends on USB
 	help
 	  This driver supports certain USB attached storage devices
 	  such as flash keys.
 	  If unsure, say N.

might just make it a lil warning:

"If you happen to enable BLK_DEV_UB, your USB attached storage devices will no longer be known as /dev/sdxn (where x is a letter and n a number), but as /dev/ub/x/partn."

(!) [Jimmy]
http://www.linux-usb.org/usb2.html
From: http://hulllug.principalhosting.net/archive/index.php/t-48985.html
> You're using the UB driver. Does it work if you turn that off and use the
> usb-storage driver instead?
Damn, you are right - this is a new driver...
I didn't notice that, i did rely on hotplug to load the correct modules.
Removed the ub driver and everything is fine now.
That means - just unloadin ub and loading usb-storage didn't work.
I had to remove it from the kernel config and rebuild the modules. Actually
usb-storage was the only module being rebuilt. Looks like usb-storage's
functionality is different if ub is built."

(!) btw, about the linux-usb.org link... I know that page... but there seem to be quite a few external hard disks (WD, for instance) and cases for hard disks, that do not work too well with linux' usb2.0 driver afterall...

quite probably the fault of those devices... but it stinks anyway :)

(!) [Heather] having to rebuild usb-storage? aw man, that does suck. can you keep both forms of it around or does it subtly affect other things too? (not to be tested with usb data you care about mind..)

(!) nah, it seems to replace part of the usb stuff...

(well - usb-storage)

the rest seems unaffected

(!) [Heather] A bit of binary diff on the other usb modules might be in order :/

(!) Now I know where the device files are, I have no problem with it... it "just works" G


(?) LG in developing countries

From Sluggo

Answered By: Ben Okopnik, Ramon van Alteren, Offer Kaye, Brian Bilbrey, Kapil Hari Paranjape

Dear readers, your editors have been discussing the changing PC/Internet environment since LG's early days, and we're wondering what's the minimum level of hardware and bandwidth now in the remoter parts of Africa, Latin America, and Asia? Are Pentium/K6 computers above 300 MHz universal now? Are people still downloading the FTP files because they can't afford the hour online to read LG interactively on the web? Or is that no longer an issue? If we started allowing articles to have more supplemental files, more images, more tarball examples, would that cause an undue burden to any readers or does it not matter?

(!) [Kapil] There seem to be two separate questions --
1. How hard is it to maintain a mirror of LG if the bandwidth/hardware requirement is upped?
Speaking only from my experience this should not be a problem in India providing that only "biggish" sites like ours try to maintain a mirror.
2. How hard will it be to read LG if the bandwidth/hardware requirement is upped?
As long as there is a low-bandwidth low-hardware version of LG that is available, you can always up the requirement for a high-end version.
So what is low-bandwidth?
A. Speaking only for India. Most places still have only a dial-up phone link. This link takes them to an ISP who will probably give them a share of 64K-512K link to one of the hubs in the bigger cities which are then linked quite well to the rest of the internet and each other (the hubs that is).
And what is low-hardware?
B. In a recent meeting to disburse funds to Indian universities for the purchase of computers, I heard that some of these place still have 486's. However, with the recent drop in prices of entry level Pentium class machines (to approximately half the earlier price) this should change in a year or so. At the same time working hardware has a way of trickling down over here so it is not impossible to find even a 386 in some places.
However, the use of GNU/Linux in India at this level is still very low. Since (whether we like it or not) LG is only read by people with some familiarity with *nix, the above data may not be entirely relevant.

(?) For years we got letters every few months asking for an e-mail or print version of LG. That was unfeasable for us to provide, so we steered people toward the FTP version, TWDT, and TWDT.txt instead. The mirrors complained whenever we regenerated the FTP files or made bulk updates to back issues, because of the bandwidth it cost them. One student wrote from a school in Africa, saying they all read LG from a shared copy downloaded at the school, but the school couldn't afford the online time to read it interactively on the web. Others said they paid by the minute or megabyte for their Internet connection, and each megabyte was a significant choice.

Yet now we hear that Pentium-level computers are widely available in the poorer parts of Latin America, many governments are switching to Linux, and community wireless networks are sprouting up in villages in India and Africa. It's been over a year since we've gotten a bandwidth complaint from a reader or a mirror. Does that mean this is no longer an issue? Or that those readers now have more local resources for Linux information/help and no longer rely solely on LG? Or that we lost those readers/mirrors during the move from SSC and they never found our new address? Unfortunately, the the nature of this problem means that those who are the least connected are the ones least able to write in and tell us about it, so we need to hear from others from those countries and regions who can tell us what the situation is.

On Wed, Dec 08, 2004 at 11:35:51AM -0800, Mike Orr wrote:

(?) Dear readers, your editors have been discussing the changing PC/Internet environment since LG's early days, and we're wondering what's the minimum level of hardware and bandwidth now in the remoter parts of Africa, Latin America, and Asia?

(!) [Ben] (A shovel and a pitchfork for minimum hardware and a wheelbarrow for bandwidth - but note that even these are not available in all areas. :) The term "minumum level" contains assumptions that render the answers to this question less than useful.)

(?) How? The question about whether most people have a 300 MHz Pentium or better was an attempt to see whether most readers have a computer capable of running a modern graphical browser and KDE comfortably.

(!) [Ben] "Minimum", in this venue, always starts at zero. Asking what the "minumum" hardware is will have people responding with their stories of woe about building TCP/IP stacks with hay and mud, and being too poor to get quality mud. Phrasing the question as you have predetermines the field of answers, since people who do not consider their hardware as "minimum" will not respond, and so you'll get the answers that only reinforce the point you're trying to make as opposed to the true state of the situation - a perfect example of the "statistics" that Barry was talking about just a few days ago.
(!) [Offer Kaye] "Running KDE comfortably" on a 300 MHz Pentium?! You must be joking... Have you tried opening a recent version of KDE? It's a hog - both memory and CPU. I have an 1800+ AthlonXP with 512MB of RAM, and even so KDE is sloooow to start up and apps take a while to open, including Firefox (a browser considered both modern and "light").

(?) Yes but you have to draw a line somewhere. KDE 3.2 is reasonable but not snappy on my 450 MHz Duron, but KDE 3.3 on the same machine is so slow it makes Windows look fast by comparision. It may not be KDE's fault: the first is on Debian and the second on Gentoo, and the system startup/shutdown on the Gentoo side is much slower too. I just bought a 2600 AthlonXP chip (decided to wait a year or two on the Shuttle), so we'll see how much that helps.

BTW, I got a Foxconn micro ATX motherboard to go with it. Hadn't heard of that brand before, but it had a VIA chipset and Award BIOS so I figured it was more standard than the mobo next to it with an nVIDIA chipset. I paid $6 more for less, haha: two memory slots instead of three, three PCI slots instead of five or six. But I thought back to when have I ever used more than three PCI cards simultaneously, and the answer was "never". Presumably the nVIDIA chipset would have been compatible enough since it wasn't nVIDIA video, but I figured why take chances and did I want my money going to a company that offers binary-only drivers? The salesman reassured me that a micro ATX mobo would fit into a regular ATX case; we'll see.

It's interesting how the prices of chips and motherboards have reversed. My standard rule has been to buy whatever combination is currently selling for $150. In the past that's meant a $50 chip and $70 motherboard. But this time it's a $99 chip and a $55 motherboard. They did have $50 chips but they were AMD Seperon. I haven't heard of those before. They came out a couple months ago as a replacement line for the Duron. Gentoo doesn't mention them as a supported platform although I assume they're compatible.

Tom's Hardware says the Sempron is replacing both the Duron and the 32-bit Athlon. http://www.tomshardware.com/cpu/20040728/index.html

(!) [Brian] BTW, I've got one of the top end Sempron's, a 3100+, running on an Asus K8N mobo (nForce3 chipset). The motherboard itself is bloody amazing. Socket for the processor. Heatsink over the single (or composite? can't tell) chipset. A few small (8-12 pin) smc glue logic chips, batches of electrolytic caps, sm resistors, and lots of connectors. But overall, the impression is of a barren field... picture here:
http://www.orbdesigns.com/bpages/2004/images/100_0265.JPG
The 3100+ Sempron is a 64-bit A64 with 32 bits lopped off, and half the L2 cache, sort of the modern day equivalent of the 386SX, I guess.
The other components in the system are a 160G Seagate Barracuda 7200.7 HD, an old 4x DVD+RW burner, and 512M of RAM.
Still, the board/processor combination is fast, supported well by the 2.6.9 kernel. The ethernet is on the chipset, and runs with the forcedeth driver, which is making some good strides now that nVidia decided that since a reverse-engineered driver was available in spite of their non-assistance, they might as well help make it better. Audio is acceptable as AC97/i810 equivalent. I'm running an ATI 9200 Video card, and the whole thing is wrapped up in an Antec Sonata case.
I've thrown Debian Sarge, Xandros, Fedora Core 3, and a couple of *BSD variants at it, all have run. OpenBSD has no driver for the ethernet ported yet. Everything else just worked, and it's the fastest "cheap" system I have.
It's not as robust as the 2.5 year old dual Athlon box, but true SMP just keeps trucking when a single processor box starts wheezing.
So, I'd count this report as a positive recommendation for the nForce3/Sempron combination on recent (2.6 kernel based) distros.
The Sempron is just the Athlon renamed, which explains why there's only a $5 difference between the same-speed chips. Seems AMD's marketers were getting nervous about the brand-name dilution effect of having their luxury chip (the AMD 64) and their proletarian chip (the Athlon) both called "Athlon", afraid that consumers wouldn't notice the difference and would, ahem, fail to appreciate the advantages of the higher-end chips. (Although "higher-end" is open to debate, since the price of the 64-bit chips is pretty close to their same-speed 32-bit counterparts.)
AMD also seems to be preparing to ditch Socket A by designing a Sempron that will fit in their AMD 64 motherboard (socket 754), as well as versions for future Intel socket designs.
So, given that 64-bit doesn't mean squat on machines with less than 4 GB memory, what happens in 2038 when the UNIX clock rolls over? Will we all have to switch to 64-bit anyway or else?
I'm putting this all in my huge case from two years ago, the one whose mobo was apparently water-damaged in my fire. Maybe I can get the neon tubes in front to light up this time. I looked through my old receipts to figure out what speed chip was in there without prying off the heatsink. Cyrix/66, AMD Duron/150.... Was it really that slow? The mobo manual said it could take a chip up to 1800. At the time I thought, "That's three times faster than I'll ever need...."
I put the "300" on in case somebody should come up with a Pentium/70 or something. The bandwidth question should be obvious. If I've put in unhelpful assumptions without realizing it, please tell me what they are so the questions can be improved.
(!) [Ben] In my opinion, there's no way to get an accurate picture of what the situation really is unless you travel to India, Africa, South America (however you choose to define it), etc., and spend a few months traipsing a wide area and taking a census - and even that data would be of limited use since it's a constantly-changing variable.
So, in short, my problem with the way the question is phrased is that the answers to it *can't* give any new insight. They can, however, be used to stack the cards. I'm not accusing you of doing this, but I am saying that this form of the question is not useful.
However - dear readers, please feel free to let us know what challenges, if any, you've encountered in your LG-reading experience. Our purpose is to deliver the greatest amount of high-quality content to you, and to "make Linux a little more fun"; this implies and requires access to that content. We can't buy you all new computers and high-speed network access - I just rattled the change in my pocket, and had to admit to myself, bitter as it may be, that it just wasn't enough - but if there's something we can do to improve access to LG, we'd love to hear your ideas.
Through the magic of email plus my own desire to make LG serve as many people as possible, this editor's door is always open. Come on in.
(!) [Jimmy] But beware the curmudgeons! And please be aware that an opinion given with the utmost brutal honesty is the /start/ of the discussion, not the end. Don't make me quote the 'Haggle' scene again.
(!) [Ramon] I've just returned from Uganda for a Development project on Linux and Open Source software in general. Apart from giving a course on Linux system administration I helped setup a local mirror with open source software and more importantly documentation. Among the documentation was the Linux Documentation Project (LDP) including The Linux Gazette.
Due to poor bandwidth offerings in Uganda we've resorted to updating this mirror using a portable harddisk that gets filled in Europe and sent through diplomatic snailmail to Uganda on a quarterly basis.
I don't think hardware is that much an issue. In Uganda the issue definitly is bandwidth. I work for a foundation that partners with a rural university, bandwidth there is 64k down / 16k upload for the entire university which has to be shared with 400+ students and 50+ staff.
Internet slows down to a crawl during the daytime........ (500B/s or less)
Common offerings from local ISP's are 16Kbit links for $50/month, if you're living in the capital, otherwise you're out-of-luck or dependant on local NGO's with internet access / cyber cafes.
Unlike India, telephonelines are non-existant. Nearly everyone has a mobile phone, normal phone lines are only present in some government buildings, large companies and possibly NGO's. The quality of the phonelines is horrible.
Although I'm not entirely sure, I think that the entire country has something in the order of a 4-6Mbit link to the rest of the internet.
At an ICT-conference I visited somebody quoted a $8000 figure for a 1Mbit internet link to me.....
We (eacoss) currently operate the only local open source mirror in Uganda and we're unable to update it through the internet. We would not be affected that much by this change because of the update-method for our mirror however other people in the eastern african region might.
That said, the other point that kapil raised, also holds true for Uganda and Eastern Africa in general. Linux/Opensource software is not (yet) widely used. The EACOSS foundation (www.eacoss.org) is trying to promote that, however reality is that most people are using windows.
This is changing (rather fast) however with M$ and other big companies starting to enforce copyright protection schemes, and licence costs generally way beyond a local year income.
There is a desperate need for more knowledge on Linux/Open source and more advanced knowledge on networking, software developement, etc in general, so the gazette could definitly fill a gap.
(!) [Ben] Thank you, Ramon: it's always good to get info from people in the field. The most interesting part for me was that my own estimate of how things were in that part of the world was very close to what you've reported.
As to the "sneaker-net" method of information transport into Uganda, it reminds me of the old joke: "never underestimate the bandwidth of a station wagon full of magtapes." It may be slow, but it's still valid.

(?) Linux-friendly hardware

From Sluggo

Answered By: Jimmy O'Regan, John Karns, Thomas Adam, Karl-Heinz Herrmann, Ben Okopnik

Is there a FAQ somewhere of hardware manufacturers' track records regarding open specs and cooperating with free software?

I.e., the Tux-friendly seal of approval. Not for things that are just passively compatible with Linux, but for manufacturers who take steps to cooperate.

I can see a possible logo, although it's not quite the right message:

[picture of Tux, with a gun hanging on the side. "Cooperate, or the penguin gets it"]

If not, it would be good to have one in LG, as a way to reward good manufacturers and punish bad ones. I'll write it up if people can send me facts and links. Off the top of my head...

CPU, MOTHERBOARD, HARD DRIVE:

(not much to say; I think they're as open as we can expect)

BIOS:

(what issues here? flashable under Linux? is the open BIOS project still active?)

LinuxBIOS (http://www.linuxbios.org) seems to be under relatively active development. Their status page (http://www.linuxbios.org/status/index.html) is pretty impressive.
(LinuxBIOS is a port of Linux that runs in place of a BIOS. It's mainly used in clusters, and boasts a record boot time of 3 seconds). -- Jimmy

(?) VIDEO:

I think Matrox has been cooperative. nVIDIA has their notorious binary drivers.

(!) [Heather] ATI has been somewhat cooperative, in that they allow information out after their boards are old enough. This is decent but I've encountered their proprietary driver not supporting an old enough board while the X11 community still hadn't gotten the open source support filled in, reducing one to raw VESA support. Wah. Temporary problem, timing just sucked is all.

PRINTERS:

I think Epson has been cooperative, but many Canon printers are Windows only. Lexmark had their offensive DMCA clause for toner cartridges.

(!) [Thomas]
> PRINTERS --  Lexmark had their
  ^^^^^^^^     ^^^^^^^
Nah... I just don't see how those two are related. :P
(!) [Karl-Heinz] Well -- I like my Optra E312. speeks PCL and Postscript. The latter better then some monster-printers of varying manufacurers I've seen in offices.

(?) CD/DVD:

could be more open but that's more of a legal issue and pressure from Hollywood than of manufacturers stonewalling.

MODEM:

winmodems bad. Is there a software-only modem for Linux? My friends with Macs like to gloat about their software modems, although the counterargument was why distract your main CPU when you can have a dedicated chip doing the work.

(!) [Jimmy] There is support for an IBM softmodem in the kernel, and there was a project to get some Lucent modems working, though that pretty much fell by the wayside. There is a software modem available, though it only goes as far as 28.8 (the author shifted focus to other nifty things like tcc, qemu, and ffmpeg).
(!) [John] The lucent modem / Linux situation seems to parallel that of the nVidia graphics cards, in that proprietary binary modules link to the kernel using the same or similar methods. Although hardware UART modems will undoubtedly remain preferrable for Linux users, I've always had pretty good luck with the Lucent modems. As winmodems go, they're probably one of the easier varieties to deal with. Not to say that they won't be a pain when you find yourself dealing with a combination of kernel and libgcc for which they haven't issued an update, but for me, that's happened only once in the 8 yrs or so that I've been dealing with them.
(!) [Jimmy] No, there actually is some open source software that accesses Lucent modems from user-space. It doesn't work as a modem, but the author just wanted to be able to use it as a phone. Someone else tried to couple that work with the software modem I mentioned, but I don't know if it works at all.
There hasn't really been any work done in this area for years though.
Sigh I'll hunt through my jungle of bookmarks
LinModem: http://fabrice.bellard.free.fr/linmodem.html (last updated in 1999)
(!) [Heather] The reason that hasn't been notable work on a true softmodem for Linux is because right around the time it was getting some progress, the genius who was making the progress, Tony Fisher, died of cancer -- a terrible loss apparently for linguistics fans as well. See http://linmodems.org and search downward for "generic modem". The university had great respect for him and still maintains the software link, so what he had is downloadable at: http://www-users.cs.york.ac.uk/~fisher/modem

...............

What's done:
  • V34 modulator (sampling rate of 8000 Hz, handle all the symbol rate, carrier and trellis combinaisons).
  • V34 demodulator (no echo cancellor yet, and startup phases not complete).
  • Algebraic part of V90.
  • DTMF dialing/receive.
  • V8 protocol.
  • V21 modulation & demodulation
  • V23 modulation & demodulation
  • sample code to test the protocol.
  • sample code to test V21, V22, V23, V34 and V90 independently from the modem.
  • a basic phone line simulator (with echos & typical line amplitude/phase distortion).
  • an X11 interface.
  • soundcard interface.
  • AT command parser & sample tty simulator.
  • asynchronous protocol.

...............

LTModem: http://www.close.u-net.com/ltmodem.html (Last modified: Sat Sep 30 22:40:31 BST 2000)

...............

The current functionality (0.9.9) is:
Finds a Lucent PCI winmodem and reports information on this.
Goes offhook and detects the dial tone.
Dials using pulses or dtmf. Here in the UK the dtmf dialling works, you can hear the call being answered.
Try "ltmodem -d 011223344" (replace 011223344 with the number of your favourite ISP) and listen to the modem at the other end answering the call!
Detects the answer tone of the phone at the other end, or busy tone if it is engaged.
Picks up incomming calls.
Command line mode allows control of modem interactively or via a script file.
Includes fixes for Pavel's voice stuff, just need some more detailed instructions on how to use it! This includes turning you computer into an expensive telephone and full duplex voice transmission.
Reads ROM check sum and does basic I/O for DSP RAM.
Monitors/Sets either data in the PCI registers or at the I/O ports, monitoring at configured intervals.

...............

Pavel Machek (the Pavel mentioned earlier) is also one of the primary authors of Gnokii.

(?) SOUND, ETHERNET, ETC: ?

(!) [Ben] Just saw something related to Mike's earlier question about hardware compatibility:
Being realistic about Linux hardware compatibility By: Robin 'Roblimo' Miller
http://www.newsforge.com/article.pl?sid=04/11/29/1559244&from=rss

(?) installing a pcmcia-network card in Suse 9.0

From Santeri.Ketola

Answered By: Ben Okopnik

Hi!

I installed last summer Suse Linux 9.0 with KDE to my laptop(thinkpad 600e, 233mzh pentium 2). I haven't used a linux before, and it seems to work fine except some points that might be more complicated in laptops than in normal pc's.

(!) [Ben] I think that's true for pretty much any OS - the hardware in laptops, other than perhaps memory and hard drives, is nearly all proprietary (i.e., you can't run out to your local computer store and buy an, e.g., video card for your Toshiba or Dell), and this has obvious results.

(?) In my apartment house they use the already existing phone-cable to access internet, therefore i needed to buy a pcmcia card(smc 8041tx v.2) and a HomePNA converter(A-Link HomePNA) to gain access to the internet.

(!) [Ben] This card is supported under pcmcia-cs, at least according to http://pcmcia-cs.sourceforge.net/ftp/SUPPORTED.CARDS . The easiest thing to do would have been to install the package from ftp://ftp.suse.com ... unfortunately, you went a different route. The next easiest thing, in my opinion, would be to reverse what you've done, then install the package.
Keeping on with trying to install from source is not something I would recommend for you, particularly because this is a standard package; what you'll have, if you do manage to succeed, is a system in which the PCMCIA package is a) not recognized by the packaging system, and is b) not upgradeable - except through more source-based installation - as a result. In other words, you'll be creating a permanent headache for yourself.

(?) I began installing it with these instructions:

...............

  SMC Networks, Inc.
                      SMC 10/100 PC Card (SMC8041 V.2)
                        Linux Driver Installation

Installation Guide:

1. Please download the pcmcia package (3.1.29 or higher vision)
   from the follow url:
   ftp://www.sunsite.unc.edu/pub/Linux/kernel/pcmcia

2. Install the package:
   Copy the pcmcia packagefile into /usr/src/linux/
   and uncompress it:
           tar zxvf pcmcia-cs-3.1.29.tar.gz

3. Config the pcmcia package
   Change the directory into pcmcia
       cd pcmcia-cs-3.1.29
   then config and install it
        make config
         make install

4. Edit the /etc/pcmcia/config
   Add following to the config file
        device "SMC 80412"
         class "network" module "pcnet_cs"
   and add the following configuration:
         card "SMC 80412"
         version "SMC" , "8041TX-10/100-PC-Card-V2", "", ""
        bind "pcnet_cs"

5. Restart the pcmcia service
        /etc/rc.d/init.d/pcmcia restart
   Then the SMC 10/100 PC Card (SMC8041 V.2) adapter will start to work.

...............

As i reached the third point, this happened:

(!) [Ben] The problem you're having, incidentally, is not a complex one:

(?)

dhcppc23:~ # /usr/src/linux/pcmcia-cs-3.1.3/Configure make
Ack!  The PCMCIA distribution is incomplete/damaged!
    Unpack again -- and try using a Linux filesystem this time.
Configuration failed.

dhcppc23:~ #
(!) [Ben] The tarball you have may have been damaged, or you may need more software. The easy way to tell is usually my examining the log file produced by "make"... but, again, note that this is all theoretical for the moment: the right thing to do is reverse what you've done so far and install the actual "pcmcia-cs" package.

(?) I have tried the command "make config" but nothing happens. And as the error message tells, i tried unpacking the package several times, but the message repeats. As i completed the instruction points 4 and 5, the light turned on in the pcmcia card, but there is still no connection.

My questions are; firstly, how to configure the card properly and secondly, how to tell the firewall to mind the pcmcia card, or does the firewall detect all interaction from my computer and the rest of the world?

(!) [Ben] I've addressed the first question already; as to firewalls, they work with interfaces, not hardware. In other words, a firewall doesn't really care what kind of hardware you have - what it needs to know about is rules for, e.g. "eth0".

(?) I know that these questions might seems somewhat simple or just plain stupid,

(!) [Ben] Not at all. You've done a fine job of describing what you need, the environment in which you're working, and the problem you're having. Answering your question was easy and pleasant as a result.

(?) but this system is totally new for me, and it seems fun and full of possibilities, but the internet access is vital for me. As in your instructions you advised to be funny, but hopefully this email provides you at least some giggles about us rookies;)

(!) [Ben] Hey, it's all about making Linux a little more fun.  :) That's why we're here!

(?) I managed to get the internet working properly for two days... and the only inconvenience was getting the suse installation cd from my dad per post. Your instructions we're precise and helpful. I reversed the driver kit i had begun installing, got the right kit from ftp.suse.com, and yast installed it all for me. The only thing that i needed to do was to reboot (i thought this was only necessary in wondows giggles)..and lights went on!

(!) [Ben] [chuckle] You didn't really need to reboot - there's almost never a need to do that in Linux, unless you've recompiled the kernel or something - but there are times when it may be easier to do that than all the "modprobe" invocations with mysterious module names.

(?) I even istalled Opera right away, went like a dream, and shockwave as well..and my laptop purrs like kitten. i only hope i wont overheat it too much because i've been so much online;) Next project is installing gimp 2 but that's only a minor glitch..it's fun learning and now it's so much easier thanks to you and the internet!

Thank you once again for your swift and precise instructions.

(!) [Ben] Excellent! It's a pleasure to help, particularly some like yourself who takes the time to let us know the results. Glad we could be of service!

(?) hi howtoopen .tgz or all zip

From ronen

Answered By: Suramya Tomar, Ben Okopnik

hi

howtoopen .tgz or all zip you now

thanks

ronen

(!) [Suramya] tar -zxf filename.tgz
or
unzip filename.zip
Next time try to be a bit more clearer in your request. It would make it easier for us to answer your question.
(!) [Ben] [ top-posting reversed so that time won't flow backwards. Suramya, please don't provide bad examples for our readers.  :) ]
Interestingly enough, earlier today Jimmy pointed me to a couple of sites in Hebrew that looked like translations of some LG articles - and beziqint.net is an ISP in Israel. Coincidence? Maybe...
guides.co.il and linmagazine.co.il -- Jimmy
In general, our foreign correspondents do a fine job of asking good questions; ronen, obviously, has missed on that count (I originally received his email at our "tag-kb" address, which is used for contacting the KnowledgeBase maintainer.) However, since his question is of broad interest to new Linux users, we'll let him off with a term in a chroot(1) jail and a careful reading of "Asking Questions of The Answer Gang" at http://linuxgazette.net/tag/ask-the-gang.html for future reference - and I'll see if we can make this into a useful exchange. (I'm feeling particularly pedantic today; as a net.friend once said, "it gets me chicks.")
So, to ask the question that ronen (theoretically) was trying to ask:

...............

Hi there, Answer Gang! I'd like to know how to open .tgz and .zip files under Linux. The standard documents are confusing, searching the Internet gives me too many results, and I don't know where else to look. I'd appreciate your help.

...............

Why, hi there, ronen! Nice of you to ask in such a clear, understandable, and polite manner and give me a chance to pontificate on the topic!
There are a number of ways to deal with compressed files in Linux. One that's probably easiest for the new user is to use Midnight Commander's "VFS" (Virtual File System) feature - you simply place the highlight on the name of the compressed file you want and press the 'Enter' key. This will let you look inside the file and copy out anything you want. The default VFS setup handles bzip, bzip2, gzip, compress, ar, zip, jar, xpi, zoo, lha, and arj compressed formats (assuming that you have the appropriate decompression software installed.) You can run Midnight Commander by typing "mc" at the command line, either in the console or in an xterm window if you're running X.
If you want to do it manually, typing the name of the appropriate decompressor (possibly followed by options) and the name of the file to decompress at the command line should do it - but beware of "file scatter", i.e., what happens when the person who created the file did not use a directory structure to contain all the files. These will now be scattered all over the directory into which you've decompressed them - usually the current one. In general, it's a Good Idea to list the files before decompressing the archive - or look into the file with Midnight Commander, as mentioned above - just so you know what to expect.
Some examples of listing syntax for various decompressors:
# Gzipped tar file
tar tzf file.tgz

# tar file compressed with bzip2
tar tjf file.tar.bz2

# zipfile
unzip -l file.zip

# ARJ file
unarj l file.arj
Typing the name of the decompression program followed by '-h' or '--help', just as is suggested at the very top of "Asking Questions of The Answer Gang" at (http://linuxgazette.net/tag/ask-the-gang.html), will show you the option list for that program.
You can also use one of several GUI decompression tools, such as "guitar" (cute name, eh?) which act somewhat similar to WinZip in Windows; you may find that environment to be more familiar and comfortable. Do realize, however, that you'll be missing out on a lot of the capabilities available at the command line; GUIs are cute, but the CLI is powerful.

(!) Perl, WWW::Mechanize, and Mailman administration

From Ben Okopnik

Answered By: Jimmy O'Regan

...or, "The Evolution of a script".
This started as a complaint about Mailman's administration interface. Over the course of 5 days in November, Ben and I bashed out a script to automate the deletion of mail that was held up by Mailman (spam, in other words), and Ben taught me some Perl along the way. -- Jimmy

Yeah, I dislike the damned thing as well. I wonder if Monsieur O'Regan would be willing to cruft up a screen-scraper that would automate the procedure?

(!) [Jimmy] Sure -- I was looking for something I could set WWW::Mechanize on anyway. Does anyone have a sample setup I can be let loose on, because Mandrake seem to have done a wonderful job of fucking up everything related to email.

(!) Awesome! Thanks, Jimmy; that damn thing is a regular pain. I wish there was a way to tell Mailman to just delete every single one of them, but I've never found a way to do so. This way, I can maybe cron it up and forget about it.

See the attached file for a sample. The only things that need to happen are

a) The "Action to take" needs to be switched to "Discard", and
b) "Submit all data" needs to be triggered.

It's actually something I need to learn about at some point, so I'll be very interested in what you code up.

(!) [Jimmy] Give this script a whirl:

See attached www-mech-1.pl.txt

I changed the action of the page to submit to a simple PHP script

See attached simple-dump.php.txt

All it does is check that a username and password have been passed, and if so, regurgitate everything the script sent. It seems to work, based on the HTML in that sample. If it doesn't work, uncomment the two 'print' statments and send me the results.
(!) [Jimmy] Mailman's auth mechanism uses cookies, starting from http://linuxgazette.net/mailman/admindb/tag

See attached www-mech-2.pl.txt

(!)

#print $mech->response();

This is probably not what you want - you'll just get a hashref as a result. However, just in case it is, for some reason, I'm sending the output along (but I'll be tweaking the script so that it does produce something useful from the above.)

(!) [Jimmy] I forgot to remove that from the original, when I thought I was using basic authentication; it prints a hashref, but it also prints the HTTP status code. Not something to rely on, but it worked well enough to let me see where I was going wrong (I was forgetting to prepend 'Basic ' to the base64 encoded user/pass pair).

(!) What it looks like is that the script is pulling down the content, but then it's not doing anything with it.

(!) [Jimmy] After that form is submitted, is there any sort of 'Are you sure?' step?

(!) Nope. It just shows you a result page that essentially says "there aren't any new messages".

I only had a few minutes this morning, but - the stuff in the "if" clause never happens. I put in a print statement above it and inside it, and the one above prints stuff like

See attached annoyed-senderaction.log.txt

just fine, but nothing from the inside (which would have been prefixed with '--->'.)

Don't know why; the regex is right...

(!) [Jimmy] maybe try changing it to /(senderaction-[^">]*)/ -- it can't hurt.

(!) Ah - that got inside:

See attached inside-senderaction.log.txt

However, it still fails to delete the buggers.  :( I suspect that the normal submission process sends something more than just the radio button values to the CGI, whereas you skip everything else:

next unless $token->return_attr('type') =~ /radio/i;

At least in my limited perception; I don't know the module at all.

Around here, Ben wondered what the PHP script was for -- Jimmy

(!) Err... sorry, I've lost the context. What is this page, where does it go, and what do I need to do with it?

(!) [Jimmy] Sorry, forgot myself. That was there to make sure the script was sending the right values: '3' for reject.

(!) Oh. I don't have PHP - no way to test that; however, you've seen the output from Data::Dumper by now, and that gives you everything.

(!) [Jimmy] Well, you said already that it's not getting inside the if statement, which is strange. If it was that there was a missing value that needed to be submitted to the form, that'd be one thing, but as it is, only the default stuff is getting submitted.
Hang on... the first submit works, but that doesn't use {name => adminpw, value => "}, it's {adminpw => "}; so maybe I should have the array made up of {$regex_match => 3}. I'm not so hot with using anything other than scalars, so you may need to fix the syntax inside the if statement.

See attached www-mech-3.pl.txt

(!) [Jimmy] OK, try again:

See attached www-mech-4.pl.txt

(!)

...............

         # This may need sytax correction
         $name->{"$1"} = 3;

...............

Looks OK, although quoting is deprecated unless you need interpolation. However, it still doesn't work; see the appended output (again, from Data::Dumper.)

Looking at it, specifically the data that's sent back, I see what looks like a problem (I've added some newlines to clarify the view):

...............

$VAR12 = bless( {
                  '_content' => '
		  senderaction-%2522pearl%2Bdeleon%2522%2540genetikayos.com=0
		  &senderforwardto-%2522pearl%2Bdeleon%2522%2540genetikayos.com=tag-owner%40linuxgazette.net
		  &senderfilter-%2522pearl%2Bdeleon%2522%2540genetikayos.com=3
		  &senderaction-abcd21ruby%2540hotmail.com=0
		  &senderforwardto-abcd21ruby%2540hotmail.com=tag-owner%40linuxgazette.net
		  &senderfilter-abcd21ruby%2540hotmail.com=3

[snip]

...............

Seems like '3' is somehow getting assigned to the wrong bit; it should be on the "senderaction" statements, but is ending up on the "senderfilter".

(!) [Jimmy] I think I have it this time...

See attached www-mech-5.pl.txt

(!) Well... still doesn't work. Time for me to stop being lazy, then, and actually look it up myself. :)

...............

while (my $token = $p->get_tag('input'))
{
    next unless $token->return_attr('type') =~ /radio/i;
    if ($token->return_attr('name') =~ /(senderaction-[^">]*)/)
    {
        $name->{$1} = 3;
    }
}

# Eek! is this \%name or %name?
$mech->submit_form(form_number => 1, fields => \%name);

...............

Neither; you've never defined a %name hash. What you've got is a reference named $name pointing to an anonymous hash. "fields" does indeed expect a hashref, though. So,

$name->{$1} = 3;

should be simply

$name{$1} = 3;

and %name should be declared in a "my" somewhere; "fields" should point to "\%name".

Ahhh... now it works. Very cool!

(!) [Jimmy] Yeah, I knew there was something I wasn't getting there; thanks for the explanation. I think I still have a mark on my forehead from when I realised I was trying to send an array where a hash was expected.
So, just so I'm sure, is the final version this?

See attached www-mech-6.pl.txt

(!) I've added a little processing to make sure that an empty page doesn't cause any errors, and a little noise so it'll tell me that it's doing its job.

See attached www-mech-7.pl.txt

(!) [Jimmy] Reminds me of something I read once -- something like "a program is complete when there's nothing left to take away, not when there's nothing left to add".

(!) Yep, the Rodin school of programming. I'm certainly an adherent.

(!) [Jimmy] I'll just chalk it up to the perils of cut 'n' paste programming.

(!) No worries; that's one of the ways to learn. If you're not making mistakes, you're not learning - right? I have to keep repeating that to myself, especially since I'm teaching my first full yoga class today. :)

(!) Seems to work fine without TokeParser.

See attached admreqrm.pl.txt

(!) [Jimmy]

...............

for ( grep /^senderaction-/, split /[ \n"']/, $mech -> content() ){

...............

I only saw the 'grep' feature for the first time a few days ago (in TAG, IIRC).

(!) Eeep!

(!) [Jimmy] Well, that's the entertaining thing about Perl; it's a "language" language. I'm still at the tourist stage, but I'm thinking of moving :)
I prefer using HTML::TokeParser::Simple because of the [http://linuxgazette.net/108/misc/oregan/tp.pl.txt Google script] I wrote, which formats the HTML differently depending on the client.

(!) Ah.

(!) [Jimmy] ...though it beats me why I didn't just change the browser string to pretend to be Mozilla. I suppose I just like the idea that if someone did change the UA string, the regex would still work.
(!) [Jimmy] Heh.

...............

    print "Deleting $_\n";
    # 'uniq' action happens because hashes possess the Buddha nature

...............

(!) :) 'Tis true, though.

(!) [Jimmy] Isn't WWW::Mechanize neat?

(!) Yep - I've wondered about how to do this kind of thing in the past, and it's impressive just how easy WWW::Mechanize makes it.

(!) [Jimmy] I was wondering how to deal with cookies -- "Wow! Cookies are free!". It rocks. I still don't trust myself enough to automate my maintenance payments though.

(!) You could always have it pause and display the setup for final approval before you actually commit.

(!) [Jimmy] Heh. It's a bit much for something I only have to do once a fortnight
I later asked Ben if he'd mind me passing this thread for use in TAG -- Jimmy

(!) Fine by me, Jimmy. I enjoyed the two of us cooperating to make the beast behave, anyway.

(!) [Jimmy] So did I. I really enjoyed that "oh no, it's not..." moment when I sent you the second regex (that was typed with my paternal "I know you're up to no good" squint).

(!) I already abstracted the password string into a variable def at the top of the script, and did a little more cleanup before sending it to Rick. Latest version appended.

See attached admreqrm-2.pl.txt

(!) [Jimmy] If you're willing to put yourself through my debugging process again, it should be easy add an option to grab the content instead of deleting.

(!) Heck, I've read the module docs by now. That's how I finally hammered my end of it into shape. Actually, it looks like you should be able to do the whole task with WWW::Mechanize (TokeParser is obviously needed simply for its regex capabilities) - that might be worth looking at before we go ahead and pub the results.

(!) [Jimmy] I was thinking that too. The doubt that was lurking in the back of my mind came out of hiding: it'd need something extra -- an option to pass message ids to not delete. (Not a problem, it's just the nagging of the "you're forgetting something" thought).

(!) Something like this, you mean?

delete_this_id() unless grep /$id/, @keep;

Take a look at the regex-based script version I sent you; it would be easy enough to tweak.

(!) [Jimmy] Something like that. Can 'unless' be followed by braces, or would it need a 'do'?

(!) "do" is pretty special in Perl, and doesn't have anything to do with conditionals (although it can be used with loops.) Sure, you can have a statement block after "unless" (it's just syntactic sugar for "!if"); what you can't have is an "elseunless". :)

(!) [Jimmy] Do widzenia! (there's this cute Polish girl...)


This page edited and maintained by the Editors of Linux Gazette
Copyright © its authors, 2005
Published in issue 110 of Linux Gazette January 2005
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

Published in Issue 110 of Linux Gazette, January 2005

Bash Shell and Beyond

By Anonymous

Introduction

This article is a continuation of a series in Issues 108 and 109 in which I discuss some of my additions to the standard Linux shell. In my previous article in Issue 109, I promised to cover dynamically-loadable builtins related to arrays, regex splitting, plus interfacing to external libraries like SQL databases and an XML parser.

Regex Match

Modeled after the Awk match() function, I added a new match builtin for regex(3) matching.

    match [-23] string regex [submatch]

It returns success (0) if 'string' contains 'regex' pattern. If the 'submatch' array variable is specified, then by default, it will contain all matching substrings corresponding to the entire 'regex' and any parenthesized groups in 'regex'. E.g.

    match Aabc123Z '([a-z]+)([0-9]+)' a         # a=(abc123 abc 123)

where 'abc123' matches the entire 'regex', 'abc' matches the first group '([a-z])', and '123' matches the second group '([0-9]+)'.

For the -2 option, 'submatch' will contain 2 elements, non-matching preamble and leftover postamble (ie. before and after the 'regex'). For -3 option, 'submatch' will contain 3 elements, the preamble, the matching string, and the postamble. E.g.

    match -2 Aabc123Z '([a-z]+)([0-9]+)' a      # a=(A Z)
    match -3 Aabc123Z '([a-z]+)([0-9]+)' a      # a=(A abc123 Z)

where 'A' and 'Z' are the string segments before and after the 'regex', respectively.

You now have 3 different ways of doing regex matching:

  1. [[ string =~ regex ]] conditional test in standard Bash-3.0, which uses BASH_REMATCH as the array variable,
  2. the new extended 'case' statement, which uses SUBMATCH as the array variable, and
  3. match builtin command, where you can specify the array variable and what it should contain.

Stack and Queue

Quite often, you need to implement a "stack" or "queue" data structure. In shell, you can use positional parameters or an array to hold the data, e.g.

    set -- {a--z}
    set -- $@ Z                 # append to queue
    set -- A $@                 # push to stack
    set -- $2 $1 ${@:3}         # swap first 2 items in stack
    shift 2                     # pop 2 items off the stack
    set -- ${@|:-5:} ${@|::-5}  # rotate queue to the right by 5
    set -- ${@|:5:} ${@|::5}    # rotate queue to the left by 5

This is acceptable for a throw-away script, but is very inefficient because of all the copying of data back and forth.

Here are builtin implementations of stack and queue operations. They directly manipulate positional parameters or arrays (with -a option), in-place without copying the data. They are fast and suitable for general purpose "toolbox" work.

pp_pop [-a array] [n]

Deletes N (default 1) positional parameters or array elements. Same as 'shift' builtin for positional parameters, except that it will pop items if possible. It returns error if the parameter or array is empty.

pp_push [-a array] arg...

Inserts arguments at the beginning of positional parameters or array. E.g.

    set -- 1 2 3
    pp_push a b c
    echo $*             # a b c 1 2 3

pp_append [-a array] arg...

Appends arguments at the end of positional parameters or array. E.g.

    set -- 1 2 3
    pp_append a b c
    echo $*             # 1 2 3 a b c

pp_swap [-a array]

Swaps the first 2 parameters (ie. $1, $2) or array elements. It returns error if the parameter or array does not have at least 2 items to swap.

pp_set [-a array] arg...

Sets the argument(s) as new positional parameters or array. Equivalent to

    set arg...
    set -A array arg...         # from Ksh

pp_overwrite [-a array] arg...

Overwrite the parameter(s) in-place. For an array, this is equivalent to

    set +A array arg...         # from Ksh

E.g.

    set -- 1 2 3 4 5 6
    pp_overwrite a b c
    echo $*             # a b c 4 5 6

pp_rotateleft [-a array] [n]

Rotate N (default 1) positional parameters or array elements to the left.

pp_rotateright [-a array] [n]

Rotate N (default 1) positional parameters or array elements to the right.

pp_flip [-a array]

Flip the order of positional parameters or array elements. E.g.

    set -- {a--z}
    pp_flip
    echo $*             # z y x ... a

The above example can be rewritten as,

    set -- {a--z}
    pp_append Z         # append to queue
    pp_push A           # push to stack
    pp_swap             # swap first 2 items in stack
    pp_pop 2            # pop 2 items off the stack
    pp_rotateright 5    # rotate queue to the right by 5
    pp_rotateleft 5     # rotate queue to the left by 5

Transpose and Sort

Transpose and sort problems come up a lot when dealing with tables. Although there are utilities such as awk(1), and sort(1) to handle these functions, in order to use them you have to pipe the data (or write a file) to the external program, then read the program's output back and re-parse it to collect the re-ordered data. For well-behaved line-oriented text data this is possible, but it is much better to have a dedicated shell solution, especially when you have the data already parsed and simply want to re-order it.

pp_transpose [-a array] n

Transpose positional parameters or array representing matrix ordered by rows into a sequence that is ordered by columns. N is the size of row. For example, given a sequence (1 2 3 4 a b c d), representing 2x4 array with 2 rows (1 2 3 4) and (a b c d),

    | 1 2 3 4 |         | 1 a |
    | a b c d |   ==>   | 2 b |
                        | 3 4 |
                        | 4 d |

the transposed sequence is (1 a 2 b 3 c 4 d), representing 4x2 array with 4 rows (1 a), (2 b), (3 c), and (4 d).

    set -- 1 2 3 4 a b c d
    pp_transpose 4
    echo $*             # 1 a 2 b 3 c 4 d

    pp_transpose 2      # back to original sequence

An equivalent solution in pure shell would go (very slowly) like

    set -- 1 2 3 4 a b c d
    eval set -- $(
        for i in `seq 4`; do 
            for j in `seq $i 4 $#`; do 
                echo '"${'$j'}"'
            done
        done
    )
    echo $*             # 1 a 2 b 3 c 4 d

pp_sort [-a array]

Sort positional parameters or array in ascending order. If the array is integer type, then numerical sorting is done, e.g.

    a=( {10..1} )
        pp_sort -a a
        echo ${a[*]}            # 1 10 2 3 ... 9 (string sort)
    declare -i a
        pp_sort -a a
        echo ${a[*]}            # 1 2 3 ... 9 10 (integer sort)

Array Operations

Array cat

arraycat [-a array] a [b ...]

Prints array elements, one array at a time. If the -a option is given, then it appends the data to the 'array' variable instead. This is similar to

    printf '%s\n' "${a[@]}" "${b[@]}}" ...
    array=( "${a[@]}" "${b[@]}}" ... )

except that you're using variable references like the strcat() and strcpy() builtins discussed in the previous articles.

Array map

In Python (and some other functional languages), you can apply a function to each element of array without manually looping through. If there are 2 or more arrays, then elements are taken from all of the arrays in parallel. I've added a shell version of the Python map() function:

arraymap command a [b ...]

Run 'command' with arguments taken from array elements in parallel. It should take as many positional parameters as there are arrays. This is equivalent to

    command "${a[0]}" "${b[0]}" ...
    command "${a[1]}" "${b[1]}" ...
    ...
    command "${a[N]}" "${b[N]}" ...

where N is the maximum of all indexes. Array elements are referenced by index, not by the order of storage. So, there can be empty parameters.

E.g.

    unset a b;  a=(1 2 3)  b=(4 5 6)
    func () { echo $1$2; }
    arraymap func a b           # join in parallel: 14 25 36

    func () { echo $(($1 + $2)); }
    arraymap func a b           # add in parallel: 5 7 9

Array zip and unzip

The names come from the workings of a zipper. You start with two rows of teeth; and, when you zip-up, you get one row of interleaved teeth. Consider arrays x=(x1 x2 x3 ... xn) and y=(y1 y2 y3 ... yn). Zipping produces a single array xy=(x1 y1 x2 y2 x3 y3 ... xn yn) which consists of interleaved elements of 'x' and 'y' arrays. Of course, unzipping does the reverse.

       y1    y2    y3 ... yn   ==>   x1 y1 x2 y2 x3 y3 ... xn yn
    x1    x2    x3 ... xn

Here are 2 new builtins to "zip" and "unzip" directly within Bash shell.

arrayzip [-a array] name ...

Print array elements, one by one, going across the arrays in parallel. If -a option is given, then append to the array variable instead. Array elements are referenced by index, not by the order of storage, so there can be empty parameters. This is shell version of Python zip() function, and is equivalent to

    arraymap 'printf "%s\n"' name ...
    arraymap 'pp_append -a array' name ...

arrayunzip -a array name...

Inverse of 'arrayzip'. Sequentially appends items from 'array' into 'name' array variables, moving across one row at a time. Output variables are flushed first. If there are not enough input items, then the null (empty) string is appended to the leftover variables.

For example,

    x=(1 2 3 4)  y=(a b c d)
    arrayzip -a xy x y
    declare -p xy               # xy=(1 a 2 b 3 c 4 d)

    unset x y
    arrayunzip -a xy x y
    declare -p x y              # back to original

You can also use array commands to extract rows or columns in a transposition problem. E.g.

    row1=(1 2 3 4)  row2=(a b c d)
    arraycat -a table row{1..2}
    arrayunzip -a table col{1..4}
    declare -p col{1..4}        # (1 a), (2 b), (3 c), (4 d)

Putting Items into an Array

array [-gG glob] [-iInN a:b] [-jspq string] [-evwrR regex]
[-EVfc command] name arg...

Given a list of items on the command-line, this new builtin appends the selected items into an array variable. It is designed to be called repeatedly, so you should create or flush the array variable beforehand. Its many options control how and what items to select.

Content filtering

The following options are command-line versions of parameter expansion ${var|...}.

-f filter Append 'arg', only if 'filter arg' returns success (0). Otherwise, skip to next 'arg'.

-c command Append the stdout of command substitution `command arg`, only if there is an output. Otherwise, skip to next 'arg'.

-i a:b Extract Python-style [a:b] substring from each 'arg', ie. arg[a:b], arg[a:b], ...

-I a:b Complement of -i, ie. [:a] + [b:]

-n a:b Extract Python-style [a:b] range from 'arg' sequence, ie. [arg,arg,...][a:b]

-N a:b Complement of -n, ie. [:a] + [b:]

-g glob Append 'arg' matching 'glob' pattern.

-r regex Append 'arg' matching 'regex' pattern.

-G glob Complement of -g.

-R regex Complement of -r.

There are minor differences between the above mechanism and standard parameter expansion. -i option extracts a substring from each item, and the -n option extracts a subrange from the argument list. Options -I and -N selects the inverse of -i and -n, respectively, which are not available in ${var|...}.

String join and split

Joining and splitting strings are very common operations. In Python, you have string.join() and string.split(). Now, you can do them in Bash also.

-j sep

Join all 'arg' with 'sep' separator, and append the resulting string. E.g.

    a=()                # 'unset a' if 'a' already exists.
    array -j '.'  a  11 22 33 44
    array -j '---'  a  abc 123
    declare -p a                # a=(11.22.33.44 abc---123)

-s sep

Split 'arg' by 'sep' separator, and append each segment to the array. If 'sep' is null, then each char itself becomes an entry. E.g.

    a=()
    array -s '.'  a  11.22.33.44
    array -s '---'  a  abc---123
    declare -p a                # a=(11 22 33 44 abc 123)

-p begin

-q end

Extract strings which are enclosed by 'begin' and 'end' delimiters from 'arg'. Append both matching (excluding the delimiters) and non-matching string segments to the array sequentially. If both 'begin' and 'end' are null or if one option is missing, then splitting is not done. E.g.

    a=()
    array -p 'abc' -q 'xyz'  a  abc123xyz789
    declare -p a                # a=(123 789)

You can call the command repeatedly, and the results are appended to the end of array variable.

Regex split

Practically, all modern scripting languages can split string on regex pattern, or replace the matching segment using callback function. Now, so can Bash, and more.

-e regex

Extract 'regex' patterns from 'arg', and append each matching string. (think egrep -e) E.g.

    unset a;  a=()
    array -e '[a-z]+'  a  abc123xyz789
    declare -p a                # a=(abc xyz)

-v regex

Remove 'regex' patterns from 'arg' strings, and append each non-matching string. Matching strings are skipped, like IFS whitespace. (think egrep -v). This option is analogous to Awk split() or Python re.split(), in that you're left with non-matching segments. E.g.

    array -v '[a-z]+'  a  abc123xyz789
    declare -p a                # a=(... 123 789)

-w regex

Similar to -e and -v option, but both matching and non-matching strings are sequentially added, so that joining the array with null (empty) string will give back the original data.

    array -w '[a-z]+'  a  abc123xyz789
    declare -p a                # a=(... abc 123 xyz 789)

You can specify regex(7) patterns with the -evw options above. Unlike the -s option, null segments are not appended, since they are rarely useful in regex splitting. If the 'nocaseglob' shell option is set, then regex matching is case-insensitive, just like glob matching.

Callback function and substitution

So far, we are chopping up the command-line items and collecting the pieces. You can also transform the pieces using a callback command and use the result instead of the original content, just like ${var|command} or -c command option. However, if you collect the matching segments and the non-matching segments separately, you lose the relative order of those segments. What is needed is to apply the callback command to each item just before appending the item to the array variable.

-E command
For each matching string, append `command matching [group...]` to the array. The command line consists of the matching string and all parenthesized groups (if any). For the -p and -q options, command substitution `command inside` will be called where 'inside' is matching segment without the delimiters.

-V command
For each non-matching string, append `command non-matching` to the array.

The-EV options are independent and take effect only if -evwpq options are specified. 'command' can be any command you can type on your command line. This is a generalized form of regex substitution.

For example, to increment numbers by 1 and capitalize non-numbers,

    a=()
    addone () { echo $(($1 + 1)); }             # add 1
    upper () { tr 'a-z' 'A-Z' <<< "$1"; }       # to uppercase
    array -w '[0-9]+' -E addone -V upper  a  abc123xyz789
    declare -p a                # a=(ABC 124 XYZ 790)

HTML Template (BAsh Server Pages)

If you can embed Python, Perl, PHP, Java, or VisualBasic within HTML file, then there is no reason why you can't embed shell script and process the HTML file through shell. In fact, I've done exactly that. Here is a new builtin to process template strings with embedded shell script.

basp [-p begin -q end] text...
Extract embedded shell scripts which are enclosed within '<%...%>' delimiters (non-greedy, non-nesting) from text arguments. Run the scripts at top level, not as command substitution, and send the output, along with surrounding texts, to stdout. If there is error, it returns immediately. If

-p and
-q
options are given, then 'begin' and 'end' are used as delimiters, instead of '<%' and '%>'.

This is shell's answer to PHP, JSP, ASP, and the likes, so I named it basp (BAsh Server Pages). It is only 70 lines of C, and its main advantage is that you don't have to learn another scripting language and syntax. You can continue to use shell which has been around for 30 years. E.g.

    tag=x
    basp '<html> <% printf "<$tag>%s</$tag> " 1 2 3 %> </html>'
           # <html> <x>1</x> <x>2</x> <x>3</x>  </html>

If you have HTML template in a file, then just read it into a string like

    basp "`< file.html`"

Because they are running at top level, embedded code-blocks share data and environment with each other and with the main shell session. If you want to isolate the main session, run it in a subshell.

A more complicated example might be to get a list of items, then print a table with 10 consecutive items per row. The template file.html will look like

    <table>
    <%
        set -- {1..40}
        for i in `seq 1 10 $#`; do
            cat << EOF
    <tr> `printf '<td>%s</td> ' ${*:i:10}` </tr>
    EOF
        done
    %>
    </table>

Then,

    basp "`< file.html`"

will produce a 4x10 table which renders to

    1  2  3  4  5  6  7  8  9  10
    11 12 13 14 15 16 17 18 19 20
    21 22 23 24 25 26 27 28 29 30
    31 32 33 34 35 36 37 38 39 40

You can implement the HTML template using the array builtin from above. Essentially, you extract the script that is between the '<%...%>' delimiters and run it through eval, and print non-script to stdout unchanged. So, it would go something like

    a=()
    array -p '<%' -q '%>' -E eval -V echo  a  "`< file.html`"
    arraycat a

But, although it works for the example above, you are limited by the fact that each command substitution is a separate process and can't share data with other code-blocks. So, if you put 'set -- {1..50}' in another code-block, then it won't work. Besides,

    basp "`< file.html`"

is less typing.

[Editor's Note: The security ramifications of this are left as an exercise for the reader. Think chroot jail, at a minimum. -- Dave ]

Expat XML parser

I've added a simple interface to the Expat XML parser, so that you can register callback functions and interact with the XML parser from the shell. This new builtin will be enabled only if you have Expat installed. If you don't, then you will need to download/compile/install Expat, and recompile Bash shell (starting with ./configure).

xml [-sedicnm command] text...

This is the interface to Expat-1.95.8 (from www.libexpat.org) library. Arguments are fed to the Expat XML parser sequentially. It returns 1 immediately on any error. If all arguments are processed without error, then the builtin returns success (0). The argument must be a single complete XML document, because Expat can handle only one XML document per parser process.

The parser will invoke the callback commands or handlers that you specify, with all required parameters on the command-line. The callbacks will run at the top level, so if you need to protect your shell environment, run the 'xml' command in subshell. For the moment, the following options are recognized:

-s command start element (Usage: command tag att=value ... ).

The attribute name and value strings are concatenated with '=', so that 'declare' or 'local' can be used to set shell variables with the same names as attributes, ie.

    declare "$2"        # set the first attribute name
    declare "${@:2}"    # set all attribute names

-e command end element (Usage: command tag )

-d command character data (Usage: command data )

-i command processing instruction (Usage: command target data )

-c command comment (Usage: command text )

-n command namespace start (Usage: command prefix uri )

-m command namespace end (Usage: command prefix )

For convenience, the name and attributes of start XML elements are saved in array variable XML_ELEMENT_STACK as a stack, ie.

XML_ELEMENT_STACK[0] = number of positional parameters (ie. $#)

XML_ELEMENT_STACK[1] = tag (ie. $1)

XML_ELEMENT_STACK[2] = the first attribute 'key=value' (ie. $2) ...

and the depth of current XML element is stored in shell variable XML_ELEMENT_DEPTH. They will be removed and decreased, respectively, at the end of XML element. Essentially, this is equivalent to doing manually

    pp_push -a XML_ELEMENT_STACK  $# "$@"
    ((XML_ELEMENT_DEPTH++))

at the start of element, and

    pp_pop -a XML_ELEMENT_STACK  $((XML_ELEMENT_STACK[0] + 1))
    ((XML_ELEMENT_DEPTH--))

at the end of element.

Example

To illustrate how it works, consider the following XML sample:

    <root>
        <one a="AA" b="BB">
            first line
            <two x="XX"/>
            second line
        </one>
    </root>
  1. When <root> element is encountered, it will set

        XML_ELEMENT_STACK=(1 root)
        XML_ELEMENT_DEPTH=1
    

    and call command registered with -s option with 'root' as the argument,

        command root
    
  2. On encountering <one> element, it will push '3', 'one', 'a=AA', and 'b=BB' onto XML_ELEMENT_STACK and increment XML_ELEMENT_DEPTH, so that they become

        XML_ELEMENT_STACK=(3 one a=AA b=BB 1 root)
        XML_ELEMENT_DEPTH=2
    

    Also, it will call the -s callback with the tag and attributes, like

        command one a=AA b=BB
    
  3. Similarly, on encountering <two> element, it will push '2', 'two', 'x=XX' onto XML_ELEMENT_STACK and increment XML_ELEMENT_DEPTH, which become

        XML_ELEMENT_STACK=(2 two x=XX 3 one a=AA b=BB 1 root)
        XML_ELEMENT_DEPTH=3
    

    and call the -s callback, like

        command two x=XX
    

    Since this tag has implicit </two> element, it will immediately call command registered with -e option with 'two' as the argument,

        command two
    

    Then, it will pop the current tag and attributes off XML_ELEMENT_STACK and decrement XML_ELEMENT_DEPTH. Now, they return to the state they were in before entering 'two' element, ie.

        XML_ELEMENT_STACK=(3 one a=AA b=BB 1 root)
        XML_ELEMENT_DEPTH=2
    
  4. On encountering </one> element, it will call -e callback,

        command one
    

    and pop the tag and attributes off XML_ELEMENT_STACK and decrement XML_ELEMENT_DEPTH, so that they become

        XML_ELEMENT_STACK=(1 root)
        XML_ELEMENT_DEPTH=1
    
  5. Finally, for </root> element, it will call -e callback,

        command root
    

    and pop the current tag off XML_ELEMENT_STACK and decrement XML_ELEMENT_DEPTH, returning to their initial state.

  6. For data such as 'first line' and 'second line', the command registered with -d option will be called with the data as argument. Multiple calls are made, if data are multi-line, contains special character encodings, or broken up by another elements. It is the user's responsibility to collect these data segments. Here, strcat would come handy.

Because XML_ELEMENT_STACK is a stack holding the command-line arguments for all nested elements, you can check it to find out where you are.

In any callback command, the command-line arguments used at the start of current element are

    arg=( "${XML_ELEMENT_STACK[@]:0:XML_ELEMENT_STACK[0]+1}" )

which consists of $# ${arg[0]}, the tag name ${arg[1]}, and the attribute names and values ${arg[*]:2} (if any). Similarly, the command-line arguments used for the immediate parent element are

    n=${XML_ELEMENT_STACK[0]}
    arg=( "${XML_ELEMENT_STACK[@]:n+1:XML_ELEMENT_STACK[n+1]+1}" )

An easier way would be to rotate the stack, assuming XML_ELEMENT_DEPTH is deep enough to allow rotation, e.g.

    n=${XML_ELEMENT_STACK[0]}
    pp_rotateleft -a XML_ELEMENT_STACK  $((n+1))
    arg=( "${XML_ELEMENT_STACK[@]:0:XML_ELEMENT_STACK[0]+1}" )
    pp_rotateright -a XML_ELEMENT_STACK  $((n+1))

To get a list of all nested tag names, you simply filter out stack items containing '=' (attribute) or all integers ($#). From inside of <two> element in the above example,

    XML_ELEMENT_STACK=(2 two x=XX 3 one a=AA b=BB 1 root)
    echo ${XML_ELEMENT_STACK[*]|~=|^[0-9]+$}            # two one root

will give you just the tags. This is equivalent to manually looping through, like

    for i in {1..XML_ELEMENT_DEPTH}; do
        echo ${XML_ELEMENT_STACK[1]}
        pp_rotateleft -a XML_ELEMENT_STACK $((XML_ELEMENT_STACK[0] + 1))
    done

So, Bash equivalent to 'outline' example from Expat distribution would go like

    indent='  '
    start () {
        echo "${indent|*XML_ELEMENT_DEPTH-1}$*"
    }
    xml -s start "`< file.xml`"

producing

    root
      one a=AA b=BB
        two x=XX

GDBM and Associative Arrays

For some reason, Bash doesn't have a key/value data structure (called associative array, hash, or dictionary in other scripting languages.) I've added a wrapper for gdbm(3) with a full set of operations to create and manipulate disk-based associative arrays.

gdbm [-euikvr] [-KVW array] file [key | key value ...]

Typical usage would be as follows:

gdbm file print all key/\t/value pairs, ie. dict.items()

gdbm -k file print all keys, ie. dict.keys()

gdbm -v file print all values, ie. dict.values()

gdbm file key print var[key], ie. ${var[key]}

gdbm -r file reorganize database

gdbm -K array file save all keys into array

gdbm -V array file save all values into array

gdbm -W array file save all key/value pairs into array sequentially

gdbm file key value store key/value, ie. var[key]=value

gdbm -i file key value store key/value, only if key is new

gdbm -v file key name store value in variable, ie. name=${var[key]}

gdbm -e file test if file is GDBM database

gdbm -e file key test if key exists

gdbm -e file key value test if key exists and value is var[key]

gdbm -u file key delete key, ie. unset var[key]

gdbm -u file key value delete key, only if value is var[key]

More than one key/value pair can be specified on the command line, and all arguments will be processed even if there is an error. This speeds up data entry, because each 'gdbm' call opens and closes the database file. If the last value is missing (ie. there is an odd number of arguments,) then the last key will be ignored.

For example,

    gdbm file.db a 111 b 222 c 333

    gdbm file.db a              # 111
    gdbm file.db b              # 222
    gdbm file.db c              # 333

    gdbm -k file.db             # c a b
    gdbm -v file.db             # 333 111 222

    gdbm -v file.db a x b y c z
    declare -p x y z            # x=111 y=222 z=333

    gdbm -e file.db a                   # does 'a' exist?
    gdbm -e file.db a 111 b 222         # is a==111 and b==222 ?

There are many benefits to this approach:

  1. the database is a single file which can be copied,

  2. the data survives exit and reboot,

  3. other processes can access the database,

  4. the shell can now handle a database which is bigger than memory.

SQLite, MySQL, and PostgreSQL

Each database comes with its own command-line client program (ie. 'sqlite', 'mysql', and 'psql'). Athough it is easy to send SQL statements to the database manager, it can be difficult to bring query results back into the shell. You have to use stdout or a file, read the table, and parse the rows and the columns. This is non-trivial for anything but simple data.

I've added a simple interface to SQLite, MySQL, and PostgreSQL:

Lsql [-a array] -d file
SQL...

Msql [-a array] [-h host -p port
-d dbname -u user -P password ] SQL...

Psql [-a array] [-h host -p port -d dbname -u user -P
password ] SQL...

where Lsql is for SQLite, Msql is for MySQL, and Psql is for PostgreSQL. Of course, if you don't have a database, then you won't be able to use the corresponding builtin.

They all work pretty much the same way. They send SQL statements to the database engine. If there is any query result, they print to stdout, or (with the -a option) save the data fields into an array variable, row by row. My intention is not to replace the client programs, but to make shell script easier to write. For example, here is the tutorial example in the SQLite documentation:

    Lsql -d file.sqlite \
        "CREATE TABLE tbl1(one VARCHAR(10), two SMALLINT)" \
        "INSERT INTO tbl1 VALUES('hello!',10)" \
        "INSERT INTO tbl1 VALUES('goodbye', 20)"        # use 'set +H'

creates a simple table and loads in 2 rows of data. To query it,

    Lsql -d file.sqlite "SELECT * FROM tbl1"    # to stdout

    Lsql -a table -d file.sqlite "SELECT * FROM tbl1"
    declare -p table            # table=(hello! 10 goodbye 20)

The first will print

    hello!  10
    goodbye 20

and the second will put the data into array variable 'table'.

Summary

This ends this tutorial on my patches to Bash-3.0 shell. Bash shell is ideal tool for teaching/learning about Linux and programming, because it is so easy to write C extensions and put shell handles on them. It is my sincere hope that readers will stick with shell a little longer before moving on to other scripting languages. :-)


Copyright © 2005, Anonymous. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

Free as in Freedom: Part One: GNU/Linux

By Adam Engel

"How far can free software go? There are no limits, except
when laws such as the patent system prohibit free software
entirely. The ultimate goal is to provide free software to
do all of the jobs computer users want to do--and thus make
proprietary software obsolete."
 -- Richard Stallman (http://www.gnu.org/philosophy/philosophy.html)
[NOTE: all dialog is culled from email conversations unless otherwise noted -- AE]

Time to start rethinking things. We "progressives," (leftists, anarchists, libertarians, liberals, etc. -- wide spectrum of opinion usually lumped together by mainstream media under the codename "fringe" or the even scarier "radical" or "free thinker") who fill hundreds of websites with our words and images may be making a few corporations very rich in the process. Corporations whose vision of software as "proprietary" property, something to own, like land, or employees, with all the rules and regulations about trespassing and fiddling with "personal" corporate property, intact.

Diebold. Another "questionable" election. This whole computer voting scam comes down to a test of freedoms. The freedom of citizens of a Republic to control their own destinies, or the freedom of corporations of a global marketplace to control everything up to and including the citizens' illusions that they are citizens of a Republic the future of which they control. Scam: a corporation using the law to guard their proprietary software, the public be damned, though this software is being used by the public, in public, to decide the future of the (Re)public. This is not just a computer thing - it's a human rights thing.

Let's take me, for instance, or you:

Unless you paid for every piece of software on your proprietary operating system, or received it as a gift for your personal use only, or are using it for work under a license purchased by your employer, you are a criminal. You stole hundreds, perhaps thousands of dollars -- it's their call, they can charge whatever they want and that price becomes the "market value" -- from some of the richest, most powerful people on earth, and for this you must pay dearly. Heavy fines. Jail time. A criminal record.

Unless... you're running the GNU/Linux operating system and any combination of its literally thousands of free software programs and applications available for free download off hundreds of websites around the world. Then, there's no problem. You're free. But still...

No matter how radical you think you are, both the activist who writes his incendiary manifesto as a Word .doc and the cop who files the police report, cutting and pasting radicals into columns of his Windows Graphical User Interface (GUI) database, are working for Microsoft.

So before you write your next piece on the PATRIOT ACT or the incredibly shrinking Bill of Rights (some animals are more equal than others) or any number of breaches of free speech and free choice our corporate masters are imposing on the world, think about what kind of software you're using, or rather, whose. Whose software are you using to email your work to your editor or newsgroup, or representative, and what kind of software runs the list, blog or website where it will be posted? Are you and your editor and colleagues defending free speech on your own free software, or is the whole thing, the writing, coding, and publication, both by your "progressive" website and its "reactionary" counterparts all working together to make more money for a few software giants that own the means of production and the means of reproduction and distribution?

No matter who wins the "battle," it seems, Microsoft, Adobe, Macintosh, etc. won the war a long time ago by defining the "personal computer" and how it's used in public and private, work, play, and education.

GNU Possibilities

It all began... (of course it never really all begins anywhere ever, but sometimes someone steps up and says "No way," so we'll take that as a beginning, here) around 1983 with Richard Stallman's GNU Manifesto and his stated goal to create a free operating system.

Yeah, someone's always stating something, but in this case, as millions of computer users can attest, the guy who stated wasn't just talking. Stallman, as we shall see, came through. Big Time.

(While GNU/Linux's file system and commands are Unix-like, according to Stallman, "it is dangerously misleading to say that GNU is 'based on Unix'. Unix is proprietary software, and we could not use any of it. We had to start over, from scratch. That's why it is so important that GNU's *Not* Unix." The name "GNU" -- pronounce the "g" -- is in fact a recursive acronym for "GNU's Not Unix".)

Stallman already had a track record as one of the most inventive programmers around. In 1975 he created the text editor, Emacs, which he would re-create, using entirely different code, in 1984, as GNU Emacs, one of the first major features of the GNU Operating System. GNU Emacs is the de facto text editor of GNU/Linux as well as many corporate owned Unixes (it shares proponents and disk space with one of the original Unix text editors, 'vi' (and it's powerful free upgrade, VIM). When people say Emacs they mean GNU Emacs, though a popular, more graphic version, XEmacs, also grew out of GNU Emacs and shares much of the same code.

"The revolutionary text editor Emacs that I developed in 1975 was not a version of anything else. It had nothing to do with Unix, which in 1975 was hardly known," Stallman emailed me regarding the origins of Emacs.

As a staff member of MIT's Artificial Intelligence Lab from 1971 to 1983, Stallman created and worked on important computer stuff and established himself as a major hacker.

Mainstream media turned "hacker" into a "bad" word to describe bad people; hackers are in fact just people who live for programming computers and are very good at it. They are proud to call themselves hackers and care as much about the media's opinion of their culture as they do the media's opinion of the validity of their calling: zilch. Unlike, say, the Generic Office Worker in the Generic Labyrinth (third cubicle to the left), they don't hang up their titles at the end of the day when they get off the train. They are hackers 24/7, or as long as they live and love to program computers. It's who they are, it's what they do. Hackers. This is important.

There are a lot of name distinctions and language manipulations in this story, including the distinction between GNU/Linux and what most people call plain old Linux. They are all important, for most of the names and terms are or were created by the creators themselves, only to have them twisted, hyphenated, out-quoted (and out-sourced) by our old friend, The Corporation, for the sake of corporate ownership and profit.

These are real people who have done real things and have real beliefs. These aren't "like, the spaced-out, hacker-snackers on TV, like you know, dude?" The success of the GNU/Linux model in standing up for freedom -- real freedom, not the freedom to "say no" to medical marijuana and live in unnecessary agony or go to jail -- is a powerful example of community over the Corporation, and something we, especially we who write about freedom and act for freedom should study in great detail. Your life will or will not change for the better due to the real or imposed outcome of the 2004 Presidential election, or who wins, or imagines they do, in 2008. The only way to change your life and anyone else's for the better is to help wrest the fate of humanity from its current corporate ownership (all rights reserved).

Life is fleeting regardless, but must it also be licensed and subject to review and revocation by those who had zero participation in its creation and whose only purpose is to excise profit from the necessities of its maintenance? Corporate ownership of data, of knowledge, can change your life in a big way, especially if you get caught using illegal knowledge on your computer or worse, legal knowledge without a license.

Again, it started like it often does. Paradigmatic. Like the German writer Kleist's classic, Michael Kohlhaas (transliterated into the character Colehouse Porter in E.L. Doctorow's novel, Ragtime), someone saw his community, his habitat, and everything in it of value to him destroyed by corporate greed and laws created and imposed to sanctify these actions, make them seem "right, the natural order of things," and decided to fight back. This is the story of his fighting and winning, for a time, for we only win for a time until things change, everything changes, and even the movement we thought was ours, the movement we started, moves away from us in every direction.

Linux is big business, or is on the cusp of becoming big business. It can go the way of the corporate citizen, or the free individual. It cannot continue the balancing act it has maintained of being both. Or can it?

The correct name of the operating system is GNU/Linux, but almost everyone in the world refers to it as "Linux." Ben Okopnik, Editor-In-Chief of the Linux Gazette (LG) wrote that this is merely a matter of convenience:

"Note that this distinction, much as RMS (Richard Stallman) and others may have tried to promote it, did not make it into the common lexicon. Just as in the case of the 'X Window System', universally known as 'X', a short simple identifier is what people will use when it's available."

But it also might have much to do with mythology that has grown up around both the Linux kernel and its chief architect, Linus Torvalds. Many people believe, and this has been amplified in mainstream media, that the "Linux Operating System" was created from scratch by Linus Torvalds in 1991, with some help from hackers around the world connected via the Internet. This makes for a good story because it displays the power of the Internet, especially during GNU/Linux's formative years in the hyped-up 1990s, and GNU/Linux is indeed a product of collaboration that could only have happened on the Internet. Also it presents us with an archetypal hero/genius of the Robin Hood ilk who led his band of merry hackers through the proprietary coded forests to wreak havoc on the corporate desktop.

Of course it's not so simple.

Linux is the kernel, not the operating system. The kernel is like the medulla, the "lizard brain" responsible for the automatic functions of the operating system -- for us: breathing, heartbeat, swallowing; for computers: background processes, daemons, the ability to read certain drivers and communicate with the user via the "shell". If the medulla is the kernel in this analogy, and the cerebrum is what it is, whether with human bodies or computers, the cerebrum, "us" the conscious user/programmer, then the rest of the body is the operating system. Arms, legs, eyes, skin. For computers it's the shell (a program that serves as the interface between the user and the kernel), and the rest of the operating system, consisting of various tools, commands, programs and the libraries that run them.

The Unix and GNU/Linux system libraries are code that allows the system to recognize and execute various functions, including communicating with itself and recognizing that "it computes, therefore it exists." In order to have a complete Unix or GNU/Linux operating system you need a kernel and a system of programs, tools, and commands, including the shell. Without the rest of the system, the kernel isn't very useful. Sort of like a medulla on a plate.

The system of tools that enabled the Linux kernel to merge into a functional operating system existed at the time of Linux's release in 1991. That operating system was developed by Richard Stallman and other hackers, many from the Free Software Foundation (FSF), and it was called GNU. Its development, essential but often neglected in importance, was a revolutionary move.

After I mentioned a series of common programs, utilities and applications, Stallman emailed me, "All programs that run on GNU/Linux are linked with GNU 'libc'. 'libc' [part of the GNU/Linux library] is the only way most programs talk to Linux."

Perhaps the only development that rivals the creation of the GNU operating system, in terms of protecting the freedoms of software users, programmers and documentation writers are the copyleft licenses, such as the GNU General Public License (GPL) for software, and the various others for documentation.

Stallman wrote, "Copyleft is a technique used in unilateral copyright licenses. The technique is to require modified versions to be under the same license. One can design the details in many different ways. For instance the GNU GPL and the GFDL are both copyleft licenses--the former primarily meant for software, the latter primarily meant for documentation--and their requirements are quite different."

Since the creation of the GNU GPL there have been many variations to serve specific needs, but the essence is the same: copyleft ensures that software code and the documentation of how to use that code remain, to quote Stallman, "free as air."

When Stallman worked through the seventies at the AI lab at MIT, things were different. There was no market, hence no marketplace. Programmers and other computer users routinely shared files and software. Everything was "open source" simply because there wasn't much around. They were creating it. Even corporate-owned software, tools, and systems -- the C language, the Unix System, the Internet, etc. -- had to be invented before they could be locked away, given away, or shared according to what could or could not be feasibly controlled and by what means.

"When I started working at the MIT Artificial Intelligence Lab in 1971, I became part of a software-sharing community that had existed for many years. Sharing of software was not limited to our particular community; it is as old as computers, just as sharing of recipes is as old as cooking... We did not call our software "free software", because that term did not yet exist; but that is what it was. Whenever people from another university or a company wanted to port and use a program, we gladly let them. If you saw someone using an unfamiliar and interesting program, you could always ask to see the source code, so that you could read it, change it, or cannibalize parts of it to make a new program," Stallman wrote on the GNU web site (http://www.gnu.org/gnu/thegnuproject.html).

But once the corporate sector figured out how to make money and that there was money to be made, things changed. The "community" that Stallman worked with during the seventies, developing the prototypes for what we take for granted as the modern operating systems of today, was gone by 1981, hired away by corporations arming themselves for the coming computer market wars, or prohibited, by non-disclosure laws of proprietary systems, from exercising the kind of freedom that resulted in creativity and experimentation.

Stallman wrote, "This meant that the first step in using a computer was to promise not to help your neighbor. A cooperating community was forbidden. The rule made by the owners of proprietary software was, 'If you share with your neighbor, you are a pirate. If you want any changes, beg us to make them. The idea that the proprietary-software social system - the system that says you are not allowed to share or change software - is antisocial, that it is unethical, that it is simply wrong, may come as a surprise to some readers. But what else could we say about a system based on dividing the public and keeping users helpless? Readers who find the idea surprising may have taken proprietary-software social system as given, or judged it on the terms suggested by proprietary software businesses. Software publishers have worked long and hard to convince people that there is only one way to look at the issue." (http://www.gnu.org/gnu/thegnuproject.html)

Stallman's questioning of the corporate assumptions that software must be owned by corporate mediators and licensed to users is examined in detail on the GNU.org site's philosophy pages; e.g., arguments for free software (http://www.gnu.org/philosophy/why-free.html) and against terminology such as "intellectual property" (http://www.gnu.org/philosophy/not-ipr.xhtml).

With the development of GNU, as with most revolutionary movements, there was no middle ground for compromise.

Stallman wrote, "With my community gone, to continue as before was impossible. Instead, I faced a stark moral choice. The easy choice was to join the proprietary software world, signing nondisclosure agreements and promising not to help my fellow hacker. Most likely I would also be developing software that was released under nondisclosure agreements, thus adding to the pressure on other people to betray their fellows too. I could have made money this way, and perhaps amused myself writing code. But I knew that at the end of my career, I would look back on years of building walls to divide people, and feel I had spent my life making the world a worse place." (http://www.gnu.org/gnu/thegnuproject.html)

The history of his response to this choice can be found in extensive detail on the GNU.org site. What Stallman did, in a nutshell, was to write The GNU Manifesto (http://www.gnu.org/gnu/manifesto.html) in which he explained to his fellow hackers and the computer using community at large the issues they faced and his determination to create a fully functional Unix-like operating system, but written from scratch, with no proprietary code, and absolutely free. His goal was to make it as good as or better than Unix -- and in this, many agree, he succeeded; various GNU tools, programs, applications and components (such as the C library and compiler, GCC) are faster, more robust, and offer more options than their proprietary counterparts. But even if he had to fall short of that goal in order to keep GNU absolutely free, he would have done so.

It is in this spirit that the GNU GPL and other copyleft licenses and declarations of "non-ownership" are based. The creation of the copyleft type of license is as radical as the creation of the GNU software itself. It takes the corporate idea of "ownership" and "copyright" created to serve a few at the expense of the many, inside out, and upside down. In order for code to be considered Free Software and therefore useable under the GNU GPL, it must be accessible to all. Anyone can change it, customize it, or make improvements on it, so long as the original code and authorship is included and this new code is also open for others to examine and modify, whether for personal customization or general improvement.

One misconception is that "free software" means that one cannot charge money for it. In fact, the opposite is the case. In the early days the FSF earned the bulk of its funding not through donations, but sales of its manuals, hard-copy books, and software. Though this is no longer true today, the FSF still sells software documentation and books on their website.

"Free as in free speech, not free beer" is the GNU slogan that sums it up best. One is free to charge for such services as distribution or redistribution of software, writing documentation or new software based on the original GPL code, etc., so long as the source remains free, prior versions and authors are listed, and other rules of the GNU GPL are followed.

While it is possible to download the Linux kernel, all of GNU's several thousand programs and applications, and the hundreds of third-party offerings for GNU/Linux, such as the X Windows GUI and window managers, the KDE desktop environment (which I'll examine in further detail in Part Two of this article) and many other components, the easiest and least time-consuming way to obtain GNU/Linux, especially for those who are new to to it, is to plunk down roughly $30 for a "distribution" on CD or DVD from companies such as Red Hat, Debian, SuSE, and others.

These companies make money by gathering all the components of GNU/Linux under one roof, in addition to adding their own components, such as SuSE's YaST GUI system manager, or Red Hat's RPM (Red Hat Package Manager) software bundling application. Nearly all the distributions come with customized easy-install GUI interfaces for new users.

GNU + Linux = GNU/Linux?

While the popularity of GNU/Linux is exploding, Stallman and others in the free software community face significant threats from a Corporate friendly business environment, always ready to lend a legal hand with restrictive copyright law. Then there's the jealous rage of Microsoft, who views the FSF and its works as a significant threat worth spending a lot of money on (and spending lots of money to make people miserable is what Microsoft does best, second only to charging lots of money for making people miserable).

But the most serious threat comes from the "Linux" community itself. Very few people outside of GNU and the FSF refer to GNU/Linux as anything but "Linux." In addition, as with all successful radical movements, as we move further in time from the origins of the necessary development of free software, people tend to associate less with "free software" and more with "Linux" itself, as if it were a sports team or some other symbolic source of identification, like "America."

Thus, many will root for the success of the nominally free "Linux" over "Microsoft" in winning the bid for a Government/Military computing contract or the unofficial "support" of governments, such as China or India and other political entities supporting the development of GNU/Linux as the "official state Operating System," or what not. Working for the authorities to help destroy the Gaea and impinge on freedom is supposed to be the job of proprietary operating systems, not GNU/Linux! But then, as Stallman himself said, GNU was developed to solve some of the world's problems, not all of them. Though the success of GNU and GNU/Linux, representing a victory of a community of individuals (that began with hundreds and has grown to millions) over a handful of corporate superpowers forces anyone who values his/her liberty to pause and wonder: what else is possible? What else can be done to change this mess for the better?

In response to my confusion regarding the free software versus the "open source" movements, Stallman emailed me this information, put out by Slackware, a GNU/Linux distribution:

from THE SLACKWARE BOOK:


Open Source and Free Software

Within the Linux community, there are two major ideological movements at
work. The Free Software movement, which we'll get into in a moment, is
working toward the goal of making all software free of intellectual
property restrictions, which it believes hamper technical improvement and
work against the good of the community. The Open Source movement is working
toward most of the same goals, but takes a more pragmatic approach to
them, preferring to base its arguments on the economic and technical merits
of making source code freely available, rather than the moral and ethical
principles that drive the Free Software Movement. The Free Software movement
is headed up by the Free Software Foundation, which is a fund-raising
organization for the GNU project. Free software is more of an ideology.
The oft-used expression is "free speech, not free beer". In essence, free
software is an attempt to guarantee certain rights for both users and
developers. These freedoms include the freedom to run the program for any
reason, the freedom to study and modify the source code, the freedom to
redistribute the source, and the freedom to share any modifications you
make. In order to guarantee these freedoms, the GNU General Public License
(GPL) was created. The GPL, in brief, provides that anyone distributing a
compiled program which is licensed under the GPL must also provide source
code, and is free to make modifications to the program as long as those
modifications are also made available in source code form. This guarantees
that once a program is opened to the community, it cannot be closed
except by consent of every author of every piece of code (even the
modifications) within it. Most Linux programs are licensed under the GPL.

It is important to note that the GPL does not say anything about price. As
odd as it may sound, you can charge for free software. The "free" part is
in the liberties you have with the source code, not in the price you pay
for the software. (However, once someone has sold you, or even given you, a
compiled program licensed under the GPL they are obligated to provide its
source code as well.)

At the forefront of the younger Open Source movement, the Open Source
Initiative is an organization that solely exists to gain support for open
source software. That is, software that has the source code available as
well as the ready-to-run program. They do not offer a specific license, but
instead they support the various types of open source licenses available.

The idea behind the OSI is to get more companies behind open source by
allowing them to write their own open source licenses and have
those licenses certified by the Open Source Initiative. Many companies want
to release source code, but do not want to use the GPL. Since they cannot
radically change the GPL, they are offered the opportunity to provide their
own license and have it certified by this organization.

While the Free Software Foundation and the Open Source Initiative work to
help each other, they are not the same thing. The Free Software Foundation
uses a specific license and provides software under that license. The Open
Source Initiative seeks support for all open source licenses, including the
one from the Free Software Foundation. The grounds on which each argues for
making source code freely available sometimes divides the two movements, but
the very fact that two ideologically diverse groups are working toward the
same goal lends credence to the efforts of each.

Thus, Stallman and others in the Free Software movement are opposed to any compromise that would threaten the initial goal of a free operating system. For instance, KDE.org, which develops a full desktop environment that enables the "average user" to use GNU/Linux as easily as he/she would Windows or Macintosh, with little or no knowledge of basic Unix or GNU/Linux commands, utilized a proprietary code called Qt. Rather than accept this breach of the GPL, GNU developed an alternative desktop environment called GNOME (www.gnome.org). Fortunately, KDE licensed Qt under the GPL, so now users have two Windows/Mac-like GUI environments to choose from. But if push came to shove, those dedicated to the principles of the free software movement would have stuck with GNOME even if it was behind scheduled release or was qualitatively inferior to KDE, while those in the "open source" movement, whose primary goal is the development of "Linux" into an operating system that will compete on a global scale with Microsoft, might have accepted the proprietary use of Qt.

Ben Okopnik, Editor-in-Chief of the Linux Gazette, wrote, "The proprietary bits of Qt were a problem. They did a tremendously intelligent thing by opening it up; KDE, and Qt development in general, simply exploded as soon as they did."

But even Stallman admits that there will be other threats to an absolutely free software movement, particularly by "open source," espoused by corporations who cannot bear even the word "freedom."

Stallman wrote, "Teaching new users about freedom became more difficult in 1998, when a part of the community decided to stop using the term "free software" and say "open source software" instead. Some who favored this term aimed to avoid the confusion of "free" with "gratis"-- a valid goal. Others, however, aimed to set aside the spirit of principle that had motivated the free software movement and the GNU project, and to appeal instead to executives and business users, many of whom hold an ideology that places profit above freedom, above community, above principle. Thus, the rhetoric of "open source" focuses on the potential to make high quality, powerful software, but shuns the ideas of freedom, community, and principle...The support of business can contribute to the community in many ways; all else being equal, it is useful. But winning their support by speaking even less about freedom and principle can be disastrous; it makes the previous imbalance between outreach and civics education even worse...."Free software" and "open source" describe the same category of software, more or less, but say different things about the software, and about values. The GNU Project continues to use the term "free software", to express the idea that freedom, not just technology, is important."(http://www.gnu.org/philosophy/philosophy.html).

In my email interview with Stallman, I too made the mistake of equating "free" with "open source."

Stallman wrote, "You mentioned the FSF but not the Free Software Movement, which leads me to wonder if you have fallen prey to a common misunderstanding. Did you know that the Open Source Movement is a right-wing reaction against the Free Software Movement, which came first? Many people think that I support the Open Source Movement. The reason they think so is that the people in the Open Source Movement work hard to give that impression. Since they have the support of corporations and the main media, they have spread this misunderstanding quite far. But it's as mistaken to label my work as 'open source' as to label Nader 'Republican'."

Stallman is a visionary and, like Nader, a people's advocate, only more so. His advocacy stretches beyond the efficiency of consumer goods and laws protecting consumer rights and into the discussion of the basis of The Law itself. Who is The Law serving, computer users and programmers, that is, citizens of a free society, or mere consumers in a market whose rules are defined and created by the corporations who, should they have their way, will not merely monopolize the market, but be the market, the only alternative for those who wish to write and use computer programs?

Stallman and others like him are the incorruptible, uncompromising fighters the left has been calling for, all the while we settle for the lesser of evils or hope the Democratic Party, the political arena's version of the "open source initiative" will somehow manage to beat the corporate state while joining it. The struggle to defend the basic rights of software users and developers inherent in the free software movement and its creation of the GNU/Linux alternative to proprietary systems is obvious. This struggle is not merely about being free at the computer, but living free everywhere. GNU can't solve all the world's problems, but the values it espouses can be harnessed in support of any struggle, whether for a clean environment or a real democracy, rather than the bloated, trash-talking, murderous Empire we think, like those befuddled by the rhetoric of proprietary software corporations, we have no choice but to accept as "The Nature of Things."

Again, Stallman, linking the rhetoric of epic struggle with its counterpart in modern film, writes of a fight worth fighting for, and his words resonate, even as we squander lives by the thousands in Iraq:

"Yoda's philosophy ('There is no "try"') sounds neat, but it doesn't work for me. I have done most of my work while anxious about whether I could do the job, and unsure that it would be enough to achieve the goal if I did. But I tried anyway, because there was no one but me between the enemy and my city. Surprising myself, I have sometimes succeeded... Sometimes I failed; some of my cities have fallen. Then I found another threatened city, and got ready for another battle. Over time, I've learned to look for threats and put myself between them and my city, calling on other hackers to come and join me... Nowadays, often I'm not the only one. It is a relief and a joy when I see a regiment of hackers digging in to hold the line, and I realize, this city may survive--for now. But the dangers are greater each year, and now Microsoft has explicitly targeted our community. We can't take the future of freedom for granted. Don't take it for granted! If you want to keep your freedom, you must be prepared to defend it." (http://www.gnu.org/philosophy/philosophy.html).

Well, what are we waiting for? Where do we stand?


Creative Commons License
This work is licensed under a Creative Commons License. It is free to distribute, reproduce or modify with the author's consent. Read more about licensing software, text and documentation at http://www.creativecommons.org.


[BIO] Adam Engel has published poetry, fiction and essays in such magazines and periodicals as Counter Punch, Dissident Voice, Online Journal, Strike-the-Root, LewRockwell.com, The New York Art Review, The Concord Journal, The Middlesex News, Accent, The Littleton Review, Ark, Smart Shoes, The Beacon, Literal Latte, Artemis, The Lummox Journal, Fearless, POESY, The Half Moon Review, Art:Mag, Chronogram, Gnome and others.

Adam Engel's first book of poetry, Oil and Water, was published by Maximum Capacity Press in 2001. His novel, Topiary, will be published by Dandelion Books in the Spring of 2005.

He has worked as a journalist, screenwriter, executive speechwriter, systems administrator, and editorial consultant, and has taught writing at New York University, Touro College and the Gotham Writer's Workshop in New York City.

Copyright © 2005, Adam Engel. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

ParallelKnoppix

By Majid Hameed

What is ParallelKnoppix?

Abstract

ParallelKnoppix is a Live CD based on Knoppix, which is also a Live CD that is itself based on the Debian Linux distribution. ParallelKnoppix lets you create a Linux cluster equipped with parallel programming tools/libraries such as MPI in just a few minutes. It saves a lot of time that we spend in configuration of the computing environment. The existing environment is not disturbed using ParallelKnoppix, since a Live CDs distribution runs without installation (a directory is created on the Master Node; it can be deleted after rebooting if desired.)

(From http://pareto.uab.es/mcreel/ParallelKnoppix/):

ParallelKnoppix is a re-master of Knoppix that allows setting up a cluster of machines for parallel processing using the LAM-MPI and/or MPICH implementations of MPI. Getting the cluster up and running takes less than 15 minutes, if the machines have PXE network cards.

Background

Clustering is one of the cheapest techniques to achieve parallelism. Clustering by using Linux is one of the Linux powers. A number of universities and other organizations mimic supercomputing by connecting PCs via Ethernet cards under Linux. Linux has been widely adopted by the scientific community to do their research work since it is loaded with a number of scientific tools such as LAM, MPI, PVM, and many more, so Linux is well suited for parallel computing. But the problem is that scientists and programmers have to do a lot of pre-configuration of the Linux environment. This makes their task slow and complex.

Now, the Linux gurus have solved this problem by developing Live CDs. Now the researcher can choose a Live CD to do parallel programming without the need for long configuration and the cluster is ready within a few minutes.

One of the Live CDs for parallel programming is ParallelKnoppix. Other Live CDs, such as BCCD and ClusterKnoppix, are also available.

Description

Just like its predecessor Knoppix, ParallelKnoppix will detect all the hardware and peripherals automatically. I have tested it on a D865GBF Intel P-IV board as well as an Intel 810C (P-III), and ParallelKnoppix configured all the hardware automatically - nothing else needed to be done. The computers that are configured using ParallelKnoppix share a common directory, which is created on master node via NFS (the Network File System). The Master node is booted using the CD and the slaves are booted using the network (the Master node runs a DHCP server.) The slaves have PXE-enabled BIOSes with PXE-compliant NICs.

Each and every service needed for LAM/MPI is configured automatically. DHCP, NFS, SSH (with passwordless logins) are all set up and running - and you are ready to experiment with MPI programs and other parallel applications.

As set up, ParallelKnoppix is not very secure - the Live CD password for both the regular user and the super user (root) are publicly known. Anyone with even a little knowledge of ParallelKnoppix can easily access the ParallelKnoppix cluster. In this case, the ease of setup is obtained by compromising some security as a trade-off.

[ As a general rule of thumb, your ParallelKnoppix network should be isolated from the Internet, and usually even your intranet, if security is at all a concern. -- Ben ]

What is PXE boot?

PXE is an acronym for the Preboot Execution Environment, a technology that is used to boot a PC remotely through a network. PXE must be supported by the system BIOS, and the network interface card needs to be PXE compliant.

What do I do if my NIC is not PXE-compliant?

You'll need to either install a ROM chip with an Etherboot image on your NIC, or burn a CD using the image; ROM-o-matic.net dynamically generates Etherboot ROM images.

Downloading ParrallelKnoppix

The ISO file is available at the following locations:

via FTP: ftp://volcano.uab.es/pub/parallelknoppix.iso

via HTTP: http://pareto.uab.es/mcreel/ParallelKnoppix/parallelknoppix.iso

MD5SUM for the image: http://pareto.uab.es/mcreel/ParallelKnoppix/parallelknoppix-2004-12-16.iso.md5

Check the home page if the above links expire.

After downloading the ISO images, check the MD5 checksums against the ISO images to ensure that your download was successful. Do this by running the md5sum program from a shell prompt and comparing the values returned:

md5sum isofilename

In the above command, replace isofilename with the correct file name.

If you are for some reason not using Linux, you can use md5Summer for Windows. An MD5 summer for DOS is also available.

If the MD5 sums match, burn the ISO images to CDRs or CDRWs. Note: writing the ISOs to CD requires a program such as cdrecord.

How does it work?

There is a nice Parallel Knoppix tutorial full of step-by-step instructions, screen shots of the configuration process, etc., available here in HTML format or here in PDF. If you exported your CD-ROM to the nodes, it will easily accommodate 50 nodes, but more than that have not been tested. I actually tested only 5 nodes myself.

What do I do if multiple DHCP servers are running?

If using this at a university (like I do), you're likely to run afoul of the "official" DHCP server, and possibly another PXE server. When you try to boot the nodes using the terminal server, the nodes will often boot from the pre-existing PXE server, and they will often get their IP addresses from the official server, not the DHCP server running on the computer that was booted from the ParallelKnoppix CD. The solution I have so far is to physically disconnect the computers to be used as nodes from the pre-existing PXE and/or DHCP servers, or to get help from the administrators to temporarily disable those servers. If anyone knows a more elegant solution, I'd like to hear about it. I think it involves messing around with miniroot.gz, and using Rom-o-Matic to create the PXE boot ROM. Too horrible for further contemplation... at least for me.

How it works (Summary)

The ParallelKnoppix Live CD is used to boot a master node. Once the master node is up, a script is executed which sets up a DHCP server, shares a common working directory to all nodes using NFS, generates the public keys for SSH to work properly (passwordless logins), etc. After DHCP on the master node is running, the clients (slaves) are booted using PXE boot. After the successful booting the sample directory is copied to the NFS shared common directory and programs begin executing in parallel on multiple PCs.

My experience

I am an undergraduate student of computer science and I was given a project to solve a mathematical problem using MPI in the parallel computing lab. I chooses ParallelKnoppix as an alternative to demonstrate my MPI program in the Linux environment. When the master node is booted using the ParallelKnoppix CD, at some point during the boot it will ask you the resolution; just enter '6', because it is the maximum resolution mode supported. After my Master Node booted, I ran the setup script (K -> ParallelKnopix -> Setup ParallelKnoppix, per the above tutorial). When the script had created the DHCP server, I turned on my slave nodes and let them boot using PXE. All the nodes booted successfully.

I then copied my program to parallel_knoppix_working, and ran my MPI program in parallel. It was literally that simple.

For compilation, I use

mpicc myprogram.c -o myprogram.bin

For execution, I use

mpirun C myprogram.bin

Conclusion

"The ParallelKnoppix CD provides a very simple and rapid means of setting up a cluster of heterogeneous PCs of the IA-32 architecture. It is not intended to provide a stable cluster for multiple users, rather it is a tool for rapid creation of a cluster for individual use. The CD itself is customizable, and the configuration and working files can be re-used over time, so it can provide a long-term solution for an individual user."
-- From the ParallelKnoppix Tutorial By Michael Creel

References

The ParallelKnoppix Homepage
http://pareto.uab.es/mcreel/ParallelKnoppix/

Discussion Paper on Parallel Knoppix By Michael Creel (14th October 2004)
http://pareto.uab.es/wp/2004/62504.pdf

High Performance Linux Clusters with OSCAR, Rocks, OpenMosix, and MPI By Joseph D. Sloan
Publisher: O'Reilly Associates
Pub. Date: November 2004
http://safari.oreilly.com/0596005709
http://safari.oreilly.com/?XmlId=0596005709

The Knoppix Homepage
http://www.knopper.net/knoppix/index-en.html
http://www.knoppix.org/
http://www.Knoppix.com
http://www.Knoppix.net

ROM-o-matic.net
http://rom-o-matic.net/

LAM/MPI Parallel Computing
http://www.lam-mpi.org/

LAM/MPI User's Guide
http://www.lam-mpi.org/download/files/7.1.1-user.pdf


[BIO] Majid Hameed is an undergraduate student at Department of Computer Science at the University of Karachi, Sindh, Pakistan. Primary interests are Artificial Intelligence, Operating Systems, Networking, Programming and Computer Graphics.

I am a Linux enthusiast. I am using Linux as an operating system for the last 3.5 years. Used and tried these distros: Red Hat Linux 9, 8, 7.3, 7.2, Slackware Linux 10, 9.1, Slax, Mandrake Move 2, Knoppix 3.4, Vector Linux 4.3, and some more.

Copyright © 2005, Majid Hameed. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

A Knight's Tour on OCaml (when a Python fails to digest it)

By Kapil Hari Paranjape

Introduction

The story begins1 when my daughter's teacher, who is then busy grading the end-term examination papers, wanted to give the class some busy work. So the teacher asked the children to find a ``Knight's tour''---make a knight jump around on a chess board starting and ending at the same square and landing on each other square exactly once. Naturally, this problem landed on my doorstep at the end of the school day---the teacher happens to know that I do mathematics!

I have heard that this problem has a solution but don't know one---typical Mathematician---stops at the point where ``solution exists''. So why not write a program to solve the problem? While the going is good, I could also use this opportunity to learn to use another programming language.

The quick and the dirty

Let's start by writing a program in a scripting language like Python---it is fun writing a program in a new language when you are reasonably sure that the code will not be longer than about a 100 lines!

The key pseudo-code can be stated as follows:

      extension of a partial solution =
            if (Length of the partial solution is 64) then
                  if (the solution closes on itself) then
                        return the solution
                  else
                        return false since this is not a solution
            else
                  for each position in available moves
                   that has not already been occupied
                     try  extension of the new partial solution
                           obtained by extending the current solution
                           by this move
We then start with any position on the chess-board and find an extension of it by 63 more moves.

This is programmed in Python quite easily. We use the Python ``workhorse'' data structure---the list. A partial solution is a list of positions which we think of as the sequence of moves.

def   extend(soln):
      if len(soln) == 64:
            if soln[-1] in moves(soln[0]):
                  return soln
            else:
                  return False
      else:
            for newpos in moves(soln[0]):
                if newpos in soln:
                   continue
                sol=extend([newpos]+soln)
                if not sol:
                   continue
                else:
                   return sol
            return False
There is a nasty tail to this Python program fragment (the tail consists of 63 returns) but that should not be serious if we have enough stack space. For us quicky-types ``optimization'' is a dirty word.

We also need to write routines that will generate the list of all possible moves at a given position.

If we represent positions on the board as pairs then the moves that a knight can make are given by

   [(-1,-2), (-2,-1), (1,-2), (-2,1), (-1,2), (2,-1), (1,2), (2,1)]
then the code fragment for this looks like
knightsmoves = [(-1,-2), (-2,-1), (1,-2), (-2,1), \
                (-1,2), (2,-1), (1,2), (2,1)]

def add(pos1,pos2):
      return (pos1[0] + pos2[0], pos1[1] + pos2[1])

def onboard(pos):
      return (pos[0] >= 0) and
             (pos[0] < 8)  and
             (pos[1] >= 0) and
             (pos[1] < 8)

def moves(pos):
       return [newpos for newpos in
                          [add(pos,move) for move in knightsmoves]
                      if onboard(newpos)]
Unfortunately, as it stands this program has no hope of producing an answer in reasonable time. The reason is that we are trying all possible moves in succession whereas we should be first going to the square which cannot be easily reached from elsewhere. This means that we need some new functions.
def filmoves(pos,soln):
      return [newpos for newpos in moves(pos)
                     if not (newpos in soln)]

def compval(pos1,pos2,soln):
      return len(filmoves(pos1,soln)) - len(filmoves(pos2,soln))

def sortedmoves(soln):
      list = filmoves(soln[0],soln[1:])
      list.sort(lambda x,y: compval(x,y,soln))
      return list
The first function filters out moves already ``used up''. The second uses this to compare two squares based on number of moves currently available. The last function uses this comparison to sort the moves. Note that we must also make a minor change to the extend function to make it use sortedmoves (Warning: Only use sortedmoves in the second call!).

According to authoritative sources (authoritative at least according to Google!) this particular algorithm was proposed by Warnsdorff in 1823. The above program is simple enough that we can ``see'' that it is correct and do not need any fancy verification procedure. Why then does is fail to give an answer when we start at the corner (0,0)? Surely a modern computer can beat a man born in 1823 in calculating things! What's wrong?!

If you don't believe me or believe that your computer is faster then just copy the code or type it in yourself and give it a whirl!

      $ python
      Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
      [GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
      Type "help", "copyright", "credits" or "license" for
         more information.
      >>> from knights import *
      >>> extend([(0,0)])
The program now appears to go sleep...!

Perhaps the reason is that Python is interpreted byte-code. A compiled language would be better. So we can set about downloading and installing psyco---a just-in-time native code compiler for Python. Meanwhile, we could try a ``real'' functional language---perhaps its implementation of lists is better. Maybe we can fit in time for a few functional programming tricks and see if tail-recursion is possible. (If you want a preview of the real answer, then jump to the Denouement.)

A humpy ride on OCaml

(I do happen to know that there is a more famous camel that appears more often in the pages of the Linux Gazette.) A nice candidate for our next choice of language is OCaml (this is also talked about in an article in an earlier Gazette). It is claimed that the optimizing native-code compiler for OCaml can beat even C in certain tasks. I have actually used the DVI previewer advi, the LATEX to HTML converter hevea2 and the file synchronizer unison; all these are written in OCaml and are quick and do the job well. Secondly, it would be a pain to sit and implement all the data structure management for lists in C just for this. So the knight must try to tour again---this time atop OCaml3.

Just to clarify some of the differences let plays the role of def and lists are constructed in the form [a;b;c;d]. The syntax is also a little more arcane but should be clear from the programs below.

While we are at it we can also introduce a tweak that avoids computing the length of a list all the time. Here is extend written in OCaml (the rec indicates a recursive definition):

let rec extend1 start len soln =
      if (len == 64)
      then
        if List.mem start (moves (List.hd l))
        then soln
        else []
      else
        do_until (fun b -> extend1 start (len+1) (b::soln))
                 (sortedmoves soln);;

let extend start = extend1 start 1 [start];;
where do_until applies a function to a list until it produces an answer or is empty:
let rec do_until f = function
      | [] -> []
      | h::t -> match f h with
                | [] -> do_until f t
                | answer -> answer;;
The | is used to introduce a pattern to match.

As before we need to define the functions that will produce the list of available moves.

let knightsmoves = [(-1,-2); (-2,-1); (1,-2); (-2,1);
                   (-1,2); (2,-1); (1,2); (2,1)];;

let add (a,b) (c,d) = (a+c,b+d);;
 
let onboard (a,b) =
 (a >= 0) && (a < 8) &&
 (b >= 0) && (b < 8);;

let moves pos =
     List.filter (onboard)
                 (List.map (add pos) knightsmoves);;

let filmoves pos soln = 
     List.filter (fun b -> not (List.mem b soln)) (moves pos);;

let compval soln pos1 pos2 =
     (List.length (filmoves pos1 soln)) -
      (List.length (filmoves pos2 soln));;

let sortedmoves soln =
     List.sort (compval soln)
               (filmoves (List.hd soln) (List.tl soln));;
As you can see the ``pattern matching''-way of defining things in OCaml really simplifies definitions.

We can string all these together - with the caveat that one must define a term before using it. So the later definitions have to come before the earlier ones. Programming languages which require declarations to come in order are best programmed ``bottom-up'' unless one can sort out all the details in one's head before putting a finger to the keyboard.

Now one can run the program by entering the interpreted mode of OCaml

      $ ocaml
       Objective Caml version 3.08.2

      # #use "knights.ml";;
      val knightsmoves : (int * int) list =
      [(-1, -2); (-2, -1); (1, -2); (-2, 1); (-1, 2); (2, -1); (1, 2);
      (2, 1)]
      val add : int * int -> int * int -> int * int = <fun>
      val onboard : int * int -> bool = <fun>
      val moves : int * int -> (int * int) list = <fun>
      val filmoves : int * int -> (int * int) list -> (int * int) list
      = <fun>
      val compval : (int * int) list -> int * int -> int * int -> int =
      <fun>
      val sortedmoves : (int * int) list -> (int * int) list = <fun>
      val do_until : ('a -> 'b list) -> 'a list -> 'b list = <fun>
      val extend1 : int * int -> int -> (int * int) list -> (int * int)
      list = <fun>
      val extend : int * int -> (int * int) list = <fun>
      # extend (0,0)
But then the system goes to sleep as before .... The whole reason for trying OCaml was to compile the code in the hope of a faster response! So we need to run the native code compiler.

Before we do that however we need to have some way to do input and output, so a little more programming is involved. Our program produces output as a list of moves in order, what we want to output is the position of each square in this list. Since output happens only once we don't need to be particularly efficient.

let rec indexadd n pos soln =
      match (List.hd soln) with
      | pos -> n
      | _   -> indexadd (n-1) pos (List.tl soln);;

let index pos soln = indexadd 64 pos soln;;

let printsoln soln =
      (* Print the top line *)
      for i = 1 to 8 do
            Printf.printf "-----";
      done;
      Printf.printf "-\n";

      for i = 0 to 7 do
            for j = 0 to 7 do
                  Printf.printf "| %2i " (index (i,j) soln);
            done;
            Printf.printf "|\n";
            (* Print a line below *)
            for j = 1 to 8 do
                  Printf.printf "-----";
            done;
            Printf.printf "-\n";
      done;;
Finally, the input procedure. For some strange reason OCaml uses !pointer to reference the contents - so the ! sign below is not a ``not''.
if (!Sys.interactive)
then
      (* If we are loaded in the interpreter do nothing *)
      ()
else
      if (Array.length Sys.argv) > 2
      then
        print_soln
          (extend
             (int_of_string Sys.argv.(1), int_of_string Sys.argv.(2))
          )
      else
        Printf.printf "Usage: %s x y\n" (Sys.argv.(0));;
Now we are all set. The compilation
       $ ocamlopt -o knights knights.ml
produces a standalone program knights. So here goes
$ ./knights 0 0
...and nothing happens!

Again, if you don't believe me, or you believe your computer is faster, you can download the OCaml source, compile it, and try it for yourself!

Denouement

Home for the day and I don't have OCaml on my home machine so I wrote the program afresh in Python. This time I felt too lazy to type in the knights moves again so I added:
knightsmoves = [((-1)**y*(1+x), (-1)**z*(2-x)) \
                         for x in [0,1] \
                         for y in [0,1] \
                  for z in [0,1]]

When I ran the program again I got
         $ python
         Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
         [GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
         Type "help", "copyright", "credits" or "license" for more
         information.
         >>> from knights import *
  >>> extend([(0,0)])
  [(2, 1), (0, 2), (2, 3), (4, 4), (6, 5),
  (7, 7), (5, 6), (3, 5), (1, 4), (3, 3),
  (5, 4), (4, 2), (3, 4), (4, 6), (2, 7),
  (0, 6), (2, 5), (0, 4), (1, 6), (3, 7),
  (4, 5), (5, 3), (6, 1), (7, 3), (5, 2),
  (4, 0), (3, 2), (2, 4), (4, 3), (2, 2),
  (1, 0), (3, 1), (5, 0), (7, 1), (6, 3),
  (7, 5), (6, 7), (5, 5), (7, 4), (6, 6),
  (4, 7), (2, 6), (0, 7), (1, 5), (0, 3),
  (1, 1), (3, 0), (5, 1), (7, 0), (6, 2),
  (4, 1), (6, 0), (7, 2), (6, 4), (7, 6),
  (5, 7), (3, 6), (1, 7), (0, 5), (1, 3),
  (0, 1), (2, 0), (1, 2), (0, 0)]
  >>>
Surprise! Here is a solution at last!

At this point, a bell somewhere had gone ``dung''... and I wasn't sure it was OCaml that did it---perhaps it was the prunes!

Then my daughter came over and said she had followed the algorithm by hand and come up with a solution. Her solution started at the square (4,4) so I tried that with the knights program compiled with OCaml.

$ ./knights 4 4
-----------------------------------------
|  9 |  6 | 11 | 44 | 27 |  4 | 29 | 34 |
-----------------------------------------
| 12 | 43 |  8 |  5 | 46 | 33 | 26 |  3 |
-----------------------------------------
|  7 | 10 | 45 | 48 | 55 | 28 | 35 | 30 |
-----------------------------------------
| 42 | 13 | 54 | 63 | 32 | 47 |  2 | 25 |
-----------------------------------------
| 53 | 60 | 49 | 56 |  1 | 62 | 31 | 36 |
-----------------------------------------
| 14 | 41 | 64 | 61 | 50 | 19 | 24 | 21 |
-----------------------------------------
| 59 | 52 | 39 | 16 | 57 | 22 | 37 | 18 |
-----------------------------------------
| 40 | 15 | 58 | 51 | 38 | 17 | 20 | 23 |
-----------------------------------------
I decided then to check the authoritative source via Google once more. What it really says is that Warnsdorff's algorithm is for a Hamiltonian path---a path that takes a knight through each square exactly once---it is not necessary to return to the starting square.

What my experience with these programs shows is that Warnsdorff's algorithm is can find a Hamiltonian circuit reasonably quickly in some cases. Perhaps unsurprisingly it's success depends on the order in which one looks at the moves of the knights. For example, the above Python code to generate knightsmoves actually gives

[(1, 2), (1, -2), (-1, 2), (-1, -2), (2, 1), (2, -1), (-2, 1), (-2, -1)]
Perhaps a little more surprising (since the final solution is circular) is the fact that the running time depends on the starting point. Indeed I got running times of a few milliseconds, a few seconds and a few hours (one process has been running for more than a couple of days!) for different inputs to the same program!

This may be rather typical of ``hard'' problems. There are a number of ``cheap'' instances and a number of truly ``hard'' instances but this distinction depends on where one starts---pure dumb luck decides whether one can solve the problem or not. (Actually it appears that the knights tour is not really a ``hard'' problem as one increases the size of the board (see Exercise 4, just below).)

Exercises

Here are some things that suggest themselves:
  1. Try to find some real way to prove that the Python is better than OCaml or vice versa. Or more generally settle the great wars between functional and procedural programming!
  2. Try to randomize the choice from amongst the lowest valency vertices if there is more than one. This may result in shorter average times for all starting points.
  3. Try to add an extra weight to ensure that vertices further away from the start are taken up sooner than other vertices of the same valency. Perhaps this will be more efficient.
  4. There is apparently a better algorithm than Warnsdorff's for the Hamiltonian circuit. Find it and implement it.

Afterword

What does this article have to do with Linux or the Gazette? In a way, it is only due to the emergence of GNU and Linux that we have an opportunity to program in a wonderful plethora of languages. At the same the time the article above could be fit into one of the ``Foolish Things We do With Our Computers'' series or even in a new series called ``Nasty Things Our Computers Do To Us''!
1
. In case you are wondering what this talk has to do with Linux or the Gazette my justification is in the AfterWord, just above.
2
. This HTML file has been converted using the TeX source and Hevea
3
. Apparently, the idea of Python programs (and programmers!) turning to OCaml is not one that occurred to me alone.

This document was translated from LATEX by HEVEA.


[BIO] Kapil Hari Paranjape has been a ``hack''-er since his punch-card days. Specifically, this means that he has never written a ``real'' program. He has merely tinkered with programs written by others. After playing with Minix in 1990-91 he thought of writing his first program---a ``genuine'' *nix kernel for the x86 class of machines. Luckily for him a certain L. Torvalds got there first---thereby saving him the trouble (once again) of actually writing code. In eternal gratitude he has spent a lot of time tinkering with and promoting Linux and GNU since those days---much to the dismay of many around him who think he should concentrate on mathematical research---which is his paying job. The interplay between actual running programs, what can be computed in principle and what can be shown to exist continues to fascinate him.

Copyright © 2005, Kapil Hari Paranjape. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

Preparing For My Interviews Part 2: MySQL and Python

By Mark Nielsen

Preparing For My Interviews Part 2: MySQL and Python

By Mark Nielsen

  1. Introduction
  2. Mysql Master/Slave and Clusters
  3. The Python script and Python Module MySQL.py.
  4. Executing the Python script.
  5. Some commands to execute.
  6. Next Month: Stored Procedures in MySQL (5.0?)
  7. Conclusion


Introduction

This article is actually a lie. I am not preparing for interviews anymore. I started this article at the end of October, but then I got a 2 month contract right after that. Still, it's the thought that counts.

This article is to help you setup MySQL Master/Slave/Cluster combinations on one computer. Why would that be useful? Well, for starters, there isn't an abundance of Master/Slave/Cluster documentation. The Cluster technology is really new. Second, MySQL is a very very very hot database. There aren't too many good MySQL DBAs out there. If you want to secure your job in the future, learn MySQL. The Master/Slave and Cluster technologies are a must. If you don't know anything about the Master/Slave or Clusters, you can pretty much forget getting hired. In every MySQL interview (I had like 10 companies interviewing me in a six week period and half of them used MySQL for something) the Master/Slave questions popped up and topics of the Clustering technology came up as well. Third, it is a pain to setup Master/Slave or Cluster environments by hand. If my script works on one of your computers, copy over the software, copy over the config files, make slight changes to the config files, and you can get a real multi-computer environment setup in minutes.

The second purpose of this article is to show you how to use Python to write a simple application (compiling and installing MySQL). I tried to include a lot of stuff in the Python code which is common to most Python scripts/modules. Also, I am thinking about turning the Python code into a package in the Vaults of Parnassus - just for kicks, and so I can say that I have some sort of Python code published.

So, why did I use the programming language Python to execute all the commands? I love Python, it is object oriented (from the ground up), has good exception handling, has been compilable for a long time, it is hard to write ugly Python code, it is easy to understand other people's code, there is only one way to do things (usually), it's easy to manipulate, and it is a general tool from web programming to Unix scripting to database programming to GUI programming to mathematical programming (my favorite). There are so many reasons to love Python if you are a true object-oriented programmer. The other reason why I try to use Python for all personal projects is to convince people where I work (or will work) that Python rocks and should be used wherever appropriate. The sad thing is, most managers don't want to use Python because of the lack of people who can write good Python code, so it is my duty to convince them otherwise. Update: I got hired at Google, which uses a lot of Python so now I am a happy camper!

Why compile MySQL? Why not just use the RPMs? I don't think clustering is built into some of the RPMs. Also, I always like to compile and install software myself. If you can't compile it, odds are, there might be other problems. If you do decide to use RPMs, and you decide to use an RPM server, please use YUM and do not use commercial RPM servers. All the commercial RPM servers I have seen (just one, you know who) are way overpriced and are geared towards the executive staff or people who want to buy support so that they can blame someone if something goes wrong. The sales staff are really good at making you believe you can jump to the moon, when really, the software they present only manages the installation of RPMs. Any 1st year programmer could write a web interface to do the same thing. By using YUM (it is easy, simple, and free of restrictions), you empower yourself and you will help bring down the costs of the the overpriced commercial RPM services. If the commercial RPM services weren't so overpriced (they should be like $25 per computer max) and didn't have so many stupid restrictions (like installing thebind RPM requires a more expensive license), I wouldn't mind, but they are getting away with doing so little, it is ridiculous. Politics and the suits have gotten in the way of good technology at some of these companies.

One more thing, I bought a 2-gig RAM 64 bit AMD CPU with Serial ATA hard drives. I bought this hardware configuration for the simple purpose of using a 64 bit operating system. Why? Because many companies are using 64 bit AMD cpus for their databases and other things. Just at work the other day, I mentioned I got a MySQL cluster to work on my home computer, so I as asked to setup a test cluster at work. See how valuable it is to stay ahead of the market?

The nice thing about the 64 bit AMD CPU is that is will also support the 32bit operating systems. Thus, I was able to take the safe route by installing a 32 bit Linux OS before I risked using the 64 bit versions (which had a lot of problems in the past). Plus, don't kill me for saying it, but I still wanted to play some Windows games that weren't available for Linux yet. I am close to the point where I never need to use Windows again. If gaming companies would always make Linux versions of their products, I would never have use Windows for anything. That would really be nice.

Mysql Master/Slave and Clusters

What is MySQL? Well, if you mean the MySQL database server, it is an SQL database server available from mysql.com. It is comparable to PostgreSQL and Oracle in most ways. MySQL is one of the two most popular Open Source database servers out there (PostgreSQL being the other).

What are MySQL Master/Slaves? The Master MySQL server lets people read and write data to it. It copies all of its data to the MySQL slave computers. Thus, you end up with many database servers with the same data. This can be useful for load-balancing your webservers against many database servers or performing a failover in case the Master dies (you shutoff the Master and make one of the Slaves the new Master). Normally, the Slave computers are read-only. Since most websites have a 4-to-1 ratio of reads to writes, having many read-only MySQL slaves can be very useful. How it is useful? Your website can handle more data and use more database connections spread over multiple servers. All the writes still have to be done to the Master, but the website can choose which Slave it wants to read data from. Separating the write connections from the read connections can speed up your website a lot.

What is MySQL Clustering? MySQL Clustering lets you put multiple computers together which are all the same and have all the same data. You can connect to any computer in the cluster and perform read/write operations which are immediately available to the other mirrors. The main different between Clustering and Master/Slaves is that each computer in a Cluster can be written to while in a Master/Slave configuration you are only suppose to write to the Master. Also, in Clustering, when you write data to one machine, the computer will not respond back with an "OK" status until the data has been copied to all the other computers. With the Master/Slave configuration, the data is not necessarily copied to the Slaves immediately. Effectively, you can view the cluster as one single entity/database. The nice thing is, if one computer is the cluster crashes, it doesn't affect the other computers or the data in the cluster. This behavior doesn't exist in the Master/Slave replication. If the Master goes down, the replication stops.

Clustering is a little more complicated, but it has huge advantages and will most likely be used a lot by many companies. It is fairly new technology, so in my opinion, it is good time to start testing it. For small websites which love to be on the bleeding edge of technology and you don't mind being risky, go ahead and use MySQL Clustering. I am a little cautious about using it for heavy performance database needs, but I am anxious to at least try! You should be warned that there are a lot of limitations with MySQL Clustering. For example, your database can only be as big as the free RAM you have. Also, I have had a lot of problems getting more than just a two storage node cluster working.

The Python script and Python Module MySQL.py

The Python Script "Compile_MySQL.py" is meant to access the MySQL.py module to install, configure, and get MySQL running. I tried to make it as simple as possible so that a lot the options you want can be specified at the command line.

The MySQL.py module currently only has one class called "Installer" which is mostly finished. It has other classes I am working on, but nothing worth talking about yet. I included a lot of stuff in the module like:

  1. I broke down the main modules to approximate the steps you would use to install MySQL. In addition, I separated out the compiling from the configuring because I wanted you to be able to skip the compiling if you already installed MySQL once.
  2. Use of the try/except statements.
  3. The first string of the method(s) is used for automatic documentation extraction.
  4. The concept of classes.
  5. The init and del methods which are executed at creation and destruction of an object.
  6. Other internal methods to handle printing an object or when you try to compare this object against other objects.
  7. Escaping to shell to execute code, get its return status, and output data.
  8. Regular expressions and using them repeatedly. It's only necessary to create a regular expression once, so that you don't waste resources recreating regular expressions.
  9. Storing variables in an object.
  10. Line command arguments are passed.
  11. The script only creates one set of MySQL binaries. It uses different directories and ports for each instance of the MySQL server.
Personally, I think the module could use a lot of work. I see repetitive code that could be converted into methods, there need to be more command line options, and there needs to be a place to save the configuration for later runs (using xml) if we want to use this as an admin tool.

Here is sample script to use my MySQL module. Note, if you already ran this script and got mysql working, and you want to reconfigure it, then comment out "M_Obj.Execute_Compile_Script()" to reconfigure mysql. I tried to comment each below in the script.

#!/usr/bin/python
   ### Just a bunch of standard modules I load. 
import urllib2, urllib, string, re, os, struct
import base64, string, gzip, sys, time, commands
import getopt

   ### The module I created. 
import MySQL

   ## Initialize our installation object. 
M_Obj = MySQL.Installer()

#--------------------------------------------------------
### Build and install the mysql binaries. These binaries will be common
### with all the mysql services.

M_Obj.Write_Compile_Script()   ### This creates out bash compile script.
M_Obj.Execute_Compile_Script() ### This executes our bash script.
                               ### This creates one set of binaries for
                               ### all mysql instances. 

M_Obj.Stop_Instances()   ### In case there are any running.
M_Obj.Setup_Instances()  ### Setup and initialize the databases. 
M_Obj.Start_Instances()  ### Start the databases. 

Executing the Python script

Download these files:
  1. MySQL.py and save it as MySQL.py.
  2. Compile_MySQL.py and save it as Compile_MySQL.py.
  3. Config files. Save all the config files in this directory (or grab this tarball containing all of them) into a directory called "Config" where you execute Compile_MySQL.py.
Then execute this command:
python Compile_MySQL.py  

This will download and install MySQL. It will make a log file called "/tmp/mysql_install.log". If it doesn't download MySQL, download mysql-4.1.7.tar.gz manually from mysql.com and save it in the directory "/usr/local/src/mysql_compile".

NOTE: If you want to specify another database server, then execute this, substituting the appropriate URL:

python Compile_MySQL.py -d http://www.signal42.com/mirrors/mysql/Downloads/MySQL-5.0/mysql-5.0.2-alpha.tar.gz

Some commands to run

So, now we got the database server installed. Let us do some stuff to verify the Master/Slaves are working as well as the MySQL Cluster. I made things really easy for you (assuming the installation was good). I have made a bunch of scripts for you.

Here are a bunch of scripts in the home directory where mysql got installed.

ScriptUsagePurpose
bash_aliasessource bash_aliases This setups aliases to connect to each service. The aliases connect to the master service, slave services, ndb_mgm, and each cluster mysqld service.
Start./StartStarts the master, slaves, and cluster.
Stop./Stop Stops the master, slaves, and cluster.

The scripts listed below are created in the "scripts" directory where mysql got installed. If you did a "source bash_aliases", these commands will be in the bash path. You can execute these scripts as many times as you like.

ScriptPurpose
Master_Status.bash Gets the status of the master service.
Slave_Status.bash Gets the status of the slave services.
Master_Slave_Status.bash Gets the status of the master and slaves.
Master_Slave_Test.bash Inserts data and then the master and slaves perform the same sql query which should show the same results.
Cluster_Status.bash Gets the status of the cluster
Cluster_Test.bash Inserts data into the cluster. It shuts down each storage node and sees if each mysqld server can still access the data.

Try to learn what the scripts do step by step. If you can fully understand what those scripts are doing, then you know at least the basics about how to manage the mysql services.

Follow these steps:

cd /usr/local/mysql-cluster    ### Change to the mysql directory. 
source bash_aliases            ### Load some aliases into the bash shell.
./Start                        ### Start mysql master, slaves, cluster.

Cluster_Status.bash	       ### Get the status of the cluster
Master_Status.bash             ### Get the status of the master service.
Slave_Status.bash              ### Get the status of the slave service.

Master_Slave_Test.bash         ### Test the master/slave services.
Cluster_Test.bash              ### Test the cluster.

Next Month

I am probably going to use MySQL 5.0 at home from now on. So, I am probably not going to test MySQL 4.1.x anymore. Saying that, possible next months topics include:
  1. MySQL failover for Master/Slave cluster. The master has gone bad and we want to make a slave the new master. There are lots of issue to consider when doing this, like data corruption.
  2. Stored procedures.
  3. More cluster configurations.
  4. Scripts to check if your MySQL Master/Slave/Cluster computers are running smoothly.
  5. Maybe check out all the new tools you can download from MySQL?

Conclusion

The Python module was sort of an overkill. However, I wanted to make it really easy to compile and install MySQL every time there is an upgrade. I am going to use Python for everything I do and I plan on using it for all SysAdmin needs in the future (if I can help it). Every time there is a new version of Python, I am so impressed because it just gets easier, simpler, and more powerful. In Python 2.4 (which just came out), sets are really cool for intersection and union calculations.

MySQL is coming along nicely. With all the new features being put into MySQL, it can compete against some of the larger database companies. It is important to learn MySQL because new job opportunities are emerging and MySQL will be a hot item over the next few years (before the masses learn it). The Python module and the script I wrote make it really easy to get a fairly complicated set of MySQL instances installed on your computer. To use it in production, just copy over the binaries and the config files and make a few changes to the config files and you are done! Once you see how Master/Slave/Cluster configurations work, it really becomes simple to understand how it all works.

Afterword:
Get your certifications.

In the last few months, I believe the MySQL Professional Certification paid off. Most employers don't want just a DBA anymore. PostgreSQL and MySQL make database servers easy to use for most people. No longer do you have to worship the DBA from hell because he/she knows all the little tricks. All the docs and examples are online and you can fool around with the source code yourself. This is going to put pressure on DBAs to be more than just DBAs. I believe the MySQL jobs I applied for really liked my programming and Sys Admin skills. I know for a fact that one company used my MySQL Professional Certification as leverage to interview me because they could claim "he is certified". They really wanted a programmer, but because of politics, they couldn't directly get a programmer, so my certification let me slip in. Cool, huh? A lot of certifications really don't tell you whether someone is good or not. However, the LPI and MySQL Certifications have two things going for them. First, they are actually reasonable certifications. Most certifications are meant to just make money for the company, but LPI and MySQL don't seem to be like that; they really want you to be qualified. Second, managers and HR like certifications because it protects them. I know most techies hate certifications, but because of politics, you really need to get certified to fight against the machine. LPI and MySQL Certifications are fairly inexpensive, unlike a lot of the other stupid certifications, so it really isn't that bad.


[BIO] Mark Nielsen was enjoying his work at cnet.com as a MySQL DBA, but is moving to Google as a MySQL DBA. During his spare time, he uses Python heavily for mathematical and web projects.

Copyright © 2005, Mark Nielsen. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

Flickr and Perl

By Jimmy O'Regan

Flickr is a photo-sharing service: it allows you to share your photos with friends, family, or the public in general. Flickr caters to "moblogging": photo blogging from mobile phones, which is a great part of the appeal to me. It also comes with an API so you don't have to take apart its pages to scrape it, which is nice.

Flickr::API, which was written by one of Flickr's developers, provides a way to interface to Flickr from Perl. (Flickr's API documentation is available here). There is also Flickr::Upload, which does exactly as the name suggests.

Getting started

The first step is to get an API key. Flickr is still a relatively new service, and want to know who is writing software to access their service and why, and having people register for an API key is a common requirement of web services anyway. To register for an API key, follow the steps outlined on this page (at the time of writing, this simply involved emailing Cal Henderson, the author of Flickr::API).

API key at the ready, you can now start using Flickr. Flickr provides a test method flickr.test.echo to allow you to check that everything is working, and this is used in the example given in Flickr::API's POD. I've expanded on it slightly to give some output using the Data::Dumper module:

use Flickr::API;
use Data::Dumper;

my $api = new Flickr::API({'key' => ''});

my $response = $api->execute_method('flickr.test.echo', {
			    'foo' => 'bar',
			    'baz' => 'quux',
			    });

print "Success: $response->{success}\n";
print "Error code: $response->{error_code}\n";
print Dumper ($response);

The output from this should be

Success: 1
Error code: 0

followed by a lot of output from Data::Dumper. The part of this output that we're interested should look something like this:

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
<baz>quux</baz>
<method>flickr.test.echo</method>
<foo>bar</foo>
<api_key>[snip]</api_key>
</rsp>

Doing something useful

Once everything is up and running, we're ready to start doing something of interest. I'm only really interested in using my own photos, so I first need to get my user id.

There are two ways of doing this: you can call flickr.urls.lookupUser with the URL of a user's photo or user page, or if you know the user's username, with flickr.people.findByUsername. Here's an example that uses both:

use Flickr::API;
use Data::Dumper;

use warnings;
use strict;

my $api = new Flickr::API({'key' => ''});

my $user = shift;
my $response;

if ($user =~ m!http://!i)
{
$response = $api->execute_method ('flickr.urls.lookupUser', {
				     'url' => $user,
				     });
}
else			         
{
$response = $api->execute_method ('flickr.urls.findByUsername', {
				     'username' => $user,
				     });
}

my $debug = 1;
if ($debug)
{
print "Success: $response->{success}\n";
print "Error code: $response->{error_code}\n";
print Dumper ($response);
}

Cleaning it up to provide useful output is left as an exercise for the reader (don't worry, I'll get to that later). When called with either a URL or username, it should have (among the usual Data::Dumper output) something that looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
        <user id="49502976979@N01">
                <username>jimregan</username>
        </user>
</rsp>

So... I mentioned that I was going to do something useful. What I'm looking to build is a little script that gives me a montage of the last few photos I posted, and a script that takes the coordinates of a photo note and generates an image map (at some point, I'd like to change that to be RDF, so I can use it in FOAF or what have you, but for now, an image map is easier).

Generating an Image Map

First, let's take a look at how we get the information, and what it looks like:

use Flickr::API;
use Data::Dumper;

use warnings;
use strict;

# Test photo: http://flickr.com/photos/jimregan/120856/
# Photo url: http://photos1.flickr.com/120856_01b51464c0.jpg
# http://www.flickr.com/services/api/flickr.photos.getInfo.html
my $api = new Flickr::API({'key' => ''});

my $response;

$response = $api->execute_method ('flickr.photos.getInfo', {
   	       	                  'photo_id' => '120856',
				  'secret'   => '01b51464c0'
				  });

my $debug = 1;
if ($debug)
{
	print "Success: $response->{success}\n";
	print "Error code: $response->{error_code}\n";
	print Dumper ($response);
}

output:

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
	<photo id="120856" secret="01b51464c0" server="1" dateuploaded="1090965387" isfavorite="0" license="4">
		<owner nsid="49502976979@N01" username="jimregan" realname="Jimmy O\'Regan" location="Ireland" />
		<title>IMAGE0006</title>
		<description>Mark, May 2002</description>
		<visibility ispublic="1" isfriend="0" isfamily="0" />
		<dates posted="1090965387" taken="2004-07-27 14:56:27" takengranularity="0" />
		<editability cancomment="0" canaddmeta="0" />
		<comments>0</comments>
		<notes>
			<note id="10840" author="49502976979@N01" authorname="jimregan" 
x="96" y="103" w="38" h="24">Look - missing his front teeth
at the bottom!</note>
		</notes>
		<tags>
			<tag id="283784" author="49502976979@N01" raw="Mark">mark</tag>
			<tag id="283785" author="49502976979@N01" raw="2002">2002</tag>
		</tags>
	</photo>
</rsp>

So, how do we turn that rather useless code example into something that will generate a simple HTML page with an image map? I could have tried accessing $response->tree directly, but life's too short for that. The author of Flickr::API and XML::Parser::Lite::Tree seems to have thought the same, because he also wrote XML::Parser::Lite::Tree::XPath, which allows some simple XPath expressions to be used on XML::Parser::Lite::Tree's output.

With a look at the XML above, we want the contents of the <note> tags: /photo/notes/note

#!/usr/bin/perl

use Flickr::API;
use Data::Dumper;
use XML::Parser::Lite::Tree::XPath;

use warnings;
use strict;

# Test photo: http://flickr.com/photos/jimregan/120856/
my $photo = "http://photos1.flickr.com/120856_01b51464c0.jpg";
# http://www.flickr.com/services/api/flickr.photos.getInfo.html
my $api = new Flickr::API({'key' => ''});

my $response;

$response = $api->execute_method ('flickr.photos.getInfo', {
   	       	                  'photo_id' => '120856',
				  'secret'   => '01b51464c0'
				  });

my $xpath = new XML::Parser::Lite::Tree::XPath($response->{tree});
my @notes = $xpath->select_nodes('/photo/notes/note');

print "<html>\n<head>\n<title>Flickr Photo</title>\n</head>\n";
print "<img src=\"$photo\" alt=\"Flickr photo\" usemap=\"#genmap\">\n";
print "<map name=\"genmap\">\n";

foreach (@notes)
{
	print "<area shape=\"rect\" coords=\"";
	print "$_->{attributes}->{x}, ";
	print "$_->{attributes}->{y}, ";
	print $_->{attributes}->{x} + $_->{attributes}->{w} .", ";
	print $_->{attributes}->{y} + $_->{attributes}->{h} ."\" ";
	print "alt=\"$_->{children}[0]->{content}\" ";
	print "title=\"$_->{children}[0]->{content}\" nohref>\n";
}
print "</map>\n</html>\n";

Now we're getting somewhere. The output is pretty shoddy HTML, but it works:

<html>
<head>
<title>Flickr Photo</title>
</head>
<img src="http://photos1.flickr.com/120856_01b51464c0.jpg" alt="Flickr photo" usemap="#genmap">
<map name="genmap">
<area shape="rect" coords="96, 103, 134, 127" alt="Look - missing his front teeth
at the bottom!" title="Look - missing his front teeth
at the bottom!" nohref>
</map>
</html>

Let's go one better, and show what it looks like:

Flickr photo Look - missing his front teeth
at the bottom!

Here's an improved version of that script that takes one or two parameters from the command line (photo ID, and secret if available) and creates a web page with more information (text version):

#!/usr/bin/perl

use Flickr::API;
use XML::Parser::Lite::Tree::XPath;
use Date::Format qw(time2str);

use warnings;
use strict;

my $api = new Flickr::API({'key' => ''});
my $response;
my $photo_id = $ARGV[0];
my ($desc, $date, $title, $taken, $photo);

if ($#ARGV == 1)
{
	$response = $api->execute_method ('flickr.photos.getInfo', {
   		       	                  'photo_id' => $ARGV[0],
					  'secret'   => $ARGV[1]
					  });
}
else
{
	$response = $api->execute_method ('flickr.photos.getInfo', {
   		       	                  'photo_id' => $ARGV[0],
					  });
}

my $xpath = new XML::Parser::Lite::Tree::XPath($response->{tree});
my @notes = $xpath->select_nodes('/photo/notes/note');

my @tmp = $xpath->select_nodes('/photo/dates');
$taken = $tmp[0]->{attributes}->{taken};

@tmp = $xpath->select_nodes('/photo/dates');
$date = time2str "%a %b %e %H:%M:%S %Y", $tmp[0]->{attributes}->{posted};

@tmp = $xpath->select_nodes('/photo/description');
$desc = $tmp[0]->{children}[0]->{content};

@tmp = $xpath->select_nodes('/photo/title');
$title = $tmp[0]->{children}[0]->{content};

@tmp = $xpath->select_nodes('/photo');
$photo = "http://photos" 
       . $tmp[0]->{attributes}->{server} 
       . ".flickr.com/"
       . $tmp[0]->{attributes}->{id} . "_"
       . $tmp[0]->{attributes}->{secret} . ".jpg";

print "<html>\n<head>\n<title>$title</title>\n</head>\n";
print "<img src=\"$photo\" alt=\"$title\" usemap=\"#genmap\">\n";
print "<map name=\"genmap\">\n";

foreach (@notes)
{
	print "<area shape=\"rect\" coords=\"";
	print "$_->{attributes}->{x}, ";
	print "$_->{attributes}->{y}, ";
	print $_->{attributes}->{x} + $_->{attributes}->{w} .", ";
	print $_->{attributes}->{y} + $_->{attributes}->{h} ."\" ";
	print "alt=\"$_->{children}[0]->{content}\" ";
	print "title=\"$_->{children}[0]->{content}\" nohref>\n";
}
print "</map>\n";
print "<p>$desc</p>\n";
print "<p>Taken: $taken, Uploaded: $date</p>\n";
print "</html>\n";

Let's look at the output of that:

Beata Kennedy's Beata Pat's shift's night out

Taken: 2004-12-12 01:09:16, Uploaded: Sun Dec 12 01:09:16 2004

I had a script earlier that did the basics of finding a userid, and said that I was going to leave making it useful as an exercise for the reader. Well, the bulk of this article was written on Christmas Day, so Merry Christmas: (text version)

use Flickr::API;
use XML::Parser::Lite::Tree::XPath;

use warnings;
use strict;

my $theuser = shift;

sub finduser
{
	my $fuser = shift;
	my ($xpath, @username, $userid);
	if ($fuser =~ m!http://!i)
	{
		$response = $api->execute_method ('flickr.urls.lookupUser', {
						  'url' => $fuser,
					     	  });

		$xpath = new XML::Parser::Lite::Tree::XPath($response->{tree});
		@username = $xpath->select_nodes('/user');
		$userid = $username[0]->{attributes}->{id};
	}
	else			         
	{
		$response = $api->execute_method ('flickr.people.findByUsername', {
						  'username' => $fuser,
						  });

		$xpath = new XML::Parser::Lite::Tree::XPath($response->{tree});
		@username = $xpath->select_nodes('/user');
		$userid = $username[0]->{attributes}->{nsid};
	}

	return $userid;
}

print finduser ($theuser);

Flickr::Upload

So how do we upload images? We use Flickr::Upload. There isn't much to using this module: the following script is based on the example from the POD, but with two minor differences.

First, the script takes the location of the image as a parameter, so it can be used more than once; second, it tells Mozilla to open a page so the uploader can edit the details of the photo (as the POD and Flickr's API documentation say it should). (text version)

use LWP::UserAgent;
use Flickr::Upload qw(upload);

my $image = shift;

my $ua = LWP::UserAgent->new;
my $photoid = upload ($ua,
                      'photo' => $image,
                      'email' => '',
                      'password' => '',
                      'tags' => 'mobile',
                      'is_public' => 1,
                      'is_friend' => 1,
                      'is_family' => 1
                     ) or die "Failed to upload $image";

`mozilla -remote \"openURL(http://www.flickr.com/tools/uploader_edit.gne?ids=$photoid)\"`;

The only required parameters are $ua, email, and password. These last two are left blank, for obvious reasons.

Creating a montage from Flickr

Here it is, the pièste de résistance: a script to generate a montage from Flickr. (text version)

use Flickr::API;
use XML::Parser::Lite::Tree::XPath;
use Getopt::Long;
use Data::Dumper;
use Image::Magick;
use LWP::Simple;

use warnings;
use strict;

# Getopt vars. All arguments with default values.
# You probably want to set this a bit lower
my $count = 24;
my $theuser = "http://flickr.com/photos/jimregan";
my $type = 'photos';
my $email = '';
my $pass = '';

my $xpath;

my $result = GetOptions ("user=s"     => \$theuser,
		         "type=s"     => \$type,
		         "count=i"    => \$count,
			 "password=s" => \$pass,
			 "email=s"    => \$email);

# For some reason Image::Magick doesn't read the 
# last image on the list. <shrug>
$count++;

my $api = new Flickr::API({'key' => ''});
my $response;

my $debug = 1;

my $user = finduser ($theuser);

if ($type eq 'photos')
{
	$response = $api->execute_method ('flickr.people.getPublicPhotos', {
					  'user_id'  => $user,
					  'per_page' => $count,
					  'page'     => 1});
}
elsif ($type eq 'favourites'||$type eq 'favorites')
{
	$response = $api->execute_method ('flickr.favorites.getList', {
					  'user_id'  => $user,
					  'per_page' => $count,
					  'email'    => $email,
					  'password' => $pass,
					  'page'     => 1});
}
elsif ($type eq 'contacts')
{
	$response = $api->execute_method ('flickr.photos.getContactsPhotos', {
					  'count'    => $count,
					  'email'    => $email,
					  'password' => $pass,});
}
else
{
	die "--type must be 'photos', 'contacts' or 'favo[u]rites'\n";
}

if ($response->{success} == 0)
{
	die "Error $response->{error_code}: $response->{error_message}"
	    . "\nDid you remember to pass --email and --password?\n";
}

my $photolist = new XML::Parser::Lite::Tree::XPath($response->{tree});
my @bphoto = $photolist->select_nodes('/photos/photo');
my ($photo, $photofile, @photofiles);

# Set up the image for our montage
my $image=Image::Magick->new;

foreach (@bphoto)
{
	$photo = "http://photos" 
	       . $_->{attributes}->{server} 
	       . ".flickr.com/"
	       . $_->{attributes}->{id} . "_"
	       . $_->{attributes}->{secret} . ".jpg";
	$photofile = "tmp-$_->{attributes}->{id}.jpg";
	push @photofiles, $photofile;
	open (FILE, ">$photofile");
	my $g = get($photo);
	print FILE $g;
}

foreach (@photofiles)
{
	$image->Read($_);
}

if ($debug)
{
	warn "$image\n" if "$image";
	print 0+$image;
	print "\n";
}

print Dumper ($image);

my $montage = $image->Montage;
$montage->Write ('output.jpg');

foreach (@photofiles)
{
	unlink $_;
}

sub finduser
{
	my $fuser = shift;
	my ($xpath, @username, $userid);
	if ($fuser =~ m!http://!i)
	{
		$response = $api->execute_method ('flickr.urls.lookupUser', {
						  'url' => $fuser,
					     	  });

		$xpath = new XML::Parser::Lite::Tree::XPath($response->{tree});
		@username = $xpath->select_nodes('/user');
		$userid = $username[0]->{attributes}->{id};
	}
	else			         
	{
		$response = $api->execute_method ('flickr.people.findByUsername', {
						  'username' => $fuser,
						  });

		$xpath = new XML::Parser::Lite::Tree::XPath($response->{tree});
		@username = $xpath->select_nodes('/user');
		$userid = $username[0]->{attributes}->{nsid};
	}

	return $userid;
}

This does quite a bit more than the other scripts, and is a bit more neat too. Note that, because Flickr requires authentication, you need to pass your email and password if you are looking for a montage of images from your Favourites or Contacts.

I'll leave you with the default output of that script (though shrunk a bit):

Default script output


[BIO] Jimmy is a single father of one, who enjoys long walks... Oh, right.

Jimmy has been using computers from the tender age of seven, when his father inherited an Amstrad PCW8256. After a few brief flirtations with an Atari ST and numerous versions of DOS and Windows, Jimmy was introduced to Linux in 1998 and hasn't looked back.

In his spare time, Jimmy likes to play guitar and read: not at the same time, but the picks make handy bookmarks.

Copyright © 2005, Jimmy O'Regan. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

Building a simple del.icio.us clone

By Jimmy O'Regan

I recently made the move from Mandrake to Ubuntu, and while I was unpacking in my new $HOME (sorry, I couldn't resist), I came across a little del.icio.us clone I wrote in PHP to test out the RDF generating script I wrote (well, adapted) to go with my article about outliners.

I decided to use PHP, basically because it's the only language I've used for web programming (aside from a misguided moment in my first year in college when I wrote something in Pascal). I decided to use SQLite for the database because I didn't feel like installing MySQL: PHP's SQLite functions are pretty similar to the MySQL equivalent anyway, so it's no big deal.

Please note that what I am presenting in this article does very little: I needed to test a script, and only cloned the parts I needed to do that. I did go a little further, but forgot about it until now. Doing something useful is for a future article!

Because I only needed it to give me simple XML output, I managed to get all I needed from a single script. First, I set up a sample database:

BEGIN TRANSACTION;
CREATE TABLE bookmarks (url TEXT, title TEXT, desc TEXT, keywords TEXT,
date TEXT, id INTEGER PRIMARY KEY);
INSERT INTO bookmarks VALUES('http://sqlite.org/datatype3.html',
'Datatypes In SQLite Version 3','','sqlite programming','2004-10-16T20:23:49Z',1);
INSERT INTO bookmarks VALUES('http://sqlite.org/lang.html',
'Query Language Understood By SQLite','','sqlite programming','2004-10-16T20:25:36Z',2);
INSERT INTO bookmarks VALUES('http://www.team-teso.net/releases.php',
'releases of teso','','computing 404','2003-07-15T22:29:38Z',3);
INSERT INTO bookmarks VALUES('http://ssshotaru.homestead.com/files/aolertranslator.html',
'The AOLer Translator','','humour','2003-11-18T00:45:35Z',4);
INSERT INTO bookmarks VALUES('http://www.onlineconversion.com/unix_time.htm',
'Online Conversion - Unix time conversion','','misc','2004-10-16T20:43:44Z',5);
COMMIT;

Then, I wrote a script to give me the output:

<?php echo '<?xml version="1.0" standalone="yes" encoding="UTF-8"?'.'>' ?>
<!-- http://ie.php.net/manual/en/language.basic-syntax.php#41654 -->

<posts tag="" user="">
<?php 

if (!extension_loaded("sqlite"))
{
        dl("sqlite.so");
}

if ($db = sqlite_open("/tmp/bookmarks.sqlite", 0666, $err))
{
        $result = sqlite_query ($db, "SELECT * FROM bookmarks");
        while (sqlite_has_more($result))
        {
                $post = sqlite_fetch_array ($result);
		
		$url = 'href="'.htmlentities($post['url']).'"';
		$title = 'description="'.htmlentities($post['title']).'"';
                if ($post['desc'] != "")
		{
	                 $desc = 'extended="'.htmlentities($post['desc']).'"';
		}
		else
		{
			$desc = "";
		}
		$date = 'time="'.$post['date'].'"';
		# Don't know if this is how it's done, but it's close enough
		$hash = 'hash="'.md5($url).'"';
		$tags = 'tag="'.$post['keywords'].'"';

		print " <post $url $title $desc $hash $tags $date />";
		printf ("\n");
       }
}
?>		
</posts>

Running this with the sample database gave me this output:

<?xml version="1.0" standalone="yes" encoding="UTF-8"?><!-- http://ie.php.net/manual/en/language.basic-syntax.php#41654 -->

<posts tag="" user="">
 <post href="http://sqlite.org/datatype3.html" description="Datatypes In 
 SQLite Version 3"  hash="56faa06a48016408c5042c7e4bfd3c24" tag="sqlite 
 programming" time="2004-10-16T20:23:49Z" />
 <post href="http://sqlite.org/lang.html" description="Query Language 
 Understood By SQLite"  hash="7a7eb0095ca227e7003c4a0f0a4a1fd9" tag="sqlite 
 programming" time="2004-10-16T20:25:36Z" />
 <post href="http://www.team-teso.net/releases.php" description="releases of 
 teso"  hash="bce6a8d5ecb506ff57be063083253e15" tag="computing 404" 
 time="2003-07-15T22:29:38Z" />
 <post href="http://ssshotaru.homestead.com/files/aolertranslator.html" 
 description="The AOLer Translator"  hash="99fbdd9eb3e03624c65b15d06a82388a" 
 tag="humour" time="2003-11-18T00:45:35Z" />
 <post href="http://www.onlineconversion.com/unix_time.htm" 
 description="Online Conversion - Unix time conversion"  
 hash="f2fd9548118ac815edee17466c58abe1" tag="misc" 
 time="2004-10-16T20:43:44Z" />
		
</posts>

Which is pretty close to the output given by http://del.icio.us/api/posts/get?.

It did what I wanted, it didn't take long to write, and I had fun doing it. So I thought I might try to make it do a bit more.

Next, I decided to tackle the page that returns the list of tags, to run delicious_mind on it:

<?php echo '<?xml version="1.0" standalone="yes" encoding="UTF-8"?'.'>' ?>

<tags>
<?php 

//error_reporting(E_ALL);
//Error reporting? I have no errors! ... erm... not now, at least.

if (!extension_loaded("sqlite"))
{
        dl("sqlite.so");
}

// I really should do something with $err
if ($db = sqlite_open("/tmp/bookmarks.sqlite", 0666, $err))
{
	$tags = array();
	$prevtags = array();
	
        $result = sqlite_query ($db, "SELECT keywords FROM bookmarks");
        while (sqlite_has_more($result))
        {
                $foo = sqlite_fetch_array ($result);
		$thistag = split(" ", $foo['keywords']);
		// print_r(array) is worth remembering.
		$prevtags = array_merge($tags);
		$tags = array_merge($prevtags, $thistag);
        }
	natcasesort($tags);
	$uniq=array_unique($tags);
	$count=array_count_values($tags);
        foreach ($uniq as $tag)
        {
		$c = $count[$tag];
                print "<tag count='$c' tag='$tag' />";
		printf("\n");
        }
}
?>		
</tags>

According to del.icio.us's API documentation the posts URL accepts two parameters: tag and date, which allow you to filter the results you receive. The next step was to make the first script do that:

<?php 
echo '<?xml version="1.0" standalone="yes" encoding="UTF-8"?'.'>'; 

if (!extension_loaded("sqlite"))
{
        dl("sqlite.so");
}

if ($_GET['tag'] != "")
{
	$tag = $_GET['tag'];
}

if ($_GET['dt'] != "")
{
	$dt = $_GET['dt'];
}

printf ("<posts ");
if ($dt)
{
	printf ("dt='$dt' ");
	$query = "SELECT * FROM bookmarks where date like '%$dt%'";
}
if ($tag)
{
	printf ("tag='$tag'");
	$query = "SELECT * FROM bookmarks where keywords like '%$tag%'";
	// The problem with this is that it matches too much.
	// Using my example, if I search for 'sql' I should get nothing,
	// but instead it matches 'sqlite'
	// Close enough for my purposes, though I should use the stuff I
	// have for extracting the tags.
}
else
{
	printf ("tag=''");
}
printf (" user=''>\n");

if ($tag && $dt)
{
	$query = "SELECT * FROM bookmarks where date like '%$dt%' and keywords like '%$tag%'";
}

if (!$tag && !$dt)
{
	$query = "SELECT * FROM bookmarks";
}

if ($debug) echo "<!-- '$query' -->";

if ($db = sqlite_open("/tmp/bookmarks.sqlite", 0666, $err))
{
        $result = sqlite_query ($db, $query);
        while (sqlite_has_more($result))
        {
                $post = sqlite_fetch_array ($result);
		
		$url = 'href="'.htmlentities($post['url']).'"';
		$title = 'description="'.htmlentities($post['title']).'"';
                if ($post['desc'] != "")
		{
	                 $desc = 'extended="'.htmlentities($post['desc']).'"';
		}
		else
		{
			$desc = "";
		}
		$date = 'time="'.$post['date'].'"';
		// Used the wrong variable in the first example
		$hash = 'hash="'.md5($post['url']).'"';
		$tags = 'tag="'.$post['keywords'].'"';

		print " <post $url $title $desc $hash $tags $date />";
		printf ("\n");
       }
}
?>		
</posts>

As noted in the comments, the tags matched too much: if I specified 'sql' as the tag to filter for, it would match 'sqlite', if that was the last tag in the list. I wrote a simple search script while thinking about what I was going to do next:


<?php

if (!extension_loaded("sqlite"))
{
        dl("sqlite.so");
}

if (!$_GET['search'])
{
	echo "<form method='GET'>";
	echo "<input name='search' value='' type='text' size='80'>";
	echo "<input type='submit'>";
	echo "</form>";
}
	
else 
{
	$search = $_GET['search'];
	
	if ($db = sqlite_open("/tmp/bookmarks.sqlite", 0666, $err))
	{
		
		echo "<form method='GET'>";
		echo "<input name='search' value='$search' type='text' size='80'>";
		echo "<input type='submit'>";
		echo "</form>";
		
		$query = "SELECT * FROM bookmarks WHERE url LIKE '%$search%' OR title LIKE '%$search%'";
		$result = sqlite_query ($db, $query);
		while (sqlite_has_more($result))
		{
			$post = sqlite_fetch_array ($result);
			$url = $post['url'];
			echo "<p><a href='$url'>";
			echo $post['title'];
			echo "</a>";
			// keywords, edit
		}
	}
}

In the end I decided to simply pad each tag out with spaces, because it was easier that way, leaving me with new versions of the posts and tags scripts:

(text version)

<?php 
echo '<?xml version="1.0" standalone="yes" encoding="UTF-8"?'.'>'; 

if (!extension_loaded("sqlite"))
{
        dl("sqlite.so");
}

if ($_GET['tag'] != "")
{
	$tag = $_GET['tag'];
}

if ($_GET['dt'] != "")
{
	$dt = $_GET['dt'];
}

printf ("<posts ");
if ($dt)
{
	printf ("dt='$dt' ");
	$query = "SELECT * FROM bookmarks where date like '%$dt%'";
}
if ($tag)
{
	printf ("tag='$tag'");
	$query = "SELECT * FROM bookmarks where keywords like '% $tag %'";
}
else
{
	printf ("tag=''");
}
printf (" user=''>\n");

if ($tag && $dt)
{
	// A simple change, to prevent false positives: pad the keywords
	// field with spaces :)
	$query = "SELECT * FROM bookmarks where date like '%$dt%' and keywords like '% $tag %'";
}

if (!$tag && !$dt)
{
	$query = "SELECT * FROM bookmarks";
}

if ($debug) echo "<!-- '$query' -->";

if ($db = sqlite_open("/tmp/bookmarks.sqlite", 0666, $err))
{
        $result = sqlite_query ($db, $query);
        while (sqlite_has_more($result))
        {
                $post = sqlite_fetch_array ($result);
		
		$url = 'href="'.htmlentities($post['url']).'"';
		$title = 'description="'.htmlentities($post['title']).'"';
                if ($post['desc'] != "")
		{
	                 $desc = 'extended="'.htmlentities($post['desc']).'"';
		}
		else
		{
			$desc = "";
		}
		$date = 'time="'.$post['date'].'"';
		// Used the wrong variable in the first example
		$hash = 'hash="'.md5($post['url']).'"';
		$tags = 'tag="'.trim($post['keywords']).'"';

		print " <post $url $title $desc $hash $tags $date />";
		printf ("\n");
       }
}
?>		
</posts>

(text version)

<?php echo '<?xml version="1.0" standalone="yes" encoding="UTF-8"?'.'>' ?>

<tags>
<?php 

//error_reporting(E_ALL);
//Error reporting? I have no errors! ... erm... not now, at least.

if (!extension_loaded("sqlite"))
{
        dl("sqlite.so");
}

// I really should do something with $err
if ($db = sqlite_open("/tmp/bookmarks.sqlite", 0666, $err))
{
	$tags = array();
	$prevtags = array();
	
        $result = sqlite_query ($db, "SELECT keywords FROM bookmarks");
        while (sqlite_has_more($result))
        {
                $foo = sqlite_fetch_array ($result);
		$thistag = split(" ", $foo['keywords']);
		// print_r(array) is worth remembering.
		$prevtags = array_merge($tags);
		$tags = array_merge($prevtags, $thistag);
        }
	natcasesort($tags);
	$uniq=array_unique($tags);
	$count=array_count_values($tags);
        foreach ($uniq as $tag)
        {
		if ($tag != '')
		{
			$c = $count[$tag];
                	print "<tag count='$c' tag='".trim($tag)."' />";
			printf("\n");
		}
        }
}
?>		
</tags>

I needed the database changed to work with these scripts, so I added a new script to generate the SQL. I should have written it to add the data to the database directly, but never got around to doing that.

<?
$url = $_POST['url'];
$title = $_POST['title'];
$desc = $_POST['desc'];
$keywords = $_POST['keywords'];
$date = date("Y-m-d\TH:i:s\Z", $_POST['date']);


$f = fopen("/tmp/bookmarks.sql", "a");
fwrite($f, "
INSERT INTO bookmarks VALUES ('$url', '$title', '$desc', 
'$keywords', '$date', NULL);
");
?>

The form to call the script:

<html>
<head>
	<title>Post Bookmark</title>
</head>
<body>
	
<form method="POST" action="make-sql.php">
<table>
<tr>
<td>URL:</td>
<td><input type="text" name="url" size="80"></td>
</tr>
<tr>
<td>Title:</td>
<td><input type="text" name="title" size="80"></td>
</tr>
<tr>
<td>Description</td>
<td><input type="text" name="desc" size="80"></td>
</tr>
<tr>
<td>Keywords</td>
<td><input type="text" name="keywords" size="80"></td>
</tr>
<tr>
<td>Date</td>
<td><input type="text" name="date" size="80"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
</form>

</body>
</html>

And the output:

INSERT INTO bookmarks VALUES ('http://www.mozilla.org/projects/plugins/scripting-plugins.html', 
'Scripting Plugins with Mozilla', '', ' mozilla javascript ', '2003-08-09T20:58:38Z', NULL);
INSERT INTO bookmarks VALUES ('http://www.mozilla.org/docs/xul/xulnotes/xulnote_xpconnect.html', 
'Fun With XBL and XPConnect', '', ' mozilla xbl ', '2003-08-06T04:20:33Z', NULL);
INSERT INTO bookmarks VALUES ('http://www.mozilla.org/projects/xbl/xbl.html', 
'XBL (Extensible Binding Language) 1.0', '', ' mozilla xbl ', '2003-08-06T04:20:18Z', NULL);
INSERT INTO bookmarks VALUES ('http://layeremu.mozdev.org/files/usage.html', 
'mozdev.org - layeremu: files/usage', '', ' mozilla ', '2003-08-06T00:31:43Z', NULL);
INSERT INTO bookmarks VALUES 
('http://www.mozdev.org/source/browse/~checkout~/gnusto/src/gnusto/content/gnusto-lib.js?rev=1.97&content-type=text/plain', 
'http://www.mozdev.org/source/browse/~checkout~/gnusto/src/gnusto/content/gnusto-lib.js?rev=1.97&content-type=text/plain', 
'', ' mozilla ', '2003-08-17T03:31:59Z', NULL);
INSERT INTO bookmarks VALUES ('http://www.mozilla.org/docs/dom/domref/dom_el_ref31.html#1028304', 
'addEventListener', '', ' mozilla javascript ', '2003-10-12T22:17:33Z', NULL);
INSERT INTO bookmarks VALUES ('http://www.mozilla.org/docs/dom/domref/dom_el_ref47.html#1028897', 
'insertBefore', '', ' mozilla javascript ', '2003-10-12T22:17:34Z', NULL);
INSERT INTO bookmarks VALUES ('http://techpubs.sgi.com/library/tpl/cgi-bin/browse.cgi?coll=0650&db=man&pth=/cat1', 
'SGI TPL Browse Man Pages (User Commands (1))', '', ' unix manpages ', '2003-07-14T09:48:03Z', NULL);
INSERT INTO bookmarks VALUES ('http://docsrv.caldera.com/', 
'SCOhelp', '', ' unix manpages ', '2003-07-14T09:48:03Z', NULL);
INSERT INTO bookmarks VALUES ('http://docs.hp.com/hpux/os/man%5Fpages.html', 
'hp-ux reference (manpages)', '', ' unix manpages ', '2003-07-14T09:48:03Z', NULL);
INSERT INTO bookmarks VALUES ('http://sun.doit.wisc.edu/', 
'DoIT/POST SUN Home Page', '', ' unix manpages ', '2003-07-14T09:48:03Z', NULL);
INSERT INTO bookmarks VALUES ('http://publib16.boulder.ibm.com/cgi-bin/ds_form?lang=en_US&viewset=AIX/', 
'AIX Documentation', '', ' unix manpages ', '2003-07-14T09:48:03Z', NULL);
INSERT INTO bookmarks VALUES ('http://www.toccionline.com/creations/ctrla/how.html', 
'CTRL+A Images - Make Your Own', '', ' computing ', '2003-07-19T13:37:06Z', NULL);
INSERT INTO bookmarks VALUES ('http://www.sco.com/developers/gabi/', 
'SCO | Developers | GABI', '', ' computing ', '2003-07-17T00:56:32Z', NULL);
INSERT INTO bookmarks VALUES ('http://openpalm.sourceforge.net/faq.html', 
'FAQ of the OpenPalm Project', '', ' computing ', '2003-07-14T10:19:25Z', NULL);
INSERT INTO bookmarks VALUES ('http://www.improvisation.ws/mb/tpcs1.php', 
'Improv Message Boards - True Porn Clerk Stories', '', ' misc ', '2003-06-10T23:59:11Z', NULL);
INSERT INTO bookmarks VALUES ('http://singsmart.com/freesingingarticles.html', 
'Sing Smart, Not Hard with Vocal Coach Yvonne DeBandi', '', ' misc ', '2003-06-09T23:22:34Z', NULL);

Now that I've made my terrible PHP code public, I guess I'll have to finish off the job. Coming in part 2:


[BIO] Jimmy is a single father of one, who enjoys long walks... Oh, right.

Jimmy has been using computers from the tender age of seven, when his father inherited an Amstrad PCW8256. After a few brief flirtations with an Atari ST and numerous versions of DOS and Windows, Jimmy was introduced to Linux in 1998 and hasn't looked back.

In his spare time, Jimmy likes to play guitar and read: not at the same time, but the picks make handy bookmarks.

Copyright © 2005, Jimmy O'Regan. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

Bash Shell and Beyond Applied

By William Park

Deleting Spam on a POP3 Server

This article will illustrate the use of my extended 'case' and 'read' Bash shell builtins (See my other articles in issues 108, 109 and 110) to delete Spam on my ISP's POP3 mail server before it gets downloaded into my local mail system. The example scripts use these extended functions, so they require that you have my shell extensions installed.

On average, I get 1 MB of spam per hour on my Yahoo account. The most troublesome of these, both in size and number, are Microsoft Swen and Netsky worms. Fortunately, they are easy to identify, and can be deleted right on the POP3 server.

  1. Swen worms are usually 150kB in size and use all lowercase letters (with optional '-' prefix) as the MIME boundary pattern, ie.

        boundary="-*[a-z]+"
    
  2. Netsky worms are about 42kB in size and use 3 different patterns for MIME boundary pattern, namely

        boundary="----=_NextPart_000_0016----=_NextPart_000_0016"
        boundary="----=_NextPart_000_001B_01C0CA80.6B015D10"
        boundary="----=_NextPart_000_001B_01C0CA81.7B015D10"
    

Telnet to POP3 server

In order to understand the shell script, you should first log in to your POP3 server using Telnet, because a shell script only automates what you type on the command line. So, let's do that:

    telnet pop.your.isp 110
    user username
    pass password
will connect to remote POP3 server (port 110), and log in using your 'username' and 'password'.
    stat
    top 1 10
Here, stat returns the number of messages and total size, and top 1 10 prints the header of the 1st email plus the top 10 lines of the body. For our purpose, we are only interested in the header, specifically the 'boundary' parameter; so, top 1 0 is what we need for our script. Note that a single '.' (dot) on a line by itself signals the end of output.
    dele 1
    quit
dele 1 marks the 1st message to be deleted, and quit ends the POP3 session upon which the server removes all messages marked for deletion.

Shell script

Usage

You can source the 3 functions and run

    check pop.your.isp username password
from the command line or in a script. However, if you use Fetchmail to download emails (like I do), then you already have servers, usernames, and passwords in ~/.fetchmailrc. You can extract these data using fetchmail --configdump directly:
    (
    fetchmail --configdump
    cat << EOF
    for server in fetchmailrc['servers']:
        if server['protocol'] == 'POP3':
            for user in server['users']:
                print server['pollname'], user['remote'], user['password']
    EOF
    ) | python | while read server user pass; do
        # use (...) to prevent 'exit' terminating entire script
        check "$server" "$user" "$pass"
    done

The entire script is available from popcheck.bash, and should be run just before Fetchmail,

    popcheck.bash && fetchmail
usually from crontab.

Summary

Although the script deals with Microsoft Swen/Netsky worms, you can add your own patterns. For example,
     'boundary="=+[0-9]+=+"' ))
       echo TAG.spam ;;
     '(Subject|From): =\?[A-Za-z0-9_-]+\?' ))
       echo non.English ;;
     'charset="(ks_c_5601-1987|euc-kr|big5|gb2312|iso-2022-jp|shift-jis)"'
     ))
       echo APIC.charset ;;
     '&lt;(5[89]|6[01]|20[23]|21[0189]|22[012])(\.[0-9]{1,3}){3}&gt;'
     ))
       echo APIC.IP ;;
     'Content-Type: text/html' ))
       echo HTML.header ;;


[BIO] I learned Unix using the original Bourne shell. And, after my journey through language wilderness, I have come full-circle back to shell. Recently, I've been patching features into Bash, giving other scripting languages a run for their money. Slackware has been my primary distribution since the beginning, because I can type. In my toolbox, I have Vim, Bash, Mutt, Tin, TeX/LaTeX, Python, Awk, Sed. Even my shell command line is in Vi-mode.

Copyright © 2005, William Park. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

Design Awareness

By Mark Seymour

Kids, Do Try This at Home

Now that we've talked about some of the basics of design, let's use some. In this issue, we'll use those design principles to create a simple opening web page for a fictitious company. (That will keep the lawsuits to a minimum, rather than reworking something like, say, the www.microsoft.com site.)

The first thing is to name the company. There are firms out there that do nothing else; I once worked with a genius (his company is at http://www.namelab.com) who's still at it, thirty years later. Since this is the January issue, we'll do something appropriately winterish.

How about a winter sports equipment company? Skis, sleds, that sort of thing. We want to give a vaguely European feel to the company, so we'll use 'alpine' rather than 'mountain'. We want to imply more than just sporting goods (we might decide to sell clothing and climbing videos and tents, as well), so we'll use 'gear' rather than 'equipment'.

So, our company is called Alpine Gear. Except we're very hip and internet, aren't we? So we'll use the serial-capital version of the name, like any good computer company: AlpineGear.

A domain search did turn up a link to an existing company (http://www.alpinegear.com), but it's called Old Style Log Works, Inc., out of Kalispell, Montana. They build custom log cabins. If you're more curious than me, you can ask their web designer (http://www.snowdogweb.com) why they have their client linked to that particular URL. But, since they don't use Alpine or Gear or AlpineGear anywhere on their site, I'm sure they won't mind our borrowing the name for this project. Yet it's a good lesson; domain names are getting more scarce, and finding a good name that's also an unused domain is getting harder.

Now we have to create a logo for the company. Or, in this case, a logotype.

What's the difference? A logo is an icon, a picture, a 'bug' that communicates the image (and hopefully the name) of the company without any additional words. Think of the Shell Oil Company logo, the Apple Computer logo, and the International Business Machines Company logo. (I'd bet many of you didn't even know that IBM stood for International Business Machines.) A logotype is just the name used in a particular typography that, hopefully, also communicates the image of the company. Recent examples are the eBay logotype, the Google logotype, and the Yahoo! logotype, complete with its own punctuation.

Why use a logotype rather than a logo? Mere personal preference, some of the time; either your own or that of the CEO of the company. But you'll notice a pattern in the companies selected above: the ones that have a product (something that needs an immediately recognizable sign on a building or on a box on a shelf) use logos, and the ones that are service providers use logotypes. It's not a perfect system, however; Ace Hardware (definitely a product company) uses a logotype and many banks (definitely service companies) use a logo. Since our company is going to sell many products, most of them produced by other companies, we'll go with a logotype.

We want to emphasize the 'European' quality of the company, so we'll pick the only font typically recognized by Americans as 'Euro', one usually referred to as either Old English or German Black Letter, for the 'European' half of the name:

This is a font called Berliner. The image was created in Photoshop, but the letterspacing was hand-tightened because the standard spacing looked too 'open', and the capital A didn't look much like an A, except to a 19th-century German. (Logotypes must be grasped as images, rather than 'read' as words, and if the letters are farther apart it tends to invite letter-by-letter 'reading' by the viewer.)

For the 'equipment' half of the name, we'll use something that's not too technical looking, something comfortable, that suggests our stuff is fun and easy to use:

This is ITC Garamond Book Condensed, also with tightened letterspacing. It also had to be scaled, because letter proportions are not the same in all fonts; at 72 points, the capital G was much larger in this font than in the Berliner. We picked Book Condensed because it gave us a similar width-to-height ration for the lower case letters. Not perfectly, but optically. You'll find a lot of things that 'look' right never measure 'right'...

Now we have our logotype:

It needs to appear in color, in most usages, so we'll need to pick them. We might as well come up with a 'color way' for our site at the same time. A 'color way' (the industry term for a series of colors to be used together) is merely the list of colors (whether PMS numbers for printing inks or hex values for the Web) that will reinforce the image we wish to show our customers.

We want to look precise (like the Swiss), but fun-loving (like the Italians). Yet we don't necessarily want to use particularly 'national' colors, with their flags (red and white for the Swiss and green, white, and red for the Italians) providing the most recognizable colors for each country. We do want to look high-tech, and definitely ready for the mountains. We don't want to look like rocks or dirt (brown), because that's what you fall on. So we'll rely on the standard mountain-evoking colors of blue (mountain air and streams) and white (snow), along with old reliable high-tech gray:

Note that we've chosen several different related blues and a couple of grays, using our favorite VisiBone swatch set; you'll eventually need to present information in varying levels, whether in a brochure or a website, and having a preset color way will help you organize it faster.

Let's see what happens when we apply our color way to our logotype:

We'll also want to use it on colored backgrounds, so we need at least one more variant:

Now let's look at the basic landing page for the company. (Click the small white box at the top of the page to return here; it's not part of our design. These pages have also been optimized for an 800x600 display, so set your browser to display that size if your resolution is higher.) To the basic page, we'll now add the logo. And then some simple navigation. We'll put in some page links. Finally, we'll display one of the links, an internal directory page, which points to further specific pages on the topic of High-Altitude Gear.

Note that we've used, to a modest extent, our color way to help guide the viewer. Other than using bold to show navigation, we've deliberately left out font specifics on the sample pages, but if you wanted to use particular fonts you could render the text as PNGs. (The gradient, of course, would require making the images with transparent backgrounds.) We've also set up a simple yet flexible navigation system, which would allow for potentially hundreds of pages in this on-line catalog.

The product pages for this site will require better definition of the use of the color way, along with setting the style of the illustrations and/or photographs and the text required to describe the objects in the catalog. Next month we'll cover some of those aspects.

I hope this has given you some things to think about in your own design work. As ever, if there are specific topics you'd like covered in future columns, don't hesitate to email me.


[BIO]

I started doing graphic design in junior high school, when it was still the Dark Ages of technology. Bill Gates and Steve Jobs were both eleven years old, and the state of the art was typing copy on Gestetner masters. I've worked on every new technology since, but I still own an X-acto knife and know how to use it.

I've been a freelancer, and worked in advertising agencies, printing companies, publishing houses, and marketing organizations in major corporations. I also did a dozen years [1985-1997] at Apple Computer; my first Macintosh was a Lisa with an astounding 1MB of memory, and my current one is a Cube with a flat screen.

I've had a website up since 1997, and created my latest one in 2004. I'm still, painfully, learning how web design is different from, but not necessarily better than, print.

Copyright © 2005, Mark Seymour. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

Ecol

By Javier Malonda

The Ecol comic strip is written for escomposlinux.org (ECOL), the web site that supports es.comp.os.linux, the Spanish USENET newsgroup for Linux. The strips are drawn in Spanish and then translated to English by the author.

These images are scaled down to minimize horizontal scrolling. To see a panel in all its clarity, click on it.

[cartoon] [cartoon] [cartoon] [cartoon]

All Ecol cartoons are at tira.escomposlinux.org (Spanish), comic.escomposlinux.org (English) and http://tira.puntbarra.com/ (Catalan). The Catalan version is translated by the people who run the site; only a few episodes are currently available.

These cartoons are copyright Javier Malonda. They may be copied, linked or distributed by any means. However, you may not distribute modifications. If you link to a cartoon, please notify Javier, who would appreciate hearing from you.


Copyright © 2005, Javier Malonda. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 110 of Linux Gazette, January 2005

The Linux Laundrette


Contents:

(?)Home computer
(?)LG #109
(?)Profanity Adventures
(?)Spam. In obfuscated Perl.
(?)More ginger beer!
(?)Even more ginger beer!
(?)Cider/Hangovers
(?)Swedish Chef
(?)Album of the month
(?)Alice in Wonderland
(?)Off for Mile-high City
(?)More on English
(?)Hey Stranger
(?)Misc IRC stuff
(?)Question
(?)Collins Word Exchange
(?)Just a bit o'Irish...
(?)Album of the month
(?)New Disease
(?)News today
(?)Question
(?)12 Days of Christmas
(?)[Lgang] SPAM: read this - abOut the GrReenCard
(?)The hot babe problem
(?)NewsForge | Free (and open) holiday greeting cards
(?)More Swedish Chef
(?)Since we've been discussing alcohol...
(?)MERRY XMAS
(?)Userfriendly Christmas cartoons
(?)Bicycles & Linux
(?)Chumpbot
(?)RICO applied to spammers
(?)Toys of yesteryear
(?)Not here
(?)Christmas messages
(?)More Christmas messages
(?)Clamscan finds HTML phishing scams...
(?)Spam jokes
(?)Christmas links
(?)Free Beer
(?)Python conferences in the US and Europe

(?) Home computer

From Jimmy O'Regan

http://codeblogs.ximian.com/blogs/tberman/archives/000419.html
(!) [Ben] I love that blurb under the picture. "With teletype interface and the Fortran language, the computer will be easy to use."

(?) Yeah. As soon as I saw that, I knew I had to send it on.

Just to be seasonable, "Merry Christmas" in 4 languages (C, Pascal, FORTRAN, and PHP), courtesy of GNU:

const a = '\"; void b()/*'; var b:string;{
c */ { /*
c document.fgColor='#ffffff'";
cos(1);print "Merry Christmas" ?>
17 format('Merry Christmas')
write(6, 15)
stop
end
c */
char *a = "}begin b:='{"; } int main () { /*'; writeln{*/
char cbuf[64]; sprintf(cbuf, "}('Merry Christmas') end. {");
cbuf[29] = '\0'; printf(cbuf+3); return 0; }
(!) [Ben] "Computers in the future may weigh no more than 1.5 tons." -- Popular Mechanics (1949)
(!) [John] They were describing my laptop!
(!) [Ben] Oh yeah - I used to wonder why the military was screwing around with depleted uranium, osmium, and other crap like that for their armor-penetrating rounds, since even a tiny chunk of my old AST laptop would have instantly crushed any armor division that it fell on.
On the other hand, since accelerating that kind of mass to anything above pedestrian velocities would require a nuclear explosion, and since any violent state change stands a chance of precipitating gravitic collapse and black hole formation, perhaps it's just as well...
(Maybe I shouldn't have bought the model with the Deep Thought CPU, but it came with a bonus Hotblack Desiato CD, and I just couldn't miss out.)

(?) LG #109

From Mark W. Tomlinson

I had just settled in of a Saturday evening with a wee dram of Irish whiskey, a good Henry Clay cigar and Linux Gazette #109. I had worked my way to "Return of the Linux Laundrette" and reached the section "Re: [LG 87] help wanted #4". This piece caused me to drop my cigar (due to uncontrollable grinning, giggling and guffawing), setting my sweatpants on fire.

(!) [Jimmy] http://linuxgazette.net/109/lg_laundrette3.html#nottag2/14 for the terminally lazy :)

(?) I'm fine, thanks - I extinguished the blaze by spilling my libation in my lap - followed, of course, by the water chaser. Be advised that I will be taking legal advice re: financial recovery for the loss of the whiskey...

(!) [Jimmy] Well, Ben and I have our own sideline business (http://linuxgazette.net/107/misc/laundrette/lg_hitsquad.html), so I can say with some confidence that it won't come to that, though some recovery may occur at some later date.

(?) I don't know how you people manage to produce such an outstanding combination of useful Linux information, non sequiturs and a, ah, rather <veering> approach to humor (my kind!) - but I certainly hope you keep doing it for a long time to come.

(!) [Jimmy] Well, I'll be compiling it for a while to come: it's a lot of fun to go back over the offtopic threads every month, especially since there are so many of them:

Dec 01 08:44:05 <editorgal>     lucky sucker, the recent gang must be a
treasure trove for laundrette bits.
Dec 01 08:45:29 <jimregan>      I felt kind of duty bound to take over
the laundrette... cos most of the time all I do is perpetuate those threads
Dec 01 08:45:39 <editorgal>     lol

[though I should have said 'perpetrate' :)]

(?) Sincerely,

Mark W. Tomlinson

(!) [Jimmy] Thanks for writing,

Jimmy


(?) Profanity Adventures

From Jimmy O'Regan

A nostalgic look at what used to happen when you tried typing swear words into text adventures:
http://www.monkeon.co.uk/swearadventure

(?) Spam. In obfuscated Perl.

From Jimmy O'Regan

mamik@yahoo.co.uk wrote:
>  $B"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"# (B
> ****************************************************************************
>  $B!!!!!!!!!!!!!!!!!!!!!!$*A&$a%5%$%H$N$40FFb!* (B
> ****************************************************************************
>  $B"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"# (B
Awesome! Spam in obfuscated Perl!
>
>                      http://www.zl8.jp/~banana/
>
>  $B"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"# (B
>  $B"#"#"#!y!y!y!y"#"#"#!y!y!y!y!y!y"#"#"#!y!y!y"#"#"#!y!y!y!y"#"#"#"#!y!y"#"#"# (B
>  $B"#"#!y!y!y!y!y!y"#"#!y!y!y!y!y!y"#"#!y!y!y!y!y"#"#!y!y!y!y!y"#"#"#!y!y"#"#"# (B
>  $B"#"#!y!y"#"#"#!y"#"#"#"#!y!y"#"#"#"#!y!y"#!y!y"#"#!y!y"#"#!y!y"#"#!y!y"#"#"# (B
>  $B"#"#!y!y!y"#"#"#"#"#"#"#!y!y"#"#"#!y!y"#"#"#!y!y"#!y!y"#"#!y!y"#"#!y!y"#"#"# (B
>  $B"#"#"#!y!y!y!y!y"#"#"#"#!y!y"#"#"#!y!y"#"#"#!y!y"#!y!y"#"#!y!y"#"#!y!y"#"#"# (B
>  $B"#"#"#"#"#!y!y!y!y"#"#"#!y!y"#"#"#!y!y"#"#"#!y!y"#!y!y!y!y!y"#"#"#!y!y"#"#"# (B
>  $B"#"#"#"#"#"#"#!y!y"#"#"#!y!y"#"#"#!y!y!y!y!y!y!y"#!y!y!y!y!y"#"#"#"#"#"#"#"# (B
>  $B"#"#!y!y"#"#"#!y!y"#"#"#!y!y"#"#"#!y!y"#"#"#!y!y"#!y!y"#"#!y!y"#"#"#"#"#"#"# (B
>  $B"#"#!y!y!y!y!y!y!y"#"#"#!y!y"#"#"#!y!y"#"#"#!y!y"#!y!y"#"#!y!y"#"#!y!y"#"#"# (B
>  $B"#"#"#!y!y!y!y!y"#"#"#"#!y!y"#"#"#!y!y"#"#"#!y!y"#!y!y"#"#"#!y!y"#!y!y"#"#"# (B
>  $B"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"# (B
>  $B!!!!!!!!!N (BFIVE $B!! (BSTAR $B!O (BMAIL MAGAZINE  $B!!!! (Bstar  $B!y!! (Bexpress
>  $B(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(, (B
== 'print "You are in a maze of twisty little passages, all alike";'
>
>  $B!y!y!y!y!y!!%i%s%-%s%0%H%C%W$N%5%$%H$P$+$j$r=8$a$^$7$? (B  $B!y!y!y!y!y (B
>
>  $B!&!E!D!D(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,!D!D!E!& (B
>  $B!!!!!!!!!!!!!!!!!!!!!! (BFIVE $B!! (BSTAR   N E W S
>  $B!&!E!D!D(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,!D!D!E!& (B
>
>  $B!!!!!!!!!!!!!!$=$&!"$3$3$O!"8^$D@1$N%5%$%H$P$+$j$G$9 (B
== 'use Inline::BrainFuck;'
>
> ______________________________________________________________________
>
>  $B!y!y (B  $B$3$s$J$N$"$j!*!) (B  $B!y!y (B********************************************
>
>  $B!!!!!!$3$l$J$iG<F@!"%H%C%W$K$J$k$K$O!"$d$C$Q$jM}M3$,$"$k$s$G$9$M!*!* (B
>
>  $B!!!!!!!!!!!!!!!!!!!!!! (Bhttp://www.eyc.jp/~gazou/?id=dGFnQGxpbnV4Z2F6ZXR0ZS5uZXQ=
>
>
> ********************************************************************************
>  $B!!!!!!!!!!!!!!!!!!!~!!!!!!!!$3$s$J7G<(HD$,M_$7$+$C$?!*!*!!!!!!!!!!!~ (B
> ********************************************************************************
== 'use MIDI;'
>  $B!! (B
>  $B!!!!!!!!!!!!!!!!!!"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~ (B
>  $B!!!!!!!!!!!!!!!!!!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"! (B
>  $B!!!!!!!!!!!!!!!!!!"!!~!!!!!!!!!!!!!!!!!!!!!!!!!!!!"!!~ (B
>  $B!!!!!!!!!!!!!!!!!!!~"!!!!!40A4!!!*!*!!!!L5NA!*!*!!!~"! (B
>  $B!!!!!!!!!!!!!!!!!!"!!~!!!!!!!!!!!!!!!!!!!!!!!!!!!!"!!~ (B
>  $B!!!!!!!!!!!!!!!!!!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"! (B
>  $B!!!!!!!!!!!!!!!!!!"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~ (B
This is the input to MIDI. Opening bars to the theme from 'The Odd Couple'
>
>
>  $B!!!!!Z!!%(%C%A$J?M!"8BDj!*!*![ (B
>  $B!!!!!! (B
>
>  $B!!!!!!!!!!!!!!!v!v!v!!$=$l$b!"$+$J$j%(%C%A$J?M8BDj$@$h!A!A!!!!!v!v!v (B
>
>
>  $B!!!y!!$"$J$?$O!"$+$J$j!!%(%C%A!)$7$+$b!"2q$$$?$$!)!! (B
>
>
>  $B!!!!!!!!#Y#E#S!!"M!!!! (Bhttp://www.zl8.jp/~banana/
>
>  $B!!!!!!!!#N#O!!!!"M!!!!!!$I$3$+C5$7$F$M (B^^;
>
>
>  $B!!40A4L5NA!*!!"M"M"M"M"M!!!!;H$$J|Bj!*!!=q$-9~$_J|Bj!*!!FI$_J|Bj!*!!8+J|Bj!* (B
>  $B!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (B
>  $B!!!!!!!!!!!!!!!!!!!!!!!!!v!!0l@Z!"$*6b$O$+$+$j$^$;$s!*!* (B
>
>
>  $B!!!!!!!!!!!!!!!J9-9pHq$G1?1D$5$l$F$$$k$+$i!"$*6b$O0l@ZI,MW$"$j$^$;$s!K (B
>
>  $B"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"! (B
> _______________________________________________________________________________
>
>  $B"#EPO?FbMF$NJQ99!&:o=|!'2<5-%a!<%k%"%I%l%9$+$i2r=|$G$-$^$9!# (B
>
>  $B!!!!!!!!!!!!!!!!!!!! (Bhappy_magazin_info@yahoo.co.jp
>
>  $B!!!!!!!!!!!!!!!! (B  $B!!!! (B-  $B7G:\5-;v$NE>:\$O$41sN82<$5$$ (B -
>  $B!E!E!&!&!&!D!D(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,!D!D!E!E!&!&!& (B
>   $B!!!!!!!!!!!!!!!!!!!!!!!!!! (B FIVE STAR
>  $B!E!E!&!&!&!D!D(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,!D!D!E!E!&!&!& (B
invokes Emacs with a patch to 'doctor' mode that says "Don't bother me with your problems"

(?) More ginger beer!

From Ben

(!) [Jimmy] "Isn't wine prohibited here?" the boy asked
"It's not what enters men's mouths that's evil," said the alchemist. "It's what comes out of their mouths that is."
-- Paulo Coelho, The Alchemist
(!) [Ben] From a Linux beer survey on Newsforge http://www.newsforge.com/article.pl?sid=04/12/08/2229209&from=rss :
-----------------------------------------------------------------------
Eric S. Raymond,      |  Ginger beer. Ideally, the dark Jamaican style.
Open source advocate  |  With lime in it.
-----------------------------------------------------------------------
I'm sure that if I search long enough, "apt-get" will show a dependency between ginger beer and Linux...
(!) [Jimmy] Heh. While we're somewhere close to the topic, what's everyone's drink of choice, on the off chance I might bump into any of you? (Most people are good at rembering names or faces, I'm good at remembering drinks :)

(?) Ooh, what a good idea - a TAG favorite potables list! I probably won't remember any of it, but just in case...

(!) [Jimmy] Ben, yours is a Sam Adams, right?

(?) Er, well, unless I can get something better. :) Among American mass-produced beers, yeah - that's about as good as it gets. Right on par with Anchor Steam Porter, and I won't shy away from a Henry Weinhardt's, either. For my all-around favorite - well, it varies a bit, but I wouldn't turn down a Young's Luxury Double-Chocolate Stout (unless I've already had dinner. Either one of those or a large prime rib, and I'm filled up for the night.) Any of the Scottish Oatmeal Stouts are sure to find a welcome as well.

I'm also quite a fan of a few English hard ciders, but since I can't get any here, I'l just shut up and suffer in silence before the pain becomes intolerable. :)))

On the stronger side, there's Lagavulin Single Islay malt, with its load of peat and iodine (as somebody once said, "full of that 'exhumed body' flavor.") People assure me there are other scotches that are very similar, but I don't drink a whole lot, so the research is slow. :) I've been slowly losing my taste for sweet liqueurs over time, but a shot of Nassau Royale will still find a warm welcome.

In the realm of unleaded beverages, I've become highly partial to the Sikh /chai/ teas - they add date powder with cinnamon, ginger, and cardamom oils, and the traditional addition of milk (or soy milk) makes it even yummier. And, of course, there's always good ginger beer.

So, what would I get you in exchange when we're drinking at the Cross-Time Saloon? [1]

(!) [Jimmy] If it's beer, I'll drink it[1].
From the coctails menu, my favourite is a Frozen Irish[2] Mint (vodka, creme de menthe, Baileys and chocolate milkshake), closely followed by a Tequila Sunrise.
Erm... I'll drink pretty much anything except whiskey (too many bad/absent memories).

(?) There's something about whiskey and vodka that produces that effect in many people, yes.

(!) [Jimmy] And tequila. But I've had my worst moments after drinking whiskey, so I steer clear these days.
(!) [Jimmy] [1] Budweiser and its ilk are therefore excluded

(?) See, I knew you were all right. Budweiser isn't really a beer - it's a true/false intelligence test...

(!) [Jimmy] I prefer to think of it as the bar tender's placebo.

(?) If you ever get curious about the ingredients and send to a lab for analysis, the verdict is likely to be "your moose is pregnant".

(!) [Sluggo] I think I mentioned the scooter rally in Ireland where I counted the empty beer cans on one of the picnic tables, and half were Guinness and the other half were Budwiser.
BTW, I thought Thomas was English. Or is he only living in England?
(!) [Thomas] Both. :)
(!) [Jimmy] Eh? Is this because of the 'Irish' comment I made in reply to Thomas? That was because he quoted a friend of his on IRC, who said something like 'if Jimmy didn't keep reminding us every few sentences that he's Irish, I'd probably have guessed from his photo'. I'm still trying to work out if that means I look drunk :) (I wasn't. Honest!)
(!) [Jimmy] Erm... that's lower down the page. These threads can be quite confusing to layout.
(!) [Jimmy] [2] I've only seen this in an English bar in Spain :)

(?) Hey, since you know the ingredients, any decent bartender should be able to mix it for you. It'll make a good test to see if a given bar is worthy of our combined presence. :)

(!) [Jimmy] I have yet to find a bar that keeps chocolate milkshake around here :(
(Although I think I might try my hand at throwing a few together during the holidays).

(?) [1] Spider Robinson's creation. Quite the place; anything we'd care to drink would be behind the bar, and Mike Callahan (the bartender) would know just how to mix it... all we need now is a local gateway apiece, and we could hang out and swap stories till the morning [some version of it] comes.

(!) [Thomas] There is perhaps more of a chance that you and I will "bump" into each other. Should that ever happen, mine is coffee[1] -- of any kind, just as long as it is not instant.
[1] Although, really, it should be I that pays for them.
(!) [Jimmy]
Why's that? Are you afraid that requesting a non-alcoholic beverage might offend my sense of Irishness[1] or something? :)
[1] Got a quota to meet :)
(!) [Neil]
English beers:
  • Morlands Old Speckled Hen
  • Youngs Special
  • Greene King Abbot Ale
  • Greene King IPA
  • Broughton Ales Border Gold
  • Charles Wells Bombardier
(!) [Thomas] My father is rather fond of a Northern beer known as "Old Perculiar". It's very black, rather like the colour of peat, although I couldn't say what it tastes like...
(!) [Neil] Theakston's Old Peculier, with a peculiar spelling ;-)
Theakston's were taken over by Scottish and Newcastle a while back, with one of the family starting up a new brewery and brewing Black Sheep ale. http://www.blacksheepbrewery.com
It seems that Theakston's are now an independent company again.
http://www.theakstons.co.uk/Intro_text.htm
I should also have included Marston's Pedigree and Black Sheep on that list.
(!) [Neil] European Beers:
  • Leffe (Belgian not Dutch)
American Beers:
  • Sam Adams
  • Dixie Black Voodoo
(!) [Jimmy] Trying your damnedest to defeat my drinks memory, eh? Damn you! :)
(!) [Sluggo] I hereby nominate Jimmy for TAG Bartender.
(!) [Jimmy] Erm... I'd have to discuss that with Heather, who currently takes care of TAG refreshments. We'll have to see if there's room for a bar in the TAG lounge
(!) [Sluggo] People who remember I like cider rather than beer get my instant respect. Pear cider is the best. The best apple cider I've found is Cider Jack; it's dry and not too sweet.
(!) [Jimmy] This launched its own mini-thread: http://linuxgazette.net/110/lg_laundrette.html#nottag.7
My favorite tea is earl green. Second is plain green. Keep all coffee and anything mocha flavored away from me.
(!) [Jimmy] I remembered that from the time you posted the link to your pho (sp?) recipe. You were quite specific about it not being 'Earl Grey'.
(!) [Sluggo] I'm not against earl gray,
(!) [Jimmy] It's Earl Grey. Not a British vs. American thing, it was named after the second Earl Grey. :-P
(!) [Sluggo] it's just that green tea tastes better than black, as well as having more antioxidants and less caffeine. Jasmine black is OK. But plain black tea I have to put sugar in. I don't know why it got so popular.
Heh heh, in 2000 I was in restaurant in Toronto and asked for tea. Too late I remembered to ask, "Wait! What kinds do you have?" but the waitress was already out of earshot. My friends immediately pounced on me, "There's only one kind of tea here! Multiflavored tea is a west coast thing." I doubt it was literally true, but it was funny.
(!) [Brian] Here in the Greater Metro DC area (and south of the Mason-Dixon line), there are two kinds, sweet and unsweet, at least in iced teas. The chinese restaurants uniformly serve hot black pekoe. You can stand a spoon up in "sweet" and they both taste powdered, and of the same brand, at least in all the restaurants I've been in. I only got sweet once, and that before I knew what I was in for. The funny thing was, I didn't know what "sweet" was, and added sugar before I tasted it... yerch!
Yeah, there's also Starbucks and clones with tens of teas, but generally...
(!) [Jimmy] Heh. Tea with milk, or without. Choice is yours.
(!) [Sluggo] In Blackpool I stayed at a hotel that had a complementary packet of "white tea", which was really black tea with powdered milk. I wonder what they would call real white tea http://coffeetea.about.com/od/typesoftea/a/whitetea.htm
(!) [Jimmy] 'forn white tea'?
(!) [Sluggo] I drink humungous amounts of water. I can't eat a meal without drinking water. The water thins the food; otherwise it feels too thick and I can't eat more.
I started drinking alcohol and tea when I was in Russia. The vodka part was because people kept saying, "You won't drink with me, you're not my friend?" I certainly didn't want to put a barrier between myself and potential contacts since I was thinking about moving there for a while. People who knew only two words of English would say "Russian Tradition!"
(!) [Jimmy] I nearly had a c|n>k there - I've been hearing 'Polish tradition' in the same way a lot recently :) I've been pressganged into taking a trip there some time in the new year by my friend Pawel to try some Polskie piwo.
We have the same sort of 'you won't drink with me?' thing here. It's probably because there's very little physical contact between sober males - it's OK when you're drunk, or already very good friends with someone, so drinking together is an essential part of the friendship process.
(!) [Jimmy] I cut this into its own thread too: http://linuxgazette.net/110/lg_laundrette.html#nottag.6
(!) [Sluggo] whenever they they filled my glass. But when I got home, I quickly grew tired of paying $5 for vodka or beer when I didn't like them much.
(!) [Jimmy] Thanks for that Mike. I'm glad to see that there's somewhere else in the world where prices are as overinflated as they are here. I've been getting sick of hearing that a pint of beer is 30 cents in the Philipines, or a litre of vodka is 5 euros in Poland :)
My friend Trev was telling me that Joon, one of the maintenance guys where I work, told him "Come to the Philipines. Bring 50,000, buy a mansion. I'll bring the women."
(!) [Sluggo] The most interesting vodka brand was "Russkaya Ruletka" (Russian roulette),
(!) [Jimmy] 'Russian roulette' is the name of one of the Polish traditions that keeps cropping up. You're given three shot glasses, one filled with water, one with vodka, and one with... 'spirits'; swap them around, slam two.
(!) [Sluggo] which had billboards all over the place. Strangely, however, I never saw that brand at the kiosks. I surmised it was only drunk by rich expatriates, who bought it... um... wherever it is that rich expatriates congregate.
The tea thing happened indirectly. You can't drink the water in Russia unless you boil it first. Russians did not generally keep fresh water around, but you were never far from a teapot. And tea is boiled water -- how convenient! The babushkas were surprised when I kept coming back for tea, and were amazed when after a few cups I'd say, "Just let me have some hot water, please" until I was ready for more tea. So I came home and never stopped drinking tea.
The thing I missed most in Russia was ice water. I love ice water, especially with hot food. You can refrigerate boiled water, but you can't make ice cubes without ice cube trays. I guess ice is not a Russian tradition; I did not see a single ice cube tray my whole time there. I decided if I ever go back to Russia, I'm gonna make sure to pack a couple ice cube trays.
(!) [Brian] Coca-Cola or Mountain Dew, in the handy 2 liter single serving size.
I enjoy assorted beers, but I find that in an earlier era I enjoyed assorted beers, etc., far too much. So now I enjoy them in absentia.
(!) [Ben]
Ah, virtual beer! All the attributes of it except its presence and its effect. Easier on the wallet as well, and you can have the best brands without ever chasing out to the store... Smart guy, that Brian.
(!) [Brian] My new motto:
 _______________________________________
/ For me, mad cow disease could only be \
\ an improvement.                       /
 ---------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/
                ||----w |
                ||     ||
For some reason, it distresses both my lovely wife and my mother when I utter such things...
(!) [Ben] I'd be quite distressed if you were to udder such things in my presence, too. Mooved to tears, most likely.
(Is anyone else going to milk this opportunity, or will you all simply cowtow to public opinion and simply write about it in your dairies?)

(?) Even more ginger beer!

From Jimmy

We have the same sort of 'you won't drink with me?' thing here. It's probably because there's very little physical contact between sober males - it's OK when you're drunk, or already very good friends with someone, so drinking together is an essential part of the friendship process.
(!) [Sluggo] Not that I saw. People in Ireland drank if they wanted to, but they didn't get all out of sorts if you didn't. And if you stuck to one beer a day they didn't mind. It wasn't this one after another "you must have more" thing.
(!) [Jimmy] Well, it's more that if you continually decline invitations to the pub, people get really annoyed. And you're right, no one minds if you don't drink. They will tease you for it, though.
(!) [Ben] Heh. Ya gotta unn'erstan', Mike... despite the overt simplicity, there's a lot to that custom. In many ways, it's like the Jewish "eat, eat!" thing. First off, there is the obvious - "hey, aren't we friends? Why do you want to insult me?" But there's also an undertone of "just how much will you let me force you to drink?", with the sure knowledge that if you agree once, it becomes much easier after that. Then there's the cultural imperative of "you must be drunk to talk about serious things", which is What Men Do (i.e., big-time male bonding ritual.)
(!) [Jimmy] Another "What Men Do" thing, at least around here, is insulting your best friends. It's like a private joke: if the implicit "I love you really, man" is ever made explicit, the bond is... cheapened (that is, unless you're +/- two drinks from throwing up); if someone else joins in, serious in their insults, they find their mouth has been shut for them really quickly.
(!) [Ben] In Russia, that was considered more or less juvenile (i.e., college students, etc. would do it, but not most "adult men".) If you're good drinking buddies with each other, and you've "talked about the deep things", there's an implied deep level of trust. There are sayings and jokes about "knowing who you're drinking with", somewhat parallel to "I (would|wouldn't) go with you to scout enemy positions" (WWII expression that's stuck around, particularly among the older set.)
Russians don't much like superficiality, and it's taken for granted that you don't have to put on airs with somebody you've dragged home out of a mud puddle. :)
(!) [Jimmy] I had been aware of this to a degree before; my former immediate supervisor is incapable of giving a compliment - the more he insults you, the better a friend he considers you.
His most used term of endearment is 'bitch', so all of the guys I work or worked with call each other that as a piss-take. I talking to a Polish coworker, Beata, in the pub last week. She started to get offended when a friend (who was put working with my former supervisor when I changed shifts) called me a bitch, and started to say something about how she knew what those words meant. At the time I thought she was offended by his language, but afterwards I realised she only knows one meaning of bitch, and it never occurred to her that he was talking about me, let alone that she's completely unaware of our little custom.
(!) [Ben] Navigating those rocks and shoals is a little challenging, but here it is: a Real Man is one who stands up to the bullying by being relatively polite but totally firm about refusing... and then proceeds to get righteously fried with you anyway. [grin] Foreigners don't thread that particular needle well, usually. For that matter, there aren't that many Russians who do, either. I guess you could call it a fairly tough test.
(!) [Jimmy] Something like this?:
"Are you going to the pub"
"No way. I only got 3 hours sleep last night, and have to work tomorrow"
<Half an hour of 'oh, go on'>
"Alright so. I'll see you next weekend"
<Later that night>
"Thought you weren't going out"
"Ah, I haven't been hungover at work for a while"
(!) [Ben] Cool - the Irish version! No, more like:
[Friendly but somewhat overbearing (and a little threatening) attitude]
"You're not drinking - you don't want me to be your friend?"
[Face him squarely, take him by the shoulders, give him a shake]
"Vasya, what the hell kind of a question is this? I'm simply not
drinking tonight. Can't do it; the wife and the children are waiting
with dinner."
(Several rounds of similar, until Vasya gives up; *then*: )
"Listen, just to calm you down - just a couple of drops for the road."
Here comes that mud puddle...
(!) [Sluggo] Yeah, but it's just fucking ridiculous. Sorry for the cultural insensitivity, but I have a big issue with forcing alcohol on people, or letting it intrude into these areas of personal relationships that it really has nothing to do with. It is possible to be buddies and talk about deep stuff without alcohol.
(!) [Ben] Did you ever hear anybody say that cultural practices are supposed to make sense? Or that the average man actually enjoys them? Complaining about them is like saying that you didn't enjoy your Basic Training in a country that practices the draft.
I don't like the idea of force being used between people - we've talked about how I switch modes when anyone initiates it - but that doesn't mean I'm going to get torqued about 99% of human history, or ignore how people interact. I'm also able to distance myself enough to see that it can work for others, and even find amusement, interest - and most of all, compassion - for those involved. For myself, I just need to know the basics for surviving whatever it is; coming out on top and with style is a plus, if available.
(!) [Jimmy] What, without being able to play the 'Wow, I talk an awful load of shite when I'm drunk!' card?
(!) [Ben] Heh. Some people would just die if you took that one away. At least their careers would.
(!) [Jimmy] I'm open to the point where I consider nothing about myself private, but that's only because of a lot of drunken conversations that I had to face up to (the post-drinking 'what the fuck is wrong with you?' conversations :) I'd had 'deep conversations' before, but they always came from my public persona.
(!) [Ben] I did it as a conscious choice, one that took a lot of struggle to make. I do have things I consider private (mostly because other people are involved), but nothing secret or hidden; I just refuse to do that to myself anymore.

(?) Cider/Hangovers

From Jimmy

(!) [Jimmy] As it happens, I'm editing this while suffering the consequences of a work Christmas party :)

(?) Pear cider? Must try that. Remembering cider isn't too difficult for me - several of my friends and one of my brothers are cider drinkers. I'm not normally a fan of cider (I get horrible indigestion from it), but add a Pernod and some blackcurrant...

(!) [Neil] I believe "Pear Cider" should be called Perry. just don't mention Babycham ;-)
(!) [Sluggo] Never heard of Perry. All the pear ciders I've seen say "pear cider" on the bottle.
(!) [Neil] Googling for pear cider throws up mostly merkin sites, perry gets you mostly English sites. I guess we're just 2 nations divided by a common language.
(!) [Sluggo] "Merkin?" Reminds me of Mark Orkin's book, _Canajan, Eh?_ http://www.amazon.com/gp/product/customer-reviews/0773759069/104-7849304-6682317?%5Fencoding=UTF8 He has two other books although I've never seen them. _French Canajan, He'?_ and _Murrican, Huh?_
I know one Canadian who says "hey" instead of "eh". That might be the source of this peculiar word.
(!) [Neil] This particular usage[1] comes from when I used to read alt.fan.pratchett.
[1] Correct usage at http://dictionary.reference.com/search?q=merkin
(!) [Sluggo] I meant the source of "eh", not the source of "merkin".
(!) [Breen]
> Googling for pear cider throws up mostly merkin sites, perry gets you mostly
                                           ^^^^^^
I do not think that word means what you think it means....

(?) I told my brother what it meant once, and it became his favourite insult for a while.

(!) [Ben] All right! Another literate word-spotter! Well done, Breen.
(I knew people at SCA who talked about making some. For authenticity. Brrr...)
(!) [Neil] When I use a word it means just what I choose it to mean, neither more nor less.
(!) [Breen] Thank you, Mr. Dumpty. <g>

(?) Ah, right.

I've asked Heather:

"I like ginger beer, RC cola, eggnog when made from real eggs, mocha extra dark w/ whipcream, and tea at a rate faster than most programmers drink coffee. coffee only if it's real - not that fastfood style coffee sold at 24 hr restaurants and capable of rusting your innards."

(?) Righto, the TAG bar is open in #tag-chat

While we're on the topic - what's everyone's favourite hangover cure? Mine's plenty of water before sleeping, with a long walk home and next morning.

(!) [Ben] Mine is to be a couple of days away from the event - in either direction. :) Kinda like the guaranteed cure for sea-sickness (sitting under an oak tree...)
Seriously, I only recall (dimly, yeah) being hung-over once from drinking - and that may well have been a mild case of food poisoning. I've even done those things you're never supposed to do, alcohol-wise - drinking wine right after vodka, ditto with champagne... no problem. However, back in those long-ago days when Bill and I didn't inhale, I spent a number of mornings feeling muzzy and low on energy. Go figure...

(?) I remember my first hangover - day after my first time getting drunk, after celebrating the birth of my son. I was sick as a dog, because I was drinking with her family, who I didn't really feel all that comfortable around at that particular moment :)

Y'know, I don't think I've ever /not/ mixed drinks... Worst was snakebite with added shots of vodka, tequila, sambucca and jaegermeister, followed by 50% cider, 50% jaeg. I was still hungover two days later.

(!) [Sluggo]
> eggnog when made from real eggs,
Ahh, another story. I was in a floating bar in Deptford (that is, a bar on a boat that was permanently moored on the Thames) with two friends, one English and one Scottish. The second guy offered to get us drinks and I said lemonade. Then, remembering "lemonade" in England means some horrible piss-colored soda like Mountain Dew, I said, "Wait! I mean with real lemons." He looked at me with a "what the hell are you talking about" expression. The other guy, who had lived in the States, understood what I meant and said, "He means like a hootch without the alcohol." Somehow the bartender managed to find such a beast.

(?) Swedish Chef

From Heather

Dec 08 17:35:47 <editorgal_zzz> 09:02 <@popeywork> fork() fork() fork() !
Dec 08 17:35:47 <editorgal_zzz> 09:02 <@popeywork> (swedish chef with a cold)

(?) Album of the month

From Sluggo

Here's my vote for Laundrette album of the month:

(!) [Jimmy] Huh? It's open to a vote now? Wait, there's an album of the month now?
/me shrugs

(?) No need for a vote. A vote would just show our individual prejudices more than it would be any meaningful measure. We can just publish the lists like we've done before. But our past list http://linuxgazette.net/102/lg_backpage3.html was our all-time favorites, and this time I'm aiming for music most of us haven't heard.

(!) [Jimmy] Another good source of free music on the 'net is the Internet Archive: http://www.archive.org/audio though the categories are a bit more 'loose' than on Magnatune. It has a few categories: open source audio, live recordings, and 'netlabels'.
There's also quite a few choral recordings available from MIT:
http://hebb.mit.edu/FreeMusic

(?) Dr Kuch, Analog Disease http://magnatune.com/artists/dr_kuch (MP3 online) It has a techno base but occasionally mixes in reggae or big band horns. The occasional lyrics are in a myriad of languages, some French and some I don't recognize.

(!) [Jimmy] Kinda reminds me of Enigma. I preferred Falling You though.

(?) Anybody got any other nominations. Extra karma if they're lesser-known artists, if at least part of the album is on the web (without requiring Windows or Mac software), and if you can say something about why the music is original or unique.

(!) [Jimmy] I don't think I've listened to a whole album this month. My mental state generally tends to have two gears - up and down - and each has had its own playlist:
Down
The Cure - Burn
The Cure - Fascination Street
Smashing Pumpkins - Soma
Smashing Pumpkins - Disarm
DJ Shadow - High Noon
Nine Inch Nails - The Frail
Nine Inch Nails - The Wretched
Nine Inch Nails - A Warm Place
Pantera - Floods
Pantera - Suicide Note Part 1
Therapy? - Moment of Clarity
Slipknot - Vermilion Part 2
Audioslave - Like a Stone
Up
Slayer - War Ensemble
Slayer - Dead Skin Mask
Slayer - Blood Red
Slayer - Spirit in Black
Slayer - Bloodlines
Carcass - Embodiment
Carcass - No Love Lost
The Cure - Friday I'm in Love
The Cure - Just Like Heaven
The Cure - Close To You
Sikth - Scent of the Obscene
Machine Head - None But My Own
Helmet - Milktoast
Helmet - Unsung
Therapy? - Unbeliever
Therapy? - Misery
(though lyrically most of my up list would be on most others' down lists :)

(?) I finally took the plunge to soundcard-driven music. Actually it was forced by a receiver and CD player that are intermittently failing. I either had to replace them or get a bookshelf system or switch to the computer, and I wanted to do it for less than $100. But I don't like the current generation of components (way overkill). The used components in the shops are, um, worse than I already have. I don't like the bookshelf systems (no phono input). But my computer has crappy speakers. So do I get good computer speakers or connect my PC to my stereo? I looked into the $50 and $100 amplified computer speakers, but was afraid to get something that still didn't sound as good as my stereo. So I opted for two 25-foot patchcords and an adapter instead, for the princely sum of $15. The sound is a bit quieter than it should be and seems "compressed", but it's OK. I'm not sure if a better soundcard or shorter patchcords would make a difference, but I can't do anything about the patchcords. The soundcard is... something that uses the Ensoniq 1371 driver. So, now I can avoid the failing CD player. The receiver is holding up better than it did with CDs. And when it does eventually fail, I can replace it with anything that amplifies. The only radio station I listen to regularly has webcasting so I don't really need a receiver per se, except for records and tapes.

(!) [Jimmy] My brother used the same sort of setup. Switch to FLAC instead of MP3 and you'll get some improvement, but there'll always be a difference because the majority of soundcards are rubbish. The volume difference is down to the cables - most guitar leads run to about that length and standard practise is to add a pre-amp to compensate.
(!) [Chris G] I think that my album of the month is:
Plasticman - Sheet One
(!) [Thomas] Since the subject of music comes up a lot, I have just completed categorising the music that I own [1]. Have a look through it, and see what you think. :)
[1] http://edulinux.homeunix.org/music.rbx
(!) [Jimmy] Looking through that list, I see several albums that I /should/ have that seem to have mysteriously disappeared. I suspect my brother Joe got at them with a hammer.
(!) [Neil]
http://www.bachue.co.uk/cds.htm
(!) [Jimmy] On a related note, I've been trying out Audioscrobbler with XMMS: Audioscrobbler makes your listening choices public, and, once it knows enough about your listening choices, recommends other music to you.
http://www.audioscrobbler.com/user/jimregan
(!) [Jimmy] I've since found that audioscrobbler is only really useful if your tastes are restricted to a single genre: it can't handle that I like Slayer, Carcass, The Cure, and Jeff Buckley :(

(?) Alice in Wonderland

From Sluggo

Just what you never wanted. A site full of Java and Javascript games based on scenes from Alice in Wonderland . Curiouser and curiouser!
http://www.ruthannzaroff.com/wonderland/index.htm

(?) Off for Mile-high City

From Ben Okopnik

...Denver, that is.
----------------------------------------------------
ben@Fenrir:~$ metar KDEN
INPUT: 2004/12/05 17:53
KDEN 051753Z 31007KT 10SM FEW060 SCT100 SCT140 BKN200 01/M04 A2962 RMK AO2 SLP034 ACSL DSNT SW-NW OMTNS T00111044 10022 21033 50006
METAR Report
============
Airport-Id:             KDEN
Report time:            2004/12/5 17:53 UTC
Visibility:             16.1 km                                 10 US-miles
Wind:                   from the NW (310°) at 13 km/h           7 kt = 8.1 mph = 3.6 m/s
Temperature:            1°C                                     33.8°F
Dewpoint:               -4°C                                    24.8°F
Rel. Humidity:          69%
Pressure:               1003 hPa                                29.62 in. Hg
Sky condition:          few clouds at 6000 ft                   1830 m
                        scattered clouds at 10000 ft            3050 m
                        scattered clouds at 14000 ft            4270 m
                        broken clouds at 20000 ft               6100 m
----------------------------------------------------
And that's in the middle of the day.
It's just wrong for humans to live anywhere that temperatures get a '-' prefix. I'm going because people are throwing money at me, but... I'm just sayin'. If we were meant to deal with cold, we'd have thicker skin and lots more hair.
BRRRR!
I'm sitting at the Jacksonville airport, with palm trees waving outside. In just a couple of hours, I'll probably be seeing polar bears and most likely have to smear seal blubber on my face while gazing out over the lakes of frozen CO2... It's been a while since I've been north of the Mason-Dixon line in the winter and my memory may be a bit faulty, but it seems like a reasonable interpolation. Particularly since the temperatures here are in the sixties, and I'm already bundled up and still cold.
(!) [Jimmy] Heh. In the sixties? Is that like ~18°C? That's a warm spring day over here. It's gone to the second t-shirt time of year, but last week I was too warm at work, and started cleaning out the freezer (-36°C) to cool down :-P

(?) -36°C? That sounds cold enough to make lawyers put their hands in their own pockets. How do you get it that low, anyway? Ask one of the Bush twins for a date and duck behind the condenser, or what?

(!) [Jimmy] I've been wondering about that since I wrote it. I think the temperature gauge is busted. It's definitely lower than -3.6, but there's no way in hell I walked into -36 and walked out again, let alone spent a few hours cheerfully chipping away at the ice blocks.
(!) [William Park] Bunch of sissies. Have you been to Arctic Circle yet, up here in Canada?

(?) Why, no. I haven't stuck my tongue across a 110v outlet, either, or spent any time pounding my head against the wall... although I understand there are people that enjoy those kinds of things - including the visit that you mention. :)

I probably will cross one of the Circles' latitudes at some point, just to do it, but it's likely to be followed by several years' stay somewhere near the equator in order to defrost and deal with the psychological damage (dark rum will play a major role in the recuperation process.) A man's got to have his standards, after all.


(?) More on English

From Sluggo

http://linuxgazette.net/109/lg_laundrette2.html

Regarding Paddington Bear and the box room, I was even more shocked when it said he was using a torch in the room. In American English, torch means something with an open flame like the ancient Romans used. Not a good thing to have in box rooms with modern wallboard. I guess the book meant he had a flashlight.

(!) [Jimmy] Yeah, torch == flashlight in this case.

(?) Of course, flashlights don't usually flash, but that's another thing. Flashbulbs flash, but nobody uses them any more.

That reminds me of the book Crazy English . I transcribed some quotes from it a few years ago. It's in LaTeX format, unfortunately.

Here's the original.
http://www.amazon.com/exec/obidos/ASIN/0671023233/

English is the most widely spoken language in the history of our
planet, used in some way by at least one out of every seven human beings
around the globe.  Half of the world's books are written in English, and
the majority of international telephone calls are made in English.
English is the language of over sixty percent of the world's radio
programs, many of them beamed, ironically, to the Russians, who know
that to win friends and influence nations, they're best off using
English.  More than seventy percent of international mail is written and
addressed in English, and eighty percent of all computer text is stored
in English.  English has acquired tha largest vocabulary of all the
world's languages, perhaps as many as two million words, and has
generated one of the noblest bodies of literature in the annals of the
human race.

Nonetheless, it is now time to face the fact that English is a crazy
language.

In the crazy English language, the blackbird hen is brown, blackboards
can be blue or green, and blackberries are green and then red before
they are ripe.  Even if balckberries were really black and blueberries
really blue, what are strawberries, cranberries, and gooseberries
supposed to look like?

To add to the insanity, there is no butter in buttermilk, no egg in
eggplant, neither worms nor wood in wormwood, neither pine nor apple in
pineapple, and no ham in a hamburger.  (In fact, if somebody invented a
sandwich consisting of a ham patty in a bun, we would have a hard time
finding a name for it.)  To make matters worse, English muffins weren't
invented in England, nor french fries in France, nor Danis pastries in
Denmark.  Sweetmeat is made from fruit, while sweetbread, which isn't
sweet, is made from meat.

Greyhounds aren't always grey (or gray), ladybugs and fireflies are
beetles, a panda bear is a raccoon, and a guinea pig is neither a pig nor
from Guinea.

####
Quite a lot snipped
#####

(!) [Jimmy] I've been flicking through "Eats, Shites and Leaves" recently, which is another collection of english oddities, and I recently had a conversation about this with Marcin "Nedman" Niedziela, founder of LG PL:
(See Marcin? This sort of thing comes up on TAG /all the time/ :)
 >>> If it makes you feel better, English is the second hardest language
 >>> to read and write.
 >>
 >> You think so..? Then try to pronounce this:
 >> "konstantynopolitańczykowianeczka" (one word) or
[Pawel, one of my Polish coworkers, wouldn't even /try/ to pronounce that]
(!) [Jimmy] Marcin later explained that it means 'a woman from Constantinople'
 >
 > Hmm... the English-ish syllables, IIRC, would be
 > cone stan tin owe pole ee tan chick owe vyan etch ka
 > (Does that mean something like 'someone who comes from
 > Constantinople?')
 >
 >> "W Szczebrzeszynie chrząszcz brzmi w trzczinie"  ;)
[Pawel pronounced that easily, but couldn't explain it]
(!) [Jimmy] Another co-worker, Beata, said that it's a tongue-twister (well, she agreed that it was like "Peter Piper picked a peck of pickled peppers") This page (http://help.berberber.com/showthread.php?p=7819#post7819) seems to agree.
 > Aha. Got me there. I haven't heard '?' pronounced, so I don't know how
 > to say it :-P (I think I could manage the rest, if I said them
 > *really* slowly)
 >
 > English is harder to read and write because there are so many
 > different rules from so many different parent languages.
 >
 > In English, we have things like:
 > rough (ruff)
 > dough (doh)
 > thought (thawt)
 > plough (plow)
 > through (throo)
 > Scarborough (Scarburrah)

(?) That's Scar-burrow over here. "Are you going to Scar-burrow fair..."

(!) [Breen] Well, if we're going to play at that:
There was a young curate from Salisbury
Whose manners were all halisbury-scalisbury
  He went down to Hampshire
  Without any Pampshire
And the people there told him to walisbury.
(!) [Jimmy]
 > cough (coff)
 > hiccough (hiccup)
(!) [Ben] Robert Heinlein noted that particular problem, and had a sentence to illustrate it: "though the tough cough and hiccough plough him through".

(?) hiccough?? I don't think I've ever seen hiccup spelled that way.

(!) [Jimmy] That's the correct spelling in BE, though little used these days.
(!) [Jimmy] While trying to learn Polish grammar, I found this page:
However, it is comforting for Poles when you compare all that with the English language, where it can seem that no rules of pronunciation and spelling are obeyed. So, in the words even - meet - speak - key - ceiling - people - machine - piece - quay - Caius - Caesar - Phoenix, the bold-marked characters or sequences of characters have the same pronunciation (all the examples here and below are British). And the other way round, a given grapheme (character) can be read in different ways: the o in each of the words polish, Polish, move (oo), Home (yoo, a surname), love, one, woman, women (i), store, word, correct, reason (-) is pronounced differently.

(?) I guess people write less about hiccupping than about finalising encyclopaedia centres painted in grey colours while coughing down draughts at the pub and watching the football lads on the telly pound the pitch as the supporters on the terraces engage in fisticuffs in the pissing English rain.

(As opposed to finalizing encyclopedia centers painted in gray colors while coughing down drafts at the bar and watching the football (ahem) boys on TV pound the field as the fans in the stands sit and watch quietly while it's raining cats and dogs.)

(!) [Jimmy] 'watch quietly'? At an event that takes place in a stadium?

(?) It was amusing attending a US-Canadian soccer game last year. It was the Seattle Sounders vs the Vancouver Whitecaps, who are traditional rivals. Some Sounders fans were trying to promote a "loud section" -- an area where people were encouraged to stand and make noise like the Europeans do -- and were passing out flyers trying to convince people to get tickets for that section. But the section was pretty empty. The Canadians meanwhile had brought their maple leaves in force and were shouting and blowing noisemakers the whole time. The Sounders fans couldn't be bothered to bestir themselves, and just sat watching and quietly thinking, "Canadians are weird". Of course, everybody goes "Ooooh!" when there's a score, but that only lasts ten seconds and then it's over, it's not the continual rumblings.

(!) [Jimmy] Yeah, but Americans don't really get soccer yet,

(?) Yet??? You're assuming they will someday? :)

(!) [Jimmy] Sure. All those kids of the soccer moms will grow up someday.
(!) [Jimmy] so it's hard to imagine there'd be too many people who are really into it. (It's not just a European thing either: the South Americans are a lot louder from what I've seen).

(?) Whenever Brazil wins the world cup, there are horns a-honking all over town, and crowds in front of Brazilian restaurants playing bongo drums for hours. This even in cities without large Brazilian populations. The first time it happened in Vancouver I didn't even recognize it. "Ah, it's just a bunch of sports fans." Only after I saw it again and again whenever Brazil or Mexico won a match did I notice the trend.

(!) [Kapil] As an honorary Mexican I feel compelled to object!

(?) There have been so many funny US-Mexico cartoons. One was in Calvin and Hobbes. Calvin did something bad (news flash!) so he has to vamoose pronto.

(!) [Jimmy] vamos?

(?) Vamos means "we go" or "let's go" in Spanish. Vamoose (va-MOOSE) is an English corruption that's more urgent (disappear, scram, get lost, hightail it outta here). Likewise, pronto in Spanish means "soon" but in English it means "right away or else". Or as a Valley Girl might say, "like, instantaneously".

(!) [Jimmy] Just wondering if I had the Spanish right. I know all about 'vamoose': my Dad's a fan of cowboy movies.

(?) Did you see the Inspector in the Pink Panther cartoons? He was a French guy with a Spanish sidekick. Every time he gave an order, the sidekick would say, "si". The inspector kept chiding him, "Don' say 'si', say 'oui'." Once they were on a pirate ship battling this evil clam captain. They escaped the ship in a dinghy. The sidekick commented, "We're sinking into the oui!" The Inspector glubbed in his last breath, "Don' say 'oui', say 'sea'."

(!) [Jimmy] :)
(IIRC, there's also a 'si' in French that also means 'yes', but for answering questions where 'oui' would be ambiguous)

(?) He practices his Spanish: "Que pasa, senorita? I am el fugitivo."

But the funniest one was a political cartoon where an American is driving into Mexico and his companion calls after him, "Don't drink the water!" Meanwhile a Mexican is driving into California and his companion calls after him, "Don't breathe the air!"

(!) [Offer Kaye] Why? That makes you an honorary Central American, not South American...
(!) [Jimmy] Honourary Mexican? How so? And more importantly, Dnde Está mi tequila?
(!) [Kapil] Because when I was in Mexico, many did exactly what you did---spoke to me in Spanish---even to the point of asking me directions. Clearly I was taken for a "native"---and I took that as an honour.
(!) [Jimmy] Heh. That's about the extent of my Spanish: Cmo está, Buenos noches, por favor, gracias, esta una bar aqui, and dos cervezas por favor. Bare necessities only :)

(?) Hasta la sagne.

(!) [K.-H.] Does this meen the same as "Hast a Lasagne" ?

(?) No, hasta means "until". Sagne doesn't exist AFAIK. I just made it up based on "hasta la taco", which you sometimes hear. They're all derived from "hasta la vista" (till we meet again, or literally "till the seeing"; compare "auf wiedersehen").

(!) [Jimmy] Or 'au revoir' in French or 'do widzenia' in Polish

(?) This is what happens to you if you grow up in California. My mom used to say "pronto" and "hamburguesa con queso, por favor". Not to order a hamburger with cheese, mind you. She just said it at random moments. (Yes, hamburguesa can also mean a girl from Hamburg.)

(!) [Jimmy] ...p. 13 in the cannibal's cookbook.

(?) "Hasta la vista... baby!"

(!) [Jimmy] /me resists the temptation to say... erm... the /other/ line from that movie
(!) [K.-H.] relevant dictionary entries:
Hast = South German dialect for "do you have"

a    =   "    "        "        "an"

Lasagne = famous Italian Pasta dish in layers
(!) [Jimmy] So you're just omitting the 'du'?
(!) [K.-H.] Well -- properly pronounced the "a" would shift to a darkish "o" sound. Spelling is not fixed for Bavarian like it's for "High german". Gramatically there is more in there -- The Bavarian "hast" actually includes the "du". "Haben sie" = "hams", "hat er" = "hod a" (putting the o sound in writing here).
(!) [Jimmy] (Rammstein taught me the ambiguity of 'Du hast': it means both 'you have' and 'you hate', right?)
(!) [K.-H.] Pronounciation is indeed very similar -- spelling is different so.
Du hast (you have)
Du hasst (you hate) -- the double "s" comes along with a somewhat
                       sharpenend "s" sound and a strong emphasis on the
                       "a"
(!) [Kapil] Ah! The USA is a bundle of contradictions:
1. The most popular country in the world. (look at immigration stats)

(?) The immigration stats that went way down this year?

(!) [Kapil] 2. The least popular government in the world. (ask people around the world who enemy number 1 is)
3. The country with the greatest number of great sports people. (see who has been winning the most gold medals over a longish period of time)

(?) ... a large percentage of whom are foreign born.

(!) [Kapil] 4. The country with the least participation in the worlds most popular game. (soccer)
... the list goes on.

(?) We make trends, we don't follow them. :) If the world doesn't understand the innate superiority of American football, baseball, and basketball over soccer, that's the world's problem. (Tongue firmly in cheek.)

A friend pointed out that organized team sports didn't exist until the Industrial Revolution, before that it was all individual sports. There were soccer-like games but not persistent teams and rankings. He said that was not just a coincidence but a conscious campaign by the business owners to instill corporate values in the workers (i.e., being a "team player"). Thus why so many teams were founded and sponsored by companies. (Hmm, this sounds a bit, er, Stalinistic....)

Contradictions "R" Us.

(?) Speaking of soccer, I just got this spam:

Subject: David Beckham wears Rolex

Do you want Watch?
http://example.com/rep/sales/

(?) Hey Stranger

From Sluggo

On Thu, Dec 09, 2004 at 08:46:24AM -0300, Britany70@hush.com wrote:
> Hey You, I am Britany
> My friend gave me your email, and warned me that you're exciting..
>
> I can not stand him anymore, this marriage is unhappy, He didn't touch me in
> months
What's the deal with "my husband isn't home" spams? They suddenly increased dramatically a couple weeks ago.
(!) [Thomas] Well, if their husbands are out playing the proverbial milkman, the least they could do is try and do the same from the other angle, no?
(!) [Ben] They're all out chasing Britany; that's why they're not at home. At least until their wives learn to start sending these emails that say, "Hey You, I'm <Name>. My friend gave me your email..." Eventually, the Brownian motion in the total population of the husband/wife set will settle to its minimum-disturbance level as the individual units recombine into stable pairs (which implies a drop to minimum temperature - take that as you will), and the spams will stop, or at least decrease greatly.
Marriage dynamics just ain't what they used to be, and it's these dang computers that are at fault.

(?) Misc IRC stuff

From Jimmy

Misc stuff from IRC that touches on just about everything else in the laundrette: English, drinking (including the grand opening of the TAG lounge's bar)

See attached irc-misc.html


(?) Question

From Jimmy O'Regan

(?) Heather mentioned on IRC that she used to write for a 'Dear Abby' type advice column for the linuxlorn, so...

"Dear Heather, I'm writing to you because I have a problem. I put a lot of time and effort into 'The Rules', but I'm worried that now, noone can see the services behind my firewall Should I try to show that I have more to offer? That, behind the firewall, I have a warm sense of ftp?"

(!) [Ben] [LOL] Jimmy, you... you... you rock.
"Young, single, beige client ISO an experienced server who is open to a new connection. If you're still running in promiscuous mode, look elsewhere..." This could really go places. Bad ones.
(!) [Sluggo] As has been pointed out, Unix is the only operating system where you can fork without protection and then kill your children.

(?) Hur hur hur. "After one spawns a child process, how long should one wait before fork()ing again?"

(!) [Sluggo] Number five -- alive.
(!) [Ben] I have no idea what that refers to, although I've heard it used once or twice before. Enlighten those of us who don't?
(!) [Brian] Short Circuit, a movie with Ally Sheedy and some robots ... numbered.
A fan site for Johnny Five: http://www.johnny-five.com
(!) [Ben] Cultural icon sorta thing, I presume? Another "Where's the beef?" Odd, I usually pick up on those, despite my refusal to own a TV. Oh well.
(!) [Sluggo] What, no Elvis sightings today?
Ben, when you drove the taxi in New York, were you an Elvis impersonator?
http://www.centredaily.com/mld/centredaily/news/7446657.htm
(!) [Ben] Sheesh, you totally missed the point. I was a cabbie impersonator.

(?) Collins Word Exchange

From Jimmy O'Regan

Collins Word Exchange:
http://www.collins.co.uk/wordexchange
is a project where internet users may debate the validity of neologisms.
The first word to make it through the process is... (drumroll please), an Irish word, langer
http://www.collins.co.uk/wordexchange/Default.aspx?it=271&pg=-1
langer noun Irish (Derog. slang) 1. a fool; an idiot 2. (Slang) penis 3. adjective langers extremely drunk (Submitted by: Normac)
I'm not convinced they have the right order of definition there: as far as I was aware, the other two usages derive from langer as a synonym for penis (and, if you think about it, it makes more sense that way anyway).
So, according to Collins, langer is now an official word, and may be used in Scrabble (score of 7).

(?) Just a bit o'Irish...

From Benjamin A. Okopnik

And then, o'course, there's this bit of (Australian-)Irish that I just got from a poetry list... just a little something to balance Jimmy's ever-cheerful ways. :)

(!) [Jimmy]
  • Complaints about the weather: check
  • "ing" changed to "in'": check
  • Dipthongs replaced with initial monopthong: check
passes enough Irishness tests for me, and several more besides.

(?)

'Said Hanrahan'

"We'll all be rooned," said Hanrahan,
   In accents most forlorn,
Outside the church, ere Mass began,
   One frosty Sunday morn.

The congregation stood about,
   Coat-collars to the ears,
And talked of stock, and crops, and drought,
   As it had done for years.

"It's looking crook," said Daniel Croke;
   "Bedad, it's cruke, me lad,
For never since the banks went broke
   Has seasons been so bad."

"It's dry, all right," said young O'Neil,
   With which astute remark
He squatted down upon his heel
   And chewed a piece of bark.

And so around the chorus ran
   "It's keepin' dry, no doubt."
"We'll all be rooned," said Hanrahan,
   "Before the year is out."

"The crops are done; ye'll have your work
   To save one bag of grain;
  From here way out to Back-o'-Bourke
   They're singin' out for rain.

"They're singin' out for rain," he said,
   "And all the tanks are dry."
The congregation scratched its head,
   And gazed around the sky.

"There won't be grass, in any case,
   Enough to feed an ass;
There's not a blade on Casey's place
   As I came down to Mass."

"If rain don't come this month," said Dan,
   And cleared his throat to speak --
"We'll all be rooned," said Hanrahan,
   "If rain don't come this week."

A heavy silence seemed to steal
   On all at this remark;
And each man squatted on his heel,
   And chewed a piece of bark.

"We want an inch of rain, we do,"
   O'Neil observed at last;
But Croke "maintained" we wanted two
   To put the danger past.

"If we don't get three inches, man,
   Or four to break this drought,
We'll all be rooned," said Hanrahan,
   "Before the year is out."

In God's good time down came the rain;
   And all the afternoon
On iron roof and window-pane
   It drummed a homely tune.

And through the night it pattered still,
   And lightsome, gladsome elves
On dripping spout and window-sill
   Kept talking to themselves.

It pelted, pelted all day long,
   A-singing at its work,
Till every heart took up the song
   Way out to Back-o'-Bourke.

And every creek a banker ran,
   And dams filled overtop;
"We'll all be rooned," said Hanrahan,
   "If this rain doesn't stop."

And stop it did, in God's good time;
   And spring came in to fold
A mantle o'er the hills sublime
   Of green and pink and gold.

And days went by on dancing feet,
   With harvest-hopes immense,
And laughing eyes beheld the wheat
   Nid-nodding o'er the fence.

And, oh, the smiles on every face,
   As happy lad and lass
Through grass knee-deep on Casey's place
   Went riding down to Mass.

While round the church in clothes genteel
   Discoursed the men of mark,
And each man squatted on his heel,
   And chewed his piece of bark.

"There'll be bush-fires for sure, me man,
   There will, without a doubt;
We'll all be rooned," said Hanrahan,
   "Before the year is out."

      -- John O'Brien
(!) [Breen] You beat me to in, Ben. :)
More info on that poetry list is at
http://www.cs.rice.edu/~ssiyer/minstrels

(?) Oh, a man of excellent taste. Will wonders never cease? :)

I knew Martin for a few years before he even started the list, through an froup we were both in. Later, I ran into the Wandering Minstrels via a web search for some piece of poetry, and was pleasantly surprised to see his name there. As large as the Net is, it's still a small world.


(?) Album of the month

From Martin Pagh Goodwin

(!) [Jimmy] (This spawned from the Album of the Month thread: http://linuxgazette.net/110/lg_laundrett.html#nottag.9)

It all boils down to whether (or is that wheather (or wedder)) your amplifier will do the DAC for you.

(!) [Jimmy] Got it right first time: whether
(!) [Sluggo] I was wondering if the second was a tip of the hat to our Editor Gal.
I couldn't figure out the third. I didn't see how you could change "Jim Dennis" to "wedder", and I can't think of anybody named Ed on staff.
(!) [Ben] It's all about the music, dude. It obviously (since we're going to go off the bugf*ck end of the guessing spectrum) refers to the 15th century ballad "Captain Wedderburn" - capably redone by Great Big Sea.
A nobleman's fair daughter
Came down a narrow lane
Met with Captain Wedderburn
Keeper of the game.

"Now my young, fair miss
If it wasn't for the law,
Then you and I in a bed might lie,
Roll-me-over-next-to-the-wall,
Roll-me-over-next-to-the-wall."
(If you've never heard it, it's a standard "do these N*3 tasks and you'll get (paid|laid|rewarded)" stories. But it's a pretty tune, and well told.)

(?) New Disease

From Sluggo

(!) [Jimmy] From Bob Eastey, via Sluggo
The Center for Disease Control has issued a warning about a new virulent strain of a sexually transmitted disease.
This disease is contracted through dangerous and high risk behavior. The disease is called Gonorrhea Lectim (pronounced "gonna re-elect him").
Many victims have contracted it after having been screwed for the past 4 years, in spite of having taken measures to protect themselves from this especially virulent disease.
Cognitive sequelae of individuals infected with Gonorrhea Lectim include, but are not limited to:
Antisocial personality disorder traits; delusions of grandeur with a distinct messianic flavor; chronic mangling of the English language; extreme cognitive dissonance; inability to incorporate new information; pronounced xenophobia; inability to accept responsibility for actions; exceptional cowardice masked by acts of misplaced bravado; uncontrolled facial smirking; ignorance of geography and history; tendencies toward creating evangelical theocracies; and a strong propensity for categorical, all-or nothing behavior.
The disease is sweeping Washington. Naturalists and epidemiologists are amazed and baffled that this malignant disease originated only a few years ago in a Texas Bush.

(?) News today

From Sluggo

(?) From the "what will those yanks do next" department...

http://seattletimes.nwsource.com/html/education/2002104208_utahguns30.html The Utah state legislature challenges a University of Utah ban against concealed firearms on campus, saying the university does not have the authority to restrict guns further than the state does. Opponents raise the prospect of disgruntled students shooting professors or chilling free speech. Proponents argue said professors (and women, and janitors) have a right to protect themselves.

(!) [Jimmy] That's pretty fucked up. Could've really improved my grades if I went there, though...

(?) This doesn't have anything to do with getting a degree in shooterology!


(?) Question

From Peter Rinaldi

(!) [Jimmy] OK, so this turned out to be a legitimate question, but I couldn't see how, really, and Heather had recently reminded me of the cardboard boxes messages....
(for the interested, JimD posted a message entitled "'chroot()' Jails or Cardboard Boxes" (http://linuxgazette.net/issue36/tag/15.html), which lead to "Thinking AROUND the Box?" (http://linuxgazette.net/issue52/tag/22.html) (Heather said that Jim actually checked patent applications for that :), "More observations of a cardboard box" (http://linuxgazette.net/issue65/tag/cardboard.html), "The Cardboard Box" (http://linuxgazette.net/issue62/lg_mail62.html#mailbag/1), and "Cardboard Box Inventor" (http://linuxgazette.net/109/lg_laundrette3.html#nottag2/3)
We're not the only Linux-related group to have gotten questions like this: Debian got frequent requests for the sheet music to "Dueling Banjos" around the time I was trying to become a package developer, which only ended when someone finally posted the sheet music. :)
From the Debian Weekly Newsletter (http://www.debian.org/News/weekly/2003/37):
*No Dueling Banjos from Debian.* Some of the most bizarre mails (http://lists.debian.org/debian-devel-0009/msg00851.html) on debian-devel over the years (http://www.google.com/search?as_oq=sheet.music+dueling+banjos&amp;as_sitesearch=debian.org&amp;safe=images) have been repeated (http://lists.debian.org/debian-devel-0306/msg01368.html) requests (http://lists.debian.org/debian-devel-0309/msg00378.html) by various (http://lists.debian.org/debian-devel-0301/msg00027.html) people for the sheet music for dueling banjos. Several list subscribers have (http://lists.debian.org/debian-devel-0009/msg00874.html) been eager (http://lists.debian.org/debian-devel-0009/msg00862.html) to assist (http://lists.debian.org/debian-curiosa-0308/msg00000.html) the posters in their search. Jim Penny called (http://lists.debian.org/debian-devel-0309/msg00382.html) this the Dueling Banjo Effect and explained that this has become a self-perpetuating Google-flop. People use Google which points them to Debian to get this sheet music, and the act of asking reinforces Google's notion that Debian is a good place to get the music.
(The first mention seems to be here: http://lists.debian.org/debian-devel/2000/07/msg00206.html see also the Debian Wiki: http://wiki.debian.net/index.cgi?DuelingBanjoes which points to the message that started it all: http://lists.debian.org/debian-devel/1999/10/msg01031.html or the sheet music: http://www.muziekzetter.be/free/dueling_banjos.pdf)

I have a brain twister of a question for you.

I was reading your article on Bluetooth and Mobile phones.

Is it possible to write a program in the computer which captures the digits being dialled from the (Nokia or whatever) mobile phone and also preferably the ID of the phone and send that information to a file on the computer in as close to real time as possible.

I would really appreciate your help. There may even be a dollar or so in it for an enterprising person.

(!) [William Park] Such phone interception is illegal in many countries. But, doable, since every intelligence agencies in every country are doing it.
Go away, spammer.
(!) [Jimmy] Yes and no, depending on what you mean.
If you mean that you want to grab this information from any phone within range, even if they are not yours, then no, it's not possible:
"To use most of the services on a mobile (or most Bluetooth devices, as far as I can tell), the mobile and the computer must first be paired. Basically, this involves both having the same PIN code entered -- just imagine how horrible it would be if anyone could browse around the files on your phone, or use your computer as an Internet gateway."
That would be a new horrible idea that had not occurred to me, but fortunately the creators of bluetooth were prepared for it.
If, on the other hand, you mean that you have a number of phones that you use for different purposes, then yes, it is possible to find out which phone numbers have been dialled, or from which numbers calls have been received, and to log them.

(?) Kind Regards

Peter F. Rinaldi Instant Response Marketing

(!) [Jimmy] Now, with this statement, and the mention of 'Marketing' you have helped me to categorise your question better - we answer questions for a much larger audience than just the individual querent, which is why you have received so much help from me so far.
I would like to warn our readers that it is possible to be subjected to spam via bluetooth by simply walking within range of a device. There is a bit of a trend where people send strangers random messages in the form of empty vcards, where the name field is used to carry the message.
I doubt this is of any particular interest to our friend in marketing, however, as this kind of abuse was foreseen by the makers of mobile phones: file transfers of any nature are turned off by default, and must be authorised in any event. It is only when a phone is paired with a computer - i.e., that you have specifically told it to trust a computer - that you can have any degree of automation.
The range of bluetooth devices (10 metres) is too low for this to be a realistic marketing vehicle. The only real use I can imagine, if it were possible to snoop unauthorised on the numbers being dialled on a phone, is that of the jealous spouse who wishes to spy on their loved one.
Because we are the answer gang, I'll go beyond our 'Linux questions only' charter for this case.
If this is your intended use, you should first be aware that this kind of jealousy is usually self-fulfilling: it starts out without basis, but the accused eventually decides to commit the crime for which they are being punished. It is, quite honestly, difficult for me to imagine this kind of mindset, as there are so few who have as much to offer as I do, so my advice to a person with these inclinations would be to improve yourself and your outlook on life to the point where you, like me, have so few competitors that jealousy is simply unfathomable.
Don't just have a nice day, make yourself have one. It's best to start with a smile, I think.

(?) 12 Days of Christmas

From Jimmy O'Regan

http://www.pncbank.com/12days

(?) [Lgang] SPAM: read this - abOut the GrReenCard

From Mike Orr

Here's a strange spam.
----- Forwarded message from Randi Simpson <agllzmjmnm@garlic.com> -----

Date: Wed, 08 Dec 2004 21:40:56 +0300
From: "Randi Simpson" <agllzmjmnm@garlic.com>
To: <jholden@oz.net>
Subject: read this - abOut the GrReenCard

US GrRrReen CarrRd Lottery 2o05

create a better future for your children!

Get it while it lasts:  http://gladiator.gcthree.info





you are blacklisted

Jeffery Ybarra
Herder
Theralase Inc., Markham, Ontario, L3R 0E7, Canada
Phone: 244-221-1158
Mobile: 813-417-8154
Email: agllzmjmnm@garlic.com

This is a confirmation message

This software is a 46 hour trial product

NOTES:
The contents of this e-mail is for understanding and should not be blunder sophoclean

paramilitary eocene retrovision

Time: Wed, 08 Dec 2004 20:46:56 +0200

----- End forwarded message -----

(?) The hot babe problem

From Sluggo

http://lwn.net/Articles/113644

LWN: "This Intent To Package posting was guaranteed to raise a bit of a fuss. The program involved is hot-babe, a graphical CPU utilization monitor. It works by displaying a typical Bruno Bellamy drawing of a minimally-clad, maximally-endowed woman. As the CPU gets busier ("hotter"), the woman undresses to compensate. Your editor, whose journalistic ethics required that he investigate this utility, found it to be an amusing addition to the desktop - for about five minutes, or until the children walk in, whichever comes first."

(!) [Ben] "Your editor, whose journalistic ethics required that he investigate this utility, [ ... ]"
Dang. I don't remember writing that, but since I said I'm required, I guess I've got no choice...
[clickety-click]

(?) I'm not sure if you're being facetious, but that was written by Jon Corbett, LWN's editor.

The article is mainly about Debian's dilemma whether to package this program.

(!) [Ben] Yes, Mike, I was being facetious. I don't know of anyone who could seriously say that their ethics require them to examine pictures of naked women. Aesthetics, certainly; lots of other reasons - including some feverishly-invented ones in case of need - but not ethics.
(!) [Jimmy] Pathologists, gynaecologists, etc.?
(!) [Ben] Their work may require them to do so. Ethics, though?
(!) [John] I think that was Corbet's idea as well - tongue planted firmly in cheek - but that's just my assumption.

(?) NewsForge | Free (and open) holiday greeting cards

From Jimmy O'Regan

http://www.newsforge.com/article.pl?sid=04/12/08/2115219&from=rss
Cute.

(?) More Swedish Chef

From Jimmy O'Regan

Dec 18 13:09:28 <editorgal> what's an opensource project do when the swedish chef doesn't agree with its current progress?
Dec 18 13:09:32 <editorgal> fork fork fork
Dec 18 13:09:33 <editorgal> ;P
Dec 18 13:10:08 <jimregan> Who's the Swedish chef's favourite singer?
Dec 18 13:10:10 <jimregan> Bjork Bjork Bjork
Dec 18 13:10:45 <jimregan> How was newborn Swedish Chef delivered?
Dec 18 13:10:46 <jimregan> Stork stork stork
Dec 18 13:11:14 <jimregan> What's the Swedish Chef's favourite food?
Dec 18 13:11:15 <jimregan> Pork pork pork
Dec 18 13:11:42 <editorgal> and if he's tired of swedish meatballs, he has for dinner...
Dec 18 13:11:48 <editorgal> pork pork pork
Dec 18 13:12:05 <jimregan> If he built a boat, what would he use?
Dec 18 13:12:06 <jimregan> Cork cork cork
Dec 18 13:12:10 * editorgal likes mine
Dec 18 13:12:31 * jimregan wishes he had googled
Dec 18 13:12:43 <jimregan> There must be many of them about the place
Dec 18 13:12:53 <editorgal> oh no his machine's unhappy - it's horked horked horked
Dec 18 13:13:04 <jimregan> fghgfs
Dec 18 13:13:14 <jimregan> Translation: "Groan"
Dec 18 13:13:28 * editorgal chuckles wickedly
Dec 18 13:13:37 <editorgal> pass another gingerbeer then :)
Dec 18 13:13:55 * jimregan passes another ginger beer from behind the bar
Dec 18 13:14:01 <editorgal> and you know his fave text adventure game
Dec 18 13:14:04 <editorgal> zork zork zork
Dec 18 13:14:18 * editorgal glugs a nice tangy one
Dec 18 13:14:24 <jimregan> Favourite place in Britain?
Dec 18 13:14:24 <jimregan> York York York
Dec 18 13:15:31 <jimregan> Least favourite insult?
Dec 18 13:15:32 <jimregan> dork dork dork
Dec 18 13:17:33 <editorgal> opens his jars with a torque torque torque
Dec 18 13:18:22 <editorgal> goes on vacation, visits rork rork rork
Dec 18 13:18:45 <editorgal> ...and per george carlin, travels *in* the plane, not on it.
Dec 18 13:21:00 <editorgal> and he warned of goblins crying "ork ork ork!"
Dec 18 13:26:08 <editorgal> the chef doesn't scuba, he goes snork snork snork.

(?) Since we've been discussing alcohol...

From Ben Okopnik

Here's one Mike will appreciate. As for anyone here who has "been there and done that", don't bother telling us; we'll just nod in commiseration^Wamusement.
http://pubpages.unh.edu/~ducharme/pages/indestructible.html

(?) MERRY XMAS

From paul power

Hello everybody just wanted to wish everybody happy xmas and wish ye the best for 2005.
p.s. FOR ANYONE WHO WONDERED WHERE THIS TRADITION STARTED - TRUE STORY SANTA TOLD ME SO
One particular Christmas a long time ago, Santa was getting ready for his annual trip, but there were problems everywhere. Four of his elves got sick, and the trainee elves did not produce the toys as fast as the regular ones, so Santa was beginning to feel the pressure of being behind schedule. Then, Mrs. Claus told him that her Mum was coming to visit.This stressed Santa even more. Then when he went to harness the reindeer, he found three of them were about to give birth and two had jumped the fence and were out heaven knows where.
Then when he began to load the sleigh one of the boards cracked and the toy bag fell to the ground and scattered the toys everywhere. So, frustrated Santa went back into the house for a cup of coffee and a shot of whiskey. When he went to the cupboard, he discovered that someone had drank all of his liquor and there was nothing left to drink. In his frustration, he accidentally dropped the coffee pot and it broke into a thousand pieces. Santa went to get the broom and found that the mice had eaten the straw from which it was made.
Just then the doorbell rang and Santa cussed his way to the door. He opened the door and there was a little angel with a great big Christmas tree. The angel said cheerfully, "Merry Christmas Santa. Isn't it just a wonderful day? I have a beautiful tree for you. Where would you like me to stick it?"
Thus began the tradition of the little angel on top of the Christmas tree.

(?) Userfriendly Christmas cartoons

From Jimmy O'Regan

Userfriendly is carrying a Christmas theme this week:
http://www.userfriendly.org/cartoons/archives/04dec/uf007425.gif http://www.userfriendly.org/cartoons/archives/04dec/uf007426.gif http://www.userfriendly.org/cartoons/archives/04dec/uf007427.gif http://www.userfriendly.org/cartoons/archives/04dec/uf007428.gif http://www.userfriendly.org/cartoons/archives/04dec/uf007429.gif http://www.userfriendly.org/cartoons/archives/04dec/xuf007430.gif
While you're at it, have a look at the Userfriendly multilingual Christmas tree: http://www.userfriendly.org/illiad/UF_CT2004.png

(?) Bicycles & Linux

From Heather

15:46 -!- Santa [~Santa@82.195.105.72] has joined #hants
15:46 -!- Santa [~Santa@82.195.105.72] has left #hants []
15:46 < [T]hunder> oh well...no presents for us this year :(
15:47 <@editorgal> haha
15:47 <@editorgal> "techies. thinkgeek will do. next chimney"
15:47 < [T]hunder> lol
15:48 < [T]hunder> but I wanted a new bicycle this year...with Linux on it so I don't crash
15:49 <@blueGremlin> lol!
15:50 * editorgal should have thought of that when I was learning to bicycle
15:51 <@editorgal> hm, linux didn't exist back then. come to think windoze didn't either..
15:51 < [T]hunder> me too...I would have never forgotten the concept of braking when I saw that bush coming my way...:(
15:52 * blueGremlin imagines [T]hunder on a bike, stationary in the middle of a road with a bush coming towards him
15:52 <@editorgal> I saw bush coming my way, best I could do was vote against..
15:52 < [T]hunder> ha ha ha
15:53 < [T]hunder> hmm...I think i'd have voted against that bush coming my way...but I was too young
15:57 <@editorgal> heard of several cars attacked by drunk lampposts
16:03 < [T]hunder> ...that's quite a technological breakthrough...finally some pay-back for all those ppl who like to drink and drive. GO LAMPPOSTS
16:04 <@blueGremlin> lol
16:04 <@blueGremlin> I see +c doesn't stop people using bold
16:24 <@editorgal> [T]hunder: can I steal your line about the bicycle for the LG laundrette?
16:25 < [T]hunder> Go ahead...it's all GPL'd

(?) Chumpbot

From Jimmy O'Regan

I'm thinking of using Chumpbot (http://usefulinc.com/chump) on TAG's IRC hangout (because I'm too lazy to go sifting through the logs every month :) Here's a sample file (I'll be generating HTML from it, obviously, but there's nothing in this that really merits inclusion for any purpose other than to serve as an example).
(Oh, wait. There's "The Night Before Christmas, Hemingway style": http://newyorker.com/archive/content/?031222fr_archive01)

See attached 2004-12-22.xml.txt

OK... I tried it out, but I don't think it won too many fans.

See attached tagbot.html


(?) RICO applied to spammers

From Benjamin A. Okopnik

Interesting turn here. Given that US law is based on precedent, I wonder where this will take us...
----- Forwarded message from RISKS List Owner <risko@csl.sri.com> -----

Date: Mon, 20 Dec 2004 11:47:08 -0700
From: "NewsScan" <newsscan@newsscan.com>
Subject: Judge slams spammers with $1-billion judgment

A federal judge in Iowa has awarded a small ISP more than $1 billion in
damages in what's believed to be the largest judgment ever against
spammers. The case was brought by Robert Kramer, whose company provides
e-mail service to about 5,000 customers, and who filed suit after his
inbound mail servers were jammed with as many as 10 million spam-mails a day
in 2000. Citing federal racketeering laws (RICO) and the Iowa Ongoing
Criminal Conduct Act, U.S. District Judge Charles R. Wolle ordered AMP
Dollar Savings of Mesa, Ariz., to pay $720 million; Cash Link Systems of
Miami, Fla., $360 million; and TEI Marketing Group, also of Florida,
$140,000. "It's definitely a victory for all of us that open up our e-mail
and find lewd and malicious and fraudulent e-mail in our boxes every day,"
said Kramer, who is unlikely to ever collect on the judgments.  [AP/*Wall
Street Journal*, 20 Dec 2004; NewsScan Daily, 20 Dec 2004]
  http://online.wsj.com/article/0,,SB110349923676804327,00.html (sub req'd)

----- End forwarded message -----

(?) Toys of yesteryear

From Jimmy O'Regan

http://tv.cream.org/extras/toys/index.html
Hmm... Among the list, I remember I, or one of my siblings, had: Transformers, Buckaroo, Guess Who?, Walkie Talkies, Connect 4, Tomytronic 3D (I had Space Attack, my brother Joe had Racers), Viewmaster, Kerplunk, Vertibird, Downfall, Tonka trucks (everybody had those, didn't they?), A la carte Kitchen (that was my sister Angela, not me :), Stretch Armstrong, Mr. Frosty, Operation, Game and Watch (Donkey Kong!), Spirograph, Screwball Scramble, Subbuteo, "A computer" (my uncle had bought me a Spectrum just before he died, but someone nicked it) and "A bike".
I am a little annoyed that He-Man and Thundercats toys didn't make the list though. :)

(?) Not here

From Jimmy O'Regan

--- You are now known as jimregan_almost_here
<editorgal> 3lol
* editorgal passes jimmy some almost eggnog
<editorgal> and that was the last cup too
<okopnik> Hey, jimregan_almost_here! Are you still almost here, or are you gone?
<okopnik> Hmph. I guess you're jimregan_mostly_gone....
[jimregan_on_his_way_to_the_pub exceeded the nick limit]
--- You are now known as jimregan_hungover_again
(More proof, as if any were needed, that friends don't let friends drink and IRC).

(?) Christmas messages

From Jimmy O'Regan

<editorgal> Merry Xmas :D :D :D
<jimregan> Many happy returns
<jimregan> Heh
<jimregan> My phone has a "Send to Many" feature, so I tapped out a Merry Christmas message, and am sending it to everyone :)
<editorgal> hehe
<jimregan> And now I'm being inundated with messages :)
<editorgal> c/~ xmas bells are ring...ing :D
<jimregan> Heh
<jimregan> "Likewise and dont abuse the spirits having a Happy New Year" - my friend Martin
<jimregan> "Tink i'll just send a generic text 2 all of baahumbug now and have done with it 2! I'm sure I'll c ya over the wkend anyway 4 xmas pints and all!" - Lorraine
<editorgal> *grin*
<jimregan> She's the only one who saw through my little scheme.
<jimregan> Heh. SMS spam.

(?) More Christmas messages

From Jimmy O'Regan

<jimregan> Heh. Marina's given me a nickname: "Senor Tequila"
<editorgal> haha
<jimregan> I sent her a slightly different message: last night while I was still sentient she got a message "Ooh! Somebody loves me", so I got her number and sent her a message saying "Someone else loves you too"
<editorgal> awwwww
<jimregan> So the message had a someone loves you in it, and she sent back "someone loves you too"
<jimregan> "Aw. I feel all warm and fuzzy inside"
<jimregan> "That'd be the Christmas spirit. I'm full of it"
<jimregan> "Yeah, that and every other spirit they'd sell you"
<editorgal> lol
<jimregan> Then my sister told me to give out to her for being drunk "Santa will be bringing you coal"
<jimregan> That's when she called me Senor Tequila.
<editorgal> I imagine a contest where they have parents write how their kid was the worst - without being hauled away to jail or child protective services - to win their heating bills covered for the winter.
<jimregan> heh
<editorgal> it's that rider that'd make the tales interesting
<jimregan> Heh. The exchange continues: "'Twas the night before Christmas and all through the house not a creature was stirring, except for Marina, who was getting plastered"
<jimregan> "No, I'm not stirring. I'm lying down 'cos I can't get up"
<editorgal> shaken not stirred?
<editorgal> some quote about not being really drunk unless you need to cling to the floor to hang on to the spinning planet
<jimregan> Actually, my friend Trev had his balance centres damaged two years ago, and went through that while sober
<editorgal> by which token I've never been drunk.
<editorgal> :(
<jimregan> "So you're getting a massive hangover for Christmas?"
<editorgal> did they heal, or is he on therapy or something now?
<jimregan> Oh, he's well healed.
<jimregan> He managed to pin it on the noise levels at work, so now ear protectors are mandatory in certain areas.
<jimregan> Not in mine, though they probably should be.
<editorgal> well at least something good came of it :/
<jimregan> I've noticed a drastic reduction in hearing range a few mornings
<jimregan> We were comparing our safety policies :)
<editorgal> I doubt anyone stops you from wearing extra earplugs
<jimregan> We reckon that between the two of us, we're responsible for every safety policy in the past few years
<editorgal> anyways it sounds like a just awful feeling :(
<jimregan> Heh. Marina's reply: "It's what I've wanted all year! I must be on Santa's nice list!"

(?) Clamscan finds HTML phishing scams...

From Brian Bilbrey

So that's probably not news. What amused me was this:

vimes:/tmp/quar# clamscan laundrette-108.txt
laundrette-108.txt: HTML.Phishing.Bank-1 FOUND

I expected to find some virii around, as I keep a few for testing purposes. But this startled me. Grin.

(!) [Jimmy] Not my fault! Someone else sent the spam, honest!

(?) Happy Days of Holly, y'all.

(!) [Jimmy] Nollaig Shona duit.
(!) [Sluggo] Please, don't call me Shona.
(!) [Jimmy] OK... Beannachtai na Nollag duit. :)

(?) Given that you replied to the list rather than just me, don't you mean Nollaig Shona Daoibh? Either way, Nollaig Mhaith Chugat.

(!) [Jimmy] Dang, caught. I couldn't remember whether it was 'daoibh' or 'dhaoibh' (which is silly, because it's the same for 'duit' vs. 'dhuit').
Sláinte agus beannachtaí dhaoibh go léir gach lá den bliain :)
Hmmm. Being of black Irish descent doesn't help me when the phrasing gets complex and Google's not nearly as much help this time. Um...:
"Greetings and blessings to you (plural) until (account/graphic/desc mmm?) (something) year (vintage).
(!) [Jimmy] "Good health and blessings to you all, each day of the year."
I think where you're getting 'greetings' is that the Irish for goodbye is 'slán' (actually, 'slán leat': may you be healthy).
'Beannachtaí' literally means 'blessings', but in common usage it's usually taken to mean 'be well'. (A Latin loan word, fact fans).

(?) Mmmm, I'd want to suggest something about a new year, except that it appears that new year would be either "an bhliain úr" or "an athbhliain".

(!) [Jimmy] 'Áth' is a word I can't translate off the top of my head. It means 'superior' or 'higher'. Town is 'baile', city is 'baile átha'. ('Baile' is also a Latin loan word, I think. It might not look it at first glance, because Irish has no direct 'v' sound, but the accusative form 'an bhaile' sounds too close to 'villa' to be a coincidence).

(?) But the implication that as a standalone word, "year" has the undertone of vintage I find least surprising. Grin. Altavista's Babelfish doesn't do Gaelic, I'd bet good sheckles that Arthur Dent's does, though. I mean, it translates Vogon poetry, doesn't it?

(!) [Jimmy] Heh. It wouldn't have helped out at the last Christmas party I was at. An old guy (with no teeth) decided to tell me a story, and I had to watch him closely to have any idea of what he was saying.

(?) Best of an extended Saturnalia to all here,

(!) [Jimmy] Erm... allow me to respond with 'Many happy returns'. Works well in all situations, I think.
(!) [Ben] Especially the day after New Year's, when you go trooping back to the store with the embarassing tie you got from Aunt Emily...
Happy holidays - Sol Invictus, Xmas, Hanukkah, Beginning of The Fellowship's Quest, Weihnachtstag, or whatever your favorite flavor of celebration happens to be - to everyone. Best wishes, and may the coming year bring you health, joy, and love in plenty.

(?) Thanks, Ben. And to you and everyone.

(!) [Heather] Merrrrrrrrrrrrrry Sir Isaac Newton's birthday, in honor of which xsnow falls downward :D

(?) Spam jokes

From Jimmy O'Regan

O'Leary showed up at Mass one Sunday and the priest almost fell down when he saw him. O'Leary had never been seen in church in his life. After Mass, the priest caught O'Leary and said "O'Leary, I am so glad you decided to come to Mass, what made you come?" O'Leary said, "I got to be honest with you Father, a while back, I misplaced my hat and I really, really love that hat. I know that Shaunassy had one just like mine and I knew that Shaunassy came to church every Sunday. I also knew that Shaunassy had to take off his hat during Mass, and I figured he would leave it in the back of church. So, I was going to leave after Communion and steal Shaunassy's hat." The priest said, "Well, O'Leary, I notice that you didn't steal Shaunassy's hat. What changed your mind?" O'Leary said "Well, after I heard your sermon on the 10 commandments, I decided that I didn't need to steal Shaunassy's hat." The priest gave O'Leary a big smile and said "After I talked about Thou Shalt Not Steal, you decided you would rather do without your hat than burn in Hell, right?" O'Leary shook his head and said "No, Father, after you talked about Thou Shalt Not Commit Adultery, I remembered where I left my hat!"
Three Lutheran ministers are having dinner at a restaurant when the Archangel Gabrial approaches and points to one of them. "I HAVE A GIFT FOR YOU," the angel says. "BUT YOU MUST CHOOSE: INFINITE WISDOM OR A MILLION DOLLARS?" Being amongst Lutheran ministers, the man chooses wisdom, and Gabrial dissapears in a puff. "So?" one of the ministers asks with awe in his voice, "what do you know now that you didn't know before?" He answers: "I should have taken the money."
A man, while playing on the front nine of a complicated golf course, became confused as to where he was on the course. Looking around, he saw a lady playing ahead of him. He walked up to her, explained his confusion and asked her if she knew what hole he was playing. "I'm on the 7th hole," she replied, "and you are a hole behind me. So you must be on the 6th hole." He thanked her and went back to his golf. On the back nine, the same thing happened and he approached her again with the same request. "I'm on number 14, and you're still a hole behind, so you must be on the 13th hole." Once again he thanked her and returned to his play. He finished his round and went to the clubhouse where he saw the same lady sitting at the end of the bar. He asked the bartender if he knew the lady. The bartender said that she was a sales lady and played the course often. He approached her and said, "Let me buy you a drink in appreciation for your help. I understand that you're in the sales profession. I'm in sales also. What do you sell?" "I'll tell you, but you're going to laugh," she replied. "No, I won't." "Well, if you must know," she answered, "I work for Tampax." With that, he laughed so hard he almost fell off the bar stool. "See," she said. "I knew you'd laugh!" "That's not what I'm laughing at," he replied, "I'm a salesman for Preparation H, so I'm still a hole behind you."

(?) Christmas links

From Jimmy O'Regan

From Slashdot (http://slashdot.org/article.pl?sid=04/12/24/1847259&tid=105)
Norad Santa tracker: http://www.noradsanta.org
The Physics of Santa: http://www.physorg.com/news2487.html

(?) Free Beer

From Martin Pagh Goodwin

Hi TAG'sters
I guess as an extension to the theme regarding our favorite drinks, this danish initiative for an open source beer could be interesting - free as in free beer?
http://www.voresoel.dk
I have yet to taste it, I would think it was sold out at the release event.

(?) Python conferences in the US and Europe

From Jimmy O'Regan

(I only noticed this during mail processing, and really should have razzed Sluggo earlier for this, but hey! I'll just send the link to TAG when LG comes out)
Sluggo wrote:

> [Sending to the Seattle Python group and the Linux Gazette Answer Gang.
> Replies may be published in Linux Gazette (linuxgazette.com).
                                                         ^^^^
I can't say anything. You know your mistake. I'll just set up the stocks, shall I?


This page edited and maintained by the "Editors" (if you can call this editing) of Linux Gazette
Copyright © its authors, 2005
Published in issue 110 of Linux Gazette January 2005
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/
(and beaten beyond recognition by Jimmy)

Published in Issue 110 of Linux Gazette, January 2005

Tux