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

/**
 * @fileoverview Generic rich data access API.
 *
 * Abstraction for data sources that allows listening for changes at different
 * levels of the data tree and updating the data via XHR requests
 *
 */

goog.provide('goog.ds.BaseDataNode');
goog.provide('goog.ds.BasicNodeList');
goog.provide('goog.ds.DataNode');
goog.provide('goog.ds.DataNodeList');
goog.provide('goog.ds.EmptyNodeList');
goog.provide('goog.ds.LoadState');
goog.provide('goog.ds.SortedNodeList');
goog.provide('goog.ds.Util');
goog.provide('goog.ds.logger');

goog.require('goog.array');
goog.require('goog.debug.Logger');

/**
 * Interface for node in rich data tree.
 *
 * Names that are reserved for system use and shouldn't be used for data node
 * names: eval, toSource, toString, unwatch, valueOf, watch. Behavior is
 * undefined if these names are used.
 *
 * @constructor
 */
goog.ds.DataNode = function() {};

/**
 * Get the value of the node
 * @return {Object} The value of the node, or null if no value.
 */
goog.ds.DataNode.prototype.get = goog.nullFunction;

/**
 * Set the value of the node
 * @param {Object} value The new value of the node.
 */
goog.ds.DataNode.prototype.set = goog.nullFunction;

/**
 * Gets all of the child nodes of the current node.
 * Should return an empty DataNode list if no child nodes.
 * @param {string=} opt_selector String selector to choose child nodes.
 * @return {goog.ds.DataNodeList} The child nodes.
 */
goog.ds.DataNode.prototype.getChildNodes = goog.nullFunction;

/**
 * Gets a named child node of the current node
 * @param {string} name The node name.
 * @param {boolean=} opt_canCreate Whether to create a child node if it does not
 *     exist.
 * @return {goog.ds.DataNode} The child node, or null
 * if no node of this name exists.
 */
goog.ds.DataNode.prototype.getChildNode = goog.nullFunction;

/**
 * Gets the value of a child node
 * @param {string} name The node name.
 * @return {Object} The value of the node, or null if no value or the child node
 *     doesn't exist.
 */
goog.ds.DataNode.prototype.getChildNodeValue = goog.nullFunction;

/**
 * Sets a named child node of the current node.
 *
 * @param {string} name The node name.
 * @param {Object} value The value to set, can be DataNode, object, property,
 *     or null. If value is null, removes the child node.
 * @return {Object} The child node, if the node was set.
 */
goog.ds.DataNode.prototype.setChildNode = goog.nullFunction;

/**
 * Get the name of the node relative to the parent node
 * @return {string} The name of the node.
 */
goog.ds.DataNode.prototype.getDataName = goog.nullFunction;

/**
 * Set the name of the node relative to the parent node
 * @param {string} name The name of the node.
 */
goog.ds.DataNode.prototype.setDataName = goog.nullFunction;

/**
 * Gets the a qualified data path to this node
 * @return {string} The data path.
 */
goog.ds.DataNode.prototype.getDataPath = goog.nullFunction;

/**
 * Load or reload the backing data for this node
 */
goog.ds.DataNode.prototype.load = goog.nullFunction;

/**
 * Gets the state of the backing data for this node
 * @return {goog.ds.LoadState} The state.
 */
goog.ds.DataNode.prototype.getLoadState = null;

/**
 * Whether the value of this node is a homogeneous list of data
 * @return {boolean} True if a list.
 */
goog.ds.DataNode.prototype.isList = goog.nullFunction;

/**
 * Enum for load state of a DataNode.
 * @enum {string}
 */
goog.ds.LoadState = {
  LOADED: 'LOADED',
  LOADING: 'LOADING',
  FAILED: 'FAILED',
  NOT_LOADED: 'NOT_LOADED'
};

/**
 * Base class for data node functionality, has default implementations for
 * many of the functions.
 *
 * implements goog.ds.DataNode
 * @constructor
 */
goog.ds.BaseDataNode = function() {};

/**
 * Set the value of the node
 * @param {Object} value The new value of the node.
 */
goog.ds.BaseDataNode.prototype.set = goog.nullFunction;

/**
 * Gets all of the child nodes of the current node.
 * Should return an empty DataNode list if no child nodes.
 * @param {string=} opt_selector String selector to choose child nodes.
 * @return {goog.ds.DataNodeList} The child nodes.
 */
goog.ds.BaseDataNode.prototype.getChildNodes = function(opt_selector) {
  return new goog.ds.EmptyNodeList();
};

/**
 * Gets a named child node of the current node
 * @param {string} name The node name.
 * @param {boolean=} opt_canCreate Whether you can create the child node if
 *     it doesn't exist already.
 * @return {goog.ds.DataNode} The child node, or null if no node of
 *     this name exists and opt_create is false.
 */
goog.ds.BaseDataNode.prototype.getChildNode = function(name, opt_canCreate) {
  return null;
};

/**
 * Gets the value of a child node
 * @param {string} name The node name.
 * @return {Object} The value of the node, or null if no value or the
 *     child node doesn't exist.
 */
goog.ds.BaseDataNode.prototype.getChildNodeValue = function(name) {
  return null;
};

/**
 * Get the name of the node relative to the parent node
 * @return {string} The name of the node.
 */
goog.ds.BaseDataNode.prototype.getDataName = goog.nullFunction;

/**
 * Gets the a qualified data path to this node
 * @return {string} The data path.
 */
goog.ds.BaseDataNode.prototype.getDataPath = function() {
  var parentPath = '';
  var myName = this.getDataName();
  if (this.getParent_ && this.getParent_()) {
    parentPath = this.getParent_().getDataPath() +
        (myName.indexOf(goog.ds.STR_ARRAY_START) != -1 ? '' :
        goog.ds.STR_PATH_SEPARATOR);
  }

  return parentPath + myName;
};

/**
 * Load or reload the backing data for this node
 */
goog.ds.BaseDataNode.prototype.load = goog.nullFunction;

/**
 * Gets the state of the backing data for this node
 * @return {goog.ds.LoadState} The state.
 */
goog.ds.BaseDataNode.prototype.getLoadState = function() {
  return goog.ds.LoadState.LOADED;
};

/**
 * Gets the parent node. Subclasses implement this function
 * @type {Function}
 * @protected
 * @suppress {underscore}
 */
goog.ds.BaseDataNode.prototype.getParent_ = null;

/**
 * Interface for node list in rich data tree.
 *
 * Has both map and list-style accessors
 *
 * @constructor
 * @extends {goog.ds.DataNode}
 */
// TODO(user): Use interfaces when available.
goog.ds.DataNodeList = function() {};

/**
 * Add a node to the node list.
 * If the node has a dataName, uses this for the key in the map.
 *
 * @param {goog.ds.DataNode} node The node to add.
 */
goog.ds.DataNodeList.prototype.add = goog.nullFunction;

/**
 * Get a node by string key.
 * Returns null if node doesn't exist.
 *
 * @param {string} key String lookup key.
 * @return {goog.ds.DataNode} The node, or null if doesn't exist.
 */
goog.ds.DataNodeList.prototype.get = goog.nullFunction;

/**
 * Get a node by index
 * Returns null if the index is out of range
 *
 * @param {number} index The index of the node.
 * @return {goog.ds.DataNode} The node, or null if doesn't exist.
 */
goog.ds.DataNodeList.prototype.getByIndex = goog.nullFunction;

/**
 * Gets the size of the node list
 *
 * @return {number} The size of the list.
 */
goog.ds.DataNodeList.prototype.getCount = goog.nullFunction;

/**
 * Sets a node in the list of a given name
 * @param {string} name Name of the node.
 * @param {goog.ds.DataNode} node The node.
 */
goog.ds.DataNodeList.prototype.setNode = goog.nullFunction;

/**
 * Removes a node in the list of a given name
 * @param {string} name Name of the node.
 * @return {boolean} True if node existed and was deleted.
 */
goog.ds.DataNodeList.prototype.removeNode = goog.nullFunction;

/**
 * Simple node list implementation with underlying array and map
 * implements goog.ds.DataNodeList.
 *
 * Names that are reserved for system use and shouldn't be used for data node
 * names: eval, toSource, toString, unwatch, valueOf, watch. Behavior is
 * undefined if these names are used.
 *
 * @param {Array.<goog.ds.DataNode>=} opt_nodes optional nodes to add to list.
 * @constructor
 * @extends {goog.ds.DataNodeList}
 */
// TODO(user): Use interfaces when available.
goog.ds.BasicNodeList = function(opt_nodes) {
  this.map_ = {};
  this.list_ = [];
  this.indexMap_ = {};
  if (opt_nodes) {
    for (var i = 0, node; node = opt_nodes[i]; i++) {
      this.add(node);
    }
  }
};

/**
 * Add a node to the node list.
 * If the node has a dataName, uses this for the key in the map.
 * TODO(user) Remove function as well
 *
 * @param {goog.ds.DataNode} node The node to add.
 */
goog.ds.BasicNodeList.prototype.add = function(node) {
  this.list_.push(node);
  var dataName = node.getDataName();
  if (dataName) {
    this.map_[dataName] = node;
    this.indexMap_[dataName] = this.list_.length - 1;
  }
};

/**
 * Get a node by string key.
 * Returns null if node doesn't exist.
 *
 * @param {string} key String lookup key.
 * @return {goog.ds.DataNode} The node, or null if doesn't exist.
 */
goog.ds.BasicNodeList.prototype.get = function(key) {
  return this.map_[key] || null;
};

/**
 * Get a node by index
 * Returns null if the index is out of range
 *
 * @param {number} index The index of the node.
 * @return {goog.ds.DataNode} The node, or null if doesn't exist.
 */
goog.ds.BasicNodeList.prototype.getByIndex = function(index) {
  return this.list_[index] || null;
};

/**
 * Gets the size of the node list
 *
 * @return {number} The size of the list.
 */
goog.ds.BasicNodeList.prototype.getCount = function() {
  return this.list_.length;
};

/**
 * Sets a node in the list of a given name
 * @param {string} name Name of the node.
 * @param {goog.ds.DataNode} node The node.
 */
goog.ds.BasicNodeList.prototype.setNode = function(name, node) {
  if (node == null) {
    this.removeNode(name);
  } else {
    var existingNode = this.indexMap_[name];
    if (existingNode != null) {
      this.map_[name] = node;
      this.list_[existingNode] = node;
    } else {
      this.add(node);
    }
  }
};

/**
 * Removes a node in the list of a given name
 * @param {string} name Name of the node.
 * @return {boolean} True if node existed and was deleted.
 */
goog.ds.BasicNodeList.prototype.removeNode = function(name) {
  var existingNode = this.indexMap_[name];
  if (existingNode != null) {
    this.list_.splice(existingNode, 1);
    delete this.map_[name];
    delete this.indexMap_[name];
    for (var index in this.indexMap_) {
      if (this.indexMap_[index] > existingNode) {
        this.indexMap_[index]--;
      }
    }
  }
  return existingNode != null;
};

/**
 * Get the index of a named node
 * @param {string} name The name of the node to get the index of.
 * @return {number|undefined} The index.
 */
goog.ds.BasicNodeList.prototype.indexOf = function(name) {
  return this.indexMap_[name];
};

/**
 * Immulatable empty node list
 * @extends {goog.ds.BasicNodeList}
 * @constructor
 */

goog.ds.EmptyNodeList = function() {
  goog.ds.BasicNodeList.call(this);
};
goog.inherits(goog.ds.EmptyNodeList, goog.ds.BasicNodeList);

