[31003] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2248 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 4 00:09:46 2009

Date: Tue, 3 Mar 2009 21:09:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 3 Mar 2009     Volume: 11 Number: 2248

Today's topics:
        finding modules via @INC sysdrk@wowway.com
    Re: finding modules via @INC <noreply@gunnar.cc>
    Re: finding modules via @INC <ben@morrow.me.uk>
    Re: Net::SSH2 scp_put not working! <whynot@pozharski.name>
    Re: Perl 5.8.8 or 5.8.9 install <glex_no-spam@qwest-spam-no.invalid>
    Re: Perl 5.8.8 or 5.8.9 install <ben@morrow.me.uk>
    Re: system not returning  correct return code. <xhoster@gmail.com>
    Re: system not returning correct return code. <whynot@pozharski.name>
    Re: What-if algorithm  <xhoster@gmail.com>
    Re: What-if algorithm <gamo@telecable.es>
    Re: What-if algorithm <hjp-usenet2@hjp.at>
    Re: What-if algorithm <gamo@telecable.es>
    Re: What-if algorithm sln@netherlands.com
    Re: What-if algorithm sln@netherlands.com
    Re: What-if algorithm sln@netherlands.com
    Re: What-if algorithm <jurgenex@hotmail.com>
    Re: Why the same script have different behavior when ex <whynot@pozharski.name>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 3 Mar 2009 17:07:56 -0800 (PST)
From: sysdrk@wowway.com
Subject: finding modules via @INC
Message-Id: <c987f327-7fcf-4930-9584-ccc8713562d3@p2g2000prf.googlegroups.com>

I'm trying to use an XML pretty printer called xmlpretty on UNIX that
I downloaded from the net.  xmlpretty is a simple perl program that
uses a module called YAWriter.pm that came with the package.  So
xmlpretty has:

use XML::Handler::YAWriter;

However, with xmlpretty and YAWriter.pm in the same directory and
running xmlpretty from this directory, perl complains it can't find
YAWriter.pm:

$ export PERL5LIB=`pwd`
$ xmlpretty
Can't locate XML/Handler/YAWriter.pm in @INC (@INC contains: /home/
kertz/xml/XML
-Handler-YAWriter-0.23 /usr/perl5/5.00503/sun4-solaris /usr/
perl5/5.00503 /usr/p
erl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at
xmlpretty line 4.
BEGIN failed--compilation aborted at xmlpretty line 4.

Note that @INC is set to the current directory twice - first with the
PERL5LIB and the default addition of the current directory (.) to this
search path.

However, if I run the xmlpretty directly with the perl command and use
the -l option to specify the current directory, it works (and fails if
I leave the -l option off):

$ perl -l `pwd` xmlpretty
$

Can anyone tell me what I need to do to be able to run xmlpretty
directly and have it find the YAWriter.pm module that is in the same
directory?

Here is my perl version:
This is perl, version 5.005_03 built for sun4-solaris

Denis


------------------------------

Date: Wed, 04 Mar 2009 02:25:47 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: finding modules via @INC
Message-Id: <7163hdFja1jbU1@mid.individual.net>

sysdrk@wowway.com wrote:
> I'm trying to use an XML pretty printer called xmlpretty on UNIX that
> I downloaded from the net.  xmlpretty is a simple perl program that
> uses a module called YAWriter.pm that came with the package.  So
> xmlpretty has:
> 
> use XML::Handler::YAWriter;
> 
> However, with xmlpretty and YAWriter.pm in the same directory and
> running xmlpretty from this directory, perl complains it can't find
> YAWriter.pm:
> 
> $ export PERL5LIB=`pwd`
> $ xmlpretty
> Can't locate XML/Handler/YAWriter.pm in @INC (@INC contains: /home/
> kertz/xml/XML
> -Handler-YAWriter-0.23 /usr/perl5/5.00503/sun4-solaris /usr/
> perl5/5.00503 /usr/p
> erl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at
> xmlpretty line 4.
> BEGIN failed--compilation aborted at xmlpretty line 4.
> 
> Note that @INC is set to the current directory twice - first with the
> PERL5LIB and the default addition of the current directory (.) to this
> search path.
> 
> However, if I run the xmlpretty directly with the perl command and use
> the -l option to specify the current directory, it works (and fails if
> I leave the -l option off):
> 
> $ perl -l `pwd` xmlpretty
> $
> 
> Can anyone tell me what I need to do to be able to run xmlpretty
> directly and have it find the YAWriter.pm module that is in the same
> directory?

