text:
import unittest
import os.path

from neuralmonkey.evaluators.multeval import MultEvalWrapper
from neuralmonkey.evaluators.beer import BeerWrapper
from neuralmonkey.evaluators.gleu import GLEUEvaluator
from neuralmonkey.evaluators.f1_bio import F1Evaluator
from neuralmonkey.evaluators.accuracy import (AccuracyEvaluator,
                                              AccuracySeqLevelEvaluator)

REF = ["I", "like", "tulips", "."]
HYP = ["I", "hate", "flowers", "and", "stones", "."]

# 4 common, |bio| = 7, |bio_ref| = 6
BIO = "BBOBOOOBIIOOOOOBIBIIIIB"
BIO_REF = "BIOBOOOBIIBIOOOBIBIIIIO"

MULTEVAL = "scripts/multeval-0.5.1/multeval.sh"
BEER = "scripts/beer_2.0/beer"

class TestExternalEvaluators(unittest.TestCase):

    def test_multeval_bleu(self):
        if os.path.exists(MULTEVAL):
            multeval = MultEvalWrapper(MULTEVAL, metric="bleu")
            bleu = multeval([HYP], [REF])
            max_bleu = multeval([REF], [REF], )
            min_bleu = multeval([], [REF])
            self.assertEqual(max_bleu, 1.0)
            self.assertEqual(min_bleu, 0.042)  # smoothing
            self.assertAlmostEqual(bleu, 0.097)
        else:
            print("MultEval not installed, cannot be found here: {}".
                  format(MULTEVAL))

    def test_multeval_ter(self):
        if os.path.exists(MULTEVAL):
            multeval = MultEvalWrapper(MULTEVAL, metric="ter")
            ter = multeval([HYP], [REF])
            min_ter = multeval([REF], [REF])
            max_ter = multeval([], [REF])
            self.assertEqual(min_ter, 0.0)
            self.assertEqual(max_ter, 1.0)
            self.assertAlmostEqual(ter, 1.0)
        else:
            print("MultEval not installed, cannot be found here: {}".
                  format(MULTEVAL))

    def test_multeval_meteor(self):
        if os.path.exists(MULTEVAL):
            multeval = MultEvalWrapper(MULTEVAL, metric="meteor")
            meteor = multeval([HYP], [REF])
            max_meteor = multeval([REF], [REF])
            min_meteor = multeval([], [REF])
            self.assertEqual(max_meteor, 1.0)
            self.assertAlmostEqual(min_meteor, 0.0)
            self.assertAlmostEqual(meteor, 0.093)
        else:
            print("MultEval not installed, cannot be found here: {}".
                  format(MULTEVAL))

    def test_beer(self):
        if os.path.exists(BEER):
            beer_evaluator = BeerWrapper(BEER)
            beer = beer_evaluator([HYP], [REF])
            max_beer = beer_evaluator([REF], [REF])
            min_beer = beer_evaluator([], [REF])
            self.assertAlmostEqual(beer, 0.1120231)
            self.assertAlmostEqual(max_beer, 0.4744488)
            self.assertEqual(min_beer, 0)
        else:
            print("BEER not installed, cannot be found here: {}".format(BEER))

    def test_gleu(self):
        gleu_evaluator = GLEUEvaluator()
        gleu = gleu_evaluator([HYP], [REF])
        max_gleu = gleu_evaluator([REF], [REF])
        min_gleu = gleu_evaluator([], [REF])
        self.assertEqual(min_gleu, 0.0)
        self.assertEqual(max_gleu, 1.0)
        self.assertAlmostEqual(gleu, 0.1111111)

    def test_f1(self):
        f1_evaluator = F1Evaluator()
        f1val = f1_evaluator([BIO], [BIO_REF])
        self.assertAlmostEqual(f1val, 8.0 / 13.0)

class TestAccuracyEvaluator(unittest.TestCase):

    def setUp(self):
        self.hyps = [["This", "is", "equal"], ["This", "is", "not"]]
        self.refs = [["This", "is", "equal"], ["This", "isn't"]]

    def test_word_level_acc(self):
        word_acc_evaluator = AccuracyEvaluator()
        word_acc = word_acc_evaluator(self.hyps, self.refs)
        max_word_acc = word_acc_evaluator(self.refs, self.refs)
        min_word_acc = word_acc_evaluator([[], []], self.hyps)
        self.assertEqual(min_word_acc, 0.0)
        self.assertEqual(word_acc, 0.8)
        self.assertEqual(max_word_acc, 1.0)

    def test_seq_level_acc(self):
        seq_acc_evaluator = AccuracySeqLevelEvaluator()
        seq_acc = seq_acc_evaluator(self.hyps, self.refs)
        max_seq_acc = seq_acc_evaluator(self.refs, self.refs)
        min_seq_acc = seq_acc_evaluator([[], []], self.hyps)
        self.assertEqual(min_seq_acc, 0.0)
        self.assertEqual(seq_acc, 0.5)
        self.assertEqual(max_seq_acc, 1.0)

if __name__ == "__main__":
    unittest.main()


text:
package com.twitter.finagle.http;

/**
 * Java friendly versions of {@link com.twitter.finagle.http.Version}.
 */
public final class Versions {
  private Versions() { }

  public static final Version HTTP_1_1 = Version.Http11$.MODULE$;
  public static final Version HTTP_1_0 = Version.Http10$.MODULE$;
}

redpajama_set_name: RedPajamaGithub


text:
<?php
require_once(FCPATH.'/application/views/breadcrumb.php');
require_once(FCPATH.'/application/views/success-error-message.php');
?>

                              Add New Launch

                          <form action="" method="post">

                                      Select Company
                                        <select name="company_id" id="company_id" class="form-control select2me">
                                        <?php
                                          $companies_arr = get_companies_arr();
                                          foreach($companies_arr as $ckey => $cvalue){
                                            echo '<option value="'.$ckey.'">'.$cvalue.'</option>';
                                          }
                                        ?>
                                      </select>

                                        Lanch Name
                                        <input type="text" name="launch_name" placeholder="M.V. Sonar Tori" class="form-control" value="<?php echo set_value('launch_name'); ?>" />

                                        Total Cabin
                                        <input type="text" name="total_cabin" placeholder="120" class="form-control" value="<?php echo set_value('total_cabin'); ?>" />

                                        Total Capacity
                                        <input type="text" name="total_capacity" placeholder="800" class="form-control" value="<?php echo set_value('total_capacity'); ?>" />

                                        Register Info
                                        <textarea class="form-control" name="register_info"><?php echo set_value('register_info'); ?></textarea>

                                      Route
                                        <select name="route_id" id="route_id" class="form-control select2me">
                                        <?php
                                          foreach($launch_route_arr as $rkey => $rvalue){
                                            echo '<option value="'.$rkey.'">'.$rvalue['route_path'].'</option>';
                                          }
                                        ?>
                                      </select>

                                        Place One Leaving Time
                                        <input type="text" name="time_start_place_1" class="form-control timepicker timepicker-default" value="<?php echo set_value('time_start_place_1'); ?>" />

                                        Place One Arrival Time
                                        <input type="text" name="time_end_place_1" class="form-control timepicker timepicker-default" value="<?php echo set_value('time_end_place_1'); ?>" />

                                        Place Two Leaving Time
                                        <input type="text" name="time_start_place_2" class="form-control timepicker timepicker-default" value="<?php echo set_value('time_start_place_2'); ?>" />

                                        Place Two Arrival Time
                                        <input type="text" name="time_end_place_2" class="form-control timepicker timepicker-default" value="<?php echo set_value('time_end_place_2'); ?>" />

                                      <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
                                      <input type="submit" class="btn green" name="register_new_launch" value="Register Now">

                          </form>


text:
#pragma once

#include "libgearman/interface/client.hpp"

// Get next connection that is ready for I/O.
gearman_connection_st *gearman_ready(gearman_universal_st&);

void gearman_universal_clone(gearman_universal_st &destination, const gearman_universal_st &source);

void gearman_universal_free(gearman_universal_st &gearman);

void gearman_free_all_packets(gearman_universal_st &gearman);

gearman_return_t gearman_universal_set_option(gearman_universal_st &self, universal_options_t option, bool value);

void gearman_set_log_fn(gearman_universal_st &self, gearman_log_fn *function, void *context, gearman_verbose_t verbose);

void gearman_universal_set_timeout(gearman_universal_st &self, int timeout);

int gearman_universal_timeout(gearman_universal_st &self);

void gearman_universal_set_namespace(gearman_universal_st &self, const char *namespace_key, size_t namespace_key_size);

gearman_return_t cancel_job(gearman_universal_st& universal,
                            gearman_job_handle_t job_handle);

/**
 * Set custom memory allocation function for workloads. Normally gearman uses
 * the standard system malloc to allocate memory used with workloads. The
 * provided function will be used instead.
 */
void gearman_set_workload_malloc_fn(gearman_universal_st&,
                                    gearman_malloc_fn *function,
                                    void *context);

/**
 * Set custom memory free function for workloads. Normally gearman uses the
 * standard system free to free memory used with workloads. The provided
 * function will be used instead.
 */
void gearman_set_workload_free_fn(gearman_universal_st&,
                                  gearman_free_fn *function,
                                  void *context);

// Free all connections for a gearman structure.
void gearman_free_all_cons(gearman_universal_st&);

// Test echo with all connections.
gearman_return_t gearman_echo(gearman_universal_st&, const void *workload, size_t workload_size);

/**
 * Wait for I/O on connections.
 *
 */
gearman_return_t gearman_wait(gearman_universal_st&);

void gearman_nap(gearman_universal_st &self);

void gearman_nap(int arg);

static inline void gearman_universal_add_options(gearman_universal_st &self, universal_options_t options)
{
  (void)gearman_universal_set_option(self, options, true);
}

static inline void gearman_universal_remove_options(gearman_universal_st &self, universal_options_t options)
{
  (void)gearman_universal_set_option(self, options, false);
}

gearman_id_t gearman_universal_id(gearman_universal_st &universal);

gearman_return_t gearman_set_identifier(gearman_universal_st& universal,
                                        const char *id,
                                        size_t id_size);

const char *gearman_univeral_namespace(gearman_universal_st& universal);

gearman_return_t gearman_server_option(gearman_universal_st&, gearman_string_t&);


text:
"""Tests for the Start.ca sensor platform."""
from homeassistant.bootstrap import async_setup_component
from homeassistant.components.startca.sensor import StartcaData
from homeassistant.helpers.aiohttp_client import async_get_clientsession

async def test_capped_setup(hass, aioclient_mock):
    """Test the default setup."""
    config = {
        "platform": "startca",
        "api_key": "NOTAKEY",
        "total_bandwidth": 400,
        "monitored_variables": [
            "usage",
            "usage_gb",
            "limit",
            "used_download",
            "used_upload",
            "used_total",
            "grace_download",
            "grace_upload",
            "grace_total",
            "total_download",
            "total_upload",
            "used_remaining",
        ],
    }

    result = (
        '<?xml version="1.0" encoding="ISO-8859-15"?>'
        "<usage>"
        "<version>1.1</version>"
        "<total> <!-- total actual usage -->"
        "<download>304946829777</download>"
        "<upload>6480700153</upload>"
        "</total>"
        "<used> <!-- part of usage that counts against quota -->"
        "<download>304946829777</download>"
        "<upload>6480700153</upload>"
        "</used>"
        "<grace> <!-- part of usage that is free -->"
        "<download>304946829777</download>"
        "<upload>6480700153</upload>"
        "</grace>"
        "</usage>"
    )
    aioclient_mock.get(
        "https://www.start.ca/support/usage/api?key=NOTAKEY", text=result
    )

    await async_setup_component(hass, "sensor", {"sensor": config})

    state = hass.states.get("sensor.start_ca_usage_ratio")
    assert state.attributes.get("unit_of_measurement") == "%"
    assert state.state == "76.24"

    state = hass.states.get("sensor.start_ca_usage")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "304.95"

    state = hass.states.get("sensor.start_ca_data_limit")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "400"

    state = hass.states.get("sensor.start_ca_used_download")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "304.95"

    state = hass.states.get("sensor.start_ca_used_upload")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "6.48"

    state = hass.states.get("sensor.start_ca_used_total")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "311.43"

    state = hass.states.get("sensor.start_ca_grace_download")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "304.95"

    state = hass.states.get("sensor.start_ca_grace_upload")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "6.48"

    state = hass.states.get("sensor.start_ca_grace_total")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "311.43"

    state = hass.states.get("sensor.start_ca_total_download")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "304.95"

    state = hass.states.get("sensor.start_ca_total_upload")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "6.48"

    state = hass.states.get("sensor.start_ca_remaining")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "95.05"

async def test_unlimited_setup(hass, aioclient_mock):
    """Test the default setup."""
    config = {
        "platform": "startca",
        "api_key": "NOTAKEY",
        "total_bandwidth": 0,
        "monitored_variables": [
            "usage",
            "usage_gb",
            "limit",
            "used_download",
            "used_upload",
            "used_total",
            "grace_download",
            "grace_upload",
            "grace_total",
            "total_download",
            "total_upload",
            "used_remaining",
        ],
    }

    result = (
        '<?xml version="1.0" encoding="ISO-8859-15"?>'
        "<usage>"
        "<version>1.1</version>"
        "<total> <!-- total actual usage -->"
        "<download>304946829777</download>"
        "<upload>6480700153</upload>"
        "</total>"
        "<used> <!-- part of usage that counts against quota -->"
        "<download>0</download>"
        "<upload>0</upload>"
        "</used>"
        "<grace> <!-- part of usage that is free -->"
        "<download>304946829777</download>"
        "<upload>6480700153</upload>"
        "</grace>"
        "</usage>"
    )
    aioclient_mock.get(
        "https://www.start.ca/support/usage/api?key=NOTAKEY", text=result
    )

    await async_setup_component(hass, "sensor", {"sensor": config})

    state = hass.states.get("sensor.start_ca_usage_ratio")
    assert state.attributes.get("unit_of_measurement") == "%"
    assert state.state == "0"

    state = hass.states.get("sensor.start_ca_usage")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "0.0"

    state = hass.states.get("sensor.start_ca_data_limit")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "inf"

    state = hass.states.get("sensor.start_ca_used_download")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "0.0"

    state = hass.states.get("sensor.start_ca_used_upload")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "0.0"

    state = hass.states.get("sensor.start_ca_used_total")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "0.0"

    state = hass.states.get("sensor.start_ca_grace_download")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "304.95"

    state = hass.states.get("sensor.start_ca_grace_upload")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "6.48"

    state = hass.states.get("sensor.start_ca_grace_total")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "311.43"

    state = hass.states.get("sensor.start_ca_total_download")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "304.95"

    state = hass.states.get("sensor.start_ca_total_upload")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "6.48"

    state = hass.states.get("sensor.start_ca_remaining")
    assert state.attributes.get("unit_of_measurement") == "GB"
    assert state.state == "inf"

async def test_bad_return_code(hass, aioclient_mock):
    """Test handling a return code that isn't HTTP OK."""
    aioclient_mock.get("https://www.start.ca/support/usage/api?key=NOTAKEY", status=404)

    scd = StartcaData(hass.loop, async_get_clientsession(hass), "NOTAKEY", 400)

    result = await scd.async_update()
    assert result is False

async def test_bad_json_decode(hass, aioclient_mock):
    """Test decoding invalid json result."""
    aioclient_mock.get(
        "https://www.start.ca/support/usage/api?key=NOTAKEY", text="this is not xml"
    )

    scd = StartcaData(hass.loop, async_get_clientsession(hass), "NOTAKEY", 400)

    result = await scd.async_update()
    assert result is False


text:
"use strict";

const DOMException = require("domexception");
const { filter, FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP } = require("./helpers");

const FIRST = false;
const LAST = true;
const NEXT = false;
const PREVIOUS = true;

exports.implementation = class TreeWalkerImpl {
  constructor(args, privateData) {
    this._active = false;
    this.root = privateData.root;
    this.whatToShow = privateData.whatToShow;
    this.filter = privateData.filter;

    this.currentNode = this.root;
  }

  get currentNode() {
    return this._currentNode;
  }

  set currentNode(node) {
    if (node === null) {
      throw new DOMException("Cannot set currentNode to null", "NotSupportedError");
    }

    this._currentNode = node;
  }

  parentNode() {
    let node = this._currentNode;
    while (node !== null && node !== this.root) {
      node = node.parentNode;

      if (node !== null && filter(this, node) === FILTER_ACCEPT) {
        return (this._currentNode = node);
      }
    }
    return null;
  }

  firstChild() {
    return this._traverseChildren(FIRST);
  }

  lastChild() {
    return this._traverseChildren(LAST);
  }

  previousSibling() {
    return this._traverseSiblings(PREVIOUS);
  }

  nextSibling() {
    return this._traverseSiblings(NEXT);
  }

  previousNode() {
    let node = this._currentNode;

    while (node !== this.root) {
      let sibling = node.previousSibling;

      while (sibling !== null) {
        node = sibling;
        let result = filter(this, node);

        while (result !== FILTER_REJECT && node.hasChildNodes()) {
          node = node.lastChild;
          result = filter(this, node);
        }

        if (result === FILTER_ACCEPT) {
          return (this._currentNode = node);
        }

        sibling = node.previousSibling;
      }

      if (node === this.root || node.parentNode === null) {
        return null;
      }

      node = node.parentNode;

      if (filter(this, node) === FILTER_ACCEPT) {
        return (this._currentNode = node);
      }
    }

    return null;
  }

  nextNode() {
    let node = this._currentNode;
    let result = FILTER_ACCEPT;

    for (;;) {
      while (result !== FILTER_REJECT && node.hasChildNodes()) {
        node = node.firstChild;
        result = filter(this, node);
        if (result === FILTER_ACCEPT) {
          return (this._currentNode = node);
        }
      }

      do {
        if (node === this.root) {
          return null;
        }

        const sibling = node.nextSibling;

        if (sibling !== null) {
          node = sibling;
          break;
        }

        node = node.parentNode;
      } while (node !== null);

      if (node === null) {
        return null;
      }

      result = filter(this, node);

      if (result === FILTER_ACCEPT) {
        return (this._currentNode = node);
      }
    }
  }

  _traverseChildren(type) {
    let node = this._currentNode;
    node = type === FIRST ? node.firstChild : node.lastChild;

    if (node === null) {
      return null;
    }

    main: for (;;) {
      const result = filter(this, node);

      if (result === FILTER_ACCEPT) {
        return (this._currentNode = node);
      }

      if (result === FILTER_SKIP) {
        const child = type === FIRST ? node.firstChild : node.lastChild;

        if (child !== null) {
          node = child;
          continue;
        }
      }

      for (;;) {
        const sibling = type === FIRST ? node.nextSibling : node.previousSibling;

        if (sibling !== null) {
          node = sibling;
          continue main;
        }

        const parent = node.parentNode;

        if (parent === null || parent === this.root || parent === this._currentNode) {
          return null;
        }

        node = parent;
      }
    }
  }

  _traverseSiblings(type) {
    let node = this._currentNode;

    if (node === this.root) {
      return null;
    }

    for (;;) {
      let sibling = type === NEXT ? node.nextSibling : node.previousSibling;

      while (sibling !== null) {
        node = sibling;
        const result = filter(this, node);

        if (result === FILTER_ACCEPT) {
          return (this._currentNode = node);
        }

        sibling = type === NEXT ? node.firstChild : node.lastChild;

        if (result === FILTER_REJECT || sibling === null) {
          sibling = type === NEXT ? node.nextSibling : node.previousSibling;
        }
      }

      node = node.parentNode;

      if (node === null || node === this.root) {
        return null;
      }

      if (filter(this, node) === FILTER_ACCEPT) {
        return null;
      }
    }
  }
};


