Spam comments

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.

Playing CD Music Digital Output

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.

Getchar and loops...

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.

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

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".

Killing GUI applications under KDE

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

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.

use an .rpm without installing it

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:

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?