...making Linux just a little more fun!

<-- prev | next -->

More 2 Cent Tips!

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

2-cent-tip: Monospaced fonts on gmail

Jason Creighton (the LG Answer Gang)

Hey, Well, thanks to a handful of different bloggers and Firefox hackers, I now can read my email on gmail in a monospaced font, the way it's supposed to be.

Grab URLid from http://extensionroom.mozdev.org/more-info/uriid

Stick this in your userContent.css:

body#mail-google-com .mb, textarea.tb {
        font-family: monospace !important;
        font-size: 12px !important;

And it Just Works(TM). Of course, since I know next to nothing about CSS, what I've done is basically a copy and paste of the tip given at http://blog.perldude.de/archives/2005/03/29/gmail-fixed-font except I changed "body#gmail-google-com" to "body#mail-google-com" because the former wasn't working for me, and I added the font-size bit. (Copied from some other page because otherwise I wouldn't know which CSS element to use.)

[Peter Knaggs] If you have the findutils package installed, this might help to find the right directory to put userContent.css:
locate userContent-example.css
For me, userContent.css seems to be happiest in the same directory as userContent-example.css, which is: $HOME/.mozilla/firefox/*.default/chrome/
Thanks for the tip!

[Peter is going to get another copy of this as I sent without first confirming that TAG was getting a copy. Funny thing, it's an email about how easy webmail is. And it is, if you can remember to click "Reply to all"]

Regarding editing your UserContent.css file, I've found ChromEdit to be helpful: http://cdn.mozdev.org/chromedit

I'm actually doing this stuff on a Windows box, but it involves gvim, so I hope we can count it as Linux-related. (I wish I was using Linux, so maybe that counts for something.)

There is a Window-only extension that allows you to edit text forms in an external editor:


Same thing, tinyurl'd:


Install it, go Tools > Extensions, select ExternalEditor, click Options, and changed the editor to gvim. Or whatever you want. (Or, if you like pain, you could leave it as notepad.) Then right click on a text form and select "edit". Only thing that annoys me is that Firefox freezes, so to look something up while composing an email, you have to save/quit, look it up, then open the editor again. Oh well, it beats trying to make properly quoted emails in a web browser text form.

(!) [Jimmy] Check out the Launderette for more Google fun

Another 2 cent tip for you

Lew Pitcher (lpitcher at sympatico.ca)

Hi, guys.

Here's a little tip I gathered from some conversation going on in the alt.os.linux newsgroup a couple of months ago. I contacted the people involved in the news thread and they all agreed that I could submit the conclusions of the thread as a Two Cent Tip (with proper accreditation, of course). So, thanks to Michael Heiming and Chris F. A. Johnson, here's a Two Cent Tip for you...

Over in news:alt.os.linux, a reader posted a question that asked how to make Linux use "file associations" (sort of like MSWindows) so that the user just types the name of the data file at the commandline, and the sutiable application starts up and processes it. The example was wanting xmms to play an MP3 just by typing the MP3's filename at the command prompt.

This lead into a discussion amongst various alt.os.linux participants, primarily Michael Heiming and Chris F.A. Johnson, about "binfmt_misc", and how it could be used to satisfy MSWindow'ish "file associations". For those who don't know, you can "register" a command interpreter through a /proc entry, so that, when you try to run a file that needs that command interpreter, the system will start up the program for you. This is how Linux recognizes executable shell scripts in order to start the shell interpreter on them, and how it recognizes executable java byte code, in order to run the java interpreter on it, when you type it's name at the command prompt.

To use this feature, you need to mount the "binfmt_misc" pseudo-filesystem, so as root,

  mount -t binfmt_misc none /proc/sys/fs/binfmt_misc

(or add the appropriate line to your /etc/fstab, and have it mounted automatically at the next boot). Now, (again, as root) tell Linux what interpreter to use by "echo"ing an association string into the /proc/sys/fs/binfmt_misc/register pseudo-file. In this case, we want to the string to indicate that any 'executable' file with the 'extension' of .mp3 is to be interpreted by /usr/bin/xmms, so the registration strings are

  echo ":xmms:E::mp3::/usr/bin/xmms:" > /proc/sys/fs/binfmt_misc/register
  echo ":mps:E::mp3::/usr/bin/xmms:" >/proc/sys/fs/binfmt_misc/register
  echo ":ogg:E::ogg::/usr/bin/xmms:" >/proc/sys/fs/binfmt_misc/register
  echo ":m3u::E:m3u::/usr/bin/xmms:" >/proc/sys/fs/binfmt_misc/register

Now, when we (as a regular user)

  ~ $ chmod u+x my_life_changed.mp3

and then

  ~ $ my_life_changed.mp3

up pops XMMS and the music plays on.

The format and variations of the "registration" string are documented in /usr/src/linux/Documentation/binfmt_misc.txt.

Kewl, eh?

My thanks to Michael Heiming and Chris F. A. Johnson for pointing out
how to do this.

Two cent tip: ISO 8601 dates

Rick Moen (LG Contributing Editor)
On wondering if his tip was lost entirely. We don't always publish tips in the same month that we get them. -- Heather

No, they've always been sent to tag@...

(!) [Heather] Strictly speaking, 2c tips began as good bits from people who weren't the Answer Guy. They tended to be, but weren't always, short, and were handled by the editor - I only did the TAG column. After some point I got involved with formatting tips as well, and then they were effectively merged with The Answer Guy's stuff, short items being put towards Two Cent Tips. With the advent of the Answer Gang, I actively encourage people wherever I run into them - send in your good tips :)
The confusion seems to have arisen from my header on the 2c tips column being too plain. sigh

Someone looking for the right submission address might (as I did) follow the link from http://linuxgazette.net to the Author FAQ, which says to mail article submissions to articles@linuxgazette.net and news items to bytes@linuxgazette.net. If we want the uninitiated to use the desired submission address for 2 cent tips without having to ask here first, it probably would be prudent to amend the Author FAQ, nicht wahr?

[Thomas] You might as well add it. No harm in doing so.
[Ben] It'll make it easier for authors who want to submit tips.

Anyway, this duplicates my June 18 post to "articles@linuxgazette.net":

One feature of the GNU coreutils' "date" program that's indispensible in creating date-stamped filenames: "date --iso-8601" returns the current date in international date standard (ISO 8601) format. E.g., on June 17, 2005, "date --iso-8601" returns "2005-06-17".

Why is this so handy, you ask? First of all, ISO 8601 dates sort correctly in ASCII- or alphabetical-ordered listings, unlike any number of other popular date formats such as 06/17/2005 (United States), 17-JUN-2005 (NATO), or the Commonwealth format I grew up using (17/06/2005).

Second, like NATO format, it's unambiguous to people everywhere, a virtue I would have appreciated when I switched from the British school system to the USA's (and thus, suddenly, all written dates before the thirteenth of each month were indeterminate).

I use the technique frequently when archiving file trees, as follows:

$ tar czf /tmp/etc-$(date --iso-8601).tar.gz /etc

It should be noted that ISO 8601's format has long been traditional in Chinese culture. It's always good to have a quarter of humanity on one's side for starters.

There are elaborations to the standard, that are somewhat less immediately applicable to computing, e.g., time of day would be written in the obvious 24-hour hh:mm:ss or hhmmss formats. One can append a "Z" suffix if such time-stamps are in zero-meridian ("Zulu", aka UTC) time. Otherwise, times are impliedly local.

Unfortunately, the International Organisation for Standardisation (ISO) do not have a freely downloadable copy of the ISO 8601 standard, but independent authors Gary Houston, Steve Adams, and Jukka Korpela have written pages that may be of interest to the more devoted calendar freaks (including code snippets for some common programming languages):

"Giga Unzipping"

Peter Knaggs (peter.knaggs at gmail.com)

Unzipping large files on linux

Thanks to Thomas Stromberg for first describing this increasingly essential tool: p7zip


Many Microsoft users these days are using PKZip 4.50 to archive such things as VMware machines, and we need to be able to extract such archives on linux, which is where p7zip comes in:

p7zip can extract zip files which contain archived files larger than 4 gigabytes.

You'll know you need it if you see a "skipping:" warning containing the following message from the regular linux unzip:

   need PK compat. v4.5 (can do v2.1)

The following is a WiKi page with a similar description, and some details on building p7zip and basic usage:


(!) [Jimmy] If you want to compress large files, you could also try out rzip, which is specifically designed for huge files.

a GTK based editor

J.Bakshi (hizibizi at spymac.com)
Answered By Adam Engel, Jimmy O'Regan, Raj Shekhar


I am looking for a GTK based programme editor (for c/c++/perl/python/shell-script) which is fast as well as enriched with features. in my debian sarge there are a no. of different editors. I have found beaver, scite etc. which are based on GTK and demand having good features. as I have experience working with kate only so I really don't have any idea about these editors. could users of these editors kindly share their working experience so that I can pick one (fast+feature rich) among these ?

[Adam] I'm not familiar with sarge -- I run SuSE 9.x -- but I'm sure you must have Vim, which is my favorite, but demands some study, and Xemacs, which can basically be used like a GUI word-processor, except for a few commands. Does your system offer Nedit? It'a a great WYSIWIG type editor that can be used for programming like VIM or Emacs/XEmacs. I don't think any of these are GTK based, but why does that matter?
[Jimmy] You can have both with Gtk: both XEmacs and Emacs can be compiled with Gtk (IIRC, the Gtk interface is standard in the newest version of Gnu Emacs); Vim fans can use gvim.
[Raj] I personally use Emacs - but if you are looking for GTK based app - I can suggest Anjuta. For debugging, ddd presents a nice gui to gdb

thanks Raj, aptitude intends to install majority of GNOME package with anjuta (my window manager is icewm). that's why I have skipped anjuta and using scite.

Verifying CD's

Eric Pretorious (eric from pretorious.net)
Answered By Jim Dennis

Hi, Jim:

Mind if I ask you a quick question? How can I verify that the .iso that I burned to CD was written correctly? `md5sum /dev/cdrom` doesn't seem to be working.

[JimD] I think you may be having "padding" problems. Read the following to understand what's happening and how to work around it with the isoinfo and dd commands:
Hope that helps.
I'm copying Heather on this and, with your permission, I'd like to have her include it in the 2-cent Tips column or Answer Guy in the next issue of the Linux Gazette (http://www.linuxgazette.net). (Your e-mail address, and optionally all other identifying info regarding you, would be stripped before publication).
Just for a quick hack I re-implemented the script that he used can called "rawread"

See attached isoread.sh.txt

... that can be published given that Steve Litt's copyright on the Troubleshooters.com website would not allow it to be copied freely.
Besides those one demonstrates a novel use of the eval command for exporting variable value pairs out of a command substitution sub-process back into our script (obviating the need to clobber our positional variables, run the isoinfo command twice, or fuss with nastier parsing of the isoinfo output).
There is, apparently, a readcd binary command that also comes with the CDR Tools package (which is where isoinfo comes from, at least on my Debian system).
Perhaps readcd does the same thing as this script. Perhaps it does it even better.

rxvt configuration for font

J.Bakshi (hizibizi from spymac.com)
Answered By Thomas Adam


as rxvt is very fast and small I am using this. I have configured it like:

rxvt -cr green -pr red -bd red -name "This rxvt is modified by J.Bakshi" -sr -cursorColor2 red -scrollColor white -troughColor black

now rxvt has become very pleasant - ;)) but the font is very small and is very difficult to read. how can I set the font size and how can I get a different font ?

please let me know. thanks for your time.

[Thomas] By using the "-fn" option to rxvt, or adding:
rxvt*font: -foo-courier-foo-120-*-*-*
(use 'xlsfonts' for a proper font-string.)
to your ~/.Xdefaults or ~/.Xresources file (same difference), and running:
xrdb -merge ~/.Xdefaults
Or by just invoking rxvt, and pressing shift and "+" on your numeric keypad.
Or you could have read the man page for rxvt. Or seen the FAQ on it.

Hurray !!! now I have a rxvt with font style too. Thanks. I have come to know about xlsfonts from this mail - ;) is there any tool which can also show the preview of the font style ? once again thanks for the solution

[Thomas] "xfontsel", "gtkfontsel", etc.

this one is not working in my machine

[Thomas] It does here. But it's also a configurable resource that rxvt responds to.

hello linux gurus

radhakrishanan rajamohan (admin.rajamohan at gmail.com)
Answered By Thomas Adam

hi there, as i am much interested in setting up a squid proxy in my internet cafe (due to bandwidth cost)i do like to have some questions to be answered , here are those i cant able to solve. 1.did configured squid and allowed my client lan browsable via 3128 port but the thing is i can able to access webcam and voice mail !.i came to know that if u masquade the port 3128 to 8080 i can be achived but i cant able to write the rule , let me know how to write a firewall rule.

[Thomas] I assume you mean IPTables? You could try something like this:
# Allow forwarding.
echo "1" > /proc/sys/net/ipv4/ip_forward

# Forward from port 3128 -> 800
80 -j DNAT --to $DNAT_IP_PORT
$IPTABLES -A FORWARD -p tcp -i $INET_IFACE -d $INET_IP --dport 3128 -j
You'd have to change things, of course.

2.even though i configured my proxy i cant save bandwith , i have a doubt that do my lan requests are cached by my porxy.how to check that ?, if no what i have to do ,let me know the key configuration in squid for that ?

[Thomas] There's a cache_mem_limit as well as different cache_* options that you can set. Have a look at /etc/squid/squid.conf -- it is the best commented config file I have ever seen and used.

OO Calc and VBA

Jimmy O'Regan (the LG Answer Gang)

A question I've seen come up with some regularity in other Linux magazines goes a little like this: "is it possible to use my VB macros in OpenOffice", with the usual half-right answer: "No, Star Basic isn't quite the same as VBA" (correct) "but it's close enough that rewriting the macros should be easy" (not quite -- that's a bit like saying that Windows applications should be easy to port to KDE because both are written in C++).

Sun have a (quite long) HOWTO that covers porting Excel macros to Calc:

The good news for would-be converts is that Novell are working on adding Excel compatibility to OO Calc:

There's also an XPCOM to UNO gateway, so Mozilla developers can use OOo and vice versa. -- Jimmy

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/


Copyright © 2005, . 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 118 of Linux Gazette, September 2005

<-- prev | next -->