text:
using System;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
using Xunit.Extensions;

namespace LibGit2Sharp.Tests
{
    public class TreeDefinitionFixture : BaseFixture
    {
        /*
         * $ git ls-tree -r HEAD
         * 100755 blob 45b983be36b73c0788dc9cbcb76cbb80fc7bb057    1/branch_file.txt
         * 100644 blob a8233120f6ad708f843d861ce2b7228ec4e3dec6    README
         * 100644 blob 45b983be36b73c0788dc9cbcb76cbb80fc7bb057    branch_file.txt
         * 100644 blob a71586c1dfe8a71c6cbf6c129f404c5642ff31bd    new.txt
         */

        [Fact]
        public void CanBuildATreeDefinitionFromATree()
        {
            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.NotNull(td);
            }
        }

        [Fact]
        public void BuildingATreeDefinitionWithBadParamsThrows()
        {
            Assert.Throws<ArgumentNullException>(() => TreeDefinition.From(default(Tree)));
        }

        [Fact]
        public void RequestingANonExistingEntryReturnsNull()
        {
            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);

                Assert.Null(td["nope"]);
                Assert.Null(td["not/here"]);
                Assert.Null(td["neither/in/here"]);
                Assert.Null(td["README/is/a-Blob/not-a-Tree"]);
            }
        }

        [Fact]
        public void RequestingAnEntryWithBadParamsThrows()
        {
            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);

                Assert.Throws<ArgumentNullException>(() => td[null]);
                Assert.Throws<ArgumentException>(() => td[string.Empty]);
                Assert.Throws<ArgumentException>(() => td["/"]);
                Assert.Throws<ArgumentException>(() => td["/a"]);
                Assert.Throws<ArgumentException>(() => td["1//branch_file.txt"]);
                Assert.Throws<ArgumentException>(() => td["README/"]);
                Assert.Throws<ArgumentException>(() => td["1/"]);
            }
        }

        [Theory]
        [InlineData("1/branch_file.txt", "100755", TreeEntryTargetType.Blob, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057")]
        [InlineData("README",            "100644", TreeEntryTargetType.Blob, "a8233120f6ad708f843d861ce2b7228ec4e3dec6")]
        [InlineData("branch_file.txt",   "100644", TreeEntryTargetType.Blob, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057")]
        [InlineData("new.txt",           "100644", TreeEntryTargetType.Blob, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd")]
        [InlineData("1",                 "040000", TreeEntryTargetType.Tree, "7f76480d939dc401415927ea7ef25c676b8ddb8f")]
        public void CanRetrieveEntries(string path, string expectedAttributes, TreeEntryTargetType expectedType, string expectedSha)
        {
            string repoPath = SandboxBareTestRepo();
            using (var repo = new Repository(repoPath))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);

                TreeEntryDefinition ted = td[path];

                Assert.Equal(ToMode(expectedAttributes), ted.Mode);
                Assert.Equal(expectedType, ted.TargetType);
                Assert.Equal(new ObjectId(expectedSha), ted.TargetId);
            }
        }

        //TODO: Convert Mode to a static class and add this helper method as 'FromString()'
        private static Mode ToMode(string expectedAttributes)
        {
            return (Mode)Convert.ToInt32(expectedAttributes, 8);
        }

        [Theory]
        [InlineData("README", "README_TOO")]
        [InlineData("README", "1/README")]
        [InlineData("README", "1/2/README")]
        [InlineData("1/branch_file.txt", "1/another_one.txt")]
        [InlineData("1/branch_file.txt", "another_one.txt")]
        [InlineData("1/branch_file.txt", "1/2/another_one.txt")]
        [InlineData("1/branch_file.txt", "1/2/3/another_one.txt")]
        [InlineData("1", "2")]
        [InlineData("1", "2/3")]
        public void CanAddAnExistingTreeEntryDefinition(string sourcePath, string targetPath)
        {
            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.Null(td[targetPath]);

                TreeEntryDefinition ted = td[sourcePath];
                td.Add(targetPath, ted);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(ted, fetched);
            }
        }

        [Fact]
        public void CanAddAnExistingGitLinkTreeEntryDefinition()
        {
            const string sourcePath = "sm_unchanged";
            const string targetPath = "sm_from_td";

            var path = SandboxSubmoduleTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.Null(td[targetPath]);

                TreeEntryDefinition ted = td[sourcePath];
                td.Add(targetPath, ted);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(ted, fetched);
            }
        }

        [Theory]
        [InlineData("README", "README_TOO")]
        [InlineData("README", "1/README")]
        [InlineData("README", "1/2/README")]
        [InlineData("1/branch_file.txt", "1/another_one.txt")]
        [InlineData("1/branch_file.txt", "another_one.txt")]
        [InlineData("1/branch_file.txt", "1/2/another_one.txt")]
        [InlineData("1/branch_file.txt", "1/2/3/another_one.txt")]
        [InlineData("1", "2")]
        [InlineData("1", "2/3")]
        public void CanAddAnExistingTreeEntry(string sourcePath, string targetPath)
        {
            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                var tree = repo.Head.Tip.Tree;
                var td = TreeDefinition.From(tree);
                Assert.Null(td[targetPath]);

                var te = tree[sourcePath];
                td.Add(targetPath, te);

                var fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(te.Target.Id, fetched.TargetId);
            }
        }

        [Theory]
        [InlineData("sm_from_td")]
        [InlineData("1/sm_from_td")]
        [InlineData("1/2/sm_from_td")]
        public void CanAddAnExistingGitLinkTreeEntry(string targetPath)
        {
            const string sourcePath = "sm_unchanged";

            var path = SandboxSubmoduleTestRepo();
            using (var repo = new Repository(path))
            {
                var tree = repo.Head.Tip.Tree;
                var td = TreeDefinition.From(tree);
                Assert.Null(td[targetPath]);

                var te = tree[sourcePath];
                td.Add(targetPath, te);

                var fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(te.Target.Id, fetched.TargetId);
            }
        }

        [Theory]
        [InlineData("a8233120f6ad708f843d861ce2b7228ec4e3dec6", "README_TOO")]
        [InlineData("a8233120f6ad708f843d861ce2b7228ec4e3dec6", "1/README")]
        [InlineData("45b983be36b73c0788dc9cbcb76cbb80fc7bb057", "1/another_one.txt")]
        [InlineData("45b983be36b73c0788dc9cbcb76cbb80fc7bb057", "another_one.txt")]
        public void CanAddAnExistingBlob(string blobSha, string targetPath)
        {
            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.Null(td[targetPath]);

                var objectId = new ObjectId(blobSha);
                var blob = repo.Lookup<Blob>(objectId);

                td.Add(targetPath, blob, Mode.NonExecutableFile);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(objectId, fetched.TargetId);
                Assert.Equal(Mode.NonExecutableFile, fetched.Mode);
            }
        }

        [Fact]
        public void CanAddAnExistingSubmodule()
        {
            const string submodulePath = "sm_unchanged";

            var path = SandboxSubmoduleTestRepo();
            using (var repo = new Repository(path))
            {
                var submodule = repo.Submodules[submodulePath];
                Assert.NotNull(submodule);

                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.NotNull(td[submodulePath]);

                td.Remove(submodulePath);
                Assert.Null(td[submodulePath]);

                td.Add(submodule);

                TreeEntryDefinition fetched = td[submodulePath];
                Assert.NotNull(fetched);

                Assert.Equal(submodule.HeadCommitId, fetched.TargetId);
                Assert.Equal(TreeEntryTargetType.GitLink, fetched.TargetType);
                Assert.Equal(Mode.GitLink, fetched.Mode);
            }
        }

        [Fact]
        public void CanAddAnExistingTree()
        {
            const string treeSha = "7f76480d939dc401415927ea7ef25c676b8ddb8f";
            const string targetPath = "1/2";

            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);

                var objectId = new ObjectId(treeSha);
                var tree = repo.Lookup<Tree>(objectId);

                td.Add(targetPath, tree);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(objectId, fetched.TargetId);
                Assert.Equal(Mode.Directory, fetched.Mode);

                Assert.NotNull(td["1/2/branch_file.txt"]);
            }
        }

        [Fact]
        public void CanReplaceAnExistingTreeWithABlob()
        {
            const string blobSha = "a8233120f6ad708f843d861ce2b7228ec4e3dec6";
            const string targetPath = "1";

            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.Equal(TreeEntryTargetType.Tree, td[targetPath].TargetType);

                var objectId = new ObjectId(blobSha);
                var blob = repo.Lookup<Blob>(objectId);

                Assert.NotNull(td["1/branch_file.txt"]);

                td.Add(targetPath, blob, Mode.NonExecutableFile);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(TreeEntryTargetType.Blob, td[targetPath].TargetType);
                Assert.Equal(objectId, fetched.TargetId);
                Assert.Equal(Mode.NonExecutableFile, fetched.Mode);

                Assert.Null(td["1/branch_file.txt"]);
            }
        }

        [Theory]
        [InlineData("README")]
        [InlineData("1/branch_file.txt")]
        public void CanReplaceAnExistingBlobWithATree(string targetPath)
        {
            const string treeSha = "7f76480d939dc401415927ea7ef25c676b8ddb8f";

            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.NotNull(td[targetPath]);
                Assert.Equal(TreeEntryTargetType.Blob, td[targetPath].TargetType);

                var objectId = new ObjectId(treeSha);
                var tree = repo.Lookup<Tree>(objectId);

                td.Add(targetPath, tree);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(TreeEntryTargetType.Tree, td[targetPath].TargetType);
                Assert.Equal(objectId, fetched.TargetId);
                Assert.Equal(Mode.Directory, fetched.Mode);
            }
        }

        [Fact]
        public void CanReplaceAnExistingTreeWithAGitLink()
        {
            var commitId = (ObjectId)"480095882d281ed676fe5b863569520e54a7d5c0";
            const string targetPath = "just_a_dir";

            var path = SandboxSubmoduleTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.Equal(TreeEntryTargetType.Tree, td[targetPath].TargetType);

                Assert.NotNull(td["just_a_dir/contents"]);

                td.AddGitLink(targetPath, commitId);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(commitId, fetched.TargetId);
                Assert.Equal(TreeEntryTargetType.GitLink, fetched.TargetType);
                Assert.Equal(Mode.GitLink, fetched.Mode);

                Assert.Null(td["just_a_dir/contents"]);
            }
        }

        [Fact]
        public void CanReplaceAnExistingGitLinkWithATree()
        {
            const string treeSha = "607d96653d4d0a4f733107f7890c2e67b55b620d";
            const string targetPath = "sm_unchanged";

            var path = SandboxSubmoduleTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.NotNull(td[targetPath]);
                Assert.Equal(TreeEntryTargetType.GitLink, td[targetPath].TargetType);
                Assert.Equal(Mode.GitLink, td[targetPath].Mode);

                var objectId = new ObjectId(treeSha);
                var tree = repo.Lookup<Tree>(objectId);

                td.Add(targetPath, tree);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(objectId, fetched.TargetId);
                Assert.Equal(TreeEntryTargetType.Tree, fetched.TargetType);
                Assert.Equal(Mode.Directory, fetched.Mode);
            }
        }

        [Fact]
        public void CanReplaceAnExistingBlobWithAGitLink()
        {
            var commitId = (ObjectId)"480095882d281ed676fe5b863569520e54a7d5c0";
            const string targetPath = "just_a_file";

            var path = SandboxSubmoduleTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.NotNull(td[targetPath]);
                Assert.Equal(TreeEntryTargetType.Blob, td[targetPath].TargetType);

                td.AddGitLink(targetPath, commitId);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(TreeEntryTargetType.GitLink, td[targetPath].TargetType);
                Assert.Equal(commitId, fetched.TargetId);
                Assert.Equal(Mode.GitLink, fetched.Mode);
            }
        }

        [Fact]
        public void CanReplaceAnExistingGitLinkWithABlob()
        {
            const string blobSha = "42cfb95cd01bf9225b659b5ee3edcc78e8eeb478";
            const string targetPath = "sm_unchanged";

            var path = SandboxSubmoduleTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.NotNull(td[targetPath]);
                Assert.Equal(TreeEntryTargetType.GitLink, td[targetPath].TargetType);
                Assert.Equal(Mode.GitLink, td[targetPath].Mode);

                var objectId = new ObjectId(blobSha);
                var blob = repo.Lookup<Blob>(objectId);

                td.Add(targetPath, blob, Mode.NonExecutableFile);

                TreeEntryDefinition fetched = td[targetPath];
                Assert.NotNull(fetched);

                Assert.Equal(objectId, fetched.TargetId);
                Assert.Equal(TreeEntryTargetType.Blob, fetched.TargetType);
                Assert.Equal(Mode.NonExecutableFile, fetched.Mode);
            }
        }

        [Fact]
        public void CanNotReplaceAnExistingTreeWithATreeBeingAssembled()
        {
            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                Assert.Equal(TreeEntryTargetType.Tree, td["1"].TargetType);

                td.Add("new/one", repo.Lookup<Blob>("a823312"), Mode.NonExecutableFile)
                    .Add("new/two", repo.Lookup<Blob>("a71586c"), Mode.NonExecutableFile)
                    .Add("new/tree", repo.Lookup<Tree>("7f76480"));

                Assert.Throws<InvalidOperationException>(() => td.Add("1", td["new"]));
            }
        }

        [Fact]
        public void ModifyingTheContentOfATreeSetsItsOidToNull()
        {
            const string blobSha = "a8233120f6ad708f843d861ce2b7228ec4e3dec6";
            const string targetPath = "1/another_branch_file.txt";

            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);

                var objectId = new ObjectId(blobSha);
                var blob = repo.Lookup<Blob>(objectId);

                Assert.NotEqual(ObjectId.Zero, td["1"].TargetId);

                td.Add(targetPath, blob, Mode.NonExecutableFile);

                Assert.Equal(ObjectId.Zero, td["1"].TargetId);
            }
        }

        [Fact]
        public void CanAddAnExistingBlobEntryWithAnExistingTree()
        {
            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
                TreeEntryDefinition original = td["README"];

                td.Add("1/2/README", original);

                TreeEntryDefinition fetched = td["1/2/README"];
                Assert.NotNull(fetched);

                Assert.Equal(original.TargetId, fetched.TargetId);
                Assert.Equal(original.Mode, fetched.Mode);

                Assert.NotNull(td["1/branch_file.txt"]);
            }
        }
    }
}


