text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.zhiyou100</groupId>
	<artifactId>TeaGrading</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>

	<dependencies>
		<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.1.0</version>
			<scope>provided</scope>
		</dependency>
		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.43</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>4.3.9.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>4.3.9.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>4.3.9.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>4.3.9.RELEASE</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>4.3.9.RELEASE</version>
			<scope>test</scope>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.4.5</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.3.1</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl -->
		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/taglibs/standard -->
		<dependency>
			<groupId>taglibs</groupId>
			<artifactId>standard</artifactId>
			<version>1.1.2</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.5</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.3.3</version>
		</dependency>

		<!-- c3p0 经典的数据库连接池 -->
		<!-- https://mvnrepository.com/artifact/com.mchange/c3p0 -->
		<dependency>
			<groupId>com.mchange</groupId>
			<artifactId>c3p0</artifactId>
			<version>0.9.5.2</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.9.0</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
			<version>2.9.0</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-annotations</artifactId>
			<version>2.9.0</version>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
		</dependency>

		<!-- spring 和 redis 继承 -->
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-redis</artifactId>
			<version>1.8.7.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>redis.clients</groupId>
			<artifactId>jedis</artifactId>
			<version>2.9.0</version>
		</dependency>

	</dependencies>

     <!-- build: 编译 -->
     <!-- plugins: 插件 -->
     <build>
          <plugins>
              <plugin>
                   <!-- tomcat 以插件的形式集成在我们的项目中,不需要在依赖于tomcat 软件 -->
                   <!-- tomcat 官方提供了两个版本的插件:tomcat6 和 tomcat7 -->
                   <groupId>org.apache.tomcat.maven</groupId>
                   <artifactId>tomcat7-maven-plugin</artifactId>
                   <version>2.2</version>
                   <configuration>
                        <!-- 设置访问路径中的根目录 -->
                        <path>/101</path>
                        <!-- 设置get 请求的编码方式 -->
                        <!-- tomcat8 以下都是 iso-8859-1 -->
                        <uriEncoding>utf-8</uriEncoding>
                        <!-- 设置端口号,默认8080 -->
                        <port>8526</port>
                   </configuration>
              </plugin>
          </plugins>
     </build>
</project>


text:
package ghist

// Percentile returns a float64 of the percentile of a given value in the histogram
func (h *Histogram) Percentile(value float64) (percentile float64) {
	var position uint64
	for i := h.Size - 1; i >= 0; i-- { // iterate in reverse to get a percentile
		if h.Bins[i].Count == 0 {
			continue
		}
		if value > h.Bins[i].Max {
			position += h.Bins[i].Count
		} else if value >= h.Bins[i].Min { // linear estimate of value's position in its bin
			pct := 0.5
			if h.Bins[i].Max-h.Bins[i].Min > 0.0 {
				pct = (value - h.Bins[i].Min) / (h.Bins[i].Max - h.Bins[i].Min)
			}
			position += uint64(float64(h.Bins[i].Count) * pct)
			break
		}
	}
	return float64(position) / float64(h.Count)
}

// Percentile32 returns Percentile() as a float32
func (h *Histogram) Percentile32(value float32) (percentile float32) {
	return float32(h.Percentile(float64(value)))
}

// Median returns an estimate of the distribution's median value by interpolating within
// the bucket that contains the median value
func (h *Histogram) Median() (median float64) {
	var (
		midPoint  uint64 = h.Count / 2
		seenCount uint64 = 0
	)

	for i := 0; i < h.Size; i++ {
		seenCount += h.Bins[i].Count
		if seenCount >= midPoint {
			if h.Bins[i].Count > 1 {
				offset := 1 - (float64(seenCount-midPoint) / float64(h.Bins[i].Count-1))
				return h.Bins[i].Max - offset*(h.Bins[i].Max-h.Bins[i].Min)
			}
			return h.Bins[i].Max
		}
	}
	return
}

// Median32 returns Median() as a float32
func (h *Histogram) Median32() (median float32) {
	return float32(h.Median())
}

// Mean returns the mean value of the histogram
func (h *Histogram) Mean() (mean float64) {
	if h.Count > 0 {
		mean = h.Sum / float64(h.Count)
	}
	return
}

// Mean32 returns Mean() as a float32
func (h *Histogram) Mean32() (mean float32) {
	return float32(h.Mean())
}

// Mode returns the most populated Bin in the histogram
func (h *Histogram) Mode() (mode Bin) {
	var (
		modeIndex        = 0
		maxCount  uint64 = 0
	)
	if h.Size > 0 {
		for i := 0; i < h.Size; i++ {
			if h.Bins[i].Count > maxCount {
				modeIndex = i
				maxCount = h.Bins[i].Count
			}
		}
		mode = h.Bins[modeIndex]
	}
	return
}

redpajama_set_name: RedPajamaGithub


text:
cask 'qgis' do
  version '2.16.3-1'
  sha256 'ed01b2f7f0212b548c2c5cd3d23d9baae0cbb603a7f2f7fbc2447b7339301711'

  url "http://www.kyngchaos.com/files/software/qgis/QGIS-#{version}.dmg"
  name 'QGIS'
  homepage 'http://www.kyngchaos.com/software/qgis'

  depends_on cask: 'gdal-framework'
  depends_on formula: 'matplotlib'

  pkg '4 Install QGIS.pkg'

  uninstall pkgutil: 'org.qgis.qgis-*'

  caveats <<-EOS.undent
    #{token} requires matplotlib in a specific location. Please run the following to finish install:

      sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python /Library/Python/2.7/site-packages/matplotlib-override
  EOS
end


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Linq;
using System.Reflection;

using Xunit;

namespace System.Net.WebSockets.Client.Test
{
    public class ResourceHelper
    {
        public static string GetExceptionMessage(string resourceName, params object[] parameters)
        {
            Type srType = typeof(SR);
            PropertyInfo property = srType.GetRuntimeProperties().Single(p => p.Name == resourceName);

            string errorMessageTemplate = (string)property.GetMethod.Invoke(null, null);

            Assert.False(string.IsNullOrEmpty(errorMessageTemplate),
                         string.Format("Localized error message '{0}' does not exist.", resourceName));

            return string.Format(errorMessageTemplate, parameters);
        }
    }
}


text:
require "spec_helper"

require "assently/case"
require "assently/serializers/case_serializer"

module Assently
  module Serializers
    RSpec.describe CaseSerializer do
      describe ".serialize" do
        it "maps the case to a api representation and return it as json" do
          signature_case = double "Assently::Case"
          api_hash = { "The" => "Case" }

          expect(Assently::ApiMappers::CaseMapper).to receive(:to_api).with(signature_case).and_return api_hash

          expect(CaseSerializer.serialize(signature_case)).to eq JSON.pretty_generate(api_hash)
        end

        it "maps event subscription" do
          api_hash = { "The" => "Case" }
          signature_case = double "Assently::Case"
          event_subscription = double "Assently::CaseEventSubscription", events: ["finished", "rejected"], url: "http://example.com"
          options = { event_callback: event_subscription }
          options_hash = {
            "EventCallback" => {
              "Events" => ["finished", "rejected"],
              "Url" => "http://example.com"
            }
          }

          expect(Assently::ApiMappers::CaseMapper).to receive(:to_api).with(signature_case).and_return api_hash
          expect(Assently::ApiMappers::CaseOptionsMapper).to receive(:to_api).with(options).and_return options_hash

          expect(CaseSerializer.serialize(signature_case, options)).to eq JSON.pretty_generate(api_hash.merge(options_hash))
        end
      end
    end
  end
end


text:
@implementation CheckUsernameService

- (NSString *)protocol
{
    return @"https://";
}

- (NSString *)domain
{
    return @"api.sherlock.aerolite.net";
}

- (NSString *)version
{
    return @"";
}

- (BOOL)useSSLCertificates
{
    // 是否使用SSL Certificates进行验证,取值为YES时,APP MainBundle中必须存在 appSSLCertificate.cer 文件,取值为NO时,不需要有该文件
    return YES;
}

@end


text:
import { helper } from '@ember/component/helper';

/**
 * Takes the modulus of two or more numbers
 *
 * ```hbs
 * {{mod a b}}
 * ```
 *
 * @param {number[]} numbers A list of numbers to modulus
 * @return {number} The modulus of all the passed numbers
 */
export function mod(numbers) {
  return numbers.reduce((a, b) => Number(a) % Number(b));
}

export default helper(mod);


text:
'use strict';

import React, { Component } from 'react'
import {
  ActivityIndicator,
  StyleSheet,
  View,
  TouchableHighlight,
  ListView,
  Text
} from 'react-native'

/**

 */
class StationListing extends Component {

  constructor(props) {
    super(props);

    this.dataSource = new ListView.DataSource({
      rowHasChanged: (row1, row2) => row1 !== row2
    })
  }

  //----
  _renderRow(station, rowId) {
    var stationName = station.name.split('-')[0];

    return (
        <TouchableHighlight onPress={() => this._rowPressed(station.name)}
            underlayColor='#dddddd'>
          <View>
            <View style={styles.horizontal}>
              <View style={styles.textContainer}>
                <Text style={styles.name}>{stationName}</Text>
                <Text style={styles.distance}>{station.distance}</Text>
              </View>
            </View>

            <View style={styles.separator}/>
          </View>
        </TouchableHighlight>
    );
  }

  //----
  _rowPressed(name) {
    console.log("Pressed " + name);
    /*
    var property = this.props.listings.filter(prop => prop.lister_url === listerURL)[0];

    this.props.navigator.push({
      title: "Property",
      component: PropertyView,
      passProps: {property: property}
    });

    */
  }

  //----

  _noDataView() {
    return (
      <View style={[ styles.centering, styles.horizontal ]}>
        <Text style={styles.light}>Find Stations by Tapping Below</Text>
      </View>
    )
  }

  _isLoadingView() {
    return (
      <View style={[ styles.centering, styles.horizontal ]}>
        <ActivityIndicator
          animating={true}
          style={ {paddingRight: 20} }
          size="large" />
        <Text style={styles.light}>Loading nearby stations...</Text>
      </View>
    )
  }

  render() {

    const isLoading  = this.props.isLoading;
    const dataSource = this.dataSource.cloneWithRows(this.props.stations);

    var content = this._noDataView();
    if (isLoading) {
      content = this._isLoadingView();
    }
    else if (this.props.stations.length > 0) {
      content = <ListView
                  enableEmptySections={true}
                  dataSource={dataSource}
                  renderRow={ this._renderRow.bind(this) } />;
    }

    return (
      <View style={styles.container}>
        {content}
      </View>
    );
  }

}

var styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'column',
    justifyContent: 'center',
    minHeight: 250
  },
  centering: {
    alignItems: 'center',
    justifyContent: 'center',
    padding: 10
  },
  horizontal: {
    flexDirection: 'row',
    justifyContent: 'center',
    padding: 10
  },
  light: {
    color: '#999'
  },
  textContainer: {
    flex: 1
  },
  name: {
    fontSize: 18,
    color: '#656565',
    fontWeight: 'bold'
  },
  distance: {
    fontSize: 12,
    color: '#999'
  },
  separator: {
    height: 1,
    backgroundColor: '#dddddd'
  }
});

module.exports = StationListing;


text:
/*
 * IMPORTANT: This is a private module, its API must not be used and is subject to change.
 * Code other than the OpenUI5 libraries must not introduce dependencies to this module.
 */
sap.ui.define([], function() {
	"use strict";

	/**
	 * Checks whether a given sString starts with sStartString
	 * ignoring the case of both strings.
	 *
	 * @function
	 * @exports sap/base/strings/startsWithIgnoreCase
	 * @param {string} sString String to be checked
	 * @param {string} sStartString The start string to be searched
	 * @returns {boolean} Whether sString starts with sStartString
	 * @see String.prototype.startsWith
	 * @private
	 * @example
	 * startsWithIgnoreCase("fooBaR", "bar") -> false
	 * startsWithIgnoreCase("fooBaR", "foO") -> true
	 * startsWithIgnoreCase("foobar", "") -> false
	 */
	var fnStartsWithIgnoreCase = function(sString, sStartString) {
		if (typeof (sStartString) != "string" || sStartString == "") {
			return false;
		}
		sString = sString.toUpperCase();
		sStartString = sStartString.toUpperCase();
		return sString.startsWith(sStartString);
	};
	return fnStartsWithIgnoreCase;

});


text:
<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * xFrameworkPX_Config_FileTransfer Class File
 *
 * PHP versions 5
 *
 * @category   xFrameworkPX
 * @package    xFrameworkPX_Config
 * @author     Kazuhiro Kotsutsumi <kotsutsumi@xenophy.com>
 * @copyright  Copyright (c) 2006-2010 Xenophy.CO.,LTD All rights Reserved.
 * @license    http://www.opensource.org/licenses/mit-license.html MIT License
 * @version    SVN $Id: FileTransfer.php 974 2009-12-26 10:12:48Z kotsutsumi $
 */

// {{{ xFrameworkPX_Config_FileTransfer

/**
 * xFrameworkPX_Config_FileTransfer Class
 *
 * @category   xFrameworkPX
 * @package    xFrameworkPX_Config
 * @author     Kazuhiro Kotsutsumi <kotsutsumi@xenophy.com>
 * @copyright  Copyright (c) 2006-2010 Xenophy.CO.,LTD All rights Reserved.
 * @license    http://www.opensource.org/licenses/mit-license.html MIT License
 * @version    Release: 3.5.0
 * @link       http://www.xframeworkpx.com/api/?class=xFrameworkPX_Config_FileTransfer
 */
class xFrameworkPX_Config_FileTransfer extends xFrameworkPX_Config
{
    // {{{ props

    /**
     * インスタンス変数
     *
     * @var xFrameworkPX
     */
    protected static $_instance = null;

    // }}}
    // {{{ __construct

    /**
     * コンストラクタ
     *
     * @return void
     */
    private function __construct()
    {

    }

    // }}}
    // {{{ getInstance

    /**
     * インスタンス取得メソッド
     *
     * @return xFrameworkPXインスタンス
     */
    public static function getInstance()
    {
        // インスタンス取得
        if (!isset(self::$_instance)) {
            self::$_instance = new xFrameworkPX_Config_FileTransfer();
        }

        return self::$_instance;
    }

    // }}}

}

// }}}

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */


text:
class Expression {
public:
	Expression(string description = "");
	void setDescription(string description);
	string getDescription() const;
	void addSample(const cv::Mat& sample);
	cv::Mat& getExample(unsigned int i);
	unsigned int size() const;
	void reset();
	void save(string filename) const;
	void load(string filename);
protected:
	string description;
	vector<cv::Mat> samples;
};


text:
import { createEvents } from './keyboard';
import config from './config';
import { createAxis, addV, subtractV } from './utils'
import animate from './animation';
import { initMap } from './initMap';

let canvasBox = document.querySelector('.canvas-box');
let timeDom = document.querySelector('.time');
let timeBox = document.querySelector('.time-box');
let backBtn = document.querySelector('.back-btn');
let resetBtn = document.querySelector('.reset-btn');
let successMask = document.querySelector('.success-mask');
let failMask = document.querySelector('.fail-mask');

let WIDTH = 1000;
let HEIGHT = 600;

export default function init(initType, dom) {
    if(config.id) {
        cancelAnimationFrame(config.id);
    }
    initConfig(initType);
    // 初始化config.renderer
    config.renderer = new THREE.WebGLRenderer({
        antialias:true,
        precision:"highp",
        preserveDrawingBuffer:true
    });
    config.renderer.setSize(WIDTH, HEIGHT);
    canvasBox.innerHTML = '';
    canvasBox.appendChild(config.renderer.domElement);
    config.renderer.setClearColor(0x000000);

    // 初始化config.scene
    config.scene = new THREE.Scene();
    initCamera();

    // createAxis();

    initLight();
    initMap(dom);
    initBall();
    addFunc();
    createEvents();

    // 计时
    timeDom.textContent = config.playTime;
    timeBox.style.display = 'block';
    config.timeID = setInterval(() => {
        let num = +timeDom.textContent;
        num--;
        if(num == -1) {
            failMask.style.display = 'block';
            backBtn.className = 'back-btn back-btn-mask';
            resetBtn.className = 'reset-btn reset-btn-mask';
            config.isP = true;
        } else {
            timeDom.textContent = num;
        }
    }, 1000)

    config.renderer.render(config.scene, config.camera);

    config.id = requestAnimationFrame(animate);
}

function initConfig(initType) {
    config.renderer = null;
    config.scene = null;
    config.camera = null;
    config.light = null;
    config.ball = [];
    config.plane = [];
    config.id = null; // animation id
    config.goalTotal = 0;
    config.goalGet = 0;
    if(initType === 'double') {
        config.isSingle = false;
        config.FA = 6000 * 3;
    } else {
        config.isSingle = true;
        config.FA = 6000;
    }
}

function initCamera() {
    // 初始化config.camera
    config.camera = new THREE.PerspectiveCamera(45, WIDTH/HEIGHT, 1, 100*config.focalDistance);
    if(config.isSingle) {
        config.camera.position.set(4*config.focalDistance, 3*config.focalDistance, 5*config.focalDistance);
    } else {
        config.camera.position.set(4*config.focalDistance, 9*config.focalDistance, 17*config.focalDistance);
    }

    config.camera.lookAt(new THREE.Vector3(0, 0, 0));
    config.scene.add(config.camera);
}

