Thu Apr 25 13:01:26 2024
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2011-05-01

HANGOUT

2024-04-25 | 2024-03-25 | 2024-02-25 | 2024-01-25 | 2023-12-25 | 2023-11-25 | 2023-10-25 | 2023-09-25 | 2023-08-25 | 2023-07-25 | 2023-06-25 | 2023-05-25 | 2023-04-25 | 2023-03-25 | 2023-02-25 | 2023-01-25 | 2022-12-25 | 2022-11-25 | 2022-10-25 | 2022-09-25 | 2022-08-25 | 2022-07-25 | 2022-06-25 | 2022-05-25 | 2022-04-25 | 2022-03-25 | 2022-02-25 | 2022-01-25 | 2021-12-25 | 2021-11-25 | 2021-10-25 | 2021-09-25 | 2021-08-25 | 2021-07-25 | 2021-06-25 | 2021-05-25 | 2021-04-25 | 2021-03-25 | 2021-02-25 | 2021-01-25 | 2020-12-25 | 2020-11-25 | 2020-10-25 | 2020-09-25 | 2020-08-25 | 2020-07-25 | 2020-06-25 | 2020-05-25 | 2020-04-25 | 2020-03-25 | 2020-02-25 | 2020-01-25 | 2019-12-25 | 2019-11-25 | 2019-10-25 | 2019-09-25 | 2019-08-25 | 2019-07-25 | 2019-06-25 | 2019-05-25 | 2019-04-25 | 2019-03-25 | 2019-02-25 | 2019-01-25 | 2018-12-25 | 2018-11-25 | 2018-10-25 | 2018-09-25 | 2018-08-25 | 2018-07-25 | 2018-06-25 | 2018-05-25 | 2018-04-25 | 2018-03-25 | 2018-02-25 | 2018-01-25 | 2017-12-25 | 2017-11-25 | 2017-10-25 | 2017-09-25 | 2017-08-25 | 2017-07-25 | 2017-06-25 | 2017-05-25 | 2017-04-25 | 2017-03-25 | 2017-02-25 | 2017-01-25 | 2016-12-25 | 2016-11-25 | 2016-10-25 | 2016-09-25 | 2016-08-25 | 2016-07-25 | 2016-06-25 | 2016-05-25 | 2016-04-25 | 2016-03-25 | 2016-02-25 | 2016-01-25 | 2015-12-25 | 2015-11-25 | 2015-10-25 | 2015-09-25 | 2015-08-25 | 2015-07-25 | 2015-06-25 | 2015-05-25 | 2015-04-25 | 2015-03-25 | 2015-02-25 | 2015-01-25 | 2014-12-25 | 2014-11-25 | 2014-10-25 | 2014-09-25 | 2014-08-25 | 2014-07-25 | 2014-06-25 | 2014-05-25 | 2014-04-25 | 2014-03-25 | 2014-02-25 | 2014-01-25 | 2013-12-25 | 2013-11-25 | 2013-10-25 | 2013-09-25 | 2013-08-25 | 2013-07-25 | 2013-06-25 | 2013-05-25 | 2013-04-25 | 2013-03-25 | 2013-02-25 | 2013-01-25 | 2012-12-25 | 2012-11-25 | 2012-10-25 | 2012-09-25 | 2012-08-25 | 2012-07-25 | 2012-06-25 | 2012-05-25 | 2012-04-25 | 2012-03-25 | 2012-02-25 | 2012-01-25 | 2011-12-25 | 2011-11-25 | 2011-10-25 | 2011-09-25 | 2011-08-25 | 2011-07-25 | 2011-06-25 | 2011-05-25 | 2011-04-25 | 2011-03-25 | 2011-02-25 | 2011-01-25 | 2010-12-25 | 2010-11-25 | 2010-10-25 | 2010-09-25 | 2010-08-25 | 2010-07-25 | 2010-06-25 | 2010-05-25 | 2010-04-25 | 2010-03-25 | 2010-02-25 | 2010-01-25 | 2009-12-25 | 2009-11-25 | 2009-10-25 | 2009-09-25 | 2009-08-25 | 2009-07-25 | 2009-06-25 | 2009-05-25 | 2009-04-25 | 2009-03-25 | 2009-02-25 | 2009-01-25 | 2008-12-25 | 2008-11-25 | 2008-10-25 | 2008-09-25 | 2008-08-25 | 2008-07-25 | 2008-06-25 | 2008-05-25 | 2008-04-25 | 2008-03-25 | 2008-02-25 | 2008-01-25 | 2007-12-25 | 2007-11-25 | 2007-10-25 | 2007-09-25 | 2007-08-25 | 2007-07-25 | 2007-06-25 | 2007-05-25 | 2007-04-25 | 2007-03-25 | 2007-02-25 | 2007-01-25 | 2006-12-25 | 2006-11-25 | 2006-10-25 | 2006-09-25 | 2006-08-25 | 2006-07-25 | 2006-06-25 | 2006-05-25 | 2006-04-25 | 2006-03-25 | 2006-02-25 | 2006-01-25 | 2005-12-25 | 2005-11-25 | 2005-10-25 | 2005-09-25 | 2005-08-25 | 2005-07-25 | 2005-06-25 | 2005-05-25 | 2005-04-25 | 2005-03-25 | 2005-02-25 | 2005-01-25 | 2004-12-25 | 2004-11-25 | 2004-10-25 | 2004-09-25 | 2004-08-25 | 2004-07-25 | 2004-06-25 | 2004-05-25 | 2004-04-25 | 2004-03-25 | 2004-02-25 | 2004-01-25 | 2003-12-25 | 2003-11-25 | 2003-10-25 | 2003-09-25 | 2003-08-25 | 2003-07-25 | 2003-06-25 | 2003-05-25 | 2003-04-25 | 2003-03-25 | 2003-02-25 | 2003-01-25 | 2002-12-25 | 2002-11-25 | 2002-10-25 | 2002-09-25 | 2002-08-25 | 2002-07-25 | 2002-06-25 | 2002-05-25 | 2002-04-25 | 2002-03-25 | 2002-02-25 | 2002-01-25 | 2001-12-25 | 2001-11-25 | 2001-10-25 | 2001-09-25 | 2001-08-25 | 2001-07-25 | 2001-06-25 | 2001-05-25 | 2001-04-25 | 2001-03-25 | 2001-02-25 | 2001-01-25 | 2000-12-25 | 2000-11-25 | 2000-10-25 | 2000-09-25 | 2000-08-25 | 2000-07-25 | 2000-06-25 | 2000-05-25 | 2000-04-25 | 2000-03-25 | 2000-02-25 | 2000-01-25 | 1999-12-25

