text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
<!--***********************************************************
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 ***********************************************************-->

<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
 <toolbar:toolbaritem xlink:href=".uno:InsertPage" toolbar:helpid="helpid:27014" toolbar:style="radio dropdown" />
 <toolbar:toolbarseparator/>
	<toolbar:toolbaritem xlink:href=".uno:InsertObjectFloatingFrame" toolbar:helpid="helpid:5563"  toolbar:visible="false" />
	<toolbar:toolbarseparator/>
	<toolbar:toolbaritem xlink:href=".uno:ImportFromFile" toolbar:helpid="helpid:27015"  toolbar:visible="false" />
	<toolbar:toolbaritem xlink:href=".uno:InsertTable" toolbar:helpid="helpid:10141"  />
	<toolbar:toolbarseparator/>
	<toolbar:toolbaritem xlink:href=".uno:InsertGraphic" toolbar:helpid="helpid:10241"  />
	<toolbar:toolbaritem xlink:href=".uno:InsertAVMedia" toolbar:helpid="helpid:6695"  />
	<toolbar:toolbaritem xlink:href=".uno:InsertSound" toolbar:helpid="helpid:5676"  toolbar:visible="false" />
	<toolbar:toolbaritem xlink:href=".uno:InsertVideo" toolbar:helpid="helpid:5677"  toolbar:visible="false" />
	<toolbar:toolbaritem xlink:href=".uno:InsertMath" toolbar:helpid="helpid:27106"/>
	<toolbar:toolbaritem xlink:href=".uno:InsertObjectChart" toolbar:helpid="helpid:10140"  />
	<toolbar:toolbaritem xlink:href=".uno:InsertObject" toolbar:helpid="helpid:5561"  toolbar:visible="false"   />
	<toolbar:toolbaritem xlink:href=".uno:InsertPlugin" toolbar:helpid="helpid:5672"  toolbar:visible="false" />
	<toolbar:toolbarseparator/>
</toolbar:toolbar>


text:
require File.dirname(__FILE__) + '/../../test_helper'

class WorldPayModuleTest < Test::Unit::TestCase

  include ActiveMerchant::Billing::Integrations

  def test_notification_method
    assert_instance_of WorldPay::Notification, WorldPay.notification('name=Andrew White')
  end

end

redpajama_set_name: RedPajamaGithub


text:
($ => {
    "use strict";

    window.newtab = function () {

        /*
         * ################################
         * PUBLIC
         * ################################
         */

        this.opts = {
            classes: {
                building: "building",
                initLoading: "initLoading",
                loading: "loading",
                chromeApps: "chromeApps",
                suggestions: "suggestions",
                edit: "edit",
                add: "add",
                link: "link",
                remove: "remove",
                infoBar: "infoBar",
                save: "save",
                cancel: "cancel",
                active: "active",
                visible: "visible",
                darkMode: "dark"
            },
            attr: {
                type: "data-type",
                perRow: "data-perRow",
                pos: "data-pos"
            },
            elm: {
                body: $("body"),
                title: $("head > title"),
                content: $("section#content"),
                topNav: $("section#content > nav"),
                search: {
                    wrapper: $("div#search"),
                    field: $("div#search > input[type='text']"),
                    submit: $("div#search > button[type='submit']")
                },
                topPages: $("div#topPages")
            },
            manifest: chrome.runtime.getManifest()
        };

        /**
         * Constructor
         */
        this.run = () => {
            chrome.permissions.contains({
                permissions: ['tabs', 'topSites']
            }, (result) => {
                if (result) {
                    loadPage();
                } else { // no permission to continue -> show default page instead
                    chrome.tabs.update({url: "chrome-search://local-ntp/local-ntp.html"});
                }
            });
        };

        /*
         * ################################
         * PRIVATE
         * ################################
         */

        let loadPage = () => {
            loadSidebar();
            initHelpers();

            let loader = this.helper.template.loading().appendTo(this.opts.elm.body);
            this.opts.elm.body.addClass(this.opts.classes.initLoading);

            this.helper.model.init().then(() => {
                let darkMode = this.helper.model.getData("a/darkMode");
                if (darkMode === true) {
                    this.opts.elm.body.addClass(this.opts.classes.darkMode);
                }
                return this.helper.i18n.init();
            }).then(() => {
                this.helper.font.init();
                this.helper.stylesheet.init();
                this.helper.stylesheet.addStylesheets(["newtab"], $(document));
                this.helper.i18n.parseHtml(document);

                this.helper.topPages.init();
                this.helper.search.init();
                this.helper.shortcuts.init();
                this.helper.edit.init();
                return $.delay(500);
            }).then(() => {
                loader.remove();
                this.opts.elm.body.removeClass([this.opts.classes.building, this.opts.classes.initLoading]);
            });
        };

        /**
         * Initialises the helper objects
         */
        let initHelpers = () => {
            this.helper = {
                model: new window.ModelHelper(this),
                template: new window.TemplateHelper(this),
                i18n: new window.I18nHelper(this),
                font: new window.FontHelper(this),
                stylesheet: new window.StylesheetHelper(this),
                search: new window.SearchHelper(this),
                entry: new window.EntryHelper(this),
                shortcuts: new window.ShortcutsHelper(this),
                topPages: new window.TopPagesHelper(this),
                edit: new window.EditHelper(this)
            };
        };

        /**
         * Loads the sidebar with the specified configuration
         */
        let loadSidebar = () => {
            this.opts.manifest.content_scripts[0].css.forEach((css) => {
                $("head").append("<link href='" + chrome.extension.getURL(css) + "' type='text/css' rel='stylesheet' />");
            });

            let loadJs = (i = 0) => {
                let js = this.opts.manifest.content_scripts[0].js[i];

                if (typeof js !== "undefined") {
                    let script = document.createElement('script');
                    document.head.appendChild(script);
                    script.onload = () => loadJs(i + 1);
                    script.src = "/" + js;
                }
            };

            loadJs();
        };
    };

    new window.newtab().run();

})(jsu);


