text:
/* http://blog.bassta.bg/2013/05/smooth-page-scrolling-with-tweenmax/ */

$(function(){

	var $window = $(window);		//Window object

	var scrollTime = 0.3;			//Scroll time
	var scrollDistance = 40;		//Distance. Use smaller value for shorter scroll and greater value for longer scroll

	$window.on("mousewheel DOMMouseScroll", function(event){

		event.preventDefault();

		var delta = event.originalEvent.wheelDelta/120 || -event.originalEvent.detail/3;
		var scrollTop = $window.scrollTop();
		var finalScroll = scrollTop - parseInt(delta*scrollDistance);

		TweenMax.to($window, scrollTime, {
			scrollTo : { y: finalScroll, autoKill:true },
				ease: Power1.easeOut,	//For more easing functions see http://api.greensock.com/js/com/greensock/easing/package-detail.html
				autoKill: true,
				overwrite: 5
			});

	});

});


text:
angular.module('pixewsWeb', [
  'ngRoute',
  'ngTouch',
  'ngAnimate',
  'angularModalService'
]);

angular.module('pixewsWeb').constant('config', {
  baseApi: 'http://ec2-52-23-224-27.compute-1.amazonaws.com',
  // baseApi: 'http://localhost:3000',
  publicToken: "2d7fEicnEirsPE"
})

redpajama_set_name: RedPajamaGithub


text:
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { push } from 'connected-react-router';
import { isEmpty } from 'lodash';

import { fetchNavigation, setNavigationVisibility } from './reducer';

import { itemById } from '../../utils/helpers';

import Navigation from './Navigation';

const mapDispatchToProps = (dispatch) => {
  return {
    fetchNavigation: bindActionCreators(fetchNavigation, dispatch),
    push: (path) => dispatch(push(path)),
    setNavigationVisibility: bindActionCreators(setNavigationVisibility, dispatch)
  };
};

const mapStateToProps = (state, ownProps) => {
  const { items, timestamp } = state.navigation;
  const { attributeTypes } = state.ui;
  const { selectedTOS, classification } = state;
  const tos = selectedTOS.classification ? itemById(items, selectedTOS.classification.id) : classification.id ? itemById(items, classification.id) : null;
  const tosPath = ownProps.tosPath ? ownProps.tosPath : tos ? tos.path : [];

  return {
    attributeTypes,
    tosPath,
    is_open: state.navigation.is_open,
    isFetching: state.navigation.isFetching,
    isUser: !isEmpty(state.user.data),
    items, // TODO: Unhack this when Navigation doesn't mutate state
    itemsTimestamp: timestamp,
    selectedTOS
  };
};

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Navigation));


text:
import unittest

from pluginsmanager.model.lv2.lv2_effect_builder import Lv2EffectBuilder
from pluginsmanager.model.connection import Connection
from pluginsmanager.model.system.system_effect import SystemEffect
from pluginsmanager.observer.mod_host.protocol_parser import ProtocolParser

class ProtocolParserTest(unittest.TestCase):
    builder = None

    @classmethod
    def setUpClass(cls):
        cls.builder = Lv2EffectBuilder()

    def test_add(self):
        effect_uri = 'http://calf.sourceforge.net/plugins/Reverb'
        effect_instance = 3

        reverb = self.builder.build(effect_uri)
        reverb.instance = effect_instance

        message = ProtocolParser.add(reverb)

        correct_message = "add {} {}".format(effect_uri, effect_instance)
        self.assertEqual(correct_message, message)

    def test_remove(self):
        effect_uri = 'http://calf.sourceforge.net/plugins/Reverb'
        effect_instance = 3

        reverb = self.builder.build(effect_uri)
        reverb.instance = effect_instance

        message = ProtocolParser.remove(reverb)

        correct_message = "remove {}".format(effect_instance)
        self.assertEqual(correct_message, message)

    def test_connect(self):
        effect1_instance = 3
        effect2_instance = 4

        reverb1 = self.builder.build('http://calf.sourceforge.net/plugins/Reverb')
        reverb2 = self.builder.build('http://calf.sourceforge.net/plugins/Reverb')
        reverb1.instance = effect1_instance
        reverb2.instance = effect2_instance

        output = reverb1.outputs[0]
        input = reverb2.inputs[0]
        connection = Connection(output, input)

        correct_message = 'connect effect_{}:{} effect_{}:{}'.format(
            reverb1.instance,
            output.symbol,
            reverb2.instance,
            input.symbol
        )

        self.assertEqual(correct_message, ProtocolParser.connect(connection))

    def test_connect_system_effect(self):
        system_effect = SystemEffect('system', ('capture_1', 'capture_2'), ('playback_1', 'playback_2'))

        output = system_effect.outputs[1]
        input = system_effect.inputs[0]
        connection = Connection(output, input)

        correct_message = 'connect system:{} system:{}'.format(
            output.symbol,
            input.symbol
        )

        self.assertEqual(correct_message, ProtocolParser.connect(connection))

    def test_disconnect(self):
        effect1_instance = 3
        effect2_instance = 4

        reverb1 = self.builder.build('http://calf.sourceforge.net/plugins/Reverb')
        reverb2 = self.builder.build('http://calf.sourceforge.net/plugins/Reverb')
        reverb1.instance = effect1_instance
        reverb2.instance = effect2_instance

        output = reverb1.outputs[0]
        input = reverb2.inputs[0]
        connection = Connection(output, input)

        correct_message = 'disconnect effect_{}:{} effect_{}:{}'.format(
            reverb1.instance,
            output.symbol,
            reverb2.instance,
            input.symbol
        )

        self.assertEqual(correct_message, ProtocolParser.disconnect(connection))

    @unittest.skip('Not implemented')
    def test_preset_load(self):
        assert False

    @unittest.skip('Not implemented')
    def test_preset_save(self):
        assert False

    @unittest.skip('Not implemented')
    def test_preset_show(self):
        assert False

    def test_param_set(self):
        effect_uri = 'http://calf.sourceforge.net/plugins/Reverb'
        effect_instance = 3

        reverb = self.builder.build(effect_uri)
        reverb.instance = effect_instance

        param = reverb.params[0]
        message = ProtocolParser.param_set(param)

        correct_message = "param_set {} {} {}".format(
            effect_instance,
            param.symbol,
            param.value
        )
        self.assertEqual(correct_message, message)

    def test_param_get(self):
        effect_uri = 'http://calf.sourceforge.net/plugins/Reverb'
        effect_instance = 3

        reverb = self.builder.build(effect_uri)
        reverb.instance = effect_instance

        param = reverb.params[0]
        message = ProtocolParser.param_get(param)

        correct_message = "param_get {} {}".format(
            effect_instance,
            param.symbol
        )
        self.assertEqual(correct_message, message)

    @unittest.skip('Not implemented')
    def test_param_monitor(self):
        assert False

    @unittest.skip('Not implemented')
    def test_monitor(self):
        assert False

    @unittest.skip('Not implemented')
    def test_midi_learn(self):
        assert False

    @unittest.skip('Not implemented')
    def test_midi_map(self):
        assert False

    @unittest.skip('Not implemented')
    def test_midi_unmap(self):
        assert False

    def test_bypass_effect_active(self):
        effect_uri = 'http://calf.sourceforge.net/plugins/Reverb'
        effect_instance = 3

        reverb = self.builder.build(effect_uri)
        reverb.instance = effect_instance
        reverb.active = True

        message = ProtocolParser.bypass(reverb)

        correct_message = "bypass {} {}".format(effect_instance, 1)
        self.assertEqual(correct_message, message)

    def test_bypass_effect_no_active(self):
        effect_uri = 'http://calf.sourceforge.net/plugins/Reverb'
        effect_instance = 3

        reverb = self.builder.build(effect_uri)
        reverb.instance = effect_instance
        reverb.active = False

        message = ProtocolParser.bypass(reverb)

        correct_message = "bypass {} {}".format(effect_instance, 0)
        self.assertEqual(correct_message, message)

    def test_load(self):
        filename = 'Não sei'
        correct_message = 'load {}'.format(filename)
        self.assertEqual(correct_message, ProtocolParser.load(filename))

    def test_save(self):
        filename = 'Não sei'
        correct_message = 'save {}'.format(filename)
        self.assertEqual(correct_message, ProtocolParser.save(filename))

    def test_help(self):
        self.assertEqual('help', ProtocolParser.help())

    def test_quit(self):
        self.assertEqual('quit', ProtocolParser.quit())


text:
.. _temporary_directories:

Temporary Directories
*********************

Many SCT commands will create temporary folders to operate, and there is an option to avoid removing temporary directories, to be used for troubleshooting purposes.

If you don't know where your temporary directory is located, you can look at:
https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir


text:
<?php

/**
 * Abstract class for the controller tests
 */
namespace Magento\TestFramework\TestCase;

use Magento\Framework\Stdlib\CookieManagerInterface;
use Magento\Framework\View\Element\Message\InterpretationStrategyInterface;
use Magento\Theme\Controller\Result\MessagePlugin;

/**
 * @SuppressWarnings(PHPMD.NumberOfChildren)
 */
abstract class AbstractController extends \PHPUnit_Framework_TestCase
{
    protected $_runCode = '';

    protected $_runScope = 'store';

    protected $_runOptions = [];

    /**
     * @var \Magento\TestFramework\Request
     */
    protected $_request;

    /**
     * @var \Magento\TestFramework\Response
     */
    protected $_response;

    /**
     * @var \Magento\TestFramework\ObjectManager
     */
    protected $_objectManager;

