text:
.tabs-container {
  overflow: hidden;
}
.tabs-header {
  border-width: 1px;
  border-style: solid;
  border-bottom-width: 0;
  position: relative;
  padding: 0;
  padding-top: 2px;
  overflow: hidden;
}
.tabs-scroller-left,
.tabs-scroller-right {
  position: absolute;
  top: auto;
  bottom: 0;
  width: 18px;
  font-size: 1px;
  display: none;
  cursor: pointer;
  border-width: 1px;
  border-style: solid;
}
.tabs-scroller-left {
  left: 0;
}
.tabs-scroller-right {
  right: 0;
}
.tabs-tool {
  position: absolute;
  bottom: 0;
  padding: 1px;
  overflow: hidden;
  border-width: 1px;
  border-style: solid;
}
.tabs-header-plain .tabs-tool {
  padding: 0 1px;
}
.tabs-wrap {
  position: relative;
  left: 0;
  overflow: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
}
.tabs-scrolling {
  margin-left: 18px;
  margin-right: 18px;
}
.tabs-disabled {
  opacity: 0.3;
  filter: alpha(opacity=30);
}
.tabs {
  list-style-type: none;
  height: 26px;
  margin: 0px;
  padding: 0px;
  padding-left: 4px;
  width: 50000px;
  border-style: solid;
  border-width: 0 0 1px 0;
}
.tabs li {
  float: left;
  display: inline-block;
  margin: 0 4px -1px 0;
  padding: 0;
  position: relative;
  border: 0;
}
.tabs li a.tabs-inner {
  display: inline-block;
  text-decoration: none;
  margin: 0;
  padding: 0 10px;
  height: 25px;
  line-height: 25px;
  text-align: center;
  white-space: nowrap;
  border-width: 1px;
  border-style: solid;
  -moz-border-radius: 5px 5px 0 0;
  -webkit-border-radius: 5px 5px 0 0;
  border-radius: 5px 5px 0 0;
}
.tabs li.tabs-selected a.tabs-inner {
  font-weight: bold;
  outline: none;
}
.tabs li.tabs-selected a:hover.tabs-inner {
  cursor: default;
  pointer: default;
}
.tabs li a.tabs-close,
.tabs-p-tool {
  position: absolute;
  font-size: 1px;
  display: block;
  height: 12px;
  padding: 0;
  top: 50%;
  margin-top: -6px;
  overflow: hidden;
}
.tabs li a.tabs-close {
  width: 12px;
  right: 5px;
  opacity: 0.6;
  filter: alpha(opacity=60);
}
.tabs-p-tool {
  right: 16px;
}
.tabs-p-tool a {
  display: inline-block;
  font-size: 1px;
  width: 12px;
  height: 12px;
  margin: 0;
  opacity: 0.6;
  filter: alpha(opacity=60);
}
.tabs li a:hover.tabs-close,
.tabs-p-tool a:hover {
  opacity: 1;
  filter: alpha(opacity=100);
  cursor: hand;
  cursor: pointer;
}
.tabs-with-icon {
  padding-left: 18px;
}
.tabs-icon {
  position: absolute;
  width: 16px;
  height: 16px;
  left: 10px;
  top: 50%;
  margin-top: -8px;
}
.tabs-title {
  font-size: 12px;
}
.tabs-closable {
  padding-right: 8px;
}
.tabs-panels {
  margin: 0px;
  padding: 0px;
  border-width: 1px;
  border-style: solid;
  border-top-width: 0;
  overflow: hidden;
}
.tabs-header-bottom {
  border-width: 0 1px 1px 1px;
  padding: 0 0 2px 0;
}
.tabs-header-bottom .tabs {
  border-width: 1px 0 0 0;
}
.tabs-header-bottom .tabs li {
  margin: -1px 4px 0 0;
}
.tabs-header-bottom .tabs li a.tabs-inner {
  -moz-border-radius: 0 0 5px 5px;
  -webkit-border-radius: 0 0 5px 5px;
  border-radius: 0 0 5px 5px;
}
.tabs-header-bottom .tabs-tool {
  top: 0;
}
.tabs-header-bottom .tabs-scroller-left,
.tabs-header-bottom .tabs-scroller-right {
  top: 0;
  bottom: auto;
}
.tabs-panels-top {
  border-width: 1px 1px 0 1px;
}
.tabs-header-left {
  float: left;
  border-width: 1px 0 1px 1px;
  padding: 0;
}
.tabs-header-right {
  float: right;
  border-width: 1px 1px 1px 0;
  padding: 0;
}
.tabs-header-left .tabs-wrap,
.tabs-header-right .tabs-wrap {
  height: 100%;
}
.tabs-header-left .tabs {
  height: 100%;
  padding: 4px 0 0 2px;
  border-width: 0 1px 0 0;
}
.tabs-header-right .tabs {
  height: 100%;
  padding: 4px 2px 0 0;
  border-width: 0 0 0 1px;
}
.tabs-header-left .tabs li,
.tabs-header-right .tabs li {
  display: block;
  width: 100%;
  position: relative;
}
.tabs-header-left .tabs li {
  left: auto;
  right: 0;
  margin: 0 -1px 4px 0;
  float: right;
}
.tabs-header-right .tabs li {
  left: 0;
  right: auto;
  margin: 0 0 4px -1px;
  float: left;
}
.tabs-justified li a.tabs-inner {
  padding-left: 0;
  padding-right: 0;
}
.tabs-header-left .tabs li a.tabs-inner {
  display: block;
  text-align: left;
  padding-left: 10px;
  padding-right: 10px;
  -moz-border-radius: 5px 0 0 5px;
  -webkit-border-radius: 5px 0 0 5px;
  border-radius: 5px 0 0 5px;
}
.tabs-header-right .tabs li a.tabs-inner {
  display: block;
  text-align: left;
  padding-left: 10px;
  padding-right: 10px;
  -moz-border-radius: 0 5px 5px 0;
  -webkit-border-radius: 0 5px 5px 0;
  border-radius: 0 5px 5px 0;
}
.tabs-panels-right {
  float: right;
  border-width: 1px 1px 1px 0;
}
.tabs-panels-left {
  float: left;
  border-width: 1px 0 1px 1px;
}
.tabs-header-noborder,
.tabs-panels-noborder {
  border: 0px;
}
.tabs-header-plain {
  border: 0px;
  background: transparent;
}
.tabs-pill {
  padding-bottom: 3px;
}
.tabs-header-bottom .tabs-pill {
  padding-top: 3px;
  padding-bottom: 0;
}
.tabs-header-left .tabs-pill {
  padding-right: 3px;
}
.tabs-header-right .tabs-pill {
  padding-left: 3px;
}
.tabs-header .tabs-pill li a.tabs-inner {
  -moz-border-radius: 5px 5px 5px 5px;
  -webkit-border-radius: 5px 5px 5px 5px;
  border-radius: 5px 5px 5px 5px;
}
.tabs-header-narrow,
.tabs-header-narrow .tabs-narrow {
  padding: 0;
}
.tabs-narrow li,
.tabs-header-bottom .tabs-narrow li {
  margin-left: 0;
  margin-right: -1px;
}
.tabs-narrow li.tabs-last,
.tabs-header-bottom .tabs-narrow li.tabs-last {
  margin-right: 0;
}
.tabs-header-left .tabs-narrow,
.tabs-header-right .tabs-narrow {
  padding-top: 0;
}
.tabs-header-left .tabs-narrow li {
  margin-bottom: -1px;
  margin-right: -1px;
}
.tabs-header-left .tabs-narrow li.tabs-last,
.tabs-header-right .tabs-narrow li.tabs-last {
  margin-bottom: 0;
}
.tabs-header-right .tabs-narrow li {
  margin-bottom: -1px;
  margin-left: -1px;
}
.tabs-scroller-left {
  background: #222222 url('images/tabs_icons.png') no-repeat 1px center;
}
.tabs-scroller-right {
  background: #222222 url('images/tabs_icons.png') no-repeat -15px center;
}
.tabs li a.tabs-close {
  background: url('images/tabs_icons.png') no-repeat -34px center;
}
.tabs li a.tabs-inner:hover {
  background: #003147;
  color: #ffffff;
  filter: none;
}
.tabs li.tabs-selected a.tabs-inner {
  background-color: #000000;
  color: #eeeeee;
  background: -webkit-linear-gradient(top,#626262 0,#000000 100%);
  background: -moz-linear-gradient(top,#626262 0,#000000 100%);
  background: -o-linear-gradient(top,#626262 0,#000000 100%);
  background: linear-gradient(to bottom,#626262 0,#000000 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#626262,endColorstr=#000000,GradientType=0);
}
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner {
  background: -webkit-linear-gradient(top,#000000 0,#626262 100%);
  background: -moz-linear-gradient(top,#000000 0,#626262 100%);
  background: -o-linear-gradient(top,#000000 0,#626262 100%);
  background: linear-gradient(to bottom,#000000 0,#626262 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#000000,endColorstr=#626262,GradientType=0);
}
.tabs-header-left .tabs li.tabs-selected a.tabs-inner {
  background: -webkit-linear-gradient(left,#626262 0,#000000 100%);
  background: -moz-linear-gradient(left,#626262 0,#000000 100%);
  background: -o-linear-gradient(left,#626262 0,#000000 100%);
  background: linear-gradient(to right,#626262 0,#000000 100%);
  background-repeat: repeat-y;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#626262,endColorstr=#000000,GradientType=1);
}
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
  background: -webkit-linear-gradient(left,#000000 0,#626262 100%);
  background: -moz-linear-gradient(left,#000000 0,#626262 100%);
  background: -o-linear-gradient(left,#000000 0,#626262 100%);
  background: linear-gradient(to right,#000000 0,#626262 100%);
  background-repeat: repeat-y;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#000000,endColorstr=#626262,GradientType=1);
}
.tabs li a.tabs-inner {
  color: #eeeeee;
  background-color: #222222;
  background: -webkit-linear-gradient(top,#626262 0,#222222 100%);
  background: -moz-linear-gradient(top,#626262 0,#222222 100%);
  background: -o-linear-gradient(top,#626262 0,#222222 100%);
  background: linear-gradient(to bottom,#626262 0,#222222 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#626262,endColorstr=#222222,GradientType=0);
}
.tabs-header,
.tabs-tool {
  background-color: #222222;
}
.tabs-header-plain {
  background: transparent;
}
.tabs-header,
.tabs-scroller-left,
.tabs-scroller-right,
.tabs-tool,
.tabs,
.tabs-panels,
.tabs li a.tabs-inner,
.tabs li.tabs-selected a.tabs-inner,
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner,
.tabs-header-left .tabs li.tabs-selected a.tabs-inner,
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
  border-color: #444444;
}
.tabs-p-tool a:hover,
.tabs li a:hover.tabs-close,
.tabs-scroller-over {
  background-color: #003147;
}
.tabs li.tabs-selected a.tabs-inner {
  border-bottom: 1px solid #000000;
}
.tabs-header-bottom .tabs li.tabs-selected a.tabs-inner {
  border-top: 1px solid #000000;
}
.tabs-header-left .tabs li.tabs-selected a.tabs-inner {
  border-right: 1px solid #000000;
}
.tabs-header-right .tabs li.tabs-selected a.tabs-inner {
  border-left: 1px solid #000000;
}
.tabs-header .tabs-pill li.tabs-selected a.tabs-inner {
  background: #0972a5;
  color: #ffffff;
  filter: none;
  border-color: #444444;
}


text:
import CommunicationMethodsFormatter
from '../../../src/lib/communication-methods-formatter';

describe('Communication methods formatter', function() {
  before(function() {});

  after(function() {});

  describe('#getCommunicationMethods()', function() {
    it(
      'should not include skype in communication methods if it has been selected already',
      function() {
        const context = {
          communicationMethods: {
            SKYPE: '',
          },
        };

        const communicationMethods = CommunicationMethodsFormatter
          .getCommunicationMethods(context);

        const expected = [{
            title: 'Puhelin',
            payload: 'PHONE',
          },
        ];

        return expect(communicationMethods)
          .to.deep
          .equal(expected);
      });

    it('should get all communication methods', function() {
      const communicationMethods = CommunicationMethodsFormatter
        .getCommunicationMethods(context);

      const expected = [{
          title: 'Skype',
          payload: 'SKYPE',
        },
        {
          title: 'Puhelin',
          payload: 'PHONE',
        },
      ];

      return expect(communicationMethods)
        .to.deep
        .equal(expected);
    });
  });

  describe('#getCommunicationMethodByIdentifier()', function() {
    it(
      'should find right string to ask for right communication Method(Skype)',
      function() {
        const input = 'SKYPE';

        const expected = {
          identifier: 'SKYPE',
          name: 'Skype',
          infoRequestText: '@REQUEST_SKYPE_NAME',
        };

        return expect(CommunicationMethodsFormatter
            .getCommunicationMethodByIdentifier(input))
          .to.deep
          .equal(expected);
      });
  });

  describe('#getCommunicationMethodByInput()', function() {
    it(
      'should find right string to ask for right communication Method(Skype)',
      function() {
        const input = 'Skype';

        const expected = {
          identifier: 'SKYPE',
          name: 'Skype',
          infoRequestText: '@REQUEST_SKYPE_NAME',
        };

        return expect(CommunicationMethodsFormatter
            .getCommunicationMethodByInput(input))
          .to.deep
          .equal(expected);
      });

    it(
      'should find right string to ask for right communication Method(Phonenumber)',
      function() {
        const input = 'Puhelin';
        const expected = {
          identifier: 'PHONE',
          name: 'Puhelin',
          infoRequestText: '@REQUEST_PHONE_NUMBER',
        };

        return expect(CommunicationMethodsFormatter
            .getCommunicationMethodByInput(input))
          .to.deep
          .equal(expected);
      });
  });

  describe('#createCommunicationMethodslist()', function() {
    it(
      'should return an array of added communication methods',
      function() {
        const context = {
          communicationMethods: {
            SKYPE: 'nickname',
          },
        };

        return expect(CommunicationMethodsFormatter
            .createCommunicationMethodslist(context))
          .to.deep
          .equal([' Skype (nickname)']);
      });
  });
});

redpajama_set_name: RedPajamaGithub


text:
title: Loops
localeTitle: Loops
---
Петли используются в JavaScript для выполнения повторяющихся задач на основе условия. Условия обычно возвращают `true` или `false` при анализе. Цикл будет продолжаться до тех пор, пока определенное условие не вернет `false` .

Существует три общих типа циклов:

*   [за](http://forum.freecodecamp.com/t/javascript-for-loop/14666)
*   [в то время как](http://forum.freecodecamp.com/t/javascript-while-loop/14668)
*   [делать пока](http://forum.freecodecamp.com/t/javascript-for-loop/14662)

Вы можете ввести `js for` , `js while` или `js do while` чтобы получить дополнительную информацию об этом.

> Ссылки: [MDN **для цикла**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for)


text:
<?php

$this->data['header'] = 'OpenID Login';
$this->data['autofocus'] = 'openid-identifier';
$this->includeAtTemplateBase('includes/header.php');

?>

    <?php if (isset($this->data['error'])) { print "
" . $this->data['error'] . "
"; } ?>

	<form method="get" action="consumer.php">
		<fieldset>
			<legend>OpenID Login</legend>

			Identity URL:
			<input type="hidden" name="action" value="verify" />
			<input id="openid-identifier" class="openid-identifier" type="text" name="openid_url" value="http://" />
			<input type="hidden" name="AuthState" value="<?php echo htmlspecialchars($this->data['AuthState']); ?>" />
			<input type="submit" value="Login with OpenID" />
		</fieldset>
	</form>

       OpenID is a free and easy way to use a single digital identity across the Internet. Enter your OpenID identity URL in the box above to authenticate.

<?php
$this->includeAtTemplateBase('includes/footer.php');
?>


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('pairprogram', '0002_auto_20160720_1006'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='session',
            name='theme',
        ),
    ]


text:
    <jf-panel ng-repeat="history in jfReleaseHistory.historyData"
              jf-panel-heading="{{history.status}}">

                {{jfReleaseHistory.DICTIONARY[key]}}:

                    {{value}}

                    {{value}}

    </jf-panel>

        This build has no release history.


text:
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */

/*
    Memcached protocol extensions for testapp.

    Provides extended protocol commands to enable interesting testcases.

    1. Currently supports shifting Memcached's timeofday.
*/

#ifndef TESTAPP_EXTENSION_H
#define TESTAPP_EXTENSION_H

#include <memcached/protocol_binary.h>

/** The default command id for the adjust timeofday operation (override with t=) */
#define PROTOCOL_BINARY_CMD_ADJUST_TIMEOFDAY (uint8_t)(0xE3 & 0xff)

#ifdef __cplusplus
extern "C" {
#endif

    /**
     * Definition of the packet used by adjust timeofday
     */
    typedef union {
        struct {
            protocol_binary_request_header header;
            struct {
                uint64_t offset;
            } body;
        } message;
        uint8_t bytes[sizeof(protocol_binary_request_header) + 8];
    } protocol_binary_adjust_time;

    /**
     * Definition of the packet returned by adjust_timeofday
     */
    typedef protocol_binary_response_no_extras protocol_binary_adjust_time_response;

#ifdef __cplusplus
}
#endif

#endif


text:
import "./UploadAvatar.less";
import { createRef, PureComponent } from "react";

import PropTypes from "prop-types";

export default class UploadAvatar extends PureComponent {
  static propTypes = {
    onLoad: PropTypes.func,
    url: PropTypes.string,
  };

  constructor(props) {
    super(props);

    this.state = {
      progress: -1,
      hasError: false,
    };

    this.onSelectFile = this.onSelectFile.bind(this);
    this.doUpload = this.doUpload.bind(this);
    this.renderProgress = this.renderProgress.bind(this);
    this.formRef = createRef();
  }

  onSelectFile(e) {
    if (e.target.value.length > 0) {
      this.setState(
        {
          progress: 0,
          hasError: false,
        },
        this.doUpload
      );
    }
  }

  doUpload() {
    const form = new FormData(this.formRef.current);
    const req = new XMLHttpRequest(form);
    req.open("POST", this.props.url);

    // Upload avatar in process
    req.upload.addEventListener(
      "progress",
      (e) => {
        const progress =
          e.total !== 0 ? parseInt((e.loaded / e.total) * 100, 10) : 0;
        this.setState({
          progress,
        });
      },
      false
    );

    // Upload avatar complete
    req.addEventListener(
      "load",
      (e) => {
        this.setState({ progress: -1, hasError: req.status !== 200 }, () => {
          this.props.onLoad(e, req);
        });
      },
      false
    );

    req.send(form);
  }

  renderForm() {
    return (

Change Avatar

        <form
          className="_react_fileupload_form_content"
          ref={this.formRef}
          method="post"
        >
          <input type="file" name="file" onChange={this.onSelectFile} />
        </form>

    );
  }

  renderProgress(progress) {
    if (progress > -1) {
      const barStyle = { width: progress + "%" };

      let message = Uploading ...;
      if (progress === 100) {
        message = Successfully uploaded;
      }

      return (

{message}

      );
    }
    return; // TODO to Vasyl, I think it excess
  }

  render() {
    return (

        {this.renderForm()}
        {this.renderProgress(this.state.progress)}

    );
  }
}


text:
#pragma once
#ifndef CLIQ_NUMERIC_LOWERSOLVE_LOCALFRONT_HPP
#define CLIQ_NUMERIC_LOWERSOLVE_LOCALFRONT_HPP

namespace cliq {

template<typename F>
void FrontLowerForwardSolve( const Matrix<F>& L, Matrix<F>& X );
template<typename F>
void FrontIntraPivLowerForwardSolve
( const Matrix<F>& L, const Matrix<Int>& p, Matrix<F>& X );

template<typename F>
void FrontLowerBackwardSolve
( const Matrix<F>& L, Matrix<F>& X, bool conjugate=false );
template<typename F>
void FrontIntraPivLowerBackwardSolve
( const Matrix<F>& L, const Matrix<Int>& p, Matrix<F>& X,
  bool conjugate=false );

//----------------------------------------------------------------------------//
// Implementation begins here                                                 //
//----------------------------------------------------------------------------//

template<typename F>
inline void FrontLowerForwardSolve( const Matrix<F>& L, Matrix<F>& X )
{
    DEBUG_ONLY(
        CallStackEntry cse("FrontLowerForwardSolve");
        if( L.Height() < L.Width() || L.Height() != X.Height() )
            LogicError
            ("Nonconformal solve:\n",
             DimsString(L,"L"),"\n",DimsString(X,"X"));
    )
    Matrix<F> LT, LB, XT, XB;
    LockedPartitionDown( L, LT, LB, L.Width() );
    PartitionDown( X, XT, XB, L.Width() );

    El::Trsm( LEFT, LOWER, NORMAL, NON_UNIT, F(1), LT, XT, true );
    El::Gemm( NORMAL, NORMAL, F(-1), LB, XT, F(1), XB );
}

template<typename F>
inline void FrontIntraPivLowerForwardSolve
( const Matrix<F>& L, const Matrix<Int>& p, Matrix<F>& X )
{
    DEBUG_ONLY(CallStackEntry cse("FrontIntraPivLowerForwardSolve"))
    Matrix<F> XT, XB;
    PartitionDown( X, XT, XB, L.Width() );
    El::PermuteRows( XT, p );
    FrontLowerForwardSolve( L, X );
}

template<typename F>
inline void FrontLowerBackwardSolve
( const Matrix<F>& L, Matrix<F>& X, bool conjugate )
{
    DEBUG_ONLY(
        CallStackEntry cse("FrontLowerBackwardSolve");
        if( L.Height() < L.Width() || L.Height() != X.Height() )
            LogicError
            ("Nonconformal solve:\n",
             DimsString(L,"L"),"\n",DimsString(X,"X"));
    )
    Matrix<F> LT, LB, XT, XB;
    LockedPartitionDown( L, LT, LB, L.Width() );
    PartitionDown( X, XT, XB, L.Width() );

    const Orientation orientation = ( conjugate ? ADJOINT : TRANSPOSE );
    El::Gemm( orientation, NORMAL, F(-1), LB, XB, F(1), XT );
    El::Trsm( LEFT, LOWER, orientation, NON_UNIT, F(1), LT, XT, true );
}

template<typename F>
inline void FrontIntraPivLowerBackwardSolve
( const Matrix<F>& L, const Matrix<Int>& p, Matrix<F>& X, bool conjugate )
{
    DEBUG_ONLY(CallStackEntry cse("FrontIntraPivLowerBackwardSolve"))
    FrontLowerBackwardSolve( L, X, conjugate );
    Matrix<F> XT, XB;
    PartitionDown( X, XT, XB, L.Width() );
    El::InversePermuteRows( XT, p );
}

} // namespace cliq

#endif // ifndef CLIQ_NUMERIC_LOWERSOLVE_LOCALFRONT_HPP


text:
package gocql

import (
	"fmt"
	"reflect"
	"sort"
	"testing"
	"time"

	"gopkg.in/inf.v0"
)

type WikiPage struct {
	Title       string
	RevId       UUID
	Body        string
	Views       int64
	Protected   bool
	Modified    time.Time
	Rating      *inf.Dec
	Tags        []string
	Attachments map[string]WikiAttachment
}

type WikiAttachment []byte

var wikiTestData = []*WikiPage{
	{
		Title:    "Frontpage",
		RevId:    TimeUUID(),
		Body:     "Welcome to this wiki page!",
		Rating:   inf.NewDec(131, 3),
		Modified: time.Date(2013, time.August, 13, 9, 52, 3, 0, time.UTC),
		Tags:     []string{"start", "important", "test"},
		Attachments: map[string]WikiAttachment{
			"logo":    WikiAttachment("\x00company logo\x00"),
			"favicon": WikiAttachment("favicon.ico"),
		},
	},
	{
		Title:    "Foobar",
		RevId:    TimeUUID(),
		Body:     "foo::Foo f = new foo::Foo(foo::Foo::INIT);",
		Modified: time.Date(2013, time.August, 13, 9, 52, 3, 0, time.UTC),
	},
}

type WikiTest struct {
	session *Session
	tb      testing.TB

	table string
}

func CreateSchema(session *Session, tb testing.TB, table string) *WikiTest {
	table = "wiki_" + table
	if err := createTable(session, fmt.Sprintf("DROP TABLE IF EXISTS gocql_test.%s", table)); err != nil {
		tb.Fatal("CreateSchema:", err)
	}

	err := createTable(session, fmt.Sprintf(`CREATE TABLE gocql_test.%s (
			title       varchar,
			revid       timeuuid,
			body        varchar,
			views       bigint,
			protected   boolean,
			modified    timestamp,
			rating      decimal,
			tags        set<varchar>,
			attachments map<varchar, blob>,
			PRIMARY KEY (title, revid)
		)`, table))

	if err != nil {
		tb.Fatal("CreateSchema:", err)
	}

	return &WikiTest{
		session: session,
		tb:      tb,
		table:   table,
	}
}

func (w *WikiTest) CreatePages(n int) {
	var page WikiPage
	t0 := time.Now()
	for i := 0; i < n; i++ {
		page.Title = fmt.Sprintf("generated_%d", (i&16)+1)
		page.Modified = t0.Add(time.Duration(i-n) * time.Minute)
		page.RevId = UUIDFromTime(page.Modified)
		page.Body = fmt.Sprintf("text %d", i)
		if err := w.InsertPage(&page); err != nil {
			w.tb.Error("CreatePages:", err)
		}
	}
}

func (w *WikiTest) InsertPage(page *WikiPage) error {
	return w.session.Query(fmt.Sprintf(`INSERT INTO %s
		(title, revid, body, views, protected, modified, rating, tags, attachments)
		VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, w.table),
		page.Title, page.RevId, page.Body, page.Views, page.Protected,
		page.Modified, page.Rating, page.Tags, page.Attachments).Exec()
}

func (w *WikiTest) SelectPage(page *WikiPage, title string, revid UUID) error {
	return w.session.Query(fmt.Sprintf(`SELECT title, revid, body, views, protected,
		modified,tags, attachments, rating
		FROM %s WHERE title = ? AND revid = ? LIMIT 1`, w.table),
		title, revid).Scan(&page.Title, &page.RevId,
		&page.Body, &page.Views, &page.Protected, &page.Modified, &page.Tags,
		&page.Attachments, &page.Rating)
}

func (w *WikiTest) GetPageCount() int {
	var count int
	if err := w.session.Query(fmt.Sprintf(`SELECT COUNT(*) FROM %s`, w.table)).Scan(&count); err != nil {
		w.tb.Error("GetPageCount", err)
	}
	return count
}

func TestWikiCreateSchema(t *testing.T) {
	session := createSession(t)
	defer session.Close()

	CreateSchema(session, t, "create")
}

func BenchmarkWikiCreateSchema(b *testing.B) {
	b.StopTimer()
	session := createSession(b)
	defer func() {
		b.StopTimer()
		session.Close()
	}()

	b.StartTimer()
	for i := 0; i < b.N; i++ {
		CreateSchema(session, b, "bench_create")
	}
}

func TestWikiCreatePages(t *testing.T) {
	session := createSession(t)
	defer session.Close()

	w := CreateSchema(session, t, "create_pages")

	numPages := 5
	w.CreatePages(numPages)
	if count := w.GetPageCount(); count != numPages {
		t.Errorf("expected %d pages, got %d pages.", numPages, count)
	}
}

func BenchmarkWikiCreatePages(b *testing.B) {
	b.StopTimer()
	session := createSession(b)
	defer func() {
		b.StopTimer()
		session.Close()
	}()

	w := CreateSchema(session, b, "bench_create_pages")

	b.StartTimer()

	w.CreatePages(b.N)
}

func BenchmarkWikiSelectAllPages(b *testing.B) {
	b.StopTimer()
	session := createSession(b)
	defer func() {
		b.StopTimer()
		session.Close()
	}()
	w := CreateSchema(session, b, "bench_select_all")

	w.CreatePages(100)
	b.StartTimer()

	var page WikiPage
	for i := 0; i < b.N; i++ {
		iter := session.Query(fmt.Sprintf(`SELECT title, revid, body, views, protected,
			modified, tags, attachments, rating
			FROM %s`, w.table)).Iter()
		for iter.Scan(&page.Title, &page.RevId, &page.Body, &page.Views,
			&page.Protected, &page.Modified, &page.Tags, &page.Attachments,
			&page.Rating) {
			// pass
		}
		if err := iter.Close(); err != nil {
			b.Error(err)
		}
	}
}

func BenchmarkWikiSelectSinglePage(b *testing.B) {
	b.StopTimer()
	session := createSession(b)
	defer func() {
		b.StopTimer()
		session.Close()
	}()
	w := CreateSchema(session, b, "bench_select_single")
	pages := make([]WikiPage, 100)
	w.CreatePages(len(pages))
	iter := session.Query(fmt.Sprintf(`SELECT title, revid FROM %s`, w.table)).Iter()
	for i := 0; i < len(pages); i++ {
		if !iter.Scan(&pages[i].Title, &pages[i].RevId) {
			pages = pages[:i]
			break
		}
	}
	if err := iter.Close(); err != nil {
		b.Error(err)
	}
	b.StartTimer()

	var page WikiPage
	for i := 0; i < b.N; i++ {
		p := &pages[i%len(pages)]
		if err := w.SelectPage(&page, p.Title, p.RevId); err != nil {
			b.Error(err)
		}
	}
}

func BenchmarkWikiSelectPageCount(b *testing.B) {
	b.StopTimer()
	session := createSession(b)
	defer func() {
		b.StopTimer()
		session.Close()
	}()

	w := CreateSchema(session, b, "bench_page_count")
	const numPages = 10
	w.CreatePages(numPages)
	b.StartTimer()
	for i := 0; i < b.N; i++ {
		if count := w.GetPageCount(); count != numPages {
			b.Errorf("expected %d pages, got %d pages.", numPages, count)
		}
	}
}

func TestWikiTypicalCRUD(t *testing.T) {
	session := createSession(t)
	defer session.Close()

	w := CreateSchema(session, t, "crud")

	for _, page := range wikiTestData {
		if err := w.InsertPage(page); err != nil {
			t.Error("InsertPage:", err)
		}
	}
	if count := w.GetPageCount(); count != len(wikiTestData) {
		t.Errorf("count: expected %d, got %d\n", len(wikiTestData), count)
	}
	for _, original := range wikiTestData {
		page := new(WikiPage)
		if err := w.SelectPage(page, original.Title, original.RevId); err != nil {
			t.Error("SelectPage:", err)
			continue
		}
		sort.Sort(sort.StringSlice(page.Tags))
		sort.Sort(sort.StringSlice(original.Tags))
		if !reflect.DeepEqual(page, original) {
			t.Errorf("page: expected %#v, got %#v\n", original, page)
		}
	}
}


text:
export * from './bsv';
export * from './tbsv';


text:
===========================
DenseNet for classification
===========================

.. automodule:: batchflow.models.tf.densenet
    :member-order: bysource
    :members:
    :undoc-members:
    :show-inheritance:


text:
package org.springside.modules.orm.jdbc;

import java.io.StringWriter;
import java.util.Map;

import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;

/**
 * 使用Velocity生成sql的工具类.
 *
 * @author calvin
 */
public class SqlBuilder {

    static {
        try {
            Velocity.init();
        } catch (Exception e) {
            throw new RuntimeException("Exception occurs while initialzie the velociy: " + e.getMessage(), e);
        }
    }

    public static String getSql(String sqlTemplate, Map<String, ?> model) {
        try {
            VelocityContext velocityContext = new VelocityContext(model);
            StringWriter result = new StringWriter();
            Velocity.evaluate(velocityContext, result, "", sqlTemplate);
            return result.toString();
        } catch (Exception e) {
            throw new RuntimeException("Parse sql failed", e);
        }
    }
}


text:
The recommended way to install **Tradukoj connector** is through [Composer](http://packagist.org/about-composer).

Download the composer binary:

``` bash
wget http://getcomposer.org/composer.phar
# or
curl -O http://getcomposer.org/composer.phar
```

Now, install **Tradukoj connector** requiring it into composer.json:

``` json
{
   ...
    "require": {
        ...
        "jlaso/tradukoj-connector": "dev-master"
        ...
    }
}
```

And now you can launch ```composer update``` in order to include the connector in your development.

Once added the autoloader you will have access to the library:

``` php
<?php

require 'vendor/autoload.php';
```

[![Latest Stable Version](https://poser.pugx.org/jlaso/tradukoj-connector/v/stable.png)](https://packagist.org/packages/jlaso/tradukoj-connector)
[![Latest Unstable Version](https://poser.pugx.org/jlaso/tradukoj-connector/v/unstable.png)](https://packagist.org/packages/jlaso/tradukoj-connector)

***

Next section: [Extending **Tradukoj connector**](https://github.com/jlaso/tradukoj-connector/blob/master/doc/usage.md).


text:
<?php

namespace Composer\Util;

use Composer\Factory;
use Composer\IO\IOInterface;
use Composer\Config;
use Composer\Downloader\TransportException;

class GitHub
{
protected $io;
protected $config;
protected $process;
protected $remoteFilesystem;

public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
{
$this->io = $io;
$this->config = $config;
$this->process = $process ?: new ProcessExecutor;
$this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
}

public function authorizeOAuth($originUrl)
{
if (!in_array($originUrl, $this->config->get('github-domains'))) {
return false;
}

 if (0 === $this->process->execute('git config github.accesstoken', $output)) {
$this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');

return true;
}

return false;
}

public function authorizeOAuthInteractively($originUrl, $message = null)
{
if ($message) {
$this->io->writeError($message);
}

$note = 'Composer';
if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
$note .= ' on ' . trim($output);
}
$note .= ' ' . date('Y-m-d Hi');

$url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
$this->io->writeError(sprintf('Head to %s', $url));
$this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));

$token = trim($this->io->askAndHideAnswer('Token (hidden): '));

if (!$token) {
$this->io->writeError('<warning>No token given, aborting.</warning>');
$this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');

return false;
}

$this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');

try {
$apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';

$this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
'retry-auth-failure' => false,
));
} catch (TransportException $e) {
if (in_array($e->getCode(), array(403, 401))) {
$this->io->writeError('<error>Invalid token provided.</error>');
$this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');

return false;
}

throw $e;
}

 $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
$this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);

$this->io->writeError('<info>Token stored successfully.</info>');

return true;
}
}


text:
extract:
	${tooldir}/ecore2bgf cmt.owl.ecore raw.bgf
	${tooldir}/normbgf raw.bgf grammar.bgf

include ../../Makefile.grammar


text:
Efficient inter-`Worker` messaging with fantastic TypeScript support.

## Implementation status

Very much `TODO`!


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('server', '0020_auto_20171212_1623'),
    ]

    operations = [
        migrations.AddField(
            model_name='session',
            name='categories',
            field=models.ManyToManyField(blank=True, db_index=True, related_name='session_list', to='server.Category', verbose_name='Weitere Kategorien'),
        ),
        migrations.AddField(
            model_name='session',
            name='ladies_only',
            field=models.BooleanField(default=False, verbose_name='Von Frauen für Frauen'),
        ),
        migrations.AddField(
            model_name='session',
            name='misc_category',
            field=models.CharField(blank=True, default='', help_text='Kategoriebezeichnung, wenn unter Kategorie "Sonstiges" gewählt wurde', max_length=75, verbose_name='Sonstiges'),
        ),
        migrations.AlterField(
            model_name='profile',
            name='member_year',
            field=models.PositiveIntegerField(blank=True, default=2018, help_text='Jahr der Aufnahme in den AV', null=True, verbose_name='Jahr'),
        ),
        migrations.AlterField(
            model_name='session',
            name='speaker',
            field=models.CharField(blank=True, default='', help_text='Name der/des Referenten', max_length=125, verbose_name='Referent'),
        ),
    ]


text:
#ifndef _CONFIG_OPENRD_H
#define _CONFIG_OPENRD_H

/*
 * Version number information
 */
#ifdef CONFIG_BOARD_IS_OPENRD_ULTIMATE
# define CONFIG_IDENT_STRING	"\nOpenRD-Ultimate"
#else
# ifdef CONFIG_BOARD_IS_OPENRD_CLIENT
#  define CONFIG_IDENT_STRING	"\nOpenRD-Client"
# else
#  ifdef CONFIG_BOARD_IS_OPENRD_BASE
#   define CONFIG_IDENT_STRING	"\nOpenRD-Base"
#  else
#   error Unknown OpenRD board specified
#  endif
# endif
#endif

/*
 * High Level Configuration Options (easy to change)
 */
#define CONFIG_SHEEVA_88SV131	1	/* CPU Core subversion */
#define CONFIG_KW88F6281	1	/* SOC Name */
#define CONFIG_MACH_OPENRD_BASE	/* Machine type */
#define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
#define CONFIG_SYS_THUMB_BUILD

/*
 * Commands configuration
 */
#define CONFIG_SYS_NO_FLASH		/* Declare no flash (NOR/SPI) */
#define CONFIG_SYS_MVFS
#define CONFIG_CMD_ENV
#define CONFIG_CMD_NAND
#define CONFIG_CMD_IDE

/*
 * mv-common.h should be defined after CMD configs since it used them
 * to enable certain macros
 */
#include "mv-common.h"

/*
 *  Environment variables configurations
 */
#ifdef CONFIG_CMD_NAND
#define CONFIG_ENV_IS_IN_NAND		1
#define CONFIG_ENV_SECT_SIZE		0x20000	/* 128K */
#else
#define CONFIG_ENV_IS_NOWHERE		1	/* if env in SDRAM */
#endif
/*
 * max 4k env size is enough, but in case of nand
 * it has to be rounded to sector size
 */
#define CONFIG_ENV_SIZE			0x20000	/* 128k */
#define CONFIG_ENV_ADDR			0x60000
#define CONFIG_ENV_OFFSET		0x60000	/* env starts here */
/*
 * Environment is right behind U-Boot in flash. Make sure U-Boot
 * doesn't grow into the environment area.
 */
#define CONFIG_BOARD_SIZE_LIMIT		CONFIG_ENV_OFFSET

/*
 * Default environment variables
 */
#define CONFIG_BOOTCOMMAND		"${x_bootcmd_kernel}; "	\
	"setenv bootargs ${x_bootargs} ${x_bootargs_root}; "	\
	"${x_bootcmd_usb}; bootm 0x6400000;"

#define MTDIDS_DEFAULT		"nand0=nand_mtd"
#define MTDPARTS_DEFAULT	"mtdparts=nand_mtd:0x100000@0x000000(uboot),"\
	"0x400000@0x100000(uImage),"\
	"0x1fb00000@0x500000(rootfs)"

#define CONFIG_EXTRA_ENV_SETTINGS	"x_bootargs=console"		\
	"=ttyS0,115200 "MTDPARTS_DEFAULT " rw ubi.mtd=2,2048\0"		\
	"x_bootcmd_kernel=nand read 0x6400000 0x100000 0x300000\0"	\
	"x_bootcmd_usb=usb start\0"					\
	"x_bootargs_root=root=ubi0:rootfs rootfstype=ubifs\0"		\
	"mtdids="MTDIDS_DEFAULT"\0"					\
	"mtdparts="MTDPARTS_DEFAULT"\0"

/*
 * Ethernet Driver configuration
 */
#ifdef CONFIG_CMD_NET
# ifdef CONFIG_BOARD_IS_OPENRD_BASE
#  define CONFIG_MVGBE_PORTS	{1, 0}	/* enable port 0 only */
# else
#  define CONFIG_MVGBE_PORTS	{1, 1}	/* enable both ports */
# endif
# ifdef CONFIG_BOARD_IS_OPENRD_ULTIMATE
#  define CONFIG_PHY_BASE_ADR	0x0
#  define PHY_NO		"88E1121"
# else
#  define CONFIG_PHY_BASE_ADR	0x8
#  define PHY_NO		"88E1116"
# endif
#endif /* CONFIG_CMD_NET */

/*
 * SATA Driver configuration
 */
#ifdef CONFIG_MVSATA_IDE
#define CONFIG_SYS_ATA_IDE0_OFFSET	MV_SATA_PORT0_OFFSET
#define CONFIG_SYS_ATA_IDE1_OFFSET	MV_SATA_PORT1_OFFSET
#endif /*CONFIG_MVSATA_IDE*/

#ifdef CONFIG_CMD_MMC
#define CONFIG_MMC
#define CONFIG_GENERIC_MMC
#define CONFIG_MVEBU_MMC
#define CONFIG_SYS_MMC_BASE KW_SDIO_BASE
#endif /* CONFIG_CMD_MMC */

#endif /* _CONFIG_OPENRD_BASE_H */


text:
layout: post
title: "watch_saga"
description: ""
category: "old"
tags: []
---

Watch Saga
==========

![watch_hello](http://hackniac.com/images/posts/simulacrum/watch_hello.jpg)

School burnt me out so I took refuge in a small personal hackathon. Believe or not, this project went from conception to working hardware with "hello world" code inside of 4 hours. The only point to it was to build a small, portable platform for fun-to-write 8 bit code. I had all the parts in my junk bin, dead-bug soldered everything, made up the schematic as I went along, and worked like mad. It helped that I am extremely familiar with all of the parts that I used, and kept the design relatively simple (electrically unsafe).

Hardware
--------

![parts](http://hackniac.com/images/posts/simulacrum/parts.jpg)

Obviously it's gross and not super robust. I super-glued things together as I went along so there was no chance of repair. It just had to work the first time, and very luckily, it did. Surprisingly the formfactor feels pretty slim. I guess that's what you can buy with space left unused by a sane design.

__parts list__

* Atmega328P - the 8 bit, 8 MHz CPU with 32 KB of flash and 2 KB of SRAM
* RN-42 serial Bluetooth module - for loading firmware and games from a phone or PC
* 24LC256 serial EEPROM - for saving games and data like high scores
* 3.3v LiPo battery
* DC to DC boost converter - to manage the battery

Software
--------

![vm_run](http://hackniac.com/images/posts/simulacrum/vm_run.png)

I did a neat experiment with [the software](https://github.com/jmptable/simcrum) for the watch. I made it so that the C code for the firmware can be compiled for the AVR or for my PC. When it's compiled for my PC it gets run with simulated hardware devices that implement the APIs I defined. SDL is used to display the screen and manage threading. Because applications for the watch can be compiled and run on a PC the development time is much shorter than it would usually be. Normally I'd need to flash the compiled code to the device after every change, and that can take thirty seconds or more. And often hardware issues will obscure the software issues that I am testing for. Development is much more pleasant with the simulation framework, but it did require a lot more code to properly implement the hardware.

When I was working on this project I made [a thread on the TigSource forums](http://forums.tigsource.com/index.php?topic=34294.0) (an indie gaming forum).


text:
from icalendar import Calendar, vDatetime
from datetime import datetime
import pytz

class CalendarParser:

    def __init__(self, file_path):
        self.file_path = file_path
        self.calendar_events = []
        self.parse_and_store_calendar()

    def parse_and_store_calendar(self):
        f = open(self.file_path, 'rb')
        gcal = Calendar.from_ical(f.read())
        for component in gcal.walk():
            if component.name == "VEVENT":
                temp_start = component.get("dtstart").dt
                temp_end = component.get("dtend").dt
                self.calendar_events.append((temp_start, temp_end))
        f.close()

    def check_event_availability(self, event_start, event_end):
        for start, end in self.calendar_events:
            start = start.replace(tzinfo=pytz.timezone('US/Eastern'))
            end = end.replace(tzinfo=pytz.timezone('US/Eastern'))
            if event_start < end <= event_end:
                print "*******"
            print start, end, event_start, event_end
            if event_start <= start < event_end:
                return False
            elif event_start >= start and event_end <= end:
                return False
            elif event_start < end >= event_end:
                return False
        else:
            return True

def main():
    c = CalendarParser("/Users/Derek/Desktop/Courses.ics")
    print c.calendar_events
    print(c.check_event_availability(datetime(2016,1,11,15,0), datetime(2016,1,11,15,10)))
    print datetime(2016,1,11,15,0).time()

if __name__ == '__main__':
    main()


text:
<!--

     Copyright 2008 Marvin Herman Froeder
     Licensed 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.

-->
<body>
	<links>
		<item name="Maven 2" href="http://maven.apache.org/"/>
        <item name="Flex Mojos" href="http://www.flexmojos.info/"/>
	</links>

	<menu name="Overview">
		<item name="Introduction" href="index.html"/>
		<item name="Usage" href="usage.html"/>
		<!--item name="FAQ" href="faq.html"/-->
	</menu>

	<!--
	<menu name="Examples">
		<item name="Compile Library" href="examples/compile-library.html"/>
	</menu>
	-->

	<menu ref="reports"/>
</body>


text:
package examples;

import java.util.Objects;

import static co.unruly.control.casts.Equality.areEqual;

/**
 * Just a demonstration of how we can build a cleaner way to check equality
 * using Result-based casts under the hood.
 */
public class ConciseEquals {

    private final int number;
    private final String text;

    public ConciseEquals(int number, String text) {
        this.number = number;
        this.text = text;
    }

//    The best of the IntelliJ inbuilt equality templates
//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//        ConciseEquals that = (ConciseEquals) o;
//        return number == that.number &&
//            Objects.equals(text, that.text);
//    }

    @Override
    public boolean equals(Object o) {
        return areEqual(this, o, (a, b) ->
            a.number == b.number &&
            Objects.equals(a.text, b.text)
        );
    }

    @Override
    public int hashCode() {
        return Objects.hash(number, text);
    }
}


text:
package utilities;

import java.util.Map.Entry;

import javax.persistence.Entity;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import utilities.internal.DatabaseUtil;
import domain.DomainEntity;

public class PopulateDatabase {

	public static void main(String[] args) {
		ApplicationContext populationContext;
		DatabaseUtil databaseUtil;

		databaseUtil = null;

		try {
			System.out.printf("PopulateDatabase 1.3%n");
			System.out.printf("--------------------%n%n");

			System.out.printf("Initialising persistence context `%s'...%n", DatabaseConfig.PersistenceUnit);
			databaseUtil = new DatabaseUtil();

			System.out.printf("Creating database `%s' (%s)...%n", databaseUtil.getDatabaseName(), databaseUtil.getDatabaseDialectName());
			databaseUtil.recreateDatabase();

			System.out.printf("Reading configuration file `%s'...%n", "PopulateDatabase.xml");
			populationContext = new ClassPathXmlApplicationContext("classpath:populateDatabase.xml");

			System.out.printf("Persisting %d entities...%n%n", populationContext.getBeanDefinitionCount());
			databaseUtil.openTransaction();
			for (Entry<String, Object> entry : populationContext.getBeansWithAnnotation(Entity.class).entrySet()) {
				String beanName;
				DomainEntity entity;

				beanName = entry.getKey();
				entity = (DomainEntity) entry.getValue();
				System.out.printf("> %s: %s", beanName, entity.getClass().getName());
				databaseUtil.persist(entity);
				System.out.printf(" -> id = %d, version = %d%n", entity.getId(), entity.getVersion());
			}
			databaseUtil.commitTransaction();
		} catch (Throwable oops) {
			System.out.flush();
			System.err.printf("%n%s%n", oops.getLocalizedMessage());
			oops.printStackTrace(System.err);
		} finally {
			if (databaseUtil != null)
				databaseUtil.close();
		}
	}

}


text:
package io.milton.dns.record;

/**
 * Constants and functions relating to DNS classes.  This is called DClass
 * to avoid confusion with Class.
 *
 * @author Brian Wellington
 */

public final class DClass {

/** Internet */
public static final int IN		= 1;

/** Chaos network (MIT) */
public static final int CH		= 3;

/** Chaos network (MIT, alternate name) */
public static final int CHAOS		= 3;

/** Hesiod name server (MIT) */
public static final int HS		= 4;

/** Hesiod name server (MIT, alternate name) */
public static final int HESIOD		= 4;

/** Special value used in dynamic update messages */
public static final int NONE		= 254;

/** Matches any class */
public static final int ANY		= 255;

private static class DClassMnemonic extends Mnemonic {
	public
	DClassMnemonic() {
		super("DClass", CASE_UPPER);
		setPrefix("CLASS");
	}

	public void
	check(int val) {
		DClass.check(val);
	}
}

private static Mnemonic classes = new DClassMnemonic();

static {
	classes.add(IN, "IN");
	classes.add(CH, "CH");
	classes.addAlias(CH, "CHAOS");
	classes.add(HS, "HS");
	classes.addAlias(HS, "HESIOD");
	classes.add(NONE, "NONE");
	classes.add(ANY, "ANY");
}

private
DClass() {}

/**
 * Checks that a numeric DClass is valid.
 * @throws InvalidDClassException The class is out of range.
 */
public static void
check(int i) {
	if (i < 0 || i > 0xFFFF)
		throw new InvalidDClassException(i);
}

/**
 * Converts a numeric DClass into a String
 * @return The canonical string representation of the class
 * @throws InvalidDClassException The class is out of range.
 */
public static String
string(int i) {
	return classes.getText(i);
}

/**
 * Converts a String representation of a DClass into its numeric value
 * @return The class code, or -1 on error.
 */
public static int
value(String s) {
	return classes.getValue(s);
}

}


text:
using System;
using OpenADK.Library;

namespace OpenADK.Library.uk.Learner
{
	///
	/// Defines the set of values that can be specified whenever an AttendanceSourceType
	/// is used as a parameter to a method or constructor.
	///
	/// <remarks>
	/// Alternatively, the static
	///  <see cref="Wrap"/> method can be called to encapsulate any string value in
	///  an AttendanceSourceType object.
	/// <para>Author: Generated by adkgen</para>
	/// <para>Version: 2.6</para>
	/// <para>Since: 2.1</para>
	/// </remarks>
	[Serializable]
	public class AttendanceSourceType : SifEnum
	{
	/// Human other than workforce member ("HU")
	public static readonly AttendanceSourceType HU_HUMAN_OT_THAN_WORKFORCE = new AttendanceSourceType("HU");

	/// Biometric device ("BIO")
	public static readonly AttendanceSourceType BIO_BIOMETRIC_DEVICE = new AttendanceSourceType("BIO");

	/// Workforce Member ("WF")
	public static readonly AttendanceSourceType WF_WORKFORCE_MEMBER = new AttendanceSourceType("WF");

	/// Other non-human input source ("OT")
	public static readonly AttendanceSourceType OT_OT_NONHUMAN_INPUT = new AttendanceSourceType("OT");

	///Wrap an arbitrary string value in an AttendanceSourceType object.
	///<param name="wrappedValue">The element/attribute value.</param>
	///<remarks>This method does not verify
	///that the value is valid according to the SIF Specification</remarks>
	public static AttendanceSourceType Wrap( String wrappedValue ) {
		return new AttendanceSourceType( wrappedValue );
	}

	private AttendanceSourceType( string enumDefValue ) : base( enumDefValue ) {}
	}
}


text:
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/ambient/model/ambient_animation_photo_provider.h"

#include <string>
#include <utility>
#include <vector>

#include "ash/ambient/model/ambient_animation_photo_config.h"
#include "ash/ambient/model/ambient_backend_model.h"
#include "ash/ambient/resources/ambient_animation_static_resources.h"
#include "ash/ambient/test/ambient_test_util.h"
#include "ash/ambient/test/fake_ambient_animation_static_resources.h"
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
#include "base/scoped_observation.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/task_environment.h"
#include "cc/paint/skottie_frame_data.h"
#include "cc/paint/skottie_resource_metadata.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/image/image_unittest_util.h"

namespace ash {

using ::testing::_;
using ::testing::AllOf;
using ::testing::AnyOf;
using ::testing::Each;
using ::testing::ElementsAre;
using ::testing::FieldsAre;
using ::testing::Invoke;
using ::testing::IsSubsetOf;
using ::testing::Key;
using ::testing::Mock;
using ::testing::NotNull;
using ::testing::Pair;
using ::testing::SizeIs;
using ::testing::UnorderedElementsAre;
using ImageAsset = ::cc::SkottieFrameDataProvider::ImageAsset;

namespace {

constexpr float kTestScaleFactor = 1;

// Test argument is cc::SkottieFrameData.
MATCHER_P2(HasImageDimensions, width, height, "") {
  return arg.image.GetSkImageInfo().width() == width &&
         arg.image.GetSkImageInfo().height() == height;
}

MATCHER_P(MatchesDimensionsFrom, other, "") {
  return arg.image.GetSkImageInfo().width() ==
             other.image.GetSkImageInfo().width() &&
         arg.image.GetSkImageInfo().height() ==
             other.image.GetSkImageInfo().height();
}

MATCHER_P(TopicHasDetails, expected_details, "") {
  return arg.get().details == expected_details;
}

class MockObserver : public AmbientAnimationPhotoProvider::Observer {
 public:
  explicit MockObserver(AmbientAnimationPhotoProvider* provider) {
    observation_.Observe(provider);
  }
  MockObserver(const MockObserver&) = delete;
  MockObserver& operator=(const MockObserver&) = delete;
  ~MockObserver() override = default;

  // AmbientAnimationPhotoProvider::Observer implementation:
  MOCK_METHOD(
      void,
      OnDynamicImageAssetsRefreshed,
      ((const base::flat_map<ambient::util::ParsedDynamicAssetId,
                             std::reference_wrapper<const PhotoWithDetails>>&)),
      (override));

 private:
  base::ScopedObservation<AmbientAnimationPhotoProvider,
                          AmbientAnimationPhotoProvider::Observer>
      observation_{this};
};

}  // namespace

// Example has 4 dynamic assets in the animation.
class AmbientAnimationPhotoProviderTest : public ::testing::Test {
 protected:
  static constexpr int kNumDynamicAssets = 4;

  explicit AmbientAnimationPhotoProviderTest(
      std::array<std::string, kNumDynamicAssets> dynamic_asset_ids =
          GetDefaultDynamicAssetIds())
      : dynamic_asset_ids_(dynamic_asset_ids),
        model_(
            CreateAmbientAnimationPhotoConfig(BuildSkottieResourceMetadata())),
        provider_(&static_resources_, &model_) {}

  cc::SkottieResourceMetadataMap BuildSkottieResourceMetadata() const {
    cc::SkottieResourceMetadataMap resource_metadata;
    for (int i = 0; i < kNumDynamicAssets; ++i) {
      CHECK(resource_metadata.RegisterAsset(
          "dummy-resource-path", "dummy-resource-name", dynamic_asset_ids_[i],
          /*size=*/absl::nullopt));
    }
    return resource_metadata;
  }

  void AddImageToModel(gfx::ImageSkia image,
                       std::string details = std::string()) {
    PhotoWithDetails decoded_topic;
    decoded_topic.photo = std::move(image);
    decoded_topic.details = std::move(details);
    model_.AddNextImage(decoded_topic);
  }

  scoped_refptr<ImageAsset> LoadAsset(
      base::StringPiece asset_id,
      absl::optional<gfx::Size> size = absl::nullopt) {
    scoped_refptr<ImageAsset> asset = provider_.LoadImageAsset(
        asset_id, base::FilePath("dummy-resource-path/dummy-resource-name"),
        std::move(size));
    CHECK(asset) << asset_id;
    return asset;
  }

  std::vector<scoped_refptr<ImageAsset>> LoadAllDynamicAssets(
      std::array<absl::optional<gfx::Size>, kNumDynamicAssets> asset_sizes =
          std::array<absl::optional<gfx::Size>, kNumDynamicAssets>()) {
    std::vector<scoped_refptr<ImageAsset>> all_assets;
    char position_id = 'A';
    for (int asset_idx = 0; asset_idx < kNumDynamicAssets;
         ++asset_idx, ++position_id) {
      all_assets.push_back(
          LoadAsset(dynamic_asset_ids_[asset_idx], asset_sizes[asset_idx]));
    }
    return all_assets;
  }

  std::vector<cc::SkottieFrameData> GetFrameDataForAssets(
      const std::vector<scoped_refptr<ImageAsset>>& assets,
      float timestamp,
      float scale = kTestScaleFactor) {
    // The timestamp for a given frame is not guaranteed to be the same for each
    // asset per Skottie's API. Apply jitter to ensure the provider handles this
    // correctly.
    static constexpr float kTimestampJitter = 0.01f;
    bool add_jitter = false;
    std::vector<cc::SkottieFrameData> all_frame_data;
    for (const scoped_refptr<ImageAsset>& asset : assets) {
      float jitter = add_jitter ? kTimestampJitter : 0.f;
      all_frame_data.push_back(asset->GetFrameData(timestamp + jitter, scale));
      add_jitter = !add_jitter;
    }
    return all_frame_data;
  }

  static std::array<std::string, kNumDynamicAssets>
  GetDefaultDynamicAssetIds() {
    return {
        GenerateLottieDynamicAssetIdForTesting(
            /*position=*/"A", /*idx=*/1),
        GenerateLottieDynamicAssetIdForTesting(
            /*position=*/"B", /*idx=*/1),
        GenerateLottieDynamicAssetIdForTesting(
            /*position=*/"C", /*idx=*/1),
        GenerateLottieDynamicAssetIdForTesting(
            /*position=*/"D", /*idx=*/1),
    };
  }

  const std::array<std::string, kNumDynamicAssets> dynamic_asset_ids_;
  base::test::TaskEnvironment task_environment_;
  AmbientBackendModel model_;
  FakeAmbientAnimationStaticResources static_resources_;
  AmbientAnimationPhotoProvider provider_;
};

TEST_F(AmbientAnimationPhotoProviderTest,
       RefreshesDynamicAssetsAtStartOfCycle) {
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/11, /*height=*/11));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/12, /*height=*/12));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/13, /*height=*/13));

  std::vector<scoped_refptr<ImageAsset>> all_assets = LoadAllDynamicAssets();

  // Cycle 0 Frame 0
  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(frame_data, UnorderedElementsAre(HasImageDimensions(10, 10),
                                               HasImageDimensions(11, 11),
                                               HasImageDimensions(12, 12),
                                               HasImageDimensions(13, 13)));

  // Cycle 0 Frame 1
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/1);
  EXPECT_THAT(frame_data, UnorderedElementsAre(HasImageDimensions(10, 10),
                                               HasImageDimensions(11, 11),
                                               HasImageDimensions(12, 12),
                                               HasImageDimensions(13, 13)));

  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/20, /*height=*/20));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/21, /*height=*/21));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/22, /*height=*/22));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/23, /*height=*/23));

  // Cycle 1 Frame 0
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(frame_data, UnorderedElementsAre(HasImageDimensions(20, 20),
                                               HasImageDimensions(21, 21),
                                               HasImageDimensions(22, 22),
                                               HasImageDimensions(23, 23)));

  // Cycle 1 Frame 1
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/1);
  EXPECT_THAT(frame_data, UnorderedElementsAre(HasImageDimensions(20, 20),
                                               HasImageDimensions(21, 21),
                                               HasImageDimensions(22, 22),
                                               HasImageDimensions(23, 23)));
}

TEST_F(AmbientAnimationPhotoProviderTest,
       RefreshesDynamicAssetsWithPartialAssetsAvailable) {
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/11, /*height=*/11));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/12, /*height=*/12));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/13, /*height=*/13));

  std::vector<scoped_refptr<ImageAsset>> all_assets = LoadAllDynamicAssets();

  // Cycle 0 Frame 0
  GetFrameDataForAssets(all_assets, /*timestamp=*/0);

  // Cycle 0 Frame 1
  GetFrameDataForAssets(all_assets, /*timestamp=*/1);

  // Only 2 new images were prepared for the next cycle. The new cycle should
  // incorporate the 2 new images plus the 2 most recent images from the last
  // cycle.
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/20, /*height=*/20));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/21, /*height=*/21));

  // Cycle 1 Frame 0
  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(frame_data, UnorderedElementsAre(HasImageDimensions(12, 12),
                                               HasImageDimensions(13, 13),
                                               HasImageDimensions(20, 20),
                                               HasImageDimensions(21, 21)));
}

