text:
'use babel'
/** @jsx etch.dom */

import etch from 'etch'
import DOMListener from 'dom-listener'
import classNames from 'classnames'
import { CompositeDisposable } from 'atom'

/*
propTypes = {
  showSoundBar: bool,
  visible: bool,
  trackInfo: {
    name: string,
    artist: string,
    cover: string,
    state: oneOf('playing', 'paused', 'error')
  }
}
*/
export default class StatusBarView {

  constructor (props, children) {
    this.props = {
      showSoundBar: atom.config.get('atom-spotified.showSoundBar'),
      visible: true,
      trackInfo: {},
    }

    // initial render of component
    etch.initialize(this)

    atom.config.observe('atom-spotified.showSoundBar', (value) => this.update({showSoundBar: value}))

    // setup subscriptions
    this.subscriptions = new CompositeDisposable()
    this.subscriptions.add(
      atom.tooltips.add(this.refs.name, {
        title: () => this.props.message || `${this.props.trackInfo.name} - ${this.props.trackInfo.artist}`
      })
    )
  }

  toggleCover () {
    const { showLargeCover } = this.props
    this.update({showLargeCover: !showLargeCover})
  }

  render () {
    const { showSoundBar, visible } = this.props
    const { name, cover, artist, state } = this.props.trackInfo

    const soundbarImg = state === 'playing'
      ? 'atom://atom-spotified/assets/equalizer_white.gif'
      : 'atom://atom-spotified/assets/equalizer_white_pause.gif'

    return (

        {showSoundBar
          ?
          : }

          {name ? `${name} - ${artist}` : 'Atom Spotified'}

    )
  }

  update (props, children) {
    // shallow update
    for (var key in props) {
      this.props[key] = props[key]
    }
    return etch.update(this)
  }

  async destroy () {
    await etch.destroy(this)
    this.subscriptions.dispose()
  }
}


text:
import React from 'react';
import Field from '../Field';
import { Button, FormInput, InputGroup } from 'elemental';

module.exports = Field.create({

	displayName: 'PasswordField',

	getInitialState () {
		return {
			passwordIsSet: this.props.value ? true : false,
			showChangeUI: this.props.mode === 'create' ? true : false,
			password: '',
			confirm: ''
		};
	},

	valueChanged (which, event) {
		var newState = {};
		newState[which] = event.target.value;
		this.setState(newState);
	},

	showChangeUI () {
		this.setState({
			showChangeUI: true
		}, () => this.focus());
	},

	onCancel () {
		this.setState({
			showChangeUI: false
		}, () => this.focus());
	},

	renderValue () {
		return <FormInput noedit>{this.props.value ? 'password set' : 'password not set'}</FormInput>;
	},

	renderField () {
		return this.state.showChangeUI ? this.renderFields() : this.renderChangeButton();
	},

	renderFields () {
		return (
			<InputGroup>
				<InputGroup.Section grow>
					<FormInput type="password" name={this.props.path} placeholder="New password" ref="focusTarget" value={this.state.password} onChange={this.valueChanged.bind(this, 'password')} autoComplete="off" />
				</InputGroup.Section>
				<InputGroup.Section grow>
					<FormInput type="password" name={this.props.paths.confirm} placeholder="Confirm new password" value={this.state.confirm} onChange={this.valueChanged.bind(this, 'confirm')} autoComplete="off" />
				</InputGroup.Section>
				{this.state.passwordIsSet ? <InputGroup.Section><Button onClick={this.onCancel}>Cancel</Button></InputGroup.Section> : null}
			</InputGroup>
		);
	},

	renderChangeButton () {
		var label = this.state.passwordIsSet ? 'Change Password' : 'Set Password';
		return (
			<Button ref="focusTarget" onClick={this.showChangeUI}>{label}</Button>
		);
	}

});

redpajama_set_name: RedPajamaGithub


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

{% block content %}

Books I've read

These are my book notes. They include excerpts as well as my own notes. I'll be updating this page as I finish more books.

    	{% for book in books %}

(Amazon)

	{% endfor %}

{% endblock %}


text:
'use strict';

const concatUtil = require('../aggregator/concat').concat;

function linearRegression (arr){
	let n = arr.length;
	let sum_x = 0;
	let sum_y = 0;
	let sum_xy = 0;
	let sum_xx = 0;
	// var sum_yy = 0;

	for (let i = 0; i < arr.length; i++) {

		sum_x += i;
		sum_y += arr[i];
		sum_xy += (i*arr[i]);
		sum_xx += (i*i);
		// sum_yy += (arr[i]*arr[i]);
	}

	return (n * sum_xy - sum_x * sum_y) / (n*sum_xx - sum_x * sum_x);
}

const strategiesMap = {
	avg: vals => {
		return vals.reduce((tot, val) => tot + val, 0) / vals.length;
	},
	min: vals => {
		return vals.reduce((min, val) => Math.min(val, min), vals[0]);
	},
	max: vals => {
		return vals.reduce((max, val) => Math.max(val, max), vals[0]);
	},
	median: vals => {
		vals = vals.sort();
		if (vals.length % 2 === 0) {
			const middle = vals.length / 2
			return (vals[middle] + vals[middle - 1]) / 2;
		} else {
			return vals[(vals.length - 1) / 2];
		}
	},
	sum: vals => {
		return vals.reduce((tot, val) => tot + val, 0);
	},
	trend: vals => {
		return linearRegression(vals);
	},
	'%change': vals => {
		if (vals.length < 1) {
			throw new Error('Cannot calculate percentage change - not enough values');
		}
		return (100 * vals[vals.length -1]/vals[vals.length -2]) - 100;
	}
};

module.exports.reduce = function (dimension, strategy, concat) {
	dimension = typeof dimension === 'undefined' ? this.dimension - 1 : this.getAxis(dimension);
	let matrix = this;
	if (dimension !== this.dimension - 1) {
		matrix = this.switchDimensions(dimension, null, 'shuffle');
	}
	let buckets = matrix.toNested(1, 'bottom');
	const axes = matrix.axes.slice();
	const removedAxis = axes.pop();
	if (strategy === 'all') {

		buckets = Object.keys(buckets).reduce((newBucket, k) => {
			Object.keys(strategiesMap)
				.map(strategy => strategiesMap[strategy](buckets[k]))
				.forEach((val, i) => {
					newBucket[k ? `${k},${i}` : i] = val;
				});
				return newBucket;
		}, {});

		axes.push({
			name: 'reduced by ...',
			values: Object.keys(strategiesMap)
		})
	} else {

		if (buckets['']) { // this is just what happens when the matrix starts off as one column and is reduced to a single value
			buckets = strategiesMap[strategy](buckets[''])
		} else {
			Object.keys(buckets).forEach(k => { // in all other cases the values have sensible labels
				buckets[k] = strategiesMap[strategy](buckets[k])
			});
		}
	}

	const reducedMatrix = matrix.clone({
		axes,
		data: buckets
	});

	if (strategy !== 'all') {
		reducedMatrix.valueLabel = `${reducedMatrix.valueLabel} (${strategy}: ${removedAxis.property})`;
	}

	if (concat) {
		return concatUtil([matrix.clone(), reducedMatrix]);
	}

	if (removedAxis.property === 'timeframe') {
		reducedMatrix.interval = null;
	}

	return reducedMatrix
}

module.exports.reduceStrategies = strategiesMap;


text:
package org.anddev.andengine.entity.modifier;

import org.anddev.andengine.entity.IEntity;
import org.anddev.andengine.util.modifier.ease.IEaseFunction;

/**
 * @author Nicolas Gramlich
 * @since 12:03:22 - 30.08.2010
 */
public class MoveXModifier extends SingleValueSpanEntityModifier {
	// ===========================================================
	// Constants
	// ===========================================================

	// ===========================================================
	// Fields
	// ===========================================================

	// ===========================================================
	// Constructors
	// ===========================================================

	public MoveXModifier(final float pDuration, final float pFromX, final float pToX) {
		this(pDuration, pFromX, pToX, null, IEaseFunction.DEFAULT);
	}

	public MoveXModifier(final float pDuration, final float pFromX, final float pToX, final IEaseFunction pEaseFunction) {
		this(pDuration, pFromX, pToX, null, pEaseFunction);
	}

	public MoveXModifier(final float pDuration, final float pFromX, final float pToX, final IEntityModifierListener pEntityModifierListener) {
		super(pDuration, pFromX, pToX, pEntityModifierListener, IEaseFunction.DEFAULT);
	}

	public MoveXModifier(final float pDuration, final float pFromX, final float pToX, final IEntityModifierListener pEntityModifierListener, final IEaseFunction pEaseFunction) {
		super(pDuration, pFromX, pToX, pEntityModifierListener, pEaseFunction);
	}

	protected MoveXModifier(final MoveXModifier pMoveXModifier) {
		super(pMoveXModifier);
	}

	@Override
	public MoveXModifier clone(){
		return new MoveXModifier(this);
	}

	// ===========================================================
	// Getter & Setter
	// ===========================================================

	// ===========================================================
	// Methods for/from SuperClass/Interfaces
	// ===========================================================

	@Override
	protected void onSetInitialValue(final IEntity pEntity, final float pX) {
		pEntity.setPosition(pX, pEntity.getY());
	}

