...making Linux just a little more fun!


This month's answers created by:

[ Sayantini Ghosh, Amit Kumar Saha, Ben Okopnik, Kapil Hari Paranjape, Karl-Heinz Herrmann, René Pfeiffer, Minh Van Nguyen, Neil Youngman, Paul Sephton, Rick Moen, Suramya Tomar, Thomas Adam ]
...and you, our readers!

2-Cent Tips

2 cent tip: juxtapose image and text in LaTeX

Minh Nguyen [nguyenminh2 at gmail.com]

Mon, 8 Oct 2007 10:05:37 +1000

Greetings LG readers,

When using LaTeX, there are times when you might want to place an image and a short paragraph side by side. Here's an illustration of what I'm referring to:

   |image goes here      | short paragraph     |
   |                     | goes here           |
   |                     |                     |
   |                     |                     |
   |                     |                     |
   |                     |                     |
   |                     |                     |
   |                     |                     |
In that case, try using the minipage environment. The following snippet of LaTeX macro can be used to implement the above illustration:

   \end{minipage} \qquad\qquad
   A short paragraph of text goes here.
Play around with the various options to get your desired effect.

Regards Minh Van Nguyen

2 cent tip: boot Slackware 12.0 using grub

Minh Nguyen [nguyenminh2 at gmail.com]

Mon, 8 Oct 2007 09:58:55 +1000

Greetings LG readers,

The default boot loader in Slackware is LILO. On some platforms, such as the IBM ThinkPad R40, my experience is that LILO can take quite some time before it boots Slackware 12.0. You can add the option "compact" to your /etc/lilo.conf to speed up the process, but this is not guaranteed to work on all platforms. An alternative is to use the GRUB boot loader.

If you boot Slackware 12.0 with GNU GRUB 0.97, you might see the following boot message on your screen:


> Testing root filesystem
> * ERROR: Root partition has already been mounted read-write. Cannot check!
> For filesystem checking to work properly, your system must initially mount
> the root partition as read only. Please modify your kernel with 'rdev' so that
> it does this. If you're booting with LILO, add a line:
>    read-only
> to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it.
> If you boot from a kernel on a floppy disk, put it in the drive and type:
>    rdev -R /dev/fd0 1
> If you boot from a bootdisk, or with Loadlin, you can add the 'ro' flag.
> This will fix the problem AND eliminate this annoying message. :^)
> Press ENTER to continue.

The boot process hangs until you actually press the ENTER button on your keyboard. To get rid of this boot message and the pause, try the GRUB boot option "ro", or add this option to your /boot/grub/menu.lst. For example, here is a snippet of my /boot/grub/menu.lst:


> # Booting Linux distribution Slackware 12.0
> title Slackware 12.0
>     root (hd0,2)
>     kernel /boot/vmlinuz root=/dev/hda3 vga=0x31a resume=/dev/hda2 splash=verbose showopts ro

Regards Minh Van Nguyen

2 Cent tip: Finding your Kernel using Grub

Martin J Hooper [martinjh at blueyonder.co.uk]

Mon, 08 Oct 2007 15:16:39 +0100

If you have done something such as adding a new partition that changes all your partition numbers so that grub can't find the right kernel do this at a grub prompt:

find <kernel>

Grub will then spit out the fully qualified path to the kernel in question and allow you to edit your menu.lst to suit.

[ Thread continues here (5 messages/4.99kB) ]

Our Mailbag

article "A Question Of Rounding" in issue #143

Ben Okopnik [ben at linuxgazette.net]

Wed, 3 Oct 2007 07:36:22 -0500

On Wed, Oct 03, 2007 at 12:36:53PM +0200, Pierre Habouzit wrote:

>   Hi,
>   I would like to report that the article "A Question Of Rounding" in
> your issue #143 is completely misleading, because its author doesn't
> understand how floating point works. Hence you published an article that
> is particularly wrong.

Thanks for your opinion; I've forwarded your response to the author.

>   I'm sorry, but this article is very wrong, and give false informations
> on a matter that isn't very well understood by many programmers, hence I
> beg you to remove this article, for the sake of the teacher that already
> have to fight against enough preconceived ideas about ieee 754 numbers
> already.

Sorry, that's not in the cards - but we'll be happy to publish your email in the next Mailbag.

I understood, even before I approved the article for publication, that a lot of people had rather strong feelings and opinions on this issue; i.e., the author getting flamed when he tried to file a bug report on this was a bit of a clue. Those opinions, however, don't make him wrong: whatever other evils can be ascribed to Micr0s0ft, their approach to IEEE-754 agrees with his - and is used by the majority of programmers in the world. That's not a guarantee that they (or he) are right - but it certainly implies that his argument stands on firm ground and has merit.