TEST_F(AmbientAnimationPhotoProviderTest,
       DistributesTopicsEvenlyWithMoreAssetsThanTopics) {
  // Only 2 images in model, when there are 4 assets.
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/11, /*height=*/11));

  std::vector<scoped_refptr<ImageAsset>> all_assets = LoadAllDynamicAssets();

  // Cycle 0 Frame 0
  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(frame_data, UnorderedElementsAre(HasImageDimensions(10, 10),
                                               HasImageDimensions(10, 10),
                                               HasImageDimensions(11, 11),
                                               HasImageDimensions(11, 11)));
}

TEST_F(AmbientAnimationPhotoProviderTest,
       HandlesMinimumTopicsAvailableInModel) {
  // Only 1 image in model, when there are 4 assets.
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10));

  std::vector<scoped_refptr<ImageAsset>> all_assets = LoadAllDynamicAssets();

  // Cycle 0 Frame 0
  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  ASSERT_THAT(frame_data, SizeIs(kNumDynamicAssets));
  EXPECT_THAT(frame_data, Each(HasImageDimensions(10, 10)));
}

TEST_F(AmbientAnimationPhotoProviderTest, LoadsStaticImageAssets) {
  static_resources_.SetStaticImageAsset(
      "static-asset-0",
      gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10));
  static_resources_.SetStaticImageAsset(
      "static-asset-1",
      gfx::test::CreateImageSkia(/*width=*/11, /*height=*/11));

  std::vector<scoped_refptr<ImageAsset>> all_assets = {
      LoadAsset("static-asset-0"), LoadAsset("static-asset-1")};

  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(frame_data, ElementsAre(HasImageDimensions(10, 10),
                                      HasImageDimensions(11, 11)));

  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/1);
  EXPECT_THAT(frame_data, ElementsAre(HasImageDimensions(10, 10),
                                      HasImageDimensions(11, 11)));

  // Unlike dynamic assets, static assets only get loaded one time in the
  // animation's lifetime.
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(frame_data, ElementsAre(HasImageDimensions(10, 10),
                                      HasImageDimensions(11, 11)));
}

