text:
from __future__ import division

import sys

import numpy as np

from ..extern.six import print_

import pyfits as fits
from . import PyfitsTestCase

def compare_arrays(arr1in, arr2in, verbose=False):
    """
    Compare the values field-by-field in two sets of numpy arrays or
    recarrays.
    """

    arr1 = arr1in.view(np.ndarray)
    arr2 = arr2in.view(np.ndarray)

    nfail = 0
    for n2 in arr2.dtype.names:
        n1 = n2
        if n1 not in arr1.dtype.names:
            n1 = n1.lower()
            if n1 not in arr1.dtype.names:
                n1 = n1.upper()
                if n1 not in arr1.dtype.names:
                    raise ValueError('field name %s not found in array 1' % n2)

        if verbose:
            sys.stdout.write("    testing field: '%s'\n" % n2)
            sys.stdout.write('        shape...........')
        if arr2[n2].shape != arr1[n1].shape:
            nfail += 1
            if verbose:
                sys.stdout.write('shapes differ\n')
        else:
            if verbose:
                sys.stdout.write('OK\n')
                sys.stdout.write('        elements........')
            w, = np.where(arr1[n1].ravel() != arr2[n2].ravel())
            if w.size > 0:
                nfail += 1
                if verbose:
                    sys.stdout.write(
                        '\n        %s elements in field %s differ\n' %
                        (w.size, n2))
            else:
                if verbose:
                    sys.stdout.write('OK\n')

    if nfail == 0:
        if verbose:
            sys.stdout.write('All tests passed\n')
        return True
    else:
        if verbose:
            sys.stdout.write('%d differences found\n' % nfail)
        return False

def get_test_data(verbose=False):
    st = np.zeros(3, [('f1', 'i4'), ('f2', 'S6'), ('f3', '>2f8')])

    np.random.seed(35)
    st['f1'] = [1, 3, 5]
    st['f2'] = ['hello', 'world', 'byebye']
    st['f3'] = np.random.random(st['f3'].shape)
    print_(st.dtype.descr)
    print_(st)

    return st

class TestStructured(PyfitsTestCase):
    def test_structured(self):
        fname = self.data('stddata.fits')

        print_('Reading from ', fname)
        data1, h1 = fits.getdata(fname, ext=1, header=True)
        data2, h2 = fits.getdata(fname, ext=2, header=True)

        st = get_test_data()

        outfile = self.temp('test.fits')
        print_('Writing to file data1:', outfile)
        fits.writeto(outfile, data1, clobber=True)
        print_('Appending to file: data2', outfile)
        fits.append(outfile, data2)

        print_('Appending to file: st', outfile)
        fits.append(outfile, st)
        print_(st.dtype.descr)
        print_(st)
        assert st.dtype.isnative
        assert np.all(st['f1'] == [1, 3, 5])

        print_('Reading data back')
        data1check, h1check = fits.getdata(outfile, ext=1, header=True)
        data2check, h2check = fits.getdata(outfile, ext=2, header=True)
        stcheck, sthcheck = fits.getdata(outfile, ext=3, header=True)

        if not compare_arrays(data1, data1check, verbose=True):
            raise ValueError('Fail')
        if not compare_arrays(data2, data2check, verbose=True):
            raise ValueError('Fail')
        print_(st, stcheck)
        if not compare_arrays(st, stcheck, verbose=True):
            raise ValueError('Fail')

        # try reading with view
        print_('Reading with ndarray view')
        dataviewcheck, hviewcheck = fits.getdata(outfile, ext=2, header=True,
                                                   view=np.ndarray)
        if not compare_arrays(data2, dataviewcheck, verbose=True):
            raise ValueError('Fail')


text:
<material>
    <technique name="Techniques/NoTexture.xml" />
    <parameter name="MatDiffColor" value="0.13 0.55 0.13 1" />
    <parameter name="MatSpecColor" value="0.5 0.5 0.5 16" />
</material>

redpajama_set_name: RedPajamaGithub


text:
import React from 'react';
import classNames from 'classnames';
import { connect } from 'react-redux';
import $ from 'jquery/dist/jquery.slim';
import ColorPicker from 'react-simple-colorpicker';
import * as actions from '../../../actions';
import * as libs from '../../../lib';
import Button from './Button';
import EditLayoutSetting from './EditLayoutSetting';

class Toolbar extends React.Component {

	constructor(props)
	{
		super(props);

		this.state = {
			active: {
				setting: false,
				editBlockColor: false,
			},
			visible: {
				setting: true,
				shuffle: true,
				add: true,
				select: true,
				edit: false,
				removeImage: false,
				duplicate: false,
				removeBlock: false,
				editColor: false
			},
			activeBlockCount: 0,
		};
	}

	static getDerivedStateFromProps(nextProps, prevState)
	{
		let newState = Object.assign({}, prevState);

		// update active block count
		newState.activeBlockCount = nextProps.tree.body.activeBlock.length;

		// select block
		if (prevState.activeBlockCount !== nextProps.tree.body.activeBlock.length)
		{
			let active = !!(nextProps.tree.body.activeBlock.length);
			newState.visible = Object.assign({}, newState.visible, {
				edit: false,
				removeImage: false,
				duplicate: active,
				removeBlock: active,
				editColor: active
			});
		}

		if (nextProps.tree.body.activeBlock[0])
		{
			// check image block
			let isImage = false;
			nextProps.tree.body.activeBlock.some(k => {
				if (nextProps.tree.body.grid[k].image)
				{
					isImage = true;
					return true;
				}
			});

			// select image block
			let block = nextProps.tree.body.grid[nextProps.tree.body.activeBlock[0]];
			newState.visible = Object.assign({}, newState.visible, {
				removeImage: isImage,
				edit: !!(block && block.image)
			});
		}

		return {
			...prevState,
			...newState,
		};
	}

	changeActive(keyName, userSW, event)
	{
		const { state } = this;
		const sw = userSW || !state.active[keyName];
		const cTarget = event ? event.currentTarget : null;

		if (sw)
		{
			$(document).on('click.pleToolbar', (e) => {
				if ($(e.target).closest('.ple-toolbar__pop').length) return;
				if (!(e.target === cTarget) && !(e.target.parentNode === cTarget))
				{
					this.changeActive(keyName, false);
				}
			});
		}
		else
		{
			$(document).off('click.pleToolbar');
		}

		this.setState({
			active: {
				...state.active,
				setting: false,
				editColor: false,
				[keyName] : sw,
			}
		});
	}

	deactivate()
	{
		$(document).off('click.pleToolbar');
		return new Promise((reject) => {
			this.setState({
				active: {
					setting: false,
					editColor: false,
				}
			}, reject);
		});
	}

	/**
	 * Submit edit setting
	 *
	 * @param {Object} state
	 * @return {Boolean}
	 */
	submitEditSetting(state)
	{
		// update setting
		this.props.dispatch(actions.body.updateSetting(state));

		// close palette
		libs.util.sleep(50).then(() => this.changeActive('setting', false));

		return false;
	}

	render()
	{
		const { state, props } = this;
		let activeBlockColor = '#fff';

		if (typeof props.tree.body.grid === 'object' && libs.object.isArray(props.tree.body.activeBlock))
		{
			const n = props.tree.body.activeBlock[0];
			activeBlockColor = (props.tree.body.grid[n] && props.tree.body.grid[n].color) ?
				props.tree.body.grid[n].color :
				props.setting.body.blockColor;
		}

		return (

					{state.visible.setting && (
						<Button
							iconClass="ple-ico-setting"
							className={classNames('ple-edit-setting', {
								'ple-toolbar__block-active': state.active.setting
							})}
							onClick={(e) => {
								e.stopPropagation();
								if (!state.active.setting)
								{
									this.deactivate().then(() => {
										this.changeActive('setting', null, e);
									});
								}
								else
								{
									this.changeActive('setting', false, e);
								}
							}}
							title="Edit preference">
							{state.active.setting && (
								<EditLayoutSetting
									submit={(e) => this.submitEditSetting(e)}
									setting={props.tree.body.setting}
									defaultSetting={props.setting.body.setting}/>
							)}
						</Button>
					)}
					{state.visible.shuffle && (
						<Button
							iconClass="ple-ico-arrow-random"
							onClick={() => props.api.grid.shuffle()}
							title="Shuffle block"/>
					)}
					{state.visible.add && (
						<Button
							iconClass="ple-ico-plus"
							onClick={() => props.api.grid.add()}
							title="Add block"/>
					)}
					{state.visible.select && (
						<Button
							iconClass="ple-ico-select"
							onClick={() => props.api.grid.toggleSelectAll()}
							title="Toggle select block"/>
					)}

					{state.visible.edit && (
						<Button
							iconClass="ple-ico-pencil"
							className="ple-toolbar__block-key"
							onClick={() => props.api.cropper.open(props.tree.body.activeBlock[0])}
							title="Edit block"/>
					)}
					{state.visible.removeImage && (
						<Button
							iconClass="ple-ico-empty"
							className="ple-toolbar__block-key"
							onClick={() => props.api.grid.removeImages(props.tree.body.activeBlock)}
							title="Remove image in block"/>
					)}
					{state.visible.duplicate && (
						<Button
							iconClass="ple-ico-duplicate"
							className="ple-toolbar__block-key"
							onClick={() => {
								if (props.tree.body.activeBlock === null)
								{
									alert('Not found select block');
									return;
								}
								props.dispatch(actions.body.duplicateBlock(props.tree.body.activeBlock));
							}}
							title="Duplicate block"/>
					)}
					{state.visible.removeBlock && (
						<Button
							iconClass="ple-ico-trash"
							className="ple-toolbar__block-key"
							onClick={() => {
								if (props.tree.body.activeBlock === null)
								{
									alert('Not found select block');
									return;
								}
								props.api.grid.remove(props.tree.body.activeBlock);
							}}
							title="Remove block"/>
					)}
					{state.visible.editColor && (
						<Button
							iconClass="ple-ico-palette"
							className={classNames(
								'ple-edit-color',
								'ple-toolbar__block-key',
								{ 'ple-toolbar__block-active': state.active.editColor }
							)}
							onClick={(e) => {
								e.stopPropagation();
								if (!state.active.editColor)
								{
									this.deactivate().then(() => this.changeActive('editColor', null, e));
								}
								else
								{
									this.changeActive('editColor', false, e);
								}
							}}
							title="Change color">

								<ColorPicker
									onChange={(color) => {
										if (!color) return;
										props.dispatch(actions.body.changeColorBlock(props.tree.body.activeBlock, color));
									}}
									color={activeBlockColor}
									className="ple-colorPicker__body"/>

						</Button>
					)}

		);
	}

}
Toolbar.displayName = 'Toolbar';
Toolbar.defaultProps = {
	dispatch: null,
	tree: null,
};

export default connect((state) => Object.assign({}, state, {}))(Toolbar);


text:
@interface AboutViewController : ExtendedUIViewController
@property (weak, nonatomic) IBOutlet UILabel *textVersion;

- (IBAction)visitWebsite:(id)sender;

@end


text:
package org.matthiaszimmermann.web3j.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Optional;
import java.util.concurrent.ExecutionException;

import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.DefaultBlockParameterName;
import org.web3j.protocol.core.methods.request.Transaction;
import org.web3j.protocol.core.methods.response.EthAccounts;
import org.web3j.protocol.core.methods.response.EthCoinbase;
import org.web3j.protocol.core.methods.response.EthGetBalance;
import org.web3j.protocol.core.methods.response.EthGetTransactionCount;
import org.web3j.protocol.core.methods.response.EthGetTransactionReceipt;
import org.web3j.protocol.core.methods.response.EthSendTransaction;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.protocol.core.methods.response.Web3ClientVersion;
import org.web3j.protocol.http.HttpService;
import org.web3j.utils.Convert;