text:
title: Django
localeTitle: Django
---
## Visão geral:

O Django é um framework Web Python de alto nível que incentiva o rápido desenvolvimento e o design limpo e pragmático. Construído por desenvolvedores experientes, ele cuida de grande parte do incômodo do desenvolvimento da Web, para que você possa se concentrar em escrever seu aplicativo sem precisar reinventar a roda. É grátis e de código aberto.

Ridiculamente rápido. O Django foi projetado para ajudar os desenvolvedores a levar os aplicativos do conceito à conclusão o mais rápido possível.

Totalmente carregado. O Django inclui dezenas de extras que você pode usar para lidar com tarefas comuns de desenvolvimento da Web. O Django cuida da autenticação do usuário, administração de conteúdo, mapas do site, feeds RSS e muitas outras tarefas - diretamente da caixa.

Tranquilamente seguro. O Django leva a segurança a sério e ajuda os desenvolvedores a evitar muitos erros comuns de segurança, como injeção de SQL, script entre sites, falsificação de solicitações entre sites e clickjacking. Seu sistema de autenticação de usuários fornece uma maneira segura de gerenciar contas de usuários e senhas.

Extremamente escalável. Alguns dos locais mais movimentados do planeta usam a capacidade do Django de escalar de forma rápida e flexível para atender às maiores demandas de tráfego.

Incrivelmente versátil. Empresas, organizações e governos usaram o Django para construir todo tipo de coisas - de sistemas de gerenciamento de conteúdo a redes sociais e plataformas de computação científica.

### Fontes

https://www.djangoproject.com/

redpajama_set_name: RedPajamaGithub


text:
#ifndef VDescriptor_Interface
#define VDescriptor_Interface

/************************
 *****  Components  *****
 ************************/

#include "VTransient.h"

#include "m.h"
#include "vdsc.h"

#include "VFragmentation.h"

/**************************
 *****  Declarations  *****
 **************************/

#include "RTlink.h"
#include "RTrefuv.h"
#include "RTvector.h"

/*************************
 *****  Definitions  *****
 *************************/

class VDescriptor : public VTransient {
//  Aliases
public:
    typedef Vdd::Store Store;

//  Types & Enumerations...
public:
/*---------------------------------------------------------------------------*
 * Extended descriptors are a polymorphic generalization of descriptors as
 * defined in 'DSC'.  The following enumerated type defines the
 *
 * Virtual machine extended descriptors can have one of the following types:
 *
 *	Empty			- a descriptor referencing no objects.
 *	Standard		- a descriptor for a homomorphic collection of
 *				  objects in the form of a standard descriptor
 *				  (see "vdsc.h").
 *	Vector			- a descriptor for a polymorphic collection of
 *				  objects in the form of a vector.
 *	VectorC			- a descriptor for a polymorphic collection of
 *				  objects in the form of a vector contructor.
 *	Fragmentation		- a descriptor for a polymorphic collection of
 *				  of objects in the form of a fragmentation.
 *---------------------------------------------------------------------------*/
    enum Type {
	Type_Empty,
	Type_Std,
	Type_Vector,
	Type_VectorC,
	Type_Fragmentation
    };

//  Counters, Parameters, and Switches
public:
    static unsigned int HomogenizeVCCount;
    static unsigned int HomogenizeVectorCount;

    static bool DefragmentationAttemptEnabled;

//  Construction/Initialization
public:
    VDescriptor ();

protected:
    void construct () {
	m_xType = Type_Empty;
	m_pDistribution = NilOf (M_CPD*);
    }

private:
    VDescriptor& operator= (VDescriptor const& rSource) {
	m_xType		= rSource.m_xType;
	m_pDistribution	= rSource.m_pDistribution;
	m_uContent	= rSource.m_uContent;
	return *this;
    }

//  Destruction
public:
    ~VDescriptor ();

//  Query
public:
    bool isEmpty () const {
	return m_xType == Type_Empty;
    }
    bool isStandard () const {
	return m_xType == Type_Std;
    }
    bool isAVector () const {
	return m_xType == Type_Vector;
    }
    bool isAVectorC () const {
	return m_xType == Type_VectorC;
    }
    unsigned isAFragmentation () const {
	return m_xType == Type_Fragmentation;
    }

//  Access
public:
    void assignTo (DSC_Pointer &rSubscript, Vdd::Store *pTarget);
    void assignTo (DSC_Scalar &rSubscript, Vdd::Store *pTarget);
    void assignTo (rtLINK_CType *pSubscript, Vdd::Store *pTarget);

    M_CPD *distribution	() const { return m_pDistribution; }

    rtLINK_CType *subsetInStore (Store *pStore, VDescriptor *pValueReturn);
    rtLINK_CType *subsetInStore (Store *pStore) {
	return subsetInStore (pStore, 0);
    }
    rtLINK_CType *subsetOfType (
	M_ASD *pSubsetSpace, M_KOTM pKOTM, VDescriptor *pValueReturn
    );
    rtLINK_CType *subsetOfType (M_ASD *pSubsetSpace, M_KOTM pKOTM) {
	return subsetOfType (pSubsetSpace, pKOTM, 0);
    }

    Type type () const { return m_xType; }
    char const *typeName () const;

public: //protected:
    DSC_Descriptor const& contentAsMonotype () const {
	return m_uContent.asDescriptor;
    }
    VFragmentation const& contentAsFragmentation () const {
	return m_uContent.asFragmentation;
    }
    rtVECTOR_Handle *contentAsVector () const {
	return m_uContent.asVector;
    }
    rtVECTOR_CType *contentAsVectorC () const {
	return m_uContent.asVectorC;
    }

    DSC_Descriptor& contentAsMonotype () {
	return m_uContent.asDescriptor;
    }
    VFragmentation &contentAsFragmentation () {
	return m_uContent.asFragmentation;
    }
    rtVECTOR_Handle *&contentAsVector () {
	return m_uContent.asVector;
    }
    rtVECTOR_CType *&contentAsVectorC () {
	return m_uContent.asVectorC;
    }

//  Distribution
public:
    M_CPD *claimedDistribution () {
	M_CPD *pDistribution = m_pDistribution;
	m_pDistribution = NilOf (M_CPD*);
	return pDistribution;
    }

    void distribute (M_CPD *pDistribution) {
    /*****
     *	pDistribution		- a standard CPD for a reference u-vector
     *				  containing the distribution to apply to
     *				  this descriptor.  This method will duplicate
     *				  a pointer to this CPD if that will most
     *				  efficiently implement its algorithm.
     *****/
	if (IsntNil (m_pDistribution)) {
	    M_CPD *pNewDistribution = rtREFUV_UVExtract (
		pDistribution, m_pDistribution
	    );
	    m_pDistribution->release ();
	    m_pDistribution = pNewDistribution;
	}
	else {
	    checkDistribution (pDistribution);
	    pDistribution->retain ();
	    m_pDistribution = pDistribution;
	}
    }

    void reorder (M_CPD *pReordering) {
    /*****
     *	pReordering		- a standard CPD for a reference u-vector
     *				  containing the reordering to apply to
     *				  this descriptor.  This method will duplicate
     *				  a pointer to this CPD if that will most
     *				  efficiently implement its algorithm.
     *****/
	M_CPD *pDistribution = rtREFUV_Flip (pReordering);
	distribute (pDistribution);
	pDistribution->release ();
    }

    void normalize ();

//  Update
protected:
    void clearContent ();

public:
    void clear ();

    bool convertMonotypeToFragmentation (unsigned int fragmentSize);

    bool convertVectorsToMonotypeIfPossible ();

    VFragmentation &convertToFragmentation (bool fCoalescing = DefragmentationAttemptEnabled);

    rtVECTOR_Handle *convertToVector ();

    rtVECTOR_CType *convertToVectorC ();

protected:
    void setContentToMoved (DSC_Descriptor& rSource) {
	clearContent ();
	contentAsMonotype () = rSource;
	rSource.construct ();
	m_xType = Type_Std;
    }
    void setContentToVector (rtVECTOR_Handle *pSource) {
	pSource->retain ();
	clearContent ();
	contentAsVector () = pSource;
	m_xType = Type_Vector;
    }
    void setContentToVector (rtVECTOR_CType *pSource) {
	pSource->retain ();
	clearContent ();
	contentAsVectorC () = pSource;
	m_xType = Type_VectorC;
    }

public:
    void setToCopied (VDescriptor const& rSource);
    void setToCopied (DSC_Descriptor const& rSource) {
	clear ();
	contentAsMonotype ().construct (rSource);
	m_xType = Type_Std;
    }

    void setToMoved (VDescriptor& rSource) {
	clear ();
	*this = rSource;
	rSource.construct ();
    }
    void setToMoved (DSC_Descriptor& rSource) {
	clear ();
	contentAsMonotype () = rSource;
	rSource.construct ();
	m_xType = Type_Std;
    }

    void setToReorderedSubset (
	M_CPD *pReordering, rtLINK_CType *pSubset, VDescriptor& rSource
    );

