text:
<?php
//
// Copyright (c) 2008-2016 Decibel Technology Limited.
//
namespace app\decibel\debug;

/**
 * Denotes a class as having the ability to be debugged
 * by the {@link DErrorHandler}.
 *
 * @author        Timothy de Paris
 */
interface DDebuggable
{
    /**
     * Provides debugging output for this object.
     *
     * This function must return a multi-dimensional array containing
     * key/value pairs of object properties to be debugged.
     *
     * @return    array
     */
    public function generateDebug();
}


text:
/**
 * @file
 */

#ifndef ORG_OPENSPLICE_CORE_OBJECT_DELEGATE_HPP_
#define ORG_OPENSPLICE_CORE_OBJECT_DELEGATE_HPP_

#include "dds/core/macros.hpp"
#include "dds/core/refmacros.hpp"
#include "org/opensplice/core/Mutex.hpp"

#include "vortex_os.h"
#include "u_types.h"

namespace org
{
namespace opensplice
{
namespace core
{

class OMG_DDS_API ObjectDelegate
{
public:
    typedef ::dds::core::smart_ptr_traits< ObjectDelegate >::ref_type ref_type;
    typedef ::dds::core::smart_ptr_traits< ObjectDelegate >::weak_ref_type weak_ref_type;

    ObjectDelegate();
    virtual ~ObjectDelegate();

    virtual void close();

    virtual void init(ObjectDelegate::weak_ref_type weak_ref) = 0;

    ObjectDelegate::weak_ref_type get_weak_ref() const;
    ObjectDelegate::ref_type get_strong_ref() const;

    int32_t get_domain_id() const {
        return domainId;
    }

protected:
    Mutex mutex;
    bool closed;
    int32_t domainId;

    void check() const;
    void set_weak_ref(ObjectDelegate::weak_ref_type weak_ref);

    ObjectDelegate::weak_ref_type myself;

    void set_domain_id(int32_t id) {
         domainId = id;
    }

public:
    void lock() const;
    void unlock() const;
};

}
}
}

#endif /* ORG_OPENSPLICE_CORE_OBJECT_DELEGATE_HPP_ */

redpajama_set_name: RedPajamaGithub


text:
package gov.nih.nci.cabig.caaers.web;

import gov.nih.nci.cabig.caaers.domain.Agent;
import gov.nih.nci.cabig.caaers.domain.repository.AgentRepository;
import gov.nih.nci.cabig.caaers.web.search.SearchStudyAjaxFacade;

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

import org.easymock.classextension.EasyMock;
import org.springframework.mock.web.MockHttpServletRequest;

public class SearchStudyAjaxFacadeTest extends DwrFacadeTestCase {

	private SearchStudyAjaxFacade searchStudyAjaxFacade;
	private AgentRepository agentRepository;
	private List<Agent> agents;
	private MockHttpServletRequest request;

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		searchStudyAjaxFacade = new SearchStudyAjaxFacade();
		agentRepository = registerMockFor(AgentRepository.class);
		searchStudyAjaxFacade.setAgentRepository(agentRepository);
		agents = new ArrayList<Agent>();
		Agent agent = new Agent();
		agent.setId(1);
		agent.setName("name1");
		agent.setNscNumber("nsc1");
		agent.setRetiredIndicator(true);
		agent.setDescription("desc1");
		agents.add(agent);
		agent = new Agent();
		agent.setId(2);
		agent.setName("name2");
		agent.setNscNumber("nsc2");
		agent.setRetiredIndicator(true);
		agent.setDescription("desc2");
		agents.add(agent);
		request = new MockHttpServletRequest();
	}

	public void testGetAgentsTable(){
		EasyMock.expect(agentRepository.getAgentsByNameAndNsc("text", "nsc", false)).andReturn(agents);
		replayMocks();
		List<Agent> returnedAgents = searchStudyAjaxFacade.getAgentsTable(new HashMap(), "text", "nsc", request);
		assertEquals(2, returnedAgents.size());
		assertNull(returnedAgents.get(0).getDescription());
		assertNull(returnedAgents.get(1).getDescription());
		verifyMocks();
	}

}


text:
.. _ML_Expectation Maximization:

Expectation Maximization
========================

.. highlight:: cpp

The Expectation Maximization(EM) algorithm estimates the parameters of the multivariate probability density function in the form of a Gaussian mixture distribution with a specified number of mixtures.

Consider the set of the N feature vectors
{ :math:`x_1, x_2,...,x_{N}` } from a d-dimensional Euclidean space drawn from a Gaussian mixture:

.. math::

    p(x;a_k,S_k, \pi _k) =  \sum _{k=1}^{m} \pi _kp_k(x),  \quad \pi _k  \geq 0,  \quad \sum _{k=1}^{m} \pi _k=1,

.. math::

    p_k(x)= \varphi (x;a_k,S_k)= \frac{1}{(2\pi)^{d/2}\mid{S_k}\mid^{1/2}} exp \left \{ - \frac{1}{2} (x-a_k)^TS_k^{-1}(x-a_k) \right \} ,