/**
 * Add a node to the node list.
 * If the node has a dataName, uses this for the key in the map.
 *
 * @param {goog.ds.DataNode} node The node to add.
 */
goog.ds.EmptyNodeList.prototype.add = function(node) {
  throw Error('Can\'t add to EmptyNodeList');
};

/**
 * Node list implementation which maintains sort order during insertion and
 * modification operations based on a comparison function.
 *
 * The SortedNodeList does not guarantee sort order will be maintained if
 * the underlying data nodes are modified externally.
 *
 * Names that are reserved for system use and shouldn't be used for data node
 * names: eval, toSource, toString, unwatch, valueOf, watch. Behavior is
 * undefined if these names are used.
 *
 * @param {Function} compareFn Comparison function by which the
 *     node list is sorted. Should take 2 arguments to compare, and return a
 *     negative integer, zero, or a positive integer depending on whether the
 *     first argument is less than, equal to, or greater than the second.
 * @param {Array.<goog.ds.DataNode>=} opt_nodes optional nodes to add to list;
 *    these are assumed to be in sorted order.
 * @extends {goog.ds.BasicNodeList}
 * @constructor
 */
goog.ds.SortedNodeList = function(compareFn, opt_nodes) {
  this.compareFn_ = compareFn;
  goog.ds.BasicNodeList.call(this, opt_nodes);
};
goog.inherits(goog.ds.SortedNodeList, goog.ds.BasicNodeList);

/**
 * Add a node to the node list, maintaining sort order.
 * If the node has a dataName, uses this for the key in the map.
 *
 * @param {goog.ds.DataNode} node The node to add.
 */
goog.ds.SortedNodeList.prototype.add = function(node) {
  if (!this.compareFn_) {
    this.append(node);
    return;
  }

  var searchLoc = goog.array.binarySearch(this.list_, node, this.compareFn_);

  // if there is another node that is "equal" according to the comparison
  // function, insert before that one; otherwise insert at the location
  // goog.array.binarySearch indicated
  if (searchLoc < 0) {
    searchLoc = -(searchLoc + 1);
  }

  // update any indexes that are after the insertion point
  for (var index in this.indexMap_) {
    if (this.indexMap_[index] >= searchLoc) {
      this.indexMap_[index]++;
    }
  }

  goog.array.insertAt(this.list_, node, searchLoc);
  var dataName = node.getDataName();
  if (dataName) {
    this.map_[dataName] = node;
    this.indexMap_[dataName] = searchLoc;
  }
};

/**
 * Adds the given node to the end of the SortedNodeList. This should
 * only be used when the caller can guarantee that the sort order will
 * be maintained according to this SortedNodeList's compareFn (e.g.
 * when initializing a new SortedNodeList from a list of nodes that has
 * already been sorted).
 * @param {goog.ds.DataNode} node The node to append.
 */
goog.ds.SortedNodeList.prototype.append = function(node) {
  goog.ds.SortedNodeList.superClass_.add.call(this, node);
};

/**
 * Sets a node in the list of a given name, maintaining sort order.
 * @param {string} name Name of the node.
 * @param {goog.ds.DataNode} node The node.
 */
goog.ds.SortedNodeList.prototype.setNode = function(name, node) {
  if (node == null) {
    this.removeNode(name);
  } else {
    var existingNode = this.indexMap_[name];
    if (existingNode != null) {
      if (this.compareFn_) {
        var compareResult = this.compareFn_(this.list_[existingNode], node);
        if (compareResult == 0) {
          // the new node can just replace the old one
          this.map_[name] = node;
          this.list_[existingNode] = node;
        } else {
          // remove the old node, then add the new one
          this.removeNode(name);
          this.add(node);
        }
      }
    } else {
      this.add(node);
    }
  }
};

/**
 * The character denoting an attribute.
 * @type {string}
 * @private
 */
goog.ds.STR_ATTRIBUTE_START_ = '@';

/**
 * The character denoting all children.
 * @type {string}
 */
goog.ds.STR_ALL_CHILDREN_SELECTOR = '*';

/**
 * The wildcard character.
 * @type {string}
 */
goog.ds.STR_WILDCARD = '*';

/**
 * The character denoting path separation.
 * @type {string}
 */
goog.ds.STR_PATH_SEPARATOR = '/';

/**
 * The character denoting the start of an array.
 * @type {string}
 */
goog.ds.STR_ARRAY_START = '[';

/**
 * Shared logger instance for data package
 * @type {goog.debug.Logger}
 */
goog.ds.logger = goog.debug.Logger.getLogger('goog.ds');

/**
 * Create a data node that references another data node,
 * useful for pointer-like functionality.
 * All functions will return same values as the original node except for
 * getDataName()
 * @param {!goog.ds.DataNode} node The original node.
 * @param {string} name The new name.
 * @return {!goog.ds.DataNode} The new data node.
 */
goog.ds.Util.makeReferenceNode = function(node, name) {
  /**
   * @constructor
   * @extends {goog.ds.DataNode}
   */
  var nodeCreator = function() {};
  nodeCreator.prototype = node;
  var newNode = new nodeCreator();
  newNode.getDataName = function() {
    return name;
  };
  return newNode;
};


text:
{% if site.google_analytics %}
	<!-- Google Analytics -->
	<!--<script>
	  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

	  ga('create', 'UA-65125366-1', 'auto');
	  ga('send', 'pageview');

	</script> -->
	<!-- End Google Analytics -->

	<!-- Global site tag (gtag.js) - Google Analytics -->
	<script async src="https://www.googletagmanager.com/gtag/js?id=UA-65125366-1"></script>
	<script>
	window.dataLayer = window.dataLayer || [];
	function gtag(){dataLayer.push(arguments);}
	gtag('js', new Date());

	gtag('config', 'UA-65125366-1', { 'optimize_id': 'GTM-NS2LRFC'});
	</script>

{% endif %}

redpajama_set_name: RedPajamaGithub


text:
![1.8 stars](../../images/ic_star_black_18dp_1x.png)![1.8 stars](../../images/ic_star_half_black_18dp_1x.png)![1.8 stars](../../images/ic_star_border_black_18dp_1x.png)![1.8 stars](../../images/ic_star_border_black_18dp_1x.png)![1.8 stars](../../images/ic_star_border_black_18dp_1x.png) 5

To use the Risky Rollers skill, try saying...

* *Alexa play Risky Rollers*

* *Roll dice*

* *End turn*

Risky Rollers is a simple dice game in which you play against Alexa. The goal of the game is to reach 100 points before the she does. On a turn, you roll the dice and add up the points shown. You can continue to roll to get more points, but if you get a one, your turn ends and you lose all of your points earned that turn. If you get double ones, you lose all of your points! When it is worth it to risk another roll is up to you.

***

### Skill Details

* **Invocation Name:** risky rollers
* **Category:** null
* **ID:** amzn1.ask.skill.dfb892f3-0a98-4ff1-8e2e-4d0e36065bd8
* **ASIN:** B01NCP2EFM
* **Author:** LukeDickinson
* **Release Date:** December 26, 2016 @ 00:49:28
* **In-App Purchasing:** No


text:
package com.genentech.chemistry.openEye;

import openeye.oechem.OEMolBase;

import com.aestel.chemistry.openEye.SimComparator;
import com.aestel.chemistry.openEye.SimComparatorFactory;

public class CliffComparatorFact implements SimComparatorFactory<OEMolBase, OEMolBase, SimComparator<OEMolBase>>
{  private final SimComparatorFactory<OEMolBase, OEMolBase, SimComparator<OEMolBase>> parentFact;
   private final boolean takeLog;
   private final String propertyTag;
   private final double minCliffSim;
   private final double foldAt1Sim;
   private final double simAt2Delta;
   private final boolean ignoreModifier;

   /**
    * Create a cliff comparator using the SimilarityComaprator provided.
    * The cliff value is calculated as delta(property)/(1-Sim).
    * If takelog is given formula is delta(log(property)/1-Sim)
    * @param parentFact Factory to create a new SimilarityComparators for the underlying
    *                   Similarity.
    * @param propertyTag Tag of property to use for numerator
    * @param takeLog if true the log of the property value is used
    * @param minCliffSim if Sim < minCliffSim return 0
    * @param foldAt1Sim  if not 0 use modified cliff formula cf. {@link CorrectedCliffComparator}.
    * @param simAt2Delta if not 0 use modified cliff formula cf. {@link CorrectedCliffComparator}.
    */
   public CliffComparatorFact(SimComparatorFactory<OEMolBase, OEMolBase, SimComparator<OEMolBase>> parentFact,
                              String propertyTag, boolean ignoreModifier, boolean takeLog, double minCliffSim,
                              double foldAt1Sim, double simAt2Delta)
   {  this.parentFact = parentFact;
      this.propertyTag = propertyTag;
      this.ignoreModifier = ignoreModifier;
      this.takeLog = takeLog;
      this.minCliffSim = minCliffSim;
      this.foldAt1Sim = foldAt1Sim;
      this.simAt2Delta = simAt2Delta;
   }

   /** returns new objects which should be deleted separately */
   @Override
   public OEMolBase createComparable(OEMolBase in)
   {  return parentFact.createComparable(in);
   }

   @Override
   public CliffComparator createComparator(OEMolBase mol)
   {  SimComparator<OEMolBase> parentComparator = parentFact.createComparator(mol);
      if( foldAt1Sim <= 0D || simAt2Delta <= 0D)
         return new CliffComparator(parentComparator, mol, propertyTag, ignoreModifier, takeLog, minCliffSim );

      return new CorrectedCliffComparator(parentComparator, mol, propertyTag, ignoreModifier, takeLog, minCliffSim, foldAt1Sim, simAt2Delta);
   }

   @Override
   public void close()
   {  parentFact.close();
   }
}


text:
package fr.openwide.core.jpa.more.business.task.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import fr.openwide.core.jpa.business.generic.service.GenericEntityServiceImpl;
import fr.openwide.core.jpa.exception.SecurityServiceException;
import fr.openwide.core.jpa.exception.ServiceException;
import fr.openwide.core.jpa.more.business.task.dao.IQueuedTaskHolderDao;
import fr.openwide.core.jpa.more.business.task.model.QueuedTaskHolder;
import fr.openwide.core.jpa.more.business.task.util.TaskStatus;

public class QueuedTaskHolderServiceImpl extends GenericEntityServiceImpl<Long, QueuedTaskHolder> implements
		IQueuedTaskHolderService {

	private IQueuedTaskHolderDao queuedTaskHolderDao;

	@Autowired
	public QueuedTaskHolderServiceImpl(IQueuedTaskHolderDao queuedTaskHolderDao) {
		super(queuedTaskHolderDao);
		this.queuedTaskHolderDao = queuedTaskHolderDao;
	}

	@Override
	protected void createEntity(QueuedTaskHolder queuedTaskHolder) throws ServiceException, SecurityServiceException {
		queuedTaskHolder.setCreationDate(new Date());
		super.createEntity(queuedTaskHolder);
	}

	@Override
	public Long count(Date since, TaskStatus... statuses) {
		return queuedTaskHolderDao.count(since, statuses);
	}

	@Override
	public Long count(TaskStatus... statuses) {
		return queuedTaskHolderDao.count(statuses);
	}

	@Override
	public QueuedTaskHolder getNextTaskForExecution(String taskType) {
		return queuedTaskHolderDao.getNextTaskForExecution(taskType);
	}

	@Override
	public QueuedTaskHolder getRandomStalledTask(String taskType, int executionTimeLimitInSeconds) {
		return queuedTaskHolderDao.getStalledTask(taskType, executionTimeLimitInSeconds);
	}

	@Override
	public List<QueuedTaskHolder> getListConsumable(String queueId)  throws ServiceException, SecurityServiceException {
		return queuedTaskHolderDao.listConsumable(queueId);
	}

	@Override
	public List<String> listTypes() {
		return queuedTaskHolderDao.listTypes();
	}

	@Override
	public boolean isReloadable(QueuedTaskHolder task) {
		return TaskStatus.RELOADABLE_TASK_STATUS.contains(task.getStatus());
	}

	@Override
	public boolean isCancellable(QueuedTaskHolder task) {
		return TaskStatus.CANCELLABLE_TASK_STATUS.contains(task.getStatus());
	}
}


