This requires that you set calendar_present=1 in the calling program.
Since I'm not sure what decides if the calendar ends up in the
container, I can't guess further
On Thu, Sep 08, 2005 at 04:58:52PM -0500, Bill Raty wrote:
>
> I'm trying not to reinvent the wheel, but I'm having difficulty determining
> if the wheel I'm needing has been invented.
>
> I've looked at HTML::Template POD, and I get the basic concept. In my
> ignorance I'm failing to see how I can apply it to my problem, and ifthere
> are other CPAN modules that are better suited to my task.
>
> I want to have a DWIMy page component system so that page controls can be
> called out and "Do The Right Thing". Example:
>
> I have a calendar input widget set that requires pieces of HTML,
> JavaScript, and CSS, which need to be exposed in the container page; a
> script tag in the "head", a 'div' that needs to appear early on inside the
> "body" tag, and the 'input' tag that has event handlers that usethe earlier
> script tag.
> I'd like a system that abstract the container page, that lets me develop the
> calendar control component as if it were the containing page, but when
> added/included/embedded in the container page the system smartly places the
> control component elements in the correct part of the containing page. The
> clincher is the second add of the calendar widget doesn't duplicate the
> 'script' and 'div' tags, but only interjects the 'input' tag for the second
> control.
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
--
Wayne Walker
wwalker at bybent.com Do you use Linux?!
http://www.bybent.com Get Counted! http://counter.li.org/
Perl - http://www.perl.org/ Perl User Groups - http://www.pm.org/
Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
IRC: wwalker on freenode.net
From bill.raty at gmail.com Fri Sep 9 12:12:59 2005
From: bill.raty at gmail.com (Bill Raty)
Date: Fri, 9 Sep 2005 14:12:59 -0500
Subject: APM: Framework help: Can HTML::Template do this? If not,
what CPAN module can?
In-Reply-To: <3be6deac0509081940597a8d52@mail.gmail.com>
References: <3be6deac05090814586506d9ad@mail.gmail.com>
<20050908221626.GB10103@bybent.com>
<3be6deac0509081940597a8d52@mail.gmail.com>
Message-ID: <3be6deac05090912124e122676@mail.gmail.com>
I've found another interesting inflection point is the 'associate' parameter
given to the template constructor. Associate tells the template that another
object has a 'param' method that acts like the one in CGI.pm: called with
args its a setter, called without args in a list context returns a list of
parameter names that are provided by the object. Thus the code using the
template can do some passive relection of templates by making a crafty
'param' method.
I'll send out examples if I'm able to cobble up anything promising.
Meanwhile, thanks again Austin Mongers!
-Bill
On 9/8/05, Bill Raty
wrote:
>
> Thanks Wayne.
>
> Aha! I may get away with it using the 'filters'. Also the special loop
> vars look promising:
>
>
>
>
> This only outputs on the first pass.
>
>
>
>
> This outputs every other pass, on the odd passes.
>
>
>
> This outputs every other pass, on the even passes.
>
>
>
>
> This outputs on passes that are neither first nor last.
>
>
> This is pass number .
>
>
>
> This only outputs on the last pass.
>
>
>
>
>
>
> It still seems to require that the template writer to know too much about
> inclusions or adhere to a convention.
>
> -Bill
>
>
>
>
>
>
> On 9/8/05, Wayne Walker wrote:
> >
> > You can do this with TMPL_IF and TMPL_INCLUDE
> >
> >
> >
> >
> >
> >
> > stuff
> >
> >
> >
> >
> >
> > This requires that you set calendar_present=1 in the calling program.
> >
> > Since I'm not sure what decides if the calendar ends up in the
> > container, I can't guess further
> >
> >
> > On Thu, Sep 08, 2005 at 04:58:52PM -0500, Bill Raty wrote:
> > >
> > > I'm trying not to reinvent the wheel, but I'm having difficulty
> > determining
> > > if the wheel I'm needing has been invented.
> > >
> > > I've looked at HTML::Template POD, and I get the basic concept. In my
> > > ignorance I'm failing to see how I can apply it to my problem, and
> > ifthere
> > > are other CPAN modules that are better suited to my task.
> > >
> > > I want to have a DWIMy page component system so that page controls can
> > be
> > > called out and "Do The Right Thing". Example:
> > >
> > > I have a calendar input widget set that requires pieces of HTML,
> > > JavaScript, and CSS, which need to be exposed in the container page; a
> > > script tag in the "head", a 'div' that needs to appear early on inside
> > the
> > > "body" tag, and the 'input' tag that has event handlers that usethe
> > earlier
> > > script tag.
> > > I'd like a system that abstract the container page, that lets me
> > develop the
> > > calendar control component as if it were the containing page, but when
> > > added/included/embedded in the container page the system smartly
> > places the
> > > control component elements in the correct part of the containing page.
> > The
> > > clincher is the second add of the calendar widget doesn't duplicate
> > the
> > > 'script' and 'div' tags, but only interjects the 'input' tag for the
> > second
> > > control.
> >
> > > _______________________________________________
> > > Austin mailing list
> > > Austin at pm.org
> > > http://mail.pm.org/mailman/listinfo/austin
> >
> > --
> >
> > Wayne Walker
> >
> > wwalker at bybent.com Do you use Linux?!
> > http://www.bybent.com Get Counted! http://counter.li.org/
> > Perl - http://www.perl.org/ Perl User Groups - http://www.pm.org/
> > Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
> > IRC: wwalker on freenode.net
> > _______________________________________________
> > Austin mailing list
> > Austin at pm.org
> > http://mail.pm.org/mailman/listinfo/austin
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/austin/attachments/20050909/1b7c7743/attachment.html
From msouth at gmail.com Fri Sep 9 20:11:04 2005
From: msouth at gmail.com (Mike South)
Date: Fri, 9 Sep 2005 23:11:04 -0400
Subject: APM: Framework help: Can HTML::Template do this? If not,
what CPAN module can?
In-Reply-To: <3be6deac05090912124e122676@mail.gmail.com>
References: <3be6deac05090814586506d9ad@mail.gmail.com>
<20050908221626.GB10103@bybent.com>
<3be6deac0509081940597a8d52@mail.gmail.com>
<3be6deac05090912124e122676@mail.gmail.com>
Message-ID:
If you want something that can do everything HTML::Template does, but
also anything else you could possibly want, look at Template Toolkit.
I have used both fairly extensively, and sooner or later you are going
to run into a limitation with HTML::Template that you can't easily get
around. Template Toolkit is very powerful and highly extensible and
is unlikely to ever run out of power for what you want to do.
If you're just starting fresh with a new project, I would recommend
going with Template Toolkit from the beginning so that you don't end
up having to rewrite all your templates later when your application's
need move out beyond what HTML::Template can do.
Just to give you a couple of examples:
In HTML::Template you can do a , but it only tells you if
foo is true or false. What if you want ? What if
you later realize that everything would be much easier if you could do
? Template Toolkit can do an if with
equals or matches (not with the exact syntax I showed there, but it
can do it).
One of the nicest things about Template Toolkit is that you can pass
in structured data and access it from the template. If you have an
array of hashes like this:
$folks = [
{
name => 'bob',
fruit =>'kiwi',
friends => [qw/ sally jessie raphael/],
},
{
name => 'sally',
fruit => 'kumquat',
friends =>[],
}
];
and you pass that in to a template as 'folks', you can have a loop like this:
[% FOREACH person = folks %]
[% person.name %] likes [% person.fruit %]
[% FOREACH friend = person.friends %]
[% IF loop.first %][% person.name %] is a friend of: [%END%]
[% friend %]
[% END %]
[% END %]
Here's a complete script. It's a little harder to get going with
Template Toolkit for the first time, but it's worth it.
#!/usr/bin/perl -w
use strict;
use Template;
my $folks = [
{
name => 'bob',
fruit =>'kiwi',
friends => [qw/ sally jessie raphael/],
},
{
name => 'sally',
fruit => 'kumquat',
friends =>[],
},
{
name => 'misery',
fruit => 'company',
friends =>[qw/ avarice sloth /],
},
{
name => 'batman',
fruit => 'robin',
friends =>[qw/ catwoman /],
},
];
#and you pass that in to a template as 'folks', you can have a loop like this:
my $template = Template->new();
my $output;
$template->process(\*DATA, {folks=>$folks}, \$output) || die $template->error;
print $output;
__DATA__
[%- FOREACH person = folks %]
======================
[%- person.name %] likes [% person.fruit %]
[%- FOREACH friend = person.friends -%]
[%- IF loop.first %]
[% person.name %] is a friend of:[% END -%]
[%- IF loop.last && person.friends.size > 1 %] and[%
END %] [% friend %][% IF not loop.last and person.friends.size > 2
%],[% END -%]
[%- END -%]
[%- IF loop.last %]
======================
[%- END -%]
[%- END %]
HTML::Template is evolving, and I have done a lot of useful work with
it, I'm not trying to dis it in the least. I just think it sounds
like you are already bumping around the edges of what it can do, and
you might be well advised to give Template Toolkit a try.
mike
p.s. I also gzipped the file and attached it to avoid wrapping issues.
Here is what the output is supposed to look like:
[msouth at localhost ~]$ perl apm.pl
======================
bob likes kiwi
bob is a friend of: sally, jessie, and raphael
======================
sally likes kumquat
======================
misery likes company
misery is a friend of: avarice and sloth
======================
batman likes robin
batman is a friend of: catwoman
======================
On 9/9/05, Bill Raty wrote:
> I've found another interesting inflection point is the 'associate' parameter
> given to the template constructor. Associate tells the template that
> another object has a 'param' method that acts like the one in CGI.pm: called
> with args its a setter, called without args in a list context returns a list
> of parameter names that are provided by the object. Thus the code using the
> template can do some passive relection of templates by making a crafty
> 'param' method.
>
> I'll send out examples if I'm able to cobble up anything promising.
>
> Meanwhile, thanks again Austin Mongers!
>
> -Bill
>
> On 9/8/05, Bill Raty wrote:
> > Thanks Wayne.
> >
> > Aha! I may get away with it using the 'filters'. Also the special loop
> vars look promising:
> >
> >
> >
> >
> > This only outputs on the first pass.
> >
> >
> >
> >
> >
> > This outputs every other pass, on the odd passes.
> >
> >
> >
> > This outputs every other pass, on the even passes.
> >
> >
> >
> >
> >
> > This outputs on passes that are neither first nor last.
> >
> >
> > This is pass number .
> >
> >
> >
> >
> > This only outputs on the last pass.
> >
> >
> >
> >
> >
> > It still seems to require that the template writer to know too much about
> inclusions or adhere to a convention.
> >
> > -Bill
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On 9/8/05, Wayne Walker wrote:
> > > You can do this with TMPL_IF and TMPL_INCLUDE
> > >
> > >
> > >
> > >
> > >
> > >
> > > stuff
> > >
> > >
> > >
> > >
> > >
> > > This requires that you set calendar_present=1 in the calling program.
> > >
> > > Since I'm not sure what decides if the calendar ends up in the
> > > container, I can't guess further
> > >
> > >
> > > On Thu, Sep 08, 2005 at 04:58:52PM -0500, Bill Raty wrote:
> > > >
> > > > I'm trying not to reinvent the wheel, but I'm having difficulty
> determining
> > > > if the wheel I'm needing has been invented.
> > > >
> > > > I've looked at HTML::Template POD, and I get the basic concept. In
> my
> > > > ignorance I'm failing to see how I can apply it to my problem, and
> ifthere
> > > > are other CPAN modules that are better suited to my task.
> > > >
> > > > I want to have a DWIMy page component system so that page controls
> can be
> > > > called out and "Do The Right Thing". Example:
> > > >
> > > > I have a calendar input widget set that
> requires pieces of HTML,
> > > > JavaScript, and CSS, which need to be exposed in the container
> page; a
> > > > script tag in the "head", a 'div' that needs to appear early on
> inside the
> > > > "body" tag, and the 'input' tag that has event handlers that usethe
> earlier
> > > > script tag.
> > > > I'd like a system that abstract the container page, that lets me
> develop the
> > > > calendar control component as if it were the containing page, but
> when
> > > > added/included/embedded in the container page the system smartly
> places the
> > > > control component elements in the correct part of the containing
> page. The
> > > > clincher is the second add of the calendar widget doesn't duplicate
> the
> > > > 'script' and 'div' tags, but only interjects the 'input' tag for
> the second
> > > > control.
> > >
> > > > _______________________________________________
> > > > Austin mailing list
> > > > Austin at pm.org
> > > > http://mail.pm.org/mailman/listinfo/austin
> > >
> > > --
> > >
> > > Wayne Walker
> > >
> > > wwalker at bybent.com Do you use Linux?!
> > > http://www.bybent.com Get Counted!
> http://counter.li.org/
> > > Perl - http://www.perl.org/ Perl User Groups -
> http://www.pm.org/
> > > Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
> > > IRC: wwalker on freenode.net
> > > _______________________________________________
> > > Austin mailing list
> > > Austin at pm.org
> > > http://mail.pm.org/mailman/listinfo/austin
> > >
> >
> >
>
>
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apm.pl.gz
Type: application/x-gzip
Size: 502 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/austin/attachments/20050910/a20a4312/apm.pl.gz
From rhennig at gmail.com Mon Sep 12 12:41:06 2005
From: rhennig at gmail.com (Randall Hennig)
Date: Mon, 12 Sep 2005 14:41:06 -0500
Subject: APM: Framework help: Can HTML::Template do this? If not,
what CPAN module can?
In-Reply-To:
References: <3be6deac05090814586506d9ad@mail.gmail.com>
<20050908221626.GB10103@bybent.com>
<3be6deac0509081940597a8d52@mail.gmail.com>
<3be6deac05090912124e122676@mail.gmail.com>
Message-ID: <5528c5fe05091212417bff36f5@mail.gmail.com>
Yeah, I used to use TT, http://www.template-toolkit.org/, and it worked
quite nice. It made it so much easier so I didn't have any HTML code mixed
in with my Perl. Now I am programming in ASP :/
Randy
On 9/9/05, Mike South wrote:
>
> If you want something that can do everything HTML::Template does, but
> also anything else you could possibly want, look at Template Toolkit.
>
> I have used both fairly extensively, and sooner or later you are going
> to run into a limitation with HTML::Template that you can't easily get
> around. Template Toolkit is very powerful and highly extensible and
> is unlikely to ever run out of power for what you want to do.
>
> If you're just starting fresh with a new project, I would recommend
> going with Template Toolkit from the beginning so that you don't end
> up having to rewrite all your templates later when your application's
> need move out beyond what HTML::Template can do.
>
> Just to give you a couple of examples:
>
> In HTML::Template you can do a , but it only tells you if
> foo is true or false. What if you want ? What if
> you later realize that everything would be much easier if you could do
> ? Template Toolkit can do an if with
> equals or matches (not with the exact syntax I showed there, but it
> can do it).
>
> One of the nicest things about Template Toolkit is that you can pass
> in structured data and access it from the template. If you have an
> array of hashes like this:
>
> $folks = [
> {
> name => 'bob',
> fruit =>'kiwi',
> friends => [qw/ sally jessie raphael/],
> },
>
> {
> name => 'sally',
> fruit => 'kumquat',
> friends =>[],
> }
> ];
>
> and you pass that in to a template as 'folks', you can have a loop like
> this:
>
> [% FOREACH person = folks %]
> [% person.name %] likes [% person.fruit %]
> [% FOREACH friend = person.friends %]
> [% IF loop.first %][% person.name %] is a friend of:
> [%END%]
> [% friend %]
> [% END %]
> [% END %]
>
> Here's a complete script. It's a little harder to get going with
> Template Toolkit for the first time, but it's worth it.
> #!/usr/bin/perl -w
> use strict;
> use Template;
>
> my $folks = [
> {
> name => 'bob',
> fruit =>'kiwi',
> friends => [qw/ sally jessie raphael/],
> },
> {
> name => 'sally',
> fruit => 'kumquat',
> friends =>[],
> },
> {
> name => 'misery',
> fruit => 'company',
> friends =>[qw/ avarice sloth /],
> },
> {
> name => 'batman',
> fruit => 'robin',
> friends =>[qw/ catwoman /],
> },
> ];
>
> #and you pass that in to a template as 'folks', you can have a loop like
> this:
>
> my $template = Template->new();
>
> my $output;
>
> $template->process(\*DATA, {folks=>$folks}, \$output) || die
> $template->error;
>
> print $output;
>
> __DATA__
> [%- FOREACH person = folks %]
> ======================
>
> [%- person.name %] likes [% person.fruit %]
> [%- FOREACH friend = person.friends -%]
> [%- IF loop.first %]
> [% person.name %] is a friend of:[% END -%]
> [%- IF loop.last && person.friends.size > 1 %] and[%
> END %] [% friend %][% IF not loop.last and person.friends.size > 2
> %],[% END -%]
>
> [%- END -%]
> [%- IF loop.last %]
> ======================
> [%- END -%]
>
> [%- END %]
>
> HTML::Template is evolving, and I have done a lot of useful work with
> it, I'm not trying to dis it in the least. I just think it sounds
> like you are already bumping around the edges of what it can do, and
> you might be well advised to give Template Toolkit a try.
>
> mike
>
> p.s. I also gzipped the file and attached it to avoid wrapping issues.
> Here is what the output is supposed to look like:
>
> [msouth at localhost ~]$ perl apm.pl
>
> ======================
> bob likes kiwi
> bob is a friend of: sally, jessie, and raphael
> ======================
> sally likes kumquat
> ======================
> misery likes company
> misery is a friend of: avarice and sloth
> ======================
> batman likes robin
> batman is a friend of: catwoman
> ======================
>
>
> On 9/9/05, Bill Raty wrote:
> > I've found another interesting inflection point is the 'associate'
> parameter
> > given to the template constructor. Associate tells the template that
> > another object has a 'param' method that acts like the one in CGI.pm:
> called
> > with args its a setter, called without args in a list context returns a
> list
> > of parameter names that are provided by the object. Thus the code using
> the
> > template can do some passive relection of templates by making a crafty
> > 'param' method.
> >
> > I'll send out examples if I'm able to cobble up anything promising.
> >
> > Meanwhile, thanks again Austin Mongers!
> >
> > -Bill
> >
> > On 9/8/05, Bill Raty wrote:
> > > Thanks Wayne.
> > >
> > > Aha! I may get away with it using the 'filters'. Also the special loop
> > vars look promising:
> > >
> > >
> > >
> > >
> > > This only outputs on the first pass.
> > >
> > >
> > >
> > >
> > >
> > > This outputs every other pass, on the odd passes.
> > >
> > >
> > >
> > > This outputs every other pass, on the even passes.
> > >
> > >
> > >
> > >
> > >
> > > This outputs on passes that are neither first nor last.
> > >
> > >
> > > This is pass number .
> > >
> > >
> > >
> > >
> > > This only outputs on the last pass.
> > >
> > >
> > >
> > >
> > >
> > > It still seems to require that the template writer to know too much
> about
> > inclusions or adhere to a convention.
> > >
> > > -Bill
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > On 9/8/05, Wayne Walker wrote:
> > > > You can do this with TMPL_IF and TMPL_INCLUDE
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > stuff
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > This requires that you set calendar_present=1 in the calling
> program.
> > > >
> > > > Since I'm not sure what decides if the calendar ends up in the
> > > > container, I can't guess further
> > > >
> > > >
> > > > On Thu, Sep 08, 2005 at 04:58:52PM -0500, Bill Raty wrote:
> > > > >
> > > > > I'm trying not to reinvent the wheel, but I'm having difficulty
> > determining
> > > > > if the wheel I'm needing has been invented.
> > > > >
> > > > > I've looked at HTML::Template POD, and I get the basic concept. In
> > my
> > > > > ignorance I'm failing to see how I can apply it to my problem, and
> > ifthere
> > > > > are other CPAN modules that are better suited to my task.
> > > > >
> > > > > I want to have a DWIMy page component system so that page controls
> > can be
> > > > > called out and "Do The Right Thing". Example:
> > > > >
> > > > > I have a calendar input widget set that
> > requires pieces of HTML,
> > > > > JavaScript, and CSS, which need to be exposed in the container
> > page; a
> > > > > script tag in the "head", a 'div' that needs to appear early on
> > inside the
> > > > > "body" tag, and the 'input' tag that has event handlers that
> usethe
> > earlier
> > > > > script tag.
> > > > > I'd like a system that abstract the container page, that lets me
> > develop the
> > > > > calendar control component as if it were the containing page, but
> > when
> > > > > added/included/embedded in the container page the system smartly
> > places the
> > > > > control component elements in the correct part of the containing
> > page. The
> > > > > clincher is the second add of the calendar widget doesn't
> duplicate
> > the
> > > > > 'script' and 'div' tags, but only interjects the 'input' tag for
> > the second
> > > > > control.
> > > >
> > > > > _______________________________________________
> > > > > Austin mailing list
> > > > > Austin at pm.org
> > > > > http://mail.pm.org/mailman/listinfo/austin
> > > >
> > > > --
> > > >
> > > > Wayne Walker
> > > >
> > > > wwalker at bybent.com Do you use Linux?!
> > > > http://www.bybent.com Get Counted!
> > http://counter.li.org/
> > > > Perl - http://www.perl.org/ Perl User Groups -
> > http://www.pm.org/
> > > > Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
> > > > IRC: wwalker on freenode.net
> > > > _______________________________________________
> > > > Austin mailing list
> > > > Austin at pm.org
> > > > http://mail.pm.org/mailman/listinfo/austin
> > > >
> > >
> > >
> >
> >
> > _______________________________________________
> > Austin mailing list
> > Austin at pm.org
> > http://mail.pm.org/mailman/listinfo/austin
> >
> >
>
>
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/austin/attachments/20050912/c6404cb6/attachment.html
From dbii at interaction.net Mon Sep 12 08:46:23 2005
From: dbii at interaction.net (David Bluestein II)
Date: Mon, 12 Sep 2005 10:46:23 -0500
Subject: APM: Perl zero not being zero, but 7e-12
Message-ID:
Okay, I've seen this before and have a question how to avoid it.
I take two variables:
$a= 38071.63;
$b = $i + $j; # Where $i + $j => 38071.63
print "$a : $b"; # results in 38071.63 : 38071.63
Yet if I do:
if ($a == $b) {
print "Equal";
} else {
print "Not equal";
}
I get a "Not equal".
If I subtract ($b-$a) the result is 7.27595761418343e-12. How do I get
Perl to ignore this "noise" which comes from someplace?
David
-----------------------------------------------------------------------
David H. Bluestein II
President & Lead Developer dbii at interaction.net
ii, inc.
http://www.interaction.net
-- Specializing in Interactive, Database Driven Websites --
From hcoyote at ghostar.ath.cx Mon Sep 12 22:33:23 2005
From: hcoyote at ghostar.ath.cx (HCoyote)
Date: Tue, 13 Sep 2005 00:33:23 -0500
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To:
References:
Message-ID: <20050913053323.GA48072@malkavian.ghostar.ath.cx>
On Mon, Sep 12, 2005 at 10:46:23AM -0500, David Bluestein II wrote:
> Okay, I've seen this before and have a question how to avoid it.
>
> I take two variables:
>
> $a= 38071.63;
> $b = $i + $j; # Where $i + $j => 38071.63
>
> print "$a : $b"; # results in 38071.63 : 38071.63
>
> Yet if I do:
>
> if ($a == $b) {
> print "Equal";
> } else {
> print "Not equal";
> }
>
> I get a "Not equal".
>
> If I subtract ($b-$a) the result is 7.27595761418343e-12. How do I get
> Perl to ignore this "noise" which comes from someplace?
I suggest a new computer. :-)
I can't get this to do the same thing on any system I test on. Does it happen only one
one system for you or is it consistently the same number? Does it change depending on
your choice of $i and $j?
Travis
From wwalker at bybent.com Mon Sep 12 22:47:22 2005
From: wwalker at bybent.com (Wayne Walker)
Date: Tue, 13 Sep 2005 00:47:22 -0500
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To:
References:
Message-ID: <20050913054722.GH4335@bybent.com>
Number::Tolerant seems to be one way, but YECH.
On Mon, Sep 12, 2005 at 10:46:23AM -0500, David Bluestein II wrote:
> Okay, I've seen this before and have a question how to avoid it.
>
> I take two variables:
>
> $a= 38071.63;
> $b = $i + $j; # Where $i + $j => 38071.63
>
> print "$a : $b"; # results in 38071.63 : 38071.63
>
> Yet if I do:
>
> if ($a == $b) {
> print "Equal";
> } else {
> print "Not equal";
> }
>
> I get a "Not equal".
>
> If I subtract ($b-$a) the result is 7.27595761418343e-12. How do I get
> Perl to ignore this "noise" which comes from someplace?
>
> David
>
> -----------------------------------------------------------------------
> David H. Bluestein II
> President & Lead Developer dbii at interaction.net
> ii, inc.
> http://www.interaction.net
> -- Specializing in Interactive, Database Driven Websites --
>
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
--
Wayne Walker
wwalker at bybent.com Do you use Linux?!
http://www.bybent.com Get Counted! http://counter.li.org/
Perl - http://www.perl.org/ Perl User Groups - http://www.pm.org/
Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
IRC: wwalker on freenode.net
From brian_clarkson at yahoo.com Mon Sep 12 22:54:51 2005
From: brian_clarkson at yahoo.com (Comrade Burnout)
Date: Mon, 12 Sep 2005 22:54:51 -0700 (PDT)
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To: <20050913054722.GH4335@bybent.com>
Message-ID: <20050913055451.44131.qmail@web53213.mail.yahoo.com>
i got bit by that once ... and i resorted to sprintf() ...
the floating point arithmetic is the root cause, i think.
--- Wayne Walker wrote:
> Number::Tolerant seems to be one way, but YECH.
>
> On Mon, Sep 12, 2005 at 10:46:23AM -0500, David Bluestein II wrote:
> > Okay, I've seen this before and have a question how to avoid it.
> >
> > I take two variables:
> >
> > $a= 38071.63;
> > $b = $i + $j; # Where $i + $j => 38071.63
> >
> > print "$a : $b"; # results in 38071.63 : 38071.63
> >
> > Yet if I do:
> >
> > if ($a == $b) {
> > print "Equal";
> > } else {
> > print "Not equal";
> > }
> >
> > I get a "Not equal".
> >
> > If I subtract ($b-$a) the result is 7.27595761418343e-12. How do I get
>
> > Perl to ignore this "noise" which comes from someplace?
> >
> > David
> >
> >
> -----------------------------------------------------------------------
> > David H. Bluestein II
> > President & Lead Developer dbii at interaction.net
> > ii, inc.
> > http://www.interaction.net
> > -- Specializing in Interactive, Database Driven Websites --
> >
> > _______________________________________________
> > Austin mailing list
> > Austin at pm.org
> > http://mail.pm.org/mailman/listinfo/austin
>
> --
>
> Wayne Walker
>
> wwalker at bybent.com Do you use Linux?!
> http://www.bybent.com Get Counted!
> http://counter.li.org/
> Perl - http://www.perl.org/ Perl User Groups -
> http://www.pm.org/
> Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
> IRC: wwalker on freenode.net
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
i'm trying to get away from this mail account as much as possible. it's become a spamtrap.
please reply to , or update your address books to, geektron at comradeburnout.com
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
From msouth at gmail.com Mon Sep 12 22:59:34 2005
From: msouth at gmail.com (Mike South)
Date: Tue, 13 Sep 2005 01:59:34 -0400
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To:
References:
Message-ID:
Floating point numbers are not stored with infinite accuracy, and
subtracitng two of them that look equal (to a print statement) can
bring out the tiny error that actually occurred when they were stored.
A general rule for comparing floating point numbers is to specify a
value that you consider close enough to zero for your purposes, and
check that the absolute value of the difference between the numbers is
less than that value (there's a traditional name for this, maybe
epsilon or some other greek letter used by numerical analysis/compiler
design/computer engineering type people to denote the smallest number
a computer can store).
If you are specifically dealing with money, one thing that business
software will often do it store all values in pennies, so you won't
(as easily) bring in error associated with floating point
representations.
(I'm actually just guessing that this is what you're seeing, of
course--maybe if you can tell us $i and $j and some numerical
representation guru will tell us how those things got converted to
binary or whatever we could confirm it. It's possible that the
problem will come and go depending on whether $i, $j, and the value in
$a are at the boundaries of accurate representability. For example,
if everything involved ended in .50 or .25 (which are representable
exactly in binary) do you see the problem? If that makes it go away
it's probably the problem I'm describing.)
On 9/12/05, David Bluestein II wrote:
> Okay, I've seen this before and have a question how to avoid it.
>
> I take two variables:
>
> $a= 38071.63;
> $b = $i + $j; # Where $i + $j => 38071.63
>
> print "$a : $b"; # results in 38071.63 : 38071.63
>
> Yet if I do:
>
> if ($a == $b) {
> print "Equal";
> } else {
> print "Not equal";
> }
>
> I get a "Not equal".
>
> If I subtract ($b-$a) the result is 7.27595761418343e-12. How do I get
> Perl to ignore this "noise" which comes from someplace?
>
> David
>
> -----------------------------------------------------------------------
> David H. Bluestein II
> President & Lead Developer dbii at interaction.net
> ii, inc.
> http://www.interaction.net
> -- Specializing in Interactive, Database Driven Websites --
>
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
From eharris at puremagic.com Mon Sep 12 23:05:49 2005
From: eharris at puremagic.com (Evan Harris)
Date: Tue, 13 Sep 2005 01:05:49 -0500 (CDT)
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To: <20050913053323.GA48072@malkavian.ghostar.ath.cx>
Message-ID:
Doing equality comparisons on floating point numbers is inherently unsafe in
all languages or platforms that don't use arbitrary precision math
libraries, and fraught with danger even in those that do. It is usually
unpredictable between different architectures as well.
The way you should be doing it is decide what your maximum allowed error for
comparisons is, say 1.0e-8, and then comparing if the two numbers are within
your allowed window for "equality", e.g. abs($a - $b) < 1.0e-8.
Evan
On Tue, 13 Sep 2005, HCoyote wrote:
> On Mon, Sep 12, 2005 at 10:46:23AM -0500, David Bluestein II wrote:
> > Okay, I've seen this before and have a question how to avoid it.
> >
> > I take two variables:
> >
> > $a= 38071.63;
> > $b = $i + $j; # Where $i + $j => 38071.63
> >
> > print "$a : $b"; # results in 38071.63 : 38071.63
> >
> > Yet if I do:
> >
> > if ($a == $b) {
> > print "Equal";
> > } else {
> > print "Not equal";
> > }
> >
> > I get a "Not equal".
> >
> > If I subtract ($b-$a) the result is 7.27595761418343e-12. How do I get
> > Perl to ignore this "noise" which comes from someplace?
>
> I suggest a new computer. :-)
>
> I can't get this to do the same thing on any system I test on. Does it happen only one
> one system for you or is it consistently the same number? Does it change depending on
> your choice of $i and $j?
>
>
> Travis
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
From bill.raty at gmail.com Mon Sep 12 23:06:23 2005
From: bill.raty at gmail.com (Bill Raty)
Date: Tue, 13 Sep 2005 01:06:23 -0500
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To: <20050913053323.GA48072@malkavian.ghostar.ath.cx>
References:
<20050913053323.GA48072@malkavian.ghostar.ath.cx>
Message-ID: <3be6deac05091223067e69009b@mail.gmail.com>
Remember that even though you initialized $a with 38071.63, the internal
number is stored in binary, not BCD, and .63 is an irrational number as far
as binary is concerned. It just all depends on where your perl was compiled,
what math libraries are being used, and how they represent their floating
point numbers.
Alternatives:
1) If you're after two base-ten digits of precision you could mult by 100,
round up, then compare. This is covered in section 2.3.3 of Perl Cookbook,
2nd edition.
2) Look at some of the better known perl math classes (Math::BigInt and
Math::BigFloat come to mind).
-Bill
On 9/13/05, HCoyote wrote:
>
> On Mon, Sep 12, 2005 at 10:46:23AM -0500, David Bluestein II wrote:
> > Okay, I've seen this before and have a question how to avoid it.
> >
> > I take two variables:
> >
> > $a= 38071.63;
> > $b = $i + $j; # Where $i + $j => 38071.63
> >
> > print "$a : $b"; # results in 38071.63 : 38071.63
> >
> > Yet if I do:
> >
> > if ($a == $b) {
> > print "Equal";
> > } else {
> > print "Not equal";
> > }
> >
> > I get a "Not equal".
> >
> > If I subtract ($b-$a) the result is 7.27595761418343e-12. How do I get
> > Perl to ignore this "noise" which comes from someplace?
>
> I suggest a new computer. :-)
>
> I can't get this to do the same thing on any system I test on. Does it
> happen only one
> one system for you or is it consistently the same number? Does it change
> depending on
> your choice of $i and $j?
>
>
> Travis
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/austin/attachments/20050913/7b8f1347/attachment.html
From tmcd at panix.com Mon Sep 12 23:06:05 2005
From: tmcd at panix.com (tmcd@panix.com)
Date: Tue, 13 Sep 2005 01:06:05 -0500 (CDT)
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To:
References:
Message-ID:
Let's see if I get in my answer before half a dozen other people do.
Short form: you're expecting exact representation of decimal numbers.
Modern computers use binary in their hardware, and Perl (without a
library) uses the hardware. The computer cannot represent all decimal
numbers exactly, and must use an approximation. That approximation
introduces an error. There's no guarantee that the same error occurs
in different calculations.
On Mon, 12 Sep 2005, David Bluestein II wrote:
> Okay, I've seen this before and have a question how to avoid it.
>
> I take two variables:>
> $a= 38071.63;
> $b = $i + $j; # Where $i + $j => 38071.63
> print "$a : $b"; # results in 38071.63 : 38071.63
>
> Yet if I do:
>
> if ($a == $b) {
> print "Equal";
> } else {
> print "Not equal";
> }
Indent your code.
> I get a "Not equal".
>
> If I subtract ($b-$a) the result is 7.27595761418343e-12. How do I
> get Perl to ignore this "noise" which comes from someplace?
You've just discovered round-off error. In almost all modern
computers, numbers are represented in the machine hardware only as
- integers, which can represent only the integers between -(2**31)
and (2**31)-1.
Grungy detail: though even more modern machines can do -(2**63)
.. (2**63)-1. Much hardware allows smaller ranges, like 8 or 16.
Grungy detail: some languages allow unsigned integers, for 0
.. (2**32)-1 or (2**64)-1, depending.
- floating-point numbers, which are represented using a shorter
integer and a small exponent of 2.
Some languages allow larger ranges, but on almost all machines, that
requires arrays of words and extra software to manipulate it.
Perl just uses the underlying hardware. I believe the exact rules are
- If you supply a constant with no decimal point and within the range
of integers, it's an integer value
- If you supply any other numeric constant, it's a floating-point
value
- If you do arithmetic involving a floating-point value, the result
is floating-point, else it is integer
38071.63 == 3807163e-02, and it cannot be represented exactly in the
internal binary floating-point notation. So the computer hardware,
and therefore Perl, use the closest approximation. Other values may
get different approximations. It's not visible via print because the
print software rounded to a nearby value (usually based on the number
of significant digits), but while it prints as 38071.63, the internal
binary value is something like 38071.620000003694 or whatever.
On some older machines, the easiest example was like
$a = 1/3; $b = 3*$a; print (1-$b);
which would print something like
1e-12
or something. That doesn't happen on my modernish CPU, though.
Another classic example still works:
$a = 0.01;
$b = 0;
for (my $i = 0; $i < 100; ++$i) {
$b += $a;
}
print (1-$b);
prints, on my machine,
-6.66133814775094e-16
It's because 0.01 is similarly approximate, and the small error in
that approximation adds up in the final result to a larger error.
Your fundamental problem is that you're expecting equality to work
between floating-point numbers. That's a sin and you need to avoid
it. If you need to represent numbers exactly, like dollars and cents
for financial calculations, then shun floating-point. There are two
common techniques:
- Use integers with a scale factor. It can be implicit, like storing
all dollar quantities as integer pennies. Or it can be explicit,
like having a separate exponent of 10 (thus implementing a base-10
version of what the hardware provides in base 2).
That can be moderately hard to do safely without error.
- Find a Perl library in CPAN that implements the ranges of numbers
you need exactly (that is, without doing an approximation).
Or maybe you're doing something that doesn't need to be 100% exact but
jsut very precise, with the 7 or 12 significant digits that the
hardware provides. In that case, don't try "==" on floating-point
numbers, because it will almost always return false due to
approximations. If you know the ranges, you can implement a "close
enough" test. Suppose you know that the numbers are from -99999.99 to
+99999.99, and you only care that they're within 0.01. Then
abs($b-$a) < 0.01
is the close-enough test. Or maybe you want them to agree to within
0.1%. Then
abs($b/$a) < 0.001
is a first cut ... except if $a is small enough and $b large enough,
you can get overflow, and hence an error or a bad result.
Despite the fact that it looks long, that's a brutally short
explanation. There are entire tracks of college classes in numerical
analysis, which (inter alia) deals with how to use computer hardware
to compute actual values and minimize errors.
--
Tim McDaniel; Reply-To: tmcd at panix.com
From tmcd at panix.com Mon Sep 12 23:20:35 2005
From: tmcd at panix.com (tmcd@panix.com)
Date: Tue, 13 Sep 2005 01:20:35 -0500 (CDT)
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To:
References:
Message-ID:
I might or might not have started first, but my answer didn't hit the
list first. Oh well.
On Tue, 13 Sep 2005, Mike South wrote:
> If you are specifically dealing with money, one thing that business
> software will often do it store all values in pennies, so you won't
> (as easily) bring in error associated with floating point
> representations.
In my suggestion of the same thing, I should note that then you have
to decide how to handle roundoff yourself, ratherthan let the computer
hardware handle it. For example, suppose you're selling something for
$123.45, which you can represent as 12345. Suppose you need to add
sales tax of 8.25%. The final value is $133.634625, which you cannot
represent. If you store 13363, they pay $133.63 and you're not
charging $0.004625. If you store 13354, they pay $133.64 and you're
overcharging $0.005375. You may say that it doesn't matter, but
believe me, it does. Sales tax laws may mandate one or the other, or
may not. And accumulation of fractional pennies is a classic bank
programming fraud called "salami slicing": if you do it right, the
books balance but the programmer's account accumulates a lot of spare
change.
Short form again: don't expect exact computation using floating-point
numbers or your approximation to them.
--
Tim McDaniel; Reply-To: tmcd at panix.com
From tmcd at panix.com Mon Sep 12 23:23:40 2005
From: tmcd at panix.com (tmcd@panix.com)
Date: Tue, 13 Sep 2005 01:23:40 -0500 (CDT)
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To: <20050913054722.GH4335@bybent.com>
References:
<20050913054722.GH4335@bybent.com>
Message-ID:
On Tue, 13 Sep 2005, Wayne Walker wrote:
> Number::Tolerant seems to be one way, but YECH.
Why "YECH"? It's a library designed for this particular sort of
problem, and at a cursory glance it looks like it's a reasonable
implementation. When you have to start worrying about the fact that
computers can't represent your numbers exactly, it's an intrinsically
messy and worrisome problem.
--
Tim McDaniel; Reply-To: tmcd at panix.com
From wwalker at bybent.com Mon Sep 12 23:38:18 2005
From: wwalker at bybent.com (Wayne Walker)
Date: Tue, 13 Sep 2005 01:38:18 -0500
Subject: APM: Perl zero not being zero, but 7e-12
In-Reply-To:
References:
<20050913054722.GH4335@bybent.com>
Message-ID: <20050913063818.GI4335@bybent.com>
On Tue, Sep 13, 2005 at 01:23:40AM -0500, tmcd at panix.com wrote:
> On Tue, 13 Sep 2005, Wayne Walker wrote:
> > Number::Tolerant seems to be one way, but YECH.
>
> Why "YECH"? It's a library designed for this particular sort of
> problem, and at a cursory glance it looks like it's a reasonable
> implementation. When you have to start worrying about the fact that
> computers can't represent your numbers exactly, it's an intrinsically
> messy and worrisome problem.
The Yech is that fit's too much overhead for most problems.
Somthine like the folllowing would at least not require creation of
objects for each number while providing much or all of what David needs.
package Float::AlmostEqual;
use Exporter;
@EXPORT = qw(ae);
our $precision = 0.0000000001;
sub ae
{
my ( $a, $b ) = @_;
my $delta = ( $a - $b );
return ( abs($delta) < $precision );
}
sub re # reasonably equal
{
my ( $a, $b ) = @_;
my $delta = ( $a - $b );
my $precision;
my ( $aa, $ab );
$aa = abs($a);
$ab = abs($b);
my $min = min( $aa, $ab );
$precision = $min / 1000000000;
return ( abs($delta) < $precision );
}
The above is a vetting the concept, yes I know re() uses an arbitrary
non-pure-math way of deciding on precision, but will work for almost any
problem. But with it, David could do all his normal porgramming, just
searching for $a == $b and replace with ae($a,$b).
If he is doing financial, then Math::FixedPrecision or something similar
is the way to go.
--
Wayne Walker
wwalker at bybent.com Do you use Linux?!
http://www.bybent.com Get Counted! http://counter.li.org/
Perl - http://www.perl.org/ Perl User Groups - http://www.pm.org/
Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
IRC: wwalker on freenode.net
From hcoyote at ghostar.ath.cx Tue Sep 13 20:37:30 2005
From: hcoyote at ghostar.ath.cx (HCoyote)
Date: Tue, 13 Sep 2005 22:37:30 -0500
Subject: APM: Next meeting?
Message-ID: <20050914033730.GA55746@malkavian.ghostar.ath.cx>
When's the next meeting? The website still shows last month's info.
Travis
From dbii at interaction.net Tue Sep 13 20:45:09 2005
From: dbii at interaction.net (David Bluestein II)
Date: Tue, 13 Sep 2005 22:45:09 -0500
Subject: APM: Next meeting?
In-Reply-To: <20050914033730.GA55746@malkavian.ghostar.ath.cx>
References: <20050914033730.GA55746@malkavian.ghostar.ath.cx>
Message-ID: <80fd2ccb5e0a6607f3f86bd4864ce427@interaction.net>
Next meeting I think is at ARL. We were going to do SQL, who wanted to
go over SQL, MySQL, DBI, etc? Volunteers? Or maybe a group effort by
3-4 of us?
David
On Sep 13, 2005, at 10:37 PM, HCoyote wrote:
> When's the next meeting? The website still shows last month's info.
>
> Travis
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
-----------------------------------------------------------------------
David H. Bluestein II
President & Lead Developer dbii at interaction.net
ii, inc.
http://www.interaction.net
-- Specializing in Interactive, Database Driven Websites --
From hcoyote at ghostar.ath.cx Tue Sep 13 21:05:39 2005
From: hcoyote at ghostar.ath.cx (HCoyote)
Date: Tue, 13 Sep 2005 23:05:39 -0500
Subject: APM: Next meeting?
In-Reply-To: <80fd2ccb5e0a6607f3f86bd4864ce427@interaction.net>
References: <20050914033730.GA55746@malkavian.ghostar.ath.cx>
<80fd2ccb5e0a6607f3f86bd4864ce427@interaction.net>
Message-ID: <20050914040539.GB55746@malkavian.ghostar.ath.cx>
On Tue, Sep 13, 2005 at 10:45:09PM -0500, David Bluestein II wrote:
> Next meeting I think is at ARL. We were going to do SQL, who wanted to
> go over SQL, MySQL, DBI, etc? Volunteers? Or maybe a group effort by
> 3-4 of us?
Is it happening tomorrow or next wednesday? (I'm still figuring out
which wednesday of the month the meetings usually are :-)
Travis
From dbii at interaction.net Tue Sep 13 21:31:50 2005
From: dbii at interaction.net (David Bluestein II)
Date: Tue, 13 Sep 2005 23:31:50 -0500
Subject: APM: Next meeting?
In-Reply-To: <20050914040539.GB55746@malkavian.ghostar.ath.cx>
References: <20050914033730.GA55746@malkavian.ghostar.ath.cx>
<80fd2ccb5e0a6607f3f86bd4864ce427@interaction.net>
<20050914040539.GB55746@malkavian.ghostar.ath.cx>
Message-ID:
Next week, on the 21st. Third Wed of month.
On Sep 13, 2005, at 11:05 PM, HCoyote wrote:
> On Tue, Sep 13, 2005 at 10:45:09PM -0500, David Bluestein II wrote:
>> Next meeting I think is at ARL. We were going to do SQL, who wanted to
>> go over SQL, MySQL, DBI, etc? Volunteers? Or maybe a group effort by
>> 3-4 of us?
>
> Is it happening tomorrow or next wednesday? (I'm still figuring out
> which wednesday of the month the meetings usually are :-)
>
> Travis
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
-----------------------------------------------------------------------
David H. Bluestein II
President & Lead Developer dbii at interaction.net
ii, inc.
http://www.interaction.net
-- Specializing in Interactive, Database Driven Websites --
From dbii at interaction.net Wed Sep 14 11:37:01 2005
From: dbii at interaction.net (David Bluestein II)
Date: Wed, 14 Sep 2005 13:37:01 -0500
Subject: APM: Meeting: September 21: SQL/MySQL/DBI and Perl
Message-ID: <7ee9ebdab44ae626fa5a37ce8f83b1d3@interaction.net>
That's our topic, now we need speakers :)
I've got 10-15 minutes of "interesting" mysql issues I've hit in the
past two weeks and resolved. Who else wants to speak (or who do you
want to volunteer to speak)? I know we had Wayne, Mark, Bill, and Heath
talking about it last meeting, maybe someone else too.
David
-----------------------------------------------------------------------
David H. Bluestein II
President & Lead Developer dbii at interaction.net
ii, inc.
http://www.interaction.net
-- Specializing in Interactive, Database Driven Websites --
From dbii at interaction.net Wed Sep 21 07:03:19 2005
From: dbii at interaction.net (David Bluestein II)
Date: Wed, 21 Sep 2005 09:03:19 -0500
Subject: APM: Meeting Tonight: Attendee Show of Hands
Message-ID: <622978471ab6a7aa0b2b9c2d947489ce@interaction.net>
Okay, everyone is clearly swamped this month, so I want to see a show
of hands of who will be at dinner at Double Dave's, and who will be at
the meeting. Our plan at the moment is meet for dinner, retire to ARL
for questions and a little bit of SQL and topic planning for future
months. This will be a really informal meeting since we don't have
things together for a presentation, but we'll answer questions.
If you are attending dinner, the "meeting", or both, please email me so
we can know our headcount tonight.
And if you cannot make it, but have a topic you want someone drafted
for to speak on, let me know today too.
Thanks-
David
-----------------------------------------------------------------------
David H. Bluestein II
President & Lead Developer dbii at interaction.net
ii, inc.
http://www.interaction.net
-- Specializing in Interactive, Database Driven Websites --
From dbii at interaction.net Wed Sep 21 08:02:56 2005
From: dbii at interaction.net (David Bluestein II)
Date: Wed, 21 Sep 2005 10:02:56 -0500
Subject: APM: Java Users Group Meeting on AJAX
Message-ID: <2076f5715f7781828aad653e9b37577b@interaction.net>
In light of some of our recent discussions, I wanted to cross post
this. While Perl and Java are definitely very different, this may be of
interest to Perl members for the overall content on AJAX, since it
seems to be an overview of the technology/process, rather than Java
itself. Just an FYI for those interested.
David
Tuesday September 27, 2005 Meeting - Austin Java Users Group
WHEN: Tuesday, September 27, 2005 7-9 P.M.
WHERE: Embassy Suites Hotel
TOPIC: Injecting Life into Boring Web Applications with AJAX
SPEAKER: Steve Benfield
Our September meeting is graciously sponsored by ClearNova
(http://www.clearnova.com/)
Main Course
-----------
Injecting Life into Boring Web Applications with AJAX
by Steve Benfield,
VP of Strategy & Technology Evangelism,
ClearNova
AJAX is hot hot hot. The techniques of AJAX (Asynchronous Javascript
+ XML) have been under our noses for years but in the past few months
the term has spread across the web development community like wildfire.
Is AJAX for real or will it wind up in the architects junkpile like
Entity Beans? Will AJAX fulfill users desires to have web applications
behave like their older client/server applications?
In this session we'll cover how AJAX works, discuss architectural
considerations for building AJAX-enabled applications, build a live
AJAX application with JSPs, see real-world AJAX examples, discuss
using AJAX for returning dynamic data vs. dynamic GUI elements, and
cover emerging AJAX frameworks. We'll end with a demonstration and
comparison of an AJAX enabled business application vs. a traditional
HTML app. Finally we'll discuss what our team had to consider and
some of the pitfalls we found when it came to implementing our own
AJAX framework.
About the Speaker
-----------------
Steve Benfield, VP of Strategy & Technology Evangelism, ClearNova
Steve has been involved in Java & web development since 1996 and
is former CTO of SilverStream Software. He has spoken previously
at AJUG as well as Java One, Web Services Edge, Software Development
Expo, OMG, Gartner Symposium, and Comdex. Steve guarantees that you
will not fall asleep at this presentation and you will walk away
with a clear understanding of AJAX.
Meeting Location & Time
-----------------------
Meeting at the Embassy Suites on North Mopac from 7 - 9 PM
(Networking follows at Baby Acapulco)
http://maps.google.com/maps?q=9505+Stonelake+Blvd+Austin+TX
Driving Directions:
Embassy Suites, 9505 Stonelake Blvd
From Mopac Loop 1 - Exit Capital of Texas Hwy. 360, take
the turn around to the access road south, turn right onto York,
then left onto Stonelake Blvd. The hotel is on the left.
It's located behind Comp USA and across the street from the ACT III
Gateway 16 theater.
-----------------------------------------------------------------------
David H. Bluestein II
President & Lead Developer dbii at interaction.net
ii, inc.
http://www.interaction.net
-- Specializing in Interactive, Database Driven Websites --
From wwalker at bybent.com Wed Sep 21 08:23:33 2005
From: wwalker at bybent.com (Wayne Walker)
Date: Wed, 21 Sep 2005 10:23:33 -0500
Subject: APM: Meeting Tonight: Attendee Show of Hands
In-Reply-To: <622978471ab6a7aa0b2b9c2d947489ce@interaction.net>
References: <622978471ab6a7aa0b2b9c2d947489ce@interaction.net>
Message-ID: <20050921152333.GC3263@bybent.com>
50/50. We are demoing our new product at www.DEMO.com DEMOfall in 45
minutes..
:wq
On Wed, Sep 21, 2005 at 09:03:19AM -0500, David Bluestein II wrote:
> Okay, everyone is clearly swamped this month, so I want to see a show
> of hands of who will be at dinner at Double Dave's, and who will be at
> the meeting. Our plan at the moment is meet for dinner, retire to ARL
> for questions and a little bit of SQL and topic planning for future
> months. This will be a really informal meeting since we don't have
> things together for a presentation, but we'll answer questions.
>
> If you are attending dinner, the "meeting", or both, please email me so
> we can know our headcount tonight.
>
> And if you cannot make it, but have a topic you want someone drafted
> for to speak on, let me know today too.
>
> Thanks-
>
> David
> -----------------------------------------------------------------------
> David H. Bluestein II
> President & Lead Developer dbii at interaction.net
> ii, inc.
> http://www.interaction.net
> -- Specializing in Interactive, Database Driven Websites --
>
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
--
Wayne Walker
wwalker at bybent.com Do you use Linux?!
http://www.bybent.com Get Counted! http://counter.li.org/
Perl - http://www.perl.org/ Perl User Groups - http://www.pm.org/
Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
IRC: wwalker on freenode.net
From outlawtx at cox-internet.com Thu Sep 29 10:48:43 2005
From: outlawtx at cox-internet.com (don james)
Date: Thu, 29 Sep 2005 12:48:43 -0500
Subject: APM: Use of the ampersand, "&"
Message-ID: <20050929184843.9555@smtp.cox-internet.com>
Hi,
I am learning Perl using Ellie Quigley's book, Perl by Example.
She has an example where the "&" precedes a filename. It is used in the
following context:
open(SAVED, ">&STDOUT");
I can't seem to figure out the purpose of the "&" in from of the file name.
Can anyone help?
Thanks,
Don James
From taylor at codecafe.com Thu Sep 29 10:54:28 2005
From: taylor at codecafe.com (Taylor Carpenter)
Date: Thu, 29 Sep 2005 12:54:28 -0500
Subject: APM: Use of the ampersand, "&"
In-Reply-To: <20050929184843.9555@smtp.cox-internet.com>
References: <20050929184843.9555@smtp.cox-internet.com>
Message-ID: <433C2A54.3020001@codecafe.com>
don james wrote:
> She has an example where the "&" precedes a filename. It is used in the
> following context:
>
> open(SAVED, ">&STDOUT");
That is for duping the file handle. See dup(2) and perldoc -f open.
Taylor
From tshinnic at io.com Thu Sep 29 12:05:52 2005
From: tshinnic at io.com (Thomas L. Shinnick)
Date: Thu, 29 Sep 2005 14:05:52 -0500
Subject: APM: Use of the ampersand, "&"
In-Reply-To: <433C2A54.3020001@codecafe.com>
References: <20050929184843.9555@smtp.cox-internet.com>
<433C2A54.3020001@codecafe.com>
Message-ID: <6.2.1.2.2.20050929134317.044dad60@mail.io.com>
At 12:54 9/29/2005, Taylor Carpenter wrote:
>don james wrote:
>> She has an example where the "&" precedes a filename. It is used in the
>> following context:
>>
>> open(SAVED, ">&STDOUT");
>
>That is for duping the file handle. See dup(2) and perldoc -f open.
perlfaq5 "How do I dup() a filehandle in Perl?" gives a good example. You already have a file open, and now you want to re-use that handle when opening another file.
open(LOG, ">>/foo/logfile");
and later
open(STDERR, ">&LOG");
This allows the second open to be ignorant of what file is being used by the first. Useful also if you want to force some output to wahtever STDERR points to
open(TRACE, ">&STDERR");
without some underlying routine having to know. Check out Test::Builder where they do open(TESTERR,">&STDERR') to keep a copy of STDERR in case the following code being tested changes where STDERR outputs to.
>Taylor
From outlawtx at cox-internet.com Fri Sep 30 06:41:47 2005
From: outlawtx at cox-internet.com (don james)
Date: Fri, 30 Sep 2005 08:41:47 -0500
Subject: APM: Use of the ampersand, "&"
In-Reply-To: <6.2.1.2.2.20050929134317.044dad60@mail.io.com>
References: <6.2.1.2.2.20050929134317.044dad60@mail.io.com>
Message-ID: <20050930144147.19035@smtp.cox-internet.com>
Hi,
Okay. I have another question. Which file handle gets duplicated?
In the following example:
open(LOG, ">>/foo/logfile");
and later
open(STDERR, ">&LOG");
Does "LOG" become the same as "STDERR" or does "STDERR" become the same
as "LOG"?
In other words, if the system sends messages to STDERR, does that same
message also get sent to LOG and then to /foo/logfile?
Sincerely,
Don James
Thursday, September 29, 2005Thu, 29 Sep 2005 14:05:52 -050014:05-
050014:05-0500 at 837ThomasThomas L. Shinnicktshinnic at io.com
>At 12:54 9/29/2005, Taylor Carpenter wrote:
>>don james wrote:
>>> She has an example where the "&" precedes a filename. It is used in the
>>> following context:
>>>
>>> open(SAVED, ">&STDOUT");
>>
>>That is for duping the file handle. See dup(2) and perldoc -f open.
>
>perlfaq5 "How do I dup() a filehandle in Perl?" gives a good example.
>You already have a file open, and now you want to re-use that handle when
>opening another file.
> open(LOG, ">>/foo/logfile");
>and later
> open(STDERR, ">&LOG");
>This allows the second open to be ignorant of what file is being used by
>the first. Useful also if you want to force some output to wahtever
>STDERR points to
> open(TRACE, ">&STDERR");
>without some underlying routine having to know. Check out Test::Builder
>where they do open(TESTERR,">&STDERR') to keep a copy of STDERR in case
>the following code being tested changes where STDERR outputs to.
>
>>Taylor
>
>
>_______________________________________________
>Austin mailing list
>Austin at pm.org
>http://mail.pm.org/mailman/listinfo/austin
From tshinnic at io.com Fri Sep 30 11:40:52 2005
From: tshinnic at io.com (Thomas L. Shinnick)
Date: Fri, 30 Sep 2005 13:40:52 -0500
Subject: APM: Use of the ampersand, "&"
In-Reply-To: <20050930144147.19035@smtp.cox-internet.com>
References: <6.2.1.2.2.20050929134317.044dad60@mail.io.com>
<20050930144147.19035@smtp.cox-internet.com>
Message-ID: <6.2.1.2.2.20050930131404.04155410@mail.io.com>
At 08:41 9/30/2005, don james wrote:
>Hi,
>
>Okay. I have another question. Which file handle gets duplicated?
>
>In the following example:
>
>open(LOG, ">>/foo/logfile");
>and later
>open(STDERR, ">&LOG");
>
>Does "LOG" become the same as "STDERR" or does "STDERR" become the same
>as "LOG"?
Yes, think of it as 'becomes' or "is made the same as this handle already open".
>In other words, if the system sends messages to STDERR, does that same
>message also get sent to LOG and then to /foo/logfile?
Actually, much closer to "output to STDERR goes to /foo/logfile, and output to LOG goes to /foo/logfile" - no intermediate steps needed.
As Taylor mentioned, this just duplicates/copies the low-level filehandle and gives it a new Perl-level handle name. Consider it an new aliased name.
If you have used the command line much you will realize what the docs for open mention, that this exactly parallels usage like:
tar xvzf foo.tar.gz >listing 2>&1
where you are doing something much like
open(STDOUT,'>','listing') or die $!;
open(STDERR,'>&',STDOUT) or die $!;
print "plain print produced\n";
warn "errors excitedly eeking\n";
>Sincerely,
>
>Don James
>
>Thursday, September 29, 2005Thu, 29 Sep 2005 14:05:52 -050014:05-
>050014:05-0500 at 837ThomasThomas L. Shinnicktshinnic at io.com
>
>>At 12:54 9/29/2005, Taylor Carpenter wrote:
>>>don james wrote:
>>>> She has an example where the "&" precedes a filename. It is used in the
>>>> following context:
>>>>
>>>> open(SAVED, ">&STDOUT");
>>>
>>>That is for duping the file handle. See dup(2) and perldoc -f open.
>>
>>perlfaq5 "How do I dup() a filehandle in Perl?" gives a good example.
>>You already have a file open, and now you want to re-use that handle when
>>opening another file.
>> open(LOG, ">>/foo/logfile");
>>and later
>> open(STDERR, ">&LOG");
>>This allows the second open to be ignorant of what file is being used by
>>the first. Useful also if you want to force some output to wahtever
>>STDERR points to
>> open(TRACE, ">&STDERR");
>>without some underlying routine having to know. Check out Test::Builder
>>where they do open(TESTERR,">&STDERR') to keep a copy of STDERR in case
>>the following code being tested changes where STDERR outputs to.
>>
>>>Taylor