It's a module, and not supposed to be placed in the same directory as 
the script. The best you can do is to install XML::Handler::YAWriter 
properly, e.g. using CPAN.pm.

Another option is to create a directory XML in 
/usr/perl5/site_perl/5.005, then create a subdirectory Handler in the 
XML directory and place YAWriter.pm there. Then you should have:

     /usr/perl5/site_perl/5.005/XML/Handler/YAWriter.pm

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Wed, 4 Mar 2009 02:19:02 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: finding modules via @INC
Message-Id: <m15186-8e9.ln1@osiris.mauzo.dyndns.org>


Quoth sysdrk@wowway.com:
> I'm trying to use an XML pretty printer called xmlpretty on UNIX that
> I downloaded from the net.  xmlpretty is a simple perl program that
> uses a module called YAWriter.pm that came with the package.  So
> xmlpretty has:
> 
> use XML::Handler::YAWriter;
> 
> However, with xmlpretty and YAWriter.pm in the same directory and
> running xmlpretty from this directory, perl complains it can't find
> YAWriter.pm:
> 
> $ export PERL5LIB=`pwd`
> $ xmlpretty
> Can't locate XML/Handler/YAWriter.pm in @INC (@INC contains: /home/
> kertz/xml/XML
> -Handler-YAWriter-0.23 /usr/perl5/5.00503/sun4-solaris /usr/
> perl5/5.00503 /usr/p
> erl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at
> xmlpretty line 4.
> BEGIN failed--compilation aborted at xmlpretty line 4.

Read the error message. It's looking for a file XML/Handler/YAWriter.pm
under one of the directories listed, so create a directory XML/Handler
in the current directory and put YAWriter.pm in there.

Note that Gunnar is right that since this is apparently a CPAN module it
would be better to install it properly. If you can't (or don't want to)
install into the system perl directories, you can use something like

    perl Makefile.PL INSTALL_BASE=~
    make test
    make install

to install it in bin/ and lib/ directories under your home directory.
You will need to set PERL5LIB=~/lib/perl5 and PATH=~/bin.

> However, if I run the xmlpretty directly with the perl command and use
> the -l option to specify the current directory, it works (and fails if
> I leave the -l option off):
> 
> $ perl -l `pwd` xmlpretty
> $

I don't know what makes you think -l 'specifies the current directory'.
-l does something quite different and I would be very surprised if it
affected your problem. Did you perhaps mean -I?

> Here is my perl version:
> This is perl, version 5.005_03 built for sun4-solaris

This is a seriously old version of perl. It was released nearly 10 years
ago, and relatively little CPAN software will be tested with it. You
should really see if you can get a newer version installed: it's
perfectly possible to do this without replacing the system perl, as that
would usually be a bad idea.

Ben



------------------------------

Date: Tue, 03 Mar 2009 23:46:20 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: Net::SSH2 scp_put not working!
Message-Id: <slrngqr99f.1a4.whynot@orphan.zombinet>

On 2009-03-03, Ben Morrow <ben@morrow.me.uk> wrote:
>
> Quoth Krishna Chaitanya <schaitan@gmail.com>:
[ OP missed attribution ]
*SKIP*
>> > If your connection is fast enough that you can always guarantee to get a
>> > new character within 250ms of the last, you can set ->blocking(0) around
>> > all <> calls and it will stop hanging.
>> 
>> Sorry for being thick...can I verify this 250ms thing by checking
>> response time from a ping? Or is there another way for me?
>
> I don't think you can verify it at all. All you can really do is try
> using readline when the network is loaded and see if it starts missing
> lines.

Or shape your network.  That goes beyond the scope of c.l.p.m. though.

*CUT*
-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


------------------------------

Date: Tue, 03 Mar 2009 18:04:08 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Perl 5.8.8 or 5.8.9 install
Message-Id: <49adc579$0$89394$815e3792@news.qwest.net>

Dana wrote:
>> I see, can you copy and paste that portion in a reply?  Did you verify
>> that it didn't suffer any errors before that stage of the build?  I
>> assume it's an error while running make?
> 
> here is the output of the make test
> 
> lib/ExtUtils/t/Constant...................
> Stop.
> FAILED at test 3
> 
> lib/ExtUtils/t/PL_FILES...................#   Failed test in ../lib/
> ExtUtils/t/PL_FILES.t at line 38.
> #          got: '256'
> #     expected: '0'
> # Makefile out-of-date with respect to Makefile.PL
[...]