text:
/**
 * Created by d.d on 18/07/2017.
 */

export interface IPostBase {
	name: string;
	title: string;
	subtitle?: string;
	createdTime: string;
	headerImageType?: string;
	tags: string[];
}

export interface IPost extends IPostBase {
	id: number;
	content: string;
}

export default class Post {
	public id: number;
	public name: string;
	public title: string;
	public content: string;
	public subtitle?: string;
	public createdTime: string;
	public headerImgName: string;
	public tags: string[];
	constructor({
		id = -1,
		name = '',
		title = '',
		content = '',
		subtitle = '',
		createdTime = '',
		headerImageType = '.jpg',
		tags = [] }: IPost) {
		this.id = id;
		this.name = name;
		this.title = title;
		this.subtitle = subtitle;
		this.createdTime = createdTime;
		this.content = content;
		this.headerImgName = createdTime + headerImageType;
		this.tags = tags;
	}
}

export interface IPostShort {
	name: string;
	title: string;
}

export interface IPostPage extends Post {
	prevPost?: IPostShort;
	nextPost?: IPostShort;
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PlantillaASP
{
    public partial class InicioConSesion : System.Web.UI.MasterPage
    {
        Wservice.Fase2WebClient servicio = new Wservice.Fase2WebClient();
        protected void Page_Load(object sender, EventArgs e)
        {
            String[] perfil = servicio.ObtenerPerfilUsuario(Session["NickName"].ToString());
            Session["saldo"] = perfil[2];

        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (servicio.RolUsuario(Session["NickName"].ToString(), "asociado"))
            {
                Response.Redirect("Asociado.aspx");
            }
            else { Response.Redirect("NoAsociado.aspx"); }
        }

        protected void Buttonfun2_Click(object sender, EventArgs e)
        {
            if (servicio.RolUsuario(Session["NickName"].ToString(), "moderador"))
            {
                Response.Redirect("Moderador.aspx");
            }
            else { Response.Redirect("NoModerador.aspx"); }
        }
    }
}


text:
layout: post
title: Visualizations of Day 9 at the 2016 U.S. Open
comments: true
---

Day 9 brought us the first half of the quarterfinals of the 2016 U.S. Open. It was a day when the favorites were in top-form, closing out all of their matches in swift fashion. Here we review how both the two women's and two men's quarterfinal matches of the day were won.

Embed from Getty Images

Wozniacki Shines

With just a 59% chance of winning the match, Caroline Wozniacki was the lowest probability favorite of the day. Unfortunately, her opponent Anastasjia Sevastova suffered an injury during the match that clearly made it an imbalanced contest (reminding us of the injury Ana Konjuh had at Wimbledon this year and her victorious [rematch yesterday](http://www.nytimes.com/2016/09/06/sports/tennis/ana-konjuh-stuns-agnieszka-radwanska.html)). We can see from the match chart below that it was really over by the second game of the second set, giving Wozniacki, World No. 74, her ticket to the semifinals.

Kerber Cruises

Taking on 2015 U.S. Open finalist Roberta Vinci, Angelique Kerber looked unbeatable. After a tough first set, in which the women had 7 breaks of service, Kerber played a second set that could even give Serena Williams reservations about a clash in the finals. In fact, after the first game of the second set, Kerber's chances of winning the match were at 95% and never wavered from there on out.

Monfils Prevails

On a day when 3 Frenchmen were among 4 of the quarterfinalists, at least one would have to end his U.S. Open journey.  Monfils was in the unlucky position of having to take on his countrymen, Lucas Pouille, to fight for a place in the semifinal. Pouille, a tennis [foot soldier](http://www.footsoldiersoftennis.com/tag/lucas-pouille/), had a miraculous run at the Open, winning 3 consecutive 5-set matches, the most recent being a win over Rafael Nadal.

Monfils wasn't about to let him be the fourth to fall to Pouille.

Monfils went into the match the [71% favorite](http://projects.fivethirtyeight.com/2016-us-open-tennis-predictions/). After earning a break in the 7th game, Monfils raised those chances even more. By the start of the second set, with one set of the board, Monfils' win chances were approaching 90% and he never looked back. Without a single break point chance in the whole match, Pouille's wasn't going to make a comeback this time.

Djokovic Gets Another Break

The most ridiculous match chart of the day has to go to Novak Djokovic. Even though Djokovic faced World No. 11, Jo-Wilfried Tsonga in his quarterfinal match, he still had a pre-match probability of taking the win of 92%. With that kind of edge, Djokovic could afford to lose a break in the first set and still have his win chances hardly falter.

When Tsonga appeared to have a knee injury at the end of the second, he soon retired and fans didn't get a chance to see Djokovic carry out his probabilistic destiny. This is Djokovic's third incomplete match in the tournament, giving him an incomprehensibly easy path to a final win.

Djokovic has only played 84 games to get to the semifinals. This is the fewest number of games any male semifinalist has every played at the US Open since 1990. In fact, the next fewest games played to reach the semifinalist was Djokovic himself in his invincible 2011 when he needed just 112 games to reach the semifinal.

{% include twitter_plug.html %}


text:
/* $Id: DocumentCleanupQueue.java 1553520 2013-12-26 17:54:07Z kwright $ */

/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.manifoldcf.crawler.system;

import org.apache.manifoldcf.core.interfaces.*;
import org.apache.manifoldcf.crawler.interfaces.*;
import java.util.*;

/** This class describes a cleanup document queue, which has a "stuffer" thread and many "reader" threads.
* The queue manages thread synchronization so that (a) the "stuffer" thread blocks until queue is empty, and
* (b) the "reader" threads block if queue is empty.
* The objects being queued are all QueuedDocumentSet objects.
*/
public class DocumentCleanupQueue
{
  public static final String _rcsid = "@(#)$Id: DocumentCleanupQueue.java 1553520 2013-12-26 17:54:07Z kwright $";

  // Since the queue has a maximum size, an ArrayList is a fine way to keep it
  protected final List<DocumentCleanupSet> queue = new ArrayList<DocumentCleanupSet>();
  // This flag gets set to 'true' if the queue is being cleared due to a reset
  protected boolean resetFlag = false;

  /** Constructor.
  */
  public DocumentCleanupQueue()
  {
  }

  /** Wake up all threads waiting on this queue.  This happens at the beginning of a reset.
  */
  public void reset()
  {
    synchronized (queue)
    {
      resetFlag = true;
      queue.notifyAll();
    }
  }

  /** Clear.  This is only used on reset.
  */
  public void clear()
  {
    synchronized (queue)
    {
      queue.clear();
      resetFlag = false;
    }
  }

  /** Check if "empty".
  *@param n is the low-water mark; if the number falls below this, then this method will return true.
  */
  public boolean checkIfEmpty(int n)
  {
    synchronized (queue)
    {
      if (queue.size() <= n)
        return true;
    }
    return false;
  }

  /** Add a document set to the queue.  This will be a set of n documents (where n is some chunk size
  * set by experiment).
  *@param dd is the document set.
  */
  public void addDocuments(DocumentCleanupSet dd)
  {
    synchronized (queue)
    {
      queue.add(dd);
      queue.notify();
    }
  }

  /** Pull a document set off the queue, and wait if there is
  * nothing there.
  *@return the document.
  */
  public DocumentCleanupSet getDocuments()
    throws InterruptedException
  {
    synchronized (queue)
    {
      // If queue is empty, go to sleep
      if (resetFlag)
        return null;

      while (queue.size() == 0 && resetFlag == false)
        queue.wait();

      // If we've been awakened, there's either an entry to grab, or we've been
      // awakened because it's time to reset.
      if (resetFlag)
          return null;

      // If we've been awakened, there's an entry to grab
      DocumentCleanupSet dd = queue.remove(queue.size()-1);
      return dd;
    }
  }

}


text:
namespace grpc_core {

TraceFlag grpc_cds_lb_trace(false, "cds_lb");

namespace {

constexpr char kCds[] = "cds_experimental";

// Parsed config for this LB policy.
class ParsedCdsConfig : public LoadBalancingPolicy::Config {
 public:
  explicit ParsedCdsConfig(grpc_core::UniquePtr<char> cluster)
      : cluster_(std::move(cluster)) {}
  const char* cluster() const { return cluster_.get(); }
  const char* name() const override { return kCds; }

 private:
  grpc_core::UniquePtr<char> cluster_;
};

// CDS LB policy.
class CdsLb : public LoadBalancingPolicy {
 public:
  explicit CdsLb(Args args);

  const char* name() const override { return kCds; }

  void UpdateLocked(UpdateArgs args) override;
  void ResetBackoffLocked() override;

 private:
  // Watcher for getting cluster data from XdsClient.
  class ClusterWatcher : public XdsClient::ClusterWatcherInterface {
   public:
    explicit ClusterWatcher(RefCountedPtr<CdsLb> parent)
        : parent_(std::move(parent)) {}
    void OnClusterChanged(CdsUpdate cluster_data) override;
    void OnError(grpc_error* error) override;

   private:
    RefCountedPtr<CdsLb> parent_;
  };

  // Delegating helper to be passed to child policy.
  class Helper : public ChannelControlHelper {
   public:
    explicit Helper(RefCountedPtr<CdsLb> parent) : parent_(std::move(parent)) {}
    RefCountedPtr<SubchannelInterface> CreateSubchannel(
        const grpc_channel_args& args) override;
    void UpdateState(grpc_connectivity_state state,
                     std::unique_ptr<SubchannelPicker> picker) override;
    void RequestReresolution() override;
    void AddTraceEvent(TraceSeverity severity, StringView message) override;

   private:
    RefCountedPtr<CdsLb> parent_;
  };

  ~CdsLb();

  void ShutdownLocked() override;

  RefCountedPtr<ParsedCdsConfig> config_;

  // Current channel args from the resolver.
  const grpc_channel_args* args_ = nullptr;

  // The xds client.
  RefCountedPtr<XdsClient> xds_client_;
  // A pointer to the cluster watcher, to be used when cancelling the watch.
  // Note that this is not owned, so this pointer must never be derefernced.
  ClusterWatcher* cluster_watcher_ = nullptr;

  // Child LB policy.
  OrphanablePtr<LoadBalancingPolicy> child_policy_;

  // Internal state.
  bool shutting_down_ = false;
};

//
// CdsLb::ClusterWatcher
//

void CdsLb::ClusterWatcher::OnClusterChanged(CdsUpdate cluster_data) {
  if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
    gpr_log(GPR_INFO, "[cdslb %p] received CDS update from xds client",
            parent_.get());
  }
  // Construct config for child policy.
  char* lrs_str = nullptr;
  if (cluster_data.lrs_load_reporting_server_name != nullptr) {
    gpr_asprintf(&lrs_str, "    \"lrsLoadReportingServerName\": \"%s\",\n",
                 cluster_data.lrs_load_reporting_server_name.get());
  }
  char* json_str;
  gpr_asprintf(&json_str,
               "[{\n"
               "  \"xds_experimental\": {\n"
               "%s"
               "    \"edsServiceName\": \"%s\"\n"
               "  }\n"
               "}]",
               (lrs_str == nullptr ? "" : lrs_str),
               (cluster_data.eds_service_name == nullptr
                    ? parent_->config_->cluster()
                    : cluster_data.eds_service_name.get()));
  gpr_free(lrs_str);
  grpc_core::UniquePtr<char> json_str_deleter(json_str);
  if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
    gpr_log(GPR_INFO, "[cdslb %p] generated config for child policy: %s",
            parent_.get(), json_str);
  }
  grpc_json* json = grpc_json_parse_string(json_str);
  if (json == nullptr) {
    char* msg;
    gpr_asprintf(&msg, "Could not parse LB config: %s", json_str);
    OnError(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg));
    gpr_free(msg);
    return;
  }
  grpc_error* error = GRPC_ERROR_NONE;
  RefCountedPtr<LoadBalancingPolicy::Config> config =
      LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(json, &error);
  grpc_json_destroy(json);
  if (error != GRPC_ERROR_NONE) {
    OnError(error);
    return;
  }
  // Create child policy if not already present.
  if (parent_->child_policy_ == nullptr) {
    LoadBalancingPolicy::Args args;
    args.combiner = parent_->combiner();
    args.args = parent_->args_;
    args.channel_control_helper = MakeUnique<Helper>(parent_->Ref());
    parent_->child_policy_ =
        LoadBalancingPolicyRegistry::CreateLoadBalancingPolicy(
            "xds_experimental", std::move(args));
    grpc_pollset_set_add_pollset_set(
        parent_->child_policy_->interested_parties(),
        parent_->interested_parties());
  }
  // Update child policy.
  UpdateArgs args;
  args.config = std::move(config);
  args.args = grpc_channel_args_copy(parent_->args_);
  parent_->child_policy_->UpdateLocked(std::move(args));
}

void CdsLb::ClusterWatcher::OnError(grpc_error* error) {
  gpr_log(GPR_ERROR, "[cdslb %p] xds error obtaining data for cluster %s: %s",
          parent_.get(), parent_->config_->cluster(), grpc_error_string(error));
  // Go into TRANSIENT_FAILURE if we have not yet created the child
  // policy (i.e., we have not yet received data from xds).  Otherwise,
  // we keep running with the data we had previously.
  if (parent_->child_policy_ == nullptr) {
    parent_->channel_control_helper()->UpdateState(
        GRPC_CHANNEL_TRANSIENT_FAILURE,
        MakeUnique<TransientFailurePicker>(error));
  } else {
    GRPC_ERROR_UNREF(error);
  }
}

//
// CdsLb::Helper
//

RefCountedPtr<SubchannelInterface> CdsLb::Helper::CreateSubchannel(
    const grpc_channel_args& args) {
  if (parent_->shutting_down_) return nullptr;
  return parent_->channel_control_helper()->CreateSubchannel(args);
}

void CdsLb::Helper::UpdateState(grpc_connectivity_state state,
                                std::unique_ptr<SubchannelPicker> picker) {
  if (parent_->shutting_down_) return;
  if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
    gpr_log(GPR_INFO, "[cdslb %p] state updated by child: %s", this,
            ConnectivityStateName(state));
  }
  parent_->channel_control_helper()->UpdateState(state, std::move(picker));
}

void CdsLb::Helper::RequestReresolution() {
  if (parent_->shutting_down_) return;
  if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
    gpr_log(GPR_INFO, "[cdslb %p] Re-resolution requested from child policy.",
            parent_.get());
  }
  parent_->channel_control_helper()->RequestReresolution();
}

void CdsLb::Helper::AddTraceEvent(TraceSeverity severity, StringView message) {
  if (parent_->shutting_down_) return;
  parent_->channel_control_helper()->AddTraceEvent(severity, message);
}

//
// CdsLb
//

CdsLb::CdsLb(Args args)
    : LoadBalancingPolicy(std::move(args)),
      xds_client_(XdsClient::GetFromChannelArgs(*args.args)) {
  if (xds_client_ != nullptr && GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
    gpr_log(GPR_INFO, "[cdslb %p] Using xds client %p from channel", this,
            xds_client_.get());
  }
}

CdsLb::~CdsLb() {
  if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
    gpr_log(GPR_INFO, "[cdslb %p] destroying cds LB policy", this);
  }
  grpc_channel_args_destroy(args_);
}

void CdsLb::ShutdownLocked() {
  if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
    gpr_log(GPR_INFO, "[cdslb %p] shutting down", this);
  }
  shutting_down_ = true;
  if (child_policy_ != nullptr) {
    grpc_pollset_set_del_pollset_set(child_policy_->interested_parties(),
                                     interested_parties());
    child_policy_.reset();
  }
  if (xds_client_ != nullptr) {
    if (cluster_watcher_ != nullptr) {
      xds_client_->CancelClusterDataWatch(StringView(config_->cluster()),
                                          cluster_watcher_);
    }
    xds_client_.reset();
  }
}

void CdsLb::ResetBackoffLocked() {
  if (child_policy_ != nullptr) child_policy_->ResetBackoffLocked();
}

void CdsLb::UpdateLocked(UpdateArgs args) {
  if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
    gpr_log(GPR_INFO, "[cdslb %p] received update", this);
  }
  // Update config.
  auto old_config = std::move(config_);
  config_ = std::move(args.config);
  // Update args.
  grpc_channel_args_destroy(args_);
  args_ = args.args;
  args.args = nullptr;
  // If cluster name changed, cancel watcher and restart.
  if (old_config == nullptr ||
      strcmp(old_config->cluster(), config_->cluster()) != 0) {
    if (old_config != nullptr) {
      xds_client_->CancelClusterDataWatch(StringView(old_config->cluster()),
                                          cluster_watcher_);
    }
    auto watcher = MakeUnique<ClusterWatcher>(Ref());
    cluster_watcher_ = watcher.get();
    xds_client_->WatchClusterData(StringView(config_->cluster()),
                                  std::move(watcher));
  }
}

//
// factory
//

class CdsFactory : public LoadBalancingPolicyFactory {
 public:
  OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
      LoadBalancingPolicy::Args args) const override {
    return MakeOrphanable<CdsLb>(std::move(args));
  }

  const char* name() const override { return kCds; }

  RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
      const grpc_json* json, grpc_error** error) const override {
    GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
    if (json == nullptr) {
      // xds was mentioned as a policy in the deprecated loadBalancingPolicy
      // field or in the client API.
      *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
          "field:loadBalancingPolicy error:cds policy requires configuration. "
          "Please use loadBalancingConfig field of service config instead.");
      return nullptr;
    }
    GPR_DEBUG_ASSERT(strcmp(json->key, name()) == 0);
    InlinedVector<grpc_error*, 3> error_list;
    const char* cluster = nullptr;
    for (const grpc_json* field = json->child; field != nullptr;
         field = field->next) {
      if (field->key == nullptr) continue;
      if (strcmp(field->key, "cluster") == 0) {
        if (cluster != nullptr) {
          error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
              "field:cluster error:Duplicate entry"));
        }
        if (field->type != GRPC_JSON_STRING) {
          error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
              "field:cluster error:type should be string"));
          continue;
        }
        cluster = field->value;
      }
    }
    if (cluster == nullptr) {
      error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
          "required field 'cluster' not present"));
    }
    if (error_list.empty()) {
      return MakeRefCounted<ParsedCdsConfig>(
          grpc_core::UniquePtr<char>(gpr_strdup(cluster)));
    } else {
      *error = GRPC_ERROR_CREATE_FROM_VECTOR("Cds Parser", &error_list);
      return nullptr;
    }
  }
};

}  // namespace

}  // namespace grpc_core

//
// Plugin registration
//

void grpc_lb_policy_cds_init() {
  grpc_core::LoadBalancingPolicyRegistry::Builder::
      RegisterLoadBalancingPolicyFactory(
          grpc_core::MakeUnique<grpc_core::CdsFactory>());
}

void grpc_lb_policy_cds_shutdown() {}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Gardenia ochreata F.Muell.

### Remarks
null


text:
function $(id) {
  return document.getElementById(id);
}

function createNaClEmbed(args) {
  var fallback = function(value, default_value) {
    return value !== undefined ? value : default_value;
  };
  var embed = document.createElement('embed');
  embed.id = args.id;
  embed.src = args.src;
  embed.type = fallback(args.type, 'application/x-nacl');
  // JavaScript inconsistency: this is equivalent to class=... in HTML.
  embed.className = fallback(args.className, 'naclModule');
  embed.width = fallback(args.width, 0);
  embed.height = fallback(args.height, 0);
  return embed;
}