text:
namespace Xilium.CefGlue
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Runtime.InteropServices;
    using Xilium.CefGlue.Interop;

    /// <summary>
    /// Class representing a V8 stack frame handle. V8 handles can only be accessed
    /// from the thread on which they are created. Valid threads for creating a V8
    /// handle include the render process main thread (TID_RENDERER) and WebWorker
    /// threads. A task runner for posting tasks on the associated thread can be
    /// retrieved via the CefV8Context::GetTaskRunner() method.
    /// </summary>
    public sealed unsafe partial class CefV8StackFrame
    {
        /// <summary>
        /// Returns true if the underlying handle is valid and it can be accessed on
        /// the current thread. Do not call any other methods if this method returns
        /// false.
        /// </summary>
        public bool IsValid
        {
            get { return cef_v8stack_frame_t.is_valid(_self) != 0; }
        }

        /// <summary>
        /// Returns the name of the resource script that contains the function.
        /// </summary>
        public string ScriptName
        {
            get
            {
                var n_result = cef_v8stack_frame_t.get_script_name(_self);
                return cef_string_userfree.ToString(n_result);
            }
        }

        /// <summary>
        /// Returns the name of the resource script that contains the function or the
        /// sourceURL value if the script name is undefined and its source ends with
        /// a "//@ sourceURL=..." string.
        /// </summary>
        public string ScriptNameOrSourceUrl
        {
            get
            {
                var n_result = cef_v8stack_frame_t.get_script_name_or_source_url(_self);
                return cef_string_userfree.ToString(n_result);
            }
        }

        /// <summary>
        /// Returns the name of the function.
        /// </summary>
        public string FunctionName
        {
            get
            {
                var n_result = cef_v8stack_frame_t.get_function_name(_self);
                return cef_string_userfree.ToString(n_result);
            }
        }

        /// <summary>
        /// Returns the 1-based line number for the function call or 0 if unknown.
        /// </summary>
        public int LineNumber
        {
            get { return cef_v8stack_frame_t.get_line_number(_self); }
        }

        /// <summary>
        /// Returns the 1-based column offset on the line for the function call or 0 if
        /// unknown.
        /// </summary>
        public int Column
        {
            get { return cef_v8stack_frame_t.get_column(_self); }
        }

        /// <summary>
        /// Returns true if the function was compiled using eval().
        /// </summary>
        public bool IsEval
        {
            get { return cef_v8stack_frame_t.is_eval(_self) != 0; }
        }

        /// <summary>
        /// Returns true if the function was called as a constructor via "new".
        /// </summary>
        public bool IsConstructor
        {
            get { return cef_v8stack_frame_t.is_constructor(_self) != 0; }
        }
    }
}


text:
'use strict';

/**
 * @fileoverview Ensures all elements with a role attribute use a valid value.
 * See base class in axe-audit.js for audit() implementation.
 */

const AxeAudit = require('./axe-audit.js');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
  /** Title of an accesibility audit that evaluates if all elements have valid aria-role HTML attributes. This title is descriptive of the successful state and is shown to users when no user action is required. */
  title: '`[role]` values are valid',
  /** Title of an accesibility audit that evaluates if all elements have valid aria-role HTML attributes. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
  failureTitle: '`[role]` values are not valid',
  /** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
  description: 'ARIA roles must have valid values in order to perform their ' +
      'intended accessibility functions. ' +
      '[Learn more](https://web.dev/aria-roles/).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class AriaRoles extends AxeAudit {
  /**
   * @return {LH.Audit.Meta}
   */
  static get meta() {
    return {
      id: 'aria-roles',
      title: str_(UIStrings.title),
      failureTitle: str_(UIStrings.failureTitle),
      description: str_(UIStrings.description),
      requiredArtifacts: ['Accessibility'],
    };
  }
}

module.exports = AriaRoles;
module.exports.UIStrings = UIStrings;


text:
module Vitals::Reporters
  class InmemReporter < BaseReporter
    attr_accessor :reports
    attr_accessor :format

    def initialize
      flush
    end

    def flush
      @reports = []
    end

    def inc(m)
      @reports << { :inc => n( m ) }
    end

    def gauge(m, v)
      @reports << { :gauge => n( m ), :val => v }
    end

    def timing(m, v)
      @reports << { :timing => n( m ), :val => v }
    end

  private
    def n(m)
      Vitals::Utils.normalize_metric(m)
    end
  end
end


text:
/**
 *  @file Stopwatch.cpp
 *  @brief Implements: libxaos-core:timing/Stopwatch.h
 *
 *  This file provides implementations for the Stopwatch class.
 */

#include <utility>

#include "timing/Clock.h"
#include "timing/Stopwatch.h"

namespace libxaos {
    namespace timing {

        // Constructors
        Stopwatch::Stopwatch() : Stopwatch(1) {}
        Stopwatch::Stopwatch(unsigned short frames) :
                _time(Clock::getTime()), _frames(new Clock::Duration[frames]),
                _frameCount(frames), _frame(frames - 1), _framesWritten(0) {
            tick(); // Creating the Stopwatch starts its ticking.
        }
        Stopwatch::~Stopwatch() {
            //! @todo Replace this with a unique pointer
            if (_frames) delete[] _frames;
        }

        // Copy / Move Semantics
        Stopwatch::Stopwatch(const Stopwatch& other) :
                _time(Clock::getTime()),
                _frames(new Clock::Duration[other._frameCount]),
                _frameCount(other._frameCount), _frame(other._frame),
                _framesWritten(other._framesWritten) {
            for (int i = 0; i < _frameCount; i++) {
                _frames[i] = other._frames[i];
            }
        }
        Stopwatch& Stopwatch::operator=(const Stopwatch& other) {
            if (this != &other) {
                // Copy Time
                _time = other._time;

                // Copy _frames
                if (_frames) delete[] _frames;
                _frames = new Clock::Duration[_frameCount];

                for (int i = 0; i < _frameCount; i++) {
                    _frames[i] = other._frames[i];
                }

                // Copy other data points.
                _frameCount = other._frameCount;
                _frame = other._frame;
                _framesWritten = other._framesWritten;
            }
            return *this;
        }
        Stopwatch::Stopwatch(Stopwatch&& other) :
                _time(other._time), _frames(other._frames),
                _frameCount(other._frameCount), _frame(other._frame),
                _framesWritten(other._framesWritten) {
            other._frames = nullptr;
        }
        Stopwatch& Stopwatch::operator=(Stopwatch&& other) {
            if (this != &other) {
                std::swap(_time, other._time);
                std::swap(_frames, other._frames);
                std::swap(_frameCount, other._frameCount);
                std::swap(_frame, other._frame);
                std::swap(_framesWritten, other._framesWritten);

                // we don't have to delete _frames before we swap
                // since when the RValue is destroyed it will do it
                // for us.
            }
            return *this;
        }
    }
}


text:
namespace DEM::Anim
{
using PPoseClipBase = std::unique_ptr<class CPoseClipBase>;
using PSkeletonInfo = Ptr<class CSkeletonInfo>;
class CPoseTrack;

class CPoseClipBase
{
public:

	CPoseClipBase();
	virtual ~CPoseClipBase();

	virtual PPoseClipBase Clone() const = 0;
	virtual void          GatherSkeletonInfo(PSkeletonInfo& SkeletonInfo) = 0;
	virtual void          PlayInterval(float PrevTime, float CurrTime, bool IsLast, const CPoseTrack& Track, UPTR ClipIndex) = 0;
};

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/DECORATION/1.8.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/DECORATION/1.8.0 http://maven.apache.org/xsd/decoration-1.8.0.xsd">

   <skin>
      <groupId>com.bernardomg.maven.skins</groupId>
      <artifactId>docs-maven-skin</artifactId>
      <version>${site.skin.version}</version>
   </skin>

</project>


text:
typedef struct {
    unsigned char* key;
    int klen;
} Key;

typedef struct {
    unsigned char* nonce;
    int nlen;
} Nonce;

typedef struct {
    Key* secret;
    Key* pub;
} KeyPair;

typedef struct {
    char* msg; // padded with zeros
    int mlen;
    int padding;
} Encrypted;

typedef struct {
    char* msg; // padded with zeros
    int mlen;
    int padding;
} Decrypted;

int box_publicKeyLength();
int box_secretKeyLength();
int box_nonceLength();
int secretbox_keyLength();
int secretbox_nonceLength();

// Invent a new public/private key pair
// Caller responsible for freeing
KeyPair* newKeyPair();

// Return individual components
Key *getPublic(KeyPair* k);
Key *getSecret(KeyPair* k);

int keyLen(Key* k);
int keyIdx(Key* k, int i);

Key* mkKey(int len);
void setKeyIdx(Key* k, int i, int v);

Nonce* mkNonce(int len);
Nonce* mkNonceFromString(char* n);
void setNonceIdx(Nonce* n, int i, int v);

// Free a key/value pair (but not the individual keys)
void freeKeyPair(KeyPair* k);

// Public/private key encryption
Encrypted* do_crypto_box(char* m, Nonce* n, Key* pkey, Key* skey);
Decrypted* do_crypto_box_open(Encrypted* c, Nonce* n, Key* pkey, Key* skey);

// Symmetric key encryption
Encrypted* do_crypto_secretbox(char* m, Nonce* n, Key* key);
Decrypted* do_crypto_secretbox_open(Encrypted* c, Nonce* n, Key* key);

// Get the string from a decrypted object
char* getDec(Decrypted* dec);
int getDecSize(Decrypted *enc);

// Read/write encrypted values

Encrypted* newBox(int len);
Encrypted* newSecretBox(int len);

int getEncLen(Encrypted *enc);
int getEncSize(Encrypted *enc);
int getEncByte(Encrypted *enc, int b);
void setEncByte(Encrypted *enc, int i, int b);
void* getEncData(Encrypted *enc);
void setEncData(Encrypted *enc, void* buf);

#endif


text:
"""
    Setup file for pyddq.

    This file was generated with PyScaffold 2.5.6, a tool that easily
    puts up a scaffold for your new Python project. Learn more under:
    http://pyscaffold.readthedocs.org/
"""

import sys
import os
import glob
import subprocess
from setuptools import setup, Command

class IntegrationTestCommand(Command):
    description = "A command to run integration tests"
    user_options = [("jar=", None, "Path to Drunken Data Quality jar")]
    jar = None
    addopts = None

    def initialize_options(self):
        pass

    def finalize_options(self):
        if self.addopts is None:
            exit("error: option addopts should be specified in setup.cfg")
        elif self.jar is None:
            exit("error: path to Drunken Data Quality jar should be specified")