There seems to be a lot of posts complaining about
this, for HPUX.  Reading through a few of them seemed
to boil down to the options used for Configure, which
compiler is used, or possibly which file system
is used.

Read through the readme.HPUX, and/or search for
that error and you should find many suggestions.
I didn't see one that said "do XYZ and it'll fix
all of your problems."


------------------------------

Date: Wed, 4 Mar 2009 00:36:52 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Perl 5.8.8 or 5.8.9 install
Message-Id: <42v086-ri8.ln1@osiris.mauzo.dyndns.org>


Quoth Dana <dana.fernandez@gmail.com>:
> > I see, can you copy and paste that portion in a reply?  Did you verify
> > that it didn't suffer any errors before that stage of the build?  I
> > assume it's an error while running make?
> 
> here is the output of the make test
> 
> lib/ExtUtils/t/Constant...................
> Stop.
> FAILED at test 3
> 
> lib/ExtUtils/t/PL_FILES...................#   Failed test in ../lib/
> ExtUtils/t/PL_FILES.t at line 38.
> #          got: '256'
> #     expected: '0'
> # Makefile out-of-date with respect to Makefile.PL

Are your files by any chance from the future? That is, have you somehow
managed to get your clock out of sync so that the datestamp on the files
extracted from the archive is newer than that on a newly created file?
If any of this is over NFS (or some other network filesystem), check
your clocks are in sync.

Otherwise, you may want to take this to perl5-porters@perl.org, the
people responsible for maintaining perl itself.

Ben



------------------------------

Date: Tue, 03 Mar 2009 18:54:17 -0800
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: system not returning  correct return code.
Message-Id: <49adf251$0$30624$ed362ca5@nr5-q3a.newsreader.com>

omi wrote:
> Please see following snip of the code:
> 
> $SIG{CHLD} = 'IGNORE';
> 
> my $ret1 = `ls jjsjds`;
> my $ret = $?;
> 
> 
> If we see the value of return code, that is not correctly set.
> and this problem is coming because of the "$SIG{CHLD} = 'IGNORE';"
> flag is set.
> we if remove that everything is working fine, but that is requirement
> of the code, since we are using this code with perl socket server
> code, which should not have to create "defunct" processes.
> 
> Please suggest solution on this, where both setting a flag and getting
> output with system can hold in the code.

I'd probably make it double fork when it does the (non-backtick) forks, 
so zombies are cleaned up by the OS.

Or you could put a { local $SIG{CHLD}; .... } around the backticks, then
use waitpid with the no wait option to clean up anything that exited in 
the mean time.

Xho


------------------------------

Date: Wed, 04 Mar 2009 00:02:15 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: system not returning correct return code.
Message-Id: <slrngqra7a.1a4.whynot@orphan.zombinet>

On 2009-03-03, Ben Morrow <ben@morrow.me.uk> wrote:
>
> Quoth omi <oakulkarni@gmail.com>:
>> On Mar 3, 9:14 pm, omi <oakulka...@gmail.com> wrote:
>> > Please see following snip of the code:
>> >
>> > $SIG{CHLD} = 'IGNORE';
>> >
>> > my $ret1 = `ls jjsjds`;
>> > my $ret = $?;
>> >
>> > If we see the value of return code, that is not correctly set.
>> > and this problem is coming because of the "$SIG{CHLD} = 'IGNORE';"
>> > flag is set.
>
> Yes. From the $? entry in perldoc perlvar:
>
>    If you have installed a signal handler for "SIGCHLD", the value
>    of $? will usually be wrong outside that handler.
>
> On systems that honour "IGNORE" for SIGCHLD, it counts as a signal
> handler. So don't do that.

I would like that quote to be verified.  Look, right now I have a big
deal of coding (testing mostly) about childs, pipes, etc.  While
experimenting I've set C<$SIG{CHLD} = sub { warn $? }>.  And I was
surprised to see C<0> as the inside value.  I<$?> is set, and has proper
value, but only after B<waitpid>.  Wouldn't like some kind perlist with
deeper insight comment on this?

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


------------------------------

Date: Tue, 03 Mar 2009 19:01:36 -0800
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: What-if algorithm 
Message-Id: <49adf252$0$30624$ed362ca5@nr5-q3a.newsreader.com>