function decodeURIArgs(encoded) {
  var args = {};
  if (encoded.length > 0) {
    var pairs = encoded.replace(/\+/g, ' ').split('&');
    for (var p = 0; p < pairs.length; p++) {
      var pair = pairs[p].split('=');
      if (pair.length != 2) {
        throw "Malformed argument key/value pair: '" + pairs[p] + "'";
      }
      args[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
    }
  }
  return args;
}

function addDefaultsToArgs(defaults, args) {
  for (var key in defaults) {
    if (!(key in args)) {
      args[key] = defaults[key];
    }
  }
}

// Return a dictionary of arguments for the test.  These arguments are passed
// in the query string of the main page's URL.  Any time this function is used,
// default values should be provided for every argument.  In some cases a test
// may be run without an expected query string (manual testing, for example.)
// Careful: all the keys and values in the dictionary are strings.  You will
// need to manually parse any non-string values you wish to use.
function getTestArguments(defaults) {
  var encoded = window.location.search.substring(1);
  var args = decodeURIArgs(encoded);
  if (defaults !== undefined) {
    addDefaultsToArgs(defaults, args);
  }
  return args;
}

function exceptionToLogText(e) {
  if (typeof e == 'object' && 'message' in e && 'stack' in e) {
    return e.message + '\n' + e.stack.toString();
  } else if (typeof(e) == 'string') {
    return e;
  } else {
    return toString(e)
  }
}

// Logs test results to the server using URL-encoded RPC.
// Also logs the same test results locally into the DOM.
function RPCWrapper() {
  // Work around how JS binds 'this'
  var this_ = this;
  // It is assumed RPC will work unless proven otherwise.
  this.rpc_available = true;
  // Set to true if any test fails.
  this.ever_failed = false;
  // Async calls can make it faster, but it can also change order of events.
  this.async = false;

  // Called if URL-encoded RPC gets a 404, can't find the server, etc.
  function handleRPCFailure(name, message) {
    // This isn't treated as a testing error - the test can be run without a
    // web server that understands RPC.
    this_.logLocal('RPC failure for ' + name + ': ' + message + ' - If you ' +
                   'are running this test manually, this is not a problem.',
                   'gray');
    this_.disableRPC();
  }

  function handleRPCResponse(name, req) {
    if (req.status == 200) {
      if (req.responseText == 'Die, please') {
        // TODO(eugenis): this does not end the browser process on Mac.
        window.close();
      } else if (req.responseText != 'OK') {
        this_.logLocal('Unexpected RPC response to ' + name + ': \'' +
                       req.responseText + '\' - If you are running this test ' +
                       'manually, this is not a problem.', 'gray');
        this_.disableRPC();
      }
    } else {
      handleRPCFailure(name, req.status.toString());
    }
  }

  // Performs a URL-encoded RPC call, given a function name and a dictionary
  // (actually just an object - it's a JS idiom) of parameters.
  function rpcCall(name, params) {
    if (window.domAutomationController !== undefined) {
      // Running as a Chrome browser_test.
      var msg = {type: name};
      for (var pname in params) {
        msg[pname] = params[pname];
      }
      domAutomationController.setAutomationId(0);
      domAutomationController.send(JSON.stringify(msg));
    } else if (this_.rpc_available) {
      // Construct the URL for the RPC request.
      var args = [];
      for (var pname in params) {
        pvalue = params[pname];
        args.push(encodeURIComponent(pname) + '=' + encodeURIComponent(pvalue));
      }
      var url = '/TESTER/' + name + '?' + args.join('&');
      var req = new XMLHttpRequest();
      // Async result handler
      if (this_.async) {
        req.onreadystatechange = function() {
          if (req.readyState == XMLHttpRequest.DONE) {
            handleRPCResponse(name, req);
          }
        }
      }
      try {
        req.open('GET', url, this_.async);
        req.send();
        if (!this_.async) {
          handleRPCResponse(name, req);
        }
      } catch (err) {
        handleRPCFailure(name, err.toString());
      }
    }
  }

  // Pretty prints an error into the DOM.
  this.logLocalError = function(message) {
    this.logLocal(message, 'red');
    this.visualError();
  }

  // If RPC isn't working, disable it to stop error message spam.
  this.disableRPC = function() {
    if (this.rpc_available) {
      this.rpc_available = false;
      this.logLocal('Disabling RPC', 'gray');
    }
  }

  this.startup = function() {
    // TODO(ncbray) move into test runner
    this.num_passed = 0;
    this.num_failed = 0;
    this.num_errors = 0;
    this._log('[STARTUP]');
  }

  this.shutdown = function() {
    if (this.num_passed == 0 && this.num_failed == 0 && this.num_errors == 0) {
      this.client_error('No tests were run. This may be a bug.');
    }
    var full_message = '[SHUTDOWN] ';
    full_message += this.num_passed + ' passed';
    full_message += ', ' + this.num_failed + ' failed';
    full_message += ', ' + this.num_errors + ' errors';
    this.logLocal(full_message);
    rpcCall('Shutdown', {message: full_message, passed: !this.ever_failed});

    if (this.ever_failed) {
      this.localOutput.style.border = '2px solid #FF0000';
    } else {
      this.localOutput.style.border = '2px solid #00FF00';
    }
  }

  this.ping = function() {
    rpcCall('Ping', {});
  }

  this.heartbeat = function() {
    rpcCall('JavaScriptIsAlive', {});
  }

  this.client_error = function(message) {
    this.num_errors += 1;
    this.visualError();
    var full_message = '\n[CLIENT_ERROR] ' + exceptionToLogText(message)
    // The client error could have been generated by logging - be careful.
    try {
      this._log(full_message, 'red');
    } catch (err) {
      // There's not much that can be done, at this point.
    }
  }

  this.begin = function(test_name) {
    var full_message = '[' + test_name + ' BEGIN]'
    this._log(full_message, 'blue');
  }

  this._log = function(message, color, from_completed_test) {
    if (typeof(message) != 'string') {
      message = toString(message);
    }

    // For event-driven tests, output may come after the test has finished.
    // Display this in a special way to assist debugging.
    if (from_completed_test) {
      color = 'orange';
      message = 'completed test: ' + message;
    }

    this.logLocal(message, color);
    rpcCall('TestLog', {message: message});
  }

  this.log = function(test_name, message, from_completed_test) {
    if (message == undefined) {
      // This is a log message that is not assosiated with a test.
      // What we though was the test name is actually the message.
      this._log(test_name);
    } else {
      if (typeof(message) != 'string') {
        message = toString(message);
      }
      var full_message = '[' + test_name + ' LOG] ' + message;
      this._log(full_message, 'black', from_completed_test);
    }
  }

  this.fail = function(test_name, message, from_completed_test) {
    this.num_failed += 1;
    this.visualError();
    var full_message = '[' + test_name + ' FAIL] ' + message
    this._log(full_message, 'red', from_completed_test);
  }

  this.exception = function(test_name, err, from_completed_test) {
    this.num_errors += 1;
    this.visualError();
    var message = exceptionToLogText(err);
    var full_message = '[' + test_name + ' EXCEPTION] ' + message;
    this._log(full_message, 'purple', from_completed_test);
  }

  this.pass = function(test_name, from_completed_test) {
    this.num_passed += 1;
    var full_message = '[' + test_name + ' PASS]';
    this._log(full_message, 'green', from_completed_test);
  }

  this.blankLine = function() {
    this._log('');
  }

  // Allows users to log time data that will be parsed and re-logged
  // for chrome perf-bot graphs / performance regression testing.
  // See: native_client/tools/process_perf_output.py
  this.logTimeData = function(event, timeMS) {
    this.log('NaClPerf [' + event + '] ' + timeMS + ' millisecs');
  }

  this.visualError = function() {
    // Changing the color is defered until testing is done
    this.ever_failed = true;
  }

  this.logLineLocal = function(text, color) {
    text = text.replace(/\s+$/, '');
    if (text == '') {
      this.localOutput.appendChild(document.createElement('br'));
    } else {
      var mNode = document.createTextNode(text);
      var div = document.createElement('div');
      // Preserve whitespace formatting.
      div.style['white-space'] = 'pre';
      if (color != undefined) {
        div.style.color = color;
      }
      div.appendChild(mNode);
      this.localOutput.appendChild(div);
    }
  }

  this.logLocal = function(message, color) {
    var lines = message.split('\n');
    for (var i = 0; i < lines.length; i++) {
      this.logLineLocal(lines[i], color);
    }
  }

  // Create a place in the page to output test results
  this.localOutput = document.createElement('div');
  this.localOutput.id = 'testresults';
  this.localOutput.style.border = '2px solid #0000FF';
  this.localOutput.style.padding = '10px';
  document.body.appendChild(this.localOutput);
}

//
// BEGIN functions for testing
//

function fail(message, info, test_status) {
  var parts = [];
  if (message != undefined) {
    parts.push(message);
  }
  if (info != undefined) {
    parts.push('(' + info + ')');
  }
  var full_message = parts.join(' ');

  if (test_status !== undefined) {
    // New-style test
    test_status.fail(full_message);
  } else {
    // Old-style test
    throw {type: 'test_fail', message: full_message};
  }
}

function assert(condition, message, test_status) {
  if (!condition) {
    fail(message, toString(condition), test_status);
  }
}

// This is accepted best practice for checking if an object is an array.
function isArray(obj) {
  return Object.prototype.toString.call(obj) === '[object Array]';
}

function toString(obj) {
  if (typeof(obj) == 'string') {
    return '\'' + obj + '\'';
  }
  try {
    return obj.toString();
  } catch (err) {
    try {
      // Arrays should do this automatically, but there is a known bug where
      // NaCl gets array types wrong.  .toString will fail on these objects.
      return obj.join(',');
    } catch (err) {
      if (obj == undefined) {
        return 'undefined';
      } else {
        // There is no way to create a textual representation of this object.
        return '[UNPRINTABLE]';
      }
    }
  }
}

// Old-style, but new-style tests use it indirectly.
// (The use of the "test" parameter indicates a new-style test.  This is a
// temporary hack to avoid code duplication.)
function assertEqual(a, b, message, test_status) {
  if (isArray(a) && isArray(b)) {
    assertArraysEqual(a, b, message, test_status);
  } else if (a !== b) {
    fail(message, toString(a) + ' != ' + toString(b), test_status);
  }
}

// Old-style, but new-style tests use it indirectly.
// (The use of the "test" parameter indicates a new-style test.  This is a
// temporary hack to avoid code duplication.)
function assertArraysEqual(a, b, message, test_status) {
  var dofail = function() {
    fail(message, toString(a) + ' != ' + toString(b), test_status);
  }
  if (a.length != b.length) {
    dofail();
  }
  for (var i = 0; i < a.length; i++) {
    if (a[i] !== b[i]) {
      dofail();
    }
  }
}

// Ideally there'd be some way to identify what exception was thrown, but JS
// exceptions are fairly ad-hoc.
// TODO(ncbray) allow manual validation of exception types?
function assertRaises(func, message, test_status) {
  try {
    func();
  } catch (err) {
    return;
  }
  fail(message, 'did not raise', test_status);
}

//
// END functions for testing
//

function haltAsyncTest() {
  throw {type: 'test_halt'};
}

function begins_with(s, prefix) {
  if (s.length >= prefix.length) {
    return s.substr(0, prefix.length) == prefix;
  } else {
    return false;
  }
}

function ends_with(s, suffix) {
  if (s.length >= suffix.length) {
    return s.substr(s.length - suffix.length, suffix.length) == suffix;
  } else {
    return false;
  }
}

function embed_name(embed) {
  if (embed.name != undefined) {
    if (embed.id != undefined) {
      return embed.name + ' / ' + embed.id;
    } else {
      return embed.name;
    }
  } else if (embed.id != undefined) {
    return embed.id;
  } else {
    return '[no name]';
  }
}

// Webkit Bug Workaround
// THIS SHOULD BE REMOVED WHEN Webkit IS FIXED
// http://code.google.com/p/nativeclient/issues/detail?id=2428
// http://code.google.com/p/chromium/issues/detail?id=103588

function ForcePluginLoadOnTimeout(elem, tester, timeout) {
  tester.log('Registering ForcePluginLoadOnTimeout ' +
             '(Bugs: NaCl 2428, Chrome 103588)');

  var started_loading = elem.readyState !== undefined;

  // Remember that the plugin started loading - it may be unloaded by the time
  // the callback fires.
  elem.addEventListener('load', function() {
    started_loading = true;
  }, true);

  // Check that the plugin has at least started to load after "timeout" seconds,
  // otherwise reload the page.
  setTimeout(function() {
    if (!started_loading) {
      ForceNaClPluginReload(elem, tester);
    }
  }, timeout);
}

function ForceNaClPluginReload(elem, tester) {
  if (elem.readyState === undefined) {
    tester.log('WARNING: WebKit plugin-not-loading error detected; reloading.');
    window.location.reload();
  }
}

function NaClWaiter(body_element) {
  // Work around how JS binds 'this'
  var this_ = this;
  var embedsToWaitFor = [];
  // embedsLoaded contains list of embeds that have dispatched the
  // 'loadend' progress event.
  this.embedsLoaded = [];

  this.is_loaded = function(embed) {
    for (var i = 0; i < this_.embedsLoaded.length; ++i) {
      if (this_.embedsLoaded[i] === embed) {
        return true;
      }
    }
    return (embed.readyState == 4) && !this_.has_errored(embed);
  }

  this.has_errored = function(embed) {
    var msg = embed.lastError;
    return embed.lastError != undefined && embed.lastError != '';
  }

  // If an argument was passed, it is the body element for registering
  // event listeners for the 'loadend' event type.
  if (body_element != undefined) {
    var eventListener = function(e) {
      if (e.type == 'loadend') {
        this_.embedsLoaded.push(e.target);
      }
    }

    body_element.addEventListener('loadend', eventListener, true);
  }

  // Takes an arbitrary number of arguments.
  this.waitFor = function() {
    for (var i = 0; i< arguments.length; i++) {
      embedsToWaitFor.push(arguments[i]);
    }
  }

  this.run = function(doneCallback, pingCallback) {
    this.doneCallback = doneCallback;
    this.pingCallback = pingCallback;

    // Wait for up to forty seconds for the nexes to load.
    // TODO(ncbray) use error handling mechanisms (when they are implemented)
    // rather than a timeout.
    this.totalWait = 0;
    this.maxTotalWait = 40000;
    this.retryWait = 10;
    this.waitForPlugins();
  }

  this.waitForPlugins = function() {
    var errored = [];
    var loaded = [];
    var waiting = [];

    for (var i = 0; i < embedsToWaitFor.length; i++) {
      try {
        var e = embedsToWaitFor[i];
        if (this.has_errored(e)) {
          errored.push(e);
        } else if (this.is_loaded(e)) {
          loaded.push(e);
        } else {
          waiting.push(e);
        }
      } catch(err) {
        // If the module is badly horked, touching lastError, etc, may except.
        errored.push(err);
      }
    }

    this.totalWait += this.retryWait;

    if (waiting.length == 0) {
      this.doneCallback(loaded, errored);
    } else if (this.totalWait >= this.maxTotalWait) {
      // Timeouts are considered errors.
      this.doneCallback(loaded, errored.concat(waiting));
    } else {
      setTimeout(function() { this_.waitForPlugins(); }, this.retryWait);
      // Capped exponential backoff
      this.retryWait += this.retryWait/2;
      // Paranoid: does setTimeout like floating point numbers?
      this.retryWait = Math.round(this.retryWait);
      if (this.retryWait > 100)
        this.retryWait = 100;
      // Prevent the server from thinking the test has died.
      if (this.pingCallback)
        this.pingCallback();
    }
  }
}

function logLoadStatus(rpc, load_errors_are_test_errors, loaded, waiting) {
  for (var i = 0; i < loaded.length; i++) {
    rpc.log(embed_name(loaded[i]) + ' loaded');
  }
  // Be careful when interacting with horked nexes.
  var getCarefully = function (callback) {
    try {
      return callback();
    } catch (err) {
      return '<exception>';
    }
  }

  var errored = false;
  for (var j = 0; j < waiting.length; j++) {
    // Workaround for WebKit layout bug that caused the NaCl plugin to not
    // load.  If we see that the plugin is not loaded after a timeout, we
    // forcibly reload the page, thereby triggering layout.  Re-running
    // layout should make WebKit instantiate the plugin.  NB: this could
    // make the JavaScript-based code go into an infinite loop if the
    // WebKit bug becomes deterministic or the NaCl plugin fails after
    // loading, but the browser_tester.py code will timeout the test.
    //
    // http://code.google.com/p/nativeclient/issues/detail?id=2428
    //
    if (waiting[j].readyState == undefined) {
      // alert('Woot');  // -- for manual debugging
      rpc.log('WARNING: WebKit plugin-not-loading error detected; reloading.');
      window.location.reload();
      throw "reload NOW";
    }
    var name = getCarefully(function(){
        return embed_name(waiting[j]);
      });
    var ready = getCarefully(function(){
        var readyStateString =
        ['UNSENT', 'OPENED', 'HEADERS_RECEIVED', 'LOADING', 'DONE'];
        // An undefined index value will return and undefined result.
        return readyStateString[waiting[j].readyState];
      });
    var last = getCarefully(function(){
        return toString(waiting[j].lastError);
      });
    var msg = (name + ' did not load. Status: ' + ready + ' / ' + last);
    if (load_errors_are_test_errors) {
      rpc.client_error(msg);
      errored = true;
    } else {
      rpc.log(msg);
    }
  }
  return errored;
}

// Contains the state for a single test.
function TestStatus(tester, name, async) {
  // Work around how JS binds 'this'
  var this_ = this;
  this.tester = tester;
  this.name = name;
  this.async = async;
  this.running = true;

  this.log = function(message) {
    this.tester.rpc.log(this.name, toString(message), !this.running);
  }

  this.pass = function() {
    // TODO raise if not running.
    this.tester.rpc.pass(this.name, !this.running);
    this._done();
    haltAsyncTest();
  }

  this.fail = function(message) {
    this.tester.rpc.fail(this.name, message, !this.running);
    this._done();
    haltAsyncTest();
  }

  this._done = function() {
    if (this.running) {
      this.running = false;
      this.tester.testDone(this);
    }
  }

  this.assert = function(condition, message) {
    assert(condition, message, this);
  }

  this.assertEqual = function(a, b, message) {
    assertEqual(a, b, message, this);
  }

  this.callbackWrapper = function(callback, args) {
    // A stale callback?
    if (!this.running)
      return;

    if (args === undefined)
      args = [];

    try {
      callback.apply(undefined, args);
    } catch (err) {
      if (typeof err == 'object' && 'type' in err) {
        if (err.type == 'test_halt') {
          // New-style test
          // If we get this exception, we can assume any callbacks or next
          // tests have already been scheduled.
          return;
        } else if (err.type == 'test_fail') {
          // Old-style test
          // A special exception that terminates the test with a failure
          this.tester.rpc.fail(this.name, err.message, !this.running);
          this._done();
          return;
        }
      }
      // This is not a special type of exception, it is an error.
      this.tester.rpc.exception(this.name, err, !this.running);
      this._done();
      return;
    }

    // A normal exit.  Should we move on to the next test?
    // Async tests do not move on without an explicit pass.
    if (!this.async) {
      this.tester.rpc.pass(this.name);
      this._done();
    }
  }

  // Async callbacks should be wrapped so the tester can catch unexpected
  // exceptions.
  this.wrap = function(callback) {
    return function() {
      this_.callbackWrapper(callback, arguments);
    };
  }

  this.setTimeout = function(callback, time) {
    setTimeout(this.wrap(callback), time);
  }

  this.waitForCallback = function(callbackName, expectedCalls) {
    this.log('Waiting for ' + expectedCalls + ' invocations of callback: '
               + callbackName);
    var gotCallbacks = 0;

    // Deliberately global - this is what the nexe expects.
    // TODO(ncbray): consider returning this function, so the test has more
    // flexibility. For example, in the test one could count to N
    // using a different callback before calling _this_ callback, and
    // continuing the test. Also, consider calling user-supplied callback
    // when done waiting.
    window[callbackName] = this.wrap(function() {
      ++gotCallbacks;
      this_.log('Received callback ' + gotCallbacks);
      if (gotCallbacks == expectedCalls) {
        this_.log("Done waiting");
        this_.pass();
      } else {
        // HACK
        haltAsyncTest();
      }
    });

    // HACK if this function is used in a non-async test, make sure we don't
    // spuriously pass.  Throwing this exception forces us to behave like an
    // async test.
    haltAsyncTest();
  }

  // This function takes an array of messages and asserts that the nexe
  // calls PostMessage with each of these messages, in order.
  // Arguments:
  //   plugin - The DOM object for the NaCl plugin
  //   messages - An array of expected responses
  //   callback - An optional callback function that takes the current message
  //              string as an argument
  this.expectMessageSequence = function(plugin, messages, callback) {
    this.assert(messages.length > 0, 'Must provide at least one message');
    var local_messages = messages.slice();
    var listener = function(message) {
      if (message.data.indexOf('@:') == 0) {
        // skip debug messages
        this_.log('DEBUG: ' + message.data.substr(2));
      } else {
        this_.assertEqual(message.data, local_messages.shift());
        if (callback !== undefined) {
          callback(message.data);
        }
      }
      if (local_messages.length == 0) {
        this_.pass();
      } else {
        this_.expectEvent(plugin, 'message', listener);
      }
    }
    this.expectEvent(plugin, 'message', listener);
  }

  this.expectEvent = function(src, event_type, listener) {
    var wrapper = this.wrap(function(e) {
      src.removeEventListener(event_type, wrapper, false);
      listener(e);
    });
    src.addEventListener(event_type, wrapper, false);
  }
}

function Tester(body_element) {
  // Work around how JS binds 'this'
  var this_ = this;
  // The tests being run.
  var tests = [];
  this.rpc = new RPCWrapper();
  this.waiter = new NaClWaiter(body_element);

  var load_errors_are_test_errors = true;

  var parallel = false;

  //
  // BEGIN public interface
  //

  this.loadErrorsAreOK = function() {
    load_errors_are_test_errors = false;
  }

  this.log = function(message) {
    this.rpc.log(message);
  }

  // If this kind of test exits cleanly, it passes
  this.addTest = function(name, testFunction) {
    tests.push({name: name, callback: testFunction, async: false});
  }

  // This kind of test does not pass until "pass" is explicitly called.
  this.addAsyncTest = function(name, testFunction) {
    tests.push({name: name, callback: testFunction, async: true});
  }

  this.run = function() {
    this.rpc.startup();
    this.startHeartbeat();
    this.waiter.run(
      function(loaded, waiting) {
        var errored = logLoadStatus(this_.rpc, load_errors_are_test_errors,
                                    loaded, waiting);
        if (errored) {
          this_.rpc.blankLine();
          this_.rpc.log('A nexe load error occured, aborting testing.');
          this_._done();
        } else {
          this_.startTesting();
        }
      },
      function() {
        this_.rpc.ping();
      }
    );
  }

  this.runParallel = function() {
    parallel = true;
    this.run();
  }

  // Takes an arbitrary number of arguments.
  this.waitFor = function() {
    for (var i = 0; i< arguments.length; i++) {
      this.waiter.waitFor(arguments[i]);
    }
  }

  //
  // END public interface
  //

  this.startHeartbeat = function() {
    var rpc = this.rpc;
    var heartbeat = function() {
      rpc.heartbeat();
      setTimeout(heartbeat, 500);
    }
    heartbeat();
  }

  this.launchTest = function(testIndex) {
    var testDecl = tests[testIndex];
    var currentTest = new TestStatus(this, testDecl.name, testDecl.async);
    setTimeout(currentTest.wrap(function() {
      this_.rpc.blankLine();
      this_.rpc.begin(currentTest.name);
      testDecl.callback(currentTest);
    }), 0);
  }

  this._done = function() {
    this.rpc.blankLine();
    this.rpc.shutdown();
  }

  this.startTesting = function() {
    if (tests.length == 0) {
      // No tests specified.
      this._done();
      return;
    }

    this.testCount = 0;
    if (parallel) {
      // Launch all tests.
      for (var i = 0; i < tests.length; i++) {
        this.launchTest(i);
      }
    } else {
      // Launch the first test.
      this.launchTest(0);
    }
  }

  this.testDone = function(test) {
    this.testCount += 1;
    if (this.testCount < tests.length) {
      if (!parallel) {
        // Move on to the next test if they're being run one at a time.
        this.launchTest(this.testCount);
      }
    } else {
      this._done();
    }
  }
}


text:
Internal Module Reference
=========================

:Release: |version|
:Date: |today|

.. toctree::
 :maxdepth: 1

 django_teledex.choices
 django_teledex.fields
 django_teledex.models


text:
package java.lang.invoke;
import java.lang.invoke.MethodHandleNatives.Constants;

//Not yet public: public
class MethodHandleInfo {
   public static final int
       REF_NONE                    = Constants.REF_NONE,
       REF_getField                = Constants.REF_getField,
       REF_getStatic               = Constants.REF_getStatic,
       REF_putField                = Constants.REF_putField,
       REF_putStatic               = Constants.REF_putStatic,
       REF_invokeVirtual           = Constants.REF_invokeVirtual,
       REF_invokeStatic            = Constants.REF_invokeStatic,
       REF_invokeSpecial           = Constants.REF_invokeSpecial,
       REF_newInvokeSpecial        = Constants.REF_newInvokeSpecial,
       REF_invokeInterface         = Constants.REF_invokeInterface;

   private final Class<?> declaringClass;
   private final String name;
   private final MethodType methodType;
   private final int referenceKind;

   public MethodHandleInfo(MethodHandle mh) throws ReflectiveOperationException {
       MemberName mn = mh.internalMemberName();
       this.declaringClass = mn.getDeclaringClass();
       this.name = mn.getName();
       this.methodType = mn.getMethodType();
       this.referenceKind = mn.getReferenceKind();
   }

   public Class<?> getDeclaringClass() {
       return declaringClass;
   }

   public String getName() {
       return name;
   }

   public MethodType getMethodType() {
       return methodType;
   }

   public int getReferenceKind() {
       return referenceKind;
   }
}


text:
@class NSString;

@protocol PublicWifiPCLogicDelegate <NSObject>
- (void)didNetWorkError:(NSString *)arg1 errMsg:(NSString *)arg2;
- (void)didSetUserInfo;
- (void)didGetPcFrontPage:(NSString *)arg1 headimg:(NSString *)arg2;
@end


text:
//
//  YuCeDetailVC.h
//  DoubleColorBall
//
//  Created by huxingqin on 2016/12/30.
//  Copyright © 2016年 huxingqin. All rights reserved.
//

#import "BaseViewController.h"

@class PredictModel;
@interface YuCeDetailVC : BaseViewController

@property (strong, nonatomic) PredictModel *model;
/** 标题 */
@property (copy, nonatomic) NSString *mTitle;
@end


text:
<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <name>Maven Example Project</name>

  <groupId>com.example</groupId>
  <artifactId>maven-example</artifactId>
  <version>1.0.0-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

  <repositories>
    <repository>
      <id>BintrayJCenter</id>
      <name>BintrayJCenter</name>
      <url>http://jcenter.bintray.com/</url>
      <layout>default</layout>
    </repository>
    <repository>
      <id>central</id>
      <name>Maven Repository Switchboard</name>
      <layout>default</layout>
      <url>http://repo1.maven.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>BintrayJCenter</id>
      <name>BintrayJCenter</name>
      <url>http://jcenter.bintray.com/</url>
      <layout>default</layout>
    </pluginRepository>
    <pluginRepository>
      <id>central</id>
      <name>Maven Plugin Repository</name>
      <url>http://repo1.maven.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <directory>target</directory>
    <outputDirectory>target/classes</outputDirectory>
    <testOutputDirectory>target/test-classes</testOutputDirectory>
    <sourceDirectory>src/main/java</sourceDirectory>
    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
    <testSourceDirectory>src/test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
          <excludes>
            <!-- By default, maven exclude both Test*.java and *Test.java names-->
            <exclude>**/Test*.java</exclude>
          </excludes>
          <skipSurefireReport>false</skipSurefireReport>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
            <!-- Bugs MCOMPILER-209, MCOMPILER-205-->
            <useIncrementalCompilation>false</useIncrementalCompilation>
        </configuration>
    </plugin>
    </plugins>
  </build>

  <reporting>
    <outputDirectory>target/site</outputDirectory>
  </reporting>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
    </dependency>
  </dependencies>
</project>


text:
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Manatee.Trello
{
	/// <summary>
	/// Represents a user token.
	/// </summary>
	public interface IToken : ICacheable, IRefreshable
	{
		/// <summary>
		/// Gets the name of the application associated with the token.
		/// </summary>
		string AppName { get; }

		/// <summary>
		/// Gets the permissions on boards granted by the token.
		/// </summary>
		ITokenPermission BoardPermissions { get; }

		/// <summary>
		/// Gets the creation date of the token.
		/// </summary>
		DateTime CreationDate { get; }

		/// <summary>
		/// Gets the date and time the token was created.
		/// </summary>
		DateTime? DateCreated { get; }

		/// <summary>
		/// Gets the date and time the token expires, if any.
		/// </summary>
		DateTime? DateExpires { get; }

		/// <summary>
		/// Gets the member for which the token was issued.
		/// </summary>
		IMember Member { get; }

		/// <summary>
		/// Gets the permissions on members granted by the token.
		/// </summary>
		ITokenPermission MemberPermissions { get; }

		/// <summary>
		/// Gets the permissions on organizations granted by the token.
		/// </summary>
		ITokenPermission OrganizationPermissions { get; }

		/// <summary>
		/// Deletes the token.
		/// </summary>
		/// <param name="ct">(Optional) A cancellation token for async processing.</param>
		/// <remarks>
		/// This permanently deletes the token from Trello's server, however, this object will remain in memory and all properties will remain accessible.
		/// </remarks>
		Task Delete(CancellationToken ct = default);
	}
}


text:
namespace Microsoft.Azure.Management.Eventhub.Fluent
{
    using System.Threading;
    using System.Threading.Tasks;
    using Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Definition;
    using Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Update;

    internal partial class EventHubAuthorizationRuleImpl
    {
        /// <summary>
        /// Specifies that authorization rule needs to be created for the given event hub.
        /// </summary>
        /// <param name="eventHubResourceId">The resource id of the event Hub.</param>
        /// <return>The next stage of the definition.</return>
        Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Definition.IWithAccessPolicy EventHubAuthorizationRule.Definition.IWithEventHub.WithExistingEventHubId(string eventHubResourceId)
        {
            return this.WithExistingEventHubId(eventHubResourceId);
        }

        /// <summary>
        /// Specifies that authorization rule needs to be created for the given event hub.
        /// </summary>
        /// <param name="resourceGroupName">Event hub namespace resource group name.</param>
        /// <param name="namespaceName">Event hub parent namespace name.</param>
        /// <param name="eventHubName">Event hub name.</param>
        /// <return>The next stage of the definition.</return>
        Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Definition.IWithAccessPolicy EventHubAuthorizationRule.Definition.IWithEventHub.WithExistingEventHub(string resourceGroupName, string namespaceName, string eventHubName)
        {
            return this.WithExistingEventHub(resourceGroupName, namespaceName, eventHubName);
        }

        /// <summary>
        /// Specifies that authorization rule needs to be created for the given event hub.
        /// </summary>
        /// <param name="eventHub">The event hub.</param>
        /// <return>The next stage of the definition.</return>
        Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Definition.IWithAccessPolicy EventHubAuthorizationRule.Definition.IWithEventHub.WithExistingEventHub(IEventHub eventHub)
        {
            return this.WithExistingEventHub(eventHub);
        }

        Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Definition.IWithCreate Microsoft.Azure.Management.Eventhub.Fluent.AuthorizationRule.Definition.IWithListen<IWithCreate>.WithListenAccess()
        {
            return this.WithListeningEnabled();
        }

        Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Definition.IWithCreate Microsoft.Azure.Management.Eventhub.Fluent.AuthorizationRule.Definition.IWithSend<IWithCreate>.WithSendAccess()
        {
            return this.WithSendingEnabled();
        }

        Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Definition.IWithCreate Microsoft.Azure.Management.Eventhub.Fluent.AuthorizationRule.Definition.IWithManage<IWithCreate>.WithManageAccess()
        {
            return this.WithManagementEnabled();
        }

        Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Update.IUpdate Microsoft.Azure.Management.Eventhub.Fluent.AuthorizationRule.Update.IWithListen<IUpdate>.WithListenAccess()
        {
            return this.WithListeningEnabled();
        }

        Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Update.IUpdate Microsoft.Azure.Management.Eventhub.Fluent.AuthorizationRule.Update.IWithSend<IUpdate>.WithSendAccess()
        {
            return this.WithSendingEnabled();
        }

        Microsoft.Azure.Management.Eventhub.Fluent.EventHubAuthorizationRule.Update.IUpdate Microsoft.Azure.Management.Eventhub.Fluent.AuthorizationRule.Update.IWithManage<IUpdate>.WithManageAccess()
        {
            return this.WithManagementEnabled();
        }

        /// <summary>
        /// Gets the resource group of the namespace where parent event hub resides.
        /// </summary>
        string Microsoft.Azure.Management.Eventhub.Fluent.IEventHubAuthorizationRule.NamespaceResourceGroupName
        {
            get
            {
                return this.NamespaceResourceGroupName();
            }
        }

        /// <summary>
        /// Gets the namespace name of parent event hub.
        /// </summary>
        string Microsoft.Azure.Management.Eventhub.Fluent.IEventHubAuthorizationRule.NamespaceName
        {
            get
            {
                return this.NamespaceName();
            }
        }

        /// <summary>
        /// Gets the name of the parent event hub.
        /// </summary>
        string Microsoft.Azure.Management.Eventhub.Fluent.IEventHubAuthorizationRule.EventHubName
        {
            get
            {
                return this.EventHubName();
            }
        }
    }
}


text:
/* Retrieves the number of sub file entries
 * Returns 1 if successful or -1 on error
 */
int mount_file_entry_get_number_of_sub_file_entries(
     mount_file_entry_t *file_entry,
     int *number_of_sub_file_entries,
     libcerror_error_t **error )
{
	static char *function = "mount_file_entry_get_number_of_sub_file_entries";

	if( file_entry == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid file entry.",
		 function );

		return( -1 );
	}
	if( ${library_name}_${mount_tool_file_entry_type}_get_number_of_sub_${mount_tool_file_entry_type}s(
	     file_entry->${mount_tool_file_entry_type_name},
	     number_of_sub_file_entries,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
		 "%s: unable to retrieve number of sub ${mount_tool_file_entry_type_description}s.",
		 function );

		return( -1 );
	}
	return( 1 );
}

