[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]

More 2¢ Tips!


Send Linux Tips and Tricks to linux-questions-only@ssc.com


Spam comments

4 Jul 2002 15:52:02 -0400
Karl Vogel (vogelke from dnaco.net)
This is in reply to the LG issue 80 TAG blurb.

In LG 80, Heather was rumored to have said:

Almost the only spam that escapes Dan's traps anymore are those dratted conman scams telling me about how their late uncle / business partner / revered general or whatever left them a quadzillion dollars / francs or whatever and they can't get at any of it unless you as a friend / distant relative / confidant / conveniently uninvolved sucker open your bank account to help them launder it.

Do you use "ifile"? That nails just about all the spam I get, including those stupid laundering schemes. The best part is that it gets smarter with time; the more spam you feed it, the better it weeds out crap.

Source:
http://www.ai.mit.edu/~jrennie/ifile

Mailing list:
http://groups.yahoo.com/group/ifile-discuss

Some tips plus a nice procmail setup and ifile database:
http://www2.picante.com:81/~gtaylor/spam

My .procmailrc is below.

-- Karl Vogel

See attached vogel.procmailrc.txt


Playing CD Music Digital Output

Tue, 2 Jul 2002 11:17:04 -0400 (VET)
Ernesto Hernandez-Novich (emhn from telcel.net.ve)
This is in reply to the LG issue 79, help wanted #2.

Hi,

Regarding Bill Parks question on the June issue, as to how to play CD audio without the analog cable usually connecting CD-ROMs to audio cards, a similar situation happens if you have one of the latest iBooks. There is no way to tweak the sound driver to do what he wants, but XMMS can be of help. He should try using the "CD Audio Player" Input Plugin (select it via Preferences -> Audio I/O Plugins) and configure it accordingly, say have /dev/hdc (the "real" CD-ROM device, not /dev/cdrom which is usually a symlink) and /cdrom. Then, put the audio CD, and open a "Playlist" in XMMS but instead of selecting a File, select the /cdrom directory; he'll see the audio tracks there and be able to play and listen to them.

That's right, the system will be doing CDDA extraction from the CD into XMMS, which then plays it through OSS/ESD/ARTS. Ugly, but works.


Ernesto Hernández-Novich
GPG Key Fingerprint = 438C 49A2 A8C7 E7D7 1500 C507 96D6 A3D6 2F4C 85E3


Getchar and loops...

Mon, 8 Jul 2002 08:34:35 -0500 (CDT)
Jay R. Ashworth, Pradeep (the LG Answer Gang)
Question by Zaikxtox (zaikxtox@yahoo.com)

Hello. I'm trying to write a very simple C program that needs to attend the user input without blocking a loop. I have porgrammed many time on pascal, and there the code will be something like:

begin
  while not keypressed
    writeln('hello! i'm still alive');
end.

well... when i use C code i try the getchar function, but it waits until a key is pressed blocking the program.

How can i know if there is a key into the buffer without blocking the execution of my programs?

Thanks in advance :) Zaikxtox

[jra] Well, you can, but it's not exactly trivial, and how you do it depends on which environment you're coding: raw-C for the glass-tty, curses/termcap, X, KDE, Gnome, etc.
This is more generic C stuff than Linux stuff; I'd recommend you look into books like The Unix Programming Environment, by (I think) Kernighan and Pike, and the Stevens books.
[pradeep] As the other poster mentioned, it depends on where you want this behaviour. Assuming that you want to do this on a console, ncurses is a great library to use. It gives you the right abstraction.
Read my howto at
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO
Particularly the function halfdelay() should help you for non-blocking key input.


epoch

Sun, 30 Jun 2002 02:22:29 -0700
Heather Stern (Linux Gazette Technical Editor)

Recently one of the gang mentioned renaming an rpm file to a much higher version number before running alien, so that the Debian package system would not want to overwrite the result.

The key to doing that "the right way" is a value that the Debian maintaineers call the epoch.

Of course people are used to seeing package versions like 1.2 or even 1.4.3p1.

In the Debian world that might be 1.4.3p1-2 meaning that this is the second time the Debian maintainer had to build the same version. Probably he or she has patches in it.

But to handle programs whose version numbers don't go constantly up like time goes forward ... a certain typesetting package comes to mind ...

