text:
package com.linguahack.app;

import edu.mit.jwi.Dictionary;
import edu.mit.jwi.IDictionary;
import edu.mit.jwi.item.*;

import java.io.IOException;
import java.net.URL;
import java.util.*;

public class TestAntonyms {
    public static void main(String[] args) throws IOException {
        Map<String, Integer> w1 = new HashMap<String, Integer>();
        w1.put("car_noun", 4);
        w1.put("boy_noun", 4);
        w1.put("good_adjective", 4);
        w1.put("polite_adjective", 4);
        w1.put("write_verb", 4);

        Set<String> ant1 = preProcessAntonyms(w1);
        for (String s : ant1) {
            System.out.println(s);
        }

        Map<String, Integer> w2 = new HashMap<String, Integer>();
        w2.put("girl_noun", 4);
        w2.put("baloon_noun", 4);
        w2.put("red_adjective", 4);
        w2.put("impolite_adjective", 4);
        w2.put("do_verb", 4);

        System.out.println(passesAntonymy(w1, w2));
    }

    private static double passesAntonymy(Map<String, Integer> w1, Map<String, Integer> w2) {
        try {
            Set<String> antonyms = preProcessAntonyms(w1);
            int hits = 0;
            for (Map.Entry<String, Integer> entry : w2.entrySet()) {
                if (entry.getValue() > 3
                        && antonyms.contains(entry.getKey())) {
                    hits++;
                }
            }

            System.out.println(hits + "  " + w2.size());
            return 100.0 - (double) hits / (double) w2.size() * 100.0 < 80.0
                    ? 00.0 : 10.0;
        } catch (IOException ignored) {
            return 0.0;
        }
    }

    private static Set<String> preProcessAntonyms(Map<String, Integer> w1) throws IOException {
        Set<String> result = new HashSet<>();
        for (Map.Entry<String, Integer> entry : w1.entrySet()) {
            if (entry.getValue() >= 3) {
                result.add(entry.getKey());
            }
        }

        URL wordNetPath = new URL("file", null, "/usr/local/WordNet-3.0/dict");
        IDictionary dict = new Dictionary(wordNetPath);
        dict.open();

        Set<String> antonyms = new HashSet<>();
        for (String sample : result) {

            int underscore = sample.indexOf('_');
            String word = sample.substring(0, underscore);
            String part = sample.substring(underscore + 1);

            IIndexWord idxWord = dict.getIndexWord(word, definePos(part));

            IWordID wordID = idxWord.getWordIDs().get(0); // 1st meaning

            IWord iWord = dict.getWord(wordID);

            Map<IPointer, List<IWordID>> relatedMap = iWord.getRelatedMap();

            for (Map.Entry<IPointer, List<IWordID>> entry : relatedMap.entrySet()) {
                for (IWordID wordID1 : entry.getValue()) {
                    IWord iWord1 = dict.getWord(wordID1);
                    antonyms.add(iWord1.getLemma() + "_" + part);
                }
            }
        }

        return antonyms;
    }

    private static POS definePos(String pos) {
        if (pos.equals("noun")) {
            return POS.NOUN;
        }
        if (pos.equals("verb")) {
            return POS.VERB;
        }
        if (pos.equals("adjective")) {
            return POS.ADJECTIVE;
        }
        if (pos.equals("adverb")) {
            return POS.ADVERB;
        }
        throw new RuntimeException();
    }
}


text:
from csv import DictReader
from petsafeconfig import SKU_CSV_FILENAME

from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request

from product_spiders.items import Product, ProductLoader

import logging

class PetsafeNetSpider(BaseSpider):
    name = 'petsafe.net'
    allowed_domains = ['petsafe.net']
    start_urls = ()

    search_url = 'http://www.petsafe.net/search?q='

    def start_requests(self):
        skus = []
        with open(SKU_CSV_FILENAME, 'rb') as csv_file:
            csv_reader = DictReader(csv_file)
            for row in csv_reader:
                if row['SKU'] not in skus:
                    skus.append(row['SKU'])
        logging.error("Number of products: %d" % len(skus))
        for sku in skus:
            url = self. search_url + sku
            yield Request(url, self.parse, meta={'sku': sku}, dont_filter=True)

    def parse(self, response):
        hxs = HtmlXPathSelector(response)

        url = response.url
        sku = response.meta['sku']

        products = hxs.select("//ul[@id='categoryproductWrapper']/li/div")
        for product in products:
            prod_sku = product.select(".//div[@class='modelNumber']/text()").extract()
            if not prod_sku:
                logging.error('ERROR!! NO NAME!! %s "%s"' % (sku, url))
                return
            prod_sku = prod_sku[0].strip()

            if prod_sku == sku:
                name = product.select("header/a/text()").extract()
                if not name:
                    logging.error('ERROR!! NO NAME!! %s "%s"' % (sku, url))
                    return
                name = name[0].strip()

                url = product.select("header/a/@href").extract()
                if not url:
                    logging.error('ERROR!! NO url!! %s "%s"' % (sku, url))
                    return
                url = url[0].strip()

                price = product.select(".//div[@class='descPrice']/div/text()").extract()
                if not price:
                    logging.error('ERROR!! NO PRICE!! %s "%s" "%s"' % (sku, name, url))
                    return
                price = price[0].strip()

                product = Product()
                loader = ProductLoader(item=product, response=response, selector=hxs)
                loader.add_value('identifier', sku)
                loader.add_value('url', url)
                loader.add_value('name', name)
                loader.add_value('price', price)

                loader.add_value('sku', sku)

                yield loader.load_item()
                break

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Doctrine\DBAL\Id;

use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Connection;

/**
 * Table ID Generator for those poor languages that are missing sequences.
 *
 * WARNING: The Table Id Generator clones a second independent database
 * connection to work correctly. This means using the generator requests that
 * generate IDs will have two open database connections. This is necessary to
 * be safe from transaction failures in the main connection. Make sure to only
 * ever use one TableGenerator otherwise you end up with many connections.
 *
 * TableID Generator does not work with SQLite.
 *
 * The TableGenerator does not take care of creating the SQL Table itself. You
 * should look at the `TableGeneratorSchemaVisitor` to do this for you.
 * Otherwise the schema for a table looks like:
 *
 * CREATE sequences (
 *   sequence_name VARCHAR(255) NOT NULL,
 *   sequence_value INT NOT NULL DEFAULT '1',
 *   sequence_increment_by INT NOT NULL DEFAULT '1',
 *   PRIMARY KEY (table_name)
 * );
 *
 * Technically this generator works as follows:
 *
 * 1. Use a robust transaction serialization level.
 * 2. Open transaction
 * 3. Acquire a read lock on the table row (SELECT .. FOR UPDATE)
 * 4. Increment current value by one and write back to database
 * 5. Commit transaction
 *
 * If you are using a sequence_increment_by value that is larger than one the
 * ID Generator will keep incrementing values until it hits the incrementation
 * gap before issuing another query.
 *
 * If no row is present for a given sequence a new one will be created with the
 * default values 'value' = 1 and 'increment_by' = 1
 *
 * @author Benjamin Eberlei <kontakt@beberlei.de>
 */
class TableGenerator
{
    /**
     * @var \Doctrine\DBAL\Connection
     */
    private $conn;

    /**
     * @var string
     */
    private $generatorTableName;

    /**
     * @var array
     */
    private $sequences = array();

    /**
     * @param \Doctrine\DBAL\Connection $conn
     * @param string                    $generatorTableName
     *
     * @throws \Doctrine\DBAL\DBALException
     */
    public function __construct(Connection $conn, $generatorTableName = 'sequences')
    {
        $params = $conn->getParams();
        if ($params['driver'] == 'pdo_sqlite') {
            throw new \Doctrine\DBAL\DBALException("Cannot use TableGenerator with SQLite.");
        }
        $this->conn = DriverManager::getConnection($params, $conn->getConfiguration(), $conn->getEventManager());
        $this->generatorTableName = $generatorTableName;
    }

    /**
     * Generates the next unused value for the given sequence name.
     *
     * @param string $sequenceName
     *
     * @return integer
     *
     * @throws \Doctrine\DBAL\DBALException
     */
    public function nextValue($sequenceName)
    {
        if (isset($this->sequences[$sequenceName])) {
            $value = $this->sequences[$sequenceName]['value'];
            $this->sequences[$sequenceName]['value']++;
            if ($this->sequences[$sequenceName]['value'] >= $this->sequences[$sequenceName]['max']) {
                unset ($this->sequences[$sequenceName]);
            }

            return $value;
        }

        $this->conn->beginTransaction();

        try {
            $platform = $this->conn->getDatabasePlatform();
            $sql = "SELECT sequence_value, sequence_increment_by " .
                   "FROM " . $platform->appendLockHint($this->generatorTableName, \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) . " " .
                   "WHERE sequence_name = ? " . $platform->getWriteLockSQL();
            $stmt = $this->conn->executeQuery($sql, array($sequenceName));

            if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
                $row = array_change_key_case($row, CASE_LOWER);

                $value = $row['sequence_value'];
                $value++;

                if ($row['sequence_increment_by'] > 1) {
                    $this->sequences[$sequenceName] = array(
                        'value' => $value,
                        'max' => $row['sequence_value'] + $row['sequence_increment_by']
                    );
                }

                $sql = "UPDATE " . $this->generatorTableName . " ".
                       "SET sequence_value = sequence_value + sequence_increment_by " .
                       "WHERE sequence_name = ? AND sequence_value = ?";
                $rows = $this->conn->executeUpdate($sql, array($sequenceName, $row['sequence_value']));

                if ($rows != 1) {
                    throw new \Doctrine\DBAL\DBALException("Race-condition detected while updating sequence. Aborting generation");
                }
            } else {
                $this->conn->insert(
                    $this->generatorTableName,
                    array('sequence_name' => $sequenceName, 'sequence_value' => 1, 'sequence_increment_by' => 1)
                );
                $value = 1;
            }

            $this->conn->commit();

        } catch(\Exception $e) {
            $this->conn->rollback();
            throw new \Doctrine\DBAL\DBALException("Error occurred while generating ID with TableGenerator, aborted generation: " . $e->getMessage(), 0, $e);
        }

        return $value;
    }
}


text:
A simple snake project using pure client side JS

[Give it a try!](https://rawgit.com/jonmash/jsSnake/master/index.html)


text:
package nu.validator.datatype;

import org.relaxng.datatype.DatatypeException;

public final class Refresh extends IriRef {

    /**
     * The singleton instance.
     */
    public static final Refresh THE_INSTANCE = new Refresh();

    private Refresh() {
        super();
    }

    private enum State {
        AT_START, DIGIT_SEEN, SEMICOLON_SEEN, SPACE_SEEN, U_SEEN, R_SEEN, L_SEEN, EQUALS_SEEN

    }

    @Override
    public void checkValid(CharSequence literal) throws DatatypeException {
        if (literal.length() == 0) {
            throw newDatatypeException("Empty literal.");
        }
        State state = State.AT_START;
        for (int i = 0; i < literal.length(); i++) {
            char c = literal.charAt(i);
            switch (state) {
                case AT_START:
                    if (isAsciiDigit(c)) {
                        state = State.DIGIT_SEEN;
                        continue;
                    } else {
                        throw newDatatypeException(i,
                                "Expected a digit, but saw ", c, " instead.");
                    }
                case DIGIT_SEEN:
                    if (isAsciiDigit(c)) {
                        continue;
                    } else if (c == ';') {
                        state = State.SEMICOLON_SEEN;
                        continue;
                    } else {
                        throw newDatatypeException(i,
                                "Expected a digit or a semicolon, but saw ", c,
                                " instead.");
                    }
                case SEMICOLON_SEEN:
                    if (isWhitespace(c)) {
                        state = State.SPACE_SEEN;
                        continue;
                    } else {
                        throw newDatatypeException(i,
                                "Expected a space character, but saw ", c,
                                " instead.");
                    }
                case SPACE_SEEN:
                    if (isWhitespace(c)) {
                        continue;
                    } else if (c == 'u' || c == 'U') {
                        state = State.U_SEEN;
                        continue;
                    } else {
                        throw newDatatypeException(
                                i,
                                "Expected a space character or the letter \u201Cu\u201D, but saw ",
                                c, " instead.");
                    }
                case U_SEEN:
                    if (c == 'r' || c == 'R') {
                        state = State.R_SEEN;
                        continue;
                    } else {
                        throw newDatatypeException(i,
                                "Expected the letter \u201Cr\u201D, but saw ",
                                c, " instead.");
                    }
                case R_SEEN:
                    if (c == 'l' || c == 'L') {
                        state = State.L_SEEN;
                        continue;
                    } else {
                        throw newDatatypeException(i,
                                "Expected the letter \u201Cl\u201D, but saw ",
                                c, " instead.");
                    }
                case L_SEEN:
                    if (c == '=') {
                        state = State.EQUALS_SEEN;
                        continue;
                    } else {
                        throw newDatatypeException(i,
                                "Expected \u201C=\u201D, but saw ", c,
                                " instead.");
                    }
                case EQUALS_SEEN:
                    if (c == '"' || c == '\'') {
                        throw newDatatypeException(
                                "Expected an unquoted IRI reference, but saw ",
                                c, " instead.");
                    }
                    if (' ' == c || '\t' == c || '\n' == c || '\f' == c
                            || '\r' == c) {
                        throw newDatatypeException("Expected an IRI reference, but saw whitespace instead.");
                    }
                    char l = literal.charAt(literal.length() - 1);
                    if (' ' == l || '\t' == l || '\n' == l || '\f' == l
                            || '\r' == l) {
                        throw newDatatypeException("Trailing whitespace.");
                    }
                    super.checkValid(literal.subSequence(i, literal.length()));
                    return;
            }
        }
        switch (state) {
            case AT_START:
                throw newDatatypeException("Expected a digit, but the literal ended.");
            case DIGIT_SEEN:
                return;
            case SEMICOLON_SEEN:
                throw newDatatypeException("Expected a space character, but the literal ended.");
            case SPACE_SEEN:
                throw newDatatypeException("Expected a space character or the letter \u201Cu\u201D, but the literal ended.");
            case U_SEEN:
                throw newDatatypeException("Expected the letter \u201Cr\u201D, but the literal ended.");
            case R_SEEN:
                throw newDatatypeException("Expected the letter \u201Cl\u201D, but the literal ended.");
            case L_SEEN:
                throw newDatatypeException("Expected \u201C=\u201D, but the literal ended.");
            case EQUALS_SEEN:
                throw newDatatypeException("Expected an IRI reference, but the literal ended.");
        }
    }

    @Override
    public String getName() {
        return "refresh";
    }

}


text:
package cc

import (
	"fmt"
	"io"
	"io/ioutil"
	"strings"
)

func Read(name string, r io.Reader) (*Prog, error) {
	return ReadMany([]string{name}, []io.Reader{r})
}

func ReadMany(names []string, readers []io.Reader) (*Prog, error) {
	lx := &lexer{}
	var prog *Prog
	for i, name := range names {
		if lx.includeSeen[name] != nil {
			continue
		}
		r := readers[i]
		data, err := ioutil.ReadAll(r)
		if err != nil {
			return nil, err
		}
		data = append(data, '\n')
		lx.start = startProg
		lx.lexInput = lexInput{
			input:  string(data),
			file:   name,
			lineno: 1,
		}
		lx.parse()
		if lx.errors != nil {
			return nil, fmt.Errorf("%v", lx.errors[0])
		}
		if prog == nil {
			prog = lx.prog
		} else {
			prog.Span.End = lx.prog.Span.End
			prog.Decls = append(prog.Decls, lx.prog.Decls...)
		}
		lx.prog = nil
		for sc := lx.scope; sc != nil; sc = sc.Next {
			for name, decl := range sc.Decl {
				if decl.Storage&Static != 0 || (decl.Storage&Typedef != 0 && strings.HasSuffix(decl.Span.Start.File, ".c")) {
					delete(sc.Decl, name)
				}
			}
			for name, typ := range sc.Tag {
				if strings.HasSuffix(typ.Span.Start.File, ".c") {
					delete(sc.Tag, name)
				}
			}
		}
	}
	lx.prog = prog
	lx.assignComments()
	lx.typecheck(lx.prog)
	if lx.errors != nil {
		return nil, fmt.Errorf("%v", strings.Join(lx.errors, "\n"))
	}

	removeDuplicates(lx.prog)

	return lx.prog, nil
}

func ParseExpr(str string) (*Expr, error) {
	lx := &lexer{
		start: startExpr,
		lexInput: lexInput{
			input:  str + "\n",
			file:   "<string>",
			lineno: 1,
		},
	}
	lx.parse()
	if lx.errors != nil {
		return nil, fmt.Errorf("parsing expression %#q: %v", str, lx.errors[0])
	}
	return lx.expr, nil
}

type Prog struct {
	SyntaxInfo
	Decls []*Decl
}

// removeDuplicates drops the duplicated declarations
// caused by forward decls from prog.
// It keeps the _last_ of each given declaration,
// assuming that's the complete one.
// This heuristic tends to preserve something like
// source order.
// It would be defeated by someone writing a "forward"
// declaration following the real definition.
func removeDuplicates(prog *Prog) {
	count := map[*Decl]int{}
	for _, d := range prog.Decls {
		count[d]++
	}
	var out []*Decl
	for _, d := range prog.Decls {
		count[d]--
		if count[d] == 0 {
			out = append(out, d)
		}
	}
	prog.Decls = out
}


text:
from goshna import *
from flask import make_response, jsonify

# Standard function
def query_db(query, args=(), one=False):
    cur = c.execute(query, args)
    rv = [dict((cur.description[idx][0], value)
        for idx, value in enumerate(row)) for row in cur.fetchall()]
    return (rv[0] if rv else None) if one else rv

def post_db(query, args=(), one=False):
    cur = c.execute(query, args)
    rv = [dict((cur.description[idx][0], value)
        for idx, value in enumerate(row)) for row in cur.fetchall()]
    conn.commit()
    return (rv[0] if rv else None) if one else rv

@app.errorhandler(404)
def not_found(error):
    return make_response(jsonify({'error': 'Not found'}), 404)


text:
/**
 * External dependencies
 */

/**
 * Internal dependencies
 */
import {
	VALIDATION_FAILURE,
	VALIDATION_REQUEST,
	VALIDATION_SUCCESS
} from 'client/state/action-types'
import lookup from 'client/lib/lookup'

function requestValidation() {
	return {
		type: VALIDATION_REQUEST,
		isFetching: true
	}
}

function receiveValidation(data) {
	return {
		type: VALIDATION_SUCCESS,
		isFetching: false,
		data
	}
}

function validationError(exception) {
	return {
		type: VALIDATION_FAILURE,
		isFetching: false,
		exception
	}
}

export function validate(quizId, password) {
	let config = {
		isAuthenticated: true,
		method: 'GET'
	}

	return function (dispatch) {
		dispatch(requestValidation())

		lookup(`api/validate/${quizId}?password=${password}`, config)
			.then(function (response) {
				return response.json()
			})
			.then(function (data) {
				if (data.exception) {
					dispatch(validationError(data.exception))

					return
				}

				localStorage.setItem(`quizzes.${quizId}.password`, password)

				dispatch(receiveValidation())

				location.replace(`/quizzes/${quizId}`)
			})
			.catch(function (error) {
				dispatch(validationError())
			})
	}
}


text:
class Groups::LabelsController < Groups::ApplicationController
  before_action :label, only: [:edit, :update, :destroy]
  before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy]
  before_action :save_previous_label_path, only: [:edit]

  respond_to :html

  def index
    respond_to do |format|
      format.html do
        @labels = @group.labels.page(params[:page])
      end

      format.json do
        available_labels = LabelsFinder.new(current_user, group_id: @group.id).execute
        render json: available_labels.as_json(only: [:id, :title, :color])
      end
    end
  end

  def new
    @label = @group.labels.new
    @previous_labels_path = previous_labels_path
  end

  def create
    @label = @group.labels.create(label_params)

    if @label.valid?
      redirect_to group_labels_path(@group)
    else
      render :new
    end
  end

  def edit
    @previous_labels_path = previous_labels_path
  end

  def update
    if @label.update_attributes(label_params)
      redirect_back_or_group_labels_path
    else
      render :edit
    end
  end

  def destroy
    @label.destroy

    respond_to do |format|
      format.html do
        redirect_to group_labels_path(@group), notice: 'Label was removed'
      end
      format.js
    end
  end

  protected

  def authorize_admin_labels!
    return render_404 unless can?(current_user, :admin_label, @group)
  end

  def authorize_read_labels!
    return render_404 unless can?(current_user, :read_label, @group)
  end

  def label
    @label ||= @group.labels.find(params[:id])
  end

  def label_params
    params.require(:label).permit(:title, :description, :color)
  end

  def redirect_back_or_group_labels_path(options = {})
    redirect_to previous_labels_path, options
  end

  def previous_labels_path
    session.fetch(:previous_labels_path, fallback_path)
  end

  def fallback_path
    group_labels_path(@group)
  end

  def save_previous_label_path
    session[:previous_labels_path] = URI(request.referer || '').path
  end
end


text:
export interface IListItem {
    name:string;
    description:string;
    url:string;
    iconName:string;
}


text:
#/bin/bash
cd $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH
export NODE_ENV=production

rm -r web/*
git reset --hard HEAD
git pull
npm install
chown -R www-data:www-data .
coffee index.coffee compile
pm2 gracefulReload ${PWD##*/}


text:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_CONSENSUS_PARAMS_H
#define BITCOIN_CONSENSUS_PARAMS_H

#include <uint256.h>
#include <llmq/params.h>

#include <map>

namespace Consensus {

enum DeploymentPos {
    DEPLOYMENT_TESTDUMMY,
    DEPLOYMENT_CSV,     // Deployment of BIP68, BIP112, and BIP113.
    DEPLOYMENT_DIP0001, // Deployment of DIP0001 and lower transaction fees.
    DEPLOYMENT_BIP147,  // Deployment of BIP147 (NULLDUMMY)
    DEPLOYMENT_DIP0003, // Deployment of DIP0002 and DIP0003 (txv3 and deterministic MN lists)
    DEPLOYMENT_DIP0008, // Deployment of ChainLock enforcement
    DEPLOYMENT_REALLOC, // Deployment of Block Reward Reallocation
    DEPLOYMENT_DIP0020, // Deployment of DIP0020, DIP0021 and LMQ_100_67 quorums
    DEPLOYMENT_DIP0024, // Deployment of DIP0024 (Quorum Rotation) and decreased governance proposal fee
    // NOTE: Also add new deployments to VersionBitsDeploymentInfo in versionbits.cpp
    MAX_VERSION_BITS_DEPLOYMENTS
};

/**
 * Struct for each individual consensus rule change using BIP9.
 */
struct BIP9Deployment {
    /** Bit position to select the particular bit in nVersion. */
    int bit;
    /** Start MedianTime for version bits miner confirmation. Can be a date in the past */
    int64_t nStartTime;
    /** Timeout/expiry MedianTime for the deployment attempt. */
    int64_t nTimeout;
    /** The number of past blocks (including the block under consideration) to be taken into account for locking in a fork. */
    int64_t nWindowSize{0};
    /** A starting number of blocks, in the range of 1..nWindowSize, which must signal for a fork in order to lock it in. */
    int64_t nThresholdStart{0};
    /** A minimum number of blocks, in the range of 1..nWindowSize, which must signal for a fork in order to lock it in. */
    int64_t nThresholdMin{0};
    /** A coefficient which adjusts the speed a required number of signaling blocks is decreasing from nThresholdStart to nThresholdMin at with each period. */
    int64_t nFalloffCoeff{0};
};

/**
 * Parameters that influence chain consensus.
 */
struct Params {
    uint256 hashGenesisBlock;
    uint256 hashDevnetGenesisBlock;
    int nSubsidyHalvingInterval;
    int nMasternodePaymentsStartBlock;
    int nMasternodePaymentsIncreaseBlock;
    int nMasternodePaymentsIncreasePeriod; // in blocks
    int nInstantSendConfirmationsRequired; // in blocks
    int nInstantSendKeepLock; // in blocks
    int nBudgetPaymentsStartBlock;
    int nBudgetPaymentsCycleBlocks;
    int nBudgetPaymentsWindowBlocks;
    int nSuperblockStartBlock;
    uint256 nSuperblockStartHash;
    int nSuperblockCycle; // in blocks
    int nSuperblockMaturityWindow; // in blocks
    int nGovernanceMinQuorum; // Min absolute vote count to trigger an action
    int nGovernanceFilterElements;
    int nMasternodeMinimumConfirmations;
    /** Block height and hash at which BIP34 becomes active */
    int BIP34Height;
    uint256 BIP34Hash;
    /** Block height at which BIP65 becomes active */
    int BIP65Height;
    /** Block height at which BIP66 becomes active */
    int BIP66Height;
    /** Block height at which DIP0001 becomes active */
    int DIP0001Height;
    /** Block height at which DIP0003 becomes active */
    int DIP0003Height;
    /** Block height at which DIP0003 becomes enforced */
    int DIP0003EnforcementHeight;
    uint256 DIP0003EnforcementHash;
    /** Block height at which DIP0008 becomes active */
    int DIP0008Height;
    /** Block height at which BRR becomes active */
    int BRRHeight;
    /** Don't warn about unknown BIP 9 activations below this height.
     * This prevents us from warning about the CSV and DIP activations. */
    int MinBIP9WarningHeight;
    /**
     * Minimum blocks including miner confirmation of the total of nMinerConfirmationWindow blocks in a retargeting period,
     * (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments.
     * Default BIP9Deployment::nThresholdStart value for deployments where it's not specified and for unknown deployments.
     * Examples: 1916 for 95%, 1512 for testchains.
     */
    uint32_t nRuleChangeActivationThreshold;
    // Default BIP9Deployment::nWindowSize value for deployments where it's not specified and for unknown deployments.
    uint32_t nMinerConfirmationWindow;
    BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS];
    /** Proof of work parameters */
    uint256 powLimit;
    bool fPowAllowMinDifficultyBlocks;
    bool fPowNoRetargeting;
    int64_t nPowTargetSpacing;
    int64_t nPowTargetTimespan;
    int nPowKGWHeight;
    int nPowDGWHeight;
    int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }
    uint256 nMinimumChainWork;
    uint256 defaultAssumeValid;

    /** these parameters are only used on devnet and can be configured from the outside */
    int nMinimumDifficultyBlocks{0};
    int nHighSubsidyBlocks{0};
    int nHighSubsidyFactor{1};

    std::vector<LLMQParams> llmqs;
    LLMQType llmqTypeChainLocks;
    LLMQType llmqTypeInstantSend{LLMQType::LLMQ_NONE};
    LLMQType llmqTypeDIP0024InstantSend{LLMQType::LLMQ_NONE};
    LLMQType llmqTypePlatform{LLMQType::LLMQ_NONE};
    LLMQType llmqTypeMnhf{LLMQType::LLMQ_NONE};
};
} // namespace Consensus

#endif // BITCOIN_CONSENSUS_PARAMS_H


text:
require File.expand_path('../../../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe 'Thread::Backtrace::Location#label' do
  it 'returns the base label of the call frame' do
    ThreadBacktraceLocationSpecs.locations[0].label.should include('<top (required)>')
  end

  it 'returns the method name for a method location' do
    ThreadBacktraceLocationSpecs.method_location[0].label.should == "method_location"
  end

  it 'returns the block name for a block location' do
    ThreadBacktraceLocationSpecs.block_location[0].label.should == "block in block_location"
  end

  it 'returns the module name for a module location' do
    ThreadBacktraceLocationSpecs::MODULE_LOCATION[0].label.should include "ThreadBacktraceLocationSpecs"
  end
end


text:
var db = require('../models');

exports.postClients = function(req, res) {
    db.Client.findOrCreate({
        where: {name: req.body.name},
        defaults: {
            name: req.body.name,
            id: req.body.id,
            secret: req.body.secret
        }
    }).spread(function(client, isCreated){
        if(isCreated){
            client.setUser(req.user.id);
            res.json({status: true, message: 'Client aggiunto.', data: client});
        } else {
            res.json({status: true, message: 'Client già esistente.', data: client});
        }
    }).catch(function(err){
        res.json({status: false, data: err});
    });
};

exports.getClients = function(req, res) {
    db.User.findById(
        req.user.id, {include: [db.Client]}
    ).then(function(user){
        res.json(user.Clients);
    }).catch(function(err){
        res.send(err);
    });
};


text:
using GeometryWars.Code.Base;
using GeometryWars.Code.Particles;
using SFML.Graphics;
using SFML.System;

namespace GeometryWars.Code.Emmiters
{
	class EnemyExplosionEmiter : BaseEmitter
	{
		#region Private Fields
		private const float _emitterDuration = 0.075f;
		private const int count = 50;
		#endregion Private Fields

		#region Public Constructors

		public EnemyExplosionEmiter(Vector2f pos, Color color)
			: base(pos, count, _emitterDuration, color)
		{
		}

		#endregion Public Constructors

		#region Public Methods

		public override BaseParticle ParticleToAdd(Vector2f pos, Color color)
		{
			return new EnemyExplosionParticle(pos, color);
		}

		#endregion Public Methods
	}
}


text:
Bitcore Payment Protocol
=======
https://github.com/bitpay/bitcore/tree/master/packages/bitcore-payment-protocol


text:
<?php

namespace App\Controllers;

use Core\MainController;
use Core\Config;

/**
 * Controller da página principal do site
 */
class IndexController extends MainController
{
	//------------------------------------------------------------
	//	PUBLIC METHODS
	//------------------------------------------------------------

	/**
	 * Página principal do site, acessada por:
	 * dominio.com/
	 *
	 * @access public
	 * @return view
	 */
	public function indexAction()
	{
		$model = $this->model('Index');

		return $this->view($this->getTemplate(), $model->getData());
	}
}


text:
"""Displays available placement strategies for a given search string.

Results are limited to 10.

The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication information"
section of our README.

Tags: strategy.getPlacementStrategiesByCriteria
"""

__author__ = 'Joseph DiLallo'

# Import appropriate modules from the client library.
from googleads import dfa

def main(client):
  # Initialize appropriate service.
  placement_strategy_service = client.GetService(
      'strategy', 'v1.20', 'https://advertisersapitest.doubleclick.net')

  # Create placement strategy search criteria structure.
  placement_strategy_search_criteria = {
      'pageSize': '10'
  }

  # Get placement strategy record set.
  results = placement_strategy_service.getPlacementStrategiesByCriteria(
      placement_strategy_search_criteria)

  # Display placement strategy names, IDs and descriptions.
  if results['records']:
    for placement in results['records']:
      print ('Placement strategy with name \'%s\' and ID \'%s\' was found.'
             % (placement['name'], placement['id']))
  else:
    print 'No placement strategies found for your criteria.'

if __name__ == '__main__':
  # Initialize client object.
  dfa_client = dfa.DfaClient.LoadFromStorage()
  main(dfa_client)


text:
@implementation KMAppearence {

}
@end


text:
<?php

namespace Vectro;

abstract class ElementAbstract
{
	private $attributes = array();
	private $children = array();

	/**
	 * Gets an attribute. A dedicated getter can be defined on a per-attribute basis.
	 * @param  string $name Name of the attribute to get
	 * @return mixed        Value of the attribute being gotten
	 */
	public function __get($name)
	{
		$replacedName = $this->replaceName($name);

		if (method_exists($this, 'get' . ucfirst($name)))
		{
			$method = 'get' . ucfirst($name);
			return $this->$method();
		}
		else if (isset($this->attributes[$replacedName]))
		{
			return $this->attributes[$replacedName];
		}
		else
		{
			return null;
		}
	}

	/**
	 * Sets an attribute. A dedicated setter can be defined on a per-attribute basis.
	 * @param string $name  Name of the attribute to set
	 * @param mixed  $value Value of the attribute being set
	 */
	public function __set($name, $value)
	{
		$replacedName = $this->replaceName($name);

		if (method_exists($this, 'set' . ucfirst($name)))
		{
			$method = 'set' . ucfirst($name);
			$this->$method($value);
		}
		else
		{
			$this->attributes[$replacedName] = $value;
		}
	}

	/**
	 * Checks whether an attribute is set.
	 * @param  string  $name Name of the attribute to check if set
	 * @return boolean       Whether or not the attribute is set
	 */
	public function __isset($name)
	{
		$replacedName = $this->replaceName($name);

		if (method_exists($this, 'get' . ucfirst($name)))
		{
			$method = 'get' . ucfirst($name);
			$value = $this->$method();

			if (!is_null($value) && !empty($value))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else if (isset($this->attributes[$replacedName]))
		{
			return true;
		}
		else
		{
			return false;
		}
	}

	/**
	 * Unset an attribute.
	 * @param string $name Name of the attribute to unset
	 */
	public function __unset($name)
	{
		$replacedName = $this->replaceName($name);

		if (isset($this->attributes[$replacedName]))
		{
			unset($this->attributes[$replacedName]);
		}
	}

	/**
	 * Allows characters to be used in attributes that cannot be used in property names.
	 * @param  string $name Name of the property
	 * @return string       Name of the attribute
	 */
	private function replaceName($name)
	{
		return str_replace(array('__', '_'), array(':', '-'), $name);
	}

	/**
	 * Getter to return the list of children of the element.
	 * @return array Array of the element's children
	 */
	protected function getChildren()
	{
		return $this->children;
	}

	/**
	 * Getter to return the list of the attribute-value pairs of the element.
	 * @return array Array of the element's attribute-value pairs
	 */
	protected function getAttributes()
	{
		return $this->attributes;
	}

	/**
	 * Add a child to the element. Child must be an instance of Element, Comment, Xml, CData or of tpye string.
	 * @param  mixed $child The chld to be added to the element
	 * @return mixed        Returns self on success, boolean false on failure
	 */
	public function add($child)
	{
		if (($child instanceof ElementAbstract) || ($child instanceof Comment) || ($child instanceof Xml) || ($child instanceof CData) || (is_string($child)))
		{
			$this->children[] = $child;

			return $this;
		}
		else
		{
			return false;
		}
	}

	/**
	 * Remove a child from the element.
	 * @param  mixed $child The child to be removed from the element
	 * @return mixed        Returns self on success, boolean false on failure
	 */
	public function remove($child)
	{
		$key = array_search($child, $this->children);

		if ($key !== false)
		{
			unset($this->children[$key]);

			return $this;
		}
		else
		{
			return false;
		}
	}

	/**
	 * Add a style property-value pair to the element's style attribute.
	 * @param  string $attribute Name of the style property
	 * @param  string $value     Value of the style property
	 * @return self
	 */
	public function addStyle($attribute, $value)
	{
		$styleArray = $this->styleToArray();

		$styleArray[trim($attribute)] = trim($value);

		$this->arrayToStyle($styleArray);

		return $this;
	}

	/**
	 * Add multiple style proprty-value pairs to the element's style attribute at once.
	 * @param  array $styles Array of style property-value pairs, with the style property name as the array key and the style balue as the array value.
	 * @return self
	 */
	public function addStyles(array $styles)
	{
		$styleArray = $this->styleToArray();

		foreach ($styles as $attribute => $value)
		{
			$styleArray[trim($attribute)] = trim($value);
		}

		$this->arrayToStyle($styleArray);

		return $this;
	}

	/**
	 * Explodes the style attribute into an array of style property-value pairs.
	 * @return array The element's style attribute represented as an array of style property-value pairs
	 */
	private function styleToArray()
	{
		if (!isset($this->style))
		{
			return array();
		}

		$exploded = explode(';', $this->style);
		$styleArray = array();

		foreach ($exploded as $pair)
		{
			if (empty($pair))
			{
				break;
			}

			list($attribute, $value) = explode(':', trim($pair), 2); // Limit of 2 so that you can have values such as "progid:DXImageTransform.*" etc.
			$styleArray[trim($attribute)] = trim($value);
		}

		return $styleArray;
	}

	/**
	 * Implodes an array of style property-value pairs into the element's style attribute.
	 * @param  array  $styleArray An array of style property-value pairs
	 */
	private function arrayToStyle(array $styleArray)
	{
		$style = '';

		foreach ($styleArray as $attribute => $value)
		{
			$style .= $attribute . ': ' . $value . '; ';
		}

		$this->style = substr($style, 0, -1);
	}

	/**
	 * Apply a matrix transformation on the element.
	 * @param  float $a
	 * @param  float $b
	 * @param  float $c
	 * @param  float $d
	 * @param  float $e
	 * @param  float $f
	 * @return self
	 */
	public function matrix($a, $b, $c, $d, $e, $f)
	{
		$transformString = 'matrix(' . implode(', ', array_map('floatval', array($a, $b, $c, $d, $e, $f))) . ')';
		$this->addTransform($transformString);

		return $this;
	}

	/**
	 * Apply a translate transformation to the element.
	 * @param  float $x Value by which to translate on the x-axis
	 * @param  float $y Value by which to translate on the y-axis
	 * @return self
	 */
	public function translate($x, $y = 0)
	{
		$transformString = 'translate(' . (float) $x . ', ' . (float) $y . ')';
		$this->addTransform($transformString);

		return $this;
	}

	/**
	 * Apply a scale transformation to the element.
	 * @param  float $x Value by which to scale on the x-axis
	 * @param  float $y Value by which to scale on the y-axis
	 * @return self
	 */
	public function scale($x, $y = null)
	{
		$transformString = 'scale(' . (float) $x . ', ' . (($y !== null) ? (float) $y : (float) $x) . ')';
		$this->addTransform($transformString);

		return $this;
	}

	/**
	 * Apply a rotate transformation to the element.
	 * @param  float $angle Angle by which to rotate
	 * @param  float $cx    x-coordinate of the point about which the rotation will be performed
	 * @param  float $cy    y-coordinate of the point about which the rotation will be performed
	 * @return self
	 */
	public function rotate($angle, $cx = null, $cy = null)
	{
		$transformString = 'rotate(' . (float) $angle . (($cx !== null) ? ', ' . (float) $cx . ', ' . (($cy !== null) ? (float) $cy : (float) $cx) : '') . ')';
		$this->addTransform($transformString);

		return $this;
	}

	/**
	 * Apply a skew transformation to the element along the x-axis.
	 * @param  float $x Value by which to skew
	 * @return self
	 */
	public function skewX($x)
	{
		$transformString = 'skewX(' . (float) $x . ')';
		$this->addTransform($transformString);

		return $this;
	}

	/**
	 * Apply a skew transformation to the element along the y-axis.
	 * @param  float $y Value by which to skew
	 * @return self
	 */
	public function skewY($y)
	{
		$transformString = 'skewY(' . (float) $y . ')';
		$this->addTransform($transformString);

		return $this;
	}

	/**
	 * Separately apply a skew transformation to the element along the x-axis and the y-axis. Calls skewX and skewY sequentially.
	 * @param  float $x Value by which to skew along the x-axis
	 * @param  float $y Balue by which to skew along the y-axis
	 * @return self
	 */
	public function skewXY($x, $y)
	{
		$this->skewX($x)->skewY($y);

		return $this;
	}

	/**
	 * Adds a transformation to the element's transform attribute.
	 * @param string $transformString The transformation string to be added
	 */
	protected function addTransform($transformString)
	{
		if (!isset($this->transform))
		{
			$this->transform = $transformString;
		}
		else
		{
			$this->transform .= ' ' . $transformString;
		}
	}

	/**
	 * Sets a properly formed value for the element's viewBox attribute.
	 * @param  array  $viewBox A 4 value array containing the min-x, min-y, width and height of the viewBox, in that order
	 * @return bool            Whether or not a valid value for viewBox was able to be set
	 */
	public function viewBox(array $viewBox)
	{
		if (sizeof($viewBox) == 4)
		{
			$viewBox[0] = (float) $viewBox[0];
			$viewBox[1] = (float) $viewBox[1];
			$viewBox[2] = abs((float) $viewBox[2]);
			$viewBox[3] = abs((float) $viewBox[3]);

			$this->viewBox = implode(' ', $viewBox);

			return true;
		}

		return false;
	}
}


text:
from __future__ import unicode_literals

from django.db import migrations

class Migration(migrations.Migration):

    dependencies = [
        ('studygroups', '0097_profile_reason_for_registration'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='profile',
            name='reason_for_registration',
        ),
    ]


text:
import webob.exc

from nova.api.openstack import extensions
from nova.api.openstack import wsgi
import nova.openstack.common.log as logging

LOG = logging.getLogger(__name__)

class SchedulerHintsController(wsgi.Controller):

    @staticmethod
    def _extract_scheduler_hints(body):
        hints = {}

        try:
            hints.update(body['os:scheduler_hints'])

        # Ignore if data is not present
        except KeyError:
            pass

        # Fail if non-dict provided
        except ValueError:
            msg = _("Malformed scheduler_hints attribute")
            raise webob.exc.HTTPBadRequest(reason=msg)

        return hints

    @wsgi.extends
    def create(self, req, body):
        hints = self._extract_scheduler_hints(body)

        if 'server' in body:
            body['server']['scheduler_hints'] = hints
            yield
        else:
            msg = _("Missing server attribute")
            raise webob.exc.HTTPBadRequest(reason=msg)

class Scheduler_hints(extensions.ExtensionDescriptor):
    """Pass arbitrary key/value pairs to the scheduler"""

    name = "SchedulerHints"
    alias = "os-scheduler-hints"
    namespace = ("http://docs.openstack.org/compute/ext/"
                 "scheduler-hints/api/v2")
    updated = "2011-07-19T00:00:00+00:00"

    def get_controller_extensions(self):
        controller = SchedulerHintsController()
        ext = extensions.ControllerExtension(self, 'servers', controller)
        return [ext]


text:
package io.volkan;

public class CustomerAccount {
    private int accountType;
    private double balance;

    public CustomerAccount(int type, double bal) {
        accountType = type;
        balance = bal;
    }

    public int getAccountType() {return accountType;}
    public double getBalance() {return balance;}
    public void setBalance(double balance) {this.balance = balance;}
}


text: <img src="../../local/img/fpo_square.png" alt="Square Thumbnail" />


text:
Termbox is a library that provides a minimalistic API which allows the programmer to write text-based user interfaces. The library is crossplatform and has both terminal-based implementations on *nix operating systems and a winapi console based implementation for windows operating systems. The basic idea is an abstraction of the greatest common subset of features available on all major terminals and other terminal-like APIs in a minimalistic fashion. Small API means it is easy to implement, test, maintain and learn it, that's what makes the termbox a distinct library in its area.

### Installation
Install and update this go package with `go get -u github.com/nsf/termbox-go`

### Examples
For examples of what can be done take a look at demos in the _demos directory. You can try them with go run: `go run _demos/keyboard.go`

There are also some interesting projects using termbox-go:
 - [godit](https://github.com/nsf/godit) is an emacsish lightweight text editor written using termbox.
 - [gomatrix](https://github.com/GeertJohan/gomatrix) connects to The Matrix and displays it's data streams in your terminal.
 - [httopd](https://github.com/verdverm/httopd) is top for httpd logs.
 - [termui](https://github.com/gizak/termui) is a terminal dashboard.
 - [gotetris](https://github.com/jjinux/gotetris) is an implementation of Tetris.

### API reference
[godoc.org/github.com/nsf/termbox-go](http://godoc.org/github.com/nsf/termbox-go)


text:
A factory package for Meteor.

This version is very similar to https://atmospherejs.com/dburles/factory although internally it's implementation is quite different.

## Usage

To define a factory:

```
Factory.define("app", Apps, {
  name: function() { return Faker.name(); }
});
```

To create an app and insert it into the collection
(usually for things like unit tests):
```
Factory.create("app");
```

To build an app, appropriate for `Apps.insert` (or other purposes, e.g. styleguide):
```
Factory.build("app")
```

### Relationships

A key thing is relationships between factories.

```
Factory.define("appVersion", AppVersions, {
  app: Factory.get("app")
});
```

If we call `Factory.create("appVersion")`, it will return a single version, but *will also insert an app into the `Apps`*. The `app` key on the version will allow you to find it.

If you call `Factory.build("appVersion")` *no app* will be created and the `app` key will be set to a random id (NOTE: this may be a bad idea and quite confusing).

There is a more useful method for this case:

```
Factory.compile("appVersion")
```

This returns an object with *collection names* as keys and an array of build documents as values, for instance:
```
{
  appVersions: [{...}],
  apps: [{...}]
}
```

This is useful for styleguide specs for instance, as the component will usually need some or all of this data.

## TODO

- JSdocs
- Support mutators/validation for insert
- afterCreate / decide on what after does
- make extend a little saner?
- decide if we'll send a PR to dburles or call this a separate package.
- Allow "runtime" dependencies between packages
- Seed approach for unit test consistency and speed.


text:
using Xunit;

namespace System.Tests
{
    public class ConvertToSByteTests : ConvertTestBase<SByte>
    {
        [Fact]
        public void FromBoolean()
        {
            Boolean[] testValues = { true, false };
            SByte[] expectedValues = { 1, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);
        }

        [Fact]
        public void FromByte()
        {
            Byte[] testValues = { 100, 0 };
            SByte[] expectedValues = { 100, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);

            Byte[] overflowValues = { Byte.MaxValue };
            VerifyThrows<OverflowException, Byte>(Convert.ToSByte, overflowValues);
        }

        [Fact]
        public void FromChar()
        {
            Char[] testValues = { 'A', Char.MinValue, };
            SByte[] expectedValues = { 65, (SByte)Char.MinValue };
            Verify(Convert.ToSByte, testValues, expectedValues);
        }

        [Fact]
        public void FromDecimal()
        {
            Decimal[] testValues = { 100m, -100m, 0m };
            SByte[] expectedValues = { 100, -100, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);

            Decimal[] overflowValues = { Decimal.MaxValue, Decimal.MinValue };
            VerifyThrows<OverflowException, Decimal>(Convert.ToSByte, overflowValues);
        }

        [Fact]
        public void FromDouble()
        {
            Double[] testValues = { 100.0, -100.0, 0 };
            SByte[] expectedValues = { 100, -100, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);

            Double[] overflowValues = { Double.MaxValue, Double.MinValue };
            VerifyThrows<OverflowException, Double>(Convert.ToSByte, overflowValues);
        }

        [Fact]
        public void FromInt16()
        {
            Int16[] testValues = { 100, -100, 0 };
            SByte[] expectedValues = { 100, -100, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);

            Int64[] overflowValues = { Int64.MaxValue, Int64.MinValue };
            VerifyThrows<OverflowException, Int64>(Convert.ToSByte, overflowValues);
        }

        [Fact]
        public void FromInt32()
        {
            Int32[] testValues = { 100, -100, 0 };
            SByte[] expectedValues = { 100, -100, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);

            Int32[] overflowValues = { Int32.MaxValue, Int32.MinValue };
            VerifyThrows<OverflowException, Int32>(Convert.ToSByte, overflowValues);
        }

        [Fact]
        public void FromInt64()
        {
            Int64[] testValues = { 100, -100, 0 };
            SByte[] expectedValues = { 100, -100, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);

            Int64[] overflowValues = { Int64.MaxValue, Int64.MinValue };
            VerifyThrows<OverflowException, Int64>(Convert.ToSByte, overflowValues);
        }

        [Fact]
        public void FromObject()
        {
            Object[] testValues = { null };
            SByte[] expectedValues = { 0 };
            VerifyFromObject(Convert.ToSByte, Convert.ToSByte, testValues, expectedValues);

            Object[] invalidValues = { new Object(), DateTime.Now };
            VerifyFromObjectThrows<InvalidCastException>(Convert.ToSByte, Convert.ToSByte, invalidValues);
        }

        [Fact]
        public void FromSByte()
        {
            SByte[] testValues = { SByte.MaxValue, SByte.MinValue };
            SByte[] expectedValues = { SByte.MaxValue, SByte.MinValue };
            Verify(Convert.ToSByte, testValues, expectedValues);
        }

        [Fact]
        public void FromSingle()
        {
            Single[] testValues = { 100.0f, -100.0f, 0.0f, };
            SByte[] expectedValues = { 100, -100, 0, };
            Verify(Convert.ToSByte, testValues, expectedValues);

            Single[] overflowValues = { Single.MaxValue, Single.MinValue };
            VerifyThrows<OverflowException, Single>(Convert.ToSByte, overflowValues);
        }

        [Fact]
        public void FromString()
        {
            String[] testValues = { "100", "-100", "0", SByte.MinValue.ToString(), SByte.MaxValue.ToString() };
            SByte[] expectedValues = { 100, -100, 0, SByte.MinValue, SByte.MaxValue };
            VerifyFromString(Convert.ToSByte, Convert.ToSByte, testValues, expectedValues);

            String[] overflowValues = { Int16.MinValue.ToString(), Int16.MaxValue.ToString() };
            VerifyFromStringThrows<OverflowException>(Convert.ToSByte, Convert.ToSByte, overflowValues);

            String[] formatExceptionValues = { "abba" };
            VerifyFromStringThrows<FormatException>(Convert.ToSByte, Convert.ToSByte, formatExceptionValues);

            // Note: Only the Convert.ToSByte(String, IFormatProvider) overload throws an ArgumentNullException.
            // This is inconsistent with the other numeric conversions, but fixing this behavior is not worth making
            // a breaking change which will affect the desktop CLR.
            Assert.Throws<ArgumentNullException>(() => Convert.ToSByte((String)null, TestFormatProvider.s_instance));
        }

        [Fact]
        public void FromStringWithBase()
        {
            String[] testValues = { null, null, null, null, "7f", "127", "177", "1111111", "80", "-128", "200", "10000000" };
            Int32[] testBases = { 10, 2, 8, 16, 16, 10, 8, 2, 16, 10, 8, 2 };
            SByte[] expectedValues = { 0, 0, 0, 0, SByte.MaxValue, SByte.MaxValue, SByte.MaxValue, SByte.MaxValue, SByte.MinValue, SByte.MinValue, SByte.MinValue, SByte.MinValue };
            VerifyFromStringWithBase(Convert.ToSByte, testValues, testBases, expectedValues);

            String[] overflowValues = { "128", "-129", "111111111", "1FF", "777" };
            Int32[] overflowBases = { 10, 10, 2, 16, 8 };
            VerifyFromStringWithBaseThrows<OverflowException>(Convert.ToSByte, overflowValues, overflowBases);

            String[] formatExceptionValues = { "12", "ffffffffffffffffffff" };
            Int32[] formatExceptionBases = { 2, 8 };
            VerifyFromStringWithBaseThrows<FormatException>(Convert.ToSByte, formatExceptionValues, formatExceptionBases);

            String[] argumentExceptionValues = { "10", "11", "abba", "-ab" };
            Int32[] argumentExceptionBases = { -1, 3, 0, 16 };
            VerifyFromStringWithBaseThrows<ArgumentException>(Convert.ToSByte, argumentExceptionValues, argumentExceptionBases);
        }

        [Fact]
        public void FromUInt16()
        {
            UInt16[] testValues = { 100, 0 };
            SByte[] expectedValues = { 100, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);

            UInt16[] overflowValues = { UInt16.MaxValue };
            VerifyThrows<OverflowException, UInt16>(Convert.ToSByte, overflowValues);
        }

        [Fact]
        public void FromUInt32()
        {
            UInt32[] testValues = { 100, 0 };
            SByte[] expectedValues = { 100, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);

            UInt32[] overflowValues = { UInt32.MaxValue };
            VerifyThrows<OverflowException, UInt32>(Convert.ToSByte, overflowValues);
        }

        [Fact]
        public void FromUInt64()
        {
            UInt64[] testValues = { 100, 0 };
            SByte[] expectedValues = { 100, 0 };
            Verify(Convert.ToSByte, testValues, expectedValues);

            UInt64[] overflowValues = { UInt64.MaxValue };
            VerifyThrows<OverflowException, UInt64>(Convert.ToSByte, overflowValues);
        }
    }
}


text:
/*
    This file is part of the WebKit open source project.
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include "config.h"
#include "JSStyleSheet.h"

#include "JSMediaList.h"
#include "JSNode.h"
#include "JSStyleSheet.h"
#include "KURL.h"
#include "MediaList.h"
#include "Node.h"
#include "StyleSheet.h"
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

ASSERT_CLASS_FITS_IN_CELL(JSStyleSheet);

/* Hash table */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif

static const HashTableValue JSStyleSheetTableValues[9] =
{
    { "type", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetType), (intptr_t)0 THUNK_GENERATOR(0) },
    { "disabled", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetDisabled), (intptr_t)setJSStyleSheetDisabled THUNK_GENERATOR(0) },
    { "ownerNode", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetOwnerNode), (intptr_t)0 THUNK_GENERATOR(0) },
    { "parentStyleSheet", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetParentStyleSheet), (intptr_t)0 THUNK_GENERATOR(0) },
    { "href", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetHref), (intptr_t)0 THUNK_GENERATOR(0) },
    { "title", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetTitle), (intptr_t)0 THUNK_GENERATOR(0) },
    { "media", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetMedia), (intptr_t)0 THUNK_GENERATOR(0) },
    { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
};

#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSStyleSheetTable = { 17, 15, JSStyleSheetTableValues, 0 };
/* Hash table for constructor */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif

static const HashTableValue JSStyleSheetConstructorTableValues[1] =
{
    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
};

#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSStyleSheetConstructorTable = { 1, 0, JSStyleSheetConstructorTableValues, 0 };
class JSStyleSheetConstructor : public DOMConstructorObject {
public:
    JSStyleSheetConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);

    virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
    virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
    static const JSC::ClassInfo s_info;
    static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
    {
        return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
    }
protected:
    static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
};

const ClassInfo JSStyleSheetConstructor::s_info = { "StyleSheetConstructor", &DOMConstructorObject::s_info, &JSStyleSheetConstructorTable, 0 };

JSStyleSheetConstructor::JSStyleSheetConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
    : DOMConstructorObject(structure, globalObject)
{
    ASSERT(inherits(&s_info));
    putDirect(exec->globalData(), exec->propertyNames().prototype, JSStyleSheetPrototype::self(exec, globalObject), DontDelete | ReadOnly);
}

bool JSStyleSheetConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSStyleSheetConstructor, JSDOMWrapper>(exec, &JSStyleSheetConstructorTable, this, propertyName, slot);
}

bool JSStyleSheetConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSStyleSheetConstructor, JSDOMWrapper>(exec, &JSStyleSheetConstructorTable, this, propertyName, descriptor);
}

/* Hash table for prototype */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif

static const HashTableValue JSStyleSheetPrototypeTableValues[1] =
{
    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
};

#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSStyleSheetPrototypeTable = { 1, 0, JSStyleSheetPrototypeTableValues, 0 };
const ClassInfo JSStyleSheetPrototype::s_info = { "StyleSheetPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSStyleSheetPrototypeTable, 0 };

JSObject* JSStyleSheetPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSStyleSheet>(exec, globalObject);
}

const ClassInfo JSStyleSheet::s_info = { "StyleSheet", &JSDOMWrapper::s_info, &JSStyleSheetTable, 0 };

JSStyleSheet::JSStyleSheet(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<StyleSheet> impl)
    : JSDOMWrapper(structure, globalObject)
    , m_impl(impl)
{
    ASSERT(inherits(&s_info));
}

JSObject* JSStyleSheet::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
    return new (exec) JSStyleSheetPrototype(exec->globalData(), globalObject, JSStyleSheetPrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype()));
}

bool JSStyleSheet::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSStyleSheet, Base>(exec, &JSStyleSheetTable, this, propertyName, slot);
}

bool JSStyleSheet::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSStyleSheet, Base>(exec, &JSStyleSheetTable, this, propertyName, descriptor);
}

JSValue jsStyleSheetType(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
    JSValue result = jsStringOrNull(exec, imp->type());
    return result;
}

JSValue jsStyleSheetDisabled(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
    JSValue result = jsBoolean(imp->disabled());
    return result;
}

JSValue jsStyleSheetOwnerNode(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->ownerNode()));
    return result;
}

JSValue jsStyleSheetParentStyleSheet(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentStyleSheet()));
    return result;
}

JSValue jsStyleSheetHref(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
    JSValue result = jsStringOrNull(exec, imp->href());
    return result;
}

JSValue jsStyleSheetTitle(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
    JSValue result = jsStringOrNull(exec, imp->title());
    return result;
}

JSValue jsStyleSheetMedia(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->media()));
    return result;
}

JSValue jsStyleSheetConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSStyleSheet* domObject = static_cast<JSStyleSheet*>(asObject(slotBase));
    return JSStyleSheet::getConstructor(exec, domObject->globalObject());
}

void JSStyleSheet::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
    lookupPut<JSStyleSheet, Base>(exec, propertyName, value, &JSStyleSheetTable, this, slot);
}

void setJSStyleSheetDisabled(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(thisObject);
    StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
    imp->setDisabled(value.toBoolean(exec));
}

JSValue JSStyleSheet::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSStyleSheetConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
}

static inline bool isObservable(JSStyleSheet* jsStyleSheet)
{
    if (jsStyleSheet->hasCustomProperties())
        return true;
    return false;
}

bool JSStyleSheetOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSStyleSheet* jsStyleSheet = static_cast<JSStyleSheet*>(handle.get().asCell());
    if (!isObservable(jsStyleSheet))
        return false;
    void* root = WebCore::root(jsStyleSheet->impl());
    return visitor.containsOpaqueRoot(root);
}

void JSStyleSheetOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSStyleSheet* jsStyleSheet = static_cast<JSStyleSheet*>(handle.get().asCell());
    DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, jsStyleSheet->impl(), jsStyleSheet);
}

StyleSheet* toStyleSheet(JSC::JSValue value)
{
    return value.inherits(&JSStyleSheet::s_info) ? static_cast<JSStyleSheet*>(asObject(value))->impl() : 0;
}

}


text:
<?php

namespace Contracts\Helpers;

use Contracts\Assertions\Assert;

function AssertThat($predicate, $doc)
{
    Assert::That($predicate, $doc);
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syst. Appl. Microbiol. 19: 196 (1996)

#### Original name
Ceratocystis albifundus M.J. Wingf., De Beer & M.J. Morris

### Remarks
null


text:
#ifndef _PEI_USB_PEIM_H_
#define _PEI_USB_PEIM_H_

#include <PiPei.h>

#include <Ppi/UsbHostController.h>
#include <Ppi/Usb2HostController.h>
#include <Ppi/UsbIo.h>

#include <Library/DebugLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/TimerLib.h>
#include <Library/PcdLib.h>

#include <IndustryStandard/Usb.h>

#define MAX_ROOT_PORT             2
#define MAX_ENDPOINT              16

#define USB_SLOW_SPEED_DEVICE     0x01
#define USB_FULL_SPEED_DEVICE     0x02

#define PEI_USB_DEVICE_SIGNATURE  SIGNATURE_32 ('U', 's', 'b', 'D')
typedef struct {
  UINTN                         Signature;
  PEI_USB_IO_PPI                UsbIoPpi;
  EFI_PEI_PPI_DESCRIPTOR        UsbIoPpiList;
  UINT8                         DeviceAddress;
  UINT8                         MaxPacketSize0;
  UINT8                         DeviceSpeed;
  UINT8                         DataToggle;
  UINT8                         IsHub;
  UINT8                         DownStreamPortNo;
  UINT8                         Reserved[2];  // Padding for IPF
  UINTN                         AllocateAddress;
  PEI_USB_HOST_CONTROLLER_PPI   *UsbHcPpi;
  PEI_USB2_HOST_CONTROLLER_PPI  *Usb2HcPpi;
  UINT8                         ConfigurationData[1024];
  EFI_USB_CONFIG_DESCRIPTOR     *ConfigDesc;
  EFI_USB_INTERFACE_DESCRIPTOR  *InterfaceDesc;
  EFI_USB_ENDPOINT_DESCRIPTOR   *EndpointDesc[MAX_ENDPOINT];
  EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator;
} PEI_USB_DEVICE;

#define PEI_USB_DEVICE_FROM_THIS(a) CR (a, PEI_USB_DEVICE, UsbIoPpi, PEI_USB_DEVICE_SIGNATURE)

/**
  Submits control transfer to a target USB device.

  @param  PeiServices            The pointer of EFI_PEI_SERVICES.
  @param  This                   The pointer of PEI_USB_IO_PPI.
  @param  Request                USB device request to send.
  @param  Direction              Specifies the data direction for the data stage.
  @param  Timeout                Indicates the maximum timeout, in millisecond.
  @param  Data                   Data buffer to be transmitted or received from USB device.
  @param  DataLength             The size (in bytes) of the data buffer.

  @retval EFI_SUCCESS            Transfer was completed successfully.
  @retval EFI_OUT_OF_RESOURCES   The transfer failed due to lack of resources.
  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.
  @retval EFI_TIMEOUT            Transfer failed due to timeout.
  @retval EFI_DEVICE_ERROR       Transfer failed due to host controller or device error.

**/
EFI_STATUS
EFIAPI
PeiUsbControlTransfer (
  IN     EFI_PEI_SERVICES          **PeiServices,
  IN     PEI_USB_IO_PPI            *This,
  IN     EFI_USB_DEVICE_REQUEST    *Request,
  IN     EFI_USB_DATA_DIRECTION    Direction,
  IN     UINT32                    Timeout,
  IN OUT VOID                      *Data,      OPTIONAL
  IN     UINTN                     DataLength  OPTIONAL
  );

/**
  Submits bulk transfer to a bulk endpoint of a USB device.

  @param  PeiServices           The pointer of EFI_PEI_SERVICES.
  @param  This                  The pointer of PEI_USB_IO_PPI.
  @param  DeviceEndpoint        Endpoint number and its direction in bit 7.
  @param  Data                  A pointer to the buffer of data to transmit
                                from or receive into.
  @param  DataLength            The lenght of the data buffer.
  @param  Timeout               Indicates the maximum time, in millisecond, which the
                                transfer is allowed to complete.

  @retval EFI_SUCCESS           The transfer was completed successfully.
  @retval EFI_OUT_OF_RESOURCES  The transfer failed due to lack of resource.
  @retval EFI_INVALID_PARAMETER Parameters are invalid.
  @retval EFI_TIMEOUT           The transfer failed due to timeout.
  @retval EFI_DEVICE_ERROR      The transfer failed due to host controller error.

**/
EFI_STATUS
EFIAPI
PeiUsbBulkTransfer (
  IN     EFI_PEI_SERVICES    **PeiServices,
  IN     PEI_USB_IO_PPI      *This,
  IN     UINT8               DeviceEndpoint,
  IN OUT VOID                *Data,
  IN OUT UINTN               *DataLength,
  IN     UINTN               Timeout
  );

/**
  Get the usb interface descriptor.

  @param  PeiServices          General-purpose services that are available to every PEIM.
  @param  This                 Indicates the PEI_USB_IO_PPI instance.
  @param  InterfaceDescriptor  Request interface descriptor.

  @retval EFI_SUCCESS          Usb interface descriptor is obtained successfully.

**/
EFI_STATUS
EFIAPI
PeiUsbGetInterfaceDescriptor (
  IN  EFI_PEI_SERVICES                **PeiServices,
  IN  PEI_USB_IO_PPI                  *This,
  OUT EFI_USB_INTERFACE_DESCRIPTOR    **InterfaceDescriptor
  );

/**
  Get the usb endpoint descriptor.

  @param  PeiServices          General-purpose services that are available to every PEIM.
  @param  This                 Indicates the PEI_USB_IO_PPI instance.
  @param  EndpointIndex        The valid index of the specified endpoint.
  @param  EndpointDescriptor   Request endpoint descriptor.

  @retval EFI_SUCCESS       Usb endpoint descriptor is obtained successfully.
  @retval EFI_NOT_FOUND     Usb endpoint descriptor is NOT found.

**/
EFI_STATUS
EFIAPI
PeiUsbGetEndpointDescriptor (
  IN  EFI_PEI_SERVICES               **PeiServices,
  IN  PEI_USB_IO_PPI                 *This,
  IN  UINT8                          EndpointIndex,
  OUT EFI_USB_ENDPOINT_DESCRIPTOR    **EndpointDescriptor
  );

/**
  Reset the port and re-configure the usb device.

  @param  PeiServices    General-purpose services that are available to every PEIM.
  @param  This           Indicates the PEI_USB_IO_PPI instance.

  @retval EFI_SUCCESS    Usb device is reset and configured successfully.
  @retval Others         Other failure occurs.

**/
EFI_STATUS
EFIAPI
PeiUsbPortReset (
  IN EFI_PEI_SERVICES    **PeiServices,
  IN PEI_USB_IO_PPI      *This
  );

/**
  Send reset signal over the given root hub port.

  @param  PeiServices       Describes the list of possible PEI Services.
  @param  UsbHcPpi          The pointer of PEI_USB_HOST_CONTROLLER_PPI instance.
  @param  Usb2HcPpi         The pointer of PEI_USB2_HOST_CONTROLLER_PPI instance.
  @param  PortNum           The port to be reset.
  @param  RetryIndex        The retry times.

**/
VOID
ResetRootPort (
  IN EFI_PEI_SERVICES               **PeiServices,
  IN PEI_USB_HOST_CONTROLLER_PPI    *UsbHcPpi,
  IN PEI_USB2_HOST_CONTROLLER_PPI   *Usb2HcPpi,
  IN UINT8                          PortNum,
  IN UINT8                          RetryIndex
  );

#endif


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<servico>
    <titulo>Emissão de Certidão Previdenciária</titulo>
    <descricao>
        <![CDATA[Solicitar a emissão de certidão de contribuições previdenciárias. A certidão para fins de averbação de imóvel é emitida somente nas unidades de atendimento presencial. A Declaração de Regularidade de Situação do Contribuinte Individual – DRS-CI deve ser solicitada no INSS.]]>
    </descricao>
    <requisitos/>
    <etapas></etapas>
    <canaisPrestacaoServico>
        <canalPrestacaoServico>
            <tipoCanalPrestacaoServico>
                <titulo>Web</titulo>
            </tipoCanalPrestacaoServico>
            <descricao>Endereço eletrônico do serviço</descricao>
            <url>http://www010.dataprev.gov.br/CWS/CONTEXTO/PCND1/PCND1.HTML</url>
        </canalPrestacaoServico>
        <canalPrestacaoServico>
            <tipoCanalPrestacaoServico>
                <titulo>Presencial</titulo>
            </tipoCanalPrestacaoServico>
            <descricao>Unidades de atendimento presencial (apenas na jurisdição do contribuinte)</descricao>
            <url>https://idg.receita.fazenda.gov.br/contato/unidades-de-atendimento/unidades-de-atendimento</url>
        </canalPrestacaoServico>
    </canaisPrestacaoServico>
    <taxa></taxa>
    <informacoesUteis>
        <informacaoUtil>
            <tipoInformacaoUtil>
                <titulo>Mais informações</titulo>
            </tipoInformacaoUtil>
            <descricao>Orientações gerais sobre o serviço</descricao>
            <url>http://www.receita.fazenda.gov.br/previdencia/CND/Orientacao/Orienta.htm</url>
        </informacaoUtil>
        <informacaoUtil>
            <tipoInformacaoUtil>
                <titulo>Serviços relacionados</titulo>
            </tipoInformacaoUtil>
            <descricao>Ver todos os serviços do assunto "Certidões e Situação Fiscal"</descricao>
            <url>http://www.receita.fazenda.gov.br/aplicacoes/atbhe/tus/default.aspx?/a/3</url>
        </informacaoUtil>
        <informacaoUtil>
            <tipoInformacaoUtil>
                <titulo>Serviços relacionados</titulo>
            </tipoInformacaoUtil>
            <descricao>Ver todos os serviços do assunto "Dívida Ativa da União – DAU"</descricao>
            <url>http://www.receita.fazenda.gov.br/aplicacoes/atbhe/tus/default.aspx?/a/7</url>
        </informacaoUtil>
    </informacoesUteis>
    <compromissosAtendimento></compromissosAtendimento>
    <legislacoes></legislacoes>
    <palavrasChave></palavrasChave>
    <orgaoResponsavel>
        <titulo>Receita Federal</titulo>
    </orgaoResponsavel>
    <orgaoPrestador>
        <titulo>Receital Federal</titulo>
        <endereco></endereco>
        <telefone></telefone>
    </orgaoPrestador>
    <publicosAlvo>
        <publicoAlvo>
            <titulo>Serviços aos cidadãos</titulo>
            <linhasDaViva>
                <linhaDaVida>
                    <titulo>Meu negócio</titulo>
                    <eventoslinhaDaVida>
                        <eventolinhaDaVida>
                            <titulo>Pagar impostos</titulo>
                        </eventolinhaDaVida>
                    </eventoslinhaDaVida>
                </linhaDaVida>
            </linhasDaViva>
        </publicoAlvo>
        <publicoAlvo>
            <titulo>Serviços às empresas</titulo>
            <linhasDaViva>
                <linhaDaVida>
                    <titulo>Meu Negócio</titulo>
                    <eventoslinhaDaVida>
                        <eventolinhaDaVida>
                            <titulo>Pagar impostos</titulo>
                        </eventolinhaDaVida>
                    </eventoslinhaDaVida>
                </linhaDaVida>
            </linhasDaViva>
        </publicoAlvo>
    </publicosAlvo>
    <areasInteresse>
        <area>
            <titulo>Economia e Finanças</titulo>
        </area>
    </areasInteresse>
</servico>


text:
function submit_test_ajax_form_settings(formId, url, inputs, method){

	    // $('#editor_inner').html('');
	    var frm = $('#' + formId);
	    var thisdata;
	    thisdata = 'ajax=true&submit=true&' + $('.settings_form').serialize();

		if(url == '' | !url){
		  url = "<?php echo $SITE_URL;?>include/addons/design_suite/DESIGN/edit_text.php?";
		}

		if(document.getElementById('lang_value')){
		    thisdata += "&value=" + encodeURIComponent(document.getElementById('lang_value').value);
		}

		if(document.getElementById('text')){
		    thisdata += "&text=" + encodeURIComponent(document.getElementById('text').value);
		}
	    //prompt(thisdata);

	    //prompt(url);
	    if(!method){
	          ajax_PAS(url, thisdata, 'get', formId);
		}else{

		  ajax_PAS(url, thisdata, method, formId);
		}
      }

      /*
            function submit_test_ajax_form(formId, url, inputs, method){

	    // $('#editor_inner').html('');
	    var frm = $('#' + formId);
	    var thisdata;
	    thisdata = $('#' + formId).serialize();

		if(url == '' | !url){
		  url = "<?php echo $SITE_URL;?>include/addons/design_suite/DESIGN/edit_text.php?";
		}

		if(document.getElementById('lang_value')){
		    thisdata += "&value=" + encodeURIComponent(document.getElementById('lang_value').value);
		}

		if(document.getElementById('text')){
		    thisdata += "&text=" + encodeURIComponent(document.getElementById('text').value);
		}
	    //prompt(thisdata);

	    if(!method){
	    ajax_PAS(url, thisdata, 'get', formId);
		}else{

	    ajax_PAS(url, thisdata, method, formId);
		}
      }
      */


text:
layout: post
authors: ["Jessica Upani"]
title: "Jessica Upani: Nomination for 2018 Steering Committee"
date: 2017-12-01
time: "00:00:00"
category: ["Governance", "Steering Committee"]
---

### 2018 Election : Jessica Upani

## Who am I?
My name is Jessica Upani. I am Namibian and I am a high school teacher. I am also a 4th year Mathematics and Computer Science undergraduate student at the University of Namibia. I am an executive of the Python Namibia society. We run Python workshops, meetups and Conferences all over the country.

## Previous involvement.
My involvement with the carpentries started in April 2016 when I was one the instructors that were trained by Aleksandra Pawlik in Potchefstroom, South Africa. I then continued with my training and became a certified Software Carpentry instructor on 7th July 2016. My final checkout was done by Greg Wilson.  He gave me my qualification.
I did not do this alone. I was mentored by David Perez-Suarez.
Since then, I hosted and taught two workshops locally. We paired our first workshop with Bertie Seyffert from South Africa. I also had a chance to meet the new instructors that were trained in Cape Town, May 2017.

I am currently training to be an instructor of instructors and I will be maintaining the Python lesson in 2018. Very exciting!

## What can I offer?
I am a teacher, in every sense of the word. I enjoy doing it and the Carpentries gives me one more opportunity to give back to my community. Our community in Namibia is small and the Carpentries give me an opportunity to see a change for the better in that regard.
I enjoy making life for others better and I enjoy sharing what I know with others. Through the Carpentries, I get to do just that. I have helped several scientists conduct their research with ease, and I intend to help many more.

## The way forward.
The have noticed a lot of growth in the Carpentries over the past two years (especially in Africa) and it is all very exciting. And now with the merge, I think that that is a great move and I would like to help get work done. I would like to help reach out to more communities both locally and remotely.

One of the strongest points of the Carpentries is bringing together people from all disciplines. I have never seen any other platform that does such a thing. Which is more of the reason why I want to be more involved in this community.


text:
<TITLE>Review for Dirty Pictures (2000) (TV)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Dirty Pictures (2000) (TV)

reviewed by
Susan Granger

http://www.speakers-podium.com/susangranger.

Susan Granger's review of "DIRTY PICTURES" (SHOWTIME TV - premieres 5/27)

           In 1989, Dennis Barrie (James Woods), director of the
Cincinnati Contemporary Arts Center, booked an exhibit of shocking
images by controversial photographer Robert Mapplethorpe. Months
later, he learned that Washington D.C.'s Corcoran Gallery had canceled
their showing because of the controversy it evoked. But with the
support of his wife (Diana Scarwid) and Board of Directors, Barrie
forged ahead, unaware of the emotional price that he and his family
would pay when Sheriff Simon Leiss, Jr. (Craig T. Nelson) decided that
five of the photos depicting lewd acts of sado-masochism and
homosexuality, plus two nude portraits of children, were not only
offensive but obscene. "How did this happen?" Barrie wonders. "I never
wanted to be a martyr for a cause." Set in court, this Showtime
Original Movie is the story of that scandal - which was evoked last
year when New York's Mayor Rudolph Giuliani once again used the legal
system as a club when he protested the "Sensation" exhibit at the
Brooklyn Museum. Undoubtedly, this Barrie case is deeply disturbing
but perhaps writer Salman Rushdie puts it best: "If you cannot defend
what - to you - is unpalatable, then you do not believe in free
speech. You only believe in the free speech of those who agree with
you." On the Granger TV Movie Gauge of 1 to 10, "Dirty Pictures" is a
significant 7, bravely tackling the provocative issue of freedom of
expression and dealing with what is our most treasured and troubling
Amendment. It's on Sat., May 27, and Wed., May 31, at 9 p.m. on
Showtime - but beware - the film is for mature audiences only. It
contains the seven disputed images and parental caution is mandatory.

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
<?php
/* Prototype  : array array_reverse(array $array [, bool $preserve_keys])
 * Description: Return input as a new array with the order of the entries reversed
 * Source code: ext/standard/array.c
*/

echo "*** Testing array_reverse() : error conditions ***\n";

// zero arguments
echo "\n-- Testing array_reverse() function with Zero arguments --\n";
var_dump( array_reverse() );

// more than the expected number of arguments
echo "\n-- Testing array_diff() function with more than expected no. of arguments --\n";
$array = array(1, 2, 3, 4, 5, 6);
$extra_arg = 10;
var_dump( array_reverse($array, true, $extra_arg) );
var_dump( array_reverse($array, false, $extra_arg) );

echo "Done";
?>


text:
package com.navercorp.pinpoint.web.cluster;

import org.springframework.util.StringUtils;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author koo.taejin
 *
 */
public class CollectorClusterInfoRepository {

    private static final Charset charset = StandardCharsets.UTF_8;

    // for test
    static final String PROFILER_SEPARATOR = "\r\n";

    private final Map<String, Set<String>> repository = new HashMap<>();

    private final Object lock = new Object();

    public void put(String id, byte[] bytes) {

        final Set<String> profilerInfoSet = newProfilerInfo(bytes);
        synchronized (lock) {
            repository.put(id, profilerInfoSet);
        }
    }

    private Set<String> newProfilerInfo(byte[] bytes) {
        final String strData = new String(bytes, charset);
        final List<String> profilerInfoList = Arrays.asList(StringUtils.tokenizeToStringArray(strData, PROFILER_SEPARATOR));
        return new HashSet<>(profilerInfoList);
    }

    public void remove(String id) {
        synchronized (lock) {
            repository.remove(id);
        }
    }

    public List<String> get(String applicationName, String agentId, long startTimeStamp) {
        final String key = bindingKey(applicationName, agentId, startTimeStamp);

        final List<String> result = new ArrayList<>();
        synchronized (lock) {
            for (Map.Entry<String, Set<String>> entry : repository.entrySet()) {
                final Set<String> valueSet = entry.getValue();
                final boolean exist = valueSet.contains(key);
                if (exist) {
                    final String id = entry.getKey();
                    result.add(id);
                }
            }
        }

        return result;
    }

    public void clear() {
        synchronized (lock) {
            repository.clear();
        }
    }

    private String bindingKey(String applicationName, String agentId, long startTimeStamp) {
        StringBuilder key = new StringBuilder(64);

        key.append(applicationName);
        key.append(':');
        key.append(agentId);
        key.append(':');
        key.append(startTimeStamp);

        return key.toString();
    }

    @Override
    public String toString() {
        synchronized (lock) {
            return repository.toString();
        }
    }

}


text:
from django.contrib import admin

from .models import Good, Set, Shop, SuperSet

class BaseAdmin(admin.ModelAdmin):
    list_display = ['romanized_name', 'name', 'price', 'available_from', 'available_until', 'event', 'shop', 'online_id']
    readonly_fields = ['participating_idols', 'participating_groups']

    raw_id_fields = ('event', 'idols', 'groups', 'shop',)
    autocomplete_lookup_fields = {
        'fk': ['event', 'shop'],
        'm2m': ['idols', 'groups']
    }

class GoodAdmin(BaseAdmin):
    fieldsets = (
        (None, {'fields': ('parent', 'category')}),
        (None, {'fields': (('romanized_name', 'name'),)}),
        ('Details', {'fields': (('available_from', 'available_until'), ('price', 'link'), 'image')}),
        ('Sources', {'fields': ('event', 'shop', 'online_id', 'other_info')}),
        ('Participants', {'fields': ('idols', 'groups')}),
        ('Participants (Rendered)', {
            'classes': ('grp-collapse grp-closed',),
            'description': 'This is calculated by the values inputted in "Participants."',
            'fields': ('participating_idols', 'participating_groups')
        }),
        ('Options', {'fields': (
            ('is_bonus_good', 'is_campaign_good'),
            ('is_lottery_good', 'is_set_exclusive'),
            ('is_graduation_good', 'is_birthday_good'),
            ('is_online_exclusive', 'is_mailorder_exclusive'),
        )})
    )

    raw_id_fields = ('event', 'idols', 'groups', 'shop', 'parent',)
    autocomplete_lookup_fields = {
        'fk': ['parent', 'event', 'shop'],
        'm2m': ['idols', 'groups']
    }
admin.site.register(Good, GoodAdmin)

class SetAdmin(BaseAdmin):
    fieldsets = (
        (None, {'fields': ('category',)}),
        (None, {'fields': (('romanized_name', 'name'),)}),
        ('Details', {'fields': (('available_from', 'available_until'), ('price', 'link'), 'image')}),
        ('Sources', {'fields': ('event', 'shop', 'online_id', 'other_info')}),
        ('Participants', {'fields': ('idols', 'groups')}),
        ('Participants (Rendered)', {
            'classes': ('grp-collapse grp-closed',),
            'description': 'This is calculated by the values inputted in "Participants."',
            'fields': ('participating_idols', 'participating_groups')
        }),
        ('Options', {'fields': (
            ('is_graduation_good', 'is_birthday_good'),
            ('is_online_exclusive', 'is_mailorder_exclusive'),
        )})
    )
admin.site.register(Set, SetAdmin)

class ShopAdmin(admin.ModelAdmin):
    fieldsets = ((None, {'fields': (('romanized_name', 'name'), 'slug', 'website_link',)}),)
    list_display = ['romanized_name', 'name', 'website_link']
admin.site.register(Shop, ShopAdmin)

class SuperSetAdmin(BaseAdmin):
    fieldsets = (
        (None, {'fields': ('goods', 'sets',)}),
        (None, {'fields': (('romanized_name', 'name'),)}),
        ('Details', {'fields': (('available_from', 'available_until'), ('price', 'link'), 'image')}),
        ('Sources', {'fields': ('event', 'shop', 'online_id', 'other_info')}),
        ('Participants', {'fields': ('idols', 'groups')}),
        ('Participants (Rendered)', {
            'classes': ('grp-collapse grp-closed',),
            'description': 'This is calculated by the values inputted in "Participants."',
            'fields': ('participating_idols', 'participating_groups')
        }),
        ('Options', {'fields': (
            ('is_graduation_good', 'is_birthday_good'),
            ('is_online_exclusive', 'is_mailorder_exclusive'),
        )})
    )

    raw_id_fields = ('goods', 'sets', 'event', 'idols', 'groups', 'shop',)
    autocomplete_lookup_fields = {
        'fk': ['event', 'shop'],
        'm2m': ['goods', 'sets', 'idols', 'groups']
    }
admin.site.register(SuperSet, SuperSetAdmin)