From cusce at jlab.org Wed May 16 11:42:03 2001 From: cusce at jlab.org (Collin Cusce) Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] What's the buzz? Message-ID: <001101c0de27$236ef920$f7203981@jlab.org> Tell me what's 'a happenin'.... Ok, I'm just wondering who is going to talk next meeting and where it's going to be held at. I have the room at Jlab reserved until the end of the year, so it can be held here again if you like. Or, if someone else wants to show off the nifty toys where they work, we can go somewhere else.....doesn't matter. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/norfolk-pm/attachments/20010516/1a920bbd/attachment.htm From dlehman at hurricanetechgroup.com Fri May 18 17:56:15 2001 From: dlehman at hurricanetechgroup.com (Daniel Lehman) Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] Java Message-ID: <20010518225615.6386.cpmta@c017.sfo.cp.net> Hey all, I am looking into taking a Java class or two. Does anyone now of a place here in Newport News to take Java classes. Looking also for a Perl class as well. Thanks in advance. From cusce at home.com Fri May 18 18:28:30 2001 From: cusce at home.com (Collin Cusce') Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] Java References: <20010518225615.6386.cpmta@c017.sfo.cp.net> Message-ID: <002501c0dff2$3ff822c0$40941718@CX782347A> Well...Chris and Jeff did a pro-bono Perl class last summer...I know a few people myself who would love to take it this year if they are willing to do it again ;-) . As for a Java class...try CNU. They offer it during the summer and if you hurry, you might still be able to sign up! ----- Original Message ----- From: "Daniel Lehman" To: Sent: Friday, May 18, 2001 6:56 PM Subject: [HRPM] Java > Hey all, > > I am looking into taking a Java class or two. Does anyone now of a place here in Newport News to take Java classes. Looking also for a Perl class as well. Thanks in advance. > From Branson.Matheson at FergInc.com Mon May 21 08:11:04 2001 From: Branson.Matheson at FergInc.com (Branson Matheson) Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] What's the buzz? In-Reply-To: <001101c0de27$236ef920$f7203981@jlab.org>; from cusce@jlab.org on Wed, May 16, 2001 at 12:42:03PM -0400 References: <001101c0de27$236ef920$f7203981@jlab.org> Message-ID: <20010521091104.B70663@thorin.ferguson.com> No one answereth?! On Wed, May 16, 2001 at 12:42:03PM -0400,Collin Cusce spoke forth: > Tell me what's 'a happenin'.... > Ok, I'm just wondering who is going to talk next meeting and where it's going to be held at. I have the room at Jlab reserved until the end of the year, so it can be held here again if you like. Or, if someone else wants to show off the nifty toys where they work, we can go somewhere else.....doesn't matter. - branson ------------------------------------------------------------------------------- Branson Matheson "If you are falling off of a mountain, Manager, Risk and Information Security You may as well try to fly." Ferguson Enterprises, Inc. - Delenn, Minbari Ambassador $/ = "" ;( $statements = ) !~ /Corporate Opinion/; From jocknerd at home.com Mon May 21 16:00:11 2001 From: jocknerd at home.com (Jeff Self) Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] Perl beginner looking for a little help Message-ID: I wrote a program in C a couple of years ago that read in football scores and computed rankings. As I am trying to learn perl now, I figured this would be a good program to work with. So far in my endeavors, my perl program can read in the input file and print out the scores for each game. What I need to do now is have each game stored in a hash I presume. What I am trying to figure out is how to create the hash that will hold the data for each game and the hash storing data for each team. If anyone's interested in looking at the data, you can get the file from http://www.mratings.com/data/nfl2000.txt. Here's what I've got right now: ******************************************************************** # Football Rankings Program # Read in the scores $a = "nfl2000.txt"; open(SCORES,$a) || die "cannot open $a for reading: $!\n"; while () { #read a line from file $a into $_ s/^\s+//; #discard leading whitespace s/\s+$//; #discard trailing whitespace s/\s+/ /g; #collapse internal whitespace ($month,$day,$year,$vteam,$vscore,$hteam,$hscore) = $_ =~ /^(\d+)\D(\d+)\D(\d+)(\D+)(\d+)(\D+)(\d+)(.*)$/; # Adjust their scores $adj_vscore = &get_adjusted_score($vscore); $adj_hscore = &get_adjusted_score($hscore); # Get expected ratio #$expected_ratio = &get_expected_ratio($vrate,$hrate); # Get the Game Ratio $game_ratio = &get_game_ratio($adj_vscore, $adj_hscore); printf("%s\t%d\t%s\t%d\t%.4f\n",$vteam,$vscore,$hteam,$hscore,$game_ratio); } ################################################## # Subroutines ################################################## ################################################## # Adjust Score # This is implemented to prevent teams from # running up the score. There is a maximum # adjusted score of 50.0 ################################################## sub get_adjusted_score { $adjden = 250.0; ($adj_score) = @_; $result = $adj_score - ($adj_score ** 2) / $adjden; return ($result); } ################################################## # Game Ratio # This is used to provide a way to measure the # outcome of a game. ################################################## sub get_game_ratio { ($adjvscore,$adjhscore) = @_; $result = (($adjvscore/6) ** 2 + 1.0)/(($adjvscore/6) ** 2 + ($adjhscore/6) ** 2 + 2.0); if ($adjvscore > $adjhscore) { $result += 1.0; } elsif ($adjvscore == $adjhscore) { $result += 0.5; } return ($result * 0.5); } ********************************************************************** Here's the structs from my C program: /* This is a Game struct */ struct Game { struct Team *vteam, *hteam; int vscore, hscore; double ratio; struct Game *next; }; /* This is a Team struct */ struct Team { char *name; int won,lost,tied,pf,pa; double rating; struct Team *next; }; Thanks, Jeff Self -- Hard Work Often Pays Off After Time, but Laziness Always Pays Off Now. From cusce at home.com Mon May 21 22:24:45 2001 From: cusce at home.com (Collin Cusce') Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] Perl beginner looking for a little help References: Message-ID: <001c01c0e26e$c043c280$40941718@CX782347A> Firstly, I would never store something this immense that is only going to grow more in a flat file. If you are willing to learn a bit about databases (if you dont know it already) , you might want to consider transfering your data into one and just run SQL queries on that. Postgres is my personal choice, but MySQL will do your needs nicely. Trust me, this makes life a WHOLE lot easier and your data a whole lot less corruptable (maybe that is just a false sense of security on my part, though). But I digress. Unfortunatly, pretty much the full extent of Perl's data structures has been hacked together by Larry Wall as simple, quick fixes. There isnt true datatyping in perl ie: nothing like a 'struct' or a real 'class' (from what I understand Perl 6 will have this, though 8-). There is an example in Advanced Perl Programming by O'Reilly that seems to be very similar to the problem you have. I'll include the source from the book and the data it takes in below, but I'll address your problem, too. Ok, so you want to create a complex datastructure in Perl. Firstly, you need to create a sort of consrtuctor function that will alter a main data srtucutre based on the values you pass into it.You will need a main datastrucutre, array or hash, that will contain all the data and then you build functions to navigate that datascructure. This is a quick job I threw together in a few minutes which probably wont work to your needs and is buggy, but hopefully it will give you the idea. my(%games,%teams); #parameters for enter_game passed in as follows: #enter_game($date, \$teams{$vis_team}, \$teams{$home_team}, $vscore,$hscore,$ratio); sub enter_game{ my($date, $visitors,$home,$vscore,$hscore,$ratio) = @_; %thisgame = { 'date' => $date, #note, the next to values are references to the teams, not a copy 'visitor' => $visitors, 'home' => $home, 'vis_score' => $vscore, 'home_score' => $hscore, 'ratio' => $ratio }; $keyname = $visitor->$name."vs".$home->$name."on:"$date; $games{$keyname} = \$thisgame; }; sub enter_team { my($name,$won,$lost,$tied,$pf,$pa,$rating); %team{$name} = { 'won' => $won, 'lost' => $lost, 'tied' => $tied, 'pf' => $pf, 'pa' => $pa, 'rating' => $rating }; }; I hope that is what you are looking for. It most definetly has bugs in it....sorry. Also, this might not be the best way to do this. I dont use Perl nearly as much as I'd like to, and I'm responding mostly as a refresher for myself. I will try and attatch the example from Advanced Perl in hopes the mailer accepts attatchments. If not, I'll send out another post with the source in the text. I hope I helped! -------------- next part -------------- A non-text attachment was scrubbed... Name: oscar.pl Type: application/octet-stream Size: 1311 bytes Desc: not available Url : http://mail.pm.org/archives/norfolk-pm/attachments/20010521/f2f7b6e4/oscar.obj -------------- next part -------------- 1995:Actor:Nicholas Cage 1995:Picture:Braveheart 1995:Supporting Actor:Kevin Spacey 1994:Actor:Tom Hanks 1994:Picture:Forrest Gump 1928:Picture:WINGS From jocknerd at home.com Tue May 22 11:19:13 2001 From: jocknerd at home.com (Jeff Self) Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] Perl beginner looking for a little help In-Reply-To: <001c01c0e26e$c043c280$40941718@CX782347A> Message-ID: Thanks Collin. The reason I have the data in a flat file is because I don't create it myself. I do rankings for college football as well as NFL and there are about 700 college football teams in the country from the big guys all the way down to schools like Newport News Apprentice. So I would hate having to find scores for all these schools or entering them into a database. I download a file every week with all the scores up to that point. In a season, there are about 3500 college football games. Thats why I read from a file and not enter them into a database. I'll look over the code tonight and see if I can get it to work for me. On Mon, 21 May 2001, Collin Cusce' wrote: > Firstly, I would never store something this immense that is only going > to grow more in a flat file. If you are willing to learn a bit about > databases (if you dont know it already) , you might want to consider > transfering your data into one and just run SQL queries on that. Postgres is > my personal choice, but MySQL will do your needs nicely. Trust me, this > makes life a WHOLE lot easier and your data a whole lot less corruptable > (maybe that is just a false sense of security on my part, though). But I > digress. > Unfortunatly, pretty much the full extent of Perl's data structures has > been hacked together by Larry Wall as simple, quick fixes. There isnt true > datatyping in perl ie: nothing like a 'struct' or a real 'class' (from what > I understand Perl 6 will have this, though 8-). There is an example in > Advanced Perl Programming by O'Reilly that seems to be very similar to the > problem you have. I'll include the source from the book and the data it > takes in below, but I'll address your problem, too. > Ok, so you want to create a complex datastructure in Perl. Firstly, you > need to create a sort of consrtuctor function that will alter a main data > srtucutre based on the values you pass into it.You will need a main > datastrucutre, array or hash, that will contain all the data and then you > build functions to navigate that datascructure. This is a quick job I threw > together in a few minutes which probably wont work to your needs and is > buggy, but hopefully it will give you the idea. > my(%games,%teams); > #parameters for enter_game passed in as follows: > #enter_game($date, \$teams{$vis_team}, > \$teams{$home_team}, $vscore,$hscore,$ratio); > sub enter_game{ > my($date, $visitors,$home,$vscore,$hscore,$ratio) = @_; > %thisgame = { > 'date' => $date, > #note, the next to values are references to the > teams, not a copy > 'visitor' => $visitors, > 'home' => $home, > 'vis_score' => $vscore, > 'home_score' => $hscore, > 'ratio' => $ratio > }; > $keyname = $visitor->$name."vs".$home->$name."on:"$date; > $games{$keyname} = \$thisgame; > }; > sub enter_team { > my($name,$won,$lost,$tied,$pf,$pa,$rating); > %team{$name} = { > 'won' => $won, > 'lost' => $lost, > 'tied' => $tied, > 'pf' => $pf, > 'pa' => $pa, > 'rating' => $rating > }; > }; > I hope that is what you are looking for. It most definetly has bugs in > it....sorry. Also, this might not be the best way to do this. I dont use > Perl nearly as much as I'd like to, and I'm responding mostly as a refresher > for myself. > > I will try and attatch the example from Advanced Perl in hopes the mailer > accepts attatchments. If not, I'll send out another post with the source in > the text. I hope I helped! > -- Hard Work Often Pays Off After Time, but Laziness Always Pays Off Now. From cusce at jlab.org Tue May 22 13:11:59 2001 From: cusce at jlab.org (Collin Cusce) Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] Perl beginner looking for a little help References: Message-ID: <001501c0e2ea$b188efa0$f7203981@jlab.org> Ok, if you say so. I really am not sure that I follow your train of thought on that...you could easily eliminate the older entries by comparing the two files and grabing only the rows who's dates are greater than the max date of your in your database and insert those automagically using Perl::DBI. I'm probably missing something, though, so sorry if I came across as a know it all or something. ----- Original Message ----- From: "Jeff Self" To: Sent: Tuesday, May 22, 2001 12:19 PM Subject: Re: [HRPM] Perl beginner looking for a little help > Thanks Collin. The reason I have the data in a flat file is because I > don't create it myself. I do rankings for college football as well as NFL > and there are about 700 college football teams in the country from the big > guys all the way down to schools like Newport News Apprentice. So I would > hate having to find scores for all these schools or entering them into a > database. I download a file every week with all the scores up to that > point. In a season, there are about 3500 college football games. Thats why > I read from a file and not enter them into a database. > > I'll look over the code tonight and see if I can get it to work for me. > > > > On Mon, 21 May 2001, Collin Cusce' wrote: > > > Firstly, I would never store something this immense that is only going > > to grow more in a flat file. If you are willing to learn a bit about > > databases (if you dont know it already) , you might want to consider > > transfering your data into one and just run SQL queries on that. Postgres is > > my personal choice, but MySQL will do your needs nicely. Trust me, this > > makes life a WHOLE lot easier and your data a whole lot less corruptable > > (maybe that is just a false sense of security on my part, though). But I > > digress. > > Unfortunatly, pretty much the full extent of Perl's data structures has > > been hacked together by Larry Wall as simple, quick fixes. There isnt true > > datatyping in perl ie: nothing like a 'struct' or a real 'class' (from what > > I understand Perl 6 will have this, though 8-). There is an example in > > Advanced Perl Programming by O'Reilly that seems to be very similar to the > > problem you have. I'll include the source from the book and the data it > > takes in below, but I'll address your problem, too. > > Ok, so you want to create a complex datastructure in Perl. Firstly, you > > need to create a sort of consrtuctor function that will alter a main data > > srtucutre based on the values you pass into it.You will need a main > > datastrucutre, array or hash, that will contain all the data and then you > > build functions to navigate that datascructure. This is a quick job I threw > > together in a few minutes which probably wont work to your needs and is > > buggy, but hopefully it will give you the idea. > > my(%games,%teams); > > #parameters for enter_game passed in as follows: > > #enter_game($date, \$teams{$vis_team}, > > \$teams{$home_team}, $vscore,$hscore,$ratio); > > sub enter_game{ > > my($date, $visitors,$home,$vscore,$hscore,$ratio) = @_; > > %thisgame = { > > 'date' => $date, > > #note, the next to values are references to the > > teams, not a copy > > 'visitor' => $visitors, > > 'home' => $home, > > 'vis_score' => $vscore, > > 'home_score' => $hscore, > > 'ratio' => $ratio > > }; > > $keyname = $visitor->$name."vs".$home->$name."on:"$date; > > $games{$keyname} = \$thisgame; > > }; > > sub enter_team { > > my($name,$won,$lost,$tied,$pf,$pa,$rating); > > %team{$name} = { > > 'won' => $won, > > 'lost' => $lost, > > 'tied' => $tied, > > 'pf' => $pf, > > 'pa' => $pa, > > 'rating' => $rating > > }; > > }; > > I hope that is what you are looking for. It most definetly has bugs in > > it....sorry. Also, this might not be the best way to do this. I dont use > > Perl nearly as much as I'd like to, and I'm responding mostly as a refresher > > for myself. > > > > I will try and attatch the example from Advanced Perl in hopes the mailer > > accepts attatchments. If not, I'll send out another post with the source in > > the text. I hope I helped! > > > > -- > Hard Work Often Pays Off After Time, but Laziness Always Pays Off Now. > > From cusce at home.com Mon May 28 18:40:47 2001 From: cusce at home.com (Collin Cusce') Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] Implicit vs. Explicit Message-ID: <001101c0e7cf$9f790950$40941718@CX782347A> I have a question regarding the implicit nature of perl. Perl allows the developer to get away with a TON of sorry code for the sake of rapid development. What I'm wondering is does the implicit nature of perl make execution slower or faster. For example, is it faster to say "$length = scalar(@myarray);" rather than to say "$length = @myarray;"? They both do the same thing, only one explicitly observes @myarray in a scalar context and the other is implicit. Is this sort of behavior what makes mod_php ever so slightly faster than mod_perl on SOME benchmarks? Comments? Also, what is going on with the meeting next week? Who's gunna talk, where do we meet, where was everybody last time, and wtf? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/norfolk-pm/attachments/20010528/e7cd9720/attachment.htm From chicks at chicks.net Wed May 30 11:03:45 2001 From: chicks at chicks.net (chicks@chicks.net) Date: Thu Aug 5 00:08:17 2004 Subject: [HRPM] bugger! Message-ID: I'm sorry about not doing anything for a meeting tonight. A close family member has been in the hospital for a few weeks. Tonight's meeting was supposed to be in Norfolk, but I haven't heard anything from Jeff so I don't know if he's planning on doing that or not. I expect to be back with it within a few weeks and I'd be happy to talk at next months meeting about XML. Playing with perl in a few free moments is about the only thing that's kept me sane lately. ;-) Again, please accept my apologies. This is only a temporary chicks outage! -- Any chance of those paper cups and string being upgraded to tin cans and wire? Or as a coworker has said . . . I've seen better throughput from a pair of gorillas and flash cards. -Jon Lewis