function initLight() {
    var ambientLight = new THREE.AmbientLight(0xaaaaaa, 0.5);
    config.scene.add(ambientLight);

    config.renderer.shadowMap.enabled = true;
    config.renderer.shadowMapSoft = true;

    // var light = new THREE.PointLight(0xffffff, 1, 0, 2);
    // light.position.set(-4*config.focalDistance, 5*config.focalDistance, 5*config.focalDistance);
    // light.castShadow = true;

    var light = new THREE.DirectionalLight( 0xFFFFFF, 1 );
    light.position.set(-5*config.focalDistance, 10*config.focalDistance, 6*config.focalDistance);
    light.castShadow = true;

    light.shadow.camera.near = 1;
    light.shadow.camera.far = 5000;
    light.shadow.camera.left = -24*config.focalDistance;
    light.shadow.camera.right = 24*config.focalDistance;
    light.shadow.camera.bottom = -24*config.focalDistance;
    light.shadow.camera.top = 24*config.focalDistance;

    light.shadow.mapSize.width = 3000;
    light.shadow.mapSize.height = 3000;
    config.light = light;
    config.scene.add(light);

    // var lightHelper = new THREE.config.cameraHelper(light.shadow.config.camera);
    // config.scene.add(lightHelper);
}

function addFunc() {
    config.camera.rotateY = function(rad, minus) {
        let delta = rad;

        if(minus) {
            delta = -delta;
        }

        let r;
        if(config.isSingle) {
            r = subtractV(config.ball[0].position, this.position);
        } else {
            r = subtractV(new THREE.Vector3(0,0,0), this.position);
        }

        r.negate();
        let newR = new THREE.Vector3(r.x * Math.cos(delta) - r.z * Math.sin(delta), r.y, r.z * Math.cos(delta) + r.x * Math.sin(delta))
        let newP = addV(this.position, subtractV(newR, r));
        this.position.set(newP.x, newP.y, newP.z);
    }
}

function initBall() {
    let ball = new THREE.Mesh(new THREE.SphereGeometry(config.R, 32, 32),
        new THREE.MeshPhongMaterial({
            color: 0xCD3C3D,
        })
    );
    ball.castShadow = true;
    ball.receiveShadow = true;

    ball.newP = new THREE.Vector3(0, 0, 0);
    ball.v = new THREE.Vector3(0, 0, 0);
    ball.f = new THREE.Vector3(0, 0, 0);
    ball.m = 1;
    ball.R = config.R;
    ball.decrease = true;

    config.ball.push(ball);

    if(config.isSingle) {
        ball.initPos = [0, 18, 0];
        ball.position.set(...ball.initPos);
        ball.keyConf = [32, 87, 83, 65, 68];
    } else {
        let ball2 = new THREE.Mesh(new THREE.SphereGeometry(config.R, 32, 32),
            new THREE.MeshLambertMaterial({
                color: 0x00cccc,
            })
        );
        ball2.castShadow = true;
        ball2.receiveShadow = true;
        ball.keyConf = [67, 87, 83, 65, 68];
        ball2.keyConf = [78, 73, 75, 74, 76];

        ball2.newP = new THREE.Vector3(0, 0, 0);
        ball2.v = new THREE.Vector3(0, 0, 0);
        ball2.f = new THREE.Vector3(0, 0, 0);
        ball2.m = 1;
        ball2.R = config.R;
        ball2.decrease = true;

        ball.initPos = [0, 18, 20];
        ball2.initPos = [20, 18, 0];
        ball.position.set(...ball.initPos);
        ball2.position.set(...ball2.initPos);

        config.ball.push(ball2);
        config.scene.add(ball2);
    }

    config.scene.add(ball);
}


text:
import merge from 'webpack-merge';
import commonConfig from './webpack.config.server.common';
import devConfig from './webpack.config.server.dev';
import prodConfig from './webpack.config.server.prod';

import {
  DEV,
} from '../environment';

const envConfig = DEV ? devConfig : prodConfig;
const config = merge(commonConfig, envConfig);

export default config;


text:
layout: page
title: Fuentes Helix Global Seminar
date: 2016-05-24
author: Adam Buchanan
tags: weekly links, java
status: published
summary: Proin feugiat ligula lectus, vitae accumsan odio posuere.
banner: images/banner/leisure-03.jpg
booking:
  startDate: 12/14/2016
  endDate: 12/18/2016
  ctyhocn: ATHTNHX
  groupCode: FHGS
published: true
---
Vestibulum lacus libero, congue quis scelerisque sed, ultrices in leo. Suspendisse diam erat, viverra eu dui sit amet, porta rhoncus diam. Nullam finibus, sapien imperdiet ultricies dictum, erat sapien consectetur magna, a lacinia tortor magna eu mauris. Donec semper erat nibh, eu dignissim diam dapibus id. Vivamus viverra imperdiet augue, eget tempor nunc eleifend at. Donec a massa sed est porttitor laoreet vitae lacinia sapien. Aliquam at lorem imperdiet, condimentum sem id, rutrum nibh. Sed hendrerit tincidunt ex at sagittis.

* Nunc tincidunt ipsum et finibus mollis.

Donec bibendum lacus tempor tellus pulvinar, at imperdiet quam ornare. Mauris feugiat erat egestas rutrum ullamcorper. Donec id consectetur dolor, vitae bibendum metus. In hac habitasse platea dictumst. Nullam fermentum elit quis nisi tristique, in volutpat erat fringilla. Suspendisse potenti. Morbi id venenatis magna. Proin convallis turpis sapien, vel sodales augue scelerisque vel. Proin luctus dui vitae lorem rhoncus commodo. Nulla euismod efficitur dui eu iaculis. Interdum et malesuada fames ac ante ipsum primis in faucibus. Cras gravida eleifend sapien, quis cursus arcu bibendum a. Suspendisse mollis lectus viverra mi interdum faucibus dapibus dictum sapien.


text:
import {Component, OnInit, OnDestroy} from "@angular/core";
import {Subscription} from "rxjs";
import template from "./workplacedetail.component.html";
import style from "./workplacedetail.component.scss";
import {Router, ActivatedRoute} from "@angular/router";
import {FormBuilder, FormGroup} from "@angular/forms";
import {MeteorObservable} from "meteor-rxjs";
import {Workplace} from "../../../../both/models/workplace.model";
import {WorkplaceCollection} from "../../../../both/collections/workplace.collection";
import * as toastr from "toastr";

@Component({
    selector: "workplacedetail",
    template,
    styles: [style]
})
export class WorkplaceDetailComponent implements OnInit, OnDestroy {
    workplaceForm: FormGroup;
    workplaceName: string;
    workplace: Workplace;
    subscription: Subscription;

    constructor(private route: ActivatedRoute,
                private formBuilder: FormBuilder,
                private router: Router) {
        this.route.params.subscribe((params) => {
            if (params["id"]) {
                this.workplaceName = params["id"];
            }
        }).unsubscribe();
    }

    save(): void {
        if (!this.workplace) {
            MeteorObservable.call("createworkplace", this.workplaceForm.value.name, this.workplaceForm.value.short_name, this.workplaceForm.value.color, this.workplaceForm.value.bg_color).subscribe((username) => {
                toastr.success("Pracoviště uloženo!");
                this.router.navigate(["workplace", username]);
            }, (error) => {
                toastr.error(`Pracoviště se nepovedlo vytvořit! ${error}`, "Error!");
            });

        } else {
            MeteorObservable.call("updateworkplace", this.workplace._id, this.workplaceForm.value.name, this.workplaceForm.value.short_name, this.workplaceForm.value.color, this.workplaceForm.value.bg_color).subscribe(() => {
                this.router.navigate(["workplace", this.workplaceForm.value.name]);
                toastr.success("Pracoviště uloženo!");
            }, (error) => {
                toastr.error(`Pracoviště se nepovedlo uložit! ${error}`, "Error!");
            });
        }
    }

    ngOnInit() {
        this.subscription = MeteorObservable.subscribe("workplaces").subscribe(() => {
            if (this.workplaceName) {
                this.workplace = WorkplaceCollection.findOne({name: this.workplaceName});
                this.workplaceForm.setValue({
                    name: this.workplace.name,
                    short_name: this.workplace.short_name,
                    color: this.workplace.color,
                    bg_color: this.workplace.bg_color
                });
            }

        });

        this.workplaceForm = this.formBuilder.group({
            name: [""],
            short_name: [""],
            color: ["#FFFFFF"],
            bg_color: ["#000000"],
        });
    }

