A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Untitled - Stikked
From Silly Motmot, 10 Years ago, written in C++.
Embed
  1. #include <vector>
  2. #include <algorithm>
  3. #include <iostream>
  4.  
  5. #include <boost/accumulators/accumulators.hpp>
  6. #include <boost/accumulators/statistics/density.hpp>
  7. #include <boost/accumulators/statistics/stats.hpp>
  8.  
  9. using namespace boost;
  10. using namespace boost::accumulators;
  11.  
  12. typedef accumulator_set<double, features<tag::density> > acc;
  13. typedef iterator_range<std::vector<std::pair<double, double> >::iterator > histogram_type;
  14.  
  15. template <typename T>
  16. class data_filler
  17. {  
  18. public:
  19.   data_filler(){}
  20.   T operator()() { return rand()/(T)RAND_MAX; }
  21. };
  22.  
  23. int main(int argc, char** argv)
  24. {
  25.  
  26.   //create some random data
  27.   std::vector<double> data(100);
  28.   std::generate(data.begin(), data.end(), data_filler<double>());
  29.   int c = data.size();//cache size for histogramm.
  30.  
  31.   //create an accumulator
  32.   acc myAccumulator( tag::density::num_bins = 20, tag::density::cache_size = 10);
  33.  
  34.   //fill accumulator
  35.   for (int j = 0; j < c; ++j)
  36.   {
  37.     myAccumulator(data[j]);
  38.   }
  39.  
  40.   histogram_type hist = density(myAccumulator);
  41.  
  42.   double total = 0.0;
  43.  
  44.   for( int i = 0; i < hist.size(); i++ )
  45.   {
  46.     std::cout << "Bin lower bound: " << hist[i].first << ", Value: " << hist[i].second << std::endl;
  47.     total += hist[i].second;
  48.   }
  49.  
  50.   std::cout << "Total: " << total << std::endl; //should be 1 (and it is)
  51.  
  52.   return 0;
  53. }