    def run(self):
        log4j_path = os.path.abspath("../src/test/resources/log4j.properties")
        result = 0
        try:
            for filename in glob.glob(os.path.join(self.addopts, "test_*.py")):
                result = result or subprocess.call([
                    "spark-submit",
                    "--driver-java-options",
                    '"-Dlog4j.configuration=file://{path}"'.format(path=log4j_path),
                    "--driver-class-path",
                    self.jar,
                    filename
                ])
        except OSError as e:
            if e.errno == os.errno.ENOENT:
                exit("spark-submit is not found!")
            else:
                exit(str(e))
        exit(result)

def setup_package():
    needs_sphinx = {'build_sphinx', 'upload_docs'}.intersection(sys.argv)
    sphinx = ['sphinx'] if needs_sphinx else []
    setup(setup_requires=['six', 'pyscaffold>=2.5a0,<2.6a0'] + sphinx,
          use_pyscaffold=True,
          cmdclass={
              "integration_test": IntegrationTestCommand
          })

if __name__ == "__main__":
    setup_package()


text:
class GeneralParams;

class IJobCreator
{
public:
    IJobCreator() = default;
    virtual ~IJobCreator() = default;
    virtual std::unique_ptr<Job> Create(int id, GeneralParams const * const params){
        throw core::Exception(SOURCE, "None supported operation");
    }
};

template<typename T>
class JobCreator : public IJobCreator
{
public:
    JobCreator() = default;
    virtual ~JobCreator() = default;
   std::unique_ptr<Job> Create(int id, GeneralParams const * const params) override {
        return std::unique_ptr<Job>(new T(id, params));
    }
};


text:
module Azure end
module Azure::Customimagesearch end
module Azure::Customimagesearch::Profiles end
module Azure::Customimagesearch::Profiles::Latest end


text:
__Pager is coming soon to the World Wide Web.__

In the meantime, you can browse through our original source code for our winning project, as submitted to [TechCrunch Disrupt NY 2015 Hackathon's ChallengePost](http://challengepost.com/software/pager).


text:
import { module, test } from 'qunit';
import hasMany from 'gatemedia-data/utils/has-many';

module('hasMany');

// Replace this with your real tests.
test('it works', function (assert) {
  var result = hasMany();
  assert.ok(result);
});


text:
<?php
/**
 *	OOTP Fantasy Leagues Home.
 *	The primary controller for the OOTP Fantasy Leagues Web site.
 *	@author			Jeff Fox
 *	@dateCreated	04/15/10
 *	@lastModified	05/04/10
 */
class home extends MY_Controller {

	/*--------------------------------
	/	VARIABLES
	/-------------------------------*/
	/**
	 *	SLUG.
	 *	@var $_NAME:Text
	 */
	var $_NAME = 'home';
	/*--------------------------------
	/	C'TOR
	/-------------------------------*/
	/**
	 *	Creates a new instance of home.
	 */
	public function home() {
		parent::MY_Controller();
		$this->enqueStyle('content.css');
	}
	/*--------------------------------
	/	PUBLIC FUNCTIONS
	/-------------------------------*/
	/**
	 *	INDEX.
	 *	The default handler when the controller is called.
	 */
	public function index() {
		// GET Fantasy Details
		$status = getFantasyStatus();
		$this->data['fantasyStatus'] = ($status == 1)? "Pre-Season" : "Active OOTP Season";
		$this->data['fantasyStatusID'] = $status;
		$this->data['fantasyStartDate'] = date('m/d/Y',(strtotime($this->params['config']['season_start'])));

		// GET OOTP League status
		$this->data['leagueStatus'] =  $this->ootp_league_model->get_state();
		$this->data['leagueName'] =  $this->ootp_league_model->name;
		$this->data['leagueAbbr'] =  $this->ootp_league_model->abbr;
		$this->data['events'] =  $this->ootp_league_model->getNextEvents();
		$lastprocess = $this->params['config']['last_process_time'];
		if ($lastprocess != EMPTY_DATE_TIME_STR && $lastprocess != EMPTY_DATE_STR) {
			$this->data['nextSimDate'] =  date('m/d/Y',(strtotime($lastprocess) + ((60*60*24)*3)));
		} else {
			$this->data['nextSimDate'] = "Not yet determined";
		}
		$this->data['current_date'] =  date('m/d/Y',(strtotime($this->ootp_league_model->current_date)));

		// GET LATEST NEWS ARTICLE FOR THIS LEAGUE
		$this->load->model('news_model');
		$this->data['news'] = $this->news_model->getNewsByParams(NEWS_FANTASY_GAME);

		$this->data['leagues'] = $this->league_model->getLeagues($this->params['config']['ootp_league_id']);
		$this->data['splashContent'] = $this->load->view('home_splash', false, true);
		$this->params['content'] = $this->load->view('homepage', $this->data, true);
		$this->params['subTitle'] = "Welcome to OOTP Fantasy Leagues";
	    $this->displayView();
	}

}
/* End of file home.php */
/* Location: ./application/controllers/home.php */


text:
<?php
/**
 * The base configurations of the WordPress.
 *
 * This file has the following configurations: MySQL settings, Table Prefix,
 * Secret Keys, and ABSPATH. You can find more information by visiting
 * {@link http://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php}
 * Codex page. You can get the MySQL settings from your web host.
 *
 * This file is used by the wp-config.php creation script during the
 * installation. You don't have to use the web site, you can just copy this file
 * to "wp-config.php" and fill in the values.
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'huescans');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'ru19BE28ns37@');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'Pe=]n:u|?q6.XyUUZ0B[zFn!{0^RohR=d01+6Q9mKA%K-kv3 f;0i.W[6Evy+p5=');
define('SECURE_AUTH_KEY',  'VOFIVAW,?3PoAAKOs|^T`=EwUL27r=5;z|w%[fpe@$%on>ihT? LC/s.g32VZx}z');
define('LOGGED_IN_KEY',    'pCmtOnpU@CCsw[e}iOnmHwJKPXy9&YT.XocoT.Z<t=U+zk`uuAVIovIx=L<ENSS2');
define('NONCE_KEY',        '<w^Q!;4f5W<O+?^Ac:|x3K$3R$O*D+PfP@(5B8llM!6B]Aio$]?;Dk|d2yUB%@?2');
define('AUTH_SALT',        '(!!aY-UI/sqqD2d?00&V%|j [A@mMJ b9Xo@{+s7(U.${DtPyU6wG(?e(MbA@X:G');
define('SECURE_AUTH_SALT', ';gYW+5sq9vx_t32>;Eck/)AGWq-n6o9Zo!AVqYu?SSiHZ%YS$J#9QUk2A_KTQ#L2');
define('LOGGED_IN_SALT',   'J@AM-Sk&p&V<I_Q/Bt2hSVmNz)dnG0Kqw1lR+(m:^HTsIkA`Di;r~MjgfX`PGd<&');
define('NONCE_SALT',       '|YhK+ }?l4g5$`MYP 3*T&.Iie6=$CHi[xNil+-0j!fsMkt$8BOKz=zRx71$9Wr+');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
	define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');


text:
class GFXTextureObject;

/// Helper struct for gathering profile stats.
class GFXTextureProfileStats
{
public:

   /// Constructs and clears the stats.
   GFXTextureProfileStats() { clear(); }

   /// Zeros all the stats.
   void clear()
   {
      dMemset( this, 0, sizeof( GFXTextureProfileStats ) );
   }

   /// Adds stats together.
   GFXTextureProfileStats& operator += ( const GFXTextureProfileStats &stats )
   {
      activeCount += stats.activeCount;
      activeTexels += stats.activeTexels;
      activeBytes += stats.activeBytes;
      allocatedTextures += stats.allocatedTextures;
      allocatedTexels += stats.allocatedTexels;
      allocatedBytes += stats.allocatedBytes;
      return *this;
   }

   U32 activeCount;       ///< Count of textures of this profile type allocated.
   U32 activeTexels;      ///< Amount of texelspace currently allocated under this profile.
   U32 activeBytes;       ///< Amount of storage currently allocated under this profile.
   U32 allocatedTextures; ///< Total number of textures allocated under this profile.
   U32 allocatedTexels;   ///< Total number of texels allocated under this profile.
   U32 allocatedBytes;    ///< Total number of bytes allocated under this profile.
};

class GFXTextureProfile
{
public:
   enum Types
   {
      DiffuseMap,
      NormalMap,
      AlphaMap,
      LuminanceMap
   };

   enum Flags
   {
      PreserveSize   = BIT(0),  ///< Never shrink this bitmap in low VRAM situations.
      NoMipmap       = BIT(1),  ///< Do not generate mipmap chain for this texture.
      SystemMemory   = BIT(2),  ///< System memory texture - isn't uploaded to card - useful as target for copying surface data out of video ram
      RenderTarget   = BIT(3),  ///< This texture will be used as a render target.
      Dynamic        = BIT(4),  ///< This texture may be refreshed. (Precludes Static)
      Static         = BIT(5),  ///< This texture will never be modified once loaded. (Precludes Dynamic)
      NoPadding      = BIT(6),  ///< Do not pad this texture if it's non pow2.
      KeepBitmap     = BIT(7),  ///< Always keep a copy of this texture's bitmap. (Potentially in addition to the API managed copy?)
      ZTarget        = BIT(8),  ///< This texture will be used as a Z target.

      /// Track and pool textures of this type for reuse.
      ///
      /// You should use this profile flag sparingly.  Odd
      /// sized textures and spikes in allocation can cause
      /// the pool to contain unused textures which will remain
      /// in memory until a flush occurs.
      ///
      Pooled = BIT(9),

      /// A hint that the device is not allowed to discard the content
      /// of a target texture after presentation or deactivated.
      ///
      /// This is mainly a depth buffer optimization.
      NoDiscard = BIT(10),

      /// Texture is managed by another process, thus should not be modified
      NoModify = BIT(11)

   };

   enum Compression
   {
      NONE,
      DXT1,
      DXT2,
      DXT3,
      DXT4,
      DXT5,
   };

   GFXTextureProfile(const String &name, Types type, U32 flags, Compression compression = NONE);

   // Accessors
   String getName() const { return mName; };
   Types getType() const { return (Types)(mProfile & (BIT(TypeBits) - 1)); }
   const Compression getCompression() const { return (Compression)((mProfile >> (FlagBits + TypeBits)) & (BIT(CompressionBits + 1) - 1)); };

   bool testFlag(Flags flag)  const
   {
      return (mProfile & (flag << TypeBits)) != 0;
   }

   // Mutators
   const U32 getDownscale() const { return mDownscale; }
   void setDownscale(const U32 shift) { mDownscale = shift; }
   void incActiveCopies() { mStats.activeCount++; }
   void decActiveCopies() { AssertFatal( mStats.activeCount != 0, "Ran out of extant copies!"); mStats.activeCount--; }

   // And static interface...
   static void init();
   static GFXTextureProfile *find(const String &name);
   static void updateStatsForCreation(GFXTextureObject *t);
   static void updateStatsForDeletion(GFXTextureObject *t);

   /// Collects the total stats for all the profiles which
   /// include any of the flag bits.
   static void collectStats( Flags flags, GFXTextureProfileStats *stats );

   /// Returns the total profile count in the list.
   static U32 getProfileCount() { return smProfileCount; }

   /// Returns the head of the profile list.
   static GFXTextureProfile* getHead() { return smHead; }

   /// Returns the next profile in the list.
   GFXTextureProfile* getNext() const { return mNext; }

   /// Returns the allocation stats for this texture profile.
   inline const GFXTextureProfileStats& getStats() const { return mStats; }

   // Helper functions...
   inline bool doStoreBitmap() const { return testFlag(KeepBitmap); }
   inline bool canDownscale() const { return !testFlag(PreserveSize); }
   inline bool isDynamic() const { return testFlag(Dynamic); }
   inline bool isRenderTarget() const { return testFlag(RenderTarget); }
   inline bool isZTarget() const { return testFlag(ZTarget); }
   inline bool isSystemMemory() const { return testFlag(SystemMemory); }
   inline bool noMip() const { return testFlag(NoMipmap); }
   inline bool isPooled() const { return testFlag(Pooled); }
   inline bool canDiscard() const { return !testFlag(NoDiscard); }
   inline bool canModify() const { return !testFlag(NoModify); }

private:
   /// These constants control the packing for the profile; if you add flags, types, or
   /// compression info then make sure these are giving enough bits!
   enum Constants
   {
      TypeBits = 2,
      FlagBits = 11,
      CompressionBits = 3,
   };

   String    mName;        ///< Name of this profile...
   U32 mDownscale;         ///< Amount to shift textures of this type down, if any.
   U32 mProfile;           ///< Stores a munged version of the profile data.
   U32 mActiveCount;       ///< Count of textures of this profile type allocated.
   U32 mActiveTexels;      ///< Amount of texelspace currently allocated under this profile.
   U32 mActiveBytes;       ///< Amount of storage currently allocated under this profile.
   U32 mAllocatedTextures; ///< Total number of textures allocated under this profile.
   U32 mAllocatedTexels;   ///< Total number of texels allocated under this profile.
   U32 mAllocatedBytes;    ///< Total number of bytes allocated under this profile.

   /// The texture profile stats.
   GFXTextureProfileStats mStats;

   /// The number of profiles in the system.
   static U32 smProfileCount;

   /// Keep a list of all the profiles.
   GFXTextureProfile *mNext;
   static GFXTextureProfile *smHead;
};

#define GFX_DeclareTextureProfile(name)  extern GFXTextureProfile name
#define GFX_ImplementTextureProfile(name, type,  flags, compression) GFXTextureProfile name(#name, type, flags, compression)

// Set up some defaults..

// Texture we can render to.
GFX_DeclareTextureProfile(GFXDefaultRenderTargetProfile);
// Standard diffuse texture that stays in system memory.
GFX_DeclareTextureProfile(GFXDefaultPersistentProfile);
// Generic diffusemap. This works in most cases.
GFX_DeclareTextureProfile(GFXDefaultStaticDiffuseProfile);
// Generic normal map.
GFX_DeclareTextureProfile(GFXDefaultStaticNormalMapProfile);
// DXT5 swizzled normal map
GFX_DeclareTextureProfile(GFXDefaultStaticDXT5nmProfile);
// Texture that resides in system memory - used to copy data to
GFX_DeclareTextureProfile(GFXSystemMemProfile);
// Depth buffer texture
GFX_DeclareTextureProfile(GFXDefaultZTargetProfile);
// Dynamic Texure
GFX_DeclareTextureProfile(GFXDynamicTextureProfile);

#endif


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace Liferay.SDK.Service.V62.ResourceBlock
{
	public class ResourceBlockService : ServiceBase
	{
		public ResourceBlockService(ISession session)
			: base(session)
		{
		}

		public async Task AddCompanyScopePermissionAsync(long scopeGroupId, long companyId, string name, long roleId, string actionId)
		{
			var _parameters = new JsonObject();

			_parameters.Add("scopeGroupId", scopeGroupId);
			_parameters.Add("companyId", companyId);
			_parameters.Add("name", name);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionId", actionId);

			var _command = new JsonObject()
			{
				{ "/resourceblock/add-company-scope-permission", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task AddGroupScopePermissionAsync(long scopeGroupId, long companyId, long groupId, string name, long roleId, string actionId)
		{
			var _parameters = new JsonObject();

			_parameters.Add("scopeGroupId", scopeGroupId);
			_parameters.Add("companyId", companyId);
			_parameters.Add("groupId", groupId);
			_parameters.Add("name", name);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionId", actionId);

			var _command = new JsonObject()
			{
				{ "/resourceblock/add-group-scope-permission", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task AddIndividualScopePermissionAsync(long companyId, long groupId, string name, long primKey, long roleId, string actionId)
		{
			var _parameters = new JsonObject();

			_parameters.Add("companyId", companyId);
			_parameters.Add("groupId", groupId);
			_parameters.Add("name", name);
			_parameters.Add("primKey", primKey);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionId", actionId);

			var _command = new JsonObject()
			{
				{ "/resourceblock/add-individual-scope-permission", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task RemoveAllGroupScopePermissionsAsync(long scopeGroupId, long companyId, string name, long roleId, string actionId)
		{
			var _parameters = new JsonObject();

			_parameters.Add("scopeGroupId", scopeGroupId);
			_parameters.Add("companyId", companyId);
			_parameters.Add("name", name);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionId", actionId);

			var _command = new JsonObject()
			{
				{ "/resourceblock/remove-all-group-scope-permissions", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task RemoveCompanyScopePermissionAsync(long scopeGroupId, long companyId, string name, long roleId, string actionId)
		{
			var _parameters = new JsonObject();

			_parameters.Add("scopeGroupId", scopeGroupId);
			_parameters.Add("companyId", companyId);
			_parameters.Add("name", name);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionId", actionId);

			var _command = new JsonObject()
			{
				{ "/resourceblock/remove-company-scope-permission", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task RemoveGroupScopePermissionAsync(long scopeGroupId, long companyId, long groupId, string name, long roleId, string actionId)
		{
			var _parameters = new JsonObject();

			_parameters.Add("scopeGroupId", scopeGroupId);
			_parameters.Add("companyId", companyId);
			_parameters.Add("groupId", groupId);
			_parameters.Add("name", name);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionId", actionId);

			var _command = new JsonObject()
			{
				{ "/resourceblock/remove-group-scope-permission", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task RemoveIndividualScopePermissionAsync(long companyId, long groupId, string name, long primKey, long roleId, string actionId)
		{
			var _parameters = new JsonObject();

			_parameters.Add("companyId", companyId);
			_parameters.Add("groupId", groupId);
			_parameters.Add("name", name);
			_parameters.Add("primKey", primKey);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionId", actionId);

			var _command = new JsonObject()
			{
				{ "/resourceblock/remove-individual-scope-permission", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task SetCompanyScopePermissionsAsync(long scopeGroupId, long companyId, string name, long roleId, IEnumerable<string> actionIds)
		{
			var _parameters = new JsonObject();

			_parameters.Add("scopeGroupId", scopeGroupId);
			_parameters.Add("companyId", companyId);
			_parameters.Add("name", name);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionIds", actionIds);

			var _command = new JsonObject()
			{
				{ "/resourceblock/set-company-scope-permissions", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task SetGroupScopePermissionsAsync(long scopeGroupId, long companyId, long groupId, string name, long roleId, IEnumerable<string> actionIds)
		{
			var _parameters = new JsonObject();

			_parameters.Add("scopeGroupId", scopeGroupId);
			_parameters.Add("companyId", companyId);
			_parameters.Add("groupId", groupId);
			_parameters.Add("name", name);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionIds", actionIds);

			var _command = new JsonObject()
			{
				{ "/resourceblock/set-group-scope-permissions", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task SetIndividualScopePermissionsAsync(long companyId, long groupId, string name, long primKey, IDictionary<string, object> roleIdsToActionIds)
		{
			var _parameters = new JsonObject();

			_parameters.Add("companyId", companyId);
			_parameters.Add("groupId", groupId);
			_parameters.Add("name", name);
			_parameters.Add("primKey", primKey);
			_parameters.Add("roleIdsToActionIds", roleIdsToActionIds);

			var _command = new JsonObject()
			{
				{ "/resourceblock/set-individual-scope-permissions", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}

		public async Task SetIndividualScopePermissionsAsync(long companyId, long groupId, string name, long primKey, long roleId, IEnumerable<string> actionIds)
		{
			var _parameters = new JsonObject();

			_parameters.Add("companyId", companyId);
			_parameters.Add("groupId", groupId);
			_parameters.Add("name", name);
			_parameters.Add("primKey", primKey);
			_parameters.Add("roleId", roleId);
			_parameters.Add("actionIds", actionIds);

			var _command = new JsonObject()
			{
				{ "/resourceblock/set-individual-scope-permissions", _parameters }
			};

			await this.Session.InvokeAsync(_command);
		}
	}
}


text:
function Stack() {
  this.store = [];
}

Stack.prototype.peek = function() {
  return this.store[this.store.length - 1];
}

Stack.prototype.push = function(item) {
  this.store.push(item);
}

Stack.prototype.pop = function () {
  return this.store.pop();
}

Stack.prototype.isEmpty = function() {
  return this.store.length === 0;
}

function Queue() {
  this.stack1 = new Stack;
  this.stack2 = new Stack;
}

Queue.prototype.first = function() {
  this.moveToStack2();
  return this.stack2.peek();
}

Queue.prototype.last = function() {
  this.moveToStack1();
  return this.stack1.peek();
}

Queue.prototype.enqueue = function(item) {
  this.moveToStack1();
  this.stack1.push(item);
}

Queue.prototype.dequeue = function() {
  this.moveToStack2();
  return this.stack2.pop();
}

Queue.prototype.isEmpty = function() {
  if (this.stack1.isEmpty() && this.stack2.isEmpty()) {
    return true;
  } else {
    return false;
  }
}

// Helpers...

Queue.prototype.moveToStack2 = function(){
  while (this.stack1.isEmpty() === false) {
    this.stack2.push(this.stack1.pop());
  }
}

Queue.prototype.moveToStack1 = function () {
  while (this.stack2.isEmpty() === false) {
    this.stack1.push(this.stack2.pop());
  }
}

var q = new Queue;
console.log(q.isEmpty() === true);

q.enqueue(1);
q.enqueue(2);
q.enqueue(3);

console.log(q.first() === 1);
console.log(q.last() === 3);
console.log(q.dequeue() === 1);
console.log(q.dequeue() === 2);
console.log(q.isEmpty() === false);
console.log(q.dequeue() === 3);
console.log(q.isEmpty() === true);


text:
REM COPY p6spy version of cdecurate-oracle-ds.xml into C:\apps\jboss-5.1.0.GA\server\default\deploy
REM COPY p6spy.jar *** manually *** into C:\apps\jboss-5.1.0.GA\server\default\lib
REM COPY spy.properties *** manually *** into C:\Apps\jboss-5.1.0.GA\server\default\deploy\cdecurate.war\WEB-INF\classes !!!

del /q C:\apps\jboss-5.1.0.GA\server\default\deploy\*-ds.xml

call cp6spy.cmd

REM overwrite with local DSRDEV
copy %USERPROFILE%\Desktop\cadsr-cdecurate\conf\cdecurate-oracle-ds.xml.p6spy.local C:\apps\jboss-5.1.0.GA\server\default\deploy\cdecurate-oracle-ds.xml

:pause


text:
package mil.nga.giat.geowave.analytics.clustering;

import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

import mil.nga.giat.geowave.accumulo.AccumuloOperations;
import mil.nga.giat.geowave.accumulo.BasicAccumuloOperations;
import mil.nga.giat.geowave.accumulo.metadata.AccumuloIndexStore;
import mil.nga.giat.geowave.analytics.extract.DimensionExtractor;
import mil.nga.giat.geowave.analytics.parameters.CentroidParameters;
import mil.nga.giat.geowave.analytics.parameters.CommonParameters;
import mil.nga.giat.geowave.analytics.parameters.GlobalParameters;
import mil.nga.giat.geowave.analytics.tools.AnalyticFeature;
import mil.nga.giat.geowave.analytics.tools.PropertyManagement;
import mil.nga.giat.geowave.analytics.tools.dbops.AccumuloAdapterStoreFactory;
import mil.nga.giat.geowave.analytics.tools.dbops.AdapterStoreFactory;
import mil.nga.giat.geowave.analytics.tools.dbops.BasicAccumuloOperationsFactory;
import mil.nga.giat.geowave.analytics.tools.dbops.DirectBasicAccumuloOperationsFactory;
import mil.nga.giat.geowave.index.ByteArrayId;
import mil.nga.giat.geowave.index.ByteArrayRange;
import mil.nga.giat.geowave.index.NumericIndexStrategyFactory.DataType;
import mil.nga.giat.geowave.store.adapter.AdapterStore;
import mil.nga.giat.geowave.store.adapter.DataAdapter;
import mil.nga.giat.geowave.store.index.CustomIdIndex;
import mil.nga.giat.geowave.store.index.DimensionalityType;
import mil.nga.giat.geowave.store.index.Index;
import mil.nga.giat.geowave.store.index.IndexType;
import mil.nga.giat.geowave.store.query.SpatialQuery;
import mil.nga.giat.geowave.vector.adapter.FeatureDataAdapter;

import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.geotools.feature.type.BasicFeatureTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.vividsolutions.jts.geom.Polygon;

public class ClusteringUtils
{

	public static final String CLUSTERING_CRS = "EPSG:4326";

	final static Logger LOGGER = LoggerFactory.getLogger(ClusteringUtils.class);

	private static Index createIndex(
			final String indexId,
			final String zookeeper,
			final String accumuloInstance,
			final String accumuloUser,
			final String accumuloPassword,
			final String namespace )
			throws Exception {

		final AccumuloOperations operations = new BasicAccumuloOperations(
				zookeeper,
				accumuloInstance,
				accumuloUser,
				accumuloPassword,
				namespace);

		final AccumuloIndexStore indexStore = new AccumuloIndexStore(
				operations);

		final ByteArrayId dbId = new ByteArrayId(
				indexId);
		if (!indexStore.indexExists(dbId)) {
			if (indexId.equals(IndexType.SPATIAL_VECTOR.getDefaultId())) {
				final Index index = IndexType.SPATIAL_VECTOR.createDefaultIndex();
				indexStore.addIndex(index);
				return index;
			}
			else if (indexId.equals(IndexType.SPATIAL_TEMPORAL_VECTOR.getDefaultId())) {
				final Index index = IndexType.SPATIAL_TEMPORAL_VECTOR.createDefaultIndex();
				indexStore.addIndex(index);
				return index;
			}
			else {
				final Index index = new CustomIdIndex(
						IndexType.SPATIAL_VECTOR.createDefaultIndexStrategy(),
						IndexType.SPATIAL_VECTOR.getDefaultIndexModel(),
						DimensionalityType.SPATIAL,
						DataType.VECTOR,
						new ByteArrayId(
								indexId));
				indexStore.addIndex(index);
				return index;
			}
		}
		else {
			return indexStore.getIndex(dbId);
		}

	}

	private static DataAdapter<?> createAdapter(
			final String sampleDataTypeId,
			final String sampleDataNamespaceURI,
			final AdapterStore adapterStore,
			final String[] dimensionNames )
			throws Exception {

		final FeatureDataAdapter adapter = AnalyticFeature.createGeometryFeatureAdapter(
				sampleDataTypeId,
				dimensionNames,
				sampleDataNamespaceURI,
				CLUSTERING_CRS);

		final ByteArrayId dbId = new ByteArrayId(
				sampleDataTypeId);
		if (!adapterStore.adapterExists(dbId)) {
			adapterStore.addAdapter(adapter);
			return adapter;
		}
		else {
			return adapterStore.getAdapter(dbId);
		}

	}

	public static DataAdapter[] getAdapters(
			PropertyManagement propertyManagement )
			throws IOException {
		BasicAccumuloOperations ops;
		try {

			final AdapterStore adapterStore = propertyManagement.getClassInstance(
					CommonParameters.Common.ADAPTER_STORE_FACTORY,
					AdapterStoreFactory.class,
					AccumuloAdapterStoreFactory.class).getAdapterStore(
					propertyManagement);

			final mil.nga.giat.geowave.store.CloseableIterator<DataAdapter<?>> it = adapterStore.getAdapters();
			final List<DataAdapter> adapters = new LinkedList<DataAdapter>();
			while (it.hasNext()) {
				adapters.add(it.next());
			}

			final DataAdapter[] result = new DataAdapter[adapters.size()];
			adapters.toArray(result);
			return result;
		}
		catch (InstantiationException e) {
			throw new IOException(
					e);
		}
	}

	public static Index[] getIndices(
			PropertyManagement propertyManagement ) {
		BasicAccumuloOperations ops;
		final String zookeeper = propertyManagement.getPropertyAsString(
				GlobalParameters.Global.ZOOKEEKER,
				"localhost:2181");
		final String accumuloInstance = propertyManagement.getPropertyAsString(
				GlobalParameters.Global.ACCUMULO_INSTANCE,
				"miniInstance");

		try {
			ops = propertyManagement.getClassInstance(
					CommonParameters.Common.ACCUMULO_CONNECT_FACTORY,
					BasicAccumuloOperationsFactory.class,
					DirectBasicAccumuloOperationsFactory.class).build(
					zookeeper,
					accumuloInstance,
					propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_USER),
					propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_PASSWORD),
					propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_NAMESPACE));

			final AccumuloIndexStore indexStore = new AccumuloIndexStore(
					ops);
			final mil.nga.giat.geowave.store.CloseableIterator<Index> it = indexStore.getIndices();
			final List<Index> indices = new LinkedList<Index>();
			while (it.hasNext()) {
				indices.add(it.next());
			}

			final Index[] result = new Index[indices.size()];
			indices.toArray(result);
			return result;
		}
		catch (final AccumuloException e) {
			LOGGER.error(
					"Cannot connect to GeoWave for Index Inquiry (" + accumuloInstance + "@ " + zookeeper + ")",
					e);
		}
		catch (final AccumuloSecurityException e) {
			LOGGER.error(
					"Cannot connect to GeoWave for Index Inquiry (" + accumuloInstance + "@ " + zookeeper + ")",
					e);
		}
		catch (InstantiationException e) {
			LOGGER.error(
					"cannot connect to GeoWave ",
					e);
		}
		return new Index[] {
			IndexType.SPATIAL_VECTOR.createDefaultIndex()
		};
	}

	/*
	 * Method takes in a polygon and generates the corresponding ranges in a
	 * GeoWave spatial index
	 */
	protected static List<ByteArrayRange> getGeoWaveRangesForQuery(
			final Polygon polygon ) {

		final Index index = IndexType.SPATIAL_VECTOR.createDefaultIndex();
		final List<ByteArrayRange> ranges = index.getIndexStrategy().getQueryRanges(
				new SpatialQuery(
						polygon).getIndexConstraints(index.getIndexStrategy()));

		return ranges;
	}

	public static Index createIndex(
			final PropertyManagement propertyManagement )
			throws Exception {
		return ClusteringUtils.createIndex(
				propertyManagement.getPropertyAsString(CentroidParameters.Centroid.INDEX_ID),
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ZOOKEEKER),
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_INSTANCE),
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_USER),
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_PASSWORD),
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_NAMESPACE));

	}

	public static BasicAccumuloOperations createOperations(
			final PropertyManagement propertyManagement )
			throws Exception {
		return propertyManagement.getClassInstance(
				CommonParameters.Common.ACCUMULO_CONNECT_FACTORY,
				BasicAccumuloOperationsFactory.class,
				DirectBasicAccumuloOperationsFactory.class).build(
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ZOOKEEKER),
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_INSTANCE),
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_USER),
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_PASSWORD),
				propertyManagement.getPropertyAsString(GlobalParameters.Global.ACCUMULO_NAMESPACE));

	}

	public static DataAdapter<?> createAdapter(
			final PropertyManagement propertyManagement )
			throws Exception {

		Class<DimensionExtractor> dimensionExtractorClass = propertyManagement.getPropertyAsClass(
				CommonParameters.Common.DIMENSION_EXTRACT_CLASS,
				DimensionExtractor.class);

		return ClusteringUtils.createAdapter(
				propertyManagement.getPropertyAsString(CentroidParameters.Centroid.DATA_TYPE_ID),
				propertyManagement.getPropertyAsString(
						CentroidParameters.Centroid.DATA_NAMESPACE_URI,
						BasicFeatureTypes.DEFAULT_NAMESPACE),
				propertyManagement.getClassInstance(
						CommonParameters.Common.ADAPTER_STORE_FACTORY,
						AdapterStoreFactory.class,
						AccumuloAdapterStoreFactory.class).getAdapterStore(
						propertyManagement),
				dimensionExtractorClass.newInstance().getDimensionNames());
	}
}