    ngOnDestroy() {
        this.subscription.unsubscribe();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<project name="Cloud Stack NetScaler network element" default="help" basedir=".">
  <description>
		Cloud Stack ant build file
    </description>

  <dirname property="netscaler.base.dir" file="${ant.file.Cloud Stack NetScaler network element}/"/>
  <!-- This directory must be set -->
  <property name="top.dir" location="${netscaler.base.dir}/../../.."/>
  <property name="build.dir" location="${top.dir}/build"/>

	<echo message="build.dir=${build.dir}; top.dir=${top.dir}; netscaler.base.dir=${netscaler.base.dir}"/>

  <!-- Import anything that the user wants to set-->
  <!-- Import properties files and environment variables here -->

  <property environment="env" />

  <condition property="build-cloud.properties.file" value="${build.dir}/override/build-cloud.properties" else="${build.dir}/build-cloud.properties">
    <available file="${build.dir}/override/build-cloud.properties" />
  </condition>

  <condition property="cloud.properties.file" value="${build.dir}/override/cloud.properties" else="${build.dir}/cloud.properties">
    <available file="${build.dir}/override/cloud.properties" />
  </condition>

  <condition property="override.file" value="${build.dir}/override/replace.properties" else="${build.dir}/replace.properties">
    <available file="${build.dir}/override/replace.properties" />
  </condition>

  <echo message="Using build parameters from ${build-cloud.properties.file}" />
  <property file="${build-cloud.properties.file}" />

  <echo message="Using company info from ${cloud.properties.file}" />
  <property file="${cloud.properties.file}" />

  <echo message="Using override file from ${override.file}" />
  <property file="${override.file}" />

  <property file="${build.dir}/build.number" />

  <!-- In case these didn't get defined in the build-cloud.properties -->
  <property name="branding.name" value="default" />
  <property name="deprecation" value="off" />
  <property name="target.compat.version" value="1.6" />
  <property name="source.compat.version" value="1.6" />
  <property name="debug" value="true" />
  <property name="debuglevel" value="lines,source"/>

  <echo message="target.dir=${target.dir}; top.dir=${top.dir}"/>
  <!-- directories for build and distribution -->
  <property name="target.dir" location="${top.dir}/target" />
  <property name="classes.dir" location="${target.dir}/classes" />
  <property name="jar.dir" location="${target.dir}/jar" />
  <property name="dep.cache.dir" location="${target.dir}/dep-cache" />
  <property name="build.log" location="${target.dir}/ant_verbose.txt" />

  <property name="deps.dir" location="${top.dir}/deps" />

  <property name="cloud-plugin-netscaler.jar" value="cloud-plugin-netscaler.jar" />

  <import file="${build.dir}/build-common.xml"/>

  <echo message="target.dir=${target.dir}; top.dir=${top.dir}"/>

  <!-- This section needs to be replaced by some kind of dependency library-->
  <path id="deps.classpath">
    <!--filelist files="${deps.classpath}" /-->
    <fileset dir="${deps.dir}" erroronmissingdir="false">
      <include name="*.jar" />
    </fileset>
  </path>

  <path id="cloudstack.classpath">
  	<fileset dir="${jar.dir}">
  	  <include name="*.jar"/>
    </fileset>
  </path>

  <path id="netscaler.classpath">
	<path refid="deps.classpath"/>
  	<path refid="cloudstack.classpath"/>
  </path>

  <!-- This section needs to be replaced by some kind of dependency library-->

  <target name="deploy-netscaler" >
  </target>

  <target name="init" description="Initialize binaries directory">
  	<mkdir dir="${classes.dir}/${cloud-plugin-netscaler.jar}"/>
  	<mkdir dir="${jar.dir}"/>
  </target>

  <target name="compile-netscaler" depends="init" description="Compile NetScaler">
    <compile-java jar.name="${cloud-plugin-netscaler.jar}" top.dir="${netscaler.base.dir}" classpath="netscaler.classpath" />
  </target>

  <target name="clean-netscaler">
    <delete dir="${classes.dir}/${cloud-plugin-netscaler.jar}"/>
  </target>

  <target name="build" depends="compile-netscaler"/>
  <target name="clean" depends="clean-netscaler"/>

  <target name="help" description="help">
    <echo level="info" message="This is the build file for NetScaler"/>
    <echo level="info" message="You can do a build by doing ant build or clean by doing ant clean" />
  </target>

</project>


text:
package io.pactfoundation.consumer.dsl;

import au.com.dius.pact.consumer.dsl.PM;
import au.com.dius.pact.consumer.dsl.PactDslJsonBody;
import au.com.dius.pact.consumer.dsl.PactDslJsonRootValue;
import au.com.dius.pact.core.model.PactSpecVersion;
import org.junit.jupiter.api.Test;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Map;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class LambdaDslObjectTest {

    @Test
    public void testStringValue() {
         /*
            {
                "bar": "Bar",
                "foo": "Foo"
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .stringValue("foo", "Foo")
                .stringValue("bar", "Bar")
                .getBody().toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody("", "", null);
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .stringValue("foo", "Foo")
                .stringValue("bar", "Bar");
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().isEmpty(), is(true));
    }

    @Test
    public void testNumberValue() {
         /*
            { "number": 1 }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
          .numberValue("number", 1)
          .getBody().toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody("", "", null);
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
          .numberValue("number", 1);
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().isEmpty(), is(true));
    }

    @Test
    public void testStringMatcher() {
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody("", "", null);
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .stringMatcher("foo", "[a-z][0-9]");
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString().replace("\"", "'");
        assertThat(actualJson, containsString("{'foo':"));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(1));
        final Map matcher = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("regex"));
        assertThat(matcher.get("regex"), is("[a-z][0-9]"));
    }

    @Test
    public void testStringMatcherWithExample() {
         /*
            {
                "foo": "a0"
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .stringMatcher("foo", "[a-z][0-9]", "a0")
                .getBody().toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .stringMatcher("foo", "[a-z][0-9]", "a0");
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(1));
        final Map matcher = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("regex"));
        assertThat(matcher.get("regex"), is("[a-z][0-9]"));
    }

    @Test
    public void testStringType() {
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .stringType("foo");
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString().replace("\"", "'");
        assertThat(actualJson, containsString("{'foo':"));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(1));
        final Map matcher = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("type"));
    }

    @Test
    public void testStringTypeWithExample() {
        /*
            {
                "foo": "Foo"
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .stringType("foo", "Foo")
                .getBody().toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody("", "", null);
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .stringType("foo", "Foo");
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(1));
        final Map matcher = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("type"));
    }

    @Test
    public void testStringTypes() {
        /*
            {
                "foo": [
                    {
                        "bar": "Bar"
                    }
                ]
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .stringType(new String[]{"foo", "bar"})
                .getBody().toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .stringType(new String[]{"foo", "bar"});
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        // It can't be equals because the values get generated randomly on each run
        //assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        assertThat(actualJson, containsString("foo"));
        assertThat(actualJson, containsString("bar"));
        Map matcher = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("type"));
        matcher = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("type"));
    }

    @Test
    public void testZonedDateTimeExampleValue() {
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody("", "", null);
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        final ZonedDateTime example = ZonedDateTime.of(LocalDateTime.of(2016, 10, 16, 02, 12, 45), ZoneId.of("America/Los_Angeles"));
        object
            .timestamp("timestamp", "yyyy-MM-dd'T'HH:mm:ssZ", example)
            .time("time", "HH:mm:ssZ", example)
            .date("date", "yyyy-MM-dd", example);
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is("{\"date\":\"2016-10-16\",\"time\":\"02:12:45-0700\",\"timestamp\":\"2016-10-16T02:12:45-0700\"}"));
    }

    @Test
    public void testAndMatchingRules() {
        /*
            {
                "foo" : "Foo"
            }
         */

        // Old Dsl
        final String pactDslJson = new PactDslJsonBody()
                .and("foo", "Foo", PM.stringType(), PM.includesStr("F"), PM.includesStr("oo"))
                .getBody().toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .and("foo", "Foo", PM.stringType(), PM.includesStr("F"), PM.includesStr("oo"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(3));
        assertThat(actualJson, containsString("foo"));
        assertThat(actualJson, containsString("Foo"));
        Map matcher = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("type"));
        matcher = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("include"));
        matcher = actualPactDsl.getMatchers().allMatchingRules().get(2).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("include"));
    }