/* Retrieves the sub file entry for the specific index
 * Returns 1 if successful or -1 on error
 */
int mount_file_entry_get_sub_file_entry_by_index(
     mount_file_entry_t *file_entry,
     int sub_file_entry_index,
     mount_file_entry_t **sub_file_entry,
     libcerror_error_t **error )
{
	${library_name}_${mount_tool_file_entry_type}_t *sub_${mount_tool_file_entry_type_name} = NULL;
	system_character_t *filename                                                            = NULL;
	static char *function                                                                   = "mount_file_entry_get_sub_file_entry_by_index";
	size_t filename_size                                                                    = 0;

	if( file_entry == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid file entry.",
		 function );

		return( -1 );
	}
	if( sub_file_entry == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid sub file entry.",
		 function );

		return( -1 );
	}
	if( *sub_file_entry != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid sub file entry value already set.",
		 function );

		return( -1 );
	}
/* TODO refactor to ${library_name}_${mount_tool_file_entry_type}_get_sub_${mount_tool_file_entry_type}_by_index */
	if( ${library_name}_${mount_tool_file_entry_type}_get_sub_${mount_tool_file_entry_type}(
	     file_entry->${mount_tool_file_entry_type_name},
	     sub_file_entry_index,
	     &sub_${mount_tool_file_entry_type_name},
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
		 "%s: unable to retrieve sub ${mount_tool_file_entry_type_description}: %d.",
		 function,
		 sub_file_entry_index );

		goto on_error;
	}
	if( mount_file_system_get_filename_from_${mount_tool_file_entry_type}(
	     file_entry->file_system,
	     sub_${mount_tool_file_entry_type_name},
	     &filename,
	     &filename_size,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
		 "%s: unable to retrieve filename of sub file entry: %d.",
		 function,
		 sub_file_entry_index );

		goto on_error;
	}
	if( mount_file_entry_initialize(
	     sub_file_entry,
	     file_entry->file_system,
	     filename,
	     filename_size - 1,
	     sub_${mount_tool_file_entry_type_name},
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to initialize sub file entry: %d.",
		 function,
		 sub_file_entry_index );

		goto on_error;
	}
	if( filename != NULL )
	{
		memory_free(
		 filename );
	}
	return( 1 );

