baseball reference
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 1097
BaseballNuke 1.0
BaseballNuke is a module for PHP-Nuke that allows for the administration of a baseball team. more>>
BaseballNuke is a module for PHP-Nuke that allows for the administration of a baseball team. BaseballNuke module gives managers of baseball teams a module for the PHP-Nuke CMS to manage their teams roster, stats, and schedules.
The module simplifies team administration and communication to fans. I plan to expand this module to include league management and expand it to other open source CMS projects.
<<lessThe module simplifies team administration and communication to fans. I plan to expand this module to include league management and expand it to other open source CMS projects.
Download (0.050MB)
Added: 2006-05-18 License: GPL (GNU General Public License) Price:
1255 downloads
Baseball::Sabermetrics 0.03
Baseball::Sabermetrics is a baseball statistics module. more>>
Baseball::Sabermetrics is a baseball statistics module.
SYNOPSIS
Baseball::Sabermetrics provides an easy interface for calculating baseball statistics, given a data importer. In this package, Ive written CPBL.pm for (Chinese Professional Baseball League, http://www.cpbl.com.tw).
use Baseball::Sabermetrics;
use Baseball::Sabermetrics::CPBL;
my $league = Baseball::Sabermetrics->new(league => CPBL);
# Actually these are predefined.
# Those data with p_ or _allowed here are for seperating pitchers
# and batters.
$league->define(
rc => ab * obp,
babip => (h_allowed - hr_allowed) / (p_pa - h_allowed - p_so - p_bb - hr_allowed,
# what started with $ will be reserved.
# Players have team and league predefined, and team has league.
formula1 => hr / $_->team->hr;
formula2 => hr / $_->league->hr;
complex => sub {
print "You can write a sub directlyn";
$_->slg - $_->ba;
},
...
);
# Some formulas can be applied to players, teams, and league, depend on what
# columns are used in the formula. For example, ab and obp are defined for
# players, teams, and league, so that rc is available for all of them.
# top 5 obp of teams
$_->print qw/ team name ba obp slg isop / for $league->top(teams, 5, obp);
# top 10 obp of players
$_->print qw/ team name ba obp slg isop / for $league->top(players, 10, obp);
# show a players information
$league->players(Chien-Ming Wang)->print qw/ win lose ip so bb whip go_ao /;
$league->teams(Yankees)->players(Chien-Ming Wang)->print qw/ win lose ip so bb whip go_ao /;
# show team statistics data (accumulated from players)
$league->{Yankees}->print qw/ win lose ip so bb whip go_ao /;
# give a brief report for pitchers/batters of the team
$league->{Yankees}->report_pitchers qw/ name ip p_so p_bb whip go_ab /;
$league->{Yankees}->report_batters qw/ name ba obp slg isop /;
$league->report_teams qw/ name win lose era obp /;
# show all available formula
print join , $league->formula_list;
Data Structure
Baseball::Sabermetrics is aimed for providing a base class of your interested teams (a league, for example). Youll need to provide a data retriever to pull data out. The following example shows how you have to fill data into this structure.
$league = {
teams => {
Yankees => {
players => {
"Chien-Ming Wang" => {
bio => {
bats => right, # coule be left, switch
throws => right,
},
ip => 57.33333333333,
game => 9,
...
fielding => {
p => {
tc => 43,
pop => 4,
...
},
# b1 => { }, b2 => { }, b3 => { },
# first, second and thrid baseman should be
# b1, b2, and b3 respectively for convenient in
# fielding context. Because the initial of the
# name of subroutine cant be a number in perl.
},
};
...
}
},
Athletics => {
...
},
},
};
TERMS
Available terms of players (including teams and league, which are accumulated from players and could be treated as an abstract player) are:
# pitching
p_game win lose tie gs sv bs hld cg sho ip p_pa np h_allowed
hr_allowed sh_allowed sf_allowed p_bb p_ibb hb p_so wp bk ra er
# batting
pa ab rbi r h 1b 2b 3b hr tb dp sh sf ibb bb hbp so sb cs
tc po a e f_dp ppo tp pb c_cs c_sb
# fielding
pos fgame tc po a e f_dp tp pb c_cs c_sb
And there are additional terms for team:
game win lose tie
<<lessSYNOPSIS
Baseball::Sabermetrics provides an easy interface for calculating baseball statistics, given a data importer. In this package, Ive written CPBL.pm for (Chinese Professional Baseball League, http://www.cpbl.com.tw).
use Baseball::Sabermetrics;
use Baseball::Sabermetrics::CPBL;
my $league = Baseball::Sabermetrics->new(league => CPBL);
# Actually these are predefined.
# Those data with p_ or _allowed here are for seperating pitchers
# and batters.
$league->define(
rc => ab * obp,
babip => (h_allowed - hr_allowed) / (p_pa - h_allowed - p_so - p_bb - hr_allowed,
# what started with $ will be reserved.
# Players have team and league predefined, and team has league.
formula1 => hr / $_->team->hr;
formula2 => hr / $_->league->hr;
complex => sub {
print "You can write a sub directlyn";
$_->slg - $_->ba;
},
...
);
# Some formulas can be applied to players, teams, and league, depend on what
# columns are used in the formula. For example, ab and obp are defined for
# players, teams, and league, so that rc is available for all of them.
# top 5 obp of teams
$_->print qw/ team name ba obp slg isop / for $league->top(teams, 5, obp);
# top 10 obp of players
$_->print qw/ team name ba obp slg isop / for $league->top(players, 10, obp);
# show a players information
$league->players(Chien-Ming Wang)->print qw/ win lose ip so bb whip go_ao /;
$league->teams(Yankees)->players(Chien-Ming Wang)->print qw/ win lose ip so bb whip go_ao /;
# show team statistics data (accumulated from players)
$league->{Yankees}->print qw/ win lose ip so bb whip go_ao /;
# give a brief report for pitchers/batters of the team
$league->{Yankees}->report_pitchers qw/ name ip p_so p_bb whip go_ab /;
$league->{Yankees}->report_batters qw/ name ba obp slg isop /;
$league->report_teams qw/ name win lose era obp /;
# show all available formula
print join , $league->formula_list;
Data Structure
Baseball::Sabermetrics is aimed for providing a base class of your interested teams (a league, for example). Youll need to provide a data retriever to pull data out. The following example shows how you have to fill data into this structure.
$league = {
teams => {
Yankees => {
players => {
"Chien-Ming Wang" => {
bio => {
bats => right, # coule be left, switch
throws => right,
},
ip => 57.33333333333,
game => 9,
...
fielding => {
p => {
tc => 43,
pop => 4,
...
},
# b1 => { }, b2 => { }, b3 => { },
# first, second and thrid baseman should be
# b1, b2, and b3 respectively for convenient in
# fielding context. Because the initial of the
# name of subroutine cant be a number in perl.
},
};
...
}
},
Athletics => {
...
},
},
};
TERMS
Available terms of players (including teams and league, which are accumulated from players and could be treated as an abstract player) are:
# pitching
p_game win lose tie gs sv bs hld cg sho ip p_pa np h_allowed
hr_allowed sh_allowed sf_allowed p_bb p_ibb hb p_so wp bk ra er
# batting
pa ab rbi r h 1b 2b 3b hr tb dp sh sf ibb bb hbp so sb cs
tc po a e f_dp ppo tp pb c_cs c_sb
# fielding
pos fgame tc po a e f_dp tp pb c_cs c_sb
And there are additional terms for team:
game win lose tie
Download (0.030MB)
Added: 2007-01-04 License: Perl Artistic License Price:
1025 downloads
Web Reference Database 0.9.0
Web Reference Database is a bibliographic manager that can import and export references in various formats. more>>
Web Reference Database is a bibliographic manager that can import and export references in various formats (including BibTeX, Endnote, MODS XML, and OpenOffice).
It can make formatted lists of citations in HTML, RTF, PDF, or LaTeX, and offers powerful searching, rich metadata, and RSS support
Enhancements:
- This release offers major function enhancements and bugfixes.
- Batch import from various bibliographic formats (including BibTeX, Endnote, RIS, ISI, and MODS XML) is now supported, as is import from a PubMed ID.
- An OpenDocument spreadsheet for use with OpenOffice.org can be exported, and formatted citation lists can be generated as HTML, RTF, PDF, or LaTeX. An SRU/W service and support for unAPI, OpenURL, and COinS metadata have been added.
- These allow the data to be used by the next generation of bibliographic clients.
- A new command line client is also included.
<<lessIt can make formatted lists of citations in HTML, RTF, PDF, or LaTeX, and offers powerful searching, rich metadata, and RSS support
Enhancements:
- This release offers major function enhancements and bugfixes.
- Batch import from various bibliographic formats (including BibTeX, Endnote, RIS, ISI, and MODS XML) is now supported, as is import from a PubMed ID.
- An OpenDocument spreadsheet for use with OpenOffice.org can be exported, and formatted citation lists can be generated as HTML, RTF, PDF, or LaTeX. An SRU/W service and support for unAPI, OpenURL, and COinS metadata have been added.
- These allow the data to be used by the next generation of bibliographic clients.
- A new command line client is also included.
Download (0.89MB)
Added: 2006-10-27 License: GPL (GNU General Public License) Price:
1093 downloads
pygtk2reference 2.9.0
pygtk2reference describes the classes of the Python PyGTK module. more>>
pygtk2reference describes the classes of the Python PyGTK module.
This document describes most of the PyGTK version 2.0 through 2.6 classes and their methods and associated functions.
Deprecated classes, functions and methods have been specifically left out of this reference though classes that have become deprecated since PyGTK 2.0 have been left in but annotated with a deprecation warning.
I have attempted to document as much of the PyGTK API as I can but there are undoubtedly errors and omissions.
This reference describes the API for PyGTK as of version 2.5.0+ and assumes that the additional API changes for version 2.6 may be significant. There will undoubtedly be changes that are not reflected in this reference.
The differences in the API between version 2.0 and previous versions are denoted in this reference with a Note that describes the availability of the object, constructor, method or function. Any of these that do not have a notation can be assumed to be available in all versions of PyGTK from 2.0 and up.
In the case of properties and signals the availability is dependent on the version of the underlying GTK+, GDK or Pango libraries. These will be annotated appropriately in a similar fashion. The source code must be consulted if this reference and your version of PyGTK seem to differ. You are encouraged to use the latest version of PyGTK that is available.
<<lessThis document describes most of the PyGTK version 2.0 through 2.6 classes and their methods and associated functions.
Deprecated classes, functions and methods have been specifically left out of this reference though classes that have become deprecated since PyGTK 2.0 have been left in but annotated with a deprecation warning.
I have attempted to document as much of the PyGTK API as I can but there are undoubtedly errors and omissions.
This reference describes the API for PyGTK as of version 2.5.0+ and assumes that the additional API changes for version 2.6 may be significant. There will undoubtedly be changes that are not reflected in this reference.
The differences in the API between version 2.0 and previous versions are denoted in this reference with a Note that describes the availability of the object, constructor, method or function. Any of these that do not have a notation can be assumed to be available in all versions of PyGTK from 2.0 and up.
In the case of properties and signals the availability is dependent on the version of the underlying GTK+, GDK or Pango libraries. These will be annotated appropriately in a similar fashion. The source code must be consulted if this reference and your version of PyGTK seem to differ. You are encouraged to use the latest version of PyGTK that is available.
Download (1.1MB)
Added: 2006-07-10 License: (FDL) GNU Free Documentation License Price:
1201 downloads
Other version of pygtk2reference
License:(FDL) GNU Free Documentation License
Games::Baseball::Scorecard 0.03
Games::Baseball::Scorecard is a Perl module. more>>
Games::Baseball::Scorecard is a Perl module.
SYNOPSIS
my $score = Games::Baseball::Scorecard->new($dir, $name, {
color => [ .4, .4, .4 ], # grey
fonts => [ # Myriad Condensed regular/bold
[ myriadrcrrl => 9 ],
[ myriadrcbrl => 14 ],
[ myriadrcrrl => 14 ],
[ myriadrcbrl => 22 ],
],
});
# fill initial scorecard out
$s->init({
scorer => Pudge,
date => 2004-10-24, 20:05-23:25,
at => Fenway Park, Boston,
temp => 48 clear,
wind => 7 to RF,
att => 35,001,
home => {
team => Boston Red Sox,
starter => 38, # jersey number
lineup => [
# [ num, position ],
[ 18, 8 ], # Damon, starting at CF
# ...
],
roster => {
# num => name
18 => Damon, Johnny,
38 => Schilling, Curt,
# ...
},
},
away => {
team => St. Louis Cardinals,
# ...
}
});
# draw the game
$s->inn; # new inning / end of last inning
$s->ab; # new at-bat
# works to full count
$s->pitches(qw(s b s b b f));
# struck out looking
$s->out(!K);
$s->ab;
# home run to left-center
$s->hit(4, lc);
# calculate/draw stats
$self->totals;
# finish the job
$s->generate;
# open final PDF
$s->pdfopen;
Games::Baseball::Scorecard is a frontend to a PDF scorecard written in Metapost by Christopher Swingley (http://www.frontier.iarc.uaf.edu/~cswingle/baseball/scorecards.php). That scorecard is drawn out, and has a nice API for actually drawing out the elements of the game: all the ball, strikes, outs, etc.
Being Metapost, it is laborious to do all this. So this module provides a nice frontend, that also keeps track of balls and strikes and hits and runs and outs and more, making input of the game quite simple and efficient.
This module does not include the entire API, but most of it. Patches and ideas welcome. Feel free to call output directly if you want to generate Metapost on your own, or to modify the $SCORECARD variable (which contains the base Metapost code), or the $TEX (single page) and $TEXD (duplex) TeX files.
I wont give a tutorial on scoring baseball games, or on Metapost, below. Seek other resources (Swingleys URL above has a nice tutorial on scoring baseball games, using the scorecard he designed, which is what were using here).
<<lessSYNOPSIS
my $score = Games::Baseball::Scorecard->new($dir, $name, {
color => [ .4, .4, .4 ], # grey
fonts => [ # Myriad Condensed regular/bold
[ myriadrcrrl => 9 ],
[ myriadrcbrl => 14 ],
[ myriadrcrrl => 14 ],
[ myriadrcbrl => 22 ],
],
});
# fill initial scorecard out
$s->init({
scorer => Pudge,
date => 2004-10-24, 20:05-23:25,
at => Fenway Park, Boston,
temp => 48 clear,
wind => 7 to RF,
att => 35,001,
home => {
team => Boston Red Sox,
starter => 38, # jersey number
lineup => [
# [ num, position ],
[ 18, 8 ], # Damon, starting at CF
# ...
],
roster => {
# num => name
18 => Damon, Johnny,
38 => Schilling, Curt,
# ...
},
},
away => {
team => St. Louis Cardinals,
# ...
}
});
# draw the game
$s->inn; # new inning / end of last inning
$s->ab; # new at-bat
# works to full count
$s->pitches(qw(s b s b b f));
# struck out looking
$s->out(!K);
$s->ab;
# home run to left-center
$s->hit(4, lc);
# calculate/draw stats
$self->totals;
# finish the job
$s->generate;
# open final PDF
$s->pdfopen;
Games::Baseball::Scorecard is a frontend to a PDF scorecard written in Metapost by Christopher Swingley (http://www.frontier.iarc.uaf.edu/~cswingle/baseball/scorecards.php). That scorecard is drawn out, and has a nice API for actually drawing out the elements of the game: all the ball, strikes, outs, etc.
Being Metapost, it is laborious to do all this. So this module provides a nice frontend, that also keeps track of balls and strikes and hits and runs and outs and more, making input of the game quite simple and efficient.
This module does not include the entire API, but most of it. Patches and ideas welcome. Feel free to call output directly if you want to generate Metapost on your own, or to modify the $SCORECARD variable (which contains the base Metapost code), or the $TEX (single page) and $TEXD (duplex) TeX files.
I wont give a tutorial on scoring baseball games, or on Metapost, below. Seek other resources (Swingleys URL above has a nice tutorial on scoring baseball games, using the scorecard he designed, which is what were using here).
Download (0.34MB)
Added: 2006-07-31 License: GPL (GNU General Public License) Price:
710 downloads
WWW::Baseball::NPB 0.03
WWW::Baseball::NPB is a Perl module that fetches Japanese baseball games information. more>>
WWW::Baseball::NPB is a Perl module that fetches Japanese baseball games information.
SYNOPSIS
use WWW::Baseball::NPB;
my $baseball = WWW::Baseball::NPB->new;
my @games = $baseball->games;
# or @games = $baseball->games(central);
for my $game (@games) {
my $home = $game->home;
my $visitor = $game->visitor;
printf "%s %d - %d %s (%s) [%s]n",
$home, $game->score($home), $game->score($visitor), $visitor,
$game->status, $game->stadium;
}
WWW::Baseball::NPB provides you a way to fetch and extract Japanese baseball games information via Yahoo! Baseball. (NPB = Nippon Professional Baseball)
<<lessSYNOPSIS
use WWW::Baseball::NPB;
my $baseball = WWW::Baseball::NPB->new;
my @games = $baseball->games;
# or @games = $baseball->games(central);
for my $game (@games) {
my $home = $game->home;
my $visitor = $game->visitor;
printf "%s %d - %d %s (%s) [%s]n",
$home, $game->score($home), $game->score($visitor), $visitor,
$game->status, $game->stadium;
}
WWW::Baseball::NPB provides you a way to fetch and extract Japanese baseball games information via Yahoo! Baseball. (NPB = Nippon Professional Baseball)
Download (0.010MB)
Added: 2006-12-14 License: Perl Artistic License Price:
1044 downloads
NetStats Baseball 0.9.1
NetStats Baseball project consists of a simulation of major league baseball. more>>
NetStats Baseball project consists of a simulation of major league baseball.
NetStats Baseball is a simulation of major league baseball which will play single games and entire seasons.
It will keep statistics for the individual players and the teams. It will keep track of the season schedule as well as seasonal and lifetime records.
Enhancements:
- Separate two compound assignments where x and x++ were used; this technically isnt well-defined in C and could cause portability problems
- Fix a call of strncpy() to strcpy()
- Remove prototypes for string.h functions in editdata/glob.h; replace with an include of the standard header (causes potential portability problems since these arent declared the same way on all systems)
- correct possible segfault after the welcome screen
- code cleanup
- include current half inning on game-play display
- no parameters now acceptable with client (playbb) ..in this case client connects to localhost
- "help" is printable
- real-life season results are available
- implement autoconf
<<lessNetStats Baseball is a simulation of major league baseball which will play single games and entire seasons.
It will keep statistics for the individual players and the teams. It will keep track of the season schedule as well as seasonal and lifetime records.
Enhancements:
- Separate two compound assignments where x and x++ were used; this technically isnt well-defined in C and could cause portability problems
- Fix a call of strncpy() to strcpy()
- Remove prototypes for string.h functions in editdata/glob.h; replace with an include of the standard header (causes potential portability problems since these arent declared the same way on all systems)
- correct possible segfault after the welcome screen
- code cleanup
- include current half inning on game-play display
- no parameters now acceptable with client (playbb) ..in this case client connects to localhost
- "help" is printable
- real-life season results are available
- implement autoconf
Download (0.20MB)
Added: 2007-01-10 License: Freely Distributable Price:
1018 downloads
XML::DOM::EntityReference 1.44
XML::DOM::EntityReference is an XML ENTITY reference in XML::DOM. more>>
XML::DOM::EntityReference is an XML ENTITY reference in XML::DOM.
XML::DOM::EntityReference extends XML::DOM::Node.
EntityReference objects may be inserted into the structure model when an entity reference is in the source document, or when the user wishes to insert an entity reference. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference.
Moreover, the XML processor may completely expand references to entities while building the structure model, instead of providing EntityReference objects. If it does provide such objects, then for a given EntityReference node, it may be that there is no Entity node representing the referenced entity; but if such an Entity exists, then the child list of the EntityReference node is the same as that of the Entity node. As with the Entity node, all descendants of the EntityReference are readonly.
The resolution of the children of the EntityReference (the replacement value of the referenced Entity) may be lazily evaluated; actions by the user (such as calling the childNodes method on the EntityReference node) are assumed to trigger the evaluation.
<<lessXML::DOM::EntityReference extends XML::DOM::Node.
EntityReference objects may be inserted into the structure model when an entity reference is in the source document, or when the user wishes to insert an entity reference. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference.
Moreover, the XML processor may completely expand references to entities while building the structure model, instead of providing EntityReference objects. If it does provide such objects, then for a given EntityReference node, it may be that there is no Entity node representing the referenced entity; but if such an Entity exists, then the child list of the EntityReference node is the same as that of the Entity node. As with the Entity node, all descendants of the EntityReference are readonly.
The resolution of the children of the EntityReference (the replacement value of the referenced Entity) may be lazily evaluated; actions by the user (such as calling the childNodes method on the EntityReference node) are assumed to trigger the evaluation.
Download (0.039MB)
Added: 2006-10-13 License: Perl Artistic License Price:
1106 downloads
Objective Modula-2 1.00 (Reference Implementation)
Objective Modula-2 programming language is a hybrid between Smalltalk and Modula-2. more>>
Objective Modula-2 programming language is a hybrid between Smalltalk and Modula-2 based on the object model and runtime of Objective-C.
The design is an example how native Cocoa/GNUstep support can be added to static imperative programming languages without implementing a bridge.
Objective Modula-2s scope encompasses the design of the Objective Modula-2 programming language and the implementation of a compiler to implement it. The initial compiler will generate Objective-C source code.
Enhancements:
- This code is used to verify ideas and concepts which come up in the course of defining the language.
- It is in an early stage, incomplete and subject to frequent changes.
<<lessThe design is an example how native Cocoa/GNUstep support can be added to static imperative programming languages without implementing a bridge.
Objective Modula-2s scope encompasses the design of the Objective Modula-2 programming language and the implementation of a compiler to implement it. The initial compiler will generate Objective-C source code.
Enhancements:
- This code is used to verify ideas and concepts which come up in the course of defining the language.
- It is in an early stage, incomplete and subject to frequent changes.
Download (0.019MB)
Added: 2007-07-21 License: (FDL) GNU Free Documentation License Price:
825 downloads
UML::Sequence 0.07
UML::Sequence is a Perl module to render UML sequence diagrams, often by running the code. more>>
UML::Sequence is a Perl module to render UML sequence diagrams, often by running the code.
SYNOPSIS
use UML::Sequence;
my $tree = UML::Sequence->new(@methods, @outline, &parse_method);
print $tree->build_xml_sequence(Title);
To use this package, or see how to use it, see genericseq.pl and seq2svg.pl.
This class helps produce UML sequence diagrams. build_xml_sequence returns a string (suitable for printing to a file) which the seq2svg.pl script converts into svg.
To control the appearance of the sequence diagram, pass to the constructor:
1 a reference to an array containing the signatures you want to hear about or a reference to a hash whose keys are the signatures you want 2 a reference to an array containing the lines in the outline of calls 3 a reference to a sub which takes signatures and returns class and method names
To build the array references and supply the code reference consult UML::Sequence::SimpleSeq, UML::Sequence::JavaSeq, or UML::Sequence::PerlSeq. To see one way to call these look in the supplied genericseq script.
<<lessSYNOPSIS
use UML::Sequence;
my $tree = UML::Sequence->new(@methods, @outline, &parse_method);
print $tree->build_xml_sequence(Title);
To use this package, or see how to use it, see genericseq.pl and seq2svg.pl.
This class helps produce UML sequence diagrams. build_xml_sequence returns a string (suitable for printing to a file) which the seq2svg.pl script converts into svg.
To control the appearance of the sequence diagram, pass to the constructor:
1 a reference to an array containing the signatures you want to hear about or a reference to a hash whose keys are the signatures you want 2 a reference to an array containing the lines in the outline of calls 3 a reference to a sub which takes signatures and returns class and method names
To build the array references and supply the code reference consult UML::Sequence::SimpleSeq, UML::Sequence::JavaSeq, or UML::Sequence::PerlSeq. To see one way to call these look in the supplied genericseq script.
Download (0.12MB)
Added: 2007-04-23 License: Perl Artistic License Price:
916 downloads
Class::DBI::Plugin::FilterOnClick 1.0
Class::DBI::Plugin::FilterOnClick is a Perl module to generate browsable and searchable HTML Tables. more>>
Class::DBI::Plugin::FilterOnClick is a Perl module to generate browsable and searchable HTML Tables using FilterOnClick in conjunction with Class::DBI.
SYNOPSIS
# Inside of your sub-class of Class::DBI add these lines:
use Class::DBI::Plugin::FilterOnClick;
use Class::DBI::Pager;
use Class::DBI::AbstractSearch;
use Class::DBI::Plugin::AbstractCount;
use Class::DBI::Plugin::RetrieveAll;
.....
# Inside your script you will be able to use this modules
# methods on your table class or object as needed.
use ClassDBIBaseClass;
use URI::Escape;
use CGI;
my $cgi = CGI->new();
my %params;
map { $params{$_} =
uri_unescape($cgi->param("$_"))
} $cgi->param();
my $filteronclick = Baseball::Master->filteronclick(
-config_file => /srv/www/cgi-bin/baseball.ini,
# -rows => $cgi->param(rows) || 15 ,
-on_page => $cgi->param(page) || 1,
-params => %params );
$filteronclick->field_to_column(
lastname => Last Name . $html->order_by_link(lastname),
firstname => First Name . $html->order_by_link(firstname),
bats => Bats,
throws => Throws,
ht_ft => Height Ft,
ht_in => In,
wt => Weight,
birthyear => Birthyear,
birthstate => Birthstate,
_FilterOnClickCustom1_ => Other Data,
_FilterOnClickCustom2_ => More Data
);
FilterOnClickCustom
$filteronclick->data_table->addRow(
Last Name,
First Name,
Bats ,
Throws ,
Height (ft),
(inches),
Weight,
Birth Year );
$filteronclick->params( $cgi->Vars; );
$filteronclick->exclude_from_url([ page ]);
# indicate which columns to exclude, inverse of display above
# can be set in config file as well
$filteronclick->exclude_columns();
# indicate the base class to work with, this is optional,
# if you should create you object via a call to
# Class::DBI::Plugin::FilterOnClick vs. a Class::DBI sub class
# this assures the correct sub class is used for data collection
$filteronclick->cdbi_class( Baseball::Master );
# indicate the style of navigation to provide
$filteronclick->navigation_style( both );
print qq~ Filter by First Letter of Last Name ~;
print $filteronclick->string_filter_navigation(
-column => lastname,
-position => begins,
);
print qq~ ~;
$filteronclick->only(firstname);
print $filteronclick->build_table(
_FilterOnClickCustom1_ => sub {
my $pid = shift; # pid = Primary ID of the record in the base table
my @status_objects = Baseball::Allstars->search(lahmanid => $pid);
if (@status_objects) {
my $years;
foreach my $st (@status_objects) {
$years .= $st->year() . " ";
}
return $years;
}
return NA;
},
_FilterOnClickCustom2_ => sub {
my $pid = shift; # pid = Primary ID of the record in the base table
my @status_objects = Baseball::Allstars->search(lahmanid => $pid);
if (@status_objects) {
my $teams;
foreach my $st (@status_objects) {
$teams .= $st->team() . " ";
}
return $teams;
}
return NA;
},
);
my $nav = $filteronclick->html_table_navigation();
print qq!
$filteronclick->add_bottom_span($nav);
print $filteronclick->data_table;
UPGRADE WARNING
As of the .8 release there have been changes to the methods and how they work. It is likely that scripts built with older versions WILL break. Please read below to find specific changes that may negatively impact scripts built using the the releases prior to .8. The 1.0 release contains some minor modifications that could in some chases break your scripts, test carefully before upgrading in a production environment.
The intention of this module is to simplify the creation of browsable and searchable HTML tables without having to write the HTML, either in your script or in templates.
It is intended for use inside of other frameworks such as Embperl, Apache::ASP or even CGI. It does not aspire to be its own framework. If you are looking for a frameworks which allow using Class::DBI I suggest you look into the Maypole or the Catalyst module.
See FilterOnClick below for more on the purpose of this module.
Tables are created using HTML::Table. The use of HTML::Table was selected because it allows for several advanced sorting techniques that can provide for easy manipulation of the data outside of the SQL statement. This is very useful in scenarios where you want to provide/test a sort routine and not write SQL for it. The more I use this utility the less likely it seems that one would need to leverage this, but it is an option if you want to explore it.
Feedback on this module, its interface, usage, documentation etc. is welcome.
<<lessSYNOPSIS
# Inside of your sub-class of Class::DBI add these lines:
use Class::DBI::Plugin::FilterOnClick;
use Class::DBI::Pager;
use Class::DBI::AbstractSearch;
use Class::DBI::Plugin::AbstractCount;
use Class::DBI::Plugin::RetrieveAll;
.....
# Inside your script you will be able to use this modules
# methods on your table class or object as needed.
use ClassDBIBaseClass;
use URI::Escape;
use CGI;
my $cgi = CGI->new();
my %params;
map { $params{$_} =
uri_unescape($cgi->param("$_"))
} $cgi->param();
my $filteronclick = Baseball::Master->filteronclick(
-config_file => /srv/www/cgi-bin/baseball.ini,
# -rows => $cgi->param(rows) || 15 ,
-on_page => $cgi->param(page) || 1,
-params => %params );
$filteronclick->field_to_column(
lastname => Last Name . $html->order_by_link(lastname),
firstname => First Name . $html->order_by_link(firstname),
bats => Bats,
throws => Throws,
ht_ft => Height Ft,
ht_in => In,
wt => Weight,
birthyear => Birthyear,
birthstate => Birthstate,
_FilterOnClickCustom1_ => Other Data,
_FilterOnClickCustom2_ => More Data
);
FilterOnClickCustom
$filteronclick->data_table->addRow(
Last Name,
First Name,
Bats ,
Throws ,
Height (ft),
(inches),
Weight,
Birth Year );
$filteronclick->params( $cgi->Vars; );
$filteronclick->exclude_from_url([ page ]);
# indicate which columns to exclude, inverse of display above
# can be set in config file as well
$filteronclick->exclude_columns();
# indicate the base class to work with, this is optional,
# if you should create you object via a call to
# Class::DBI::Plugin::FilterOnClick vs. a Class::DBI sub class
# this assures the correct sub class is used for data collection
$filteronclick->cdbi_class( Baseball::Master );
# indicate the style of navigation to provide
$filteronclick->navigation_style( both );
print qq~ Filter by First Letter of Last Name ~;
print $filteronclick->string_filter_navigation(
-column => lastname,
-position => begins,
);
print qq~ ~;
$filteronclick->only(firstname);
print $filteronclick->build_table(
_FilterOnClickCustom1_ => sub {
my $pid = shift; # pid = Primary ID of the record in the base table
my @status_objects = Baseball::Allstars->search(lahmanid => $pid);
if (@status_objects) {
my $years;
foreach my $st (@status_objects) {
$years .= $st->year() . " ";
}
return $years;
}
return NA;
},
_FilterOnClickCustom2_ => sub {
my $pid = shift; # pid = Primary ID of the record in the base table
my @status_objects = Baseball::Allstars->search(lahmanid => $pid);
if (@status_objects) {
my $teams;
foreach my $st (@status_objects) {
$teams .= $st->team() . " ";
}
return $teams;
}
return NA;
},
);
my $nav = $filteronclick->html_table_navigation();
print qq!
$nav
n!; $filteronclick->add_bottom_span($nav);
print $filteronclick->data_table;
UPGRADE WARNING
As of the .8 release there have been changes to the methods and how they work. It is likely that scripts built with older versions WILL break. Please read below to find specific changes that may negatively impact scripts built using the the releases prior to .8. The 1.0 release contains some minor modifications that could in some chases break your scripts, test carefully before upgrading in a production environment.
The intention of this module is to simplify the creation of browsable and searchable HTML tables without having to write the HTML, either in your script or in templates.
It is intended for use inside of other frameworks such as Embperl, Apache::ASP or even CGI. It does not aspire to be its own framework. If you are looking for a frameworks which allow using Class::DBI I suggest you look into the Maypole or the Catalyst module.
See FilterOnClick below for more on the purpose of this module.
Tables are created using HTML::Table. The use of HTML::Table was selected because it allows for several advanced sorting techniques that can provide for easy manipulation of the data outside of the SQL statement. This is very useful in scenarios where you want to provide/test a sort routine and not write SQL for it. The more I use this utility the less likely it seems that one would need to leverage this, but it is an option if you want to explore it.
Feedback on this module, its interface, usage, documentation etc. is welcome.
Download (0.024MB)
Added: 2006-11-29 License: Perl Artistic License Price:
1060 downloads
Math::Amoeba 0.04
Math::Amoeba is a Multidimensional Function Minimization. more>>
Math::Amoeba is a Multidimensional Function Minimization.
SYNOPSIS
use Math::Amoeba qw(ConstructVertices EvaluateVertices Amoeba MinimiseND);
my ($vertice,$y)=MinimiseND(@guess,@scales,&func,$tol,$itmax,$verbose);
my @vertices=ConstructVertices(@vector,@offsets);
my @y=EvaluateVertices(@vertices,&func);
my ($vertice,$y)=Amoeba(@vertices,@y,&func,$tol,$itmax,$verbose);
This is an implementation of the Downhill Simpex Method in Multidimensions (Nelder and Mead) for finding the (local) minimum of a function. Doing this in Perl makes it easy for that function to actually be the output of another program such as a simulator.
Arrays and the function are passed by reference to the routines.
The simplest use is the MinimiseND function. This takes a reference to an array of guess values for the parameters at the function minimum, a reference to an array of scales for these parameters (sensible ranges around the guess in which to look), a reference to the function, a convergence tolerance for the minimum, the maximum number of iterations to be taken and the verbose flag (default ON). It returns an array consisting of a reference to the function parameters at the minimum and the value there.
The Amoeba function is the actual implementation of the Downhill Simpex Method in Multidimensions. It takes a reference to an array of references to arrays which are the initial n+1 vertices (where n is the number of function parameters), a reference to the function valuation at these vertices, a reference to the function, a convergence tolerance for the minimum, the maximum number of iterations to be taken and the verbose flag (default ON). It returns an array consisting of a reference to the function parameters at the minimum and the value there.
The ConstructVertices is used by MinimiseND to construct the initial vertices for Amoeba as the initial guess plus the parameter scale parameters as vectors along the parameter axis.
The EvaluateVertices takes these set of vertices, calling the function for each one and returning the vector of results.
EXAMPLE
use Math::Amoeba qw(MinimiseND);
sub afunc {
my ($a,$b)=@_;
print "$at$bn";
return ($a-7)**2+($b+3)**2;
}
my @guess=(1,1);
my @scale=(1,1);
($p,$y)=MinimiseND(@guess,@scale,&afunc,1e-7,100);
print "(",join(,,@{$p}),")=$yn";
produces the output
(6.99978191653352,-2.99981241563247)=1.00000008274829
<<lessSYNOPSIS
use Math::Amoeba qw(ConstructVertices EvaluateVertices Amoeba MinimiseND);
my ($vertice,$y)=MinimiseND(@guess,@scales,&func,$tol,$itmax,$verbose);
my @vertices=ConstructVertices(@vector,@offsets);
my @y=EvaluateVertices(@vertices,&func);
my ($vertice,$y)=Amoeba(@vertices,@y,&func,$tol,$itmax,$verbose);
This is an implementation of the Downhill Simpex Method in Multidimensions (Nelder and Mead) for finding the (local) minimum of a function. Doing this in Perl makes it easy for that function to actually be the output of another program such as a simulator.
Arrays and the function are passed by reference to the routines.
The simplest use is the MinimiseND function. This takes a reference to an array of guess values for the parameters at the function minimum, a reference to an array of scales for these parameters (sensible ranges around the guess in which to look), a reference to the function, a convergence tolerance for the minimum, the maximum number of iterations to be taken and the verbose flag (default ON). It returns an array consisting of a reference to the function parameters at the minimum and the value there.
The Amoeba function is the actual implementation of the Downhill Simpex Method in Multidimensions. It takes a reference to an array of references to arrays which are the initial n+1 vertices (where n is the number of function parameters), a reference to the function valuation at these vertices, a reference to the function, a convergence tolerance for the minimum, the maximum number of iterations to be taken and the verbose flag (default ON). It returns an array consisting of a reference to the function parameters at the minimum and the value there.
The ConstructVertices is used by MinimiseND to construct the initial vertices for Amoeba as the initial guess plus the parameter scale parameters as vectors along the parameter axis.
The EvaluateVertices takes these set of vertices, calling the function for each one and returning the vector of results.
EXAMPLE
use Math::Amoeba qw(MinimiseND);
sub afunc {
my ($a,$b)=@_;
print "$at$bn";
return ($a-7)**2+($b+3)**2;
}
my @guess=(1,1);
my @scale=(1,1);
($p,$y)=MinimiseND(@guess,@scale,&afunc,1e-7,100);
print "(",join(,,@{$p}),")=$yn";
produces the output
(6.99978191653352,-2.99981241563247)=1.00000008274829
Download (0.004MB)
Added: 2007-08-14 License: Perl Artistic License Price:
801 downloads
Convert::Bencode_XS 0.05
Convert::Bencode_XS is a Perl module for faster conversions to/from Bencode format. more>>
Convert::Bencode_XS is a Perl module for faster conversions to/from Bencode format.
SYNOPSIS
use Convert::Bencode_XS qw(bencode bdecode);
use Data::Dumper;
print "Serializing:n", bencode([123, [], "XXX"]), "nn";
print Dumper bdecode(d3:fool3:bar4:stube6:numberi123ee);
__END__
Serializing:
li123el0:e3:XXXe
$VAR1 = {
number => 123,
foo => [
bar,
stub
]
};
bencode($stuff)
Returns a bencoded string representing whats in $stuff. $stuff can be either a scalar, an array reference or a hash reference. Every nesting of these data structures is allowed, other ones will croak.
bdecode($bencoded)
Returns a Perl data structure: it could be either a scalar, array reference or hash reference depending on whats in $bencoded. Dictionaries are converted in hashes, lists in arrays, scalars in strings. If $COERCE (see below) is set to a false value then scalars encoded like integers will be cleanse() before being returned so that a re-serialization of the structure will give back exactly the same bencoded string.
Enhancements:
- Perl
<<lessSYNOPSIS
use Convert::Bencode_XS qw(bencode bdecode);
use Data::Dumper;
print "Serializing:n", bencode([123, [], "XXX"]), "nn";
print Dumper bdecode(d3:fool3:bar4:stube6:numberi123ee);
__END__
Serializing:
li123el0:e3:XXXe
$VAR1 = {
number => 123,
foo => [
bar,
stub
]
};
bencode($stuff)
Returns a bencoded string representing whats in $stuff. $stuff can be either a scalar, an array reference or a hash reference. Every nesting of these data structures is allowed, other ones will croak.
bdecode($bencoded)
Returns a Perl data structure: it could be either a scalar, array reference or hash reference depending on whats in $bencoded. Dictionaries are converted in hashes, lists in arrays, scalars in strings. If $COERCE (see below) is set to a false value then scalars encoded like integers will be cleanse() before being returned so that a re-serialization of the structure will give back exactly the same bencoded string.
Enhancements:
- Perl
Download (0.009MB)
Added: 2006-08-23 License: Perl Artistic License Price:
1158 downloads
Scalar::Util 1.19
Scalar::Util is a selection of general-utility scalar subroutines. more>>
Scalar::Util is a selection of general-utility scalar subroutines.
SYNOPSIS
use Scalar::Util qw(blessed dualvar isweak readonly refaddr reftype tainted
weaken isvstring looks_like_number set_prototype);
Scalar::Util contains a selection of subroutines that people have expressed would be nice to have in the perl core, but the usage would not really be high enough to warrant the use of a keyword, and the size so small such that being individual extensions would be wasteful.
By default Scalar::Util does not export any subroutines. The subroutines defined are
blessed EXPR
If EXPR evaluates to a blessed reference the name of the package that it is blessed into is returned. Otherwise undef is returned.
$scalar = "foo";
$class = blessed $scalar; # undef
$ref = [];
$class = blessed $ref; # undef
$obj = bless [], "Foo";
$class = blessed $obj; # "Foo"
dualvar NUM, STRING
Returns a scalar that has the value NUM in a numeric context and the value STRING in a string context.
$foo = dualvar 10, "Hello";
$num = $foo + 2; # 12
$str = $foo . " world"; # Hello world
isvstring EXPR
If EXPR is a scalar which was coded as a vstring the result is true.
$vs = v49.46.48;
$fmt = isvstring($vs) ? "%vd" : "%s"; #true
printf($fmt,$vs);
isweak EXPR
If EXPR is a scalar which is a weak reference the result is true.
$ref = $foo;
$weak = isweak($ref); # false
weaken($ref);
$weak = isweak($ref); # true
NOTE: Copying a weak reference creates a normal, strong, reference.
$copy = $ref;
$weak = isweak($ref); # false
looks_like_number EXPR
Returns true if perl thinks EXPR is a number. See "looks_like_number" in perlapi.
openhandle FH
Returns FH if FH may be used as a filehandle and is open, or FH is a tied handle. Otherwise undef is returned.
$fh = openhandle(*STDIN); # *STDIN
$fh = openhandle(*STDIN); # *STDIN
$fh = openhandle(*NOTOPEN); # undef
$fh = openhandle("scalar"); # undef
readonly SCALAR
Returns true if SCALAR is readonly.
sub foo { readonly($_[0]) }
$readonly = foo($bar); # false
$readonly = foo(0); # true
refaddr EXPR
If EXPR evaluates to a reference the internal memory address of the referenced value is returned. Otherwise undef is returned.
$addr = refaddr "string"; # undef
$addr = refaddr $var; # eg 12345678
$addr = refaddr []; # eg 23456784
$obj = bless {}, "Foo";
$addr = refaddr $obj; # eg 88123488
reftype EXPR
If EXPR evaluates to a reference the type of the variable referenced is returned. Otherwise undef is returned.
$type = reftype "string"; # undef
$type = reftype $var; # SCALAR
$type = reftype []; # ARRAY
$obj = bless {}, "Foo";
$type = reftype $obj; # HASH
set_prototype CODEREF, PROTOTYPE
Sets the prototype of the given function, or deletes it if PROTOTYPE is undef. Returns the CODEREF.
set_prototype &foo, $$;
tainted EXPR
Return true if the result of EXPR is tainted
$taint = tainted("constant"); # false
$taint = tainted($ENV{PWD}); # true if running under -T
weaken REF
REF will be turned into a weak reference. This means that it will not hold a reference count on the object it references. Also when the reference count on that object reaches zero, REF will be set to undef.
This is useful for keeping copies of references , but you dont want to prevent the object being DESTROY-ed at its usual time.
{
my $var;
$ref = $var;
weaken($ref); # Make $ref a weak reference
}
# $ref is now undef
Note that if you take a copy of a scalar with a weakened reference, the copy will be a strong reference.
my $var;
my $foo = $var;
weaken($foo); # Make $foo a weak reference
my $bar = $foo; # $bar is now a strong reference
This may be less obvious in other situations, such as grep(), for instance when grepping through a list of weakened references to objects that may have been destroyed already:
@object = grep { defined } @object;
This will indeed remove all references to destroyed objects, but the remaining references to objects will be strong, causing the remaining objects to never be destroyed because there is now always a strong reference to them in the @object array.
<<lessSYNOPSIS
use Scalar::Util qw(blessed dualvar isweak readonly refaddr reftype tainted
weaken isvstring looks_like_number set_prototype);
Scalar::Util contains a selection of subroutines that people have expressed would be nice to have in the perl core, but the usage would not really be high enough to warrant the use of a keyword, and the size so small such that being individual extensions would be wasteful.
By default Scalar::Util does not export any subroutines. The subroutines defined are
blessed EXPR
If EXPR evaluates to a blessed reference the name of the package that it is blessed into is returned. Otherwise undef is returned.
$scalar = "foo";
$class = blessed $scalar; # undef
$ref = [];
$class = blessed $ref; # undef
$obj = bless [], "Foo";
$class = blessed $obj; # "Foo"
dualvar NUM, STRING
Returns a scalar that has the value NUM in a numeric context and the value STRING in a string context.
$foo = dualvar 10, "Hello";
$num = $foo + 2; # 12
$str = $foo . " world"; # Hello world
isvstring EXPR
If EXPR is a scalar which was coded as a vstring the result is true.
$vs = v49.46.48;
$fmt = isvstring($vs) ? "%vd" : "%s"; #true
printf($fmt,$vs);
isweak EXPR
If EXPR is a scalar which is a weak reference the result is true.
$ref = $foo;
$weak = isweak($ref); # false
weaken($ref);
$weak = isweak($ref); # true
NOTE: Copying a weak reference creates a normal, strong, reference.
$copy = $ref;
$weak = isweak($ref); # false
looks_like_number EXPR
Returns true if perl thinks EXPR is a number. See "looks_like_number" in perlapi.
openhandle FH
Returns FH if FH may be used as a filehandle and is open, or FH is a tied handle. Otherwise undef is returned.
$fh = openhandle(*STDIN); # *STDIN
$fh = openhandle(*STDIN); # *STDIN
$fh = openhandle(*NOTOPEN); # undef
$fh = openhandle("scalar"); # undef
readonly SCALAR
Returns true if SCALAR is readonly.
sub foo { readonly($_[0]) }
$readonly = foo($bar); # false
$readonly = foo(0); # true
refaddr EXPR
If EXPR evaluates to a reference the internal memory address of the referenced value is returned. Otherwise undef is returned.
$addr = refaddr "string"; # undef
$addr = refaddr $var; # eg 12345678
$addr = refaddr []; # eg 23456784
$obj = bless {}, "Foo";
$addr = refaddr $obj; # eg 88123488
reftype EXPR
If EXPR evaluates to a reference the type of the variable referenced is returned. Otherwise undef is returned.
$type = reftype "string"; # undef
$type = reftype $var; # SCALAR
$type = reftype []; # ARRAY
$obj = bless {}, "Foo";
$type = reftype $obj; # HASH
set_prototype CODEREF, PROTOTYPE
Sets the prototype of the given function, or deletes it if PROTOTYPE is undef. Returns the CODEREF.
set_prototype &foo, $$;
tainted EXPR
Return true if the result of EXPR is tainted
$taint = tainted("constant"); # false
$taint = tainted($ENV{PWD}); # true if running under -T
weaken REF
REF will be turned into a weak reference. This means that it will not hold a reference count on the object it references. Also when the reference count on that object reaches zero, REF will be set to undef.
This is useful for keeping copies of references , but you dont want to prevent the object being DESTROY-ed at its usual time.
{
my $var;
$ref = $var;
weaken($ref); # Make $ref a weak reference
}
# $ref is now undef
Note that if you take a copy of a scalar with a weakened reference, the copy will be a strong reference.
my $var;
my $foo = $var;
weaken($foo); # Make $foo a weak reference
my $bar = $foo; # $bar is now a strong reference
This may be less obvious in other situations, such as grep(), for instance when grepping through a list of weakened references to objects that may have been destroyed already:
@object = grep { defined } @object;
This will indeed remove all references to destroyed objects, but the remaining references to objects will be strong, causing the remaining objects to never be destroyed because there is now always a strong reference to them in the @object array.
Download (0.042MB)
Added: 2007-05-21 License: Perl Artistic License Price:
888 downloads
Yahoo::Marketing::ForecastKeywordResponse 0.08
Yahoo::Marketing::ForecastKeywordResponse is an object to returns forecasted results for a set of keywords. more>>
Yahoo::Marketing::ForecastKeywordResponse is an object to returns forecasted results for a set of keywords.
SYNOPSIS
See http://ysm.techportal.searchmarketing.yahoo.com/docs/reference/dataObjects.asp for documentation of the various data objects.
new
Creates a new instance
METHODS
get/set methods
customizedResponseByAdGroup
defaultResponseByAdGroup
landscapeByAdGroup
get (read only) methods
<<lessSYNOPSIS
See http://ysm.techportal.searchmarketing.yahoo.com/docs/reference/dataObjects.asp for documentation of the various data objects.
new
Creates a new instance
METHODS
get/set methods
customizedResponseByAdGroup
defaultResponseByAdGroup
landscapeByAdGroup
get (read only) methods
Download (0.066MB)
Added: 2006-12-14 License: Perl Artistic License Price:
1044 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above baseball reference search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed