text:
<!DOCTYPE html>

<title>Numbers Into Notes</title>
<meta name="description" content="Javascript interactive demo for the Ada Lovelace Symposium, in which number
sequences are converted into notes.  December 2015, this version released February 2016.">
<meta name="keywords" content="ada, lovelace, babbage, analytical engine, fibonacci, integer sequences">
<meta name="author" content="David De Roure">
<meta charset="UTF-8">
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />

<link rel="stylesheet" href="css/NumbersIntoNotes.css" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" />

Numbers Into Notes

“Supposing, for instance, that the fundamental relations of pitched
sounds in the science of harmony and of musical composition were susceptible
of such expression and adaptations, the engine might compose elaborate
and scientific pieces of music of any degree of complexity or extent.”
  Ada Lovelace, 1843

<button class="btn btn-info" data-toggle="tooltip" data-placement="top" title="Jump to About section">About</button>

1. Generate

The first stage in this interactive demonstration is to generate
a sequence of numbers using an algorithm that might have been run on
the Analytical Engine.
In stage 2 you reduce these numbers to a smaller range
of numbers, using 'clock arithmetic'. Then
in stage 3, you can visualize and play the number sequence
interactively, and explore the mapping of the numbers to musical notes.
If this is your first visit, try the green buttons.
NB This program has been developed and tested in Chrome and Firefox
browsers.

Fibonacci

Each number is the sum of the previous two. If we start with 0, 1 we
get the sequence commonly known as the

Fibonacci numbers
0, 1, 1, 2, 3, 5, 8, 13, ... (could also start 1, 1). If we start with 2, 1
we get the

Lucas numbers
2, 1, 3, 4, 7, 11, 18, ... (could also start 1, 3).
The sequences are described mathematically by the relation
Fk,n+1 = kFk,n + Fk,n-1 where k = 1.

<button class="btn btn-success" onclick="doFibonacci()" data-toggle="tooltip" data-placement="top" title="Generate sequence of Fibonacci numbers">Fibonacci</button>
   n0: <input type="number" id="n0" value="0" min="0" max="999">
   n1: <input type="number" id="n1" value="1" min="0" max="999">
   k:  <input type="number" id="k" value="1" min="1" max="99">

Powers

The sequence of powers of 2 is 20, 21,
22, 23, ... i.e. 1, 2, 4, 8, 16, 32 etc.  Here
you can generate the sequence of powers of 2 or any other number,
known as the base.

<button class="btn btn-success" onclick="doPowers()" data-toggle="tooltip" data-placement="top" title="Generate sequence of powers">Powers</button>
  base: <input type="number" id="base" value="2" min="2" max="99">

Other Algorithms

How might Ada Lovelace have calculated these?

<button class="btn btn-default" onclick="doPrimes()" data-toggle="tooltip" data-placement="top" title="Generate sequence of prime numbers">Primes</button>
<button class="btn btn-default" onclick="doPi(100)" data-toggle="tooltip" data-placement="top" title="Generate sequence of digits of pi">Pi</button>
<button class="btn btn-default" onclick="doPhi(320)" data-toggle="tooltip" data-placement="top" title="Generate sequence of digits of the golden ratio">Golden Ratio</button>

<button class="btn btn-default" onclick="doRandom()" data-toggle="tooltip" data-placement="top" title="Generate sequence of random numbers less than the given number">Random</button>
<button class="btn btn-default" onclick="doDiceWalk()" data-toggle="tooltip" data-placement="top" title="Walk random intervals by rolling two dice">Dice</button>
<input type="number" id="random" value="42" min="2" max="999">

Tribonacci

Like Fibonacci, but each number is the sum of the previous three.
Another of many
variations on Fibonacci.

<button class="btn btn-default" onclick="doTribonacci()" data-toggle="tooltip" data-placement="top" title="Generate sequence of Tribonacci numbers">Tribonacci</button>

n0: <input type="number" id="t0" value="0" min="0" max="999">
n1: <input type="number" id="t1" value="0" min="0" max="999">
n2: <input type="number" id="t2" value="1" min="0" max="999">

Triangular and Factorials

Triangular numbers are the sequence of sums 1, 1 + 2, 1 + 2 + 3, 1 + 2 + 3 + 4, ....

Factorial numbers are the sequence of products 1, 1 x 2, 1 x 2 x 3, 1 x 2 x 3 x 4, ...

<button class="btn btn-default" onclick="doTriangle()" data-toggle="tooltip" data-placement="top" title="Generate sequence of Triangular numbers">Triangular</button>
<button class="btn btn-default" onclick="doFactorial()" data-toggle="tooltip" data-placement="top" title="Generate sequence of factorial numbers">Factorial</button>

Sinusoidal

This is an approximation to a sine wave, the sequence described by the
equation a + a.sin(rθ)

<button class="btn btn-default" onclick="doSin()" data-toggle="tooltip" data-placement="top" title="Generate sine wave">Sine</button>
a: <input type="number" id="amplitude" value="12" min="1" max="63">
r: <input type="number" id="r" value="5" min="1" max="999">

Bernoulli

Bernouill numbers are generated here using the algorithm described
by Ada Lovelace. The numbers are a sequence of fractions, so we provide
a sequence of numerators or a sequence of denominators.

<button class="btn btn-default" onclick="doBernoullinumerators()" data-toggle="tooltip" data-placement="top" title="Generate Bernouilli numerators">Numerators</button>
<button class="btn btn-default" onclick="doBernoullidenominators()" data-toggle="tooltip" data-placement="top" title="Generate Bernoulli denominators">Denominators</button>

The Sequence

   <button class="btn btn-info" data-toggle="collapse" data-target="#algorithms" data-toggle="tooltip" data-placement="top" title="Show or hide more algorithms" >More algorithms</button>

   <button class="btn btn-info" onclick="displaySequence(0,0)" data-toggle="tooltip" data-placement="top" title="Show the sequence as far as possible">More numbers</button>

   <button class="btn btn-default" onclick="doOEIS()" data-toggle="tooltip" data-placement="top" title="Search the Online Encyclopedia of Integer Sequence using the first 10 numbers">Search OEIS</button>

2. Reduce

Modulo

We reduce each of the numbers in the sequence using

modular arithmetic
(clock arithmetic).  We divide each number by mod and keep the
remainder, so all the numbers will be between 0 and mod - 1.

<button class="btn btn-success" onclick="doModsequence()" data-toggle="tooltip" data-placement="top" title="Reduce the numbers to the given modulus" id="reducebutton" disabled>Reduce</button>
mod: <input type="number" id="modulus" value="35" min="2" max="128">

Logarithms

Logarithms are included here to help visualize the growth of the sequences.
Log10 of 10 is 1, 100 is 2, 1000 is 3, etc
(logs of zero or negative numbers will appear as 0).

<button class="btn btn-default" onclick="doLogsequence()" data-toggle="tooltip" data-placement="top" title="Take logs base 10">Generate logs</button>

The Numbers

    <textarea id="modsequence" rows="4" cols="120" placeholder="Number sequence"></textarea>

    <button class="btn btn-default" onclick="updateModseq()" data-toggle="tooltip" data-placement="top" title="Register changes after manually editing sequence">Update</button>

About

length

mod

period

    <button class="btn btn-default" onclick="displayCorrelation(0)" data-toggle="tooltip" data-placement="top" title="Show autocorrelation table">AC</button>
    <button class="btn btn-default" onclick="displayCorrelation(1)" data-toggle="tooltip" data-placement="top" title="Correlation in diatonic scale">7</button>
    <button class="btn btn-default" onclick="displayCorrelation(2)" data-toggle="tooltip" data-placement="top" title="Correlation in chromatic scale">12</button>

3. Play

Press Display to show a 'number roll' visualization of the
sequence, with time from left to right and numbers going up.
The mapping of numbers to notes can be modified as you wish using the
buttons below the number roll.
Press the Play button to play the sequence as eighth notes (quavers),
or the 4 or 2 buttons to play quarter or half notes, with
piano or
xylophone sounds.
The mouse selects a subset of notes to be played, and holding the shift key
down modifies the current selection.
Sust causes notes to be sustained so that you can hear them alongside
each other.  You can also change the tempo (beats per minute).
The Life button produces the next generation of the number
roll according to the rules of the