gamo wrote:
> 
> In excel you have a menu function that consist of given one 
> cell input and one cell output no matter how are related one
> to other, you could search for the input that correspond to 
> a given value of the output.

You should probably tell us what that "menu function" is called.
It sounds like either "goal seek" or the add-in "solver".  You want some 
kind of numeric solver or function minimizer.  There are all kinds of 
them out there, simplex, Levenberg Marquidt, steepest descent, Newtons 
method, conjugate gradient, etc. that have different areas of expertise. 
  You can find several in "Numerical Recipes in C", for example.  I 
haven't seen CPAN implementations of these in Perl that I liked.

Xho


------------------------------

Date: Wed, 4 Mar 2009 00:38:14 +0100
From: gamo <gamo@telecable.es>
Subject: Re: What-if algorithm
Message-Id: <alpine.LNX.2.00.0903040027420.3729@jvz.es>

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-614481227-1236123496=:3729
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Tue, 3 Mar 2009, J=FCrgen Exner wrote:

> gamo <gamo@telecable.es> wrote:
> >
> >
> >In excel you have a menu function that consist of given one=20
> >cell input and one cell output no matter how are related one
> >to other, you could search for the input that correspond to=20
> >a given value of the output.
> >
> >That is, if I set $input and have a (complicated)=20
> >$output =3D f ( $input );=20
> >I can search in the reverse direction for a solution to=20
> >$output =3D XXX;=20
> >
> >Do you know the subyacent algorithm or module to cover this?
>=20
> Because in the general case it is impossible to create the reverse
> function f^-1 (it may not even exist) the only way is to enumerate and
> loop over all $input values and compare the results to the desired
> output value.=20
> And you can do that with a simple grep():
>=20
> =09@results =3D grep (f($_) =3D=3D XXX, @candidates);
>=20
> jue

Thanks, that's what I was asking. I agree that the problem could=20
be impossible. But there are methods better than random search=20
or brute force to generate the candidates. That sistematic search
is what I want to know.  =20

Best regards,


>=20
> jue
>=20

--=20
http://www.telecable.es/personales/gamo/
"Was it a car or a cat I saw?"
perl -E 'say 111_111_111**2;'
--8323328-614481227-1236123496=:3729--


------------------------------

Date: Wed, 4 Mar 2009 00:58:22 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: What-if algorithm
Message-Id: <slrngqrh0u.imf.hjp-usenet2@hrunkner.hjp.at>

On 2009-03-03 15:04, Jürgen Exner <jurgenex@hotmail.com> wrote:
> gamo <gamo@telecable.es> wrote:
>>In excel you have a menu function that consist of given one 
>>cell input and one cell output no matter how are related one
>>to other, you could search for the input that correspond to 
>>a given value of the output.
>>
>>That is, if I set $input and have a (complicated) 
>>$output = f ( $input ); 
>>I can search in the reverse direction for a solution to 
>>$output = XXX; 
>>
>>Do you know the subyacent algorithm or module to cover this?
>
> Because in the general case it is impossible to create the reverse
> function f^-1 (it may not even exist) the only way is to enumerate and
> loop over all $input values and compare the results to the desired
> output value. 
> And you can do that with a simple grep():
>
> 	@results = grep (f($_) == XXX, @candidates);

That may be a bit impractical if @candidates is the set of all floating
point numbers.

However, for differentiable functions you can use Newton's method
if you start with an estimate which is "close enough".

(I guess this is what Excel does)

	hp


------------------------------

Date: Wed, 4 Mar 2009 01:11:20 +0100
From: gamo <gamo@telecable.es>
Subject: Re: What-if algorithm
Message-Id: <alpine.LNX.2.00.0903040103060.3729@jvz.es>

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-1386879582-1236125480=:3729
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Wed, 4 Mar 2009, Peter J. Holzer wrote:

