text:
/*
 * Hibernate Validator, declare and validate application constraints
 *
 * License: Apache License, Version 2.0
 * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
 */
package org.hibernate.validator.internal.engine;

import java.time.Clock;

import jakarta.validation.ClockProvider;

/**
 * A default {@link ClockProvider} implementation which returns the current system time in the default time zone using
 * {@link Clock#systemDefaultZone()}.
 *
 * @author Guillaume Smet
 */
public class DefaultClockProvider implements ClockProvider {

	public static final DefaultClockProvider INSTANCE = new DefaultClockProvider();

	private DefaultClockProvider() {
	}

	@Override
	public Clock getClock() {
		return Clock.systemDefaultZone();
	}

}


text:
Release Procedure
=================

* Make sure version.py is at correct version
* Commit changes
* Tag release with e.g. release_0.5.1.0 and push to github.

::

    git commit -a
    git tag release_0.5.1.0
    git push && git push --tags

* [Check credentials in `~/.pypirc`]
* To upload to PyPI, run:

::

    python setup.py sdist upload

* To upload docs, run:

::

    cd docs
    make zip_html

* Then go to https://pypi.python.org/pypi?%3Aaction=pkg_edit&name=stormtracks and upload zip file.

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="right" >

        <TextView
            android:id="@+id/badge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/rounded"
            android:paddingLeft="6dp"
            android:paddingRight="6dp"
            android:text="empty"
            android:textColor="#FFFFFF" />

</LinearLayout>


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--

    Copyright 2003 - 2019 The eFaps Team

    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.

-->
<ui-command xmlns="http://www.efaps.org/xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.efaps.org/xsd http://www.efaps.org/xsd/eFaps_1.0.xsd">
    <uuid>26dba049-f74e-4559-a35e-35072ab347b0</uuid>
    <file-application>eFapsApp-POS</file-application>
    <definition>
        <version-expression>(version==latest)</version-expression>
        <name>POS_IndicationSetTree_Indication_Menu_Action_Delete</name>
        <target>
            <execute
                program="org.efaps.esjp.common.uitable.CommonDelete" />
        </target>
        <property name="AskUser">true</property>
        <property name="Submit">true</property>
    </definition>
</ui-command>


text:
package testutil

import (
	"fmt"
	"io/ioutil"
	"os"
	"path"

	"github.com/influxdata/telegraf/plugins/common/tls"
)

type pki struct {
	path string
}

func NewPKI(path string) *pki {
	return &pki{path: path}
}

func (p *pki) TLSClientConfig() *tls.ClientConfig {
	return &tls.ClientConfig{
		TLSCA:   p.CACertPath(),
		TLSCert: p.ClientCertPath(),
		TLSKey:  p.ClientKeyPath(),
	}
}

func (p *pki) TLSServerConfig() *tls.ServerConfig {
	return &tls.ServerConfig{
		TLSAllowedCACerts: []string{p.CACertPath()},
		TLSCert:           p.ServerCertPath(),
		TLSKey:            p.ServerKeyPath(),
		TLSCipherSuites:   []string{p.CipherSuite()},
		TLSMinVersion:     p.TLSMinVersion(),
		TLSMaxVersion:     p.TLSMaxVersion(),
	}
}

func (p *pki) ReadCACert() string {
	return readCertificate(p.CACertPath())
}

func (p *pki) CACertPath() string {
	return path.Join(p.path, "cacert.pem")
}

func (p *pki) CipherSuite() string {
	return "TLS_RSA_WITH_3DES_EDE_CBC_SHA"
}

func (p *pki) TLSMinVersion() string {
	return "TLS11"
}

func (p *pki) TLSMaxVersion() string {
	return "TLS12"
}

func (p *pki) ReadClientCert() string {
	return readCertificate(p.ClientCertPath())
}

func (p *pki) ClientCertPath() string {
	return path.Join(p.path, "clientcert.pem")
}

func (p *pki) ReadClientKey() string {
	return readCertificate(p.ClientKeyPath())
}

func (p *pki) ClientKeyPath() string {
	return path.Join(p.path, "clientkey.pem")
}

func (p *pki) ReadServerCert() string {
	return readCertificate(p.ServerCertPath())
}

func (p *pki) ServerCertPath() string {
	return path.Join(p.path, "servercert.pem")
}

func (p *pki) ReadServerKey() string {
	return readCertificate(p.ServerKeyPath())
}

func (p *pki) ServerKeyPath() string {
	return path.Join(p.path, "serverkey.pem")
}

func readCertificate(filename string) string {
	file, err := os.Open(filename)
	if err != nil {
		panic(fmt.Sprintf("opening %q: %v", filename, err))
	}
	octets, err := ioutil.ReadAll(file)
	if err != nil {
		panic(fmt.Sprintf("reading %q: %v", filename, err))
	}
	return string(octets)
}


text:
package fr.free.nrw.commons.upload;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AlertDialog;

import fr.free.nrw.commons.MWApi;
import org.mediawiki.api.ApiResult;

import java.io.IOException;
import java.util.ArrayList;

import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.contributions.ContributionsActivity;
import timber.log.Timber;

/**
 * Sends asynchronous queries to the Commons MediaWiki API to check that file doesn't already exist
 * Displays a warning to the user if the file already exists on Commons
 */
public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {

    private String fileSHA1;
    private Context context;

    public ExistingFileAsync(String fileSHA1, Context context) {
        this.fileSHA1 = fileSHA1;
        this.context = context;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected Boolean doInBackground(Void... voids) {
        MWApi api = CommonsApplication.getInstance().getMWApi();
        ApiResult result;

        // https://commons.wikimedia.org/w/api.php?action=query&list=allimages&format=xml&aisha1=801957214aba50cb63bb6eb1b0effa50188900ba
        try {
            result = api.action("query")
                    .param("format", "xml")
                    .param("list", "allimages")
                    .param("aisha1", fileSHA1)
                    .get();
            Timber.d("Searching Commons API for existing file: %s", result);
        } catch (IOException e) {
            Timber.e(e, "IO Exception: ");
            return false;
        }

        ArrayList<ApiResult> resultNodes = result.getNodes("/api/query/allimages/img");
        Timber.d("Result nodes: %s", resultNodes);

        boolean fileExists;
        if (!resultNodes.isEmpty()) {
            fileExists = true;
        } else {
            fileExists = false;
        }

        Timber.d("File already exists in Commons: %s", fileExists);
        return fileExists;
    }

    @Override
    protected void onPostExecute(Boolean fileExists) {
        super.onPostExecute(fileExists);

        // If file exists, display warning to user.
        // Use soft warning for now (user able to choose to proceed) until have determined that implementation works without bugs
        if (fileExists) {
            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.setMessage(R.string.file_exists)
                    .setTitle(R.string.warning);
            builder.setPositiveButton(R.string.no, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    //Go back to ContributionsActivity
                    Intent intent = new Intent(context, ContributionsActivity.class);
                    context.startActivity(intent);
                }
            });
            builder.setNegativeButton(R.string.yes, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    //No need to do anything, user remains on upload screen
                }
            });

            AlertDialog dialog = builder.create();
            dialog.show();
        }
    }
}


text:
import httpretty
import pytest
from h_matchers import Any

@pytest.fixture
def pyramid_settings():
    return {
        "client_embed_url": "http://hypothes.is/embed.js",
        "nginx_server": "http://via.hypothes.is",
        "via_html_url": "https://viahtml.hypothes.is/proxy",
        "checkmate_url": "http://localhost:9099",
        "nginx_secure_link_secret": "not_a_secret",
        "via_secret": "not_a_secret",
        "signed_urls_required": False,
        "checkmate_api_key": "dev_api_key",
        "checkmate_ignore_reasons": None,
        "checkmate_allow_all": False,
        "enable_front_page": True,
        "data_directory": "tests/data_directory",
    }

def assert_cache_control(headers, cache_parts):
    """Assert that all parts of the Cache-Control header are present."""
    assert dict(headers) == Any.dict.containing({"Cache-Control": Any.string()})
    assert (
        headers["Cache-Control"].split(", ") == Any.list.containing(cache_parts).only()
    )

@pytest.fixture(autouse=True)
def httpretty_():
    """Monkey-patch Python's socket core module to mock all HTTP responses.

    We never want real HTTP requests to be sent by the tests so replace them
    all with mock responses. This handles requests sent using the standard
    urllib2 library and the third-party httplib2 and requests libraries.
    """
    httpretty.enable(allow_net_connect=False)

    yield

    httpretty.disable()
    httpretty.reset()


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flowable.validation.validator.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.SubProcess;
import org.flowable.bpmn.model.ValuedDataObject;
import org.flowable.validation.ValidationError;
import org.flowable.validation.validator.Problems;
import org.flowable.validation.validator.ProcessLevelValidator;

/**
 * @author jbarrez
 */
public class DataObjectValidator extends ProcessLevelValidator {

    @Override
    protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) {

        // Gather data objects
        List<ValuedDataObject> allDataObjects = new ArrayList<>();
        allDataObjects.addAll(process.getDataObjects());
        List<SubProcess> subProcesses = process.findFlowElementsOfType(SubProcess.class, true);
        for (SubProcess subProcess : subProcesses) {
            allDataObjects.addAll(subProcess.getDataObjects());
        }

        // Validate
        for (ValuedDataObject dataObject : allDataObjects) {
            if (StringUtils.isEmpty(dataObject.getName())) {
                addError(errors, Problems.DATA_OBJECT_MISSING_NAME, process, dataObject, "Name is mandatory for a data object");
            }
        }

    }

}


text:
	<?php echo htmlentities($instructor[InstructorFetcher::DB_COLUMN_FIRST_NAME]); ?>
	<?php echo htmlentities($instructor[InstructorFetcher::DB_COLUMN_LAST_NAME]); ?>

		<input type="hidden" value="<?php echo $instructor[InstructorFetcher::DB_COLUMN_ID]; ?>"/>


text:
'use strict';