    @Test
    public void testOrMatchingRules() {
        /*
            {
                "foo" : null
            }
         */

        // Old Dsl
        final String pactDslJson = new PactDslJsonBody()
                .or("foo", null, PM.nullValue(), PM.booleanType(), PM.numberType())
                .getBody().toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .or("foo", null, PM.nullValue(), PM.booleanType(), PM.numberType());
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(3));
        assertThat(actualJson, containsString("foo"));
        assertThat(actualJson, containsString("null"));
        Map matcher = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("null"));
        matcher = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("type"));
        matcher = actualPactDsl.getMatchers().allMatchingRules().get(2).toMap(PactSpecVersion.V3);
        assertThat(matcher.get("match"), is("number"));
    }

    @Test
    public void testArray() {
        /*
            {
                "foo": [
                    {
                        "bar": "Bar"
                    }
                ]
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .array("foo")
                .object()
                .stringValue("bar", "Bar")
                .closeObject()
                .closeArray()
                .getBody().toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .array("foo", (array) -> array.object((o) -> o.stringValue("bar", "Bar")));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().isEmpty(), is(true));
    }

    @Test
    public void testObject() {
        /*
            {
                "foo": {
                    "bar": "Bar"
                }
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .object("foo")
                .stringType("bar", "Bar")
                .closeObject()
                .getBody().toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
        object
                .object("foo", (o) -> o.stringValue("bar", "Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().isEmpty(), is(true));

    }

    @Test
    public void testEachArrayLike() {
        /*
            {
                "foo": [
                    ["Bar"]
                ]
            }

         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .eachArrayLike("foo")
                .stringType("Bar")
                .closeArray()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
                .eachArrayLike("foo", a -> a.stringType("Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("match"), is("type"));
        final Map<String, Object> subArrayRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(subArrayRule.get("match"), is("type"));
    }

    @Test
    public void testEachArrayLikeWithExample() {
        /*
            {
                "foo": [
                    ["Bar", "Bar"]
                ]
            }

         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .eachArrayLike("foo", 2)
                .stringType("Bar")
                .closeArray()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
                .eachArrayLike("foo", 2, a -> a.stringType("Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("match"), is("type"));
        final Map<String, Object> subArrayRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(subArrayRule.get("match"), is("type"));
    }

    @Test
    public void testEachArrayWithMinLike() {
        /*
            {
                "foo": [
                    ["Bar"]
                ]
            }

         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .eachArrayWithMinLike("foo", 2)
                .stringType("Bar")
                .closeArray()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
                .eachArrayWithMinLike("foo", 2, a -> a.stringType("Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("min"), is(2));
        final Map<String, Object> subArrayRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(subArrayRule.get("match"), is("type"));
    }

    @Test
    public void testEachArrayWithMinLikeWithExample() {
        /*
            {
                "foo": [
                    ["Bar"]
                ]
            }

         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .eachArrayWithMinLike("foo", 3, 2)
                .stringType("Bar")
                .closeArray()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
                .eachArrayWithMinLike("foo", 3, 2, a -> a.stringType("Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("min"), is(2));
        final Map<String, Object> subArrayRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(subArrayRule.get("match"), is("type"));
    }

    @Test
    public void testEachArrayWithMaxLike() {
        /*
            {
                "foo": [
                    ["Bar"]
                ]
            }

         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .eachArrayWithMaxLike("foo", 2)
                .stringType("Bar")
                .closeArray()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
                .eachArrayWithMaxLike("foo", 2, a -> a.stringType("Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("max"), is(2));
        final Map<String, Object> subArrayRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(subArrayRule.get("match"), is("type"));
    }

    @Test
    public void testEachArrayWithMaxLikeWithExample() {
        /*
            {
                "foo": [
                    ["Bar"]
                ]
            }

         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .eachArrayWithMaxLike("foo", 2, 3)
                .stringType("Bar")
                .closeArray()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
                .eachArrayWithMaxLike("foo", 2, 3, a -> a.stringType("Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("max"), is(3));
        final Map<String, Object> subArrayRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(subArrayRule.get("match"), is("type"));
    }

    @Test
    public void testEachArrayWithMinMaxLike() {
        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
          .eachArrayWithMinMaxLike("foo", 2, 10)
          .stringType("Bar")
          .closeArray()
          .closeArray()
          .getBody()
          .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
          .eachArrayWithMinMaxLike("foo", 2, 10, a -> a.stringType("Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("min"), is(2));
        assertThat(arrayRule.get("max"), is(10));
        final Map<String, Object> subArrayRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(subArrayRule.get("match"), is("type"));
    }

    @Test
    public void testEachArrayWithMinMaxLikeWithExample() {
        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
          .eachArrayWithMinMaxLike("foo", 2, 2, 10)
          .stringType("Bar")
          .closeArray()
          .closeArray()
          .getBody()
          .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
          .eachArrayWithMinMaxLike("foo", 2, 10, 2, a -> a.stringType("Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("min"), is(2));
        assertThat(arrayRule.get("max"), is(10));
        final Map<String, Object> subArrayRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(subArrayRule.get("match"), is("type"));
    }

    @Test
    public void testEachLike() {
        /*
            {
                "foo": [
                    {
                        "bar": "string"
                    }
                ]
            }

         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .eachLike("foo")
                .stringType("bar")
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
                .eachLike("foo", o -> o.stringType("bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("match"), is("type"));
        final Map<String, Object> arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(arrayObjectRule.get("match"), is("type"));

    }

    @Test
    public void testEachLikeWithExample() {
        /*
            {
                "foo": [
                    {
                        "bar": "Bar"
                    },
                    {
                        "bar": "Bar"
                    }
                ]
            }

         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .eachLike("foo", 2)
                .stringType("bar", "Bar")
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslJsonBody object = new LambdaDslJsonBody(actualPactDsl);
        object
                .eachLike("foo", 2, o -> o.stringType("bar", "Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("match"), is("type"));
        final Map<String, Object> arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(arrayObjectRule.get("match"), is("type"));

    }

    @Test
    public void testMinArrayLike() {
        /*
            {
                "foo": [
                    {
                        "bar": "string"
                    },
                    {
                        "bar": "string"
                    }
                ]
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .minArrayLike("foo", 2)
                .stringType("bar")
                .closeObject()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslJsonBody(actualPactDsl);
        object
                .minArrayLike("foo", 2, o -> o.stringType("bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> arrayRule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(arrayRule.get("min"), is(2));
        final Map<String, Object> arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(arrayObjectRule.get("match"), is("type"));
    }

    @Test
    public void testMinArrayLikeWithExample() {
        /*
            {
                "foo": [
                    {
                        "bar": "Bar"
                    },
                    {
                        "bar": "Bar"
                    },
                    {
                        "bar": "Bar"
                    }
                ]
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .minArrayLike("foo", 2, 3)
                .stringType("bar", "Bar")
                .closeObject()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslJsonBody(actualPactDsl);
        object
                .minArrayLike("foo", 2, 3, o -> o.stringType("bar", "Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> rule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(rule.get("min"), is(2));
        final Map<String, Object> arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(arrayObjectRule.get("match"), is("type"));
    }

    @Test
    public void testMaxArrayLike() {
        /*
            {
                "foo": [
                    {
                        "bar": "string"
                    }
                ]
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .maxArrayLike("foo", 2)
                .stringType("bar")
                .closeObject()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslJsonBody(actualPactDsl);
        object
                .maxArrayLike("foo", 2, o -> o.stringType("bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> rule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(rule.get("max"), is(2));
        final Map<String, Object> arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(arrayObjectRule.get("match"), is("type"));
    }

    @Test
    public void testMaxArrayLikeWithExample() {
        /*
            {
                "foo": [
                    {
                        "bar": "Bar"
                    },
                    {
                        "bar": "Bar"
                    }
                ]
            }
         */

        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .maxArrayLike("foo", 3, 2)
                .stringType("bar", "Bar")
                .closeObject()
                .closeArray()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslJsonBody(actualPactDsl);
        object
                .maxArrayLike("foo", 3, 2, o -> o.stringType("bar", "Bar"));
        actualPactDsl.close();

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
        assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
        final Map<String, Object> rule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
        assertThat(rule.get("max"), is(3));
        final Map<String, Object> arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
        assertThat(arrayObjectRule.get("match"), is("type"));
    }

  @Test
  public void testMinMaxArrayLike() {
    // Old DSL
    final String pactDslJson = new PactDslJsonBody()
      .minMaxArrayLike("foo", 2, 7)
      .stringType("bar")
      .closeObject()
      .closeArray()
      .getBody()
      .toString();

    // Lambda DSL
    final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
    final LambdaDslObject object = new LambdaDslJsonBody(actualPactDsl);
    object
      .minMaxArrayLike("foo", 2, 7, o -> o.stringType("bar"));
    actualPactDsl.close();

    String actualJson = actualPactDsl.getBody().toString();
    assertThat(actualJson, is(pactDslJson));
    assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
    final Map<String, Object> rule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
    assertThat(rule.get("min"), is(2));
    assertThat(rule.get("max"), is(7));
    final Map<String, Object> arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
    assertThat(arrayObjectRule.get("match"), is("type"));
  }

  @Test
  public void testMinMaxArrayLikeWithExample() {
    // Old DSL
    final String pactDslJson = new PactDslJsonBody()
      .minMaxArrayLike("foo", 3, 5, 3)
      .stringType("bar", "Bar")
      .closeObject()
      .closeArray()
      .getBody()
      .toString();

    // Lambda DSL
    final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
    final LambdaDslObject object = new LambdaDslJsonBody(actualPactDsl);
    object
      .minMaxArrayLike("foo", 3, 5, 3, o -> o.stringType("bar", "Bar"));
    actualPactDsl.close();

    String actualJson = actualPactDsl.getBody().toString();
    assertThat(actualJson, is(pactDslJson));
    assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(2));
    final Map<String, Object> rule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
    assertThat(rule.get("min"), is(3));
    assertThat(rule.get("max"), is(5));
    final Map<String, Object> arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
    assertThat(arrayObjectRule.get("match"), is("type"));
  }

    @Test
    public void testEachKeyLike() {
        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .object("one")
                .eachKeyLike("001-A") // key like an id where the value is matched by the following example
                .stringType("description", "Some Description")
                .closeObject()
                .closeObject()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslJsonBody(actualPactDsl);
        object.object("one",
                      o -> o.eachKeyLike("001-A",
                                         nested -> nested.stringType("description", "Some Description")));

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
    }

    @Test
    public void testEachKeyMappedToAnArrayLike() {
        // Old DSL
        final String pactDslJson = new PactDslJsonBody()
                .object("one")
                .eachKeyMappedToAnArrayLike("001")
                .id("someId", 23456L)
                .closeObject()
                .closeArray()
                .closeObject()
                .getBody()
                .toString();

        // Lambda DSL
        final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
        final LambdaDslObject object = new LambdaDslJsonBody(actualPactDsl);
        object.object("one",
                      o -> o.eachKeyMappedToAnArrayLike("001",
                                                        nested -> nested.id("someId", 23456L)));

        String actualJson = actualPactDsl.getBody().toString();
        assertThat(actualJson, is(pactDslJson));
    }

  @Test
  public void testStringArray() {
    /*
        {
            "foo": [ "one", "one", "one" ]
        }
     */

    // Old DSL
    final String pactDslJson = new PactDslJsonBody()
      .minArrayLike("foo", 3, PactDslJsonRootValue.stringType("one"), 3)
      .maxArrayLike("foo2", 3, PactDslJsonRootValue.stringType("one"), 3)
      .minMaxArrayLike("foo3", 3, 10, PactDslJsonRootValue.stringType("one"), 3)
      .getBody().toString();

    // Lambda DSL
    final PactDslJsonBody actualPactDsl = new PactDslJsonBody();
    final LambdaDslObject object = new LambdaDslObject(actualPactDsl);
    object
      .minArrayLike("foo", 3, PactDslJsonRootValue.stringType("one"), 3)
      .maxArrayLike("foo2", 3, PactDslJsonRootValue.stringType("one"), 3)
      .minMaxArrayLike("foo3", 3, 10, PactDslJsonRootValue.stringType("one"), 3);
    actualPactDsl.close();

    String actualJson = actualPactDsl.getBody().toString();
    assertThat(actualJson, is(pactDslJson));
    assertThat(actualPactDsl.getMatchers().allMatchingRules().size(), is(6));
    Map<String, Object> rule = actualPactDsl.getMatchers().allMatchingRules().get(0).toMap(PactSpecVersion.V3);
    assertThat(rule.get("min"), is(3));
    Map<String, Object> arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(1).toMap(PactSpecVersion.V3);
    assertThat(arrayObjectRule.get("match"), is("type"));
    rule = actualPactDsl.getMatchers().allMatchingRules().get(2).toMap(PactSpecVersion.V3);
    assertThat(rule.get("max"), is(3));
    arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(3).toMap(PactSpecVersion.V3);
    assertThat(arrayObjectRule.get("match"), is("type"));
    rule = actualPactDsl.getMatchers().allMatchingRules().get(4).toMap(PactSpecVersion.V3);
    assertThat(rule.get("min"), is(3));
    assertThat(rule.get("max"), is(10));
    arrayObjectRule = actualPactDsl.getMatchers().allMatchingRules().get(5).toMap(PactSpecVersion.V3);
    assertThat(arrayObjectRule.get("match"), is("type"));
  }

  @Test
  public void testValueFromProviderState() {
    String pactDslJson = new PactDslJsonBody()
            .valueFromProviderState("id", "id", "A1")
            .getBody().toString();
    String lambdaDslJson = LambdaDsl
            .newJsonBody(body -> body.valueFromProviderState("id", "id", "A1"))
            .build().toString();
    assertThat(lambdaDslJson, is(pactDslJson));
  }
}