on_error:
	if( filename != NULL )
	{
		memory_free(
		 filename );
	}
	if( sub_${mount_tool_file_entry_type_name} != NULL )
	{
		${library_name}_${mount_tool_file_entry_type}_free(
		 &sub_${mount_tool_file_entry_type_name},
		 NULL );
	}
	return( -1 );
}


text:
package oauth2

import (
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/stretchr/testify/assert"
)

const (
	contentType     = "Content-Type"
	jsonContentType = "application/json"
)

// NewAccessTokenServer creates a new httptest.Server OAuth2 provider Access
// Token endpoint. Caller must close the server.
func NewAccessTokenServer(t *testing.T, json string) *httptest.Server {
	return NewTestServerFunc(func(w http.ResponseWriter, req *http.Request) {
		assert.Equal(t, "POST", req.Method)
		w.Header().Set(contentType, jsonContentType)
		w.Write([]byte(json))
	})
}

// NewTestServeFunc is an adapter to allow the use of ordinary functions as
// httptest.Server's for testing. Caller must close the server.
func NewTestServerFunc(handler func(w http.ResponseWriter, r *http.Request)) *httptest.Server {
	return httptest.NewServer(http.HandlerFunc(handler))
}


text:
<!doctype html>

    <title>Wes Chow - Profile - PyGotham 2015</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../../../static/css/app.css">

    <meta name="msapplication-TileColor" content="#182833">
    <meta name="msapplication-TileImage" content="../../../static/img/metro-icon.png">
    <link rel="apple-touch-icon-precomposed" href="../../../static/img/apple-touch-icon.png">
    <link rel="icon" href="../../../static/img/favicon.png">