    /**
     * Whether absence of session error messages has to be asserted automatically upon a test completion
     *
     * @var bool
     */
    protected $_assertSessionErrors = false;

    /**
     * Bootstrap instance getter
     *
     * @return \Magento\TestFramework\Helper\Bootstrap
     */
    protected function _getBootstrap()
    {
        return \Magento\TestFramework\Helper\Bootstrap::getInstance();
    }

    /**
     * Bootstrap application before any test
     */
    protected function setUp()
    {
        $this->_assertSessionErrors = false;
        $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
        $this->_objectManager->removeSharedInstance('Magento\Framework\App\ResponseInterface');
        $this->_objectManager->removeSharedInstance('Magento\Framework\App\RequestInterface');
    }

    protected function tearDown()
    {
        $this->_request = null;
        $this->_response = null;
        $this->_objectManager = null;
    }

    /**
     * Ensure that there were no error messages displayed on the admin panel
     */
    protected function assertPostConditions()
    {
        if ($this->_assertSessionErrors) {
            // equalTo() is intentionally used instead of isEmpty() to provide the informative diff
            $this->assertSessionMessages(
                $this->equalTo([]),
                \Magento\Framework\Message\MessageInterface::TYPE_ERROR
            );
        }
    }

    /**
     * Run request
     *
     * @param string $uri
     */
    public function dispatch($uri)
    {
        $this->getRequest()->setRequestUri($uri);
        $this->_getBootstrap()->runApp();
    }

    /**
     * Request getter
     *
     * @return \Magento\TestFramework\Request
     */
    public function getRequest()
    {
        if (!$this->_request) {
            $this->_request = $this->_objectManager->get('Magento\Framework\App\RequestInterface');
        }
        return $this->_request;
    }

    /**
     * Response getter
     *
     * @return \Magento\TestFramework\Response
     */
    public function getResponse()
    {
        if (!$this->_response) {
            $this->_response = $this->_objectManager->get('Magento\Framework\App\ResponseInterface');
        }
        return $this->_response;
    }

    /**
     * Assert that response is '404 Not Found'
     */
    public function assert404NotFound()
    {
        $this->assertEquals('noroute', $this->getRequest()->getControllerName());
        $this->assertContains('404 Not Found', $this->getResponse()->getBody());
    }

    /**
     * Analyze response object and look for header with specified name, and assert a regex towards its value
     *
     * @param string $headerName
     * @param string $valueRegex
     * @throws \PHPUnit_Framework_AssertionFailedError when header not found
     */
    public function assertHeaderPcre($headerName, $valueRegex)
    {
        $headerFound = false;
        $headers = $this->getResponse()->getHeaders();
        foreach ($headers as $header) {
            if ($header->getFieldName() === $headerName) {
                $headerFound = true;
                $this->assertRegExp($valueRegex, $header->getFieldValue());
            }
        }
        if (!$headerFound) {
            $this->fail("Header '{$headerName}' was not found. Headers dump:\n" . var_export($headers, 1));
        }
    }

    /**
     * Assert that there is a redirect to expected URL.
     * Omit expected URL to check that redirect to wherever has been occurred.
     * Examples of usage:
     * $this->assertRedirect($this->equalTo($expectedUrl));
     * $this->assertRedirect($this->stringStartsWith($expectedUrlPrefix));
     * $this->assertRedirect($this->stringEndsWith($expectedUrlSuffix));
     * $this->assertRedirect($this->stringContains($expectedUrlSubstring));
     *
     * @param \PHPUnit_Framework_Constraint|null $urlConstraint
     */
    public function assertRedirect(\PHPUnit_Framework_Constraint $urlConstraint = null)
    {
        $this->assertTrue($this->getResponse()->isRedirect(), 'Redirect was expected, but none was performed.');
        if ($urlConstraint) {
            $actualUrl = '';
            foreach ($this->getResponse()->getHeaders() as $header) {
                if ($header->getFieldName() == 'Location') {
                    $actualUrl = $header->getFieldValue();
                    break;
                }
            }
            $this->assertThat($actualUrl, $urlConstraint, 'Redirection URL does not match expectations');
        }
    }

    /**
     * Assert that actual session messages meet expectations:
     * Usage examples:
     * $this->assertSessionMessages($this->isEmpty(), \Magento\Framework\Message\MessageInterface::TYPE_ERROR);
     * $this->assertSessionMessages($this->equalTo(['Entity has been saved.'],
     * \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS);
     *
     * @param \PHPUnit_Framework_Constraint $constraint Constraint to compare actual messages against
     * @param string|null $messageType Message type filter,
     *        one of the constants \Magento\Framework\Message\MessageInterface::*
     * @param string $messageManagerClass Class of the session model that manages messages
     */
    public function assertSessionMessages(
        \PHPUnit_Framework_Constraint $constraint,
        $messageType = null,
        $messageManagerClass = 'Magento\Framework\Message\Manager'
    ) {
        $this->_assertSessionErrors = false;

        $messages = $this->getMessages($messageType, $messageManagerClass);

        $this->assertThat(
            $messages,
            $constraint,
            'Session messages do not meet expectations ' . var_export($messages, true)
        );
    }

    /**
     * Return all stored messages
     *
     * @param string|null $messageType
     * @param string $messageManagerClass
     * @return array
     */
    protected function getMessages(
        $messageType = null,
        $messageManagerClass = 'Magento\Framework\Message\Manager'
    ) {
        return array_merge(
            $this->getSessionMessages($messageType, $messageManagerClass),
            $this->getCookieMessages($messageType)
        );
    }

    /**
     * Return messages stored in session
     *
     * @param string|null $messageType
     * @param string $messageManagerClass
     * @return array
     */
    protected function getSessionMessages(
        $messageType = null,
        $messageManagerClass = 'Magento\Framework\Message\Manager'
    ) {
        /** @var $messageManager \Magento\Framework\Message\ManagerInterface */
        $messageManager = $this->_objectManager->get($messageManagerClass);
        /** @var $messages \Magento\Framework\Message\AbstractMessage[] */
        if ($messageType === null) {
            $messages = $messageManager->getMessages()->getItems();
        } else {
            $messages = $messageManager->getMessages()->getItemsByType($messageType);
        }

        /** @var $messageManager InterpretationStrategyInterface */
        $interpretationStrategy = $this->_objectManager->get(InterpretationStrategyInterface::class);

        $actualMessages = [];
        foreach ($messages as $message) {
            $actualMessages[] = $interpretationStrategy->interpret($message);
        }

        return $actualMessages;
    }

    /**
     * Return messages stored in cookies by type
     *
     * @param string|null $messageType
     * @return array
     */
    protected function getCookieMessages($messageType = null)
    {
        /** @var $cookieManager CookieManagerInterface */
        $cookieManager = $this->_objectManager->get(CookieManagerInterface::class);
        try {
            $messages = \Zend_Json::decode(
                $cookieManager->getCookie(MessagePlugin::MESSAGES_COOKIES_NAME, \Zend_Json::encode([]))
            );
            if (!is_array($messages)) {
                $messages = [];
            }
        } catch (\Zend_Json_Exception $e) {
            $messages = [];
        }

        $actualMessages = [];
        foreach ($messages as $message) {
            if ($messageType === null || $message['type'] == $messageType) {
                $actualMessages[] = $message['text'];
            }
        }

        return $actualMessages;
    }
}


text:
//==============================================================================
//         Copyright 2003 - 2012   LASMEA UMR 6602 CNRS/Univ. Clermont II
//         Copyright 2009 - 2012   LRI    UMR 8623 CNRS/Univ Paris Sud XI
//         Copyright 2011 - 2012   MetaScale SAS
//
//          Distributed under the Boost Software License, Version 1.0.
//                 See accompanying file LICENSE.txt or copy at
//                     http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
#ifndef NT2_CORE_FUNCTIONS_LOGSPACE_HPP_INCLUDED
#define NT2_CORE_FUNCTIONS_LOGSPACE_HPP_INCLUDED

#include <nt2/include/functor.hpp>
#include <nt2/sdk/meta/generative_hierarchy.hpp>
#include <nt2/core/container/dsl/generative.hpp>
#include <nt2/core/functions/common/generative.hpp>

namespace nt2
{
  /// INTERNAL ONLY
  struct regular_t {};

  /*!
    @brief regularity mark-up
  **/
  const meta::as_<regular_t> regular_ = {};

  namespace tag
  {
    struct logspace_ : ext::state_constant_<logspace_>
    {
      typedef ext::state_constant_<logspace_> parent;
    };
  }

  NT2_FUNCTION_IMPLEMENTATION(nt2::tag::logspace_, logspace, 2)
  NT2_FUNCTION_IMPLEMENTATION(nt2::tag::logspace_, logspace, 3)
  NT2_FUNCTION_IMPLEMENTATION(nt2::tag::logspace_, logspace, 4)
}

namespace nt2 { namespace ext
{
  /// INTERNAL ONLY
  template<class Domain, class Expr, int N>
  struct  value_type<tag::logspace_,Domain,N,Expr>
        : meta::generative_value<Expr>
  {};

  /// INTERNAL ONLY
  template<class Domain, class Expr, int N>
  struct  size_of<tag::logspace_,Domain,N,Expr>
        : meta::generative_size<Expr>
  {};
} }

#endif


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jz.hcs.model.vo;

/**
 *
 * @author jesse
 */