TEST_F(AmbientAnimationPhotoProviderTest, MatchesDynamicAssetOrientation) {
  // 2 landscape 2 portrait
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/10, /*height=*/20));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/20, /*height=*/10));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/20, /*height=*/40));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/40, /*height=*/20));

  std::vector<scoped_refptr<ImageAsset>> all_assets =
      LoadAllDynamicAssets({gfx::Size(100, 50), gfx::Size(50, 100),
                            gfx::Size(100, 50), gfx::Size(50, 100)});

  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(std::vector<cc::SkottieFrameData>({frame_data[0], frame_data[2]}),
              UnorderedElementsAre(HasImageDimensions(20, 10),
                                   HasImageDimensions(40, 20)));
  EXPECT_THAT(std::vector<cc::SkottieFrameData>({frame_data[1], frame_data[3]}),
              UnorderedElementsAre(HasImageDimensions(10, 20),
                                   HasImageDimensions(20, 40)));
  GetFrameDataForAssets(all_assets, /*timestamp=*/1);

  // 3 landscape 1 portrait
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/10, /*height=*/20));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/60, /*height=*/30));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/80, /*height=*/40));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/100, /*height=*/50));
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  // Portrait asset expectations:
  EXPECT_THAT(frame_data[1], HasImageDimensions(10, 20));
  EXPECT_THAT(frame_data[3],
              AnyOf(HasImageDimensions(15, 30), HasImageDimensions(20, 40),
                    HasImageDimensions(25, 50)));
  // Landscape asset expectations:
  EXPECT_THAT(
      std::vector<cc::SkottieFrameData>({frame_data[0], frame_data[2]}),
      IsSubsetOf({HasImageDimensions(60, 30), HasImageDimensions(80, 40),
                  HasImageDimensions(100, 50)}));
  GetFrameDataForAssets(all_assets, /*timestamp=*/1);

  // // 1 landscape 3 portrait
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/30, /*height=*/60));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/20, /*height=*/10));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/40, /*height=*/80));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/50, /*height=*/100));
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  // Landscape asset expectations:
  EXPECT_THAT(frame_data[0], HasImageDimensions(20, 10));
  EXPECT_THAT(frame_data[2],
              AnyOf(HasImageDimensions(30, 15), HasImageDimensions(40, 20),
                    HasImageDimensions(50, 25)));
  // Portrait asset expectations:
  EXPECT_THAT(
      std::vector<cc::SkottieFrameData>({frame_data[1], frame_data[3]}),
      IsSubsetOf({HasImageDimensions(30, 60), HasImageDimensions(40, 80),
                  HasImageDimensions(50, 100)}));
}