text:
=begin
#BillForward REST API

#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

OpenAPI spec version: 1.0.0

Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.2.3-SNAPSHOT

=end

require 'spec_helper'
require 'json'
require 'date'

# Unit tests for Bfwd::StripeObject
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
# Please update as you see appropriate
describe 'StripeObject' do
  before do
    # run before each test
    @instance = Bfwd::StripeObject.new
  end

  after do
    # run after each test
  end

  describe 'test an instance of StripeObject' do
    it 'should create an instance of StripeObject' do
      expect(@instance).to be_instance_of(Bfwd::StripeObject)
    end
  end
end


text:
package cookbook.core

// fintrospect-core
object Extracting_Upstream_Responses extends App {

  import argo.jdom.JsonNode
  import com.twitter.finagle.http.Method.Get
  import com.twitter.finagle.http.{Request, Response}
  import com.twitter.finagle.{Http, Service}
  import com.twitter.util.Await.result
  import io.fintrospect.configuration.{Authority, Host, Port}
  import io.fintrospect.filters.RequestFilters.AddHost
  import io.fintrospect.filters.ResponseFilters
  import io.fintrospect.parameters.{Body, BodySpec, Path}
  import io.fintrospect.util.{Extracted, Extraction, ExtractionFailed}
  import io.fintrospect.{RouteClient, RouteSpec}

  case class Pokemon(id: Int, name: String, weight: Int)

  object Pokemon {
    def from(j: JsonNode) = Pokemon(j.getNumberValue("id").toInt,
      j.getStringValue("name"),
      j.getNumberValue("weight").toInt)
  }

  val authority: Authority = Host("pokeapi.co").toAuthority(Port._80)

  val http: Service[Request, Response] = AddHost(authority).andThen(Http.newService(authority.toString))

  val id = Path.int("pokemonId")

  val spec: BodySpec[Pokemon] = BodySpec.json().map(Pokemon.from)

  val nameAndWeight: Body[Pokemon] = Body.of(spec)

  val client: RouteClient[Extraction[Option[Pokemon]]] = RouteSpec().at(Get) / "api" / "v2" / "pokemon" / id / "" bindToClient
    ResponseFilters.ExtractBody(nameAndWeight).andThen(http)

  def reportOnPokemon(pid: Int) =
    println(
      result(client(id --> pid)) match {
        case Extracted(Some(pokemon)) => s"i found a pokemon: $pokemon"
        case Extracted(None) => s"there is no pokemon with id $pid"
        case ExtractionFailed(errors) => s"problem extracting response $errors"
      }
    )

  reportOnPokemon(1)
  reportOnPokemon(11)
  reportOnPokemon(9999)
}


text:
package org.jhipster.store.repository;

import org.jhipster.store.domain.Product;
import org.springframework.stereotype.Repository;

import org.springframework.data.mongodb.repository.MongoRepository;

/**
 * Spring Data MongoDB repository for the Product entity.
 */
@SuppressWarnings("unused")
@Repository
public interface ProductRepository extends MongoRepository<Product,String> {

}


text:
require 'unicorn-cuba-base/root_logger'

class MemoryLimit
	include ClassLogging

	class MemoryLimitedExceededError < RuntimeError
		def initialize
			super "memory limit exceeded"
		end
	end

	module IO
		def root_limit(ml)
			@root_limit = ml
		end

		def read(bytes = nil)
			data = @root_limit.get("#{self.class.name} IO read") do |max_read_bytes|
				if not bytes or bytes > max_read_bytes
					data = super max_read_bytes
					raise MemoryLimitedExceededError unless eof?
					data or '' # read() always returns '' on EOF
				else
					super bytes or ''
				end
			end
		end
	end

	def initialize(bytes = 256 * 1024 ** 2)
		log.debug "setting up new memory limit of #{bytes} bytes" if bytes
		@limit = bytes
	end

	attr_reader :limit

	def get(reason = nil)
		yield(@limit).tap do |data|
			borrow(data.bytesize, reason) if data
		end
	end

	def borrow(bytes, reason = nil)
		if reason
			log.debug "borrowing #{bytes} from #{@limit} bytes of limit for #{reason}"
		else
			log.debug "borrowing #{bytes} from #{@limit} bytes of limit"
		end

		bytes > @limit and raise MemoryLimitedExceededError
		@limit -= bytes
		bytes
	end

	def return(bytes, reason = nil)
		if reason
			log.debug "returning #{bytes} to #{@limit} bytes of limit used for #{reason}"
		else
			log.debug "returning #{bytes} to #{@limit} bytes of limit"
		end
		@limit += bytes
		bytes
	end

	def io(io)
		io.extend MemoryLimit::IO
		io.root_limit self
		io
	end
end


text:
package org.apache.cassandra.metrics;

import com.codahale.metrics.Gauge;
import com.codahale.metrics.Meter;
import org.apache.cassandra.utils.memory.BufferPool;

import static org.apache.cassandra.metrics.CassandraMetricsRegistry.Metrics;

public class BufferPoolMetrics
{
    private static final MetricNameFactory factory = new DefaultNameFactory("BufferPool");

    /** Total number of misses */
    public final Meter misses;

    /** Total size of buffer pools, in bytes */
    public final Gauge<Long> size;

    public BufferPoolMetrics()
    {
        misses = Metrics.meter(factory.createMetricName("Misses"));

        size = Metrics.register(factory.createMetricName("Size"), new Gauge<Long>()
        {
            public Long getValue()
            {
                return BufferPool.sizeInBytes();
            }
        });
    }
}


text:
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { InputWritr } from "inputwritr";

import {
    Aliases,
    ButtonListing,
    ControllerMapping,
    ControllerMappings,
    DeviceLayrSettings,
    Gamepad,
    JoystickListing,
    JoystickTriggerAxis,
    Triggers,
} from "./types";

/**
 * Status possibilities for an axis. Neutral is the default; positive is above
 * its threshold; negative is below the threshold / -1.
 */
export enum AxisStatus {
    /**
     * Low axis status (lower than the negative of the threshold).
     */
    negative,

    /**
     * Default axis status (absolutely closer to 0 than the threshold).
     */
    neutral,

    /**
     * High axis status (higher than the threshold).
     */
    positive,
}

/**
 * Known mapping schemas for standard controllers. These are referenced
 * by added gamepads via the gamepads' .name attribute.
 */
const controllerMappings: ControllerMappings = {
    /**
     * Controller mapping for a typical Xbox style controller.
     */
    standard: {
        axes: [
            {
                axis: "x",
                joystick: 0,
                name: "leftJoystick",
            },
            {
                axis: "y",
                joystick: 0,
                name: "leftJoystick",
            },
            {
                axis: "x",
                joystick: 1,
                name: "rightJoystick",
            },
            {
                axis: "y",
                joystick: 1,
                name: "rightJoystick",
            },
        ],
        buttons: [
            "a",
            "b",
            "x",
            "y",
            "leftTop",
            "rightTop",
            "leftTrigger",
            "rightTrigger",
            "select",
            "start",
            "leftStick",
            "rightStick",
            "dpadUp",
            "dpadDown",
            "dpadLeft",
            "dpadRight",
        ],
        joystickThreshold: 0.49,
    },
};

/**
 * Puts the default values for all buttons and joystick axes that don't already
 * have statuses. This is useful so activation checks don't glitch out.
 *
 * @param gamepad   The gamepad whose triggers are to be defaulted.
 * @param triggers   The triggers to default, as listings keyed by name.
 */
const setDefaultTriggerStatuses = (gamepad: Gamepad, triggers: Triggers): void => {
    const mapping = controllerMappings[gamepad.mapping || "standard"];

    for (const mappingButton of mapping.buttons) {
        const button = triggers[mappingButton] as ButtonListing | undefined;

        if (button) {
            button.status ||= false;
        }
    }

    for (const axis of mapping.axes) {
        const joystick = triggers[axis.name] as JoystickListing;

        for (const j in joystick) {
            if (!{}.hasOwnProperty.call(joystick, j)) {
                continue;
            }

            if (joystick[j].status === undefined) {
                joystick[j].status = AxisStatus.neutral;
            }
        }
    }
};

/**
 * @param gamepad   The gamepad whose axis is being looked up.
 * @param magnitude   The direction an axis is measured at, in [-1, 1].
 * @returns What direction a magnitude is relative to 0.
 */
const getAxisStatus = (gamepad: Gamepad, magnitude: number): AxisStatus => {
    const joystickThreshold = controllerMappings[gamepad.mapping || "standard"].joystickThreshold;

    if (magnitude > joystickThreshold) {
        return AxisStatus.positive;
    }

    if (magnitude < -joystickThreshold) {
        return AxisStatus.negative;
    }

    return AxisStatus.neutral;
};

/**
 * Pipes GamePad API device actions to InputWritr pipes.
 */
export class DeviceLayr {
    /**
     * The InputWritr being piped button and joystick triggers commands.
     */
    private readonly inputWriter: InputWritr;

    /**
     * Mapping of which device controls should cause what triggers, along
     * with their current statuses.
     */
    private readonly triggers: Triggers;

    /**
     * For "on" and "off" activations, the equivalent event keys to pass to
     * the internal InputWritr.
     */
    private readonly aliases: Aliases;

    /**
     * Any added gamepads (devices), in order of activation.
     */
    private readonly gamepads: Gamepad[];

    /**
     * Initializes a new instance of the DeviceLayr class.
     *
     * @param settings   Settings to use for initialization.
     */
    public constructor(settings: DeviceLayrSettings) {
        if (typeof settings === "undefined") {
            throw new Error("No settings object given to DeviceLayr.");
        }
        if (typeof settings.inputWriter === "undefined") {
            throw new Error("No InputWriter given to DeviceLayr.");
        }

        this.inputWriter = settings.inputWriter;
        this.triggers = settings.triggers ?? {};
        this.aliases = settings.aliases ?? {
            off: "off",
            on: "on",
        };

        this.gamepads = [];
    }

    /**
     * @returns The InputWritr being piped button and joystick triggers.
     */
    public getInputWritr(): InputWritr {
        return this.inputWriter;
    }

    /**
     * @returns Mapping of which device controls should cause what triggers,
     *          along with their current statuses.
     */
    public getTriggers(): Triggers {
        return this.triggers;
    }

    /**
     * @returns For "on" and "off" activations, the equivalent event keys
     *          to pass to the internal InputWritr.
     */
    public getAliases(): Aliases {
        return this.aliases;
    }

    /**
     * @returns Any added gamepads (devices), in order of activation.
     */
    public getGamepads(): Gamepad[] {
        return this.gamepads;
    }

    /**
     * If possible, checks the navigator for new gamepads, and adds them if found.
     *
     * @returns How many gamepads were added.
     */
    public checkNavigatorGamepads(): number {
        // The types are wrong: this might not exist
        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
        if (!navigator.getGamepads) {
            return 0;
        }

        const gamepad = navigator.getGamepads()[this.gamepads.length];
        if (!gamepad) {
            return 0;
        }

        this.registerGamepad(gamepad);

        return this.checkNavigatorGamepads() + 1;
    }

    /**
     * Registers a new gamepad.
     *
     * @param gamepad   The gamepad to register.
     */
    public registerGamepad(gamepad: Gamepad): void {
        this.gamepads.push(gamepad);
        setDefaultTriggerStatuses(gamepad, this.triggers);
    }

    /**
     * Checks the trigger statuses of all known gamepads.
     */
    public activateAllGamepadTriggers(): void {
        for (const gamepad of this.gamepads) {
            this.activateGamepadTriggers(gamepad);
        }
    }

    /**
     * Checks the trigger status of a gamepad, calling the equivalent InputWritr
     * events if any triggers have occurred.
     *
     * @param gamepad   The gamepad whose status is to be checked.
     */
    public activateGamepadTriggers(gamepad: Gamepad): void {
        const mapping: ControllerMapping = controllerMappings[gamepad.mapping || "standard"];

        for (let i = Math.min(mapping.axes.length, gamepad.axes.length) - 1; i >= 0; i -= 1) {
            this.activateAxisTrigger(
                gamepad,
                mapping.axes[i].name,
                mapping.axes[i].axis,
                gamepad.axes[i]
            );
        }

        for (
            let i = Math.min(mapping.buttons.length, gamepad.buttons.length) - 1;
            i >= 0;
            i -= 1
        ) {
            this.activateButtonTrigger(mapping.buttons[i], gamepad.buttons[i].pressed);
        }
    }

    /**
     * Checks for triggered changes to an axis, and calls the equivalent InputWritr
     * event if one is found.
     *
     * @param gamepad   The gamepad whose triggers are to be checked.
     * @param name   The name of the axis, typically "x" or "y".
     * @param magnitude   The current value of the axis, in [1, -1].
     * @returns Whether the trigger was activated.
     */
    public activateAxisTrigger(
        gamepad: Gamepad,
        name: string,
        axis: string,
        magnitude: number
    ): boolean {
        const listing = (this.triggers[name] as JoystickListing)[axis];
        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
        if (!listing) {
            return false;
        }

        // If the axis' current status matches the new one, don't do anything
        const status: AxisStatus = getAxisStatus(gamepad, magnitude);
        if (listing.status === status) {
            return false;
        }

        // If it exists, release the old axis via the InputWritr using the off alias
        if (
            listing.status !== undefined &&
            (listing as any)[AxisStatus[listing.status]] !== undefined
        ) {
            this.inputWriter.callEvent(
                this.aliases.off,
                (listing as any)[AxisStatus[listing.status]]
            );
        }

        // Mark the new status in the listing
        listing.status = status;

        // Trigger the new status via the InputWritr using the on alias
        if ((listing as any)[AxisStatus[status]] !== undefined) {
            this.inputWriter.callEvent(this.aliases.on, (listing as any)[AxisStatus[status]]);
        }

        return true;
    }

    /**
     * Checks for triggered changes to a button, and calls the equivalent InputWritr
     * event if one is found.
     *
     * @param name   The name of the button, such as "a" or "left".
     * @param status   Whether the button is activated (pressed).
     * @returns Whether the trigger was activated.
     */
    public activateButtonTrigger(name: string, status: boolean): boolean {
        const listing = this.triggers[name] as ButtonListing | undefined;

        // If the button's current status matches the new one, don't do anything
        if (!listing || listing.status === status) {
            return false;
        }

        listing.status = status;

        // Trigger the new status via the InputWritr using the new alias
        this.inputWriter.callEvent(status ? this.aliases.on : this.aliases.off, listing.trigger);

        return true;
    }

    /**
     * Clears the statuses of all axes and buttons on all known gamepads.
     */
    public clearAllGamepadTriggers(): void {
        for (const gamepad of this.gamepads) {
            this.clearGamepadTriggers(gamepad);
        }
    }

    /**
     * Clears the status of all axes and buttons on a gamepad.
     *
     * @param gamepad   The gamepad whose triggers are to be cleared.
     */
    public clearGamepadTriggers(gamepad: Gamepad): void {
        const mapping: ControllerMapping = controllerMappings[gamepad.mapping || "standard"];

        for (const axis of mapping.axes) {
            this.clearAxisTrigger(axis.name, axis.axis);
        }

        for (const button of mapping.buttons) {
            this.clearButtonTrigger(button);
        }
    }

    /**
     * Sets the status of an axis to neutral.
     *
     * @param name   The name of the axis, typically "x" or "y".
     */
    public clearAxisTrigger(name: string, axis: string): void {
        const listing: JoystickTriggerAxis = (this.triggers[name] as JoystickListing)[axis];

        listing.status = AxisStatus.neutral;
    }

    /**
     * Sets the status of a button to off.
     *
     * @param name   The name of the button, such as "a" or "left".
     */
    public clearButtonTrigger(name: string): void {
        const listing: ButtonListing = this.triggers[name] as ButtonListing;

        listing.status = false;
    }
}


text:
Challenge an identity during a verification process using an oAuth2 provider.

This sample uses the [PHP-SDK](https://github.com/veridu/veridu-php) to integrate the Challenge.

## Files
 * [challenge-api/oAuth2/facebook-settings.php.dist](facebook-settings.php.dist): distribution settings file for Facebook application (copy this file to challenge-api/facebook-settings.php)
 * [challenge-api/oAuth2/index.php](index.php): entry point for the challenge process

## Setup Steps
Please follow the instructions to **Install composer** and **Install dependencies** available [here](../README.md).

## Starting Application
Follow the instructions below to start the sample application using PHP's built-in server.
```bash
$ cd challenge-api/oAuth2/
$ php -S 127.0.0.1:8080
```

On your webbrowser navigate to [http://127.0.0.1:8080/](http://127.0.0.1:8080/).

## Help!
If you have more questions, you can find more details on the following links:
 * [What do I need to do before I can call the API](https://veridu.com/wiki/What_do_I_need_to_do_before_I_can_call_the_API)
 * [How do I use the PHP SDK?](https://veridu.com/wiki/How_do_I_use_the_PHP_SDK%3F)
 * [How do I retrieve a user's Verified Profile?](https://veridu.com/wiki/How_do_I_retrieve_a_user%27s_Verified_Profile%3F)
 * [Provider API EndPoint](https://veridu.com/wiki/Provider_Resource)
 * [Task API EndPoint](https://veridu.com/wiki/Task_Resource)


text:
class AddForeignKeysForTaxonsPrototypes < ActiveRecord::Migration[4.2]
  def change
    add_foreign_key :spree_prototype_taxons, :spree_taxons, column: :taxon_id
    add_foreign_key :spree_prototype_taxons, :spree_prototypes, column: :prototype_id
  end
end


text:
case class DebugParam[T](param: T)

// TypeStack init: REFERENCE(type AnyRef)
// [Now checking: typer]
// [check: typer] work/fail1.scala:1: trees differ
//  old: T [Trees$Ident] (tpe = T)
//  new: T [Trees$TypeTree] (tpe = T)
// [check: typer] work/fail1.scala:1: trees differ
//  old: DebugParam[T] [Trees$AppliedTypeTree] (tpe = null)
//  new: DebugParam[T] [Trees$TypeTree] (tpe = DebugParam[T])
// Exception in thread "main" java.lang.NullPointerException
//  at scala.tools.nsc.typechecker.Typers$Typer.typedTypeConstructor(Typers.scala:4337)
//  at scala.tools.nsc.typechecker.Typers$Typer.typedTypeConstructor(Typers.scala:4358)
//  at scala.tools.nsc.typechecker.Typers$Typer.typedNew$1(Typers.scala:3240)
//  at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3994)
//  at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4223)
//  at scala.tools.nsc.typechecker.TreeCheckers$TreeChecker.scala$tools$nsc$typechecker$TreeCheckers$TreeChecker$$super$typed(TreeCheckers.scala:101)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace GZ_SpotVisual
{
    /// <summary>
    /// ¿ª»úÆô¶¯-±ØÐëÉèÖÃIntentFilter
    /// </summary>
    [BroadcastReceiver]
    [IntentFilter(new[] { Intent.ActionBootCompleted }, Categories = new[] { Intent.CategoryDefault })]
    class BootReceiver : BroadcastReceiver
    {
        public override void OnReceive(Context context, Intent intent)
        {
            if (intent.Action == Intent.ActionBootCompleted)
            {
                Intent newIntent = new Intent(context, typeof(SplashActivity));
                //Õâ¸ö±ê¼Ç±ØÐë¼Ó
                newIntent.AddFlags(ActivityFlags.NewTask);
                context.StartActivity(newIntent);
            }
        }
    }
}


text:
title: Welcome
permalink: /docs/home/
redirect_from: /docs/index.html
---

`osim-rl` package allows you to synthesize physiologically accurate movement by combining biomechanical expertise embeded in [OpenSim](http://opensim.stanford.edu/) simulation software with state-of-the-art control strategies using Deep Reinforcement Learning.

![HUMAN environment](https://s3.amazonaws.com/osim-rl/videos/running.gif)

Our objectives are to:
* use Reinforcement Learning (RL) to solve problems in healthcare,
* promote open-source tools in RL research ([the physics simulator](http://opensim.stanford.edu), [the RL environment](https://github.com/stanfordnmbl/osim-rl), and the [competition platform](http://crowdai.org/) on which we run challenges are all open-source),
* encourage RL research in computationally complex environments, with stochasticity and highly-dimensional action spaces, relevant to real-life applications,
* bridge biomechanics, neuroscience, and computer science communities.

<!--
## What can I find here?

Human movement results from the intricate coordination of muscles, tendons, joints, and other physiological elements. While children learn to walk, run, climb, and jump in their first years of life and most of us can navigate complex environments--like a crowded street or moving subway--without considerable active attention, developing controllers that can efficiently and robustly synthesize realistic human motions in a variety of environments remains a grand challenge for biomechanists, neuroscientists, and computer scientists. Current controllers are confined to a small set of pre-specified movements or driven by torques, rather than the complex muscle actuators found in humans.
-->


text:
/**
 * Created by Kristof on 10/03/2015.
 */

QUnit.module("Objectstore - Add");
QUnit.test("Adding data", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test" };

    initionalSituationObjectStoreNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);
                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "Add error");
                    };
                }
                catch (ex){
                    assert.equal(ex.name, "DataError", "DataError");
                }

                transaction.oncomplete = function (e){
                    assert.ok(true, "Transaction complete");
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.ok(false, "Transaction abort");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with external key", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test" };
    var key = 1;

    initionalSituationObjectStoreNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data, key);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.equal(e.target.result, key, "Key ok");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data - objectstore autoincrement", function (assert) {
    var done = assert.async();
    assert.expect(1);
    var data = { test: "test" };
    initionalSituationObjectStoreWithAutoIncrement(function () {
		var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add exception");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with external key - objectstore autoincrement", function (assert) {
    var done = assert.async();
    assert.expect(2);
	var data = { test: "test" };
	var key = 1;
	initionalSituationObjectStoreWithAutoIncrement(function () {
		var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data, key);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.equal(e.target.result, key, "Key ok");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction exception");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with external key (increase autoincrement) - objectstore autoincrement", function (assert) {
    var done = assert.async();
    assert.expect(3);
	var data = { test: "test" };
	initionalSituationObjectStoreWithAutoIncrement(function () {
		var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        var key = e.target.result;

						try{
							var addRequest2 = objectstore.add(data, (key + 3));

							addRequest2.onsuccess = function (e){
								equal(e.target.result, (key + 3), "Key same as provided");
                                try{
                                    var addRequest3 = objectstore.add(data);

                                    addRequest3.onsuccess = function (e){
                                        assert.equal(e.target.result, (key + 4), "Key increased after add with provided key");
                                    };
                                    addRequest3.onerror = function (e){
                                        assert.ok(false, "add error");
                                    };
                                }
                                catch (ex){
                                    assert.ok(false, "add exception");
                                }
							};
							addRequest2.onerror = function (e){
                                assert.ok(false, "add error");
							};
						}
						catch (ex){
                            assert.ok(false, "add exception");
						}
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
});
QUnit.test("Adding data - objectstore keyPath", function (assert) {
    var done = assert.async();
    assert.expect(2);
	var data = { test: "test" };
	initionalSituationObjectStoreWithKeyPathNoAutoIncrement(function () {
		var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "Add error");
                    };
                }
                catch (ex){
                    assert.equal(ex.name, "DataError", "DataError");
                }

                transaction.oncomplete = function (e){
                    assert.ok(true, "Transaction complete");
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.ok(false, "Transaction abort");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with inline key - objectstore keyPath", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test", id: 1 };
    initionalSituationObjectStoreWithKeyPathNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.equal(e.target.result, data.id, "Key same as provided");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with external key - objectstore keyPath", function (assert) {
    var done = assert.async();
    assert.expect(1);
    var data = { test: "test" };
    var key = 1;
    initionalSituationObjectStoreWithKeyPathNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data, key);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.equal(ex.name, "DataError", "DataError");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.ok(false, "Transaction abort");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data - objectstore keyPath autoincrement", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test" };
    initionalSituationObjectStoreWithKeyPathAndAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.equal(e.target.result, 1, "Key same as provided");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with inline key - objectstore keyPath autoincrement", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test", id:2 };
    initionalSituationObjectStoreWithKeyPathAndAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.equal(e.target.result, data.id, "Key set by autoincrement");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with external key - objectstore keyPath autoincrement", function (assert) {
    var done = assert.async();
    assert.expect(1);
    var data = { test: "test" };
    var key = 1;
    initionalSituationObjectStoreWithKeyPathAndAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data, key);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "data error");
                    };
                }
                catch (ex){
                    assert.equal(ex.name, "DataError", "DataError");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.ok(false, "Transaction abort");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with existing external key", function (assert) {
    var done = assert.async();
    assert.expect(3);

    initionalSituationObjectStoreNoAutoIncrementWithData(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(addData, addData.id);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.equal(e.target.error.name, "ConstraintError", "ConstraintError");
                    };
                }
                catch (ex){
                    assert.ok(false, "Add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.equal(err.target.error.name, "ConstraintError", "ConstraintError");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (err){
                    assert.equal(err.target.error.name, "ConstraintError", "ConstraintError");
                    //**/e.target.result.close();
                    //done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with existing internal key", function (assert) {
    var done = assert.async();
    assert.expect(3);

    initionalSituationObjectStoreWithKeyPathAndDataNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(addData);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.equal(e.target.error.name, "ConstraintError", "ConstraintError");
                    };
                }
                catch (ex){
                    assert.ok(false, "Add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.equal(err.target.error.name, "ConstraintError", "ConstraintError");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (err){
                    assert.equal(err.target.error.name, "ConstraintError", "ConstraintError");
                    //e.target.result.close();
                    //done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with invalid key", function (assert) {
    var done = assert.async();
    assert.expect(1);
    var data = { test: "test" };

    initionalSituationObjectStoreNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data, data);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "Add error");
                    };
                }
                catch (ex){
                    assert.equal(ex.name, "DataError", "DataError");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.ok(false, "Transaction abort");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with external key - string", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test" };
    var key = "key";

    initionalSituationObjectStoreNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data, key);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.equal(e.target.result, key, "Key ok");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with external key - array", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test" };
    var key = [1,2,3];

    initionalSituationObjectStoreNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data, key);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.deepEqual(e.target.result, key, "Key ok");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with inline key - string", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test", id: "key" };
    initionalSituationObjectStoreWithKeyPathNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.equal(e.target.result, data.id, "Key same as provided");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction error");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database exception");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with inline key - date", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test", id: new Date() };
    initionalSituationObjectStoreWithKeyPathNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.deepEqual(e.target.result, data.id, "Key same as provided");
                    };
                    addRequest.onerror = function (e){
                    assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction error");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database exception");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with inline key - array", function (assert) {
    var done = assert.async();
    assert.expect(2);
    var data = { test: "test", id: [1,2,3] };
    initionalSituationObjectStoreWithKeyPathNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data);

                    addRequest.onsuccess = function (e){
                        assert.ok(true, "data added");
                        assert.deepEqual(e.target.result, data.id, "Key same as provided");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "add error");
                    };
                }
                catch (ex){
                    assert.ok(false, "add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (){
                    assert.ok(false, "Transaction aborted");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data - ReadOnly transaction", function (assert) {
    var done = assert.async();
    assert.expect(1);
    var data = { test: "test" };
    var key = "key";

    initionalSituationObjectStoreNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readonly");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data, key);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "Add error");
                    };
                }
                catch (ex){
                    assert.equal(ex.name, "ReadOnlyError", "ReadOnlyError");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.ok(false, "Transaction abort");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data - DataCloneError", function (assert) {
    var done = assert.async();
    assert.expect(1);
    var data = { test: "test", toString: function () {
                                            return true;
                                        }
                };
    var key = "key";

    initionalSituationObjectStoreNoAutoIncrement(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(data, key);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.ok(false, "Add error");
                    };
                }
                catch (ex){
                    assert.equal(ex.name, "DataCloneError", "DataCloneError");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.ok(false, "Transaction abort");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (){
                    assert.ok(false, "Transaction error");
                    e.target.result.close();
                    done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
QUnit.test("Adding data with existing index key - unique index ", function (assert) {
    var done = assert.async();
    assert.expect(3);

    initionalSituationIndexUniqueIndexWithData(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(addData, addData.id + 1);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.equal(e.target.error.name, "ConstraintError", "ConstraintError");
                    };
                }
                catch (ex){
                    assert.ok(false, "Add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.equal(err.target.error.name, "ConstraintError", "ConstraintError");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (err){
                    assert.equal(err.target.error.name, "ConstraintError", "ConstraintError");
                    //e.target.result.close();
                    //done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
 });
QUnit.test("Adding data with existing index key - unique multientry index ", function (assert) {
    var done = assert.async();
    assert.expect(3);

    initionalSituationIndexUniqueMultiEntryIndexWithData(function () {
        var request = indexedDb.open(dbName);
        request.onsuccess = function(e){
            try{
                var transaction = e.target.result.transaction([objectStoreName], "readwrite");
                var objectstore = transaction.objectStore(objectStoreName);

                try{
                    var addRequest = objectstore.add(addData, addData.id + 1);

                    addRequest.onsuccess = function (e){
                        assert.ok(false, "data added");
                    };
                    addRequest.onerror = function (e){
                        assert.equal(e.target.error.name, "ConstraintError", "ConstraintError");
                    };
                }
                catch (ex){
                    assert.ok(false, "Add exception");
                }

                transaction.oncomplete = function (e){
                    e.target.db.close();
                    done();
                };
                transaction.onabort = function (err){
                    assert.equal(err.target.error.name, "ConstraintError", "ConstraintError");
                    e.target.result.close();
                    done();
                };
                transaction.onerror = function (err){
                    assert.equal(err.target.error.name, "ConstraintError", "ConstraintError");
                    //e.target.result.close();
                    //done();
                };
            }
            catch (ex) {
                assert.ok(false, "Transaction exception");
                e.target.result.close();
                done();
            }
        };
        request.onerror = function(){
            assert.ok(false, "Database error");
            done();
        };
    }, done, assert);
    });
// TODO: test adding data to a deleted objectstore

// TODO Add test with indexes check if data is present


text:
"""rito_lib is a wrapper around Riot API v4.

Due to the deprecation of the static data API, we use data dragon and mimic the
old response from the static-data-api.

usage:
  # setup
  import rito_lib
  s = rito_lib.RitoLib(api_key, proxy, rito_api_channel)

  # wrappers for api calls.
  s.GetSummoner(region, summoner_name)
  s.GetSummonerBySummonerId(region, summoner_id)
  s.ListLeaguePositions(region, summoner_id)
  s.ListChampionMasteries(region, summoner_id)
  s.GetChampionMastery(region, summoner_id, champ_id)
  s.ListRecentMatches(region, account_id)
  s.GetMatch(region, game_id)
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from absl import logging
from google.protobuf import json_format
from google.protobuf import text_format
import grpc
import os
import six

from hypebot.protos.riot import platform_pb2
from hypebot.protos.riot.v4 import champion_mastery_pb2
from hypebot.protos.riot.v4 import champion_mastery_pb2_grpc
from hypebot.protos.riot.v4 import league_pb2
from hypebot.protos.riot.v4 import league_pb2_grpc
from hypebot.protos.riot.v4 import match_pb2
from hypebot.protos.riot.v4 import match_pb2_grpc
from hypebot.protos.riot.v3 import static_data_pb2
from hypebot.protos.riot.v4 import summoner_pb2
from hypebot.protos.riot.v4 import summoner_pb2_grpc

PLATFORM_IDS = {
    'br': platform_pb2.BR1,
    'eune': platform_pb2.EUN1,
    'euw': platform_pb2.EUW1,
    'jp': platform_pb2.JP1,
    'kr': platform_pb2.KR,
    'lan': platform_pb2.LA1,
    'las': platform_pb2.LA2,
    'na': platform_pb2.NA1,
    'oce': platform_pb2.OC1,
    'tr': platform_pb2.TR1,
    'ru': platform_pb2.RU,
    'pbe': platform_pb2.PBE1,
}

class DataDragonLib(object):
  """Wraps ddragon to mimic old static-data-api."""

  _BASE_URL = 'https://ddragon.leagueoflegends.com'

  def __init__(self, proxy):
    self._proxy = proxy

  def _EndpointUrl(self, endpoint, realm='na'):
    response = self._proxy.FetchJson(
        os.path.join(self._BASE_URL, 'realms', '%s.json' % realm))
    version = response.get('v')
    return os.path.join(self._BASE_URL, 'cdn', version, 'data/en_US',
                        '%s.json' % endpoint)

  def ListChampions(self):
    """Use undocumented endpoint to list champions."""
    response = self._proxy.FetchJson(self._EndpointUrl('championFull'))
    # Fix differences between static-data and ddragon.
    for _, champ in response['data'].items():
      tmp = champ['id']
      champ['id'] = champ['key']
      champ['key'] = tmp

      for spell in champ['spells']:
        spell['effectBurn'][0] = ''
        for var in spell['vars']:
          if not isinstance(var['coeff'], list):
            var['coeff'] = [var['coeff']]

    return json_format.ParseDict(
        response,
        static_data_pb2.ListChampionsResponse(),
        ignore_unknown_fields=True)

  def ListItems(self):
    response = self._proxy.FetchJson(self._EndpointUrl('item'))
    return json_format.ParseDict(
        response,
        static_data_pb2.ListItemsResponse(),
        ignore_unknown_fields=True)

  def ListReforgedRunePaths(self):
    response = self._proxy.FetchJson(self._EndpointUrl('runesReforged'))
    return json_format.ParseDict(
        {
            'paths': response
        },  # ddragon pls.
        static_data_pb2.ListReforgedRunePathsResponse(),
        ignore_unknown_fields=True)

class RitoLib(object):
  """Class for fetching various data from Riot API."""

  def __init__(self, proxy, channel, api_key):
    self._proxy = proxy
    self.api_key = api_key

    self._champion_mastery_service = (
        champion_mastery_pb2_grpc.ChampionMasteryServiceStub(channel))
    self._league_service = league_pb2_grpc.LeagueServiceStub(channel)
    self._match_service = match_pb2_grpc.MatchServiceStub(channel)
    self._summoner_service = summoner_pb2_grpc.SummonerServiceStub(channel)

    self._ddragon = DataDragonLib(self._proxy)

  def _GetPlatformMetadata(self, region):
    return platform_pb2.PlatformId.Name(
        PLATFORM_IDS.get(region, platform_pb2.NA1))

  def _CallApi(self, method, request, region, use_storage=False):
    """Send an RPC to the Riot API.

    Returns cached results, if available. By default, results are cached in-
    memory. Results may also be cached permanently in long-term storage.

    Args:
      method: The RPC method to call.
      request: The RPC request.
      region: The Riot API region.
      use_storage: If True, permanently store the result.

    Returns:
      The data or None if the RPC failed.
    """
    metadata = (('api-key', self.api_key), ('platform-id',
                                            self._GetPlatformMetadata(region)))
    rpc_action = lambda: method(request, metadata=metadata).SerializeToString()
    request_plain_text = text_format.MessageToString(
        request, as_utf8=not six.PY2, as_one_line=True)
    method_name = method._method.decode('utf8')
    key = ':'.join((region, method_name, request_plain_text))
    # Handle RPC exceptions outside of the proxy fetch so temporary errors are
    # not cached.
    try:
      r = self._proxy.RawFetch(key, rpc_action, use_storage=use_storage)
      if r:
        return method._response_deserializer(r)
    except grpc.RpcError as e:
      logging.error('RPC %s with request %s failed: %s', method_name, request,
                    e)

  def GetSummoner(self, region, summoner_name):
    return self._CallApi(
        self._summoner_service.GetSummoner,
        summoner_pb2.GetSummonerRequest(summoner_name=summoner_name), region)

  def GetSummonerBySummonerId(self, region, encrypted_summoner_id):
    return self._CallApi(
        self._summoner_service.GetSummoner,
        summoner_pb2.GetSummonerRequest(
            encrypted_summoner_id=encrypted_summoner_id), region)

  def GetSummonerByAccountId(self, region, encrypted_account_id):
    return self._CallApi(
        self._summoner_service.GetSummoner,
        summoner_pb2.GetSummonerRequest(
            encrypted_account_id=encrypted_account_id), region)

  def GetSummonerByPuuid(self, region, encrypted_puuid):
    return self._CallApi(
        self._summoner_service.GetSummoner,
        summoner_pb2.GetSummonerRequest(encrypted_puuid=encrypted_puuid),
        region)

  def ListLeaguePositions(self, region, encrypted_summoner_id):
    return self._CallApi(
        self._league_service.ListLeaguePositions,
        league_pb2.ListLeaguePositionsRequest(
            encrypted_summoner_id=encrypted_summoner_id), region)

  def ListChampionMasteries(self, region, encrypted_summoner_id):
    return self._CallApi(
        self._champion_mastery_service.ListChampionMasteries,
        champion_mastery_pb2.ListChampionMasteriesRequest(
            encrypted_summoner_id=encrypted_summoner_id), region)

  def GetChampionMastery(self, region, encrypted_summoner_id, champ_id):
    return self._CallApi(
        self._champion_mastery_service.GetChampionMastery,
        champion_mastery_pb2.GetChampionMasteryRequest(
            encrypted_summoner_id=encrypted_summoner_id, champion_id=champ_id),
        region)

  def ListRecentMatches(self, region, encrypted_account_id):
    return self._CallApi(
        self._match_service.ListMatches,
        match_pb2.ListMatchesRequest(
            encrypted_account_id=encrypted_account_id, end_index=20), region)

  def GetMatch(self, region, game_id):
    return self._CallApi(
        self._match_service.GetMatch,
        match_pb2.GetMatchRequest(game_id=game_id),
        region,
        use_storage=True)

  def ListItems(self):
    return self._ddragon.ListItems()

  def ListChampions(self):
    return self._ddragon.ListChampions()

  def ListReforgedRunePaths(self):
    return self._ddragon.ListReforgedRunePaths()


text:
package ga.thesis.hibernate.service;

import ga.thesis.hibernate.entities.GroupList;

public interface GroupListService extends CRUDService<GroupList, Long> {
}