text:
using System.Collections.Generic;
using System.Globalization;

namespace KataNetHack.Tests
{
    public class StageItemBuilder
    {
        private int NumberItems => _width*_height;
        private int _exitPosition;
        private int _width = 10;
        private int _height = 10;

        public StageItemBuilder WithWidth(int width)
        {
            _width = width;
            return this;
        }

        public StageItemBuilder WithHeight(int height)
        {
            _height = height;
            return this;
        }

        public IEnumerable<char> Build()
        {
            if (_exitPosition == 0)
            {
                _exitPosition = CalculateAnExitPoistion();
            }
            for (int i = 0; i < NumberItems; i++)
            {
                if (IsTopWall(i) || IsBottomWall(i) || IsLeftWall(i) || IsRightWall(i))
                {
                    yield return '=';
                }
                else if (i == _exitPosition)
                {
                    yield return '*';
                }
                else
                {
                    yield return ' ';
                }
            }

        }

        private int CalculateAnExitPoistion()
        {
            return NumberItems - _width - 2;// 1 for zero based index and 1 for rigt side wall
        }

        private bool IsLeftWall(int i)
        {
            return i % _width == 0;
        }

        private bool IsRightWall(int i)
        {
            var row = i/_width;
            var sub = row*_width;
            var diff = i - sub;
            var b = (diff + 1) == _width;
            return b;
        }