TEST_F(AmbientAnimationPhotoProviderTest, HandlesOnlyPortraitAvailable) {
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/10, /*height=*/20));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/30, /*height=*/60));

  std::vector<scoped_refptr<ImageAsset>> all_assets =
      LoadAllDynamicAssets({gfx::Size(100, 50), gfx::Size(50, 100),
                            gfx::Size(100, 50), gfx::Size(50, 100)});

  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(
      std::vector<cc::SkottieFrameData>({frame_data[0], frame_data[1]}),
      AnyOf(
          ElementsAre(HasImageDimensions(10, 5), HasImageDimensions(30, 60)),
          ElementsAre(HasImageDimensions(30, 15), HasImageDimensions(10, 20))));
  EXPECT_THAT(
      std::vector<cc::SkottieFrameData>({frame_data[2], frame_data[3]}),
      AnyOf(
          ElementsAre(HasImageDimensions(10, 5), HasImageDimensions(30, 60)),
          ElementsAre(HasImageDimensions(30, 15), HasImageDimensions(10, 20))));
}

TEST_F(AmbientAnimationPhotoProviderTest, HandlesOnlyLandscapeAvailable) {
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/20, /*height=*/10));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/60, /*height=*/30));

  std::vector<scoped_refptr<ImageAsset>> all_assets =
      LoadAllDynamicAssets({gfx::Size(100, 50), gfx::Size(50, 100),
                            gfx::Size(100, 50), gfx::Size(50, 100)});

  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(
      std::vector<cc::SkottieFrameData>({frame_data[0], frame_data[1]}),
      AnyOf(
          ElementsAre(HasImageDimensions(20, 10), HasImageDimensions(15, 30)),
          ElementsAre(HasImageDimensions(60, 30), HasImageDimensions(5, 10))));
  EXPECT_THAT(
      std::vector<cc::SkottieFrameData>({frame_data[2], frame_data[3]}),
      AnyOf(
          ElementsAre(HasImageDimensions(20, 10), HasImageDimensions(15, 30)),
          ElementsAre(HasImageDimensions(60, 30), HasImageDimensions(5, 10))));
}