text:
{% extends "../head.html" %}

{% block page_title %}
  Request to view other people's licences - GOV.UK
{% endblock %}

{% block content %}

  {% include "../partials/beta-banner.html" %}

  {% include "../partials/nav-manage.html" %}

Request to view other people's licences

If you manage licences for other people (as an agent or consultant, for example), you can use this service to view information about those licences online.

        How does the request process work?

We'll ask you for licence holder's email address and licence number(s).

We'll email the licence holder to ask permission to share their licence information with you online. The licence holder can accept or reject your request.

If they accept, we'll send them a security code to the postal address on their licence to make sure they are the registered licence holder. They should receive the code within 5 working days.

Once the licence holder receives the code, they can either enter it into our system or ask you to do it for them. Please contact them to agree the best way for this to happen.

As soon as the security code has been entered, you'll be able to view the licence information online.

Request to manage licences

{% endblock %}


text:
from wdom import options, tag
from wdom.themes import default
from wdom.document import Document, get_document

def _get_theme_name(theme) -> str:
    if hasattr(theme, 'name'):
        theme_name = theme.name
    elif theme.__name__ == 'wdom.themes':
        if options.config.theme:
            theme_name = options.config.theme.upper()
        else:
            theme_name = 'DEFAULT'
    return theme_name

def sample_app(theme=default) -> tag.Tag:
    app = theme.Div()
    body = theme.Container(parent=app, style='width: 80vw; margin: 1em 10vw;')
    body.append(theme.Div(theme.H1(_get_theme_name(theme)),
                          style='text-align: center;'))
    body.append(theme.Hr())

    # Typography
    body.append(theme.H1('Typography', style='text-align: center;'))
    typography = theme.Div(parent=body)
    typography.append(
        theme.H1('Heading 1'),
        theme.H2('Heading 2'),
        theme.H3('Heading 3'),
        theme.H4('Heading 4'),
        theme.H5('Heading 5'),
        theme.H6('Heading 6'),
        theme.P(
            'This is a paragraph. ',
            theme.Code('Code, '),
            theme.Strong('Bolded, '),
            theme.Em('Italicized, '),
            theme.A('Colored (link)'),
            ', and ',
            theme.U('Underlined'),
            ' strings.',
        ),
    )

    code_div = theme.Div(parent=body)
    pre = theme.Pre(parent=code_div)
    pre.append(theme.Code(
        '''\
    # Source code preview
    def python(i: int) -> str:
        print(str(i))
    '''.rstrip()))

    body.append(theme.Hr())

    # Buttons
    body.append(theme.H1('Buttons', style='text-align: center;'))

    button_wrapper = theme.Div(parent=body)
    button_wrapper.append(
        theme.Button('Button'),
        theme.DefaultButton('Default'),
        theme.PrimaryButton('Primary'),
        theme.SecondaryButton('Secondary'),
        theme.SuccessButton('Success'),
        theme.InfoButton('Info'),
        theme.WarningButton('Warning'),
        theme.DangerButton('Danger'),
        theme.ErrorButton('Error'),
        theme.LinkButton('Link'),
    )
    body.append(theme.Hr())

    # List
    body.append(theme.H1('List', style='text-align: center;'))
    list_div = theme.Row(parent=body)
    ul_div = theme.Col6(parent=list_div)
    ul_div.append(theme.H3('Unordered List'))
    ul1 = theme.Ul(parent=ul_div)
    ul1.append(theme.Li('Item 1'))
    li = theme.Li('Item 2', parent=ul1)
    ul2 = theme.Ul(parent=li)
    ul2.append(
        theme.Li('Item 2.1'),
        theme.Li('Item 2.2'),
        theme.Li('Item 3'),
    )

    ol_div = theme.Col6(parent=list_div)
    ol_div.append(theme.H3('Ordered List'))
    ol1 = theme.Ol(parent=ol_div)
    ol1.append(theme.Li('Item 1'))
    li = theme.Li('Item 2', parent=ol1)
    ol2 = theme.Ol(parent=li)
    ol2.append(
        theme.Li('Item 2.1'),
        theme.Li('Item 2.2'),
        theme.Li('Item 3'),
    )
    body.append(theme.Hr())

    # Form
    body.append(theme.H1('Form', style='text-align: center;'))

    input_wrapper = theme.FormInner(parent=theme.Form(parent=theme.FormGroup(parent=body)))  # noqa: E501
    input_wrapper.append(
        theme.Row(
            theme.Col6(
                theme.FormItem(
                    theme.Label('TextArea'),
                    theme.Textarea(placeholder='textarea', rows=10),
                ),
            ),
            theme.Col6(
                theme.FormItem(
                    theme.Label('Text Input'),
                    theme.Input(placeholder='<input type="text">'),
                ),
                theme.FormItem(
                    theme.Label(theme.CheckBox(), 'Check1'),
                    theme.Label(theme.CheckBox(), 'Check2'),
                ),
                theme.FormItem(
                    theme.Label(theme.RadioButton(name='radio_group'), 'Radio1'),  # noqa: E501
                    theme.Label(theme.RadioButton(name='radio_group'), 'Radio2'),  # noqa: E501
                ),
                theme.FormItem(
                    theme.Select(
                        theme.Option('Item 1'),
                        theme.Optgroup(
                            theme.Option('Item 2'),
                            theme.Option('Item 3'),
                            label='- Item Group -'
                        )
                    ),
                ),
                theme.FormItem(
                    theme.Select(
                        theme.Option('Option 1'),
                        theme.Optgroup(
                            theme.Option('Option 1.1'),
                            theme.Option('Option 1.2'),
                            theme.Option('Option 1.3'),
                            label='- Option Group -',
                        ),
                        multiple=True,
                        size=5,
                    ),
                ),
            ),
        ),
    )

    body.append(theme.Hr())

    # Table
    body.append(theme.H1('Table', style='text-align: center;'))

    table_div = theme.Div(parent=body)
    table = theme.Table(parent=table_div)

    thead = theme.Thead(parent=table)
    tr1 = theme.Tr(parent=thead)
    tr1.append(
        theme.Th('Name'),
        theme.Th('Age'),
        theme.Th('Seibetsu'),
        theme.Th('Location'),
    )

    tbody = theme.Tbody(parent=table)
    tr2 = theme.Tr(parent=tbody)
    tr2.append(
        theme.Td('Taro Suzuki'),
        theme.Td('26'),
        theme.Td('Male'),
        theme.Td('Tokyo'),
    )

    tr3 = theme.Tr(parent=tbody)
    tr3.append(
        theme.Td('Hanako Yamada'),
        theme.Td('20'),
        theme.Td('Female'),
        theme.Td('Kyoto'),
    )
    body.append(theme.Hr())

    # Grid Layout
    body.append(theme.H1('Grid Layout', style='text-align: center;'))

    grid = theme.Container(
        parent=body,
        style='border: solid 1px #bbb; background-color: #666;'
    )
    left_style = 'background-color: #eeeeee;'
    right_style = 'background-color: #fafafa'
    for i in range(0, 13):
        lcol = 'Col' + str(i or '')
        rcol = 'Col' + str(12 - i or '')
        grid.append(theme.Row(
            getattr(theme, lcol)(lcol, style=left_style),
            getattr(theme, rcol)(rcol, style=right_style),
        ))

    return app