public class Exposer {
    //是否开启
    private boolean isExposed;
    //加密
    private String md5;
    //id
    private long seckillId;
    //系统当前时间(毫秒)
    private long now;
    //开启时间
    private long start;
    //结束时间
    private long end;

    public Exposer() {
    }

    public Exposer(boolean isExposed, String md5, long seckillId) {
        this.isExposed = isExposed;
        this.md5 = md5;
        this.seckillId = seckillId;
    }

    public Exposer(boolean isExposed, long seckillId, long now, long start, long end) {
        this.isExposed = isExposed;
        this.seckillId = seckillId;
        this.now = now;
        this.start = start;
        this.end = end;
    }

    public Exposer(boolean isExposed, long seckillId) {
        this.isExposed = isExposed;
        this.seckillId = seckillId;
    }

    public boolean isIsExposed() {
        return isExposed;
    }

    public void setIsExposed(boolean isExposed) {
        this.isExposed = isExposed;
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public long getSeckillId() {
        return seckillId;
    }

    public void setSeckillId(long seckillId) {
        this.seckillId = seckillId;
    }

    public long getNow() {
        return now;
    }

    public void setNow(long now) {
        this.now = now;
    }

    public long getStart() {
        return start;
    }

    public void setStart(long start) {
        this.start = start;
    }

    public long getEnd() {
        return end;
    }

    public void setEnd(long end) {
        this.end = end;
    }

    @Override
    public String toString() {
        return "Exposer{" + "isExposed=" + isExposed + ", md5=" + md5 + ", seckillId=" + seckillId + ", now=" + now + ", start=" + start + ", end=" + end + '}';
    }

}


text:
layout: project
---
hEPPy
=====

**EPP client and library in Python**

[![GitHub version](https://badge.fury.io/gh/hiqdev%2Fheppy.svg)](https://badge.fury.io/gh/hiqdev%2Fheppy)
[![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/hiqdev/heppy.svg)](https://scrutinizer-ci.com/g/hiqdev/heppy/)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/hiqdev/heppy.svg)](https://scrutinizer-ci.com/g/hiqdev/heppy/)

[EPP](https://en.wikipedia.org/wiki/Extensible_Provisioning_Protocol) is Extensible Provisioning Protocol used for registrar-registry communication to register and manage domains.

This package provides:

- library for building and parsing EPP requests and responses
- EPP client implemented as a UNIX daemon
- whole infrastructure for implementing domain name registrar

For the moment it is in early stage of development.

## License

This project is released under the terms of the BSD-3-Clause [license](LICENSE).
Read more [here](http://choosealicense.com/licenses/bsd-3-clause).

Copyright © 2015-2016, HiQDev (http://hiqdev.com/)


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

namespace _03BarracksFactory.Models.Units
{
    class Gunner : Unit
    {
        private const int DefaultHealth = 20;
        private const int DefaultDamage = 20;

        public Gunner()
            : base(DefaultHealth, DefaultDamage)
        {
        }
    }
}


text:
/* eslint-env mocha */
/* global describe, it */

'use strict';

var assert = require('chai').assert;
var inventory = require('../lib/inventory');

var helmet = {
    slot: 'head'
};
var heavyHelmet = {
    slot: 'head',
    name: 'heavy helmet',
    requirements: {
        str: { min: 10 }
    }
};
var lightHelmet = {
    slot: 'head',
    name: 'light helmet',
    requirements: {
        str: { min: 0 }
    }
};

describe('inventory', function () {
    it('have desired methods', function () {
		assert.isFunction(inventory.unEquip);
		assert.isFunction(inventory.equipFromInventory);
		assert.isFunction(inventory.isWearable);
    });

    describe('unEqip', function () {
        var unEquip = inventory.unEquip;
        var attributes = {
            equipped: {
                head: helmet,
                emptySlot: null
            },
            inventory: []
        };

        it('returns same object it was given', function () {
            var newAttribs = unEquip(attributes, 'emptySlot');
            assert.ok(newAttribs === attributes, 'same object');
        });

        it('removes item from given slot and pushes it to inventory', function () {
            unEquip(attributes, 'head');

            assert.lengthOf(attributes.inventory, 1);
            assert.equal(attributes.inventory[0], helmet);
            assert.isNull(attributes.equipped.head);
        });

        it('does not changes anything when working with empty slot', function () {
            var inventoryLength = attributes.inventory.length;

            unEquip(attributes, 'emptySlot');

            assert.lengthOf(attributes.inventory, inventoryLength);
            assert.isNull(attributes.equipped.emptySlot);
        });

        it('throws specific error with incorrect slot', function () {
            assert.throws(
                unEquip.bind(null, attributes, 'non-existent slot name'),
                /No such slot: non-existent slot name/,
                'throws exception when non-existent slot'
            );
        });
    });

    describe('equipFromInventory', function () {
        var equip = inventory.equipFromInventory;

        it('returns same object it was given', function () {
            var attributes = {
                equipped: {
                    head: null,
                    emptySlot: null
                },
                inventory: [helmet]
            };
            var newAttribs = equip(attributes, 0, 'head');

            assert.ok(newAttribs === attributes, 'same object');
        });

        it('removes item from inventory and places it to correct slot', function () {
            var attributes = {
                equipped: {
                    head: null,
                    emptySlot: null
                },
                inventory: [helmet]
            };

            equip(attributes, 0, 'head');

            assert.lengthOf(attributes.inventory, 0);
            assert.equal(attributes.equipped.head, helmet);
        });

        it('throws error on invalid index and does not change inventory and equipped', function () {
            var attributes = {
                equipped: {
                    head: null,
                    emptySlot: null
                },
                inventory: [helmet]
            };

            assert.throws(
                equip.bind(null, attributes, 1, 'head'),
                /Invalid inventory index: 1/,
                'no such index thrown'
            );

            assert.deepEqual(attributes.equipped, {head: null, emptySlot: null});
            assert.deepEqual(attributes.inventory, [helmet]);
        });

        it('throws error on invalid slotName and does not change inventory and equipped', function () {
            var badItem = {
                slot: 'wtf slot', name: 'wtf'
            };
            var attributes = {
                equipped: {
                    head: null,
                    emptySlot: null
                },
                inventory: [helmet, badItem]
            };

            assert.throws(
                equip.bind(null, attributes, 0, 'invalid slot'),
                /No such slot: invalid slot/,
                'no such slot thrown'
            );

            assert.deepEqual(attributes.equipped, {head: null, emptySlot: null});
            assert.deepEqual(attributes.inventory, [helmet, badItem]);

            assert.throws(
                equip.bind(null, attributes, 1),
                /No such slot: wtf slot/,
                'no such slot thrown when slot was auto-selected'
            );

            assert.deepEqual(attributes.equipped, {head: null, emptySlot: null});
            assert.deepEqual(attributes.inventory, [helmet, badItem]);
        });

        it('throws error when item.slot and slotName mismatch', function () {
            var attributes = {
                equipped: {
                    head: null,
                    feet: null
                },
                inventory: [helmet]
            };

            assert.throws(
                equip.bind(null, attributes, 0, 'feet'),
                /Item intended for head and can not be equipped to feet/,
                'slot mismatch thrown'
            );

            assert.deepEqual(attributes.equipped, {head: null, feet: null});
            assert.deepEqual(attributes.inventory, [helmet]);
        });

        it('throws error when item requirements not met and vice versa', function () {
            var attributes = {
                str: 1,
                equipped: {
                    head: null
                },
                inventory: [heavyHelmet, lightHelmet]
            };

            assert.throws(
                equip.bind(null, attributes, 0),
                /Item requirements not met/,
                'requirements exception thrown'
            );

            assert.deepEqual(attributes.equipped, {head: null});
            assert.deepEqual(attributes.inventory, [heavyHelmet, lightHelmet]);

            assert.doesNotThrow(
                equip.bind(null, attributes, 1),
                /Item requirements not met/,
                'requirements exception NOT thrown'
            );

            assert.deepEqual(attributes.equipped, {head: lightHelmet});
            assert.deepEqual(attributes.inventory, [heavyHelmet]);
        });

        it('unequips item if slot is occupied', function () {
            var attributes = {
                str: 15,
                equipped: {
                    head: lightHelmet
                },
                inventory: [heavyHelmet]
            };

            equip(attributes, 0);
            assert.deepEqual(attributes.equipped, {head: heavyHelmet});
            assert.deepEqual(attributes.inventory, [lightHelmet]);
        });
    });

    describe('isWearable', function () {
        var isWearable = inventory.isWearable;

        it('throws error on invalid index and does not change inventory and equipped', function () {
            var attributes = {
                equipped: {
                    head: null,
                    emptySlot: null
                },
                inventory: [helmet]
            };

            assert.throws(
                isWearable.bind(null, attributes, 1),
                /Invalid inventory index: 1/,
                'no such index thrown'
            );
        });

        it('throws error when item requirements not met', function () {
            var attributes = {
                str: 1,
                equipped: {
                    head: null
                },
                inventory: [heavyHelmet, lightHelmet]
            };

            assert.throws(
                isWearable.bind(null, attributes, 0),
                /Item requirements not met/,
                'requirements exception thrown'
            );
        });

        it('throws error when item.slot and slotName mismatch', function () {
            var attributes = {
                equipped: {
                    head: null,
                    feet: null
                },
                inventory: [{name: 'slotless thing'}]
            };

            assert.throws(
                isWearable.bind(null, attributes, 0),
                /Item "slotless thing" can not be equipped/,
                'slot mismatch thrown'
            );
        });

        it('returns string with destined slot', function () {
            var attributes = {
                equipped: {
                    head: null
                },
                inventory: [helmet]
            };

            var result = isWearable(attributes, 0);
            assert.equal('head', result);
        });
    });
});


text:
<?php

namespace Topxia\Api\Resource;

use Biz\OpenCourse\Service\OpenCourseService;
use Biz\Taxonomy\Service\CategoryService;
use Biz\Taxonomy\Service\TagService;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Common\ArrayToolkit;

class OpenCourses extends BaseResource
{
    public function get(Application $app, Request $request)
    {
        $conditions = $request->query->all();

        $start = $request->query->get('start', 0);
        $limit = $request->query->get('limit', 20);

        $total = $this->getOpenCourseService()->countCourses($conditions);
        $openCourses = $this->getOpenCourseService()->searchCourses($conditions, array('createdTime' => 'DESC'), $start, $limit);
        $openCourses = $this->assembly($openCourses);

        return $this->wrap($this->filter($openCourses), $total);
    }

    protected function assembly(array $openCourses)
    {
        $categoryIds = ArrayToolkit::column($openCourses, 'categoryId');
        $categories = $this->getCategoryService()->findCategoriesByIds($categoryIds);

        foreach ($openCourses as &$course) {
            if (isset($categories[$course['categoryId']])) {
                $course['category'] = array(
                    'id' => $categories[$course['categoryId']]['id'],
                    'name' => $categories[$course['categoryId']]['name'],
                );
            } else {
                $course['category'] = array();
            }
        }

        return $openCourses;
    }

    public function filter($res)
    {
        return $this->multicallFilter('OpenCourse', $res);
    }

    /**
     * @return OpenCourseService
     */
    protected function getOpenCourseService()
    {
        return $this->getServiceKernel()->createService('OpenCourse:OpenCourseService');
    }

    /**
     * @return TagService
     */
    protected function getTagService()
    {
        return $this->getServiceKernel()->createService('Taxonomy:TagService');
    }

    /**
     * @return CategoryService
     */
    protected function getCategoryService()
    {
        return $this->getServiceKernel()->createService('Taxonomy:CategoryService');
    }
}


text:
/* eslint react/no-multi-comp:0, no-console:0 */

import { createForm } from 'rc-form';
import React, { PropTypes } from 'react';
import { createRootContainer, createContainer } from 'react-data-binding';
import ReactDOM from 'react-dom';
import { regionStyle } from './styles';
import Switch from 'antd/lib/switch';
import 'antd/dist/antd.css';

const createFormContainer = createContainer((state) => {
  return {
    on: ((state.formState || {}).on || {}).value || false,
  };
});

let TopForm = React.createClass({
  propTypes: {
    form: PropTypes.object,
    on: PropTypes.bool,
  },

  render() {
    const { form, on } = this.props;
    const { getFieldProps } = form;
    return (

has email?

        <Switch {...getFieldProps('on', {
          initialValue: on,
          valuePropName: 'checked',
        })}
        />

);
  },
});
TopForm = createFormContainer(TopForm);

let BottomForm = React.createClass({
  propTypes: {
    form: PropTypes.object,
    on: PropTypes.bool,
  },

  render() {
    const { form, on } = this.props;
    const style = {
      ...regionStyle,
      display: on ? 'block' : 'none',
    };
    return (

email:

        <input {...form.getFieldProps('email', {
          rules: [{
            type: 'email',
          }],
          hidden: !on,
        })}
        />

);
  },
});

BottomForm = createFormContainer(BottomForm);

let Form = React.createClass({
  propTypes: {
    form: PropTypes.object,
  },
  onSubmit(e) {
    e.preventDefault();
    console.log(this.props.form.getFieldsValue());
  },
  render() {
    const { form } = this.props;
    return (

      <TopForm form={ form }/>
      <BottomForm form={ form }/>

        <button onClick={this.onSubmit}>submit</button>

);
  },
});

Form = createForm({
  mapPropsToFields(props) {
    console.log('mapPropsToFields', props);
    return props.formState;
  },
  onFieldsChange(props, fields) {
    console.log('onFieldsChange', fields);
    props.setStoreState({
      formState: {
        ...props.formState,
        ...fields,
      },
    });
  },
})(Form);

Form = createContainer((state) => {
  return {
    formState: state.formState,
  };
})(Form);

class App extends React.Component {
  render() {
    return (

integrate with react-data-binding

      <Form />

);
  }
}

const NewApp = createRootContainer({
  formState: {
    on: { value: true },
  },
})(App);

ReactDOM.render(<NewApp />, document.getElementById('__react-content'));


text:
package org.voltdb.hadoop.typeto;

import static org.voltdb.hadoop.TypeAide.TIMESTAMP;
import static org.voltdb.hadoop.TypeAide.TINYINT;

import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.util.EnumSet;

import org.voltdb.hadoop.TypeAide;

import com.google_voltpatches.common.base.Function;

public class ShortTypeTo extends TypeTo<Short>{

    final static EnumSet<TypeAide> loose =
            EnumSet.complementOf(EnumSet.of(TIMESTAMP));
    final static EnumSet<TypeAide> strict =
            EnumSet.complementOf(EnumSet.of(TIMESTAMP,TINYINT));

    public ShortTypeTo(TypeAide type, boolean strictCompatibility) {
        super(type,strictCompatibility);
    }

    public ShortTypeTo(TypeAide type) {
        this(type,true);
    }

    @Override
    public Function<Short, Object> getAdjuster() {
        return m_typeTo.accept(vtor, null, null);
    }

    @Override
    public Function<Short, Object> getAdjusterFor(TypeAide type) {
        return type.accept(vtor, null, null);
    }

    @Override
    public boolean isCompatibleWith(TypeAide type, boolean strictly) {
        return (strictly? strict:loose).contains(type);
    }

    private static final TypeAide.Visitor<Function<Short, Object>, Void, RuntimeException> vtor =
            new TypeAide.Visitor<Function<Short,Object>, Void, RuntimeException>() {
                @Override
                public Function<Short, Object> visitVarBinary(Void p, Object v) {
                    return new Function<Short, Object>() {
                        @Override
                        final public Object apply(Short v) {
                            if (v == null) return null;
                            ByteBuffer bb = ByteBuffer.allocate(Short.SIZE>>3);
                            return bb.putShort(v).array();
                        }
                    };
                }
                @Override
                public Function<Short, Object> visitTinyInt(Void p, Object v) {
                    return new Function<Short, Object>() {
                        @Override
                        final public Object apply(Short v) {
                            if (v == null) return null;
                            if (v <= Byte.MIN_VALUE || v > Byte.MAX_VALUE) {
                                throw new IncompatibleException("Short("+v+") to Byte");
                            }
                            return v.byteValue();
                        }
                    };
                }
                @Override
                public Function<Short, Object> visitTimestamp(Void p, Object v) {
                    throw new IncompatibleException("Short is not compatible with Date");
                }
                @Override
                public Function<Short, Object> visitString(Void p, Object v) {
                    return new Function<Short, Object>() {
                        @Override
                        final public Object apply(Short v) {
                            if (v == null) return null;
                            return v.toString();
                        }
                    };
                }
                @Override
                public Function<Short, Object> visitSmallInt(Void p, Object v) {
                    return new Function<Short, Object>() {
                        @Override
                        final public Object apply(Short v) {
                            if (v == null) return null;
                            return v.shortValue();
                        }
                    };
                }
                @Override
                public Function<Short, Object> visitInteger(Void p, Object v) {
                    return new Function<Short, Object>() {
                        @Override
                        final public Object apply(Short v) {
                            if (v == null) return null;
                            return v.intValue();
                        }
                    };
                }
                @Override
                public Function<Short, Object> visitFloat(Void p, Object v) {
                    return new Function<Short, Object>() {
                        @Override
                        final public Object apply(Short v) {
                            if (v == null) return null;
                            return v.doubleValue();
                        }
                    };
                }
                @Override
                public Function<Short, Object> visitDecimal(Void p, Object v) {
                    return new Function<Short, Object>() {
                        @Override
                        final public Object apply(Short v) {
                            if (v == null) return null;
                            return new BigDecimal(v.intValue());
                        }
                    };
                }
                @Override
                public Function<Short, Object> visitBigInt(Void p, Object v) {
                    return new Function<Short, Object>() {
                        @Override
                        final public Object apply(Short v) {
                            if (v == null) return null;
                            return v.longValue();
                        }
                    };
                }
            };
}


text:
<!doctype html>
<link rel="stylesheet" href="s.css" />

Tests for recipes/shape/polygon/triangle

First triangles are using default $height value (half), others are using auto == same width & height)

Top

Bottom

Left

Right

Top Left

Top Right

Bottom Left

Bottom Right


text:
set -e

/usr/local/bin/ep ${DATAVAULT_HOME}/scripts/set-defaults.sh
source ${DATAVAULT_HOME}/scripts/set-defaults.sh

/usr/local/bin/ep ${DATAVAULT_HOME}/config/*
/usr/local/bin/ep ${DATAVAULT_HOME}/scripts/fix-permissions.sh

${DATAVAULT_HOME}/scripts/fix-permissions.sh

if [ $1 == "broker" ] || [ $1 == "worker" ]; then
	/usr/local/bin/wait-for-it ${RABBITMQ_HOST}:15672 --timeout=90 --strict -- echo "RabbitMQ is ready"
	if [ $1 == "broker" ]; then
		/usr/local/bin/wait-for-it ${MYSQL_HOST}:3306 --timeout=90 --strict -- echo "MySQL is ready"
	fi
fi
shift

cd ${DATAVAULT_HOME}/lib

su-exec datavault "$@"


text:
package rbac

import (
	rbacv1 "k8s.io/api/rbac/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"

	"kubevirt.io/api/instancetype"

	virtv1 "kubevirt.io/api/core/v1"

	"kubevirt.io/api/migrations"
)

const (
	GroupNameSubresources  = "subresources.kubevirt.io"
	GroupNameSnapshot      = "snapshot.kubevirt.io"
	GroupNameInstancetype  = "instancetype.kubevirt.io"
	GroupNamePool          = "pool.kubevirt.io"
	NameDefault            = "kubevirt.io:default"
	VMInstancesGuestOSInfo = "virtualmachineinstances/guestosinfo"
	VMInstancesFileSysList = "virtualmachineinstances/filesystemlist"
	VMInstancesUserList    = "virtualmachineinstances/userlist"
)

func GetAllCluster() []runtime.Object {
	return []runtime.Object{
		newDefaultClusterRole(),
		newDefaultClusterRoleBinding(),
		newAdminClusterRole(),
		newEditClusterRole(),
		newViewClusterRole(),
	}
}

func newDefaultClusterRole() *rbacv1.ClusterRole {
	return &rbacv1.ClusterRole{
		TypeMeta: metav1.TypeMeta{
			APIVersion: VersionNamev1,
			Kind:       "ClusterRole",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name: NameDefault,
			Labels: map[string]string{
				virtv1.AppLabel:               "",
				"kubernetes.io/bootstrapping": "rbac-defaults",
			},
			Annotations: map[string]string{
				"rbac.authorization.kubernetes.io/autoupdate": "true",
			},
		},
		Rules: []rbacv1.PolicyRule{
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"version",
					"guestfs",
				},
				Verbs: []string{
					"get", "list",
				},
			},
		},
	}
}

func newDefaultClusterRoleBinding() *rbacv1.ClusterRoleBinding {
	return &rbacv1.ClusterRoleBinding{
		TypeMeta: metav1.TypeMeta{
			APIVersion: VersionNamev1,
			Kind:       "ClusterRoleBinding",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name: NameDefault,
			Labels: map[string]string{
				virtv1.AppLabel: "",
			},
			Annotations: map[string]string{
				"rbac.authorization.kubernetes.io/autoupdate": "true",
			},
		},
		RoleRef: rbacv1.RoleRef{
			APIGroup: VersionName,
			Kind:     "ClusterRole",
			Name:     NameDefault,
		},
		Subjects: []rbacv1.Subject{
			{
				Kind:     "Group",
				APIGroup: VersionName,
				Name:     "system:authenticated",
			},
			{
				Kind:     "Group",
				APIGroup: VersionName,
				Name:     "system:unauthenticated",
			},
		},
	}
}

func newAdminClusterRole() *rbacv1.ClusterRole {
	return &rbacv1.ClusterRole{
		TypeMeta: metav1.TypeMeta{
			APIVersion: VersionNamev1,
			Kind:       "ClusterRole",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name: "kubevirt.io:admin",
			Labels: map[string]string{
				virtv1.AppLabel: "",
				"rbac.authorization.k8s.io/aggregate-to-admin": "true",
			},
		},
		Rules: []rbacv1.PolicyRule{
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"virtualmachineinstances/console",
					"virtualmachineinstances/vnc",
					"virtualmachineinstances/vnc/screenshot",
					VMInstancesGuestOSInfo,
					VMInstancesFileSysList,
					VMInstancesUserList,
				},
				Verbs: []string{
					"get",
				},
			},
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"virtualmachineinstances/pause",
					"virtualmachineinstances/unpause",
					"virtualmachineinstances/addvolume",
					"virtualmachineinstances/removevolume",
					"virtualmachineinstances/freeze",
					"virtualmachineinstances/unfreeze",
					"virtualmachineinstances/softreboot",
					"virtualmachineinstances/portforward",
				},
				Verbs: []string{
					"update",
				},
			},
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"virtualmachines/expand-spec",
				},
				Verbs: []string{
					"get",
				},
			},
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"virtualmachines/start",
					"virtualmachines/stop",
					"virtualmachines/restart",
					"virtualmachines/addvolume",
					"virtualmachines/removevolume",
					"virtualmachines/migrate",
					"virtualmachines/memorydump",
				},
				Verbs: []string{
					"update",
				},
			},
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"expand-vm-spec",
				},
				Verbs: []string{
					"update",
				},
			},
			{
				APIGroups: []string{
					GroupName,
				},
				Resources: []string{
					"virtualmachines",
					"virtualmachineinstances",
					"virtualmachineinstancepresets",
					"virtualmachineinstancereplicasets",
					"virtualmachineinstancemigrations",
				},
				Verbs: []string{
					"get", "delete", "create", "update", "patch", "list", "watch", "deletecollection",
				},
			},
			{
				APIGroups: []string{
					GroupNameSnapshot,
				},
				Resources: []string{
					"virtualmachinesnapshots",
					"virtualmachinesnapshotcontents",
					"virtualmachinerestores",
				},
				Verbs: []string{
					"get", "delete", "create", "update", "patch", "list", "watch", "deletecollection",
				},
			},
			{
				APIGroups: []string{
					GroupNameInstancetype,
				},
				Resources: []string{
					instancetype.PluralResourceName,
					instancetype.ClusterPluralResourceName,
					instancetype.PluralPreferenceResourceName,
					instancetype.ClusterPluralPreferenceResourceName,
				},
				Verbs: []string{
					"get", "delete", "create", "update", "patch", "list", "watch", "deletecollection",
				},
			},
			{
				APIGroups: []string{
					GroupNamePool,
				},
				Resources: []string{
					"virtualmachinepools",
				},
				Verbs: []string{
					"get", "delete", "create", "update", "patch", "list", "watch", "deletecollection",
				},
			},
			{
				APIGroups: []string{
					migrations.GroupName,
				},
				Resources: []string{
					migrations.ResourceMigrationPolicies,
				},
				Verbs: []string{
					"get", "list", "watch",
				},
			},
		},
	}
}

func newEditClusterRole() *rbacv1.ClusterRole {
	return &rbacv1.ClusterRole{
		TypeMeta: metav1.TypeMeta{
			APIVersion: VersionNamev1,
			Kind:       "ClusterRole",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name: "kubevirt.io:edit",
			Labels: map[string]string{
				virtv1.AppLabel: "",
				"rbac.authorization.k8s.io/aggregate-to-edit": "true",
			},
		},
		Rules: []rbacv1.PolicyRule{
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"virtualmachineinstances/console",
					"virtualmachineinstances/vnc",
					"virtualmachineinstances/vnc/screenshot",
					VMInstancesGuestOSInfo,
					VMInstancesFileSysList,
					VMInstancesUserList,
				},
				Verbs: []string{
					"get",
				},
			},
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"virtualmachineinstances/pause",
					"virtualmachineinstances/unpause",
					"virtualmachineinstances/addvolume",
					"virtualmachineinstances/removevolume",
					"virtualmachineinstances/freeze",
					"virtualmachineinstances/unfreeze",
					"virtualmachineinstances/softreboot",
					"virtualmachineinstances/portforward",
				},
				Verbs: []string{
					"update",
				},
			},
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"virtualmachines/expand-spec",
				},
				Verbs: []string{
					"get",
				},
			},
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"virtualmachines/start",
					"virtualmachines/stop",
					"virtualmachines/restart",
					"virtualmachines/addvolume",
					"virtualmachines/removevolume",
					"virtualmachines/migrate",
					"virtualmachines/memorydump",
				},
				Verbs: []string{
					"update",
				},
			},
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"expand-vm-spec",
				},
				Verbs: []string{
					"update",
				},
			},
			{
				APIGroups: []string{
					GroupName,
				},
				Resources: []string{
					"virtualmachines",
					"virtualmachineinstances",
					"virtualmachineinstancepresets",
					"virtualmachineinstancereplicasets",
					"virtualmachineinstancemigrations",
				},
				Verbs: []string{
					"get", "delete", "create", "update", "patch", "list", "watch",
				},
			},
			{
				APIGroups: []string{
					GroupNameSnapshot,
				},
				Resources: []string{
					"virtualmachinesnapshots",
					"virtualmachinesnapshotcontents",
					"virtualmachinerestores",
				},
				Verbs: []string{
					"get", "delete", "create", "update", "patch", "list", "watch",
				},
			},
			{
				APIGroups: []string{
					GroupNameInstancetype,
				},
				Resources: []string{
					instancetype.PluralResourceName,
					instancetype.ClusterPluralResourceName,
					instancetype.PluralPreferenceResourceName,
					instancetype.ClusterPluralPreferenceResourceName,
				},
				Verbs: []string{
					"get", "delete", "create", "update", "patch", "list", "watch",
				},
			},
			{
				APIGroups: []string{
					GroupNamePool,
				},
				Resources: []string{
					"virtualmachinepools",
				},
				Verbs: []string{
					"get", "delete", "create", "update", "patch", "list", "watch",
				},
			},
			{
				APIGroups: []string{
					GroupName,
				},
				Resources: []string{
					"kubevirts",
				},
				Verbs: []string{
					"get", "list",
				},
			},
			{
				APIGroups: []string{
					migrations.GroupName,
				},
				Resources: []string{
					migrations.ResourceMigrationPolicies,
				},
				Verbs: []string{
					"get", "list", "watch",
				},
			},
		},
	}
}

func newViewClusterRole() *rbacv1.ClusterRole {
	return &rbacv1.ClusterRole{
		TypeMeta: metav1.TypeMeta{
			APIVersion: VersionNamev1,
			Kind:       "ClusterRole",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name: "kubevirt.io:view",
			Labels: map[string]string{
				virtv1.AppLabel: "",
				"rbac.authorization.k8s.io/aggregate-to-view": "true",
			},
		},
		Rules: []rbacv1.PolicyRule{
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"virtualmachines/expand-spec",
					VMInstancesGuestOSInfo,
					VMInstancesFileSysList,
					VMInstancesUserList,
				},
				Verbs: []string{
					"get",
				},
			},
			{
				APIGroups: []string{
					GroupNameSubresources,
				},
				Resources: []string{
					"expand-vm-spec",
				},
				Verbs: []string{
					"update",
				},
			},
			{
				APIGroups: []string{
					GroupName,
				},
				Resources: []string{
					"virtualmachines",
					"virtualmachineinstances",
					"virtualmachineinstancepresets",
					"virtualmachineinstancereplicasets",
					"virtualmachineinstancemigrations",
				},
				Verbs: []string{
					"get", "list", "watch",
				},
			},
			{
				APIGroups: []string{
					GroupNameSnapshot,
				},
				Resources: []string{
					"virtualmachinesnapshots",
					"virtualmachinesnapshotcontents",
					"virtualmachinerestores",
				},
				Verbs: []string{
					"get", "list", "watch",
				},
			},
			{
				APIGroups: []string{
					GroupNameInstancetype,
				},
				Resources: []string{
					instancetype.PluralResourceName,
					instancetype.ClusterPluralResourceName,
					instancetype.PluralPreferenceResourceName,
					instancetype.ClusterPluralPreferenceResourceName,
				},
				Verbs: []string{
					"get", "list", "watch",
				},
			},
			{
				APIGroups: []string{
					GroupNamePool,
				},
				Resources: []string{
					"virtualmachinepools",
				},
				Verbs: []string{
					"get", "list", "watch",
				},
			},
			{
				APIGroups: []string{
					migrations.GroupName,
				},
				Resources: []string{
					migrations.ResourceMigrationPolicies,
				},
				Verbs: []string{
					"get", "list", "watch",
				},
			},
		},
	}
}


text:
package goryachev.memsafecrypto.bc;
import goryachev.memsafecrypto.ICryptoZeroable;

/**
 * all parameter classes implement this.
 */
public interface CipherParameters
	extends ICryptoZeroable
{
}


text:
/**
 * @file httpRead.c
 *
 */
/* Embedded Xinu, Copyright (C) 2009.  All rights reserved. */

#include <stddef.h>
#include <stdlib.h>

#include <http.h>
#include <shell.h>
#include <string.h>

/* TODO: ensure all headers that need to be parsed are */

/**
 * Read characters from a http.
 * @param devptr pointer to http device
 * @param buf buffer for read characters
 * @param len size of the buffer
 * @return number of characters read, EOF if end of file was reached
 */
devcall httpRead(device *devptr, void *buf, uint len)
{
    /* Pointer to HTTP device structure */
    struct http *webptr;

    /* Pointer to physical hardware */
    device *phw;

    /* HTTP request iteration and storage variables */
    char *command;
    int i, start, slen, uriStart, uriEnd, pagebodytype;
    int methodint, cmdindex;
    bool headersOnly;
    methodint = -1;
    pagebodytype = 0;
    headersOnly = FALSE;

    /* Local pointer for passed buffer */
    char *buffer = buf;

    /* Update firmware OS return value */
    int flashSuccess;
    flashSuccess = -1;

    /* Shell interaction variables */
    int commandlen = 0;
    /* Return value for characters read */
    int count = 0;

    /* Setup and error check pointers to structures */
    webptr = &httptab[devptr->minor];
    phw = webptr->phw;
    if (NULL == phw)
    {
        return SYSERR;
    }

    /* Set all flags to default values */
    webptr->rcount = 0;
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_CONCLOSE, NULL);
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_RQSTEND, NULL);
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_CHUNKED, NULL);
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_WAITONSHELL, NULL);
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_ENDREADOUTPUT,
                NULL);
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_CLEANSED, NULL);
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_CLEARWOUT, NULL);
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_FLUSHWOUT, NULL);
    httpControl(devptr, HTTP_CTRL_SET_FLAG, HTTP_FLAG_AWAITINGRQST, NULL);

    /* Read in an entire HTTP request */
    webptr->hdrcount = httpReadRqst(devptr);
    if (SYSERR == webptr->hdrcount)
    {
        /* Reading of underly device failed */
        webptr->hdrcount = 0;
        httpControl(devptr, HTTP_CTRL_SET_FLAG, HTTP_FLAG_AWAITINGRQST,
                    NULL);
        httpControl(devptr, HTTP_CTRL_SET_FLAG, HTTP_FLAG_CONCLOSE, NULL);
        signal(webptr->closeall);
        return SYSERR;
    }

    /* Parse the request headers and acquire values */
    if (SYSERR == httpReadHdrs(webptr))
    {
        /* Memory not available for headers of request */
        httpErrorResponse(devptr, HTTP_ERR_INTSERV);
        return 0;
    }

    /* Acquire the remaining webptr->content of the request */
    if (webptr->contentlen > 0)
    {
        webptr->content = (char *)malloc(webptr->contentlen + 1);
        if (NULL == webptr->content)
        {
            /* Memory not available for content size */
            httpErrorResponse(devptr, HTTP_ERR_INTSERV);
            return 0;
        }
        bzero(webptr->content, webptr->contentlen + 1);

        i = 0;
        for (i = 0; i < webptr->contentlen; i++)
        {
            *(webptr->content + i) = (*phw->getc) (phw);
        }
    }
    else
    {
        webptr->content = NULL;
    }

    /* A whole request has been accumulated */
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_AWAITINGRQST, NULL);

    /* Clear write buffer */
    httpControl(devptr, HTTP_CTRL_SET_FLAG, HTTP_FLAG_CLEARWOUT, NULL);
    httpWrite(devptr, NULL, 0);
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_CLEARWOUT, NULL);

    /* Decipher if status line is valid request */
    i = 0;

    /* Move to first value in status line */
    for (; webptr->rin[i] == ' ' && i < webptr->hdrend[0]; i++)
    {                           /* Do nothing */
    }

    /* Determine method string length */
    start = i;
    for (; webptr->rin[i] != ' ' && i < webptr->hdrend[0]; i++)
    {                           /* Do nothing */
    }
    slen = i - start;

    /* Check if valid method */
    methodint = validMethod(&webptr->rin[start], slen);

    if (SYSERR == methodint)
    {
        httpErrorResponse(devptr, HTTP_ERR_BADREQ);
        return 0;
    }
    else if (HTTP_METHOD_NOALLOW == methodint)
    {
        httpErrorResponse(devptr, HTTP_ERR_METHOD);
        return 0;
    }
    else if (HTTP_METHOD_POST == methodint && 0 == webptr->contentlen)
    {
        httpErrorResponse(devptr, HTTP_ERR_BADREQ);
        return 0;
    }
    else if (HTTP_METHOD_HEAD == methodint)
    {
        headersOnly = TRUE;
    }

    /* Move to next value in status line */
    for (; webptr->rin[i] == ' ' && i < webptr->hdrend[0]; i++)
    {                           /* Do nothing */
    }

    /* Store the request URI start and end point */
    uriStart = i;
    for (; webptr->rin[i] != ' ' && i < webptr->hdrend[0]; i++)
    {                           /* Do nothing */
    }
    uriEnd = i;

    /* Move to last value in status line */
    for (; webptr->rin[i] == ' ' && i < webptr->hdrend[0]; i++)
    {                           /* Do nothing */
    }

    /* Determine version string length */
    start = i;
    for (; webptr->rin[i] != ' ' && i < webptr->hdrend[0]; i++)
    {                           /* Do nothing */
    }
    slen = i - start;

    /* Check valid version of HTTP */
    if (SYSERR == validVersion(&webptr->rin[start], slen))
    {
        httpErrorResponse(devptr, HTTP_ERR_BADVERS);
        return 0;
    }

    cmdindex = validURI(&webptr->rin[uriStart], uriEnd - uriStart);
    /* Check valid URI */
    if (SYSERR == cmdindex)
    {
        httpErrorResponse(devptr, HTTP_ERR_NOTFND);
        return 0;
    }

    switch (httpcmdtab[cmdindex].inwebshell)
    {
        /* Commands run in webshell */
    case TRUE:
        commandlen = strnlen(httpcmdtab[cmdindex].command, SHELL_BUFLEN);
        command = httpcmdtab[cmdindex].command;

        /* Fill buffer for shell to read from */
        memcpy(buffer, command, commandlen);

        /* Insert newline into buffer */
        buffer[commandlen] = '\r';
        buffer[commandlen + 1] = '\n';

        /* Setup count variable for eventual return */
        count = commandlen + 2;

        /* Set the flag for waiting on webshell */
        httpControl(devptr, HTTP_CTRL_SET_FLAG, HTTP_FLAG_WAITONSHELL,
                    NULL);
        break;

        /* Commands not run in webshell */
    case FALSE:
        /* Handle index page */
        if (0 == (memcmp(httpcmdtab[cmdindex].url, "index.html",
                         strnlen(httpcmdtab[cmdindex].url, HTTP_STR_SM))))
        {
            httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_WAITONSHELL,
                        NULL);
        }
        /* Handle configure router page */
        else if (0 == (memcmp(httpcmdtab[cmdindex].url, "config.html",
                              strnlen(httpcmdtab[cmdindex].url,
                                      HTTP_STR_SM))))
        {
            /* Set up variables for all types of requests */
            pagebodytype = CONFIG_PAGE;

            /* Acquire memory for pointers dealing with configuration */
            if (SYSERR == setupConfig(webptr))
            {
                httpErrorResponse(devptr, HTTP_ERR_INTSERV);
                return 0;
            }

            /* Service config.html POST request */
            if (HTTP_METHOD_POST == methodint)
            {
                flashSuccess = postConfig(webptr);
            }
        }
    }

    /* Write headers */
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_CHUNKED, NULL);
    httpControl(devptr, HTTP_CTRL_SET_FLAG, HTTP_FLAG_CONCLOSE, NULL);
    char *headers =
        "HTTP/1.1 200 OK\r\n"
        "Connection: close\r\n"
        "Content-Type: text/html; charset=ISO-8859-1\r\n"
        "Transfer-Encoding: chunked\r\n\r\n";
    httpWrite(devptr, headers, strnlen(headers, HTTP_STR_SM));

    /* Flush write buffer */
    httpFlushWBuffer(devptr);

    if (!headersOnly)
    {
        /* Set chunked flag */
        httpControl(devptr, HTTP_CTRL_SET_FLAG, HTTP_FLAG_CHUNKED, NULL);

        /* Output the top of a webpage in the web interface */
        httpHtmlBeginPage(devptr);

        /* Output navigation part a webinterface webpage */
        httpHtmlNavigation(devptr);

        /* Write out the HTML for beginning of page content */
        httpHtmlBeginContent(devptr);

        /* Write out the page body if there is one */
        switch (pagebodytype)
        {
        case CONFIG_PAGE:
            outputConfig(devptr, flashSuccess);
            break;
        }
    }

    /* Set the flag showing preliminary writes are all done */
    httpControl(devptr, HTTP_CTRL_SET_FLAG, HTTP_FLAG_ENDREADOUTPUT,
                NULL);

    /* Flush write buffer, transmitting webpage topping parts */
    httpFlushWBuffer(devptr);

    /* Clear write buffer */
    httpControl(devptr, HTTP_CTRL_SET_FLAG, HTTP_FLAG_CLEARWOUT, NULL);
    httpWrite(devptr, NULL, 0);
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_CLEARWOUT, NULL);

    /* Reset request end flag */
    httpControl(devptr, HTTP_CTRL_CLR_FLAG, HTTP_FLAG_RQSTEND, NULL);

    /* Free buffers used exclusively in the httpRead */
    if (webptr->content != NULL)
    {
        free(webptr->content);
    }
    if (webptr->boundary != NULL)
    {
        free(webptr->boundary);
    }

    return count;
}