TEST_F(AmbientAnimationPhotoProviderTest,
       NotifiesObserversWhenDynamicAssetsRefreshed) {
  MockObserver observer(&provider_);

  gfx::ImageSkia test_image =
      gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10);
  AddImageToModel(test_image, "attribution-a");
  AddImageToModel(test_image, "attribution-b");
  AddImageToModel(test_image, "attribution-c");
  AddImageToModel(test_image, "attribution-d");

  std::vector<scoped_refptr<ImageAsset>> all_assets = LoadAllDynamicAssets();

  // Cycle 0 Frame 0
  EXPECT_CALL(
      observer,
      OnDynamicImageAssetsRefreshed(AllOf(
          ElementsAre(Key(FieldsAre("A", 1)), Key(FieldsAre("B", 1)),
                      Key(FieldsAre("C", 1)), Key(FieldsAre("D", 1))),
          UnorderedElementsAre(Pair(_, TopicHasDetails("attribution-a")),
                               Pair(_, TopicHasDetails("attribution-b")),
                               Pair(_, TopicHasDetails("attribution-c")),
                               Pair(_, TopicHasDetails("attribution-d"))))));
  GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  Mock::VerifyAndClearExpectations(&observer);

  // Cycle 0 Frame 1
  EXPECT_CALL(observer, OnDynamicImageAssetsRefreshed(_)).Times(0);
  GetFrameDataForAssets(all_assets, /*timestamp=*/1);
  Mock::VerifyAndClearExpectations(&observer);

  AddImageToModel(test_image, "attribution-e");
  AddImageToModel(test_image, "attribution-f");
  AddImageToModel(test_image, "attribution-g");
  AddImageToModel(test_image, "attribution-h");

  // Cycle 1 Frame 0
  EXPECT_CALL(
      observer,
      OnDynamicImageAssetsRefreshed(AllOf(
          ElementsAre(Key(FieldsAre("A", 1)), Key(FieldsAre("B", 1)),
                      Key(FieldsAre("C", 1)), Key(FieldsAre("D", 1))),
          UnorderedElementsAre(Pair(_, TopicHasDetails("attribution-e")),
                               Pair(_, TopicHasDetails("attribution-f")),
                               Pair(_, TopicHasDetails("attribution-g")),
                               Pair(_, TopicHasDetails("attribution-h"))))));
  GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  Mock::VerifyAndClearExpectations(&observer);

  // Cycle 1 Frame 1
  EXPECT_CALL(observer, OnDynamicImageAssetsRefreshed(_)).Times(0);
  GetFrameDataForAssets(all_assets, /*timestamp=*/1);
  Mock::VerifyAndClearExpectations(&observer);
}

TEST_F(AmbientAnimationPhotoProviderTest,
       NotifiesObserversWhenDynamicAssetsDuplicated) {
  MockObserver observer(&provider_);

  // Only 1 image in model, when there are 4 assets.
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10),
                  "attribution-a");

  std::vector<scoped_refptr<ImageAsset>> all_assets = LoadAllDynamicAssets();

  // Cycle 0 Frame 0
  EXPECT_CALL(observer, OnDynamicImageAssetsRefreshed(AllOf(
                            SizeIs(kNumDynamicAssets),
                            Each(Pair(_, TopicHasDetails("attribution-a"))))));
  GetFrameDataForAssets(all_assets, /*timestamp=*/0);
}

TEST_F(AmbientAnimationPhotoProviderTest, LoadsDifferentImageScaleFactor) {
  gfx::ImageSkia test_image =
      gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10);
  test_image.AddRepresentation(
      gfx::ImageSkiaRep(gfx::test::CreateBitmap(/*width=*/20, /*height=*/20),
                        /*scale=*/kTestScaleFactor * 2));
  AddImageToModel(test_image);

  std::vector<scoped_refptr<ImageAsset>> all_assets = LoadAllDynamicAssets();

  // Load at 1x.
  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  ASSERT_THAT(frame_data, SizeIs(kNumDynamicAssets));
  EXPECT_THAT(frame_data, Each(HasImageDimensions(10, 10)));

  // Cycle 0 Frame 1
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/0.5,
                                     /*scale=*/kTestScaleFactor * 2);
  ASSERT_THAT(frame_data, SizeIs(kNumDynamicAssets));
  EXPECT_THAT(frame_data, Each(HasImageDimensions(20, 20)));
}

class AmbientAnimationPhotoProviderTestMultipleAssetsPerPosition
    : public AmbientAnimationPhotoProviderTest {
 protected:
  enum AssetIdx {
    kPositionAIdx1 = 0,
    kPositionAIdx2,
    kPositionBIdx1,
    kPositionBIdx2,
  };

  AmbientAnimationPhotoProviderTestMultipleAssetsPerPosition()
      : AmbientAnimationPhotoProviderTest(GetDynamicAssetIds()) {}

 private:
  static std::array<std::string, kNumDynamicAssets> GetDynamicAssetIds() {
    return {
        GenerateLottieDynamicAssetIdForTesting(
            /*position=*/"A", /*idx=*/1),
        GenerateLottieDynamicAssetIdForTesting(
            /*position=*/"A", /*idx=*/2),
        GenerateLottieDynamicAssetIdForTesting(
            /*position=*/"B", /*idx=*/1),
        GenerateLottieDynamicAssetIdForTesting(
            /*position=*/"B", /*idx=*/2),
    };
  }
};

TEST_F(AmbientAnimationPhotoProviderTestMultipleAssetsPerPosition,
       RefreshesDynamicAssetsAtStartOfCycle) {
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/11, /*height=*/11));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/12, /*height=*/12));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/13, /*height=*/13));

  scoped_refptr<ImageAsset> asset_a_1 =
      LoadAsset(dynamic_asset_ids_[kPositionAIdx1]);
  scoped_refptr<ImageAsset> asset_a_2 =
      LoadAsset(dynamic_asset_ids_[kPositionAIdx2]);
  scoped_refptr<ImageAsset> asset_b_1 =
      LoadAsset(dynamic_asset_ids_[kPositionBIdx1]);
  scoped_refptr<ImageAsset> asset_b_2 =
      LoadAsset(dynamic_asset_ids_[kPositionBIdx2]);
  std::vector<scoped_refptr<ImageAsset>> all_assets(kNumDynamicAssets);
  all_assets[kPositionAIdx1] = asset_a_1;
  all_assets[kPositionAIdx2] = asset_a_2;
  all_assets[kPositionBIdx1] = asset_b_1;
  all_assets[kPositionBIdx2] = asset_b_2;

  // Cycle 0 Frame 0
  std::vector<cc::SkottieFrameData> frame_data =
      GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(frame_data, UnorderedElementsAre(HasImageDimensions(10, 10),
                                               HasImageDimensions(11, 11),
                                               HasImageDimensions(12, 12),
                                               HasImageDimensions(13, 13)));

  // Cycle 0 Frame 1
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/1);
  EXPECT_THAT(frame_data, UnorderedElementsAre(HasImageDimensions(10, 10),
                                               HasImageDimensions(11, 11),
                                               HasImageDimensions(12, 12),
                                               HasImageDimensions(13, 13)));

  cc::SkottieFrameData asset_a_2_previous = frame_data[kPositionAIdx2];
  cc::SkottieFrameData asset_b_2_previous = frame_data[kPositionBIdx2];

  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/20, /*height=*/20));
  AddImageToModel(gfx::test::CreateImageSkia(/*width=*/21, /*height=*/21));

  // Cycle 1 Frame 0
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(frame_data[kPositionAIdx1],
              MatchesDimensionsFrom(asset_a_2_previous));
  EXPECT_THAT(frame_data[kPositionBIdx1],
              MatchesDimensionsFrom(asset_b_2_previous));
  std::vector<cc::SkottieFrameData> idx_2_assets = {frame_data[kPositionAIdx2],
                                                    frame_data[kPositionBIdx2]};
  EXPECT_THAT(idx_2_assets, UnorderedElementsAre(HasImageDimensions(20, 20),
                                                 HasImageDimensions(21, 21)));

  // Cycle 1 Frame 1
  frame_data = GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  EXPECT_THAT(frame_data[kPositionAIdx1],
              MatchesDimensionsFrom(asset_a_2_previous));
  EXPECT_THAT(frame_data[kPositionBIdx1],
              MatchesDimensionsFrom(asset_b_2_previous));
  idx_2_assets = {frame_data[kPositionAIdx2], frame_data[kPositionBIdx2]};
  EXPECT_THAT(idx_2_assets, UnorderedElementsAre(HasImageDimensions(20, 20),
                                                 HasImageDimensions(21, 21)));
}

TEST_F(AmbientAnimationPhotoProviderTestMultipleAssetsPerPosition,
       NotifiesObserversWhenDynamicAssetsRefreshed) {
  MockObserver observer(&provider_);

  gfx::ImageSkia test_image =
      gfx::test::CreateImageSkia(/*width=*/10, /*height=*/10);
  AddImageToModel(test_image, "attribution-a");
  AddImageToModel(test_image, "attribution-b");
  AddImageToModel(test_image, "attribution-c");
  AddImageToModel(test_image, "attribution-d");

  std::vector<scoped_refptr<ImageAsset>> all_assets = LoadAllDynamicAssets();

  std::string asset_a_2_prev_attribution;
  std::string asset_b_2_prev_attribution;
  // Cycle 0 Frame 0
  EXPECT_CALL(
      observer,
      OnDynamicImageAssetsRefreshed(AllOf(
          ElementsAre(Key(FieldsAre("A", 1)), Key(FieldsAre("B", 1)),
                      Key(FieldsAre("A", 2)), Key(FieldsAre("B", 2))),
          UnorderedElementsAre(Pair(_, TopicHasDetails("attribution-a")),
                               Pair(_, TopicHasDetails("attribution-b")),
                               Pair(_, TopicHasDetails("attribution-c")),
                               Pair(_, TopicHasDetails("attribution-d"))))))
      .WillOnce(Invoke(
          [&](const base::flat_map<
              ambient::util::ParsedDynamicAssetId,
              std::reference_wrapper<const PhotoWithDetails>>& new_topics) {
            asset_a_2_prev_attribution =
                new_topics.at(ambient::util::ParsedDynamicAssetId({"A", 2}))
                    .get()
                    .details;
            asset_b_2_prev_attribution =
                new_topics.at(ambient::util::ParsedDynamicAssetId({"B", 2}))
                    .get()
                    .details;
          }));
  GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  Mock::VerifyAndClearExpectations(&observer);

  // Cycle 0 Frame 1
  EXPECT_CALL(observer, OnDynamicImageAssetsRefreshed(_)).Times(0);
  GetFrameDataForAssets(all_assets, /*timestamp=*/1);
  Mock::VerifyAndClearExpectations(&observer);

  AddImageToModel(test_image, "attribution-e");
  AddImageToModel(test_image, "attribution-f");

  // Cycle 1 Frame 0
  EXPECT_CALL(
      observer,
      OnDynamicImageAssetsRefreshed(ElementsAre(
          Pair(FieldsAre("A", 1), TopicHasDetails(asset_a_2_prev_attribution)),
          Pair(FieldsAre("B", 1), TopicHasDetails(asset_b_2_prev_attribution)),
          Pair(FieldsAre("A", 2), AnyOf(TopicHasDetails("attribution-e"),
                                        TopicHasDetails("attribution-f"))),
          Pair(FieldsAre("B", 2), AnyOf(TopicHasDetails("attribution-e"),
                                        TopicHasDetails("attribution-f"))))));
  GetFrameDataForAssets(all_assets, /*timestamp=*/0);
  Mock::VerifyAndClearExpectations(&observer);

  // Cycle 1 Frame 1
  EXPECT_CALL(observer, OnDynamicImageAssetsRefreshed(_)).Times(0);
  GetFrameDataForAssets(all_assets, /*timestamp=*/1);
  Mock::VerifyAndClearExpectations(&observer);
}

}  // namespace ash


text:
package workload.scenarios

import io.gatling.core.Predef._

/**
 * Created by ebour.
 */
class Scenario extends io.gatling.core.scenario.Simulation {

    def getScenario: io.gatling.core.structure.ScenarioBuilder = {
      scenario("null")
    }

    def getDescription: String = {
      "null"
    }

}


text:
package org.eclipse.bpel4chor.model.chor;

import org.eclipse.bpel4chor.model.chor.common.ElementInstance;
import org.eclipse.bpel4chor.model.chor.common.MessageLinkElementInstance;
import org.eclipse.bpel4chor.model.pbd.CLinkable;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EObject;

/**
 *
 * A representation of the model object 'CMessage Link'.
 *
 *
 *

 * The following features are supported:
 *

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getSendActivity Send Activity}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getReceiveActivity Receive Activity}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getParticipantRefs Participant Refs}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getBindSenderTo Bind Sender To}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getSender Sender}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getSenders Senders}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getReceiver Receiver}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getMessageName Message Name}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getName Name}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getState State}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getId Id}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getInstanceID Instance ID}

 *
{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getInstanceBuffer Instance Buffer}

 *

 *

 *
 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink()
 * @model
 * @generated
 */
public interface CMessageLink extends EObject
{
        /**
	 * Returns the value of the 'Send Activity' reference.
	 *
         *

         * If the meaning of the 'Send Activity' reference isn't clear,
         * there really should be more of a description here...
         *

         *
	 * @return the value of the 'Send Activity' reference.
	 * @see #setSendActivity(CLinkable)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_SendActivity()
	 * @model
	 * @generated
	 */
        CLinkable getSendActivity();

        /**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getSendActivity Send Activity}' reference.
	 *
         *
	 * @param value the new value of the 'Send Activity' reference.
	 * @see #getSendActivity()
	 * @generated
	 */
        void setSendActivity(CLinkable value);

        /**
	 * Returns the value of the 'Receive Activity' reference.
	 *
         *

         * If the meaning of the 'Receive Activity' reference isn't clear,
         * there really should be more of a description here...
         *

         *
	 * @return the value of the 'Receive Activity' reference.
	 * @see #setReceiveActivity(CLinkable)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_ReceiveActivity()
	 * @model
	 * @generated
	 */
        CLinkable getReceiveActivity();

        /**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getReceiveActivity Receive Activity}' reference.
	 *
         *
	 * @param value the new value of the 'Receive Activity' reference.
	 * @see #getReceiveActivity()
	 * @generated
	 */
        void setReceiveActivity(CLinkable value);

        /**
	 * Returns the value of the 'Participant Refs' reference list.
	 * The list contents are of type {@link org.eclipse.bpel4chor.model.chor.CParticipantRef}.
	 *
         *

         * If the meaning of the 'Participant Refs' reference list isn't clear,
         * there really should be more of a description here...
         *

         *
	 * @return the value of the 'Participant Refs' reference list.
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_ParticipantRefs()
	 * @model
	 * @generated
	 */
        EList<CParticipantRef> getParticipantRefs();

        /**
	 * Returns the value of the 'Bind Sender To' reference.
	 *
         *

         * If the meaning of the 'Bind Sender To' reference isn't clear,
         * there really should be more of a description here...
         *

         *
	 * @return the value of the 'Bind Sender To' reference.
	 * @see #setBindSenderTo(CParticipant)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_BindSenderTo()
	 * @model
	 * @generated
	 */
        CParticipant getBindSenderTo();

        /**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getBindSenderTo Bind Sender To}' reference.
	 *
         *
	 * @param value the new value of the 'Bind Sender To' reference.
	 * @see #getBindSenderTo()
	 * @generated
	 */
        void setBindSenderTo(CParticipant value);