def sample_page(theme=default) -> Document:
    page = get_document()
    app = sample_app(theme)
    page.body.prepend(app)
    for css in theme.css_files:
        page.add_cssfile(css)
    for js in theme.js_files:
        page.add_jsfile(js)
    return page

def main():
    from wdom import server
    sample_page()
    server.start()

if __name__ == '__main__':
    main()


text:
from __future__ import print_function
from builtins import input
import proteus
from proteus.MeshTools import *

## \ingroup scripts
#
# \file readMesh.py
#
# \brief A script for reading a .3dm file for  viewing or exctracint the boundary mesh.

def readMesh():
    from optparse import OptionParser
    usage  = "usage: %readMesh  [options] meshFilename"
    parser = OptionParser(usage=usage)
    parser.add_option("-b", "--boundaryMesh",
                      help="print boundary mesh to 3dm file",
                      action="store_true",
                      dest="boundaryMesh",
                      default=False)
    parser.add_option("-e", "--ensight",
                      help="print meshes to ensight format",
                      action="store_true",
                      dest="ensight",
                      default=False)
    parser.add_option("-m", "--matlab",
                      help="print edges to files for plotting in matlab",
                      action="store_true",
                      dest="matlab",
                      default=False)
    parser.add_option("-M", "--view-matlab",
                      help="plot edges in matlab",
                      action="store_true",
                      dest="viewMatlab",
                      default=False)
    parser.add_option("-g", "--gnuplot",
                      help="print edges to files for plotting in gnuplot",
                      action="store_true",
                      dest="gnuplot",
                      default=False)
    parser.add_option("-G", "--view-gnuplot",
                      help="plot edges in gnuplot",
                      action="store_true",
                      dest="viewGnuplot",
                      default=False)
    (opts, args) = parser.parse_args()
    print(args)
    if len(args)==1:
        meshFilename = args[0]
    else:
        print(usage)
        return 1
    #mesh=TetrahedralMesh()
    #mesh.readMeshADH(filename)
    mesh = None
    meshIn = open(meshFilename+'.3dm','r')
    firstLine = meshIn.readline()
    firstWords = firstLine.split()
    meshIn.close()
    if firstWords[0] == 'MESH3D':
        mesh = Mesh3DM(meshFilename)
    elif firstWords[0] == 'MESH2D':
        mesh = Mesh2DM(meshFilename)
    else:
        print(firstWords[0])
    #print mesh.meshInfo()
    if opts.boundaryMesh:
        mesh.buildTriangleArrays()
        mesh.writeBoundaryMeshADH(meshFilename)
    if opts.ensight:
        if opts.boundaryMesh:
            mesh.writeBoundaryMeshEnsight(meshFilename)
        mesh.writeMeshEnsight(meshFilename)
    if opts.matlab or opts.viewMatlab:
        mesh.writeEdgesMatlab('meshEdges')
    if opts.viewMatlab:
        mesh.viewMeshMatlab('meshEdges')
    if opts.gnuplot or opts.viewGnuplot:
        mesh.writeEdgesGnuplot('meshEdges')
    if opts.viewGnuplot:
        mesh.viewMeshGnuplot('meshEdges')
    return 0
if __name__ == '__main__':
    import profile
    import pstats
    import gc
    gc.enable()
#     gc.set_debug(gc.DEBUG_STATS)
#      profile.run('readMesh()','readMeshProf')
#      p = pstats.Stats('readMeshProf')
#      p.sort_stats('cumulative').print_stats(20)
#      p.sort_stats('time').print_stats(20)
    readMesh()
    input('Please press return to continue... \n')


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>{{ site.title }}{% if page.title %} — {{ page.title | markdownline | strip_html }}{% endif %}</title>
	<meta name="viewport" content="width=device-width,initial-scale=1">
	<link rel="stylesheet" href="/styles/screen.css">
	<link rel="manifest" href="/devopera.webmanifest">
	<link rel="alternate" href="/feed/" type="application/atom+xml" title="Dev.Opera">
	<link rel="alternate" href="/feed/articles/" type="application/atom+xml" title="Dev.Opera Articles">
	<link rel="alternate" href="/feed/blog/" type="application/atom+xml" title="Dev.Opera Blog">
	<link rel="alternate" href="/feed/tv/" type="application/atom+xml" title="Dev.Opera TV">
{% if page.url == '/index.html' %}
	<meta name="description" content="Dev.Opera covers current and future HTML, CSS and JavaScript features and implementations, responsive web design, browser extensions, and more.">
{% endif %}

{% if page.url == '/index.html' %}

				Dev.Opera

{% else %}

				Dev.Opera

{% endif %}

			{% include menu.html items='Blog|Articles|Extensions|TV' %}

		<form action="/search/" method="get">
			<fieldset elem="search">
				<input elem="search-field" type="search" name="q" placeholder="Search Dev.Opera" required>
			</fieldset>
		</form>


text:
use std::net::{SocketAddr, UdpSocket};
use std::io::Result as IOResult;

use keys::*;
use boxes::*;
use nonces::*;
use packet::*;
use identity::*;

pub struct Client {
    client_extension: Extension,
    server_extension: Extension,
    sock: UdpSocket,
    rem_addr: SocketAddr,
    precomputed_key: PrecomputedKey,
    client_short_term_pk: client_short_term::PublicKey,
    next_send_nonce: Nonce8,
    last_recv_nonce: Nonce8,
}

impl Client {
    pub fn connect(id: Identity, client_extension: Extension, sock: UdpSocket, remote_server: RemoteServer, payload: Option<&[u8]>) -> IOResult<Client> {
        let (client_short_term_pk, client_short_term_sk) = client_short_term::gen_keypair();
        let client_long_term_pk = client_long_term::PublicKey(id.pk);
        let client_long_term_sk = client_long_term::SecretKey(id.sk);
        let mut next_send_nonce = Nonce8::new_low();

        {
            let RemoteServer { ref server_extension, ref server_long_term_pk, .. } = remote_server;

            let hello_packet: Packet = HelloPacket {
                server_extension: server_extension.clone(),
                client_extension: client_extension.clone(),
                client_short_term_pk: client_short_term_pk.clone(),
                hello_box: PlainHelloBox::new_empty().seal(&next_send_nonce, &server_long_term_pk, &client_short_term_sk),
            }.into();
            next_send_nonce.increment();

            try!(hello_packet.send(&sock, remote_server.server_addr.clone()));
        }

        {
            let RemoteServer { ref server_extension, ref server_long_term_pk, .. } = remote_server;

            let (packet, rem_addr) = try!(Packet::recv(&sock));

            if let Packet::Cookie(ref cookie_packet) = packet {
                debug!("COOKIE packet!");

                let cookie_box = cookie_packet.cookie_box.open(server_long_term_pk, &client_short_term_sk).unwrap();
                let server_short_term_pk = cookie_box.server_short_term_pk;
                let precomputed_key = PrecomputedKey::precompute_at_client(&server_short_term_pk, &client_short_term_sk);

                let initiate_packet: Packet = InitiatePacket {
                    server_extension: server_extension.clone(),
                    client_extension: client_extension.clone(),
                    client_short_term_pk: client_short_term_pk.clone(),
                    server_cookie: cookie_box.server_cookie,
                    initiate_box: PlainInitiateBox {
                        client_long_term_pk: client_long_term_pk.clone(),
                        vouch: PlainVouch {
                            client_short_term_pk: client_short_term_pk.clone(),
                        }.seal(&Nonce16::new_random(), &server_long_term_pk, &client_long_term_sk),
                        domain_name: DomainName::new_empty(),
                    }.seal_precomputed(&next_send_nonce, &precomputed_key, payload),
                }.into();
                next_send_nonce.increment();

                try!(initiate_packet.send(&sock, rem_addr));

                Ok(Client {
                    client_extension: client_extension,
                    server_extension: server_extension.clone(),
                    sock: sock,
                    rem_addr: remote_server.server_addr,
                    precomputed_key: precomputed_key,
                    client_short_term_pk: client_short_term_pk,
                    next_send_nonce: next_send_nonce,
                    last_recv_nonce: Nonce8::new_zero(),
                })
            } else {
                panic!("Cookie packet not recv!!");
            }
        }
    }