public class Web3jUtils {

	public static Web3j buildHttpClient(String ip, String port) {
		String url = String.format("http://%s:%s", ip, port);
		return Web3j.build(new HttpService(url));
	}

	public static String getClientVersion(Web3j web3j) throws InterruptedException, ExecutionException {
		Web3ClientVersion client = web3j
				.web3ClientVersion()
				.sendAsync()
				.get();

		return client.getWeb3ClientVersion();
	}

	public static EthCoinbase getCoinbase(Web3j web3j) throws InterruptedException, ExecutionException {
		return web3j
				.ethCoinbase()
				.sendAsync()
				.get();
	}

	/**
	 * Returns the list of addresses owned by this client.
	 */
	public static EthAccounts getAccounts(Web3j web3j) throws InterruptedException, ExecutionException {
		return web3j
				.ethAccounts()
				.sendAsync()
				.get();
	}

	/**
	 * Returns the balance (in Ether) of the specified account address.
	 */
	public static BigDecimal getBalanceEther(Web3j web3j, String address) throws InterruptedException, ExecutionException {
		return weiToEther(getBalanceWei(web3j, address));
	}

	/**
	 * Returns the balance (in Wei) of the specified account address.
	 */
	public static BigInteger getBalanceWei(Web3j web3j, String address) throws InterruptedException, ExecutionException {
		EthGetBalance balance = web3j
				.ethGetBalance(address, DefaultBlockParameterName.LATEST)
				.sendAsync()
				.get();

		return balance.getBalance();
	}

	/**
	 * Return the nonce (tx count) for the specified address.
	 */
	public static BigInteger getNonce(Web3j web3j, String address) throws InterruptedException, ExecutionException {
		EthGetTransactionCount ethGetTransactionCount =
				web3j.ethGetTransactionCount(address, DefaultBlockParameterName.LATEST).sendAsync().get();

		return ethGetTransactionCount.getTransactionCount();
	}

	/**
	 * Converts the provided Wei amount (smallest value Unit) to Ethers.
	 */
	public static BigDecimal weiToEther(BigInteger wei) {
		return Convert.fromWei(wei.toString(), Convert.Unit.ETHER);
	}

	public static BigInteger etherToWei(BigDecimal ether) {
		return Convert.toWei(ether, Convert.Unit.ETHER).toBigInteger();
	}

	/**
	 * Transfers the specified amount of Wei from the coinbase to the specified account.
	 * The method waits for the transfer to complete using method {@link waitForReceipt}.
	 */
	public static TransactionReceipt transferFromCoinbaseAndWait(Web3j web3j, String to, BigInteger amountWei)
			throws Exception
	{
		String coinbase = getCoinbase(web3j).getResult();
		BigInteger nonce = getNonce(web3j, coinbase);
		// this is a contract method call -> gas limit higher than simple fund transfer
		BigInteger gasLimit = Web3jConstants.GAS_LIMIT_ETHER_TX.multiply(BigInteger.valueOf(2));
		Transaction transaction = Transaction.createEtherTransaction(
				coinbase,
				nonce,
				Web3jConstants.GAS_PRICE,
				gasLimit,
				to,
				amountWei);

		EthSendTransaction ethSendTransaction = web3j
				.ethSendTransaction(transaction)
				.sendAsync()
				.get();

		String txHash = ethSendTransaction.getTransactionHash();

		return waitForReceipt(web3j, txHash);
	}

	/**
	 * Waits for the receipt for the transaction specified by the provided tx hash.
	 * Makes 40 attempts (waiting 1 sec. inbetween attempts) to get the receipt object.
	 * In the happy case the tx receipt object is returned.
	 * Otherwise, a runtime exception is thrown.
	 */
	public static TransactionReceipt waitForReceipt(Web3j web3j, String transactionHash)
			throws Exception
	{

		int attempts = Web3jConstants.CONFIRMATION_ATTEMPTS;
		int sleep_millis = Web3jConstants.SLEEP_DURATION;

		Optional<TransactionReceipt> receipt = getReceipt(web3j, transactionHash);

		while(attempts-- > 0 && !receipt.isPresent()) {
			Thread.sleep(sleep_millis);
			receipt = getReceipt(web3j, transactionHash);
		}

		if (attempts <= 0) {
			throw new RuntimeException("No Tx receipt received");
		}

		return receipt.get();
	}

	/**
	 * Returns the TransactionRecipt for the specified tx hash as an optional.
	 */
	public static Optional<TransactionReceipt> getReceipt(Web3j web3j, String transactionHash)
			throws Exception
	{
		EthGetTransactionReceipt receipt = web3j
				.ethGetTransactionReceipt(transactionHash)
				.sendAsync()
				.get();

		return receipt.getTransactionReceipt();
	}

	/**
	 * Reads the specified solidity file and returns it as a single line string.
	 * Includes some preprocessing: removing '//' comments and \s+ are replaced by ' ' globally.
	 */
	public static String readSolidityFile(String fileName) {
		try {
			File file = new File(fileName);
			FileInputStream fis = new FileInputStream(file);
			InputStreamReader isr = new InputStreamReader(fis);
			BufferedReader br = new BufferedReader(isr);
			StringBuffer text = new StringBuffer();

			br.lines().forEach(line -> {
				if(text.length() > 0) {
					text.append(" ");
				}

				// treat comments
				if(line.contains("//")) {
					line = line.substring(0, line.indexOf("//"));
				}

				text.append(line);
			});

			br.close();

			String sourceCode = text.toString();
			return sourceCode.replaceAll("\\s+", " ");
		}
		catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}
}


text:
using System.Data.Entity;
using System.Data.Entity.Infrastructure;

namespace OnlineTest.Data
{
    public interface IOnlineTestsDbContext
    {
        DbSet<TEntity> Set<TEntity>() where TEntity : class;

        DbEntityEntry<TEntity> Entry<TEntity>(TEntity entity) where TEntity : class;

        void Dispose();

        int SaveChanges();
    }
}


text:
# Parallax

Swiper allows you to create galleries with parallax effect.
This functionality is *partially* built into the widget.

More information can be found on the description page slider API
in the section 'Parallax' at the bottom of the page. [http://www.idangero.us/swiper/api/](http://www.idangero.us/swiper/api/)

## Partial support

Despite the fact that the widget provides a standard tool for parallax,
you should configuring effects for each slide manually,
to support the better customization.

Therefore, slides and content need to be configured through the options, for example, `\yii\helpers\BaseHtml::tag`

## Configuring parallax

You can configure parallax through the field `\romkaChev\yii2\swiper\Swiper::$parallaxOptions`, similar to `\yii\helpers\BaseHtml::tag`

> Pay attention: to parallax get worked,
  you should declare option `parallax = true` in field `\romkaChev\yii2\swiper\Swiper::$pluginOptions`

Also, to simplify work with widget the following constants were introduced:

| Constant                        | Value         | Direct analogue                                                   |
|---------------------------------|---------------|-------------------------------------------------------------------|
| `Swiper::PARALLAX_BACKGROUND`   | `background`  | `Swiper::$parallaxOptions['style'] = 'background-image:url(...)'` |
| `Swiper::PARALLAX_TRANSITION`   | `transition`  | `Swiper::$parallaxOptions['data']['swiper-parallax']`             |
| `Swiper::PARALLAX_TRANSITION_X` | `transitionX` | `Swiper::$parallaxOptions['data']['swiper-parallax-x']`           |
| `Swiper::PARALLAX_TRANSITION_Y` | `transitionY` | `Swiper::$parallaxOptions['data']['swiper-parallax-y']`           |
| `Swiper::PARALLAX_DURATION`     | `duration`    | `Swiper::$parallaxOptions['data']['swiper-duration']`             |

Example:

```PHP
<?php
use romkaChev\yii2\swiper\Swiper;
use yii\helpers\Html;

echo Swiper::widget( [
  'items' => [
    [
    /**
     * For each element of each slide, we specify different offsets
     * depending on the progress of the transition to the slide.
     */
      'content' => [
        Html::tag('div', 'Slide 1',       [ 'data' => [ 'swiper-parallax' => -100 ] ] ),
        Html::tag('div', 'Subtitle 1',    [ 'data' => [ 'swiper-parallax' => -200 ] ] ),
        Html::tag('div', '<p>Text 1</p>', [ 'data' => [ 'swiper-parallax' => -300 ] ] ),
      ]
    ],
    [
      'content' => [
        Html::tag('div', 'Slide 2',       [ 'data' => [ 'swiper-parallax' => -100 ] ] ),
        Html::tag('div', 'Subtitle 2',    [ 'data' => [ 'swiper-parallax' => -200 ] ] ),
        Html::tag('div', '<p>Text 2</p>', [ 'data' => [ 'swiper-parallax' => -300 ] ] ),
      ]
    ],
    [
      'content' => [
        Html::tag('div', 'Slide 3',       [ 'data' => [ 'swiper-parallax' => -100 ] ] ),
        Html::tag('div', 'Subtitle 3',    [ 'data' => [ 'swiper-parallax' => -200 ] ] ),
        Html::tag('div', '<p>Text 3</p>', [ 'data' => [ 'swiper-parallax' => -300 ] ] ),
      ]
    ]
  ],
  'behaviours' => [
    'parallax' // Declare behaviour "parallax"
  ],
  'parallaxOptions' => [ // Configuring parallax
    'background' => 'http://placehold.it/2536x1080',
    'transition' => '-23%',
    'data' => [
      'duration' => '750' // Set option directly
    ]
  ],
  'pluginOptions' => [
    Swiper::OPTION_PARALLAX => true // Specifies that the parallax included
  ]
] );
```


text:
package typed

import (
	"fmt"
	"strings"
	"sync"

	"sigs.k8s.io/structured-merge-diff/fieldpath"
	"sigs.k8s.io/structured-merge-diff/schema"
	"sigs.k8s.io/structured-merge-diff/value"
)

// AsTyped accepts a value and a type and returns a TypedValue. 'v' must have
// type 'typeName' in the schema. An error is returned if the v doesn't conform
// to the schema.
func AsTyped(v value.Value, s *schema.Schema, typeRef schema.TypeRef) (*TypedValue, error) {
	tv := &TypedValue{
		value:   v,
		typeRef: typeRef,
		schema:  s,
	}
	if err := tv.Validate(); err != nil {
		return nil, err
	}
	return tv, nil
}

// AsTypeUnvalidated is just like AsTyped, but doesn't validate that the type
// conforms to the schema, for cases where that has already been checked or
// where you're going to call a method that validates as a side-effect (like
// ToFieldSet).
func AsTypedUnvalidated(v value.Value, s *schema.Schema, typeRef schema.TypeRef) *TypedValue {
	tv := &TypedValue{
		value:   v,
		typeRef: typeRef,
		schema:  s,
	}
	return tv
}

// TypedValue is a value of some specific type.
type TypedValue struct {
	value   value.Value
	typeRef schema.TypeRef
	schema  *schema.Schema
}

// AsValue removes the type from the TypedValue and only keeps the value.
func (tv TypedValue) AsValue() *value.Value {
	return &tv.value
}

// Validate returns an error with a list of every spec violation.
func (tv TypedValue) Validate() error {
	w := tv.walker()
	defer w.finished()
	if errs := w.validate(); len(errs) != 0 {
		return errs
	}
	return nil
}

// ToFieldSet creates a set containing every leaf field and item mentioned, or
// validation errors, if any were encountered.
func (tv TypedValue) ToFieldSet() (*fieldpath.Set, error) {
	s := fieldpath.NewSet()
	w := tv.walker()
	defer w.finished()
	w.leafFieldCallback = func(p fieldpath.Path) { s.Insert(p) }
	w.nodeFieldCallback = func(p fieldpath.Path) { s.Insert(p) }
	if errs := w.validate(); len(errs) != 0 {
		return nil, errs
	}
	return s, nil
}

// Merge returns the result of merging tv and pso ("partially specified
// object") together. Of note:
//  * No fields can be removed by this operation.
//  * If both tv and pso specify a given leaf field, the result will keep pso's
//    value.
//  * Container typed elements will have their items ordered:
//    * like tv, if pso doesn't change anything in the container
//    * like pso, if pso does change something in the container.
// tv and pso must both be of the same type (their Schema and TypeRef must
// match), or an error will be returned. Validation errors will be returned if
// the objects don't conform to the schema.
func (tv TypedValue) Merge(pso *TypedValue) (*TypedValue, error) {
	return merge(&tv, pso, ruleKeepRHS, nil)
}

// Compare compares the two objects. See the comments on the `Comparison`
// struct for details on the return value.
//
// tv and rhs must both be of the same type (their Schema and TypeRef must
// match), or an error will be returned. Validation errors will be returned if
// the objects don't conform to the schema.
func (tv TypedValue) Compare(rhs *TypedValue) (c *Comparison, err error) {
	c = &Comparison{
		Removed:  fieldpath.NewSet(),
		Modified: fieldpath.NewSet(),
		Added:    fieldpath.NewSet(),
	}
	_, err = merge(&tv, rhs, func(w *mergingWalker) {
		if w.lhs == nil {
			c.Added.Insert(w.path)
		} else if w.rhs == nil {
			c.Removed.Insert(w.path)
		} else if !w.rhs.Equals(*w.lhs) {
			// TODO: Equality is not sufficient for this.
			// Need to implement equality check on the value type.
			c.Modified.Insert(w.path)
		}
	}, func(w *mergingWalker) {
		if w.lhs == nil {
			c.Added.Insert(w.path)
		} else if w.rhs == nil {
			c.Removed.Insert(w.path)
		}
	})
	if err != nil {
		return nil, err
	}

	return c, nil
}

// RemoveItems removes each provided list or map item from the value.
func (tv TypedValue) RemoveItems(items *fieldpath.Set) *TypedValue {
	tv.value, _ = value.FromUnstructured(tv.value.ToUnstructured(true))
	removeItemsWithSchema(&tv.value, items, tv.schema, tv.typeRef)
	return &tv
}

// NormalizeUnions takes the new object and normalizes the union:
// - If discriminator changed to non-nil, and a new field has been added
// that doesn't match, an error is returned,
// - If discriminator hasn't changed and two fields or more are set, an
// error is returned,
// - If discriminator changed to non-nil, all other fields but the
// discriminated one will be cleared,
// - Otherwise, If only one field is left, update discriminator to that value.
//
// Please note: union behavior isn't finalized yet and this is still experimental.
func (tv TypedValue) NormalizeUnions(new *TypedValue) (*TypedValue, error) {
	var errs ValidationErrors
	var normalizeFn = func(w *mergingWalker) {
		if w.rhs != nil {
			v := *w.rhs
			w.out = &v
		}
		if err := normalizeUnions(w); err != nil {
			errs = append(errs, w.error(err)...)
		}
	}
	out, mergeErrs := merge(&tv, new, func(w *mergingWalker) {}, normalizeFn)
	if mergeErrs != nil {
		errs = append(errs, mergeErrs.(ValidationErrors)...)
	}
	if len(errs) > 0 {
		return nil, errs
	}
	return out, nil
}

// NormalizeUnionsApply specifically normalize unions on apply. It
// validates that the applied union is correct (there should be no
// ambiguity there), and clear the fields according to the sent intent.
//
// Please note: union behavior isn't finalized yet and this is still experimental.
func (tv TypedValue) NormalizeUnionsApply(new *TypedValue) (*TypedValue, error) {
	var errs ValidationErrors
	var normalizeFn = func(w *mergingWalker) {
		if w.rhs != nil {
			v := *w.rhs
			w.out = &v
		}
		if err := normalizeUnionsApply(w); err != nil {
			errs = append(errs, w.error(err)...)
		}
	}
	out, mergeErrs := merge(&tv, new, func(w *mergingWalker) {}, normalizeFn)
	if mergeErrs != nil {
		errs = append(errs, mergeErrs.(ValidationErrors)...)
	}
	if len(errs) > 0 {
		return nil, errs
	}
	return out, nil
}

func (tv TypedValue) Empty() *TypedValue {
	tv.value = value.Value{Null: true}
	return &tv
}

var mwPool = sync.Pool{
	New: func() interface{} { return &mergingWalker{} },
}

func merge(lhs, rhs *TypedValue, rule, postRule mergeRule) (*TypedValue, error) {
	if lhs.schema != rhs.schema {
		return nil, errorFormatter{}.
			errorf("expected objects with types from the same schema")
	}
	if !lhs.typeRef.Equals(rhs.typeRef) {
		return nil, errorFormatter{}.
			errorf("expected objects of the same type, but got %v and %v", lhs.typeRef, rhs.typeRef)
	}

	mw := mwPool.Get().(*mergingWalker)
	defer func() {
		mw.lhs = nil
		mw.rhs = nil
		mw.schema = nil
		mw.typeRef = schema.TypeRef{}
		mw.rule = nil
		mw.postItemHook = nil
		mw.out = nil
		mw.inLeaf = false

		mwPool.Put(mw)
	}()

	mw.lhs = &lhs.value
	mw.rhs = &rhs.value
	mw.schema = lhs.schema
	mw.typeRef = lhs.typeRef
	mw.rule = rule
	mw.postItemHook = postRule

	errs := mw.merge()
	if len(errs) > 0 {
		return nil, errs
	}

	out := &TypedValue{
		schema:  lhs.schema,
		typeRef: lhs.typeRef,
	}
	if mw.out == nil {
		out.value = value.Value{Null: true}
	} else {
		out.value = *mw.out
	}
	return out, nil
}

// Comparison is the return value of a TypedValue.Compare() operation.
//
// No field will appear in more than one of the three fieldsets. If all of the
// fieldsets are empty, then the objects must have been equal.
type Comparison struct {
	// Removed contains any fields removed by rhs (the right-hand-side
	// object in the comparison).
	Removed *fieldpath.Set
	// Modified contains fields present in both objects but different.
	Modified *fieldpath.Set
	// Added contains any fields added by rhs.
	Added *fieldpath.Set
}

// IsSame returns true if the comparison returned no changes (the two
// compared objects are similar).
func (c *Comparison) IsSame() bool {
	return c.Removed.Empty() && c.Modified.Empty() && c.Added.Empty()
}

// String returns a human readable version of the comparison.
func (c *Comparison) String() string {
	bld := strings.Builder{}
	if !c.Modified.Empty() {
		bld.WriteString(fmt.Sprintf("- Modified Fields:\n%v\n", c.Modified))
	}
	if !c.Added.Empty() {
		bld.WriteString(fmt.Sprintf("- Added Fields:\n%v\n", c.Added))
	}
	if !c.Removed.Empty() {
		bld.WriteString(fmt.Sprintf("- Removed Fields:\n%v\n", c.Removed))
	}
	return bld.String()
}


text:
package com.google.api.gax.retrying;

import static org.junit.Assert.assertFalse;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@SuppressWarnings({"unchecked", "deprecation"})
@RunWith(JUnit4.class)
public class RetryAlgorithmTest {

  @Test
  public void testCreateFirstAttempt() {
    TimedRetryAlgorithm timedAlgorithm = mock(TimedRetryAlgorithm.class);
    RetryAlgorithm<Void> algorithm =
        new RetryAlgorithm<>(mock(ResultRetryAlgorithm.class), timedAlgorithm);

    algorithm.createFirstAttempt();
    verify(timedAlgorithm).createFirstAttempt();
  }

  @Test
  public void testCreateFirstAttemptWithUnusedContext() {
    TimedRetryAlgorithm timedAlgorithm = mock(TimedRetryAlgorithm.class);
    RetryAlgorithm<Void> algorithm =
        new RetryAlgorithm<>(mock(ResultRetryAlgorithm.class), timedAlgorithm);

    RetryingContext context = mock(RetryingContext.class);
    algorithm.createFirstAttempt(context);
    verify(timedAlgorithm).createFirstAttempt();
  }

  @Test
  public void testCreateFirstAttemptWithContext() {
    TimedRetryAlgorithmWithContext timedAlgorithm = mock(TimedRetryAlgorithmWithContext.class);
    RetryAlgorithm<Void> algorithm =
        new RetryAlgorithm<>(mock(ResultRetryAlgorithmWithContext.class), timedAlgorithm);

    RetryingContext context = mock(RetryingContext.class);
    algorithm.createFirstAttempt(context);
    verify(timedAlgorithm).createFirstAttempt(context);
  }

  @Test
  public void testCreateFirstAttemptWithNullContext() {
    TimedRetryAlgorithmWithContext timedAlgorithm = mock(TimedRetryAlgorithmWithContext.class);
    RetryAlgorithm<Void> algorithm =
        new RetryAlgorithm<>(mock(ResultRetryAlgorithmWithContext.class), timedAlgorithm);

    algorithm.createFirstAttempt(null);
    verify(timedAlgorithm).createFirstAttempt();
  }

  @Test
  public void testNextAttempt() {
    ResultRetryAlgorithm<Object> resultAlgorithm = mock(ResultRetryAlgorithm.class);
    TimedRetryAlgorithm timedAlgorithm = mock(TimedRetryAlgorithm.class);
    RetryAlgorithm<Object> algorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm);

    Throwable previousThrowable = new Throwable();
    Object previousResult = new Object();
    TimedAttemptSettings previousSettings = mock(TimedAttemptSettings.class);

    algorithm.createNextAttempt(previousThrowable, previousResult, previousSettings);
    verify(resultAlgorithm).shouldRetry(previousThrowable, previousResult);
  }

  @Test
  public void testNextAttemptWithContext() {
    ResultRetryAlgorithmWithContext<Object> resultAlgorithm =
        mock(ResultRetryAlgorithmWithContext.class);
    TimedRetryAlgorithmWithContext timedAlgorithm = mock(TimedRetryAlgorithmWithContext.class);
    RetryAlgorithm<Object> algorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm);

    RetryingContext context = mock(RetryingContext.class);
    Throwable previousThrowable = new Throwable();
    Object previousResult = new Object();
    TimedAttemptSettings previousSettings = mock(TimedAttemptSettings.class);

    algorithm.createNextAttempt(context, previousThrowable, previousResult, previousSettings);
    verify(resultAlgorithm).shouldRetry(context, previousThrowable, previousResult);
  }

  @Test
  public void testShouldRetry() {
    ResultRetryAlgorithm<Object> resultAlgorithm = mock(ResultRetryAlgorithm.class);
    TimedRetryAlgorithm timedAlgorithm = mock(TimedRetryAlgorithm.class);
    RetryAlgorithm<Object> algorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm);

    Throwable previousThrowable = new Throwable();
    Object previousResult = new Object();
    TimedAttemptSettings previousSettings = mock(TimedAttemptSettings.class);

    algorithm.shouldRetry(previousThrowable, previousResult, previousSettings);
    verify(resultAlgorithm).shouldRetry(previousThrowable, previousResult);
  }

  @Test
  public void testShouldRetry_usesTimedAlgorithm() {
    ResultRetryAlgorithm<Object> resultAlgorithm = mock(ResultRetryAlgorithm.class);
    TimedRetryAlgorithm timedAlgorithm = mock(TimedRetryAlgorithm.class);
    RetryAlgorithm<Object> algorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm);

    Throwable previousThrowable = new Throwable();
    Object previousResult = new Object();
    TimedAttemptSettings previousSettings = mock(TimedAttemptSettings.class);
    when(resultAlgorithm.shouldRetry(previousThrowable, previousResult)).thenReturn(true);

    algorithm.shouldRetry(previousThrowable, previousResult, previousSettings);
    verify(timedAlgorithm).shouldRetry(previousSettings);
  }

  @Test
  public void testShouldRetryWithContext() {
    ResultRetryAlgorithmWithContext<Object> resultAlgorithm =
        mock(ResultRetryAlgorithmWithContext.class);
    TimedRetryAlgorithmWithContext timedAlgorithm = mock(TimedRetryAlgorithmWithContext.class);
    RetryAlgorithm<Object> algorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm);

    RetryingContext context = mock(RetryingContext.class);
    Throwable previousThrowable = new Throwable();
    Object previousResult = new Object();
    TimedAttemptSettings previousSettings = mock(TimedAttemptSettings.class);

    algorithm.shouldRetry(context, previousThrowable, previousResult, previousSettings);
    verify(resultAlgorithm).shouldRetry(context, previousThrowable, previousResult);
  }

  @Test
  public void testShouldRetryWithContext_usesTimedAlgorithm() {
    ResultRetryAlgorithmWithContext<Object> resultAlgorithm =
        mock(ResultRetryAlgorithmWithContext.class);
    TimedRetryAlgorithmWithContext timedAlgorithm = mock(TimedRetryAlgorithmWithContext.class);
    RetryAlgorithm<Object> algorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm);

    RetryingContext context = mock(RetryingContext.class);
    Throwable previousThrowable = new Throwable();
    Object previousResult = new Object();
    TimedAttemptSettings previousSettings = mock(TimedAttemptSettings.class);
    when(resultAlgorithm.shouldRetry(context, previousThrowable, previousResult)).thenReturn(true);

    algorithm.shouldRetry(context, previousThrowable, previousResult, previousSettings);
    verify(timedAlgorithm).shouldRetry(context, previousSettings);
  }

  @Test
  public void testShouldRetry_noPreviousSettings() {
    ResultRetryAlgorithm<Object> resultAlgorithm = mock(ResultRetryAlgorithm.class);
    TimedRetryAlgorithm timedAlgorithm = mock(TimedRetryAlgorithm.class);
    RetryAlgorithm<Object> algorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm);

    Throwable previousThrowable = new Throwable();
    Object previousResult = new Object();
    when(resultAlgorithm.shouldRetry(previousThrowable, previousResult)).thenReturn(true);

    assertFalse(algorithm.shouldRetry(previousThrowable, previousResult, null));
  }

  @Test
  public void testShouldRetryWithContext_noPreviousSettings() {
    ResultRetryAlgorithmWithContext<Object> resultAlgorithm =
        mock(ResultRetryAlgorithmWithContext.class);
    TimedRetryAlgorithmWithContext timedAlgorithm = mock(TimedRetryAlgorithmWithContext.class);
    RetryAlgorithm<Object> algorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm);

    RetryingContext context = mock(RetryingContext.class);
    Throwable previousThrowable = new Throwable();
    Object previousResult = new Object();

    assertFalse(algorithm.shouldRetry(context, previousThrowable, previousResult, null));
  }
}


text:
@implementation OXmlXPathMapper
{
    NSString *_nsURI;
}

#pragma mark - constructors

- (id)initXpath:(NSString *)xpath type:(Class)type property:(NSString *)property
{
    if (self = [super initMapperToClass:type toPath:property fromClass:[NSString class] fromPath:xpath]) {
        if ([OXUtil isXPathString:xpath]) {         //only allocate for multi-element or wildcard paths
            if ([OXUtil  firstIndexOfChar:'@' inString:xpath] >= 0 || [xpath hasSuffix:OX_TEXT_NODE]) {
                NSAssert1(NO, @"ERROR: unsupported xpath: '%@' - mixing leaf nodes (attributes or text) with element nodes currently not supported", xpath);
            }
            _xpath = [OXPathLite xpath:xpath];
        }
        _xmlType = [[self class] xmlTypeFromPath:xpath];
        if (property == nil) {
            property = _xpath ? _xpath.pathLeaf : xpath;
            self.toPath = [[self class] xpathToKVCPath:property];
        }
        if (_xmlType == OX_XML_ATTRIBUTE && [xpath hasPrefix:OX_ATTRIBUTE_PREFIX]) {
            self.fromPath = [xpath substringWithRange:NSMakeRange(1,[xpath length]-1)];
        }
    }
    return self;
}

- (id)initXpath:(NSString *)xpath scalar:(const char *)encodedType property:(NSString *)property
{
    if (self = [super initMapperToScalar:encodedType toPath:property fromClass:[NSString class] fromPath:xpath]) {
        _xmlType = [[self class] xmlTypeFromPath:xpath];
        if (property == nil) {
            property = _xpath ? _xpath.pathLeaf : xpath;
            self.toPath = [[self class] xpathToKVCPath:property];
        }
        if (_xmlType == OX_XML_ATTRIBUTE && [xpath hasPrefix:OX_ATTRIBUTE_PREFIX]) {
            self.fromPath = [xpath substringWithRange:NSMakeRange(1,[xpath length]-1)];
        }
    }
    return self;
}

+ (id)xpath:(NSString *)xpath
{
    return [[OXmlXPathMapper alloc] initXpath:xpath type:nil property:nil];
}

+ (id)xpath:(NSString *)xpath type:(Class)type
{
    return [[OXmlXPathMapper alloc] initXpath:xpath type:type property:nil];
}

+ (id)xpath:(NSString *)xpath type:(Class)type property:(NSString *)property
{
    return [[OXmlXPathMapper alloc] initXpath:xpath type:type property:property];
}

+ (id)xpath:(NSString *)xpath scalar:(const char *)encodedType property:(NSString *)property
{
    return [[OXmlXPathMapper alloc] initXpath:xpath scalar:encodedType property:property];
}

+ (id)xpath:(NSString *)xpath toMany:(Class)childType containerType:(Class)containerType property:(NSString *)property
{
    OXType *containerOXType = [OXType typeContainer:containerType containing:childType];
    OXmlXPathMapper *mapper = [[OXmlXPathMapper alloc] initXpath:xpath type:containerType property:property];
    mapper.toType = containerOXType;
    return mapper;
}

+ (id)xpath:(NSString *)xpath toMany:(Class)childType property:(NSString *)property dictionaryKey:(NSString *)keyProperty
{
    OXType *containerOXType = [OXType typeContainer:nil containing:childType];
    OXmlXPathMapper *mapper = [[OXmlXPathMapper alloc] initXpath:xpath type:nil property:property];
    mapper.toType = containerOXType;
    mapper.dictionaryKeyName = keyProperty;
    return mapper;
}

#pragma mark - builder

- (OXmlXPathMapper *)factory:(OXFactoryBlock)factory
{
    self.factory = factory;
    return self;
}

- (OXmlXPathMapper *)setter:(OXSetterBlock)setter
{
    self.setter = setter;
    return self;
}

- (OXmlXPathMapper *)getter:(OXGetterBlock)getter
{
    self.getter = getter;
    return self;
}

- (OXmlXPathMapper *)toTransform:(OXTransformBlock)toTransform
{
    self.toTransform = toTransform;
    return self;
}

- (OXmlXPathMapper *)fromTransform:(OXTransformBlock)fromTransform
{
    self.fromTransform = fromTransform;
    return self;
}

- (OXmlXPathMapper *)enumerator:(OXEnumerationBlock)enumerator
{
    self.enumerator = enumerator;
    return self;
}

- (OXmlXPathMapper *)appender:(OXSetterBlock)appender
{
    self.appender = appender;
    return self;
}

- (OXmlXPathMapper *)nsURI:(NSString *)nsURI
{
    self.nsURI = nsURI;
    return self;
}

- (OXmlXPathMapper *)proxyClass:(Class)proxyClass
{
    _proxyType = [OXType cachedType:proxyClass];
    return self;
}

- (OXmlXPathMapper *)isVirtualProperty
{
    self.virtualProperty = YES;
    return self;
}

- (OXmlXPathMapper *)formatter:(NSString *)formatterName
{
    [self setValue:formatterName forKey:@"formatterName"];
    return self;
}

- (OXmlXPathMapper *)path:(OXPathFactoryBlock)pathFactory
{
    self.pathFactory = pathFactory;
    return self;
}

#pragma mark - properties

@dynamic nsURI;
- (NSString *)nsURI
{
    if (_nsURI) {
        return _nsURI;
    } else {
        OXmlElementMapper *parentElementMapper = (OXmlElementMapper *)self.parent;
        NSAssert1(parentElementMapper != nil, @"OXmlXPathMapper 'nsURI' property can't be accessed if parent is not set in %@", self);
        return parentElementMapper.nsURI;
    }
}
- (void)setNsURI:(NSString *)nsURI
{
    _nsURI = nsURI;
}

@dynamic fromPathRoot;
- (NSString *)fromPathRoot
{
    return _xpath ? _xpath.pathRoot : self.fromPath;                    //lazy use of xpath
}

@dynamic fromPathLeaf;
- (NSString *)fromPathLeaf
{
    return _xpath ? _xpath.pathLeaf : self.fromPath;                    //lazy use of xpath
}

#pragma mark - utility

+ (OXmlTypeEnum)xmlTypeFromPath:(NSString *)xpath
{
    NSArray *segments = [xpath componentsSeparatedByString:OX_ROOT_PATH];
    NSString *tag = [segments lastObject];
    if ([tag hasPrefix:OX_ATTRIBUTE_PREFIX]) {
        return OX_XML_ATTRIBUTE;
    } else if ([tag isEqualToString:OX_TEXT_NODE]) {
        return OX_XML_BODY;
    } else {
        return OX_XML_ELEMENT;
    }
}

+ (NSString *)xpathToKVCPath:(NSString *)xpath
{
    NSString *result = [xpath stringByReplacingOccurrencesOfString:OX_ROOT_PATH withString:@"."];
    result = [result stringByReplacingOccurrencesOfString:OX_ATTRIBUTE_PREFIX withString:@""];
    result = [result stringByReplacingOccurrencesOfString:@".text()" withString:@""];   //handle case: elem/text()
    result = [result stringByReplacingOccurrencesOfString:OX_TEXT_NODE withString:@""];
    return result;
}

+ (NSString *)xpathToAttribute:(NSString *)xpath
{
    if ([OXUtil lastIndexOfChar:'@' inString:xpath] < 0) {
        int lastIndex = [OXUtil lastIndexOfChar:'/' inString:xpath];
        if (lastIndex < 0) {
            return [NSString stringWithFormat:@"%@%@", OX_ATTRIBUTE_PREFIX, xpath];
        } else {
            NSUInteger len = [xpath length];
            return [NSString stringWithFormat:@"%@%@%@", [xpath substringWithRange:NSMakeRange(0,lastIndex)], OX_ATTRIBUTE_PREFIX, [xpath substringWithRange:NSMakeRange(lastIndex,len)]];
        }
    } else {
        return xpath;
    }
}

@end

//
//  Copyright (c) 2013 Outsource Cafe, Inc. All rights reserved.
//
//  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.
//


text:
Chrome Platform Analytics is a Javascript library supporting the use of Google Analytics (GA) from Chrome Platform Applications (and Extensions).

Please see [the wiki](https://github.com/GoogleChrome/chrome-platform-analytics/wiki) for more information.


text:
// Copyright (c) Samuel Cragg.
//
// Licensed under the MIT license. See LICENSE file in the project root for
// full license information.

namespace Crest.Abstractions
{
    using System;
    using System.Threading.Tasks;

    /// <summary>
    /// Allows custom error handling logic to be applied.
    /// </summary>
    public interface IErrorHandlerPlugin
    {
        /// <summary>
        /// Gets the relative order this should be invoked in.
        /// </summary>
        /// <remarks>
        /// Lower numbers will be invoked before higher numbers (i.e. 100 will
        /// be executed before 200).
        /// </remarks>
        int Order { get; }

        /// <summary>
        /// Determines whether this instance can handle the specified exception.
        /// </summary>
        /// <param name="exception">The exception that has been raised.</param>
        /// <returns>
        /// <c>true</c> if <see cref="ProcessAsync(IRequestData, Exception)"/> should be invoked
        /// on this instance; otherwise, <c>false</c>.
        /// </returns>
        bool CanHandle(Exception exception);

        /// <summary>
        /// Performs custom processing of the response to a request.
        /// </summary>
        /// <param name="request">The request data.</param>
        /// <param name="exception">The exception that has been raised.</param>
        /// <returns>
        /// A task that represents the asynchronous operation. The value of the
        /// <c>TResult</c> parameter contains the response to send.
        /// </returns>
        Task<IResponseData> ProcessAsync(IRequestData request, Exception exception);
    }
}


text:
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/queue.h>

#include "gbsim.h"

struct gbsim_interface *interface_get_by_hash(struct gbsim_svc *svc,
					      uint32_t hash)
{
	struct gbsim_interface *intf;

	TAILQ_FOREACH(intf, &svc->intfs, intf_node)
		if (intf->manifest_fname_hash == hash)
			return intf;

	return NULL;
}

struct gbsim_interface *interface_get_by_id(struct gbsim_svc *svc, uint8_t id)
{
	struct gbsim_interface *intf;

	TAILQ_FOREACH(intf, &svc->intfs, intf_node)
		if (intf->interface_id == id)
			return intf;

	return NULL;
}

void interface_free(struct gbsim_svc *svc, struct gbsim_interface *intf)
{
	struct gbsim_connection *connection;

	gbsim_debug("free interface %u\n", intf->interface_id);
	TAILQ_FOREACH(connection, &intf->connections, cnode)
		free_connection(connection);

	TAILQ_REMOVE(&svc->intfs, intf, intf_node);
	free(intf->manifest);
	free(intf);
}

struct gbsim_interface *interface_alloc(struct gbsim_svc *svc, uint8_t id)
{
	struct gbsim_interface *intf;

	intf = interface_get_by_id(svc, id);
	if (intf) {
		gbsim_error("allocated an already existent interface %u\n", id);
		return intf;
	}

	intf = calloc(1, sizeof(*intf));
	if (!intf)
		return NULL;

	TAILQ_INIT(&intf->connections);
	intf->interface_id = id;

	intf->svc = svc;

	TAILQ_INSERT_TAIL(&svc->intfs, intf, intf_node);

	return intf;
}


text:
package org.pitest.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.pitest.functional.prelude.Prelude.isEqualTo;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.pitest.functional.F;
import org.pitest.functional.Option;
import org.pitest.functional.prelude.Prelude;

public class InputStreamLineIterableTest {

  private InputStreamLineIterable testee;
  private List<String>            actual;

  @Before
  public void setUp() {
    this.actual = new ArrayList<String>();
    final StringReader input = new StringReader("1\n2\n3\n");
    this.testee = new InputStreamLineIterable(input);
  }

  @Test
  public void shouldApplyForEachToAllLines() {
    this.testee.forEach(Prelude.accumulateTo(this.actual));
    assertEquals(this.actual, Arrays.asList("1", "2", "3"));
  }

  @Test
  public void shouldApplyFilterToAllLines() {
    assertEquals(Arrays.asList("1"), this.testee.filter(isEqualTo("1")));
  }

  @Test
  public void shouldApplyMapToAllLines() {
    assertEquals(Arrays.asList("1", "2", "3"),
        this.testee.map(Prelude.<String> id()));
  }

  @Test
  public void shouldApplyFlatMapToAllLines() {
    assertEquals(Arrays.asList("1", "3"), this.testee.flatMap(mapIfNotTwo()));
  }

  @Test
  public void shouldReturnTrueWhenContainsCalledAndPredicateMatches() {
    assertTrue(this.testee.contains(isEqualTo("1")));
  }

  @Test
  public void shouldReturnFalseWhenContainsCalledAndPredicateDoesNotMatch() {
    assertFalse(this.testee.contains(isEqualTo("10")));
  }

  private F<String, Option<String>> mapIfNotTwo() {
    return new F<String, Option<String>>() {
      public Option<String> apply(final String a) {
        if (a.equals("2")) {
          return Option.none();
        }
        return Option.some(a);
      }

    };
  }

}


text:
<?php
namespace Asyncro;

/*
 * @link http://github.com/robinef
 *
 * @package Asyncro
 * @author robinef@gmail.com
 */

class ClientTest extends \PHPUnit_Framework_TestCase {

    /**
     * Test multiple asynchronous call
     */
    public function testSimpleHttpCall() {
        $test = new Client();
        $callback = function (&$buffer) {
           $buffer;
        };

        $test->addRequest('http://www.google.fr',$callback);
        $test->addRequest('http://www.google.fr',$callback);
        try {
            $test->run();
            $this->assertTrue(TRUE);
        } catch(Exception $ex) {
            $this->assertTrue(FALSE);
        }
    }
}

?>


text:
@once
@push('plugin-css')
    <link rel="stylesheet" href="{!! mix('/plugins/fileinput/bootstrap-fileinput.min.css', '/assets/vendor/boilerplate') !!}">
@endpush
@push('plugin-js')
    <script src="{!! mix('/plugins/fileinput/bootstrap-fileinput.min.js', '/assets/vendor/boilerplate') !!}"></script>
    <script src="/assets/vendor/boilerplate/plugins/fileinput/themes/fas/theme.min.js"></script>
    <script>$.fn.fileinput.defaults = $.extend({}, $.fn.fileinput.defaults, $.fn.fileinputThemes.fas);</script>
@if(App::getLocale() !== 'en')
    <script src="/assets/vendor/boilerplate/plugins/fileinput/locales/{{ App::getLocale() }}.js"></script>
    <script>$.fn.fileinput.defaults.language='{{ App::getLocale() }}';</script>
@endif
    <script>registerAsset('fileinput');</script>
@endpush
@endonce


text:
namespace JabbR.Models.Migrations
{
    using System.Data.Entity.Migrations;

    public partial class UserFlag : DbMigration
    {
        public override void Up()
        {
            AddColumn("ChatUsers", "Flag", c => c.String(maxLength: 2));
        }

        public override void Down()
        {
            DropColumn("ChatUsers", "Flag");
        }
    }
}


text:
{% extends "web/base.html" %}

{% block title %}Support{% endblock %}

{% block content %}

Support

IRC

    Join the Deis core developers and user community on the #deis
    IRC channel on freenode.net. All questions
    are welcome, and the core Deis developers make every effort to be available.

GitHub

    Request a new feature or report a bug to the Deis team as a
    GitHub issue. Deis
    has great test coverage, but we rely on you to help us find things to fix
    and ways to improve.

StackOverflow

    Questions about Deis, Docker, and PaaS systems in general receive expert
    answers from a large developer community at
    StackOverflow.

{% endblock %}


text:
package com.softserve.ita;

//import org.testng.annotations.Test;

public class OrderedTest {
	public void testC() {
		System.out.println("testC");
	}

	public void testB() {
		System.out.println("testB");
	}

	public void testA() {
		System.out.println("testA");
	}
}


text:
<?php
/**
 * ScreenRecordingPageView
 *
 * PHP version 5
 *
 * @category Class
 * @package  ultracart\v2
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * UltraCart Rest API V2
 *
 * UltraCart REST API Version 2
 *
 * OpenAPI spec version: 2.0.0
 * Contact: support@ultracart.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 2.4.15-SNAPSHOT
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

namespace ultracart\v2\models;

use \ArrayAccess;
use \ultracart\v2\ObjectSerializer;

/**
 * ScreenRecordingPageView Class Doc Comment
 *
 * @category Class
 * @package  ultracart\v2
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class ScreenRecordingPageView implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $swaggerModelName = 'ScreenRecordingPageView';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'domain' => 'string',
        'events' => '\ultracart\v2\models\ScreenRecordingPageViewEvent[]',
        'first_event_timestamp' => 'string',
        'http_post' => 'bool',
        'last_event_timestamp' => 'string',
        'missing_events' => 'bool',
        'params' => '\ultracart\v2\models\ScreenRecordingPageViewParameter[]',
        'range_end' => 'int',
        'range_start' => 'int',
        'referrer' => 'string',
        'referrer_params' => '\ultracart\v2\models\ScreenRecordingPageViewParameter[]',
        'referrer_raw' => 'string',
        'screen_recording_page_view_uuid' => 'string',
        'time_on_page' => 'int',
        'timing_dom_content_loaded' => 'int',
        'timing_loaded' => 'int',
        'truncated_events' => 'bool',
        'ucapv' => 'string',
        'url' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'domain' => null,
        'events' => null,
        'first_event_timestamp' => 'dateTime',
        'http_post' => null,
        'last_event_timestamp' => 'dateTime',
        'missing_events' => null,
        'params' => null,
        'range_end' => 'int32',
        'range_start' => 'int32',
        'referrer' => null,
        'referrer_params' => null,
        'referrer_raw' => null,
        'screen_recording_page_view_uuid' => null,
        'time_on_page' => 'int32',
        'timing_dom_content_loaded' => 'int32',
        'timing_loaded' => 'int32',
        'truncated_events' => null,
        'ucapv' => null,
        'url' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerTypes()
    {
        return self::$swaggerTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerFormats()
    {
        return self::$swaggerFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'domain' => 'domain',
        'events' => 'events',
        'first_event_timestamp' => 'first_event_timestamp',
        'http_post' => 'http_post',
        'last_event_timestamp' => 'last_event_timestamp',
        'missing_events' => 'missing_events',
        'params' => 'params',
        'range_end' => 'range_end',
        'range_start' => 'range_start',
        'referrer' => 'referrer',
        'referrer_params' => 'referrer_params',
        'referrer_raw' => 'referrer_raw',
        'screen_recording_page_view_uuid' => 'screen_recording_page_view_uuid',
        'time_on_page' => 'time_on_page',
        'timing_dom_content_loaded' => 'timing_dom_content_loaded',
        'timing_loaded' => 'timing_loaded',
        'truncated_events' => 'truncated_events',
        'ucapv' => 'ucapv',
        'url' => 'url'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'domain' => 'setDomain',
        'events' => 'setEvents',
        'first_event_timestamp' => 'setFirstEventTimestamp',
        'http_post' => 'setHttpPost',
        'last_event_timestamp' => 'setLastEventTimestamp',
        'missing_events' => 'setMissingEvents',
        'params' => 'setParams',
        'range_end' => 'setRangeEnd',
        'range_start' => 'setRangeStart',
        'referrer' => 'setReferrer',
        'referrer_params' => 'setReferrerParams',
        'referrer_raw' => 'setReferrerRaw',
        'screen_recording_page_view_uuid' => 'setScreenRecordingPageViewUuid',
        'time_on_page' => 'setTimeOnPage',
        'timing_dom_content_loaded' => 'setTimingDomContentLoaded',
        'timing_loaded' => 'setTimingLoaded',
        'truncated_events' => 'setTruncatedEvents',
        'ucapv' => 'setUcapv',
        'url' => 'setUrl'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'domain' => 'getDomain',
        'events' => 'getEvents',
        'first_event_timestamp' => 'getFirstEventTimestamp',
        'http_post' => 'getHttpPost',
        'last_event_timestamp' => 'getLastEventTimestamp',
        'missing_events' => 'getMissingEvents',
        'params' => 'getParams',
        'range_end' => 'getRangeEnd',
        'range_start' => 'getRangeStart',
        'referrer' => 'getReferrer',
        'referrer_params' => 'getReferrerParams',
        'referrer_raw' => 'getReferrerRaw',
        'screen_recording_page_view_uuid' => 'getScreenRecordingPageViewUuid',
        'time_on_page' => 'getTimeOnPage',
        'timing_dom_content_loaded' => 'getTimingDomContentLoaded',
        'timing_loaded' => 'getTimingLoaded',
        'truncated_events' => 'getTruncatedEvents',
        'ucapv' => 'getUcapv',
        'url' => 'getUrl'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$swaggerModelName;
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['domain'] = isset($data['domain']) ? $data['domain'] : null;
        $this->container['events'] = isset($data['events']) ? $data['events'] : null;
        $this->container['first_event_timestamp'] = isset($data['first_event_timestamp']) ? $data['first_event_timestamp'] : null;
        $this->container['http_post'] = isset($data['http_post']) ? $data['http_post'] : null;
        $this->container['last_event_timestamp'] = isset($data['last_event_timestamp']) ? $data['last_event_timestamp'] : null;
        $this->container['missing_events'] = isset($data['missing_events']) ? $data['missing_events'] : null;
        $this->container['params'] = isset($data['params']) ? $data['params'] : null;
        $this->container['range_end'] = isset($data['range_end']) ? $data['range_end'] : null;
        $this->container['range_start'] = isset($data['range_start']) ? $data['range_start'] : null;
        $this->container['referrer'] = isset($data['referrer']) ? $data['referrer'] : null;
        $this->container['referrer_params'] = isset($data['referrer_params']) ? $data['referrer_params'] : null;
        $this->container['referrer_raw'] = isset($data['referrer_raw']) ? $data['referrer_raw'] : null;
        $this->container['screen_recording_page_view_uuid'] = isset($data['screen_recording_page_view_uuid']) ? $data['screen_recording_page_view_uuid'] : null;
        $this->container['time_on_page'] = isset($data['time_on_page']) ? $data['time_on_page'] : null;
        $this->container['timing_dom_content_loaded'] = isset($data['timing_dom_content_loaded']) ? $data['timing_dom_content_loaded'] : null;
        $this->container['timing_loaded'] = isset($data['timing_loaded']) ? $data['timing_loaded'] : null;
        $this->container['truncated_events'] = isset($data['truncated_events']) ? $data['truncated_events'] : null;
        $this->container['ucapv'] = isset($data['ucapv']) ? $data['ucapv'] : null;
        $this->container['url'] = isset($data['url']) ? $data['url'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }

    /**
     * Gets domain
     *
     * @return string
     */
    public function getDomain()
    {
        return $this->container['domain'];
    }

    /**
     * Sets domain
     *
     * @param string $domain domain
     *
     * @return $this
     */
    public function setDomain($domain)
    {
        $this->container['domain'] = $domain;

        return $this;
    }

    /**
     * Gets events
     *
     * @return \ultracart\v2\models\ScreenRecordingPageViewEvent[]
     */
    public function getEvents()
    {
        return $this->container['events'];
    }

    /**
     * Sets events
     *
     * @param \ultracart\v2\models\ScreenRecordingPageViewEvent[] $events events
     *
     * @return $this
     */
    public function setEvents($events)
    {
        $this->container['events'] = $events;

        return $this;
    }

    /**
     * Gets first_event_timestamp
     *
     * @return string
     */
    public function getFirstEventTimestamp()
    {
        return $this->container['first_event_timestamp'];
    }

    /**
     * Sets first_event_timestamp
     *
     * @param string $first_event_timestamp First event timestamp
     *
     * @return $this
     */
    public function setFirstEventTimestamp($first_event_timestamp)
    {
        $this->container['first_event_timestamp'] = $first_event_timestamp;

        return $this;
    }

    /**
     * Gets http_post
     *
     * @return bool
     */
    public function getHttpPost()
    {
        return $this->container['http_post'];
    }

    /**
     * Sets http_post
     *
     * @param bool $http_post http_post
     *
     * @return $this
     */
    public function setHttpPost($http_post)
    {
        $this->container['http_post'] = $http_post;

        return $this;
    }

    /**
     * Gets last_event_timestamp
     *
     * @return string
     */
    public function getLastEventTimestamp()
    {
        return $this->container['last_event_timestamp'];
    }

    /**
     * Sets last_event_timestamp
     *
     * @param string $last_event_timestamp Last event timestamp
     *
     * @return $this
     */
    public function setLastEventTimestamp($last_event_timestamp)
    {
        $this->container['last_event_timestamp'] = $last_event_timestamp;

        return $this;
    }

    /**
     * Gets missing_events
     *
     * @return bool
     */
    public function getMissingEvents()
    {
        return $this->container['missing_events'];
    }

    /**
     * Sets missing_events
     *
     * @param bool $missing_events missing_events
     *
     * @return $this
     */
    public function setMissingEvents($missing_events)
    {
        $this->container['missing_events'] = $missing_events;

        return $this;
    }

    /**
     * Gets params
     *
     * @return \ultracart\v2\models\ScreenRecordingPageViewParameter[]
     */
    public function getParams()
    {
        return $this->container['params'];
    }

    /**
     * Sets params
     *
     * @param \ultracart\v2\models\ScreenRecordingPageViewParameter[] $params params
     *
     * @return $this
     */
    public function setParams($params)
    {
        $this->container['params'] = $params;

        return $this;
    }

    /**
     * Gets range_end
     *
     * @return int
     */
    public function getRangeEnd()
    {
        return $this->container['range_end'];
    }

    /**
     * Sets range_end
     *
     * @param int $range_end range_end
     *
     * @return $this
     */
    public function setRangeEnd($range_end)
    {
        $this->container['range_end'] = $range_end;

        return $this;
    }

    /**
     * Gets range_start
     *
     * @return int
     */
    public function getRangeStart()
    {
        return $this->container['range_start'];
    }

    /**
     * Sets range_start
     *
     * @param int $range_start range_start
     *
     * @return $this
     */
    public function setRangeStart($range_start)
    {
        $this->container['range_start'] = $range_start;

        return $this;
    }

    /**
     * Gets referrer
     *
     * @return string
     */
    public function getReferrer()
    {
        return $this->container['referrer'];
    }

    /**
     * Sets referrer
     *
     * @param string $referrer referrer
     *
     * @return $this
     */
    public function setReferrer($referrer)
    {
        $this->container['referrer'] = $referrer;

        return $this;
    }

    /**
     * Gets referrer_params
     *
     * @return \ultracart\v2\models\ScreenRecordingPageViewParameter[]
     */
    public function getReferrerParams()
    {
        return $this->container['referrer_params'];
    }

    /**
     * Sets referrer_params
     *
     * @param \ultracart\v2\models\ScreenRecordingPageViewParameter[] $referrer_params referrer_params
     *
     * @return $this
     */
    public function setReferrerParams($referrer_params)
    {
        $this->container['referrer_params'] = $referrer_params;

        return $this;
    }

    /**
     * Gets referrer_raw
     *
     * @return string
     */
    public function getReferrerRaw()
    {
        return $this->container['referrer_raw'];
    }

    /**
     * Sets referrer_raw
     *
     * @param string $referrer_raw referrer_raw
     *
     * @return $this
     */
    public function setReferrerRaw($referrer_raw)
    {
        $this->container['referrer_raw'] = $referrer_raw;

        return $this;
    }

    /**
     * Gets screen_recording_page_view_uuid
     *
     * @return string
     */
    public function getScreenRecordingPageViewUuid()
    {
        return $this->container['screen_recording_page_view_uuid'];
    }

    /**
     * Sets screen_recording_page_view_uuid
     *
     * @param string $screen_recording_page_view_uuid screen_recording_page_view_uuid
     *
     * @return $this
     */
    public function setScreenRecordingPageViewUuid($screen_recording_page_view_uuid)
    {
        $this->container['screen_recording_page_view_uuid'] = $screen_recording_page_view_uuid;

        return $this;
    }

    /**
     * Gets time_on_page
     *
     * @return int
     */
    public function getTimeOnPage()
    {
        return $this->container['time_on_page'];
    }

    /**
     * Sets time_on_page
     *
     * @param int $time_on_page time_on_page
     *
     * @return $this
     */
    public function setTimeOnPage($time_on_page)
    {
        $this->container['time_on_page'] = $time_on_page;

        return $this;
    }

    /**
     * Gets timing_dom_content_loaded
     *
     * @return int
     */
    public function getTimingDomContentLoaded()
    {
        return $this->container['timing_dom_content_loaded'];
    }

    /**
     * Sets timing_dom_content_loaded
     *
     * @param int $timing_dom_content_loaded Amount of time for DOMContentLoaded event to fire (milliseconds)
     *
     * @return $this
     */
    public function setTimingDomContentLoaded($timing_dom_content_loaded)
    {
        $this->container['timing_dom_content_loaded'] = $timing_dom_content_loaded;

        return $this;
    }

    /**
     * Gets timing_loaded
     *
     * @return int
     */
    public function getTimingLoaded()
    {
        return $this->container['timing_loaded'];
    }

    /**
     * Sets timing_loaded
     *
     * @param int $timing_loaded Amount of time for loaded event to fire (milliseconds)
     *
     * @return $this
     */
    public function setTimingLoaded($timing_loaded)
    {
        $this->container['timing_loaded'] = $timing_loaded;

        return $this;
    }

    /**
     * Gets truncated_events
     *
     * @return bool
     */
    public function getTruncatedEvents()
    {
        return $this->container['truncated_events'];
    }

    /**
     * Sets truncated_events
     *
     * @param bool $truncated_events truncated_events
     *
     * @return $this
     */
    public function setTruncatedEvents($truncated_events)
    {
        $this->container['truncated_events'] = $truncated_events;

        return $this;
    }

    /**
     * Gets ucapv
     *
     * @return string
     */
    public function getUcapv()
    {
        return $this->container['ucapv'];
    }

    /**
     * Sets ucapv
     *
     * @param string $ucapv ucapv
     *
     * @return $this
     */
    public function setUcapv($ucapv)
    {
        $this->container['ucapv'] = $ucapv;

        return $this;
    }

    /**
     * Gets url
     *
     * @return string
     */
    public function getUrl()
    {
        return $this->container['url'];
    }

    /**
     * Sets url
     *
     * @param string $url url
     *
     * @return $this
     */
    public function setUrl($url)
    {
        $this->container['url'] = $url;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}


text:
{% extends path+"/_layout-case.html" %}

{% block citizen_content %}

    {# macro #}
  {{ nav.case_tabs("timeline",1,path1, customer._id) }}

          {% if data['newevidencename'] %}

{{ data['newevidencename'] }} - medical evidence recorded

{{customer.fmeRequestedDate | formatDate("D MMMM YYYY") }}

      {% endif %}

{% if customer.status == "fme" %}

{% if data['telephonecontactreport']%}

Telephone conversation - medical evidence recorded

{{customer.fmeRequestedDate | formatDate("D MMMM YYYY") }}

{% endif %}

{% if customer.fmeType.indexOf("FRR") > -1 or customer.fmeType == 'Factual report'%}
{% if data['recordevidencefrr']==='frr'%}

Factual report - medical evidence recorded

{{customer.fmeRequestedDate | formatDate("D MMMM YYYY") }}

{% endif %}

 Factual report - medical evidence requested

{{customer.fmeRequestedDate | formatDate("D MMMM YYYY") }}

{% endif %}

{% if customer.fmeType.indexOf("113") > -1 or  customer.fmeType.indexOf("113visited") > -1 or customer.fmeType == 'GP Report'%}
{% if data['recordevidencegp']==='gp'%}

GP report - medical evidence recieved

{{customer.fmeRequestedDate | formatDate("D MMMM YYYY") }}

  {% endif %}

GP Report - medical evidence requested

{{customer.fmeRequestedDate | formatDate("D MMMM YYYY") }}

{% endif %}

{% endif %}

Med 3 - medical evidence recieved

10 August 2018

UC50 form received

10 August 2018

UC50 form sent out to {{customer.name.first}}

19 July 2018

New referral created

17 July 2018

{% endblock %}

{# {% block page_script %}

{% endblock %} #}


text:
import { Request } from '@graphql-tools/utils';
import { Transform, DelegationContext } from '../types';
export default class AddTypenameToAbstract implements Transform {
    transformRequest(originalRequest: Request, delegationContext: DelegationContext, _transformationContext: Record<string, any>): Request;
}


text:
using System;
using System.Xml;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;

namespace MyMeta
{
#if ENTERPRISE
	using System.Runtime.InteropServices;
	[ComVisible(false), ClassInterface(ClassInterfaceType.AutoDual)]
#endif
	public class Procedures : Collection, IProcedures, IEnumerable, ICollection
	{
		public Procedures()
		{

		}

		#region XML User Data

#if ENTERPRISE
		[ComVisible(false)]
#endif
		override public string UserDataXPath
		{
			get
			{
				return Database.UserDataXPath + @"/Procedures";
			}
		}

#if ENTERPRISE
		[ComVisible(false)]
#endif
		override internal bool GetXmlNode(out XmlNode node, bool forceCreate)
		{
			node = null;
			bool success = false;

			if(null == _xmlNode)
			{
				// Get the parent node
				XmlNode parentNode = null;
				if(this.Database.GetXmlNode(out parentNode, forceCreate))
				{
					// See if our user data already exists
					string xPath = @"./Procedures";
					if(!GetUserData(xPath, parentNode, out _xmlNode) && forceCreate)
					{
						// Create it, and try again
						this.CreateUserMetaData(parentNode);
						GetUserData(xPath, parentNode, out _xmlNode);
					}
				}
			}

			if(null != _xmlNode)
			{
				node = _xmlNode;
				success = true;
			}

			return success;
		}

#if ENTERPRISE
		[ComVisible(false)]
#endif
		override public void CreateUserMetaData(XmlNode parentNode)
		{
			XmlNode myNode = parentNode.OwnerDocument.CreateNode(XmlNodeType.Element, "Procedures", null);
			parentNode.AppendChild(myNode);
		}

		#endregion

		internal DataColumn f_Catalog				= null;
		internal DataColumn f_Schema				= null;
		internal DataColumn f_Name					= null;
		internal DataColumn f_Type					= null;
		internal DataColumn f_ProcedureDefinition	= null;
		internal DataColumn f_Description			= null;
		internal DataColumn f_DateCreated			= null;
		internal DataColumn f_DateModified			= null;

		private void BindToColumns(DataTable metaData)
		{
			if(false == _fieldsBound)
			{
				if(metaData.Columns.Contains("PROCEDURE_CATALOG"))		f_Catalog				= metaData.Columns["PROCEDURE_CATALOG"];
				if(metaData.Columns.Contains("PROCEDURE_SCHEMA"))		f_Schema				= metaData.Columns["PROCEDURE_SCHEMA"];
				if(metaData.Columns.Contains("PROCEDURE_NAME"))			f_Name					= metaData.Columns["PROCEDURE_NAME"];
				if(metaData.Columns.Contains("PROCEDURE_TYPE"))			f_Type					= metaData.Columns["PROCEDURE_TYPE"];
				if(metaData.Columns.Contains("PROCEDURE_DEFINITION"))	f_ProcedureDefinition	= metaData.Columns["PROCEDURE_DEFINITION"];
				if(metaData.Columns.Contains("DESCRIPTION"))			f_Description			= metaData.Columns["DESCRIPTION"];
				if(metaData.Columns.Contains("DATE_CREATED"))			f_DateCreated			= metaData.Columns["DATE_CREATED"];
				if(metaData.Columns.Contains("DATE_MODIFIED"))			f_DateModified			= metaData.Columns["DATE_MODIFIED"];

			}
		}

		internal virtual void LoadAll()
		{

		}

		internal void PopulateArray(DataTable metaData)
		{
			BindToColumns(metaData);

			Procedure procedure = null;

			int count = metaData.Rows.Count;
			for(int i = 0; i < count; i++)
			{
				procedure = (Procedure)this.dbRoot.ClassFactory.CreateProcedure();
				procedure.dbRoot = this.dbRoot;
				procedure.Procedures = this;
				procedure.Row = metaData.Rows[i];
				this._array.Add(procedure);
			}
		}

		internal void AddProcedure(Procedure procedure)
		{
			this._array.Add(procedure);
		}

		#region indexers

		virtual public IProcedure this[object index]
		{
			get
			{
				if(index.GetType() == Type.GetType("System.String"))
				{
					return GetByPhysicalName(index as String);
				}
				else
				{
					int idx = Convert.ToInt32(index);
					return this._array[idx] as Procedure;
				}
			}
		}

#if ENTERPRISE
		[ComVisible(false)]
#endif
		public Procedure GetByName(string name)
		{
			Procedure obj = null;
			Procedure tmp = null;

			int count = this._array.Count;
			for(int i = 0; i < count; i++)
			{
				tmp = this._array[i] as Procedure;

				if(this.CompareStrings(name,tmp.Name))
				{
					obj = tmp;
					break;
				}
			}

			return obj;
		}

#if ENTERPRISE
		[ComVisible(false)]
#endif
		public Procedure GetByPhysicalName(string name)
		{
			Procedure obj = null;
			Procedure tmp = null;

			int count = this._array.Count;
			for(int i = 0; i < count; i++)
			{
				tmp = this._array[i] as Procedure;

				if(this.CompareStrings(name,tmp.Name))
				{
					obj = tmp;
					break;
				}
			}

			return obj;
		}

		#endregion

        #region IEnumerable Members

        IEnumerator IEnumerable.GetEnumerator() {
            return GetEnumerator();
        }

        #endregion

        #region IEnumerable<IProcedure> Members

        public IEnumerator<IProcedure> GetEnumerator() {
            foreach (object item in _array)
                yield return item as IProcedure;
        }

        #endregion

		#region IList Members

		object System.Collections.IList.this[int index]
		{
			get	{ return this[index];}
			set	{ }
		}

		#endregion

		internal Database Database = null;

    }
}


text:
import time

import testtools

from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
from tempest import config
from tempest import exceptions
from tempest.test import attr
from tempest.test import skip_because

CONF = config.CONF

class ServerActionsV3Test(base.BaseV3ComputeTest):
    _interface = 'json'
    resize_available = CONF.compute_feature_enabled.resize
    run_ssh = CONF.compute.run_ssh

    def setUp(self):
        # NOTE(afazekas): Normally we use the same server with all test cases,
        # but if it has an issue, we build a new one
        super(ServerActionsV3Test, self).setUp()
        # Check if the server is in a clean state after test
        try:
            self.client.wait_for_server_status(self.server_id, 'ACTIVE')
        except Exception:
            # Rebuild server if something happened to it during a test
            self.__class__.server_id = self.rebuild_server(self.server_id)

    @classmethod
    def setUpClass(cls):
        super(ServerActionsV3Test, cls).setUpClass()
        cls.client = cls.servers_client
        cls.server_id = cls.rebuild_server(None)

    @testtools.skipUnless(CONF.compute_feature_enabled.change_password,
                          'Change password not available.')
    @attr(type='gate')
    def test_change_server_password(self):
        # The server's password should be set to the provided password
        new_password = 'Newpass1234'
        resp, body = self.client.change_password(self.server_id, new_password)
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'ACTIVE')

        if self.run_ssh:
            # Verify that the user can authenticate with the new password
            resp, server = self.client.get_server(self.server_id)
            linux_client = RemoteClient(server, self.ssh_user, new_password)
            linux_client.validate_authentication()

    @attr(type='smoke')
    def test_reboot_server_hard(self):
        # The server should be power cycled
        if self.run_ssh:
            # Get the time the server was last rebooted,
            resp, server = self.client.get_server(self.server_id)
            linux_client = RemoteClient(server, self.ssh_user, self.password)
            boot_time = linux_client.get_boot_time()

        resp, body = self.client.reboot(self.server_id, 'HARD')
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'ACTIVE')

        if self.run_ssh:
            # Log in and verify the boot time has changed
            linux_client = RemoteClient(server, self.ssh_user, self.password)
            new_boot_time = linux_client.get_boot_time()
            self.assertGreater(new_boot_time, boot_time)

    @skip_because(bug="1014647")
    @attr(type='smoke')
    def test_reboot_server_soft(self):
        # The server should be signaled to reboot gracefully
        if self.run_ssh:
            # Get the time the server was last rebooted,
            resp, server = self.client.get_server(self.server_id)
            linux_client = RemoteClient(server, self.ssh_user, self.password)
            boot_time = linux_client.get_boot_time()

        resp, body = self.client.reboot(self.server_id, 'SOFT')
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'ACTIVE')

        if self.run_ssh:
            # Log in and verify the boot time has changed
            linux_client = RemoteClient(server, self.ssh_user, self.password)
            new_boot_time = linux_client.get_boot_time()
            self.assertGreater(new_boot_time, boot_time)

    @attr(type='smoke')
    def test_rebuild_server(self):
        # The server should be rebuilt using the provided image and data
        meta = {'rebuild': 'server'}
        new_name = data_utils.rand_name('server')
        password = 'rebuildPassw0rd'
        resp, rebuilt_server = self.client.rebuild(self.server_id,
                                                   self.image_ref_alt,
                                                   name=new_name,
                                                   metadata=meta,
                                                   admin_password=password)
        self.addCleanup(self.client.rebuild, self.server_id, self.image_ref)

        # Verify the properties in the initial response are correct
        self.assertEqual(self.server_id, rebuilt_server['id'])
        rebuilt_image_id = rebuilt_server['image']['id']
        self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
        self.assertEqual(self.flavor_ref, rebuilt_server['flavor']['id'])

        # Verify the server properties after the rebuild completes
        self.client.wait_for_server_status(rebuilt_server['id'], 'ACTIVE')
        resp, server = self.client.get_server(rebuilt_server['id'])
        rebuilt_image_id = server['image']['id']
        self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
        self.assertEqual(new_name, server['name'])

        if self.run_ssh:
            # Verify that the user can authenticate with the provided password
            linux_client = RemoteClient(server, self.ssh_user, password)
            linux_client.validate_authentication()

    @attr(type='gate')
    def test_rebuild_server_in_stop_state(self):
        # The server in stop state  should be rebuilt using the provided
        # image and remain in SHUTOFF state
        resp, server = self.client.get_server(self.server_id)
        old_image = server['image']['id']
        new_image = self.image_ref_alt \
            if old_image == self.image_ref else self.image_ref
        resp, server = self.client.stop(self.server_id)
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'SHUTOFF')
        self.addCleanup(self.client.start, self.server_id)
        resp, rebuilt_server = self.client.rebuild(self.server_id, new_image)
        self.addCleanup(self.client.wait_for_server_status, self.server_id,
                        'SHUTOFF')
        self.addCleanup(self.client.rebuild, self.server_id, old_image)

        # Verify the properties in the initial response are correct
        self.assertEqual(self.server_id, rebuilt_server['id'])
        rebuilt_image_id = rebuilt_server['image']['id']
        self.assertEqual(new_image, rebuilt_image_id)
        self.assertEqual(self.flavor_ref, rebuilt_server['flavor']['id'])

        # Verify the server properties after the rebuild completes
        self.client.wait_for_server_status(rebuilt_server['id'], 'SHUTOFF')
        resp, server = self.client.get_server(rebuilt_server['id'])
        rebuilt_image_id = server['image']['id']
        self.assertEqual(new_image, rebuilt_image_id)

    def _detect_server_image_flavor(self, server_id):
        # Detects the current server image flavor ref.
        resp, server = self.client.get_server(server_id)
        current_flavor = server['flavor']['id']
        new_flavor_ref = self.flavor_ref_alt \
            if current_flavor == self.flavor_ref else self.flavor_ref
        return current_flavor, new_flavor_ref

    @testtools.skipIf(not resize_available, 'Resize not available.')
    @attr(type='smoke')
    def test_resize_server_confirm(self):
        # The server's RAM and disk space should be modified to that of
        # the provided flavor

        previous_flavor_ref, new_flavor_ref = \
            self._detect_server_image_flavor(self.server_id)

        resp, server = self.client.resize(self.server_id, new_flavor_ref)
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')

        self.client.confirm_resize(self.server_id)
        self.client.wait_for_server_status(self.server_id, 'ACTIVE')

        resp, server = self.client.get_server(self.server_id)
        self.assertEqual(new_flavor_ref, server['flavor']['id'])

    @testtools.skipIf(not resize_available, 'Resize not available.')
    @attr(type='gate')
    def test_resize_server_revert(self):
        # The server's RAM and disk space should return to its original
        # values after a resize is reverted

        previous_flavor_ref, new_flavor_ref = \
            self._detect_server_image_flavor(self.server_id)

        resp, server = self.client.resize(self.server_id, new_flavor_ref)
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')

        self.client.revert_resize(self.server_id)
        self.client.wait_for_server_status(self.server_id, 'ACTIVE')

        # Need to poll for the id change until lp#924371 is fixed
        resp, server = self.client.get_server(self.server_id)
        start = int(time.time())

        while server['flavor']['id'] != previous_flavor_ref:
            time.sleep(self.build_interval)
            resp, server = self.client.get_server(self.server_id)

            if int(time.time()) - start >= self.build_timeout:
                message = 'Server %s failed to revert resize within the \
                required time (%s s).' % (self.server_id, self.build_timeout)
                raise exceptions.TimeoutException(message)

    @attr(type='gate')
    def test_create_backup(self):
        # Positive test:create backup successfully and rotate backups correctly
        # create the first and the second backup
        backup1 = data_utils.rand_name('backup-1')
        resp, _ = self.servers_client.create_backup(self.server_id,
                                                    'daily',
                                                    2,
                                                    backup1)
        oldest_backup_exist = True

        # the oldest one should be deleted automatically in this test
        def _clean_oldest_backup(oldest_backup):
            if oldest_backup_exist:
                self.images_client.delete_image(oldest_backup)

        image1_id = data_utils.parse_image_id(resp['location'])
        self.addCleanup(_clean_oldest_backup, image1_id)
        self.assertEqual(202, resp.status)
        self.images_client.wait_for_image_status(image1_id, 'active')

        backup2 = data_utils.rand_name('backup-2')
        self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
        resp, _ = self.servers_client.create_backup(self.server_id,
                                                    'daily',
                                                    2,
                                                    backup2)
        image2_id = data_utils.parse_image_id(resp['location'])
        self.addCleanup(self.images_client.delete_image, image2_id)
        self.assertEqual(202, resp.status)
        self.images_client.wait_for_image_status(image2_id, 'active')

        # verify they have been created
        properties = {
            'image_type': 'backup',
            'backup_type': "daily",
            'instance_uuid': self.server_id,
        }
        resp, image_list = self.images_client.image_list_detail(
            properties,
            sort_key='created_at',
            sort_dir='asc')
        self.assertEqual(200, resp.status)
        self.assertEqual(2, len(image_list))
        self.assertEqual((backup1, backup2),
                         (image_list[0]['name'], image_list[1]['name']))

        # create the third one, due to the rotation is 2,
        # the first one will be deleted
        backup3 = data_utils.rand_name('backup-3')
        self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
        resp, _ = self.servers_client.create_backup(self.server_id,
                                                    'daily',
                                                    2,
                                                    backup3)
        image3_id = data_utils.parse_image_id(resp['location'])
        self.addCleanup(self.images_client.delete_image, image3_id)
        self.assertEqual(202, resp.status)
        # the first back up should be deleted
        self.images_client.wait_for_resource_deletion(image1_id)
        oldest_backup_exist = False
        resp, image_list = self.images_client.image_list_detail(
            properties,
            sort_key='created_at',
            sort_dir='asc')
        self.assertEqual(200, resp.status)
        self.assertEqual(2, len(image_list),
                         'Unexpected number of images for '
                         'v3:test_create_backup; was the oldest backup not '
                         'yet deleted? Image list: %s' %
                         [image['name'] for image in image_list])
        self.assertEqual((backup2, backup3),
                         (image_list[0]['name'], image_list[1]['name']))

    def _get_output(self):
        resp, output = self.servers_client.get_console_output(
            self.server_id, 10)
        self.assertEqual(200, resp.status)
        self.assertTrue(output, "Console output was empty.")
        lines = len(output.split('\n'))
        self.assertEqual(lines, 10)

    @attr(type='gate')
    def test_get_console_output(self):
        # Positive test:Should be able to GET the console output
        # for a given server_id and number of lines

        # This reboot is necessary for outputting some console log after
        # creating a instance backup. If a instance backup, the console
        # log file is truncated and we cannot get any console log through
        # "console-log" API.
        # The detail is https://bugs.launchpad.net/nova/+bug/1251920
        resp, body = self.servers_client.reboot(self.server_id, 'HARD')
        self.assertEqual(202, resp.status)
        self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')

        self.wait_for(self._get_output)

    @attr(type='gate')
    def test_get_console_output_server_id_in_shutoff_status(self):
        # Positive test:Should be able to GET the console output
        # for a given server_id in SHUTOFF status

        # NOTE: SHUTOFF is irregular status. To avoid test instability,
        #       one server is created only for this test without using
        #       the server that was created in setupClass.
        resp, server = self.create_test_server(wait_until='ACTIVE')
        temp_server_id = server['id']

        resp, server = self.servers_client.stop(temp_server_id)
        self.assertEqual(202, resp.status)
        self.servers_client.wait_for_server_status(temp_server_id, 'SHUTOFF')

        self.wait_for(self._get_output)

    @attr(type='gate')
    def test_pause_unpause_server(self):
        resp, server = self.client.pause_server(self.server_id)
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'PAUSED')
        resp, server = self.client.unpause_server(self.server_id)
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'ACTIVE')

    @attr(type='gate')
    def test_suspend_resume_server(self):
        resp, server = self.client.suspend_server(self.server_id)
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'SUSPENDED')
        resp, server = self.client.resume_server(self.server_id)
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'ACTIVE')

    @attr(type='gate')
    def test_shelve_unshelve_server(self):
        resp, server = self.client.shelve_server(self.server_id)
        self.assertEqual(202, resp.status)

        offload_time = CONF.compute.shelved_offload_time
        if offload_time >= 0:
            self.client.wait_for_server_status(self.server_id,
                                               'SHELVED_OFFLOADED',
                                               extra_timeout=offload_time)
        else:
            self.client.wait_for_server_status(self.server_id,
                                               'SHELVED')

        resp, server = self.client.get_server(self.server_id)
        image_name = server['name'] + '-shelved'
        resp, images = self.images_client.image_list(name=image_name)
        self.assertEqual(1, len(images))
        self.assertEqual(image_name, images[0]['name'])

        resp, server = self.client.unshelve_server(self.server_id)
        self.assertEqual(202, resp.status)
        self.client.wait_for_server_status(self.server_id, 'ACTIVE')

    @attr(type='gate')
    def test_stop_start_server(self):
        resp, server = self.servers_client.stop(self.server_id)
        self.assertEqual(202, resp.status)
        self.servers_client.wait_for_server_status(self.server_id, 'SHUTOFF')
        resp, server = self.servers_client.start(self.server_id)
        self.assertEqual(202, resp.status)
        self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')

    @attr(type='gate')
    def test_lock_unlock_server(self):
        # Lock the server,try server stop(exceptions throw),unlock it and retry
        resp, server = self.servers_client.lock_server(self.server_id)
        self.assertEqual(202, resp.status)
        resp, server = self.servers_client.get_server(self.server_id)
        self.assertEqual(200, resp.status)
        self.assertEqual(server['status'], 'ACTIVE')
        # Locked server is not allowed to be stopped by non-admin user
        self.assertRaises(exceptions.Conflict,
                          self.servers_client.stop, self.server_id)
        resp, server = self.servers_client.unlock_server(self.server_id)
        self.assertEqual(202, resp.status)
        resp, server = self.servers_client.stop(self.server_id)
        self.assertEqual(202, resp.status)
        self.servers_client.wait_for_server_status(self.server_id, 'SHUTOFF')
        resp, server = self.servers_client.start(self.server_id)
        self.assertEqual(202, resp.status)
        self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')


text:
import { PatchedPackageDetails } from "./PackageDetails"
import { join } from "./path"
import { existsSync } from "fs"

export function packageIsDevDependency({
  appPath,
  packageDetails,
}: {
  appPath: string
  packageDetails: PatchedPackageDetails
}) {
  const packageJsonPath = join(appPath, "package.json")
  if (!existsSync(packageJsonPath)) {
    return false
  }
  const { devDependencies } = require(packageJsonPath)
  return Boolean(devDependencies && devDependencies[packageDetails.packageNames[0]])
}


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.kenzap.servo"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="18" />
  	<uses-feature android:name="android.hardware.usb.host" />
    <uses-permission android:name="com.android.example.USB_PERMISSION" />
	<uses-permission android:name="android.permission.INTERNET"/>

    <application
	android:icon="@drawable/ic_launcher"
	android:allowBackup="true"

	android:label="@string/app_name" >
	<activity
	android:name=".MainActivity"
	android:label="@string/app_name"
	android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation"
	>
	<intent-filter>
	<action android:name="android.intent.action.MAIN" />
	<category android:name="android.intent.category.LAUNCHER" />
	</intent-filter>

	 		  <intent-filter>
			    <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
			  </intent-filter>
			  <meta-data
			      android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
			      android:resource="@xml/device_filter" />
	</activity>
	<activity
	android:name=".Instruct"
	android:label="@string/help"
	android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation"
	>
	</activity>
	</application>

</manifest>