> On 2009-03-03 15:04, J=FCrgen Exner <jurgenex@hotmail.com> wrote:
> > gamo <gamo@telecable.es> wrote:
> >>In excel you have a menu function that consist of given one=20
> >>cell input and one cell output no matter how are related one
> >>to other, you could search for the input that correspond to=20
> >>a given value of the output.
> >>
> >>That is, if I set $input and have a (complicated)=20
> >>$output =3D f ( $input );=20
> >>I can search in the reverse direction for a solution to=20
> >>$output =3D XXX;=20
> >>
> >>Do you know the subyacent algorithm or module to cover this?
> >
> > Because in the general case it is impossible to create the reverse
> > function f^-1 (it may not even exist) the only way is to enumerate and
> > loop over all $input values and compare the results to the desired
> > output value.=20
> > And you can do that with a simple grep():
> >
> > =09@results =3D grep (f($_) =3D=3D XXX, @candidates);
>=20
> That may be a bit impractical if @candidates is the set of all floating
> point numbers.
>=20
> However, for differentiable functions you can use Newton's method
> if you start with an estimate which is "close enough".
>=20
> (I guess this is what Excel does)
>=20
> =09hp
>=20

I don't know. I see the work of=20

/*
 * goal-seek.c:  A generic root finder.
 *
 * Author:
 *   Morten Welinder (terra@gnome.org)
 *
 */

included in gnumeric-1.8.3 source.

But I'm unable to discern if root-finding methods are aplicable=20
to the generic case of non-continous, non-derivable functions.=20

Best regards,

--=20
http://www.telecable.es/personales/gamo/
"Was it a car or a cat I saw?"
perl -E 'say 111_111_111**2;'
--8323328-1386879582-1236125480=:3729--


------------------------------

Date: Wed, 04 Mar 2009 04:02:25 GMT
From: sln@netherlands.com
Subject: Re: What-if algorithm
Message-Id: <pkurq4ptekgfp7olkim6kd1uqrnbt0ete4@4ax.com>

On Wed, 4 Mar 2009 00:38:14 +0100, gamo <gamo@telecable.es> wrote:

>On Tue, 3 Mar 2009, Jürgen Exner wrote:
>
>> gamo <gamo@telecable.es> wrote:
>> >
>> >
>> >In excel you have a menu function that consist of given one 
>> >cell input and one cell output no matter how are related one
>> >to other, you could search for the input that correspond to 
>> >a given value of the output.
>> >
>> >That is, if I set $input and have a (complicated) 
>> >$output = f ( $input ); 
>> >I can search in the reverse direction for a solution to 
>> >$output = XXX; 
>> >
>> >Do you know the subyacent algorithm or module to cover this?
>> 
>> Because in the general case it is impossible to create the reverse
>> function f^-1 (it may not even exist) the only way is to enumerate and
>> loop over all $input values and compare the results to the desired
>> output value. 
>> And you can do that with a simple grep():
>> 
>> 	@results = grep (f($_) == XXX, @candidates);
>> 
>> jue
>
>Thanks, that's what I was asking. I agree that the problem could 
>be impossible. But there are methods better than random search 
>or brute force to generate the candidates. That sistematic search
>is what I want to know.   
>
>Best regards,
>
>

Linear equations can be solved directly

y = x - 1;
x = y + 1

Single term polynomial's can be solved directly

y = x**2 - 16
x = sqrt(y+16)    or (y+16) to the power of 1/n for roots

Multiple term polynomial, for a given y, x cannot be solved directly.
One equation, one unknown (given y), but multiple terms.

y = x**2 + 2*x + 1
y = x(x + 2) + 1
x(x+2) = y-1
x = (y-1)/(x+2)

Here an itteration is required on each given y. If it converges
there is a single solution if y is not 0 where there are two.
And X will probably end up being a non-whole number.

---------------------------
y = some value (constant);
diff = 1;
cnt = 0
Xold = Xnew = 1;
while ( fabs (diff) > .01 && cnt < 20)
{
	Xnew = x = (y-1)/(Xold+2);
	++cnt;
	dif = Xnew - Xold;
}
printf ("count = %d, diff = %d, Xnew = %d\n", cnt, diff, Xnew);
-----------------------------

So when an itteration is required, it could happen that an exact solution is 
found quickly, within 7-20 itterations.

If you don't plan to do itterations, some things to think about when your
just guessing trying to solve it, which by the way, is totally illogical.