    pub fn send(&mut self, msg: &[u8]) -> IOResult<usize> {
        let client_msg_packet: Packet = ClientMessagePacket {
            server_extension: self.server_extension.clone(),
            client_extension: self.client_extension.clone(),
            client_short_term_pk: self.client_short_term_pk.clone(),
            payload_box: ClientMessageBox::seal_precomputed(msg, &self.next_send_nonce, &self.precomputed_key),
        }.into();
        self.next_send_nonce.increment();

        client_msg_packet.send(&self.sock, self.rem_addr.clone())
    }

    pub fn recv(&mut self) -> IOResult<Vec<u8>> {
        loop {
            let (packet, _rem_addr) = try!(Packet::recv(&self.sock));

            if let Packet::ServerMessage(ref server_msg_packet) = packet {
                debug!("SERVER_MSG packet!");

                if server_msg_packet.payload_box.nonce <= self.last_recv_nonce {
                    debug!("Invalid nonce!");
                    continue;
                }

                self.last_recv_nonce = server_msg_packet.payload_box.nonce.clone();

                return Ok(server_msg_packet.payload_box.open_precomputed(&self.precomputed_key).unwrap());
            } else {
                debug!("Incorrect msg type recv'd");
            }
        }
    }
}


text:
package com.jtransc.io.async;

import com.jtransc.annotation.JTranscAddMembers;
import com.jtransc.annotation.JTranscAddMembersList;
import com.jtransc.annotation.JTranscMethodBody;
import com.jtransc.annotation.JTranscMethodBodyList;
import com.jtransc.async.JTranscAsyncHandler;
import com.jtransc.io.JTranscSyncIO;

import java.io.FileNotFoundException;
import java.io.IOException;

@JTranscAddMembers(target = "dart", value = "RandomAccessFile raf;")
public class JTranscAsyncFileStream extends JTranscAsyncStream {
	JTranscSyncIO.ImplStream syncStream;

	@JTranscMethodBody(target = "dart", value = {
		"var mode = (N.istr(p2) == 'rw') ? FileMode.WRITE : FileMode.READ;",
		"N.completeFuture(p3, () async {",
		"	this.raf = await new File(N.istr(p0)).open(mode: mode);",
		"	return this;",
		"});",
	})
	public void openAsync(String path, int mode, String modestr, JTranscAsyncHandler<JTranscAsyncFileStream> callback) {
		try {
			syncStream = JTranscSyncIO.impl.open(path, mode);
			callback.complete(this, null);
		} catch (FileNotFoundException e) {
			callback.complete(null, e);
		}
	}

	@JTranscMethodBody(target = "dart", value = {
		"N.completeFuture(p4, () async {",
		"	await this.raf.setPosition(p0.toInt());",
		"	await this.raf.writeFrom(p1.data, p2, p2 + p3);",
		"	return N.boxInt(p3);",
		"});",
	})
	@Override
	public void writeAsync(long position, byte[] data, int offset, int size, JTranscAsyncHandler<Integer> callback) {
		syncStream.setPosition(position);
		callback.complete(syncStream.write(data, offset, size), null);
	}

	@JTranscMethodBody(target = "dart", value = {
		"N.completeFuture(p4, () async {",
		"	await this.raf.setPosition(p0.toInt());",
		"	var count = await this.raf.readInto(p1.data, p2, p2 + p3);",
		"	return N.boxInt(count);",
		"});",
	})
	@Override
	public void readAsync(long position, byte[] data, int offset, int size, JTranscAsyncHandler<Integer> callback) {
		syncStream.setPosition(position);
		callback.complete(syncStream.read(data, offset, size), null);
	}

	@JTranscMethodBody(target = "dart", value = "N.completeFuture(p1, () async { await this.raf.truncate(p0.toInt()); return N.boxLong(p0.toInt()); });")
	@Override
	public void setLengthAsync(long length, JTranscAsyncHandler<Long> callback) {
		syncStream.setLength(length);
		callback.complete(length, null);
	}

	@JTranscMethodBody(target = "dart", value = "N.completeFuture(p0, () async { var length = await this.raf.length(); return N.boxLong(N.lnew(length.toInt())); });")
	@Override
	public void getLengthAsync(JTranscAsyncHandler<Long> callback) {
		callback.complete(syncStream.getLength(), null);
	}

	@JTranscMethodBody(target = "dart", value = "N.completeFuture(p0, () async { await this.raf.close(); return N.boxInt(0); });")
	@Override
	public void closeAsync(JTranscAsyncHandler<Integer> callback) {
		try {
			syncStream.close();
			callback.complete(0, null);
		} catch (IOException e) {
			callback.complete(null, e);
		}
	}
}


text:
package org.jboss.resteasy.security.smime;

import org.bouncycastle.cms.CMSAlgorithm;
import org.bouncycastle.cms.CMSEnvelopedDataStreamGenerator;
import org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder;
import org.bouncycastle.cms.jcajce.JceKeyTransRecipientInfoGenerator;
import org.bouncycastle.operator.OutputEncryptor;
import org.jboss.resteasy.security.BouncyIntegration;
import org.jboss.resteasy.security.doseta.i18n.Messages;
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
import org.jboss.resteasy.spi.WriterException;
import org.jboss.resteasy.util.Base64;

import javax.mail.MessagingException;
import javax.mail.internet.InternetHeaders;
import javax.mail.internet.MimeBodyPart;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.Providers;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;

/**
 * @author Bill Burke
 * @version $Revision: 1 $
 */
@Provider
@Produces("*/*")
public class EnvelopedWriter implements MessageBodyWriter<EnvelopedOutput>
{
   static
   {
      BouncyIntegration.init();
   }

   @Context
   protected Providers providers;

   @Override
   public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
   {
      return EnvelopedOutput.class.isAssignableFrom(type);
   }

   @Override
   public long getSize(EnvelopedOutput smimeOutput, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
   {
      return -1;
   }

   @Override
   public void writeTo(EnvelopedOutput out, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> headers, OutputStream os) throws IOException, WebApplicationException
   {
      ByteArrayOutputStream baos = null;
      OutputStream encrypted = null;
      try
      {
         headers.putSingle("Content-Disposition", "attachment; filename=\"smime.p7m\"");
         headers.putSingle("Content-Type", "application/pkcs7-mime; smime-type=enveloped-data; name=\"smime.p7m\"");
         headers.putSingle("Content-Transfer-Encoding", "base64");

         OutputEncryptor encryptor = new JceCMSContentEncryptorBuilder(CMSAlgorithm.DES_EDE3_CBC)
                 .setProvider("BC")
                 .build();
         if (out.getCertificate() == null) throw new NullPointerException(Messages.MESSAGES.certificateObjectNotSet());
         JceKeyTransRecipientInfoGenerator infoGenerator = new JceKeyTransRecipientInfoGenerator(out.getCertificate());
         infoGenerator.setProvider("BC");
         CMSEnvelopedDataStreamGenerator generator = new CMSEnvelopedDataStreamGenerator();
         generator.addRecipientInfoGenerator(infoGenerator);

         MimeBodyPart _msg = createBodyPart(providers, out);

         baos = new ByteArrayOutputStream();
         encrypted = generator.open(baos, encryptor);

         _msg.writeTo(encrypted);
         encrypted.close();
         byte[] bytes = baos.toByteArray();
         String str = Base64.encodeBytes(bytes, Base64.DO_BREAK_LINES);
         os.write(str.getBytes());
      }
      catch (Exception e)
      {
         throw new WriterException(e);
      }
   }

   public static MimeBodyPart createBodyPart(Providers providers, SMIMEOutput out) throws IOException, MessagingException
   {
      ByteArrayOutputStream bodyOs = new ByteArrayOutputStream();
      MessageBodyWriter writer = providers.getMessageBodyWriter(out.getType(), out.getGenericType(), null, out.getMediaType());
      if (writer == null)
      {
         throw new WriterException(Messages.MESSAGES.failedToFindWriter(out.getType().getName()));
      }
      MultivaluedMapImpl<String, Object> bodyHeaders = new MultivaluedMapImpl<String, Object>();
      bodyHeaders.add("Content-Type",  out.getMediaType().toString());
      writer.writeTo(out.getEntity(), out.getType(), out.getGenericType(), null, out.getMediaType(), bodyHeaders, bodyOs);

      InternetHeaders ih = new InternetHeaders();

      for (Map.Entry<String, List<Object>> entry : bodyHeaders.entrySet())
      {
         for (Object value : entry.getValue())
         {
            ih.addHeader(entry.getKey(), value.toString());
         }
      }
      return new MimeBodyPart(ih, bodyOs.toByteArray());
   }
}