Speech
Nick Gibb explains how storytelling stretches children’s vocabularies, expands their horizons and extends their ability to learn.
People of my generation will remember the late comedian Max Bygraves and his famous catchphrase, “I wanna tell you a story”.
The reception Bygraves’s catchphrase always gained demonstrates the timeless pleasure of being told a good story. This is a pleasure that National Storytelling Week celebrates, and I am delighted to be a part of the events today.
Over the years I have spoken a lot about the importance of initial literacy, and how all the evidence, both in this country and internationally, points to systematic synthetic phonics as the best way to teach young children to decode and read words.
Learning to decode words is the vital first step in becoming a confident reader. It is a necessary condition without which children will spend years struggling with reading, but it is only a first step. Today, I want to talk about the importance of storytelling, of children being read to and told stories, not only in the years before they start school but throughout their education.
A 2003 American study called ‘The early catastrophe’ by Professors Hart and Risley, found that an American child from a professional family will experience 2,153 words an hour by the age of 3. This compares to a child from the most disadvantaged background who will experience only 616 words an hour.
That amounts to a 30-million-word gap between the least and most advantaged 3-year-old.
Similar findings exist in the UK. According to Department for Education data on early years pupils, the widest attainment gap, when comparing pupils eligible for free school meals and all others, is in reading and writing.
Why does this matter? Because conversation and storytelling widen a child’s vocabulary, and a wide vocabulary is decisive in becoming a confident reader. As the cognitive scientist Daniel Willingham has written, it is possible to read a text slightly pitched above your understanding, as the meaning of unfamiliar words can be deduced from the context. However, as the number of unfamiliar words increases, your ability to ‘get the gist’ drops rapidly.
So, the more words a child knows at an early age, the greater their ability to read challenging texts. This in turn increases their ability to learn more words, and so on and so forth, in a positive feedback loop of vocabulary accumulation. The word gap which researchers identify amongst children aged 3, can be a gulf by the time pupils take their GCSEs.
The reading expert Keith Stanovich has dubbed this positive feedback loop ‘the Matthew effect’, after the verse in the Gospel of Mathew telling the parable of the talents: “to those who have, more shall be given, but from those who have not, even what they have shall be taken away.”
As a government, we are dedicated to improving the life chances of young people. All pupils should be given the best start in life by their schooling, irrespective of birth or background. If you believe in social justice then you will want state education to do all that it can to remedy the education gap between those from advantaged, and those from disadvantaged backgrounds.
It is difficult to overstate the benefits of instilling a love of reading in a child. According to research by the OECD, reading for pleasure is more important than a family’s socio-economic status in determining a child’s success at school.
This finding is supported by the work of Dr Alice Sullivan and Matt Brown at the Institute of Education. From analysing the educational outcomes of around 6,000 children who participated in the 1970 British Cohort Study, they found that reading for pleasure is more important for a child’s cognitive development between 10 and 16 than their parents’ level of education.
Remarkably, the combined effect of reading books often, going to the library regularly and reading newspapers at 16 was 4 times greater than the advantage children gained from having a parent with a degree. These findings show that given the gift of reading, a child’s life chances need not be limited by their social or economic background. Deprivation need not be destiny.
And let us not forget the immeasurable benefit that stories can have in widening a child’s imagination, transporting them to entirely new and unfamiliar places - geographically, historically and emotionally. Getting lost in a good story can allow you to discover more about the world, more about humankind, and more about yourself.
We are living through something of a golden age of children’s books, with ‘Percy Jackson’ novels transporting young readers to mythology of ancient Greece, and ‘The Hunger Games’ landing them in a dystopian future. It is extremely reassuring that, according to the latest annual survey from the National Literacy Trust, enjoyment and frequency of reading amongst 8- to 18-year-olds are both at their highest levels for 9 years.
Reading independently, being read to, and engaging in conversation are all vitally important for a child’s development. But today I would like to make a particular case for the importance of being read stories.
Research has shown that the vocabulary of general conversation is surprisingly impoverished, compared to the vocabulary we find in written material. This was demonstrated by 2 American reading experts who ranked 86,000 word forms in the English language according to the frequency with which they occurred in written English.
The word ranked first is ‘the’. ‘It’ is ranked 10th. ‘Amplifier’ is ranked 16,000th - you get the drift.
Using this data, the researchers then measured different forms of written and spoken English. In children’s books, the average word is ranked 627th most frequent. The average word used in conversation between university graduates, however, ranks only 496th most frequent.
In other words, even highly educated people use less sophisticated vocabulary when speaking than the words used in a typical children’s book. Which is why it is so important not just to talk to children but to read to them as well. Story time is a crucial part of any primary school’s timetable, as it has such power to build a child’s vocabulary. The type of story or book being read can be more challenging than a book the child chooses to read for him or herself.
Of course, National Storytelling Week celebrates the oral tradition of storytelling: fables, folk tales and fairy lore. As long as human civilisation has existed, we have shared stories. For those looking to communicate a message, encapsulating it in a well told story has long been the most effective method.
Would the teachings of the Bible have been so powerful had Jesus never told the story of the Good Samaritan, but simply instructed his followers to care for all humankind?
Aesop and Jesus were not just good storytellers, they were expert cognitive psychologists. Humans are hard-wired to remember stories, to the point that psychologists have referred to stories as ‘psychologically privileged’ in the human mind.
The best teachers have always based their lessons, knowingly or unknowingly, on this insight. As some psychologists suggest, a good story encourages the listener to be continually making small inferences, working out how the narrative is going to develop and resolve, thus keeping their attention throughout.
For mathematics teachers introducing pupils to the concept of volume, you can do a lot worse than retelling the story of Archimedes in the bath. Few children can forget the image of Archimedes running through the streets of Syracuse naked, exclaiming ‘Eureka!’.
If a history teacher wants pupils to learn about the African-American struggle for civil rights, the stories of Emmet Till and Rosa Parks can capture attention and aid memory like little else. If a science teacher wants pupils to remember the properties of antibiotics, then the story of how Alexander Fleming first discovered penicillin is ideal.
I understand that Snail Tales are currently undertaking their own controlled trial looking into the benefits of storytelling for long-term memory, and I look forward to hearing their findings.
But to return to the question of ensuring all pupils become confident readers.
Mastering the mechanics of decoding has to be the first objective - it is the gateway towards being a successful reader. This is best achieved through structured schemes of systematic phonics, with plenty of practice reading books that are consistent with the level of phonic knowledge the child has been taught.
The second objective of the English curriculum is practice - encouraging children to improve the fluency and speed of their reading by reading large numbers of books. The more you read, the more vocabulary you acquire and the easier it becomes to comprehend.
For this reason, I would like to see every pupil in years 3 to 6 of primary school reading at least 1 book a week. ‘A book a week’ should be the mantra for anyone hoping to eliminate illiteracy in this country.
The third objective of the English curriculum is to help pupils read more challenging books. Teachers should set for their classes those books that are slightly more challenging than the ones pupils would elect to read on their own. And that too involves teachers reading to their pupils.
From my own education I remember being read to throughout my time at school: from ‘Stig of the Dump’ at junior school, to Alastair MacLean, Hammond Innes, and L P Hartley’s ‘The Go-Between’ in the third year of secondary school. After the first couple of pages read to us by the teacher, pupils would take it in turns to read aloud the next sections. We did this, I remember, with ‘The Mayor of Casterbridge’ in the fourth year, ‘Great Expectations’ in the fifth year and even on into the sixth form where we read together as a class D H Lawrence’s ‘The Rainbow’ and Steinbeck’s ‘The Grapes of Wrath’.
This process gave me the confidence to take on challenging books, that were much more difficult than those I would otherwise have chosen. And it worked - I went on to read many more MacLean, Dickens, Lawrence and Steinbeck books thanks to my teachers.
I do question why, when I am on school visits, I see teachers in the first 3 years of secondary school already using English literature lessons to prepare for GCSE-style questions. Instead of GCSE-style analysis of the text, should those lessons not be used to spread the sheer enjoyment of reading, through introducing pupils to a wide and varied diet of English and world literature? I am sure this would be far better preparation for their eventual examinations than a premature obsession with exam technique.
And this brings me to the fourth and final objective: the canon. It is important that schools introduce pupils to the great works of English literature, that lend pupils an intellectual hinterland to draw upon for the rest of their lives. Of course, the exact make-up of the canon will always be a matter of debate and disagreement, but the existence of the canon should not be.
Through our reforms to the English literature GCSE, children are being encouraged to read more challenging titles in years 10 and 11. Prior to our reforms, around 90% of pupils in the English literature GCSE delivered by one exam board answered questions on a single text: ‘Of Mice and Men’. Now, John Steinbeck is a great author (‘East of Eden’ is my all-time favourite book - it’s the Great American Novel) but even I doubt this short novella was deserving of such overwhelming attention.
Since September, pupils have been studying the reformed English literature GCSE for the first time, including the study of both a 19th century novel and a modern book. Instead of a strict diet of Steinbeck, pupils can read George Orwell and Jane Austen, Kazuo Ishiguro and Charlotte Bronte - and they will be reading the whole novel, not just extracts.
For now, the important point is - as Max Bygraves might have said - children wanna hear a story. If we are to deliver an education that closes the word gap, closes the reading gap, and thus closes the achievement gap, we need to introduce our children to as many stories as we can.
Published: 3 February 2016


|
Scheduler
|
#include <policy.h>
Public Member Functions | |
| Policy (int nbOfStates, int nbOfActions, std::shared_ptr< Utils::RandomGenerator > gen) | |
| void | update (state_t state, const std::vector< double > &vector) |
| action_t | getAction (state_t state) |
| void | initializeUniformly () |
| void | initializeRandomly (std::shared_ptr< Utils::RandomGenerator > gen) |
| void | initializeFromFile (std::string filename) |
| void | saveToFile (std::string filename) |
| void | print (std::ostream &stream) |
| size_t | getNbOfStates () |
| size_t | getNbOfActions () |
Protected Member Functions | |
| std::vector< double > * | getActionVector (state_t state) |
| void | handleErrorInGettingAction (std::vector< double > *vector, state_t state, double d) |
Protected Attributes | |
| std::vector< std::vector< double > > | policy |
| size_t | nbOfStates |
| size_t | nbOfActions |
| std::shared_ptr< Utils::RandomGenerator > | randomGenerator |
| Policy::Policy | ( | int | nbOfStates, |
| int | nbOfActions, | ||
| std::shared_ptr< Utils::RandomGenerator > | gen | ||
| ) |
Definition at line 22 of file policy.cpp.
Definition at line 98 of file policy.cpp.
|
protected |
Definition at line 93 of file policy.cpp.
| size_t Policy::getNbOfActions | ( | ) |
Definition at line 154 of file policy.cpp.
| size_t Policy::getNbOfStates | ( | ) |
Definition at line 149 of file policy.cpp.
|
protected |
Definition at line 118 of file policy.cpp.
| void Policy::initializeFromFile | ( | std::string | filename | ) |
Definition at line 51 of file policy.cpp.
| void Policy::initializeRandomly | ( | std::shared_ptr< Utils::RandomGenerator > | gen | ) |
Definition at line 32 of file policy.cpp.
| void Policy::initializeUniformly | ( | ) |
Definition at line 41 of file policy.cpp.
| void Policy::print | ( | std::ostream & | stream | ) |
Definition at line 132 of file policy.cpp.
| void Policy::saveToFile | ( | std::string | filename | ) |
Definition at line 73 of file policy.cpp.
| void Policy::update | ( | state_t | state, |
| const std::vector< double > & | vector | ||
| ) |
Definition at line 79 of file policy.cpp.
|
protected |
|
protected |