        private bool IsBottomWall(int i)
        {
            return i > ( NumberItems - _width - 1 );
        }

        private bool IsTopWall(int i)
        {
            return i < _width;
        }
    }
}


text:
package org.apache.camel.component.chunk;

import java.util.Map;

import org.apache.camel.Endpoint;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Component;
import org.apache.camel.support.DefaultComponent;

@Component("chunk")
public class ChunkComponent extends DefaultComponent {

    @Metadata(defaultValue = "false")
    private boolean allowTemplateFromHeader;
    @Metadata(defaultValue = "false")
    private boolean allowContextMapAll;

    public ChunkComponent() {
    }

    @Override
    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
        ChunkEndpoint endpoint = new ChunkEndpoint(uri, this, remaining);
        endpoint.setAllowTemplateFromHeader(allowTemplateFromHeader);
        endpoint.setAllowContextMapAll(allowContextMapAll);
        setProperties(endpoint, parameters);
        return endpoint;
    }

    public boolean isAllowTemplateFromHeader() {
        return allowTemplateFromHeader;
    }

    /**
     * Whether to allow to use resource template from header or not (default false).
     *
     * Enabling this allows to specify dynamic templates via message header. However this can
     * be seen as a potential security vulnerability if the header is coming from a malicious user, so use this with care.
     */
    public void setAllowTemplateFromHeader(boolean allowTemplateFromHeader) {
        this.allowTemplateFromHeader = allowTemplateFromHeader;
    }

    public boolean isAllowContextMapAll() {
        return allowContextMapAll;
    }

    /**
     * Sets whether the context map should allow access to all details.
     * By default only the message body and headers can be accessed.
     * This option can be enabled for full access to the current Exchange and CamelContext.
     * Doing so impose a potential security risk as this opens access to the full power of CamelContext API.
     */
    public void setAllowContextMapAll(boolean allowContextMapAll) {
        this.allowContextMapAll = allowContextMapAll;
    }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Systremma atacamae Syd.