Must have been some other package. According to its FAQ, TeX's version number asymptotically approaches pi, growing digits along the way. -- Heather

... they invented an epoch. epochs start at the invisible "1" and go up to 99.

So a version:


99:1.4.3p1-local

Would be 98 epochs ahead of a mere:


1.4.3p1-12

and the same number of epochs ahead of:


2.1.12-1

If you want your package and the Debian one to live together in harmony, then rename yours to something before the version number that does not overlap:


mtools4flash-3.9.7-1fp
mtools-3.9.7-2

Of course that's safest if the files inside their file list don't overlap either!

That was the problem, of course; the filesets were exactly the same. -- Ben

Using either of these methods is safer than setting a hold on the package, which is sometimes recommended, but which I've seen fail before.


crypt undefined

Tue, 2 Jul 2002 16:48:03 +0200
Chris Niekel (chris from niekel.net)
This is in reply to the LG issue 80, 2c Tips #8.

g++ -lcrypt server.c Error: 'crypt' undefined

The order of the arguments matter. You should try:


g++ server.c -lcrypt

The linker links from left to right and is a bit dumb. After compiling server.c, the crypt call is undefined. Then libcrypt.a is tried, and crypt is defined in there. So it will be resolved.

In your case, libcrypt.a doesn't match any undefined symbols (YET!), so it is not linked into the executable. Then server.o is linked, and that has an unresolved symbol (crypt). The linker isn't smart enough to go back to libcrypt.a.

The answerer of the questions talks about the name mangling. If you mix C and C++ code, you have to tell the compiler what is C. That is usually done by doing:


extern "C" void foo(int);

This tells the compiler that function foo takes an int, returns nothing and is a C function. But all standard libraries already do that for you, so it's very safe to call crypt() from C++ code.

Greetings,

Chris Niekel


diald

Mon, 15 Jul 2002 14:07:38 -0400
LF11 (lf11 from naisp.net)
This is in reply to the LG issue 80, 2c Tips #10.

I've mainly been connecting to the internet using diald, but I've noticed that I'm only getting about 3.5 KBps , whereas on W98 I get about 5KBps. A little experimentation shows that dialling with kppp gives about 5KBps as well.

kppp seems to use an initialisation string of ATM1L1, but changing MODEM_INIT to "ATM1L1" in /etc/diald/connect, didn't improve the performance.

MODEM_INIT started out as "ATZ&C1&D2%C0". I changed "%C0" to "%C3" to ensure that compression was enabled, but this made no difference. I can't find an option in diald to log exactly what's sent to the modem and I can't see any conflicting options in the configuration for pppd.

Any suggestions for how to track down why kppp gets better performance than diald would be appreciated.

The modem is an MRI 56K internal modem.

Check the port speeds. It's likely that diald is using a port speed of 28.8KBps or 56KBps. Try to have something well above the actual speed of the modem, as the data coming from the modem may be substantially higher in volume than the actual modem's capability (due to hardware compression).

The only exception to this is with a USR 56k Faxmodem I have when used with WvDial; it must be at 56k, and I don't know why. If the computer port speed is set higher than that, what comes across the line from the modem seems to be escaped characters of some sort, along the lines of