import Event, { Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import * as browser from 'vs/base/browser/browser';
import { CommonEditorConfiguration, IEnvConfiguration } from 'vs/editor/common/config/commonEditorConfig';
import { IDimension } from 'vs/editor/common/editorCommon';
import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo';
import { ElementSizeObserver } from 'vs/editor/browser/config/elementSizeObserver';
import { FastDomNode } from 'vs/base/browser/fastDomNode';
import { CharWidthRequest, CharWidthRequestType, readCharWidths } from 'vs/editor/browser/config/charWidthReader';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';

class CSSBasedConfigurationCache {

	private _keys: { [key: string]: BareFontInfo; };
	private _values: { [key: string]: FontInfo; };

	constructor() {
		this._keys = Object.create(null);
		this._values = Object.create(null);
	}

	public has(item: BareFontInfo): boolean {
		let itemId = item.getId();
		return !!this._values[itemId];
	}

	public get(item: BareFontInfo): FontInfo {
		let itemId = item.getId();
		return this._values[itemId];
	}

	public put(item: BareFontInfo, value: FontInfo): void {
		let itemId = item.getId();
		this._keys[itemId] = item;
		this._values[itemId] = value;
	}

	public remove(item: BareFontInfo): void {
		let itemId = item.getId();
		delete this._keys[itemId];
		delete this._values[itemId];
	}

	public getKeys(): BareFontInfo[] {
		return Object.keys(this._keys).map(id => this._keys[id]);
	}

	public getValues(): FontInfo[] {
		return Object.keys(this._keys).map(id => this._values[id]);
	}
}

export function readFontInfo(bareFontInfo: BareFontInfo): FontInfo {
	return CSSBasedConfiguration.INSTANCE.readConfiguration(bareFontInfo);
}

export function restoreFontInfo(storageService: IStorageService): void {
	let strStoredFontInfo = storageService.get('editorFontInfo', StorageScope.GLOBAL);
	if (typeof strStoredFontInfo !== 'string') {
		return;
	}
	let storedFontInfo: ISerializedFontInfo[] = null;
	try {
		storedFontInfo = JSON.parse(strStoredFontInfo);
	} catch (err) {
		return;
	}
	if (!Array.isArray(storedFontInfo)) {
		return;
	}
	CSSBasedConfiguration.INSTANCE.restoreFontInfo(storedFontInfo);
}

export function saveFontInfo(storageService: IStorageService): void {
	let knownFontInfo = CSSBasedConfiguration.INSTANCE.saveFontInfo();
	storageService.store('editorFontInfo', JSON.stringify(knownFontInfo), StorageScope.GLOBAL);
}

export interface ISerializedFontInfo {
	readonly zoomLevel: number;
	readonly fontFamily: string;
	readonly fontWeight: string;
	readonly fontSize: number;
	readonly lineHeight: number;
	readonly letterSpacing: number;
	readonly isMonospace: boolean;
	readonly typicalHalfwidthCharacterWidth: number;
	readonly typicalFullwidthCharacterWidth: number;
	readonly spaceWidth: number;
	readonly maxDigitWidth: number;
}

class CSSBasedConfiguration extends Disposable {

	public static INSTANCE = new CSSBasedConfiguration();

	private _cache: CSSBasedConfigurationCache;
	private _evictUntrustedReadingsTimeout: number;

	private _onDidChange = this._register(new Emitter<void>());
	public onDidChange: Event<void> = this._onDidChange.event;

	constructor() {
		super();

		this._cache = new CSSBasedConfigurationCache();
		this._evictUntrustedReadingsTimeout = -1;
	}

	public dispose(): void {
		if (this._evictUntrustedReadingsTimeout !== -1) {
			clearTimeout(this._evictUntrustedReadingsTimeout);
			this._evictUntrustedReadingsTimeout = -1;
		}
		super.dispose();
	}

	private _writeToCache(item: BareFontInfo, value: FontInfo): void {
		this._cache.put(item, value);

		if (!value.isTrusted && this._evictUntrustedReadingsTimeout === -1) {
			// Try reading again after some time
			this._evictUntrustedReadingsTimeout = setTimeout(() => {
				this._evictUntrustedReadingsTimeout = -1;
				this._evictUntrustedReadings();
			}, 5000);
		}
	}

	private _evictUntrustedReadings(): void {
		let values = this._cache.getValues();
		let somethingRemoved = false;
		for (let i = 0, len = values.length; i < len; i++) {
			let item = values[i];
			if (!item.isTrusted) {
				somethingRemoved = true;
				this._cache.remove(item);
			}
		}
		if (somethingRemoved) {
			this._onDidChange.fire();
		}
	}

	public saveFontInfo(): ISerializedFontInfo[] {
		// Only save trusted font info (that has been measured in this running instance)
		return this._cache.getValues().filter(item => item.isTrusted);
	}

	public restoreFontInfo(savedFontInfo: ISerializedFontInfo[]): void {
		// Take all the saved font info and insert them in the cache without the trusted flag.
		// The reason for this is that a font might have been installed on the OS in the meantime.
		for (let i = 0, len = savedFontInfo.length; i < len; i++) {
			let fontInfo = new FontInfo(savedFontInfo[i], false);
			this._writeToCache(fontInfo, fontInfo);
		}
	}

	public readConfiguration(bareFontInfo: BareFontInfo): FontInfo {
		if (!this._cache.has(bareFontInfo)) {
			let readConfig = CSSBasedConfiguration._actualReadConfiguration(bareFontInfo);

			if (readConfig.typicalHalfwidthCharacterWidth <= 2 || readConfig.typicalFullwidthCharacterWidth <= 2 || readConfig.spaceWidth <= 2 || readConfig.maxDigitWidth <= 2) {
				// Hey, it's Bug 14341 ... we couldn't read
				readConfig = new FontInfo({
					zoomLevel: browser.getZoomLevel(),
					fontFamily: readConfig.fontFamily,
					fontWeight: readConfig.fontWeight,
					fontSize: readConfig.fontSize,
					lineHeight: readConfig.lineHeight,
					letterSpacing: readConfig.letterSpacing,
					isMonospace: readConfig.isMonospace,
					typicalHalfwidthCharacterWidth: Math.max(readConfig.typicalHalfwidthCharacterWidth, 5),
					typicalFullwidthCharacterWidth: Math.max(readConfig.typicalFullwidthCharacterWidth, 5),
					spaceWidth: Math.max(readConfig.spaceWidth, 5),
					maxDigitWidth: Math.max(readConfig.maxDigitWidth, 5),
				}, false);
			}

			this._writeToCache(bareFontInfo, readConfig);
		}
		return this._cache.get(bareFontInfo);
	}

	private static createRequest(chr: string, type: CharWidthRequestType, all: CharWidthRequest[], monospace: CharWidthRequest[]): CharWidthRequest {
		let result = new CharWidthRequest(chr, type);
		all.push(result);
		if (monospace) {
			monospace.push(result);
		}
		return result;
	}

	private static _actualReadConfiguration(bareFontInfo: BareFontInfo): FontInfo {
		let all: CharWidthRequest[] = [];
		let monospace: CharWidthRequest[] = [];

		const typicalHalfwidthCharacter = this.createRequest('n', CharWidthRequestType.Regular, all, monospace);
		const typicalFullwidthCharacter = this.createRequest('\uff4d', CharWidthRequestType.Regular, all, null);
		const space = this.createRequest(' ', CharWidthRequestType.Regular, all, monospace);
		const digit0 = this.createRequest('0', CharWidthRequestType.Regular, all, monospace);
		const digit1 = this.createRequest('1', CharWidthRequestType.Regular, all, monospace);
		const digit2 = this.createRequest('2', CharWidthRequestType.Regular, all, monospace);
		const digit3 = this.createRequest('3', CharWidthRequestType.Regular, all, monospace);
		const digit4 = this.createRequest('4', CharWidthRequestType.Regular, all, monospace);
		const digit5 = this.createRequest('5', CharWidthRequestType.Regular, all, monospace);
		const digit6 = this.createRequest('6', CharWidthRequestType.Regular, all, monospace);
		const digit7 = this.createRequest('7', CharWidthRequestType.Regular, all, monospace);
		const digit8 = this.createRequest('8', CharWidthRequestType.Regular, all, monospace);
		const digit9 = this.createRequest('9', CharWidthRequestType.Regular, all, monospace);

		// monospace test: used for whitespace rendering
		this.createRequest('→', CharWidthRequestType.Regular, all, monospace);
		this.createRequest('·', CharWidthRequestType.Regular, all, monospace);

		// monospace test: some characters
		this.createRequest('|', CharWidthRequestType.Regular, all, monospace);
		this.createRequest('/', CharWidthRequestType.Regular, all, monospace);
		this.createRequest('-', CharWidthRequestType.Regular, all, monospace);
		this.createRequest('_', CharWidthRequestType.Regular, all, monospace);
		this.createRequest('i', CharWidthRequestType.Regular, all, monospace);
		this.createRequest('l', CharWidthRequestType.Regular, all, monospace);
		this.createRequest('m', CharWidthRequestType.Regular, all, monospace);

		// monospace italic test
		this.createRequest('|', CharWidthRequestType.Italic, all, monospace);
		this.createRequest('_', CharWidthRequestType.Italic, all, monospace);
		this.createRequest('i', CharWidthRequestType.Italic, all, monospace);
		this.createRequest('l', CharWidthRequestType.Italic, all, monospace);
		this.createRequest('m', CharWidthRequestType.Italic, all, monospace);
		this.createRequest('n', CharWidthRequestType.Italic, all, monospace);

		// monospace bold test
		this.createRequest('|', CharWidthRequestType.Bold, all, monospace);
		this.createRequest('_', CharWidthRequestType.Bold, all, monospace);
		this.createRequest('i', CharWidthRequestType.Bold, all, monospace);
		this.createRequest('l', CharWidthRequestType.Bold, all, monospace);
		this.createRequest('m', CharWidthRequestType.Bold, all, monospace);
		this.createRequest('n', CharWidthRequestType.Bold, all, monospace);

		readCharWidths(bareFontInfo, all);

		const maxDigitWidth = Math.max(digit0.width, digit1.width, digit2.width, digit3.width, digit4.width, digit5.width, digit6.width, digit7.width, digit8.width, digit9.width);

		let isMonospace = true;
		let referenceWidth = monospace[0].width;
		for (let i = 1, len = monospace.length; i < len; i++) {
			const diff = referenceWidth - monospace[i].width;
			if (diff < -0.001 || diff > 0.001) {
				isMonospace = false;
				break;
			}
		}

		// let's trust the zoom level only 2s after it was changed.
		const canTrustBrowserZoomLevel = (browser.getTimeSinceLastZoomLevelChanged() > 2000);
		return new FontInfo({
			zoomLevel: browser.getZoomLevel(),
			fontFamily: bareFontInfo.fontFamily,
			fontWeight: bareFontInfo.fontWeight,
			fontSize: bareFontInfo.fontSize,
			lineHeight: bareFontInfo.lineHeight,
			letterSpacing: bareFontInfo.letterSpacing,
			isMonospace: isMonospace,
			typicalHalfwidthCharacterWidth: typicalHalfwidthCharacter.width,
			typicalFullwidthCharacterWidth: typicalFullwidthCharacter.width,
			spaceWidth: space.width,
			maxDigitWidth: maxDigitWidth
		}, canTrustBrowserZoomLevel);
	}
}

export class Configuration extends CommonEditorConfiguration {

	public static applyFontInfoSlow(domNode: HTMLElement, fontInfo: BareFontInfo): void {
		domNode.style.fontFamily = fontInfo.fontFamily;
		domNode.style.fontWeight = fontInfo.fontWeight;
		domNode.style.fontSize = fontInfo.fontSize + 'px';
		domNode.style.lineHeight = fontInfo.lineHeight + 'px';
		domNode.style.letterSpacing = fontInfo.letterSpacing + 'px';
	}

	public static applyFontInfo(domNode: FastDomNode<HTMLElement>, fontInfo: BareFontInfo): void {
		domNode.setFontFamily(fontInfo.fontFamily);
		domNode.setFontWeight(fontInfo.fontWeight);
		domNode.setFontSize(fontInfo.fontSize);
		domNode.setLineHeight(fontInfo.lineHeight);
		domNode.setLetterSpacing(fontInfo.letterSpacing);
	}

	private readonly _elementSizeObserver: ElementSizeObserver;

	constructor(options: IEditorOptions, referenceDomElement: HTMLElement = null) {
		super(options);

		this._elementSizeObserver = this._register(new ElementSizeObserver(referenceDomElement, () => this._onReferenceDomElementSizeChanged()));

		this._register(CSSBasedConfiguration.INSTANCE.onDidChange(() => this._onCSSBasedConfigurationChanged()));

		if (this._validatedOptions.automaticLayout) {
			this._elementSizeObserver.startObserving();
		}

		this._register(browser.onDidChangeZoomLevel(_ => this._recomputeOptions()));
		this._register(browser.onDidChangeAccessibilitySupport(() => this._recomputeOptions()));

		this._recomputeOptions();
	}

	private _onReferenceDomElementSizeChanged(): void {
		this._recomputeOptions();
	}

	private _onCSSBasedConfigurationChanged(): void {
		this._recomputeOptions();
	}

	public observeReferenceElement(dimension?: IDimension): void {
		this._elementSizeObserver.observe(dimension);
	}

	public dispose(): void {
		super.dispose();
	}

	private _getExtraEditorClassName(): string {
		let extra = '';
		if (browser.isIE) {
			extra += 'ie ';
		} else if (browser.isFirefox) {
			extra += 'ff ';
		} else if (browser.isEdge) {
			extra += 'edge ';
		}
		if (platform.isMacintosh) {
			extra += 'mac ';
		}
		return extra;
	}

	protected _getEnvConfiguration(): IEnvConfiguration {
		return {
			extraEditorClassName: this._getExtraEditorClassName(),
			outerWidth: this._elementSizeObserver.getWidth(),
			outerHeight: this._elementSizeObserver.getHeight(),
			emptySelectionClipboard: browser.isWebKit,
			pixelRatio: browser.getPixelRatio(),
			zoomLevel: browser.getZoomLevel(),
			accessibilitySupport: browser.getAccessibilitySupport()
		};
	}

	protected readConfiguration(bareFontInfo: BareFontInfo): FontInfo {
		return CSSBasedConfiguration.INSTANCE.readConfiguration(bareFontInfo);
	}
}


text:
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)

require 'thymeleaf'
require 'minitest/autorun'

class TestThymeleaf < Minitest::Test

  def render(source, context = {})
    Thymeleaf::Template.new(source, context).render
  end

  require_relative 'assertions/html'
  require_relative 'assertions/html_page'
  require_relative 'assertions/syntax_error'

end

Thymeleaf.configure do |config|
  config.template.prefix = "#{__dir__}/templates/"
  config.template.suffix = '.th.html'
end


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Code Coverage for C:\wamp\www\Zend\module\Application/src/Application</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

C:\wamp\www\Zend\module\Application /

src /

Application

(Dashboard)

Code Coverage

Lines

Functions and Methods

Classes and Traits

      Total

35.29%

48 / 136

66.67%

2 / 3

66.67%

2 / 3

       Controller

100.00%

8 / 8

100.00%

1 / 1

100.00%

1 / 1

       Model

31.25%

40 / 128

50.00%

1 / 2

50.00%

1 / 2

Legend

     Low: 0% to 35%
     Medium: 35% to 70%
     High: 70% to 100%

     Generated by PHP_CodeCoverage 1.2.12 using PHP 5.4.3 and PHPUnit 3.7.24 at Fri Aug 30 14:06:29 UTC 2013.


text:
<?php

namespace PhpInk\Nami\CoreBundle\Model\Odm;

use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Mapping\Annotation as Gedmo;
use JMS\Serializer\Annotation as JMS;
use PhpInk\Nami\CoreBundle\Model\Odm\Core;
use PhpInk\Nami\CoreBundle\Model\BlockInterface;
use PhpInk\Nami\CoreBundle\Model\Image\BlockImageInterface;
use PhpInk\Nami\CoreBundle\Model\PageInterface;
use PhpInk\Nami\CoreBundle\Model\UserInterface;

/**
* Document\Block
 *
 * @ODM\Document(
 *     collection="blocks",
 *     repositoryClass="PhpInk\Nami\CoreBundle\Repository\Odm\BlockRepository"
 * )
 * @ODM\HasLifecycleCallbacks
 *
 * @JMS\ExclusionPolicy("all")
 * @JMS\AccessorOrder("custom", custom = {
 *     "id", "active", "title", "slug", "header",
 *     "content", "background", "category",
 *     "createdAt", "updatedAt", "createdBy", "updatedBy"
 * })
 */
class Block extends Core\Document implements BlockInterface
{
    use Core\SortableItemTrait,
        Core\CreatedUpdatedAtTrait,
        Core\CreatedUpdatedByTrait;

    /**
     * Primary Key
     * @var string
     * @ODM\Id
     * @JMS\Expose
     */
    protected $id;

    /**
     * @var bool
     * @ODM\Boolean
     * @JMS\Expose
     * @JMS\Groups({"full"})
     */
    protected $active;

    /**
     * @var string
     * @ODM\String
     * @JMS\Expose
     */
    protected $title;

    /**
     * @var string
     * @ODM\String
     * @JMS\Expose
     */
    protected $content;

    /**
     * @var Page
     * @ODM\ReferenceOne(targetDocument="Page", inversedBy="blocks")
     * @JMS\Expose
     * @JMS\Type("string")
     * @JMS\Accessor("getPageId")
     */
    protected $page;

    /**
     * @var string
     * @ODM\String
     * @JMS\Expose
     */
    protected $type = 'default';

    /**
     * @var ArrayCollection<PhpInk\Nami\CoreBundle\Model\Odm\Image\BlockImage>
     * @ODM\ReferenceMany(targetDocument="PhpInk\Nami\CoreBundle\Model\Odm\Image\BlockImage",
     * mappedBy="block", orphanRemoval=true,
     * cascade={"persist", "remove"})
     * @ODM\EmbedMany(targetDocument="Image")
     * @JMS\Expose
     * @JMS\Type("array<string>")
     * @JMS\Accessor("getImagesId")
     */
    protected $images;

    /**
     * @var string
     * @ODM\String
     * @JMS\Expose
     */
    private $template = 'default';

    /**
     * Plugin instance
     * @var mixed
     */
    protected $plugin = null;

    /**
     * @var array
     * @JMS\Expose
     * @JMS\Accessor("getReferences")
     * @JMS\MaxDepth(3)
     */
    protected $_references = array();

    /**
     * Block constructor
     * @param string $title
     * @param string $content
     */
    public function __construct($title = null, $content = null)
    {
        $this->active = false;
        $this->images = new ArrayCollection();
        if (!is_null($title)) {
            $this->setTitle($title);
        }
        if (!is_null($content)) {
            $this->setContent($content);
        }
    }

    /**
     * Fill null collection properties
     *
     * @ODM\PostLoad
     */
    public function initialize()
    {
        if (is_null($this->images)) {
            $this->images = new ArrayCollection();
        }
    }

    /**
     * Get the value of id.
     *
     * @return string
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set the value of id.
     *
     * @param string
     * @return $this
     */
    public function setId($id)
    {
        $this->id = $id;
        return $this;
    }

    /**
     * Set the value of active.
     *
     * @param boolean $active
     * @return $this
     */
    public function setActive($active)
    {
        $this->active = $active;

        return $this;
    }

    /**
     * Get the value of active.
     *
     * @return boolean
     */
    public function isActive()
    {
        return $this->active;
    }

    /**
     * Get the value of title.
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Set the value of title.
     *
     * @param string $title
     * @return $this
     */
    public function setTitle($title)
    {
        $this->title = $title;
        return $this;
    }

    /**
     * Get the value of content.
     *
     * @return string
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * Set the value of content.
     *
     * @param string $content
     * @return $this
     */
    public function setContent($content)
    {
        $this->content = $content;
        return $this;
    }

    /**
     * Get the value of type.
     *
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Set the value of type.
     *
     * @param string $type
     * @return $this
     */
    public function setType($type)
    {
        $this->type = $type;
        return $this;
    }

    /**
     * Remove a block image
     *
     * @param BlockImageInterface $image
     * @return BlockInterface
     */
    public function removeImage(BlockImageInterface $image)
    {
        $this->images->remove($image);

        return $this;
    }

    /**
     * Add a block image
     *
     * @param BlockImageInterface $image
     * @return BlockInterface
     */
    public function addImage(BlockImageInterface $image)
    {
        $image->setBlock($this);
        $this->images->add($image);

        return $this;
    }

    /**
     * Returns the block images
     *
     * @return ArrayCollection
     */
    public function getImages()
    {
        return $this->images;
    }

    /**
     * Returns bool if the block has images
     *
     * @return ArrayCollection
     */
    public function hasImages()
    {
        return count($this->images) > 0;
    }

    /**
     * Returns first image url
     *
     * @return string
     */
    public function getFirstImage()
    {
        $image = '';
        if ($this->hasImages()) {
            $image = $this->images->get(0);
        }
        return $image;
    }

    /**
     * Returns first image url
     *
     * @return string
     */
    public function getFirstImageUrl()
    {
        $url = '';
        if ($image = $this->getFirstImage()) {
            $url = $image->getUrl();
        }
        return $url;
    }

    /**
     * Returns first image url
     *
     * @return string
     */
    public function getFirstImageName()
    {
        $url = '';
        if ($image = $this->getFirstImage()) {
            $url = $image->getName();
        }
        return $url;
    }

    /**
     * Returns the block images ID
     *
     * @return array
     */
    public function getImagesId()
    {
        $ids = array();
        foreach ($this->images as $image) {
            $ids[] = $image->getId();
        }
        return $ids;
    }

    /**
     * Get the value of template.
     *
     * @return mixed
     */
    public function getTemplate()
    {
        return $this->template;
    }

    /**
     * Set the value of template.
     *
     * @param mixed $template
     * @return $this
     */
    public function setTemplate($template)
    {
        $this->template = $template;
        return $this;
    }

    /**
     * Get the value of page.
     *
     * @return PageInterface
     */
    public function getPage()
    {
        return $this->page;
    }

    /**
     * Get the value of page.
     *
     * @return string|null
     */
    public function getPageId()
    {
        return $this->getPage() ?
            $this->getPage()->getId() : null;
    }

    /**
     * Set the value of page.
     *
     * @param PageInterface $page
     * @return BlockInterface
     */
    public function setPage($page)
    {
        $this->page = $page;
        return $this;
    }

    /**
     * Displays a _references param for JMS
     * with related entities data
     *
     * @param UserInterface|null $user
     * @param array     $groups
     * @return array
     */
    public function getReferences(UserInterface $user = null, $groups = array())
    {
        if (empty($this->_references)) {
            $this->_references = array(
                'images' => array()

            );
            foreach ($this->getImages() as $image) {
                $this->_references['images']{$image->getId()} = $image;
            }
        }
        return $this->_references;
    }

    public function __toString()
    {
        return (string) $this->getTitle();
    }

    /**
     * Get the value of plugin
     * @return mixed
     */
    public function getPlugin()
    {
        return $this->plugin;
    }

    /**
     * Set the value of plugin
     * @param mixed $plugin
     * @return BlockInterface
     */
    public function setPlugin($plugin)
    {
        $this->plugin = $plugin;
        return $this;
    }
}


text:
package com.lxg.acm.mapper;

import com.lxg.acm.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * 用户管理
 * @author Administrator
 *
 */
@Repository
@CacheNamespace(size = 100)
public interface UserMapper {

	@Delete("delete from user")
	void clearUser();

	// 登录
	@Select("select * from user where username=#{username} and password=#{password}")
	public User login(@Param(value = "username") String username, @Param(value = "password") String password);

	/**
	 * 用户添加
	 * @param user
	 */
	@Insert("insert into user(username,password,email,nick,school,createTime) values(#{username},#{password},#{email},#{nick},#{school},now())")
	public Long save(User user);

	/**
	 * 按uid查询用户
	 * @param uid
	 * @return
	 */
	@Select("select * from user where uid=#{uid}")
	public User query(Long uid);

	/**
	 * 查询用户解决的题号
	 * @param uid
	 * @return
	 */
	@Select("select DISTINCT pid from status where uid=#{uid} and result=0")
	public List<Integer> queryByUidSolved(Long uid);

	/**
	 * 查询用户未通过的题号
	 * @param uid
	 * @return
	 */
	@Select("select DISTINCT pid from status where uid=#{uid} and result!=0")
	public List<Integer> queryByUidNoSolved(Long uid);

	/**
	 * 用户排名排序
	 * @param offset
	 * @param pageSize
	 * @return
	 */
	@Select("select * from user order by solved desc,submit asc,accepted desc limit #{offset},#{pageSize}")
	public List<User> queryForList(@Param(value = "offset") Long offset,
			@Param(value = "pageSize") Long pageSize);