        /**
	 * Returns the value of the 'Sender' reference.
	 *
         *

         * If the meaning of the 'Sender' reference isn't clear,
         * there really should be more of a description here...
         *

         *
	 * @return the value of the 'Sender' reference.
	 * @see #setSender(CParticipant)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_Sender()
	 * @model
	 * @generated
	 */
        CParticipant getSender();

        /**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getSender Sender}' reference.
	 *
         *
	 * @param value the new value of the 'Sender' reference.
	 * @see #getSender()
	 * @generated
	 */
        void setSender(CParticipant value);

        /**
	 * Returns the value of the 'Senders' reference.
	 *
         *

         * If the meaning of the 'Senders' reference isn't clear,
         * there really should be more of a description here...
         *

         *
	 * @return the value of the 'Senders' reference.
	 * @see #setSenders(CParticipantSet)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_Senders()
	 * @model
	 * @generated
	 */
        CParticipantSet getSenders();

        /**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getSenders Senders}' reference.
	 *
         *
	 * @param value the new value of the 'Senders' reference.
	 * @see #getSenders()
	 * @generated
	 */
        void setSenders(CParticipantSet value);

        /**
	 * Returns the value of the 'Receiver' reference.
	 *
         *

         * If the meaning of the 'Receiver' reference isn't clear,
         * there really should be more of a description here...
         *

         *
	 * @return the value of the 'Receiver' reference.
	 * @see #setReceiver(CParticipant)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_Receiver()
	 * @model
	 * @generated
	 */
        CParticipant getReceiver();

        /**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getReceiver Receiver}' reference.
	 *
         *
	 * @param value the new value of the 'Receiver' reference.
	 * @see #getReceiver()
	 * @generated
	 */
        void setReceiver(CParticipant value);

        /**
	 * Returns the value of the 'Message Name' attribute.
	 *
         *

         * If the meaning of the 'Message Name' attribute isn't clear,
         * there really should be more of a description here...
         *

         *
	 * @return the value of the 'Message Name' attribute.
	 * @see #setMessageName(String)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_MessageName()
	 * @model
	 * @generated
	 */
        String getMessageName();

        /**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getMessageName Message Name}' attribute.
	 *
         *
	 * @param value the new value of the 'Message Name' attribute.
	 * @see #getMessageName()
	 * @generated
	 */
        void setMessageName(String value);

        /**
	 * Returns the value of the 'Name' attribute.
	 *
         *

         * If the meaning of the 'Name' attribute isn't clear,
         * there really should be more of a description here...
         *

         *
	 * @return the value of the 'Name' attribute.
	 * @see #setName(String)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_Name()
	 * @model
	 * @generated
	 */
        String getName();

        /**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getName Name}' attribute.
	 *
         *
	 * @param value the new value of the 'Name' attribute.
	 * @see #getName()
	 * @generated
	 */
        void setName(String value);

								/**
	 * Returns the value of the 'State' attribute.
	 *
	 *

	 * If the meaning of the 'State' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'State' attribute.
	 * @see #setState(String)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_State()
	 * @model
	 * @generated
	 */
	String getState();

								/**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getState State}' attribute.
	 *
	 *
	 * @param value the new value of the 'State' attribute.
	 * @see #getState()
	 * @generated
	 */
	void setState(String value);

								/**
	 * Returns the value of the 'Id' attribute.
	 *
	 *

	 * If the meaning of the 'Id' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Id' attribute.
	 * @see #setId(String)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_Id()
	 * @model
	 * @generated
	 */
	String getId();

								/**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getId Id}' attribute.
	 *
	 *
	 * @param value the new value of the 'Id' attribute.
	 * @see #getId()
	 * @generated
	 */
	void setId(String value);

								/**
	 * Returns the value of the 'Instance ID' attribute.
	 *
	 *

	 * If the meaning of the 'Instance ID' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Instance ID' attribute.
	 * @see #setInstanceID(String)
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_InstanceID()
	 * @model
	 * @generated
	 */
	String getInstanceID();

								/**
	 * Sets the value of the '{@link org.eclipse.bpel4chor.model.chor.CMessageLink#getInstanceID Instance ID}' attribute.
	 *
	 *
	 * @param value the new value of the 'Instance ID' attribute.
	 * @see #getInstanceID()
	 * @generated
	 */
	void setInstanceID(String value);

								/**
	 * Returns the value of the 'Instance Buffer' map.
	 * The key is of type {@link java.lang.String},
	 * and the value is of type {@link org.eclipse.bpel4chor.model.chor.common.ElementInstance},
	 *
	 *

	 * If the meaning of the 'Instance Buffer' map isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Instance Buffer' map.
	 * @see org.eclipse.bpel4chor.model.chor.ChorPackage#getCMessageLink_InstanceBuffer()
	 * @model mapType="org.eclipse.bpel4chor.model.chor.common.EStringToElementInstanceMap<org.eclipse.emf.ecore.EString, org.eclipse.bpel4chor.model.chor.common.ElementInstance>"
	 * @generated
	 */
	EMap<String, ElementInstance> getInstanceBuffer();

} // CMessageLink


text:
steal('can', 'xit/models/yield.js', './init.mustache', 'jquery/dom/form_params',
	function (can, Yield, initView) {

	/**
	 * @constructor xit/yield/create
	 * @alias YieldCreate
	 * @parent xit
	 * @inherits can.Control
	 * Creates yields
	 */
	return can.Control(
	/** @Prototype */
	{
		/**
		 *  Render the initial template
		 */
		init: function () {
			this.element.html(initView());
		},
		/**
		 *  Submit handler. Create a new yield from the form.
		 */
		submit: function (el, ev) {
			ev.preventDefault();
			el.find('[type=submit]').val('Creating...')
			new Yield(el.formParams()).save(function() {
				el.find('[type=submit]').val('Create');
				el[0].reset()
			});
		}
	});
});


text:
/**
 */
package CIM.IEC61970.Informative.InfCommon.impl;

import CIM.IEC61970.Informative.InfCommon.InfCommonPackage;
import CIM.IEC61970.Informative.InfCommon.Ratio;

import CIM.impl.ElementImpl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 *
 * An implementation of the model object 'Ratio'.
 *
 *

 * The following features are implemented:
 *

 *

 *
{@link CIM.IEC61970.Informative.InfCommon.impl.RatioImpl#getNumerator Numerator}

 *
{@link CIM.IEC61970.Informative.InfCommon.impl.RatioImpl#getDenominator Denominator}

 *

 *
 * @generated
 */
public class RatioImpl extends ElementImpl implements Ratio {
	/**
	 * The default value of the '{@link #getNumerator() Numerator}' attribute.
	 *
	 *
	 * @see #getNumerator()
	 * @generated
	 * @ordered
	 */
	protected static final float NUMERATOR_EDEFAULT = 0.0F;

	/**
	 * The cached value of the '{@link #getNumerator() Numerator}' attribute.
	 *
	 *
	 * @see #getNumerator()
	 * @generated
	 * @ordered
	 */
	protected float numerator = NUMERATOR_EDEFAULT;

	/**
	 * The default value of the '{@link #getDenominator() Denominator}' attribute.
	 *
	 *
	 * @see #getDenominator()
	 * @generated
	 * @ordered
	 */
	protected static final float DENOMINATOR_EDEFAULT = 0.0F;

	/**
	 * The cached value of the '{@link #getDenominator() Denominator}' attribute.
	 *
	 *
	 * @see #getDenominator()
	 * @generated
	 * @ordered
	 */
	protected float denominator = DENOMINATOR_EDEFAULT;

	/**
	 *
	 *
	 * @generated
	 */
	protected RatioImpl() {
		super();
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return InfCommonPackage.Literals.RATIO;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public float getNumerator() {
		return numerator;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setNumerator(float newNumerator) {
		float oldNumerator = numerator;
		numerator = newNumerator;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InfCommonPackage.RATIO__NUMERATOR, oldNumerator, numerator));
	}

	/**
	 *
	 *
	 * @generated
	 */
	public float getDenominator() {
		return denominator;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setDenominator(float newDenominator) {
		float oldDenominator = denominator;
		denominator = newDenominator;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InfCommonPackage.RATIO__DENOMINATOR, oldDenominator, denominator));
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case InfCommonPackage.RATIO__NUMERATOR:
				return getNumerator();
			case InfCommonPackage.RATIO__DENOMINATOR:
				return getDenominator();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case InfCommonPackage.RATIO__NUMERATOR:
				setNumerator((Float)newValue);
				return;
			case InfCommonPackage.RATIO__DENOMINATOR:
				setDenominator((Float)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case InfCommonPackage.RATIO__NUMERATOR:
				setNumerator(NUMERATOR_EDEFAULT);
				return;
			case InfCommonPackage.RATIO__DENOMINATOR:
				setDenominator(DENOMINATOR_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case InfCommonPackage.RATIO__NUMERATOR:
				return numerator != NUMERATOR_EDEFAULT;
			case InfCommonPackage.RATIO__DENOMINATOR:
				return denominator != DENOMINATOR_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (numerator: ");
		result.append(numerator);
		result.append(", denominator: ");
		result.append(denominator);
		result.append(')');
		return result.toString();
	}

} //RatioImpl


text:
package org.shredzone.commons.suncalc.param;

import static org.shredzone.commons.suncalc.util.ExtendedMath.dms;

/**
 * Location based parameters.
 *

 * Use them to give information about the geolocation of the observer. If ommitted, the
 * coordinates of Null Island are
 * used.
 *
 * @param <T>
 *            Type of the final builder
 */
@SuppressWarnings("unchecked")
public interface LocationParameter<T> {

    /**
     * Sets the latitude.
     *
     * @param lat
     *            Latitude, in degrees.
     * @return itself
     */
    T latitude(double lat);

    /**
     * Sets the longitude.
     *
     * @param lng
     *            Longitude, in degrees.
     * @return itself
     */
    T longitude(double lng);

    /**
     * Sets the height.
     *
     * @param h
     *            Height, in meters above sea level. Default: 0.0 m. Negative values are
     *            silently changed to the acceptable minimum of 0.0 m.
     * @return itself
     */
    T height(double h);

    /**
     * Sets the geolocation.
     *
     * @param lat
     *            Latitude, in degrees.
     * @param lng
     *            Longitude, in degrees.
     * @return itself
     */
    default T at(double lat, double lng) {
        latitude(lat);
        longitude(lng);
        return (T) this;
    }

    /**
     * Sets the geolocation. In the given array, index 0 must contain the latitude, and
     * index 1 must contain the longitude. An optional index 2 may contain the height, in
     * meters.
     *

     * This call is meant to be used for coordinates stored in constants.
     *
     * @param coords
     *            Array containing the latitude and longitude, in degrees.
     * @return itself
     */
    default T at(double[] coords) {
        if (coords.length != 2 && coords.length != 3) {
            throw new IllegalArgumentException("Array must contain 2 or 3 doubles");
        }
        if (coords.length == 3) {
            height(coords[2]);
        }
        return at(coords[0], coords[1]);
    }

    /**
     * Sets the latitude.
     *
     * @param d
     *            Degrees
     * @param m
     *            Minutes
     * @param s
     *            Seconds (and fraction of seconds)
     * @return itself
     */
    default T latitude(int d, int m, double s) {
        return latitude(dms(d, m, s));
    }

    /**
     * Sets the longitude.
     *
     * @param d
     *            Degrees
     * @param m
     *            Minutes
     * @param s
     *            Seconds (and fraction of seconds)
     * @return itself
     */
    default T longitude(int d, int m, double s) {
        return longitude(dms(d, m, s));
    }

    /**
     * Uses the same location as given in the {@link LocationParameter} at this moment.
     *

     * Changes to the source parameter will not affect this parameter, though.
     *
     * @param l  {@link LocationParameter} to be used.
     * @return itself
     */
    T sameLocationAs(LocationParameter<?> l);

}


text:
namespace Bridge.ClientTest.Utilities
{
    [Reflectable]
    internal class NotPublicClass
    {
    }
}