where
:math:`m` is the number of mixtures,
:math:`p_k` is the normal distribution
density with the mean
:math:`a_k` and covariance matrix
:math:`S_k`,
:math:`\pi_k` is the weight of the k-th mixture. Given the number of mixtures
:math:`M` and the samples
:math:`x_i`,
:math:`i=1..N` the algorithm finds the
maximum-likelihood estimates (MLE) of all the mixture parameters,
that is,
:math:`a_k`,
:math:`S_k` and
:math:`\pi_k` :

.. math::

    L(x, \theta )=logp(x, \theta )= \sum _{i=1}^{N}log \left ( \sum _{k=1}^{m} \pi _kp_k(x) \right ) \to \max _{ \theta \in \Theta },

.. math::

    \Theta = \left \{ (a_k,S_k, \pi _k): a_k  \in \mathbbm{R} ^d,S_k=S_k^T>0,S_k  \in \mathbbm{R} ^{d  \times d}, \pi _k \geq 0, \sum _{k=1}^{m} \pi _k=1 \right \} .

The EM algorithm is an iterative procedure. Each iteration includes
two steps. At the first step (Expectation step or E-step), you find a
probability
:math:`p_{i,k}` (denoted
:math:`\alpha_{i,k}` in the formula below) of
sample ``i`` to belong to mixture ``k`` using the currently
available mixture parameter estimates:

.. math::

    \alpha _{ki} =  \frac{\pi_k\varphi(x;a_k,S_k)}{\sum\limits_{j=1}^{m}\pi_j\varphi(x;a_j,S_j)} .

At the second step (Maximization step or M-step), the mixture parameter estimates are refined using the computed probabilities:

.. math::

    \pi _k= \frac{1}{N} \sum _{i=1}^{N} \alpha _{ki},  \quad a_k= \frac{\sum\limits_{i=1}^{N}\alpha_{ki}x_i}{\sum\limits_{i=1}^{N}\alpha_{ki}} ,  \quad S_k= \frac{\sum\limits_{i=1}^{N}\alpha_{ki}(x_i-a_k)(x_i-a_k)^T}{\sum\limits_{i=1}^{N}\alpha_{ki}}

Alternatively, the algorithm may start with the M-step when the initial values for
:math:`p_{i,k}` can be provided. Another alternative when
:math:`p_{i,k}` are unknown is to use a simpler clustering algorithm to pre-cluster the input samples and thus obtain initial
:math:`p_{i,k}` . Often (including machine learning) the
:ocv:func:`kmeans` algorithm is used for that purpose.

One of the main problems of the EM algorithm is a large number
of parameters to estimate. The majority of the parameters reside in
covariance matrices, which are
:math:`d \times d` elements each
where
:math:`d` is the feature space dimensionality. However, in
many practical problems, the covariance matrices are close to diagonal
or even to
:math:`\mu_k*I` , where
:math:`I` is an identity matrix and
:math:`\mu_k` is a mixture-dependent "scale" parameter. So, a robust computation
scheme could start with harder constraints on the covariance
matrices and then use the estimated parameters as an input for a less
constrained optimization problem (often a diagonal covariance matrix is
already a good enough approximation).

**References:**

*
    Bilmes98 J. A. Bilmes. *A Gentle Tutorial of the EM Algorithm and its Application to Parameter Estimation for Gaussian Mixture and Hidden Markov Models*. Technical Report TR-97-021, International Computer Science Institute and Computer Science Division, University of California at Berkeley, April 1998.

EM
--
.. ocv:class:: EM : public Algorithm

The class implements the EM algorithm as described in the beginning of this section. It is inherited from :ocv:class:`Algorithm`.

EM::EM
------
The constructor of the class

.. ocv:function:: EM::EM(int nclusters=EM::DEFAULT_NCLUSTERS, int covMatType=EM::COV_MAT_DIAGONAL, const TermCriteria& termCrit=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, EM::DEFAULT_MAX_ITERS, FLT_EPSILON) )

.. ocv:pyfunction:: cv2.EM([nclusters[, covMatType[, termCrit]]]) -> <EM object>

    :param nclusters: The number of mixture components in the Gaussian mixture model. Default value of the parameter is ``EM::DEFAULT_NCLUSTERS=5``. Some of EM implementation could determine the optimal number of mixtures within a specified value range, but that is not the case in ML yet.

    :param covMatType: Constraint on covariance matrices which defines type of matrices. Possible values are:

        * **EM::COV_MAT_SPHERICAL** A scaled identity matrix :math:`\mu_k * I`. There is the only parameter :math:`\mu_k` to be estimated for each matrix. The option may be used in special cases, when the constraint is relevant, or as a first step in the optimization (for example in case when the data is preprocessed with PCA). The results of such preliminary estimation may be passed again to the optimization procedure, this time with ``covMatType=EM::COV_MAT_DIAGONAL``.

        * **EM::COV_MAT_DIAGONAL** A diagonal matrix with positive diagonal elements. The number of free parameters is ``d`` for each matrix. This is most commonly used option yielding good estimation results.

        * **EM::COV_MAT_GENERIC** A symmetric positively defined matrix. The number of free parameters in each matrix is about :math:`d^2/2`. It is not recommended to use this option, unless there is pretty accurate initial estimation of the parameters and/or a huge number of training samples.

    :param termCrit: The termination criteria of the EM algorithm. The EM algorithm can be terminated by the number of iterations ``termCrit.maxCount`` (number of M-steps) or when relative change of likelihood logarithm is less than ``termCrit.epsilon``. Default maximum number of iterations is ``EM::DEFAULT_MAX_ITERS=100``.

EM::train
---------
Estimates the Gaussian mixture parameters from a samples set.

.. ocv:function:: bool EM::train(InputArray samples, OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray())

.. ocv:function:: bool EM::trainE(InputArray samples, InputArray means0, InputArray covs0=noArray(), InputArray weights0=noArray(), OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray())

.. ocv:function:: bool EM::trainM(InputArray samples, InputArray probs0, OutputArray logLikelihoods=noArray(), OutputArray labels=noArray(), OutputArray probs=noArray())

.. ocv:pyfunction:: cv2.EM.train(samples[, logLikelihoods[, labels[, probs]]]) -> retval, logLikelihoods, labels, probs

.. ocv:pyfunction:: cv2.EM.trainE(samples, means0[, covs0[, weights0[, logLikelihoods[, labels[, probs]]]]]) -> retval, logLikelihoods, labels, probs

.. ocv:pyfunction:: cv2.EM.trainM(samples, probs0[, logLikelihoods[, labels[, probs]]]) -> retval, logLikelihoods, labels, probs

    :param samples: Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have ``CV_64F`` type it will be converted to the inner matrix of such type for the further computing.

    :param means0: Initial means :math:`a_k` of mixture components. It is a one-channel matrix of :math:`nclusters \times dims` size. If the matrix does not have ``CV_64F`` type it will be converted to the inner matrix of such type for the further computing.

    :param covs0: The vector of initial covariance matrices :math:`S_k` of mixture components. Each of covariance matrices is a one-channel matrix of :math:`dims \times dims` size. If the matrices do not have ``CV_64F`` type they will be converted to the inner matrices of such type for the further computing.

    :param weights0: Initial weights :math:`\pi_k` of mixture components. It should be a one-channel floating-point matrix with :math:`1 \times nclusters` or :math:`nclusters \times 1` size.

    :param probs0: Initial probabilities :math:`p_{i,k}` of sample :math:`i` to belong to mixture component :math:`k`. It is a  one-channel floating-point matrix of :math:`nsamples \times nclusters` size.

    :param logLikelihoods: The optional output matrix that contains a likelihood logarithm value for each sample. It has :math:`nsamples \times 1` size and ``CV_64FC1`` type.

    :param labels: The optional output "class label" for each sample: :math:`\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N` (indices of the most probable mixture component for each sample). It has :math:`nsamples \times 1` size and ``CV_32SC1`` type.

    :param probs: The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has :math:`nsamples \times nclusters` size and ``CV_64FC1`` type.

Three versions of training method differ in the initialization of Gaussian mixture model parameters and start step:

* **train** - Starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm.

* **trainE** - Starts with Expectation step. You need to provide initial means :math:`a_k` of mixture components. Optionally you can pass initial weights :math:`\pi_k` and covariance matrices :math:`S_k` of mixture components.

* **trainM** - Starts with Maximization step. You need to provide initial probabilities :math:`p_{i,k}` to use this option.

The methods return ``true`` if the Gaussian mixture model was trained successfully, otherwise it returns ``false``.

Unlike many of the ML models, EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the
*Maximum Likelihood Estimate* of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure:
:math:`p_{i,k}` in ``probs``,
:math:`a_k` in ``means`` ,
:math:`S_k` in ``covs[k]``,
:math:`\pi_k` in ``weights`` , and optionally computes the output "class label" for each sample:
:math:`\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N` (indices of the most probable mixture component for each sample).

The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the
:ocv:class:`CvNormalBayesClassifier`.

EM::predict
-----------
Returns a likelihood logarithm value and an index of the most probable mixture component for the given sample.

.. ocv:function:: Vec2d EM::predict(InputArray sample, OutputArray probs=noArray()) const

.. ocv:pyfunction:: cv2.EM.predict(sample[, probs]) -> retval, probs

    :param sample: A sample for classification. It should be a one-channel matrix of :math:`1 \times dims` or :math:`dims \times 1` size.

    :param probs: Optional output matrix that contains posterior probabilities of each component given the sample. It has :math:`1 \times nclusters` size and ``CV_64FC1`` type.

The method returns a two-element ``double`` vector. Zero element is a likelihood logarithm value for the sample. First element is an index of the most probable mixture component for the given sample.

CvEM::isTrained
---------------
Returns ``true`` if the Gaussian mixture model was trained.

.. ocv:function:: bool EM::isTrained() const

.. ocv:pyfunction:: cv2.EM.isTrained() -> retval

EM::read, EM::write
-------------------
See :ocv:func:`Algorithm::read` and :ocv:func:`Algorithm::write`.

EM::get, EM::set
----------------
See :ocv:func:`Algorithm::get` and :ocv:func:`Algorithm::set`. The following parameters are available:

* ``"nclusters"``
* ``"covMatType"``
* ``"maxIters"``
* ``"epsilon"``
* ``"weights"`` *(read-only)*
* ``"means"`` *(read-only)*
* ``"covs"`` *(read-only)*

..


