text:
Metadata for arXiv
==================

The goal of this repository is to provide a minimal API to put metadata on arXiv papers.

Disclaimer: This code is not scalable nor ready to run in production. In
particular, it might be error-prone, and do not try to be resilient and keep
trace of errors. It is here as a proof of concept and to back [this
article](http://known.phyks.me/2015/lets-some-metadata-on-arxiv) with some
code. However, the `reference_fetcher` part is working quite well, and was able
to extract most of the references from arXiv papers I tested it on. Note that
it is quite long to run it on a paper, mainly due to the latency in [Crossref
API](http://search.crossref.org/).

A demo instance should be available at
[http://arxiv.phyks.me/](http://arxiv.phyks.me/). This may not be very stable
or highly available though.

**Note: If you want to extract some functions from this repo, please consider using [libbmc](https://github.com/Phyks/libbmc/) instead, which is specifically dedicated to this (and this repo should be using it, rather than duplicating code).**

## Special thanks

Under the hood, this code uses the wonderful [Crossref
API](http://search.crossref.org/) for reference parsing to DOI, which works
really well and with a very large index.

It also uses the [Dissemin API](http://beta.dissem.in/) in the
`reference_fetcher` to try to find Open access versions of referenced papers.

It works using the Open access [arXiv.org](http://arxiv.org) repository,
without which it would be really difficult to achieve similar thing, due to
paywalls and lack of sources. It also uses their
[API](http://arxiv.org/help/api) to fetch DOIs from arXiv id and conversely.

## Introduction

Most of the published scientific papers are availabe online, as preprints. For
physics and computer science, most of them are available on the
[arXiv](http://arxiv.org/) repository. Published paper get a unique (global)
identifier, a [DOI](https://en.wikipedia.org/wiki/Digital_object_identifier).
Preprint papers released on arXiv get a unique
[identifier](https://arxiv.org/help/arxiv_identifier). Correspondance between
these two identifiers can be made quite easily once the preprint is published,
as some publishers pushes back the DOIs to arXiv.

Then, all these articles can be easily identified and tracked. However, very
small use of this is done, and especially there is no way to post metadata
between articles. For example, getting a (usable) list of articles referencing
a given article, or referenced by it, is very difficult (and a textual
bibliography is not a usable list of articles, as it is truly difficult to
parse).

This basic Python code offers a way to add some metadata between articles. One
can import articles in it. It automatically tries to fetch referenced papers
and add the corresponding relationships between these papers and the added
paper. Relationships are reversible which means one can easily get the papers
citing a given paper.

It offers an API to add extra metadata. One could for instance imagine adding
others relations between papers to say they are similar, extra possible
reference, or so on.

One could even imagine extending this further to tag papers, just as arXiv do
(in some sort) with their "categories" (such as
[cond-mat](http://arxiv.org/archive/cond-mat)) so that researchers could follow
tags relative to their area of research, and get a narrower and better targeted
list of papers everyday. Plus everyone could tag articles in a collaborative
way, so that some papers which might be of interest for a field, but were not
tagged as such, would reach it anyway.

## Installation

For building `opendetex` (which is a necessary dependency), you will need
`gcc`, `flex` and `make`.

* Clone this repository: `git clone https://github.com/Phyks/arxiv_metadata`.
* Init submodules (`opendetex`): `git submodule init; git submodule update`.
* Build `opendetex`: `cd reference_fetcher/opendetex; make`.
* [This is all if you only want to use the `reference_fetcher`. Else, go on reading]
* Download required Python modules: `pip install -r requirements.txt`.
* [Optional] Update configuration in `config.py`. Default values are for testing and dev.
* You are ready to go.

## Test it

You can test it easily using the Bottle built-in webserver. This is the default configuration.

To start the app, just run `python3 ./main.py` and head to [http://localhost:8080](http://localhost:8080).

You should not use this server in production, and should edit `main.py` accordingly.

## API

### Index

```
GET /
```

```json
{
    "papers": "/papers/?id={id}&doi={doi}&arxiv_id={arxiv_id}",
}
```

### Get papers

```
GET /papers
Accept: application/vnd.api+json
```

One can filter further using `id={id}`, `doi={doi}` or `arxiv_id={arxiv_id}`
query parameters.

```json
    {
        "data": [
            {
                "type": "papers",
                "id": 1,
                "attributes": {
                    "doi": "10.1126/science.1252319",
                    "arxiv_id": "1401.2910"
                },
                "links": {
                    "self": "/papers/1"
                },
                "relationships": {
                    "cite": {
                        "links": {
                            "related": "/papers/1/relationships/cite"
                        }
                    },
                    ...
                }
            }
        ]
    }
```

### Get a paper

```
GET /papers/1
Accept: application/vnd.api+json
```

```json
{
    "data": {
        "type": "papers",
        "id": 1,
        "attributes": {
            "doi": "10.1126/science.1252319",
            "arxiv_id": "1401.2910"
        },
        "links": {
            "self": "/papers/1"
        },
        "relationships": {
            "cite": {
                "links": {
                    "related": "/papers/1/relationships/cite"
                }
            },
            ...
        }
    }
}
```

### Get the relationships of a paper

```
GET /papers/1/relationships/cite
Accept: application/vnd.api+json
```

```json
{
    "links": {
        "self": "/papers/1/relationships/cite",
        "related": "/papers/1/cite"
    },
    "data": [
        {
            "type": "papers",
            "id": 2,
        },
        ...
    ]
}
```

The previous relationship is to be understood as `paper 1 cites paper 2`.

Using `?reverse=1`, one can reverse the relationships (ie get results for
papers that cites the paper identified by the id in the URL, in the previous
case).

### Post a paper

```
POST /papers
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
    "data": {
        "doi": "10.1126/science.1252319",
        // OR
        "arxiv_id": "1401.2910"
    }
}
```

`arxiv_id` (respectively `doi`) is fetched automatically if available.

```json
{
    "data": {
        "type": "papers",
        "id": 1,
        "attributes": {
            "doi": "10.1126/science.1252319",
            "arxiv_id": "1401.2910"
        },
        "links": {
            "self": "/papers/1"
        },
        "relationships": {
            "cite": {
                "links": {
                    "related": "/papers/1/relationships/cite"
                }
            },
            ...
        }
    }
}
```

### Get tags

```
GET /tags
Accept: application/vnd.api+json
```

Filtering is possible using ``id=ID``, ``name=NAME`` or any combination of
these GET parameters. Other parameters are ignored.

```json
{
    "data": [
        {
            "type": "tags",
            "id": 1,
            "attributes": {
                "name": "foobar",
            },
            "links": {
                "self": "/tags/1"
            }
        }
    ]
}
```

### Get a tag by id

```
GET /tag/1
Accept: application/vnd.api+json
```

```json
{
    "data": {
        "type": "papers",
        "id": 1,
        "attributes": {
            "doi": "10.1126/science.1252319",
            "arxiv_id": "1401.2910"
        },
        "links": {
            "self": "/papers/1"
        },
        "relationships": {
            "cite": {
                "links": {
                    "related": "/papers/1/relationships/cite"
                }
            },
            …
        }
    }
}
```

### Create a tag

```
POST /tags
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
    "data": {
        "name": "foobar",
    }
}
```

```json
{
    "data": {
        "type": "tags",
        "id": 1,
        "attributes": {
            "name": "foobar",
        },
        "links": {
            "self": "/tags/1"
        }
    }
}
```

### Create a relationship between two papers

```
POST /papers/1/relationships/cite
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
    "data": [
        { "type": "cite", "id": "2" },
        ...
    ]
}
```

Response is empty HTTP 204.

### Add a tag to a paper

```
POST /papers/1/relationships/tags
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
    "data": [
        { "type": "tags", "id": "2" },
        ...
    ]
}
```

`id` is the id of the tag, which has to be created previously.

Response is empty HTTP 204.

### Delete a paper and associated relationships

```
DELETE /papers/1
Accept: application/vnd.api+json
```

Response is empty HTTP 204.

### Delete a tag

```
DELETE /tags/1
Accept: application/vnd.api+json
```

Response is empty HTTP 204.

### Delete a relationship between two papers

```
DELETE /papers/1/relationships/cite
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
    "data": [
        { "type": "cite", "id": "2" },
        ...
    ]
}
```

Response is empty HTTP 204.

### Deleting a tag for a paper

```
DELETE /papers/1/relationships/tags
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
    "data": [
        { "type": "tags", "id": "2" },
        ...
    ]
}
```

`id` is the id of the tag.

Response is empty HTTP 204.

## Associated library

`reference_fetcher` is a module you can use to:

* Fetch DOIs (or arXiv ids) of papers referenced by a given paper on arXiv (or any other paper, provided that you have a .bbl file).
* Fetch DOI associated with a given arXiv paper (if any).
* Fetch the arXiv identifier associated to a given DOI (if any).
* and more :)

`fetch_references.py` script in the root folder is here to show you how to use it and to serve as a minimal example.

### Usage

* `./fetch_references.py some_file.bbl` to get a list of DOIs associated to each `\bibitem`.
* `./fetch_references.py arxiv_eprint_id` to get a list of DOIs associated to each reference from the provided arXiv eprint.

### Example

```
$ ./fetch_references.py 1401.2910
```

```
{'author Barahona, F. title On the computational complexity of I sing spin glass models . journal Journal of Physics A: Mathematical and General volume 15 , pages 3241 ( year 1982 )': 'http://dx.doi.org/10.1088/0305-4470/15/10/028',
 'author Bennett, C. , author Bernstein, E. , author Brassard, G. author Vazirani, U. title Strengths and weaknesses of quantum computing . journal SIAM Journal on Computing volume 26 , pages 1510-1523 ( year 1997 )': 'http://dx.doi.org/10.1137/s0097539796300933',
 'author Berkley, A. J. et al. title A scalable readout system for a superconducting adiabatic quantum optimization system . journal Superconductor Science and Technology volume 23 , pages 105014 ( year 2010 )': 'http://dx.doi.org/10.1088/0953-2048/23/10/105014',
 'author Berry, D. W. , author Childs, A. M. , author Cleve, R. , author Kothari, R. author Somma, R. D. title Exponential improvement in precision for simulating sparse hamiltonians . journal arXiv:1312.1414 ( year 2013 )': 'http://arxiv.org/abs/1312.1414',
 'author Boixo, S. , author Albash, T. , author Spedalieri, F. M. , author Chancellor, N. author Lidar, D. A. title Experimental signature of programmable quantum annealing ( year 2012 ). . 1212.1739': 'http://arxiv.org/abs/1212.1739',
 'author Boixo, S. et al. title Quantum annealing with more than one hundred qubits ( year 2013 ). . 1304.4595': 'http://arxiv.org/abs/1304.4595',
 'author Dechter, R. title Bucket elimination: A unifying framework for reasoning . journal Artificial Intelligence volume 113 , pages 41-85 ( year 1999 )': 'http://dx.doi.org/10.1016/s0004-3702(99)00059-4',
 'author Farhi, E. et al. title A quantum adiabatic evolution algorithm applied to random instances of an NP -complete problem . journal Science volume 292 , pages 472-475 ( year 2001 )': 'http://dx.doi.org/10.1126/science.1057726',
 'author Feynman, R. title Simulating physics with computers . journal International Journal of Theoretical Physics volume 21 , pages 467-488 ( year 1982 )': 'http://dx.doi.org/10.1007/bf02650179',
 'author Grover, L. K. title Quantum mechanics helps in searching for a needle in a haystack . journal Physical Review Letters volume 79 , pages 325-328 ( year 1997 )': 'http://dx.doi.org/10.1103/physrevlett.79.325',
 'author Harris, R. et al. title Experimental investigation of an eight-qubit unit cell in a superconducting optimization processor . journal Phys. Rev. B volume 82 , pages 024511 ( year 2010 )': 'http://dx.doi.org/10.1103/physrevb.82.024511',
 'author Helmut G. Katzgraber, R. S. A., Firas Hamze . title Glassy Chimeras are blind to quantum speedup: Designing better benchmarks for quantum annealing machines ( year 2014 ). . 1401.1546': 'http://arxiv.org/abs/1401.1546',
 'author Isakov, S. , author Zintchenko, I. , author Ronnow, T. author Troyer, M. title Optimized simulated annealing for Ising spin glasses ( year 2014 ). . 1401.1084': 'http://arxiv.org/abs/1401.1084',
 'author Johnson, M. W. et al. title A scalable control system for a superconducting adiabatic quantum optimization processor . journal Superconductor Science and Technology volume 23 , pages 065004 ( year 2010 )': 'http://dx.doi.org/10.1088/0953-2048/23/6/065004',
 'author Johnson, M. W. et al. title Quantum annealing with manufactured spins . journal Nature volume 473 , pages 194-198 ( year 2011 )': None,
 'author Kadowaki, T. author Nishimori, H. title Quantum annealing in the transverse I sing model . journal Phys. Rev. E volume 58 , pages 5355-5363 ( year 1998 )': 'http://dx.doi.org/10.1103/physreve.58.5355',
 'author Kirkpatrick, S. , author Gelatt, C. D. author Vecchi, M. P. title Optimization by simulated annealing . journal Science volume 220 , pages 671-680 ( year 1983 )': 'http://dx.doi.org/10.1126/science.220.4598.671',
 'author Lloyd, S. title Universal quantum simulators . journal Science volume 273 , pages 1073-1078 ( year 1996 )': 'http://dx.doi.org/10.1126/science.273.5278.1073',
 'author Marto n n ak, R. , author Santoro, G. E. author Tosatti, E. title Quantum annealing by the path-integral M onte C arlo method: The two-dimensional random I sing model . journal Phys. Rev. B volume 66 , pages 094203 ( year 2002 )': 'http://dx.doi.org/10.1103/physrevb.66.094203',
 'author McGeoch, C. C. author Wang, C. title Experimental evaluation of an adiabatic quantum system for combinatorial optimization . In booktitle Proceedings of the 2013 ACM Conference on Computing Frontiers ( year 2013 )': 'http://dx.doi.org/10.1145/2482767.2482797',
 'author Papageorgiou, A. author Traub, J. F. title Measures of quantum computing speedup . journal Phys. Rev. A volume 88 , pages 022316 ( year 2013 )': 'http://dx.doi.org/10.1103/physreva.88.022316',
 'author Parberry, I. title Parallel speedup of sequential machines: a defense of parallel computation thesis . journal SIGACT News volume 18 , pages 54-67 ( year 1986 )': 'http://dx.doi.org/10.1145/8312.8317',
 'author Pomerance, C. title A tale of two sieves . journal Notices of the Amer. Math. Soc. volume 43 , pages 1473-1485 ( year 1996 )': None,
 'author Pudenz, K. L. , author Albash, T. author Lidar, D. A. title Error corrected quantum annealing with hundreds of qubits . journal arXiv:1307.8190 ( year 2013 )': 'http://arxiv.org/abs/1307.8190',
 'author Santoro, G. E. , author Marto n a k, R. , author Tosatti, E. author Car, R. title Theory of quantum annealing of an I sing spin glass . journal Science volume 295 , pages 2427-2430 ( year 2002 )': None,
 'author Santra, S. , author Quiroz, G. , author Steeg, G. V. author Lidar, D. title MAX 2-SAT with up to 108 qubits . journal arXiv:1307.3931 ( year 2013 )': 'http://arxiv.org/abs/1307.3931',
 'author Sarandy, M. S. author Lidar, D. A. title Adiabatic quantum computation in open systems . journal Physical Review Letters volume 95 , pages 250503- ( year 2005 )': 'http://dx.doi.org/10.1103/physrevlett.95.250503',
 'author Shor, P. W. title Algorithms for quantum computation: discrete logarithms and factoring . journal Foundations of Computer Science, 1994 Proceedings., 35th Annual Symposium on pages 124-134 ( year 20-22 Nov 1994 )': 'http://dx.doi.org/10.1109/sfcs.1994.365700',
 'author Smolin, J. A. , author Smith, G. author Vargo, A. title Oversimplifying quantum factoring . journal Nature volume 499 , pages 163-165 ( year 2013 )': 'http://dx.doi.org/10.1038/nature12290',
 'author Smolin, J. A. author Smith, G. title Classical signature of quantum annealing ( year 2013 ). . arXiv:1305.4904': 'http://arxiv.org/abs/1305.4904',
 'author Somma, R. D. , author Nagaj, D. author Kieferov a , M. title Quantum speedup by quantum annealing . journal Physical Review Letters volume 109 , pages 050501- ( year 2012 )': 'http://dx.doi.org/10.1103/physrevlett.109.050501',
 "author Wang, L. et al. title Comment on: 'Classical signature of quantum annealing ' ( year 2013 ). . arXiv:1305.5837": 'http://arxiv.org/abs/1305.5837',
 'author Young, A. P. author Katzgraber, H. G. title Absence of an Almeida-Thouless Line in Three-Dimensional Spin Glasses . journal Phys. Rev. Lett. volume 93 , pages 207203 ( year 2004 )': 'http://dx.doi.org/10.1103/physrevlett.93.207203',
 'note For example, it may be the case, though it seems unlikely, that a classified polynomial-time factoring algorithm is available to parts of the intelligence community': None,
 'note Such a proof seems unlikely to be found any time soon since it would imply that factoring is not in the complexity class P (polynomial) and thus P and NP (nondeterministic polynomial) are distinct, solving the long-standing P versus NP question': None,
 "note We compare quantum annealing only to classical simulated annealing and simulated quantum annealing in this study. Another example of a limited quantum speedup would be Shor's factoring algorithm running on a fully coherent quantum computer vs a classical computer where the period finding using a quantum circuit has been replaced by a classical period finding algorithm": None,
 'note While one can in principle look for an optimal annealing time for each individual problem instance, we instead determine an averaged optimal annealing time for each problem size by annealing many instances at various annealing times , and then use these for all future problems of that size': None}
```

---

```
$ ./fetch_reference.py /tmp/test.bbl
```

```
{'Abrikosov A. A., Gorʹkov L. P., Dzyaloshinski I. E. Dzi͡aloshinskiĭ I. E. Methods Of Quantum Field Theory In Statistical Physics (Dover Publications) 1975': None,
 'Arnold P. Moore G. Phys. Rev. Lett. 87 2001 120401': None,
 'Baym G., Blaizot J.-P., Holzmann M., Lalo e F. Vautherin D. Phys. Rev. Lett. 83 1999 1703': 'http://dx.doi.org/10.1103/physrevlett.83.1703',
 "Capogrosso-Sansone B., Giorgini S., Pilati S., Pollet L., Prokof'ev N., Svistunov B. Troyer M. New Journal of Physics 12 2010 043010": 'http://dx.doi.org/10.1088/1367-2630/12/4/043010',
 'Donnelly R. J. Phys. Today 62 2009 34–39': 'http://dx.doi.org/10.1063/1.3248499',
 'Griffin A. Zaremba E. Phys. Rev. A 56 1997 4839': 'http://dx.doi.org/10.1103/physreva.56.4839',
 'Hou Y.-H., Pitaevskii L. P. Stringari S. Phys. Rev. A 88 2013 043630': 'http://dx.doi.org/10.1103/physreva.88.043630',
 'Hu H., Taylor E., Liu X.-J., Stringari S. Griffin A. New Journal of Physics 12 2010 043040': 'http://dx.doi.org/10.1088/1367-2630/12/4/043040',
 "Kashurnikov V. A., Prokof'ev N. V. Svistunov B. V. Phys. Rev. Lett. 87 2001 120402": 'http://dx.doi.org/10.1103/physrevlett.87.120402',
 'Ku M. J. H., Sommer A. T., Cheuk L. W. Zwierlein M. W. Science 335 2012 563': 'http://dx.doi.org/10.1126/science.1214987',
 'Landau L. D. J. Phys. USSR 11 1947 91': None,
 'Landau L. D. Lifshitz E. M. Fluid Mechanics, Second Edition: Volume 6 (Course of Theoretical Physics) 2nd Edition Course of theoretical physics / by L. D. Landau and E. M. Lifshitz, Vol. 6 (Butterworth-Heinemann) 1987': 'http://dx.doi.org/10.1016/b978-0-08-050347-9.50001-0',
 'Lee T. D. Yang C. N. Phys. Rev. 113 1959 1406': 'http://dx.doi.org/10.1103/physrev.113.1406',
 'Meppelink R., Koller S. B. van der Straten P. Phys. Rev. A 80 2009 043605': 'http://dx.doi.org/10.1103/physreva.80.043605',
 'Ozawa T. Stringari S. Phys. Rev. Lett. 112 2014 025302': 'http://dx.doi.org/10.1103/physrevlett.112.025302',
 'Peshkov V. P. J. Phys. USSR 8 1944 381': None,
 'Pitaevskii L. P. Stringari S. Bose-Einstein condensation (Clarendon Press, Oxford New York) 2003': 'http://dx.doi.org/10.1023/b:joss.0000028243.07395.b3',
 'Sidorenkov L. A., Tey M. K., Grimm R., Hou Y.-H., Pitaevskii L. Stringari S. Nature 498 2013 78 letter': 'http://dx.doi.org/10.1038/nature12136',
 'Taylor E., Hu H., Liu X.-J., Pitaevskii L. P., Griffin A. Stringari S. Phys. Rev. A 80 2009 053601': 'http://dx.doi.org/10.1103/physreva.80.053601'}
 ```

## License

All the codes in this repository (excepted the `opendetex` code which is not
from me) are under an MIT License. Feel free to reuse, fork, PR and contribute!


text:
# Sporidesmium subulatum var. subulatum VARIETY

#### Status
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycol. Pap. 36: 31 (1951)

#### Original name
Sporidesmium subulatum var. subulatum

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Ascomycota/Dothideomycetes/Repetophragma/Repetophragma subulatum/Sporidesmium subulatum subulatum/README.md

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: mdoering/backbone


text:
# Change log

## 1.0.0

### BREAKING CHANGES

- API now uses promises instead of callbacks.
- Initialisation code has been removed from the `ADAuth` constructor.
  If using the constructor, `.initialise()`, which returns a promise, must be called afterwards. Alternatively, you can use `await ADAuth.create(options)`.

### Added

- Automated testing, both unit and integration tests.

### Changed

- Project migrated to typescript.
- Package manager switched to yarn.

### Removed

- Admin client removed, as it is not used in the AD authentication flow. All operations against the server are performed using the user client.

### Fixed

- Errors from the server are now properly passed to the client.

## 0.1.4

### Fixed

- `objectGUID` attributes are now serialized correctly. Prior, they would be serialized into unusable strings, such as `{----------------}`.

## 0.1.3

### Added

- Support for loading CA certificates for AD off of the file system or a web server.

## 0.1.2

### Added

- `objectGUID` attributes on objects are now converted to a human-readable string format

## 0.1.1

### Fixed

- Unhandled case where `user.memberOf` may be a string object instead of an array, leading to an error when `memberOf.unshift` is attempted

## 0.1.0

First working version after being forked from node-ldapauth-fork

### Added

- New, required, configuration property `domainDn`, which points to the distinguished name of the domain root (e.g. `dc=corp,dc=example,dc=com`)
- `searchFilterByDN` configuration property, which defaults to
  `(&(objectCategory=user)(objectClass=user)(distinguishedName={{dn}}))`
- `searchFilterByUPN` configuration property, which defaults to
  `(&(objectCategory=user)(objectClass=user)(userPrincipalName={{upn}}))`
- `searchFilterBySAN` configuration property, which defaults to
  `(&(objectCategory=user)(objectClass=user)(samAccountName={{username}}))`
- Users can now be authenticated both by their user principal name, or UPN<EMAIL_ADDRESS>and down-level logon name (`EXAMPLE\user`)
- A user's `primaryGroupID` is now used to resolve the primary group object and prepend it to `memberOf` and `_groups`
- Group membership is now fetched recursively and represents all the groups a user is an _effective_ member of

### Removed

- `searchFilter` configuration property, which has has been split into `searchFilterByDN`, `searchFilterByUPN`, and `searchFilterBySAN`
- `cutarelease.py` build step, in favour of a manual release workflow. This may be reconsidered at a later time.

### Changed

- The authentication process now attempts to bind the user's credentials first. Subsequent LDAP queries use the client bound to the user's credentials
- Groups are now fetched by default instead of on-demand
- `searchBase` now defaults to the value of `domainDn` and isn't required to be explicitly set
- `groupSearchFilter` now defaults to `(&(objectCategory=group)(objectClass=group)(member={{dn}}))`
- Dependency versions now use caret (`^`), except for `ldapjs`, which refers to `master`, pending a future release

license: MIT

repository: adalinesimonian/node-adauth

branch_name: refs/heads/main

gha_language: TypeScript

gha_license_id: NOASSERTION

repo_name: adalinesimonian/node-adauth


text:
# Carrierwave::Attachmentscanner

[![Build Status](https://travis-ci.org/attachmentscanner/carrierwave-attachmentscanner.svg?branch=master)](https://travis-ci.org/attachmentscanner/carrierwave-attachmentscanner)

Carrierwave::Attachmentscanner allows you to scan any file uploaded by
[CarrierWave](https://github.com/carrierwaveuploader/carrierwave) for viruses or
other malicious content.

It works by sending the upload to [Attachment Scanner](http://www.attachmentscanner.com)
to be checked and then raising an error if the file matches a known database.

## Installation

Add `carrierwave-attachmentscanner` to your `Gemfile`

```ruby
gem 'carrierwave-attachmentscanner'
```

Download and install by running:

```bash
bundle
```

Initialize the scanner with your `cluster_url` and `api_token`
(If you don't already have these values head to
[Attachment Scanner](http://www.attachmentscanner.com) and sign up for an account):

### Adding to an Uploader

You can then include `CarrierWave::AttachmentScanner` in your uploaders:

```ruby
class YourUploader < CarrierWave::Uploader::Base
  include CarrierWave::AttachmentScanner
end
```

### Adding your credentials

```bash
bundle exec rails generate carrierwave_attachmentscanner:config [CLUSTER_URL] [API_TOKEN]
```

This will create `config/initializers/carrierwave_attachmentscanner.rb` with the
following content:

```ruby
CarrierWave::AttachmentScanner.configure do |config|
  config.url = "CLUSTER_URL"
  config.api_token = "API_TOKEN"
end
```

If you leave things blank we'll assume that you're going to set the config values
within ENV variables like the following:

```ruby
CarrierWave::AttachmentScanner.configure do |config|
  config.url = ENV['ATTACHMENT_SCANNER_URL']
  config.api_token = ENV['ATTACHMENT_SCANNER_API_TOKEN']
end
```

# Usage

Once installed `CarrierWave::AttachmentScanner` will call the endpoint with any
file a user attempts to call on your uploader.

It will raise a `CarrierWave::IntegrityError` whenever a malicious file is found,
by default this will then prevent the model from saving.

## Customising the response

There are two methods that can be used to compare the response from the
AttachmentScanner API and present an error message within CarrierWave.

The first method `blocked_scan_statuses` is used to compare the scan result with
a list of statuses.

```ruby
def blocked_scan_statuses
  %w(found)
end
```

The second can be overridden in order to use the response to alter the upload
message.

```ruby
# This can be overridden in order to change the message
def scan_error_message(result)
  "AttachmentScanner prevented this upload"
end
```

Finally if you need total control you can override the `scan_result_allowed?`
method completely.

# Development / Contributing

Pull requests are welcome. There is an RSpec suite at `/spec`. Please ensure that
tests pass before submitting a pull request.

Thank you for making `CarrierWave::AttachmentScanner` better.

gha_language: Ruby


text:
# Certificate generation (refer to this document when ssl is enabled)

##Generation steps
The meaning of each parameter:
  * -genkeypair generates a key
  * -keyalg specifies the key algorithm, then specify RSA,
  * -keysize specifies the key length. The default is 1024 bits. Specify 2048 here, longer, I can't crack it (haha...),
  * -siglag specifies the digital signature algorithm, specified here as the SHA1withRSA algorithm
  * -validity specifies the validity period of the certificate. Here is 36500 days, which is 100 years. I think my application will not take so long.
  * -alias specifies the alias, here is cas.server.com
  * -keystore specifies the keystore storage location, where there is a d drive
  * -dname specifies the user information, no need to answer its question one by one;

Note: CN=domain name, we use `passport.sso.com`
1.
```cmd
Keytool -genkeypair -keyalg RSA -keysize 2048 -sigalg SHA1withRSA -validity 36500 -alias passport.sso.com -keystore d:/tomcat.keystore -dname "CN=passport.sso.com,OU=sunrizetech,O=esaleb,L =GuangZhou,ST=GuangDong,C=CN"
# Enter the above command, the following password we enter 123456, and then press Enter, the tomcat.keystore file is generated on the d drive;
```

2. Export digital certificate
  Enter the following command under cmd:
```cmd
Keytool -exportcert -alias passport.sso.com -keystore d:/tomcat.keystore -file d:/tomcat.cer -rfc
```

3. Import the server's certificate tomcat.cer into the cacerts certificate store of the client java.
Cmd to `${JAVA_HOME}jre\lib\security`

Run the following command:
```cmd
Keytool -import -alias passport.sso.com -keystore %JAVA_HOME%\jre\lib\security\cacerts -file d:/tomcat.cer -trustcacerts
#密码为changeit
```

4. Check if the import is successful
```cmd
Keytool -list -keystore "%JAVA_HOME%\jre\lib\security\cacerts" | findstr/i server
```
```bash
keytool -list -keystore "$JAVA_HOME\jre\lib\security\cacerts" | grep server
```

Something outputs represent success

repository: mcdir/sso

repo_name: mcdir/sso


text:
# [ISS-232] Using Master Branches with Older Swifts

[XML Source](../xml/ISS-232.xml)

So far, I've encountered 3 different dependencies for PerfectTemplate which no longer work with the Swift 2016-06-20 that's present in our most up-to-date deployment options.  How do we ensure that the documentation leads developers to get a version of the PerfectTemplate project that pulls in dependencies whose versions are compatible with Swift 2016-06-20?

Status|Resolution|Reporter|Assignee
------|----------|--------|--------
Closed|Done|[Shao](Synthetel)|[Jonathan Guthrie]($jono)

Created|Wed, 27 Jul 2016 19:33:30 -0400
-------|--------------
Updated|Mon, 29 Aug 2016 22:31:52 -0400
Resolved|Mon, 29 Aug 2016 22:31:52 -0400

## Comments

### Wed, 27 Jul 2016 19:44:32 -0400 / jono

Hi Shao,

Linked this to ISS-231 as it's the same thing. The snapshots just got updated.

The 27th is the date where Swift 3.0 is "breaking code frozen" so we should start to see a decrease in the mess that these changes are creating.

– Jonathan Guthrie

repository: adam-roth/Archived-Perfect-Issues

repo_name: adam-roth/Archived-Perfect-Issues


text:
---
title: Patient and Consumer Health
linktitle: Patient and Consumer Health
toc: true
type: docs
date: 2022-05-27
draft: false
menu:
  covid-19:
    #parent: Topics
    weight: 40

# Prev/next pager order (if `docs_section_pager` enabled in `params.toml`)
weight: 40
---

## Consumer Health Resources

* [COVID-19 Spanish Language Resources](https://docs.google.com/document/d/18TNTjiY-iUW4mxYCt5RZnkd2H15TZHPXARyEGN9_H-c/edit)
* [EPA Disinfectant List](https://www.epa.gov/pesticide-registration/list-n-disinfectants-use-against-sars-cov-2)
* [Johns Hopkins Bloomberg School of Public Health Expert Reality Check](https://www.globalhealthnow.org/2020-02/coronavirus-expert-reality-check)
* [Johns Hopkins Health Library](https://www.hopkinsmedicine.org/health/)
* [MedlinePlus Coronavirus Infections](https://medlineplus.gov/coronavirusinfections.html)
* [National Insitutes of Health: Health Information](https://www.nih.gov/health-information)
* [Operational Toolkit for Businesses Reopening or Expanding Operations in COVID-19](https://www.centerforhealthsecurity.org/our-work/publications/operational-toolkit-for-businesses-considering-reopening-or-expanding-operations-in-covid-19)


text:
# RealTimeBusTracker

## :white_medium_square: Description
### Week 9 Final Exercise
### This exercise called Real Time Bus Tracker shows all the bus stops between the MIT campus and the Harvard campus. By solving this exercise we practiced on the DOM manipulation along with the animation of Maps.

## :white_medium_square: How to run
### Once you load the page on your browser, click on the "Show Bus Stops" button. And then you will see how the pin marked starts moving showing the bus stops.

## :white_medium_square: Roadmap of future improvements
### This exercise has many ways to e improved, the first one that comes to my mind is adding the information of the time that takes from one stop to the next one.

## :white_medium_square: LICENSE INFORMATION

### MIT License

### Copyright (c) 2021 pabsanchez

### Permission is hereby granted, free of charge, to any person obtaining a copy
### of this software and associated documentation files (the "Software"), to deal
### in the Software without restriction, including without limitation the rights
### to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
### copies of the Software, and to permit persons to whom the Software is
### furnished to do so, subject to the following conditions:

### The above copyright notice and this permission notice shall be included in all
### copies or substantial portions of the Software.

 IN NO EVENT SHALL THE
### AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
### LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
### OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
### SOFTWARE.

repository: pabsanchez/RealTimeBusTracker

repo_name: pabsanchez/RealTimeBusTracker


text:
# ClipperCard Parser
Unofficial Node.js library to retrieve and parse profile and activity data from the Bay Area's Clipper Card system.

  [![Build Status][travis-image]][travis-url]
  [![Node Version][node-image]][node-url]
  [![NPM Version][npm-image]][npm-url]
  [![NPM Downloads][downloads-image]][downloads-url]

#Usage

This library works by emulating a user logging on through the [ClipperCard](https://www.clippercard.com/ClipperWeb/index.do) website. The library attempts to be as polite as possible when dealing with the website - minimizing the traffic and being respectful of the site. Regardless, please familiarize yourself with their Terms of Use before using this library so you can ensure that you are using this in accordance with their policies.

The default User-Agent string for this library identifies itself as this Node.js module, so the site administrators can easily identify the traffic if necessary. The goal of this library is *not* to misuse the site, but merely to provide easy access to the data within. If and when there is a ClipperCard API available, I will switch this library over to that.

Your use of this library is entirely at your own risk.

#Installation

To get started, simply install the module using npm:

    npm install node-clippercard

and then `require` it:

    var ClipperAccount = require('node-clippercard');

or using ES6 imports:

    import ClipperAccount from 'node-clippercard'

#Classes

This library exposes classes called `ClipperAccount` and `ClipperStatement`.

##ClipperAccount

This is intended to be the primary access point for the library. It provides the `login()` capability needed to access the account.

###new ClipperAccount(options)

* options `Object` An options object containing at least `email` and `password`

Creates a new `ClipperAccount` instance ready to log in to an account.

    let clipperAccount = new ClipperAccount({email<EMAIL_ADDRESS>password: "test");

###ClipperAccount.login(callback, forceRefresh=false)

###ClipperAccount.getProfile(callback, forceRefresh=false)

##ClipperStatement

[travis-image]: https://travis-ci.org/abstractvector/node-clippercard.svg?branch=master
[travis-url]: https://travis-ci.org/abstractvector/node-clippercard
[node-image]: https://img.shields.io/node/v/node-clippercard.svg
[node-url]: https://npmjs.org/package/node-clippercard
[npm-image]: https://img.shields.io/npm/v/node-clippercard.svg
[npm-url]: https://npmjs.org/package/node-clippercard
[downloads-image]: https://img.shields.io/npm/dt/node-clippercard.svg
[downloads-url]: https://npmjs.org/package/node-clippercard

repository: abstractvector/node-clippercard

repo_name: abstractvector/node-clippercard


text:
---
id: Monoid
title: Module Monoid
---

[← Index](.)

[Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts)

# Monoid

**Signature** (type class) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L26-L28)

```ts
export interface Monoid<A> extends Semigroup<A> {
  readonly empty: A
}
```

Added in v1.0.0

## monoidAll

Boolean monoid under conjunction

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L61-L64)

```ts
export const monoidAll: Monoid<boolean> = ...
```

Added in v1.0.0

## monoidAny

Boolean monoid under disjunction

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L70-L73)

```ts
export const monoidAny: Monoid<boolean> = ...
```

Added in v1.0.0

## monoidProduct

Number monoid under multiplication

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L130-L133)

```ts
export const monoidProduct: Monoid<number> = ...
```

Added in v1.0.0

## monoidString

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L138-L141)

```ts
export const monoidString: Monoid<string> = ...
```

Added in v1.0.0

## monoidSum

Number monoid under addition

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L121-L124)

```ts
export const monoidSum: Monoid<number> = ...
```

Added in v1.0.0

## monoidVoid

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L146-L149)

```ts
export const monoidVoid: Monoid<void> = ...
```

Added in v1.0.0

## unsafeMonoidArray

**Signature** (constant) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L80-L83)

```ts
export const unsafeMonoidArray: Monoid<Array<any>> = ...
```

Added in v1.0.0

## fold

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L33-L35)

```ts
export const fold = <A>(M: Monoid<A>): ((as: Array<A>) => A) => { ... }
```

Added in v1.0.0

## getArrayMonoid

Monoid under array concatenation (`Array<any>`)

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L90-L92)

```ts
export const getArrayMonoid = <A = never>(): Monoid<Array<A>> => { ... }
```

Added in v1.0.0

## getDictionaryMonoid

Gets [Monoid](./Monoid.md) instance for dictionaries given [Semigroup](./Semigroup.md) instance for their values

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L110-L115)

```ts
export function getDictionaryMonoid<A>(S: Semigroup<A>): Monoid< { ... }
```

**Example**

```ts
import { getDictionaryMonoid, fold } from 'fp-ts/lib/Monoid'
import { semigroupSum } from 'fp-ts/lib/Semigroup'

const M = getDictionaryMonoid(semigroupSum)
assert.deepStrictEqual(fold(M)([{ foo: 123 }, { foo: 456 }]), { foo: 579 })
```

Added in v1.4.0

## getDualMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L50-L55)

```ts
export const getDualMonoid = <A>(M: Monoid<A>): Monoid<A> => { ... }
```

Added in v1.0.0

## getEndomorphismMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L164-L169)

```ts
export const getEndomorphismMonoid = <A = never>(): Monoid<Endomorphism<A>> => { ... }
```

Added in v1.0.0

## getFunctionMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L154-L159)

```ts
export const getFunctionMonoid = <M>(M: Monoid<M>) => <A = never>(): Monoid<(a: A) => M> => { ... }
```

Added in v1.0.0

## getJoinMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L201-L206)

```ts
export const getJoinMonoid = <A>(B: Bounded<A>): Monoid<A> => { ... }
```

Added in v1.9.0

## getMeetMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L191-L196)

```ts
export const getMeetMonoid = <A>(B: Bounded<A>): Monoid<A> => { ... }
```

Added in v1.9.0

## getProductMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L40-L45)

```ts
export const getProductMonoid = <A, B>(MA: Monoid<A>, MB: Monoid<B>): Monoid<[A, B]> => { ... }
```

Added in v1.0.0

## getRecordMonoid

**Signature** (function) [Source](https://github.com/gcanti/fp-ts/blob/master/src/Monoid.ts#L174-L186)

```ts
export const getRecordMonoid = <O extends { [key: string]: any }>(
  monoids: { [K in keyof O]: Monoid<O[K]> }
): Monoid<O> => { ... }
```

Added in v1.0.0

repository: yusangeng/fp-ts

repo_name: yusangeng/fp-ts


text:
echo
====

echo is a node.js service to simply echo query params back as JSON. It's being used to simulate an API endpoint for trial-testing API load testing services and solutions, as well as pre-integrating them into Jenkins, etc.

Use:
```
> node index.js
```

Open http://localhost:8888/api?k1=v1&k2=v2&k3=v3 in your browser

You should see the following response page:
```
  {
    "k1": "v1",
    "k2": "v2",
    "k3": "v3"
  }
```

For extra validation the content-type of the response should be text/json, if you'd like to double-check that everything works exactly as you'd expect an API to work.

repository: dm-ptp/echo

repo_name: dm-ptp/echo


text:
# RequireJS API

* [Usage](#usage)
    * [Loading JavaScript Files](#jsfiles)
    * [Defining a Module](#define)
        * [Simple Name/Value Pairs](#defsimple)
        * [Definition Functions](#deffunc)
        * [Definition Functions with Dependencies](#defdep)
        * [Defining a Module as a Function](#funcmodule)
        * [Other Module Notes](#modulenotes)
        * [Circular Dependencies](#circular)
    * [Define an I18N Bundle](#i18n)
    * [Specify a Text File Dependency](#text)
    * [Specify a JSONP Service Dependency](#jsonp)
    * [Load Scripts in a Specific Order](#order)
* [Mechanics](#mechanics)
* [Configuration Options](#config)
* [Page Load Event Support](#pageload)
* [Advanced Usage](#advanced)
    * [Loading Modules from Packages](#packages)
    * [Multiversion Support](#multiversion)
    * [Loading Code After Page Load](#afterload)
    * [Module Modifiers](#modifiers)
        * [Modifier Registration](#modregister)
        * [Modifier Definition](#moddef)
    * [Web Worker Support](#webworker)
    * [Rhino Support](#rhino)

# Usage

There are 5 basic ways to use require.js:

1. Loading JavaScript files.
2. Define a module that has other dependencies.
3. Define an internationalization (i18n) bundle.
4. Specify a text file dependency.
4. Specify a JSONP service dependency.

## Loading JavaScript Files

If you just want to load some JavaScript files, do the following inside the HEAD tag in an HTML document:

The dependencies above, ["a.js", "b.js", "some/module"], will be loaded via scripts tags that have the following src values:

* a.js (in the same directory as the HTML page that has the above HTML snippet)
* b.js (in the same directory as the HTML page that has the above HTML snippet)
* scripts/some/module.js

Files that end in ".js" are assumed to just be plain JS files that do not use require.js's module syntax, and therefore do not use the module-to-path algorithm used for looking up dot-notation modules, like "some/module" above.

See the **Configuration Options** section for information on changing the lookup paths used for dependencies.

While you can use require() inside a script tag in an HTML file, it is strongly encouraged to place the work in a file that is loaded by RequireJS. This allows for easier optimization via the optimization tool, and there is a shorthand that can be used in the HTML for this pattern. The above example would be structured like this:

The data-main attribute tells RequireJS will take the value of the data-main attribute and treat it like a require([]) call. So, in this case, it would load scripts/main.js, and that file should have the top-level require call:

    //Inside scripts/main.js
    require(["a.js", "b.js", "some/module"], function() {
        //...
    });

## Defining a Module

A module is different from a traditional script file in that it defines a well-scoped object that does not try to pollute the global namespace. It can explicitly list its dependencies and get a handle on those dependencies without needing to refer to global objects, but instead receive the dependencies as arguments to the function that defines the module. Modules in RequireJS are an extension of the [Module Pattern](http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth), with the benefit of not needing globals to refer to other modules.

The RequireJS syntax for modules allows them to be loaded as fast as possible, even out of order, but evaluated in the correct dependency order, and since global variables are not created, it makes it possible to [load multiple versions of a module in a page](#multiversion).

(If you are familiar with or are using CommonJS modules, then please also see [CommonJS Notes](commonjs.md) for information on how the RequirejS module format maps to CommonJS modules).

There should only be **one** module definition per file on disk. The modules can be grouped into optimized bundles by the [optimization tool](optimization.md).

**NOTE**: As of RequireJS 0.14.3, the function **define()** is preferred to create modules. Previously it was **require.def()**. require.def is still available, but define() is encouraged in the interests of conforming to the [Asynchronous Module Proposal](http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition). You are free to continue require.def() if you only want RequireJS to load the modules, but if you want your code to be potentially interoperable with other Async Module script loaders, you should consider using define(). Any API examples that use define() will work the same if require.def() is used instead.

### Simple Name/Value Pairs

If the module does not have any dependencies, and it is just a collection of name/value pairs, then just pass an object literal to define():

    //Inside file my/shirt.js:
    define({
        color: "black",
        size: "unisize"
    });

### Definition Functions

If the module does not have dependencies, but needs to use a function to do some setup work, then define itself, pass a function to define():

    //my/shirt.js now does setup work
    //before returning its module definition.
    define(function () {
        //Do setup work here

        return {
            color: "black",
            size: "unisize"
        }
    );

### Definition Functions with Dependencies

If the module has dependencies, then specify the dependencies as an array for the first argument and then pass a definition function as the second argument. The function will be called to define the module once all dependencies have loaded. The function should return an object that defines the module. The dependencies will be passed to the definition function as function arguments, listed in the same order as the order in the dependency array:

    //my/shirt.js now has some dependencies, a cart and inventory
    //module in the same directory as shirt.js
    define(["./cart", "./inventory"], function(cart, inventory) {
            //return an object to define the "my/shirt" module.
            return {
                color: "blue",
                size: "large"
                addToCart: function() {
                    inventory.decrement(this);
                    cart.add(this);
                }
            }
        }
    );

In this example, a my/shirt module is created. It depends on my/cart and my/inventory. On disk, the files are structured like this:

* my/cart.js
* my/inventory.js
* my/shirt.js

The function call above specifies two arguments, "cart" and "inventory". These are the modules represented by the "./cart" and "./inventory" module names.

The function is not called until the my/cart and my/inventory modules have been loaded, and the function receives the modules as the "cart" and "inventory" arguments.

Modules that define globals are explicitly discouraged, so that multiple versions of a module can exist in a page at a time (see **Advanced Usage**). Also, the order of the function arguments should match the order of the dependencies.

The return object from the function call defines the "my/shirt" module. Be defining modules in this way, "my/shirt" does not exist as a global object.

### Defining a Module as a Function

If the modules do not have to return objects. Any valid return value from a function is allowed. Here is a module that returns a function as its module definition:

    //A module definition inside foo/title.js. It uses
    //my/cart and my/inventory modules from before,
    //but since foo/bar.js is in a different directory than
    //the "my" modules, it uses the "my" in the module dependency
    //name to find them. The "my" part of the name can be mapped
    //to any directory, but by default, it is assumed to be a sibling
    //to the "foo" directory.
    define(["my/cart", "my/inventory"],
        function(cart, inventory) {
            //return a function to define "foo/title". It gets or sets
            //the window title.
            return function(title) {
                return title ? (window.title = title) : inventory.storeName + ' ' + cart.name;
            }
        }
    );

### Defining a Module with a Name

You may encounter some define() calls that include a name for the module as the first argument to define():

        //Excplicitly defines the "foo/title" module:
        define("foo/title",
            ["my/cart", "my/inventory"],
            function(cart, inventory) {
                //Define foo/title object in here.
           }
        );

These are normally generated by the [optimization tool](optimization.md). You can explicitly name modules yourself, but it makes the modules less portable -- if you move the file to another directory you will need to change the name. It is normally best to avoid coding in a name for the module and just let the optimization tool burn in the module names. The optimization tool needs to add the names so that more than one module can be bundled in a file, to allow for faster loading in the browser.

### Other Module Notes

Only one module should be defined per JavaScript file, given the nature of the module name-to-file-path lookup algorithm. Multiple modules will be grouped into optimized files by the [optimization tool](optimization.md), but you should only use the optimization tool to place more than one module in a file.

If you need to work with a module you already loaded via a require(["module/name"], function(){}) call in the JavaScript console, then you can use  the require() form that just uses the string name of the module to fetch it:

    require("module/name").callSomeFunction()

Note this only works if "module/name" was previously loaded via the async version of require: require(["module/name"]).

### Circular Dependencies

If you define a circular dependency (A needs B and B needs A), then in this case when B's module function is called, it will get an undefined value for A. B can fetch A later after modules have been defined by using the require() method (be sure to specify require as a dependency so the right context is used to look up A):

    //Inside B.js:
    define(["require", "A"],
        function(require, a) {
            //"a" in this case will be null if A also asked for B,
            //a circular dependency.
            return function(title) {
                return require("A").doSomething();
            }
        }
    );

Normally you should not need to use require() to fetch a module, but instead rely on the module being passed in to the function as an argument. Circular dependencies are rare, and usually a sign that you might want to rethink the design. However, sometimes they are needed, and in that case, use require() as specified above.

If you are familiar with CommonJS modules, you could instead declare **exports** as a dependency to create an empty object for the module. By doing this on both sides of a circular dependency, you can then safely hold on to the the other module via a function argument.

## Define an I18N Bundle

Once your web app gets to a certain size and popularity, localizing the strings in the interface and providing other locale-specific information becomes more useful. However, it can be cumbersome to work out a scheme that scales well for supporting multiple locales.

require.js allows you to set up a basic module that has localized information without forcing you to provide all locale-specific information up front. It can be added over time, and only strings/values that change between locales can be defined in the locale-specific file.

i18n bundle support is provided by the require/i18n.js plugin. It is automatically loaded when a module or dependency specifies the i18n! prefix (more info below).

To define a bundle, put it in a directory called "nls" -- the i18n! plugin assumes a module name with "nls" in it indicates an i18n bundle. The "nls" marker in the name tells the i18n plugin where to expect the locale directories (they should be immediate children of the nls directory). If you wanted to provide a bundle of color names in your "my" set of modules, create the directory structure like so:

* my/nls/colors.js

The contents of that file should look like so:

    //my/nls/colors.js contents:
    define({
        "root": {
            "red": "red",
            "blue": "blue",
            "green": "green"
        }
    });

An object literal with a property of "root" defines this module. That is all you have to do to set the stage for later localization (l10n) work.

You can then use the above module in another module, say, in a my/lamps.js file:

    //Contents of my/lamps.js
    define(["i18n!my/nls/colors"], function(colors) {
        return {
            testMessage: "The name for red in this locale is: " + colors.red
        }
    });

The my/lamps module has one property called "testMessage" that uses colors.red to show the localized value for the color red.

Later, when you want to add a specific translation to a file, say for the fr-fr locale, change my/nls/colors to look like so:

    //Contents of my/nls/colors.js
    define({
        "root": {
            "red": "red",
            "blue": "blue",
            "green": "green"
        },
        "fr-fr": true
    });

Then define a file at my/nls/fr-fr/colors.js that has the following contents:

    //Contents of my/nls/fr-fr/colors.js
    define({
        "red": "rouge",
        "blue": "bleu",
        "green": "vert"
    });

require.js will use browser's navigator.language or navigator.userLanguage property to determine what locale values to use for my/nls/colors, your app does not have to change. If you prefer to set the locale, you can use the locale: configuration parameter to require.js (see the **Configuration options** section).

require.js is also smart enough to pick the right locale bundle, the one that most closely matches the ones provided by my/nls/colors. For instance, if the locale is "en-us", then the "root" bundle will be used. If the locale is "fr-fr-paris" then the "fr-fr" bundle will be used.

require.js also combines bundles together, so for instance, if the french bundle was defined like so (omitting a value for red):

    //Contents of my/nls/fr-fr/colors.js
    define({
        "blue": "bleu",
        "green": "vert"
    });

Then the value for red in "root" will be used. This works for all locale pieces. If all the bundles listed below were defined, then require.js will use the values in the following priority order (the one at the top takes the most precedence):

* my/nls/fr-fr-paris/colors.js
* my/nls/fr-fr/colors.js
* my/nls/fr/colors.js
* my/nls/colors.js

If you prefer to not include the root bundle in the top level module, you can define it like a normal locale bundle. In that case, the top level module would look like:

    //my/nls/colors.js contents:
    define({
        "root": true,
        "fr-fr": true,
        "fr-fr-paris": true
    });

and the root bundle would look like:

    //Contents of my/nls/root/colors.js
    define({
        "red": "red",
        "blue": "blue",
        "green": "green"
    });

## Specify a Text File Dependency

It is nice to build HTML using regular HTML tags, instead of building up DOM structures in script. However, there is no good way to embed HTML in a JavaScript file. The best that can be done is using a string of HTML, but that can be hard to manage, particularly for multi-line HTML.

require.js has a plugin, require/text.js, that can help with this issue. It will automatically be loaded if the text! prefix is used for a dependency.

You can specify a text file resource as a dependency like so:

    require(["some/module", "text!some/module.html", "text!some/module.css"],
        function(module, html, css) {
            //the html variable will be the text of the some/module.html file
            //the css variable will be the text of the som/module.css file.
        }
    );

Notice the .html and .css suffixes to specify the extension of the file. The "some/module" part of the path will be resolved according to normal module name resolution: it will use the **baseUrl** and **paths** [configuration options](#config) to map that name to a path.

For HTML/XML/SVG files, there is another option you can pass !strip, which strips XML declarations so that external SVG and XML documents can be added to a document without worry. Also, if the string is an HTML document, only the part inside the body tag is returned. Example:

    require(["text!some/module.html!strip"],
        function(html) {
            //the html variable will be the text of the some/module.html file,
            //but only the part inside the body tag.
        }
    );

The text files are loaded via asynchronous XMLHttpRequest (XHR) calls, so you can only fetch files from the same domain as the web page.

However, the build system for require.js will inline any text! references with the actual text file contents into the modules, so after a build, the modules that have text! dependencies can be used from other domains.

## Specify a JSONP Service Dependency

[JSONP](http://en.wikipedia.org/wiki/JSON#JSONP) is a way of calling some services in JavaScript. It works across domains and it is an established approach to calling services that just require an HTTP GET via a script tag.

To use a JSONP service in RequireJS, specify "define" as the callback parameter's value. This means you can get the value of a JSONP URL as if it was a module definition.

Here is an example that calls a twitter API endpoint. In this example, the JSONP callback parameter is called "callback", so "callback=define" tells the API to wrap the JSON response in a "define()" wrapper:

    require(["http://search.twitter.com/trends/current.json?callback=define"],
        function (trends) {
            //The trends object will be the API response for the
            //Twitter trends/current API
            console.log(trends);
        }
    );

This use of JSONP should be limited to JSONP services for initial application setup. If the JSONP service times out, it means other modules you define via define() may not get executed, so the error handling is not robust.

This functionality should not be used for long-polling JSONP connections -- APIs that deal with real time streaming. Those kinds of APIs should do more script cleanup after receiving each response, and RequireJS will only fetch a JSONP URL once -- subsequent uses of the same URL as a dependency in a require() or define() call will get a cached value.

Errors in loading a JSONP service are normally surfaced via timeouts for the service, since script tag loading does not give much detail into network problems. To detect errors, you can override require.onError() to get errors. The error object passed to the onerror function will contain two properties if it is a timeout issue:

* **requireType**: value will be "timeout"
* **requireModules**: an array of module names/URLs that timed out. You can find the JSONP service URL in here.

Note however that if you get this type of error it probably means other modules you defined via define() did not get executed, and the scripts you want to use may not be available.

## Load Scripts in a Specific Order

Normally RequireJS loads and evaluates scripts in an undetermined order. However, there are some traditional scripts that depend on being loaded in a specific order. For those cases you can use the **order** plugin:

    require(["order!one.js", "order!two.js", "order!three.js"], function () {
        //This callback is called after the three scripts finish loading.
    });

Scripts loaded by the **order** plugin will be fetched asynchronously, but evaluated in the order they are passed to require, so it should still perform better with using script tags in the head of an HTML document.

The **order** plugin is best used with traditional scripts, it is not needed for scripts that use define() to define modules. It is possible to mix and match "order!" dependencies with regular dependencies, but only the "order!" ones will be evaluated in relative order to each other.

**Note**: the order! plugin only works with JavaScript files that are cacheable by the browser. If the JS file has headers that do not allow the browser to cache the file, then the order of scripts will not be maintained.

# Mechanics

require.js loads each dependency as a script tag, using head.appendChild().

require.js waits for all dependencies to load, figures out the right order in which to call the functions that define the modules, then calls the module definition functions in the right order.

Using require.js in a server-side JavaScript enviroment that has synchronous loading should be as easy as redefining require.load(). The build system does this, the require.load method for that environment can be found in build/jslib/requirePatch.js.

In the future, this code may be pulled into the require/ directory as an optional module that you can load in your env to get the right load behavior based on the host environment.

# Configuration Options

When using require() in the top-level HTML page (or top-level script file that does not define a module), a configuration object can be passed as the first option:

Also, you can define require to be an object **before** require.js is loaded, and have the values applied. This is example specifies some dependencies to load as soon as require.js defines require() and registers a require.ready() callback to register after require.js defines require.ready():

Supported configuration options:

**baseUrl**: the root path to use for all module lookups. So in the above example, "my/module"'s script tag will have a src="/another/path/my/module.js". baseUrl is **not** used when loading plain .js files, those strings are used as-is, so a.js and b.js will be loaded from the same directory as the HTML page that contains the above snippet.

If no baseUrl is passed in, the path to require.js is used as the baseUrl path. The baseUrl can be an URL on a different domain as the page that will load require.js. RequireJS script loading works across domains. The only restriction is on text content loaded by text! plugins: those paths should be on the same domain as the page, at least during development. The optimization tool will inline text! plugin resources so after using the optimization tool, you can use resources that reference text! plugin resources from another domain.

**baseUrlMatch**: If no baseUrl is specified, normally the path to require.js is used. However, if you build RequireJS into another file with a name that does not have "require.js" in it, then the autodetection of the baseUrl will fail. In that case you can set baseUrlMatch to match the name of the file you built. The value should be a Regular expression. For example:

    baseUrlMatch: /mycustomlib\.js/i

**paths**: allows configuration of some modules paths. Assumed to be relative to baseUrl. So for "some/module"'s script tag will have a src="/another/path/some/v1.0/module.js". The path that is used for a module name should **not** include the .js extension, since the path mapping could be for a directory. The path mapping code will automatically add the .js extension when mapping the module name to a path.

**packagePaths**: configures module name prefixes to map to CommonJS packages. See the [packages topic](#packages) for more information. Related to **packages** config option.

**packages**: configures loading modules from CommonJS packages. See the [packages topic](#packages) for more information. Related to **packagePaths** config option.

**waitSeconds**: The number of seconds to wait before giving up on loading a script. The default is 7 seconds.

**locale**: The locale to use for loading i18n bundles. By default navigator.language or navigator.userLanguage will be used. The proper syntax for specifying a locale is using lowercase and separating values by dashes, for instance: "fr-fr-paris" or "en-us".

**context**: A name to give to a loading context. This allows require.js to load multiple versions of modules in a page, as long as each top-level require call specifies a unique context string. See **Advanced Features** below.

**deps**: An array of dependencies to load. Useful when require is defined as a config object before require.js is loaded, and you want to specify dependencies to load as soon as require() is defined.

**callback**: An function to pass to require that should be require after **deps** have been loaded. Useful when require is defined as a config object before require.js is loaded, and you want to specify a function to require after the configuration's **deps** array have been loaded.

**ready**: An function to pass to require.ready(). Useful when require is defined as a config object before require.js is loaded, and you want to specify a require.ready callback to set as soon as require() is defined.

**priority**: An array of module/file names to load immediately, before tracing down any other dependencies. This allows you to set up a small set of files that are downloaded in parallel that contain most of the modules and their dependencies already built in. More information is in the [Optimization FAQ, Priority Downloads](faq-optimization#priority).

**urlArgs**: Extra querystring arguments appended to URLs that RequireJS uses to fetch resources. Most useful to cache bust when the browser or server is not configured correctly. Example cache bust setting for urlArgs:

    urlArgs: "bust=" +  (new Date()).getTime()

During development it can be useful to use this, however **be sure** to remove it before deploying your code.

# Page Load Event Support

require.js also has a method for notifying your code when the page has loaded. require.js uses the DOMContentLoaded event for browsers that support it, or window onload for browsers that do not.

The syntax:

    require.ready(function() {
      //DOM is ready, DOM nodes can be manipulated now.
    });

To use it in conjunction with module loading:

    require(["module/one", "module/two"],
        function(one, two) {
          require.ready(function() {
            one.modifyTheDom();
          });
        }
    );

# Advanced Usage

## Loading Modules from Packages

RequireJS supports loading modules that are in a [CommonJS Packages](http://wiki.commonjs.org/wiki/Packages/1.1) directory structure, but some additional configuration needs to be specified for it to work. Specifically, there is support for the following CommonJS Packages features:

* A package can be associated with a module name/prefix.
* The package config can specify the following properties for a specific package:
    * **name**: The name of the package (used for the module name/prefix mapping)
    * **location**: The location on disk. Locations are relative to the baseUrl configuration value, unless they contain a protocol or start with a front slash (/).
    * **lib**: The name of the directory inside the package folder that contains modules. The default value is "lib", so no need to specify it unless it is different than the default.
    * **main**: The name of the module inside the lib directory that should be used when someone does a require for "packageName". The default value is "main", so only specify it if it differs from the default.

**IMPORTANT NOTES**

* While the packages can have the CommonJS directory layout, the modules themselves should be in a module format that RequireJS can understand. Exception to the rule: if you are using the r.js Node adapter, the modules can be in the traditional CommonJS module format. You can use the [CommonJS converter tool](commonjs.md#autoconversion) if you need to convert traditional CommonJS modules into an async module format that RequireJS uses.
* Only one version of a package can be used in a project context at a time. You can use RequireJS [multiversion support](#multiversion) to load two different module contexts, but if you want to use Package A and B in one context and they depend on different versions of Package C, then that will be a problem. This may change in the future.

If you use a similar project layout as specified in the [Start Guide](start.md), the start of your web project would look something like this (Node/Rhino-based projects are similar, just use the contents of the **scripts** directory as the top-level project directory):

* project-directory/
    * project.html
    * scripts/
        * require.js

There are two types of packages you may use in your project -- packages made by other people (third-party packages), and packages that you make as part of your project (source packages). It is suggested that you use two different directories inside scripts to keep track of them. For third-party packages, a **.packages** is recommended, where source packages can just be directories that are siblings to require.js. The third-party packages likely do not need to be committed to your source control, so you can put .packages in your source control's ignore file (.gitignore, .hgignore, etc...).

However, you will want to remember what third-party packages you are using, and where you got them. For that reason, it is suggested that you construct a **package.json** file in the **scripts** directory and use a [**mappings**](http://wiki.commonjs.org/wiki/Packages/Mappings) section in the package.json file to remember the locations.

Here is how the example directory layout looks with two third-party packages, **alpha** and **omega**, and has two source packages, **cart** and **store**:

* project-directory/
    * project.html
    * scripts/
        * .gitignore (ignores .packages)
        * .packages/
            * alpha/
                * lib/
                    * main.js
            * omega/
                * lib/
                    * main.js
        * cart/
            * lib/
                * main.js
        * store/
            * lib/
                * main.js
                * util.js
        * main.js
        * package.json
        * require.js

The **package.json** for the project might be as simple as this, just to track where alpha and omega came from, since they are not committed to source control:

    {
        "mappings": {
            "alpha": "http://example.com/packages/alpha/0.4.zip",
            "omega": "http://example.com/pacakges/omega/1.0.zip"
        }
    }

**project.html** will have a script tag like this:

This will instruct require.js to load scripts/main.js. **main.js** uses the **packagePaths** config option to set up the location of the the third party packages, where "packages" is used to set up packages that are relative to require.js, which in this case are the source packages "cart" and "store":

    //main.js contents
    //Pass a config object to require
    require({
        packagePaths: {
            ".packages": ["alpha", "omega"]
        },
        "packages": ["cart", "store"]
    });

    require(["alpha", "omega", "cart", "store", "store/util"],
    function (alpha,   omega,   cart,   store,   util) {
        //use the modules as usual.
    });

A require of "alpha" means that it will be loaded from **scripts/.packages/alpha/lib/main.js**, since "lib" and "main" are the default lib directory and main module settings supported by RequireJS. A require of "store/util" will be loaded from **scripts/store/lib/util.js**.

If the "alpha" and "store" packages did not follow the "lib" and "main.js" conventions, and looked more like this:

* project-directory/
    * project.html
    * scripts/
        * .gitignore (ignores .packages)
        * .packages/
            * alpha/
                * scripts/
                    * index.js
            * omega/
                * lib/
                    * main.js
        * cart/
            * lib/
                * main.js
        * store/
            * store.js
            * util.js
        * main.js
        * package.json
        * require.js

Then the RequireJS configuration would look like so:

    require({
        packagePaths: {
            ".packages": [
                {
                    name: "alpha",
                    lib: "scripts",
                    main: "index"
                },
                "omega"
            ]
        },
        "packages": [
            "cart",
            {
                name: "store",
                lib: ".",
                main: "store"
            }
        ]
    });

**packagePaths** is just a convenience for listing several packages that are not direct siblings of require.js, but still have a common directory parent. The above configuration could be written like so with just the **packages** config option, by using the **location** property for each third-party package:

    require({
        "packages": [
            {
                name: "alpha",
                location: ".packages/alpha",
                lib: "scripts",
                main: "index"
            },
            {
                name: "omega",
                location: ".packages/omega"
            }
            "cart",
            {
                name: "store",
                lib: ".",
                main: "store"
            }
        ]
    });

To avoid verbosity, it is strongly suggested to always use packages that use the "lib" and "main" conventions in their structure, and use packagePaths for third party packages.

To make fetching and configuring packages easier, there are designs for [a command line package tool](http://github.com/jrburke/requirejs/blob/master/docs/design/packages.md) in the works.

## Multiversion Support

As mentioned in **Configuration Options**, multiple versions of a module can be loaded in a page by using different "context" configuration options. Here is an example that loads two different versions of the alpha and beta modules (this example is taken from one of the test files):

Note that "require" is specified as a dependency for the module. This allows the require method that is passed to the function callback to use the right context to load the modules correctly for multiversion support, and it is required in multiversion situations where you want to user require inside the module's factory function.

## Loading Code After Page Load

The example above in the **Multiversion Support** section shows how code can later be loaded by nested require() calls.

## Module Modifiers

There are some cases where you want to be able to modify the behavior of a module. A common case is setting up a base module but modifying it only if some specific information or state is available.

One example could be a module that calculates DOM node positions and sizes. In standards mode, the calculations are simpler, but in quirks mode it can be trickier. You may want to avoid loading the quirks mode code unless the browser page is really in quirks mode, but you still want the node dimension module to have the same interface to other modules.

Enter Module Modifiers. They allow you to modify properties of a module. Some properties of module modifiers:

* modifiers are executed before the target module is given to other modules as dependency.
* modifiers can be specified before the target module is loaded.
* modifiers can be lazy-loaded and lazy-evaluated: only executed if the target module is loaded.
* modifiers can only modify **properties** of a module. They cannot completely redefine the whole module.

require.modify() is used for modifiers, and require.modify() can be called in two ways:

* Modifier registration.
* Modifier definition.

### Modifier Registration

If you want to tell require.js that there is a modifier, but not actually load the modifier or the target yet, then just register the modifiers with require.js:

    require.modify({
        "my/target1": "my/modifier1",
        "my/target1": "my/modifier2",
        "my/target2": "my/modifier3"
    });

This call tells require.js to load the "my/modifier1" and "my/modifier2" modules if the "my/target1" module is loaded and to load "my/modifier3" module if "my/target2" is loaded.

You are not required to register modifiers with require.js. Only do it if you want to avoid loading the target modules and defining the modifiers right away. Otherwise, you can use Modifier Definition.

### Modifier Definition

A modifier definition looks like a normal define() module definition, but:

* require.modify() is used.
* the target module's name is listed first in the require.modify() call.
* modifiers do not need to return an object from the function definition, since they are just modifying another module.

For the example given above in Modifier Registration, where "my/target1" is the target module and "my/modifier1" is the modifier, the "my/modifier1" module might look like this:

    require.modify(
        "my/target1",
        "my/modifier1",
        ["my/target1"],
        function(target1) {
            //Modify the properties on target1 as appropriate.
            //No need to return a value from this function since it
            //modifies another module.
            target1.foo = function(){};
        }
    );

## Web Worker Support

As of release 0.12, RequireJS can be run inside a Web Worker. Just use importScripts() inside a web worker to load require.js (or the JS file that contains the require() definition), then call require.

You will likely need to set the **baseUrl** [configuration option](#config) to make sure require() can find the scripts to load.

You can see an example of its use by looking at one of the files used in [the unit test](http://github.com/jrburke/requirejs/blob/master/tests/workers.js).

## Rhino Support

RequireJS can be used in Rhino, just be sure to load require.js and require/rhino.js before doing any require calls:

    load("requirejs/require.js");
    load("requirejs/require/rhino.js");

    //Set up any config values, baseUrl is required so module names
    //will map correctly to paths.
    require({
        baseUrl: 'path/to/scripts'
    });

    //Now load the top level script.
    require(['startingscript']);

You can see an example of RequireJS working in Rhino by looking at [tests/all-rhino.js](http://github.com/jrburke/requirejs/blob/master/tests/all-rhino.js). The test file is a bit different from above since each test sets its own baseUrl.

repository: posabsolute/stackJS

repo_name: posabsolute/stackJS


text:
- Follow [this](http://www.prismmodelchecker.org/games/installation.php), also using the following command: `./configure --with-java=/usr/lib/jvm/java-8-openjdk --enable-interfaces=java`
- Take care to use Java 8
- Make sure all necessary libraries are in 'lib' folder.
- Replace the `ext` folder with one from some other installation
- Add `ppl_java.jar` (located in `/usr/local/lib/ppl/ppl_java.jar`) to `lib` (seems optional)
- For benchmarking, `pip install pueue` with python3

repository: kushgrover/apt-vs-dift

repo_name: kushgrover/apt-vs-dift


text:
---
title: "Expression Language Injection"
alertid: 90025
alertindex: 9002500
alerttype: "Active"
alertcount: 1
status: beta
type: alert
risk: High
solution: "Perform data validation best practice against untrusted input and to ensure that output encoding is applied when data arrives on the EL layer, so that no metacharacter is found by the interpreter within the user content before evaluation. The most obvious patterns to detect include ${ and #{, but it may be possible to encode or fragment this data."
references:
   - https://owasp.org/www-community/vulnerabilities/Expression_Language_Injection
   - http://cwe.mitre.org/data/definitions/917.html
other: ""
cwe: 917
wasc: 20
alerttags:
  - OWASP_2017_A01
  - OWASP_2021_A03
  - WSTG-v42-INPV-11
code: https://github.com/zaproxy/zap-extensions/blob/main/addOns/ascanrulesBeta/src/main/java/org/zaproxy/zap/extension/ascanrulesBeta/ExpressionLanguageInjectionScanRule.java
linktext: "org/zaproxy/zap/extension/ascanrulesBeta/ExpressionLanguageInjectionScanRule.java"
---
The software constructs all or part of an expression language (EL) statement in a Java Server Page (JSP) using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended EL statement before it is executed. In certain versions of Spring 3.0.5 and earlier, there was a vulnerability (CVE-2011-2730) in which Expression Language tags would be evaluated twice, which effectively exposed any application to EL injection. However, even for later versions, this weakness is still possible depending on configuration.

repository: zaproxy/zaproxy-website

gha_language: HTML

gha_license_id: MIT

repo_name: zaproxy/zaproxy-website


text:
## What are BEES Tidy Tuesdays?
A weekly social data project using the R ecosystem for PhD students (and anyone else that wants to come), run within the School of Biological, Earth & Environmental Sciences (BEES) at UNSW Sydney; adopted from the [Tidy-Tuesdays project](https://github.com/rfordatascience/tidytuesday).

## When and where are BEES Tidy Tuesdays?
Tuesdays! We meet each week from 3pm-4pm in the Rountree room (Level 3, Biolink).

## Schedule
| Week | Date | Data | Source | Article | Collabrative Document
| :---: | :---: | :--- | :--- | :---|:---|
| 0 | `2020-02-18` | [Food's Carbon Footprint](https://github.com/rfordatascience/tidytuesday/blob/master/data/2020/2020-02-18/readme.md) | [nu3](https://www.nu3.de/blogs/nutrition/food-carbon-footprint-index-2018) | [`r-tastic` by Kasia Kulma](https://r-tastic.co.uk/post/from-messy-to-tidy/) | [Week 0 notes](https://hackmd.io/i9tURjJCRM6FKVbYSYYb4w) |
| 1 | `2020-02-25` | [Measles Vaccination](https://github.com/WSJ/measles-data) | [WSJ](https://github.com/WSJ/measles-data) |  [WSJ](https://www.wsj.com/graphics/school-measles-rate-map/) | [Week 1 notes](https://hackmd.io/zvVWWDgGS8Ga8m15ER1S3g)|
| 2 | `2020-03-03` | NHL Goals | [HockeyReference.com](https://www.hockey-reference.com/leaders/goals_career.html) |[Washington Post](https://www.washingtonpost.com/graphics/2020/sports/capitals/ovechkin-700-goals/?utm_campaign=wp_graphics) | [Week 2 notes](https://hackmd.io/THKk5guvTGWVoSicPuvFLA?both)|
| 3 | `2020-03-10` | [College Tuition, Diversity, and Pay](https://github.com/rfordatascience/tidytuesday/blob/master/data/2020/2020-03-10/readme.md) | [TuitionTracker.org](https://www.tuitiontracker.org/) | [TuitionTracker.org](https://www.tuitiontracker.org/) | [Week 3 notes](https://hackmd.io/YpQx0tYxRhqJNXofQ6vQrA?sync=&type=)

## What do Tidy Tuesdays cover?
Tidy Tuesdays aims to create **a safe and supportive learning environment** for PhD students in BEES to:
  - enhance their data analysis and visualisation skills
  - learn and recieve feedback from others
  - discover other's work
  - get to know other PhD students in the school

## What do Tidy Tuesdays not cover?

While we can answer easy statistics questions, the best place to get advice on stats is from [Stats Central](https://www.analytical.unsw.edu.au/facilities/stats-central).

Same goes for IT problems. We can try to help, but [UNSW IT](https://www.myit.unsw.edu.au/) is where you should direct most of the more technical questions.

For now we are focussing on only the R ecosystem, so we will not be working in other programming languages.

## How we meet and learn?

For each meeting, we get a interesting raw dataset, and invite you to explore the data. The dataset often may be 'messy', so we will get you to apply various data wrangling techniques within the R ecosystem to make the data 'tidy'!

Bring your laptop and make sure the R software and the development environment RStudio are installed on your computer.

## Who can join tidy-tuesdays?

All PhD students within the School of Biological, Earth & Environmental Sciences (BEES) are encouraged to join, however all are welcome. No prior programming knowledge required, we invite everyone to join!

## Any questions?
If you have any questions, please let us know during the session, or add an "Issue" to this page.

## Links
- [Helpful Resources](https://github.com/BEES-Tidy-Tuesdays/helpful-resources) - Our curated list of helpful R resources
- [Facilitator Page](https://github.com/BEES-Tidy-Tuesdays/facilitator-resources/) - Information for the facilitator

repository: BEES-Tidy-Tuesdays/home

repo_name: BEES-Tidy-Tuesdays/home


text:
# Online Test 1, Problem 8

Write a Haskell function `maxcount :: [String] -> Int` that takes a list of strings as argument. The list could have repeated values. The function should return the number of times the most frequent value is repeated.

**Sample Test Cases**

Test Case | Input	| Output
--------- | ----- | ------
Test Case 1	| `maxcount ["the", "higher", "you", "climb", "the", "further", "you", "fall"]` | `2`
Test Case 2	| `maxcount ["to", "be", "or", "not", "to",  "be", "that", "be", "the", "question"]` | `3`

repository: divayprakash/haskell-course

repo_name: divayprakash/haskell-course


text:
An image histogram acts as a graphical representation of the tonal
distribution in a digital image.

**Course**: [Digital Image Processing Laboratory], Spring 2014

**Taught by**: Prof. Lakshi Prosad Roy

[Digital Image Processing Laboratory]: https://github.com/nitrece/digital-image-processing-laboratory

![](Results/00.%20Image.png)

![](Results/01.%20Histogram.png)

repository: matlabf/image-histogram

repo_name: matlabf/image-histogram


text:
# Explosive Percolation
The latest version of my thesis can be found [here](latex/main.pdf).

The simulations are done using a Julia package I created called [GraphEvolve.jl](https://github.com/cameronperot/GraphEvolve.jl).

The code used to produce all data used in my thesis can be found [here](code).

I wrote my bachelor's thesis in the computational physics group at Universität Leipzig under the advisement of Prof. Dr. Wolfhard Janke and Dr. Stefan Schnabel on the topic of percolation theory. Percolation theory is a subject with a range of applications, and is often used to model phase transitions in physical systems, such as ferromagnets which have an ordered ferromagnetic phase at low temperatures and a disordered phase at high temperatures.

To be more specific the topic is based on the concept of explosive percolation, which refers to the rapid onset of large scale connectivity at the critical point in a percolating system.
I designed and analyzed a model for evaluating and adding edges to a graph called stochastic edge acceptance, or SEA for short.

Illustrated in the plot below (system size $N = 10^6$) we can see the order parameter $|C|/N$ plotted against the relative number of edges present in the graph $r = t/N$ where $t$ is the total number of edges present.
* ER = Erdos-Renyi Model
* BF = Bohman-Frieze Model
* PR = Product Rule Model
* SEA = Stochastic Edge Acceptance Model

![Order Parameter](https://github.com/cameronperot/explosive-percolation/blob/master/latex/images/Network_ER_BF_PR_SEA_1e6_order_param.png)

We can see that the BF, PR, and SEA models all exhibit phase transitions at a later point than the reference ER model, which has been proven to transition at $r = 0.5$.
The PR and SEA models both show a significantly higher rate of change in the order parameter near the critical point.

repository: cameronperot/explosive-percolation

repo_name: cameronperot/explosive-percolation


text:
---
title: "CLP #2: Einstein's Riddle"
date: 2019-03-14
categories:
    - Java
tags:
    - CLP
header:
    image: "/assets/images/blog/einstein-riddle/albert-einstein.png"
    teaser: "/assets/images/blog/einstein-riddle/albert-einstein-teaser.png"
    og_image: "/assets/images/blog/einstein-riddle/albert-einstein-teaser.png"
excerpt: "Each of us knows that Albert Einstein was a great genius. His person had a huge impact on the development of physics, but have you ever heard of his riddle? If not then, I will explain it to you now."
mathjax: "true"
---

    Code
    GitHub

    Part 1
    What is CLP?

    Part 3
    Scheduling Problem

    Part 4
    Optimization Problem

## Introduction
Each of us knows that Albert Einstein was a great genius. His person had a huge impact on the development of physics, but have you ever heard of his riddle? If not then, I will explain it to you now.

## Try to Solve It
There are **five houses in five different colors**. Each house is occupied by a man of different nationality. Each man has a different pet, prefers a different drink, and smokes different brand of cigarettes. The question is: ***who owns the fish?***

There are the following hints:
1. The Brit lives in the Red house.
2. The Swede keeps dogs as pets.
3. The Dane drinks tea.
4. The Green house is next to the White house, on the left.
5. The owner of the Green house drinks coffee.
6. The person who smokes Pall Mall rears birds.
7. The owner of the Yellow house smokes Dunhill.
8. The man living in the centre house drinks milk.
9. The Norwegian lives in the first house.
10. The man who smokes Blends lives next to the one who keeps cats.
11. The man who keeps horses lives next to the man who smokes Dunhill.
12. The man who smokes Blue Master drinks beer.
13. The German smokes Prince.
14. The Norwegian lives next to the Blue house.
15. The man who smokes Blends has a neighbour who drinks water.

Now you can try to **solve this task yourself**. Just in case, similar puzzles can be found here.

## CLP Strength
If you do not know what *Constraint Logic Programming* is yet, I invite you to read my previous post. The main task will be to transform all assumptions into equations and inequalities. The other elements will be similar to the previous example.

Let's start by collecting and segregating all the names appearing in the riddle. One way is to create several enums that will illustrate our problem more.

```java
enum Pet { DOGS , BIRDS, HORSES, CATS, FISH }
enum Drink { TEA, COFFEE, MILK, BEER, WATER }
enum Color { RED, GREEN, WHITE, YELLOW, BLUE }
enum Nation { ENGLISHMAN, SWEDE, DANE, NORWEGIAN, GERMAN }
enum Cigarette { PALLMALL, DUNHILL, BLUEMASTER, PRINCE, BLEND }
enum OrderOfCategories { COLOR, NATION, PET, DRINK, CIGARETTE }
```

After that, we can make a special place for our variables and define constants: *SIZE* and *DIST_1* (described below).
```java
Store store = new Store(); // Store for CLP variables
ArrayList<IntVar> vars = new ArrayList<IntVar>(); // ArrayList of CLP variables to store all sets

final int SIZE = 5;
final IntVar DIST_1 = new IntVar(store, 1, 1);
```

We'll also create several IntVar arrays. In the loop, for each index of each array, we can **define the domain** (possible value obtained) **from 1 to 5** and add this element to the ArrayList. We're doing it because every animal can belong to one of the five houses. The situation is similar for drinks, colors, nationalities and cigarettes.
```java
IntVar pet[] = new IntVar[SIZE];
IntVar drink[] = new IntVar[SIZE];
IntVar color[] = new IntVar[SIZE];
IntVar nation[] = new IntVar[SIZE];
IntVar cigarette[] = new IntVar[SIZE];

// Determination of possible values
for (int i = 0; i < SIZE; i++) {
    pet[i] = new IntVar(store, Pet.values()[i].toString(), 1, SIZE);
    drink[i] = new IntVar(store, Drink.values()[i].toString(), 1, SIZE);
    color[i] = new IntVar(store, Color.values()[i].toString(), 1, SIZE);
    nation[i] = new IntVar(store, Nation.values()[i].toString(), 1, SIZE);
    cigarette[i] = new IntVar(store, Cigarette.values()[i].toString(), 1, SIZE);
    vars.add(pet[i]);
    vars.add(drink[i]);
    vars.add(color[i]);
    vars.add(nation[i]);
    vars.add(cigarette[i]);
}
```

Now the most important part of the program, that is imposing constraints. To somehow ensure that no pet, drink, color, nationality or cigarettes will be assigned to the same house, we should use ***Alldifferent()***. I think the other constraints are understandable and logical. Only the constant *DIST_1* mentioned above needs explanation. The answer is in the documentation - each parameter passed to the function must be of type IntVar. Therefore, **we can not enter "1" (int) in *distance()* constraint**.
```java
// Constraints
store.impose(new Alldifferent(pet));
store.impose(new Alldifferent(drink));
store.impose(new Alldifferent(color));
store.impose(new Alldifferent(nation));
store.impose(new Alldifferent(cigarette));

store.impose(new XeqY( nation[Nation.ENGLISHMAN.ordinal()], color[Color.RED.ordinal()] ));                  // 1
store.impose(new XeqY( nation[Nation.SWEDE.ordinal()], pet[Pet.DOGS.ordinal()] ));                          // 2
store.impose(new XeqY( nation[Nation.DANE.ordinal()], drink[Drink.TEA.ordinal()] ));                        // 3
store.impose(new XplusCeqZ( color[Color.GREEN.ordinal()], 1, color[Color.WHITE.ordinal()] ));               // 4
store.impose(new XeqY( color[Color.GREEN.ordinal()], drink[Drink.COFFEE.ordinal()] ));                      // 5
store.impose(new XeqY( cigarette[Cigarette.PALLMALL.ordinal()], pet[Pet.BIRDS.ordinal()] ));                // 6
store.impose(new XeqY( color[Color.YELLOW.ordinal()], cigarette[Cigarette.DUNHILL.ordinal()] ));            // 7
store.impose(new XeqC( drink[Drink.MILK.ordinal()], 3 ));                                                   // 8
store.impose(new XeqC( nation[Nation.NORWEGIAN.ordinal()], 1 ));                                            // 9
store.impose(new Distance( cigarette[Cigarette.BLEND.ordinal()], pet[Pet.CATS.ordinal()], DIST_1 ));        // 10
store.impose(new Distance( cigarette[Cigarette.DUNHILL.ordinal()], pet[Pet.HORSES.ordinal()], DIST_1 ));    // 11
store.impose(new XeqY( cigarette[Cigarette.BLUEMASTER.ordinal()], drink[Drink.BEER.ordinal()] ));           // 12
store.impose(new XeqY( nation[Nation.GERMAN.ordinal()], cigarette[Cigarette.PRINCE.ordinal()] ));           // 13
store.impose(new Distance( nation[Nation.NORWEGIAN.ordinal()], color[Color.BLUE.ordinal()], DIST_1 ));      // 14
store.impose(new Distance( cigarette[Cigarette.BLEND.ordinal()], drink[Drink.WATER.ordinal()], DIST_1 ));   // 15

```

Finally, we can **look for a solution**. You can also easily calculate how much it takes to find a solution for a computer.
```java
// Time - start
long T1 = System.nanoTime();

// Search for solution
Search label = new DepthFirstSearch();
SelectChoicePoint select = new InputOrderSelect(store, vars.toArray(new IntVar[1]), new IndomainMin());
label.labeling(store, select);

// Time - stop
long T2 = System.nanoTime();
System.out.println("Time: " + Long.toString(T2-T1) + "ns");
```

## So Who Owns the Fish?
Returning to the main question, let's find out about it by launching the program.

**The owner of the fish is German**. We can also see that the time it takes to find the right answer was $$ 10178915ns=0,01s $$. In case of problems, the entire program can be found here. Did you manage to be faster than your computer?

gha_language: JavaScript


text:
---
layout: post
title: "When this goes off the rails, it goes way off the rails"
share-img: "https://www.asianturfgrass.com/img/utk_poa_2018.jpg"
tags: [weeds, podcast, science, research]
---

I really enjoyed listening to Frank Rossi and Jim Brosnan discuss weed control, *Poa annua*, herbicide resistance, and glyphosate in their [recent discussion on TurfNet's Frankly Speaking](https://www.turfnet.com/podcasts/rossi/brosnan/).

<iframe width="100%" height="180px" src="//percolate.blogtalkradio.com/offsiteplayer?hostId=705817&episodeId=11550103" frameborder="0" allowfullscreen></iframe>

I'd recommend listening to this to learn more about some important turfgrass management challenges and the research being done right now to find solutions.

The section about herbicide resistance was especially interesting. After Brosnan described a survey of *Poa annua* in Tennessee, Rossi asked if he understood correctly that "almost 90% of the [*Poa annua* control] programs are breaking down in one way, shape, or form?"

Brosnan confirmed that was correct, and explained that "when this goes off the rails, it goes **way** off the rails ... we want you to be diversifying what you're doing so you're not selecting for resistance on your golf course, but the answer to a resistance problem is not gonna come from a jug."