Re: [SLUG] Help Me - C codes

2005-11-28 Thread telford
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, Nov 28, 2005 at 05:53:24AM +1100, Tess Snider wrote:

> What's totally crazy is that once you've been programming a while, and
> really understand this recursion stuff well, you have to then learn to
> stop using it.  It's very sad, because recursion is good stuff, but
> the trouble is that, in C, arbitrarily large recursions make your
> stack the size of Godzilla.  This is because every time you make a
> function call, it has to temporarily tuck away all of the local
> information in the last scope out of the way onto the stack, so it can
> go back and retrieve it later, when the function is done.  So, as you
> dive down into your recursion, your stack gets bigger and bigger.  You
> can visualize this by putting a large number into the factorial
> function, and then putting a breakpoint down at your boundary
> condition, and looking at the stack trace in the debugger of your
> choice.  Holy cow!

The stack will grow linearly with the number but the integer will
overflow much sooner than your stack does.

I've NEVER liked the use of factorial as an example of recursion in
books on programming because it is such a bad example that can obviously
be much better implemented iteratively and worse, (perhaps not obviously)
multiplying up integers is a terrible way to calculate factorials (not
much better than doing division by repeated subtraction).

- --
#include 

extern double tgamma( double );
double fact( double x ) { return( tgamma( x + 1 )); }


#include 

int main()
{
int i;

for( i = 0; i < 50; i++ )
{
printf( "fact( %d ) = %g\n", i, fact( i ));
}
}
- --

Recursion only gets useful when dealing with tree structures and in
that case ALL languages will grow their stack (because they need to
store the intermediate values). In such a situation the recursive
solution will be much easier to write and usually more efficient to
execute than the non-recursive solution. Certainly it will be 
easier to debug because the stack contents are easy to inspect.

Try writing a qsort() without recursion...

- Tel

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iQIVAwUBQ4rn+MfOVl0KFTApAQLT/w/+KxAxByWByNRrysFZG8o0FpLObCZp4B/g
S3aQ/5Q/39jTK491NEjwisag4Bv2/M6VRGy5efYAc//j/9Tp6VXyQpQ+8MFQ5D+9
xk9R9njKp12h67zHIPva7jQV5A05Crt/i3c5FATHpPVVRTTEaABl+5r4VlINpKtE
AmxKxg+DmjIOQMAgsymtDP0WwAam9fegYWPJds/2e2GLWO3outbvtA9qerXJZ2gJ
BSTrzI2Y8tdsvLgfzQrl4T/2+uvKBD6E/ezNvMcF1TKeBtFE7nrpU70qIoTPIXEe
mBMKuXqk8yi6A0IbqU+384wQNbeQ8znlWPxwFWy9AyvNWLiNul45ovvvnTD1iWYK
u5xdpceVB+MgBr3qSEib1T3UP6ACtA+TsWWcMA52z5DzDGEx8dyRCVk3bxQQgb9P
DQlu6jk3Hj0loAfmxR43M+fU5CIePfFK/iYLgNoCKY1+a3GD2nAu2s0DzS24D5Ad
Rqfiyfr5+T/+y6btPauKIfNyt3mhKq1/HJDFwzdmiGnPzt2mvoccaXKhZ5Tc5q+S
R0xtLohHJ8uOAEWgCUi8P+3YFgWTWX3/IIJRsMqV38ILzJKl629mhaQpEHL3YMcg
0vayNrwZcj6SqUki5h/GmzzV+mdKrQevyfg/wDj/qRqCULrAaRYmQkJ3/OEnKKS7
f5TxnDWV65Q=
=NEdk
-END PGP SIGNATURE-
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Remote site Upgrade of FC

2005-11-28 Thread David Gillies
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Howard Lowndes wrote:
> Has anyone got any good pointers to howtos for remote site distro
> upgrades, esp FC.

I followed this guide to do an update from rh9 -> fc1 -> fc2 -> fc3.

http://www.brandonhutchinson.com/Upgrading_Red_Hat_Linux_with_yum.html

It took a little bit more forced removal and upgrading of some rpms
(most of the problematic rpms came from the atrpms repository though)
than is mentioned in the guide.

When I attempted fc3 -> fc4 though, yum just wouldn't work (would sit
there forever attempting to work out dependancies). So I opted for apt
instead and it went through well once I removed all packages from atrpms.

Also, one thing to look out for it moving from fc1 -> fc2 is that you
have to do some special upgrading to take into account of upgrading from
lvm1 to lvm2.

- --
dave.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDiuj9hPPdWeHRgaoRAvl7AJ0cR8GCBHXHB8okfrUCVnG19YuiWwCghFT7
srGrFgBDOACEit3f9c9VSQs=
=50De
-END PGP SIGNATURE-
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Help Me - C codes

2005-11-28 Thread Tess Snider
On 11/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Try writing a qsort() without recursion...

I think I once had to do that in my algorithms class, when the earth
was without form and void, and darkness hovered over the face of the
deep. ;)

Tess
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: ocaml vs python/ruby/perl etc. was [SLUG] Why not C

2005-11-28 Thread Raphael Kraus
Ok, I know I shouldn't bite - but I just have to...

> Read the note on usage again.
> Here it is in terms geeks will grok:
> "less" is used for continuous quantities,
> "fewer" is used for discrete quantities
> 
> less water, fewer drops.
> less population, fewer people.
> less traffic, fewer cars.