text:
Article 2022
----
Le contrat de fiducie définit les conditions dans lesquelles le fiduciaire rend
compte de sa mission au constituant.

Toutefois, lorsque pendant l'exécution du contrat le constituant fait l'objet
d'une mesure de tutelle, le fiduciaire rend compte de sa mission au tuteur à la
demande de ce dernier au moins une fois par an, sans préjudice de la périodicité
fixée par le contrat. Lorsque pendant l'exécution du contrat le constituant fait
l'objet d'une mesure de curatelle, le fiduciaire rend compte de sa mission, dans
les mêmes conditions, au constituant et à son curateur.

Le fiduciaire rend compte de sa mission au bénéficiaire et au tiers désigné en
application de l'article 2017, à leur demande, selon la périodicité fixée par le
contrat.


text:
#include <iostream>
#include <string>
#include <algorithm>

#include "lib3mf_implicit.hpp"

using namespace Lib3MF;

void printVersion(PWrapper wrapper) {
	Lib3MF_uint32 nMajor, nMinor, nMicro;
	wrapper->GetLibraryVersion(nMajor, nMinor, nMicro);
	std::cout << "lib3mf version = " << nMajor << "." << nMinor << "." << nMicro;
	std::string sReleaseInfo, sBuildInfo;
	if (wrapper->GetPrereleaseInformation(sReleaseInfo)) {
		std::cout << "-" << sReleaseInfo;
	}
	if (wrapper->GetBuildInformation(sBuildInfo)) {
		std::cout << "+" << sBuildInfo;
	}
	std::cout << std::endl;
}

// Utility functions to create vertices and triangles
sLib3MFPosition fnCreateVertex(float x, float y, float z)
{
	sLib3MFPosition result;
	result.m_Coordinates[0] = x;
	result.m_Coordinates[1] = y;
	result.m_Coordinates[2] = z;
	return result;
}

sLib3MFTriangle fnCreateTriangle(int v0, int v1, int v2)
{
	sLib3MFTriangle result;
	result.m_Indices[0] = v0;
	result.m_Indices[1] = v1;
	result.m_Indices[2] = v2;
	return result;
}

sLib3MFTransform createTranslationMatrix(float x, float y, float z)
{
	sLib3MFTransform mMatrix;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			mMatrix.m_Fields[i][j] = (i == j) ? 1.0f : 0.0f;
		}
	}

	mMatrix.m_Fields[3][0] = x;
	mMatrix.m_Fields[3][1] = y;
	mMatrix.m_Fields[3][2] = z;

	return mMatrix;
}

void ComponentsExample() {
	PWrapper wrapper = CWrapper::loadLibrary();

	std::cout << "------------------------------------------------------------------" << std::endl;
	std::cout << "3MF Components example" << std::endl;
	printVersion(wrapper);
	std::cout << "------------------------------------------------------------------" << std::endl;

	PModel model = wrapper->CreateModel();

	PMeshObject meshObject = model->AddMeshObject();
	meshObject->SetName("Box");

	// Create mesh structure of a cube
	std::vector<sLib3MFPosition> vertices(8);
	std::vector<sLib3MFTriangle> triangles(12);

	float fSizeX = 10.0f;
	float fSizeY = 20.0f;
	float fSizeZ = 30.0f;

	// Manually create vertices
	vertices[0] = fnCreateVertex(0.0f, 0.0f, 0.0f);
	vertices[1] = fnCreateVertex(fSizeX, 0.0f, 0.0f);
	vertices[2] = fnCreateVertex(fSizeX, fSizeY, 0.0f);
	vertices[3] = fnCreateVertex(0.0f, fSizeY, 0.0f);
	vertices[4] = fnCreateVertex(0.0f, 0.0f, fSizeZ);
	vertices[5] = fnCreateVertex(fSizeX, 0.0f, fSizeZ);
	vertices[6] = fnCreateVertex(fSizeX, fSizeY, fSizeZ);
	vertices[7] = fnCreateVertex(0.0f, fSizeY, fSizeZ);

	// Manually create triangles
	triangles[0] = fnCreateTriangle(2, 1, 0);
	triangles[1] = fnCreateTriangle(0, 3, 2);
	triangles[2] = fnCreateTriangle(4, 5, 6);
	triangles[3] = fnCreateTriangle(6, 7, 4);
	triangles[4] = fnCreateTriangle(0, 1, 5);
	triangles[5] = fnCreateTriangle(5, 4, 0);
	triangles[6] = fnCreateTriangle(2, 3, 7);
	triangles[7] = fnCreateTriangle(7, 6, 2);
	triangles[8] = fnCreateTriangle(1, 2, 6);
	triangles[9] = fnCreateTriangle(6, 5, 1);
	triangles[10] = fnCreateTriangle(3, 0, 4);
	triangles[11] = fnCreateTriangle(4, 7, 3);

	meshObject->SetGeometry(vertices, triangles);

	// Create Component Object
	PComponentsObject componentsObject = model->AddComponentsObject();

	// Add first component
	componentsObject->AddComponent(meshObject.get(), createTranslationMatrix(0.0f, 0.0f, 0.0f));

	// Add second component
	componentsObject->AddComponent(meshObject.get(), createTranslationMatrix(40.0f, 60.0f, 80.0f));

	// Add third component
	componentsObject->AddComponent(meshObject.get(), createTranslationMatrix(120.0f, 30.0f, 70.0f));

	// Add componentsobject as build item
	model->AddBuildItem(componentsObject.get(), createTranslationMatrix(0.0f, 0.0f, 0.0f));

	// Add translated componentsobject as build item
	model->AddBuildItem(componentsObject.get(), createTranslationMatrix(200.0f, 40.0f, 10.0f));

	// Add translated meshobject as build item
	model->AddBuildItem(meshObject.get(), createTranslationMatrix(-40.0f, 0.0f, 20.0f));

	// Output scene as STL and 3MF
	PWriter _3mfWriter = model->QueryWriter("3mf");
	std::cout << "writing components.3mf..." << std::endl;
	_3mfWriter->WriteToFile("components.3mf");

	PWriter stlWriter = model->QueryWriter("stl");
	std::cout << "writing components.stl..." << std::endl;
	stlWriter->WriteToFile("components.stl");

	std::cout << "done" << std::endl;
}

int main() {
	try {
		ComponentsExample();
	}
	catch (ELib3MFException &e) {
		std::cout << e.what() << std::endl;
		return e.getErrorCode();
	}
	return 0;
}


text:
import {
  AsyncTestCompleter,
  inject,
  describe,
  ddescribe,
  it,
  iit,
  xit,
  xdescribe,
  expect,
  beforeEach,
  SpyObject
} from 'angular2/testing_internal';
import {Testability} from 'angular2/src/core/testability/testability';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {normalizeBlank} from 'angular2/src/facade/lang';
import {PromiseWrapper, EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';

// Schedules a microtasks (using a resolved promise .then())
function microTask(fn: Function): void {
  PromiseWrapper.resolve(null).then((_) => { fn(); });
}

class MockNgZone extends NgZone {
  _onTurnStartStream: EventEmitter<any>;
  get onTurnStart() { return this._onTurnStartStream; }

  _onEventDoneStream: EventEmitter<any>;
  get onEventDone() { return this._onEventDoneStream; }

  constructor() {
    super({enableLongStackTrace: false});
    this._onTurnStartStream = new EventEmitter(false);
    this._onEventDoneStream = new EventEmitter(false);
  }

  start(): void { ObservableWrapper.callNext(this._onTurnStartStream, null); }

  finish(): void { ObservableWrapper.callNext(this._onEventDoneStream, null); }
}

export function main() {
  describe('Testability', () => {
    var testability, execute, ngZone;

    beforeEach(() => {
      ngZone = new MockNgZone();
      testability = new Testability(ngZone);
      execute = new SpyObject().spy('execute');
    });

    describe('Pending count logic', () => {
      it('should start with a pending count of 0',
         () => { expect(testability.getPendingRequestCount()).toEqual(0); });

      it('should fire whenstable callbacks if pending count is 0',
         inject([AsyncTestCompleter], (async) => {
           testability.whenStable(execute);
           microTask(() => {
             expect(execute).toHaveBeenCalled();
             async.done();
           });
         }));

      it('should not fire whenstable callbacks synchronously if pending count is 0', () => {
        testability.whenStable(execute);
        expect(execute).not.toHaveBeenCalled();
      });

      it('should not call whenstable callbacks when there are pending counts',
         inject([AsyncTestCompleter], (async) => {
           testability.increasePendingRequestCount();
           testability.increasePendingRequestCount();
           testability.whenStable(execute);

           microTask(() => {
             expect(execute).not.toHaveBeenCalled();
             testability.decreasePendingRequestCount();

             microTask(() => {
               expect(execute).not.toHaveBeenCalled();
               async.done();
             });
           });
         }));

      it('should fire whenstable callbacks when pending drops to 0',
         inject([AsyncTestCompleter], (async) => {
           testability.increasePendingRequestCount();
           testability.whenStable(execute);

           microTask(() => {
             expect(execute).not.toHaveBeenCalled();
             testability.decreasePendingRequestCount();

             microTask(() => {
               expect(execute).toHaveBeenCalled();
               async.done();
             });
           });
         }));

      it('should not fire whenstable callbacks synchronously when pending drops to 0', () => {
        testability.increasePendingRequestCount();
        testability.whenStable(execute);
        testability.decreasePendingRequestCount();

        expect(execute).not.toHaveBeenCalled();
      });
    });

    describe('NgZone callback logic', () => {
      it('should start being ready',
         () => { expect(testability.isAngularEventPending()).toEqual(false); });

      it('should fire whenstable callback if event is already finished',
         inject([AsyncTestCompleter], (async) => {
           ngZone.start();
           ngZone.finish();
           testability.whenStable(execute);

           microTask(() => {
             expect(execute).toHaveBeenCalled();
             async.done();
           });
         }));

      it('should not fire whenstable callbacks synchronously if event is already finished', () => {
        ngZone.start();
        ngZone.finish();
        testability.whenStable(execute);

        expect(execute).not.toHaveBeenCalled();
      });

      it('should fire whenstable callback when event finishes',
         inject([AsyncTestCompleter], (async) => {
           ngZone.start();
           testability.whenStable(execute);

           microTask(() => {
             expect(execute).not.toHaveBeenCalled();
             ngZone.finish();

             microTask(() => {
               expect(execute).toHaveBeenCalled();
               async.done();
             });
           });
         }));

      it('should not fire whenstable callbacks synchronously when event finishes', () => {
        ngZone.start();
        testability.whenStable(execute);
        ngZone.finish();

        expect(execute).not.toHaveBeenCalled();
      });

      it('should not fire whenstable callback when event did not finish',
         inject([AsyncTestCompleter], (async) => {
           ngZone.start();
           testability.increasePendingRequestCount();
           testability.whenStable(execute);

           microTask(() => {
             expect(execute).not.toHaveBeenCalled();
             testability.decreasePendingRequestCount();

             microTask(() => {
               expect(execute).not.toHaveBeenCalled();
               ngZone.finish();

               microTask(() => {
                 expect(execute).toHaveBeenCalled();
                 async.done();
               });
             });
           });
         }));

      it('should not fire whenstable callback when there are pending counts',
         inject([AsyncTestCompleter], (async) => {
           ngZone.start();
           testability.increasePendingRequestCount();
           testability.increasePendingRequestCount();
           testability.whenStable(execute);

           microTask(() => {
             expect(execute).not.toHaveBeenCalled();
             ngZone.finish();

             microTask(() => {
               expect(execute).not.toHaveBeenCalled();
               testability.decreasePendingRequestCount();

               microTask(() => {
                 expect(execute).not.toHaveBeenCalled();
                 testability.decreasePendingRequestCount();

                 microTask(() => {
                   expect(execute).toHaveBeenCalled();
                   async.done();
                 });
               });
             });
           });
         }));
    });
  });
}


text:
//     Data Access is a Java library to store data
//     Copyright (C) 2016-2018 Adrián Romero Corchado.
//
//     This file is part of Data Access
//
//     Licensed under the Apache License, Version 2.0 (the "License");
//     you may not use this file except in compliance with the License.
//     You may obtain a copy of the License at
//
//         http://www.apache.org/licenses/LICENSE-2.0
//
//     Unless required by applicable law or agreed to in writing, software
//     distributed under the License is distributed on an "AS IS" BASIS,
//     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//     See the License for the specific language governing permissions and
//     limitations under the License.
package com.adr.data.var;

import java.util.Arrays;

/**
 *
 * @author adrian
 */
public class VariantBytes extends Variant {

    public final static VariantBytes NULL = new VariantBytes(null);

    private final byte[] value;

    public VariantBytes(byte[] value) {
        this.value = value;
    }

    @Override
    public Kind getKind() {
        return Kind.BYTES;
    }

    @Override
    public boolean isNull() {
        return value == null;
    }

    @Override
    public byte[] asBytes() {
        return value;
    }

    @Override
    public Object asObject() {
        return value;
    }

    @Override
    public int hashCode() {
        return 72 + Arrays.hashCode(this.value);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final VariantBytes other = (VariantBytes) obj;
        return Arrays.equals(this.value, other.value);
    }
}


text:
<?php
namespace Acme\EcoBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
* @ORM\Entity
* @ORM\Entity(repositoryClass="Acme\EcoBundle\Entity\CategoryRepository")
* @ORM\Table(name="category")
*/
class Category
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $categoryId;

    /**
     * @ORM\Column(type="string", length=100)
     */
    protected $categoryName;

    /**
     * @ORM\ManyToOne(targetEntity="Family", inversedBy="categories")
     * @ORM\JoinColumn(name="familyId", referencedColumnName="familyId")
     */
    protected $family;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    protected $isDeleted;

    /**
     * @ORM\OneToMany(targetEntity="Transaction", mappedBy="category")
     */
    protected $transactions;

    public function __construct()
    {
        $this->transactions = new ArrayCollection();
    }

    /**
     * Get categoryId
     *
     * @return integer
     */
    public function getCategoryId()
    {
        return $this->categoryId;
    }

    /**
     * Set categoryName
     *
     * @param string $categoryName
     * @return Category
     */
    public function setCategoryName($categoryName)
    {
        $this->categoryName = $categoryName;

        return $this;
    }

    /**
     * Get categoryName
     *
     * @return string
     */
    public function getCategoryName()
    {
        return $this->categoryName;
    }

    /**
     * Set isDeleted
     *
     * @param integer $isDeleted
     * @return Category
     */
    public function setIsDeleted($isDeleted)
    {
        $this->isDeleted = $isDeleted;

        return $this;
    }

    /**
     * Get isDeleted
     *
     * @return integer
     */
    public function getIsDeleted()
    {
        return $this->isDeleted;
    }

    /**
     * Set family
     *
     * @param \Acme\EcoBundle\Entity\Family $family
     * @return Category
     */
    public function setFamily(\Acme\EcoBundle\Entity\Family $family = null)
    {
        $this->family = $family;

        return $this;
    }

    /**
     * Get family
     *
     * @return \Acme\EcoBundle\Entity\Family
     */
    public function getFamily()
    {
        return $this->family;
    }

    /**
     * Add transactions
     *
     * @param \Acme\EcoBundle\Entity\Transaction $transactions
     * @return Category
     */
    public function addTransaction(\Acme\EcoBundle\Entity\Transaction $transactions)
    {
        $this->transactions[] = $transactions;

        return $this;
    }

    /**
     * Remove transactions
     *
     * @param \Acme\EcoBundle\Entity\Transaction $transactions
     */
    public function removeTransaction(\Acme\EcoBundle\Entity\Transaction $transactions)
    {
        $this->transactions->removeElement($transactions);
    }

    /**
     * Get transactions
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTransactions()
    {
        return $this->transactions;
    }
}


text:
<!DOCTYPE html>

    <title></title>

    <form>
        Number for end<input type="text" id="number" />

        <input type="button" onclick="Action()" value="Click me" />
    </form>