	@Select("<script>select * from user where 1=1 <if test='username!=null'>and username like '%#{username}%'</if> order by solved desc,accepted asc,submit desc limit #{offset},#{pageSize}</script>")
	public List<User> queryForListByUser(@Param(value = "offset") Long offset,
								   @Param(value = "pageSize") Long pageSize,User user);

	/**
	 * 用户运行状态查询
	 * @param s_uid
	 * @param page
	 * @param pageSize
	 * @return
	 */
	@Select("<script>select * from user order by solved desc,accepted asc,submit desc "+
				"limit #{offset},#{pageSize}</script>")
	public List<User> queryForListProblemstatus(@Param("s_uid") Long s_uid,
			@Param("offset") Long page, @Param("pageSize") Long pageSize);

	/**
	 * 按权限类型查询用户
	 * @param type
	 * @return
	 */
	@Select("select user.username as username,type from user,role where user.username=role.username and type=#{type}")
	public List<User> queryAdminForList(String type);

	/**
	 * 查询所有的问题状态
	 * @return
	 */
	@Select("select count(1) from problemstatus")
	public Long countProblemstatus();

	//----------------------------
	@Select("select * from user order by rand() limit 1")
	public User queryByRand();

	/**
	 * 根据用户uid删除用户
	 * @param uid
	 */
	@Delete("delete from user where uid=#{uid}")
	public void delete(Long uid);

	/**
	 * 更新用户
	 * @param user
	 * @return
	 */
	@Update("<script>update user set " +
			"<if test='username!=null'>username=#{username},</if>" +
			"<if test='password!=null'>password=#{password},</if>" +
			"<if test='email!=null'>email=#{email},</if>" +
			"<if test='nick!=null'>nick=#{nick},</if>" +
			"<if test='school!=null'>school=#{school},</if>" +
			"<if test='solved!=null'>solved=#{solved},</if>" +
			"<if test='accepted!=null'>accepted=#{accepted},</if>" +
			"<if test='submit!=null'>submit=#{submit},</if> " +
//			"<if test='accesstime!=null'>accesstime=#{accesstime},</if> " +
			"<if test='defunct!=null'>defunct=#{defunct}</if> " +
			"where uid=#{uid}</script>")
	Long update(User user);

	/**
	 * 查询用户总数
	 * @return
	 */
	@Select("select count(1) from user")
	public Long count();

	/**
	 * 按用户名查询用户
	 * @param username
	 * @return
	 */
	@Select("select * from user where username=#{username}")
	@Options(useCache = true, flushCache = false, timeout = 1000)
	public User queryByUsername(String username);

	/**
	 * 根据用户名查询用户权限
	 * @param username
	 * @return
	 */
	@Select("select type from role where username=#{username}")
	public Set<String> findRoles(String username);

//
//	public List<Problem> queryFindProblemList(Object params,
//			@Param("offset") Long page, @Param("pageSize") Long pageSize);

	//==========用户解决题目总数(不相同)
	@Select("SELECT COUNT(DISTINCT pid) AS solved FROM STATUS WHERE uid=#{uid} AND result=0")
	public Long getUserSolved(Long uid);
	//===========用户通过次数
	@Select("SELECT COUNT(1) FROM STATUS WHERE uid=#{uid} AND result=0")
	public Long getUserAccepted(Long uid);

	@Select("select count(1) from user where username=#{username}")
	Integer isUserNameAdd(String username);

	@Update("update user set password=#password{} where username=#{username}")
	Integer updateUserPassword(String password,String username);

	@Select("select * from user where username=#{username} and password=#{password}")
	Integer isUserPasswordPass(String username,String password);
}


text:
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">

  <title>dateutil.rrule.rruleset</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />

         Trees

         Indices

         Help

EIC Site-packages

        Package dateutil ::
        Module rrule ::
        Class rruleset

[hide private]

[frames] | no frames]

Class rruleset

source code

rrulebase --+
            |
           rruleset

        Nested Classes
        [hide private]

        _genitem

        Instance Methods
        [hide private]

          __init__(self,
        cache=False)

            source code

          rrule(self,
        rrule)

            source code

          rdate(self,
        rdate)

            source code

          exrule(self,
        exrule)

            source code

          exdate(self,
        exdate)

            source code

          _iter(self)

            source code

Inherited from rrulebase:
      __contains__,
      __getitem__,
      __iter__,
      after,
      before,
      between,
      count

Inherited from rrulebase (private):
      _iter_cached

        Method Details
        [hide private]

__init__(self,
        cache=False)

(Constructor)

  	source code

Overrides:
        rrulebase.__init__

         Trees

         Indices

         Help

EIC Site-packages

    Generated by Epydoc
    3.0.1 on Mon Oct  8 11:15:36 2012

      http://epydoc.sourceforge.net


text:
require "typograph/version"
require "typograph/adapter"
require "typograph/processors/quotes"
require "typograph/processors/russian_grammar"
require "typograph/processor"

module Typograph
  def self.process(text="", options={})
    return "" if text.nil?
    Processor.new(options).process(text)
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<TITLE
>LDAP Lookup of Connection Parameters</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 9.0.10 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="libpq - C Library"
HREF="libpq.html"><LINK
REL="PREVIOUS"
TITLE="The Connection Service File"
HREF="libpq-pgservice.html"><LINK
REL="NEXT"
TITLE="SSL Support"
HREF="libpq-ssl.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2012-09-19T22:08:45">

PostgreSQL 9.0.10 Documentation

Prev	Up	Chapter 31. libpq - C Library	Next

31.16. LDAP Lookup of Connection Parameters

   If libpq has been compiled with LDAP support (option
   <TT
CLASS="LITERAL"
><TT
CLASS="OPTION"
>--with-ldap</TT
></TT
> for <TT
CLASS="COMMAND"
>configure</TT
>)
   it is possible to retrieve connection options like <TT
CLASS="LITERAL"
>host</TT
>
   or <TT
CLASS="LITERAL"
>dbname</TT
> via LDAP from a central server.
   The advantage is that if the connection parameters for a database change,
   the connection information doesn't have to be updated on all client machines.

   LDAP connection parameter lookup uses the connection service file
   <TT
CLASS="FILENAME"
>pg_service.conf</TT
> (see Section 31.15).  A line in a
   <TT
CLASS="FILENAME"
>pg_service.conf</TT
> stanza that starts with
   <TT
CLASS="LITERAL"
>ldap://</TT
> will be recognized as an LDAP URL and an
   LDAP query will be performed. The result must be a list of
   <TT
CLASS="LITERAL"
>keyword = value</TT
> pairs which will be used to set
   connection options.  The URL must conform to RFC 1959 and be of the
   form

ldap://[<TT
CLASS="REPLACEABLE"
>hostname</TT
>[:<TT
CLASS="REPLACEABLE"
>port</TT
>]]/<TT
CLASS="REPLACEABLE"
>search_base</TT
>?<TT
CLASS="REPLACEABLE"
>attribute</TT
>?<TT
CLASS="REPLACEABLE"
>search_scope</TT
>?<TT
CLASS="REPLACEABLE"
>filter</TT
>

   where <TT
CLASS="REPLACEABLE"
>hostname</TT
> defaults to
   <TT
CLASS="LITERAL"
>localhost</TT
> and <TT
CLASS="REPLACEABLE"
>port</TT
>
   defaults to 389.

   Processing of <TT
CLASS="FILENAME"
>pg_service.conf</TT
> is terminated after
   a successful LDAP lookup, but is continued if the LDAP server cannot
   be contacted.  This is to provide a fallback with further LDAP URL
   lines that point to different LDAP servers, classical <TT
CLASS="LITERAL"
>keyword
   = value</TT
> pairs, or default connection options.  If you would
   rather get an error message in this case, add a syntactically incorrect
   line after the LDAP URL.

   A sample LDAP entry that has been created with the LDIF file

version:1
dn:cn=mydatabase,dc=mycompany,dc=com
changetype:add
objectclass:top
objectclass:groupOfUniqueNames
cn:mydatabase
uniqueMember:host=dbserver.mycompany.com
uniqueMember:port=5439
uniqueMember:dbname=mydb
uniqueMember:user=mydb_user
uniqueMember:sslmode=require

   might be queried with the following LDAP URL:

ldap://ldap.mycompany.com/dc=mycompany,dc=com?uniqueMember?one?(cn=mydatabase)

   You can also mix regular service file entries with LDAP lookups.
   A complete example for a stanza in <TT
CLASS="FILENAME"
>pg_service.conf</TT
>
   would be:

# only host and port are stored in LDAP, specify dbname and user explicitly
[customerdb]
dbname=customer
user=appuser
ldap://ldap.acme.com/cn=dbserver,cn=hosts?pgconnectinfo?base?(objectclass=*)

Prev	Home	Next

The Connection Service File	Up	SSL Support


text:
<?php

/**
 *
 *
 * @phpstub
 *
 * @param resource $component
 * @param mixed $func_name
 * @param mixed $data
 *
 * @return void
 */
function newt_component_add_callback($component, $func_name, $data)
{
}


text:
Meteor.methods({
  "errorsMeta.changeState": function(appId, errorName, errorType, status) {
    // latency compensation stub for "errorsMeta.changeState" method
    return ErrorsMeta.upsert({
      appId: appId,
      name: errorName,
      type: errorType,
    }, {
      $set: {
        status: status
      }
    });
  }
});


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:gravity="center|top"
	android:orientation="vertical"
	android:baselineAligned="false">

	<TextView
		android:text="League App"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"/>

	<EditText
		android:layout_height="wrap_content"
		android:ems="10"
		android:layout_width="wrap_content"
		android:maxLines="1"
		android:imeOptions="actionSearch"
		android:inputType="text"
		android:id="@+id/search"
		android:gravity="center_horizontal"
		android:hint="search"
		android:layout_gravity="center"
		android:visibility="invisible"/>

	<View
		android:layout_height="1dp"
		android:background="?android:attr/dividerVertical"
		android:layout_width="match_parent"/>

	<ScrollView
		android:layout_width="match_parent"
		android:layout_height="match_parent"
		android:fillViewport="false"
		android:layout_weight="2">

		<TableLayout
			android:id="@+id/button_layout"
			android:layout_width="match_parent"
			android:layout_height="wrap_content">

		</TableLayout>

		<!--android:background="#543157"-->

	</ScrollView>

	<ProgressBar
		android:id="@+id/update_progress"
		style="@android:style/Widget.ProgressBar.Horizontal"
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		android:visibility="gone"/>

	<LinearLayout
		android:id="@+id/footer"
		android:orientation="horizontal"
		android:layout_height="wrap_content"
		android:layout_width="match_parent"
		android:gravity="bottom|center">

		<Button
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:text="clear log"
			android:visibility="gone"
			android:id="@+id/log_clear_button">
		</Button>
		<!-- android:background="#245675" -->

	</LinearLayout>

</LinearLayout>


text:
<?php

declare(strict_types=1);

namespace SlimAurynTest\Foo;

interface Foo
{
    public function wasConstructedThroughDelegation(): bool;
}


text:
'use strict';

// MODULES //

var test = require( 'tape' );
var urls = require( './../lib' );

// TESTS //

test( 'main export is a function', function test( t ) {
	t.ok( typeof urls === 'function', 'main export is a function' );
	t.end();
});

test( 'an `options` argument is required', function test( t ) {
	t.throws( foo, TypeError, 'throws error' );
	t.end();

	function foo() {
		urls();
	}
});

test( 'a repository `owner` must be specified', function test( t ) {
	t.throws( foo, TypeError, 'throws error' );
	t.end();

	function foo() {
		urls({
			'repo': 'beep'
		});
	}
});

test( 'a repository name must be specified', function test( t ) {
	t.throws( foo, TypeError, 'throws error' );
	t.end();

	function foo() {
		urls({
			'owner': 'beep'
		});
	}
});

test( 'the function returns an object containing `image` and `url` fields', function test( t ) {
	var out = urls({
		'owner': 'beep',
		'repo': 'boop'
	});

	t.equal( typeof out.image, 'string', 'image field is a string' );
	t.equal( typeof out.url, 'string', 'url field is a string' );
	t.end();
});

test( 'the `image` field corresponds to a shields.io badge url', function test( t ) {
	var out = urls({
		'owner': 'beep',
		'repo': 'boop'
	});
	t.equal( out.image, 'https://img.shields.io/github/stars/beep/boop.svg?style=social&label=Star&link=https://github.com/beep/boop&link=https://github.com/beep/boop/stargazers', 'image url' );
	t.end();
});

test( 'the `url` field corresponds to the repository url on Github', function test( t ) {
	var out = urls({
		'owner': 'beep',
		'repo': 'boop'
	});
	t.equal( out.url, 'https://github.com/beep/boop', 'Github url' );
	t.end();
});

test( 'the default social action is `star`', function test( t ) {
	var out = urls({
		'owner': 'beep',
		'repo': 'boop'
	});
	t.equal( out.image, 'https://img.shields.io/github/stars/beep/boop.svg?style=social&label=Star&link=https://github.com/beep/boop&link=https://github.com/beep/boop/stargazers', 'image url' );
	t.end();
});

test( 'the social action can be specified', function test( t ) {
	var out;

	// Fork:
	out = urls({
		'owner': 'beep',
		'repo': 'boop',
		'action': 'fork'
	});
	t.equal( out.image, 'https://img.shields.io/github/forks/beep/boop.svg?style=social&label=Fork&link=https://github.com/beep/boop&link=https://github.com/beep/boop/network', 'image url' );

	// Watch:
	out = urls({
		'owner': 'beep',
		'repo': 'boop',
		'action': 'watch'
	});
	t.equal( out.image, 'https://img.shields.io/github/watchers/beep/boop.svg?style=social&label=Watch&link=https://github.com/beep/boop&link=https://github.com/beep/boop/watchers', 'image url' );

	// Star:
	out = urls({
		'owner': 'beep',
		'repo': 'boop',
		'action': 'star'
	});
	t.equal( out.image, 'https://img.shields.io/github/stars/beep/boop.svg?style=social&label=Star&link=https://github.com/beep/boop&link=https://github.com/beep/boop/stargazers', 'image url' );

	t.end();
});

test( 'the default badge style is `social`', function test( t ) {
	var out = urls({
		'owner': 'beep',
		'repo': 'boop'
	});
	t.equal( out.image, 'https://img.shields.io/github/stars/beep/boop.svg?style=social&label=Star&link=https://github.com/beep/boop&link=https://github.com/beep/boop/stargazers', 'image url' );
	t.end();
});

test( 'the badge style can be specified', function test( t ) {
	var out = urls({
		'owner': 'beep',
		'repo': 'boop',
		'style': 'flat'
	});
	t.equal( out.image, 'https://img.shields.io/github/stars/beep/boop.svg?style=flat&label=stars', 'image url' );
	t.end();
});

test( 'the default badge format is `svg`', function test( t ) {
	var out = urls({
		'owner': 'beep',
		'repo': 'boop'
	});
	t.equal( out.image, 'https://img.shields.io/github/stars/beep/boop.svg?style=social&label=Star&link=https://github.com/beep/boop&link=https://github.com/beep/boop/stargazers', 'image url' );
	t.end();
});

test( 'the badge format can be specified', function test( t ) {
	var out = urls({
		'owner': 'beep',
		'repo': 'boop',
		'format': 'png'
	});
	t.equal( out.image, 'https://img.shields.io/github/stars/beep/boop.png?style=social&label=Star&link=https://github.com/beep/boop&link=https://github.com/beep/boop/stargazers', 'image url' );
	t.end();
});


text:
layout: default
---

{% assign lehrveranstaltungen = (site.lehrveranstaltungen | sort: 'title')) %}
{% assign cards = "" | split: "" %}

{% for lehrveranstaltung in lehrveranstaltungen %}
{% if lehrveranstaltung.typ != "other" %}
{% capture card %}
{% include veranstaltungsinfo-klein.html lehrveranstaltung=lehrveranstaltung %}
{% endcapture %}
{% assign cards = cards | push: card %}
{% endif %}
{% endfor %}

{% assign introtext = (site.snippets | where:"kennung","communication") %}

Communication

		{{introtext[0].content}}

			{% for card in cards %}
			{{card}}
			{% endfor %}


text:
/**
 * @module
 * @description
 * Change detection enables data binding in Angular.
 */
export { ChangeDetectionStrategy, ChangeDetectorRef, WrappedValue, SimpleChange, IterableDiffers, KeyValueDiffers, CollectionChangeRecord, KeyValueChangeRecord } from './change_detection/change_detection';


text:
package oneandone

import (
	"fmt"
	"github.com/1and1/oneandone-cloudserver-sdk-go"
	"github.com/hashicorp/terraform/helper/schema"
	"github.com/hashicorp/terraform/helper/validation"
	"log"
	"strings"
)

func resourceOneandOneLoadbalancer() *schema.Resource {
	return &schema.Resource{
		Create: resourceOneandOneLoadbalancerCreate,
		Read:   resourceOneandOneLoadbalancerRead,
		Update: resourceOneandOneLoadbalancerUpdate,
		Delete: resourceOneandOneLoadbalancerDelete,
		Schema: map[string]*schema.Schema{

			"name": {
				Type:     schema.TypeString,
				Required: true,
			},
			"description": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"method": {
				Type:         schema.TypeString,
				Required:     true,
				ValidateFunc: validateMethod,
			},
			"datacenter": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"persistence": {
				Type:     schema.TypeBool,
				Optional: true,
			},
			"persistence_time": {
				Type:     schema.TypeInt,
				Optional: true,
			},
			"health_check_test": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"health_check_interval": {
				Type:     schema.TypeInt,
				Optional: true,
			},
			"health_check_path": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"health_check_path_parser": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"rules": {
				Type: schema.TypeList,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"protocol": {
							Type:     schema.TypeString,
							Required: true,
						},
						"port_balancer": {
							Type:         schema.TypeInt,
							Required:     true,
							ValidateFunc: validation.IntBetween(1, 65535),
						},
						"port_server": {
							Type:         schema.TypeInt,
							Required:     true,
							ValidateFunc: validation.IntBetween(1, 65535),
						},
						"source_ip": {
							Type:     schema.TypeString,
							Required: true,
						},
						"id": {
							Type:     schema.TypeString,
							Computed: true,
						},
					},
				},
				Required: true,
			},
		},
	}
}

func resourceOneandOneLoadbalancerCreate(d *schema.ResourceData, meta interface{}) error {
	config := meta.(*Config)

	req := oneandone.LoadBalancerRequest{
		Name:  d.Get("name").(string),
		Rules: getLBRules(d),
	}

	if raw, ok := d.GetOk("description"); ok {
		req.Description = raw.(string)
	}

	if raw, ok := d.GetOk("datacenter"); ok {
		dcs, err := config.API.ListDatacenters()
		if err != nil {
			return fmt.Errorf("An error occured while fetching list of datacenters %s", err)
		}

		decenter := raw.(string)
		for _, dc := range dcs {
			if strings.ToLower(dc.CountryCode) == strings.ToLower(decenter) {
				req.DatacenterId = dc.Id
				break
			}
		}
	}

	if raw, ok := d.GetOk("method"); ok {
		req.Method = raw.(string)
	}

	if raw, ok := d.GetOk("persistence"); ok {
		req.Persistence = oneandone.Bool2Pointer(raw.(bool))
	}
	if raw, ok := d.GetOk("persistence_time"); ok {
		req.PersistenceTime = oneandone.Int2Pointer(raw.(int))
	}

	if raw, ok := d.GetOk("health_check_test"); ok {
		req.HealthCheckTest = raw.(string)
	}
	if raw, ok := d.GetOk("health_check_interval"); ok {
		req.HealthCheckInterval = oneandone.Int2Pointer(raw.(int))
	}
	if raw, ok := d.GetOk("health_check_path"); ok {
		req.HealthCheckPath = raw.(string)
	}
	if raw, ok := d.GetOk("health_check_path_parser"); ok {
		req.HealthCheckPathParser = raw.(string)
	}

	lb_id, lb, err := config.API.CreateLoadBalancer(&req)
	if err != nil {
		return err
	}

	err = config.API.WaitForState(lb, "ACTIVE", 10, config.Retries)
	if err != nil {
		return err
	}

	d.SetId(lb_id)

	return resourceOneandOneLoadbalancerRead(d, meta)
}

func getLBRules(d *schema.ResourceData) []oneandone.LoadBalancerRule {
	var rules []oneandone.LoadBalancerRule

	if raw, ok := d.GetOk("rules"); ok {
		rawRules := raw.([]interface{})
		log.Println("[DEBUG] raw rules:", raw)
		for _, raw := range rawRules {
			rl := raw.(map[string]interface{})
			rule := oneandone.LoadBalancerRule{
				Protocol: rl["protocol"].(string),
			}

			if rl["port_balancer"] != nil {
				rule.PortBalancer = uint16(rl["port_balancer"].(int))
			}
			if rl["port_server"] != nil {
				rule.PortServer = uint16(rl["port_server"].(int))
			}

			if rl["source_ip"] != nil {
				rule.Source = rl["source_ip"].(string)
			}

			rules = append(rules, rule)
		}
	}
	return rules
}

func resourceOneandOneLoadbalancerUpdate(d *schema.ResourceData, meta interface{}) error {
	config := meta.(*Config)

	if d.HasChange("name") || d.HasChange("description") || d.HasChange("method") || d.HasChange("persistence") || d.HasChange("persistence_time") || d.HasChange("health_check_test") || d.HasChange("health_check_interval") {
		lb := oneandone.LoadBalancerRequest{}
		if d.HasChange("name") {
			_, n := d.GetChange("name")
			lb.Name = n.(string)
		}
		if d.HasChange("description") {
			_, n := d.GetChange("description")
			lb.Description = n.(string)
		}
		if d.HasChange("method") {
			_, n := d.GetChange("method")
			lb.Method = (n.(string))
		}
		if d.HasChange("persistence") {
			_, n := d.GetChange("persistence")
			lb.Persistence = oneandone.Bool2Pointer(n.(bool))
		}
		if d.HasChange("persistence_time") {
			_, n := d.GetChange("persistence_time")
			lb.PersistenceTime = oneandone.Int2Pointer(n.(int))
		}
		if d.HasChange("health_check_test") {
			_, n := d.GetChange("health_check_test")
			lb.HealthCheckTest = n.(string)
		}
		if d.HasChange("health_check_path") {
			_, n := d.GetChange("health_check_path")
			lb.HealthCheckPath = n.(string)
		}
		if d.HasChange("health_check_path_parser") {
			_, n := d.GetChange("health_check_path_parser")
			lb.HealthCheckPathParser = n.(string)
		}

		ss, err := config.API.UpdateLoadBalancer(d.Id(), &lb)

		if err != nil {
			return err
		}
		err = config.API.WaitForState(ss, "ACTIVE", 10, 30)
		if err != nil {
			return err
		}

	}

	if d.HasChange("rules") {
		oldR, newR := d.GetChange("rules")
		oldValues := oldR.([]interface{})
		newValues := newR.([]interface{})
		if len(oldValues) > len(newValues) {
			diff := difference(oldValues, newValues)
			for _, old := range diff {
				o := old.(map[string]interface{})
				if o["id"] != nil {
					old_id := o["id"].(string)
					fw, err := config.API.DeleteLoadBalancerRule(d.Id(), old_id)
					if err != nil {
						return err
					}

					err = config.API.WaitForState(fw, "ACTIVE", 10, config.Retries)
					if err != nil {
						return err
					}
				}
			}
		} else {
			var rules []oneandone.LoadBalancerRule
			log.Println("[DEBUG] new values:", newValues)

			for _, raw := range newValues {
				rl := raw.(map[string]interface{})
				log.Println("[DEBUG] rl:", rl)

				if rl["id"].(string) == "" {
					rule := oneandone.LoadBalancerRule{
						Protocol: rl["protocol"].(string),
					}

					rule.PortServer = uint16(rl["port_server"].(int))
					rule.PortBalancer = uint16(rl["port_balancer"].(int))

					rule.Source = rl["source_ip"].(string)

					log.Println("[DEBUG] adding to list", rl["protocol"], rl["source_ip"], rl["port_balancer"], rl["port_server"])
					log.Println("[DEBUG] adding to list", rule)

					rules = append(rules, rule)
				}
			}

			log.Println("[DEBUG] new rules:", rules)

			if len(rules) > 0 {
				fw, err := config.API.AddLoadBalancerRules(d.Id(), rules)
				if err != nil {
					return err
				}

				err = config.API.WaitForState(fw, "ACTIVE", 10, config.Retries)
			}
		}
	}

	return resourceOneandOneLoadbalancerRead(d, meta)
}

func resourceOneandOneLoadbalancerRead(d *schema.ResourceData, meta interface{}) error {
	config := meta.(*Config)

	ss, err := config.API.GetLoadBalancer(d.Id())
	if err != nil {
		if strings.Contains(err.Error(), "404") {
			d.SetId("")
			return nil
		}
		return err
	}

	d.Set("name", ss.Name)
	d.Set("description", ss.Description)
	d.Set("datacenter", ss.Datacenter.CountryCode)
	d.Set("method", ss.Method)
	d.Set("persistence", ss.Persistence)
	d.Set("persistence_time", ss.PersistenceTime)
	d.Set("health_check_test", ss.HealthCheckTest)
	d.Set("health_check_interval", ss.HealthCheckInterval)
	d.Set("rules", getLoadbalancerRules(ss.Rules))

	return nil
}

func getLoadbalancerRules(rules []oneandone.LoadBalancerRule) []map[string]interface{} {
	raw := make([]map[string]interface{}, 0, len(rules))

	for _, rule := range rules {

		toadd := map[string]interface{}{
			"id":            rule.Id,
			"port_balancer": rule.PortBalancer,
			"port_server":   rule.PortServer,
			"protocol":      rule.Protocol,
			"source_ip":     rule.Source,
		}

		raw = append(raw, toadd)
	}

	return raw

}

func resourceOneandOneLoadbalancerDelete(d *schema.ResourceData, meta interface{}) error {
	config := meta.(*Config)

	lb, err := config.API.DeleteLoadBalancer(d.Id())
	if err != nil {
		return err
	}
	err = config.API.WaitUntilDeleted(lb)
	if err != nil {
		return err
	}

	return nil
}

func validateMethod(v interface{}, k string) (ws []string, errors []error) {
	value := v.(string)

	if value != "ROUND_ROBIN" && value != "LEAST_CONNECTIONS" {
		errors = append(errors, fmt.Errorf("%q value sholud be either 'ROUND_ROBIN' or 'LEAST_CONNECTIONS' not %q", k, value))
	}

	return
}


text:
module SapphireBot
  # Manages server config files.
  module ServerConfig
    extend StoreData

    @default_settings = load_file("#{Dir.pwd}/data/default_settings.yml")
    @servers = load_file("#{Dir.pwd}/data/server_config.yml")

    # Loads config from file.
    def self.load_config(id)
      return @servers[id] if @servers.key?(id)

      @servers[id] = {}
      @default_settings.each do |key, value|
        @servers[id][key] = value[:default]
      end
      LOGGER.debug "created a new config entry for server #{id}"

      @servers[id]
    end

    def self.update_servers(config, id)
      @servers[id] = config
    end

    def self.save
      LOGGER.debug 'Saving server config'
      save_to_file("#{Dir.pwd}/data/server_config.yml", @servers) unless @servers.empty?
    end

    # Returns information about default settings.
    def self.settings_info
      @default_settings
    end
  end
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>PayPal Adaptive Payments - Preapproval</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />

<?php
    $serverName = $_SERVER['SERVER_NAME'];
	$serverPort = $_SERVER['SERVER_PORT'];
	$url=dirname('http://'.$serverName.':'.$serverPort.$_SERVER['REQUEST_URI']);
	$returnUrl = $url."/Preapproval.php";
	$cancelUrl =  $url."/CancelPreapproval.php";
?>

Preapproval

A request to create a Preapproval. A Preapproval
				is an agreement between a Paypal account holder (the sender) and the
				API caller (the service invoker) to make payment(s) on the the
				sender's behalf with various limitations defined.

			<form id="Form1" name="Form1" method="post"
				action="PreapprovalReceipt.php">

Return URL *

						<input name="returnUrl" id="returnUrl" value="<?php echo $returnUrl;?>" />

Cancel Url *

						<input name="cancelUrl" id="cancelUrl" value="<?php echo $cancelUrl;?>" />

Currency code *

						<input name="currencyCode" value="USD" />

Preapproval start date *

						<input name="startingDate" id="startingDate" value="<?php echo date("Y-m-d");?>" />

Preapproval end date

						<input name="endingDate" id="endingDate" value="<?php echo date("Y-m-d", time() + 864000);?>" />

Payment date - Date of month

						<input name="dateOfMonth" id="dateOfMonth" value="" />

Payment date - Day of week

						<select name="dayOfWeek" id="dayOfWeek">
							<option>- Select -</option>
							<option>NO_DAY_SPECIFIED</option>
							<option>SUNDAY</option>
							<option>MONDAY</option>
							<option>TUESDAY</option>
							<option>WEDNESDAY</option>
							<option>THURSDAY</option>
							<option>FRIDAY</option>
							<option>SATURDAY</option>
						</select>

Maximum amount per payment

						<input name="maxAmountPerPayment" id="maxAmountPerPayment" value="" />

Maximum number of payments

						<input name="maxNumberOfPayments" id="maxNumberOfPayments" value="10" />

Maximum number of payments per period

						<input name="maxNumberOfPaymentsPerPeriod" id="maxNumberOfPaymentsPerPeriod" value="" />

Maximum total amount of all payments

						<input name="maxTotalAmountOfAllPayments" id="maxTotalAmountOfAllPayments" value="50.0" />

Payment period

						<select name="paymentPeriod" id="paymentPeriod">
							<option>- Select -</option>
							<option>NO_PERIOD_SPECIFIED</option>
							<option>DAILY</option>
							<option>WEEKLY</option>
							<option>BIWEEKLY</option>
							<option>SEMIMONTHLY</option>
							<option>MONTHLY</option>
							<option>ANNUALLY</option>
						</select>

Display Maximum Total Amount

						<select name="displayMaxTotalAmount">
							<option value="">--Select a value--</option>
							<option value="true">True</option>
							<option value="false">False</option>
						</select>

Memo

						<input name="memo" id="memo" value="" />

IPN Notification URL

						<input name="ipnNotificationUrl" id="ipnNotificationUrl" value="" />

Sender email

						<input name="senderEmail" id="senderEmail" value="" />

Is PIN type required

						<select name="pinType" id="pinType">
							<option>- Select -</option>
							<option>NOT_REQUIRED</option>
							<option>REQUIRED</option>
						</select>

Fees payer

						<select name="feesPayer">
							<option value="EACHRECEIVER">EACHRECEIVER</option>
							<option value="PRIMARYRECEIVER">PRIMARYRECEIVER</option>
							<option value="SENDER" selected="selected">SENDER</option>
							<option value="SECONDARYONLY">SECONDARYONLY</option>
						</select>

					<input type="submit" value="Submit" />

			</form>

		Home


text:
package freestyle

import org.scalatest.{AsyncWordSpec, Matchers}

import freestyle.implicits._
import freestyle.config._
import freestyle.config.implicits._
import java.util.concurrent.TimeUnit
import scala.concurrent.{ExecutionContext, Future}
import cats.instances.either._
import cats.instances.future._
import cats.syntax.cartesian._
import cats.syntax.either._

class ConfigTests extends AsyncWordSpec with Matchers {

  import algebras._

  implicit override def executionContext = ExecutionContext.Implicits.global

  "Config integration" should {

    "allow configuration to be interleaved inside a program monadic flow" in {
      val program = for {
        _      <- app.nonConfig.x
        config <- app.configM.empty
      } yield config
      program.interpret[Future] map { _ shouldBe a[Config] }
    }

    "allow configuration to parse strings" in {
      val program = for {
        a   <- app.nonConfig.x
        cfg <- app.configM.parseString("{n = 1}")
      } yield cfg.int("n").map(_ + a)
      program.interpret[Future] map { _ shouldBe Right(1 + 1) }
    }

    "allow configuration to load classpath files" in {
      app.configM.load.interpret[Future] map { _.int("s") shouldBe Right(3) }
    }

    "allow values to be read from a parsed config" in {
      val config = """{n = 1, s = "foo", b = true, xs = ["a", "b"], delay = "1000ms"}"""
      val program = app.configM.parseString(config) map { cfg =>
        (cfg.hasPath("n") |@|
          cfg.int("n") |@|
          cfg.double("n") |@|
          cfg.string("s") |@|
          cfg.boolean("b") |@|
          cfg.stringList("xs") |@|
          cfg.duration("delay", TimeUnit.SECONDS)).tupled
      }
      program.interpret[Future] map {
        _ shouldBe Right((true, 1, 1d, "foo", true, List("a", "b"), 1L))
      }
    }

  }

}

object algebras {
  @free
  trait NonConfig {
    def x: FS[Int]
  }

  implicit def nonConfigHandler: NonConfig.Handler[Future] =
    new NonConfig.Handler[Future] {
      def x: Future[Int] = Future.successful(1)
    }

  @module
  trait App {
    val nonConfig: NonConfig
    val configM: ConfigM
  }

  val app = App[App.Op]

}


text:
package java.rmi.server;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * @deprecated
 * @since 1.1
 */
public interface LoaderHandler
{
  /**
   * For binary compatibility with the JDK, the string "sun.rmi.server".
   * Not actually used for anything.
   */
  String packagePrefix = "sun.rmi.server";

  /**
   * @deprecated
   */
  Class<?> loadClass(String name)
    throws MalformedURLException, ClassNotFoundException;

  /**
   * @deprecated
   */
  Class<?> loadClass(URL codebase, String name)
    throws MalformedURLException, ClassNotFoundException;

  /**
   * @deprecated
   */
  Object getSecurityContext(ClassLoader loader);
}


text:
'use strict';

var isObject     = require('es5-ext/object/is-object')
  , d            = require('d')
  , validElement = require('dom-ext/element/valid-element')

  , defineProperties = Object.defineProperties
  , Attr, Text;

Attr = function (element, name, type/*, options*/) {
	var options = Object(arguments[3]);
	this.element = validElement(element);
	this.observable = options.observable;
	this.name = name;
	this.type = type;
};
defineProperties(Attr.prototype, {
	value: d.gs(function () { return this.element.getAttribute(this.name); },
		function (value) {
			if (value == null) {
				this.element.removeAttribute(this.name);
				return;
			}
			if ((this.type.__id__ !== 'Base') && !isObject(value)) {
				value = this.type.getObjectValue(value, this.observable.descriptor);
				value = value.toString(this.observable && this.observable.descriptor);
			}
			this.element.setAttribute(this.name, value);
		}),
	dismiss: d(function () {})
});

Text = function (document, type/*, options*/) {
	var options = Object(arguments[2]);
	this.document = document;
	this.type = type;
	this.observable = options.observable;
	this.dom = document.createTextNode('');
};
Object.defineProperties(Text.prototype, {
	toDOM: d(function () { return this.dom; }),
	value: d.gs(function () { return this.dom.data; }, function (value) {
		if (value == null) {
			this.dom.data = '';
			return;
		}
		if ((this.type.__id__ !== 'Base') && !isObject(value)) {
			value = this.type.getObjectValue(value, this.observable.descriptor);
			value = value.toString(this.observable && this.observable.descriptor);
		}
		this.dom.data = value;
	}),
	dismiss: d(function () {})
});

module.exports = exports = function (db) {
	defineProperties(db.Base, {
		DOMAttr: d(Attr),
		DOMText: d(Text),
		toDOMText: d(function (document/*, options*/) {
			return new this.DOMText(document, this, arguments[1]);
		}),
		toDOMAttrBox: d(function (element, name/*, options*/) {
			return new this.DOMAttr(element, name, this, arguments[2]);
		})
	});

	defineProperties(db.Base.prototype, {
		toDOMText: d(function (document/*, options*/) {
			var text = this.constructor.toDOMText(document, arguments[1]);
			text.value = this;
			return text;
		}),
		toDOMAttrBox: d(function (element, name/*, options*/) {
			var text = this.constructor.toDOMAttrBox(element, name, arguments[2]);
			text.value = this;
			return text;
		}),
		toDOM: d(function (document/*, options*/) {
			return this.toDOMText(document, arguments[1]).dom;
		}),
		toDOMAttr: d(function (element, name/*, options*/) {
			return this.toDOMAttrBox(element, name, arguments[2]).dom;
		})
	});

	return db.Base;
};
exports.Attr = Attr;
exports.Text = Text;


text:
package io.agrest.runtime.parser.converter;

import static io.agrest.meta.Types.typeForName;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import io.agrest.parser.converter.Base64Converter;
import io.agrest.parser.converter.FloatConverter;
import io.agrest.parser.converter.GenericConverter;
import io.agrest.parser.converter.ISOLocalDateConverter;
import io.agrest.parser.converter.ISOLocalDateTimeConverter;
import io.agrest.parser.converter.ISOLocalTimeConverter;
import io.agrest.parser.converter.ISOOffsetDateTimeConverter;
import io.agrest.parser.converter.JsonValueConverter;
import io.agrest.parser.converter.LongConverter;
import io.agrest.parser.converter.UtcDateConverter;
import org.apache.cayenne.di.DIRuntimeException;
import org.apache.cayenne.di.Inject;
import org.apache.cayenne.di.Provider;

import com.fasterxml.jackson.databind.JsonNode;

/**
 * @since 2.10
 */
public class DefaultJsonValueConverterFactoryProvider implements Provider<IJsonValueConverterFactory> {

    private static final JsonValueConverter<JsonNode> DO_NOTHING_CONVERTER = node -> node;

    private Map<String, JsonValueConverter<?>> injectedConverters;

    public DefaultJsonValueConverterFactoryProvider(@Inject Map<String, JsonValueConverter<?>> injectedConverters) {
        this.injectedConverters = injectedConverters;
    }

    @Override
    public IJsonValueConverterFactory get() throws DIRuntimeException {

        Map<Class<?>, JsonValueConverter<?>> converters =
                appendInjectedConverters(
                        appendKnownConverters(new HashMap<>()));

        return new DefaultJsonValueConverterFactory(converters, defaultConverter());
    }

    protected JsonValueConverter<?> defaultConverter() {
        return GenericConverter.converter();
    }

    protected Map<Class<?>, JsonValueConverter<?>> appendKnownConverters(Map<Class<?>, JsonValueConverter<?>> converters) {

        converters.put(Object.class, GenericConverter.converter());
        converters.put(Float.class, FloatConverter.converter());
        converters.put(float.class, FloatConverter.converter());
        converters.put(Long.class, LongConverter.converter());
        converters.put(long.class, LongConverter.converter());
        converters.put(Date.class, UtcDateConverter.converter());
        converters.put(java.sql.Date.class, UtcDateConverter.converter(java.sql.Date.class));
        converters.put(java.sql.Time.class, UtcDateConverter.converter(java.sql.Time.class));
        converters.put(java.sql.Timestamp.class, UtcDateConverter.converter(java.sql.Timestamp.class));
        converters.put(byte[].class, Base64Converter.converter());
        converters.put(LocalDate.class, ISOLocalDateConverter.converter());
        converters.put(LocalTime.class, ISOLocalTimeConverter.converter());
        converters.put(LocalDateTime.class, ISOLocalDateTimeConverter.converter());
        converters.put(OffsetDateTime.class, ISOOffsetDateTimeConverter.converter());
        converters.put(JsonNode.class, DO_NOTHING_CONVERTER);

        return converters;
    }

    protected Map<Class<?>, JsonValueConverter<?>> appendInjectedConverters(Map<Class<?>, JsonValueConverter<?>> converters) {
        injectedConverters.forEach((k, v) -> converters.put(typeForName(k), v));
        return converters;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<article id="750">
	<title>The Effect of Growth on the Obsolescence of Semiconductor Physics Literature	</title>
	<author>Oliver, Merrill R.	</author>
	<text>
		   Semiconductor physics literature is studied in order to investigate recent
		hypotheses relating obsolescence to the growth in periodical literature and the
		growth in the number of contributing scientists.. The results indicate that
		obsolescence remains constant and that the two growth rates are, within
		experimental error, of equal magnitude for this subject over a five-year
		period.. These results are seen to be inconsistent with the assumption that an
		exponentially-growing literature possesses a constant utility..
	</text>
</article>


text:
;(function(define){define(function(require,exports,module){
/*jshint esnext:true*/
'use strict';

/**
 * Dependencies
 */

var GaiaDialog = require('gaia-dialog');

/**
 * Extend from the `HTMLElement` prototype
 *
 * @type {Object}
 */
var proto = GaiaDialog.extend();

/**
 * Runs when an instance of `GaiaTabs`
 * is first created.
 *
 * The initial value of the `select` attribute
 * is used to select a tab.
 *
 * @private
 */
proto.createdCallback = function() {
  this.onCreated();

  this.els.submit = this.shadowRoot.querySelector('.submit');
  this.els.cancel = this.shadowRoot.querySelector('.cancel');

  this.els.cancel.addEventListener('click', this.close.bind(this));
  this.els.submit.addEventListener('click', this.close.bind(this));
};

proto.template = `

<gaia-dialog>

<content></content>

  <fieldset>
    <button class="cancel">Cancel</button>
    <button class="submit danger">Confirm</button>
  </fieldset>
</gaia-dialog>`;

// Register and expose the constructor
try {
  module.exports = document.registerElement('gaia-dialog-confirm', { prototype: proto });
  module.exports.proto = proto;
} catch (e) {
  if (e.name !== 'NotSupportedError') {
    throw e;
  }
}

});})(typeof define=='function'&&define.amd?define
:(function(n,w){'use strict';return typeof module=='object'?function(c){
c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){
return w[n];},m.exports,m);w[n]=m.exports;};})('gaia-dialog-alert',this));


text:
'use strict';

var React = require('react');
var IconBase = require(__dirname + 'components/IconBase/IconBase');

var IosPhotos = React.createClass({
	displayName: 'IosPhotos',

	render: function render() {
		return React.createElement(
			IconBase,
			null,
			React.createElement(
				'g',
				null,
				React.createElement('path', { d: 'M96,128v320h384V128H96z' }),
				React.createElement('polygon', { points: '416,64 32,64 32,384 80,384 80,112 416,112 \t' })
			)
		);
	}
});


text:
/*
 *	POSIX Standard: 3.2.1 Wait for Process Termination	<sys/wait.h>
 */

#ifndef	_SYS_WAIT_H
#define	_SYS_WAIT_H	1

#include <features.h>

__BEGIN_DECLS

#include <bits/types.h>
#ifndef __pid_t_defined
typedef __pid_t pid_t;
# define __pid_t_defined
#endif

#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
# include <signal.h>
#endif

#if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8
/* Some older standards require the contents of struct rusage to be
   defined here.  */
# include <bits/types/struct_rusage.h>
#endif

/* These macros could also be defined in <stdlib.h>.  */
#if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8)
/* This will define the `W*' macros for the flag
   bits to `waitpid', `wait3', and `wait4'.  */
# include <bits/waitflags.h>

/* This will define all the `__W*' macros.  */
# include <bits/waitstatus.h>

# define WEXITSTATUS(status)	__WEXITSTATUS (status)
# define WTERMSIG(status)	__WTERMSIG (status)
# define WSTOPSIG(status)	__WSTOPSIG (status)
# define WIFEXITED(status)	__WIFEXITED (status)
# define WIFSIGNALED(status)	__WIFSIGNALED (status)
# define WIFSTOPPED(status)	__WIFSTOPPED (status)
# ifdef __WIFCONTINUED
#  define WIFCONTINUED(status)	__WIFCONTINUED (status)
# endif
#endif	/* <stdlib.h> not included.  */

#ifdef	__USE_MISC
# define WCOREFLAG		__WCOREFLAG
# define WCOREDUMP(status)	__WCOREDUMP (status)
# define W_EXITCODE(ret, sig)	__W_EXITCODE (ret, sig)
# define W_STOPCODE(sig)	__W_STOPCODE (sig)
#endif

/* The following values are used by the `waitid' function.  */
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
typedef enum
{
  P_ALL,		/* Wait for any child.  */
  P_PID,		/* Wait for specified process.  */
  P_PGID		/* Wait for members of process group.  */
} idtype_t;
#endif

/* Wait for a child to die.  When one does, put its status in *STAT_LOC
   and return its process ID.  For errors, return (pid_t) -1.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern __pid_t wait (int *__stat_loc);

#ifdef	__USE_MISC
/* Special values for the PID argument to `waitpid' and `wait4'.  */
# define WAIT_ANY	(-1)	/* Any process.  */
# define WAIT_MYPGRP	0	/* Any process in my process group.  */
#endif

/* Wait for a child matching PID to die.
   If PID is greater than 0, match any process whose process ID is PID.
   If PID is (pid_t) -1, match any process.
   If PID is (pid_t) 0, match any process with the
   same process group as the current process.
   If PID is less than -1, match any process whose
   process group is the absolute value of PID.
   If the WNOHANG bit is set in OPTIONS, and that child
   is not already dead, return (pid_t) 0.  If successful,
   return PID and store the dead child's status in STAT_LOC.
   Return (pid_t) -1 for errors.  If the WUNTRACED bit is
   set in OPTIONS, return status for stopped children; otherwise don't.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);

#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
# ifndef __id_t_defined
typedef __id_t id_t;
#  define __id_t_defined
# endif

# include <bits/types/siginfo_t.h>

/* Wait for a childing matching IDTYPE and ID to change the status and
   place appropriate information in *INFOP.
   If IDTYPE is P_PID, match any process whose process ID is ID.
   If IDTYPE is P_PGID, match any process whose process group is ID.
   If IDTYPE is P_ALL, match any process.
   If the WNOHANG bit is set in OPTIONS, and that child
   is not already dead, clear *INFOP and return 0.  If successful, store
   exit code and status in *INFOP.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
		   int __options);
#endif

#if defined __USE_MISC \
    || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K)
/* This being here makes the prototypes valid whether or not
   we have already included <sys/resource.h> to define `struct rusage'.  */
struct rusage;

/* Wait for a child to exit.  When one does, put its status in *STAT_LOC and
   return its process ID.  For errors return (pid_t) -1.  If USAGE is not
   nil, store information about the child's resource usage there.  If the
   WUNTRACED bit is set in OPTIONS, return status for stopped children;
   otherwise don't.  */
extern __pid_t wait3 (int *__stat_loc, int __options,
		      struct rusage * __usage) __THROWNL;
#endif

#ifdef __USE_MISC
/* PID is like waitpid.  Other args are like wait3.  */
extern __pid_t wait4 (__pid_t __pid, int *__stat_loc, int __options,
		      struct rusage *__usage) __THROWNL;
#endif /* Use misc.  */

__END_DECLS

#endif /* sys/wait.h  */


text:
package controllers

import akka.actor.{ActorSystem, ActorRef}
import play.api.libs.json._
import play.api.mvc._
import models.Book._
import services.{KafkaConsumer, KafkaSender}

object Application extends Controller {

  val system = ActorSystem("KafkaClients")

  // make a producer and consumer for the "myevents" topic
  val kafkaProducer: ActorRef = system.actorOf(KafkaSender.props("myevents"), "producertest")
  val kafkaConsumer: ActorRef = system.actorOf(KafkaConsumer.props("myevents"), "consumertest")

  // start consuming events on the "test" group
  kafkaConsumer ! "test"

  def listBooks = Action {
    kafkaProducer ! """{ "event": "books viewed" }"""
    Ok(Json.toJson(books))
  }

  def saveBook = Action(BodyParsers.parse.json) { request =>
    val b = request.body.validate[Book]
    b.fold(
      errors => {
        BadRequest(Json.obj("status" -> "OK", "message" -> JsError.toFlatJson(errors)))
      },
      book => {
        addBook(book)
        kafkaProducer ! """{ "event": "book saved" }"""
        Ok(Json.obj("status" -> "OK"))
      }
    )
  }
}


text:
package com.ce.game.myapplication.view.newpincode;

import android.content.Context;
import android.support.annotation.IdRes;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;

import com.ce.game.myapplication.R;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Created by KyleCe on 2016/8/10.
 *
 * @author: KyleCe
 */

public class NumberKeyboardForUnlock extends FrameLayout {

    protected List<KeyboardInterface> mKeyList;
    protected View mItemParent;
    protected final int KEYBOARD_SCALE = 12;

    public NumberKeyboardForUnlock(Context context) {
        this(context, null);
    }

    public NumberKeyboardForUnlock(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public NumberKeyboardForUnlock(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        inflate(context, R.layout.first_anim_showcase_number_keyboard_all_keyboard, this);

        mItemParent = findViewById(R.id.single_button_parent);

        setForUnlock();
    }

    protected void setForUnlock() {
        mKeyList = new ArrayList<>(KEYBOARD_SCALE);
        addButtonToList(mKeyList, R.id.number_keyboard_0);
        addButtonToList(mKeyList, R.id.number_keyboard_1);
        addButtonToList(mKeyList, R.id.number_keyboard_2);
        addButtonToList(mKeyList, R.id.number_keyboard_3);
        addButtonToList(mKeyList, R.id.number_keyboard_4);
        addButtonToList(mKeyList, R.id.number_keyboard_5);
        addButtonToList(mKeyList, R.id.number_keyboard_6);
        addButtonToList(mKeyList, R.id.number_keyboard_7);
        addButtonToList(mKeyList, R.id.number_keyboard_8);
        addButtonToList(mKeyList, R.id.number_keyboard_9);
        addButtonToList(mKeyList, R.id.number_keyboard_10);
        addButtonToList(mKeyList, R.id.number_keyboard_11);
    }

    protected <N extends KeyboardInterface> void addButtonToList(Collection<N> c, @IdRes int id) {
        c.add((N) findViewById(id));
    }

    public void setPressCallback(PressCallback pressCallback) {
        pressCallback = pressCallback == null ? PressCallback.NULL : pressCallback;
        for (KeyboardInterface n : mKeyList)
            n.setPressCallback(pressCallback);
    }
}


text:
using System;

namespace SimpleTest.PnP
{
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Assembly | AttributeTargets.Module, AllowMultiple = true)]
    class InterceptorBypassAttribute : AspectMatchingAttributeBase
    {
        public bool DoNeedBypass { get; }

        public InterceptorBypassAttribute(bool iBypass)
        {
            DoNeedBypass = iBypass;
        }
        public bool NeedBypass()
        {
            return DoNeedBypass;
        }
    }
}


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\ShopBundle\Tests\Calculator;

use Mockery;
use Mockery\Adapter\Phpunit\MockeryTestCase;
use Sylius\Bundle\ShopBundle\Calculator\OrderItemsSubtotalCalculator;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\OrderItemInterface;

final class OrderItemsSubtotalCalculatorTest extends MockeryTestCase
{
    /**
     * @test
     */
    public function it_can_be_instantiated(): OrderItemsSubtotalCalculator
    {
        return new OrderItemsSubtotalCalculator();
    }

    /**
     * @test
     * @depends it_can_be_instantiated
     */
    public function it_can_calculate_the_subtotal_of_order_items(OrderItemsSubtotalCalculator $calculator): void
    {
        $subTotal = $calculator->getSubtotal($this->getOrderMock([
            $this->getOrderItemMock(1000),
            $this->getOrderItemMock(1000),
        ]));
        $this->assertEquals(2000, $subTotal);
    }

    /**
     * @test
     * @depends it_can_be_instantiated
     */
    public function it_can_calculate_a_subtotal_if_there_are_no_order_items(
        OrderItemsSubtotalCalculator $calculator
    ): void {
        $subTotal = $calculator->getSubtotal($this->getOrderMock([]));
        $this->assertEquals(0, $subTotal);
    }

    private function getOrderItemMock(int $subTotal): OrderItemInterface
    {
        $orderItem = Mockery::mock(OrderItemInterface::class);
        $orderItem
            ->shouldReceive('getSubTotal')
            ->once()
            ->andReturn($subTotal)
        ;

        return $orderItem;
    }

    private function getOrderMock(array $orderItems): OrderInterface
    {
        $order = Mockery::mock(OrderInterface::class);
        $order
            ->shouldReceive('getItems->toArray')
            ->once()
            ->andReturn($orderItems);

        return $order;
    }
}


text:
-------------------------------------------------------------------------------
-- <copyright company="Sherlock">
--     Copyright 2013 Sherlock. Licensed under the Apache License, Version 2.0.
-- </copyright>
-------------------------------------------------------------------------------

CREATE PROCEDURE [Tests].[UpdateTestStepReportDirectory]
    @id INT,
    @testStepId INT,
    @path NVARCHAR(MAX)
AS
    IF NOT EXISTS (
        SELECT *
        FROM [Tests].[TestStepReportDirectory]
        WHERE [pk_TestStepReportDirectoryId] = @id)
    BEGIN
        RAISERROR
            (
                N'An entry for a test step report directory with ID %d does not exist.',
                11,
                1,
                @id
            )
        RETURN
    END

    BEGIN TRANSACTION

        UPDATE [Tests].[TestStepReportDirectory]
        SET
            [fk_TestStepId] = @testStepId,
            [Path] = @path
        WHERE [pk_TestStepReportDirectoryId] = @id

        IF @@ERROR <> 0
        BEGIN
            ROLLBACK

            RAISERROR
                (
                    'Failed to update test step report directory with ID %d.',
                    11,
                    1,
                    @id
                )
            RETURN
        END

    COMMIT
RETURN 0


text:
#include <set>

#include <grpc/support/log.h>

#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
#include "test/cpp/util/benchmark_config.h"

namespace grpc {
namespace testing {

static const int WARMUP = 5;
static const int BENCHMARK = 5;

static void RunSynchronousUnaryPingPong() {
  gpr_log(GPR_INFO, "Running Synchronous Unary Ping Pong");

  ClientConfig client_config;
  client_config.set_client_type(SYNC_CLIENT);
  client_config.set_outstanding_rpcs_per_channel(1);
  client_config.set_client_channels(1);
  client_config.set_rpc_type(UNARY);
  client_config.mutable_load_params()->mutable_closed_loop();

  ServerConfig server_config;
  server_config.set_server_type(SYNC_SERVER);

  const auto result =
      RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);

  GetReporter()->ReportQPS(*result);
  GetReporter()->ReportLatency(*result);
}

}  // namespace testing
}  // namespace grpc

int main(int argc, char** argv) {
  grpc::testing::InitBenchmark(&argc, &argv, true);

  grpc::testing::RunSynchronousUnaryPingPong();

  return 0;
}


text:
#pragma warning(disable:4786)

#include <iostream>
#include <fstream>
#include <cstdlib>

#include "parts.h"

using namespace std;

void loadDefinitions(const char* filename, NameContainer& partContainer)
{
	ifstream inf(filename);
	string part, subpart;
	int quantity;

	while (inf.good())
    {
		inf >> part >> quantity >> subpart;

		if (!inf.good())
            return;

        partContainer.addPart(part, quantity, subpart);
	}
}

void whatisQuery(const string& x, NameContainer& partContainer)
{
	Part* xp = partContainer.lookup(x);
	cout << endl;
	xp->describe();
}

void howmanyQuery(const string& x, const string& y, NameContainer& partContainer)
{
	Part* xp = partContainer.lookup(x);
	Part* yp = partContainer.lookup(y);
	cout << endl << y << " has " << yp->countHowMany(xp) << " " << x << endl;
}

void processQueries(const char* filename, NameContainer& partContainer)
{
	ifstream inf(filename);
	string query, x, y;

	while (inf.good())
    {
		inf >> query >> x;

		if ( query == "howmany" )
			inf >> y;

		if (!inf.good())
            return;

		if (query == "howmany")
			howmanyQuery(x, y, partContainer);
		else if (query == "whatis")
			whatisQuery(x, partContainer);
		else
        {
			cerr << "*** Illegal query: " << query << endl;
			return;
		}
	}
}

int main(void)
{
    NameContainer partContainer;

	loadDefinitions("definitions.txt", partContainer);
	processQueries("queries.txt", partContainer);

	return EXIT_SUCCESS;                    // 0
}


text:
package io.comhub.register.android.presentation.test.activity;

import android.app.Fragment;
import android.content.Intent;
import android.test.ActivityInstrumentationTestCase2;
import io.comhub.register.android.presentation.R;
import io.comhub.register.android.presentation.view.activity.UserListActivity;

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

public class UserListActivityTest extends ActivityInstrumentationTestCase2<UserListActivity> {

  private UserListActivity userListActivity;

  public UserListActivityTest() {
    super(UserListActivity.class);
  }

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    this.setActivityIntent(createTargetIntent());
    userListActivity = getActivity();
  }

  @Override
  protected void tearDown() throws Exception {
    super.tearDown();
  }

  public void testContainsUserListFragment() {
    Fragment userListFragment =
      userListActivity.getFragmentManager().findFragmentById(R.id.fragmentContainer);
    assertThat(userListFragment, is(notNullValue()));
  }

  public void testContainsProperTitle() {
    String actualTitle = this.userListActivity.getTitle().toString().trim();

    assertThat(actualTitle, is("Users List"));
  }

  private Intent createTargetIntent() {
    Intent intentLaunchActivity =
      UserListActivity.getCallingIntent(getInstrumentation().getTargetContext());

    return intentLaunchActivity;
  }
}