Note: The name should be updated before creating a new checklist, otherwise
checklists with the same name could be created. Also check that the correct
team is selected. Incorrect team assignments can only be updated by an
administrator after the checklist has been created.


Name:
Type of Charity:
Email:
Password:
Name of Charity Representative:*
Descripton of Charity:
Official Charity Website:*
Next
Country:
US
UK
Routing Number:
Account Number:
Submit


|
Standard Reference Data Program |
Data Gateway |
Chemistry WebBook |
|
NIST subscription sites provide data under the NIST Standard Reference Data Program, but require an annual fee to access. The purpose of the fee is to recover costs associated with the development of data collections included in such sites. Your institution may already be a subscriber. Follow the links above to find out more about the data in these sites and their terms of usage.
Go To: Top, Constants of diatomic molecules, References, Notes / Error Report
Data compilation copyright by the U.S. Secretary of Commerce on behalf of the U.S.A. All rights reserved.
Data evaluated as indicated in comments:
L - S.G. Lias
Data compiled as indicated in comments:
LLK - S.G. Lias, R.D. Levin, and S.A. Kafafi
RDSH - H.M. Rosenstock, K. Draxl, B.W. Steiner, and J.T. Herron
View reactions leading to GeO+ (ion structure unspecified)
| Quantity | Value | Units | Method | Reference | Comment |
|---|---|---|---|---|---|
| IE (evaluated) | 11.1 ± 0.15 | eV | N/A | N/A | L |
| IE (eV) | Method | Reference | Comment |
|---|---|---|---|
| 11.10 | EVAL | Huber and Herzberg, 1979 | LLK |
| 11.0 ± 0.3 | EI | Hildenbrand, 1972 | LLK |
| 11.10 ± 0.10 | EI | Hildenbrand, 1971 | LLK |
| ~11.39 | S | Hildenbrand and Murad, 1969 | RDSH |
| 11.5 ± 0.5 | EI | Hildenbrand and Murad, 1969 | RDSH |
| 10.1 ± 0.8 | EI | Drowart, Degreve, et al., 1965 | RDSH |
| 11.25 | PE | White, Rosenberg, et al., 1979 | Vertical value; LLK |
| 11.25 ± 0.01 | PE | Colbourn, Dyke, et al., 1978 | Vertical value; LLK |
| Ion | AE (eV) | Other Products | Method | Reference | Comment |
|---|---|---|---|---|---|
| Ge+ | 14. ± 1. | O | EI | Drowart, Degreve, et al., 1965 | RDSH |
Go To: Top, Gas phase ion energetics data, References, Notes / Error Report
Data compilation copyright by the U.S. Secretary of Commerce on behalf of the U.S.A. All rights reserved.
Data compiled by: K.P. Huber and G. Herzberg
| State | Te | ωe | ωexe | ωeye | Be | αe | γe | De | βe | re | Trans. | ν00 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Additional unassigned R shaded absorption bands between 66800 and 69900 cm-1. | ||||||||||||
| Barrow and Rowlinson, 1954 | ||||||||||||
| F | 67474.5 | 809.0 H | 5.66 | F ← X R | 67390 H | |||||||
| missing citation | ||||||||||||
| E | 49637.3 | 504.3 H | 4.8 | E ↔ X R | 49397 H | |||||||
| missing citation; missing citation | ||||||||||||
| A 1Π | 37766.9 H | 650.4 H | 4.21 | 0.4133 1 2 | 0.0033 | 8.2E-7 | 1.761 | A ↔ X 2 R | 37595.4 Z | |||
| missing citation; missing citation; missing citation; missing citation; Korzh and Kuznetsova, 1971; Murty, Reddy, et al., 1972; missing citation | ||||||||||||
| State | Te | ωe | ωexe | ωeye | Be | αe | γe | De | βe | re | Trans. | ν00 |
| a (3Π1) | 32132 | 734.9 H | 5.3 | (0.438) | (1.711) | a → X 2 R | 32007 H | |||||
| Sharma and Padur, 1967; missing citation | ||||||||||||
| a' (3Σ+) | 27733 | 633.3 H | 2.7 | (0.389) | (1.815) | a' → X 2 3 R | 27553 H | |||||
| Hager, Wilson, et al., 1974; missing citation; missing citation | ||||||||||||
| (B) | (21117) | (580.0) H | (3.5) 4 | (B → X) R | (20917) | |||||||
| Tewari and Mohan, 1971 | ||||||||||||
| X 1Σ+ | 0 | 985.5 5 H | 4.29 5 | 0.4856962 2 | 0.0030756 | 4.72E-7 6 | 1.624648 7 | |||||
| Torring, 1966; Hoeft, Lovas, et al., 1969; Honerjager and Tischer, 1973 | ||||||||||||
| 8 | ||||||||||||
| Raymonda, Muenter, et al., 1970; Davis and Muenter, 1974 |
| 1 | Perturbation between A 1Π(v=0) and a 3Π(v=8), see Capelle and Brom, 1975. |
| 2 | RKR potential curves Nair, Singh, et al., 1965, Savithry, Rao, et al., 1974, Franck-Condon factors Sinha and Chatterjee, 1973, Singh, 1974, Capelle and Brom, 1975; variation of A-X electronic transition moment Rao, Rao, et al., 1976. |
| 3 | Also observed in phosphorescence in various solid matrices at low temperature Meyer, Jones, et al., 1971; lifetime in matrices Meyer, Smith, et al., 1970. |
| 4 | Observed in thermal emission. 11 |
| 5 | From band origins Korzh and Kuznetsova, 1971 obtain ωe = 986.84 Korzh and Kuznetsova, 1971, ωexe = 4.47 Korzh and Kuznetsova, 1971. |
| 6 | Calculated De |
| 7 | Microwave sp. |
| 8 | Mol. beam el. reson. 12 13 |
| 9 | Thermochemical value (mass-spectrom.) Drowart, Degreve, et al., 1965. |
| 10 | Vertical I.P. from electron impact mass spectrometry Hildenbrand, 1971. |
| 11 | The vibrational analysis seems uncertain since the intensity distribution does not agree with that expected for such a large change of ωe. |
| 12 | μel(+GeO-) = [3.2720 + 0.0208(v+1/2)] D Raymonda, Muenter, et al., 1970. |
| 13 | gJ(v=0)= -0.1411 Honerjager and Tischer, 1973, Davis and Muenter, 1974; also magnetic susceptibility anisotropy and molecular quadrupole moment. |
Go To: Top, Gas phase ion energetics data, Constants of diatomic molecules, Notes / Error Report
Data compilation copyright by the U.S. Secretary of Commerce on behalf of the U.S.A. All rights reserved.
Huber and Herzberg, 1979
Huber, K.P.; Herzberg, G.,
Molecular Spectra and Molecular Structure. IV. Constants of Diatomic Molecules,, Van Nostrand Reinhold Co., 1979, ,1. [all data]
Hildenbrand, 1972
Hildenbrand, D.L.,
The gaseous equilibrium Ge + SiO = GeO + Si and the dissociation energy of SiO,
High Temp. Sci., 1972, 4, 244. [all data]
Hildenbrand, 1971
Hildenbrand, D.L.,
First ionization potentials of the molecules BF, SiO and GeO,
Intern. J. Mass Spectrom. Ion Phys., 1971, 7, 255. [all data]
Hildenbrand and Murad, 1969
Hildenbrand, D.L.; Murad, E.,
Dissociation energy and ionization potential of silicon monoxide,
J. Chem. Phys., 1969, 51, 807. [all data]
Drowart, Degreve, et al., 1965
Drowart, J.; Degreve, F.; Verhaegen, G.; Colin, R.,
Thermochemical study of the germanium oxides using a mass spectrometer. Dissociation energy of the molecule GeO,
J. Chem. Soc. Faraday Trans., 1965, 61, 1072. [all data]
White, Rosenberg, et al., 1979
White, M.G.; Rosenberg, R.A.; Lee, S.T.; Shirley, D.A.,
The He(I) photoelectron spectroscopy of heavy group IV-VI diatomics,
J. Electron Spectrosc. Relat. Phenom., 1979, 17, 323. [all data]
Colbourn, Dyke, et al., 1978
Colbourn, E.A.; Dyke, J.M.; Fackerell, A.; Morris, A.; Trickle, I.R.,
Vacuum ultraviolet photoelectron spectrum of the GeO(X1Σ+) molecule,
J. Chem. Soc. Faraday Trans. 2, 1978, 74, 2278. [all data]
Barrow and Rowlinson, 1954
Barrow, R.F.; Rowlinson, H.C.,
The absorption spectra of the gaseous monoxides of silicon, germanium and tin in the Schumann region,
Proc. Roy. Soc. (London), 1954, A224, 374. [all data]
Korzh and Kuznetsova, 1971
Korzh, P.D.; Kuznetsova, M.I.,
Electronic transition and isotopic effect for Ge72O and Ge74O molecules,
Opt. Spectrosc. Engl. Transl., 1971, 31, 286, In original 539. [all data]
Murty, Reddy, et al., 1972
Murty, A.A.N.; Reddy, Y.P.; Rao, P.T.,
Emission band spectrum of GeO molecule,
Indian J. Pure Appl. Phys., 1972, 10, 834. [all data]
Sharma and Padur, 1967
Sharma, A.; Padur, J.P.,
A spectroscopic study of the chemiluminescent reaction of germanium tetrahydride with atomic oxygen,
Proc. Phys. Soc. London, 1967, 90, 269. [all data]
Hager, Wilson, et al., 1974
Hager, G.; Wilson, L.E.; Hadley, S.G.,
Reactions of atomic silicon and germanium with nitrous oxide to produce electronically excited silicon monoxide and germanium monoxide,
Chem. Phys. Lett., 1974, 27, 439. [all data]
Tewari and Mohan, 1971
Tewari, D.P.; Mohan, H.,
Band spectrum of the molecule germanium monoxide (GeO) in the visible region,
J. Mol. Spectrosc., 1971, 39, 290. [all data]
Torring, 1966
Torring, T.,
Das Mikrowellenrotationsspektrum des GeO,
Z. Naturforsch. A, 1966, 21, 287. [all data]
Hoeft, Lovas, et al., 1969
Hoeft, J.; Lovas, F.J.; Tiemann, E.; Tischer, R.; Torring, T.,
Elektrisches Dipolmoment und Mikrowellenrotationsspektrum des GeO und GeS,
Z. Naturforsch. A, 1969, 24, 1217. [all data]
Honerjager and Tischer, 1973
Honerjager, R.; Tischer, R.,
gJ-Faktor der Molekeln GeO und SiS und Anisotropie ihrer Magnetisierbarkeit,
Z. Naturforsch. A, 1973, 28, 1374. [all data]
Raymonda, Muenter, et al., 1970
Raymonda, J.W.; Muenter, J.S.; Klemperer, W.A.,
Electric dipole moment of SiO and GeO,
J. Chem. Phys., 1970, 52, 3458. [all data]
Davis and Muenter, 1974
Davis, R.E.; Muenter, J.S.,
Magnetic properties of silicon and germanium monoxide,
J. Chem. Phys., 1974, 61, 2940. [all data]
Capelle and Brom, 1975
Capelle, G.A.; Brom, J.M., Jr.,
Reactions of germanium vapor with oxidizers: photon yields and a new GeO band system,
J. Chem. Phys., 1975, 63, 5168. [all data]
Nair, Singh, et al., 1965
Nair, K.P.R.; Singh, R.B.; Rai, D.K.,
Potential-energy curves and dissociation energies of oxides and sulfides of group IV A elements,
J. Chem. Phys., 1965, 43, 3570. [all data]
Savithry, Rao, et al., 1974
Savithry, T.; Rao, D.V.K.; Rao, P.T.,
True potential energy curves, dissociation energy and r-centroids of diatomic GeO,
Curr. Sci., 1974, 43, 329. [all data]
Sinha and Chatterjee, 1973
Sinha, S.P.; Chatterjee, C.L.,
Franck-Condon factors & r-centroids for GeO (A-X) system,
Indian J. Pure Appl. Phys., 1973, 11, 57. [all data]
Singh, 1974
Singh, J.,
Franck-Condon factors & r-centroids for A1Π-X1Σ+ system of GeO molecule,
Indian J. Pure Appl. Phys., 1974, 12, 528. [all data]
Rao, Rao, et al., 1976
Rao, M.L.P.; Rao, D.V.K.; Rao, P.T.,
Electronic transition-moment variation in the A1Π-X1Σ system of the GeO molecule,
J. Quant. Spectrosc. Radiat. Transfer, 1976, 16, 467. [all data]
Meyer, Jones, et al., 1971
Meyer, B.; Jones, Y.; Smith, J.J.; Spitzer, K.,
The spectrum of matrix-isolated GeO and GeS,
J. Mol. Spectrosc., 1971, 37, 100. [all data]
Meyer, Smith, et al., 1970
Meyer, B.; Smith, J.J.; Spitzer, K.,
Phosphorescent decay time of matrix-isolated GeO, GeS, SnO, and SnS, and the lifetime of the Cameron bands of CO-type diatomics,
J. Chem. Phys., 1970, 53, 3616-3620. [all data]
Go To: Top, Gas phase ion energetics data, Constants of diatomic molecules, References
| AE | Appearance energy |
| IE (evaluated) | Recommended ionization energy |
Copyright for NIST Standard Reference Data is governed by the Standard Reference Data Act.
|
Standard Reference Data Program |
Data Gateway |
Chemistry WebBook |
If you have comments or questions about this site, please contact us.