text:
import { assert } from '@firebase/util';
import { doubleToIEEE754String, sha1 } from '../util/util';
import { priorityHashText, validatePriorityNode } from './snap';
var __childrenNodeConstructor;
/**
 * LeafNode is a class for storing leaf nodes in a DataSnapshot.  It
 * implements Node and stores the value of the node (a string,
 * number, or boolean) accessible via getValue().
 */
var LeafNode = /** @class */ (function () {
    /**
     * @implements {Node}
     * @param {!(string|number|boolean|Object)} value_ The value to store in this leaf node.
     *                                         The object type is possible in the event of a deferred value
     * @param {!Node=} priorityNode_ The priority of this node.
     */
    function LeafNode(value_, priorityNode_) {
        if (priorityNode_ === void 0) { priorityNode_ = LeafNode.__childrenNodeConstructor.EMPTY_NODE; }
        this.value_ = value_;
        this.priorityNode_ = priorityNode_;
        this.lazyHash_ = null;
        assert(this.value_ !== undefined && this.value_ !== null, "LeafNode shouldn't be created with null/undefined value.");
        validatePriorityNode(this.priorityNode_);
    }
    Object.defineProperty(LeafNode, "__childrenNodeConstructor", {
        get: function () {
            return __childrenNodeConstructor;
        },
        set: function (val) {
            __childrenNodeConstructor = val;
        },
        enumerable: true,
        configurable: true
    });
    /** @inheritDoc */
    LeafNode.prototype.isLeafNode = function () {
        return true;
    };
    /** @inheritDoc */
    LeafNode.prototype.getPriority = function () {
        return this.priorityNode_;
    };
    /** @inheritDoc */
    LeafNode.prototype.updatePriority = function (newPriorityNode) {
        return new LeafNode(this.value_, newPriorityNode);
    };
    /** @inheritDoc */
    LeafNode.prototype.getImmediateChild = function (childName) {
        // Hack to treat priority as a regular child
        if (childName === '.priority') {
            return this.priorityNode_;
        }
        else {
            return LeafNode.__childrenNodeConstructor.EMPTY_NODE;
        }
    };
    /** @inheritDoc */
    LeafNode.prototype.getChild = function (path) {
        if (path.isEmpty()) {
            return this;
        }
        else if (path.getFront() === '.priority') {
            return this.priorityNode_;
        }
        else {
            return LeafNode.__childrenNodeConstructor.EMPTY_NODE;
        }
    };
    /**
     * @inheritDoc
     */
    LeafNode.prototype.hasChild = function () {
        return false;
    };
    /** @inheritDoc */
    LeafNode.prototype.getPredecessorChildName = function (childName, childNode) {
        return null;
    };
    /** @inheritDoc */
    LeafNode.prototype.updateImmediateChild = function (childName, newChildNode) {
        if (childName === '.priority') {
            return this.updatePriority(newChildNode);
        }
        else if (newChildNode.isEmpty() && childName !== '.priority') {
            return this;
        }
        else {
            return LeafNode.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(childName, newChildNode).updatePriority(this.priorityNode_);
        }
    };
    /** @inheritDoc */
    LeafNode.prototype.updateChild = function (path, newChildNode) {
        var front = path.getFront();
        if (front === null) {
            return newChildNode;
        }
        else if (newChildNode.isEmpty() && front !== '.priority') {
            return this;
        }
        else {
            assert(front !== '.priority' || path.getLength() === 1, '.priority must be the last token in a path');
            return this.updateImmediateChild(front, LeafNode.__childrenNodeConstructor.EMPTY_NODE.updateChild(path.popFront(), newChildNode));
        }
    };
    /** @inheritDoc */
    LeafNode.prototype.isEmpty = function () {
        return false;
    };
    /** @inheritDoc */
    LeafNode.prototype.numChildren = function () {
        return 0;
    };
    /** @inheritDoc */
    LeafNode.prototype.forEachChild = function (index, action) {
        return false;
    };
    /**
     * @inheritDoc
     */
    LeafNode.prototype.val = function (exportFormat) {
        if (exportFormat && !this.getPriority().isEmpty())
            return {
                '.value': this.getValue(),
                '.priority': this.getPriority().val()
            };
        else
            return this.getValue();
    };
    /** @inheritDoc */
    LeafNode.prototype.hash = function () {
        if (this.lazyHash_ === null) {
            var toHash = '';
            if (!this.priorityNode_.isEmpty())
                toHash +=
                    'priority:' +
                        priorityHashText(this.priorityNode_.val()) +
                        ':';
            var type = typeof this.value_;
            toHash += type + ':';
            if (type === 'number') {
                toHash += doubleToIEEE754String(this.value_);
            }
            else {
                toHash += this.value_;
            }
            this.lazyHash_ = sha1(toHash);
        }
        return this.lazyHash_;
    };
    /**
     * Returns the value of the leaf node.
     * @return {Object|string|number|boolean} The value of the node.
     */
    LeafNode.prototype.getValue = function () {
        return this.value_;
    };
    /**
     * @inheritDoc
     */
    LeafNode.prototype.compareTo = function (other) {
        if (other === LeafNode.__childrenNodeConstructor.EMPTY_NODE) {
            return 1;
        }
        else if (other instanceof LeafNode.__childrenNodeConstructor) {
            return -1;
        }
        else {
            assert(other.isLeafNode(), 'Unknown node type');
            return this.compareToLeafNode_(other);
        }
    };
    /**
     * Comparison specifically for two leaf nodes
     * @param {!LeafNode} otherLeaf
     * @return {!number}
     * @private
     */
    LeafNode.prototype.compareToLeafNode_ = function (otherLeaf) {
        var otherLeafType = typeof otherLeaf.value_;
        var thisLeafType = typeof this.value_;
        var otherIndex = LeafNode.VALUE_TYPE_ORDER.indexOf(otherLeafType);
        var thisIndex = LeafNode.VALUE_TYPE_ORDER.indexOf(thisLeafType);
        assert(otherIndex >= 0, 'Unknown leaf type: ' + otherLeafType);
        assert(thisIndex >= 0, 'Unknown leaf type: ' + thisLeafType);
        if (otherIndex === thisIndex) {
            // Same type, compare values
            if (thisLeafType === 'object') {
                // Deferred value nodes are all equal, but we should also never get to this point...
                return 0;
            }
            else {
                // Note that this works because true > false, all others are number or string comparisons
                if (this.value_ < otherLeaf.value_) {
                    return -1;
                }
                else if (this.value_ === otherLeaf.value_) {
                    return 0;
                }
                else {
                    return 1;
                }
            }
        }
        else {
            return thisIndex - otherIndex;
        }
    };
    /**
     * @inheritDoc
     */
    LeafNode.prototype.withIndex = function () {
        return this;
    };
    /**
     * @inheritDoc
     */
    LeafNode.prototype.isIndexed = function () {
        return true;
    };
    /**
     * @inheritDoc
     */
    LeafNode.prototype.equals = function (other) {
        /**
         * @inheritDoc
         */
        if (other === this) {
            return true;
        }
        else if (other.isLeafNode()) {
            var otherLeaf = other;
            return (this.value_ === otherLeaf.value_ &&
                this.priorityNode_.equals(otherLeaf.priorityNode_));
        }
        else {
            return false;
        }
    };
    /**
     * The sort order for comparing leaf nodes of different types. If two leaf nodes have
     * the same type, the comparison falls back to their value
     * @type {Array.<!string>}
     * @const
     */
    LeafNode.VALUE_TYPE_ORDER = ['object', 'boolean', 'number', 'string'];
    return LeafNode;
}());
export { LeafNode };

