From nkuipers at uvic.ca Thu Jun 3 17:49:25 2004 From: nkuipers at uvic.ca (nkuipers) Date: Mon Aug 2 21:39:05 2004 Subject: [VPM] Iterating through a dynamic array Message-ID: <40C10D09@wm2.uvic.ca> Hello all, I am rather stuck on this, and would like some help please. I have 2 arrays, the first contains a bunch of string refs, the second a bunch of numeric scores, where the indeces of the second array correspond to those of the first. So, the stringref in array_one[0] has a score contained in array_two[0]. Now, I want to iterate through the scores, and if a score doesn't meet a certain threshold value, I want to splice() out the corresponding stringref. Well, that's fine for the first splice operation, but then I am stuck with two sets of indeces that no longer correspond. I suppose I could splice out of both arrays to keep them the same size, and then restart the iteration, but then I am redoing score comparisons that already passed in order to get to the next splice candidate, and that's ick. For those of you you speak better in code than prose, here it is, slightly beatified: my @init; # gets populated with stringrefs ... remove_similar(get_similarity_matrix($shifted_stringref_from_init)); # similarity() is from String::Similar on CPAN sub get_similarity_matrix { my ($seq1) = @_; my @score_matrix = (); foreach my $seq2 (@init) { push @score_matrix, similarity($$seq1, $$seq2); } return \@score_matrix; } sub remove_similar { my @score_matrix = @{ shift @_ }; for (my $i = 0; $i <= $#score_matrix; $i++) { if ($score_matrix[$i] > $LIMIT) { splice @init, $i, 1; # ACK!! } } } Thanks for any insight, Nathanael Kuipers, BSc. (CD) ----- Center for Biomedical Research University of Victoria email: nkuipers@uvic.ca From jhs at uvic.ca Thu Jun 3 18:19:34 2004 From: jhs at uvic.ca (Jeremy Stashewsky) Date: Mon Aug 2 21:39:05 2004 Subject: [VPM] Iterating through a dynamic array References: <40C10D09@wm2.uvic.ca> Message-ID: <006001c449c1$3ba3e8d0$3716688e@ns.uvic.ca> How about using a "hash set" to keep track of which elements to delete? my %to_keep = map {$_=>1} (0..$#score_matrix); foreach my $i (0..$#score_matrix) { if ($score_matrix[$i] > $LIMIT) { delete $to_keep{$i}; } } my @keepers = sort {$a <=> $b} keys %to_keep @score_matrix = @score_matrix[@keepers]; @init = @init[@keepers]; # is this your other array? Likewise, you could add in the elements you wanted to keep into the hash instead of deleting the ones you don't want. I *guess* you could also use a list of indices you wanted to keep, splicing out the elements you don't want as you go along -- this approach will save you the sort() call near the end. Which strategy is faster will probably depend on which operation is faster: deleting from a hash or splicing out from a list. Disclaimer: I didn't actually test any of this, but it should work. ~jeremy ----- Original Message ----- From: "nkuipers" To: Sent: Thursday, June 03, 2004 3:49 PM Subject: [VPM] Iterating through a dynamic array > Hello all, > > I am rather stuck on this, and would like some help please. > > I have 2 arrays, the first contains a bunch of string refs, the second a bunch > of numeric scores, where the indeces of the second array correspond to those > of the first. So, the stringref in array_one[0] has a score contained in > array_two[0]. Now, I want to iterate through the scores, and if a score > doesn't meet a certain threshold value, I want to splice() out the > corresponding stringref. Well, that's fine for the first splice operation, > but then I am stuck with two sets of indeces that no longer correspond. I > suppose I could splice out of both arrays to keep them the same size, and then > restart the iteration, but then I am redoing score comparisons that already > passed in order to get to the next splice candidate, and that's ick. For > those of you you speak better in code than prose, here it is, slightly > beatified: > > my @init; # gets populated with stringrefs > ... > > remove_similar(get_similarity_matrix($shifted_stringref_from_init)); > > # similarity() is from String::Similar on CPAN > sub get_similarity_matrix { > my ($seq1) = @_; > my @score_matrix = (); > foreach my $seq2 (@init) { > push @score_matrix, similarity($$seq1, $$seq2); > } > return \@score_matrix; > } > > sub remove_similar { > my @score_matrix = @{ shift @_ }; > for (my $i = 0; $i <= $#score_matrix; $i++) { > if ($score_matrix[$i] > $LIMIT) { > splice @init, $i, 1; # ACK!! > } > } > } > > Thanks for any insight, > > Nathanael Kuipers, BSc. (CD) > ----- > Center for Biomedical Research > University of Victoria > email: nkuipers@uvic.ca > > _______________________________________________ > Victoria-pm mailing list > Victoria-pm@pm.org > http://www.pm.org/mailman/listinfo/victoria-pm > From Peter at PSDT.com Thu Jun 3 18:51:37 2004 From: Peter at PSDT.com (Peter Scott) Date: Mon Aug 2 21:39:05 2004 Subject: [VPM] Iterating through a dynamic array In-Reply-To: <40C10D09@wm2.uvic.ca> References: <40C10D09@wm2.uvic.ca> Message-ID: <6.0.3.0.2.20040603162050.02204bd0@shell2.webquarry.com> At 03:49 PM 6/3/2004, nkuipers wrote: >Hello all, > >I am rather stuck on this, and would like some help please. > >I have 2 arrays, the first contains a bunch of string refs, the second >a bunch >of numeric scores, where the indeces of the second array correspond to those >of the first. So, the stringref in array_one[0] has a score contained in >array_two[0]. In general, this is a bad idea (to split a data structure across independent variables). Only under special circumstances would I concede that this was better than combining them. >Now, I want to iterate through the scores, and if a score >doesn't meet a certain threshold value, I want to splice() out the >corresponding stringref. Well, that's fine for the first splice operation, >but then I am stuck with two sets of indeces that no longer correspond. Not if you combine them into one data structure. How about having each element be an arrayref whose first element was the stringref (or string) and the second was the score? >I >suppose I could splice out of both arrays to keep them the same size, >and then >restart the iteration, but then I am redoing score comparisons that already >passed in order to get to the next splice candidate, and that's ick. Indeed. Of course, you could remember where you left off, and pick up there. >For >those of you you speak better in code than prose, here it is, slightly >beatified: > >my @init; # gets populated with stringrefs >... > >remove_similar(get_similarity_matrix($shifted_stringref_from_init)); > ># similarity() is from String::Similar on CPAN >sub get_similarity_matrix { > my ($seq1) = @_; > my @score_matrix = (); > foreach my $seq2 (@init) { > push @score_matrix, similarity($$seq1, $$seq2); > } > return \@score_matrix; >} > >sub remove_similar { > my @score_matrix = @{ shift @_ }; > for (my $i = 0; $i <= $#score_matrix; $i++) { > if ($score_matrix[$i] > $LIMIT) { > splice @init, $i, 1; # ACK!! > } > } >} > >Thanks for any insight, Referencing the global variable @init in remove_similar() is, as Douglas Adams would say, a dead giveaway that you have a suboptimal design. Another approach: grep out the indices from the score array that you want to remove, and then splice both arrays: remove_similar(get_similarity_matrix($shifted_stringref_from_init), \@init); sub remove_similar { my ($score, $init) = @_; my @keep_indices = grep $score->[$_] <= $LIMIT => 0 .. $#$score; @$score = @$score[@keep_indices]; @$init = @$init[@keep_indices]; } Okay, so I don't like the double pass there. So how about: sub remove_similar { my ($score, $init) = @_; my @keep_indices; my $index = 0; @$score = grep { $index++; $_ <= $LIMIT && push @keep_indices, $index } @$score; @$init = @$init[@keep_indices]; } (Untested, but they look right...) But as I said, I'd sooner have one data structure: my @init = map [ $_ ] => ...list of stringrefs ... get_similarities(\@init); remove_similar(\@init); sub get_similarites { my $arr = shift; ... push @$_, $score for @$arr; # More or less } sub remove_similar { my $arr = shift; @$arr = grep $_->[1] <= $LIMIT => @$arr; } -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ *** New! *** http://www.perlmedic.com/ From nkuipers at uvic.ca Fri Jun 4 17:01:15 2004 From: nkuipers at uvic.ca (nkuipers) Date: Mon Aug 2 21:39:05 2004 Subject: [VPM] Iterating through a dynamic array Message-ID: <40C16F11@wm2.uvic.ca> Thanks for the ideas. As always, KISS. Working across 2 data structures is messy. So I went down to 1, and it was almost too simple from there...I think...it seems to be doing what I want anyway...although maybe not too elegant... use constant { LIMIT => 0.90 }; my %sequence = (); my $pid = 1; ... # populate the hash with $pid++ as keys, sequence refs as values ... for my $i (1..$pid-1) { for my $j (1..$pid-1) { if ($i == $j) { next } # same sequence if (!exists $sequence{$i} || !exists $sequence{$j}) { next } # already deleted if ((similarity ${ $sequence{$i} }, ${ $sequence{$j} }) > LIMIT) { delete $sequence{$j}; # keep "first copy" } } Have a great weekend, Nathanael From jeremygwa at hotmail.com Wed Jun 9 02:05:30 2004 From: jeremygwa at hotmail.com (Jeremy Aiyadurai) Date: Mon Aug 2 21:39:05 2004 Subject: [VPM] network discovery Message-ID: hi all, how do i discover all hosts (ip's and hostnames) on a lan, using perl. my reason is that i am working on a client/server app. my ip's change from time to time on my network, depending on when and which machines are shutdown/restarted, and it is hard for me to find any pattern, if there is such a thing. thanks in advance for any help. Jeremy A. _________________________________________________________________ Free yourself from those irritating pop-up ads with MSn Premium. Get 2months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines From darren at DarrenDuncan.net Wed Jun 9 02:29:17 2004 From: darren at DarrenDuncan.net (Darren Duncan) Date: Mon Aug 2 21:39:05 2004 Subject: [VPM] network discovery In-Reply-To: References: Message-ID: At 12:05 AM -0700 6/9/04, Jeremy Aiyadurai wrote: >hi all, >how do i discover all hosts (ip's and hostnames) on a lan, using perl. >my reason is that i am working on a client/server app. my ip's >change from time to time on my network, depending on when and which >machines are shutdown/restarted, and it is hard for me to find any >pattern, if there is such a thing. >thanks in advance for any help. >Jeremy A. You could try pinging all the possible addresses every now and then; those which reply exist. Since you're on a LAN, there are usually only 254 possible IP addresses (at least with a normal LAN), which would take a few seconds in total to test. The address ranges are, as I recall, 192.168.0.1 thru 192.168.1.254. (The .0 and .255 are never used by machines; they are reserved for broadcast or similar things; for that matter, .1 may be used by the router itself, leaving 253 others to test.) -- Darren Duncan From jhs at uvic.ca Wed Jun 9 13:36:04 2004 From: jhs at uvic.ca (Jeremy Stashewsky) Date: Mon Aug 2 21:39:05 2004 Subject: [VPM] network discovery References: Message-ID: <00b201c44e50$9f1266b0$3916688e@ns.uvic.ca> Try fping: http://www.fping.com It's not Perl, but you can definitely call it from there. fping 192.168.1.1 192.168.1.2 ... 192.168.1.254 or fping -g 192.168.1.0/24 The "24" corresponds to a 24-bit subnet mask, which is 2**(32-24) = 2^8 = 256 hosts. If you read the man page, you can adjust the timing and parallelism to speed things up. ~jeremy ----- Original Message ----- From: "Jeremy Aiyadurai" To: Sent: Wednesday, June 09, 2004 12:05 AM Subject: [VPM] network discovery > hi all, > > how do i discover all hosts (ip's and hostnames) on a lan, using perl. > > my reason is that i am working on a client/server app. my ip's change from > time to time on my network, depending on when and which machines are > shutdown/restarted, and it is hard for me to find any pattern, if there is > such a thing. > > > thanks in advance for any help. > > Jeremy A. > > _________________________________________________________________ > Free yourself from those irritating pop-up ads with MSn Premium. Get 2months > FREE* > http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines > > _______________________________________________ > Victoria-pm mailing list > Victoria-pm@pm.org > http://www.pm.org/mailman/listinfo/victoria-pm > From jeremygwa at hotmail.com Wed Jun 9 14:08:55 2004 From: jeremygwa at hotmail.com (Jeremy Aiyadurai) Date: Mon Aug 2 21:39:05 2004 Subject: [VPM] network discovery - send again Message-ID: hi all, please re-send replies for "network discovery" as my hotmail mailbox was full, and was not recieving anything. thanks so much. Jeremy A. _________________________________________________________________ STOP MORE SPAM with the MSN Premium and get 2 months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines From darren at DarrenDuncan.net Wed Jun 9 14:17:11 2004 From: darren at DarrenDuncan.net (Darren Duncan) Date: Mon Aug 2 21:39:05 2004 Subject: Resend - Re: [VPM] network discovery Message-ID: At 12:05 AM -0700 6/9/04, Jeremy Aiyadurai wrote: >hi all, >how do i discover all hosts (ip's and hostnames) on a lan, using perl. >my reason is that i am working on a client/server app. my ip's >change from time to time on my network, depending on when and which >machines are shutdown/restarted, and it is hard for me to find any >pattern, if there is such a thing. >thanks in advance for any help. >Jeremy A. You could try pinging all the possible addresses every now and then; those which reply exist. Since you're on a LAN, there are usually only 254 possible IP addresses (at least with a normal LAN), which would take a few seconds in total to test. The address ranges are, as I recall, 192.168.0.1 thru 192.168.1.254. (The .0 and .255 are never used by machines; they are reserved for broadcast or similar things; for that matter, .1 may be used by the router itself, leaving 253 others to test.) -- Darren Duncan From jeremygwa at hotmail.com Fri Jun 11 16:50:53 2004 From: jeremygwa at hotmail.com (Jeremy Aiyadurai) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Types of LAN's for compatibility Message-ID: hi Darren, >Since you're on a LAN, there are usually only 254 possible IP addresses (at >least with a normal LAN), what makes a LAN, a normal LAN? how many types a LAN's are there, and what would be the ip ranges? eg. my lan is 192.168.1.* (eg. * = 1 - 254). The reason i am asking these questions is I dont know too much about lan computing, but need to know, so my client/server app, will be able to work on any type of lan. Thanks in advance, Jeremy A. >From: Darren Duncan >To: victoria-pm@pm.org >Subject: Resend - Re: [VPM] network discovery >Date: Wed, 9 Jun 2004 12:17:11 -0700 > >At 12:05 AM -0700 6/9/04, Jeremy Aiyadurai wrote: >>hi all, >>how do i discover all hosts (ip's and hostnames) on a lan, using perl. >>my reason is that i am working on a client/server app. my ip's change from >>time to time on my network, depending on when and which machines are >>shutdown/restarted, and it is hard for me to find any pattern, if there is >>such a thing. >>thanks in advance for any help. >>Jeremy A. > >You could try pinging all the possible addresses every now and then; those >which reply exist. Since you're on a LAN, there are usually only 254 >possible IP addresses (at least with a normal LAN), which would take a few >seconds in total to test. The address ranges are, as I recall, 192.168.0.1 >thru 192.168.1.254. (The .0 and .255 are never used by machines; they are >reserved for broadcast or similar things; for that matter, .1 may be used >by the router itself, leaving 253 others to test.) -- Darren Duncan >_______________________________________________ >Victoria-pm mailing list >Victoria-pm@pm.org >http://www.pm.org/mailman/listinfo/victoria-pm _________________________________________________________________ Add photos to your messages with MSN Premium. Get 2 months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines From darren at DarrenDuncan.net Fri Jun 11 18:39:59 2004 From: darren at DarrenDuncan.net (Darren Duncan) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Re: Types of LAN's for compatibility In-Reply-To: References: Message-ID: At 2:50 PM -0700 6/11/04, Jeremy Aiyadurai wrote: >what makes a LAN, a normal LAN? >how many types a LAN's are there, and what would be the ip ranges? >eg. my lan is 192.168.1.* (eg. * = 1 - 254). >The reason i am asking these questions is I dont know too much about >lan computing, but need >to know, so my client/server app, will be able to work on any type of lan. >Thanks in advance, >Jeremy A. I don't recall all the details, but some person or organization can be allocated different blocks of IP addresses for their use, with names like A, B, and C; depending what you have, you can work with either 256, or 65,536, or 16.7 million different IP addresses. Checking the status of 256 is easy, checking the much larger numbers is not usually practical. That's sort of what I'm getting at. -- Darren Duncan From darren at DarrenDuncan.net Fri Jun 11 20:40:45 2004 From: darren at DarrenDuncan.net (Darren Duncan) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Re: Types of LAN's for compatibility In-Reply-To: References: Message-ID: Jeremy, please always send these questions to the list, not me directly. With a typical DHCP server, then your "192.168.1.(1 -254 possibilities)" is correct. Regarding the 16.7 million et al, these A|B|C things I referred to were actually allocations of the public internet, and there are ranges that big there. I don't know the answers to the other questions. -- Darren Duncan At 5:52 PM -0700 6/11/04, Jeremy Aiyadurai wrote: >hi Darren, > >Thankyou for your replies. > >my router has a dhcp server. this is not the case with all networks, is it? >given the broadcast address, (router address), what would be a good >perl algorithm for (pinging) detecting >all machines. >eg. if router address (default gateway) is 192.168.1.1, then it >would be 192.168.1.(1 -254 possibilities). >that is easy to figure out, for a normal lan, >but what if the router (default gateway) address is different. > >what is a good algorithm, that is optimal for testing for machines, >given any default gateway address. >I know there are 16.7 million possibilities, but no network is going >to be that big. > >also, what is a subnet mask? should this be used for the algorthim >instead of the gateway address? can this be used for figuring what >ip's to check? > >Regards, > >Jeremy A. > >>From: Darren Duncan >>To: victoria-pm@pm.org >>Subject: [VPM] Re: Types of LAN's for compatibility >>Date: Fri, 11 Jun 2004 16:39:59 -0700 >> >>At 2:50 PM -0700 6/11/04, Jeremy Aiyadurai wrote: >>>what makes a LAN, a normal LAN? >>>how many types a LAN's are there, and what would be the ip ranges? >>>eg. my lan is 192.168.1.* (eg. * = 1 - 254). >>>The reason i am asking these questions is I dont know too much >>>about lan computing, but need >>>to know, so my client/server app, will be able to work on any type of lan. >>>Thanks in advance, >>>Jeremy A. >> >>I don't recall all the details, but some person or organization can >>be allocated different blocks of IP addresses for their use, with >>names like A, B, and C; depending what you have, you can work with >>either 256, or 65,536, or 16.7 million different IP addresses. >>Checking the status of 256 is easy, checking the much larger >>numbers is not usually practical. That's sort of what I'm getting >>at. -- Darren Duncan From jeremygwa at hotmail.com Fri Jun 11 21:03:35 2004 From: jeremygwa at hotmail.com (Jeremy Aiyadurai) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] network questions. Message-ID: Hi all I have some questions. my router has a dhcp server. this is not the case with all networks, is it? given the broadcast address, (router address), what would be a good perl algorithm for (pinging) detecting all machines. eg. if router address (default gateway) is 192.168.1.1, then it would be 192.168.1.(1 -254 possibilities). that is easy to figure out, for a normal lan, but what if the router (default gateway) address is different. what is a good algorithm, that is optimal for testing for machines, given any default gateway address. I know there are 16.7 million possibilities, but no network is going to be that big. also, what is a subnet mask? should this be used for the algorthim instead of the gateway address? can this be used for figuring what ip's to check? Thanks in advance for your replies. Regards, Jeremy A. _________________________________________________________________ STOP MORE SPAM with the MSN Premium and get 2 months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines From jeremygwa at hotmail.com Fri Jun 11 21:03:48 2004 From: jeremygwa at hotmail.com (Jeremy Aiyadurai) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] network questions. Message-ID: Hi all I have some questions. my router has a dhcp server. this is not the case with all networks, is it? given the broadcast address, (router address), what would be a good perl algorithm for (pinging) detecting all machines. eg. if router address (default gateway) is 192.168.1.1, then it would be 192.168.1.(1 -254 possibilities). that is easy to figure out, for a normal lan, but what if the router (default gateway) address is different. what is a good algorithm, that is optimal for testing for machines, given any default gateway address. I know there are 16.7 million possibilities, but no network is going to be that big. also, what is a subnet mask? should this be used for the algorthim instead of the gateway address? can this be used for figuring what ip's to check? Thanks in advance for your replies. Regards, Jeremy A. _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN Premium http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines From darren at DarrenDuncan.net Sun Jun 13 21:41:52 2004 From: darren at DarrenDuncan.net (Darren Duncan) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] subject of June meeting? Message-ID: The third tuesday of June is coming up, in 2 days. Have we decided on a discussion topic yet, so I can post the brief description on the web site? Or is the June meeting cancelled from a lack of discussion? -- Darren Duncan P.S. I'm scheduled to be away for a week in mid-July, though I plan to be back on the monday or tuesday that is 6 to 30 hours prior to the third tuesday of July, so I should be there for that meeting. But someone else may have to do the website update for then, unless it is known over a week in advance. From abez at abez.ca Sun Jun 13 23:21:45 2004 From: abez at abez.ca (abez) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] subject of June meeting? In-Reply-To: Message-ID: I am unable to attend This tuesday and the following tuesday I will be at a conference. I move to either have a meeting on 29th or suggest that the meeting is held more informally like at a coffee place. Since I will be unable to provide a data projector key. If you guys still need a room booking w/o data projector I can provide that. abram On Sun, 13 Jun 2004, Darren Duncan wrote: > The third tuesday of June is coming up, in 2 days. > > Have we decided on a discussion topic yet, so I can post the brief > description on the web site? > > Or is the June meeting cancelled from a lack of discussion? > > -- Darren Duncan > > P.S. I'm scheduled to be away for a week in mid-July, though I plan > to be back on the monday or tuesday that is 6 to 30 hours prior to > the third tuesday of July, so I should be there for that meeting. > But someone else may have to do the website update for then, unless > it is known over a week in advance. > _______________________________________________ > Victoria-pm mailing list > Victoria-pm@pm.org > http://www.pm.org/mailman/listinfo/victoria-pm > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From darren at DarrenDuncan.net Mon Jun 14 14:42:32 2004 From: darren at DarrenDuncan.net (Darren Duncan) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] subject of June meeting? In-Reply-To: <6.0.3.0.2.20040614090235.021e2050@shell2.webquarry.com> References: <6.0.3.0.2.20040614090235.021e2050@shell2.webquarry.com> Message-ID: At 9:12 AM -0700 6/14/04, Peter Scott wrote: >Having asked several times over the last couple of months for a >volunteer speaker for June, I think we are not going to get one in >24 hours. Therefore, I am cancelling the June VPM meeting; next >meeting will be July 20. Okay, I'll update the web site to that effect soon, unless you happen to first. >Anyone care to present something there? It need not take the whole >time, we can work with talks as short as 15 minutes if we have >enough of them. While I don't know if I'll be ready by then or not, I can give a talk in July about my database access framework that consists mainly of 'SQL::SyntaxModel' and 'Rosetta'. I just want to upload a few more versions to CPAN first, so that it is ready to be "used", and make a general announcement on the DBI related lists to solicit pre-alpha feedback. >(Sometime we will have the social event you suggest, but I want more >people to be available. I was just down in Los Angeles and LA.pm >had a restaurant get-together for me, then headed over to Ask Bjorn >Hansen's surprise birthday party a few doors away.) Sounds like that was fun. Out of curiosity, how many regular members does LA.pm have, and how old is that group? Also, is 'Ask' the guy's first name, or is that a nickname and his real first name is 'Bjorn'? Pick one, or a third option. -- Darren Duncan From Peter at PSDT.com Mon Jun 14 15:25:55 2004 From: Peter at PSDT.com (Peter Scott) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] subject of June meeting? In-Reply-To: References: <6.0.3.0.2.20040614090235.021e2050@shell2.webquarry.com> Message-ID: <6.0.3.0.2.20040614132343.021e1bd8@shell2.webquarry.com> At 12:42 PM 6/14/2004, Darren Duncan wrote: >At 9:12 AM -0700 6/14/04, Peter Scott wrote: >>Having asked several times over the last couple of months for a >>volunteer speaker for June, I think we are not going to get one in 24 >>hours. Therefore, I am cancelling the June VPM meeting; next meeting >>will be July 20. > >Okay, I'll update the web site to that effect soon, unless you happen >to first. Please go ahead and own the web site... >>Anyone care to present something there? It need not take the whole >>time, we can work with talks as short as 15 minutes if we have enough of them. > >While I don't know if I'll be ready by then or not, I can give a talk >in July about my database access framework that consists mainly of >'SQL::SyntaxModel' and 'Rosetta'. I just want to upload a few more >versions to CPAN first, so that it is ready to be "used", and make a >general announcement on the DBI related lists to solicit pre-alpha feedback. Sounds good. Do you think you might also talk about a more introductory topic some time, drawing on your expertise in databases perhaps? >>(Sometime we will have the social event you suggest, but I want more >>people to be available. I was just down in Los Angeles and LA.pm had >>a restaurant get-together for me, then headed over to Ask Bjorn >>Hansen's surprise birthday party a few doors away.) > >Sounds like that was fun. > >Out of curiosity, how many regular members does LA.pm have, and how >old is that group? Don't know how many regulars, but they've had ~12 show up to the two meetings involving me. Age - dunno, think about 6-7 years. >Also, is 'Ask' the guy's first name, or is that a nickname and his >real first name is 'Bjorn'? Pick one, or a third option. AFAICT that is his actual first name. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ *** New! *** http://www.perlmedic.com/ From darren at DarrenDuncan.net Mon Jun 14 20:23:01 2004 From: darren at DarrenDuncan.net (Darren Duncan) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] subject of June meeting? In-Reply-To: <6.0.3.0.2.20040614132343.021e1bd8@shell2.webquarry.com> References: <6.0.3.0.2.20040614090235.021e2050@shell2.webquarry.com> <6.0.3.0.2.20040614132343.021e1bd8@shell2.webquarry.com> Message-ID: At 1:25 PM -0700 6/14/04, Peter Scott wrote: >Please go ahead and own the web site... The web site is now updated. The June meeting is cancelled, with the next one in July. I left the old description up to say that is what happened in May. >Sounds good. Do you think you might also talk about a more >introductory topic some time, drawing on your expertise in databases >perhaps? I could. And I did a few months ago. Though this time I'm thinking I should do more preparation and actually demonstrate stuff on a live database, for which I'll need the portable computer. I will post this to the list later if it will happen. >Don't know how many regulars, but they've had ~12 show up to the two >meetings involving me. Age - dunno, think about 6-7 years. I guess it isn't one of those huge chapters then, with several hundred or thousand people. Correct me if I'm wrong, but doesn't London.pm have around 1000 people? P.S. Keep all replies on-list, thanks. -- Darren Duncan From Peter at PSDT.com Mon Jun 14 20:59:52 2004 From: Peter at PSDT.com (Peter Scott) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] subject of June meeting? In-Reply-To: References: <6.0.3.0.2.20040614090235.021e2050@shell2.webquarry.com> <6.0.3.0.2.20040614132343.021e1bd8@shell2.webquarry.com> Message-ID: <6.0.3.0.2.20040614185711.021e1bd8@shell2.webquarry.com> At 06:23 PM 6/14/2004, Darren Duncan wrote: >At 1:25 PM -0700 6/14/04, Peter Scott wrote: >>Sounds good. Do you think you might also talk about a more >>introductory topic some time, drawing on your expertise in databases perhaps? > >I could. And I did a few months ago. Though this time I'm thinking I >should do more preparation and actually demonstrate stuff on a live >database, for which I'll need the portable computer. I will post this >to the list later if it will happen. Sure. And those of you out there who have learned something you like about Perl - that's enough to come and talk. Don't assume you have to be an expert to speak. There are others in the group who are at the same level of expertise who will be interested in anything you've found out regardless of how familiar it may be to the gurus. >>Don't know how many regulars, but they've had ~12 show up to the two >>meetings involving me. Age - dunno, think about 6-7 years. > >I guess it isn't one of those huge chapters then, with several hundred >or thousand people. Correct me if I'm wrong, but doesn't London.pm >have around 1000 people? I don't know their size but it is very big. So are Boston.pm and NY.pm, I believe. We're doing okay as PMs go. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ *** New! *** http://www.perlmedic.com/ From jhs at uvic.ca Wed Jun 16 14:12:14 2004 From: jhs at uvic.ca (Jeremy Stashewsky) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Perl Bug? Message-ID: <014201c453d5$d562add0$3916688e@ns.uvic.ca> Can any of you comment on why this perl statement doesn't or shouldn't work? Seems to happen under perl 5.8.4, but not under 5.8.0. (Code is a snippet from Cricket: cricket.sf.net) $ perl my(@oidsToQuery) = my(@indices) = (); __END__ Bizarre copy of ARRAY in aassign at - line 1. $ Thanks, ~jeremy From darren at DarrenDuncan.net Wed Jun 16 14:31:50 2004 From: darren at DarrenDuncan.net (Darren Duncan) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Perl Bug? In-Reply-To: <014201c453d5$d562add0$3916688e@ns.uvic.ca> References: <014201c453d5$d562add0$3916688e@ns.uvic.ca> Message-ID: At 12:12 PM -0700 6/16/04, Jeremy Stashewsky wrote: >Can any of you comment on why this perl statement doesn't or shouldn't work? >Seems to happen under perl 5.8.4, but not under 5.8.0. >(Code is a snippet from Cricket: cricket.sf.net) >$ perl >my(@oidsToQuery) = my(@indices) = (); >__END__ >Bizarre copy of ARRAY in aassign at - line 1. >$ >Thanks, >~jeremy Well, that brings up a question for me. Namely, can 'my' be used as an rvalue, or only as an lvalue? I've only ever seen it used as an lvalue. -- Darren Duncan From Peter at PSDT.com Wed Jun 16 14:22:37 2004 From: Peter at PSDT.com (Peter Scott) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Perl Bug? In-Reply-To: <014201c453d5$d562add0$3916688e@ns.uvic.ca> References: <014201c453d5$d562add0$3916688e@ns.uvic.ca> Message-ID: <6.0.3.0.2.20040616122046.021062d0@shell2.webquarry.com> At 12:12 PM 6/16/2004, you wrote: >Can any of you comment on why this perl statement doesn't or shouldn't work? >Seems to happen under perl 5.8.4, but not under 5.8.0. > >(Code is a snippet from Cricket: cricket.sf.net) >$ perl >my(@oidsToQuery) = my(@indices) = (); >__END__ >Bizarre copy of ARRAY in aassign at - line 1. >$ 5.8.4 is bleeding edge, so I'd say you've found a bug and should run perlbug to report it. Doesn't happen in 5.8.1 on Linux. Doesn't happen in 5.6.1 on Linux or Solaris. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ *** New! *** http://www.perlmedic.com/ From Peter at PSDT.com Wed Jun 16 15:57:54 2004 From: Peter at PSDT.com (Peter Scott) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Perl Bug? In-Reply-To: References: <014201c453d5$d562add0$3916688e@ns.uvic.ca> Message-ID: <6.0.3.0.2.20040616130753.021062d0@shell2.webquarry.com> At 12:31 PM 6/16/2004, Darren Duncan wrote: >At 12:12 PM -0700 6/16/04, Jeremy Stashewsky wrote: >Can any of you comment on why this perl statement doesn't or shouldn't work? >Seems to happen under perl 5.8.4, but not under 5.8.0. >(Code is a snippet from Cricket: cricket.sf.net) >$ perl >my(@oidsToQuery) = my(@indices) = (); >__END__ >Bizarre copy of ARRAY in aassign at - line 1. >$ >Thanks, >~jeremy > >Well, that brings up a question for me. Namely, can 'my' be used as >an rvalue, or only as an lvalue? I've only ever seen it used as an >lvalue. -- Darren Duncan I don't see why not. 'my' is basically a modifier on the use of a variable. I do this all the time: getopts('dvit', \my %Opt); However, the usage quoted is not, I think, an lvalue. Observe: % perl -MO=Deparse -e 'my(@oidsToQuery) = my(@indices) = ()' my(@oidsToQuery) = (my(@indices) = ()); First the empty list assignment is done to my @indices. Then the result of that assignment is used in a list context to assign to @oidsToQuery. I always remember it as "the result of an assignment is the *value* assigned." Experiment time: use strict; use warnings; tie my $x, 'main'; my $y = ($x = 42); print "\$y = $y\n"; sub TIESCALAR { return bless \my $new, shift } sub STORE { ${$_[0]} = $_[1]; print "STORE $_[1]\n" } sub FETCH { print "FETCH ${$_[0]}\n"; ${$_[0]} } Result: STORE 42 FETCH 42 $y = 42 Okay, I was wrong... it does fetch the variable. So a my modifier can be used in an rvalue context (that example doesn't prove it, but you can do your own experiments to see that the example that Jeremy was trying will work, usually). Incidentally, the code Jeremy was trying is unnecessary; arrays start out empty, so my (@oidsToQuery,@indices) will do just fine. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ *** New! *** http://www.perlmedic.com/ From michael at negativespace.net Wed Jun 16 16:48:39 2004 From: michael at negativespace.net (michael@negativespace.net) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Perl Bug? References: 6.0.3.0.2.20040616130753.021062d0@shell2.webquarry.com Message-ID: <200406162148.i5GLmd0I022415@berkelium3.baremetal.com> Indeed, and if you want to make it clear that they are starting out empty, you can do my (@foo, @bar) = (); or my (@foo, @bar) = (),(); which works because of list context magic and list flattening, although I'm not sure that the last one should work. Michael Peter Scott Peter@PSDT.com wrote: ...chop... >At 12:31 PM 6/16/2004, Darren Duncan wrote: >Incidentally, the code Jeremy was trying is unnecessary; arrays start >out empty, so > > my (@oidsToQuery,@indices) > >will do just fine. > >-- >Peter Scott >Pacific Systems Design Technologies >http://www.perldebugged.com/ >*** New! *** http://www.perlmedic.com/ > >_______________________________________________ >Victoria-pm mailing list >Victoria-pm@pm.org >http://www.pm.org/mailman/listinfo/victoria-pm From michael at negativespace.net Wed Jun 16 16:50:24 2004 From: michael at negativespace.net (michael@negativespace.net) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Perl Bug? References: 6.0.3.0.2.20040616122046.021062d0@shell2.webquarry.com Message-ID: <200406162150.i5GLoO0I026037@berkelium3.baremetal.com> There is no error with perl 5.8.3 on Windows2000 (an ActiveState build) Michael Peter Scott Peter@PSDT.com wrote: >At 12:12 PM 6/16/2004, you wrote: >>Can any of you comment on why this perl statement doesn't or shouldn't work? >>Seems to happen under perl 5.8.4, but not under 5.8.0. >> >>(Code is a snippet from Cricket: cricket.sf.net) >>$ perl >>my(@oidsToQuery) = my(@indices) = (); >>__END__ >>Bizarre copy of ARRAY in aassign at - line 1. >>$ > >5.8.4 is bleeding edge, so I'd say you've found a bug and should run >perlbug to report it. > >Doesn't happen in 5.8.1 on Linux. Doesn't happen in 5.6.1 on Linux or >Solaris. >-- >Peter Scott >Pacific Systems Design Technologies >http://www.perldebugged.com/ >*** New! *** http://www.perlmedic.com/ > >_______________________________________________ >Victoria-pm mailing list >Victoria-pm@pm.org >http://www.pm.org/mailman/listinfo/victoria-pm From jhs at uvic.ca Wed Jun 16 16:56:49 2004 From: jhs at uvic.ca (Jeremy Stashewsky) Date: Mon Aug 2 21:39:06 2004 Subject: [VPM] Perl Bug? References: 6.0.3.0.2.20040616122046.021062d0@shell2.webquarry.com <200406162150.i5GLoO0I026037@berkelium3.baremetal.com> Message-ID: <016b01c453ec$d39f3470$3916688e@ns.uvic.ca> I've perlbug'd it. I'll It's ticket number 30319 if anyone wants to know =). http://rt.perl.org/rt3/Ticket/Display.html?id=30319 ~jeremy ----- Original Message ----- From: To: Sent: Wednesday, June 16, 2004 2:50 PM Subject: Re: [VPM] Perl Bug? > There is no error with perl 5.8.3 on Windows2000 (an ActiveState build) > > Michael > > Peter Scott Peter@PSDT.com wrote: > > >At 12:12 PM 6/16/2004, you wrote: > >>Can any of you comment on why this perl statement doesn't or shouldn't work? > >>Seems to happen under perl 5.8.4, but not under 5.8.0. > >> > >>(Code is a snippet from Cricket: cricket.sf.net) > >>$ perl > >>my(@oidsToQuery) = my(@indices) = (); > >>__END__ > >>Bizarre copy of ARRAY in aassign at - line 1. > >>$ > > > >5.8.4 is bleeding edge, so I'd say you've found a bug and should run > >perlbug to report it. > > > >Doesn't happen in 5.8.1 on Linux. Doesn't happen in 5.6.1 on Linux or > >Solaris. > >-- > >Peter Scott > >Pacific Systems Design Technologies > >http://www.perldebugged.com/ > >*** New! *** http://www.perlmedic.com/ > > > >_______________________________________________ > >Victoria-pm mailing list > >Victoria-pm@pm.org > >http://www.pm.org/mailman/listinfo/victoria-pm > _______________________________________________ > Victoria-pm mailing list > Victoria-pm@pm.org > http://www.pm.org/mailman/listinfo/victoria-pm >