Key: Value:

Key: Value:

MESSAGE
DATE 2011-05-19
FROM Ruben Safir
SUBJECT Re: [NYLXS - HANGOUT] C++ Workshop - creating a distribution list
The key function in creating a distribution list in out project is the
function that exists in the stats namespace, but which is not a member
of the Distribution class:

template
void mount_individual_data_point(chainlist::List * tabulate,
chainlist::List > * table){
T val;
stats::Distribution * j;
val = *(tabulate->cursor()->value()); //get a value
table->cursor()= table->front(); //check to see if the
//distribution list exists
if(!table->cursor()){ // if not add a distribution table to the
//List of distributions
j = new stats::Distribution (val);
table->insert(*j ); //now we have at least one
delete j;
j=table->cursor()->value();//and increased its population
j->increase_occ();
}else{
//otherwise search for a distribution node described as
//value
table->find_value(val);
if( table->cursor() ){
j=table->cursor()->value();//and increase its population
j->increase_occ();
}else{//otherwise add a new node
j = new stats::Distribution (val);
table->insert( *j ); //now we have one for that value
delete j;
j=table->cursor()->value();//and increased its population
j->increase_occ();
}
}
}

A detailed look at this templated function is valuable. The purpose of
stats:: mount_individual_data_point(chainlist::List *, chainlist::List *) is
to take two lists, one of type T, which in our working example
translates to integers, and to walk through it creating or growing a
second List of type stats::Distribution. As the function walks
through the first list, it hunts for unique new samples, and tallys
their population in the list in the List::Distribution. Buy sending
both lists by pointer, we avoid uneeded copy overhead.

it starts be declaring in int val, which is just for later readability
and convience, which holds the current value that we are examining.

values in our List class are pointers, so we copy by value the
deferenced value into val.

we then create a pointer to a stats::Distribution object which we use to
construct new Distribution objects and destroy them as needed,
preventing memory leaks.

stats::Distribution * j;

This just then uses the List's cursor to find where in the list we
want to analyze. This is set by the calling function. as
mount_individual_data_point only works on a single member of the
population at a time.

val = *(tabulate->cursor()->value()); //get a value

we then check to see if our Distribution list is populated. It is up to
the user of this function to assure that the Distribution List is
actually allocated and not just a pointer, otherwise the infix operation
will fail:

table->cursor()= table->front();

If cursor is equal to front, then we haven't done anything to the list
yet, it is an empty shell