//# sourceMappingURL=LeafNode.js.map


text:
@interface FJSBrowserTranstionAnimation : NSObject<UIViewControllerAnimatedTransitioning>

@end


text:
package esform.control.request;

import esform.request.BaseRequest;

/**
 * Created by
 *
 * @name:孙证杰
 * @email:200765821@qq.com on 2017/10/20.
 */
public class QueryControlRequest extends BaseRequest {
    private String controlName;
    private String controlClass;

    public String getControlName() {
        return controlName;
    }

    public void setControlName(String controlName) {
        this.controlName = controlName;
    }

    public String getControlClass() {
        return controlClass;
    }

    public void setControlClass(String controlClass) {
        this.controlClass = controlClass;
    }
}


text:
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Example - example-error-$rootScope-inprog-jquery</title>

  <script src="../../components/jquery-2.1.1/jquery.js"></script>
  <script src="../../../angular.js"></script>
  <script src="app.js"></script>

</head>
<body ng-app="app">
  <button ng-click="focusInput = true">Focus</button>
<input ng-focus="count = count + 1" set-focus-if="focusInput" />
</body>
</html>


text:
using System;
using log4net;
using ILog = JudoPayDotNet.Logging.ILog;

namespace JudoPayDotNetDotNet.Logging
{
	/// <summary>
	/// Creates a log4net instance wrapper in the judopay sdk ILog logger interface.
	/// </summary>
    public static class DotNetLoggerFactory
    {
		/// <summary>
		/// Create an instance of ILog
		/// </summary>
		/// <param name="askingType">the type requesting the logger</param>
		/// <returns></returns>
        public static ILog Create(Type askingType)
        {
            return new Logger(LogManager.GetLogger(askingType));
        }
    }
}


text:
using System.Threading.Tasks;

using Pixiv.Enums;

using Xunit;

namespace Pixiv.Tests.Clients.V1
{
    public class UserClientTest : PixivTestAPiClient
    {
        public UserClientTest() : base("**REDACTED**") { }