less water != fewer drops

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Audio, Video & Arts Miniconf at LCA

2005-11-28 Thread Silvia.Pfeiffer
Call for Participation

The Linux Digital Arts Mini-Conf @ LCA2006 
(http://halo.gen.nz/lca2006/index.html) 
will be held before linux.conf.au, Australia's national Linux conference,
in January 2006 at the University of Otago in Dunedin, New Zealand.

If you would like to present a technical session, please mail a brief
abstract (100-300 words) to [EMAIL PROTECTED] by 
 Monday, December 19th 2005.

In keeping with the developer focus of linux.conf.au, this mini-conf
will allow Linux audio, video and arts developers to meet and share
ideas, and also to discuss audio/video-related issues with the
developers of the kernel, networking and desktop systems. For all
users, this will be a great way to see and hear the variety of tools
available.  Suggested topic areas include:

 * Linux for Digital Audio Workstations and musical instruments
 * Video for Linux
 * low latency and reliable audio in the Linux kernel and userspace
 * Networked & distributed audio-visual applications on Linux
 * systems for connecting music, processing and control hardware
 * core Linux audio subsystems: Jack, ALSA, LADSPA, etc.
 * Linux media frameworks: gstreamer, vlc, xine, etc.
 * software synthesis and sequencing applications
 * recording, editing and mastering applications
 * audio & video file formats and codecs
 * streaming and network services for audio and video
 * telephony and speech technologies
 * multicast video conferencing on Linux
 * usability of music and audio applications
 * audio & video on Linux devices, e.g. mobile phones, set-top box, IPTV
 * audio/video podcasting on Linux
 * video editing on Linux
 * Linux Radio applications
 * Uses of non-standard I/O, e.g. mechanical control, blinkenlights
 * Linux games

Presentations must relate to Free and open source software and/or open
standards.


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] xserver

2005-11-28 Thread ashley maher
G'day,

Distro: Ubuntu Breezy amd64

I made the mistake of upgrading my kernel and the nvidia package a
couple of days ago using ubuntu packages.

>From the logs:

Script started on Tue 29 Nov 2005 10:23:49 EST
[EMAIL PROTECTED]:~$ more /var/log/gdbm/\:0.log



Error: API mismatch: the NVIDIA kernel module is version 1.0.7174, but
this X module is version 1.0.7667. Please be sure that your kernel
module and all NVIDIA driver files have the same driver version.



Script done on Tue 29 Nov 2005 10:24:37 EST


Hints on fixing this one greatfully received.

Regards,

Ashley

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Re: xserver

2005-11-28 Thread Matthew Palmer
On Tue, Nov 29, 2005 at 10:46:14AM +1100, ashley maher wrote:
> G'day,
> 
> Distro: Ubuntu Breezy amd64
> 
> I made the mistake of upgrading my kernel and the nvidia package a
> couple of days ago using ubuntu packages.
> 
> >From the logs:
> 
> Script started on Tue 29 Nov 2005 10:23:49 EST
> [EMAIL PROTECTED]:~$ more /var/log/gdbm/\:0.log
> 
> 
> 
> Error: API mismatch: the NVIDIA kernel module is version 1.0.7174, but
> this X module is version 1.0.7667. Please be sure that your kernel
> module and all NVIDIA driver files have the same driver version.

Smells like you upgraded the X driver without bumping the kernel module at
the same time.

- Matt

-- 
"I'm tempted to try Gentoo, but... I have better things to do with my CPU
cycles than to compile Python so that it can compile the compiler
so that it can compile the kernel."
-- Dave Brown, ASR


signature.asc
Description: Digital signature
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

[SLUG] vsftp chroot

2005-11-28 Thread tuxta2

Hi all,
I am currntly running vsftp and want to enable chroot for logins, so far 
I cant make it happen.
When I edit /etc/vsftpd/vsftpd.conf and add in (what I think are) the 
options then ftp doesn't work at all.

Anyone using this server and got vsftpd working in a chroot environment ?

Thanks in advance

Tuxta
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] [ot] Recursive web query to capture web database

2005-11-28 Thread Richard Hayes
Dear list,

I will like to use perl to write a web-based query to capture data from a 
government departments website.  

The site has tablular information similar to tax tables but only a small 
portion of the total data is shown  at any give query, I would like to 
capture the total.

Any suggestions 
   
-- 
Richard Hayes
Nada Marketing
PO Box 12 Gordon Australia 2072
Tel: +(61-2) 9412 4367 Fax: +(61-2) 9412 4920 Mob: +(61) 0414 618 425
www.nada.com.au 
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] vsftp chroot

2005-11-28 Thread Jamie Wilkinson
This one time, at band camp, tuxta2 wrote:
>Hi all,
>I am currntly running vsftp and want to enable chroot for logins, so far 
>I cant make it happen.
>When I edit /etc/vsftpd/vsftpd.conf and add in (what I think are) the 
>options then ftp doesn't work at all.

What do you think are the options?

>Anyone using this server and got vsftpd working in a chroot environment ?

I have it running with chroot_local_user set.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] [ot] Recursive web query to capture web database

2005-11-28 Thread Raphael Kraus
G'day Richard,

> I will like to use perl to write a web-based query to capture data 
> from a 
> government departments website.  
> 
> The site has tablular information similar to tax tables but only a small 
> portion of the total data is shown  at any give query, I would like to 
> capture the total.
> 
> Any suggestions 
> 

WWW::Mechanize :)

Raphael

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html