    void setToSubset (rtLINK_CType *pSubset, VDescriptor& rSource);
    void setToSubset (DSC_Pointer & rSubset, VDescriptor& rSource);

    void setToSubset (rtLINK_CType *pSubset, DSC_Descriptor& rSource) {
	clear ();
	contentAsMonotype ().constructComposition (pSubset, rSource);
	m_xType = Type_Std;
    }
    void setToSubset (DSC_Pointer& rSubset, DSC_Descriptor& rSource) {
	clear ();
	contentAsMonotype ().constructComposition (rSubset, rSource);
	m_xType = Type_Std;
    }

    void setToCorrespondence (rtPTOKEN_Handle *pPPT, Store *pStore) {
	clear ();
	contentAsMonotype ().constructCorrespondence (pPPT, pStore);
	m_xType = Type_Std;
    }

    void setToIdentity (Store *pStore, rtPTOKEN_Handle *pPToken) {
	clear ();
	contentAsMonotype ().constructIdentity (pStore, pPToken);
	m_xType = Type_Std;
    }

    /************************
     *  setToNA/True/False  *
     ************************/

    void setToNA (rtPTOKEN_Handle *pPPT, M_KOT *pKOT) {
	clear ();
	contentAsMonotype ().constructNA (pPPT, pKOT);
	m_xType = Type_Std;
    }
    void setToNA (M_KOT *pKOT) {
	clear ();
	contentAsMonotype ().constructNA (pKOT);
	m_xType = Type_Std;
    }

    void setToTrue (rtPTOKEN_Handle *pPPT, M_KOT *pKOT) {
	clear ();
	contentAsMonotype ().constructTrue (pPPT, pKOT);
	m_xType = Type_Std;
    }

    void setToFalse (rtPTOKEN_Handle *pPPT, M_KOT *pKOT) {
	clear ();
	contentAsMonotype ().constructFalse (pPPT, pKOT);
	m_xType = Type_Std;
    }

    void setToBoolean (rtPTOKEN_Handle *pPPT, M_KOT *pKOT, bool iBoolean) {
	clear ();
	contentAsMonotype ().constructBoolean (pPPT, pKOT, iBoolean);
	m_xType = Type_Std;
    }

    /*******************
     *  setToConstant  *
     *******************/

    void setToConstant (rtPTOKEN_Handle *pPPT, Store *pStore, rtPTOKEN_Handle *pRPT) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, pStore, pRPT);
	m_xType = Type_Std;
    }
    void setToConstant (rtPTOKEN_Handle *pPPT, M_KOTE const &rKOTE) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, rKOTE);
	m_xType = Type_Std;
    }

    void setToConstant (rtPTOKEN_Handle *pPPT, Store *pStore, rtPTOKEN_Handle *pRPT, char value) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, pStore, pRPT, value);
	m_xType = Type_Std;
    }
    void setToConstant (rtPTOKEN_Handle *pPPT, M_KOTE const &rKOTE, char value) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, rKOTE, value);
	m_xType = Type_Std;
    }
    void setToConstant (rtPTOKEN_Handle *pPPT, M_KOT *pKOT, char value) {
	setToConstant (pPPT, pKOT->TheCharacterClass, value);
    }

    void setToConstant (rtPTOKEN_Handle *pPPT, Store *pStore, rtPTOKEN_Handle *pRPT, double value) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, pStore, pRPT, value);
	m_xType = Type_Std;
    }
    void setToConstant (rtPTOKEN_Handle *pPPT, M_KOTE const &rKOTE, double value) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, rKOTE, value);
	m_xType = Type_Std;
    }
    void setToConstant (rtPTOKEN_Handle *pPPT, M_KOT *pKOT, double value) {
	setToConstant (pPPT, pKOT->TheDoubleClass, value);
    }

    void setToConstant (rtPTOKEN_Handle *pPPT, Store *pStore, rtPTOKEN_Handle *pRPT, float value) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, pStore, pRPT, value);
	m_xType = Type_Std;
    }
    void setToConstant (rtPTOKEN_Handle *pPPT, M_KOTE const &rKOTE, float value) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, rKOTE, value);
	m_xType = Type_Std;
    }
    void setToConstant (rtPTOKEN_Handle *pPPT, M_KOT *pKOT, float value) {
	setToConstant (pPPT, pKOT->TheFloatClass, value);
    }

    void setToConstant (rtPTOKEN_Handle *pPPT, Store *pStore, rtPTOKEN_Handle *pRPT, int value) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, pStore, pRPT, value);
	m_xType = Type_Std;
    }
    void setToConstant (rtPTOKEN_Handle *pPPT, M_KOTE const &rKOTE, int value) {
	clear ();
	contentAsMonotype ().constructConstant (pPPT, rKOTE, value);
	m_xType = Type_Std;
    }
    void setToConstant (rtPTOKEN_Handle *pPPT, M_KOT *pKOT, int value) {
	setToConstant (pPPT, pKOT->TheIntegerClass, value);
    }

    void setToReferenceConstant (
	rtPTOKEN_Handle *pPPT, Store *pStore, rtPTOKEN_Handle *pRPT, unsigned int value
    ) {
	clear ();
	contentAsMonotype ().constructReferenceConstant (pPPT, pStore, pRPT, value);
	m_xType = Type_Std;
    }

    void setToMonotype (M_CPD *pMonotype) {
	clear ();
	contentAsMonotype ().constructMonotype (pMonotype);
	m_xType = Type_Std;
    }
    void setToMonotype (Store *pStore, M_CPD *pMonotype) {
	clear ();
	if (pStore)
	    contentAsMonotype ().constructMonotype (pStore, pMonotype);
	else
	    contentAsMonotype ().constructMonotype (pMonotype);
	m_xType = Type_Std;
    }

    void setToMonotype (Store *pStore, rtLINK_CType *pMonotype) {
	clear ();
	contentAsMonotype ().constructMonotype (pStore, pMonotype);
	m_xType = Type_Std;
    }

    void setToVector (rtVECTOR_Handle *pSource) {
	pSource->retain ();
	clear ();
	contentAsVector () = pSource;
	m_xType = Type_Vector;
    }
    void setToVector (rtVECTOR_CType *pSource) {
	pSource->retain ();
	clear ();
	contentAsVectorC () = pSource;
	m_xType = Type_VectorC;
    }

    VFragmentation &setToFragmentation (rtPTOKEN_Handle *ptoken) {
	clear ();
	contentAsFragmentation ().construct (ptoken);
	m_xType = Type_Fragmentation;

	return contentAsFragmentation ();
    }

//  Consistency Checking
protected:
    void checkDistribution (M_CPD *pDistribution) const;

//  Description
public:
    void describe (unsigned int xLevel);

//  Error Reporting
public:
    void raiseTypeException (char const* pWhere = 0) const;

protected:
    void raiseAssignmentTargetException (Vdd::Store *pStore) const;

//  State
/*---------------------------------------------------------------------------*
 *	m_xType			- the descriptor type.
 *	m_pDistribution		- an optional ('Nil' if absent) standard CPD
 *				  for a reference u-vector.  When present, this
 *				  u-vector specifies the positions to which the
 *				  values contained in the 'content' component
 *				  of this descriptor must be 'distributed' when
 *				  viewed as an ordered collection.
 *	m_uContent		- a union of representation formats for a
 *				  descriptor.  The following describes those
 *				  formats:
 *	.asDescriptor		... a standard descriptor.  Used to represent
 *				    'Descriptor' descriptors.  May have its
 *				    value store overriden by 'context' defined
 *				    below.
 *	.asVector		... a standard CPD for a vector.  Used to
 *				    represent 'Vector' descriptors.
 *	.asVectorC		... a vector constructor.  Used to represent
 *				    'VectorC' descriptors.
 *	.asFragmentation	... a 'Fragmentation'.  Used to represent
 *				    fragmentation descriptors.
 *---------------------------------------------------------------------------*/
protected:
    Type		m_xType;
    M_CPD*		m_pDistribution;
    union content_t {
	DSC_Descriptor	    asDescriptor;
	rtVECTOR_Handle*    asVector;
	rtVECTOR_CType*	    asVectorC;
	VFragmentation	    asFragmentation;
    }			m_uContent;
};

#endif


text:
This Nitrogen project is an umbrella project for a set of popular hardware device adapters.  See each subproject for more information about each.

## Nitrogen Project

The Nitrogen project is housed in a set of GitHub projects:

1. [service](https://github.com/nitrogenjs/service): Core platform responsible for managing principals, security, and messaging.
2. [client](https://github.com/nitrogenjs/client): JavaScript client library for building Nitrogen devices and applications.
3. [admin](https://github.com/nitrogenjs/admin): Web admin tool for working with the Nitrogen service.
4. [device](https://github.com/nitrogenjs/devices): Device principals for common pieces of hardware.
5. [commands](https://github.com/nitrogenjs/commands): CommandManagers and schemas for well known command types.
6. [cli](https://github.com/nitrogenjs/cli): Command line interface for working with the Nitrogen service.
7. [reactor](https://github.com/nitrogenjs/reactor): Always-on hosted application execution platform.
8. [apps](https://github.com/nitrogenjs/apps): Project maintained Nitrogen applications.


text:
Here are the front-end and back-end Seed Projects

seed project lists:
- vue@2.x seed
- react seed
- react dva seed
- react-antd-mob-craco seed
- koa@2.x seed
- weex@1.1.0-beta.4 demo
- react-native@0.49 demo

> carkings edit


text:
using System;

namespace NAudio.Wave.SampleProviders
{
    /// <summary>
    /// Signal Generator
    /// Sin, Square, Triangle, SawTooth, White Noise, Pink Noise, Sweep.
    /// </summary>
    /// <remarks>
    /// Posibility to change ISampleProvider
    /// Example :
    /// ---------
    /// WaveOut _waveOutGene = new WaveOut();
    /// WaveGenerator wg = new SignalGenerator();
    /// wg.Type = ...
    /// wg.Frequency = ...
    /// wg ...
    /// _waveOutGene.Init(wg);
    /// _waveOutGene.Play();
    /// </remarks>
    public class SignalGenerator : ISampleProvider
    {
        // Wave format
        private readonly WaveFormat waveFormat;

        // Random Number for the White Noise & Pink Noise Generator
        private readonly Random random = new Random();

        private readonly double[] pinkNoiseBuffer = new double[7];

        // Const Math
        private const double TwoPi = 2*Math.PI;

        // Generator variable
        private int nSample;

        // Sweep Generator variable
        private double phi;

        /// <summary>
        /// Initializes a new instance for the Generator (Default :: 44.1Khz, 2 channels, Sinus, Frequency = 440, Gain = 1)
        /// </summary>
        public SignalGenerator()
            : this(44100, 2)
        {

        }

        /// <summary>
        /// Initializes a new instance for the Generator (UserDef SampleRate & Channels)
        /// </summary>
        /// <param name="sampleRate">Desired sample rate</param>
        /// <param name="channel">Number of channels</param>
        public SignalGenerator(int sampleRate, int channel)
        {
            phi = 0;
            waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channel);

            // Default
            Type = SignalGeneratorType.Sin;
            Frequency = 440.0;
            Gain = 1;
            PhaseReverse = new bool[channel];
            SweepLengthSecs = 2;
        }

        /// <summary>
        /// The waveformat of this WaveProvider (same as the source)
        /// </summary>
        public WaveFormat WaveFormat => waveFormat;

        /// <summary>
        /// Frequency for the Generator. (20.0 - 20000.0 Hz)
        /// Sin, Square, Triangle, SawTooth, Sweep (Start Frequency).
        /// </summary>
        public double Frequency { get; set; }

        /// <summary>
        /// Return Log of Frequency Start (Read only)
        /// </summary>
        public double FrequencyLog => Math.Log(Frequency);

        /// <summary>
        /// End Frequency for the Sweep Generator. (Start Frequency in Frequency)
        /// </summary>
        public double FrequencyEnd { get; set; }

        /// <summary>
        /// Return Log of Frequency End (Read only)
        /// </summary>
        public double FrequencyEndLog => Math.Log(FrequencyEnd);

        /// <summary>
        /// Gain for the Generator. (0.0 to 1.0)
        /// </summary>
        public double Gain { get; set; }

        /// <summary>
        /// Channel PhaseReverse
        /// </summary>
        public bool[] PhaseReverse { get; }

        /// <summary>
        /// Type of Generator.
        /// </summary>
        public SignalGeneratorType Type { get; set; }

        /// <summary>
        /// Length Seconds for the Sweep Generator.
        /// </summary>
        public double SweepLengthSecs { get; set; }

        /// <summary>
        /// Reads from this provider.
        /// </summary>
        public int Read(float[] buffer, int offset, int count)
        {
            int outIndex = offset;

            // Generator current value
            double multiple;
            double sampleValue;
            double sampleSaw;

            // Complete Buffer
            for (int sampleCount = 0; sampleCount < count/waveFormat.Channels; sampleCount++)
            {
                switch (Type)
                {
                    case SignalGeneratorType.Sin:

                        // Sinus Generator

                        multiple = TwoPi*Frequency/waveFormat.SampleRate;
                        sampleValue = Gain*Math.Sin(nSample*multiple);

                        nSample++;

                        break;

                    case SignalGeneratorType.Square:

                        // Square Generator

                        multiple = 2*Frequency/waveFormat.SampleRate;
                        sampleSaw = ((nSample*multiple)%2) - 1;
                        sampleValue = sampleSaw > 0 ? Gain : -Gain;

                        nSample++;
                        break;

                    case SignalGeneratorType.Triangle:

                        // Triangle Generator

                        multiple = 2*Frequency/waveFormat.SampleRate;
                        sampleSaw = ((nSample*multiple)%2);
                        sampleValue = 2*sampleSaw;
                        if (sampleValue > 1)
                            sampleValue = 2 - sampleValue;
                        if (sampleValue < -1)
                            sampleValue = -2 - sampleValue;

                        sampleValue *= Gain;

                        nSample++;
                        break;

                    case SignalGeneratorType.SawTooth:

                        // SawTooth Generator

                        multiple = 2*Frequency/waveFormat.SampleRate;
                        sampleSaw = ((nSample*multiple)%2) - 1;
                        sampleValue = Gain*sampleSaw;

                        nSample++;
                        break;

                    case SignalGeneratorType.White:

                        // White Noise Generator
                        sampleValue = (Gain*NextRandomTwo());
                        break;

                    case SignalGeneratorType.Pink:

                        // Pink Noise Generator

                        double white = NextRandomTwo();
                        pinkNoiseBuffer[0] = 0.99886*pinkNoiseBuffer[0] + white*0.0555179;
                        pinkNoiseBuffer[1] = 0.99332*pinkNoiseBuffer[1] + white*0.0750759;
                        pinkNoiseBuffer[2] = 0.96900*pinkNoiseBuffer[2] + white*0.1538520;
                        pinkNoiseBuffer[3] = 0.86650*pinkNoiseBuffer[3] + white*0.3104856;
                        pinkNoiseBuffer[4] = 0.55000*pinkNoiseBuffer[4] + white*0.5329522;
                        pinkNoiseBuffer[5] = -0.7616*pinkNoiseBuffer[5] - white*0.0168980;
                        double pink = pinkNoiseBuffer[0] + pinkNoiseBuffer[1] + pinkNoiseBuffer[2] + pinkNoiseBuffer[3] + pinkNoiseBuffer[4] + pinkNoiseBuffer[5] + pinkNoiseBuffer[6] + white*0.5362;
                        pinkNoiseBuffer[6] = white*0.115926;
                        sampleValue = (Gain*(pink/5));
                        break;

                    case SignalGeneratorType.Sweep:

                        // Sweep Generator
                        double f = Math.Exp(FrequencyLog + (nSample*(FrequencyEndLog - FrequencyLog))/(SweepLengthSecs*waveFormat.SampleRate));

                        multiple = TwoPi*f/waveFormat.SampleRate;
                        phi += multiple;
                        sampleValue = Gain*(Math.Sin(phi));
                        nSample++;
                        if (nSample > SweepLengthSecs*waveFormat.SampleRate)
                        {
                            nSample = 0;
                            phi = 0;
                        }
                        break;

                    default:
                        sampleValue = 0.0;
                        break;
                }

                // Phase Reverse Per Channel
                for (int i = 0; i < waveFormat.Channels; i++)
                {
                    if (PhaseReverse[i])
                        buffer[outIndex++] = (float) -sampleValue;
                    else
                        buffer[outIndex++] = (float) sampleValue;
                }
            }
            return count;
        }

        /// <summary>
        /// Private :: Random for WhiteNoise & Pink Noise (Value form -1 to 1)
        /// </summary>
        /// <returns>Random value from -1 to +1</returns>
        private double NextRandomTwo()
        {
            return 2*random.NextDouble() - 1;
        }

    }

    /// <summary>
    /// Signal Generator type
    /// </summary>
    public enum SignalGeneratorType
    {
        /// <summary>
        /// Pink noise
        /// </summary>
        Pink,
        /// <summary>
        /// White noise
        /// </summary>
        White,
        /// <summary>
        /// Sweep
        /// </summary>
        Sweep,
        /// <summary>
        /// Sine wave
        /// </summary>
        Sin,
        /// <summary>
        /// Square wave
        /// </summary>
        Square,
        /// <summary>
        /// Triangle Wave
        /// </summary>
        Triangle,
        /// <summary>
        /// Sawtooth wave
        /// </summary>
        SawTooth,
    }

}


text:
A website where users can quickly upload videos for free.

Feel free to use any of the code.

Note: This website makes use of Bootstrap CSS, so make sure you link it.


text:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Input;
using TipsySheep.Logic.Core;
using static TipsySheep.Logic.Core.EFStatements.DbInfo;

namespace TipsySheep.UI.Interfaces
{
    public interface INewSheepViewModel
    {
        int Abgang { get; set; }
        int AbgangCheckState { get; set; }
        ICommand BackButtonCommand { get; }
        string Bemerkung { get; set; }
        int Bezug { get; set; }
        List<tbl_Abgang> DispatchList { get; set; }
        DateTime Erstelldatum { get; set; }
        DateTime Geburtsdatum { get; set; }
        List<tbl_Gender> GenderList { get; set; }
        int Geschlecht { get; set; }
        int Id { get; set; }
        int IsMotherCheckState { get; set; }
        bool KeepAlive { get; }
        string Kennnummer { get; set; }
        ICollection<LambCollection> Lambs { get; set; }
        string Name { get; set; }
        List<tbl_Bezug> PurchaseList { get; set; }
        List<tbl_Race> RaceList { get; set; }
        int Rasse { get; set; }
        ICommand SaveButtonCommand { get; }
        Task<bool> SaveNewAsync();
    }
}


text:
  'use strict';

  var pn_ul = document.getElementsByClassName('pnlist');
  var $input = document.getElementById('search-input');
  var ulLen = pn_ul.length;
  var app_index = lunr.Index.load(window.APP_SEARCH_INDEX);
  var script_index = lunr.Index.load(window.SCRIPT_SEARCH_INDEX);
  var lib_index = lunr.Index.load(window.LIB_SEARCH_INDEX);

  function pnAddClass(elem, className) {
    var classList = elem.classList;

    if (!classList.contains(className)) {
      classList.add(className);
    }
  }

  function pnRemoveClass(elem, className) {
    var classList = elem.classList;

    if (classList.contains(className)) {
      classList.remove(className);
    }
  }

  function pnnSearch(elements, value, index) {
    var result = index.search('*' + value + '*');
    var len = result.length;
    var selected = {};
    var elementLen = elements.length;
    var i = 0;

    for (i = 0; i < len; i++) {
      selected[result[i].ref] = true;
    }

    for (i = 0; i < elementLen; i++) {
      if (selected[i]) {
        pnAddClass(elements[i], 'on');
      } else {
        pnRemoveClass(elements[i], 'on');
      }
    }
  }

  function pnSearch(value) {
    var arr_index = [app_index, script_index, lib_index];
    for (var i = 0; i < ulLen; i++) {
      var elements = pn_ul[i].getElementsByTagName("li");
      var index = arr_index[i];
      pnnSearch(elements, value, index);
    }
  }

  function pnShuffle(array) {
    var arr = Array.from(array);
    var currentIndex = array.length, temporaryValue, randomIndex;

    // While there remain elements to shuffle...
    while (0 !== currentIndex) {

      // Pick a remaining element...
      randomIndex = Math.floor(Math.random() * currentIndex);
      currentIndex -= 1;

      // And swap it with the current element.
      temporaryValue = arr[currentIndex];
      arr[currentIndex] = arr[randomIndex];
      arr[randomIndex] = temporaryValue;
    }

    return arr;
  }

  function displayRandom() {
    for (var i = 0; i < ulLen; i++) {
      var elements = pnShuffle(pn_ul[i].getElementsByTagName("li"));
      var elementLen = elements.length;
      for (var j = 0; j < elementLen; j++) {
        pnRemoveClass(elements[j], 'on');
      }
      for (var j = 0; j < elementLen; j++) {
        pnAddClass(elements[j], 'on');
        if (j == 5) {break;}
      }
    }
  }

  $input.addEventListener('input', function() {
    var value = this.value;

    if (!value) return displayRandom();
    pnSearch(value);
  });

  if (window.addEventListener)
      window.addEventListener("load", displayRandom, false);
  else if (window.attachEvent)
      window.attachEvent("onload", displayRandom);
  else window.onload = displayRandom;


text:
#define ifDescr ifentry->descr
#define ifType ifentry->type
#define ifMtu ifentry->mtu
#define ifSpeed ifentry->speed
#define ifPhysAddress ifentry->paddr
#define ifPhysAddress_len ifentry->paddr_len    /* # of char elements, not bytes */
#define ifAdminStatus ifentry->admin_status
#define ifOperStatus ifentry->oper_status
#define ifLastChange ifentry->lastchange
#define ifInOctets ifentry->stats.ibytes.low
#define ifInUcastPkts ifentry->stats.iucast.low
#define ifInNUcastPkts ifentry->stats.inucast
#define ifInDiscards ifentry->stats.idiscards
#define ifInErrors ifentry->stats.ierrors
#define ifInUnknownProtos ifentry->stats.iunknown_protos
#define ifOutOctets ifentry->stats.obytes.low
#define ifOutUcastPkts ifentry->stats.oucast.low
#define ifOutNUcastPkts ifentry->stats.onucast
#define ifOutDiscards ifentry->stats.odiscards
#define ifOutErrors ifentry->stats.oerrors
#define ifOutQLen ifentry->stats.oqlen
#define ifName ifentry->name
#define ifInMulticastPkts ifentry->stats.imcast.low
#define ifInBroadcastPkts ifentry->stats.ibcast.low
#define ifOutMulticastPkts ifentry->stats.omcast.low
#define ifOutBroadcastPkts ifentry->stats.obcast.low
#define ifHCInOctets ifentry->stats.ibytes
#define ifHCInUcastPkts ifentry->stats.iucast
#define ifHCInMulticastPkts ifentry->stats.imcast
#define ifHCInBroadcastPkts ifentry->stats.ibcast
#define ifHCOutOctets ifentry->stats.obytes
#define ifHCOutUcastPkts ifentry->stats.oucast
#define ifHCOutMulticastPkts ifentry->stats.omcast
#define ifHCOutBroadcastPkts ifentry->stats.obcast
#define ifHighSpeed ifentry->speed_high
#define ifPromiscuousMode ifentry->promiscuous
#define ifConnectorPresent ifentry->connector_present


text:
<?php

namespace Omnipay\PayUZa;

use Omnipay\Tests\GatewayTestCase;

class GatewayTest extends GatewayTestCase
{
    public function setUp()
    {
        parent::setUp();

        $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest());
    }

    public function testPurchase()
    {
        $request = $this->gateway->purchase(array('amount' => '12.00'));

        $this->assertInstanceOf('\Omnipay\PayUZa\Message\PurchaseRequest', $request);
        $this->assertSame('12.00', $request->getAmount());
    }

    public function testCompletePurchase()
    {
        $request = $this->gateway->completePurchase(array('amount' => '12.00'));

        $this->assertInstanceOf('\Omnipay\PayUZa\Message\CompletePurchaseRequest', $request);
        $this->assertSame('12.00', $request->getAmount());
    }
}


text:
* Open the Editor and drag a few blocks
* Click on **Share**, then **Publish**
* A new URL gets generated successfully
* Click **Copy** , the URL gets copied in the clipboard
* In a new browser tab, open that URL
* The script page shows the same blocks as in the editor

## Cancel #cancel

* Open the Editor and drag a few blocks
* Click on **Share**
* Click the **X** icon
* the dialog closes and no URL is generated

## Embed #embed

* Open the Editor and drag a few blocks
* Click on **Share**, then **Publish**
* Click on **Embed**
    1. Copy the content of the **Code** tab
    2. Open https://jsfiddle.net
    3. Copy the text in the HTML section
    4. Click Run and verify that the blocks render

## Additional Tests

* [Test Plan](/testplan)


text:
const nameWhitelist = new RegExp("^[a-z0-9]+$", "i");

class Dislocator {
  constructor() {
    this._registry = {};
    this._instances = {};
    this._loading = [];
  }

  register(name, creatorCb) {
    if (!nameWhitelist.test(name)) {
      throw new Error(`Invalid service name: "${name}"`);
    }

    if (this.isRegistered(name)) {
      throw new Error(`A service called "${name}" is already registered.`);
    }

    this._registry[name] = creatorCb;

    Object.defineProperty(this, name, {
      get: () => this.get(name),
      configurable: true,
      enumerable: true
    });

    return this;
  }

  use(providerFn) {
    providerFn(this);
    return this;
  }

  unregister(name) {
    if (!this.isRegistered(name)) {
      throw new Error(`No registration named "${name}"`);
    }

    delete this._registry[name];
    delete this[name];

    delete this._instances[name];

    return this;
  }

  isRegistered(name) {
    return !!this._registry[name];
  }

  names(regex) {
    let names = Object.keys(this._registry);

    if (regex) {
      names = names.filter(name => name.match(regex));
    }

    return names;
  }

  get(name) {
    if (this._loading.indexOf(name) !== -1) {
      const chain = this._loading.reduce((str, name) => `${str} -> ${name}`);
      throw new Error(`Circular dependency detected (${chain} -> ${name})`);
    }

    this._loading.push(name);

    if (!this.isRegistered(name)) {
      throw new Error(`No registration named "${name}"`);
    }

    if (!(name in this._instances)) {
      if (typeof this._registry[name] === "function") {
        this._instances[name] = this._registry[name](this);
      } else {
        this._instances[name] = this._registry[name];
      }
    }

    this._loading.pop();

    return this._instances[name];
  }
}

module.exports = Dislocator;


text:
using Newtonsoft.Json;

namespace Pleer.Net.Model.Response
{
    public abstract class BaseResponse
    {
        [JsonProperty("success")]
        public bool Success { get; set; }

        [JsonProperty("message")]
        public string Message { get; set; }

        [JsonProperty("error")]
        public string Error { get; set; }

        [JsonProperty("error_description")]
        public string ErrorDescription { get; set; }
    }
}


text:
'''
Created by auto_sdk on 2015.08.03
'''
from top.api.base import RestApi
class TmallItemIncrementUpdateSchemaGetRequest(RestApi):
	def __init__(self,domain='gw.api.taobao.com',port=80):
		RestApi.__init__(self,domain, port)
		self.item_id = None
		self.xml_data = None

	def getapiname(self):
		return 'tmall.item.increment.update.schema.get'


text:
/**
 * Prophet 2.5
 * 版权所有:(C)2003-2010 吉贝克
 *
 *
 */

package com.gbicc.cfl.util;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

/**
 * @作者: 张彦龙
 * @作者: 2010-7-5
 * @描述: POI用于导入/导出的工具类。
 */
public class POIUtils {
	private static final long serialVersionUID = -5493681454502123207L;

	private static final Log log = LogFactory.getLog(POIUtils.class);

	/**
	 * 复制对象列表至工作簿。

	 *
	 * @param list 对象列表
	 * @param workbook 工作簿
	 * @param rowMapper 数据映射,[{key=对象属性名, value=对象属性值}, ...]
	 * @param sheetName 表格名称
	 */
	public static void copyListToWorkbook(List list, HSSFWorkbook workbook, Map rowMapper, String sheetName) throws Exception {
		// 创建sheet
		HSSFSheet sheet = workbook.createSheet(sheetName);

		// 创建rows
		int i = 0;
		int j = 0;
		// 创建header
		HSSFRow header = sheet.createRow(i++);
		for (Iterator iterator = rowMapper.entrySet().iterator(); iterator.hasNext();) {
			Map.Entry entry = (Map.Entry) iterator.next();
			HSSFCell cell = header.createCell((short) j++);
			setCellValue(cell, entry.getValue());
			if (log.isDebugEnabled()) {
				log.debug("RowMapper value, key=[" + entry.getKey() + "] value=[" + entry.getValue() + "]");
			}
		}
		for (Iterator it = list.iterator(); it.hasNext();) {
			// 创建内容
			Object obj = (Object) it.next();
			HSSFRow row = sheet.createRow(i++);
			j = 0;
			for (Iterator iterator = rowMapper.entrySet().iterator(); iterator.hasNext();) {
				Map.Entry entry = (Map.Entry) iterator.next();
				HSSFCell cell = row.createCell((short) j++);
				Object value = PropertyUtils.getProperty(obj, entry.getKey().toString());
				setCellValue(cell, value);
				if (log.isDebugEnabled()) {
					log.debug("Model value, property=[" + entry.getKey() + "] value=[" + value + "]");
				}
			}
		}
	}

	/**
	 * 设置单元格。

	 *
	 * @param cell 单元格
	 * @param value 值
	 */
	private static void setCellValue(HSSFCell cell, Object value) {
		if (value == null) {
			cell.setCellValue(new HSSFRichTextString(""));
			return;
		}

		switch (cell.getCellType()) {
		case HSSFCell.CELL_TYPE_STRING:
		case HSSFCell.CELL_TYPE_FORMULA:
			String strValue = value.toString().trim();
			cell.setCellValue(new HSSFRichTextString(strValue));
			break;
		case HSSFCell.CELL_TYPE_NUMERIC:
			if (value instanceof Short) {
				cell.setCellValue(((Short) value).shortValue());
			}
			if (value instanceof Integer) {
				cell.setCellValue(((Integer) value).intValue());
			}
			if (value instanceof Long) {
				cell.setCellValue(((Long) value).longValue());
			}
			if (value instanceof Float) {
				cell.setCellValue(((Float) value).floatValue());
			}
			if (value instanceof Double) {
				cell.setCellValue(((Double) value).doubleValue());
			}
			break;
		case HSSFCell.CELL_TYPE_BLANK:
		case HSSFCell.CELL_TYPE_BOOLEAN:
		case HSSFCell.CELL_TYPE_ERROR:
		default:
			cell.setCellValue(new HSSFRichTextString(value.toString()));
			break;
		}
	}
}


text:
import logging
import os
import sendgrid
import bidwire_settings
from sendgrid.helpers.mail import *
from yattag import Doc

log = logging.getLogger(__name__)

ITEMS_DELIMITER = " ### "

def get_items(bid):
    if bid.items:
        return ITEMS_DELIMITER.join(bid.items)
    else:
        return bid.description

def append_items(bid):
    return ": " + get_items(bid)

def send_email(subject, mail_body, recipients):
    log.info("Sending email to recipients {}".format(recipients))
    sg = sendgrid.SendGridAPIClient(apikey=bidwire_settings.SENDGRID_API_KEY)
    from_email = Email(bidwire_settings.ADMIN_EMAIL)
    content = Content("text/html", mail_body)
    for recipient in recipients:
        to_email = Email(recipient)
        mail = Mail(from_email, subject, to_email, content)
        response = sg.client.mail.send.post(request_body=mail.get())
        log.info("Sendgrid response status: {}".format(response.status_code))

def make_html_body(items, func_format_item, pre_list_text=None):
    """Returns an HTML email body listing all new items.

    The produced HTML looks like:
    <pre_list_text>
    <list of new items, generated calling func_format_item>
    <post_list_text>

    Arguments:
    items -- a list of new items to put in the email (can be any type)
    func_format_item -- a function that takes one item and returns an
        HTML-formatted version of this item
    pre_list_text -- any text to put before the item list
    post_list_text -- any text to put after the item list

    Returns:
    the resulting HTML, as a string
    """
    doc, tag, text = Doc().tagtext()
    if pre_list_text:
        with tag('p'):
            text(pre_list_text)
    with tag('ul'):
        for item in items:
            with tag('li'):
                # Append the HTML for the item to the doc as-is (don't escape)
                doc.asis(func_format_item(item))
    return doc.getvalue()

def make_bid_item_body(bid):
    """Returns the HTML for one Bid item"""
    doc, tag, text = Doc().tagtext()
    with tag('strong'):
        with tag('a', href=bid.get_url()):
            text(bid.description)
    text(append_items(bid))

    return doc.getvalue()

def make_doc_item_body(document):
    """Returns the HTML for one Document item"""
    doc, tag, text = Doc().tagtext()
    with tag('strong'):
        with tag('a', href=document.url):
            text(document.title)
    return doc.getvalue()


text:
/*
  +----------------------------------------------------------------------+
  | PHP Version 5                                                        |
  +----------------------------------------------------------------------+
  | Copyright (c) 2006-2011 The PHP Group                                |
  +----------------------------------------------------------------------+
  | This source file is subject to version 3.01 of the PHP license,      |
  | that is bundled with this package in the file LICENSE, and is        |
  | available through the world-wide-web at the following url:           |
  | http://www.php.net/license/3_01.txt                                  |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to          |
  | license@php.net so we can mail you a copy immediately.               |
  +----------------------------------------------------------------------+
  | Authors: Georg Richter <georg@mysql.com>                             |
  |          Andrey Hristov <andrey@mysql.com>                           |
  |          Ulf Wendel <uwendel@mysql.com>                              |
  +----------------------------------------------------------------------+
*/

#include "my_global.h"
#include <my_sys.h>
#include <mysys_err.h>
#include <m_string.h>
#include "errmsg.h"
#include "mysql.h"
#include <string.h>
#ifdef _WIN32
#include <share.h>
#endif

typedef struct st_mysql_infile_info
{
  int        fd;
  int        error_no;
  char       error_msg[MYSQL_ERRMSG_SIZE + 1];
  const char *filename;
} MYSQL_INFILE_INFO;

/* {{{ mysql_local_infile_init */
static
int mysql_local_infile_init(void **ptr, const char *filename, void *userdata)
{
  MYSQL_INFILE_INFO *info;
  int CodePage= -1;
#ifdef _WIN32
  MYSQL *mysql= (MYSQL *)userdata;
  wchar_t *w_filename= NULL;
  int Length;
#endif
  DBUG_ENTER("mysql_local_infile_init");

  info = (MYSQL_INFILE_INFO *)my_malloc(sizeof(MYSQL_INFILE_INFO), MYF(MY_ZEROFILL));
  if (!info) {
    DBUG_RETURN(1);
  }

  *ptr = info;

  info->filename = filename;

#ifdef _WIN32
  if (mysql)
    CodePage= madb_get_windows_cp(mysql->charset->csname);
#endif
  if (CodePage == -1)
  {
#ifdef _WIN32
    info->fd= sopen(info->filename, _O_RDONLY | _O_BINARY, _SH_DENYNO , _S_IREAD | _S_IWRITE);
#else
    info->fd = open(info->filename, O_RDONLY | O_BINARY, my_umask);
#endif
    my_errno= errno;
  }
#ifdef _WIN32
  else
  {
    if ((Length= MultiByteToWideChar(CodePage, 0, info->filename, (int)strlen(info->filename), NULL, 0)))
    {
      if (!(w_filename= (wchar_t *)my_malloc((Length + 1) * sizeof(wchar_t), MYF(MY_ZEROFILL))))
      {
        info->error_no= CR_OUT_OF_MEMORY;
        my_snprintf((char *)info->error_msg, sizeof(info->error_msg),
                     ER(CR_OUT_OF_MEMORY));
        DBUG_RETURN(1);
      }
      Length= MultiByteToWideChar(CodePage, 0, info->filename, (int)strlen(info->filename), w_filename, (int)Length);
    }
    if (Length == 0)
    {
      my_free(w_filename);
      info->error_no= CR_UNKNOWN_ERROR;
      my_snprintf((char *)info->error_msg, sizeof(info->error_msg),
                  "Character conversion error: %d", GetLastError());
      DBUG_RETURN(1);
    }
    info->fd= _wsopen(w_filename, _O_RDONLY | _O_BINARY, _SH_DENYNO , _S_IREAD | _S_IWRITE);
    my_errno= errno;
    my_free(w_filename);
  }
#endif

  if (info->fd < 0)
  {
    info->error_no = my_errno;
    my_snprintf((char *)info->error_msg, sizeof(info->error_msg),
                EE(EE_FILENOTFOUND), filename, info->error_no);
    DBUG_RETURN(1);
  }
  DBUG_RETURN(0);
}
/* }}} */

/* {{{ mysql_local_infile_read */
static
int mysql_local_infile_read(void *ptr, char * buf, unsigned int buf_len)
{
  MYSQL_INFILE_INFO *info = (MYSQL_INFILE_INFO *)ptr;
  int count;

  DBUG_ENTER("mysql_local_infile_read");

  count= read(info->fd, (void *)buf, (size_t)buf_len);

  if (count < 0)
  {
    strcpy(info->error_msg, "Error reading file");
    info->error_no = EE_READ;
  }
  DBUG_RETURN(count);
}
/* }}} */

/* {{{ mysql_local_infile_error */
static
int mysql_local_infile_error(void *ptr, char *error_buf, unsigned int error_buf_len)
{
  MYSQL_INFILE_INFO *info = (MYSQL_INFILE_INFO *)ptr;

  DBUG_ENTER("mysql_local_infile_error");

  if (info) {
    strncpy(error_buf, info->error_msg, error_buf_len);
    DBUG_RETURN(info->error_no);
  }

  strncpy(error_buf, "Unknown error", error_buf_len);
  DBUG_RETURN(CR_UNKNOWN_ERROR);
}
/* }}} */

/* {{{ mysql_local_infile_end */
static
void mysql_local_infile_end(void *ptr)
{
  MYSQL_INFILE_INFO *info = (MYSQL_INFILE_INFO *)ptr;

  DBUG_ENTER("mysql_local_infile_end");

  if (info)
  {
    if (info->fd >= 0)
      close(info->fd);
    my_free(ptr);
  }
  DBUG_VOID_RETURN;
}
/* }}} */

/* {{{ mysql_local_infile_default */
void mysql_set_local_infile_default(MYSQL *conn)
{
  DBUG_ENTER("mysql_local_infile_default");
  conn->options.local_infile_init = mysql_local_infile_init;
  conn->options.local_infile_read = mysql_local_infile_read;
  conn->options.local_infile_error = mysql_local_infile_error;
  conn->options.local_infile_end = mysql_local_infile_end;
  DBUG_VOID_RETURN;
}
/* }}} */

/* {{{ mysql_set_local_infile_handler */
void STDCALL mysql_set_local_infile_handler(MYSQL *conn,
        int (*local_infile_init)(void **, const char *, void *),
        int (*local_infile_read)(void *, char *, uint),
        void (*local_infile_end)(void *),
        int (*local_infile_error)(void *, char *, uint),
        void *userdata)
{
  DBUG_ENTER("mysql_set_local_infile_handler");
  conn->options.local_infile_init=  local_infile_init;
  conn->options.local_infile_read=  local_infile_read;
  conn->options.local_infile_end=   local_infile_end;
  conn->options.local_infile_error= local_infile_error;
  conn->options.local_infile_userdata[0] = userdata;
  DBUG_VOID_RETURN;
}
/* }}} */

/* {{{ mysql_handle_local_infile */
my_bool mysql_handle_local_infile(MYSQL *conn, const char *filename)
{
  unsigned int buflen= 4096;
  int bufread;
  unsigned char *buf= NULL;
  void *info= NULL;
  my_bool result= 1;

  DBUG_ENTER("mysql_handle_local_infile");

  /* check if all callback functions exist */
  if (!conn->options.local_infile_init || !conn->options.local_infile_end ||
      !conn->options.local_infile_read || !conn->options.local_infile_error)
  {
    conn->options.local_infile_userdata[0]= conn;
    mysql_set_local_infile_default(conn);
  }

  if (!(conn->options.client_flag & CLIENT_LOCAL_FILES)) {
    my_set_error(conn, CR_UNKNOWN_ERROR, SQLSTATE_UNKNOWN, "Load data local infile forbidden");
    /* write empty packet to server */
    my_net_write(&conn->net, "", 0);
    net_flush(&conn->net);
    goto infile_error;
  }

  /* allocate buffer for reading data */
  buf = (uchar *)my_malloc(buflen, MYF(0));

  /* init handler: allocate read buffer and open file */
  if (conn->options.local_infile_init(&info, filename,
                                      conn->options.local_infile_userdata[0]))
  {
    char tmp_buf[MYSQL_ERRMSG_SIZE];
    int tmp_errno;

    tmp_errno= conn->options.local_infile_error(info, tmp_buf, sizeof(tmp_buf));
    my_set_error(conn, tmp_errno, SQLSTATE_UNKNOWN, tmp_buf);
    my_net_write(&conn->net, "", 0);
    net_flush(&conn->net);
    goto infile_error;
  }

  /* read data */
  while ((bufread= conn->options.local_infile_read(info, (char *)buf, buflen)) > 0)
  {
    if (my_net_write(&conn->net, (char *)buf, bufread))
    {
      my_set_error(conn, CR_SERVER_LOST, SQLSTATE_UNKNOWN, NULL);
      goto infile_error;
    }
  }

  /* send empty packet for eof */
  if (my_net_write(&conn->net, "", 0) || net_flush(&conn->net))
  {
    my_set_error(conn, CR_SERVER_LOST, SQLSTATE_UNKNOWN, NULL);
    goto infile_error;
  }

  /* error during read occured */
  if (bufread < 0)
  {
    char tmp_buf[MYSQL_ERRMSG_SIZE];
    int tmp_errno= conn->options.local_infile_error(info, tmp_buf, sizeof(tmp_buf));
    my_set_error(conn, tmp_errno, SQLSTATE_UNKNOWN, tmp_buf);
    goto infile_error;
  }

  result = 0;

infile_error:
  conn->options.local_infile_end(info);
  my_free(buf);
  DBUG_RETURN(result);
}
/* }}} */


text:
package additional

import (
	"errors"
	"github.com/yu-ichiko/go-psd/util"
)

type SectionDivider struct {
	Type      int
	BlendMode string
	SubType   int
}

func NewSectionDividerSetting(buf []byte) (*SectionDivider, error) {
	var err error
	size := len(buf)
	sd := &SectionDivider{}
	reader := util.NewReader(buf)
	sd.Type, err = reader.ReadInt()
	if err != nil {
		return nil, err
	}
	if size >= 12 {
		sig, err := reader.ReadString(4)
		if err != nil {
			return nil, err
		}
		if sig != "8BIM" {
			return nil, errors.New("invalid SectionDividerSetting signature")
		}
		sd.BlendMode, err = reader.ReadString(4)
		if err != nil {
			return nil, err
		}
	}
	if size >= 16 {
		sd.SubType, err = reader.ReadInt()
		if err != nil {
			return nil, err
		}
	}
	return sd, nil
}


text:
/**
 * Created by buyttle-cesar on 11/06/15.
 */
'use strict';

var expect = require('chai').expect;
var Item = require('../item');

describe("#Item", function () {

  describe("# Constructor", function () {

    it("should set the provided selector", function () {
    var item = new Item("test",22,10);
      expect(item.selector).to.equal("test");
    });

    it("should set the provided cost", function () {
      var item = new Item("selector",2.30,10);
      expect(item.cost).to.equal(2.30);
    });

    it("should set the provided count", function () {
      var item  = new Item("selector",2.30,2);
      expect(item.count).to.equal(2);
    });
    it("should set zero in count if the provided count is negative", function () {
      var item = new Item("selector",2.30,-2);

      expect(item.count).to.equal(0);
    });

  });

  describe("#isAvailable",function(){
    context("when the count is bigger than 0", function () {
      it("should return true ", function () {
        var item = new Item("selector",2,6);
        expect(item.isAvailable()).to.be.true;
      });
    });
    context("when the count is lower than 1", function () {
      it("should return false", function () {
        var item =  new Item("selector",2,0);
        expect(item.isAvailable()).to.be.false;
      });
    });
  });

  describe("#decreaseCount", function () {

    context("when the count is 20", function () {
      it("it should the count be 19",function(){
        var item = new Item("selector",2,20);
        item.decreaseCount();
        expect(item.count).to.equal(19);
      });
    });
    context("when the counter is 0", function () {
      it("should continue the same value",function(){
        var item = new Item("selector",2,0);
        item.decreaseCount();
        expect(item.count).to.equal(0);
      });
    });
  });
});


text:
package org.apache.xml.security.stax.ext;

import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;

import java.security.Key;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import javax.xml.namespace.QName;

/**
 * Main configuration class to supply keys etc.
 * This class is subject to change in the future.
 *
 * @author $Author: coheigea $
 * @version $Revision: 1721124 $ $Date: 2015-12-21 11:03:05 +0000 (Mon, 21 Dec 2015) $
 */
public class XMLSecurityProperties {

    private final List<InputProcessor> inputProcessorList = new ArrayList<InputProcessor>();
    private boolean skipDocumentEvents = false;
    private boolean disableSchemaValidation = false;

    private List<XMLSecurityConstants.Action> actions = new ArrayList<XMLSecurityConstants.Action>();

    private X509Certificate encryptionUseThisCertificate;
    private String encryptionSymAlgorithm;
    private String encryptionKeyTransportAlgorithm;
    private String encryptionKeyTransportDigestAlgorithm;
    private String encryptionKeyTransportMGFAlgorithm;
    private byte[] encryptionKeyTransportOAEPParams;
    private final List<SecurePart> encryptionParts = new LinkedList<SecurePart>();
    private Key encryptionKey;
    private Key encryptionTransportKey;
    private SecurityTokenConstants.KeyIdentifier encryptionKeyIdentifier;

    private Key decryptionKey;

    private final List<SecurePart> signatureParts = new LinkedList<SecurePart>();
    private String signatureAlgorithm;
    private String signatureDigestAlgorithm;
    private String signatureCanonicalizationAlgorithm;
    private Key signatureKey;
    private X509Certificate[] signatureCerts;
    private boolean addExcC14NInclusivePrefixes = false;
    private SecurityTokenConstants.KeyIdentifier signatureKeyIdentifier;
    private boolean useSingleCert = true;

    private Key signatureVerificationKey;

    private int signaturePosition = 0;

    private QName idAttributeNS = XMLSecurityConstants.ATT_NULL_Id;

    public XMLSecurityProperties() {
    }

    protected XMLSecurityProperties(XMLSecurityProperties xmlSecurityProperties) {
        this.inputProcessorList.addAll(xmlSecurityProperties.inputProcessorList);
        this.skipDocumentEvents = xmlSecurityProperties.skipDocumentEvents;
        this.disableSchemaValidation = xmlSecurityProperties.disableSchemaValidation;
        this.actions = xmlSecurityProperties.actions;
        this.encryptionUseThisCertificate = xmlSecurityProperties.encryptionUseThisCertificate;
        this.encryptionSymAlgorithm = xmlSecurityProperties.encryptionSymAlgorithm;
        this.encryptionKeyTransportAlgorithm = xmlSecurityProperties.encryptionKeyTransportAlgorithm;
        this.encryptionKeyTransportDigestAlgorithm = xmlSecurityProperties.encryptionKeyTransportDigestAlgorithm;
        this.encryptionKeyTransportMGFAlgorithm = xmlSecurityProperties.encryptionKeyTransportMGFAlgorithm;
        this.encryptionKeyTransportOAEPParams = xmlSecurityProperties.encryptionKeyTransportOAEPParams;
        this.encryptionParts.addAll(xmlSecurityProperties.encryptionParts);
        this.encryptionKey = xmlSecurityProperties.encryptionKey;
        this.encryptionTransportKey = xmlSecurityProperties.encryptionTransportKey;
        this.encryptionKeyIdentifier = xmlSecurityProperties.encryptionKeyIdentifier;
        this.decryptionKey = xmlSecurityProperties.decryptionKey;
        this.signatureParts.addAll(xmlSecurityProperties.signatureParts);
        this.signatureAlgorithm = xmlSecurityProperties.signatureAlgorithm;
        this.signatureDigestAlgorithm = xmlSecurityProperties.signatureDigestAlgorithm;
        this.signatureCanonicalizationAlgorithm = xmlSecurityProperties.signatureCanonicalizationAlgorithm;
        this.signatureKey = xmlSecurityProperties.signatureKey;
        this.signatureCerts = xmlSecurityProperties.signatureCerts;
        this.addExcC14NInclusivePrefixes = xmlSecurityProperties.addExcC14NInclusivePrefixes;
        this.signatureKeyIdentifier = xmlSecurityProperties.signatureKeyIdentifier;
        this.useSingleCert = xmlSecurityProperties.useSingleCert;
        this.signatureVerificationKey = xmlSecurityProperties.signatureVerificationKey;
        this.signaturePosition = xmlSecurityProperties.signaturePosition;
        this.idAttributeNS = xmlSecurityProperties.idAttributeNS;
    }

    public SecurityTokenConstants.KeyIdentifier getSignatureKeyIdentifier() {
        return signatureKeyIdentifier;
    }

    public void setSignatureKeyIdentifier(SecurityTokenConstants.KeyIdentifier signatureKeyIdentifier) {
        this.signatureKeyIdentifier = signatureKeyIdentifier;
    }

    /**
     * returns the position of the signature. By default, the signature
     * is located at the first child of the root element
     *
     * @return The signature position
     */
    public int getSignaturePosition() {
        return signaturePosition;
    }

    /**
     * Specifies the position of the signature
     *
     * @param signaturePosition Position of the signature (by default: 0)
     */
    public void setSignaturePosition(int signaturePosition) {
        this.signaturePosition = signaturePosition;
    }

    /**
     * Return the qualified name of the ID attribute used to sign the document.
     * By default, ID is used.
     *
     * @return the qualified name of the ID attribute
     */
    public QName getIdAttributeNS() {
        return idAttributeNS;
    }

    /**
     * Sets the qualified name of the ID attribute used to sign the document.
     * @param idAttributeNS Qualified Name of the ID attribute to use
     */
    public void setIdAttributeNS(QName idAttributeNS) {
        this.idAttributeNS = idAttributeNS;
    }

    /**
     * returns the KeyIdentifierType which will be used in the secured document
     *
     * @return The KeyIdentifierType
     */
    public SecurityTokenConstants.KeyIdentifier getEncryptionKeyIdentifier() {
        return encryptionKeyIdentifier;
    }

    /**
     * Specifies the KeyIdentifierType to use in the secured document
     *
     * @param encryptionKeyIdentifier
     */
    public void setEncryptionKeyIdentifier(SecurityTokenConstants.KeyIdentifier encryptionKeyIdentifier) {
        this.encryptionKeyIdentifier = encryptionKeyIdentifier;
    }

    /**
     * Add an additional, non standard, InputProcessor to the chain
     *
     * @param inputProcessor The InputProcessor to add
     */
    public void addInputProcessor(InputProcessor inputProcessor) {
        this.inputProcessorList.add(inputProcessor);
    }

    /**
     * Returns the currently registered additional InputProcessors
     *
     * @return the List with the InputProcessors
     */
    public List<InputProcessor> getInputProcessorList() {
        return inputProcessorList;
    }

    public void setDecryptionKey(Key decryptionKey) {
        this.decryptionKey = decryptionKey;
    }

    public Key getDecryptionKey() {
        return decryptionKey;
    }

    public void setEncryptionTransportKey(Key encryptionTransportKey) {
        this.encryptionTransportKey = encryptionTransportKey;
    }

    public Key getEncryptionTransportKey() {
        return encryptionTransportKey;
    }

    public void setEncryptionKey(Key encryptionKey) {
        this.encryptionKey = encryptionKey;
    }

    public Key getEncryptionKey() {
        return encryptionKey;
    }

    /**
     * Adds a part which must be encrypted by the framework
     *
     * @param securePart
     */
    public void addEncryptionPart(SecurePart securePart) {
        encryptionParts.add(securePart);
    }

    /**
     * Returns the encryption parts which are actually set
     *
     * @return A List of SecurePart's
     */
    public List<SecurePart> getEncryptionSecureParts() {
        return encryptionParts;
    }

    /**
     * Returns the Encryption-Algo
     *
     * @return the Encryption-Algo as String
     */
    public String getEncryptionSymAlgorithm() {
        return encryptionSymAlgorithm;
    }

    /**
     * Specifies the encryption algorithm
     *
     * @param encryptionSymAlgorithm The algo to use for encryption
     */
    public void setEncryptionSymAlgorithm(String encryptionSymAlgorithm) {
        this.encryptionSymAlgorithm = encryptionSymAlgorithm;
    }

    /**
     * Returns the encryption key transport algorithm
     *
     * @return the key transport algorithm as string
     */
    public String getEncryptionKeyTransportAlgorithm() {
        return encryptionKeyTransportAlgorithm;
    }

    /**
     * Specifies the encryption key transport algorithm
     *
     * @param encryptionKeyTransportAlgorithm
     *         the encryption key transport algorithm as string
     */
    public void setEncryptionKeyTransportAlgorithm(String encryptionKeyTransportAlgorithm) {
        this.encryptionKeyTransportAlgorithm = encryptionKeyTransportAlgorithm;
    }

    public String getEncryptionKeyTransportDigestAlgorithm() {
        return encryptionKeyTransportDigestAlgorithm;
    }

    public void setEncryptionKeyTransportDigestAlgorithm(String encryptionKeyTransportDigestAlgorithm) {
        this.encryptionKeyTransportDigestAlgorithm = encryptionKeyTransportDigestAlgorithm;
    }

    public String getEncryptionKeyTransportMGFAlgorithm() {
        return encryptionKeyTransportMGFAlgorithm;
    }

    public void setEncryptionKeyTransportMGFAlgorithm(String encryptionKeyTransportMGFAlgorithm) {
        this.encryptionKeyTransportMGFAlgorithm = encryptionKeyTransportMGFAlgorithm;
    }

    public byte[] getEncryptionKeyTransportOAEPParams() {
        return encryptionKeyTransportOAEPParams;
    }

    public void setEncryptionKeyTransportOAEPParams(byte[] encryptionKeyTransportOAEPParams) {
        this.encryptionKeyTransportOAEPParams = encryptionKeyTransportOAEPParams;
    }

    public X509Certificate getEncryptionUseThisCertificate() {
        return encryptionUseThisCertificate;
    }

    public void setEncryptionUseThisCertificate(X509Certificate encryptionUseThisCertificate) {
        this.encryptionUseThisCertificate = encryptionUseThisCertificate;
    }

    public X509Certificate[] getSignatureCerts() {
        return signatureCerts;
    }

    public void setSignatureCerts(X509Certificate[] signatureCerts) {
        this.signatureCerts = signatureCerts;
    }

    public void addSignaturePart(SecurePart securePart) {
        signatureParts.add(securePart);
    }

    public List<SecurePart> getSignatureSecureParts() {
        return signatureParts;
    }

    public String getSignatureAlgorithm() {
        return signatureAlgorithm;
    }

    public void setSignatureAlgorithm(String signatureAlgorithm) {
        this.signatureAlgorithm = signatureAlgorithm;
    }

    public String getSignatureDigestAlgorithm() {
        return signatureDigestAlgorithm;
    }

    public void setSignatureDigestAlgorithm(String signatureDigestAlgorithm) {
        this.signatureDigestAlgorithm = signatureDigestAlgorithm;
    }

    public void setSignatureKey(Key signatureKey) {
        this.signatureKey = signatureKey;
    }

    public Key getSignatureKey() {
        return signatureKey;
    }

    public boolean isUseSingleCert() {
        return useSingleCert;
    }

    public void setUseSingleCert(boolean useSingleCert) {
        this.useSingleCert = useSingleCert;
    }

    public boolean isAddExcC14NInclusivePrefixes() {
        return addExcC14NInclusivePrefixes;
    }

    public void setAddExcC14NInclusivePrefixes(boolean addExcC14NInclusivePrefixes) {
        this.addExcC14NInclusivePrefixes = addExcC14NInclusivePrefixes;
    }

    /**
     * Returns the actual set actions
     *
     * @return The Actions in applied order
     */
    public List<XMLSecurityConstants.Action> getActions() {
        return actions;
    }

    /**
     * Specifies how to secure the document eg. Timestamp, Signature, Encrypt
     *
     * @param actions
     */
    public void setActions(List<XMLSecurityConstants.Action> actions) {
        this.actions = actions;
    }

    public void addAction(XMLSecurityConstants.Action action) {
        if (actions == null) {
            actions = new ArrayList<XMLSecurityConstants.Action>();
        }
        actions.add(action);
    }

    public String getSignatureCanonicalizationAlgorithm() {
        return signatureCanonicalizationAlgorithm;
    }

    public void setSignatureCanonicalizationAlgorithm(String signatureCanonicalizationAlgorithm) {
        this.signatureCanonicalizationAlgorithm = signatureCanonicalizationAlgorithm;
    }

    public Key getSignatureVerificationKey() {
        return signatureVerificationKey;
    }

    public void setSignatureVerificationKey(Key signatureVerificationKey) {
        this.signatureVerificationKey = signatureVerificationKey;
    }

    /**
     * Returns if the framework is skipping document-events
     *
     * @return true if document-events will be skipped, false otherwise
     */
    public boolean isSkipDocumentEvents() {
        return skipDocumentEvents;
    }

    /**
     * specifies if the framework should forward Document-Events or not
     *
     * @param skipDocumentEvents set to true when document events should be discarded, false otherwise
     */
    public void setSkipDocumentEvents(boolean skipDocumentEvents) {
        this.skipDocumentEvents = skipDocumentEvents;
    }

    public boolean isDisableSchemaValidation() {
        return disableSchemaValidation;
    }

    public void setDisableSchemaValidation(boolean disableSchemaValidation) {
        this.disableSchemaValidation = disableSchemaValidation;
    }
}


text:
int main()
{
	auto app = new MyApplication();
	// window title, dimensions and if it is fullscreen
	app->run("AIE", 1280, 720, false);
	delete app;

    return 0;
}


text:
Walk through the linked list code in the curriculum and understand it well. Then write a linked list class and its core functions (insertFirst, insertLast, remove, find) from scratch.

<details><summary>Show Solution</summary>

```js
class _Node {
  constructor(value, next) {
    this.value = value;
    this.next = next;
  }
}

class LinkedList {
  constructor() {
    this.head = null;
  }

  insertFirst(item) { // O(1) constant time, no iteration
    this.head = new _Node(item, this.head)
  }

  insertLast(item) {
    if (!this.head) {return this.insertFirst(item)} // If the list is empty

    let currentNode = this.head;
    while (currentNode.next) {
      currentNode = currentNode.next;
    }

    currentNode.next = new _Node(item, null)
  }

  insertBefore(value, item) { // O(n) linear time
    if (!this.head) {return null} // If the list is empty, do nothing
    if (this.head.value === value) { // If the lookup value is the first item in the list
      this.insertFirst(item);
      return;
    }

    let currentNode = this.head;
    let previousNode = this.head;
    while (currentNode.value !== value) {
      if (!currentNode.next) {return null} // If the lookup value is not found, do nothing
      previousNode = currentNode;
      currentNode = currentNode.next;
    }

    previousNode.next = new _Node(item, currentNode);
  }

  insertAfter(value, item) { // O(n) linear time, same implementation as insertBefore essentially
    if (!this.head) {return null} // If the list is empty, do nothing

    let currentNode = this.head;
    while (currentNode.value !== value) {
      if (!currentNode.next) {return null} // If the lookup value is not found, do nothing
      currentNode = currentNode.next;
    }

    currentNode.next = new _Node(item, currentNode.next)
    // We initialize the node node with the current pointer, then set the current point to the new node
  }

  insertAt(index, item) {
    if (index === 0) { // Handle if index to insert at is 0
      return this.insertFirst(item);
    }

    let counter = 1;
    let currentNode = this.head.next;
    let previousNode = this.head;
    while (counter < index) {
      if (!currentNode.next) {return null} // If the index does not exist in our list
      previousNode = currentNode;
      currentNode = currentNode.next;
      counter++;
    }

    previousNode.next = new _Node(item, currentNode)
  }

  find(value) { // O(n) linear time, iterates through the list
    if (!this.head) {return null} // If the list is empty

    let currentNode = this.head;

    while(currentNode.value !== value) {
      if (!currentNode.next) {return null} // If we reach the end of the list

      currentNode = currentNode.next;
    }

    return currentNode;
  }

  remove(value) {
    if (!this.head) {return null} // If the list is empty
    if (this.head.value === value) { // If it's the first node in the list
      this.head = this.head.next;
      return;
    }

    let currentNode = this.head;
    let previousNode = this.head;

    while(currentNode.value !== value) {
      if (!currentNode.next) {return null} // If we reach the end of the list

      previousNode = currentNode;
      currentNode = currentNode.next;
    }

    previousNode.next = currentNode.next
  }
}
```

</details>

## Creating a singly linked list
Write a function main. Within the function, using the linked list class above, create a linked list with the name SLL and add the following items to your linked list: Apollo, Boomer, Helo, Husker, Starbuck.
Add Tauhida to the list.
Remove Husker from the list.
Implement a function called insertBefore() in the class that inserts a new node before a given node containing a key.
Implement a function called insertAfter() in the class that inserts a new node after a node containing the key.
Implement a function called insertAt() that inserts an item at a specific position in the linked list.
Add Athena before Boomer using your insertBefore() function.
Add Hotdog after Helo using the insertAfter() method.
Using the insertAt() method insert Kat in the 3rd position of the list.
Remove Tauhida from the list.

```js
function main() {
  const SLL = new LinkedList; // Initialize our linked list object

  SLL.insertLast('Apollo')
  SLL.insertLast('Boomer')
  SLL.insertLast('Helo')
  SLL.insertLast('Husker')
  SLL.insertLast('Starbuck')

  SLL.insertBefore('Boomer', 'Athena')
  SLL.insertAfter('Helo', 'Hotdog')
  SLL.insertAt(2, 'Kat')

  linkedListHelpers.display(SLL)
  console.log('List size: ' + linkedListHelpers.size(SLL))
  console.log('Is the list empty? ' + linkedListHelpers.isEmpty(SLL))
  console.log('The node before Boomer is: ' + linkedListHelpers.findPrevious(SLL, 'Boomer').value)
  console.log('The last item in my list is: ' + linkedListHelpers.findLast(SLL).value)

  console.log(thirdFromEnd(SLL))
  console.log(findMiddle(SLL))
}
main()
```

## Supplemental functions for a linked list
Implement the following functions that operate on your linked list class. Note that these should be free functions instead of methods of the linked list class, so implement them outside the linked list class. Test each function using the list created in exercise 1.
display: displays the linked list
size: returns the size of the linked list
isEmpty: finds if the list is empty or not (without using the size() function)
findPrevious: finds the node before the item you are looking for
findLast: returns the last node in the linked list

```js
const linkedListHelpers = {
  display: function (list) { // O(n) linear
    if (!list.head) {return console.log('The list is empty')}

    let currentNode = list.head;
    while (currentNode) {
      console.log(currentNode.value);
      currentNode = currentNode.next;
    }
  },
  size: function(list) { // O(n) linear time
    let counter = 0;
    let currentNode = list.head;
    while (currentNode) {
      counter++;
      currentNode = currentNode.next;
    }
    return counter;
  },
  isEmpty: function(list) { // O(1) constant time
    if (!list.head) {return true}
    return false;
  },
  findPrevious: function(list, value) { // O(n) linear
    if (!list.head) {return null} // If the list is empty

    let currentNode = list.head;
    let previousNode = list.head
    while(currentNode.value !== value) {
      if (!currentNode.next) {return null} // If we reach the end of the list without finding the value
      previousNode = currentNode;
      currentNode = currentNode.next;
    }

    return previousNode;
  },
  findLast: function(list) { // O(n) linear
    if (!list.head) {return null} // If the list is empty

    let currentNode = list.head;
    while (currentNode.next) {
      currentNode = currentNode.next;
    }
    return currentNode;
  },
  findByIndex: function(list, index) {
    if (!list.head) {return null}
    let counter = 0;
    let currentNode = list.head;
    while (counter < index) {
      if (!currentNode.next) {return null} // If the index does not exist in our list
      currentNode = currentNode.next;
      counter++;
    }

    return currentNode;
  }
}
```

## Mystery program
Analyze the following function (without running it in an IDE) to determine what problem it is trying to solve. What is the time complexity of this algorithm?

```js
function WhatDoesThisProgramDo(lst) {
    let current = lst.head;
    while (current !== null) {
        let newNode = current;
        while (newNode.next !== null) {
            if (newNode.next.value === current.value) {
                newNode.next = newNode.next.next;
            }
            else {
                newNode = newNode.next;
            }
        }
        current = current.next;
    }
}
```
> O(n^2) quadratic, it traverses the list once for each node in the list
> This program removes duplicates from a linked list

## Reverse a list
Write an algorithm to reverse a linked list. The time complexity of your algorithm should be linear (O(n)). For this exercise, notice we are not asking you just to print the linked list in reverse or use another linked list to store the value in reverse order. Your program should reverse the direction of a given singly linked list. In other words, all pointers should point backward. BONUS: Solve this problem using both recursive and iterative algorithms.

```js
function reverseList (list) { // O(n) linear,
  if (!list.head) {return list} // If the list is empty

  let currentNode = list.head;
  let previousNode = null;
  while (currentNode.next) {
    let nextNode = currentNode.next;
    currentNode.next = previousNode;

    previousNode = currentNode;
    currentNode = nextNode;
  }
  currentNode.next = previousNode; // Reverse the final pointer
  list.head = currentNode;
}
```

## 3rd from the end
Write an algorithm to find the 3rd element from the end of a linked list. Note You may be tempted to add a length property to your linked list class. The length property is not a typical property of linked list, therefore don't make any modification to the linked list class that is provided to you.

```js
function thirdFromEnd(list) { // O(2n) linear
  const length = linkedListHelpers.size(list);

  // See the findByIndex helper for implementation
  return linkedListHelpers.findByIndex(list, length - 3);
}
```

## Middle of a list
Write an algorithm to find the middle element of a linked list. Note You may be tempted to add a length property to your linked list class. The length property is not a typical property of linked list, therefore don't make any modification to the linked list class that is provided to you. Also, finding the size of the linked list using the size() function and dividing it by half will not find the correct middle of the linked list. So, don't use either of these approaches.

```js
function findMiddle(list) {
  // Do not add a length property or use size()

  // Have two cursors traversing the list, one at double speed
  // Once the 2x cursor reaches the end, return the other

  if (!list.head) {return null}

  let playerOne = list.head;
  let playerTwo = null;
  while (playerOne) {
    playerOne = playerOne.next ? playerOne.next.next : null;
    playerTwo = playerTwo ? playerTwo.next : list.head;
  }
  return playerTwo;
}
```

## Cycle in a list
Write an algorithm to find whether a linked list has a cycle (i.e., whether a node in the list has its next value pointing to an earlier node in the list). For this exercise, create a linked list with the name CycleList. Be sure to insert nodes in the list so that it has a cycle. Then test your program with a cycleList function.

```js
// Rewrite this function so it works with cycles occuring anywhere in the list
function isCycle(list) { // O(n) linear, traverses the list once
  if (!list.head) {return null}

  let firstNode = list.head;
  let currentNode = list.head;
  while (currentNode.next) {
    if (currentNode.next === firstNode) {
      return true;
    }
    currentNode = currentNode.next;
  }
  return false;
}
```

## Sorting a list
Write an algorithm that will sort a given linked list. For example given a list such as 3->2->5->7->1, your program will output the sorted version of this list which will be 1->2->3->5->7. You may not use another list or any other data structure such as an array to store the data. Also, you can only go through the list once, O(n) runtime.
> Impossible, you cannot have an O(n) runtime unless the list is already sorted.


text:
behat-registry
==============

What is it?
-----------

A little extension that allows a simple registry to be injected in to
FeatureContexts, allowing steps to share data across contexts if necessary

Installation
------------

The only documented way to install behat-registry is with
[composer](http://getcomposer.org)

``` bash
$ composer.phar require --dev davedevelopment/behat-registry:*
```

Usage
-----

Add the extension to your `behat.yml` file:

``` yaml
default:
    extensions:
        DaveDevelopment\BehatRegistry\Extension:

```

If you implement the
`DaveDevelopment\BehatRegistry\Context\Initializer\RegistryAwareInterface` with
your `Context` classes, they will have a Registry injected.

``` php
<?php

use DaveDevelopment\BehatRegistry\Context\Initializer\RegistryAwareInterface;
use DaveDevelopment\BehatRegistry\Registry;

class FeatureContext implements RegistryAwareInterface
{
    public function setRegistry(Registry $registry)
    {
        $this->registry = $registry;
    }

```

If you want some items to persist between scenarios, call the persist method
with the key.

``` php
<?php

    $this->registry->userId = 123;
    $this->registry->persist("userId");

```

Copyright
---------

Copyright (c) 2012 Dave Marshall. See LICENCE for further details