PyGotham 2015

          Menu

              About

Code of Conduct

FAQ

Privacy Policy

Social Event

              Events

Talk List

Talk Schedule

              Registration

Information

              Speaking

Call For Proposals

              Sponsors

Sponsors

Sponsorship Prospectus

              Venue

Information

Wes Chow

Wes has a B.S. in Electrical Engineering & Computer Science from UC Berkeley. He spent eight years building technical infrastructure for high frequency trading shops, and co-founded Athena Capital Research. One day, he stared into his dark soul and realized he needed to move into the startup light. Thus S7 Labs sprang into being, and he led teams that built Storybox, a Seedcamp NY finalist, and Songza Radio. He's now at Chartbeat serving out his term as CTO.

Presentations

            Sharding Data for Fun & Profit

        PyGotham 2015 is a production of Big Apple Py.

        Design by Jessie Sima. Hosting provided by Rackspace.

        Questions? Comments? Please contact organizers@pygotham.org.


text:
"use strict";

/**
 * Created by chrisp on 14/12/2016.
 */

var superAgent = void 0,
    assert = void 0,
    server = void 0,
    app = void 0;

assert = require("assert");
superAgent = require("superagent");
app = require("./routes/api_");

//noinspection Eslint
describe("server", function () {

	//noinspection Eslint
	beforeEach(function () {
		server = app().listen(3000);
	});

	//noinspection Eslint
	afterEach(function () {
		server.close();
	});

	//noinspection Eslint
	it("Print out 'Hello, World!' when user goes to /", function (done) {
		superAgent.get("http://localhost:3000/", function (error, res) {
			assert.ifError(error);
			assert.equal(res.status, 200);
			assert.equal(res.text, "Hello, Worlds!");
			done();
		});
	});
});

//noinspection Eslint
describe("my feature", function () {
	//noinspection Eslint
	it("work ", function () {
		assert.equal("A", "A");
	});
	//noinspection Eslint
	it("fails gracefully", function () {
		assert.notEqual("A", 2);
	});

	//noinspection Eslint
	describe("my innner", function () {
		//noinspection Eslint
		it("inner work ", function () {
			assert.notEqual("XXXX", "YYYY");
		});
		//noinspection Eslint
		it("inner fails ", function () {
			assert.notEqual("A", 2);
		});
	});
});
//# sourceMappingURL=test.js.map


text:
layout: "docs_api"
version: "<$ version.current.name $>"
versionHref: "<$ version.current.href $>"
path: "<$ doc.path $>"


text:
"""Module for common base classes and helpers, such as options and counters"""
from __future__ import absolute_import

from collections import namedtuple
from functools import partial
from six import iteritems

class _Nameable(object):
    """Base class for attribute classes with automatically set `name` attribute"""
    def __init__(self, name):
        super(_Nameable, self).__init__()
        self.name = name

    def _getNameForIdentifier(self, name):
        return name

class _Bindable(object):
    """Helper class for allowing instance-unique class-declarative behavior."""
    def __init__(self, *args, **kwargs):
        self._bound = {}
        super(_Bindable, self).__init__(*args, **kwargs)

    def __get__(self, instance, owner):
        if owner is None:
            return self

        if owner not in self._bound:
            self._bound[owner] = self._bind(owner)

        return self._bound[owner]

    def _bind(self, obj):
        raise NotImplementedError()

class ProvidesCounters(object):
    def _genCounterCallbacks(self):
        """Yields this item's (names, value) counter tuple(s)."""
        raise NotImplementedError()

_AddArgArgs = namedtuple('_AddArgArgs', ['opts', 'kwargs'])

class option(_Nameable):
    def __init__(self, name=None, type=None, default=None, help=None,
                 action=None, metavar=None, required=False, choices=None,
                 nargs=None):
        super(option, self).__init__(name)

        # Set defaults for action=storeX to bool (otherwise, str)
        if type is None:
            if action in ['store_true', 'store_false']:
                type = bool
            else:
                type = str

        self.type = type
        self.default = default
        self.help = help
        self.action = action
        self.metavar = metavar
        self.required = required
        self.choices = choices
        self.nargs = nargs

    def __get__(self, obj, type=None):
        if obj is None:
            return self

        value = self._getter(obj)(self.name)

        # If the default is of a different type than the option requires,
        # we should return the default.  Unfortunately, the way this is
        # currently implemented, it's impossible to detect this case.  For now,
        # let's treat `None` like a special case and return it as-is.
        if value is None:
            return value

        if self.type is not None:
            value = self.type(value)
        return value

    def __set__(self, obj, value):
        if self.type is not None:
            value = self.type(value)
        self._setter(obj)(self.name, value)

    def _getter(self, obj):
        getter = getattr(obj, 'getTaskOption', None)
        if getter is None:
            getter = getattr(obj, 'getOption', None)
        assert getter is not None
        return getter

    def _setter(self, obj):
        setter = getattr(obj, 'setTaskOption', None)
        if setter is None:
            setter = getattr(obj, 'setOption', None)
        assert setter is not None
        return setter

    def _prepareForArgumentParser(self, task_cls):
        """Convert inst properties to *args, **kwargs for ap.add_argument().
        """
        name = task_cls._loptName(self.name)

        # This is kinda funky.  I want to support some form of shorthand
        # notation for overridable default values.  Doing it this way means we
        # can do option(..., default=lambda cls: cls.FOO, ...)
        default = self.default
        if callable(default):
            default = default(task_cls)

        kwargs = dict(default=default, help=self.help, action=self.action,
                      required=self.required)
        if self.action is None:
            kwargs['metavar'] = self.metavar
            kwargs['type'] = self.type
            kwargs['choices'] = self.choices
        if self.nargs is not None:
            kwargs['nargs'] = self.nargs
        return _AddArgArgs([name], kwargs)

    def _addToArgumentParser(self, optargs, ap):
        ap.add_argument(*optargs.opts, **optargs.kwargs)

    def _getNameForIdentifier(self, name):
        return name

class _NameHelper(type):
    def __new__(cls, name, bases, attrs):

        for k, v in iteritems(attrs):
            # Assign `name` for options
            if not isinstance(v, _Nameable):
                continue
            if v.name is not None:
                continue
            v.name = v._getNameForIdentifier(k)
        return super(_NameHelper, cls).__new__(cls, name, bases, attrs)

_SpartsObjectBase = _NameHelper('_SpartsObjectBase', (object, ), {})

class _SpartsObject(_SpartsObjectBase):
    def __new__(cls, *args, **kwargs):
        inst = super(_SpartsObject, cls).__new__(cls)
        inst.counters = {}
        #for k, v in iteritems(cls.__dict__):

        # Traverse all child objects and statically assign a callable
        # reference to all child counters to the instance's counters dictionary.
        #
        # This is sort of implicitly broken for Callback counters, which are
        # defined after __new__ is called (e.g., during Task initialization)
        # TODO: Implement this in a better way.
        for k in dir(cls):
            v = getattr(cls, k)
            if isinstance(v, ProvidesCounters):
                for cn, cv in v._genCounterCallbacks():
                    inst.counters[cn] = cv

        return inst

    @classmethod
    def _loptName(cls, name):
        raise NotImplementedError()

    def getCounters(self):
        result = {}
        for k in self.counters:
            result[k] = self.getCounter(k)

        for cn, c in iteritems(self.getChildren()):
            for k in c.counters:
                result[cn + '.' + k] = c.getCounter(k)

        return result

    def getCounter(self, name):
        # Hack to get counters from a child task, even if the callable
        # wasn't statically assigned to this instance's counters dictionary.
        # TODO: Figure out a better way to do this.
        if name not in self.counters and '.' in name:
            child, sep, name = name.partition('.')
            return self.getChild(child).getCounter(name)

        return self.counters.get(name, lambda: None)

    def getChild(self, name):
        return self.getChildren()[name]

    def getChildren(self):
        return {}

    @classmethod
    def _addArguments(cls, ap):
        options = get_options(cls)
        for opt in options:
            opt.regfunc(ap)

_OptRegFunc = namedtuple('_OptRegFunc', ['opt', 'regfunc'])

def get_options(cls):
    """Get argparse options for class, `cls`

    Look for class level attributes of type option and
    convert them into the arguments  necessary for calling
    parser.add_argument().

    Arguments:
        subclass of VTask or Vservice - `cls`

    Returns:
        list(namedtuple) -
            .opt - namedtuple
                   .args - list of argument string names
                          (e.g. ['--help', '-h'])
                   .kwargs - dict of kwargs for add_argument()
                          (e.g. default=False, action='store_true' etc)
            .regfunc - callable that takes the ArgumentParser as an argument
                       and adds the option to it.
                       (e.g. "foo.regfunc(ap)" registers the foo option on ap)
    """
    ret = []
    for k in dir(cls):
        v = getattr(cls, k)
        preparefunc = getattr(v, '_prepareForArgumentParser', None)
        if not preparefunc:
            continue
        opt = preparefunc(cls)
        regfunc = partial(getattr(v, '_addToArgumentParser'), opt)
        ret.append(_OptRegFunc(opt, regfunc))
    return ret


text:
My first github project
I've been wanting to work with git for a while and github is the perfect
way to do it, its free, awesome.