### Remarks
null


text:
namespace hpmc
    {
void export_sphere(pybind11::module& m);
void export_convex_polygon(pybind11::module& m);
void export_simple_polygon(pybind11::module& m);
void export_spheropolygon(pybind11::module& m);
void export_polyhedron(pybind11::module& m);
void export_ellipsoid(pybind11::module& m);
void export_faceted_ellipsoid(pybind11::module& m);
void export_sphinx(pybind11::module& m);
void export_union_convex_polyhedron(pybind11::module& m);
void export_union_faceted_ellipsoid(pybind11::module& m);
void export_union_sphere(pybind11::module& m);
void export_convex_polyhedron(pybind11::module& m);
void export_convex_spheropolyhedron(pybind11::module& m);

void export_external_fields(pybind11::module& m);
    } // namespace hpmc

#endif // __MODULES__


text:
package p06_BirthdayCelebrations.persons.organicals;

public class Citizen extends OrganicTraveler {

	private int age;

	public Citizen(String id, String name, String birthDate, int age) {
		super(id, name, birthDate);
		setAge(age);
	}

	public int getAge() {
		return age;
	}

	private void setAge(int age) {
		this.age = age;
	}

}


text:
title: The Metal Human Centipede
date: 2017-09-29
description: Hill and Beez discuss the recently announced headliners for Bloodstock 2018 and speculate on who might headline Download next year, they discuss the new track from former Korn drummer David Silveria's band Core 10, there's hilarious chat about who they'd have in their heavy metal human centipede, followed by reviews on new albums from Grave Pleasures, Cradle of Filth, Counterparts and Berried Alive, and Album Club this week is on the Misfits' long lost debut album Static Age.
soundcloud: 344529432
---

## News

