From adam at battleaxe.net Wed Feb 2 13:15:24 2005 From: adam at battleaxe.net (Adam Israel) Date: Wed Feb 2 13:15:08 2005 Subject: [Chicago-talk] February meeting? Message-ID: <420142EC.1040800@battleaxe.net> Hey guys, Is there going to be a February meeting? The web page still says November and I haven't seen anything mentioned on the list recently. -Adam From andy at petdance.com Wed Feb 2 13:24:52 2005 From: andy at petdance.com (Andy Lester) Date: Wed Feb 2 13:25:02 2005 Subject: [Chicago-talk] February meeting? In-Reply-To: <420142EC.1040800@battleaxe.net> References: <420142EC.1040800@battleaxe.net> Message-ID: <20050202212452.GA22449@petdance.com> On Wed, Feb 02, 2005 at 03:15:24PM -0600, Adam Israel (adam@battleaxe.net) wrote: > Is there going to be a February meeting? The web page still says > November and I haven't seen anything mentioned on the list recently. Jason Gessner keeps making noises about a room downtown, but I haven't heard anything definite. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Wed Feb 2 13:24:52 2005 From: andy at petdance.com (Andy Lester) Date: Wed Feb 2 13:25:08 2005 Subject: [Chicago-talk] February meeting? In-Reply-To: <420142EC.1040800@battleaxe.net> References: <420142EC.1040800@battleaxe.net> Message-ID: <20050202212452.GA22449@petdance.com> On Wed, Feb 02, 2005 at 03:15:24PM -0600, Adam Israel (adam@battleaxe.net) wrote: > Is there going to be a February meeting? The web page still says > November and I haven't seen anything mentioned on the list recently. Jason Gessner keeps making noises about a room downtown, but I haven't heard anything definite. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From shawn.c.carroll at gmail.com Fri Feb 4 05:28:29 2005 From: shawn.c.carroll at gmail.com (Shawn Carroll) Date: Fri Feb 4 05:28:47 2005 Subject: [Chicago-talk] Phalanx and HTML::TreeBuilder Message-ID: Sean, Earlier we, Chicago.pm, delivered a patch for HTML::TreeBuilder. This patch contained updates to tests and pod to increase the testing coverage of your module. Since then we haven't received any feedback from you on this patch. Can you please get back to us at your convience with any feedback? --Shawn -- shawn.c.carroll@gmail.com Perl Programmer Soccer Referee From lembark at wrkhors.com Sun Feb 13 16:24:57 2005 From: lembark at wrkhors.com (Steven Lembark) Date: Sun Feb 13 16:24:42 2005 Subject: [Chicago-talk] Proper encapsulation In-Reply-To: <5cfdfaf7050122115435f04a2@mail.gmail.com> References: <41F1EC54.4010400@heyjay.com> <5cfdfaf7050122115435f04a2@mail.gmail.com> Message-ID: -- Jim Thomason > It completely 100% utterly totally absolutely violates encapsulation. > Attributes should be defined within the class period, end of > discussion. Think about it - if you're defining attributes outside of > the class, then they're not really encapsulated inside anything, are > they? :-) Up to the point where you have to debug something and have no way to tell what's going on inside the class even if you need to. Remember the shotgun approach: Perl asks you to stay out of its living room because you weren't invited, not because it has a weapon. For example, if you can export set/get methods that check for "_foo" variables (traditionally considered private) or set something in the object about heavy privacy then it might make complete sense to export make the methods available for sane usage (e.g., extending the class, debugging, access to values closures' data in Data::Dumper). -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark@wrkhors.com 1 888 359 3508 From lembark at wrkhors.com Sun Feb 13 16:31:43 2005 From: lembark at wrkhors.com (Steven Lembark) Date: Sun Feb 13 16:31:22 2005 Subject: [Chicago-talk] CRON Jobs for the paranoid In-Reply-To: <20050126194048.12864.qmail@web202.biz.mail.re2.yahoo.com> References: <20050126194048.12864.qmail@web202.biz.mail.re2.yahoo.com> Message-ID: -- Richard Reina > Due to lack of trust my office network is not hooked > up to the internet. This means I (if I remeber) > manually set the time on ntp server once per week so > that the other computers can get the correct time. I > am cosidering writing a short perl script that when > executed askes me for the time and resets the time on > the ntp server. However, if I have cron execute the > script how can interrupt (get my attention) whatever I > am doing when I am logged in. > > Any suggestions are appreceiated. Nothing to do with perl whatever but... PPP Over modem with autodial & no pickup on ring: the only connections you can make are outbound. For not too much money these days you can pick up one of the GPS units that will set the local time from the radio standards (no network in involved). You're probably going overboard with NTP. Use adjtimex and your wristwatch once a month and it'll proably work out fine. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark@wrkhors.com 1 888 359 3508 From lembark at wrkhors.com Sun Feb 13 16:31:43 2005 From: lembark at wrkhors.com (Steven Lembark) Date: Sun Feb 13 16:31:23 2005 Subject: [Chicago-talk] CRON Jobs for the paranoid In-Reply-To: <20050126194048.12864.qmail@web202.biz.mail.re2.yahoo.com> References: <20050126194048.12864.qmail@web202.biz.mail.re2.yahoo.com> Message-ID: -- Richard Reina > Due to lack of trust my office network is not hooked > up to the internet. This means I (if I remeber) > manually set the time on ntp server once per week so > that the other computers can get the correct time. I > am cosidering writing a short perl script that when > executed askes me for the time and resets the time on > the ntp server. However, if I have cron execute the > script how can interrupt (get my attention) whatever I > am doing when I am logged in. > > Any suggestions are appreceiated. Nothing to do with perl whatever but... PPP Over modem with autodial & no pickup on ring: the only connections you can make are outbound. For not too much money these days you can pick up one of the GPS units that will set the local time from the radio standards (no network in involved). You're probably going overboard with NTP. Use adjtimex and your wristwatch once a month and it'll proably work out fine. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark@wrkhors.com 1 888 359 3508 From richard at rushlogistics.com Sun Feb 13 17:19:59 2005 From: richard at rushlogistics.com (Richard Reina) Date: Sun Feb 13 17:20:10 2005 Subject: [Chicago-talk] CRON Jobs for the paranoid In-Reply-To: Message-ID: <20050214011959.2533.qmail@web206.biz.mail.re2.yahoo.com> Thanks fro the input. Sold your house yet? RR --- Steven Lembark wrote: > > > -- Richard Reina > > > Due to lack of trust my office network is not > hooked > > up to the internet. This means I (if I remeber) > > manually set the time on ntp server once per week > so > > that the other computers can get the correct time. > I > > am cosidering writing a short perl script that > when > > executed askes me for the time and resets the time > on > > the ntp server. However, if I have cron execute > the > > script how can interrupt (get my attention) > whatever I > > am doing when I am logged in. > > > > Any suggestions are appreceiated. > > Nothing to do with perl whatever but... > > PPP Over modem with autodial & no pickup on ring: > the > only connections you can make are outbound. > > For not too much money these days you can pick up > one > of the GPS units that will set the local time from > the radio standards (no network in involved). > > You're probably going overboard with NTP. Use > adjtimex > and your wristwatch once a month and it'll proably > work out fine. > > -- > Steven Lembark > 85-09 90th Street > Workhorse Computing > Woodhaven, NY 11421 > lembark@wrkhors.com > 1 888 359 3508 > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From Andy_Bach at wiwb.uscourts.gov Mon Feb 14 13:01:08 2005 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach@wiwb.uscourts.gov) Date: Mon Feb 14 13:15:41 2005 Subject: [Chicago-talk] [PERL6]: Fun with junctions (was Sets vs Junctions) Message-ID: I don't know if anybody *else* is on the edge of their seat, await P6 but ... I ran into the "Perl 6 and Parrot Essentials" book at a used book store and so ended up on the P6 lists. Its not your mother's perl anymore; well, it will be (it'll have full P5 compatability somehow), but its a whole lot more. One new feature are junctions: http://dev.perl.org/perl6/synopsis/S09.html set-like, array like, yet w/ their own set of operations, like "any" and "all" ... below is a nice summary of what junctions are and why we want them. a Andy Bach, Sys. Mangler Internet: andy_bach@wiwb.uscourts.gov VOICE: (608) 261-5738 FAX 264-5932 "Bugs happen. A bug is a test case you haven't written yet." Mark Pilgrim ----- Forwarded by Andy Bach/WIWB/07/USCOURTS on 02/14/2005 02:48 PM ----- "Patrick R. Michaud" 02/11/2005 01:22 PM To Rod Adams cc "perl6-language@perl.org" Subject Fun with junctions (was Sets vs Junctions) On Fri, Feb 11, 2005 at 12:54:39AM -0600, Rod Adams wrote: > Damian writes: > >Junctions have an associated boolean predicate that's preserved across > >operations on the junction. Junctions also implicitly distribute > >across operations, and rejunctify the results. > > My brain is having trouble fully grasping that. Let me attempt a paraphrase: > > Junctions exist to be tested for something. > When a test is performed, the junction is evaluated in terms of that > test. A "result junction" is created, which contains only the elements > of the original junction which will pass that given test. If the result > junction is empty, the test fails. >From "Perl 6 and Parrot Essentials": A junction is basically just an unordered set with a logical relation defined between its elements. Any operation on the junction is an operation on the entire set. "Tests" are not used to select elements from the junction, a "test" (such as a relational op) is simply applied to the elements of the junction(s) and returns the junction of the results. In other words, if you think of a "test" as being a boolean operator, then applying a boolean operator to a junction is going to return a junction of true/false values, because boolean operators return true/false values. For example, with the "less than or equals" (<=) relational operator, the expression any(2,3,4) <= 3 becomes any( 2 <= 3, # 1 (true) 3 <= 3, # 1 (true) 4 <= 3 # 0 (false) ) which ultimately becomes any(1,0), because <= is an operator that returns booleans. In plain English, we're asking "Are any of the values 2, 3, or 4 less than or equal to 3?", and the answer is "yes", because any(1,0) evaluates to true in a boolean context. Note that it does *not* becomes the junction of the values that were less than or equal to 3 -- for that we would use C. Similarly, consider all(2,3,4) <= 3 which becomes all( 2 <= 3, # 1 (true) 3 <= 3, # 1 (true) 4 <= 3 # 0 (false) ) or all(1,0). Here, the English question is "Are all of the values 2, 3, and 4 less than or equal to 3?", and the answer is "no" (and all(1,0) evaluates to false in a boolean context). Okay, so how is this useful? Here's an example (w/apologies for any inadvertent syntax errors): if (any(@age) >= 100) { say "There's a centenarian here!"; } is somehow a lot nicer than if (grep { $^x >= 100 } @age) { say "There's a centenarian here!"; } And if (all(@age) >= 100) { say "We're all centenarians here!"; } is much nicer than if (!(grep { $^x < 100 } @age)) { say "We're all centenarians here!"; } But wait, there's more! Junctions are valuable because we can combine them into multiple operands or function arguments. Thus, # intersection: Are any values in @foo also in @bar? any(@foo) == any(@bar) # containment: Are all of the elements in @foo also in @bar? all(@foo) == any(@bar) # non-intersection: Are all of the elements in @foo not in @bar? all(@foo) == none(@bar) Here's that last one spelled out to see the effects, assuming @foo=(2,3,4) and @bar=(5,6): all(2,3,4) == none(5,6) -> all( 2 == none(5,6), 3 == none(5,6), 4 == none(5,6) ) -> all( none(2==5, 2==6), none(3==5, 3==6), none(4==5, 4==6) ) -> all( none(0, 0), none(0, 0), none(0, 0) ) Of course, the value of junctions is that they work pretty much with any operation on scalar arguments. Thus, if we define an is_factor() function as: # return true if $x is a factor of $y sub is_factor (Scalar $x, Scalar $y) { $y % $x == 0 } then we automatically get: # are any of @foo factors of $bar? if is_factor(any(@foo), $bar) { ... } # are all of @foo factors of $bar? if is_factor(all(@foo), $bar) { ... } # is $foo a factor of any elements of @bar? if is_factor($foo, any(@bar)) { ... } # is $foo a factor of all elements of @bar? if is_factor($foo, all(@bar)) { ... } # are any elements of @foo factors of any elements of @bar? if is_factor(any(@foo), any(@bar)) { ... } # are all elements of @foo factors of all elements of @bar? if is_factor(all(@foo), all(@bar)) { ... } # a (somewhat inefficient?) is_prime test for $bar if is_factor(none(2..sqrt($bar)), $bar) { say "$bar is prime"; } Just because I'm curious, here's the the prime test spelled out for $bar==23, testing if 23 is a prime number: is_factor(none(2..sqrt(23)), 23) -> is_factor(none(2..4), 23) -> { 23 % none(2..4) == 0 } -> { none( 23 % 2, 23 % 3, 23 % 4 ) == 0 } -> { none( 1, 2, 3 ) == 0 } -> { none( 1==0, 2==0, 3==0 ) } -> { none( 0, 0, 0) } -> true That is just too cool. :-) Pm From me at heyjay.com Mon Feb 14 20:17:00 2005 From: me at heyjay.com (Jay Strauss) Date: Mon Feb 14 20:20:40 2005 Subject: [Chicago-talk] Converting from www::mech to underlying objects Message-ID: <421177BC.1000508@heyjay.com> Hi, Awhile back, Leland showed me how to read data from the CBOE site like: use WWW::Mechanize; my $url = "http://www.cboe.com/DelayedQuote/QuoteTableDownload.aspx"; my $mech = WWW::Mechanize->new(); $mech->agent_alias( 'Windows IE 6' ); $mech->get( $url ); $mech->form(0); $mech->set_fields( txtTicker => 'QQQQ'); my $form = $mech->current_form; $form->find_input('__VIEWSTATE')->name('NOVIEWSTATE'); my $request = $form->click; $mech->request($request, "QQQQ.txt"); I thought I'd try to fit it into the Finance::Quote namespace as Finance::Quote::CBOE. Finance::Quote doesn't use www::mech, it uses the underlying modules like LWP::UserAgent. So I'm trying to convert the above to work on the more base stuff. Below is my code, it seems like its correct, but when I run it I get an "Invalid request" back from the server. Could someone give me a nudge in the right direction? Thanks Jay sub option_chain { my $quoter = shift; $symbol = 'QQQQ'; my $ua = $quoter->user_agent; $ua->agent('Windows IE 6'); my $response = $ua->get($url); my $form = HTML::Form->parse($response->content, $response->base); $form->value(txtTicker => $symbol); $form->find_input('__VIEWSTATE')->name('NOVIEWSTATE'); my $request = $form->click; $ua->request($request, "$symbol.txt"); } From lembark at wrkhors.com Wed Feb 16 19:55:52 2005 From: lembark at wrkhors.com (Steven Lembark) Date: Wed Feb 16 20:08:05 2005 Subject: [Chicago-talk] [PERL6]: Fun with junctions (was Sets vs Junctions) In-Reply-To: References: Message-ID: -- Andy_Bach@wiwb.uscourts.gov > I don't know if anybody *else* is on the edge of their seat, await P6 but > ... I ran into the "Perl 6 and Parrot Essentials" book at a used book > store and so ended up on the P6 lists. Its not your mother's perl > anymore; well, it will be (it'll have full P5 compatability somehow), but > its a whole lot more. One new feature are junctions: > http://dev.perl.org/perl6/synopsis/S09.html > > set-like, array like, yet w/ their own set of operations, like "any" and > "all" ... below is a nice summary of what junctions are and why we want > them. Take a look at Quantum::Superpositions. My contribution to P6 was showing Damian enough ways to use them that he took the time to get them in :-) The real trick is that a disjunction evaluates all of its arguments to determine the truth. Grammers are single objects that can be applied to input to return an output or nada. Hence, you can create a disjunction of grammers. This doesn't sound very interesting until you realize that P6 compiles to parrot object: it's language agnostic. So long as your grammer works with a given language and returns true then it'll hand back soemthing to the junction's test. Net result is that in P6 you an create a language-agnostic compiler via "map { $junction_of_gramz } @source_blocks" (or something fairly similar). Try that with Python :-) -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark@wrkhors.com 1 888 359 3508 From lembark at wrkhors.com Wed Feb 16 19:55:52 2005 From: lembark at wrkhors.com (Steven Lembark) Date: Wed Feb 16 20:08:07 2005 Subject: [Chicago-talk] [PERL6]: Fun with junctions (was Sets vs Junctions) In-Reply-To: References: Message-ID: -- Andy_Bach@wiwb.uscourts.gov > I don't know if anybody *else* is on the edge of their seat, await P6 but > ... I ran into the "Perl 6 and Parrot Essentials" book at a used book > store and so ended up on the P6 lists. Its not your mother's perl > anymore; well, it will be (it'll have full P5 compatability somehow), but > its a whole lot more. One new feature are junctions: > http://dev.perl.org/perl6/synopsis/S09.html > > set-like, array like, yet w/ their own set of operations, like "any" and > "all" ... below is a nice summary of what junctions are and why we want > them. Take a look at Quantum::Superpositions. My contribution to P6 was showing Damian enough ways to use them that he took the time to get them in :-) The real trick is that a disjunction evaluates all of its arguments to determine the truth. Grammers are single objects that can be applied to input to return an output or nada. Hence, you can create a disjunction of grammers. This doesn't sound very interesting until you realize that P6 compiles to parrot object: it's language agnostic. So long as your grammer works with a given language and returns true then it'll hand back soemthing to the junction's test. Net result is that in P6 you an create a language-agnostic compiler via "map { $junction_of_gramz } @source_blocks" (or something fairly similar). Try that with Python :-) -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark@wrkhors.com 1 888 359 3508 From me at heyjay.com Thu Feb 17 04:27:54 2005 From: me at heyjay.com (Jay Strauss) Date: Thu Feb 17 04:31:32 2005 Subject: [Chicago-talk] How/where does www::mech re-evaluate a response and do the right thing? Message-ID: <42148DCA.90606@heyjay.com> Hi (maybe Andy will respond), If I get back a response object that looks like the below. By what mechanism do I use the header and cookie to download the file? What I mean is, am I suppose take that header put it into some other type of HTTP or LWP object and do a request on it? I'm trying to figure out how www::mech just does the right thing and just serves up the content Thanks Jay $VAR1 = bless( { '_protocol' => 'HTTP/1.1', '_content' => 'Object moved^M