You are, of course, welcome to write an article that presents your viewpoint. If it meets our requirements and guidelines (http://linuxgazette.net/faq/author.html), I'd be happy to publish it.

* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

[ Thread continues here (36 messages/102.86kB) ]

rsync not working when trying to update LG mirror

Suramya Tomar [security at suramya.com]

Wed, 03 Oct 2007 22:33:18 +0530

Hey everyone, I maintain a mirror for LG at my site and recently it was brought to my attention that the mirror had gone out of date. I had the update script set up as a cron job so didn't monitor it. But apparently it has been failing with the following errors:

u38576182:~/public_html/suramya.com/linux/gazette > ./sync_mirror.sh rsync: failed to connect to linuxgazette.net: Connection refused rsync error: error in socket IO (code 10) at clientserver.c(97) rsync: failed to connect to linuxgazette.net: Connection refused rsync error: error in socket IO (code 10) at clientserver.c(97)

The sync script contains the following code:

u38576182:~/public_html/suramya.com/linux/gazette > cat sync_mirror.sh RSYNC_RSH=/usr/bin/ssh export RSYNC_RSH rsync -avz --exclude /ftpfiles/ linuxgazette.net::lg-all www_root rsync -avz linuxgazette.net::lg-ftp ftpfiles

This only happens on this one particular system. When I try it on my local system it runs without issues. Any idea why the lingazette.net is rejecting the rsync connection? If I try to ssh to linuxgazette.net from the server I get a password prompt.

This server has rsync version 2.5.6cvs protocol version 26 installed. Its a shared hosting account so I don't have root access on the server.

Any help would be appreciated

Thanks, Suramya

Name : Suramya Tomar
Homepage URL: http://www.suramya.com

[ Thread continues here (16 messages/21.87kB) ]

480% CPU?

Neil Youngman [ny at youngman.org.uk]

Mon, 22 Oct 2007 13:07:52 +0100

Would anyone care to hazard a guess why top is claiming that the top 3 process are between them using 480% CPU on a dual core box?


[ Thread continues here (6 messages/5.22kB) ]

problem with usb support

nishith datta [nkdiitd2002 at yahoo.com]

Sat, 20 Oct 2007 11:59:07 -0700 (PDT)


I got a hp pavillion dv1000 series laptop and it's loaded with Redhat

I am unable to get the usb support working on it.

I checked out the lsmod and it shows the uhci and ohci drivers inserted.

I however donot see any hid driver or usbcore module. I did a slocate on my system but didnot find them either. I definitely chose to have these supports when compiling my kernel.

What am I doing wrong ?


[ Thread continues here (2 messages/1.70kB) ]

using smp kernel, get 100% cpu usage one one cpu without any real load on the system

jim ruxton [cinetron at passport.ca]

Mon, 08 Oct 2007 14:21:21 -0400

Hi I'm on a P4 running an smp kernel ie.

uname -a : Linux jims-laptop 2.6.20-16-386 #2 Sun Sep 23 19:47:10 UTC 2007 i686 GNU/Linux

For some reason occasionaly one of my cpu's runs away and starts showing 100% cpu usage, however top only shows the program using the most cpu at 7% or less. Where is that 93% going? This is driving me crazy. I have to reboot the machine to get it back to normal. I've tried Fedora and Kubuntu. Though Kubuntu appeared more stable it still happened. Played around with changing max_cstate without success.I've just downgraded to a 386 kernel to see if that helps. This isn't a real solution however. Do you have any suggestions? I've asked around on forums and irc channels without luck. Thanks. Jim

output of cat /proc/cpuinfo :

processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Pentium(R) 4 CPU 3.06GHz
stepping : 9
cpu MHz : 3059.352
cache size : 512 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr
bogomips : 6123.68
clflush size : 64

[ Thread continues here (13 messages/29.23kB) ]


Terry T [timburwa at gmail.com]

Mon, 8 Oct 2007 09:16:18 +0200

Hie I am new UNIX.I want to copy 30 files with different names using the following command.

ftp -i -s:filename > logfilename.log

The command works well.

My problem is to type the same command 30 times for each file name. How do I transfer all the 30 files at the same time?

[ Thread continues here (7 messages/6.50kB) ]

A couple of Perl questions...

Jimmy ORegan [joregan at gmail.com]

Tue, 9 Oct 2007 19:20:41 +0100

I have a couple of scripts that almost work, and I was wondering if anyone (Ben? :) could tell me why...

First, I want to convert a list of tags in the IPA PAN's corpus format (subst:pl:dat:f) to Apertium's tag format (n.f.pl.dat). I have this:

use warnings;
use strict;
# tags to replace
my %terms = qw(n nt pri p1 sec p2 ter p3 subst n);
while (<>)
	my @in = split/:/;
	my @out = map { ($terms{$_} ne "") ? $terms{$_} : $_ } @in;
	if ($#out > 3) {
		my $type = $out[3];
		$out[3] = $out[2];
		$out[2] = $out[1];
		$out[1] = $type;
	print join '.', @out;

That's broken, because it only works for tag sets which have more than 4 entries, but changing the if to "($#out >= 3)" gives me this: ".sg.nomxxs.m3" from "xxs:sg:nom:m3". I also get a lot of warnings:

Use of uninitialized value in string ne at foo.pl line 11, <> line 1085.
Use of uninitialized value in string ne at foo.pl line 11, <> line 1086.

Next, I have a list of names extracted from a Polish morphology dictionary[1] that I'm trying to convert to a list of word stems and endings. I have this, which works (aside from a couple of errors):

use warnings;
use strict;
use String::Diff qw/diff_fully/;
use Data::Dumper;
	my $endings = $_;
	my @a = split/, /;
	my $stem = find_stem(@a);
	$endings =~ s/$stem//g;
	print $stem;
	if ($endings =~ /?/) {print ":n.f:";}
	elsif ($endings =~ /owie/) {print ":n.m1:";}
	else {print ":n.??:";}
	print $endings . "\n";
sub test()
	my $test = "Adam, Adama, Adaemie, Adamowi, Adamem, Adamach, Adamami, Adamom";
	my @t = split/, /, $test;
	print find_stem(@t);
	print "\n";
sub find_stem()
	my @in = @_;
	my ($r, $l, $cur, $last);
	my $i=0;
	while ($i<($#in))
		($r, $l) = diff_fully($in[$i], $in[$i+1]);
		$cur = $r->[0]->[1];
		$last = $cur if (!$last);
		if ($cur ne $last) {
			($r, $l) = diff_fully($last, $cur);
			$last = $r->[0]->[1];
	return $last;

but if I change the end of the while() to this:

	else {print ":n.??:";}
	my @ends = split/, /, $endings;
	$endings = join(',', at ends);
	print $endings . "\n";

to sort the endings, it... doesn't. What am I missing?

[1] "S?ownik alternatywny", under the GPL: http://www.kurnik.pl/slownik/odmiany/

[ Thread continues here (5 messages/16.04kB) ]

Please help me :(...

Lin, Hong [hlin at devry.edu]

Mon, 29 Oct 2007 18:09:11 -0500


I have a wired problem and I hope I can get some help in your place.

I received a "Forbidden / You don't have permission to access /~user/index.html on this server." Error while I try to display my web page.

The OP is Fedora 7 Apache is 2.2.6

Permissions of all directories and files are set to rwxr-xr-x leading from /home all the way to the files inside public_html.

I have modified the httpd.conf file to make sure it looks for the /~user/public_html directory.

I did not touch any other file or area. If I "killall httpd" and run /usr/sbin/httpd, then the index.html under the /~user/public_html displays. That means that it seems worked for my purpose.

However, after I run "/etc/init.d/httpd restart", it displayed stopping httpd [ok] starting httpd [ok], but I will not be able to see my index.html file under the /~user/public_html

The system index.html (the testing page) always worked.

The wired thing is after I taking out all the #lines within the /etc/init.d/httpd file, I can use "/etc/init.d/httpd restart" to make it work.

However, when the machine reboots, it does not work again. I have tried to put "/etc/init.d/httpd restart" at end of the rc.local to force the web serve stop and start at the boot. The server will stop and then start, but it does not display my web page.

I have also tried to put "/etc/init.d/httpd stop" and "/usr/sbin/httpd" at end of rc.local. It does not display my web either.

The S85httpd is linked with .../init.d/httpd

I have tried with "/usr/sbin/apachectl start", it does not work either manually or inside the rc.local

Here is the summary:

Manually /usr/sbin/httpd worked (after I killed all the httpd process)

Manually /etc/init.d/httpd worked (only after I took out all the #lines, and I don't know why it matters)

Apachectl never worked.

The machine boot up does not work.

May you help me?

Thanks in advance.


[ Thread continues here (5 messages/11.51kB) ]

Copyright & Copyleft

Ramanathan Muthaiah [rus.cahimb at gmail.com]

Wed, 3 Oct 2007 00:05:16 +0530

Just wondering, why all the GNU/Linux man pages refer to copyright only and do not have no reference / brief statement regd "copyleft".

Quicky browsing through the "http://www.gnu.org/copyleft/copyleft.html", I did understand that this concept of copyleft is incorporated by applying copyright and then adding terms of distribution.

To quote from the above URL,

"To copyleft a program, we first state that it is copyrighted; then we add distribution terms, which are a legal instrument that gives everyone the rights to use, modify, and redistribute the program's code or any program derived from it but only if the distribution terms are unchanged . . . "

Any thoughts ?


[ Thread continues here (3 messages/3.03kB) ]

Thoughts on "Mercurial"

Amit Kumar Saha [amitsaha.in at gmail.com]

Sun, 28 Oct 2007 12:09:51 +0530

Hi all!

I am working on an article titled "Distributed Version Control with Mercurial".

Basically, I am a newbie to Mercurial, so the article will be a result of learning, and putting it in a simple, as-i-did-it way.

1. Now, I would like to know thoughts, experiences on Mercurial from those of you who have already used it.

2. If you have made the switch from CVS/SVN to mercurial, then why did you do it?

3. Automated tools you use to facilitate CVS/SVN repos to Mercurial.

All comments, insights are welcome.

Thanks, Amit

Amit Kumar Saha
*NetBeans Community Docs
Contribution Coordinator*
me blogs@ http://amitksaha.blogspot.com

Version control for /etc

Kapil Hari Paranjape [kapil at imsc.res.in]

Fri, 26 Oct 2007 08:53:02 +0530


I was looking at version control mechanisms to handle /etc on the machines here. If people on TAG have used such systems I would appreciate feedback.

CVS: seems to be the classic solution. Cons: People say it is old and unmaintained code which is "end-of-life".

Mercurial: One of the modern VC systems considered "notable" on Rick Moen's knowledge base. One difficulty with "hg" is that it insists on the "distributed" model. Putting the version control history outside /etc (a la CVS) would require convoluted mounts.

GIT: Another modern VC system (though not "notable" as per Rick's kb). It is rather similar to Mercurial in many ways. One difference is that one can use the environment variable GIT_DIR to point to a different directory for storing VC history.

Some reasons to keep VC history outside /etc: 1. This way one can easily check for "cruft" without adding an explicit "ignore" for ".hg" or ".git" ... 2. Uses less space in "/etc". 3. Can keep the history on an "archival" disk safe from potential corruption.

Any thoughts/suggestions by people on TAG are welcome as usual!


Kapil. --

[ Thread continues here (15 messages/30.26kB) ]

Question on how to block a ssh host from being used as a Socks proxy

Suramya Tomar [security at suramya.com]

Fri, 19 Oct 2007 04:21:16 +0530

Hey Everyone, I have been using a SOCKs proxy via SSH (using port tunneling [1]) to browse the net from unsecure locations and it works great.

However I have noticed that when I connect to certain hosts I am unable to use the connection as a SOCKS proxy and I was wondering how these hosts were configured to do this. It seems like a good feature to have on servers that I configure. Are there any disadvantages to this setup that I am missing?

I have tried looking for a solution online but I guess I am not asking the right questions because I didn't find anything useful. So any idea's/suggestions on what/where to look?

Thanks in advance.

- Suramya

[1] To set up a SOCKS proxy using SSH from a windows system follow these steps:

Open PuTTY. You should be greeted with a configuration screen. First, you will enter the hostname or IP address of the SSH server. Type in a name for your connection settings in the box below ?Saved Sessions?, and click the Save button.

Now you need to look at the tree of options to the left; expand the SSH tree, and select ?Tunnels?. Enter 4567 (or any port number above 1024) in the Source Port area, and click the Dynamic radio button to select it. Leave the Destination field blank, and click ?Add?.

Now go back to the Session tree (very top of the left section), and save again. You will be prompted to enter a username, which is the username of your shell account. Type that in, hit enter, and then type in your password when it prompts you.

In your browser change the proxy setting to localhost and the port you used earlier and you can browse the net safely.

Name : Suramya Tomar
Homepage URL: http://www.suramya.com

[ Thread continues here (6 messages/9.88kB) ]

Apertium: an open source machine translation system

Jimmy ORegan [joregan at gmail.com]

Mon, 8 Oct 2007 17:05:38 +0100

On 30/09/2007, Jimmy O'Regan <joregan at gmail.com> wrote:

> Apertium (http://xixona.dlsi.ua.es/apertium-www/) is an open source
> machine translation system.


> Polish is still[1] my main language of interest, and I'm working on a
> configuration for the morphological analyzer.

The start of my Polish-English module was added to SVN today (http://apertium.svn.sourceforge.net/viewvc/apertium/apertium-en-pl/) and can be tested here: http://xixona.dlsi.ua.es/testing/index.php

It's nothing more than a tiny inflecting dictionary at the moment, but I'm working on it :)

Talkback: Discuss this article with The Answer Gang

Copyright © 2007, . 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 144 of Linux Gazette, November 2007