        [Fact]
        public async Task Detail_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.DetailAsync(3623925));
        }

        [Fact]
        public void Detail_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.DetailAsync(3623925, null));
        }

        [Fact]
        public async Task Follower_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.FollowerAsync(3623925));
        }

        [Fact]
        public void Follower_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.FollowerAsync(3623925, null));
        }

        [Fact]
        public async Task Following_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.FollowingAsync(3623925, Restrict.Public));
        }

        [Fact]
        public void Following_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.FollowingAsync(3623925, Restrict.Public, null));
        }

        [Fact]
        public async Task Illusts_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.IllustsAsync(1023317, ContentType.Illust));
        }

        [Fact]
        public void Illusts_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.IllustsAsync(1023317, ContentType.Illust, null, null));
        }

        [Fact]
        public async Task IllustSeries_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.IllustSeriesAsync(14499092));
        }

        [Fact]
        public void IllustSeries_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.IllustSeriesAsync(14499092, null, null));
        }

        [Fact]
        public async Task Mypixiv_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.MypixivAsync(8986503));
        }

        [Fact]
        public void Mypixiv_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.MypixivAsync(8986503, null));
        }

        [Fact]
        public async Task Novel_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.NovelsAsync(8986503));
        }

        [Fact]
        public void Novel_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.NovelsAsync(8986503, null));
        }

        [Fact(Skip = "Unimplemented")]
        public async Task NovelDraftPreviews_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.NovelDraftPreviewsAsync());
        }

        [Fact(Skip = "Unimplemented")]
        public void NovelDraftPreviews_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.NovelDraftPreviewsAsync());
        }

        [Fact]
        public async Task Recommended_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.RecommendedAsync());
        }

        [Fact]
        public void Recommended_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.RecommendedAsync(null, null));
        }

        [Fact]
        public async Task Related_ShouldExtendsIsNullObject()
        {
            await ShouldExtendsIsNullObject(w => w.UserV1.RelatedAsync(11970396));
        }

        [Fact]
        public void Related_ShouldHaveAttributes()
        {
            ShouldHaveAttributes(w => w.UserV1.RelatedAsync(11970396, null));
        }
    }
}


text:
    <ht-sidebar when-done-animating="vm.sidebarReady()">

Menu

    </ht-sidebar>


text:
package version

import (
	"testing"
)

func TestFullVersion(t *testing.T) {
	version := FullVersion()

	expected := Version + Build + " (" + GitCommit + ")"

	if version != expected {
		t.Fatalf("invalid version returned: %s", version)
	}
}


text:
<?php

namespace Neutrino\Cli;

/**
 * Class Router
 *
 *  @package Neutrino\Cli
 */
class Router extends \Phalcon\Cli\Router
{
    /**
     * Adds a route to the router, with task as class.
     *
     * ex : $router->addTask('some', SomeTask::class);
     *
     * @param string      $command
     * @param string      $class
     * @param string|null $action
     * @param array       $params
     *
     * @return \Phalcon\Cli\Router\Route|\Phalcon\Cli\Router\RouteInterface
     */
    public function addTask($command, $class, $action = null, array $params = [])
    {
        $params['task'] = $class;

        $params['action'] = $action;

        preg_match_all('/\{([\w_]+)\}/', $command, $matches);

        foreach ($matches[0] as $k => $match) {
            $command = str_replace($match, '([[:word:]]+)', $command);

            $params[substr($match, 1, -1)] = $k + 1;
        }

        return $this->add($command, $params);
    }
}


text:
layout: post
title: Sublime Text的Package Control插件配置proxy
date: 2012-11-13 11:35
description: "Sublime Text中的default的**package control**中对proxy似乎并没有生效, 始终无法浏览插件列表, 查了不少资料, 应该是对https的代理设置上有点问题. 下面说一下解决方案."
tags: [sublime text, proxy, package control]
image:
  feature: abstract-6.jpg
  credit: dargadgetz
  creditlink: http://www.dargadgetz.com/ios-7-abstract-wallpaper-pack-for-iphone-5-and-ipod-touch-retina/
---

Sublime Text中的default的**package control**中对proxy似乎并没有生效, 始终无法浏览插件列表, 查了不少资料, 应该是对https的代理设置上有点问题. 下面说一下解决方案.

尝试修改package control中的`repository`从**https**改为**http**:

From:
{% highlight python %}
"repository_channels": [
"https://sublime.wbond.net/repositories.json"
]
{% endhighlight %}

To:
{% highlight python %}
"repository_channels": [
"http://sublime.wbond.net/repositories.json"
]
{% endhighlight %}

File: Package Control.py

From:
{% highlight python %}
url = download['url']
{% endhighlight %}

To:
{% highlight python %}
url = download['url'].replace('https','http')
{% endhighlight %}

最后, 在配置package control的`http_proxy`应该就没有问题了