Object moved to here.

^M ^M ', '_rc' => '302', '_headers' => bless( { 'client-response-num' => 1, 'cache-control' => 'private', 'set-cookie' => [ 'CBOESiteTrackingID=88f8300a-e989-4f5b-aafd-99ba123870c1; expires=Tue, 17-Feb-2105 12:25:47 GMT; path=/', 'WEBTRENDS_ID=; expires=Wed, 16-Feb-2005 12:25:47 GMT; path=/', 'DownLoadError=; expires=Wed, 16-Feb-2005 12:25:47 GMT; path=/', 'QueryData=06C38A2F1465BF909C384E3F185DD721EE116829700B819C9D36C67EC20BB9A965700C969F77344BC081C467639F2FB71BCE63C1E41FAA2B5F87065CFE9F1CA8EC2ACD76B5F588B08DD89F3EF32EEC76410C8314C5B9825E; path=/' ], 'location' => '/DelayedQuote/QuoteData.dat', 'date' => 'Thu, 17 Feb 2005 12:25:47 GMT', 'client-peer' => '198.160.148.116:80', 'content-length' => '144', 'x-aspnet-version' => '1.1.4322', 'client-date' => 'Thu, 17 Feb 2005 12:22:48 GMT', 'content-type' => 'text/html; charset=iso-8859-1', 'title' => 'Object moved', 'server' => 'Microsoft-IIS/6.0' }, 'HTTP::Headers' ), '_msg' => 'Found', '_request' => bless( { '_content' => '__EVENTTARGET=&__EVENTARGUMENT=&NOVIEWSTATE=dDwtODc5MTM4MTUwOzs%2B6wDeQv0gEC342sUPKG%2B3n6ZStJ8%3D&ucHeader%3AucCBOEHeaderLinks%3AucCBOEHeaderSearch%3Asearchtext=&txtTicker=QQQQ&cmdSubmit=Download', '_uri' => bless( do{\(my $o = 'http://www.cboe.com/DelayedQuote/QuoteTableDownload.aspx')}, 'URI::http' ), '_headers' => bless( { 'user-agent' => 'Windows IE 6', 'content-type' => 'application/x-www-form-urlencoded', 'content-length' => 196 }, 'HTTP::Headers' ), '_method' => 'POST' }, 'HTTP::Request' ) }, 'HTTP::Response' ); From andy at petdance.com Thu Feb 17 11:05:01 2005 From: andy at petdance.com (Andy Lester) Date: Thu Feb 17 11:05:12 2005 Subject: [Chicago-talk] How/where does www::mech re-evaluate a response and do the right thing? In-Reply-To: <42148DCA.90606@heyjay.com> References: <42148DCA.90606@heyjay.com> Message-ID: <20050217190501.GB23774@petdance.com> On Thu, Feb 17, 2005 at 06:27:54AM -0600, Jay Strauss (me@heyjay.com) wrote: > If I get back a response object that looks like the below. By what > mechanism do I use the header and cookie to download the file? What I > mean is, am I suppose take that header put it into some other type of > HTTP or LWP object and do a request on it? The $mech->content is just looking at the HTTP::Response object's content() method. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Thu Feb 17 11:05:01 2005 From: andy at petdance.com (Andy Lester) Date: Thu Feb 17 11:05:14 2005 Subject: [Chicago-talk] How/where does www::mech re-evaluate a response and do the right thing? In-Reply-To: <42148DCA.90606@heyjay.com> References: <42148DCA.90606@heyjay.com> Message-ID: <20050217190501.GB23774@petdance.com> On Thu, Feb 17, 2005 at 06:27:54AM -0600, Jay Strauss (me@heyjay.com) wrote: > If I get back a response object that looks like the below. By what > mechanism do I use the header and cookie to download the file? What I > mean is, am I suppose take that header put it into some other type of > HTTP or LWP object and do a request on it? The $mech->content is just looking at the HTTP::Response object's content() method. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance