text:
<?php
/**
 * Definition of the RestrictionType type
 *
 * @author James I. Armes <http://www.jamesarmes.net>
 */

class EWSType_RestrictionType extends EWSType {
	/**
	 * SearchExpression property
	 *
	 * @var EWSType_SearchExpressionType
	 */
	public $SearchExpression;

	/**
	 * Constructor
	 */
	public function __construct() {
		$this->schema = array(
			array(
				'name' => 'SearchExpression',
				'required' => false,
				'type' => 'SearchExpressionType',
			),
		); // end $this->schema
	} // end function __construct()
} // end class RestrictionType


text:
<?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Generates and displays a section containing metabox tabs that have been added by other plugins through the
 * `wpseo_tab_header` and `wpseo_tab_content` actions.
 */
class WPSEO_Metabox_Addon_Tab_Section extends WPSEO_Metabox_Tab_Section {

	/**
	 * Applies the actions for adding a tab to the metabox.
	 */
	public function display_content() {
		?>

					<?php do_action( 'wpseo_tab_header' ); ?>

			<?php do_action( 'wpseo_tab_content' ); ?>

		<?php
	}

	/**
	 * `WPSEO_Metabox_Addon_Section` always has "tabs", represented by registered actions. If this is not the case,
	 * it should not be instantiated.
	 *
	 * @return bool
	 */
	protected function has_tabs() {
		return true;
	}
}

redpajama_set_name: RedPajamaGithub


text:
"""Tests that non-HD wallets that are upgraded are able to receive via MWEB"""

import os
import shutil

from test_framework.test_framework import BitcoinTestFramework
from test_framework.ltc_util import create_non_hd_wallet, setup_mweb_chain
from test_framework.util import assert_equal

class MWEBWalletUpgradeTest(BitcoinTestFramework):
    def set_test_params(self):
        self.setup_clean_chain = True
        self.num_nodes = 2
        self.extra_args = [['-whitelist=noban@127.0.0.1'],[]]  # immediate tx relay

    def skip_test_if_missing_module(self):
        self.skip_if_no_previous_releases()
        self.skip_if_no_wallet()

    def run_test(self):
        node0 = self.nodes[0]
        node1 = self.nodes[1]

        #
        # Mine until MWEB is activated
        #
        self.log.info("Setting up MWEB chain")
        setup_mweb_chain(node0)
        self.sync_all()

        #
        # Create a non-HD wallet using an older litecoin core version
        #
        self.log.info("Creating non-hd wallet")
        nonhd_wallet_dat = create_non_hd_wallet(self.chain, self.options)

        #
        # Replace node1's wallet with the non-HD wallet.dat
        #
        self.log.info("Replacing wallet with non-hd wallet.dat")
        node1.get_wallet_rpc(self.default_wallet_name).unloadwallet()
        upgrade_wallet_dir = os.path.join(node1.datadir, "regtest", "wallets", self.default_wallet_name)
        shutil.rmtree(upgrade_wallet_dir)
        os.mkdir(upgrade_wallet_dir)
        shutil.copy(nonhd_wallet_dat, upgrade_wallet_dir)
        node1.loadwallet(self.default_wallet_name)

        #
        # Upgrade node1's non-HD wallet to the latest version
        #
        self.log.info("Upgrading wallet")
        node1.upgradewallet()

        #
        # Send to MWEB address of upgraded wallet (node1)
        #
        self.log.info("Send to upgraded wallet's mweb address")
        mweb_addr = node1.getnewaddress(address_type='mweb')
        tx1_id = node0.sendtoaddress(mweb_addr, 25)
        self.sync_mempools()

        #
        # Verify transaction is received by upgraded wallet (node1)
        #
        self.log.info("Verify upgraded wallet lists the transaction")
        tx1 = node1.gettransaction(txid=tx1_id)
        assert_equal(tx1['confirmations'], 0)
        assert_equal(tx1['amount'], 25)
        assert_equal(tx1['details'][0]['address'], mweb_addr)

        node0.generate(1)
        self.sync_all()

        #
        # Verify that MWEB coins can be spent by upgraded wallet (node1)
        #
        self.log.info("Spending MWEB coins")
        mining_mweb_addr = node0.getnewaddress(address_type='mweb')
        tx2_id = node1.sendtoaddress(mining_mweb_addr, 10)
        self.sync_mempools()

        #
        # Mine 1 block and verify transaction confirms
        #
        self.log.info("Mining block to verify it confirms")
        node0.generate(1)
        tx2 = node0.gettransaction(txid=tx2_id)
        assert_equal(tx2['confirmations'], 1)
        assert_equal(tx2['amount'], 10)
        assert_equal(tx2['details'][0]['address'], mining_mweb_addr)

if __name__ == '__main__':
    MWEBWalletUpgradeTest().main()


text:
import d3 from 'd3';

/**
 * Check if a variable has a given type.
 * Freely inspired from http://bonsaiden.github.io/JavaScript-Garden/fr/#types
 *
 * @param {Any} obj - checked variable
 * @param {String} type - type name
 * @return {Boolean} true if variable has the expected type, false otherwise
 */
export const is = (obj, type) => {
  const clazz = Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
  return obj !== undefined && obj !== null && clazz === type.toLowerCase().trim();
};

/**
 * Add a zoomable g layer inside the tree's svg node.
 * Store into tree's 'zoom' attribute the zoom behavior and into tree's 'grid' attribute the created node
 *
 * @param {RequestTree} tree - modified tree instance
 * @param {Number} tree.width - svg node width
 * @param {Number} tree.initialScale - initiale scale used for zooming (inside scaleExtent)
 * @param {[Number, Number]} tree.scaleExtent - minimum and maximal bound used for zoom.
 * @param {Behavior} tree.zoom - attribute used to store d3's zoom behavior
 * @return {SVGElement} g group created
 */
export const makeZoomableGrid = tree => {
  let zoomLevel;

  tree.zoom = d3.behavior.zoom().
    translate([0, tree.height * 0.5]).
    scale(tree.initialScale).
    scaleExtent(tree.scaleExtent).
    on('zoom', () => {
      // Eventually, animate the zoom
      let node = tree.grid;
      if (zoomLevel !== d3.event.scale) {
        node = node.transition();
        zoomLevel = d3.event.scale;
      }
      node.attr('transform', `translate(${d3.event.translate}) scale(${d3.event.scale})`);
    });

  tree.svg.on('click', tree.hideMenu.bind(tree));

  zoomLevel = tree.zoom.scale();

  tree.grid = tree.svg.call(tree.zoom).
    append('g').
      attr('transform', `translate(${tree.zoom.translate()}) scale(${zoomLevel})`);
  return tree.grid;
};

/**
 * Get biggest node representation, and compute columns widths.
 *
 * @param {d3.selection} node - d3 nodes that will be analyzed
 * @param {Number} hSpacing - spacing factor (higher than 1) between two columns, where elbow will be located.
 * @return {Object} containing biggest node representation and columns width, with hSpacing factor
 * @return {Number} return.biggest.width - width of the biggest node
 * @return {Number} return.biggest.height - height of the biggest node
 * @return {Number[]} return.columns - array of column widths
 */
export const getDimensions = (node, hSpacing) => {
  const biggest = {width: 0, height: 0};
  const columns = [];

  // Do not use fat arrow to have this aiming at current SVGElement
  /* eslint no-invalid-this: 0 */
  node.each(function(d) {
    let {width, height} = this.getBBox();
    const depth = d.depth;
    width *= hSpacing;
    if (biggest.width < width) {
      biggest.width = width;
    }
    if (biggest.height < height) {
      biggest.height = height;
    }
    if (!columns[depth]) {
      columns[depth] = 0;
    }
    if (columns[depth] < width) {
      columns[depth] = width;
    }
  });
  return {biggest, columns};
};

/**
 * This function translate a parsed data (grammar parser's output) into a D3 compliant tree structure.
 * @param {Object} data - the wellformated parsed data
 * @return {Object} a D3 tree structure
 */
export const translateToTree = data => {
  const keys = Object.keys(data);
  const isAnd = keys.indexOf('$and') >= 0;
  const isOr = keys.indexOf('$or') >= 0;
  if (isAnd || isOr) {
    const key = isAnd ? '$and' : '$or';
    const result = assign({
      name: key,
      children: data[key].map(translateToTree)
    }, data);
    delete result[key];
    return result;
  }
  return data;
};

/**
 * This function translate a tree data (that may have be modified by d3's layout)
 * into a grammar generator's compliant data structure.
 * @param {Object} tree - D3 tree structure
 * @return {Object} corresponding wellformated parsed data
 */
export const translateFromTree = tree => {
  const data = {};
  switch (tree.name) {
  case '$and':
  case '$or':
    if (tree.hasOwnProperty('children')) {
      data[tree.name] = tree.children.map(translateFromTree).filter(n => Object.keys(n).length > 0);
    } else {
      data[tree.name] = [];
    }
    break;
  default:
    data.name = tree.name;
    for (let prop in tree) {
      // copy everything that was not added by d3 layout and our own code (__id and __value).
      if (['parent', 'x', 'y', 'depth', 'name', 'width', 'height', '__id', '__value'].indexOf(prop) === -1) {
        data[prop] = tree[prop];
      }
    }
  }
  return data;
};

/**
 * Function factory that will return a SVGPath generator between two positions
 * Generated path are square links between the two node, where vertical elbow is located in the space
 * between two columns.
 *
 * @param {Number[]} columns - array containing columns width.
 * @param {Number} hSpacing - spacing factor (higher than 1) between two columns, where elbow will be located.
 * @return {Function} SVGPath generator, that takes an object with 'source' and 'target' points (x, y, width)
 * and that return a valid SVG path (usable for path 'd' attribute)
 */
export const makeElbow = (columns, hSpacing) => {
  return ({source, target}) => {
    const start = source.y + (source.width || 0);
    // Elbow will takes place in horizontal spacing between levels
    const space = columns[source.depth];
    const corner = target.y - (space - space / hSpacing) / 2;
    return `M${start},${source.x}H${corner}V${target.x}H${target.y}`;
  };
};

/**
 * Deep copy of objects into another.
 * When the samge property in in multiple sources, right most parameter takes precedence over left-most ons.
 * This function is a naïve implementation of lodash's assign to avoid insluding the whole library and keep
 * dependencies to d3
 *
 * @param {Object} target - object in which properties will be copied. Will be modified.
 * @param {Object[]} sources - any object you whish to copy into the result oject
 * @return {Object} the resulting object.
 */
export const assign = (target, ...sources) => {
  sources.forEach(source => {
    for (let property in source) {
      if (is(source[property], 'object')) {
        if (!is(target[property], 'object')) {
          target[property] = {};
        }
        assign(target[property], source[property]);
      } else {
        target[property] = source[property];
      }
    }
  });
  return target;
};

/**
 * Format a given natural integer by adding thousand serparators.
 * Decimals and negative numbers are not supported.
 * @param {Number} number - formatted number
 * @param {String} separator = ' '- thousand separator used
 * @return {String} the formatted number
 */
export const formatNumber = (number, separator = ' ') => {
  if (isNaN(parseInt(number))) {
    return number;
  }
  return Math.floor(+number).toString().split('').reverse().reduce((res, digit, i) => digit + (i > 0 && i % 3 === 0 ? separator : '') + res);
};


text:
package com.compositesw.services.system.admin.server;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.compositesw.services.system.util.common.AttributeList;
import com.compositesw.services.system.util.common.BaseRequest;

/**
 *
Java class for updateServerAttributesRequest complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="updateServerAttributesRequest">
 *   <complexContent>
 *     <extension base="{http://www.compositesw.com/services/system/util/common}baseRequest">
 *       <sequence>
 *         <element name="attributes" type="{http://www.compositesw.com/services/system/util/common}attributeList"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "updateServerAttributesRequest", propOrder = {
    "attributes"
})
public class UpdateServerAttributesRequest
    extends BaseRequest
{

    @XmlElement(required = true)
    protected AttributeList attributes;

    /**
     * Gets the value of the attributes property.
     *
     * @return
     *     possible object is
     *     {@link AttributeList }
     *
     */
    public AttributeList getAttributes() {
        return attributes;
    }

    /**
     * Sets the value of the attributes property.
     *
     * @param value
     *     allowed object is
     *     {@link AttributeList }
     *
     */
    public void setAttributes(AttributeList value) {
        this.attributes = value;
    }

}


text:
<?php

class Dao_Mysql_Spot extends Dao_Base_Spot
{
    /*
     * adds a list of fullspots to the database. Don't use this without having an entry in the header
     * table as it will remove the spot from the list
     */
    public function addFullSpots($fullSpots)
    {
        SpotTiming::start(__CLASS__.'::'.__FUNCTION__);

        /*
         * Prepare the array for insertion
         */
        foreach ($fullSpots as &$fullSpot) {
            $fullSpot['verified'] = (int) $fullSpot['verified'];
            $fullSpot['user-key'] = base64_encode(serialize($fullSpot['user-key']));
        } // foreach

        $this->_conn->batchInsert(
            $fullSpots,
            'INSERT IGNORE INTO spotsfull(messageid, verified, usersignature, userkey, xmlsignature, fullxml)
								  	VALUES',
            [PDO::PARAM_STR, PDO::PARAM_INT, PDO::PARAM_STR, PDO::PARAM_STR, PDO::PARAM_STR, PDO::PARAM_STR],
            ['messageid', 'verified', 'user-signature', 'user-key', 'xml-signature', 'fullxml']
        );

        SpotTiming::stop(__CLASS__.'::'.__FUNCTION__, [$fullSpots]);
    }

    // addFullSpot

    /*
     * Remove a spot from the database
     */
    public function removeSpots($spotMsgIdList)
    {
        if (count($spotMsgIdList) == 0) {
            return;
        } // if

        $this->_conn->modify('DELETE FROM spots, spotsfull, reportsxover, spotstatelist, reportsposted USING spots
							LEFT JOIN spotsfull ON spots.messageid=spotsfull.messageid
                            LEFT JOIN reportsxover ON spots.messageid=reportsxover.nntpref
							LEFT JOIN spotstatelist ON spots.messageid=spotstatelist.messageid
							LEFT JOIN reportsposted ON spots.messageid=reportsposted.inreplyto
							WHERE spots.messageid  IN ('.$this->_conn->arrayKeyToIn($spotMsgIdList).')');
    }

    // removeSpots

    /*
     * Remove older spots from the database
     */
    public function deleteSpotsRetention($retention)
    {
        $retention = $retention * 24 * 60 * 60; // omzetten in seconden

        $this->_conn->modify(
            'DELETE FROM spots, spotsfull, commentsxover, reportsxover, spotstatelist, reportsposted USING spots
                                LEFT JOIN spotsfull ON spots.messageid=spotsfull.messageid
                                LEFT JOIN commentsxover ON spots.messageid=commentsxover.nntpref
                                LEFT JOIN reportsxover ON spots.messageid=reportsxover.nntpref
                                LEFT JOIN spotstatelist ON spots.messageid=spotstatelist.messageid
                                LEFT JOIN reportsposted ON spots.messageid=reportsposted.inreplyto
                                WHERE spots.stamp < :stamp',
            [
                ':stamp' => [time() - $retention, PDO::PARAM_INT],
            ]
        );
    }

    // deleteSpotsRetention

    /*
     * Returns the amount of spots per hour
     */
    public function getSpotCountPerHour($limit)
    {
        if (empty($limit)) {
            return $this->_conn->arrayQuery('SELECT EXTRACT(HOUR FROM FROM_UNIXTIME(stamp)) AS data,
                                                    COUNT(*) AS amount
                                               FROM spots
                                               GROUP BY data');
        } else {
            return $this->_conn->arrayQuery(
                'SELECT EXTRACT(HOUR FROM FROM_UNIXTIME(stamp)) AS data,
                                                    COUNT(*) AS amount
                                               FROM spots
                                               WHERE stamp > :stamp
                                               GROUP BY data',
                [
                    ':stamp' => [strtotime('-1'.$limit), PDO::PARAM_INT],
                ]
            );
        } // else
    }

    // getSpotCountPerHour

    /*
     * Returns the amount of spots per weekday
     */
    public function getSpotCountPerWeekday($limit)
    {
        if (empty($limit)) {
            return $this->_conn->arrayQuery("SELECT FROM_UNIXTIME(stamp,'%w') AS data,
                                                    COUNT(*) AS amount
                                               FROM spots
                                               GROUP BY data");
        } else {
            return $this->_conn->arrayQuery(
                "SELECT FROM_UNIXTIME(stamp,'%w') AS data,
                                                    COUNT(*) AS amount
                                               FROM spots
                                               WHERE stamp > :stamp
                                               GROUP BY data",
                [
                    ':stamp' => [strtotime('-1'.$limit), PDO::PARAM_INT],
                ]
            );
        } // else
    }

    // getSpotCountPerWeekday

    /*
     * Returns the amount of spots per month
     */
    public function getSpotCountPerMonth($limit)
    {
        if (empty($limit)) {
            return $this->_conn->arrayQuery('SELECT EXTRACT(MONTH FROM FROM_UNIXTIME(stamp)) AS data,
                                                    COUNT(*) AS amount
                                               FROM spots
                                               GROUP BY data');
        } else {
            return $this->_conn->arrayQuery(
                'SELECT EXTRACT(MONTH FROM FROM_UNIXTIME(stamp)) AS data,
                                                    COUNT(*) AS amount
                                               FROM spots
                                               WHERE stamp > :stamp
                                               GROUP BY data',
                [
                    ':stamp' => [strtotime('-1'.$limit), PDO::PARAM_INT],
                ]
            );
        } // else
    }

    // getSpotCountPerMonth

    /*
     * Remove extra spots
     */
    public function removeExtraSpots($messageId)
    {
        // Retrieve the actual spot
        $spot = $this->getSpotHeader($messageId);

        /*
         * The spot might be empty because - for example, the spot
         * is moderated (and hence deleted), the highest spot retrieved
         * might be missing from the database because of the spam cleanup.
         *
         * Ignore this error
         */
        if (empty($spot)) {
            return;
        } // if

        $this->_conn->modify(
            'DELETE FROM spots, spotsfull USING spots
								LEFT JOIN spotsfull on spots.messageid=spotsfull.messageid
							  WHERE spots.id > :spotid',
            [
                ':spotid' => [$spot['id'], PDO::PARAM_INT],
            ]
        );
    }

    // removeExtraSpots

    public function getQuerystr($extendedFieldList, $additionalTableList, $additionalJoinList, $ourUserId, $criteriaFilter, $sortList, $limit, $offset)
    {
        /*
         * Run the query with a limit always increased by one. this allows us to
         * check whether any more results are available
         */
        $queryStr = 'SELECT s.id AS id,
												s.messageid AS messageid,
												s.category AS category,
												s.poster AS poster,
												l.download as downloadstamp,
												l.watch as watchstamp,
												l.seen AS seenstamp,
												s.subcata AS subcata,
												s.subcatb AS subcatb,
												s.subcatc AS subcatc,
												s.subcatd AS subcatd,
												s.subcatz AS subcatz,
												s.title AS title,
												s.tag AS tag,
												s.stamp AS stamp,
												s.moderated AS moderated,
												s.filesize AS filesize,
												s.spotrating AS rating,
												s.commentcount AS commentcount,
												s.reportcount AS reportcount,
												s.spotterid AS spotterid,
 												s.editstamp AS editstamp,
 												s.editor AS editor,
												f.verified AS verified,
												COALESCE(bl.idtype, wl.idtype, gwl.idtype) AS idtype
												'.$extendedFieldList.'
									 FROM spots AS s '.
                                    $additionalTableList.
                                    $additionalJoinList.
                                  ' LEFT JOIN spotstatelist AS l FORCE INDEX FOR JOIN (idx_spotstatelist_1) ON ((s.messageid = l.messageid) AND (l.ouruserid = '.$this->_conn->safe((int) $ourUserId).'))
									 LEFT JOIN spotsfull AS f FORCE INDEX FOR JOIN (idx_spotsfull_1) ON (s.messageid = f.messageid)
									 LEFT JOIN spotteridblacklist as bl FORCE INDEX FOR JOIN (idx_spotteridblacklist_1) ON ((bl.spotterid = s.spotterid) AND ((bl.ouruserid = '.$this->_conn->safe((int) $ourUserId).') OR (bl.ouruserid = -1)) AND (bl.idtype = 1))
									 LEFT JOIN spotteridblacklist AS wl FORCE INDEX FOR JOIN (idx_spotteridblacklist_1) ON ((wl.spotterid = s.spotterid) AND ((wl.ouruserid = '.$this->_conn->safe((int) $ourUserId).") AND (wl.idtype = 2)))
									 LEFT JOIN spotteridblacklist AS gwl FORCE INDEX FOR JOIN (idx_spotteridblacklist_1) ON ((gwl.spotterid = s.spotterid) AND ((gwl.ouruserid = -1) AND (gwl.idtype = 2))) \n ".
                                    $criteriaFilter.'
									 ORDER BY '.$sortList.
                                  ' LIMIT '.(int) ($limit + 1).' OFFSET '.(int) $offset;

        return $queryStr;
    }
} // Dao_Mysql_Spot


text:
class P2pBase < ActiveRecord::Base
	validates: user_id, uniqueness: true
	validates: card_a, presence: true, numericality: true
	validates: card_b, presence: true, numericality: true
	validates: phone, presence: true, numericality: true
	validates: expire, presence: true
	validates: cvv, presence: true, numericality: true
end


text:
package org.idpf.epubcheck.util.css;

import com.google.common.base.Predicate;
import org.idpf.epubcheck.util.css.CssToken.Type;

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

import static com.google.common.base.Preconditions.checkNotNull;

final class CssTokenList extends ArrayList<CssToken>
{

  public CssTokenList()
  {
    this(2048);
  }

  private CssTokenList(int initSize)
  {
    super(initSize);
  }

  CssTokenIterator iterator(final Predicate<CssToken> filter)
  {
    return new CssTokenIterator(filter, this);
  }

  class CssTokenIterator
  {

    private final Predicate<CssToken> filter;
    final List<CssToken> list;
    int next; // index of next element to return
    int lastRet = -1; // index of last element returned
    CssToken last = null; // last token returned

    /**
     * Constructor.
     *
     * @param filter A filter Predicate that is applied to all tokens unless
     *               another Predicate is passed using #next(Predicate)
     */
    CssTokenIterator(final Predicate<CssToken> filter, List<CssToken> list)
    {
      this.filter = checkNotNull(filter);
      this.list = list;
    }

    /**
     * Get the next token in the token list. This method uses the
     * constructor filter.
     */
    CssToken next()
    {
      return next(filter);
    }

    /**
     * Get the next token in the token list that matches the given filter,
     * or NoSuchElementException if no more tokens exist.
     */
    CssToken next(final Predicate<CssToken> filter)
    {
      while (true)
      {
        int i = next;
        if (i >= size())
        {
          throw new NoSuchElementException();
        }
        next = i + 1;
        CssToken tk = get(lastRet = i);
        if (filter.apply(tk))
        {
          last = tk;
          return tk;
        }
      }
    }

    /**
     * Using the constructor filter.
     */
    boolean hasNext()
    {
      return hasNext(filter);
    }

    /**
     * Using the supplied filter.
     */
    boolean hasNext(final Predicate<CssToken> filter)
    {
      int i = next;
      while (true)
      {
        if (i == size())
        {
          return false;
        }
        if (filter.apply(get(i)))
        {
          return true;
        }
        i++;
      }
    }

    /**
     * Get the next token without advancing the iterators position.
     */
    public CssToken peek()
    {
      return peek(filter);
    }

    /**
     * Get the next token without advancing the iterators position.
     */
    public CssToken peek(Predicate<CssToken> filter)
    {
      int _next = next;
      int _lastRet = lastRet;
      CssToken _last = last;
      if (hasNext(filter))
      {
        CssToken tk = next(filter);
        next = _next;
        lastRet = _lastRet;
        last = _last;
        return tk;
      }
      throw new NoSuchElementException();
    }

    /**
     * Get the list index of the last element returned prior to filtering,
     * or -1 if no element has yet been returned.
     */
    int index()
    {
      return lastRet;
    }

    /**
     * Get the filter that is currently being used for invocations of next()
     * and hasNext()
     */
    Predicate<CssToken> filter()
    {
      return filter;
    }

  }

  static final class Filters
  {

    /**
     * A filter that filters whitespace and comments
     */
    static final Predicate<CssToken> FILTER_S_CMNT = new Predicate<CssToken>()
    {
      public boolean apply(final CssToken input)
      {
        return !(input.type == Type.S || input.type == Type.COMMENT);
      }
    };

    /**
     * A filter that filters whitespace, comments, CDO and CDC
     */
    static final Predicate<CssToken> FILTER_S_CMNT_CDO_CDC = new Predicate<CssToken>()
    {
      public boolean apply(final CssToken input)
      {
        return !(input.type == Type.S || input.type == Type.COMMENT
            || input.type == Type.CDO || input.type == Type.CDC);
      }
    };

    /**
     * A filter that filters nothing.
     */
    static final Predicate<CssToken> FILTER_NONE = new Predicate<CssToken>()
    {
      public boolean apply(final CssToken input)
      {
        return true;
      }
    };

  }

  static final class PrematureEOFException extends RuntimeException
  {
    private static final long serialVersionUID = 343701466381708884L;
  }

  private static final long serialVersionUID = 924068097174100851L;

}


text:
* * *

title: <%= hoc_s(:title_resources) %> layout: wide nav: promote_nav

* * *

<link rel="stylesheet" type="text/css" href="/css/promote-page.css" />
</link>

# Promote the Hour of Code

## Hosting an Hour of Code? [See the how-to guide](<%= resolve_url('/how-to') %>)

<%= view :promote_handouts %> <%= view :promote_videos %>

## Obesite te plakate na vaši šoli

<%= view :promote_posters %>

## Objavite na družbenih medijih

[![image](/images/fit-250/social-1.jpg)](/images/social-1.jpg)     [![image](/images/fit-250/social-2.jpg)](/images/social-2.jpg)     [![image](/images/fit-250/social-3.jpg)](/images/social-3.jpg)

<%= view :social_posters %>

## Use the Hour of Code logo to spread the word

[![image](<%= localized_image('/images/fit-200/hour-of-code-logo.png') %>)](%= localized_image('/images/hour-of-code-logo.png') %)

[Download hi-res versions](http://images.code.org/share/hour-of-code-logo.zip)

**"Hour of Code" is trademarked. We don't want to prevent this usage, but we want to make sure it fits within a few limits:**

  1. Any reference to "Hour of Code" should be used in a fashion that doesn't suggest that it's your own brand name, but rather referencing the Hour of Code as a grassroots movement. Good example: "Participate in the Hour of Code™ at ACMECorp.com". Bad example: "Try Hour of Code by ACME Corp".
  2. Use a "TM" superscript in the most prominent places you mention "Hour of Code", both on your web site and in app descriptions.
  3. Include language on the page (or in the the footer), including links to the CSEdWeek and Code.org web sites, that says the following:

    *"The 'Hour of Code™' is a nationwide initiative by Computer Science Education Week[csedweek.org] and Code.org[code.org] to introduce millions of students to one hour of computer science and computer programming."*

  4. No use of "Hour of Code" in app names.

## Print these stickers to give to your students

(Stickers are 1" diameter, 63 per sheet)
[![image](/images/fit-250/hour-of-code-stickers.png)](/images/hour-of-code-stickers.pdf)

## Pošljite spodnja sporočila in pomagajte promovirati Uro za kodo

## Spodbudite vašo šolo, delodajalca ali prijatelje, da se prijavijo:

Čeprav so računalniki povsod, računalništvo uči manj šol kot pred 10 leti. Dobra novica je, da smo na proti, da to spremenimo. If you've heard about the Hour of Code before, you might know it made history. More than 100 million students have tried an Hour of Code.

With the Hour of Code, computer science has been on homepages of Google, MSN, Yahoo! in Disney. Over 100 partners joined together to support this movement. Last year, every Apple Store in the world hosted an Hour of Code and even President Obama wrote his first line of code as part of the campaign.

This year, let's make it even bigger. I'm asking you to join in for the Hour of Code 2015. Please get involved with an Hour of Code event during Computer Science Education Week, <%= campaign_date('full') %>.

Razširite vest o tem. Gostite dogodek. Vprašajte na vaši šoli in se prijavite. Ali poskusite Uro za kodo sami--vsakomur lahko koristi učenje osnov.

Get started at http://hourofcode.com/<%= @country %>

## Povabite medije, da se udeležijo vašega dogodka:

**Subject line:** Local school joins mission to introduce students to computer science

Računalniki so vsepovsod, vendar manj šol poučuje računalništvo kot pred 10 leti. Dekleta in manjšine so še vedno premalo zastopane. Dobra novica pa je, da smo na poti v spremembe.

With the Hour of Code, computer science has been on homepages of Google, MSN, Yahoo! in Disney. Over 100 partners joined together to support this movement. Last year, every Apple Store in the world hosted an Hour of Code and even President Obama wrote his first line of code as part of the campaign.

That's why every one of the [X number] students at [SCHOOL NAME] are joining in on the largest learning event in history: The Hour of Code, during Dec. 7-13.

Vabimo vas, da se nam pridružite [DATE] in vidite, kako se bodo naši otroci pridružili projektu.

Uro za kodo organizira neprofitna organizacija Code.org in več kot 100 drugih partnerjev. Je dokaz, da so učenci danes pripravljeni, da se naučijo znanja za uspeh v 21. stoletju. Pridružite se nam.

**Kontakt:** [VAŠE IME], [TITLE], telefon: 041 555-555

**Kdaj:** [DATUM in ČAS dogodka]

**Kje:** [NASLOV in POT]

Veseli bomo, če bomo v stiku.

## Povejte staršem o dogodku v vaši šoli:

Dragi starši,

Živimo v svetu, ki je obdan s tehnologijo. Vemo, da ne glede na področje, ki ga bodo učenci izbrali za svojo kariero, so njihove možnosti za uspeh večje, če bodo poznali, kako tehnologija deluje. Vendar se nas le majhen delček uči računalništva in manj učencev se ga uči kot pred desetletjem.

Zato se bo naša šola pridružila največjemu izobraževalnemu dogodku v zgodovini: Ura za kodo. 7-13). More than 100 million students worldwide have already tried an Hour of Code.

Ura za kodo je dokaz, da je [SCHOOL NAME] pripravljena naučiti učence temeljna znanja za 21. stoletje. Želimo, da o projektu izve čimveč ljudi. I encourage you to volunteer, reach out to local media, share the news on social media channels and consider hosting additional Hour of Code events in the community.

To je priložnost, da spremenimo izobraževanje v [TOWN/CITY NAME].

See http://hourofcode.com/<%= @country %> for details, and help spread the word.

Lep pozdrav,

Vaš ravnatelj

## Povabite lokalne politike na dogodek v vaši šoli:

Dragi [župan/svetnik/poslanec LAST NAME]:

Ali ste vedeli, da je danes v svetu na področju računalništva trikrat več delovnih mest kot diplomantov? Računalništvo je danes temelj *vsake* industrije. Yet most of schools don't teach it. V [SCHOOL NAME] poskušamo to spremeniti.

Zato se bo naša šola pridružila največjemu izobraževalnemu dogodku v zgodovini: Ura za kodo. 7-13). More than 100 million students worldwide have already tried an Hour of Code.

Vabimo vas, da se nam pridružite na našem dogodku Ura za kodo in v uvodu poveste nekaj spodbudnih besed učencem. Dogodek bo potekal [DATE, TIME, PLACE] in bo dal jasno sporočilo, da je [mesto] pripravljeno, da nauči učence temeljna znanja za 21. stoletje. Želimo zagotoviti, da bodo naši učenci na čelu ustvarjanja tehnologije prihodnosti--ne bodo je samo uporabljali.

Prosimo vas, kontaktirajte me na [TELEFONSKA ŠTEVILKA ali e-poštni naslov]. Veselim se vašega odgovora.

Najlepša hvala in lep pozdrav [NAME], [TITLE]

<%= view :signup_button %>


text:
 public:                                           \
  constexpr Type() : __VA_ARGS__() {}              \
                                                   \
 protected:                                        \
  template <typename TFieldType, int kFieldOffset> \
  friend class TaggedField;                        \
                                                   \
  explicit inline Type(Address ptr)

#define OBJECT_CONSTRUCTORS_IMPL(Type, Super) \
  inline Type::Type(Address ptr) : Super(ptr) { SLOW_DCHECK(Is##Type()); }
// In these cases, we don't have our own instance type to check, so check the
// supertype instead. This happens for types denoting a NativeContext-dependent
// set of maps.
#define OBJECT_CONSTRUCTORS_IMPL_CHECK_SUPER(Type, Super) \
  inline Type::Type(Address ptr) : Super(ptr) { SLOW_DCHECK(Is##Super()); }

#define NEVER_READ_ONLY_SPACE   \
  inline Heap* GetHeap() const; \
  inline Isolate* GetIsolate() const;

// TODO(leszeks): Add checks in the factory that we never allocate these
// objects in RO space.
#define NEVER_READ_ONLY_SPACE_IMPL(Type)                                   \
  Heap* Type::GetHeap() const { return GetHeapFromWritableObject(*this); } \
  Isolate* Type::GetIsolate() const {                                      \
    return GetIsolateFromWritableObject(*this);                            \
  }

#define DECL_PRIMITIVE_ACCESSORS(name, type) \
  inline type name() const;                  \
  inline void set_##name(type value);

#define DECL_SYNCHRONIZED_PRIMITIVE_ACCESSORS(name, type) \
  inline type synchronized_##name() const;                \
  inline void synchronized_set_##name(type value);

#define DECL_BOOLEAN_ACCESSORS(name) DECL_PRIMITIVE_ACCESSORS(name, bool)

#define DECL_INT_ACCESSORS(name) DECL_PRIMITIVE_ACCESSORS(name, int)

#define DECL_SYNCHRONIZED_INT_ACCESSORS(name) \
  DECL_SYNCHRONIZED_PRIMITIVE_ACCESSORS(name, int)

#define DECL_INT32_ACCESSORS(name) DECL_PRIMITIVE_ACCESSORS(name, int32_t)

#define DECL_UINT16_ACCESSORS(name) \
  inline uint16_t name() const;     \
  inline void set_##name(int value);

#define DECL_INT16_ACCESSORS(name) \
  inline int16_t name() const;     \
  inline void set_##name(int16_t value);

#define DECL_UINT8_ACCESSORS(name) \
  inline uint8_t name() const;     \
  inline void set_##name(int value);

// TODO(ishell): eventually isolate-less getters should not be used anymore.
// For full pointer-mode the C++ compiler should optimize away unused isolate
// parameter.
#define DECL_GETTER(name, type) \
  inline type name() const;     \
  inline type name(const Isolate* isolate) const;

#define DEF_GETTER(holder, name, type)                     \
  type holder::name() const {                              \
    const Isolate* isolate = GetIsolateForPtrCompr(*this); \
    return holder::name(isolate);                          \
  }                                                        \
  type holder::name(const Isolate* isolate) const

#define DECL_ACCESSORS(name, type)   \
  DECL_GETTER(name, type)            \
  inline void set_##name(type value, \
                         WriteBarrierMode mode = UPDATE_WRITE_BARRIER);

#define DECL_CAST(Type)                                 \
  V8_INLINE static Type cast(Object object);            \
  V8_INLINE static Type unchecked_cast(Object object) { \
    return bit_cast<Type>(object);                      \
  }

#define CAST_ACCESSOR(Type) \
  Type Type::cast(Object object) { return Type(object.ptr()); }

#define INT_ACCESSORS(holder, name, offset)                   \
  int holder::name() const { return ReadField<int>(offset); } \
  void holder::set_##name(int value) { WriteField<int>(offset, value); }

#define INT32_ACCESSORS(holder, name, offset)                         \
  int32_t holder::name() const { return ReadField<int32_t>(offset); } \
  void holder::set_##name(int32_t value) { WriteField<int32_t>(offset, value); }

#define RELAXED_INT32_ACCESSORS(holder, name, offset) \
  int32_t holder::name() const {                      \
    return RELAXED_READ_INT32_FIELD(*this, offset);   \
  }                                                   \
  void holder::set_##name(int32_t value) {            \
    RELAXED_WRITE_INT32_FIELD(*this, offset, value);  \
  }

#define UINT16_ACCESSORS(holder, name, offset)                          \
  uint16_t holder::name() const { return ReadField<uint16_t>(offset); } \
  void holder::set_##name(int value) {                                  \
    DCHECK_GE(value, 0);                                                \
    DCHECK_LE(value, static_cast<uint16_t>(-1));                        \
    WriteField<uint16_t>(offset, value);                                \
  }

#define UINT8_ACCESSORS(holder, name, offset)                         \
  uint8_t holder::name() const { return ReadField<uint8_t>(offset); } \
  void holder::set_##name(int value) {                                \
    DCHECK_GE(value, 0);                                              \
    DCHECK_LE(value, static_cast<uint8_t>(-1));                       \
    WriteField<uint8_t>(offset, value);                               \
  }

#define ACCESSORS_CHECKED2(holder, name, type, offset, get_condition, \
                           set_condition)                             \
  DEF_GETTER(holder, name, type) {                                    \
    type value = TaggedField<type, offset>::load(isolate, *this);     \
    DCHECK(get_condition);                                            \
    return value;                                                     \
  }                                                                   \
  void holder::set_##name(type value, WriteBarrierMode mode) {        \
    DCHECK(set_condition);                                            \
    TaggedField<type, offset>::store(*this, value);                   \
    CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode);            \
  }

#define ACCESSORS_CHECKED(holder, name, type, offset, condition) \
  ACCESSORS_CHECKED2(holder, name, type, offset, condition, condition)

#define ACCESSORS(holder, name, type, offset) \
  ACCESSORS_CHECKED(holder, name, type, offset, true)

#define SYNCHRONIZED_ACCESSORS_CHECKED2(holder, name, type, offset,       \
                                        get_condition, set_condition)     \
  DEF_GETTER(holder, name, type) {                                        \
    type value = TaggedField<type, offset>::Acquire_Load(isolate, *this); \
    DCHECK(get_condition);                                                \
    return value;                                                         \
  }                                                                       \
  void holder::set_##name(type value, WriteBarrierMode mode) {            \
    DCHECK(set_condition);                                                \
    TaggedField<type, offset>::Release_Store(*this, value);               \
    CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode);                \
  }

#define SYNCHRONIZED_ACCESSORS_CHECKED(holder, name, type, offset, condition) \
  SYNCHRONIZED_ACCESSORS_CHECKED2(holder, name, type, offset, condition,      \
                                  condition)

#define SYNCHRONIZED_ACCESSORS(holder, name, type, offset) \
  SYNCHRONIZED_ACCESSORS_CHECKED(holder, name, type, offset, true)

#define WEAK_ACCESSORS_CHECKED2(holder, name, offset, get_condition,  \
                                set_condition)                        \
  DEF_GETTER(holder, name, MaybeObject) {                             \
    MaybeObject value =                                               \
        TaggedField<MaybeObject, offset>::load(isolate, *this);       \
    DCHECK(get_condition);                                            \
    return value;                                                     \
  }                                                                   \
  void holder::set_##name(MaybeObject value, WriteBarrierMode mode) { \
    DCHECK(set_condition);                                            \
    TaggedField<MaybeObject, offset>::store(*this, value);            \
    CONDITIONAL_WEAK_WRITE_BARRIER(*this, offset, value, mode);       \
  }

#define WEAK_ACCESSORS_CHECKED(holder, name, offset, condition) \
  WEAK_ACCESSORS_CHECKED2(holder, name, offset, condition, condition)

#define WEAK_ACCESSORS(holder, name, offset) \
  WEAK_ACCESSORS_CHECKED(holder, name, offset, true)

// Getter that returns a Smi as an int and writes an int as a Smi.
#define SMI_ACCESSORS_CHECKED(holder, name, offset, condition)   \
  int holder::name() const {                                     \
    DCHECK(condition);                                           \
    Smi value = TaggedField<Smi, offset>::load(*this);           \
    return value.value();                                        \
  }                                                              \
  void holder::set_##name(int value) {                           \
    DCHECK(condition);                                           \
    TaggedField<Smi, offset>::store(*this, Smi::FromInt(value)); \
  }

#define SMI_ACCESSORS(holder, name, offset) \
  SMI_ACCESSORS_CHECKED(holder, name, offset, true)

#define SYNCHRONIZED_SMI_ACCESSORS(holder, name, offset)                 \
  int holder::synchronized_##name() const {                              \
    Smi value = TaggedField<Smi, offset>::Acquire_Load(*this);           \
    return value.value();                                                \
  }                                                                      \
  void holder::synchronized_set_##name(int value) {                      \
    TaggedField<Smi, offset>::Release_Store(*this, Smi::FromInt(value)); \
  }

#define RELAXED_SMI_ACCESSORS(holder, name, offset)                      \
  int holder::relaxed_read_##name() const {                              \
    Smi value = TaggedField<Smi, offset>::Relaxed_Load(*this);           \
    return value.value();                                                \
  }                                                                      \
  void holder::relaxed_write_##name(int value) {                         \
    TaggedField<Smi, offset>::Relaxed_Store(*this, Smi::FromInt(value)); \
  }

#define BOOL_GETTER(holder, field, name, offset) \
  bool holder::name() const { return BooleanBit::get(field(), offset); }

#define BOOL_ACCESSORS(holder, field, name, offset)                      \
  bool holder::name() const { return BooleanBit::get(field(), offset); } \
  void holder::set_##name(bool value) {                                  \
    set_##field(BooleanBit::set(field(), offset, value));                \
  }

#define BIT_FIELD_ACCESSORS(holder, field, name, BitField)      \
  typename BitField::FieldType holder::name() const {           \
    return BitField::decode(field());                           \
  }                                                             \
  void holder::set_##name(typename BitField::FieldType value) { \
    set_##field(BitField::update(field(), value));              \
  }

#define INSTANCE_TYPE_CHECKER(type, forinstancetype)    \
  V8_INLINE bool Is##type(InstanceType instance_type) { \
    return instance_type == forinstancetype;            \
  }

#define TYPE_CHECKER(type, ...)                                         \
  DEF_GETTER(HeapObject, Is##type, bool) {                              \
    return InstanceTypeChecker::Is##type(map(isolate).instance_type()); \
  }

#define RELAXED_INT16_ACCESSORS(holder, name, offset) \
  int16_t holder::name() const {                      \
    return RELAXED_READ_INT16_FIELD(*this, offset);   \
  }                                                   \
  void holder::set_##name(int16_t value) {            \
    RELAXED_WRITE_INT16_FIELD(*this, offset, value);  \
  }

#define FIELD_ADDR(p, offset) ((p).ptr() + offset - kHeapObjectTag)

#define ACQUIRE_READ_FIELD(p, offset) \
  TaggedField<Object>::Acquire_Load(p, offset)

#define RELAXED_READ_FIELD(p, offset) \
  TaggedField<Object>::Relaxed_Load(p, offset)

#define RELAXED_READ_WEAK_FIELD(p, offset) \
  TaggedField<MaybeObject>::Relaxed_Load(p, offset)

#define WRITE_FIELD(p, offset, value) \
  TaggedField<Object>::store(p, offset, value)

#define RELEASE_WRITE_FIELD(p, offset, value) \
  TaggedField<Object>::Release_Store(p, offset, value)

#define RELAXED_WRITE_FIELD(p, offset, value) \
  TaggedField<Object>::Relaxed_Store(p, offset, value)

#define RELAXED_WRITE_WEAK_FIELD(p, offset, value) \
  TaggedField<MaybeObject>::Relaxed_Store(p, offset, value)

#ifdef V8_DISABLE_WRITE_BARRIERS
#define WRITE_BARRIER(object, offset, value)
#else
#define WRITE_BARRIER(object, offset, value)                       \
  do {                                                             \
    DCHECK_NOT_NULL(GetHeapFromWritableObject(object));            \
    MarkingBarrier(object, (object).RawField(offset), value);      \
    GenerationalBarrier(object, (object).RawField(offset), value); \
  } while (false)
#endif

#ifdef V8_DISABLE_WRITE_BARRIERS
#define WEAK_WRITE_BARRIER(object, offset, value)
#else
#define WEAK_WRITE_BARRIER(object, offset, value)                           \
  do {                                                                      \
    DCHECK_NOT_NULL(GetHeapFromWritableObject(object));                     \
    MarkingBarrier(object, (object).RawMaybeWeakField(offset), value);      \
    GenerationalBarrier(object, (object).RawMaybeWeakField(offset), value); \
  } while (false)
#endif

#ifdef V8_DISABLE_WRITE_BARRIERS
#define EPHEMERON_KEY_WRITE_BARRIER(object, offset, value)
#else
#define EPHEMERON_KEY_WRITE_BARRIER(object, offset, value)                    \
  do {                                                                        \
    DCHECK_NOT_NULL(GetHeapFromWritableObject(object));                       \
    EphemeronHashTable table = EphemeronHashTable::cast(object);              \
    MarkingBarrier(object, (object).RawField(offset), value);                 \
    GenerationalEphemeronKeyBarrier(table, (object).RawField(offset), value); \
  } while (false)
#endif

#ifdef V8_DISABLE_WRITE_BARRIERS
#define CONDITIONAL_WRITE_BARRIER(object, offset, value, mode)
#else
#define CONDITIONAL_WRITE_BARRIER(object, offset, value, mode)       \
  do {                                                               \
    DCHECK_NOT_NULL(GetHeapFromWritableObject(object));              \
    DCHECK_NE(mode, UPDATE_EPHEMERON_KEY_WRITE_BARRIER);             \
    if (mode != SKIP_WRITE_BARRIER) {                                \
      if (mode == UPDATE_WRITE_BARRIER) {                            \
        MarkingBarrier(object, (object).RawField(offset), value);    \
      }                                                              \
      GenerationalBarrier(object, (object).RawField(offset), value); \
    }                                                                \
  } while (false)
#endif

#ifdef V8_DISABLE_WRITE_BARRIERS
#define CONDITIONAL_WEAK_WRITE_BARRIER(object, offset, value, mode)
#else
#define CONDITIONAL_WEAK_WRITE_BARRIER(object, offset, value, mode)           \
  do {                                                                        \
    DCHECK_NOT_NULL(GetHeapFromWritableObject(object));                       \
    DCHECK_NE(mode, UPDATE_EPHEMERON_KEY_WRITE_BARRIER);                      \
    if (mode != SKIP_WRITE_BARRIER) {                                         \
      if (mode == UPDATE_WRITE_BARRIER) {                                     \
        MarkingBarrier(object, (object).RawMaybeWeakField(offset), value);    \
      }                                                                       \
      GenerationalBarrier(object, (object).RawMaybeWeakField(offset), value); \
    }                                                                         \
  } while (false)
#endif

#ifdef V8_DISABLE_WRITE_BARRIERS
#define CONDITIONAL_EPHEMERON_KEY_WRITE_BARRIER(object, offset, value, mode)
#else
#define CONDITIONAL_EPHEMERON_KEY_WRITE_BARRIER(object, offset, value, mode) \
  do {                                                                       \
    DCHECK_NOT_NULL(GetHeapFromWritableObject(object));                      \
    DCHECK_NE(mode, UPDATE_EPHEMERON_KEY_WRITE_BARRIER);                     \
    EphemeronHashTable table = EphemeronHashTable::cast(object);             \
    if (mode != SKIP_WRITE_BARRIER) {                                        \
      if (mode == UPDATE_WRITE_BARRIER) {                                    \
        MarkingBarrier(object, (object).RawField(offset), value);            \
      }                                                                      \
      GenerationalEphemeronKeyBarrier(table, (object).RawField(offset),      \
                                      value);                                \
    }                                                                        \
  } while (false)
#endif

#define ACQUIRE_READ_INT32_FIELD(p, offset) \
  static_cast<int32_t>(base::Acquire_Load(  \
      reinterpret_cast<const base::Atomic32*>(FIELD_ADDR(p, offset))))

#define RELAXED_WRITE_INT8_FIELD(p, offset, value)                             \
  base::Relaxed_Store(reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)), \
                      static_cast<base::Atomic8>(value));
#define RELAXED_READ_INT8_FIELD(p, offset) \
  static_cast<int8_t>(base::Relaxed_Load(  \
      reinterpret_cast<const base::Atomic8*>(FIELD_ADDR(p, offset))))

#define RELAXED_READ_INT16_FIELD(p, offset) \
  static_cast<int16_t>(base::Relaxed_Load(  \
      reinterpret_cast<const base::Atomic16*>(FIELD_ADDR(p, offset))))

#define RELAXED_WRITE_INT16_FIELD(p, offset, value)             \
  base::Relaxed_Store(                                          \
      reinterpret_cast<base::Atomic16*>(FIELD_ADDR(p, offset)), \
      static_cast<base::Atomic16>(value));

#define RELAXED_READ_UINT32_FIELD(p, offset) \
  static_cast<uint32_t>(base::Relaxed_Load(  \
      reinterpret_cast<const base::Atomic32*>(FIELD_ADDR(p, offset))))

#define RELAXED_WRITE_UINT32_FIELD(p, offset, value)            \
  base::Relaxed_Store(                                          \
      reinterpret_cast<base::Atomic32*>(FIELD_ADDR(p, offset)), \
      static_cast<base::Atomic32>(value));

#define RELAXED_READ_INT32_FIELD(p, offset) \
  static_cast<int32_t>(base::Relaxed_Load(  \
      reinterpret_cast<const base::Atomic32*>(FIELD_ADDR(p, offset))))

#define RELEASE_WRITE_INT32_FIELD(p, offset, value)             \
  base::Release_Store(                                          \
      reinterpret_cast<base::Atomic32*>(FIELD_ADDR(p, offset)), \
      static_cast<base::Atomic32>(value))

#define RELAXED_WRITE_INT32_FIELD(p, offset, value)             \
  base::Relaxed_Store(                                          \
      reinterpret_cast<base::Atomic32*>(FIELD_ADDR(p, offset)), \
      static_cast<base::Atomic32>(value));

#define RELAXED_READ_BYTE_FIELD(p, offset) \
  static_cast<byte>(base::Relaxed_Load(    \
      reinterpret_cast<const base::Atomic8*>(FIELD_ADDR(p, offset))))

#define RELAXED_WRITE_BYTE_FIELD(p, offset, value)                             \
  base::Relaxed_Store(reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)), \
                      static_cast<base::Atomic8>(value));

#ifdef OBJECT_PRINT
#define DECL_PRINTER(Name) void Name##Print(std::ostream& os);  // NOLINT
#else
#define DECL_PRINTER(Name)
#endif

#ifdef VERIFY_HEAP
#define DECL_VERIFIER(Name) void Name##Verify(Isolate* isolate);
#define EXPORT_DECL_VERIFIER(Name) \
  V8_EXPORT_PRIVATE void Name##Verify(Isolate* isolate);
#else
#define DECL_VERIFIER(Name)
#define EXPORT_DECL_VERIFIER(Name)
#endif

#define DEFINE_DEOPT_ELEMENT_ACCESSORS(name, type) \
  type DeoptimizationData::name() const {          \
    return type::cast(get(k##name##Index));        \
  }                                                \
  void DeoptimizationData::Set##name(type value) { set(k##name##Index, value); }

#define DEFINE_DEOPT_ENTRY_ACCESSORS(name, type)                \
  type DeoptimizationData::name(int i) const {                  \
    return type::cast(get(IndexForEntry(i) + k##name##Offset)); \
  }                                                             \
  void DeoptimizationData::Set##name(int i, type value) {       \
    set(IndexForEntry(i) + k##name##Offset, value);             \
  }

#define TQ_OBJECT_CONSTRUCTORS(Type)               \
 public:                                           \
  constexpr Type() = default;                      \
                                                   \
 protected:                                        \
  template <typename TFieldType, int kFieldOffset> \
  friend class TaggedField;                        \
                                                   \
  inline explicit Type(Address ptr);               \
  friend class TorqueGenerated##Type<Type, Super>;

#define TQ_OBJECT_CONSTRUCTORS_IMPL(Type) \
  inline Type::Type(Address ptr)          \
      : TorqueGenerated##Type<Type, Type::Super>(ptr) {}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Lecanora polycarpa Schltdl.

### Remarks
null


text:
"""
Read SAS sas7bdat or xport files.
"""

def read_sas(filepath_or_buffer, format=None, index=None, encoding=None,
             chunksize=None, iterator=False):
    """
    Read SAS files stored as either XPORT or SAS7BDAT format files.

    Parameters
    ----------
    filepath_or_buffer : string or file-like object
        Path to the SAS file.
    format : string {'xport', 'sas7bdat'} or None
        If None, file format is inferred.  If 'xport' or 'sas7bdat',
        uses the corresponding format.
    index : identifier of index column, defaults to None
        Identifier of column that should be used as index of the DataFrame.
    encoding : string, default is None
        Encoding for text data.  If None, text data are stored as raw bytes.
    chunksize : int
        Read file `chunksize` lines at a time, returns iterator.
    iterator : bool, defaults to False
        If True, returns an iterator for reading the file incrementally.

    Returns
    -------
    DataFrame if iterator=False and chunksize=None, else SAS7BDATReader
    or XportReader
    """

    if format is None:
        try:
            fname = filepath_or_buffer.lower()
            if fname.endswith(".xpt"):
                format = "xport"
            elif fname.endswith(".sas7bdat"):
                format = "sas7bdat"
            else:
                raise ValueError("unable to infer format of SAS file")
        except:
            pass

    if format.lower() == 'xport':
        from pandas.io.sas.sas_xport import XportReader
        reader = XportReader(filepath_or_buffer, index=index,
                             encoding=encoding,
                             chunksize=chunksize)
    elif format.lower() == 'sas7bdat':
        from pandas.io.sas.sas7bdat import SAS7BDATReader
        reader = SAS7BDATReader(filepath_or_buffer, index=index,
                                encoding=encoding,
                                chunksize=chunksize)
    else:
        raise ValueError('unknown SAS format')

    if iterator or chunksize:
        return reader

    return reader.read()


text:
"""
The flask application package.
"""

from flask import Flask
app = Flask(__name__)

import BipFlaskProject.views


text:
Some string utils

`UnsafeString([]byte) string` return unsafe string from bytes slice indirectly (without allocation)
`UnsafeStringFromPtr(*byte, length) string` return unsafe string from bytes slice pointer indirectly (without allocation)
`UnsafeStringBytes(*string) []bytes` return unsafe string bytes indirectly (without allocation)

`Split2(s string, sep string) (string, string, int)`  Split2 return the split string results (without memory allocations). Use Index for find separator.
`SplitN(s string, sep string, buf []string) ([]string, int)` // SplitN return splitted slice (use pre-allocated buffer) and end position (for detect if string contains more fields for split). Use Index for find separator.

`Builder` very simular to strings.Builder, but has better perfomance (at golang 1.14).

`Template` is a simple templating system


text:
package com.tri.ui.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.tri.ui.model.observer.ChangeEvent;
import com.tri.ui.model.observer.ChangeEventType;
import com.tri.ui.model.observer.Observable;
import com.tri.ui.model.observer.Observer;
import com.tri.ui.model.utility.Validate;

/**
 * Super class for all data controllers.
 *
 * @param <D>
 *            data
 *
 * @author khennig@pobox.com
 */
public abstract class DataController<D> implements Observable, Serializable {

	private static final long serialVersionUID = 1L;

	private List<Observer> observers;

	/** Returns the value element(s) of this data controller */
	public abstract D getData();

	@Override
	public void addObserver(final Observer observer) {
		Validate.notNull(observer, "Observer required");
		Validate.isTrue(!getObservers().contains(observer),
				"Observer already associated");
		if (!getObservers().add(observer)) {
			throw new RuntimeException("Failed to add observer");
		}
	}

	@Override
	public void removeObserver(final Observer observer) {
		Validate.notNull(observer, "Observer required");
		Validate.isTrue(getObservers().remove(observer),
				"Observer not associated");
	}

	@Override
	public void removeObservers() {
		getObservers().clear();
	}

	@Override
	public void notify(final ChangeEvent event) {
		Validate.notNull(event, "Event required");
		for (Observer observer : getObservers()) {
			observer.update(event);
		}
	}

	@Override
	public void notify(final ChangeEventType type) {
		notify(new ChangeEvent(this, type));
	}

	private List<Observer> getObservers() {
		if (observers == null) {
			observers = new ArrayList<Observer>();
		}
		return observers;
	}

}


text:
<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />

/**
 * Model object representing a loadable locale.
 */
Ext.define('nineam.localization.model.LocaleModel', {
    extend: 'Ext.data.Model',

    /**
     * Model configuration object for managing differences between ExtJS and ST2.
     *
     * This object is handled by the modelConfig preprocessor.
     *
     * @private
     */
    modelConfig: [
        {name: 'id', type: 'string'},
        {name: 'label', type: 'string'},
        {name: 'url', type: 'string'},
        {name: 'propertiesClass', type: 'string'}
    ]
});


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="ilyag.readowrite.MainActivity"
    >

    <item
        android:id="@+id/menu_item_change_to_reader_mode"
        android:orderInCategory="100"
        app:showAsAction="always"
        android:title="@string/change_to_reader_main" />

    <item
        android:id="@+id/menu_item_change_to_writer_mode"
        app:showAsAction="always"
        android:title="@string/change_to_writer_main" />

    <item
        android:id="@+id/menu_item_settings"
        android:orderInCategory="100"
        app:showAsAction="never"
        android:title="@string/action_settings" />

</menu>


text:
class Issue < ActiveRecord::Base

 	  belongs_to :address
  	belongs_to :home_owner #, class_name: 'HomeOwner', foreign_key: "home_owner_id"
  	belongs_to :letter
  	belongs_to :user
  	belongs_to :issue_category #, class_name: "IssueCategory", foreign_key: "issue_category_id"
    belongs_to :issue_status_category

    validates :issue_status_category, presence: :true
  	validates :issue_category, presence: true
    validates :date, :address_id, :user_id, :issue_category_id, :home_owner, presence: true
    validates :note, length: { in: 0..500}

  # for carrierwave
  mount_uploaders :pictures, ImageUploader

  # def get_address
  # 	Address.find(self.addressId)
  # end

  def issue_status
    if issue_status_category_id == 1
      "Open"
    elsif issue_status_category_id == 5
      "Resolved"
    else
      "Lien"
    end
  end

end


text:
require 'spec_helper'

describe Fishbowl::Requests do
  describe "#save_sales_order" do
    before :each do
      mock_tcp_connection
      mock_login_response
      Fishbowl::Connection.connect(host: 'localhost')
      Fishbowl::Connection.login(username: 'johndoe', password: 'secret')
    end

    let(:connection) { FakeTCPSocket.instance }
    let(:mock_sales_order) {
      #TODO mock a SalesOrder
    }

    it "sends proper request" do
      mock_the_response(expected_response)
      Fishbowl::Requests.save_sales_order(mock_sales_order)
      connection.last_write.should be_equivalent_to(expected_request)
    end

    def expected_request
      request = Nokogiri::XML::Builder.new do |xml|
        xml.FbiXml {
          xml.Ticket
          xml.FbiMsgsRq {
            xml.SOSaveRq {
              #TODO figure out what goes here!
            }
          }
        }
      end

      request.to_xml
    end

    def expected_response
      Nokogiri::XML::Builder.new do |xml|
        xml.response {
          xml.SOSaveRs(statusCode: '1000', statusMessage: "Success!") {
            #TODO figure out what goes here!
          }
        }
      end
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/edit_mode_check"
        app:showAsAction="always"
        android:icon="@drawable/ic_done_white_24dp">
    </item>
    <item
        android:id="@+id/edit_mode_delete"
        app:showAsAction="always"
        android:icon="@drawable/ic_delete_white_24dp">
    </item>

</menu>


text:
describe('RequestQueue', function() {
    require('./RequestQueue.get.spec');
});


text:
package com.rwtema.extrautils.item;

import com.google.common.collect.Multimap;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import java.util.HashSet;
import com.rwtema.extrautils.block.BlockSpike;
import net.minecraft.item.ItemBlock;

public class ItemBlockSpike extends ItemBlock
{
    public final BlockSpike spike;
    public static final HashSet<Item> itemHashSet;

    public ItemBlockSpike(final Block p_i45328_1_) {
        super(p_i45328_1_);
        this.spike = (BlockSpike)p_i45328_1_;
        this.spike.itemSpike = (Item)this;
        ItemBlockSpike.itemHashSet.add((Item)this);
    }

    public int getItemEnchantability() {
        return this.spike.swordStack.getItem().getItemEnchantability(this.spike.swordStack);
    }

    public int cofh_canEnchantApply(final ItemStack stack, final Enchantment ench) {
        if (ench.canApply(this.spike.swordStack.copy())) {
            return 1;
        }
        return -1;
    }

    public boolean isItemTool(final ItemStack p_77616_1_) {
        return p_77616_1_.stackSize == 1;
    }

    public Multimap getAttributeModifiers(final ItemStack stack) {
        return this.spike.swordStack.copy().getAttributeModifiers();
    }

    public boolean isBookEnchantable(final ItemStack stack, final ItemStack book) {
        return stack.stackSize == 1;
    }

    static {
        itemHashSet = new HashSet<Item>();
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>OriginatorInfo (Bouncy Castle Library 1.54 API Specification)</title>
<meta name="date" content="2015-12-29">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Bouncy Castle Cryptography Library 1.54

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.bouncycastle.asn1.cms

Class OriginatorInfo

java.lang.Object

org.bouncycastle.asn1.ASN1Object

org.bouncycastle.asn1.cms.OriginatorInfo

All Implemented Interfaces:

ASN1Encodable, Encodable

public class OriginatorInfo
extends ASN1Object

RFC 5652: OriginatorInfo object.

 RFC 3369:

 OriginatorInfo ::= SEQUENCE {
     certs [0] IMPLICIT CertificateSet OPTIONAL,
     crls  [1] IMPLICIT CertificateRevocationLists OPTIONAL
 }
 CertificateRevocationLists ::= SET OF CertificateList (from X.509)

 RFC 3582 / 5652:

 OriginatorInfo ::= SEQUENCE {
     certs [0] IMPLICIT CertificateSet OPTIONAL,
     crls  [1] IMPLICIT RevocationInfoChoices OPTIONAL
 }
 RevocationInfoChoices ::= SET OF RevocationInfoChoice
 RevocationInfoChoice ::= CHOICE {
     crl CertificateList,
     other [1] IMPLICIT OtherRevocationInfoFormat }

 OtherRevocationInfoFormat ::= SEQUENCE {
     otherRevInfoFormat OBJECT IDENTIFIER,
     otherRevInfo ANY DEFINED BY otherRevInfoFormat }

 TODO: RevocationInfoChoices / RevocationInfoChoice.
       Constructor using CertificateSet, CertificationInfoChoices

Constructor Summary

Constructors

Constructor and Description

OriginatorInfo(ASN1Set certs,
              ASN1Set crls)

Method Summary

Methods

Modifier and Type
Method and Description

ASN1Set
getCertificates()

ASN1Set
getCRLs()

static OriginatorInfo
getInstance(ASN1TaggedObject obj,
           boolean explicit)

Return an OriginatorInfo object from a tagged object.

static OriginatorInfo
getInstance(java.lang.Object obj)

Return an OriginatorInfo object from the given object.

ASN1Primitive
toASN1Primitive()

Produce an object suitable for an ASN1OutputStream.

Methods inherited from class org.bouncycastle.asn1.ASN1Object

equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode, toASN1Object

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

OriginatorInfo

public OriginatorInfo(ASN1Set certs,
              ASN1Set crls)

Method Detail

getInstance

public static OriginatorInfo getInstance(ASN1TaggedObject obj,
                         boolean explicit)

Return an OriginatorInfo object from a tagged object.

Parameters:

obj - the tagged object holding the object we want.

explicit - true if the object is meant to be explicitly
              tagged false otherwise.

Throws:

java.lang.IllegalArgumentException - if the object held by the
          tagged object cannot be converted.

getInstance

public static OriginatorInfo getInstance(java.lang.Object obj)

Return an OriginatorInfo object from the given object.

 Accepted inputs:

 null → null

 OriginatorInfo object

 ASN1Sequence input formats with OriginatorInfo structure inside

Parameters:

obj - the object we want converted.

Throws:

java.lang.IllegalArgumentException - if the object cannot be converted.

getCertificates

public ASN1Set getCertificates()

getCRLs

public ASN1Set getCRLs()

toASN1Primitive

public ASN1Primitive toASN1Primitive()

Produce an object suitable for an ASN1OutputStream.

Specified by:

toASN1Primitive in interface ASN1Encodable

Specified by:

toASN1Primitive in class ASN1Object

Returns:

a primitive representation of this object.

Overview

Package

Class

Tree

Deprecated

Index

Help

Bouncy Castle Cryptography Library 1.54

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
import numpy as np
from reinforcement.gridworld import standard_grid, negative_grid

def iterative_policy_evaluation(g):
	# g --> gridworld object
	# P --> pi(a|s); the policy of choosing action a given the state s.
	# Probability distribution. But in lots of cases pi(a|s) can equal 1.
	# Default P == None because I want to be able to switch from using a
	# deterministic to a random policy. Deterministic in the sense that
	# pi(a|s) = 1 for all actions and for all states.

	# We are going to use a dictionary so that we don't need
	# to set up a mapping from a 2-tuple to an integer, which would
	# be needed to use an array.
	V_s = {}

	# initialize all states' values to zero
	for s in g.all_states():
		V_s[s] = 0.0

	# Now start updating the states' values
	# Iterative policy eval converges only in the limit. So we iterate
	# until the difference in an updated state's value and its previous
	# value is negligible.
	epsilon = 10e-4
	num = 0
	while True:
		delta = 0
		num += 1
#		if num > 5:
#			break
		for s in g.all_states():
			prev_V = V_s[s]

			gamma = 1.0 # No discount factor this time.

			g.set_state(s)
			current_state = g.current_state()

			# We have to check each action in the set
			# A(s); the possible actions from the state
			# Check if terminal state. Terminal states have no state-value
			if g.is_terminal(current_state):
				V_s[current_state] = 0.0
			else:
				temp_V_s = 0.0
				order_A = len(g.actions[s])
				prob_a = (1.0/order_A)

				for action in g.actions[s]:
					r = g.move(action)
					s_prime = g.current_state()
					temp_V_s += (prob_a * (r + gamma*V_s[s_prime]))
					g.undo_move(action)
					# I want to sum over all of the actions possible
					# from state s1, so after performing state transition,
					# to check the next action from s1, we have to return to
					# s1.
				###
				V_s[s] = temp_V_s
				delta = max(delta, np.abs(V_s[current_state] - prev_V))
			###
		#print("Delta = ",delta)
		#print("Number of whiles = ", num)
		if delta < epsilon:
			break

	return V_s

def iterative_fixed_policy_evaluation(P,g, V_s):
	# P --> fixed policy
	# g --> grid_world object
	# V_s --> state-value dictionary.

	epsilon = 10e-4
	num = 0
	while True:
		delta = 0
		num += 1
		for s in g.all_states():
			prev_V = V_s[s]

			gamma = 0.9 # No discount factor this time.

			g.set_state(s)
			current_state = g.current_state()

			# We have to check each action in the set
			# A(s); the possible actions from the state
			# Check if terminal state. Terminal states have no state-value
			if g.is_terminal(current_state):
				V_s[current_state] = 0
			else:
				temp_V_s = 0
				order_A = len(g.actions[s])
				prob_a = (1.0/order_A)

				action = P[s]
				r = g.move(action)
				s_prime = g.current_state()
				temp_V_s = (r + gamma*V_s[s_prime])
				g.set_state(s)
				#g.undo_move(action) # this was error-prone when using randomly generated policies
				###
				V_s[s] = temp_V_s
			###
			delta = max(delta, abs(V_s[current_state] - prev_V))

		if delta < epsilon:
			break

	return V_s

def main():

	g = standard_grid()
	values_s = iterative_policy_evaluation(g)

	#g = negative_grid()
	#values_s = iterative_policy_evaluation(g)
	print(values_s)
	print_IPE_result(g,values_s)
	if(0):
		print("")
		Policy = {
			(0,0):'R',
			(0,1):'R',
			(0,2):'R',
			(1,0):'U',
			(1,2):'R',
			(2,0):'U',
			(2,1):'R',
			(2,2):'R',
			(2,3):'U'
			}
		g = standard_grid()
		values_s = iterative_fixed_policy_evaluation(Policy,g)

	#g = negative_grid()
	#values_s = iterative_policy_evaluation(g)
	#print(values_s)
	#print_IPE_result(g,values_s)

def print_IPE_result(g,value_s):
	# g --> grid_world object
	# value_s --> dictionary of states and their values

	width = g.width + 1
	height = g.height + 1
	for i in range(height):
		print("--------------------------------")
		temp_line = ''
		for j in range(width):
			if (i,j) in value_s:
				if value_s[(i,j)]>=0:
					temp_line += " %.3f"%(value_s[(i,j)]) + " "
				else:
					temp_line += "%.3f"%(value_s[(i,j)]) + " "
			else:
				temp_line += " 0.000 "
		print(temp_line)
	print("--------------------------------")

def print_policy(P,g):
	# g --> grid_world object
	# value_s --> dictionary of states and their values

	width = g.width + 1
	height = g.height + 1
	for i in range(height):
		print("--------------------------------")
		temp_line = ''
		for j in range(width):
			if (i,j) in P:
				temp_line += " "+(P[(i,j)]) + " "
			else:
				temp_line += " 0 "
		print(temp_line)
	print("--------------------------------")

def policy_improvement():
	"""
	policy = {
		(0,0):'D',
		(0,1):'R',
		(0,2):'R',
		(1,0):'U',
		(1,2):'R',
		(2,0):'U',
		(2,1):'R',
		(2,2):'R',
		(2,3):'U'
		}
	"""
	POSSIBLE_ACTIONS = ["D","L","R","U"]

	#g = standard_grid()
	g = negative_grid()
	states = g.all_states()

	# INITIALIZE RANDOM POLICY.
	# Our algorithm should be able to learn an optimal policy.
	policy = {}
	for s in g.actions:
		policy[s] = POSSIBLE_ACTIONS[np.random.randint(4)]

	# INITIALIZE STATE-VALUE DICTIONARY
	V_s = {}
	# initialize all states' values to zero. Could also have done random; it doesn't matter.
	for s in g.all_states():
		V_s[s] = 0

	# POLICY IMPROVEMENT
	policy_changed = False
	print("Initial policy:\n")
	print_policy(policy,g)
	print("")

	values_s = iterative_fixed_policy_evaluation(policy,g, V_s)
	num = 0
	while True:
		num+=1
		policy_changed = False

		## Check if we can find a better policy. Control problem
		for s in states:
			g.set_state(s)
			current_state = g.current_state()

			gamma = 0.9

			# If s is not a terminal state
			if s in g.actions:
				previous_a = policy[s]
				max_V = values_s[current_state]

				for a in POSSIBLE_ACTIONS:
					r = g.move(a)
					s_prime = g.current_state()
					temp_V = (r + gamma*values_s[s_prime])
					if temp_V > max_V:
						max_V = temp_V
						policy[s] = a
						policy_changed = True
					g.set_state(s)

		#		values_s[s] = max_V

		# state-value improvement if policy changed.
		if policy_changed:
			print("iteration = ",num)
			if (0):# num == 200:
				print(policy)
				input("continue?")
			values_s = iterative_fixed_policy_evaluation(policy,g,values_s)
		else:
			break

	print("New policy:\n")
	print_policy(policy,g)


text:
void register_Style_class();

#endif//Style_hpp__pyplusplus_wrapper


text:
import ConfigParser
config = ConfigParser.ConfigParser()
config.read("config.ini")


text:
#include "internal/mouse-event_private.hpp"

#include <skland/gui/surface.hpp>

namespace skland {
namespace gui {

using core::PointI;
using core::PointD;

MouseEvent::MouseEvent(Input *input)
    : InputEvent(input) {
  p_.reset(new Private);
}

MouseEvent::~MouseEvent() {

}

Surface *MouseEvent::GetSurface() const {
  return p_->surface;
}

uint32_t MouseEvent::GetSerial() const {
  return p_->serial;
}

const PointD &MouseEvent::GetSurfaceXY() const {
  return p_->surface_xy;
}

PointD MouseEvent::GetWindowXY() const {
  PointD xy;

  PointI pos = p_->surface->GetWindowPosition();

  xy.x = pos.x + p_->surface_xy.x;
  xy.y = pos.y + p_->surface_xy.y;

  return xy;
}

uint32_t MouseEvent::GetButton() const {
  return p_->button;
}

uint32_t MouseEvent::GetState() const {
  return p_->state;
}

uint32_t MouseEvent::GetAxis() const {
  return p_->axis;
}

} // namespace gui
} // namespace skland


text:
from django import template
from django.contrib.auth.models import User

from clusters.models import Cluster

register = template.Library()

class ClusterPermsNode(template.Node):
    def __init__(self, user, perm_name, cluster, varname):
        self.user = template.Variable(user)
        self.perm_name = perm_name
        self.cluster = template.Variable(cluster)
        self.varname = varname

    def render(self, context):
        #import pdb; pdb.set_trace()
        try:
            actual_user = self.user.resolve(context)
        except template.VariableDoesNotExist:
            return ''
        try:
            actual_cluster = self.cluster.resolve(context)
        except template.VariableDoesNotExist:
            return ''
        answer = actual_cluster.permits(self.perm_name, actual_user)
        #print actual_user, self.perm_name, actual_cluster, answer
        context[self.varname] = answer
        return ''

def cluster_perms(parser, token):
    '''
    Template tag to check for permission against a cluster.

    Usage:
        {% load permissions %}

        {% for VARNAME in QUERYRESULT %}
            {% cluster_perms USER PERMNAME CLUSTER VARNAME as BOOLEANVARNAME %}
            {% if BOOLEANVARNAME %}
                I DO
            {% else %}
                I DON'T
            {% endif %}
            have permission for {{ VARNAME }}.{{ CODENAME }}!!
        {% endfor %}
    '''
    #import pdb; pdb.set_trace()
    try:
        bits = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError(
            'tag requires exactly five arguments')
    if len(bits) != 6:
        raise template.TemplateSyntaxError(
            'tag requires exactly five arguments')
    if bits[4] != 'as':
        raise template.TemplateSyntaxError(
            "fourth argument to tag must be 'as'")
    return ClusterPermsNode(bits[1], bits[2], bits[3], bits[5])

cluster_perms = register.tag(cluster_perms)

class CommunityPermsNode(template.Node):
    def __init__(self, user, perm_name, community, varname):
        self.user = template.Variable(user)
        self.perm_name = perm_name
        self.community = template.Variable(community)
        self.varname = varname

    def render(self, context):
        #import pdb; pdb.set_trace()
        try:
            actual_user = self.user.resolve(context)
        except template.VariableDoesNotExist:
            return ''
        try:
            actual_community = self.community.resolve(context)
        except template.VariableDoesNotExist:
            return ''
        answer = actual_community.permits(self.perm_name, actual_user)
        #print actual_user, self.perm_name, actual_community, answer
        context[self.varname] = answer
        return ''

def community_perms(parser, token):
    '''
    Template tag to check for permission against a community.

    Usage:
        {% load permissions %}

        {% for VARNAME in QUERYRESULT %}
            {% community_perms USER PERMNAME COMMUNITY VARNAME as BOOLEANVARNAME %}
            {% if BOOLEANVARNAME %}
                I DO
            {% else %}
                I DON'T
            {% endif %}
            have permission for {{ VARNAME }}.{{ CODENAME }}!!
        {% endfor %}
    '''
    #import pdb; pdb.set_trace()
    try:
        bits = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError(
            'tag requires exactly five arguments')
    if len(bits) != 6:
        raise template.TemplateSyntaxError(
            'tag requires exactly five arguments')
    if bits[4] != 'as':
        raise template.TemplateSyntaxError(
            "fourth argument to tag must be 'as'")
    return CommunityPermsNode(bits[1], bits[2], bits[3], bits[5])

community_perms = register.tag(community_perms)


text:
using System.Linq;
using Xunit;

namespace System.Security.Cryptography.RNG.Tests
{
    /// <summary>
    /// Since RNGCryptoServiceProviderTests wraps RandomNumberGenerator from Algorithms assembly, we only test minimally here.
    /// </summary>
    public partial class RNGCryptoServiceProviderTests
    {
        [Fact]
        public static void DifferentSequential_10_Array()
        {
            // Ensure that the RNG doesn't produce a stable set of data.
            byte[] first = new byte[10];
            byte[] second = new byte[10];

            using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
            {
                rng.GetBytes(first);
                rng.GetBytes(second);
            }

            // Random being random, there is a chance that it could produce the same sequence.
            // The smallest test case that we have is 10 bytes.
            // The probability that they are the same, given a Truly Random Number Generator is:
            // Pmatch(byte0) * Pmatch(byte1) * Pmatch(byte2) * ... * Pmatch(byte9)
            // = 1/256 * 1/256 * ... * 1/256
            // = 1/(256^10)
            // = 1/1,208,925,819,614,629,174,706,176
            Assert.NotEqual(first, second);
        }

        [Fact]
        public static void DifferentSequential_10_Span()
        {
            // Ensure that the RNG doesn't produce a stable set of data.
            byte[] first = new byte[10];
            byte[] second = new byte[10];

            using (var rng = new RNGCryptoServiceProvider())
            {
                rng.GetBytes((Span<byte>)first);
                rng.GetBytes((Span<byte>)second);
            }

            // Random being random, there is a chance that it could produce the same sequence.
            // The smallest test case that we have is 10 bytes.
            // The probability that they are the same, given a Truly Random Number Generator is:
            // Pmatch(byte0) * Pmatch(byte1) * Pmatch(byte2) * ... * Pmatch(byte9)
            // = 1/256 * 1/256 * ... * 1/256
            // = 1/(256^10)
            // = 1/1,208,925,819,614,629,174,706,176
            Assert.NotEqual(first, second);
        }

        [Fact]
        public static void GetNonZeroBytes_Array()
        {
            using (var rng = new RNGCryptoServiceProvider())
            {
                AssertExtensions.Throws<ArgumentNullException>("data", () => rng.GetNonZeroBytes(null));

                // Array should not have any zeros
                byte[] rand = new byte[65536];
                rng.GetNonZeroBytes(rand);
                Assert.Equal(-1, Array.IndexOf<byte>(rand, 0));
            }
        }

        [Fact]
        public static void GetNonZeroBytes_Span()
        {
            using (var rng = new RNGCryptoServiceProvider())
            {
                AssertExtensions.Throws<ArgumentNullException>("data", () => rng.GetNonZeroBytes(null));

                // Array should not have any zeros
                byte[] rand = new byte[65536];
                rng.GetNonZeroBytes((Span<byte>)rand);
                Assert.Equal(-1, Array.IndexOf<byte>(rand, 0));
            }
        }

        [Fact]
        public static void GetBytes_Offset()
        {
            using (var rng = new RNGCryptoServiceProvider())
            {
                byte[] rand = new byte[400];

                // Set canary bytes
                rand[99] = 77;
                rand[399] = 77;

                rng.GetBytes(rand, 100, 200);

                // Array should not have been touched outside of 100-299
                Assert.Equal(99, Array.IndexOf<byte>(rand, 77, 0));
                Assert.Equal(399, Array.IndexOf<byte>(rand, 77, 300));

                // Ensure 100-300 has random bytes; not likely to ever fail here by chance (256^200)
                Assert.True(rand.Skip(100).Take(200).Sum(b => b) > 0);
            }
        }

        [Fact]
        public static void VerifyCtors()
        {
            using (new RNGCryptoServiceProvider()) { }
            using (new RNGCryptoServiceProvider(string.Empty)) { }
            using (new RNGCryptoServiceProvider((string)null)) { }
            using (new RNGCryptoServiceProvider((CspParameters)null)) { }

            Assert.Throws<PlatformNotSupportedException>(() =>
            { using (new RNGCryptoServiceProvider(new CspParameters())) { } });
        }
    }
}


text:
<?php

namespace Jced;

/**
 * Trait UopzTrait
 *
 * Useful wrapper for uopz library's functions
 */
trait UopzTrait
{
    /**
     * Hook non-return third-party-called function to get return from it
     *
     * Simple example:
     *
     * public function foo($data) {
     *     return Database::insert($data);
     * }
     * public function bar() {
     *     $data = ['field' => 'value'];
     *     foo($data);
     * }
     *
     * Sometime when you testing bar() you may want to know what happend in foo()
     *
     * public function testBar() {
     *     $this->uopzFunctionHook(
     *         'foo',
     *         function ($data) {
     *             return $data;
     *         },
     *         $fooResult
     *     );
     *     bar();
     *     $this->assertEqual(['field' => 'value'], $fooResult);
     * }
     *
     * @param string|array $function Function/method name
     * @param Closure $closure Closure
     * @param mixed $return Referenced return
     * @param bool $backup Backup
     */
    public function uopzFunctionHook($function, Closure $closure, &$return, $backup = false)
    {
        $this->uopzFunction(
            $function,
            function () use (&$return, $closure) {
                $return = call_user_func_array($closure, func_get_args());
                return $return;
            },
            $backup
        );
    }

    /**
     * Replace function's return value using list of conditions.
     * Source function cant be redefined or defined as closure before using this method.
     * Example:
     *
     * public function selectAll($table) {
     *     return $db->select()->from($table)->fetchAll();
     * }
     *
     * public function foo() {
     *     $result1 = $this->selectAll('user');
     *     // do something
     *     $result2 = $this->selectAll('article');
     *     // do something
     *     $result3 = $this->selectAll('post');
     * }
     *
     * You can mock all calls just doing:
     *
     * public function testFoo() {
     *     $this->uopzFunctionConditionReturn(
     *         'selectAll',
     *         [
     *             ['table', 'user', [0 => 'user1', 2 => 'user3']],
     *             ['table', 'post', function () { return 'some other result here'; }],
     *         ],
     *         null // for all other queries
     *     );
     * }
     *
     * @param string|array $function Function/method name
     * @param array $conditionList Conditions
     * @param bool $backup Backup
     * @param mixed $default Default return
     * @throws Exception
     */
    public function uopzFunctionConditionReturn($function, array $conditionList, $default = null, $backup = false)
    {
        if (is_array($function)) {
            $replacement = new ReflectionMethod($function[0], $function[1]);
        } else {
            $replacement = new ReflectionFunction($function);
        }
        if ('{closure}' == $replacement->getName() || $replacement->isClosure()) {
            throw new Exception('Cant apply conditions to closure or replaced function. Try to restore function before.');
        }
        $parameters = array_map(
            function ($parameter) {
                return $parameter->getName();
            },
            $replacement->getParameters()
        );
        $this->uopzFunction(
            $function,
            function () use ($parameters, $conditionList, $default) {
                $returnConvert = function ($return) {
                    if ($return instanceof Closure) {
                        return $return();
                    } elseif (is_object($return)) {
                        return clone $return;
                    } else {
                        return $return;
                    }
                };
                foreach ($conditionList as list($parameterName, $needle, $return)) {
                    $key = in_array($parameterName, $parameters);
                    if (false !== $key && func_get_arg($key) === $needle) {
                        return $returnConvert($return);
                    }
                }
                return $returnConvert($default);
            },
            $backup
        );
    }

    /**
     * Consistent return
     *
     * @param string|array $function Function name
     * @param array $return Return
     * @param bool $backup Backup
     */
    public function uopzFunctionConsistentReturn($function, array $return, $backup = false)
    {
        $this->uopzFunction(
            $function,
            function () use ($return) {
                static $callNumber = 0;
                $return = $return[$callNumber++];
                if ($return instanceof Closure) {
                    return $return();
                } elseif (is_object($return)) {
                    return clone $return;
                } else {
                    return $return;
                }
            },
            $backup
        );
    }

    /**
     * Replace one function with another
     *
     * Example:
     *
     * $this->uopzFunctionReplace(['mysqli', 'query'], 'mysql_query'); // downgrade :)
     *
     * @param string|array $function Target function name
     * @param string|array $replace Source function name
     * @param bool $backup Backup
     */
    public function uopzFunctionReplace($function, $replace, $backup = false)
    {
        $this->uopzFunction(
            $function,
            function () use ($replace) {
                if (is_array($replace)) {
                    if (is_object($replace[0])) {
                        $className = get_class($replace[0]);
                        $object = $replace[0];
                    } else {
                        $className = $replace[0];
                        $object = null;
                    }
                    $replacement = new ReflectionMethod($className, $replace[1]);
                    return $replacement->invokeArgs($object, func_get_args());
                } else {
                    $replacement = new ReflectionFunction($replace);
                    return $replacement->invokeArgs(func_get_args());
                }
            },
            $backup
        );
    }

    /**
     * Just return something, nothing more
     *
     * @param string|array $function Function name
     * @param mixed $return Return
     * @param bool $backup Backup
     */
    public function uopzFunctionSimpleReturn($function, $return, $backup = false)
    {
        $this->uopzFunction(
            $function,
            function () use ($return) {
                if ($return instanceof Closure) {
                    return $return();
                } elseif (is_object($return)) {
                    return clone $return;
                } else {
                    return $return;
                }
            },
            $backup
        );
    }

    /**
     * Backup function
     *
     * @param string|array $function Function name
     */
    public function uopzBackup($function)
    {
        $this->uopzInvoke('backup', $function);
    }

    /**
     * @param string|array $function Restore function
     */
    public function uopzRestore($function)
    {
        $this->uopzInvoke('restore', $function);
    }

    /**
     * Ask function to do nothing :)
     *
     * @param string|array $function Function name
     * @param bool $backup Backup
     */
    public function uopzMuteFunction($function, $backup = false)
    {
        $this->uopzFunction(
            $function,
            function () {
                return ;
            },
            $backup
        );
    }

    /**
     * Check docs for uops_function ;)
     *
     * @param string|array $function
     * @param Closure $closure
     * @param bool $backup
     */
    public function uopzFunction($function, Closure $closure, $backup = false)
    {
        if ($backup) {
            $this->uopzBackup($function);
        }
        $this->uopzInvoke('function', $function, [$closure]);
    }

    /**
     * Check docs for uops_redefine ;)
     *
     * @param string|array $constant
     * @param mixed $value
     */
    public function uopzRedefine($constant, $value)
    {
        $this->uopzInvoke('redefine', $constant, [$value]);
    }

    /**
     * Check docs for uops_flags ;)
     *
     * My favourite useful example:
     *
     * public function testMyPrivateMethod() {
     *     // make private method public
     *     $this->uopzFlags(['MyClass', 'myPrivateMethod'], ZEND_ACC_PUBLIC);
     *     $myClassObject = new MyClass();
     *     $this->assertTrue($myClassObject->myPrivateMethod());
     * }
     *
     * @param string|array $function
     * @param int $flags
     */
    public function uopzFlags($function, $flags)
    {
        $this->uopzInvoke('flags', $function, [$flags]);
    }

    /**
     * Call native functions, never mind
     *
     * @param string $name
     * @param string|array $functionName
     * @param array $params
     */
    private function uopzInvoke($name, $functionName, array $params = [])
    {
        $replacement = new ReflectionFunction('uopz_' . $name);
        if (!is_array($functionName)) {
            $functionName = [$functionName];
        }
        $replacement->invokeArgs(array_merge($functionName, $params));
    }
}


text:
%{
MIT License

Copyright (c) [2016] [Mallory Ann Jensen, jensenma@alum.mit.edu]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
%}

clear all; close all;

%Determine the wafer size based on the image
filename = 'C:\Users\Mallory\Documents\PERC mc-Si degradation\PERC LeTID May 25 2016\PERC LeTID047.tif';
raw = imread(filename);
figure;
imshow(raw);
title('Raw data');
grayscale = rgb2gray(raw);
figure;
imshow(grayscale);
title('Grayscale data');
%Now threshold the image
thresh = im2bw(grayscale,0.2);
figure;
imshow(thresh);
title('Thresholded image');

%Number of items we're interested in
n = 7;
for i = 1:n
    [thresh_cropped,x_crop,y_crop]=crop_PL(thresh);
    %We want to know the number of pixels that have threshold == 0 (black)
    hold = find(thresh_cropped==0);
    [a,b]=size(hold);
    num_pixels(i) = a;
end

%Now we need to convert the number of pixels to a size
conversion = 297.2/14039; %mm/pixel in one direction
area_pixel = conversion*conversion; %mm2 of one pixel since they are square

sample_face = num_pixels.*area_pixel; %mm2


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>A History of Surfing</title>
    <link rel="stylesheet" href="style.css"/>
    <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto|Montserrat">

A History of Surfing

Introduction

The Ancient Hawaiian people did not consider surfing a mere recreational activity, hobby, extreme sport, or career as it is viewed today. Rather, the Hawaiian people integrated surfing into their culture and made surfing more of an art than anything else.[citation needed] They referred to this art as heʻe nalu which translates into English as "wave sliding." The art began before entering the mysterious ocean as the Hawaiians prayed to the gods for protection and strength to undertake the powerful mystifying ocean. If the ocean was tamed, frustrated surfers would call upon the kahuna (priest), who would aid them in a surfing prayer asking the gods to deliver great surf. Prior to entering the ocean, the priest would also aid the surfers (mainly of the upper class) in undertaking the spiritual ceremony of constructing a surfboard.

Profiles

Stacy Peralta

Dave Kalama

Andy Irons

Laird Hamilton


text:
using System;

#if MONO_STRICT
using System.Data.Linq;
#else
using DbLinq.Data.Linq;
#endif

namespace DbLinq.Data.Linq.Identity
{
    /// <summary>
    /// Provides a factory that creates IIdentityReaders
    /// </summary>
    internal interface IIdentityReaderFactory
    {
        /// <summary>
        /// Returns an IIdentityReader specific to the requested type
        /// (this allows to precompile the reader)
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        IIdentityReader GetReader(Type t, DataContext dataContext);
    }
}