Modular symbols by numerical integration#
We describe here the method for computing modular symbols by numerical approximations of the integral of the modular form on a path between cusps.
More precisely, let \(E\) be an elliptic curve and \(f\) the newform associated to the isogeny class of \(E\). If
then the modular symbol \([r]^{+}\) is defined as the quotient of the real part of \(\lambda(\infty\to r)\) by the least positive real period of \(E\). Similarly for the negative modular symbol, it is the quotient of the imaginary part of the above by the smallest positive imaginary part of a period on the imaginary axis.
The theorem of Manin-Drinfeld shows that the modular symbols are rational numbers with small denominator. They are used for the computation of special values of the L-function of \(E\) twisted by Dirichlet characters and for the computation of \(p\)-adic L-functions.
ALGORITHM:
The implementation of modular symbols in eclib and directly in sage uses the algorithm described in Cremona’s book [Cre1997] and Stein’s book [St2007]. First the space of all modular symbols of the given level is computed, then the space corresponding to the given newform is determined. Even if these initial steps may take a while, the evaluation afterwards is instantaneous. All computations are done with rational numbers and hence are exact.
Instead the method used here (see [Wu2018] for details) is by evaluating the above integrals \(\lambda(r\to r')\) by numerical approximation. Since we know precise bounds on the denominator, we can make rigorous estimates on the error to guarantee that the result is proven to be the correct rational number.
The paths over which we integrate are split up and Atkin-Lehner operators are used to compute the badly converging part of the integrals by using the Fourier expansion at other cusps than \(\infty\).
Note
There is one assumption for the correctness of these computations: The Manin constant for the \(X_0\)-optimal curve should be \(1\) if the curve lies outside the Cremona tables. This is known for all curves in the Cremona table, but only conjectured for general curves.
EXAMPLES:
The most likely usage for the code is through the functions
modular_symbol
with implementation set to “num” and through
modular_symbol_numerical
:
sage: E = EllipticCurve("5077a1")
sage: M = E.modular_symbol(implementation="num")
sage: M(0)
0
sage: M(1/123)
4
sage: Mn = E.modular_symbol_numerical(sign=-1, prec=30)
sage: Mn(3/123) # abs tol 1e-11
3.00000000000018
In more details. A numerical modular symbols M
is created from an
elliptic curve with a chosen sign
(though the other sign will also be
accessible, too):
sage: E = EllipticCurve([101,103])
sage: E.conductor()
35261176
sage: M = E.modular_symbol(implementation="num", sign=-1)
sage: M
Numerical modular symbol attached to
Elliptic Curve defined by y^2 = x^3 + 101*x + 103 over Rational Field
We can then compute the value \([13/17]^{-}\) and \([1/17]^{+}\) by calling
the function M
. The value of \([0]^{+}=0\) tells us that the rank of
this curve is positive:
sage: M(13/17)
-1/2
sage: M(1/17,sign=+1)
-3
sage: M(0, sign=+1)
0
One can compute the numerical approximation to these rational numbers to any proven binary precision:
sage: M.approximative_value(13/17, prec=2) #abs tol 1e-4
-0.500003172770455
sage: M.approximative_value(13/17, prec=4) #abs tol 1e-6
-0.500000296037388
sage: M.approximative_value(0, sign=+1, prec=6) #abs tol 1e-8
0.000000000000000
There are a few other things that one can do with M
. The Manin
symbol \(M(c:d)\) for a point \((c:d)\) in the projective line can be
computed.:
sage: M.manin_symbol(1,5)
-1
In some cases useful, there is a function that returns all \([a/m]^{+}\) for a fixed denominator \(m\). This is rather quicker for small \(m\) than computing them individually:
sage: M.all_values_for_one_denominator(7)
{1/7: 0, 2/7: 3/2, 3/7: 3/2, 4/7: -3/2, 5/7: -3/2, 6/7: 0}
Finally a word of warning. The algorithm is fast when the cusps involved
are unitary. If the curve is semistable, all cusps are unitary. But
rational numbers with a prime \(p\) dividing the denominator once, but the
conductor more than once, are very difficult. For instance for the above
example, a seemingly harmless command like M(1/2)
would take a very
very long time to return a value. However it is possible to compute them
for smaller conductors:
sage: E = EllipticCurve("664a1")
sage: M = E.modular_symbol(implementation="num")
sage: M(1/2)
0
The problem with non-unitary cusps is dealt with rather easily when one can twist to a semistable curve, like in this example:
sage: C = EllipticCurve("11a1")
sage: E = C.quadratic_twist(101)
sage: M = E.modular_symbol(implementation="num")
sage: M(1/101)
41
AUTHORS:
Chris Wuthrich (2013-16)
- class sage.schemes.elliptic_curves.mod_sym_num.ModularSymbolNumerical#
Bases:
object
This class assigning to an elliptic curve over \(\QQ\) a modular symbol. Unlike the other implementations this class does not precompute a basis for this space. Instead at each call, it evaluates the integral using numerical approximation. All bounds are very strictly implemented and the output is a correct proven rational number.
INPUT:
E
– an elliptic curve over the rational numbers.sign
– either -1 or +1 (default). This sets the default value ofsign
throughout the class. Both are still accessible.
OUTPUT: a modular symbol
EXAMPLES:
sage: E = EllipticCurve("5077a1") sage: M = E.modular_symbol(implementation="num") sage: M(0) 0 sage: M(77/57) -1 sage: M(33/37, -1) 2 sage: M = E.modular_symbol(sign=-1, implementation="num") sage: M(2/7) 2 sage: from sage.schemes.elliptic_curves.mod_sym_num \ ....: import ModularSymbolNumerical sage: M = ModularSymbolNumerical(EllipticCurve("11a1")) sage: M(1/3, -1) 1/2 sage: M(1/2) -4/5
- all_values_for_one_denominator(m, sign=0)#
Given an integer
m
and asign
, this returns the modular symbols \([a/m]\) for all \(a\) coprime to \(m\) using partial sums. This is much quicker than computing them one by one.This will only work if \(m\) is relatively small and if the cusps \(a/m\) are unitary.
INPUT:
m
– a natural numbersign
– optional either +1 or -1, or 0 (default), in which case the sign passed to the class is taken.
OUTPUT: a dictionary of fractions with denominator \(m\) giving rational numbers.
EXAMPLES:
sage: E = EllipticCurve('5077a1') sage: M = E.modular_symbol(implementation="num") sage: M.all_values_for_one_denominator(7) {1/7: 3, 2/7: 0, 3/7: -3, 4/7: -3, 5/7: 0, 6/7: 3} sage: [M(a/7) for a in [1..6]] [3, 0, -3, -3, 0, 3] sage: M.all_values_for_one_denominator(3,-1) {1/3: 4, 2/3: -4} sage: E = EllipticCurve('11a1') sage: M = E.modular_symbol(implementation="num") sage: M.all_values_for_one_denominator(12) {1/12: 1/5, 5/12: -23/10, 7/12: -23/10, 11/12: 1/5} sage: M.all_values_for_one_denominator(12, -1) {1/12: 0, 5/12: 1/2, 7/12: -1/2, 11/12: 0} sage: E = EllipticCurve('20a1') sage: M = E.modular_symbol(implementation="num") sage: M.all_values_for_one_denominator(4) {1/4: 0, 3/4: 0} sage: M.all_values_for_one_denominator(8) {1/8: 1/2, 3/8: -1/2, 5/8: -1/2, 7/8: 1/2}
- approximative_value(r, sign=0, prec=20, use_twist=True)#
The numerical modular symbol evaluated at rational.
It returns a real number, which should be equal to a rational number to the given binary precision
prec
. In practice the precision is often much higher. See the examples below.INPUT:
r
– a rational (or integer)sign
– optional either +1 or -1, or 0 (default), in which case the sign passed to the class is taken.prec
– an integer (default 20)use_twist
– True (default) allows to use a quadratic twist of the curve to lower the conductor.
OUTPUT: a real number
EXAMPLES:
sage: E = EllipticCurve("5077a1") sage: M = E.modular_symbol(implementation="num") sage: M.approximative_value(123/567) # abs tol 1e-11 -4.00000000000845 sage: M.approximative_value(123/567,prec=2) # abs tol 1e-9 -4.00002815242902 sage: E = EllipticCurve([11,88]) sage: E.conductor() 1715296 sage: M = E.modular_symbol(implementation="num") sage: M.approximative_value(0,prec=2) # abs tol 1e-11 -0.0000176374317982166 sage: M.approximative_value(1/7,prec=2) # abs tol 1e-11 0.999981178147778 sage: M.approximative_value(1/7,prec=10) # abs tol 1e-11 0.999999972802649
- clear_cache()#
Clear the cached values in all methods of this class
EXAMPLES:
sage: E = EllipticCurve("11a1") sage: M = E.modular_symbol(implementation="num") sage: M(0) 1/5 sage: M.clear_cache() sage: M(0) 1/5
- elliptic_curve()#
Return the elliptic curve of this modular symbol.
EXAMPLES:
sage: E = EllipticCurve("15a4") sage: M = E.modular_symbol(implementation="num") sage: M.elliptic_curve() Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + 35*x - 28 over Rational Field
- manin_symbol(u, v, sign=0)#
Given a pair \((u,v)\) presenting a point in \(\mathbb{P}^1(\mathbb{Z}/N\mathbb{Z})\) and hence a coset of \(\Gamma_0(N)\), this computes the value of the Manin symbol \(M(u:v)\).
INPUT:
u
– an integerv
– an integer such that \((u:v)\) is a projective point modulo \(N\)sign
– optional either +1 or -1, or 0 (default), in which case the sign passed to the class is taken.
EXAMPLES:
sage: E = EllipticCurve('11a1') sage: M = E.modular_symbol(implementation="num") sage: M.manin_symbol(1,3) -1/2 sage: M.manin_symbol(1,3, sign=-1) -1/2 sage: M.manin_symbol(1,5) 1 sage: M.manin_symbol(1,5) 1 sage: E = EllipticCurve('14a1') sage: M = E.modular_symbol(implementation="num") sage: M.manin_symbol(1,2) -1/2 sage: M.manin_symbol(17,6) -1/2 sage: M.manin_symbol(-1,12) -1/2
- transportable_symbol(r, rr, sign=0)#
Return the symbol \([r']^+ - [r]^+\) where \(r'=\gamma(r)\) for some \(\gamma\in\Gamma_0(N)\). These symbols can be computed by transporting the path into the upper half plane close to one of the unitary cusps. Here we have implemented it only to move close to \(i\infty\) and \(0\).
INPUT:
r
andrr
– two rational numberssign
– optional either +1 or -1, or 0 (default), in which case the sign passed to the class is taken.
OUTPUT: a rational number
EXAMPLES:
sage: E = EllipticCurve("11a1") sage: M = E.modular_symbol(implementation="num") sage: M.transportable_symbol(0/1,-2/7) -1/2 sage: E = EllipticCurve("37a1") sage: M = E.modular_symbol(implementation="num") sage: M.transportable_symbol(0/1,-1/19) 0 sage: M.transportable_symbol(0/1,-1/19,-1) 0 sage: E = EllipticCurve("5077a1") sage: M = E.modular_symbol(implementation="num") sage: M.transportable_symbol(0/1,-35/144) -3 sage: M.transportable_symbol(0/1,-35/144,-1) 0 sage: M.transportable_symbol(0/1, -7/31798) 0 sage: M.transportable_symbol(0/1, -7/31798, -1) -5


Biking in State College is a joy! The combination of bike racks, paths and friendly legislation makes transportation a breeze. However, a flat can ruin the day. With experience, changing a bike flat takes no more than ten minutes, and is essential knowledge for any cyclist. This tutorial will walk you through the major steps involved with replacing a punctured tube.
Note: Helpful feedback will be highlighted in green!
Use the navigation bar on the left to jump to specific sections of interest. Alternatively, links in the footer navigate to the next and previous steps. Keep an eye out for more tips and feedback in green below.
Things you will need:
- Replacement Tube
- Tire Levers
- Bike Pump
Steps Involved:
- Removing the Wheel from the Frame
- Removing the Punctured Tube from the Wheel
- Visual Inspection
- Replacing the Tube
- Reassembly
First, the entire wheel must be detached from the bike's fork. This involves releasing the brake tension and wheel retention device so the wheel may freely fall off the bike.
The tube that holds air is wrapped in a tire secured to the rim. This step will seperate rim, tube and tire.
Often, the metal shard or thorn that punctured the tube remains embedded in the tire. This step will identify the location of the puncture and remove any particles from the wheel that may cause another flat.
Now that the rim and wheel are prepared for a new tube, we will inflate the replacement and reassemble the wheel.
The wheel, breaks and retention device will be properly reconfigured to safely hold your fully inflated wheel inplace.
Warning! Refer to the glossary if any terms are confusing or unclear. This tutorial assumes you know the distinction between a wheel, tube, tire and rim. Please brush up before continuing.


A simple class that represents a HTTP request. Request encapsulates the URI path, any request parameters, header attributes, body etc. as appropriate.
More...
#include <HttpRequest.h>
|
| typedef std::map< QString, QString > | Map |
| | Map used to represent request parameters and headers. More...
|
| |
| typedef Map::const_iterator | Iterator |
| | Constant iterator to access contents of the parameters and headers. More...
|
| |
|
| | HttpRequest (const QString &uri) |
| | Constructor. Create a request for the specified server resource. More...
|
| |
| | ~HttpRequest () |
| | Destructor. No actions required. More...
|
| |
| const QString & | getUri () const |
| | Return the uri for which this request was created. More...
|
| |
| const QString & | getBody () const |
| | Return the body to send as part of the request. For GET requests, this will be empty. More...
|
| |
| HttpRequest & | setBody (const QString &body) |
| | Set the body to send as part of the request. This is meant for use primarily with POST/PUT type requests. More...
|
| |
| HttpRequest & | setParameter (const QString &key, const QString &value) |
| | Add the specified key/value combination as a request parameter to this request. If a mapping already exists with the specified key, it will be replaced with the specified value. More...
|
| |
| HttpRequest & | setHeader (const QString &key, const QString &value) |
| | Add the specified key/value combination as a request attribute to this request. If a mapping already exists with the specified key, it will be replaced with the specified value. More...
|
| |
| const QString | getParamters () const |
| | Return the requests parameters as a string. Note: A leading ? symbol will not be added, which is required for GET requests. Calls must add if making a GET request. More...
|
| |
| Iterator | beginHeaders () const |
| | Return a constant iterator to the beginning of the headers map. More...
|
| |
| Iterator | endHeaders () const |
| | Return a constant iterator to the beginning of the headers map. More...
|
| |
A simple class that represents a HTTP request. Request encapsulates the URI path, any request parameters, header attributes, body etc. as appropriate.
Constant iterator to access contents of the parameters and headers.
Map used to represent request parameters and headers.
| qsense::net::HttpRequest::HttpRequest |
( |
const QString & |
uri | ) |
|
Constructor. Create a request for the specified server resource.
| qsense::net::HttpRequest::~HttpRequest |
( |
| ) |
|
|
inline |
Destructor. No actions required.
| Iterator qsense::net::HttpRequest::beginHeaders |
( |
| ) |
const |
|
inline |
Return a constant iterator to the beginning of the headers map.
| Iterator qsense::net::HttpRequest::endHeaders |
( |
| ) |
const |
|
inline |
Return a constant iterator to the beginning of the headers map.
| const QString& qsense::net::HttpRequest::getBody |
( |
| ) |
const |
|
inline |
Return the body to send as part of the request. For GET requests, this will be empty.
| const QString qsense::net::HttpRequest::getParamters |
( |
| ) |
const |
Return the requests parameters as a string. Note: A leading ? symbol will not be added, which is required for GET requests. Calls must add if making a GET request.
| const QString& qsense::net::HttpRequest::getUri |
( |
| ) |
const |
|
inline |
Return the uri for which this request was created.
Set the body to send as part of the request. This is meant for use primarily with POST/PUT type requests.
Add the specified key/value combination as a request attribute to this request. If a mapping already exists with the specified key, it will be replaced with the specified value.
Add the specified key/value combination as a request parameter to this request. If a mapping already exists with the specified key, it will be replaced with the specified value.
The documentation for this class was generated from the following file:


XHProf is a hierarchical profiler for PHP. It reports
function-level call counts and inclusive and
exclusive metrics such as wall (elapsed)
time, CPU time and memory usage. A function's profile can be broken
down by callers or callees. The raw data collection component is
implemented in C as a PHP Zend extension called
xhprof
. XHProf has a simple HTML based user
interface (written in PHP). The browser based UI for viewing profiler
results makes it easy to view results or to share results with peers.
A callgraph image view is also supported.
XHProf reports can often be helpful in understanding the structure of the code being executed. The hierarchical nature of the reports can be used to determine, for example, what chain of calls led to a particular function getting called.
XHProf supports ability to compare two runs (a.k.a. "diff" reports) or aggregate data from multiple runs. Diff and aggregate reports, much like single run reports, offer "flat" as well as "hierarchical" views of the profile.
XHProf is a light-weight instrumentation based profiler. During the data collection phase, it keeps track of call counts and inclusive metrics for arcs in the dynamic callgraph of a program. It computes exclusive metrics in the reporting/post processing phase. XHProf handles recursive functions by detecting cycles in the callgraph at data collection time itself and avoiding the cycles by giving unique depth qualified names for the recursive invocations.
XHProf's light-weight nature and aggregation capabilities make it well suited for collecting "function-level" performance statistics from production environments. [See additional notes for use in production.]
XHProfLive (not part of the open source kit), for example, is a system-wide performance monitoring system in use at Facebook that is built on top of XHProf. XHProfLive continually gathers function-level profiler data from production tier by running a sample of page requests under XHProf. XHProfLive then aggregates the profile data corresponding to individual requests by various dimensions such as time, page type, and can help answer a variety of questions such as: What is the function-level profile for a specific page? How expensive is function "foo" across all pages, or on a specific page? What functions regressed most in the last hour/day/week? What is the historical trend for execution time of a page/function? and so on.
Originally developed at Facebook, XHProf was open sourced in Mar, 2009.
XHProf provides:
Function-level summary information such as number of calls, inclusive/exclusive wall time, memory usage, and CPU time.
For each function, it provides a breakdown of calls and times per parent (caller) & child (callee), such as:
You may want to compare data from two XHProf runs for various reasons-- to figure out what's causing a regression between one version of the code base to another, to evaluate the performance improvement of a code change you are making, and so on.
A diff report takes two runs as input and provides both flat function-level diff information, and hierarchical information (breakdown of diff by parent/children functions) for each function.
The "flat" view (sample screenshot) in the diff report points out the top regressions & improvements.
Clicking on functions in the "flat" view of the diff report, leads to the "hierarchical" (or parent/child) diff view of a function (sample screenshot). We can get a breakdown of the diff by parent/children functions.
The profile data can also be viewed as a callgraph. The callgraph view highlights the critical path of the program.
XHProf's memory profile mode helps track functions that allocate lots of memory.
It is worth clarifying that that XHProf doesn't strictly track each allocation/free operation. Rather it uses a more simplistic scheme. It tracks the increase/decrease in the amount of memory allocated to PHP between each function's entry and exit. It also tracks increase/decrease in the amount of peak memory allocated to PHP for each function.
include, include_once, require and
require_once
operations as if they were functions. The name of
the file being included is used to generate the name for these "fake" functions.
main()
: a fictitious function that is at the root of the call graph.
load::<filename>
and run_init::<filename>
:
XHProf tracks PHP include/require
operations as
function calls.
For example, an include "lib/common.php"; operation will result in two XHProf function entries:
load::lib/common.php
- This represents the work done by the
interpreter to compile/load the file. [Note: If you are using a PHP
opcode cache like APC, then the compile only happens on a cache miss
in APC.]
run_init::lib/common.php
- This represents
initialization code executed at the file scope as a result of the
include operation.
foo@<n>
: Implies that this is a
recursive invocation of foo()
, where <n>
represents
the recursion depth. The recursion may be direct (such as due to
foo()
--> foo()
), or indirect (such as
due to foo() --> goo()
--> foo()).
True hierarchical profilers keep track of a full call stack at every data gathering point, and are later able to answer questions like: what was the cost of the 3rd invokation of foo()? or what was the cost of bar() when the call stack looked like a()->b()->bar()?
XHProf keeps track of only 1-level of calling context and is therefore only able to answer questions about a function looking either 1-level up or 1-level down. It turns out that in practice this is sufficient for most use cases.
To make this more concrete, take for instance the following example.
Say you have: 1 call from a() --> c() 1 call from b() --> c() 50 calls from c() --> d()
While XHProf can tell you that d() was called from c() 50 times, it cannot tell you how many of those calls were triggered due to a() vs. b(). [We could speculate that perhaps 25 were due to a() and 25 due to b(), but that's not necessarily true.]
In practice however, this isn't a very big limitation.
The extension lives in the "extension/" sub-directory.
Note: A windows port hasn't been implemented yet. We have
tested xhprof
on Linux/FreeBSD so far.
Version 0.9.2 and above of XHProf is also expected to work on Mac OS. [We have tested on Mac OS 10.5.]
Note: XHProf uses the RDTSC instruction (time stamp counter)
to implement a really low overhead timer for elapsed time. So at the
moment xhprof
only works on x86 architecture.
Also, since RDTSC values may not be synchronized across CPUs,
xhprof
binds the program to a single CPU during the
profiling period.
XHProf's RDTSC based timer functionality doesn't work correctly if SpeedStep technology is turned on. This technology is available on some Intel processors. [Note: Mac desktops and laptops typically have SpeedStep turned on by default. To use XHProf, you'll need to disable SpeedStep.]
The steps below should work for Linux/Unix environments.
% cd <xhprof_source_directory>/extension/ % phpize % ./configure --with-php-config=<path to php-config> % make % make install % make test
php.ini file: You can update your php.ini file to automatically load your extension. Add the following to your php.ini file.
[xhprof] extension=xhprof.so ; ; directory used by default implementation of the iXHProfRuns ; interface (namely, the XHProfRuns_Default class) for storing ; XHProf runs. ; xhprof.output_dir=<directory_for_storing_xhprof_runs>
Test generating raw profiler data using a sample test program like:
foo.php
<?php function bar($x) { if ($x > 0) { bar($x - 1); } } function foo() { for ($idx = 0; $idx < 2; $idx++) { bar($idx); $x = strlen("abc"); } } // start profiling xhprof_enable(); // run program foo(); // stop profiler $xhprof_data = xhprof_disable(); // display raw xhprof data for the profiler run print_r($xhprof_data);
Run the above test program:
% php -dextension=xhprof.so foo.php
You should get an output like:
Array ( [foo==>bar] => Array ( [ct] => 2 # 2 calls to bar() from foo() [wt] => 27 # inclusive time in bar() when called from foo() ) [foo==>strlen] => Array ( [ct] => 2 [wt] => 2 ) [bar==>bar@1] => Array # a recursive call to bar() ( [ct] => 1 [wt] => 2 ) [main()==>foo] => Array ( [ct] => 1 [wt] => 74 ) [main()==>xhprof_disable] => Array ( [ct] => 1 [wt] => 0 ) [main()] => Array # fake symbol representing root ( [ct] => 1 [wt] => 83 ) )
Note: The raw data only contains "inclusive" metrics. For example, the wall time metric in the raw data represents inclusive time in microsecs. Exclusive times for any function are computed during the analysis/reporting phase.
Note: By default only call counts & elapsed time is profiled. You can optionally also profile CPU time and/or memory usage. Replace,
xhprof_enable();in the above program with, for example:
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
You should now get an output like:
Array ( [foo==>bar] => Array ( [ct] => 2 # number of calls to bar() from foo() [wt] => 37 # time in bar() when called from foo() [cpu] => 0 # cpu time in bar() when called from foo() [mu] => 2208 # change in PHP memory usage in bar() when called from foo() [pmu] => 0 # change in PHP peak memory usage in bar() when called from foo() ) [foo==>strlen] => Array ( [ct] => 2 [wt] => 3 [cpu] => 0 [mu] => 624 [pmu] => 0 ) [bar==>bar@1] => Array ( [ct] => 1 [wt] => 2 [cpu] => 0 [mu] => 856 [pmu] => 0 ) [main()==>foo] => Array ( [ct] => 1 [wt] => 104 [cpu] => 0 [mu] => 4168 [pmu] => 0 ) [main()==>xhprof_disable] => Array ( [ct] => 1 [wt] => 1 [cpu] => 0 [mu] => 344 [pmu] => 0 ) [main()] => Array ( [ct] => 1 [wt] => 139 [cpu] => 0 [mu] => 5936 [pmu] => 0 ) )
Skipping builtin functions during profiling
By default PHP builtin functions (such as strlen
) are
profiled. If you do not want to profile builtin functions (to either
reduce the overhead of profiling further or size of generated raw
data), you can use the XHPROF_FLAGS_NO_BUILTINS
flag as in for example:
// do not profile builtin functions xhprof_enable(XHPROF_FLAGS_NO_BUILTINS);
Ignoring specific functions during profiling (0.9.2 or higher)
Starting with release 0.9.2 of xhprof, you can tell XHProf to
ignore a specified list of functions during profiling. This allows you
to ignore, for example, functions used for indirect function calls
such as call_user_func
and
call_user_func_array
. These intermediate functions
unnecessarily complicate the call hierarchy and make the XHProf
reports harder to interpret since they muddle the parent-child
relationship for functions called indirectly.
To specify the list of functions to be ignored during profiling
use the 2nd (optional) argument to xhprof_enable
.
For example,
// elapsed time profiling; ignore call_user_func* during profiling xhprof_enable(0, array('ignored_functions' => array('call_user_func', 'call_user_func_array'))); or, // elapsed time + memory profiling; ignore call_user_func* during profiling xhprof_enable(XHPROF_FLAGS_MEMORY, array('ignored_functions' => array('call_user_func', 'call_user_func_array')));
The XHProf UI is implemented in PHP. The code resides in two
subdirectories, xhprof_html/
and xhprof_lib/
.
The xhprof_html
directory contains the 3 top-level PHP pages.
index.php
: For viewing a single run or diff report.
callgraph.php
: For viewing a callgraph of a XHProf run as an image.
typeahead.php
: Used implicitly for the function typeahead form
on a XHProf report.
The xhprof_lib
directory contains supporting code for
display as well as analysis (computing flat profile info, computing
diffs, aggregating data from multiple runs, etc.).
Web server config: You'll need to make sure that the
xhprof_html/
directory is accessible from your web server, and that
your web server is setup to serve PHP scripts.
Managing XHProf Runs
Clients have flexibility in how they save the XHProf raw data obtained from an XHProf run. The XHProf UI layer exposes an interface iXHProfRuns (see xhprof_lib/utils/xhprof_runs.php) that clients can implement. This allows the clients to tell the UI layer how to fetch the data corresponding to a XHProf run.
The XHProf UI libaries come with a default file based implementation of the iXHProfRuns interface, namely "XHProfRuns_Default" (also in xhprof_lib/utils/xhprof_runs.php). This default implementation stores runs in the directory specified by xhprof.output_dir INI parameter.
A XHProf run must be uniquely identified by a namespace and a run id.
a) Saving XHProf data persistently:
Assuming you are using the default implementation
XHProfRuns_Default
of the
iXHProfRuns
interface, a typical XHProf run
followed by the save step might look something like:
// start profiling xhprof_enable(); // run program .... // stop profiler $xhprof_data = xhprof_disable(); // // Saving the XHProf run // using the default implementation of iXHProfRuns. // include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php"; include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php"; $xhprof_runs = new XHProfRuns_Default(); // Save the run under a namespace "xhprof_foo". // // **NOTE**: // By default save_run() will automatically generate a unique // run id for you. [You can override that behavior by passing // a run id (optional arg) to the save_run() method instead.] // $run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_foo"); echo "---------------\n". "Assuming you have set up the http based UI for \n". "XHProf at some address, you can view run at \n". "http://<xhprof-ui-address>/index.php?run=$run_id&source=xhprof_foo\n". "---------------\n";
The above should save the run as a file in the directory specified
by the xhprof.output_dir
INI parameter. The file's
name might be something like
49bafaa3a3f66.xhprof_foo
; the two parts being the
run id ("49bafaa3a3f66") and the namespace ("xhprof_foo"). [If you
want to create/assign run ids yourself (such as a database sequence
number, or a timestamp), you can explicitly pass in the run id to the
save_run
method.
b) Using your own implementation of iXHProfRuns
If you decide you want your XHProf runs to be stored differently (either in a compressed format, in an alternate place such as DB, etc.) database, you'll need to implement a class that implements the iXHProfRuns() interface.
You'll also need to modify the 3 main PHP entry pages (index.php,
callgraph.php, typeahead.php) in the "xhprof_html/" directory to use
the new class instead of the default class XHProfRuns_Default
.
Change this line in the 3 files.
$xhprof_runs_impl = new XHProfRuns_Default();
You'll also need to "include" the file that implements your class in the above files.
Accessing runs from UI
a) Viewing a Single Run Report
To view the report for run id say <run_id> and namespace <namespace> use a URL of the form:
http://<xhprof-ui-address>/index.php?run=<run_id>&source=<namespace>
For example,
http://<xhprof-ui-address>/index.php?run=49bafaa3a3f66&source=xhprof_foo
b) Viewing a Diff Report
To view the report for run ids say <run_id1> and <run_id2> in namespace <namespace> use a URL of the form:
http://<xhprof-ui-address>/index.php?run1=<run_id1>&run2=<run_id2>&source=<namespace>
c) Aggregate Report
You can also specify a set of run ids for which you want an aggregated view/report.
Say you have three XHProf runs with ids 1, 2 & 3 in namespace "benchmark". To view an aggregate report of these runs:
http://<xhprof-ui-address>/index.php?run=1,2,3&source=benchmark
Weighted aggregations: Further suppose that the above three runs correspond to three types of programs p1.php, p2.php and p3.php that typically occur in a mix of 20%, 30%, 50% respectively. To view an aggregate report that corresponds to a weighted average of these runs using:
http://<xhprof-ui-address>/index.php?run=1,2,3&wts=20,30,50&source=benchmark
Some observations/guidelines. Your mileage may vary:
We recommend using elapsed time + memory profiling mode in production. [Note: The additional overhead of memory profiling mode is really low.]
// elapsed time profiling (default) + memory profiling xhprof_enable(XHPROF_FLAGS_MEMORY);
To profile say 1/10000 of your requests, instrument the beginning of your request processing with something along the lines of:
if (mt_rand(1, 10000) == 1) {
xhprof_enable(XHPROF_FLAGS_MEMORY);
$xhprof_on = true;
}
At the end of the request (or in a request shutdown function), you might then do something like:
if ($xhprof_on) {
// stop profiler
$xhprof_data = xhprof_disable();
// save $xhprof_data somewhere (say a central DB)
...
}
You can then rollup/aggregate these individual profiles by time
(e.g., 5 minutely/hourly/daily basis), page/request type,or other
dimensions using xhprof_aggregate_runs()
.
The xhprof extension also provides a very light weight sampling mode. The sampling interval is 0.1 secs. Samples record the full function call stack. The sampling mode can be useful if an extremely low overhead means of doing performance monitoring and diagnostics is desired.
The relevant functions exposed by the extension for using the
sampling mode are xhprof_sample_enable()
and
xhprof_sample_disable()
.
[TBD: more detailed documentation on sampling mode.]
The xhprof_lib/utils/xhprof_lib.php
file contains
additional library functions that can be used for manipulating/
aggregating XHProf runs.
For example:
xhprof_aggregate_runs()
:
can be used to aggregate multiple XHProf runs into a single run. This
can be helpful for building a system-wide "function-level" performance
monitoring tool using XHProf. [For example, you might to roll up
XHProf runs sampled from production periodically to generate hourly,
daily, reports.]
xhprof_prune_run()
: Aggregating large number of
XHProf runs (especially if they correspond to different types of
programs) can result in the callgraph size becoming too large. You can
use xhprof_prune_run
function to prune the callgraph data
by editing out subtrees that account for a very small portion of the
total time.
xhprof_html/jquery
subdirectory.
The HTML-based navigational interface for browsing profiler results is inspired by that of a similar tool that exists for Oracle's stored procedure language, PL/SQL. But that's where the similarity ends; the internals of the profiler itself are quite different.


Bias-variance decomposition in a nutshell
This post means to give you a nutshell description of bias-variance decomposition.
basic setting
We will show four key results using Bias-variance decomposition.
Let us assume $f_{true}(x_n)$ is the true model, and the observations are given by:
\[y_n = f_{true}(x_n) + \epsilon_n \qquad (1)\]
where $\epsilon_n$ are i.i.d. with zero mean and variance $\sigma^2$. Note that $f_{true}$ can be nonlinear and $\epsilon_n$ does not have to be Gaussian.
We denote the least-square estimation by
\[f_{lse}(x_{\ast}) = \tilde{x}_{\ast}^T w_{lse} \]
Where the tilde symbol means there is a constant 1 feature added to the raw data. For this derivation, we will assume that $x_{\ast}$ is fixed, although it is straightforward to generalize this.
Expected Test Error
Bias-variance comes directly out of the test error:
Where equation (2.2) is the expectation over training data and testing data; and the second term in equation (2.7) is called predict variance, and the third term of it is called the square of predict bias. Thus comes the name bias-variance decomposition.
Where does the bias come from? model bias and estimation bias
As illustrated in the following figure, bias comes from model bias and estimation bias. Model bias comes from the model itself; and estimation bias comes from dataset (mainly). And bear in mind that ridge regression increases estimation bias while reducing variance(you may need to find other papers to get this idea)
References
- Kevin, Murphy. “Machine Learning: a probabilistic perspective.” (2012).
- Bishop, Christopher M. “Pattern recognition.” Machine Learning 128 (2006).
- Emtiyaz Khan’s lecture notes on PCML, 2015


Index
All Classes|All Packages
A
- AddRecipe() - Method in class SteppingStones.RecipeBox
-
creates a default instance of Recipe and calls the AddNewRecipe() method
- AddRecipeIngredient(Ingredient) - Method in class SteppingStones.Recipe
-
Adds the recipe Ingredient to the list of recipes
C
- CreateNewRecipe() - Method in class SteppingStones.Recipe
-
Creates a new recipe object and associated ingredients
D
- DeleteRecipe(String) - Method in class SteppingStones.RecipeBox
-
Deletes the recipe from the collection by recipe name
G
- GetCost() - Method in class SteppingStones.Ingredient
-
Gets the cost for this ingredient
- GetIngredientAmount() - Method in class SteppingStones.Ingredient
-
Gets The Amount of this ingredient
- GetListOfRecipes() - Method in class SteppingStones.RecipeBox
-
Gets the List of Recipe(s)
- GetMaxCaloriesPerUnit() - Method in class SteppingStones.Ingredient
-
Gets the Max Calories per Unit
- GetMaxIngredientAmount() - Method in class SteppingStones.Ingredient
-
Gets the Ingredient Amount's max limit
- GetNameOfIngredient() - Method in class SteppingStones.Ingredient
-
Gets The name of this ingredient
- GetNumberCaloriesPerUnit() - Method in class SteppingStones.Ingredient
-
Gets The Number of Calories per Unit
- GetRecipeIngredients() - Method in class SteppingStones.Recipe
-
Gets the list of names for the recipe Ingredients
- GetRecipeName() - Method in class SteppingStones.Recipe
-
Gets the name of the recipe
- GetServings() - Method in class SteppingStones.Recipe
-
Gets the Servings for the recipe
- GetTotalCalories() - Method in class SteppingStones.Ingredient
-
Gets the Total Calories for this ingredient
- GetTotalRecipeCalories() - Method in class SteppingStones.Recipe
-
Gets the total recipe calories
- GetUnitMeasurement() - Method in class SteppingStones.Ingredient
-
Gets The Unit of measurement for this ingredient
I
- Ingredient - Class in SteppingStones
-
SNHU IT-511
- Ingredient() - Constructor for class SteppingStones.Ingredient
-
Default Constructor - Sets the member variables to their defaults
- Ingredient(String, String, Float, int, double, double) - Constructor for class SteppingStones.Ingredient
-
Declared Constructor - Sets the member variables to the passed in values
M
- main(String[]) - Static method in class SteppingStones.Main
-
Driver Class, Driver Main
- Main - Class in SteppingStones
-
SNHU IT-511
- Main() - Constructor for class SteppingStones.Main
P
- PrintAllRecipeDetails(String) - Method in class SteppingStones.RecipeBox
-
Prints all the recipe details
- PrintAllRecipeNames() - Method in class SteppingStones.RecipeBox
-
Prints all the recipe names Prints all the recipe names from the instance's List of Recipes
- PrintIngredient() - Method in class SteppingStones.Ingredient
-
Prints the ingredient out
- PrintRecipe() - Method in class SteppingStones.Recipe
-
Prints the recipe and the associated ingredients
R
- Recipe - Class in SteppingStones
-
SNHU IT-511
- Recipe() - Constructor for class SteppingStones.Recipe
-
Default Constructor - Sets the member variables to their defaults
- Recipe(String, int, ArrayList<Ingredient>, double) - Constructor for class SteppingStones.Recipe
-
Declared Constructor - Sets the member variables to the passed in values
- RecipeBox - Class in SteppingStones
-
SNHU IT-511
- RecipeBox() - Constructor for class SteppingStones.RecipeBox
-
Default Constructor - Sets the member variables to their defaults
- RecipeBox(ArrayList<Recipe>) - Constructor for class SteppingStones.RecipeBox
-
Declared Constructor - Sets the member variables to the passed in values
S
- SetCost(double) - Method in class SteppingStones.Ingredient
-
Sets the cost for this ingredient
- SetIngredientAmount(Float) - Method in class SteppingStones.Ingredient
-
Sets the Ingredient Amount's max limit
- SetListOfRecipes(ArrayList<Recipe>) - Method in class SteppingStones.RecipeBox
-
Sets the List of Recipe(s)
- SetNameOfIngredient(String) - Method in class SteppingStones.Ingredient
-
Sets The name of this ingredient
- SetNumberCaloriesPerUnit(int) - Method in class SteppingStones.Ingredient
-
Set The Number of Calories per Unit
- SetRecipeIngredients(ArrayList<Ingredient>) - Method in class SteppingStones.Recipe
-
Sets the list of names for the recipe Ingredients
- SetRecipeName(String) - Method in class SteppingStones.Recipe
-
Sets the name of the recipe
- SetServings(int) - Method in class SteppingStones.Recipe
-
Sets the Servings for the recipe
- SetTotalCalories(double) - Method in class SteppingStones.Ingredient
-
Set The total calories for this ingredient
- SetTotalRecipeCalories(double) - Method in class SteppingStones.Recipe
-
Sets the total recipe calories
- SetUnitMeasurement(String) - Method in class SteppingStones.Ingredient
-
Sets The Unit of measurement for this ingredient
- SteppingStones - package SteppingStones
U
- UpdateRecipe(String) - Method in class SteppingStones.RecipeBox
-
Updates Recipe from the collection by recipe name
- UpdateRecipe(Recipe) - Method in class SteppingStones.Recipe
-
Updates this recipe object and associated ingredients
All Classes|All Packages


Preparation time
1-2 hours
Cooking time
1 to 2 hours
Serves
Serves 4
For the beans, place a heavy-bottomed saucepan onto a medium heat and add the olive oil, shallots, thyme leaves, bay leaf, garlic, ginger and peppercorns. Gently fry for 2-3 minutes, until the shallots are soft but not coloured.
Add the vinegar to the pan and swirl to combine. Remove from the heat and allow to cool.
Meanwhile, bring a pan of lightly salted water to the boil and blanch the beans for two minutes. Drain and refresh the beans in cold water.
Place the beans into a large bowl and sprinkle with the sugar, tossing gently to coat. Pour the cooled vinegar mixture over the beans and set aside.
For the jacket potatoes, preheat the oven to 200C/400F/Gas 6.
Pierce the baking potatoes several times all over with a sharp knife, then place into the oven to bake for one hour, or until crisp on the outside, but tender when pierced with a knife. Remove from the oven and allow to cool slightly.
Preheat the grill to its highest setting.
Meanwhile, heat a frying pan until hot. Add the bacon strips and fry, stirring occasionally for 3-4 minutes until golden and crisp. Remove the bacon from the fat with a slotted spoon and set aside to drain on kitchen paper.
When the potatoes are cool, place them onto a board and slice the tops off. Using a spoon, scoop out all of the potato flesh from the skins and place the flesh into a clean bowl.
Mash the potato flesh until smooth, then add the cooked bacon, flaked mackerel and crème fraîche. Season, to taste, with salt and freshly ground black pepper.
Carefully spoon the potato mixture back into the potato skins and place onto a baking sheet. Top each potato with a piece of Taleggio and place under the grill to cook until the cheese is golden and bubbling.
To serve, place the jacket potatoes onto four plates and place a spoonful of the pickled beans alongside.


Task 1:
Literals: Inspect scripts.js
Try the function
Task 2:
Task 3:
Task 4:
* Everything is logged to the console as well


{% block head %}{% endblock %}
Home
(current)
About Us
Core Concept
History
Environment
Teachers
Classes
Contact
{% block main %}{% endblock %}


And the man believed the word that Jesus had spoken unto him, and he went his way.


I consider myself as having a pretty high tolerance for all kinds of drugs -(Except Salvia – THAT STUFF KICKED MY BUTT!!!), and these resins that I smoked really did not do a whole lot for me except make me tired.
First of all, I ordered both from an Internet source that I will not mention that sent the wild dagga resin in a small plastic zip lock baggie. I had to cut the baggie to get to the sticky stuff, and even then, it got all over everything (kinda like smoking bowl resin out of the elbow – the really sticky gooey stuff). Anyway, I FINALLY got enough in the bowl to smoke and I had to put ashes in the bottom of the bowl because otherwise the resin would have just dripped all down in the bowl.  I did not really feel any different than my usual stonedness, except my eyes did not feel dry.
Then, after about 30 minutes, I decided to try the blue lotus stuff. This was packaged better because the resin was wrapped in wax paper and was not so gooey. It had more of a hash consistency to it. I again put ashes in the bottom of the bowl and put the blue lotus resin on top. I hit that about 5-6 times. It was not as harsh as the wild dagga, but harsh nonetheless. After that, the only thing that I really noticed was that the TV looked more 3D. I felt kind of floaty, but I definitely prefer a good ole fashioned MJ buzz to either one of these. After that, I went to bed early because my lungs felt too tight to smoke any MJ – kinda the feeling in the lungs that I have after tripping acid all night. Perhaps these herbs are better left to those who practice meditation and that sort of thing. It is supposed to help one think clearly. I don’t know...
I wouldn't waste my time on wild dagga and blue lotus.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


The CAN is the back end of the horn antenna.  The simplest way of doing this is by placing each part horizontally in the clips of the helping hands of your soldering stand. A small drop of solder is melted onto the tip of the SMA connector and onto the tip of copper wire. The two soldered ends are brought together and then soldered together. Make sure that the SMA connector and the copper wire are aligned horizontally before soldering. Remember that the parts will be hot! Do not handle the parts too quickly after applying the solder to the tip of the SMA connector and the copper wire. Use tweezers or needle nose pliers to handle the hot parts. You can also let the parts cool before handling. Click on the video link to watch a demonstration of soldering the SMA connector to the copper wire.
https://youtu.be/lt63VYeqB38
Preparing the Can
Making the paint thinner can into the back end of the radio telescope requires four steps:
1. Removing the bottom of the paint thinner can
2. Drilling the hole for the antenna
3. Taping the spout of the paint thinner can
4. Attaching the antenna to the paint thinner can
Removing the Bottom of the Paint Thinner Can
Removing the bottom of the paint thinner can is best done with a smooth edge can opener. The OXO Smooth Edge Can Opener model number 2128100 works the best. This can opener cuts on the outside of the can instead of the inside and leaves a very smooth edge. This can opener also has a top turning knob. Do not get a side turning knob can opener. The side turning knob hits the side of the paint thinner can. A regular can opener will also not engage far enough down the inside edge of the paint thinner can to cut properly or at all. The rounded corners of a paint thinner can are also impossible for a regular can opener to navigate. Click on the video link to watch a demonstration of cutting the bottom off the paint thinner can.
https://youtu.be/IFm9_-f6lvQ
Drilling the Feedthrough Hole
A hole needs to be drilled in the paint thinner can for the feedthrough antenna. The hole is 1/4 of an inch in diameter and is located 5.25cm from the edge of the top of the paint thinner can (the uncut side) and 3.25 inches from the side (the centerline of the can). You should also place a snuggly fitting wooden support block in the can under the spot where the hole is to be drilled. This will insure a clean, smooth, and circular hole. Click on the video link to watch a demonstration of drilling the feedthrough hole.
https://youtu.be/nOl8OJEHZHQ
Taping the Spout
You should tape the spout opening of the can before attaching the feedthrough antenna. You will need two 2 inches long pieces of aluminum tape to cover the outside and inside of the spout. This is assuming that the roll of aluminum tape is 1.5 inches wide. Do your best to keep the tape smooth and flush with the edges of the spout. Click on the video link to watch a demonstration of taping the spout.
https://youtu.be/t-MNZw7UhMI
Attaching the Feedthrough Antenna
The feedthrough antenna is soldered onto the paint thinner can. First use the soldering iron or hot air gun to melt enough solder to surround the 1/4 inch hole and also be a pool of solder the size of the base of the SMA connector. Let the solder cool. Drop the feedthrough antenna into the hole copper wire side down. Look into the paint thinner can and center the feedthrough antenna in the 1/4 inch hole. You do not want the copper wire or solder touching the metal can. Use the hot air gun to heat up the SMA connector, ring of solder, and metal can. When all three pieces are at the correct temperature, the solder will liquify and pull the SMA connector down level with the metal can. This should be a solid connection between the metal can and the SMA connector. Click on the video link to watch a demonstration of attaching the feedthrough antenna.
https://youtu.be/dH5D2EP3ODM


Basic form fields
Required Textfield
Required Select
Select an option
Selected
Required Checkbox
Required Checkbox
daftValidation form fields
Required
Required Select
Select an option
Selected


Timing Labels Assistant for use with Audacity to produce timings for SAB
The Latest releases can be always be found at (https://github.com/indiamcq/timing-labels-assistant/releases)
Put the file in a writable folder, not in a subdirectory of Program Files.
After starting the file the first time, it brings up a Select the default phrases folder dialog. This is to populate an ini file in the same folder.
You may want to change the location of the phrases file path in the ini file for the next book or language.
1 If you like listening to the file and inserting a timing point on the fly then just press [tab] or backslash [\\] or Numberpad plus [+] key. The timing point is added and the relevant reference 1a is inserted. Pressing again will insert the next point at that playback point and add the next label from the phrase file.
2 If you like the guess timing points by the WAV form shape, then just right mouse click where you want the timing point and it will be added with the label.
You can mix the methods together if you like.
You can now restart labeling if you quit part way through a previous session. Find the Timing-Labels-Assistant icon in the system tray or the System Tray overflow area and left click on it and select the top menu item, Restart timing at label.... The next label to be inserted will be the one you selected. If you typed a label that does not exist then it will ask you to try again.
If the timing is wrong, don't delete it, just move it to the right place. Click the mouse in the circle part of the timing point, then drag the point to the correct place. Or if you delete it click on the tray icon for TLA and select Restart at menu item.
When the last reference is found it is inserted then the program issues a beep then exits.
Ian


You are finished! Thank you for your participation in this experiment. You will be eligible for full payment once you answer the following questions.
Please rate how much you agree or disagree with
the following statements and provide additional comments where
appropriate (fields with a * are
required):


Explanation
Set Up
I've used a clone of angular-seed to set this project up. Therefore the backend runs on NodeJS http-server. Both NPM and Bower have been used to get the project running and install the various dependencies.
Home (View 1) uses the $http/ngRoute dependencies to demonstrate use of a public REST API. A POST request is sent to the API with the parameters taken from the user input.
MVC
- View: 3 of these have been included - 1 per application menu item
- Controller: 1 controller per view, split into functions
AngularJS v1.5
- $http get and post examples - ngroute
- Inclusion of external libraries - angular-spinner
- Error handling
Git
Clone of Angular-Seed project. Then forked to blind-alpaca (replacing the origin).
Bootstrap
Bootstrap 3 has been used, utilising the grid layout included with it and other standard optimised properties.


{% load static %}
{%block title%}Coding Club IITG{%endblock%}
Coding Club
HOME
LOGIN
SIGNUP
{%block content%}
WEB DESIGN / WEB DEVELOPMENT / SOCIAL MEDIA
DIGITAL TEAM
What we do
Talk to us
{%endblock%}


K
- type of key for mapV
- type of value for mappublic final class GinMapBinder<K,V>
extends java.lang.Object
Example usage:
interface X {}; class X1Impl implements X {}; class X2Impl implements X {}; class X3Provider implements Provider<X> {}; GinMapBinder<String, X> mapBinder = GinMapBinder.newMapBinder(binder(), String.class, X.class); mapBinder.addBinding("id1").to(X1Impl.class); mapBinder.addBinding("id2").to(X2Impl.class); mapBinder.addBinding("id3").toProvider(X3Provider.class);
GIN supports instance binding for only limited set of types. To overcome this limitation,
GinMapBinder provides addBinding(Class)
method so bindings can be added via a key
provider class that will instantiate the actual key during runtime. This alternative approach
is needed to used for all key types that cannot be bound via
GinConstantBindingBuilder
:
class Place { public Place(String key) { ... } } class HomePlaceProvider implements Provider<Place> { public Place get() { return new Place("home"); } } class AboutPlaceProvider implements Provider<Place> { public Place get() { return new Place("about"); } } GinMapBinder<Place, X> mapBinder = GinMapBinder.newMapBinder(binder(), Place.class, X.class); mapBinder.addBinding(HomePlaceProvider.class).to(XImpl1.class); mapBinder.addBinding(AboutPlaceProvider.class).to(XImpl2.class);
| Modifier and Type | Method and Description |
|---|---|
GinLinkedBindingBuilder<V> |
addBinding(java.lang.Class<? extends javax.inject.Provider<? extends K>> keyProvider)
Returns a binding builder used to add a new entry in the map using a key provider.
|
GinLinkedBindingBuilder<V> |
addBinding(K key)
Returns a binding builder used to add a new entry in the map.
|
GinLinkedBindingBuilder<V> |
addBinding(TypeLiteral<? extends javax.inject.Provider<? extends K>> keyProvider)
Returns a binding builder used to add a new entry in the map using a key provider.
|
static <K,V> GinMapBinder<K,V> |
newMapBinder(GinBinder binder,
java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Returns a new mapbinder that collects entries of
keyType /valueType in a
Map that is itself bound with no binding annotation. |
static <K,V> GinMapBinder<K,V> |
newMapBinder(GinBinder binder,
java.lang.Class<K> keyType,
java.lang.Class<V> valueType,
java.lang.annotation.Annotation annotation)
Returns a new mapbinder that collects entries of
keyType /valueType in a
Map that is itself bound with annotation . |
static <K,V> GinMapBinder<K,V> |
newMapBinder(GinBinder binder,
java.lang.Class<K> keyType,
java.lang.Class<V> valueType,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns a new mapbinder that collects entries of
keyType /valueType in a
Map that is itself bound with annotationType . |
static <K,V> GinMapBinder<K,V> |
newMapBinder(GinBinder binder,
TypeLiteral<K> keyType,
TypeLiteral<V> valueType)
Returns a new mapbinder that collects entries of
keyType /valueType in a
Map that is itself bound with no binding annotation. |
static <K,V> GinMapBinder<K,V> |
newMapBinder(GinBinder binder,
TypeLiteral<K> keyType,
TypeLiteral<V> valueType,
java.lang.annotation.Annotation annotation)
Returns a new mapbinder that collects entries of
keyType /valueType in a
Map that is itself bound with annotation . |
static <K,V> GinMapBinder<K,V> |
newMapBinder(GinBinder binder,
TypeLiteral<K> keyType,
TypeLiteral<V> valueType,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns a new mapbinder that collects entries of
keyType /valueType in a
Map that is itself bound with annotationType . |
GinMapBinder<K,V> |
permitDuplicates()
Configures the
MapBinder to handle duplicate entries. |
public static <K,V> GinMapBinder<K,V> newMapBinder(GinBinder binder, TypeLiteral<K> keyType, TypeLiteral<V> valueType)
keyType
/valueType
in a
Map
that is itself bound with no binding annotation.public static <K,V> GinMapBinder<K,V> newMapBinder(GinBinder binder, java.lang.Class<K> keyType, java.lang.Class<V> valueType)
keyType
/valueType
in a
Map
that is itself bound with no binding annotation.public static <K,V> GinMapBinder<K,V> newMapBinder(GinBinder binder, TypeLiteral<K> keyType, TypeLiteral<V> valueType, java.lang.annotation.Annotation annotation)
keyType
/valueType
in a
Map
that is itself bound with annotation
.public static <K,V> GinMapBinder<K,V> newMapBinder(GinBinder binder, java.lang.Class<K> keyType, java.lang.Class<V> valueType, java.lang.annotation.Annotation annotation)
keyType
/valueType
in a
Map
that is itself bound with annotation
.public static <K,V> GinMapBinder<K,V> newMapBinder(GinBinder binder, TypeLiteral<K> keyType, TypeLiteral<V> valueType, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
keyType
/valueType
in a
Map
that is itself bound with annotationType
.public static <K,V> GinMapBinder<K,V> newMapBinder(GinBinder binder, java.lang.Class<K> keyType, java.lang.Class<V> valueType, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
keyType
/valueType
in a
Map
that is itself bound with annotationType
.public GinMapBinder<K,V> permitDuplicates()
MapBinder
to handle duplicate entries.
When multiple equal keys are bound, the value that gets included in the map is arbitrary.
In addition to the Map<K, V>
and Map<K, Provider<V>>
maps that are normally
bound, a Map<K, Set<V>>
and Map<K, Set<Provider<V>>>
are also bound,
which contain all values bound to each key.
When multiple modules contribute elements to the map, this configuration option impacts all of them.
public GinLinkedBindingBuilder<V> addBinding(K key)
It is an error to call this method without also calling one of the to
methods on the
returned binding builder.
Scoping elements independently is supported. Use the in
method to specify a binding
scope.
public GinLinkedBindingBuilder<V> addBinding(java.lang.Class<? extends javax.inject.Provider<? extends K>> keyProvider)
This API is not compatible with Guice however it is provided as GIN has limitation to bind
'instances'. For that reason for all key types that are not defined in
GinConstantBindingBuilder
needs to use a provider
class for each key together with this method.
addBinding(Object)
public GinLinkedBindingBuilder<V> addBinding(TypeLiteral<? extends javax.inject.Provider<? extends K>> keyProvider)
This API is not compatible with Guice however it is provided as GIN has limitation to bind
'instances'. For that reason for all key types that are not defined in
GinConstantBindingBuilder
needs to use a provider
class for each key together with this method.
addBinding(Object)


The ratio scale on the 1 : 50 000 topographic map compares one unit on the map to 50 000 of the same unit on the ground. This means that 1 cm : 50 000 cm. In reality we use kilometres and since there are 100 000 cm in 1 km, we can say that 1 cm : 0,5 km.
For example: If you measure the distance on a topographic
map to be 3,7 cm between two places, the calculation to
convert to km is:


Oatmeal Chocholate Chip Cookies
- Oats
- Chocholate
- Flour
- Salt
- Baking Soda
- Mix the ingredients together
- Add Oats and Chocholate Chips
- Put them in refrigerator for 45min to prevent overspreding
- Scoop cookie dough balls onto the pan
For more tips go to this website for SallysBakingAddiction more help


The Slice
that LEAN passes to the OnData
method represents all of the data for your subscriptions at a single point in time. The Slice
object contains data like Tick
objects, TradeBar
objects, QuoteBar
objects, corporate actions, and chains for Option and Future contracts. You can use the data in the Slice
to make trading decisions.
To access data in the Slice
, index it with the security Symbol
. If you use the security ticker instead of the Symbol
, LEAN automatically finds the Symbol
.
public override void OnData(Slice slice) { if (slice.ContainsKey(_symbol)) { var myData = slice[_symbol]; } }
def OnData(self, slice: Slice) -> None: if slice.ContainsKey(self.symbol): my_data = slice[self.symbol]
The following table shows the Slice
property to index based on the data format you want:
| Data Format | Slice Property |
|---|---|
TradeBar |
Bars |
QuoteBar |
QuoteBars |
Tick |
Ticks |
public override void OnData(Slice slice) { if (slice.ContainsKey(_symbol)) { var bar = slice.Bars[_symbol]; } }
def OnData(self, slice: Slice) -> None: if slice.ContainsKey(self.symbol): bar = slice.Bars[self.symbol]
If you just index the Slice
instead of the preceding properties, it returns the correct object. If your data subscription provides QuoteBar
objects and you index the Slice
with the security Symbol
, it returns the QuoteBar
.
Slice
objects have the following properties:
For more information about the Slice
class, see Timeslices.


Take note on the last dot which is needed to see the directory as a file and to
actually get a last modification date of it.
This comes in handy when you want just one 'last updated' message on the
frontpage of your website and still taking all files of your website into
account.
Regards,
Frank Keijzers
===============================================================================
This is a very handy function for dealing with browser caching. For example,
say you have a stylesheet and you want to make sure everyone has the most
recent version.  Instead, you can do this:
';
?>
Sample output:
By appending a GET value (the UNIX timestamp) to the stylesheet URL, you make
the browser think the stylesheet is dynamic, so it'll reload the stylesheet
every time the modification date changes.
===============================================================================
There's a deeply-seated problem with filemtime() under Windows due to the fact
that it calls Windows' stat() function, which implements DST (according to this
bug: http://bugs.php.net/bug.php?id=40568). The detection of DST on the time of
the file is confused by whether the CURRENT time of the current system is
currently under DST.
This is a fix for the mother of all annoying bugs:
Dustin Oprea
===============================================================================
While testing on Windows, I noticed that the precision of filemtime is just 1
second.
So if you use clearstatcache() and filemtime() to check if a file has been
modified, it might fail to detect the change. The modifications just have to
happen within less than a second.
(I ran into this with Apache on Windows XP.)
===============================================================================
If PHP's integer type is only 32 bits on your system, filemtime() will fail on
files over 2GB with the warning "stat failed". All stat()-related commands will
exhibit the same behavior.
As a workaround, you can call the system's stat command to get the modification
time of a file:
On FreeBSD:
$mtime = exec ('stat -f %m '. escapeshellarg ($path));
On Linux:
$mtime = exec ('stat -c %Y '. escapeshellarg ($path));
Thanks to "mpb dot mail at gmail dot com" for his/her similar comment on stat
().
===============================================================================
Another little handy tool; to get the most recent modified time from files in a
directory. It even does recursive directories if you set the $doRecursive param
to true. Based on a file/directory list function I saw somewhere on this site.
;)
function mostRecentModifiedFileTime($dirName,$doRecursive) {
$d = dir($dirName);
$lastModified = 0;
while($entry = $d->read()) {
if ($entry != "." && $entry != "..") {
if (!is_dir($dirName."/".$entry)) {
$currentModified = filemtime($dirName."/".$entry);
} else if ($doRecursive && is_dir($dirName."/".$entry)) {
$currentModified = mostRecentModifiedFileTime($dirName."/
".$entry,true);
}
if ($currentModified > $lastModified){
$lastModified = $currentModified;
}
}
}
$d->close();
return $lastModified;
}
===============================================================================
Cheaper and dirtier way to code a cache:
= $cache_life)){
ob_start();
resource_consuming_function();
file_put_contents($cache_file,ob_get_flush());
}else{
readfile($cache_file);
}
?>
===============================================================================
i needed the ability to grab the mod time of an image on a remote site. the
following is the solution with the help of Joe Ferris.
===============================================================================
Here is a handy script to create a csv file with file names and the date when
files in a given folder were inserted:
===============================================================================
The above code works fine if you place it on each page you want a date stamp
on. I've found that if you place a reference such as filemtime(__FILE__) in an
included or required file, that the modification time of the inherited file
will be returned, not the time of the file that did the ineriting.
===============================================================================
Here is a small but handy script that you can use to find which files in your
server are modified after a date/time that you specify. This script will go
through all folders in the specified directory recursively and echo the
modified files with the last modified date/time...
//Starts Here
//Put here the directory you want to search for. Put / if you want to search
your entire domain
$dir='/';
//Put the date you want to compare with in the format of: YYYY-mm-dd hh:mm:ss
$comparedatestr="2006-08-12 00:00:00";
$comparedate=strtotime($comparedatestr);
//I run the function here to start the search.
directory_tree($dir,$comparedate);
//This is the function which is doing the search...
function directory_tree($address,$comparedate){
@$dir = opendir($address);
if(!$dir){ return 0; }
while($entry = readdir($dir)){
if(is_dir("$address/$entry") && ($entry != ".." && $entry !=
".")){
directory_tree("$address/$entry",$comparedate);
}
else {
if($entry != ".." && $entry != ".") {
$fulldir=$address.'/'.$entry;
$last_modified = filemtime($fulldir);
$last_modified_str= date("Y-m-d h:i:s", $last_modified);
if($comparedate < $last_modified) {
echo $fulldir.'=>'.$last_modified_str;
echo " ";
}
}
}
}
}
===============================================================================
Here's a handy little function for smart cache overriding :)
';
}
}
?>
===============================================================================
The mentioned example:
$filename = 'somefile.txt';
if (file_exists($filename)) {
echo "$filename wurde zuletzt modifiziert:: " . date ("F d Y H:i:s.",
filemtime($filename));
}
works, however is not ideal from a performance point of view of serving static
files through PHP, since it basically needs two perform two file system
operations (file_exists and filemtime). A more effective way would be to only
use filemtime and save the overhead of file_exists using:
$filename = 'somefile.txt';
$fmtime = filemtime($filename);
if (!$fmtime) {
echo "$filename wurde zuletzt modifiziert:: " . date ("F d Y H:i:s.",
$fmtime);
}
===============================================================================
To find the oldest file in a directory :
$directory= "C:\\";
$smallest_time=INF;
$oldest_file='';
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
$time=filemtime($directory.'/'.$file);
if (is_file($directory.'/'.$file)) {
if ($time < $smallest_time) {
$oldest_file = $file;
$smallest_time = $time;
}
}
}
closedir($handle);
}
echo $oldest_file;
===============================================================================
If you do use:
Make note that it will throw a warning as the documentation states. While
tobias makes a good point for production, when error reporting is off, this can
increase your performance over using `file_exists`. However, if error reporting
is on and it's writing to a log... this is not the case. Obviously this varies
on sever specs and the size of the error log. For most cases, it's still ideal
to use the `file_exists` method.
===============================================================================
To get the modification date of some remote file, you can use the fine function
by notepad at codewalker dot com (with improvements by dma05 at web dot de and
madsen at lillesvin dot net).
But you can achieve the same result more easily now with stream_get_meta_data
(PHP>4.3.0).
However a problem may arise if some redirection occurs. In such a case, the
server HTTP response contains no Last-Modified header, but there is a Location
header indicating where to find the file. The function below takes care of any
redirections, even multiple redirections, so that you reach the real file of
which you want the last modification date.
hih,
JJS.
===============================================================================
concerning "notepad at codewalkers dot com"'s code:
this code is pretty neat, but i just wanted to note that using the
"HEAD"-method instead of the "GET"-method in the http-request might be
preferrable, since then not the whole resource is being downloaded...
http/1.1 definiton snippet:
Section "9.4 HEAD"
The HEAD method is identical to GET except that the server MUST NOT return a
message-body in the response. The metainformation contained in the HTTP headers
in response to a HEAD request SHOULD be identical to the information sent in
response to a GET request. This method can be used for obtaining
metainformation about the entity implied by the request without transferring
the entity-body itself. This method is often used for testing hypertext links
for validity, accessibility, and recent modification. [...]
-- snippet end ---
the code would then be...:
-- snippet ---
fputs($handle,"HEAD $uri[path] HTTP/1.1\r\nHost: $uri[host]\r\n\r\n");
-- snippet end ---
regards, Magnus
===============================================================================
"this is not (necessarily) correct, the modification time of a directory will
be the time of the last file *creation* in a directory (and not in it's sub
directories)."
This is not (necessarily) correct either. In *nix the timestamp can be
independently set. For example the command "touch directory" updates the
timestamp of a directory without file creation.
Also file removal will update the timestamp of a directory.
===============================================================================
Also on 32-bit systems, filemtime() also does not work for files with
modification time set beyond Jan 2038. It is the dreaded time_t overflow bug
for unix seconds.
On windows you can set the system time to any arbitrary future date, and any
new files you created or edited will automatically change to that future date.
If exec isn't permitted for some reason, and if you could access the file via
an web url (e.g. http://localhost/yourfile.txt), another workaround is to get
the Last-Modified time from the HTTP headers (e.g. get_headers(url) ), and
parse it as a DateTime object.
I have tested it and it works for years like 2050 and 3012.
===============================================================================
Cheap and dirty way to code a cache:
=
$cache_life)){
ob_start();
resource_consuming_function();
file_put_contents($cache_file,ob_get_flush());
}else{
readfile($cache_file);
}
?>
===============================================================================
when working with swf files (flash animations), there is a nice way to avoid
the browser cache. i used to do this by hand, then i used a random number, but
with large animations while working online, it gets boring because the server
always downloads the whole animation, even if there was no change.
but...
this will do the trick
base.swf?rand=