text:
The folder contains the required files to create a [docset](https://kapeli.com/docsets) which can be used in
documentation browsers like [Dash](https://kapeli.com/dash), [Velocity](https://velocity.silverlakesoftware.com), or
[Zeal](https://zealdocs.org).

The docset can be created with

```sh
make nlohmann_json.docset
```

The generated folder `nlohmann_json.docset` can then be opened in the documentation browser.

A recent version is also part of the [Dash user contributions](https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/JSON_for_Modern_C%2B%2B).

## Licenses

The [JSON logo](https://commons.wikimedia.org/wiki/File:JSON_vector_logo.svg) is public domain.


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

        <title>
      The Brave New
      World of Design Requirements
    </title>

            The Brave New
      World of Design Requirements

      Authors

      Mathias Jarke, Pericles Loucopoulos, Kalle Lyytinen, John Mylopoulos,
      William Robinson

      Notes

       Their tripartite analysis of the requirements process is useful
      perhaps, to differentiate scope or stages in workshop processes.

      Their observation that RE researchers focus on the what rather than the
      how, may reveal one of the core issues here. Whilst specifying 'what' can
      appear to be a complete description, once you embark on the 'how' (having
      to implement the 'what'), other unspecified aspects emerge, which in
      practice project back onto the 'what' - e.g. interactions required in the
      device which are too complex to be feasible in the field, incorrect
      defaults which take no account of users' needs. This may link to the
      notion of 'non-functional' requirements (see wikipedia).

      Field of Study

      Concepts

      Quotations

      "design requirements rather than software requirements as an inclusive
      term better characterizes all requirements issues within these ecosystems
      that need to be addressed at the crossroads of business development,
      software engineering, and industrial design"

      "[Requirements Engineering] is replete with analytical frameworks,
      standards for requirements quality, elicitation protocols, and modeling
      methodologies"

      "we adopt a widely employed and straightforward categorization of the
      requirements processes into three facets: (1) discovery, (2)
      specification,

      and (3) validation and verification  During discovery, designers
      develop an understanding of the application domain and infer specific
      design needs through consultation with stakeholders and other sources
      [18]. Requirements specification is both a noun and a verb in RE
      parlance. As a noun, a specification is the document in which the
      requirements for a design effort are articulated thus representing an
      agreement between the stakeholders

      and the design team [16,24]. The verb suggests the process of developing
      and managing the specification document; it is the process by which the
      design team acquires, abstracts, and represents the requirements [17,22].
      Finally, during requirements validation and verification designers ensure
      that the requirements are (1) of high quality, (2) by addressing the
      users' needs, (3) and being appropriate for the design effort, and (4)
      having no

      inconsistencies or defects"

      "Requirements researchers have also stated that requirements are properly
      concerned with what is to be achieved by a design artifact,

      without regard to how it will be designed and implemented"

      References


text:
require "spec_helper"

describe OSMGeo::Node do

  	before :each do
      @aw = AnalysisWindow.new #()
    end

    it "Can get a bucket of nodes and treat them as rgeo points" do
    	@aw.nodes_x_all.first[:objects][0..100].each do |node|
    		puts node.point
    	end
    end

end


text:
<?php

namespace Zettacast\Injector;

use Zettacast\Collection\Collection;

/**
 * The binder class is responsible for linking abstractions to concrete
 * implementations.
 * @package Zettacast\Injector
 * @version 1.0
 */
class Binder implements BinderInterface
{
	/**
	 * Collection of abstraction bindings. Abstraction bindings allow the usage
	 * of contracts as the requested object, so the concrete object can be
	 * given by the injector.
	 * @var Collection Abstraction bindings collection.
	 */
	protected $bindings;

	/**
	 * Binder constructor.
	 * This constructor simply sets all its properties to empty collections.
	 */
	public function __construct()
	{
		$this->bindings = new Collection;
	}

	/**
	 * Resolves a binding, or alias to its concrete implementation.
	 * @param string $abstract Requested abstraction name.
	 * @return array Resolved abstraction or null if not found.
	 */
	public function resolve(string $abstract): ?array
	{
		while(is_scalar($abstract) && $this->knows($abstract)) {
			$result = $this->bindings->get($abstract);
			$abstract = $result['concrete'];
		}

		return $result ?? null;
	}

	/**
	 * Checks whether given abstract is bound to a concrete implementation.
	 * @param string $abstract Abstraction to check.
	 * @return bool Is abstraction known to binder?
	 */
	public function knows(string $abstract): bool
	{
		return $this->bindings->has($abstract);
	}

	/**
	 * Creates a new abstraction binding or aliasing, allowing them to have
	 * their names enshortened or be instantiated.
	 * @param string $abstract Abstraction to bind.
	 * @param string|\Closure $target Concrete object to abstraction.
	 * @param bool $share Should abstraction register as a singleton?
	 */
	public function bind(string $abstract, $target, bool $share = false): void
	{
		$this->bindings->set($abstract, [
			'concrete' => $target,
			'shared'   => $share,
		]);
	}

	/**
	 * Deletes an abstraction binding.
	 * @param string $abstract Abstraction to unbind.
	 */
	public function unbind(string $abstract): void
	{
		$this->bindings->del($abstract);
	}
}


text:
"""
http://scikit-learn.org/stable/auto_examples/plot_missing_values.html#sphx-glr-auto-examples-plot-missing-values-py
"""

import numpy as np
from sklearn.datasets import load_boston
from sklearn.ensemble import RandomForestRegressor
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.model_selection import cross_val_score

rng = np.random.RandomState(0)

dataset = load_boston()
X_full, y_full = dataset.data, dataset.target
n_samples = X_full.shape[0]
n_features = X_full.shape[1]

# Estimate the score on the entire dataset, with no missing values
estimator = RandomForestRegressor(random_state=0, n_estimators=100)
score = cross_val_score(estimator, X_full, y_full).mean()
print("Score with the entire dataset = %.2f" % score)

# Add missing values in 75% of the lines
missing_rate = 0.75
n_missing_samples = int(np.floor(n_samples * missing_rate))
missing_samples = np.hstack((np.zeros(n_samples - n_missing_samples,
                                      dtype=np.bool),
                             np.ones(n_missing_samples,
                                     dtype=np.bool)))
rng.shuffle(missing_samples)
missing_features = rng.randint(0, n_features, n_missing_samples)

# Estimate the score without the lines containing missing values
X_filtered = X_full[~missing_samples, :]
y_filtered = y_full[~missing_samples]
estimator = RandomForestRegressor(random_state=0, n_estimators=100)
score = cross_val_score(estimator, X_filtered, y_filtered).mean()
print("Score without the samples containing missing values = %.2f" % score)

# Estimate the score after imputation of the missing values
X_missing = X_full.copy()
X_missing[np.where(missing_samples)[0], missing_features] = 0
y_missing = y_full.copy()
estimator = Pipeline([("imputer", SimpleImputer(missing_values=0,
                                                strategy="mean",
                                                axis=0)),
                      ("forest", RandomForestRegressor(random_state=0,
                                                       n_estimators=100))])
score = cross_val_score(estimator, X_missing, y_missing).mean()
print("Score after imputation of the missing values = %.2f" % score)


text:
using System;
using System.Collections.Generic;

namespace Affecto.IdentityManagement.Querying.Data
{
    public class Role
    {
        public Guid Id { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public string ExternalGroupName { get; set; }
        public IReadOnlyCollection<Permission> Permissions { get; set; }
    }
}


text:
package org.apache.flink.test.util;

import java.io.IOException;

import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataOutputView;
import org.apache.flink.types.Value;

/**
 * Implements a feature vector as a multi-dimensional point. Coordinates of that point
 * (= the features) are stored as double values. The distance between two feature vectors is
 * the Euclidian distance between the points.
 */
public final class CoordVector implements Value, Comparable<CoordVector> {
	private static final long serialVersionUID = 1L;

	// coordinate array
	private double[] coordinates;

	/**
	 * Initializes a blank coordinate vector. Required for deserialization!
	 */
	public CoordVector() {
		coordinates = null;
	}

	/**
	 * Initializes a coordinate vector.
	 *
	 * @param coordinates The coordinate vector of a multi-dimensional point.
	 */
	public CoordVector(Double[] coordinates) {
		this.coordinates = new double[coordinates.length];
		for (int i = 0; i < coordinates.length; i++) {
			this.coordinates[i] = coordinates[i];
		}
	}

	/**
	 * Initializes a coordinate vector.
	 *
	 * @param coordinates The coordinate vector of a multi-dimensional point.
	 */
	public CoordVector(double[] coordinates) {
		this.coordinates = coordinates;
	}

	/**
	 * Returns the coordinate vector of a multi-dimensional point.
	 *
	 * @return The coordinate vector of a multi-dimensional point.
	 */
	public double[] getCoordinates() {
		return this.coordinates;
	}

	/**
	 * Sets the coordinate vector of a multi-dimensional point.
	 *
	 * @param coordinates The dimension values of the point.
	 */
	public void setCoordinates(double[] coordinates) {
		this.coordinates = coordinates;
	}

	/**
	 * Computes the Euclidian distance between this coordinate vector and a
	 * second coordinate vector.
	 *
	 * @param cv The coordinate vector to which the distance is computed.
	 * @return The Euclidian distance to coordinate vector cv. If cv has a
	 *         different length than this coordinate vector, -1 is returned.
	 */
	public double computeEuclidianDistance(CoordVector cv) {
		// check coordinate vector lengths
		if (cv.coordinates.length != this.coordinates.length) {
			return -1.0;
		}

		double quadSum = 0.0;
		for (int i = 0; i < this.coordinates.length; i++) {
			double diff = this.coordinates[i] - cv.coordinates[i];
			quadSum += diff*diff;
		}
		return Math.sqrt(quadSum);
	}

	@Override
	public void read(DataInputView in) throws IOException {
		int length = in.readInt();
		this.coordinates = new double[length];
		for (int i = 0; i < length; i++) {
			this.coordinates[i] = in.readDouble();
		}
	}

	@Override
	public void write(DataOutputView out) throws IOException {
		out.writeInt(this.coordinates.length);
		for (int i = 0; i < this.coordinates.length; i++) {
			out.writeDouble(this.coordinates[i]);
		}
	}

	/**
	 * Compares this coordinate vector to another key.
	 *
	 * @return -1 if the other key is not of type CoordVector. If the other
	 *         key is also a CoordVector but its length differs from this
	 *         coordinates vector, -1 is return if this coordinate vector is
	 *         smaller and 1 if it is larger. If both coordinate vectors
	 *         have the same length, the coordinates of both are compared.
	 *         If a coordinate of this coordinate vector is smaller than the
	 *         corresponding coordinate of the other vector -1 is returned
	 *         and 1 otherwise. If all coordinates are identical 0 is
	 *         returned.
	 */
	@Override
	public int compareTo(CoordVector o) {
		// check if both coordinate vectors have identical lengths
		if (o.coordinates.length > this.coordinates.length) {
			return -1;
		}
		else if (o.coordinates.length < this.coordinates.length) {
			return 1;
		}

		// compare all coordinates
		for (int i = 0; i < this.coordinates.length; i++) {
			if (o.coordinates[i] > this.coordinates[i]) {
				return -1;
			} else if (o.coordinates[i] < this.coordinates[i]) {
				return 1;
			}
		}
		return 0;
	}
}