Game of Life (devised 1970), and the
Cat button transforms a square iteratively (inspired by

Arnold's Cat, 1960s) so that it returns to normal after a
Pisano period.
Pressing Display resets the display at any time.

<button class="btn btn-success" onclick="initRoll()" data-toggle="tooltip" data-placement="top" title="Display piano roll" id="displaybutton" disabled>Display</button>
<button class="btn btn-default" onclick="rollWidth(-1)" data-toggle="tooltip" data-placement="top" title="Make roll narrower">w-</button>
<button class="btn btn-default" onclick="rollWidth(1)" data-toggle="tooltip" data-placement="top" title="Make roll wider">w+</button>
<button class="btn btn-default" onclick="rollHeight(-1)" data-toggle="tooltip" data-placement="top" title="Make roll shorter">h-</button>
<button class="btn btn-default" onclick="rollHeight(1)" data-toggle="tooltip" data-placement="top" title="Make roll taller">h+</button>

<button class="btn btn-success play" onclick="playRoll(8)" data-toggle="tooltip" data-placement="top" title="Play eighth notes" disabled></button>
<button class="btn btn-default play" onclick="playRoll(4)" data-toggle="tooltip" data-placement="top" title="Play quarter notes" disabled>4</button>
<button class="btn btn-default play" onclick="playRoll(2)" data-toggle="tooltip" data-placement="top" title="Play half notes" disabled>2</button>
<button class="btn btn-success play" onclick="playStop()" data-toggle="tooltip" data-placement="top" title="Stop playback" disabled></button>
<button class="btn btn-default" onclick="extendNotes(1)" data-toggle="tooltip" data-placement="top" title="Set separate notes">Stacc</button>
<button class="btn btn-default" onclick="extendNotes(2)" data-toggle="tooltip" data-placement="top" title="Set sustained notes">Sust</button>

<button class="btn btn-default" onclick="copySelection()" data-toggle="tooltip" data-placement="top" title="Copy selection"></button>
<button class="btn btn-default" onclick="pasteSelection()" data-toggle="tooltip" data-placement="top" title="Paste selection at index chosen by arrow keys"></button>
<button class="btn btn-default" onclick="nudgeSelection(-1)" data-toggle="tooltip" data-placement="top" title="Nudge paste location left"></button>
<button class="btn btn-default" onclick="nudgeSelection(1)" data-toggle="tooltip" data-placement="top" title="Nudge paste location right"></button>

    <input class="form-control" type="text" id="bpm" value="60">

    <button class="btn btn-default" onclick="doLife()" data-toggle="tooltip" data-placement="top" title="Next generation of Life">Life</button>
    <button class="btn btn-default" onclick="doCat()" data-toggle="tooltip" data-placement="top" title="Iteration of Arnold Cat using Fibonacci">Cat</button>

<canvas id="pianoroll" width="512" height="80"></canvas>

<textarea id="selection" value="" cols="100" rows="1" style="display:none;"></textarea>

Choose which pitch and octave the number 0 corresponds to (e.g. C1), then
click on a scale or generate one from intervals (e.g. 2 2 1 2 2 2 1, or WWHWWWH, or TTSTTTS).
Pressing any buttons will regenerate the mapping table, which comes into effect next time you play.

<button class="btn btn-default" onclick="setPitch(0)">C</button>
<button class="btn btn-default" onclick="setPitch(1)">C#</button>
<button class="btn btn-default" onclick="setPitch(2)">D</button>
<button class="btn btn-default" onclick="setPitch(3)">Eb</button>
<button class="btn btn-default" onclick="setPitch(4)">E</button>
<button class="btn btn-default" onclick="setPitch(5)">F</button>
<button class="btn btn-default" onclick="setPitch(6)">F#</button>
<button class="btn btn-default" onclick="setPitch(7)">G</button>
<button class="btn btn-default" onclick="setPitch(8)">Ab</button>
<button class="btn btn-default" onclick="setPitch(9)">A</button>
<button class="btn btn-default" onclick="setPitch(10)">Bb</button>
<button class="btn btn-default" onclick="setPitch(11)">B</button>

<button class="btn btn-default" onclick="setOctave(0)">0</button>
<button class="btn btn-default" onclick="setOctave(1)">1</button>
<button class="btn btn-default" onclick="setOctave(2)">2</button>
<button class="btn btn-default" onclick="setOctave(3)">3</button>
<button class="btn btn-default" onclick="setOctave(4)">4</button>
<button class="btn btn-default" onclick="setOctave(5)">5</button>
<button class="btn btn-default" onclick="setOctave(6)">6</button>
<button class="btn btn-default" onclick="setOctave(7)">7</button>

<button class="btn btn-default" onclick="setScale([2,2,1,2,2,2,1])">Major</button>
<button class="btn btn-default" onclick="setScale([2,1,2,2,1,2,2])">Natural minor</button>
<button class="btn btn-default" onclick="setScale([2,1,2,2,1,3,1])">Harmonic minor</button>
<button class="btn btn-default" onclick="setScale([2,2,1,2,1,3,1])">Harmonic major</button>

<button class="btn btn-default" onclick="setScale([2,2,3,2,3])">Pentatonic</button>
<button class="btn btn-default" onclick="setScale([2])">Whole Tone</button>
<button class="btn btn-default" onclick="setScale([1])">Chromatic</button>

Pitch

Oct

Generate Scale from Intervals

    <input type="text" id="scale" value="" />
    <button class="btn btn-default" onclick="reGenerate()" data-toggle="tooltip" data-placement="top" title="Regenerate mapping of numbers to notes using intervals">Regenerate</button>

   <button class="btn btn-info" data-toggle="collapse" data-target="#scales" data-toggle="tooltip" data-placement="top" title="Show more buttons with predefined scale intervals">More scales</button>

<button class="btn btn-default" onclick="setScale([1])">Chromatic</button>
<button class="btn btn-default" onclick="setScale([2])">2</button>
<button class="btn btn-default" onclick="setScale([3])">3</button>
<button class="btn btn-default" onclick="setScale([2,1])">2-1</button>
<button class="btn btn-default" onclick="setScale([1,2])">1-2</button>
<button class="btn btn-default" onclick="setScale([4])">4</button>
<button class="btn btn-default" onclick="setScale([3,1])">3-1</button>
<button class="btn btn-default" onclick="setScale([1,3])">1-3</button>
<button class="btn btn-default" onclick="setScale([5])">5</button>
<button class="btn btn-default" onclick="setScale([1,4])">1-4</button>
<button class="btn btn-default" onclick="setScale([4,1])">4-1</button>
<button class="btn btn-default" onclick="setScale([2,3])">2-3</button>
<button class="btn btn-default" onclick="setScale([3,2])">3-2</button>
<button class="btn btn-default" onclick="setScale([6])">6</button>
<button class="btn btn-default" onclick="setScale([1,5])">1-5</button>
<button class="btn btn-default" onclick="setScale([5,1])">5-1</button>
<button class="btn btn-default" onclick="setScale([2,4])">2-4</button>
<button class="btn btn-default" onclick="setScale([4,2])">4-2</button>
<button class="btn btn-default" onclick="setScale([5,7])">5-7</button>
<button class="btn btn-default" onclick="setScale([7,5])">7-5</button>

<button class="btn btn-default" onclick="setScale([2,2,1,2,2,2,1])">Major</button>
<button class="btn btn-default" onclick="setScale([2,1,2,2,1,2,2])">Natural minor</button>
<button class="btn btn-default" onclick="setScale([2,1,2,2,1,3,1])">Harmonic minor</button>
<button class="btn btn-default" onclick="setScale([2,2,1,2,1,3,1])">Harmonic major</button>
<button class="btn btn-default" onclick="setScale([2,2,1,2,2,2,1])">Ionian</button>
<button class="btn btn-default" onclick="setScale([2,1,2,2,2,1,2])">Dorian</button>
<button class="btn btn-default" onclick="setScale([1,2,2,2,1,2,2])">Phrygian</button>
<button class="btn btn-default" onclick="setScale([2,2,2,1,2,2,1])">Lydian</button>
<button class="btn btn-default" onclick="setScale([2,2,1,2,2,1,2])">Mixolydian</button>
<button class="btn btn-default" onclick="setScale([2,1,2,2,1,2,2])">Aeolian</button>
<button class="btn btn-default" onclick="setScale([1,2,2,1,2,2,2])">Locrian</button>

<button class="btn btn-default" onclick="setScale([2,1,2,2,2,2,1])">Melodic ascending minor</button>
<button class="btn btn-default" onclick="setScale([1,2,2,2,2,1,2])">Phrygian raised sixth</button>
<button class="btn btn-default" onclick="setScale([2,2,2,2,1,2,1])">Lydian raised fifth</button>
<button class="btn btn-default" onclick="setScale([2,2,2,1,2,1,2])">Acoustic</button>
<button class="btn btn-default" onclick="setScale([2,2,1,2,1,2,2])">Major minor</button>
<button class="btn btn-default" onclick="setScale([2,1,2,1,2,2,2])">Half diminished scale</button>
<button class="btn btn-default" onclick="setScale([1,2,1,2,2,2,2])">Altered scale</button>

<button class="btn btn-default" onclick="setScale([2,2,2,2,2,2])">Whole Tone</button>
<button class="btn btn-default" onclick="setScale([3,1,3,1,3,1])">Augmented</button>
<button class="btn btn-default" onclick="setScale([2,2,2,3,1,2])">Prometheus</button>
<button class="btn btn-default" onclick="setScale([3,2,1,1,3,2])">Blues</button>
<button class="btn btn-default" onclick="setScale([1,3,2,1,3,2])">Tritone</button>
<button class="btn btn-default" onclick="setScale([2,2,3,2,3])">Major Pentatonic</button>
<button class="btn btn-default" onclick="setScale([2,3,2,3,2])">Egyptian</button>
<button class="btn btn-default" onclick="setScale([3,2,3,2,2])">Blues minor</button>
<button class="btn btn-default" onclick="setScale([2,3,2,2,3])">Blues major</button>
<button class="btn btn-default" onclick="setScale([3,2,2,3,2])">Minor Pentatonic</button>

4. Export

Here you can see the note sequence in various data formats, which you
can copy and paste to export this data to other software tools—Lilypond
to display notes in music notation, MIDI CSV to generate Standard MIDI
files, or an image of the number roll.
If you are running this web page from a server that supports
conversions automatically then you will see Generate PDF
and Generate MIDI buttons, which open a new browser window.
Metadata specified here (e.g. a title) is included in the exported files, and
you can also generate a provenance graph which describes how your output
was generated.

Note Names

Notation

MIDI

Image

Metadata

Provenance

Metadata

 <form>

   Title
   <input type="text" class="form-control" id="metaTitle" placeholder="Title of this piece">

   Description
   <textarea class="form-control" rows="3" id="metaDescription" placeholder="Description of your piece"></textarea>

   Creator
   <input type="text" class="form-control" id="metaCreator" placeholder="Your name or something to identify you as the creator of this piece">

   Parameters

    Sequence
    Rows
    Columns
    Pitch
    Octave
    Intervals
    Selection
    BPM

   Date
   <input type="text" class="form-control" id="metaDate" placeholder="Automatically generated date">

   Identifier
   <input type="text" class="form-control" id="metaIdentifier" placeholder="Automatically generated identifier">

 </form>

Lilypond music score notation

      <form role="form" id="lilyform" method="POST"
	    action="http://demeter.oerc.ox.ac.uk/cgi-bin/lily"
            target="_blank">

        <textarea id="lilytext" name="lilytext" rows="6" cols="120" placeholder="Text for copying " readonly></textarea>

       <button class="btn btn-info" type="submit" id="lilysubmit" value="Submit" display="none">Generate PDF</button>
      </form>

MIDI piano roll (CSV)

      <form role="form" id="midiform" method="POST"
	    action="http://demeter.oerc.ox.ac.uk/cgi-bin/csvmidi"
            target="_blank">

        <textarea id="miditext" name="miditext" rows="6" cols="120" placeholder="Text for copying " readonly></textarea>

       <button class="btn btn-info" type="submit" id="midisubmit" value="Submit" display="none">Generate MIDI</button>
      </form>

Notes

      <textarea id="notestext" rows="6" cols="120" placeholder="Text for copying " readonly></textarea>

Image of Number Roll

Provenance (prov-n)

      <form role="form" id="provform" method="POST"
	    action="http://demeter.oerc.ox.ac.uk/cgi-bin/prov"
            target="_blank">

        <textarea id="provtext" name="provtext" rows="6" cols="120" placeholder="Text for copying " readonly></textarea>

       <button class="btn btn-info" type="submit" id="provsubmit" value="Submit" display="none">Generate Graph</button>
      </form>

About

This tool was developed to generate Fibonacci numbers and reduce them with
clock arithmetic, generating a periodic sequence which is then
mapped to notes, and the music explored by selecting fragments to play
(Lagrange noted periodic functions in Fibonacci numbers in 1774, and
the period is known as the Pisano period).
Additional algorithms have been added to stimulate discussion of
mathematical calculations on the Analytical Engine, contemplating what
Ada Lovelace and Charles Babbage might have done if the engine had been
built. Powers is included as it is the example in the
Ada sketches operatic work composed by Emily Howard.
The other examples are:

Pi

Pi was calculated by hand to 100 decimal places in 1706 using
Machin's algorithm.  The same algorithm is used here—note that algorithms
existed before computers. Pi is believed to be a 'normal number'
which means any possible musical sequence appears somewhere in its digits.

Golden Ratio

This is the number that the ratio of successive
Fibonacci numbers converges to (1.618...) and it's calculated using a square
root function. Although the square root algorithm we use is known today as
Newton's method, it goes back to 1st century Greece or Babylonian times
(incidentally the Babylonians worked in sexagesimal i.e. base 60).

Prime numbers

Calculated here using the Sieve of Eratosthenes,
but how might this have been coded for the Analytical Engine?
The size of the sieve is estimated using a 1798 result by Legendre, and
in those days 1 was considered to be a prime.

Random

How could random numbers have been generated on
the Analytical Engine? Musical dice games (Musikalisches Würfelspiel) were
popular in the 1700s. Today we analyse and generate music using probabilities
of note and chord ransitions, using a mathematical approach due to Markov born
in 1856.

Factorials

We see triangle numbers created by adding, and
Factorials by multiplying, hence that the factorial sequence goes up much
more rapidly. The notation
for factorial, e.g. 20!, was introduced in 1808. 20! can be stored in
a 64 bit integer before we run out of bits, but the analytical engine could
go up to 41! with its support for 50 decimal digits.

Sine

The sin trig function is used here to generate an integer
sequence approximating a sinusoidal wave.
The Analytical Engine could have been used for creating trignometric tables.
This also illustrates another way of generating sounds, by generating a
waveform (but how might that have been converted to sound?)

Bernoulli

Ada Lovelace is famed for the algorithm to generate Bernoulli numbers.
Here we generate the numerator and denominator sequences separately.
Only short sequences are generated because it is quite computationally
intensive, using a rational arithmetic library. How long would the
algorithm have taken to run on the Analytical Engine?

Please email Numbers into Notes with
any questions, bug reports, and suggestions for new features.
This application is currently only supported on Chrome and Firefox.

Written by David De Roure, December 2015, for the Ada Lovelace
Symposium and as an interactive demonstration to encourage discussion
about music, mathematics, and programming at the time of Ada Lovelace.
Thanks to Emily Howard and Lasse Rempe-Gillen for their inspiration
through Ada sketches, to Pip Willcox for jointly organising
the Numbers into Notes project, and to all our colleagues for
feedback and ideas.  This research is supported by the
Transforming Musicology
project funded by the Arts and Humanities Research Council, and the
FAST
project funded by the Engineering and Physical Sciences Research Council.

When this application is run online, the logs maintained by the server include
the IP address of the client, the referring web page, and the user agent (browser).
This information is used for debugging and developing the software, and may be
summarised in aggregate form to report usage in publicly available documents.
We do not use cookies.  When export format conversion functionality is enabled,
exported Lilypond and MIDI files are stored on the server on a temporary basis
and are available to anyone with the appropriate URLs: they are stored for access,
to assist with debugging and demonstrating the operation of the program, and
in order to analyse and report on usage.


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.ico" />
<title>

  com.google.inject Details

| Guice

</title>
<link href="../../../../javadoc/assets/android-developer-docs.css" rel="stylesheet" type="text/css" />
<link href="../../../../javadoc/assets/customizations.css" rel="stylesheet" type="text/css" />

      Guice

          <form accept-charset="utf-8" class="gsc-search-box"
                onsubmit="return submit_search()">

                    <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
                      title="search developer docs" name="q"
                      value="search developer docs"
                      onFocus="search_focus_changed(this, true)"
                      onBlur="search_focus_changed(this, false)"
                      onkeydown="return search_changed(event, true, '../../../')"
                      onkeyup="return search_changed(event, false, '../../../')" />

                    <input type="submit" value="Search" title="search" id="search-button" class="gsc-search-button" />

          </form>

    <input type="checkbox" id="apiLevelCheckbox" onclick="toggleApiLevelSelector(this)" />
    Filter by API Level:
    <select id="apiLevelSelector">

    </select>

<nobr>
                Package Index |
                Class Index</nobr>

  com.google.inject

  com.google.inject.assistedinject

  com.google.inject.binder

  com.google.inject.jndi

  com.google.inject.matcher

  com.google.inject.multibindings

  com.google.inject.name

  com.google.inject.persist

  com.google.inject.persist.finder

  com.google.inject.persist.jpa

  com.google.inject.servlet

  com.google.inject.spi

  com.google.inject.spring

  com.google.inject.throwingproviders

  com.google.inject.tools.jmx

  com.google.inject.util

Interfaces

Binder

Binding<T>

Injector

MembersInjector<T>

Module

PrivateBinder

Provider<T>

Scope

Classes

AbstractModule

Guice

InjectorBuilder

Key<T>

PrivateModule

Scopes

TypeLiteral<T>

Annotations

BindingAnnotation

Exposed

ImplementedBy

Inject

ProvidedBy

Provides

ScopeAnnotation

Singleton

Enums

Stage

Exceptions

ConfigurationException

CreationException

OutOfScopeException

ProvisionException

<nobr>
            Package Index |
            Class Index</nobr>

  Since: API Level Guice_1.0

  package

com.google.inject

      Classes | Description

Google Guice (pronounced "juice") is an ultra-lightweight dependency
 injection framework.  Please refer to the Guice
 User's Guide
 for a gentle introduction.

The principal public APIs in this package are:

Inject

The annotation you will use in your implementation classes to tell Guice
     where and how it should send in ("inject") the objects you depend on
     (your "dependencies").

Module

The interface you will implement in order to specify "bindings" --
     instructions for how Guice should handle injection -- for a particular
     set of interfaces.

Binder

The object that Guice passes into your Module
     to collect these bindings.

Provider

The interface you will implement when you need to customize exactly how
     Guice creates instances for a particular binding.

Generated by Doclava.

redpajama_set_name: RedPajamaGithub


text:
'use strict';

/* global Connector */

if (location.href === 'http://bandzone.cz/' || location.href === 'https://bandzone.cz/') {
	Connector.playerSelector = '#stats';

	Connector.getArtist = function () {
		var text = $('.stat:has(.ui-miniaudioplayer-state-playing) h4').text().trim();
		return text || null;
	};

	Connector.getTrack = function () {
		var text = $('.stat:has(.ui-miniaudioplayer-state-playing) .songTitle').text().trim();
		return text || null;
	};

	Connector.isPlaying = function () {
		return $('.ui-miniaudioplayer-state-playing').length;
	};
} else {
	Connector.playerSelector = '#playerWidget';

	Connector.getArtist = function () {
		var text = $('.profile-name h1').text().replace($('.profile-name span').text(), '').trim();
		return text || null;
	};

	Connector.trackSelector = '.ui-state-active .ui-audioplayer-song-title';

	Connector.isPlaying = function () {
		return $('ui-audioplayer-button').text() === 'stop';
	};
}


text:
package com.ack.adventureandconquer.game.creature.npc.swimmer;

import com.ack.adventureandconquer.game.creature.npc.Npc;

/**
 * Created by saskyrar on 11/02/15.
 */
public class SeaSnake extends Npc {
    @Override
    public int getDefaultArmorClass() {
        return 3;
    }

    @Override
    public int getDefaultHitDice() {
        return 3;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal"
        android:orientation="vertical">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/abc_action_bar_default_height_material"
            android:background="?attr/colorPrimary"
            android:minHeight="?attr/actionBarSize" />

        <FrameLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </LinearLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/drawer_navigation"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:itemIconTint="@android:color/white"
        app:itemTextColor="@android:color/white"
        app:headerLayout="@layout/drawer_header"
        app:menu="@menu/drawer"
        android:background="@color/transparent_background"/>
</android.support.v4.widget.DrawerLayout>


text:
include(FindPackageHandleStandardArgs)
include(Utilities)
include(CMakeParseArguments)

find_package(PythonInterp REQUIRED)

function(_python_executable OUTVAR)
    cmake_parse_arguments(PYEXEC "LOCAL" "PYTHON_EXECUTABLE" "" ${ARGN})
    if(PYEXEC_LOCAL AND PYEXEC_PYTHON_EXECUTABLE)
        message(FATAL_ERROR "Cannot use LOCAL and PYTHON arguments together")
    endif()
    if(PYEXEC_LOCAL AND NOT LOCAL_PYTHON_EXECUTABLE)
        message(FATAL_ERROR "PythonVirtualEnv not included yet.")
    endif()
    if(PYEXEC_LOCAL)
        set(${OUTVAR} ${LOCAL_PYTHON_EXECUTABLE} PARENT_SCOPE)
    elseif(PYEXEC_PYTHON_EXECUTABLE)
        set(${OUTVAR} ${PYEXEC_PYTHON_EXECUTABLE} PARENT_SCOPE)
    elseif(NOT LOCAL_PYTHON_EXECUTABLE)
        set(${OUTVAR} ${PYTHON_EXECUTABLE} PARENT_SCOPE)
    elseif(EXISTS "${LOCAL_PYTHON_EXECUTABLE}")
        set(${OUTVAR} ${LOCAL_PYTHON_EXECUTABLE} PARENT_SCOPE)
    endif()
    set(${OUTVAR}_UNPARSED_ARGUMENTS ${PYEXEC_UNPARSED_ARGUMENTS} PARENT_SCOPE)
endfunction()

function(find_python_package PACKAGE)
    string(TOUPPER "${PACKAGE}" PACKAGE_UPPER)
    if(${PACKAGE_UPPER}_FOUND)
        set(${PACKAGE}_FOUND ${${PACKAGE_UPPER}_FOUND} PARENT_SCOPE)
        return()
    endif()
    cmake_parse_arguments(${PACKAGE}_FIND
        "REQUIRED;EXACT" "VERSION" "" ${ARGN})
    cmake_parse_arguments(PYPACK
        "QUIET" "WORKING_DIRECTORY;ERROR_MESSAGE" ""
        ${${PACKAGE}_FIND_UNPARSED_ARGUMENTS})
    _python_executable(LOCALPYTHON ${PYPACK_UNPARSED_ARGUMENTS})
    if(NOT PYPACK_WORKING_DIRECTORY)
        set(PYPACK_WORKING_DIRECTORY "${PROJECT_BINARY_DIR}")
    endif()
    if(NOT PYPACK_ERROR_MESSAGE)
        set(PYPACK_ERROR_MESSAGE "Python module ${PACKAGE} could not be found.")
    endif()
    if(PYPACK_QUIET)
        set(${PACKAGE}_FIND_QUIETLY TRUE)
        set(${PACKAGE_UPPER}_FIND_QUIETLY TRUE)
    else()
        set(${PACKAGE}_FIND_QUIETLY FALSE)
        set(${PACKAGE_UPPER}_FIND_QUIETLY FALSE)
    endif()
    # Unset prior variables
    unset(${PACKAGE}_LOCATION CACHE)
    unset(${PACKAGE}_FOUND CACHE)
    unset(${PACKAGE_UPPER}_FOUND CACHE)

    execute_process(
        COMMAND ${LOCALPYTHON} -c
            "import ${PACKAGE};print(getattr(${PACKAGE}, '__version__', ''))"
        WORKING_DIRECTORY "${PYPACK_WORKING_DIRECTORY}"
        RESULT_VARIABLE PACKAGE_WAS_FOUND
        ERROR_VARIABLE ERROR
        OUTPUT_VARIABLE OUTPUT
    )
    if("${PACKAGE_WAS_FOUND}" STREQUAL "0")
        string(STRIP "${OUTPUT}" string_version)
        set(arguments
            "import ${PACKAGE}"
            "from os.path import dirname"
            "print(dirname(${PACKAGE}.__file__))"
        )
        execute_process(
            COMMAND ${LOCALPYTHON} -c "${arguments}"
            WORKING_DIRECTORY "${PYPACK_WORKING_DIRECTORY}"
            RESULT_VARIABLE LOCATION_WAS_FOUND
            ERROR_VARIABLE ERROR
            OUTPUT_VARIABLE OUTPUT
        )
        if("${LOCATION_WAS_FOUND}" STREQUAL "0")
            string(STRIP "${OUTPUT}" OUTPUT)
            FILE(TO_CMAKE_PATH ${OUTPUT} ${PACKAGE}_LOCATION)
        endif()
    endif()
    find_package_handle_standard_args(${PACKAGE}
        REQUIRED_VARS ${PACKAGE}_LOCATION
        VERSION_VAR string_version
        FAIL_MESSAGE "${PYPACK_ERROR_MESSAGE}"
    )
    if(NOT "${PACKAGE}" STREQUAL "${PACKAGE_UPPER}")
        set(${PACKAGE}_FOUND ${${PACKAGE_UPPER}_FOUND} PARENT_SCOPE)
    endif()
    set(${PACKAGE_UPPER}_FOUND "${${PACKAGE_UPPER}_FOUND}" CACHE INTERNAL "")
    if(${PACKAGE_UPPER}_FOUND)
        set(${PACKAGE}_LOCATION "${${PACKAGE}_LOCATION}"
            CACHE PATH "Location of ${PACKAGE}")
        set(${PACKAGE}_VERSION_STRING "${string_version}"
            CACHE STRING "Version of ${PACKAGE}")
    else()
        set(${PACKAGE}_LOCATION "${${PACKAGE}_LOCATION}"
            CACHE PATH "Location of ${PACKAGE}")
    endif()
endfunction()


text:
package org.apache.cassandra.streaming;

import java.io.*;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.Collections;

import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.DecoratedKey;
import org.apache.cassandra.db.Table;
import org.apache.cassandra.db.compaction.CompactionController;
import org.apache.cassandra.db.compaction.PrecompactedRow;
import org.apache.cassandra.io.IColumnSerializer;
import org.apache.cassandra.io.sstable.*;
import org.apache.cassandra.io.util.FileUtils;
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.BytesReadTracker;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.Pair;

import com.ning.compress.lzf.LZFInputStream;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class IncomingStreamReader
{
    private static final Logger logger = LoggerFactory.getLogger(IncomingStreamReader.class);

    protected final PendingFile localFile;
    protected final PendingFile remoteFile;
    protected final StreamInSession session;
    private final Socket socket;

    public IncomingStreamReader(StreamHeader header, Socket socket) throws IOException
    {
        this.socket = socket;
        InetAddress host = header.broadcastAddress != null ? header.broadcastAddress
                           : ((InetSocketAddress)socket.getRemoteSocketAddress()).getAddress();
        session = StreamInSession.get(host, header.sessionId);
        session.setSocket(socket);

        session.addFiles(header.pendingFiles);
        // set the current file we are streaming so progress shows up in jmx
        session.setCurrentFile(header.file);
        session.setTable(header.table);
        // pendingFile gets the new context for the local node.
        remoteFile = header.file;
        localFile = remoteFile != null ? StreamIn.getContextMapping(remoteFile) : null;
    }

    public void read() throws IOException
    {
        if (remoteFile != null)
        {
            if (logger.isDebugEnabled())
            {
                logger.debug("Receiving stream");
                logger.debug("Creating file for {} with {} estimated keys",
                             localFile.getFilename(),
                             remoteFile.estimatedKeys);
            }

            assert remoteFile.estimatedKeys > 0;
            SSTableReader reader = null;
            logger.debug("Estimated keys {}", remoteFile.estimatedKeys);
            DataInputStream dis = new DataInputStream(new LZFInputStream(socket.getInputStream()));
            try
            {
                reader = streamIn(dis, localFile, remoteFile);
                session.finished(remoteFile, reader);
            }
            catch (IOException ex)
            {
                retry();
                throw ex;
            }
        }

        session.closeIfFinished();
    }

    private SSTableReader streamIn(DataInput input, PendingFile localFile, PendingFile remoteFile) throws IOException
    {
        ColumnFamilyStore cfs = Table.open(localFile.desc.ksname).getColumnFamilyStore(localFile.desc.cfname);
        DecoratedKey key;
        SSTableWriter writer = new SSTableWriter(localFile.getFilename(), remoteFile.estimatedKeys);
        CompactionController controller = new CompactionController(cfs, Collections.<SSTableReader>emptyList(), Integer.MIN_VALUE, true);

        try
        {
            BytesReadTracker in = new BytesReadTracker(input);

            for (Pair<Long, Long> section : localFile.sections)
            {
                long length = section.right - section.left;
                long bytesRead = 0;
                while (bytesRead < length)
                {
                    in.reset(0);
                    key = SSTableReader.decodeKey(StorageService.getPartitioner(), localFile.desc, ByteBufferUtil.readWithShortLength(in));
                    long dataSize = SSTableReader.readRowSize(in, localFile.desc);

                    ColumnFamily cached = cfs.getRawCachedRow(key);
                    if (cached != null && remoteFile.type == OperationType.AES && dataSize <= DatabaseDescriptor.getInMemoryCompactionLimit())
                    {
                        // need to update row cache
                        // Note: Because we won't just echo the columns, there is no need to use the PRESERVE_SIZE flag, contrarily to what appendFromStream does below
                        SSTableIdentityIterator iter = new SSTableIdentityIterator(cfs.metadata, in, key, 0, dataSize, IColumnSerializer.Flag.FROM_REMOTE);
                        PrecompactedRow row = new PrecompactedRow(controller, Collections.singletonList(iter));
                        // We don't expire anything so the row shouldn't be empty
                        assert !row.isEmpty();
                        writer.append(row);
                        // row append does not update the max timestamp on its own
                        writer.updateMaxTimestamp(row.maxTimestamp());

                        // update cache
                        ColumnFamily cf = row.getFullColumnFamily();
                        cfs.updateRowCache(key, cf);
                    }
                    else
                    {
                        writer.appendFromStream(key, cfs.metadata, dataSize, in);
                        cfs.invalidateCachedRow(key);
                    }

                    bytesRead += in.getBytesRead();
                    remoteFile.progress += in.getBytesRead();
                }
            }
            return writer.closeAndOpenReader();
        }
        catch (Exception e)
        {
            writer.abort();
            if (e instanceof IOException)
                throw (IOException) e;
            else
                throw FBUtilities.unchecked(e);
        }
    }

    private void retry() throws IOException
    {
        /* Ask the source node to re-stream this file. */
        session.retry(remoteFile);

        /* Delete the orphaned file. */
        if (new File(localFile.getFilename()).isFile())
            FileUtils.deleteWithConfirm(new File(localFile.getFilename()));
    }
}


text:
/*
*= require surveyor_gui/jquery.rating
*/


text:
package com.graphhopper.jsprit.core.problem.job;

import com.graphhopper.jsprit.core.problem.AbstractJob;
import com.graphhopper.jsprit.core.problem.Capacity;
import com.graphhopper.jsprit.core.problem.Location;
import com.graphhopper.jsprit.core.problem.Skills;
import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow;
import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindowsImpl;

import java.util.Collection;

/**
 * Shipment is an implementation of Job and consists of a pickup and a delivery of something.
 *

 *
It distinguishes itself from {@link Service} as two locations are involved a pickup where usually
 * something is loaded to the transport unit and a delivery where something is unloaded.
 *

 *
By default serviceTimes of both pickup and delivery is 0.0 and timeWindows of both is [0.0, Double.MAX_VALUE],
 *

 *
A shipment can be built with a builder. You can get an instance of the builder by coding Shipment.Builder.newInstance(...).
 * This way you can specify the shipment. Once you build the shipment, it is immutable, i.e. fields/attributes cannot be changed anymore and
 * you can only 'get' the specified values.
 *

 *
Note that two shipments are equal if they have the same id.
 *
 * @author schroeder
 */
public class Shipment extends AbstractJob {

    /**
     * Builder that builds the shipment.
     *
     * @author schroeder
     */
    public static class Builder {

        private String id;

        private double pickupServiceTime = 0.0;

        private double deliveryServiceTime = 0.0;

        private TimeWindow deliveryTimeWindow = TimeWindow.newInstance(0.0, Double.MAX_VALUE);

        private TimeWindow pickupTimeWindow = TimeWindow.newInstance(0.0, Double.MAX_VALUE);

        private Capacity.Builder capacityBuilder = Capacity.Builder.newInstance();

        private Capacity capacity;

        private Skills.Builder skillBuilder = Skills.Builder.newInstance();

        private Skills skills;

        private String name = "no-name";

        private Location pickupLocation_;

        private Location deliveryLocation_;

        protected TimeWindowsImpl deliveryTimeWindows;

        private boolean deliveryTimeWindowAdded = false;

        private boolean pickupTimeWindowAdded = false;

        private TimeWindowsImpl pickupTimeWindows;

        private int priority = 2;

        /**
         * Returns new instance of this builder.
         *
         * @param id the id of the shipment which must be a unique identifier among all jobs
         * @return the builder
         */
        public static Builder newInstance(String id) {
            return new Builder(id);
        }

        Builder(String id) {
            if (id == null) throw new IllegalArgumentException("id must not be null");
            this.id = id;
            pickupTimeWindows = new TimeWindowsImpl();
            pickupTimeWindows.add(pickupTimeWindow);
            deliveryTimeWindows = new TimeWindowsImpl();
            deliveryTimeWindows.add(deliveryTimeWindow);
        }

        /**
         * Sets pickup location.
         *
         * @param pickupLocation pickup location
         * @return builder
         */
        public Builder setPickupLocation(Location pickupLocation) {
            this.pickupLocation_ = pickupLocation;
            return this;
        }

        /**
         * Sets pickupServiceTime.
         *

         *
ServiceTime is intended to be the time the implied activity takes at the pickup-location.
         *
         * @param serviceTime the service time / duration the pickup of the associated shipment takes
         * @return builder
         * @throws IllegalArgumentException if servicTime < 0.0
         */
        public Builder setPickupServiceTime(double serviceTime) {
            if (serviceTime < 0.0) throw new IllegalArgumentException("serviceTime must not be < 0.0");
            this.pickupServiceTime = serviceTime;
            return this;
        }

        /**
         * Sets the timeWindow for the pickup, i.e. the time-period in which a pickup operation is
         * allowed to START.
         *

         *
By default timeWindow is [0.0, Double.MAX_VALUE}
         *
         * @param timeWindow the time window within the pickup operation/activity can START
         * @return builder
         * @throws IllegalArgumentException if timeWindow is null
         */
        public Builder setPickupTimeWindow(TimeWindow timeWindow) {
            if (timeWindow == null) throw new IllegalArgumentException("delivery time-window must not be null");
            this.pickupTimeWindow = timeWindow;
            this.pickupTimeWindows = new TimeWindowsImpl();
            this.pickupTimeWindows.add(timeWindow);
            return this;
        }

        /**
         * Sets delivery location.
         *
         * @param deliveryLocation delivery location
         * @return builder
         */
        public Builder setDeliveryLocation(Location deliveryLocation) {
            this.deliveryLocation_ = deliveryLocation;
            return this;
        }

        /**
         * Sets the delivery service-time.
         *

         *
ServiceTime is intended to be the time the implied activity takes at the delivery-location.
         *
         * @param deliveryServiceTime the service time / duration of shipment's delivery
         * @return builder
         * @throws IllegalArgumentException if serviceTime < 0.0
         */
        public Builder setDeliveryServiceTime(double deliveryServiceTime) {
            if (deliveryServiceTime < 0.0) throw new IllegalArgumentException("deliveryServiceTime must not be < 0.0");
            this.deliveryServiceTime = deliveryServiceTime;
            return this;
        }

        /**
         * Sets the timeWindow for the delivery, i.e. the time-period in which a delivery operation is
         * allowed to start.
         *

         *
By default timeWindow is [0.0, Double.MAX_VALUE}
         *
         * @param timeWindow the time window within the associated delivery is allowed to START
         * @return builder
         * @throws IllegalArgumentException if timeWindow is null
         */
        public Builder setDeliveryTimeWindow(TimeWindow timeWindow) {
            if (timeWindow == null) throw new IllegalArgumentException("delivery time-window must not be null");
            this.deliveryTimeWindow = timeWindow;
            this.deliveryTimeWindows = new TimeWindowsImpl();
            this.deliveryTimeWindows.add(timeWindow);
            return this;
        }

        /**
         * Adds capacity dimension.
         *
         * @param dimensionIndex the dimension index of the corresponding capacity value
         * @param dimensionValue the capacity value
         * @return builder
         * @throws IllegalArgumentException if dimVal < 0
         */
        public Builder addSizeDimension(int dimensionIndex, int dimensionValue) {
            if (dimensionValue < 0) throw new IllegalArgumentException("capacity value cannot be negative");
            capacityBuilder.addDimension(dimensionIndex, dimensionValue);
            return this;
        }

        /**
         * Builds the shipment.
         *
         * @return shipment
         * @throws IllegalArgumentException if neither pickup-location nor pickup-coord is set or if neither delivery-location nor delivery-coord
         *                               is set
         */
        public Shipment build() {
            if (pickupLocation_ == null) throw new IllegalArgumentException("pickup location is missing");
            if (deliveryLocation_ == null) throw new IllegalArgumentException("delivery location is missing");
            capacity = capacityBuilder.build();
            skills = skillBuilder.build();
            return new Shipment(this);
        }

        public Builder addRequiredSkill(String skill) {
            skillBuilder.addSkill(skill);
            return this;
        }

        public Builder setName(String name) {
            this.name = name;
            return this;
        }

        public Builder addDeliveryTimeWindow(TimeWindow timeWindow) {
            if(timeWindow == null) throw new IllegalArgumentException("time-window arg must not be null");
            if(!deliveryTimeWindowAdded){
                deliveryTimeWindows = new TimeWindowsImpl();
                deliveryTimeWindowAdded = true;
            }
            deliveryTimeWindows.add(timeWindow);
            return this;
        }

        public Builder addDeliveryTimeWindow(double earliest, double latest) {
            addDeliveryTimeWindow(TimeWindow.newInstance(earliest, latest));
            return this;
        }

        public Builder addPickupTimeWindow(TimeWindow timeWindow) {
            if(timeWindow == null) throw new IllegalArgumentException("time-window arg must not be null");
            if(!pickupTimeWindowAdded){
                pickupTimeWindows = new TimeWindowsImpl();
                pickupTimeWindowAdded = true;
            }
            pickupTimeWindows.add(timeWindow);
            return this;
        }

        public Builder addPickupTimeWindow(double earliest, double latest) {
            return addPickupTimeWindow(TimeWindow.newInstance(earliest, latest));
        }

        /**
         * Set priority to shipment. Only 1 = high priority, 2 = medium and 3 = low are allowed.
         *

         * Default is 2 = medium.
         *
         * @param priority
         * @return builder
         */
        public Builder setPriority(int priority) {
            if(priority < 1 || priority > 3) throw new IllegalArgumentException("incorrect priority. only 1 = high, 2 = medium and 3 = low is allowed");
            this.priority = priority;
            return this;
        }
    }

    private final String id;

    private final double pickupServiceTime;

    private final double deliveryServiceTime;

    private final TimeWindow deliveryTimeWindow;

    private final TimeWindow pickupTimeWindow;

    private final Capacity capacity;

    private final Skills skills;

    private final String name;

    private final Location pickupLocation_;

    private final Location deliveryLocation_;

    private final TimeWindowsImpl deliveryTimeWindows;

    private final TimeWindowsImpl pickupTimeWindows;

    private final int priority;

    Shipment(Builder builder) {
        this.id = builder.id;
        this.pickupServiceTime = builder.pickupServiceTime;
        this.pickupTimeWindow = builder.pickupTimeWindow;
        this.deliveryServiceTime = builder.deliveryServiceTime;
        this.deliveryTimeWindow = builder.deliveryTimeWindow;
        this.capacity = builder.capacity;
        this.skills = builder.skills;
        this.name = builder.name;
        this.pickupLocation_ = builder.pickupLocation_;
        this.deliveryLocation_ = builder.deliveryLocation_;
        this.deliveryTimeWindows = builder.deliveryTimeWindows;
        this.pickupTimeWindows = builder.pickupTimeWindows;
        this.priority = builder.priority;
    }

    @Override
    public String getId() {
        return id;
    }

    public Location getPickupLocation() {
        return pickupLocation_;
    }

    /**
     * Returns the pickup service-time.
     *

     *
By default service-time is 0.0.
     *
     * @return service-time
     */
    public double getPickupServiceTime() {
        return pickupServiceTime;
    }

    public Location getDeliveryLocation() {
        return deliveryLocation_;
    }

    /**
     * Returns service-time of delivery.
     *
     * @return service-time of delivery
     */
    public double getDeliveryServiceTime() {
        return deliveryServiceTime;
    }

    /**
     * Returns the time-window of delivery.
     *
     * @return time-window of delivery
     */
    public TimeWindow getDeliveryTimeWindow() {
        return deliveryTimeWindows.getTimeWindows().iterator().next();
    }

    public Collection<TimeWindow> getDeliveryTimeWindows() {
        return deliveryTimeWindows.getTimeWindows();
    }

    /**
     * Returns the time-window of pickup.
     *
     * @return time-window of pickup
     */
    public TimeWindow getPickupTimeWindow() {
        return pickupTimeWindows.getTimeWindows().iterator().next();
    }

    public Collection<TimeWindow> getPickupTimeWindows() {
        return pickupTimeWindows.getTimeWindows();
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

    /**
     * Two shipments are equal if they have the same id.
     *
     * @return true if shipments are equal (have the same id)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Shipment other = (Shipment) obj;
        if (id == null) {
            if (other.id != null)
                return false;
        } else if (!id.equals(other.id))
            return false;
        return true;
    }

    @Override
    public Capacity getSize() {
        return capacity;
    }

    @Override
    public Skills getRequiredSkills() {
        return skills;
    }

    @Override
    public String getName() {
        return name;
    }

    /**
     * Get priority of shipment. Only 1 = high priority, 2 = medium and 3 = low are allowed.
     *

     * Default is 2 = medium.
     *
     * @return priority
     */
    public int getPriority() {
        return priority;
    }
}


text:
"use strict";

module.exports = {
  get: function(request, response) {
    response.render({
      user: {
        name: "scott",
        pass: "pacat"
      }
    })

  }/*,
  post: function(request, response) {

    if(!request || !request.query ){
      // Honeypot for spambots
      console.log(request.query);
      if (request.query.company) {
        response.render({
          type: 'empty',
          err: true,
          message: request.query.message,
          name: request.query.name,
          email: request.query.email,
          msg: 'Spam Bot détecté. Le message n\'a pas été envoyé, s\'il vous plaît, contactez-nous par email ou par téléphone',
          description: 'Spam'
        });
      }
      // Check if all required fields are filled
      if (!request.query.name || !request.query.email || !request.query.message) {
        response.render({
          type: 'empty',
          err: true,
          message: request.query.message,
          name: request.query.name,
          email: request.query.email,
          msg: 'Remplissez tous les champs, merci!',
          description: 'L\'e-mail n\'a pas été envoyé avec succès'
        });
      }

      // Check for valid email
      let validator = require("email-validator");
      let email_check = validator.validate(request.query.email);
      if (email_check == false) {
        response.render({
          type: 'empty',
          err: true,
          message: request.query.message,
          name: request.query.name,
          email: request.query.email,
          msg: 'Entrez une adresse email valide s\'il vous plaît, merci!',
          description: 'L\'e-mail n\'a pas été envoyé avec succès'
        });
      }

      // Set up smtp mailer
      let nodemailer = require('nodemailer');
      let transporter = nodemailer.createTransport({
        service: 'Gmail',
        auth: {
          user: 'Website@account.com',
          pass: 'WebsitePass'
        }
      });

    let mailOptions = {
      from: request.body.email, // sender address
      to: 'ani.grenoble@gmail.com', // list of receivers
      subject: 'Site internet contact', // Subject line
      text: 'Nom de l\'envoyeur :' + request.body.name + ' \nEmail de contact :' + request.body.email + "\nMessage : " + request.body.message // plaintext body
        // html: '<b>Hello world ✔</b>' // You can choose to send an HTML body instead
    };

        // Email not sent
        if (error) {
          console.log(error);
          response.render({
            type: 'error',
            description: 'L\'e-mail n\'a pas été envoyé avec succès'
          });
          // Email successfully sent!
        } else {
          console.log(info);
          response.render({
            type: 'success',
            description: 'L\'e-mail a été envoyé avec succès'
          });
        };
      });
      response.render();
    }
  }*/

}


text:
package org.spongycastle.crypto.test;

import java.security.SecureRandom;

import org.spongycastle.asn1.sec.SECNamedCurves;
import org.spongycastle.asn1.x9.X9ECParameters;
import org.spongycastle.crypto.AsymmetricCipherKeyPair;
import org.spongycastle.crypto.digests.SHA1Digest;
import org.spongycastle.crypto.generators.ECKeyPairGenerator;
import org.spongycastle.crypto.generators.KDF2BytesGenerator;
import org.spongycastle.crypto.kems.ECIESKeyEncapsulation;
import org.spongycastle.crypto.params.ECDomainParameters;
import org.spongycastle.crypto.params.ECKeyGenerationParameters;
import org.spongycastle.crypto.params.KeyParameter;
import org.spongycastle.util.test.SimpleTest;

/**
 * Tests for the ECIES Key Encapsulation Mechanism
 */
public class ECIESKeyEncapsulationTest
    extends SimpleTest
{
    public String getName()
    {
        return "ECIESKeyEncapsulation";
    }

    public void performTest()
        throws Exception
    {

        // Set EC domain parameters and generate key pair
        X9ECParameters            spec     = SECNamedCurves.getByName("secp224r1");
        ECDomainParameters        ecDomain = new ECDomainParameters(spec.getCurve(), spec.getG(), spec.getN());
        ECKeyPairGenerator        ecGen    = new ECKeyPairGenerator();

        ecGen.init(new ECKeyGenerationParameters(ecDomain, new SecureRandom()));

        AsymmetricCipherKeyPair    keys      = ecGen.generateKeyPair();

        // Set ECIES-KEM parameters
        ECIESKeyEncapsulation     kem;
        KDF2BytesGenerator        kdf = new KDF2BytesGenerator(new SHA1Digest());
        SecureRandom            rnd = new SecureRandom();
        byte[]                    out = new byte[57];
        KeyParameter            key1, key2;

        // Test basic ECIES-KEM
        kem = new ECIESKeyEncapsulation(kdf, rnd);

        kem.init(keys.getPublic());
        key1 = (KeyParameter)kem.encrypt(out, 128);

        kem.init(keys.getPrivate());
        key2 = (KeyParameter)kem.decrypt(out, 128);

        if (!areEqual(key1.getKey(), key2.getKey()))
        {
            fail("failed basic test");
        }

        // Test ECIES-KEM using new cofactor mode
        kem = new ECIESKeyEncapsulation(kdf, rnd, true, false, false);

        kem.init(keys.getPublic());
        key1 = (KeyParameter)kem.encrypt(out, 128);

        kem.init(keys.getPrivate());
        key2 = (KeyParameter)kem.decrypt(out, 128);

        if (!areEqual(key1.getKey(), key2.getKey()))
        {
            fail("failed cofactor test");
        }

        // Test ECIES-KEM using old cofactor mode
        kem = new ECIESKeyEncapsulation(kdf, rnd, false, true, false);

        kem.init(keys.getPublic());
        key1 = (KeyParameter)kem.encrypt(out, 128);

        kem.init(keys.getPrivate());
        key2 = (KeyParameter)kem.decrypt(out, 128);

        if (!areEqual(key1.getKey(), key2.getKey()))
        {
            fail("failed old cofactor test");
        }

        // Test ECIES-KEM using single hash mode
        kem = new ECIESKeyEncapsulation(kdf, rnd, false, false, true);

        kem.init(keys.getPublic());
        key1 = (KeyParameter)kem.encrypt(out, 128);

        kem.init(keys.getPrivate());
        key2 = (KeyParameter)kem.decrypt(out, 128);

        if (!areEqual(key1.getKey(), key2.getKey()))
        {
            fail("failed single hash test");
        }

        // Test ECIES-KEM using new cofactor mode and single hash mode
        kem = new ECIESKeyEncapsulation(kdf, rnd, true, false, true);

        kem.init(keys.getPublic());
        key1 = (KeyParameter)kem.encrypt(out, 128);

        kem.init(keys.getPrivate());
        key2 = (KeyParameter)kem.decrypt(out, 128);

        if (!areEqual(key1.getKey(), key2.getKey()))
        {
            fail("failed cofactor and single hash test");
        }

        // Test ECIES-KEM using old cofactor mode and single hash mode
        kem = new ECIESKeyEncapsulation(kdf, rnd, false, true, true);

        kem.init(keys.getPublic());
        key1 = (KeyParameter)kem.encrypt(out, 128);

        kem.init(keys.getPrivate());
        key2 = (KeyParameter)kem.decrypt(out, 128);

        if (!areEqual(key1.getKey(), key2.getKey()))
        {
            fail("failed old cofactor and single hash test");
        }
    }

    public static void main(
        String[]    args)
    {
        runTest(new ECIESKeyEncapsulationTest());
    }
}


text:
<table xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

</table>


text:
<?php

namespace core\datasources;

use core\AbstractModel;

interface DataSourceInterface
{
    public function query($queryType, AbstractModel $entity, $verb, $params);

    public function setDatasourceKey($keyName);

}


text:
import sys, os, os.path, re
import distutils, setuptools

from setuptools import dist, extension
from setuptools.command import build_ext
from setuptools.extension import Library as _Library

def patch_st_dir(patch_version, st_egg, jccdir):
    return '''

Shared mode is disabled, setuptools patch.43.%s must be applied to enable it
or the NO_SHARED environment variable must be set to turn off this error.

    sudo patch -d %s -Nup0 < %s/jcc/patches/patch.43.%s

See %s/INSTALL for more information about shared mode.
''' %(patch_version, st_egg, jccdir, patch_version, jccdir)

def patch_st_zip(patch_version, st_egg, jccdir):
    return '''

Shared mode is disabled, setuptools patch.43.%s must be applied to enable it
or the NO_SHARED environment variable must be set to turn off this error.

    mkdir tmp
    cd tmp
    unzip -q %s
    patch -Nup0 < %s/jcc/patches/patch.43.%s
    sudo zip %s -f
    cd ..
    rm -rf tmp

See %s/INSTALL for more information about shared mode.
''' %(patch_version, st_egg, jccdir, patch_version, st_egg, jccdir)

def patch_setuptools(with_setuptools):

    with_setuptools_c7 = ('00000000', '00000006', '*c', '00000007', '*final')
    with_setuptools_c11 = ('00000000', '00000006', '*c', '00000011', '*final')
    with_distribute_1 = ('00000000', '00000006', '00000001', '*final')

    try:
        from setuptools.command.build_ext import sh_link_shared_object
        enable_shared = True  # jcc/patches/patch.43 was applied
    except ImportError:
        jccdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
        st_egg = os.path.dirname(setuptools.__path__[0])
        if with_setuptools_c7 <= with_setuptools <= with_setuptools_c11 or with_distribute_1 <= with_setuptools:
            # Old setuptools 0.6c7-10 series
            # New distribute 0.6.1+ series

            if with_setuptools < with_setuptools_c11 and not hasattr(dist, 'check_packages'):
                # Old setuptools 0.6c7-10 series missing check_packages()
                dist.check_packages = check_packages

            setuptools.Library = LinuxLibrary
            extension.Library = LinuxLibrary
            build_ext.build_ext = LinuxBuildExt
            if build_ext.use_stubs:
                # Build shared libraries.
                global sh_link_shared_object # Fix UnboundLocalError
                build_ext.link_shared_object = sh_link_shared_object
            else:
                # Build static libraries every where else (unless forced)
                build_ext.libtype = 'static'
                build_ext.link_shared_object = st_link_shared_object

            print >>sys.stderr, "Applied shared mode monkey patch to:", setuptools
            return True # monkey patch was applied

        elif with_setuptools < with_setuptools_c11:   # old 0.6c7-10 series
            patch_version = '0.6c7'
        elif with_setuptools >= with_distribute_1:    # new 0.6.1 and up fork
            patch_version = '0.6c7'                   # compatible with 0.6c7
        else:
            patch_version = '0.6c11'                  # old 0.6c11+ series

        if os.path.isdir(st_egg):
            raise NotImplementedError, patch_st_dir(patch_version, st_egg,
                                                    jccdir)
        else:
            raise NotImplementedError, patch_st_zip(patch_version, st_egg,
                                                    jccdir)

    return enable_shared

class LinuxLibrary(_Library):
    def __init__(self, *args, **kwds):
        self.force_shared = kwds.pop('force_shared', False)
        extension.Extension.__init__(self, *args, **kwds)

class LinuxBuildExt(build_ext.build_ext):

    def get_ext_filename(self, fullname):
        filename = build_ext._build_ext.get_ext_filename(self, fullname)
        if fullname in self.ext_map:
            ext = self.ext_map[fullname]
            if isinstance(ext, _Library):
                if ext.force_shared and not build_ext.use_stubs:
                    libtype = 'shared'
                else:
                    libtype = build_ext.libtype
                fn, ext = os.path.splitext(filename)
                return self.shlib_compiler.library_filename(fn, libtype)
            elif build_ext.use_stubs and ext._links_to_dynamic:
                d, fn = os.path.split(filename)
                return os.path.join(d, 'dl-' + fn)
        return filename

    def build_extension(self, ext):
        _compiler = self.compiler
        try:
            force_shared = False
            if isinstance(ext, _Library):
                self.compiler = self.shlib_compiler
                force_shared = ext.force_shared and not build_ext.use_stubs
                if force_shared:
                    self.compiler.link_shared_object = sh_link_shared_object.__get__(self.compiler)
            build_ext._build_ext.build_extension(self, ext)
            if ext._needs_stub:
                self.write_stub(self.get_finalized_command('build_py').build_lib, ext)
        finally:
            if force_shared:
                self.compiler.link_shared_object = build_ext.link_shared_object.__get__(self.compiler)
            self.compiler = _compiler

def sh_link_shared_object(self, objects, output_libname, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None):
    self.link(self.SHARED_LIBRARY, objects, output_libname, output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, debug, extra_preargs, extra_postargs, build_temp, target_lang)

def st_link_shared_object(self, objects, output_libname, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None):
    assert output_dir is None   # distutils build_ext doesn't pass this
    output_dir, filename = os.path.split(output_libname)
    basename, ext = os.path.splitext(filename)
    if self.library_filename("x").startswith('lib'):
        # strip 'lib' prefix; this is kludgy if some platform uses
        # a different prefix
        basename = basename[3:]

    self.create_static_lib(objects, basename, output_dir, debug, target_lang)

def check_packages(dist, attr, value):
    for pkgname in value:
        if not re.match(r'\w+(\.\w+)*', pkgname):
            distutils.log.warn(
                "WARNING: %r not a valid package name; please use only"
                ".-separated package names in setup.py", pkgname
            )


text:
"""
Set up publication form schemas
"""

import logging

from django.conf import settings
from django.contrib.auth.models import User, Group
from tardis.tardis_portal.models import Schema, ParameterName
from . import default_settings

logger = logging.getLogger(__name__)

class PubFormConfig():

    def _setup_PUBLICATION_SCHEMA_ROOT(self, namespace):
        schema, _ = Schema.objects.get_or_create(namespace=namespace,
                                                 name='Publication',
                                                 hidden=True,
                                                 immutable=True)

        ParameterName.objects.get_or_create(schema=schema,
                                            name='embargo',
                                            full_name='embargo',
                                            data_type=ParameterName.DATETIME,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='pdb-embargo',
                                            full_name='pdb-embargo',
                                            data_type=ParameterName.STRING,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='pdb-last-sync',
                                            full_name='pdb-last-sync',
                                            data_type=ParameterName.DATETIME,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='form_state',
                                            full_name='form_state',
                                            data_type=ParameterName.STRING,
                                            immutable=True)

    def _setup_PUBLICATION_DRAFT_SCHEMA(self, namespace):
        schema, _ = Schema.objects.get_or_create(namespace=namespace,
                                                 name='Draft Publication',
                                                 hidden=True,
                                                 immutable=True)

    def _setup_PDB_PUBLICATION_SCHEMA_ROOT(self, namespace):
        schema, _ = Schema.objects.get_or_create(namespace=namespace,
                                                 name='Protein Data Bank',
                                                 hidden=False,
                                                 immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='pdb-id',
                                            full_name='PDB ID',
                                            data_type=ParameterName.STRING,
                                            is_searchable=True,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='title',
                                            full_name='Title',
                                            data_type=ParameterName.STRING,
                                            is_searchable=True,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='url',
                                            full_name='URL',
                                            data_type=ParameterName.URL,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='resolution',
                                            full_name='Resolution',
                                            units='Å',
                                            data_type=ParameterName.NUMERIC,
                                            is_searchable=True,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='r-value',
                                            full_name='R-Value',
                                            units='(obs.)',
                                            data_type=ParameterName.NUMERIC,
                                            is_searchable=True,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='r-free',
                                            full_name='R-Free',
                                            data_type=ParameterName.NUMERIC,
                                            is_searchable=True,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='space-group',
                                            full_name='Space Group',
                                            data_type=ParameterName.STRING,
                                            is_searchable=True,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='unit-cell',
                                            full_name='Unit Cell (Å,°)',
                                            data_type=ParameterName.STRING,
                                            immutable=True)

    def _setup_PDB_SEQUENCE_PUBLICATION_SCHEMA(self, namespace):
        schema, _ = Schema.objects.get_or_create(namespace=namespace,
                                                 name='Sequence Data',
                                                 hidden=False,
                                                 immutable=True)

        ParameterName.objects.get_or_create(schema=schema,
                                            name='expression-system',
                                            full_name='Expression System',
                                            data_type=ParameterName.STRING,
                                            is_searchable=True,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='organism',
                                            full_name='Organism',
                                            data_type=ParameterName.STRING,
                                            is_searchable=True,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='sequence',
                                            full_name='Sequence',
                                            data_type=ParameterName.STRING,
                                            is_searchable=True,
                                            immutable=True)

    def _setup_PDB_CITATION_PUBLICATION_SCHEMA(self, namespace):
        schema, _ = Schema.objects.get_or_create(namespace=namespace,
                                                 name='Citation',
                                                 hidden=False,
                                                 immutable=True)

        ParameterName.objects.get_or_create(schema=schema,
                                            name='title',
                                            full_name='Title',
                                            data_type=ParameterName.STRING,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='authors',
                                            full_name='Authors',
                                            data_type=ParameterName.STRING,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='journal',
                                            full_name='Journal',
                                            data_type=ParameterName.STRING,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='volume',
                                            full_name='Volume',
                                            data_type=ParameterName.STRING,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='page-range',
                                            full_name='Pages',
                                            data_type=ParameterName.STRING,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='doi',
                                            full_name='DOI',
                                            data_type=ParameterName.URL,
                                            immutable=True)

    def _setup_PUBLICATION_DETAILS_SCHEMA(self, namespace):
        schema, _ = Schema.objects.get_or_create(namespace=namespace,
                                                 name='Publication Details',
                                                 hidden=False,
                                                 immutable=True)

        ParameterName.objects.get_or_create(schema=schema,
                                            name='doi',
                                            full_name='DOI',
                                            data_type=ParameterName.STRING,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='acknowledgements',
                                            full_name='Acknowledgements',
                                            data_type=ParameterName.STRING,
                                            immutable=True)

    def _setup_MX_PUBLICATION_DATASET_SCHEMA(self, namespace):
        schema, _ = Schema.objects.get_or_create(namespace=namespace,
                                                 name='MX dataset details',
                                                 hidden=False,
                                                 immutable=True)

        ParameterName.objects.get_or_create(schema=schema,
                                            name='dataset',
                                            full_name='Dataset',
                                            data_type=ParameterName.STRING,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='description',
                                            full_name='Description',
                                            data_type=ParameterName.STRING,
                                            immutable=True)
        ParameterName.objects.get_or_create(schema=schema,
                                            name='additional-information',
                                            full_name='Additional information',
                                            data_type=ParameterName.STRING,
                                            immutable=True)

    def do_setup(self, force=False):
        logger.info('Checking for required django settings.')

        required_settings = [('PUBLICATION_OWNER_GROUP',
                              'All publications are owned by this group')]
        required_schemas = [
            ('PUBLICATION_SCHEMA_ROOT',
             'A hidden schema that contians data required to manage the '
             'publication'),
            ('PUBLICATION_DRAFT_SCHEMA',
             'Stores the form state and is deleted once the form is '
             'completed'),
            ('PUBLICATION_DETAILS_SCHEMA',
             'Contains standard bibliographic details, such as DOI and '
             'acknowledgements'),
            ('PDB_PUBLICATION_SCHEMA_ROOT',
             'Standard protein crystallographic parameters'),
            ('PDB_SEQUENCE_PUBLICATION_SCHEMA',
             'Protein sequence data that might repeat depending on how many '
             'entities are present'),
            ('PDB_CITATION_PUBLICATION_SCHEMA',
             'Citation data that is extracted from the PDB record'),
            ('MX_PUBLICATION_DATASET_SCHEMA',
             'Macromolecular crystallography dataset publication schema')]

        recommended_settings = [('PUBLICATION_FORM_MAPPINGS', ''),
                                ('PDB_REFRESH_INTERVAL', ''),
                                ('PUBLICATION_NOTIFICATION_SENDER_EMAIL', '')]
        for setting, description in (required_settings + required_schemas +
                                     recommended_settings):
            if not hasattr(settings, setting):
                logger.info(setting + ' setting not found. Using defaults'
                                      ' for now, but you might encounter problems'
                                      ' later! (%s)' % description)

        for schema, description in required_schemas:
            logger.info('Setting up schema: ' + schema)
            getattr(self, '_setup_' + schema)(
                getattr(settings, schema,
                        getattr(default_settings, schema)))

        pub_group = getattr(settings, 'PUBLICATION_OWNER_GROUP',
                            'publication-admin')
        try:
            Group.objects.get(name=pub_group)
            logger.info('Publication owner group exists.')
        except Group.DoesNotExist:
            logger.info('Publication owner group doesnt, so creating.')
            pub_owner_group = Group(name=pub_group)
            pub_owner_group.save()
            logger.info('Publication owner group created. Adding all'
                        'superusers.')
            superusers = User.objects.filter(is_superuser=True)
            pub_owner_group.user_set.add(*superusers)

        logger.info('Publication form setup complete.')


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
    <Button
            style="@style/style1"
            android:text="Hello" android:textColor="@android:color/black" android:background="@android:color/white"/>
</LinearLayout>


text:
/**
 * Sample Application - angular-scaffold
 * @module application
 */
angular.module('application', [
        'application.templates',
        'application.controller',
        'ui.router'
    ])

    .constant('NAV_ITEMS', [
        {title: 'Home', state: 'home', sref: 'home', icon: 'glyphicon-home'},
        {title: 'About', state: 'about', sref: 'about', icon: 'glyphicon-info-sign'},
        {title: 'Contact', state: 'contact', sref: 'contact', icon: 'glyphicon-earphone'}
    ])

    .config(function ($stateProvider, $urlRouterProvider) {
        'use strict';

        $urlRouterProvider.otherwise('/home');

        $stateProvider
            .state('home', {
                url: '/home',
                templateUrl: 'view/home.tpl.html',
                controller: 'HomeCtrl'
            })
            .state('about', {
                url: '/about',
                templateUrl: 'view/about.tpl.html'
            })
            .state('contact', {
                url: '/contact',
                templateUrl: 'view/contact.tpl.html'
            });
    })

    .run(function ($rootScope, $state, $stateParams) {
        'use strict';

        $rootScope.$state = $state;
        $rootScope.$stateParams = $stateParams;
    });


text:
package com.l2fprod.common.swing.renderer;

import com.l2fprod.common.annotations.RendererRegistry;
import com.l2fprod.common.beans.editor.CalendarStringPropertyEditor;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

/**
 * A renderer for Date.
 *
 * @author Ricardo Lopes
 */
@RendererRegistry(type = Calendar.class)
public class CalendarRenderer extends DefaultCellRenderer {

    private DateFormat dateFormat;

    public CalendarRenderer() {
        this(CalendarStringPropertyEditor.DEFAULT_DATE_FORMAT);
    }

    public CalendarRenderer(String formatString) {
        this(formatString, Locale.getDefault());
    }

    public CalendarRenderer(Locale l) {
        this(DateFormat.getDateInstance(DateFormat.SHORT, l));
    }

    public CalendarRenderer(String formatString, Locale l) {
        this(new SimpleDateFormat(formatString, l));
    }

    public CalendarRenderer(DateFormat dateFormat) {
        this.dateFormat = dateFormat;
    }

    @Override
    public void setValue(Object value) {
        if (value == null) {
            setText("");
        } else {
            setText(dateFormat.format(((Calendar) value).getTime()));
        }
    }

}


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             tools:context="org.lactor.consultant.about.ui.AboutFragment"
             android:orientation="vertical">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/longtext"
        android:padding="50dp"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/created_at_purdue_university"
        android:padding="50dp"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/app_design_by_icon8"
        android:padding="50dp"/>

</LinearLayout>


text:
/**
 * @file window.h
 * @brief Defines Window.
 */

#pragma once

#include "std/ogle_std.inc"
#include <memory>

namespace ogle {

class Configuration;

/**
 * @brief A window that provides a rendering context.
 *
 * It is assumed that there is only Window per application.
 * Windows also handle events like closing, minimizing,
 * and resizing.
 */
class Window {
 public:
  /// Configuration module for windows.
  static const stl_string kConfigModule;

  /// Configuration attribute defining implementation to use.
  static const stl_string kConfigAttributeImplementation;

  //@{
  /// Configuration attribute defining a common window property.
  static const stl_string kConfigAttributeWidth;
  static const stl_string kConfigAttributeHeight;
  static const stl_string kConfigAttributeTitle;
  //@}

  /**
   * @brief Default destructor.
   */
  virtual ~Window() = default;

  /**
   * @brief Creates a new Window.
   * @param configuration Window configuration.
   * @return New window.
   */
  static std::unique_ptr<Window> Build(const Configuration& configuration);

  /**
   * @brief Clear all window contents.
   */
  virtual void ClearWindow() = 0;

  /**
   * @brief Swap buffers to display next frame.
   */
  virtual void SwapBuffers() = 0;

  /**
   * @brief Handle events on window, like close.
   * @return false if window should close, else true.
   */
  virtual bool HandleWindowEvents() = 0;

  /**
   * @brief Accessor.
   * @return Window's aspect ratio.
   */
  virtual const float aspect_ratio() const = 0;

  /**
   * @brief Accessor.
   * @return Window width [pixels].
   */
  virtual const int window_width() const = 0;

  /**
   * @brief Accessor.
   * @return Window height [pixels].
   */
  virtual const int window_height() const = 0;
};

}  // namespace ogle


text:
require_relative "../helper"

module Risc
  class TestPlaform < MiniTest::Test

    def test_arm_factory_exists
      assert Platform.for("Arm")
    end
    def test_inter_factory_exists
      assert Platform.for("Interpreter")
    end
    def test_factory_raise
      assert_raises{ Platform.for("NotArm")}
    end
    def test_allocate
      allocator = Platform.for("Interpreter").allocator(FakeCompiler.new)
      assert_equal FakeCompiler , allocator.compiler.class
    end
    def test_map_message
      assert_equal :r13 , Platform.new.assign_reg?(:message)
    end
    def test_map_sys
      assert_equal :r0 , Platform.new.assign_reg?(:syscall_1)
    end
    def test_map_id
      assert_nil Platform.new.assign_reg?(:id_some_id)
    end
    def test_names_len
      assert_equal 13 , Platform.new.register_names.length
    end
    def test_names_r
      assert_equal "r" , Platform.new.register_names.first.to_s[0]
      assert_equal "r" , Platform.new.register_names.last.to_s[0]
    end
  end
end


text:
/* */
'use strict';
var each = require('./_array-methods')(0),
    redefine = require('./_redefine'),
    meta = require('./_meta'),
    assign = require('./_object-assign'),
    weak = require('./_collection-weak'),
    isObject = require('./_is-object'),
    has = require('./_has'),
    getWeak = meta.getWeak,
    isExtensible = Object.isExtensible,
    uncaughtFrozenStore = weak.ufstore,
    tmp = {},
    InternalMap;
var wrapper = function(get) {
  return function WeakMap() {
    return get(this, arguments.length > 0 ? arguments[0] : undefined);
  };
};
var methods = {
  get: function get(key) {
    if (isObject(key)) {
      var data = getWeak(key);
      if (data === true)
        return uncaughtFrozenStore(this).get(key);
      return data ? data[this._i] : undefined;
    }
  },
  set: function set(key, value) {
    return weak.def(this, key, value);
  }
};
var $WeakMap = module.exports = require('./_collection')('WeakMap', wrapper, methods, weak, true, true);
if (new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7) {
  InternalMap = weak.getConstructor(wrapper);
  assign(InternalMap.prototype, methods);
  meta.NEED = true;
  each(['delete', 'has', 'get', 'set'], function(key) {
    var proto = $WeakMap.prototype,
        method = proto[key];
    redefine(proto, key, function(a, b) {
      if (isObject(a) && !isExtensible(a)) {
        if (!this._f)
          this._f = new InternalMap;
        var result = this._f[key](a, b);
        return key == 'set' ? this : result;
      }
      return method.call(this, a, b);
    });
  });
}


text:
namespace content {

class RendererPpapiHost;

class PepperFlashRendererHost : public ppapi::host::ResourceHost {
 public:
  PepperFlashRendererHost(RendererPpapiHost* host,
                          PP_Instance instance,
                          PP_Resource resource);
  virtual ~PepperFlashRendererHost();

  // ppapi::host::ResourceHost override.
  virtual int32_t OnResourceMessageReceived(
      const IPC::Message& msg,
      ppapi::host::HostMessageContext* context) OVERRIDE;

 private:
  int32_t OnMsgGetProxyForURL(ppapi::host::HostMessageContext* host_context,
                              const std::string& url);

  DISALLOW_COPY_AND_ASSIGN(PepperFlashRendererHost);
};

}  // namespace content

#endif  // CONTENT_RENDERER_PEPPER_PEPPER_FLASH_RENDERER_HOST_H_


text:
{% extends 'adminlayout.html' %}

{% block content %}

Restarting

<meta http-equiv="refresh" content="5; url=/" />

{% endblock %}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ugoria.URBD.Contracts.Data;
using Ugoria.URBD.Contracts.Data.Commands;
using Ugoria.URBD.Contracts.Data.Reports;

namespace Ugoria.URBD.Contracts.Handlers
{
    public interface IExtDirectoriesDataHandler : IDataHandler
    {
        ExtDirectoriesCommand GetPreparedExtDirectoriesCommand(ExtDirectoriesCommand command);
        void SetReport(ExtDirectoriesReport report);
    }
}


text:
package org.apache.reef.runtime.common.evaluator;

import org.apache.reef.proto.EvaluatorRuntimeProtocol;
import org.apache.reef.proto.ReefServiceProtos;
import org.apache.reef.runtime.common.evaluator.context.ContextManager;
import org.apache.reef.runtime.common.evaluator.parameters.DriverRemoteIdentifier;
import org.apache.reef.runtime.common.evaluator.parameters.HeartbeatPeriod;
import org.apache.reef.runtime.common.utils.RemoteManager;
import org.apache.reef.tang.InjectionFuture;
import org.apache.reef.tang.annotations.Parameter;
import org.apache.reef.tang.annotations.Unit;
import org.apache.reef.util.Optional;
import org.apache.reef.wake.EventHandler;
import org.apache.reef.wake.time.Clock;
import org.apache.reef.wake.time.event.Alarm;

import javax.inject.Inject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;

@Unit
public class HeartBeatManager {

  private static final Logger LOG = Logger.getLogger(HeartBeatManager.class.getName());

  private final Clock clock;
  private final int heartbeatPeriod;
  private final EventHandler<EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto> evaluatorHeartbeatHandler;
  private final InjectionFuture<EvaluatorRuntime> evaluatorRuntime;
  private final InjectionFuture<ContextManager> contextManager;

  @Inject
  private HeartBeatManager(
      final InjectionFuture<EvaluatorRuntime> evaluatorRuntime,
      final InjectionFuture<ContextManager> contextManager,
      final Clock clock,
      final RemoteManager remoteManager,
      final @Parameter(HeartbeatPeriod.class) int heartbeatPeriod,
      final @Parameter(DriverRemoteIdentifier.class) String driverRID) {

    this.evaluatorRuntime = evaluatorRuntime;
    this.contextManager = contextManager;
    this.clock = clock;
    this.heartbeatPeriod = heartbeatPeriod;
    this.evaluatorHeartbeatHandler = remoteManager.getHandler(
        driverRID, EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto.class);
  }

  /**
   * Assemble a complete new heartbeat and send it out.
   */
  public synchronized void sendHeartbeat() {
    this.sendHeartBeat(this.getEvaluatorHeartbeatProto());
  }

  /**
   * Called with a specific TaskStatus that must be delivered to the driver.
   */
  public synchronized void sendTaskStatus(final ReefServiceProtos.TaskStatusProto taskStatusProto) {
    this.sendHeartBeat(this.getEvaluatorHeartbeatProto(
        this.evaluatorRuntime.get().getEvaluatorStatus(),
        this.contextManager.get().getContextStatusCollection(),
        Optional.of(taskStatusProto)));
  }

  /**
   * Called with a specific TaskStatus that must be delivered to the driver.
   */
  public synchronized void sendContextStatus(
      final ReefServiceProtos.ContextStatusProto contextStatusProto) {

    // TODO: Write a test that checks for the order.
    final Collection<ReefServiceProtos.ContextStatusProto> contextStatusList = new ArrayList<>();
    contextStatusList.add(contextStatusProto);
    contextStatusList.addAll(this.contextManager.get().getContextStatusCollection());

    final EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto heartbeatProto =
        this.getEvaluatorHeartbeatProto(
            this.evaluatorRuntime.get().getEvaluatorStatus(),
            contextStatusList, Optional.<ReefServiceProtos.TaskStatusProto>empty());

    this.sendHeartBeat(heartbeatProto);
  }

  /**
   * Called with a specific EvaluatorStatus that must be delivered to the driver.
   */
  public synchronized void sendEvaluatorStatus(
      final ReefServiceProtos.EvaluatorStatusProto evaluatorStatusProto) {
    this.sendHeartBeat(EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto.newBuilder()
        .setTimestamp(System.currentTimeMillis())
        .setEvaluatorStatus(evaluatorStatusProto)
        .build());
  }

  /**
   * Sends the actual heartbeat out and logs it, so desired.
   *
   * @param heartbeatProto
   */
  private synchronized void sendHeartBeat(
      final EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto heartbeatProto) {
    if (LOG.isLoggable(Level.FINEST)) {
      LOG.log(Level.FINEST, "Heartbeat message:\n" + heartbeatProto, new Exception("Stack trace"));
    }
    this.evaluatorHeartbeatHandler.onNext(heartbeatProto);
  }

  private EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto getEvaluatorHeartbeatProto() {
    return this.getEvaluatorHeartbeatProto(
        this.evaluatorRuntime.get().getEvaluatorStatus(),
        this.contextManager.get().getContextStatusCollection(),
        this.contextManager.get().getTaskStatus());
  }

  private final EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto getEvaluatorHeartbeatProto(
      final ReefServiceProtos.EvaluatorStatusProto evaluatorStatusProto,
      final Iterable<ReefServiceProtos.ContextStatusProto> contextStatusProtos,
      final Optional<ReefServiceProtos.TaskStatusProto> taskStatusProto) {

    final EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto.Builder builder =
        EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto.newBuilder()
            .setTimestamp(System.currentTimeMillis())
            .setEvaluatorStatus(evaluatorStatusProto);

    for (final ReefServiceProtos.ContextStatusProto contextStatusProto : contextStatusProtos) {
      builder.addContextStatus(contextStatusProto);
    }

    if (taskStatusProto.isPresent()) {
      builder.setTaskStatus(taskStatusProto.get());
    }

    return builder.build();
  }

  final class HeartbeatAlarmHandler implements EventHandler<Alarm> {
    @Override
    public void onNext(final Alarm alarm) {
      synchronized (HeartBeatManager.this) {
        if (evaluatorRuntime.get().isRunning()) {
          HeartBeatManager.this.sendHeartbeat();
          HeartBeatManager.this.clock.scheduleAlarm(HeartBeatManager.this.heartbeatPeriod, this);
        } else {
          LOG.log(Level.FINEST,
              "Not triggering a heartbeat, because state is: {0}",
              evaluatorRuntime.get().getState());
        }
      }
    }
  }
}