CONNECT 49333/ARQ
f [18] f [18] `[1e]~[1e]~[1e][06][1e]x[1e][18]x

And pppd says "LCP timeout sending Config-Requests" in syslog. Just thought I'd let you know about this problem in case you have it.

HTH, -cj

[Neil] Beware, it doesn't read /etc/diald/diald.conf. According to the man page "diald reads options first from /etc/diald/diald.defs, then from /etc/diald/diald.options".
Putting speed 115200 in diald.options gave me a throughput 4.9KBps downloading Mozilla 1.1 alpha.


Killing GUI applications under KDE

04 Jul 2002 08:17:43 +0530
Ashwin N (ashwin_n from gmx.net)

Here's a quick way of killing a GUI application that has hung or is not quitting (or you just want to kill for fun :-). Press Ctrl-Alt-Esc and your mouse pointer turns into skull-and-bones. Now, click on the offending application to kill it. This works only under KDE.

Of course, "xkill" command does the same thing, but this is much easier and faster to use.

Ashwin

[Ben] Good tip, Ashwin! Under IceWM, I have "xkill" tied to "Alt-Ctrl-K" for the same functionality:
(from "~/.icewm/keys")

key "Alt+Ctrl+k" /usr/bin/X11/xkill


GRUB - Window XP can not load

Fri, 28 Jun 2002 16:43:08 +0100
Neil Youngman (n.youngman from ntlworld.com)
Question by Soufian Widjaja (orion982@yahoo.com)

I find some info online that we can overwrite the boot loader and then install boot loader for Window by run fdisk / MBR on Windows If this is the way, how can I do that? What to do with my Linux once we overwrite the MBR?

I think what's needed is to experiment with the GRUB command line mode. When the menu comes up press 'c' to go to command line mode and try a few variations on the command sequence you've got in /boot/grub/menu.last When you come up with a command sequence that works, then edit your GRUB config to match.

2 things to try are:

1 After the rootnoverify command add the command makeactive. 2 Try varying the partition numbers in the rootnoverify command.

There's lots of handy info in Linux Journal #85, see
http://www.linuxjournal.com/article.php?sid=4622

Hope That Helps


Kylix

Wed, 3 Jul 2002 20:04:57 GMT
Chirag Wazir (wazir from vsnl.com)
Question by Octavio Aguilar (oam@mail.cosett.com.bo)
This is in reply to the LG issue 80, Help Wanted #1.

Does anybody know how to run a program that's compiled in Kylix, but without having the Kylix environment around at runtime?

If you want to run a compiled Kylix program outside the IDE you need to run


source /usr/local/kylix2/bin/kylixpath

first, or add it to your /etc/profile

I had the same problem initially - so I presume that's what the question is about - my Spanish is non-existent.

The alternative interpretation could be about making a distribution package to run on machines where Kyilx isn't installed - I haven't tried that yet.

Chirag Wazir


use an .rpm without installing it

Sat, 6 Jul 2002 13:40:26 -0500 (COT)
RE Otta (obob from qwest.net)
Previous Tip by Ashwin M (ashwin_n@gmx.net)
This is in reply to the LG issue 80, 2c Tip #18.

It is simpler to use Midnight Commander. Click on the rpm file like you would a directory and transverse the rpm as you would a branch of the directory tree. Locate the file or files and copy them to an actual directory with the copy button. Simple and effective!

[John Karns] I've found that some mc versions changed the rpm handling behavior. I had grown quite accustomed to viewing rpm contents and copying parts via mc, then after installing SuSE 7.1 on my laptop, was no longer able to view more than a partial list of the files in the rpm; specifically the rpm headers (description, etc.). I was able to correct the problem finding the mc scripts used for rpm handling, and changing one to agree with a previous mc version script.
One other point is that for very large rpm files (over 2 or 3 MB), the process can be very slow. When dealing with rpm files containing large tar balls of source code, I usually just "install" the rpm, which copies the desired file to /usr/src/packages/SOURCES.


Linux Journal Weekly News Notes tech tips


Watching multiple log files at once

Recent versions of the GNU tail command let you tail multiple files with the same command. Combined with the -f option, you can watch multiple log files. For example:


tail -f /var/log/httpd/access_log /var/log/httpd/error_log

will monitor the Apache access and error logs.



Switching to Maildir format mailboxes

If you're moving from old-style mailboxes to Maildir directories for your mail, you can force Mutt to create Maildir directories by default with:


:set mbox_type=Maildir

in your .muttrc file.

To get Procmail to deliver to directories as Maildir and not MH folders, put a / after the directory name in your recipes, like this:


# Dump mail from Microsoft viruses into a trash Maildir
:0 Bf
* Content-Type: application/octet-stream;
trash/


Running screen-oriented programs directly

To run a screen-based program such as top remotely with one ssh command, use the -t (terminal) option to ssh, like this:


ssh -t myserver top


Your running processes

For an easy-to-understand, compact view of what's running on your system now, try the pstree command. A handy option is -u, which shows the name of the user running each process. Option -p shows the process ID, so if you want to memorize only one option combination, try:


pstree -pu

(No pun intended.)

pstree is a good way to make sure that privilege separation is working in your upgraded ssh install--you did upgrade sshd, didn't you?


This page edited and maintained by the Editors of Linux Gazette Copyright © 2002
Published in issue 81 of Linux Gazette August 2002
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]