However it is likely that the solution will be a non-whole number so
@results = grep (f($_) == XXX, @candidates
                       ^^
                     this would not be reasonable

You would want to get the results of f($_) and compare it to within +/- some percentage
of XXX in range. Or round to a whole number at least. You could flag multiple candidates
that are close to the solution. But, its still not the solution because its a blind,
directionless series of calculations that don't even constitute an itteration.

-sln



------------------------------

Date: Wed, 04 Mar 2009 04:06:43 GMT
From: sln@netherlands.com
Subject: Re: What-if algorithm
Message-Id: <5gvrq4lecfjvke645krtn0e9n07haakg3v@4ax.com>

On Wed, 04 Mar 2009 04:02:25 GMT, sln@netherlands.com wrote:

>On Wed, 4 Mar 2009 00:38:14 +0100, gamo <gamo@telecable.es> wrote:
>
>>On Tue, 3 Mar 2009, Jürgen Exner wrote:
>>
>>> gamo <gamo@telecable.es> wrote:
>>> >
>>> >
[snip]
>
>Here an itteration is required on each given y. If it converges
>there is a single solution if y is not 0 where there are two.
>And X will probably end up being a non-whole number.
>
>---------------------------
>y = some value (constant);
>diff = 1;
>cnt = 0
>Xold = Xnew = 1;
>while ( fabs (diff) > .01 && cnt < 20)
>{
>	Xnew = x = (y-1)/(Xold+2);
>	++cnt;
>	dif = Xnew - Xold;
        Xold = Xnew;
>}
>printf ("count = %d, diff = %d, Xnew = %d\n", cnt, diff, Xnew);
>-----------------------------

-sln


------------------------------

Date: Wed, 04 Mar 2009 04:09:20 GMT
From: sln@netherlands.com
Subject: Re: What-if algorithm
Message-Id: <2kvrq4lfj9pigbn859cilrtum4rp3gb2fd@4ax.com>

On Wed, 04 Mar 2009 04:06:43 GMT, sln@netherlands.com wrote:

>On Wed, 04 Mar 2009 04:02:25 GMT, sln@netherlands.com wrote:
>
>>On Wed, 4 Mar 2009 00:38:14 +0100, gamo <gamo@telecable.es> wrote:
>>
>>>On Tue, 3 Mar 2009, Jürgen Exner wrote:
>>>
>>>> gamo <gamo@telecable.es> wrote:
>>>> >
>>>> >
>[snip]
>>
>>Here an itteration is required on each given y. If it converges
>>there is a single solution if y is not 0 where there are two.
>>And X will probably end up being a non-whole number.
>>
>>---------------------------
>>y = some value (constant);
>>diff = 1;
>>cnt = 0
>>Xold = Xnew = 1;
>>while ( fabs (diff) > .01 && cnt < 20)
>>{
	Xnew = (y-1)/(Xold+2);
>>	++cnt;
>>	dif = Xnew - Xold;
>        Xold = Xnew;
>>}
>>printf ("count = %d, diff = %d, Xnew = %d\n", cnt, diff, Xnew);
>>-----------------------------
>



------------------------------

Date: Tue, 03 Mar 2009 20:59:18 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: What-if algorithm
Message-Id: <bj2sq41ufrm4ng6rl3ub51k38fdv16am1b@4ax.com>

"Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:
>On 2009-03-03 15:04, Jürgen Exner <jurgenex@hotmail.com> wrote:
>> gamo <gamo@telecable.es> wrote:
>>>In excel you have a menu function that consist of given one 
[...]
>> And you can do that with a simple grep():
>>
>> 	@results = grep (f($_) == XXX, @candidates);
>
>That may be a bit impractical if @candidates is the set of all floating
>point numbers.

True, but it is highly unlikely that the set of all floating point
numbers is stored in an Excel spreadsheet.

jue


------------------------------

Date: Wed, 04 Mar 2009 00:10:23 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: Why the same script have different behavior when executed in Normal  or Debug mode?
Message-Id: <slrngqrami.1a4.whynot@orphan.zombinet>

On 2009-03-03, djslls@sina.com <djslls@sina.com> wrote:
*SKIP*
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Encode;
> use Text::ParseWords qw(parse_line);
>
> my $teststr="123#abc#xyz";
> $teststr=decode("ascii",$teststr);   ###(1) pay attention here
>
> my @testarray=parse_line("#",0,$teststr);
> my $test=$testarray[0];
>
> print $test;
>
> in Normal executing mode, I get "123" in output;
> however, when debugging, I type "p $test" just before the last line, I
> get nothing. It should be "123".

(wild guess) Consider adding explicit newline (C<"\n">) (there're many
ways to do this in Perl though).  That's possible, that your output
happens to overwritten with debugger's.

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 2248
***************************************


home help back first fref pref prev next nref lref last post