if(!table->cursor()){ // if not add a distribution table to the List of distributions
j = new stats::Distribution (val);
table->insert(*j ); //now we have at least one
delete j;
j=table->cursor()->value();//and increased its population
j->increase_occ();

Keep in mind that cursor will equal zero if pointed at front, if no
members have yet been added, and so we start by creating a new
Distrubution object pointed to (j) with value val, insert it in our
List > * table, passing j by value, and then clean up by
deleting j.

Finally we pass the address of the new internal Distribution Node within
table back to (j), which is a pointer, and call the Distribution member
increase_occ() which incrememnt the population tally represented in the
private data as int occurances of the Distribution class.

Now if it is not a fresh List< Distribution >, then we need to
search to see if out Distribution node already exists. We do this by
leveraging our chainlist::List member find_value() which sets the cursor
of the list to the first occurance of a value. Since the List<
Distribution > has all unique members, we only need to find the first
occurance. If the value doesn't exist in the List, then the function
set the cursor to NULL

}else{
//otherwise search for a distribution node described as
//value
table->find_value(val);
if( table->cursor() ){
j=table->cursor()->value();//and increase its population
j->increase_occ();
}else{//otherwise add a new node
j = new stats::Distribution (val);
table->insert( *j ); //now we have one for that value
delete j;
j=table->cursor()->value();//and increased its population
j->increase_occ();
}
}
}


Any questions?

Ruben



  1. 2011-05-02 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  2. 2011-05-06 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] NYLXS Business
  3. 2011-05-06 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] NYLXS Business
  4. 2011-05-06 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Business
  5. 2011-05-09 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] UPDATED! NYLUG Presents: 5/18 -at- 6:30PM Cameron L. Fadjo on Construct, Program, Design: An Introduction to Scratch From the Perspective of Computing and Cognition
  6. 2011-05-09 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Notes
  7. 2011-05-10 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday May 10 6:00PM-8:00PM
  8. 2011-05-15 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Notes
  9. 2011-05-16 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Notes
  10. 2011-05-16 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Fwd: [New-York-C-Developers-Group] MongoNYC - MongoDB Conference
  11. 2011-05-16 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  12. 2011-05-18 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [rick-at-linuxmafia.com: [conspire] YouTube downloading software
  13. 2011-05-19 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - creating a distribution list
  14. 2011-05-19 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - creating a distribution list
  15. 2011-05-20 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  16. 2011-05-22 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  17. 2011-05-22 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  18. 2011-05-23 swd <sderrick-at-optonline.net> Subject: [NYLXS - HANGOUT] Membership Dues Address?
  19. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Membership Dues Address?
  20. 2011-05-23 swd <sderrick-at-optonline.net> RE: [NYLXS - HANGOUT] Membership Dues Address?
  21. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Template Argument type deterination
  22. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Membership Dues Address?
  23. 2011-05-23 swd <sderrick-at-optonline.net> RE: [NYLXS - HANGOUT] Membership Dues Address?
  24. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Membership Dues Address?
  25. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ian.bruntlett-at-gmail.com: [accu-general] Free e-book:- The
  26. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Job Fair
  27. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [billy.donahue-at-gmail.com: Re: [mrbrklyn-at-panix.com: Template
  28. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re: [mrbrklyn-at-panix.com: Template Argument
  29. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re: [mrbrklyn-at-panix.com: Template Argument
  30. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re:
  31. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re:
  32. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re:
  33. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] template implicit converstion
  34. 2011-05-24 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday May 24 6:00PM-8:00PM
  35. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [mrbrklyn-at-panix.com: (fwd) Template argument determination]
  36. 2011-05-25 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  37. 2011-05-25 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  38. 2011-05-26 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Presents: 6/15 -at- 6:30PM Robert Menes on Rockbox: Open Source Jukebox Firmware
  39. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [ruben-at-mrbrklyn.com: Re: [NYLXS - HANGOUT] C++ Workshop - New
  40. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [ruben-at-mrbrklyn.com: Re: [NYLXS - HANGOUT] C++ Workshop - New
  41. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [ruben-at-mrbrklyn.com: Re: [NYLXS - HANGOUT] C++ Workshop - New
  42. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Perl Class
  43. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Perl Class
  44. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Postgres Class
  45. 2011-05-26 Paul Robert Marino <prmarino1-at-gmail.com> Re: [NYLXS - HANGOUT] Postgres Class
  46. 2011-05-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop - next phase
  47. 2011-05-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Fwd: Consensus from last night's meeting
  48. 2011-05-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Fwd: Re: [The-New-York-Perl-Meetup-Group] Consensus from last night's
  49. 2011-05-30 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Job opennings
  50. 2011-05-31 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!