* [Nightwish and Gojira to headline Bloodstock festival 2018](http://teamrock.com/news/2017-08-12/nightwish-and-gojira-to-headline-bloodstock-festival-2018)
* [Bloodstock Announces Judas Priest As Third Headliner For 2018](http://www.bloodstock.uk.com/news/bloodstock-announces-judas-priest-as-third-headliner-for-2018)
* [Core 10: Former Korn Drummer David Silveria's New Band is the Most Depressing/Funniest Thing You Will See This Week](http://www.metalsucks.net/2017/04/07/core-10-former-korn-drummer-david-silverias-new-band-is-the-most-depressingfunniest-thing-you-will-see-this-week/)

## Questions

* **[Matt Bradley](https://www.facebook.com/thatsnotmetalpodcast/posts/2182867711939761?comment_id=2182960985263767&comment_tracking=%7B%22tn%22%3A%22R5%22%7D)**: _Possibly one for the battle special, but song end preference triple threat. Abrupt finish Vs Fade to silence Vs Stylised Finish. Which is your favourite?_
* **[Graham Preston](https://www.facebook.com/thatsnotmetalpodcast/posts/2182867711939761?comment_id=2182869411939591&comment_tracking=%7B%22tn%22%3A%22R9%22%7D)**: _If you were in the middle of a human centipede, who in the rock/metal world would be at the front and back (stolen from the Richard Herring podcast)?_
* [Elliot Leaver](https://www.facebook.com/thatsnotmetalpodcast/posts/2182867711939761?comment_id=2182869121939620&comment_tracking=%7B%22tn%22%3A%22R9%22%7D): _Remove one song from an album to make it better. Which song and which album?_

## Album reviews

* [Grave Pleasures - Motherblood](https://itunes.apple.com/gb/album/motherblood/id1262214046)
* [Cradle of Filth - Cryptoriana - The Seductiveness of Decay](https://itunes.apple.com/gb/album/cryptoriana-the-seductiveness-of-decay/id1257704049)
* [Counterparts - You're Not You Anymore](https://itunes.apple.com/gb/album/youre-not-you-anymore/id1258679769)
* [Berried Alive - Fools Gold](https://itunes.apple.com/gb/album/fools-gold/id1257966955)

## Album club

* [The Misfits - Static Age](https://itunes.apple.com/gb/album/static-age/id724429372)


text:
/* global test */
import { strictEqual, isFalse, isTrue, isNull, throws } from 'proclaim';

const lib = '../../../../lib/';

const Document = require(lib + 'Document');
const HTMLSelectElement = require(lib + 'HTMLElement/elements/HTMLSelectElement');
const HTMLOptionElement = require(lib + 'HTMLElement/elements/HTMLOptionElement');

test('HTMLSelectElement shoud have the nodeName == select ', () => {
    let elt = new HTMLSelectElement();
    strictEqual(elt.nodeName, 'select');
});

test('HTMLSelectElement autoFocus getter', () => {
    let elt = new HTMLSelectElement();
    isFalse(elt.autoFocus);

    elt.setAttribute('autofocus', '');
    isTrue(elt.autoFocus);

    elt.removeAttribute('autofocus');
    isFalse(elt.autoFocus);
});

test('HTMLSelectElement autoFocus setter', () => {
    let elt = new HTMLSelectElement();
    isFalse(elt.autoFocus);

    elt.autoFocus = true;
    isTrue(elt.autoFocus);

    elt.autoFocus = false;
    isFalse(elt.autoFocus);
});

test('HTMLSelectElement disabled getter', () => {
    let elt = new HTMLSelectElement();
    isFalse(elt.disabled);

    elt.setAttribute('disabled', '');
    isTrue(elt.disabled);

    elt.removeAttribute('disabled');
    isFalse(elt.disabled);
});

test('HTMLSelectElement disabled setter', () => {
    let elt = new HTMLSelectElement();
    isFalse(elt.disabled);

    elt.disabled = true;
    isTrue(elt.disabled);

    elt.disabled = false;
    isFalse(elt.disabled);
});

test('HTMLSelectElement form getter', () => {
    const document = new Document();
    let elt = new HTMLSelectElement();
    let form = document.createElement('form');
    let div = document.createElement('div');

    isNull(elt.form);

    form.appendChild(elt);
    strictEqual(elt.form, form);

    form.appendChild(div);
    div.appendChild(elt);
    strictEqual(elt.form, form);

    form.removeChild(div);
    isNull(elt.form);
});

test('HTMLSelectElement form setter', () => {
    let elt = new HTMLSelectElement();
    throws(() => elt.form = null, 'form is read only');
});

test('HTMLSelectElement labels getter', () => {
    const document = new Document();
    let elt = document.createElement('select');
    let div = document.createElement('div');
    div.appendChild(elt);
    let label1 = document.createElement('label');
    let label2 = document.createElement('label');
    div.appendChild(label1);
    div.appendChild(label2);

    label1.setAttribute('for', 'test');
    elt.setAttribute('id', 'test');

    let labels = elt.labels;
    strictEqual(labels.length, 1);
    strictEqual(labels[0], label1);

    let div2 = document.createElement('div');
    div.appendChild(div2);
    let label3 = document.createElement('label');
    label3.setAttribute('for', 'test');
    div2.appendChild(label3);

    labels = elt.labels;
    strictEqual(labels.length, 2);
    strictEqual(labels[0], label1);
    strictEqual(labels[1], label3);
});

test('HTMLSelectElement length getter', () => {
    let elt = new HTMLSelectElement();
    strictEqual(elt.length, 0);

    let option1 = new HTMLOptionElement();
    let option2 = new HTMLOptionElement();

    elt.appendChild(option1);
    strictEqual(elt.length, 1);

    elt.appendChild(option2);
    strictEqual(elt.length, 2);

    elt.removeChild(option1);
    strictEqual(elt.length, 1);

    elt.removeChild(option2);
    strictEqual(elt.length, 0);
});

test('HTMLSelectElement length setter', () => {
    let elt = new HTMLSelectElement();
    throws(() => elt.length = null, 'length is read only');
});

test('HTMLSelectElement multiple getter', () => {
    let elt = new HTMLSelectElement();
    isFalse(elt.multiple);

    elt.setAttribute('multiple', '');
    isTrue(elt.multiple);

    elt.removeAttribute('multiple');
    isFalse(elt.multiple);
});

test('HTMLSelectElement multiple setter', () => {
    let elt = new HTMLSelectElement();
    isFalse(elt.multiple);

    elt.multiple = true;
    isTrue(elt.multiple);

    elt.multiple = false;
    isFalse(elt.multiple);
});

test('HTMLSelectElement name getter', () => {
    let elt = new HTMLSelectElement();
    isNull(elt.name);

    elt.setAttribute('name', 'test');
    strictEqual(elt.name, 'test');

    elt.removeAttribute('name');
    isNull(elt.name);
});

test('HTMLSelectElement name setter', () => {
    let elt = new HTMLSelectElement();
    isNull(elt.name);

    elt.name = 'test';
    strictEqual(elt.name, 'test');
    strictEqual(elt.getAttribute('name'), 'test');
});

test('HTMLSelectElement options getter', () => {
    let elt = new HTMLSelectElement();
    strictEqual(elt.options.length, 0);

    let option = new HTMLOptionElement();
    elt.appendChild(option);

    strictEqual(elt.options.length, 1);
    strictEqual(elt.options[0], option);
});

test('HTMLSelectElement options setter', () => {
    let elt = new HTMLSelectElement();
    throws(() => elt.options = null, 'options is read only');
});

test('HTMLSelectElement required getter', () => {
    let elt = new HTMLSelectElement();
    isFalse(elt.required);

    elt.setAttribute('required', '');
    isTrue(elt.required);

    elt.removeAttribute('required');
    isFalse(elt.required);
});

test('HTMLSelectElement required setter', () => {
    let elt = new HTMLSelectElement();
    isFalse(elt.required);

    elt.required = true;
    isTrue(elt.required);

    elt.required = false;
    isFalse(elt.required);
});

test('HTMLSelectElement selected getter', () => {
    let elt = new HTMLSelectElement();

    strictEqual(elt.selectedIndex, -1);

    let option1 = new HTMLOptionElement();
    elt.appendChild(option1);

    let option2 = new HTMLOptionElement();
    elt.appendChild(option2);

    strictEqual(elt.selectedIndex, 0);
    strictEqual(elt.selectedOption, option1);

    option1.value = 'value';
    option2.value = '';
    strictEqual(elt.selectedIndex, 1);
    strictEqual(elt.selectedOption, option2);

    option1.value = '';
    strictEqual(elt.selectedIndex, 0);
    strictEqual(elt.selectedOption, option1);

    option2.selected = true;
    strictEqual(elt.selectedIndex, 1);
    strictEqual(elt.selectedOption, option2);
});

test('HTMLSelectElement selected setter', () => {
    let elt = new HTMLSelectElement();

    strictEqual(elt.selectedIndex, -1);

    let option1 = new HTMLOptionElement();
    elt.appendChild(option1);

    let option2 = new HTMLOptionElement();
    elt.appendChild(option2);

    elt.selectedIndex = 1;
    isTrue(option2.selected);

    elt.selectedIndex = 0;
    isTrue(option1.selected);
    isFalse(option2.selected);
});

test('HTMLSelectElement size getter', () => {
    let elt = new HTMLSelectElement();

    strictEqual(elt.size, 1);

    elt.multiple = true;
    strictEqual(elt.size, 4);

    elt.setAttribute('size', 10);
    strictEqual(elt.size, 10);
});

test('HTMLSelectElement size setter', () => {
    let elt = new HTMLSelectElement();

    strictEqual(elt.size, 1);

    elt.size = 10;
    strictEqual(elt.size, 10);
});

test('HTMLSelectElement tabIndex', () => {
    let elt = new HTMLSelectElement();
    throws(() => elt.tabIndex, 'Obsolete since HTML5');
});

test('HTMLSelectElement type getter', () => {
    let elt = new HTMLSelectElement();

    strictEqual(elt.type, 'select-one');

    elt.multiple = true;
    strictEqual(elt.type, 'select-multiple');

    elt.multiple = false;
    strictEqual(elt.type, 'select-one');
});

test('HTMLSelectElement type setter', () => {
    let elt = new HTMLSelectElement();
    throws(() => elt.type = null, 'type is read only');
});


text:
namespace jingle_glue {
class PseudoTcpAdapter;
class StreamSocketAdapter;
class TransportChannelSocketAdapter;
}  // namespace jingle_glue

namespace net {
class CertVerifier;
class ClientSocketFactory;
class Socket;
class StreamSocket;
class X509Certificate;
}  // namespace net

namespace remoting {

namespace protocol {

class JingleSessionManager;
class SocketWrapper;

// Implements protocol::Session that work over libjingle session (the
// cricket::Session object is passed to Init() method). Created
// by JingleSessionManager for incoming and outgoing connections.
class JingleSession : public protocol::Session,
                      public sigslot::has_slots<> {
 public:
  static const char kChromotingContentName[];

  // Create a JingleSession used in client mode. A server certificate is
  // required.
  static JingleSession* CreateClientSession(JingleSessionManager* manager);

  // Create a JingleSession used in server mode. A server certificate and
  // private key is provided. |key| is copied in the constructor.
  static JingleSession* CreateServerSession(
      JingleSessionManager* manager,
      scoped_refptr<net::X509Certificate> certificate,
      crypto::RSAPrivateKey* key);

  // Chromotocol Session interface.
  virtual void SetStateChangeCallback(StateChangeCallback* callback);

  virtual net::Socket* control_channel();
  virtual net::Socket* event_channel();
  virtual net::Socket* video_channel();

  virtual net::Socket* video_rtp_channel();
  virtual net::Socket* video_rtcp_channel();

  virtual const std::string& jid();
  virtual MessageLoop* message_loop();

  virtual const SessionConfig* config();
  virtual void set_config(const SessionConfig* config);

  virtual const std::string& initiator_token();
  virtual void set_initiator_token(const std::string& initiator_token);
  virtual const std::string& receiver_token();
  virtual void set_receiver_token(const std::string& receiver_token);

  // These fields are only set on the receiving side.
  virtual const CandidateSessionConfig* candidate_config();

  virtual void Close(Task* closed_task);

 private:
  friend class JingleSessionManager;

  JingleSession(JingleSessionManager* client,
                scoped_refptr<net::X509Certificate> server_cert,
                crypto::RSAPrivateKey* key);
  virtual ~JingleSession();

  // Called by JingleSessionManager.
  void set_candidate_config(const CandidateSessionConfig* candidate_config);
  scoped_refptr<net::X509Certificate> server_certificate() const;
  void Init(cricket::Session* cricket_session);

  // Close all the channels and terminate the session.
  void CloseInternal(int result, bool failed);

  bool HasSession(cricket::Session* cricket_session);
  cricket::Session* ReleaseSession();

  // Initialize the session configuration from a received connection response
  // stanza.
  bool InitializeConfigFromDescription(
    const cricket::SessionDescription* description);

  // Initialize PseudoTCP + SSL on each of the video, control and input
  // channels.  The channels must have been created before this is called.
  bool InitializeChannels();

  // Helper method to create and initialize PseudoTCP + SSL socket on
  // top of the provided |channel|. The resultant SSL socket is
  // written to |ssl_socket|. Return true if successful.
  bool EstablishSSLConnection(net::Socket* channel,
                              scoped_ptr<SocketWrapper>* ssl_socket);

  // Used for Session.SignalState sigslot.
  void OnSessionState(cricket::BaseSession* session,
                      cricket::BaseSession::State state);
  // Used for Session.SignalError sigslot.
  void OnSessionError(cricket::BaseSession* session,
                      cricket::BaseSession::Error error);

  void OnInitiate();
  void OnAccept();
  void OnTerminate();

  void OnConnect(int result);

  // Called by SSL socket to notify connect event.
  void OnSSLConnect(int result);

  void SetState(State new_state);

  // JingleSessionManager that created this session.
  scoped_refptr<JingleSessionManager> jingle_session_manager_;

  // Server certificate used in SSL connections.
  scoped_refptr<net::X509Certificate> server_cert_;

  // Private key used in SSL server sockets.
  scoped_ptr<crypto::RSAPrivateKey> key_;

  State state_;
  scoped_ptr<StateChangeCallback> state_change_callback_;

  bool closed_;
  bool closing_;

  // JID of the other side. Set when the connection is initialized,
  // and never changed after that.
  std::string jid_;

  // The corresponding libjingle session.
  cricket::Session* cricket_session_;

  scoped_ptr<const SessionConfig> config_;

  std::string initiator_token_;
  std::string receiver_token_;

  // These data members are only set on the receiving side.
  scoped_ptr<const CandidateSessionConfig> candidate_config_;

  // |control_channel_| holds a channel until SSL socket is
  // created. After that |control_ssl_socket_| owns the channel. The
  // same is the case fo |event_channel_| and |video_channel_|.
  scoped_ptr<jingle_glue::TransportChannelSocketAdapter> control_channel_;
  scoped_ptr<SocketWrapper> control_ssl_socket_;

  scoped_ptr<jingle_glue::TransportChannelSocketAdapter> event_channel_;
  scoped_ptr<SocketWrapper> event_ssl_socket_;

  scoped_ptr<jingle_glue::TransportChannelSocketAdapter> video_channel_;
  scoped_ptr<SocketWrapper> video_ssl_socket_;

  // Count the number of SSL connections esblished.
  int ssl_connections_;

  // Used to verify the certificate received in SSLClientSocket.
  scoped_ptr<net::CertVerifier> cert_verifier_;

  scoped_ptr<jingle_glue::TransportChannelSocketAdapter> video_rtp_channel_;
  scoped_ptr<jingle_glue::TransportChannelSocketAdapter> video_rtcp_channel_;

  // Callback called by the SSL layer.
  net::CompletionCallbackImpl<JingleSession> connect_callback_;
  net::CompletionCallbackImpl<JingleSession> ssl_connect_callback_;

  DISALLOW_COPY_AND_ASSIGN(JingleSession);
};

}  // namespace protocol

}  // namespace remoting

#endif  // REMOTING_PROTOCOL_JINGLE_SESSION_H_