	@Override
	protected void onSetValue(final IEntity pEntity, final float pPercentageDone, final float pX) {
		pEntity.setPosition(pX, pEntity.getY());
	}

	// ===========================================================
	// Methods
	// ===========================================================

	// ===========================================================
	// Inner and Anonymous Classes
	// ===========================================================
}


text:
Shibkit::MetaMeta - Lazy Access To SAML Metadata
================================================

[![Gem Version](https://badge.fury.io/rb/shibkit-meta_meta.png)](http://badge.fury.io/rb/shibkit-meta_meta)

## DESCRIPTION

Shibkit::MetaMeta aims to provide lazy, friendly handling of
Shibboleth/SAML2 metadata. Easily download and parse metadata XML into Ruby
objects.

### What is SAML Metadata? What is Shibboleth?
SAML2 Metadata is widely used in education to build access management federations
- groups of trusted IDPs (login servers) and SPs (websites using the IDPs for authentication).

MetaMeta is the first part of Shibkit to be released. It does not require any
of the other Shibkit gems to work but most of the others depend on it.

### Why use Shibkit::MetaMeta?

There are few reasons to use MetaMeta if you are running an IDP or a simple
authenticated website. However, if you are building a more advanced web application
that needs to be aware of other entities in its federations then MetaMeta may be useful to you.

Features include:

* Ready-to-use configurations and information for all major SAML federations (not actually complete yet)
* Efficient download, caching and expiry of metadata, using ETag, Expires, Cache-Control and Last-Modified headers where available
* Validation of metadata (also not complete but we're working on it)
* Immediate access to metadata as XML or parsed Nokogiri documents
* Conversion of metadata into convenient Ruby objects for Federations, Entities, Contacts and Organisations.
* Easy storage of objects into databases for querying
* Compatibility with JRuby and Java scripting - it may then be included in Java IDPs and other Java applications (not working yet)
* Easy integration with non-Ruby applications: MetaMeta will act as a loader to build databases of entities for use by your Java, .Net, Python or PHP application.

### Shibkit::Disco

Shibkit::MetaMeta provides a simple interface to data stored in SAML metadata files
but does not include any persistence or query facilities, discovery protocol support, etc.

If you are planning to use SAML metadata within your application you might be better
using Shibkit::Disco, a library that builds on Shibkit::MetaMeta to provide a
SAML discovery framework. Most features of Shibkit::MetaMeta will still be available inside
Shibkit::Disco. It will be available in early 2012.

>I feel the same way about disco as I do about herpes.
>*Hunter S. Thompson*

If you don't fancy the heavier framework in Shibkit::Disco you can probably get
what you need from Shibkit::MetaMeta, or use it in a framework of your own.

## CAVEATS

MetaMeta is still early in development so please bear the following in mind when using it:

* Tests and API documentation are not complete. They will be completed before version 1.0.0.
* The API may not be stable until version 1.0. If using Bundler please lock the version to avoid upgrades breaking your application
* Full validation of metadata is not present yet. **Do not use MetaMeta for security checks yet.**
* The mock 'dev' metadata is not valid or complete. We plan to eventually build some fully-functional example federations, but at present both UnCommon and Example federations are simple test mocks of certain parts of SAML2 metadata.
* The source list of federations is _far_ from complete.
* For development and testing the provided lists should be fine but please DO NOT use the provided federation source lists in production without manually checking their contents or using your own edited version. Your federation will have its own guidelines for verifying their certificate and metadata, please read them and check that the certificate and source URL you are using are correct. Your chain of trust should not originate in a file on Github, even if the creators are nice people.
* MetaMeta is using far too much memory when processing metadata XML.
* MetaMeta is not compatible with JRuby yet (but we hope it will be)
* Not yet tested on Windows, although it detects Windows and tries to compensate.

## INSTALLATION

### Requirements
Shibkit::MetaMeta is available as a gem and should bring in most dependencies itself
when installed. It does need a few of other things as well:

* Ruby 1.8.7+ or Ruby 1.9.2+
* Rubygems (not required but makes things much simpler)
* LibXML2 (including LibXML2-devel on most Linux distros)
* LibXSLT (including libXSLT-devel on most Linux distros)
* Linux, Mac OS, *BSD, Solaris (Windows is unsupported at present)

### As a released Ruby Gem

#### Rubygems

If you use RubyGems directly then simply type:

```bash
gem install shibkit-meta_meta
```

and require the gem in your code

```ruby
require 'rubygems'
require 'shibkit/meta_meta'
```

#### Bundler

Bundler users can add MetaMeta to their Gemfiles like this:

```ruby
source "http://rubygems.org"
gem "shibkit-meta_meta"
```

then of course run `bundle install` on the commandline and
 `require 'bundler'` within your code.

It's a very good idea to immediately specify a gem version since MetaMeta is
going to a little unstable for awhile, and there may be breaking-things API
changes until v1.0.0.

### Using the latest development version
If you'd like to use the very latest in-development version of MetaMeta, possibly
as a developer you should check it out of Github and include it with Bundler by specifying
the source location:

```bash
git clone git@github.com:Digital-Identity-Labs/shibkit-meta_meta.git
```

```ruby
source "http://rubygems.org"
gem "shibkit-meta_meta", :path => "~/Projects/shibkit-meta_meta/"
```

You can also skip Bundler and install the gem directly from source by typing

```shell
rake install
```

Please feel welcome to fork the project on Github and send pull requests for any
changes you wish to contribute.

## USAGE

### Convenience Features

The MetaMeta class provides a number of simple factory-style methods to return
simplified representations of the items within SAML metadata files.

#### Automatic metadata retrieval and parsing

MetaMeta contains information about a number of popular federations which it
will access by default. While it's best to use your own list of sources, it be
convenient to get started immediately.

For instance, to find the longest entity URI in all popular federations all you
need is:

```ruby
puts Shibkit::MetaMeta.entities.sort!{|a,b| a.uri.size <=> b.uri.size}.last
```

Metadata will normally be automatically downloaded, cached, parsed and sorted on first use.

#### Easy access to Federation, Entities and Organisations
MetaMeta can return arrays of all federations, and all entities (SPs and IDPs),
IDPs or SPs in all Federations. It can also attempt to list all organisations but
the data returned is not yet particularly useful.

```ruby
Shibkit::MetaMeta.federations.each {|f| puts f }
Shibkit::MetaMeta.entities.each { |e| puts e }
Shibkit::MetaMeta.idps.each { |e| puts e }
Shibkit::MetaMeta.sps.each { |e| puts e }
Shibkit::MetaMeta.orgs.each { |o| puts o }
```

#### Select an entity by URI
If you already know the URI of an entity in a loaded federation then you can get it directly using
`#from_uri`

```ruby
entity = Shibkit::MetaMeta.from_uri('https://shib.manchester.ac.uk/shibboleth')

puts entity.idp?
puts entity.accountable?
```

The same thing can be achieved a little more compactly using the [] method:

```ruby
entity = Shibkit::MetaMeta['https://shib.manchester.ac.uk/shibboleth']

puts entity.idp?
puts entity.accountable?
```

My aliasing the rather long Shibkit::MetaMeta class name, you can reduce it further:

```
MM = Shibkit::MetaMeta
entity = MM['https://shib.manchester.ac.uk/shibboleth']
```

Read more about the Shibkit::MetaMeta class

----

### Metadata Sources

MetaMeta needs to know various things about a Federation before it can access
its metadata. This information is handled by the Source class. Sources can be
specified directly in your code or loaded from a source list file.

Source objects describe federations and collections and are effectively metadata
about metadata, hence the odd name of this software.

#### Loading your own source list
It's best to write and load your own source list for your software.

* You can download and process only the federations you require, saving time and
energy.
* You can check that file locations, certificates and fingerprints are correct
* You can include your own federations or simpler local metadata collections

Source lists are simple YAML documents. Copy the examples included with MetaMeta
or read the Shibkit::MetaMeta::Source documentation before writing your own.

```ruby
Shibkit::MetaMeta.config.sources_file = '/etc/mm/my_metadata_sources.yml'
Shibkit::MetaMeta.idps.each { |e| puts e }
```

#### Selecting a built-in source list
MetaMeta comes with a few source lists that you can choose from.

 * `:real` is a list of all major federations (this file may not be complete yet!)
 * `:dev`  is a small list of tiny fictional federations for testing and development

They are loaded by specifying the symbol instead of a real filename string

```ruby
Shibkit::MetaMeta.config.sources_file = :real
Shibkit::MetaMeta.idps.each { |e| puts e }
```

----

### Accessing Source information
Source objects can be accessed directly, to be read or adjusted after loading.

```ruby
## List homepages specified in all metadata sources, wherever the source is defined
Shibkit::MetaMeta.sources.each {|s| puts s.homepage_url}

```

#### Automatic selection of source lists
By default MetaMeta will choose a (hopefully) suitable source list for you.

(At the moment this is always the `:real` list but when the `:dev` list is fixed this will
be used instead when in 'development' mode in Rails and Sinatra applications)

#### Automatic loading and processing of Metadata
MetaMeta will normally load and process XML from your sources when you first
ask for data. However, this can sometimes cause delays exactly when you don't want them.

Autoloading of metadata can be turned off and on at any time:

```ruby
Shibkit::MetaMeta.config.autoload = false
# or maybe
Shibkit::MetaMeta.config.autoload = true if Date.today.day == 1
```

Of course if autoloading is turned off you'll not get any federations or entities
when you need them. To load data call the `#load_sources` method:

```ruby
Shibkit::MetaMeta.load_sources    # Loads sources file but not actual metadata
Shibkit::MetaMeta.process_sources # Downloads and processes metadata into objects

# There will now be a delay while metadata is downloaded and processed...

Shibkit::MetaMeta.loaded_sources? # => true
Shibkit::MetaMeta.stocked? # => true
```

You can call `Shibkit::MetaMeta.process_sources`  to pre-emptively create objects
even if `Shibkit::MetaMeta.config.autoload` is active.

#### Adding your own Sources without a sources file

It's possible to append additional sources using the `Shibkit::MetaMeta.add_source`
method. Pass either a hash or a Source object you prepared earlier.

If a source with the same ID URI already exists then it will be replaced by the
new one.

```ruby
Shibkit::MetaMeta.add_source({
    :uri           => 'http://ukfederation.org.uk',
    :name          => 'UK Access Management Federation For Education And Research',
    :display_name  => 'UK Access Management Federation',
    :type          => 'federation',
    :countries     => ['gb'],
    :metadata      => 'http://metadata.ukfederation.org.uk/ukfederation-metadata.xml',
    :certificate   => 'http://metadata.ukfederation.org.uk/ukfederation.pem',
    :fingerprint   => '94:7F:5E:8C:4E:F5:E1:69:E7:DF:68:1E:48:AA:98:44:A5:41:56:EE',
    :refeds_info   => 'https://refeds.terena.org/index.php/FederationUkfed',
    :homepage      => 'http://www.ukfederation.org.uk',
    :languages     => ['en-gb', 'en'],
    :support_email => ' service@ukfederation.org.uk',
    :description   => 'A single solution for accessing online resources and services',
})

```

----

### Federations

Federation objects describe a federation, including its members
(SPs and IDPs).

#### Listing federation objects

You can get an array of all loaded federations using '#federations'

```ruby
all_federations = Shibkit::MetaMeta.federations
```

#### Finding an federation by URI

```ruby
uk_fed = Shibkit::MetaMeta.from_uri('http://ukfederation.org.uk')
```

#### Loading federation objects ahead of time

Calling `Shibkit::MetaMeta.process_sources` will re-process federation metadata
into objects, removing previously generated objects from MetaMeta's lists.

```ruby
Shibkit::MetaMeta.process_sources
Shibkit::MetaMeta.stocked? # => true
```

#### Filtering and selecting Sources/Federations

It's nice to have easy access to many different federations but if you're only
interested in one or two of them it can add a lot of wasteful overhead to process
all of them together.

You can limit the sources/federations to be processed using the `#only_use` method:

```ruby
Shibkit::MetaMeta.config.only_use(['http://ukfederation.org.uk'])

```

After specifying federation URIs only matching federations will be downloaded
 and processed.

You can go back to processing all federations by using `:all` or `:everything`

```ruby
Shibkit::MetaMeta.config.only_use(:everything)

```

----

### Entities (IDPs & SPs)

Entity objects are generic representations of entities listed in SAML metadata.
They can be IDPs, SPs, or both. MetaMeta only stores general information about the
entity in the Entity object itself, and then uses SP and IDP objects inside it
to store more detailed information about the roles of the entity.

#### Accessing all the entities in a federation

```ruby
federation = Shibkit::MetaMeta.from_uri('http://ukfederation.org.uk')
uk_fed_entities = federation.entities
```

#### Finding an entity by URI

```ruby
uom_idp = Shibkit::MetaMeta.from_uri('https://shib.manchester.ac.uk/shibboleth')
```

#### Listing all primary entities in all federations
If you're read this far you can probably guess how this will go.

```ruby
all_entities = Shibkit::MetaMeta.entities
```

This doesn't list *all* entities, only all *primary* entities. I'm afraid we've made
up the term "primary entity". Read on for enlightenment.

#### Multi-federation entities and primary entities

The same IDP or SP, represented by the same URI, can be in more than one federation.
The Shibboleth IDP will load the only the first one that it finds. Because of this,
although it's possible to give the same service different metadata in each
federation it's probably a bad idea to do so - you don't know which metadata
for your service will be used.

IDPs and SPs don't usually care which trusted federation an entity belongs to - they're
trusted, and that's what matters. However, your SAML-aware software might care, so
MetaMeta tries to keep track of multiple federation membership.

Each Federation object has its own list of entities. These are separate objects and if
metadata for a service varies between different federations it should be different
between their MetaMeta objects too.

```ruby
entity1 = fed1.entities.collect { |e| e.uri = 'http://silly-idp.com/shib' }[0]
entity2 = fed2.entities.collect { |e| e.uri = 'http://silly-idp.com/shib' }[0]

entity1.primary_federation_uri # => 'http://fed1.org'
entity1.idp.protocols
  # => ['urn:oasis:names:tc:SAML:1.1:protocol', 'urn:oasis:names:tc:SAML:2.0:protocol']

entity2.primary_federation_uri # => 'http://fed2.org'
entity2.idp.protocols
  # => ['urn:oasis:names:tc:SAML:2.0:protocol']

```

In most cases you don't want to know about the other varieties; you want to know about
the entity with the first metadata to be loaded. Shibkit::MetaMeta refers to this
as the "Primary Entity", and its parent Federation as its "primary federation".

Shibkit::MetaMeta only lists primary records when you call `Shibkit::MetaMeta.from_uri` and
`Shibkit::MetaMeta.entities`

Primary entities will have any other federations that they are a member of listed under
`#other_federations` and `#secondary_federations`. Both primary and seconday/other federations are
listed by `#federation_uris`.

You can quickly check if an entity is primary or multifederation:

```ruby
ent = Shibkit::MetaMeta.from_uri('https://idp.uni.ac.uk/shibboleth')

ent.primary? # => true
ent.multi_federated? # => true
```

#### Entity objects

```ruby
ent = Shibkit::MetaMeta.from_uri('https://idp.uni.ac.uk/shibboleth')

ent.uri # => 'https://idp.uni.ac.uk/shibboleth'
ent.accountable? # => true
ent.hide?        # => false
ent.sp?          # => false
ent.idp?         # => true

ent.idp.scopes # => ['uni.ac.uk']

```

For more information on Entity objects please read the API documentation.

----

### IDPs

While an Entity object can represent an IDP (indicated by the `#idp?` method) the details of its
IDP role are held in the IDP object it contains.

```ruby
entity.idp? # => true
entity.idp.protocols        # => ['urn:oasis:names:tc:SAML:2.0:protocol']
entity.idp.scopes           # => ['uni.ac.uk']

entity.idp.display_name     # => "The University of Studies"
entity.idp.display_name :fr # => "L'Université des Etudes"
entity.idp.description      # => "Example login service for UoS"
entity.idp.domains          # => ['uni.ac.uk']
```

For more information on IDP objects please read the API documentation.

----

### SPs

Entity objects can also represent an SP (even if also an IDP). As with IDPs the
additional information is represented by an SP object within the Entity object.

```ruby
entity.sp? # => true
entity.sp.protocols     # => ['urn:oasis:names:tc:SAML:2.0:protocol']

entity.sp.display_name     # => "University of Studies Webmail"
entity.sp.display_name :fr # => "L'Université des Etudes de Webmail"
entity.sp.description      # => "Email service for staff and students"
entity.sp.ip_blocks        # => ['192.168.1.0/24', '10.50.1.0/24']
```

For more information on SP objects please read the API documentation.

----

### Contacts

IDP and SP objects may contain Contact objects. Each type of contact is available
from its own method in an Entity object. If a contact type is not available then `nil`
is returned.

```ruby
sc = entity.support_contact
tc = entity.technical_contact
ac = entity.admin_contact
```

Contact objects are very simple:

```ruby
contact = entity.support_contact

contact.givenname     # => 'Joe'
contact.surname       # => 'Yossarian'
contact.display_name  # => 'Joe Yossarian'
contact.email_url     # => "mailto:joe.yossarian@uni.ac.uk"
contact.email_address # => 'joe.yossarian@uni.ac.uk'
contact.category      # => :support

```

For more information on Contact objects please read the API documentation.

----

### Organisations

IDP and SP objects may contain Organisation objects. Organisation details have
often been used to describe services (especially IDPs) rather than the organisation
running the service. Recent additions to SAML metadata (described in the next section) will
hopefully lead to organisation details gradually becoming more useful.

```ruby
org = entity.organisation

org.name          # => 'University of Studies'
org.display_name  # => 'University of Studies IDP (test)'
org.url           # => 'uni.ac.uk'
```

MetaMeta will fall back to using Organisation data to describe entities when no
user interface information is available.

The `Shibkit::MetaMeta.orgs` method will list all organisations found in all federations
after trying, rather badly, to minimise repeated records. We added this feature to
see how well it would work, and so far it doesn't work very well at all.

For the curious or optimistic:

```ruby
messy_list_organisations = Shibkit::MetaMeta.orgs
```

----

### User Interface Info

Shibkit::MetaMeta aims to reproduce the details that Shibboleth IDPs can present
to users during authentication - friendly, localised information on SPs and IDPs.

User interface information for SPs and IDPs is available as as English default, a
specified locale (if available, falling back to English) and as a hash of all available
content.

```ruby
entity.idp.display_name     # => "The University of Studies"
entity.idp.display_name :fr # => "L'Université des Etudes"
entity.idp.display_names
  # => {:en => "The University of Studies", :fr => "L'Université des Etudes"}

entity.idp.keywords      # => ['example', 'university']
entity.idp.keywords :fr  # => ['exemple', 'université']
entity.idp.keyword_sets
  # => {:en => ['example', 'university'], :fr => ['exemple', 'université']}
```

----

### Logos

SPs and IDPs may also have Logo objects, for use in user interfaces or just to
decorate your federation reports. Like user interface information they can be
grouped according to language, and the defaults assume `:en`

```ruby
default_logos = entity.idp.logos
french_logos  = entity.idp.logos :fr

default_logos.each { |logo| puts logo.url ; puts logo.width }

## Find location of largest image in a set
french_logos.sort{ |a,b| a.pixels <=> b.pixels }.last.uri

```

Logo objects have various methods for describing the image, downloading it,
comparing the real image to details in metadata, etc. Please read the API docs
for more info.

----

### Discovery Hints

Discovery hints can be used by WAYF/Discovery Services to guess at likely
options for users.

```ruby
entity.sp.ip_blocks          # => ['192.168.1.0/24', '10.50.1.0/24']
entity.sp.domains            # => ['uni.ac.uk']
entity.idp.geo_location_uris # => nil
```

----

### Service Information
SPs can advertise a number of Services.

```ruby

entity.sp.services         # Returns an array of service objects
service = entity.sp.default_service  # Returns one service

service.attributes      # Array of attribute objects
service.index           # Returns the index number of the service
service.description     # Default description
service.description :en # English description
service.description     # Hash of all descriptions, keyed on language.

```

### IDP and SP Attributes
While rarely used, it's possible for metadata to list the attributes made available
by IDPs or requested by SPs. These should be available via the SP and IDP objects.

```ruby
entity.idp.attributes.each { |a| puts a.friendly_name }

entity.sp.default_service.attributes.each { |a| puts a.name }

attribute = entity.idp.attributes[0]

attribute.name           # Name uri for the attribute
attribute.required?      # (Used by SPs)
attribute.name_format    #
attribute.friendly_name  #
attribute.values         # Available values (from IDPs)

```

----

### Provisioning Your Application

Shibkit::MetaMeta is **not** a sleek and speedy bit of software. It can use a
fairly large amount of RAM to process metadata - when loading four federations
(c.2400 unique entities) a couple of hundred megabytes of RAM is typical,
and also takes about a minute on a typical PC.

Because of this it is probably a very bad idea to autoload objects inside a
persistent web application, especially at startup. Using multiple Mongrel processes,
each loading their own metadata, is definitely not advisable.

Shibkit::MetaMeta is best suited to running scripts that process metadata then quit,
maybe loading data into other storage formats.

If you want a persistent database to query within your applications you should
consider Shibkit::Disco, which builds on MetaMeta and provides a variety of database
backends.

----

### Optimising for speed or memory

There are a few things that can make Shibkit:MetaMeta a little lighter.

#### Speed: Smartcache

MetaMeta's "smartcache" feature will store the objects created from your metadata
XML on disk and reload them the next time MetaMeta is run. A simple script that takes two
minutes to download and process metadata when first run may take a couple of seconds
the second time it's run if you have the smartcache enabled.

Smartcaching is on by default, but can be turned off with Shibkit::MetaMeta::Config's
 ```#smartcache_active``` method. Smartcache data expires when it's older than the
 ```#smartcache_expiry``` config setting or when MetaMeta's configuration,
  platform or Ruby version changes.

```ruby
Shibkit::MetaMeta.config do |c|
  c.autoload          = true
  c.smartcache_expiry = 60*60
  c.smartcache_active = true
end
```

If the smartcache is turned off then metadata files will be downloaded each time
your script is run. Download caching will still occur if possible.

#### Memory: Purging XML

MetaMeta objects will normally store the parsed XML used to create them. This can
take up more RAM and will cause larger, slower smartcache files. In many cases you won't
need this data at all after the object has been created, so you can safely delete it.

```ruby
Shibkit::MetaMeta.config do |c|
  c.purge_xml = true
end
```

----

### General Options

[There are a few methods in the Source class that need to be refactored out for use everywhere
in MetaMeta. Should be fixed soon.]

----

### Download Caching Options

...

### Debugging Hints

You can dump all objects in a readable format using ```#save_cache_file``` and
reload them using ```#load_cache_file```. (This can use quite a bit of RAM)

```ruby
Shibkit::MetaMeta.save_cache_file "/Users/pete/Desktop/dump.yaml"
# ...
Shibkit::MetaMeta.load_cache_file "/Users/pete/Desktop/dump.yaml"
```

## BACKGROUND READING

* [Wikipedia on SAML2](http://en.wikipedia.org/wiki/SAML_2.0)
* [Shibboleth software](http://shibboleth.internet2.edu/)
* [SAML2 Metadata spec](http://www.oasis-open.org/committees/download.php/35391/sstc-saml-metadata-errata-2.0-wd-04-diff.pdf)
* [Metadata UI spec](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-ui/v1.0/sstc-saml-metadata-ui-v1.0.pdf)
* [Metadata Correctness](https://wiki.shibboleth.net/confluence/display/SHIB2/MetadataCorrectness)
* [The SAML2 Spec](http://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf)
* [All the SAML2 specs](http://saml.xml.org/saml-specifications)

## SHIBKIT

Shibkit::MetaMeta is part of Shibkit, a collection of Ruby gems derived from
code used by Digital Identity Ltd in various projects and experiments. Most
future commercial and open source Digital Identity Labs projects will be based
on Shibkit libraries.

## CONTRIBUTORS

* Pete Birkinshaw
* Eddy Wheldon
* Linda Ward
* Sam Jones

## LICENSE

Shibkit is copyright (c) 2011, Digital Identity Ltd. It's licensed under the
Apache License, Version 2.0, which is a lot like the BSD and MIT licenses only
with added cunning bits and extra words for lawyers. It's a permissive license.

See [LICENSE.md](https://github.com/Digital-Identity-Labs/shibkit-meta_meta/blob/master/LICENSE)
for the entire whole license text if you're curious.

## DIGITAL IDENTITY LABS

...

## OOPS...

We've definitely made mistakes. This is software - there are going to be coding bugs,
inaccurate documentation, misinterpreted specs, and horrible, embarrassing things that
we haven't even worried about yet.

If you find something wrong, weird or confusing please let us know on the Shibkit-MetaMeta
issue tracker. It might cause us blushes but we'd rather someone let us know straight away.

https://github.com/Digital-Identity-Labs/shibkit-meta_meta/issues

## CONTRIBUTE

If you'd like to add new features to MetaMeta or even remove feature you hate
then please fork the repository on Github. Change the code to work the way you want,
and then send us a pull request if you'd like us to merge any of your changes back
into the official repository.

https://github.com/Digital-Identity-Labs/shibkit-meta_meta

If you'd like us to add a feature for you then please get in touch.


text:
{% include custom/versionconfig.html %}
{% include custom/sidebarconfigs.html %}

GP Connect API {{ gpconnectVersion }}
FHIR® {{ fhirVersion }}

{{sidebar[0].product}}

    {% if showbackbutton == true %}

         {{ backbuttontext }}

    {% endif %}

    {% for entry in sidebar %}
    {% for folder in entry.folders %}
    {% if folder.output contains "web" %}

        {{ folder.title }}

            {% for folderitem in folder.folderitems %}
            {% if folderitem.output contains "web" %}
            {% if folderitem.external_url %}

{{folderitem.title}}

            {% elsif page.url == folderitem.url %}

{{folderitem.title}}

            {% else %}

{{folderitem.title}}

            {% endif %}
            {% for subfolders in folderitem.subfolders %}
            {% if subfolders.output contains "web" %}

                {{ subfolders.title }}

                    {% for subfolderitem in subfolders.subfolderitems %}
                    {% if subfolderitem.output contains "web" %}
                    {% if subfolderitem.external_url %}

{{subfolderitem.title}}

                    {% elsif page.url == subfolderitem.url %}

{{subfolderitem.title}}

                    {% else %}

{{subfolderitem.title}}

                    {% endif %}
                    {% endif %}
                    {% endfor %}

            {% endif %}
            {% endfor %}
            {% endif %}
            {% endfor %}

        {% endif %}
        {% endfor %}
        {% endfor %}

Quick links

                {% for item in quicklinks %}
                        {{item.url}}
                {% endfor %}

               Go back to previous page


text:
/*
 *  receive.js
 *
 *  David Janes
 *  IOTDB.org
 *  2015-03-27
 *
 *  Demonstrate receiving
 *  Make sure to see README first
 */

var Transport = require('../RESTTransport').RESTTransport;

var p = new Transport({
});
p.updated("MyThingID", "meta", function(id, band, value) {
    if (value === undefined) {
        p.get(id, band, function(_id, _band, value) {
            console.log("+", id, band, value);
        });
    } else {
        console.log("+", id, band, value);
    }
});


text:
package spray.contrib.socketio.mq

import akka.actor.Actor
import akka.actor.ActorLogging
import akka.actor.ActorRef
import akka.actor.Props
import akka.actor.Terminated
import java.net.URLEncoder

object LocalTopicRegion {
  def props(topicProps: Props) = Props(classOf[LocalTopicRegion], topicProps)
}

class LocalTopicRegion(topicProps: Props) extends Actor with ActorLogging {

  def receive = {
    case Terminated(ref) =>
    case msg             => deliverMessage(msg, sender())
  }

  def deliverMessage(msg: Any, snd: ActorRef): Unit = {
    val (id, m) = Topic.idExtractor(msg)
    if (id == null || id == "") {
      log.warning("Id must not be empty, dropping message [{}]", msg.getClass.getName)
      context.system.deadLetters ! msg
    } else {
      val name = URLEncoder.encode(id, "utf-8")
      val entry = context.child(name).getOrElse {
        context.watch(context.actorOf(topicProps, name))
      }
      entry.tell(m, snd)
    }
  }
}


text:
"use strict";

var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");

_Object$defineProperty(exports, "__esModule", {
  value: true
});

exports.default = void 0;
var listitemRole = {
  abstract: false,
  accessibleNameRequired: false,
  baseConcepts: [],
  childrenPresentational: false,
  nameFrom: ['author'],
  prohibitedProps: [],
  props: {
    'aria-level': null,
    'aria-posinset': null,
    'aria-setsize': null
  },
  relatedConcepts: [{
    concept: {
      constraints: ['direct descendant of ol, ul or menu'],
      name: 'li'
    },
    module: 'HTML'
  }, {
    concept: {
      name: 'item'
    },
    module: 'XForms'
  }],
  requireContextRole: ['directory', 'list'],
  requiredContextRole: ['directory', 'list'],
  requiredOwnedElements: [],
  requiredProps: {},
  superClass: [['roletype', 'structure', 'section']]
};
var _default = listitemRole;
exports.default = _default;


text:
.class public interface abstract Lcom/google/android/gms/internal/zzhk;
.super Ljava/lang/Object;

# virtual methods
.method public abstract onRewardedVideoAdClosed()V
.end method

.method public abstract onRewardedVideoAdLeftApplication()V
.end method

.method public abstract onRewardedVideoAdOpened()V
.end method

.method public abstract onRewardedVideoStarted()V
.end method

.method public abstract zza(Lcom/google/android/gms/ads/internal/reward/mediation/client/RewardItemParcel;)V
.end method

.method public abstract zzgb()V
.end method


text:
Clouds for [voxel.js](http://voxeljs.com).

# example

[View this example](http://shama.github.io/voxel-clouds)

```js
// create a clouds
var clouds = require('voxel-clouds')({

  // pass a copy of the game
  game: game,

  // how high up the clouds should be from the player
  high: 10,

  // the distance from the player the clouds should repeat
  distance: 300,

  // how many clouds to generate
  many: 100,

  // how fast the clouds should move
  speed: 0.01,

  // material of the clouds
  material: new game.THREE.MeshBasicMaterial({
    emissive: 0xffffff,
    shading: game.THREE.FlatShading,
    fog: false,
    transparent: true,
    opacity: 0.5,
  }),
});

// on tick, move the clouds
game.on('tick', clouds.tick.bind(clouds));
```

# api

## `clouds.generate([size:16])`
Will generate a cloud 16x1x16.

## `clouds.tick(delta)`
Call on game tick to move the clouds and upon exceeding the distance from the
player; loop the cloud.

## `clouds.clouds`
An array of all the generated voxel mesh clouds.

# install

With [npm](https://npmjs.org) do:

```
npm install voxel-clouds
```

Use [browserify](http://browserify.org) to `require('voxel-clouds')`.

## release history
* 0.2.0 - update deps
* 0.1.0 - initial release

## license
Copyright (c) 2013 Kyle Robinson Young<br/>
Licensed under the MIT license.


text:
Coordinate Sprite::get_coordinate(int index = -1)
{
    if(index == -1)
        index = pos_index;

    return this->path.get_coordinate(index);
}

void Sprite::move_to_next_position()
{
    if(dead)
        return;
    this->pos_index++;
}

Coordinate Sprite::get_previous_position()
{
    if (this->pos_index == 0)
    	return get_coordinate(0);
    else
    	return get_coordinate(this->pos_index-1);
}

Sprite::Sprite(Path path, Spritesheet * spritesheet, std::vector<Coordinate>& cycles, std::vector<Coordinate>& dead_cycles, int health = 100) : path(path), spritesheet(spritesheet), cycles(cycles), dead_cycles(dead_cycles) , health(health), random_pos(Coordinate(0, 0))
{
    attacked = false;
    dead = false;
    this->pos_index = 0;

}

Spritesheet * Sprite::get_spritesheet()
{
	return this->spritesheet;
}

bool Sprite::is_out_of_map()
{
    return this->pos_index >= this->path.size();
}

std::vector<Coordinate>& Sprite::get_sscords()
{
    if(dead)
        return dead_cycles;
    else
        return cycles;
}

void Sprite::set_attacked()
{
    attacked = true;
}
void Sprite::set_not_attacked()
{
    attacked = false;
}
bool Sprite::is_attacked()
{
    return attacked;
}

void Sprite::die()
{
    dead = true;
}

void Sprite::add_damage(int damage)
{
    health -= damage;
    if(health <= 0)
        die();
}

void Sprite::set_random_position(Coordinate coord)
{
    random_pos.x = coord.x;
    random_pos.y = coord.y;
}

Coordinate Sprite::get_offset()
{
    return random_pos;
}


text:
export default {
  props: {
    name: String
  },

  computed: {
    formAttrs () {
      return {
        type: 'hidden',
        name: this.name,
        value: this.value
      }
    }
  },

  methods: {
    __injectFormInput (child, action, className) {
      child[action](
        this.$createElement('input', {
          staticClass: 'hidden',
          class: className,
          attrs: this.formAttrs,
          domProps: this.formDomProps
        })
      )
    }
  }
}

export const FormFieldMixin = {
  props: {
    name: String
  },

  computed: {
    nameProp () {
      return this.name || this.for
    }
  }
}


text:
#ifndef CLICK_BYPASS_HH
#define CLICK_BYPASS_HH 1
#include <click/element.hh>
#include <click/routervisitor.hh>
CLICK_DECLS

/*
=c

Bypass([ACTIVE])

=s classification

sends packet stream through optional bypass with zero overhead

=d

Bypass adds zero-overhead path switching to a configuration.

Normally, a Bypass element emits received packets on its first output, like
Null. However, when ACTIVE is true, a push Bypass element emits packets onto
output port 1. An active pull Bypass forwards pull requests to input port 1.

Here's a typical use of a push Bypass:

  ... source -> print_bypass :: Bypass -> sink ...;
  print_bypass [1] -> Print(Debug) -> sink;

To turn on the Print, write print_bypass.active to true.

You could implement this functionality multiple ways, for instance by using
Switch or Print's "active" handler, but Bypass is special because an inactive
Bypass has I<zero overhead>. Bypass modifies its neighboring elements so that
packets skip over the Bypass itself. In other words, the above configuration
behaves like one of the following two lines:

  ... source -> sink ...;
  ... source -> Print(Debug) -> sink ...;

Bypass can have two inputs and outputs. The additional push input (pull
output) reconnects the bypass path to the normal path, and makes it easier to
use Bypass in agnostic contexts. On a push Bypass, packets received on input
port 1 are forwarded to output port 0; on a pull Bypass, pull requests
received on output port 1 are forwarded to input port 0. The above
configuration could also be written this way:

  source :: TimedSource -> print_bypass :: Bypass -> sink ...;
  print_bypass [1] -> Print(Debug) -> [1] print_bypass;

And here is a pull version of Bypass in a related configuration:

  source :: Queue -> print_bypass :: Bypass -> sink ...;
  print_bypass [1] -> Print(Debug) -> [1] print_bypass;

Note that the bypass path is exactly the same in both cases.

Keyword arguments are:

=over 8

=item INLINE

Boolean. If true, then Bypass remains inline: it does not modify its
neighbors' ports, and it will introduce overhead. Default is false.

=back

=n

Bypass modifies Click internals at run time, which can be dangerous. Elements
that test their neighbors' classes should not be used next to
Bypass. (Elements should not test their neighbors' classes, however.) Bypass
should not be used in a devirtualized configuration unless its INLINE argument
is set to true.

=a

Switch, PullSwitch, Null, click-devirtualize
*/
class Bypass : public Element { public:

    Bypass() CLICK_COLD;

    const char *class_name() const	{ return "Bypass"; }
    const char *port_count() const	{ return "1-2/1-2"; }
    const char *flow_code() const	{ return "xy/[xy]x"; }
    void *cast(const char *name);

    int configure(Vector<String> &conf, ErrorHandler *errh) CLICK_COLD;
    int initialize(ErrorHandler *errh) CLICK_COLD;
    void add_handlers() CLICK_COLD;

    void push(int port, Packet *p);
    Packet *pull(int port);

  private:
    struct Locator : public RouterVisitor {
        Element* _e;
        int _port;
        int _from_port;
        Locator(int from_port);
        bool visit(Element *e, bool isoutput, int port,
                   Element *from_e, int from_port, int distance);
    };

    struct Assigner : public RouterVisitor {
        Element* _e;
        int _port;
        Vector<int> _interesting;
        Assigner(Element *e, int port);
        bool visit(Element *e, bool isoutput, int port,
                   Element *from_e, int from_port, int distance);
    };

    bool _active;
    bool _inline;

    void fix();
    static int write_handler(const String &s, Element *e, void *user_data, ErrorHandler *errh) CLICK_COLD;
    friend struct Locator;
    friend struct Assigner;

};

CLICK_ENDDECLS
#endif


text:
using System;
using System.Globalization;
using System.Runtime.Serialization;
using System.Threading;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models.Entities;

namespace Umbraco.Core.Models
{
    /// <summary>
    /// Represents a Language.
    /// </summary>
    [Serializable]
    [DataContract(IsReference = true)]
    public class Language : EntityBase, ILanguage
    {
        private string _isoCode;
        private string _cultureName;
        private bool _isDefaultVariantLanguage;
        private bool _mandatory;
        private int? _fallbackLanguageId;

        public Language(string isoCode)
        {
            IsoCode = isoCode;
        }

        /// <inheritdoc />
        [DataMember]
        public string IsoCode
        {
            get => _isoCode;
            set => SetPropertyValueAndDetectChanges(value, ref _isoCode, nameof(IsoCode));
        }

        /// <inheritdoc />
        [DataMember]
        public string CultureName
        {
            // CultureInfo.DisplayName is the name in the installed .NET language
            //            .NativeName is the name in culture info's language
            //            .EnglishName is the name in English
            //
            // there is no easy way to get the name in a specified culture (which would need to be installed on the server)
            // this works:
            //   var rm = new ResourceManager("mscorlib", typeof(int).Assembly);
            //   var name = rm.GetString("Globalization.ci_" + culture.Name, displayCulture);
            // but can we rely on it?
            //
            // and... DisplayName is captured and cached in culture infos returned by GetCultureInfo(), using
            // the value for the current thread culture at the moment it is first retrieved - whereas creating
            // a new CultureInfo() creates a new instance, which _then_ can get DisplayName again in a different
            // culture
            //
            // I assume that, on a site, all language names should be in the SAME language, in DB,
            // and that would be the Umbraco.Core.DefaultUILanguage (app setting) - BUT if by accident
            // ANY culture has been retrieved with another current thread culture - it's now corrupt
            //
            // so, the logic below ensures that the name always end up being the correct name
            // see also LanguageController.GetAllCultures which is doing the same
            //
            // all this, including the ugly settings injection, because se store language names in db,
            // otherwise it would be ok to simply return new CultureInfo(IsoCode).DisplayName to get the name
            // in whatever culture is current - we should not do it, see task #3623
            //
            // but then, some tests that compare audit strings (for culture names) would need to be fixed

            get
            {
                if (_cultureName != null) return _cultureName;

                // capture
                var threadUiCulture = Thread.CurrentThread.CurrentUICulture;

                try
                {
                    var globalSettings = (IGlobalSettings) Composing.Current.Factory.GetInstance(typeof(IGlobalSettings));
                    var defaultUiCulture = CultureInfo.GetCultureInfo(globalSettings.DefaultUILanguage);
                    Thread.CurrentThread.CurrentUICulture = defaultUiCulture;

                    // get name - new-ing an instance to get proper display name
                    return new CultureInfo(IsoCode).DisplayName;
                }
                finally
                {
                    // restore
                    Thread.CurrentThread.CurrentUICulture = threadUiCulture;
                }
            }

            set => SetPropertyValueAndDetectChanges(value, ref _cultureName, nameof(CultureName));
        }

        /// <inheritdoc />
        [IgnoreDataMember]
        public CultureInfo CultureInfo => CultureInfo.GetCultureInfo(IsoCode);

        /// <inheritdoc />
        public bool IsDefault
        {
            get => _isDefaultVariantLanguage;
            set => SetPropertyValueAndDetectChanges(value, ref _isDefaultVariantLanguage, nameof(IsDefault));
        }

        /// <inheritdoc />
        public bool IsMandatory
        {
            get => _mandatory;
            set => SetPropertyValueAndDetectChanges(value, ref _mandatory, nameof(IsMandatory));
        }

        /// <inheritdoc />
        public int? FallbackLanguageId
        {
            get => _fallbackLanguageId;
            set => SetPropertyValueAndDetectChanges(value, ref _fallbackLanguageId, nameof(FallbackLanguageId));
        }
    }
}


text:
$.fn.dataList = function(options) {
    var opt = $.extend({
        autoSelectable: false,
        addClassIfError:'error',
        ajax: false,
        ajaxErrorMessage:"Request failed",
        allowNewValues:false,
        clearOnFocus: false,
        dataRanking:false,
        datalistAttr: "data-list",
        defaultMessage:'Please, select a choice',
        default_value:"",
        emptyMessage:"No results found",
        error400:"Server understood the request, but request content was invalid",
        error401:"Unauthorized access",
        error403:"Forbidden resource can\'t be accessed",
        error404:"Not found",
        error500:"Internal server error",
        error503:"Service unavailable",
        errorAbort:'Request was aborted by the server',
        errorParse:'Parsing JSON request failed',
        errorTimeOut:'Request time out',
        errorUnknown:'Unknown error',
        loadingMessage: 'Loading...',
        method: "post",
        multiple_class:'',
        onChange: null,
        parameterToSend:"query",
        requiredMessage:'Please, enter at least one value',
        return_mask:"text",
        selected_value:"",
        url:"",
        value_selected_to:"",
        placeholder:('placeholder' in document.createElement("input"))
    }, options );

    var dataListTarget = $(this);
    var selector  = "#"+$(this).attr("id");
    var multiple  = typeof $(this).attr('multiple') != "undefined";
    var required  = typeof $(this).attr('required') != "undefined";
    var valueList = null;
    var divLayer  = '
{text}<input type="hidden" value="{value}" name="'+selector.replace('#', '')+'[]">X
';

    function unselectText(e){ try { $(e.target).get(0).selectionStart = $(e.target).get(0).value.length; $(e.target).get(0).selectionEnd = $(e.target).get(0).value.length; } catch(ex) {}}
    function selectFirst(){ $('#'+$(selector).attr(opt.datalistAttr)+"_ul li").removeClass('hover'); var item = $('#'+$(selector).attr(opt.datalistAttr)+"_ul").find("li:visible:first"); if(item.html() != opt.emptyMessage && opt.autoSelectable) item.addClass("hover"); }
    function selectText(e){ try { if(isTextSelected($(e.target).get(0))){ $(e.target).get(0).selectionStart = 0; $(e.target).get(0).selectionEnd = $(e.target).get(0).value.length; } } catch(ex) {}}
    function isTextSelected(input) { if (typeof input.selectionStart == "number") { return input.selectionStart == 0 && input.selectionEnd == input.value.length; } else if (typeof document.selection != "undefined") { input.focus(); return document.selection.createRange().text == input.value; }}
    function isValid(){ $(selector).removeAttr('title').removeClass(opt.addClassIfError); if((!multiple && $(selector).val() == '') || (multiple && $('input', valueList).length == 0)){ if(opt.placeholder &&  required){ $(selector).attr('placeholder', opt.requiredMessage).addClass(opt.addClassIfError) } else if(!opt.placeholder && required){ $(selector).attr('title', opt.requiredMessage).val(opt.requiredMessage).addClass(opt.addClassIfError) } } }
    function isMobile() { return ('ontouchstart' in document.documentElement);}
    function empty(e){ if(e.css("display") != 'none' && e.html().indexOf(opt.emptyMessage) != -1) return true; return false; }

    function get(t, val, ul, input, e){
        if(opt.ajax && $.trim($('#'+input.attr(opt.datalistAttr)).html()) == ""){
            var param = opt.parameterToSend;
            $.ajax({url:opt.url, data:param+"="+val, method:opt.method, xhrFields: { withCredentials: true }}).done(function(data) {
                try { var parseData = JSON.parse(data); } catch(e){ var parseData = data;  }
                var s = '';
                if(typeof parseData == 'object'){
                    if(JSON.stringify(parseData)=='[null]' || parseData == null || parseData == []){
                        s += '<option value="false">'+opt.emptyMessage+'</option>';
                    } else {
                        for(var js=0; js<parseData.length; js++){
                            s += '<option value="'+parseData[js].value+'">'+parseData[js].text+'</option>';
                        }
                    }
                } else {
                    var a = parseData.split('\n');
                    for(var j=0; j<a.length; j++){
                        if($.trim(a[j])!="") s += '<option value="'+a[j]+'">'+a[j]+'</option>';
                    }
                }

                $('#'+input.attr(opt.datalistAttr)).html(s);
                search(val, ul, input, e);
                if(val == "")  ul.hide();

                assignByDefault();

            }).error(function(x, text, exception) {
                    var message;
                    var statusErrorMap = {
                        '400' : opt.error400,
                        '401' : opt.error401,
                        '403' : opt.error403,
                        '404' : opt.error404+': '+opt.url,
                        '500' : opt.error500,
                        '503' : opt.error503
                    };
                    if (x.status) {
                        message =statusErrorMap[x.status];
                        if(!message){
                            message=opt.errorUnknown;
                        }
                    }else if(exception=='parsererror'){
                        message=opt.errorParse;
                    }else if(exception=='timeout'){
                        message=opt.errorTimeOut;
                    }else if(exception=='abort'){
                        message=opt.errorAbort;
                    }else {
                        message=opt.errorUnknown;
                    }
                    alert(opt.ajaxErrorMessage+"\n\n"+message);
            });
        } else {
            search(val, ul, input, e);
        }
    }

    function select(e, v){
        var vst = opt.value_selected_to;
        var rmk = opt.return_mask;
        var sep = rmk.replace('value', '').replace('text', '');
        var aux = $(e).parent().attr("id");

        if(opt.allowNewValues && typeof v == "undefined"){
            if(multiple){
                var div = divLayer.replace('{text}', $(selector).val());
                    div = div.replace('{value}', '0');
                valueList.append(div);
                $(selector).val('');

                $(selector).attr('placeholder', opt.defaultMessage)
            } else {
                if(rmk.indexOf('text') != -1 && rmk.indexOf('value') != -1){
                    var val = $(selector).val();
                    var pv = val;

                    var l = val.split(rmk.replace('value', '').replace('text', ''));
                    $('#'+vst).val('0');
                    $('#'+aux).val(val);
                } else {
                    $('#'+aux).val(val);
                    if(opt.value_selected_to != "") $('#'+vst).val(e.getAttribute("data-value"));
                }
            }

            $('#'+$(selector).attr(opt.datalistAttr)+"_ul").hide();
        } else {
            if(multiple && typeof v != "undefined"){
                aux = rmk.split(sep);
                var val = v.split(sep);
                var arr = {};
                for(var x=0; x < aux.length; x++){
                    arr[aux[x]] = val[x];
                }
                var div = "";
                if(opt.dataRanking && arr.text.indexOf(" (") != -1) arr.text = arr.text.substr(0, arr.text.indexOf(" ("));
                if(typeof arr.value != 'undefined' && arr.value != "") div = divLayer.replace('{value}', arr.value);
                if(typeof arr.text != 'undefined' && arr.text != "") div = div.replace('{text}', arr.text);

                idx = arr.text;
                valueList.append(div);
                $(selector).val('');

                $(selector).attr('placeholder', opt.defaultMessage);

            } else {
                if(typeof aux != "undefined"){
                    aux = aux.substr(0, aux.indexOf("_dataList"));
                    var val = v;
                    if(rmk.indexOf('text') != -1 && rmk.indexOf('value') != -1){
                        var pv = rmk.split('value');

                        var l = val.split(rmk.replace('value', '').replace('text', ''));
                        $('#'+vst).val(l[pv[0]==''?0:1]);
                        $('#'+aux).val(l[pv[0]==''?1:0]);
                    } else {
                        $('#'+aux).val(val);
                        if(opt.value_selected_to != "") $('#'+vst).val(e.getAttribute("data-value"));
                    }
                } else {
                    $('#'+aux).val('');
                    if(opt.value_selected_to != "") $('#'+vst).val('');
                }
            }
            $('#'+$(e).parent().attr("id")).hide();
        }

        // If OnChange parameter is sent
        if(opt.onChange != null){ eval(opt.onChange); }

        if(required) dataListTarget.prev().removeAttr("required");
    }

    function search(val, ul, input, e){
        var sdt = opt.datalistAttr;
        var et  = e.target;

        if(typeof ul[0] == "undefined") return;

        var items = document.querySelectorAll('ul[id*="_dataList_ul"]');
        for(var z = 0; z < items.length; ++z){
            var item = items[z];
            item.style['display'] = "none";
        }

        if(ul.html() != ''){
            var aux = $('li', $('#'+input.attr(sdt)).next());
            for(var i=0; i<aux.length; i++){
                var item = aux.eq(i)[0];
                if(item.getAttribute("data-value").toUpperCase().indexOf(val.toUpperCase()) == -1 && item.innerHTML.toUpperCase().indexOf(val.toUpperCase()) == -1){
                    item.style["display"] = "none";
                } else {
                    item.style["display"] = "";
                }
            }
            if(multiple){
                var mis = $('input', valueList);
                var lst = "";
                for(var x = 0; x < mis.length; ++x){
                    var mi = $(mis[x]);
                    lst += "|"+mi.val()+"|";
                }
                for(var i=0; i<aux.length; i++){
                    var item = aux.eq(i)[0];
                    if(lst.indexOf("|"+item.getAttribute("data-value")+"|") != -1) item.style["display"] = "none";
                }
            }

            ul.show();

            selectFirst();
            selectText(e);

        } else {
            var auxPHldr = $(selector).attr('placeholder');
            $(selector).attr('placeholder', opt.loadingMessage + " " + auxPHldr);

            setTimeout(function () {
                var aux = $('#'+input.attr(sdt)+' option');
                var ulEmpty = true;

                ul = ul[0];
                ul.innerHTML = '';
                for(var i=0; i<aux.length; i++){
                    var item = aux.eq(i)[0];
                    var dataRank = typeof item.getAttribute('data-rank') != 'undefined';

                    if(item.value.toUpperCase().indexOf(val) != -1 || item.text.toUpperCase().indexOf(val) != -1){
                        ulEmpty = false;
                        var mask = opt.return_mask.replace('value', item.value).replace('text', item.text);
                        if(opt.dataRanking && dataRank) mask += " ("+item.getAttribute('data-rank')+')';
                        if(!multiple){
                            ul.innerHTML = ul.innerHTML + (dataRank?('
'):('
'))+mask+'
';
                        } else {
                            var mis = $('input', valueList);
                            var lst = "";
                            for(var x = 0; x < mis.length; ++x){
                                var mi = $(mis[x]);
                                lst += "|"+mi.val()+"|";
                            }
                            if(lst.indexOf("|"+item.value+"|") == -1) ul.innerHTML = ul.innerHTML + (dataRank?('
'):('
'))+mask+'
';
                        }
                    }
                }
                if(ulEmpty) ul.innerHTML = ul.innerHTML + '
'+opt.emptyMessage+'
';
                ul = $(ul);

                $('#'+$(et).attr(sdt)+"_ul li").off("mouseover click");
                $('#'+$(et).attr(sdt)+"_ul li").on("mouseover", function(e){ if(empty($(this))) return false; $(this).parent().find('li').removeClass("hover"); $(this).addClass("hover"); });
                $('#'+$(et).attr(sdt)+"_ul li").on("click", function(e){ if(empty($(this))) return false; select(e.target, $(this).html()); });

                $(selector).attr('placeholder', auxPHldr);

                ul.show();
                selectFirst();
                selectText(e);
            }, 25);
        }
    }

    function assignByDefault(){
        if($(selector)[0].nodeName == "INPUT") {
            $(selector).val($('#'+$(selector).attr(opt.datalistAttr) + ' option[value="'+opt.default_value+'"]').text());
            if(opt.value_selected_to != "") $('#'+opt.value_selected_to).val(opt.default_value);

        } else {
            document.getElementById(selector.replace('#', '')).value=opt.default_value;
        }
    }

    function assignSelected(value){
        if(multiple){
            if(typeof value == "object"){
                valueList = $('.valueList_dataList', $(selector).parent());

                for(var i = 0; i < value.length; ++i){
                    var div = divLayer.replace('{text}', value[i].text);
                        div = div.replace('{value}', value[i].value);
                    valueList.append(div);
                }
            } else {
                $(selector).attr("title", opt.errorParse).attr("placeholder", opt.errorParse).addClass(opt.addClassIfError);
            }
        } else {
            if($(selector)[0].nodeName == "INPUT") {
                $(selector).val($('#'+$(selector).attr(opt.datalistAttr) + ' option[value="'+value+'"]').text());
                if(opt.value_selected_to != "") $('#'+opt.value_selected_to).val(value);

            } else {
                document.getElementById(selector.replace('#', '')).value=value;
            }
        }
    }

    var methods = {
        init: function(options) {
                $(selector).before('<input autocomplete="off" />');

                var selName = selector.replace("#", '');
                var c = document.getElementById(selName);

                // Copy the attriibutes to new input
                for (var i = 0, atts = c.attributes, n = atts.length; i < n; i++){
                    var attr = atts[i].nodeName;

                    if(attr.toLowerCase() == "onchange"){
                        opt.onChange = dataListTarget.attr(attr);
                    } else {
                        dataListTarget.prev().attr(attr, dataListTarget.attr(attr));
                    }
                }

                if(multiple) dataListTarget.prev().removeAttr("name");
                if(required && multiple) dataListTarget.prev().removeAttr("required");

                // Remove attributes to selector
                dataListTarget.prev().attr(opt.datalistAttr, selName+'_dataList');
                for (var i = 0, atts = c.attributes, n = atts.length; i < n; i++){ dataListTarget.removeAttr(atts[0].nodeName); }

                // Hide the select tag
                $(selector).next().attr('id', selName+'_dataList').css('display', 'none');
                dataListTarget = $('input'+selector);
                get(selName, '', $('#'+$('#'+selName).attr(opt.datalistAttr)).next(), dataListTarget, $(selName));

                // If selector is multiple
                if(multiple){
                    var c = " ";
                    if(opt.multiple_class != "") c += opt.multiple_class;
                    valueList = $('

').insertAfter('#'+dataListTarget.attr(opt.datalistAttr));
                    if($('head').html().indexOf('.valueList_dataList > div > span{ float: right; margin:0 0 0 10px; cursor: pointer; }') == -1)
                        $("").appendTo("head");
                }

                // Insert unsorted list after selector
                $('

').insertAfter('#'+dataListTarget.attr(opt.datalistAttr)).hide();

                // If dataList is multiple and required, add new associate event
                if(required && multiple){
                    var frm = $(selector).parents('form');
                    $(frm).submit(function(e){
                        if($('input', valueList).length == 0){
                            if(opt.placeholder){
                                $(selector).attr('placeholder', opt.requiredMessage).addClass(opt.addClassIfError);
                            } else {
                                $(selector).attr('title', opt.requiredMessage).val(opt.requiredMessage).addClass(opt.addClassIfError);
                            }

                            e.preventDefault();
                            return false;
                       }
                    });
                }

                // Auto insert selected items
                var itemsSel = document.querySelectorAll(selector + " + select option");
                for(var x = 0; x < itemsSel.length; ++x){
                    var itemSel = itemsSel[x];
                    if(typeof itemSel.getAttribute("selected") == "string"){
                        if(multiple){
                            assignSelected([{text: itemSel.text, value: itemSel.value}])
                        } else {
                            assignSelected(itemSel.value);
                        }
                    }
                }

                // Focusin Event
                $(selector).on("focusin", function(e){
                    if(typeof e.target.getAttribute("readonly") == "string"){ $(e.target).blur(); return; }

                    if(opt.clearOnFocus){
                        $(this).val("");
                        if(opt.value_selected_to != "") $('#'+opt.value_selected_to).val('');
                        var obj = $('#'+$(e.target).attr(opt.datalistAttr)).next();
                        var trg = $('li:visible:first', obj);
                        trg.parent().scrollTop(0);
                    }

                    var obj = $('#'+$(e.target).attr(opt.datalistAttr)).next();
                    obj.attr("id", $(e.target).attr(opt.datalistAttr)+"_ul");
                    var val = $(this).val().toUpperCase();
                    if(val == '' && $('li', obj).length == 0) get($(this).attr("id"), val, obj, dataListTarget, e);
                    else search(val, obj, dataListTarget, e);
                    $(this).attr("data-before", $(this).val());
                });

                $(selector).on("focusout", function(e){ if(typeof e.target.getAttribute("readonly") == "string"){ $(e.target).blur(); return; } unselectText(e); if(opt.clearOnFocus && opt.default_value != "" && $(this).val() == "") assignSelected(opt.default_value)  });

                // KeyUp Event
                $(selector).on("keyup", function(e){
                    var obj = $('#'+$(e.target).attr(opt.datalistAttr)).next();
                    obj.attr("id", $(e.target).attr(opt.datalistAttr)+"_ul");
                    var val = $(this).val().toUpperCase();

                    if((e.keyCode == 27 || ((e.keyCode == 8 || e.keyCode == 46)) && val=="") || (e.keyCode != 13 && e.keyCode != 38 && e.keyCode != 40 && e.keyCode != 9)){
                        get($(this).attr("id"), val, obj, dataListTarget, e);
                    }
                });

                // KeyDown Event
                $(selector).on("keydown", function(e){
                    var obj = $('#'+$(e.target).attr(opt.datalistAttr)).next();
                    obj.attr("id", $(e.target).attr(opt.datalistAttr)+"_ul");
                    var val = $(this).val().toUpperCase();

                    if(e.which == 27){ $(selector).val($(selector).attr("data-before")); }

                    if(e.keyCode == 40){
                        if(empty($('#'+obj.attr("id")))) return false;
                        if(obj.css("display") == 'none'){
                            if(val == '' && $('li:visible', obj).length == 0) get($(this).attr("id"), val, obj, dataListTarget, e);
                            else search(val, obj, dataListTarget, e);
                        }
                        obj.show();

                        var firstSel = $('li.hover:visible:first', obj);

                        if(firstSel.length > 0 && firstSel.length - firstSel.index() != 1){ var target = firstSel.nextAll( 'li:visible:first'); } else { var target = $('li:not(.hover):visible:first', obj); }
                        if(target.length == 0) { target = $('li:visible:first', obj); }

                        firstSel.removeClass("hover");
                        target.addClass("hover");

                        var s = target.parent().scrollTop(), h = target.parent().height(), p = target.position().top;
                        if(p +target.innerHeight() > h) target.parent().scrollTop(s+target.innerHeight());
                        else if(p <= 0) target.parent().scrollTop(0);

                    } else if(e.keyCode == 38){
                        if(empty($('#'+obj.attr("id")))) return false;
                        var firstSel = $('li.hover:visible:first', obj);

                        if(firstSel.length > 0){ var target = firstSel.prevAll( 'li:visible:first'); } else { var target = $('li:visible:not(.hover):first', obj); }
                        if(target.length == 0) { target = $('li:visible:last', obj); }

                        firstSel.removeClass("hover");
                        target.addClass("hover");

                        var s = target.parent().scrollTop(), h = target.parent().height(), p = target.position().top;
                        if(p +target.innerHeight() > h) target.parent().scrollTop(s+target.innerHeight());
                        else target.parent().scrollTop(s+p);
                        if($('li:visible:last', obj).hasClass("hover")) target.parent().scrollTop(s+p);

                    } else if(e.keyCode == 9){
                        var e = $.Event('keypress');
                        e.which = 13;
                        $('#'+$(this).attr("id")).trigger(e);
                        $('input['+opt.datalistAttr+'] + * + ul').hide();

                    } else if((e.keyCode == 27 || ((e.keyCode == 8 || e.keyCode == 46)) && val=="") || e.keyCode != 13){
                        get($(this).attr("id"), val, obj, dataListTarget, e);
                    }
                });

                $('body').on('click.hideMenu', function(e) { if (typeof $(e.target).data("list") == "undefined" || $(e.target).data("list").indexOf("_dataList") == -1) $('input[' + opt.datalistAttr + '] + * + ul').hide(); });
                $(selector).on("keypress", function(e){ if(e.which == 13){ var targetID = $('#'+$(e.target).attr(opt.datalistAttr)+"_ul li.hover"); select(targetID[0], targetID.html()); return false; } });

                $(selector).focusin(function(e){ if(!opt.placeholder){ if($(e.target).val() == opt.requiredMessage) $(e.target).val('')}});
                $(selector).focusout(function(e){
                    setTimeout(function(){ isValid(); }, 250);
                });

            if(!opt.ajax){
                window.onload = function (){
                    assignByDefault();
                    if(opt.selected_value != "") assignSelected(opt.selected_value);
                };
            }
            if(opt.selected_value != ""){ assignSelected(opt.selected_value); }

            return this;
        },
        update: function(value) {
            if(multiple){
                valueList = $('.valueList_dataList', $(selector).parent());
                valueList[0].innerHTML="";
                assignSelected(value);
            } else {
                var select = document.querySelector(selector+'_dataList'), aux = '';

                select.innerHTML="";
                select.nextElementSibling.innerHTML = '';

                for(var x = 0; x < value.length; ++x){
                    var item = value[x];

                    aux += '<option value="'+item.value+'">'+item.text+'</option>';
                }

                select.innerHTML = aux;
                document.querySelector(selector).focus();
            }
        },
        change: function(value){
            if(opt.onChange != null){ eval(value); }
        },
        destroy: function() {
            var selName = selector.replace("#", '');
            var c = document.getElementById(selName);
            var jqc = $(c);

            // Copy the attributes to new input
            for (var i = 0, atts = c.attributes, n = atts.length; i < n; i++){
                var attr = atts[i].nodeName;
                jqc.next().attr(attr, jqc.attr(attr));
            }
            jqc.next().next().remove();
            jqc.next().css("display", '');
            jqc.remove();
        }
    };

    if ( typeof options === 'object' || ! options ) {
        // Default to "init"
        return methods.init.apply( this, arguments );
    } else if ( methods[options] ) {
        return methods[ options ].apply( this, Array.prototype.slice.call( arguments, 1 ));
    }
};


text: This is an HL7 Parser written in Python to parse the message onto a JSON file.


text:
Basic document of language,tool

Git

GitHub


text:
package net.edralzar.wargolem.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;

public class WarRoom {

    private String roomId;
    private String topic;
    private String serverId;

    private Player owner;
    private List<Player> squad;

    private List<String> chat;

    private BiMap<MapResource, Player> scouts;

    public WarRoom(String roomId, String topic, String serverId, Player owner) {
        this.roomId = roomId;
        this.topic = topic;
        this.serverId = serverId;
        this.owner = owner;
        this.squad = new ArrayList<Player>();
        this.chat = new ArrayList<String>();
        this.scouts = HashBiMap.create();
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getTopic() {

        return topic;
    }

    public String getServerId() {
        return serverId;
    }

    public Player getOwner() {
        return owner;
    }

    public List<Player> getSquad() {
        return squad;
    }

    public List<String> getChat() {
        return chat;
    }

    public BiMap<MapResource, Player> getScouts() {
        return scouts;
    }
}