text:
package com.hp.alm.ali.idea.ui.editor;

import com.hp.alm.ali.idea.entity.EntityRef;
import com.hp.alm.ali.idea.entity.edit.EntityEditStrategyImpl;
import com.hp.alm.ali.idea.model.Entity;
import com.hp.alm.ali.idea.model.Field;
import com.hp.alm.ali.idea.model.Metadata;
import com.hp.alm.ali.idea.services.EntityService;
import com.hp.alm.ali.idea.services.MetadataService;
import com.hp.alm.ali.idea.services.ProjectListService;
import com.hp.alm.ali.idea.ui.editor.field.LookupListField;
import com.hp.alm.ali.idea.ui.editor.field.TextAreaField;
import com.intellij.openapi.project.Project;

import java.awt.Dimension;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class AcceptanceTestEditor extends BaseEditor {

    private Metadata metadata;
    private Field statusField;
    private List<String> statusValues;

    public AcceptanceTestEditor(Project project, EntityRef parent) {
        super(project, "Add Acceptance Test", new Entity("acceptance-test", 0), new AcceptanceTestEditor.Create(project, parent));

        entity.setProperty("status", "Not Started");

        init();
    }

    public AcceptanceTestEditor(Project project, Entity test) {
        super(project, "Modify Acceptance Test", test, new EntityEditStrategyImpl.Edit(project));

        init();
    }

    private void init() {
        setSize(new Dimension(640, 480));
        centerOnOwner();
    }

    public void beforeUpdate() {
        metadata = project.getComponent(MetadataService.class).getEntityMetadata("acceptance-test");
        statusField = metadata.getField("status");
        statusValues = project.getComponent(ProjectListService.class).getProjectList("acceptance-test", statusField);
    }

    @Override
    public void update() {
        addField("description", new TextAreaField("Description", entity.getPropertyValue("description"), true, true), true);
        addField("status", new LookupListField(statusValues, statusField, entity, true, true));
    }

    public static class Create implements SaveHandler {

        private EntityService entityService;
        private EntityRef parent;

        public Create(Project project, EntityRef parent) {
            this.parent = parent;
            entityService = project.getComponent(EntityService.class);
        }

        @Override
        public boolean save(Entity modified, Entity entity) {
            modified.setProperty("entity-id", String.valueOf(parent.id));
            modified.setProperty("entity-type", parent.type);
            Date now = new Date();
            modified.setProperty("last-modified-status-date", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(now));
            modified.setProperty("creation-date", new SimpleDateFormat("yyyy-MM-dd").format(now));
            return entityService.createEntity(modified, false) != null;
        }
    }
}


text:
package swarm

import (
	"fmt"

	peer "github.com/ipfs/go-ipfs/p2p/peer"

	metrics "github.com/ipfs/go-ipfs/metrics"
	inet "github.com/ipfs/go-ipfs/p2p/net"

	ctxgroup "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup"
	ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
	context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
)

// Network implements the inet.Network interface.
// It is simply a swarm, with a few different functions
// to implement inet.Network.
type Network Swarm

// NewNetwork constructs a new network and starts listening on given addresses.
func NewNetwork(ctx context.Context, listen []ma.Multiaddr, local peer.ID,
	peers peer.Peerstore, bwc metrics.Reporter) (*Network, error) {

	s, err := NewSwarm(ctx, listen, local, peers, bwc)
	if err != nil {
		return nil, err
	}

	return (*Network)(s), nil
}

// DialPeer attempts to establish a connection to a given peer.
// Respects the context.
func (n *Network) DialPeer(ctx context.Context, p peer.ID) (inet.Conn, error) {
	log.Debugf("[%s] network dialing peer [%s]", n.local, p)
	sc, err := n.Swarm().Dial(ctx, p)
	if err != nil {
		return nil, err
	}

	log.Debugf("network for %s finished dialing %s", n.local, p)
	return inet.Conn(sc), nil
}

// CtxGroup returns the network's ContextGroup
func (n *Network) CtxGroup() ctxgroup.ContextGroup {
	return n.cg
}

// Swarm returns the network's peerstream.Swarm
func (n *Network) Swarm() *Swarm {
	return (*Swarm)(n)
}

// LocalPeer the network's LocalPeer
func (n *Network) LocalPeer() peer.ID {
	return n.Swarm().LocalPeer()
}

// Peers returns the connected peers
func (n *Network) Peers() []peer.ID {
	return n.Swarm().Peers()
}

// Peers returns the connected peers
func (n *Network) Peerstore() peer.Peerstore {
	return n.Swarm().peers
}

// Conns returns the connected peers
func (n *Network) Conns() []inet.Conn {
	conns1 := n.Swarm().Connections()
	out := make([]inet.Conn, len(conns1))
	for i, c := range conns1 {
		out[i] = inet.Conn(c)
	}
	return out
}

// ConnsToPeer returns the connections in this Netowrk for given peer.
func (n *Network) ConnsToPeer(p peer.ID) []inet.Conn {
	conns1 := n.Swarm().ConnectionsToPeer(p)
	out := make([]inet.Conn, len(conns1))
	for i, c := range conns1 {
		out[i] = inet.Conn(c)
	}
	return out
}

// ClosePeer connection to peer
func (n *Network) ClosePeer(p peer.ID) error {
	return n.Swarm().CloseConnection(p)
}

// close is the real teardown function
func (n *Network) close() error {
	return n.Swarm().Close()
}

// Close calls the ContextCloser func
func (n *Network) Close() error {
	return n.Swarm().cg.Close()
}

// Listen tells the network to start listening on given multiaddrs.
func (n *Network) Listen(addrs ...ma.Multiaddr) error {
	return n.Swarm().Listen(addrs...)
}

// ListenAddresses returns a list of addresses at which this network listens.
func (n *Network) ListenAddresses() []ma.Multiaddr {
	return n.Swarm().ListenAddresses()
}

// InterfaceListenAddresses returns a list of addresses at which this network
// listens. It expands "any interface" addresses (/ip4/0.0.0.0, /ip6/::) to
// use the known local interfaces.
func (n *Network) InterfaceListenAddresses() ([]ma.Multiaddr, error) {
	return n.Swarm().InterfaceListenAddresses()
}

// Connectedness returns a state signaling connection capabilities
// For now only returns Connected || NotConnected. Expand into more later.
func (n *Network) Connectedness(p peer.ID) inet.Connectedness {
	c := n.Swarm().ConnectionsToPeer(p)
	if c != nil && len(c) > 0 {
		return inet.Connected
	}
	return inet.NotConnected
}

// NewStream returns a new stream to given peer p.
// If there is no connection to p, attempts to create one.
func (n *Network) NewStream(p peer.ID) (inet.Stream, error) {
	log.Debugf("[%s] network opening stream to peer [%s]", n.local, p)
	s, err := n.Swarm().NewStreamWithPeer(p)
	if err != nil {
		return nil, err
	}

	return inet.Stream(s), nil
}

// SetHandler sets the protocol handler on the Network's Muxer.
// This operation is threadsafe.
func (n *Network) SetStreamHandler(h inet.StreamHandler) {
	n.Swarm().SetStreamHandler(h)
}

// SetConnHandler sets the conn handler on the Network.
// This operation is threadsafe.
func (n *Network) SetConnHandler(h inet.ConnHandler) {
	n.Swarm().SetConnHandler(func(c *Conn) {
		h(inet.Conn(c))
	})
}

// String returns a string representation of Network.
func (n *Network) String() string {
	return fmt.Sprintf("<Network %s>", n.LocalPeer())
}

// Notify signs up Notifiee to receive signals when events happen
func (n *Network) Notify(f inet.Notifiee) {
	n.Swarm().Notify(f)
}

// StopNotify unregisters Notifiee fromr receiving signals
func (n *Network) StopNotify(f inet.Notifiee) {
	n.Swarm().StopNotify(f)
}

redpajama_set_name: RedPajamaGithub


text:
#include <aws/core/utils/crypto/commoncrypto/CryptoImpl.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/Outcome.h>

#include <CommonCrypto/CommonDigest.h>
#include <CommonCrypto/CommonHMAC.h>
#include <CommonCrypto/CommonCryptor.h>
#include <CommonCrypto/CommonSymmetricKeywrap.h>

//for OSX < 10.10 compatibility
typedef int32_t CCStatus;
typedef int32_t CCCryptorStatus;

namespace Aws
{
    namespace Utils
    {
        namespace Crypto
        {
            static const char* CC_LOG_TAG = "CommonCryptoImpl";

            SecureRandomBytes_CommonCrypto::SecureRandomBytes_CommonCrypto()
            {
                fp = fopen("/dev/random", "r");

                if(!fp)
                {
                    m_failure = true;

                }
            }

            SecureRandomBytes_CommonCrypto::~SecureRandomBytes_CommonCrypto()
            {
                if(fp)
                {
                    fclose(fp);
                }
            }

            /**
             * https://developer.apple.com/library/ios/documentation/Security/Conceptual/cryptoservices/RandomNumberGenerationAPIs/RandomNumberGenerationAPIs.html
             *  This is not thread safe. If you need thread safety, it is your responsibility.
             */
            void SecureRandomBytes_CommonCrypto::GetBytes(unsigned char* buffer, size_t bufferSize)
            {
                assert(buffer);

                if(!fp)
                {
                    m_failure = true;
                }

                size_t read = fread(buffer, sizeof(unsigned char), bufferSize, fp);

                if(read != bufferSize)
                {
                    m_failure = true;
                }
            }

            HashResult MD5CommonCryptoImpl::Calculate(const Aws::String& str)
            {
                ByteBuffer hash(CC_MD5_DIGEST_LENGTH);
                CC_MD5(str.c_str(), static_cast<CC_LONG>(str.length()), hash.GetUnderlyingData());

                return HashResult(std::move(hash));
            }

            HashResult MD5CommonCryptoImpl::Calculate(Aws::IStream& stream)
            {
                CC_MD5_CTX md5;
                CC_MD5_Init(&md5);

                auto currentPos = stream.tellg();
                stream.seekg(0, stream.beg);

                char streamBuffer[Aws::Utils::Crypto::Hash::INTERNAL_HASH_STREAM_BUFFER_SIZE];
                while(stream.good())
                {
                    stream.read(streamBuffer, Aws::Utils::Crypto::Hash::INTERNAL_HASH_STREAM_BUFFER_SIZE);
                    auto bytesRead = stream.gcount();

                    if(bytesRead > 0)
                    {
                        CC_MD5_Update(&md5, streamBuffer, static_cast<CC_LONG>(bytesRead));
                    }
                }

                stream.clear();
                stream.seekg(currentPos, stream.beg);

                ByteBuffer hash(CC_MD5_DIGEST_LENGTH);
                CC_MD5_Final(hash.GetUnderlyingData(), &md5);

                return HashResult(std::move(hash));
            }

            HashResult Sha256CommonCryptoImpl::Calculate(const Aws::String& str)
            {
                ByteBuffer hash(CC_SHA256_DIGEST_LENGTH);
                CC_SHA256(str.c_str(), static_cast<CC_LONG>(str.length()), hash.GetUnderlyingData());

                return HashResult(std::move(hash));
            }

            HashResult Sha256CommonCryptoImpl::Calculate(Aws::IStream& stream)
            {
                CC_SHA256_CTX sha256;
                CC_SHA256_Init(&sha256);

                auto currentPos = stream.tellg();
                stream.seekg(0, stream.beg);

                char streamBuffer[Aws::Utils::Crypto::Hash::INTERNAL_HASH_STREAM_BUFFER_SIZE];
                while(stream.good())
                {
                    stream.read(streamBuffer, Aws::Utils::Crypto::Hash::INTERNAL_HASH_STREAM_BUFFER_SIZE);
                    auto bytesRead = stream.gcount();

                    if(bytesRead > 0)
                    {
                        CC_SHA256_Update(&sha256, streamBuffer, static_cast<CC_LONG>(bytesRead));
                    }
                }

                stream.clear();
                stream.seekg(currentPos, stream.beg);

                ByteBuffer hash(CC_SHA256_DIGEST_LENGTH);
                CC_SHA256_Final(hash.GetUnderlyingData(), &sha256);

                return HashResult(std::move(hash));
            }

            HashResult Sha256HMACCommonCryptoImpl::Calculate(const ByteBuffer& toSign, const ByteBuffer& secret)
            {
                unsigned int length = CC_SHA256_DIGEST_LENGTH;
                ByteBuffer digest(length);
                std::memset(digest.GetUnderlyingData(), 0, length);

                CCHmac(kCCHmacAlgSHA256, secret.GetUnderlyingData(), secret.GetLength(), toSign.GetUnderlyingData(), toSign.GetLength(), digest.GetUnderlyingData());

                return HashResult(std::move(digest));
            }

            CommonCryptoCipher::CommonCryptoCipher(const CryptoBuffer& key, size_t ivSizeBytes, bool ctrMode) :
                    SymmetricCipher(key, ivSizeBytes, ctrMode), m_encryptorHandle(nullptr), m_decryptorHandle(nullptr)
            {
                Init();
            }

            CommonCryptoCipher::CommonCryptoCipher(CommonCryptoCipher&& toMove) : SymmetricCipher(std::move(toMove))
            {
                m_encryptorHandle = toMove.m_encryptorHandle;
                toMove.m_encryptorHandle = nullptr;
                m_decryptorHandle = toMove.m_decryptorHandle;
                toMove.m_decryptorHandle = nullptr;
            }

            CommonCryptoCipher::CommonCryptoCipher(CryptoBuffer&& key, CryptoBuffer&& initializationVector, CryptoBuffer&& tag) :
                    SymmetricCipher(std::move(key), std::move(initializationVector), std::move(tag)),
                    m_encryptorHandle(nullptr), m_decryptorHandle(nullptr)
            {
                Init();
            }

            CommonCryptoCipher::CommonCryptoCipher(const CryptoBuffer& key, const CryptoBuffer& initializationVector,
                                         const CryptoBuffer& tag) :
                    SymmetricCipher(key, initializationVector, tag),
                    m_encryptorHandle(nullptr), m_decryptorHandle(nullptr)
            {
                Init();
            }

            CommonCryptoCipher::~CommonCryptoCipher()
            {
                if (m_encryptorHandle)
                {
                    CCCryptorRelease(m_encryptorHandle);
                }
                if (m_decryptorHandle)
                {
                    CCCryptorRelease(m_decryptorHandle);
                }
            }

            void CommonCryptoCipher::Init()
            {

            }

            CryptoBuffer CommonCryptoCipher::EncryptBuffer(const CryptoBuffer& unEncryptedData)
            {
                if (m_failure)
                {
                    AWS_LOGSTREAM_FATAL(CC_LOG_TAG, "Cipher not properly initialized for encryption. Aborting");
                    return CryptoBuffer();
                }

                size_t lengthWritten = unEncryptedData.GetLength() + (GetBlockSizeBytes() - 1);
                CryptoBuffer encryptedText(static_cast<size_t>( lengthWritten + (GetBlockSizeBytes() - 1)));

                CCStatus status = CCCryptorUpdate(m_encryptorHandle, unEncryptedData.GetUnderlyingData(), unEncryptedData.GetLength(),
                                                  encryptedText.GetUnderlyingData(), encryptedText.GetLength(), &lengthWritten);

                if (status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(CC_LOG_TAG, "Encryption of buffer failed with status code: " << status);
                    return CryptoBuffer();
                }

                if (lengthWritten < encryptedText.GetLength())
                {
                    return CryptoBuffer(encryptedText.GetUnderlyingData(), lengthWritten);
                }

                return encryptedText;
            }

            CryptoBuffer CommonCryptoCipher::FinalizeEncryption()
            {
                if (m_failure)
                {
                    AWS_LOGSTREAM_FATAL(CC_LOG_TAG,
                                        "Cipher not properly initialized for encryption finalization. Aborting");
                    return CryptoBuffer();
                }

                CryptoBuffer finalBlock(GetBlockSizeBytes());
                size_t writtenSize = 0;

                CCStatus status = CCCryptorFinal(m_encryptorHandle, finalBlock.GetUnderlyingData(), finalBlock.GetLength(), &writtenSize);
                if (status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(CC_LOG_TAG, "Decryption of buffer failed with status code: " << status);
                    return CryptoBuffer();
                }

                return CryptoBuffer(finalBlock.GetUnderlyingData(), writtenSize);
            }

            CryptoBuffer CommonCryptoCipher::DecryptBuffer(const CryptoBuffer& encryptedData)
            {
                if (m_failure)
                {
                    AWS_LOGSTREAM_FATAL(CC_LOG_TAG, "Cipher not properly initialized for decryption. Aborting");
                    return CryptoBuffer();
                }

                size_t lengthWritten = encryptedData.GetLength() + (GetBlockSizeBytes() - 1);
                CryptoBuffer decryptedText(static_cast<size_t>(lengthWritten));

                CCStatus status = CCCryptorUpdate(m_decryptorHandle, encryptedData.GetUnderlyingData(), encryptedData.GetLength(),
                    decryptedText.GetUnderlyingData(), decryptedText.GetLength(), &lengthWritten);

                if (status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(CC_LOG_TAG, "Decryption of buffer failed with status code: " << status);
                    return CryptoBuffer();
                }

                if (lengthWritten < decryptedText.GetLength())
                {
                    return CryptoBuffer(decryptedText.GetUnderlyingData(), static_cast<size_t>(lengthWritten));
                }

                return decryptedText;
            }

            CryptoBuffer CommonCryptoCipher::FinalizeDecryption()
            {
                if (m_failure)
                {
                    AWS_LOGSTREAM_FATAL(CC_LOG_TAG,
                                        "Cipher not properly initialized for decryption finalization. Aborting");
                    return CryptoBuffer();
                }

                CryptoBuffer finalBlock(GetBlockSizeBytes());
                size_t writtenSize = static_cast<int>(finalBlock.GetLength());
                CCStatus status = CCCryptorFinal(m_decryptorHandle, finalBlock.GetUnderlyingData(), finalBlock.GetLength(), &writtenSize);
                if (status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(CC_LOG_TAG, "Decryption of buffer failed with status code: " << status);
                    return CryptoBuffer();
                }
                return CryptoBuffer(finalBlock.GetUnderlyingData(), writtenSize);
            }

            void CommonCryptoCipher::Reset()
            {
                m_failure = false;

                if (m_encryptorHandle)
                {
                    CCCryptorRelease(m_encryptorHandle);
                }
                if (m_decryptorHandle)
                {
                    CCCryptorRelease(m_decryptorHandle);
                }

                m_encryptorHandle = nullptr;
                m_decryptorHandle = nullptr;
                Init();
            }

            size_t AES_CBC_Cipher_CommonCrypto::BlockSizeBytes = 16;
            size_t AES_CBC_Cipher_CommonCrypto::KeyLengthBits = 256;
            static const char* CBC_CC_LOG_TAG = "AES_CBC_Cipher_CommonCrypto";

            AES_CBC_Cipher_CommonCrypto::AES_CBC_Cipher_CommonCrypto(const CryptoBuffer& key) : CommonCryptoCipher(key, BlockSizeBytes)
            {
                InitCipher();
            }

            AES_CBC_Cipher_CommonCrypto::AES_CBC_Cipher_CommonCrypto(CryptoBuffer&& key, CryptoBuffer&& initializationVector) :
                    CommonCryptoCipher(std::move(key), std::move(initializationVector))
            {
                InitCipher();
            }

            AES_CBC_Cipher_CommonCrypto::AES_CBC_Cipher_CommonCrypto(const CryptoBuffer& key,
                                                           const CryptoBuffer& initializationVector) :
                    CommonCryptoCipher(key, initializationVector)
            {
                InitCipher();
            }

            void AES_CBC_Cipher_CommonCrypto::InitCipher()
            {
                CCCryptorStatus status = CCCryptorCreateWithMode(kCCEncrypt, kCCModeCBC, kCCAlgorithmAES, ccPKCS7Padding,
                                                                 m_initializationVector.GetUnderlyingData(), m_key.GetUnderlyingData(), m_key.GetLength(),
                                                                 nullptr, 0, 0, 0, &m_encryptorHandle);
                if (status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(CBC_CC_LOG_TAG, "Error while initializing AES 256 CBC encryptor. Status code: " << status);
                }

                status = CCCryptorCreateWithMode(kCCDecrypt, kCCModeCBC, kCCAlgorithmAES, ccPKCS7Padding,
                                                 m_initializationVector.GetUnderlyingData(), m_key.GetUnderlyingData(), m_key.GetLength(),
                                                 nullptr, 0, 0, 0, &m_decryptorHandle);
                if (status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(CBC_CC_LOG_TAG, "Error while initializing AES 256 CBC decryptor. Status code: " << status);
                }

            }

            size_t AES_CBC_Cipher_CommonCrypto::GetBlockSizeBytes() const
            {
                return BlockSizeBytes;
            }

            size_t AES_CBC_Cipher_CommonCrypto::GetKeyLengthBits() const
            {
                return KeyLengthBits;
            }

            void AES_CBC_Cipher_CommonCrypto::Reset()
            {
                CommonCryptoCipher::Reset();
                InitCipher();
            }

            size_t AES_CTR_Cipher_CommonCrypto::BlockSizeBytes = 16;
            size_t AES_CTR_Cipher_CommonCrypto::KeyLengthBits = 256;
            static const char* CTR_CC_LOG_TAG = "AES_CTR_Cipher_CommonCrypto";

            AES_CTR_Cipher_CommonCrypto::AES_CTR_Cipher_CommonCrypto(const CryptoBuffer& key) :
                    CommonCryptoCipher(key, BlockSizeBytes, true)
            {
                InitCipher();
            }

            AES_CTR_Cipher_CommonCrypto::AES_CTR_Cipher_CommonCrypto(CryptoBuffer&& key, CryptoBuffer&& initializationVector) :
                    CommonCryptoCipher(std::move(key), std::move(initializationVector))
            {
                InitCipher();
            }

            AES_CTR_Cipher_CommonCrypto::AES_CTR_Cipher_CommonCrypto(const CryptoBuffer& key,
                                                           const CryptoBuffer& initializationVector) :
                    CommonCryptoCipher(key, initializationVector)
            {
                InitCipher();
            }

            void AES_CTR_Cipher_CommonCrypto::InitCipher()
            {
                CCCryptorStatus status = CCCryptorCreateWithMode(kCCEncrypt, kCCModeCTR, kCCAlgorithmAES, ccNoPadding,
                                                                 m_initializationVector.GetUnderlyingData(), m_key.GetUnderlyingData(), m_key.GetLength(),
                                                                 nullptr, 0, 0, kCCModeOptionCTR_BE, &m_encryptorHandle);
                if (status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(CTR_CC_LOG_TAG, "Error while initializing AES 256 CTR encryptor. Status code: " << status);
                }

                status = CCCryptorCreateWithMode(kCCDecrypt, kCCModeCTR, kCCAlgorithmAES, ccNoPadding,
                                                 m_initializationVector.GetUnderlyingData(), m_key.GetUnderlyingData(), m_key.GetLength(),
                                                 nullptr, 0, 0, kCCModeOptionCTR_BE, &m_decryptorHandle);
                if (status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(CTR_CC_LOG_TAG, "Error while initializing AES 256 CTR decryptor. Status code: " << status);
                }
            }

            size_t AES_CTR_Cipher_CommonCrypto::GetBlockSizeBytes() const
            {
                return BlockSizeBytes;
            }

            size_t AES_CTR_Cipher_CommonCrypto::GetKeyLengthBits() const
            {
                return KeyLengthBits;
            }

            void AES_CTR_Cipher_CommonCrypto::Reset()
            {
                CommonCryptoCipher::Reset();
                InitCipher();
            }

            static const char* const AES_KEY_WRAP_LOG_TAG = "AES_KeyWrap_Cipher_CommonCrypto";
            size_t AES_KeyWrap_Cipher_CommonCrypto::BlockSizeBytes = 8;
            size_t AES_KeyWrap_Cipher_CommonCrypto::KeyLengthBits = 256;

            AES_KeyWrap_Cipher_CommonCrypto::AES_KeyWrap_Cipher_CommonCrypto(const CryptoBuffer& key) : CommonCryptoCipher(key, 0)
            { }

            CryptoBuffer AES_KeyWrap_Cipher_CommonCrypto::EncryptBuffer(const CryptoBuffer& unEncryptedData)
            {
                assert(!m_failure);

                m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*)&unEncryptedData});

                return CryptoBuffer();
            }

            CryptoBuffer AES_KeyWrap_Cipher_CommonCrypto::FinalizeEncryption()
            {
                if (m_failure)
                {
                    AWS_LOGSTREAM_FATAL(CC_LOG_TAG,
                                        "Cipher not properly initialized for encryption finalization. Aborting");
                    return CryptoBuffer();
                }

                if (m_workingKeyBuffer.GetLength() == 0)
                {
                    m_failure = true;
                    return CryptoBuffer();
                }

                size_t outputBufferLength = GetBlockSizeBytes() + m_workingKeyBuffer.GetLength();
                CryptoBuffer outputBuffer(outputBufferLength);

                CCCryptorStatus status = CCSymmetricKeyWrap(kCCWRAPAES, CCrfc3394_iv, CCrfc3394_ivLen, m_key.GetUnderlyingData(), m_key.GetLength(),
                    m_workingKeyBuffer.GetUnderlyingData(), m_workingKeyBuffer.GetLength(), outputBuffer.GetUnderlyingData(), &outputBufferLength);

                if(status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(AES_KEY_WRAP_LOG_TAG, "Key wrap failed with status code " << status);
                    return CryptoBuffer();
                }

                return outputBuffer;
            }

            CryptoBuffer AES_KeyWrap_Cipher_CommonCrypto::DecryptBuffer(const CryptoBuffer& encryptedData)
            {
                assert(!m_failure);

                m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*)&encryptedData});

                return CryptoBuffer();
            }

            CryptoBuffer AES_KeyWrap_Cipher_CommonCrypto::FinalizeDecryption()
            {
                if (m_failure)
                {
                    AWS_LOGSTREAM_FATAL(CC_LOG_TAG,
                                        "Cipher not properly initialized for decryption finalization. Aborting");
                    return CryptoBuffer();
                }

                if (m_workingKeyBuffer.GetLength() == 0)
                {
                    m_failure = true;
                    return CryptoBuffer();
                }

                size_t outputBufferLength = m_workingKeyBuffer.GetLength() - GetBlockSizeBytes();
                CryptoBuffer outputBuffer(outputBufferLength);

                CCCryptorStatus status = CCSymmetricKeyUnwrap(kCCWRAPAES, CCrfc3394_iv, CCrfc3394_ivLen, m_key.GetUnderlyingData(), m_key.GetLength(),
                                                            m_workingKeyBuffer.GetUnderlyingData(), m_workingKeyBuffer.GetLength(), outputBuffer.GetUnderlyingData(), &outputBufferLength);

                if(status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(AES_KEY_WRAP_LOG_TAG, "Key unwrap failed with status code " << status);
                    return CryptoBuffer();
                }

                return outputBuffer;
            }

            void AES_KeyWrap_Cipher_CommonCrypto::Reset()
            {
                CommonCryptoCipher::Reset();
                m_workingKeyBuffer = CryptoBuffer();
            }

        }
    }
}


text:
using UnityEngine;
using System.Collections;

public class Control : MonoBehaviour {

    [SerializeField]
    GameObject hud;
    [SerializeField]
    GameObject arrows;
    [SerializeField]
    GameObject dir;
    public bool willUseAccelerometer;
	[SerializeField]
	Car car;

    public void ChooseControl(bool willUse)
    {

        willUseAccelerometer = willUse;
        hud.SetActive(true);
        if(willUse)
        {
			car.accelerometerControl = true;
            arrows.SetActive(false);
            Debug.Log(arrows.activeSelf);
        }

        Time.timeScale = 1;
        dir.SetActive(false);
    }
}


text:
#ifndef CAFFE2_OPERATORS_SINUSOID_POSITION_ENCODING_OP_H_
#define CAFFE2_OPERATORS_SINUSOID_POSITION_ENCODING_OP_H_

#ifdef _MSC_VER
#define _USE_MATH_DEFINES
#endif // _MSC_VER
#include <cmath>

#include "caffe2/core/operator.h"

#include "Eigen/Core"

namespace caffe2 {

template <class Context>
class SinusoidPositionEncodingOp : public Operator<Context> {
 public:
  SinusoidPositionEncodingOp(const OperatorDef& operator_def, Workspace* ws)
      : Operator<Context>(operator_def, ws),
        embedding_size_(OperatorBase::template GetSingleArgument<int>(
            "embedding_size",
            100)),
        alpha_(OperatorBase::template GetSingleArgument<float>("alpha", 10000)),
        amplitude_(
            OperatorBase::template GetSingleArgument<float>("amplitude", 1)) {}
  USE_OPERATOR_CONTEXT_FUNCTIONS;

  bool RunOnDevice() override {
    return DispatchHelper<TensorTypes<int32_t, int64_t>>::call(
        this, OperatorBase::Input<TensorCPU>(0));
  }

  template <typename Index>
  bool DoRunWithType() {
    auto& positions = Input(0);
    auto* output = Output(0);

    CAFFE_ENFORCE_EQ(positions.ndim(), 2, "POSITIONS should be a 2-D tensor");

    auto shape = positions.dims();
    shape.push_back(embedding_size_);
    output->Resize(shape);

    int M = shape[0];
    int K = shape[1];
    const Index* idxs = positions.template data<Index>();
    float* out = output->template mutable_data<float>();

    float log_alpha = std::log(alpha_);
    float max_alpha_pow =
        ((float)embedding_size_ - 1.0f) / (float)embedding_size_;

    for (int i = 0; i < M; ++i) {
      float pos = (float)idxs[i * K];

      // Compute the embedding for position i, example 0 first
      float* row = &out[i * K * embedding_size_];
      Eigen::Map<Eigen::VectorXf> row_map(row, embedding_size_, 1);
      auto row_array = row_map.array();

      float log_pos = std::log(pos);
      row_array.setLinSpaced(
          embedding_size_, log_pos, log_pos - log_alpha * max_alpha_pow);
      row_array = row_array.exp().eval();
      // row_array[k] == pos / alpha^(k / embedding_size)

      // Phase shift so that alternating elements are cosines
      for (int k = 1; k < embedding_size_; k += 2) {
        row[k] += (float)M_PI_2;
      }
      row_array = amplitude_ * row_array.sin().eval();

      // Copy the embedding to position i in the other examples
      for (int j = 1; j < K; ++j) {
        int base = i * K * embedding_size_;
        std::copy(
            &out[base],
            &out[base + embedding_size_],
            &out[base + j * embedding_size_]);
      }
    }
    return true;
  }

 protected:
  int embedding_size_;
  float alpha_;
  float amplitude_;
};

} // namespace caffe2

#endif // CAFFE2_OPERATORS_SINUSOID_POSITION_ENCODING_OP_H_


text:
<?php

namespace PPI\Framework\Router;

use Symfony\Cmf\Component\Routing\ChainRouter as BaseChainRouter;
use Symfony\Component\HttpFoundation\Request;

/**
 * Class ChainRouter.
 *
 * @author Paul Dragoonis <paul@ppi.io>
 */
class ChainRouter extends BaseChainRouter
{
    /**
     * @var Request
     */
    protected $matchedRouteRequest;

    private $routingCache;

    /**
     * @param array $parameters
     *
     * @return string
     */
    public function parametersToString(array $parameters)
    {
        $pieces = array();
        foreach ($parameters as $key => $val) {
            $pieces[] = sprintf('"%s": "%s"', $key, (is_string($val) ? $val : json_encode($val)));
        }

        return implode(', ', $pieces);
    }

    /**
     * @return bool
     */
    public function hasRouters()
    {
        $routers = $this->sortRouters();

        return !empty($routers);
    }

    /**
     * @todo - might not need this afterall
     *
     * @return Request
     */
    public function getMatchedRouteRequest()
    {
        return $this->matchedRouteRequest;
    }

    /**
     * @param Request $request
     *
     * @throws \Exception
     */
    public function matchRequest(Request $request)
    {
        try {
            $parameters = parent::matchRequest($request);
            $this->matchedRouteRequest = $request;
            return $parameters;
        } catch (\Exception $e) {
            throw $e;
        }

    }

}


text:
package com.axxessio.oauth2.server.service;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import com.axxessio.oauth2.server.service.pdo.Role;
import com.axxessio.oauth2.server.service.pdo.SessionScope;
import com.axxessio.oauth2.server.service.pdo.User;

@Component
public class UserService {

	private static final EntityManagerFactory emf = Persistence.createEntityManagerFactory("OAuth2");
	private static final EntityManager em = emf.createEntityManager();
	private static final Logger logger = Logger.getLogger(TokenService.class);

	public SessionScope<String, String> getSessionScope (String username, String[] scopes) {
		// now we read rights base on scope parameter
		User user = getUser (username);

		if (user == null) return null;

		Role role = user.getRoles().iterator().next();
		SessionScope<String, String> sessionScope = new SessionScope<String, String>();

		if (role != null && scopes != null) {
			for (int i = 0; i < scopes.length; i++) {
				sessionScope.put(scopes[i], role.rightsToString(scopes[i]));
			}
		}

		return sessionScope;
	}

	public Role getRole(long roleId) {
		Query query = em.createNamedQuery("Role.findRoleByRoleId");
		query.setParameter(1, roleId);
		Role role = null;
		try {
			role = (Role) query.getSingleResult();
		} catch (Exception e) {
			logger.error("Problem - can not find role with id [" + roleId + "] in the database");
		}
		return role;
	}

	public Role getRole(String roleName) {
		Query query = em.createNamedQuery("Role.findRoleByRoleName");
		query.setParameter(1, roleName);
		Role role = null;
		try {
			role = (Role) query.getSingleResult();
		} catch (Exception e) {
			logger.warn("Problem - can not find role [" + roleName + "] in the database");
		}
		return role;
	}

	public User getUser (String name) {
		Query query = em.createNamedQuery("User.findUserByName");
		query.setParameter(1, name);
		User user = null;
		try {
			user = (User) query.getSingleResult();
		} catch (Exception e) {
			logger.warn("Problem - can not find user [" + name + "] in the database");
		}
		return user;
	}

}


text:
package org.spongepowered.api.entity;

import org.spongepowered.api.util.Identifiable;
import org.spongepowered.api.util.Nameable;

/**
 * Represents an entity which may tame other entities.
 */
public interface Tamer extends Identifiable, Nameable {
}


text:
    #pragma hdrstop
#endif

#include "wx/bitmap.h"
#include "wx/dcmemory.h"
#include "wx/dcgraph.h"
#include "wx/icon.h"
#include "wx/colour.h"
#include "wx/gdicmn.h"

// ----------------------------------------------------------------------------
// test class
// ----------------------------------------------------------------------------

class GCDCBoundingBoxTestCase : public CppUnit::TestCase
{
public:
    GCDCBoundingBoxTestCase()
    {
        m_bmp.Create(100, 100);
        m_dc.SelectObject(m_bmp);
        m_gcdc = new wxGCDC(m_dc);
    }

    ~GCDCBoundingBoxTestCase()
    {
        delete m_gcdc;
        m_dc.SelectObject(wxNullBitmap);
        m_bmp = wxNullBitmap;
    }

    virtual void setUp()
    {
        m_gcdc->ResetBoundingBox();
    }

private:
    wxBitmap m_bmp;
    wxMemoryDC m_dc;
    wxGCDC *m_gcdc;

    void AssertBox(int minX, int minY, int width, int height, int margin = 0)
    {
        int maxX = minX + width;
        int maxY = minY + height;

        // Allow for a margin of error due to different implementation
        // specificities regarding drawing paths.
        if ( margin )
        {
            #define WX_ASSERT_CLOSE(expected, actual, delta) \
                WX_ASSERT_MESSAGE(("%d != %d", actual, expected), \
                                  abs(actual - expected) <= delta)

            WX_ASSERT_CLOSE(minX, m_gcdc->MinX(), margin);
            WX_ASSERT_CLOSE(minY, m_gcdc->MinY(), margin);
            WX_ASSERT_CLOSE(maxX, m_gcdc->MaxX(), margin);
            WX_ASSERT_CLOSE(maxY, m_gcdc->MaxY(), margin);

            #undef WX_ASSERT_CLOSE
        }
        else
        {
            CPPUNIT_ASSERT_EQUAL(minX, m_gcdc->MinX());
            CPPUNIT_ASSERT_EQUAL(minY, m_gcdc->MinY());
            CPPUNIT_ASSERT_EQUAL(maxX, m_gcdc->MaxX());
            CPPUNIT_ASSERT_EQUAL(maxY, m_gcdc->MaxY());
        }
    }

    CPPUNIT_TEST_SUITE( GCDCBoundingBoxTestCase );
        CPPUNIT_TEST( DrawBitmap );
        CPPUNIT_TEST( DrawIcon );
        CPPUNIT_TEST( DrawLine );
        CPPUNIT_TEST( CrossHair );
        CPPUNIT_TEST( DrawArc );
        CPPUNIT_TEST( DrawEllipticArc );
        CPPUNIT_TEST( DrawPoint );
        CPPUNIT_TEST( DrawLines );
        #if wxUSE_SPLINES
            CPPUNIT_TEST( DrawSpline );
        #endif
        CPPUNIT_TEST( DrawPolygon );
        CPPUNIT_TEST( DrawPolyPolygon );
        CPPUNIT_TEST( DrawRectangle );
        CPPUNIT_TEST( DrawRoundedRectangle );
        CPPUNIT_TEST( DrawEllipse );
        CPPUNIT_TEST( Blit );
        CPPUNIT_TEST( StretchBlit );
        CPPUNIT_TEST( DrawRotatedText );
        CPPUNIT_TEST( DrawText );
        CPPUNIT_TEST( GradientFillLinear );
        CPPUNIT_TEST( GradientFillConcentric );
        CPPUNIT_TEST( DrawCheckMark );
    CPPUNIT_TEST_SUITE_END();

    void DrawBitmap();
    void DrawIcon();
    void DrawLine();
    void CrossHair();
    void DrawArc();
    void DrawEllipticArc();
    void DrawPoint();
    void DrawLines();
    #if wxUSE_SPLINES
        void DrawSpline();
    #endif
    void DrawPolygon();
    void DrawPolyPolygon();
    void DrawRectangle();
    void DrawRoundedRectangle();
    void DrawEllipse();
    void Blit();
    void StretchBlit();
    void DrawRotatedText();
    void DrawText();
    void GradientFillLinear();
    void GradientFillConcentric();
    void DrawCheckMark();

    wxDECLARE_NO_COPY_CLASS(GCDCBoundingBoxTestCase);
};

// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( GCDCBoundingBoxTestCase );

// also include in it's own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( GCDCBoundingBoxTestCase, "GCDCBoundingBoxTestCase" );

void GCDCBoundingBoxTestCase::DrawBitmap()
{
    wxBitmap bitmap;
    bitmap.Create(12, 12);

    m_gcdc->DrawBitmap(bitmap, 5, 5);
    AssertBox(5, 5, 12, 12);
}

void GCDCBoundingBoxTestCase::DrawIcon()
{
    wxBitmap bitmap;
    bitmap.Create(16, 16);
    wxIcon icon;
    icon.CopyFromBitmap(bitmap);

    m_gcdc->DrawIcon(icon, 42, 42);
    AssertBox(42, 42, 16, 16);
}

void GCDCBoundingBoxTestCase::DrawLine()
{
    m_gcdc->DrawLine(10, 10, 20, 15);
    AssertBox(10, 10, 10, 5);
}

void GCDCBoundingBoxTestCase::CrossHair()
{
    int w, h;
    m_gcdc->GetSize(&w, &h);

    m_gcdc->CrossHair(33, 33);
    AssertBox(0, 0, w, h);
}

void GCDCBoundingBoxTestCase::DrawArc()
{
    m_gcdc->DrawArc(25, 30, 15, 40, 25, 40);  // quarter circle
    AssertBox(15, 30, 10, 10, 3);
}

void GCDCBoundingBoxTestCase::DrawEllipticArc()
{
    m_gcdc->DrawEllipticArc(40, 50, 30, 20, 0, 180);  // half circle
    AssertBox(40, 50, 30, 10, 3);
}

void GCDCBoundingBoxTestCase::DrawPoint()
{
    m_gcdc->DrawPoint(20, 20);
    AssertBox(20, 20, 1, 1);
}

void GCDCBoundingBoxTestCase::DrawLines()
{
    wxPoint points[4];
    points[0] = wxPoint(10, 20);
    points[1] = wxPoint(20, 10);
    points[2] = wxPoint(30, 20);
    points[3] = wxPoint(20, 30);

    m_gcdc->DrawLines(4, points, 7, 8);
    AssertBox(17, 18, 20, 20);
}

#if wxUSE_SPLINES
void GCDCBoundingBoxTestCase::DrawSpline()
{
    wxPoint points[3];
    points[0] = wxPoint(10, 30);
    points[1] = wxPoint(20, 20);
    points[2] = wxPoint(40, 50);

    m_gcdc->DrawSpline(3, points);
    AssertBox(10, 20, 30, 30, 5);
}
#endif  // wxUSE_SPLINES

void GCDCBoundingBoxTestCase::DrawPolygon()
{
    wxPoint points[3];
    points[0] = wxPoint(10, 30);
    points[1] = wxPoint(20, 10);
    points[2] = wxPoint(30, 30);

    m_gcdc->DrawPolygon(3, points, -5, -7);
    AssertBox(5, 3, 20, 20);
}

void GCDCBoundingBoxTestCase::DrawPolyPolygon()
{
    int lenghts[2];
    lenghts[0] = 3;
    lenghts[1] = 3;
    wxPoint points[6];
    points[0] = wxPoint(10, 30);
    points[1] = wxPoint(20, 10);
    points[2] = wxPoint(30, 30);
    points[3] = wxPoint(20, 60);
    points[4] = wxPoint(30, 40);
    points[5] = wxPoint(40, 60);

    m_gcdc->DrawPolyPolygon(2, lenghts, points, 12, 5);
    AssertBox(22, 15, 30, 50, 4);
}

void GCDCBoundingBoxTestCase::DrawRectangle()
{
    m_gcdc->DrawRectangle(2, 2, 12, 12);
    AssertBox(2, 2, 12, 12);
}

void GCDCBoundingBoxTestCase::DrawRoundedRectangle()
{
    m_gcdc->DrawRoundedRectangle(27, 27, 12, 12, 2);
    AssertBox(27, 27, 12, 12);
}

void GCDCBoundingBoxTestCase::DrawEllipse()
{
    m_gcdc->DrawEllipse(54, 45, 23, 12);
    AssertBox(54, 45, 23, 12);
}

void GCDCBoundingBoxTestCase::Blit()
{
    wxBitmap bitmap;
    bitmap.Create(20, 20);
    wxMemoryDC dc(bitmap);

    m_gcdc->Blit(20, 10, 12, 7, &dc, 0, 0);
    AssertBox(20, 10, 12, 7);

    dc.SelectObject(wxNullBitmap);
}

void GCDCBoundingBoxTestCase::StretchBlit()
{
    wxBitmap bitmap;
    bitmap.Create(20, 20);
    wxMemoryDC dc(bitmap);

    m_gcdc->StretchBlit(30, 50, 5, 5, &dc, 0, 0, 12, 4);
    AssertBox(30, 50, 5, 5);

    dc.SelectObject(wxNullBitmap);
}

void GCDCBoundingBoxTestCase::DrawRotatedText()
{
    wxString text("vertical");
    wxCoord w, h;
    m_gcdc->GetTextExtent(text, &w, &h);

    m_gcdc->DrawRotatedText(text, 43, 22, -90);
    AssertBox(43 - h, 22, h, w, 3);
}

void GCDCBoundingBoxTestCase::DrawText()
{
    wxString text("H");
    wxCoord w, h;
    m_gcdc->GetTextExtent(text, &w, &h);

    m_gcdc->DrawText(text, 3, 3);
    AssertBox(3, 3, w, h, 3);
}

void GCDCBoundingBoxTestCase::GradientFillLinear()
{
    wxRect rect(16, 16, 30, 40);
    m_gcdc->GradientFillLinear(rect, *wxWHITE, *wxBLACK, wxNORTH);
    AssertBox(16, 16, 30, 40);
}

void GCDCBoundingBoxTestCase::GradientFillConcentric()
{
    wxRect rect(6, 6, 30, 40);
    m_gcdc->GradientFillConcentric(rect, *wxWHITE, *wxBLACK, wxPoint(10, 10));
    AssertBox(6, 6, 30, 40);
}

void GCDCBoundingBoxTestCase::DrawCheckMark()
{
    m_gcdc->DrawCheckMark(32, 24, 16, 16);
    AssertBox(32, 24, 16, 16);
}


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using MicroOrm.Dapper.Repositories.Extensions;

namespace MicroOrm.Dapper.Repositories
{
    public partial class DapperRepository<TEntity>
        where TEntity : class
    {
        /// <inheritdoc />
        public bool BulkUpsert(IEnumerable<TEntity> instances)
        {
            return BulkUpsert(instances, null);
        }

        /// <inheritdoc />
        public async Task<bool> BulkUpsertAsync(IEnumerable<TEntity> instances)
        {
            return await BulkUpsertAsync(instances, null);
        }

        /// <inheritdoc />
        public bool BulkUpsert(IEnumerable<TEntity> instances, IDbTransaction transaction)
        {
            var queryResult = SqlGenerator.GetBulkUpSert(instances);
            var result = TransientDapperExtentions.ExecuteWithRetry(() => Connection.Execute(queryResult.GetSql(), null, transaction)) > 0;
            return result;
        }

        /// <inheritdoc />
        public async Task<bool> BulkUpsertAsync(IEnumerable<TEntity> instances, IDbTransaction transaction)
        {
            var queryResult = SqlGenerator.GetBulkUpSert(instances);
            var result = (await TransientDapperExtentions.ExecuteWithRetryAsync(() => Connection.ExecuteAsync(queryResult.GetSql(), null, transaction))) > 0;
            return result;
        }
    }
}


text:
#pragma checksum "D:\Minh Thái\My Documents\University HCMUS\WP8 Apps\GoMusic\GoMusic\GoMusic\Views\LightTheme\NowPlayingPage_Square.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "1C4B071002D787DB10BE47BC9C762E83"
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.34014
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using Coding4Fun.Toolkit.Controls;
using GoMusic.MyControls;
using Microsoft.Phone.Controls;
using System;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Resources;
using System.Windows.Shapes;
using System.Windows.Threading;
using Telerik.Windows.Controls;

namespace GoMusic.Views.LightTheme {

    public partial class NowPlayingPage_Square : Microsoft.Phone.Controls.PhoneApplicationPage {

        internal System.Windows.Media.Animation.Storyboard DiskSpin;

        internal System.Windows.Controls.Grid LayoutRoot;

        internal System.Windows.VisualStateGroup SongMenuStates;

        internal System.Windows.VisualState ToSongList;

        internal System.Windows.VisualState ToSongCover;

        internal System.Windows.VisualStateGroup TrayVolumeStates;

        internal System.Windows.VisualState TrayVolumeOpened;

        internal System.Windows.VisualState TrayVolumeClosed;

        internal System.Windows.VisualStateGroup LyricsStates;

        internal System.Windows.VisualState LyricsOpened;

        internal System.Windows.VisualState LyricsClosed;

        internal System.Windows.Controls.Grid grid_Tray;

        internal System.Windows.Controls.Grid grid_TrayInfo;

        internal Coding4Fun.Toolkit.Controls.SuperImage ImageTrayCover;

        internal System.Windows.Documents.Run RunSong;

        internal System.Windows.Documents.Run RunArtist;

        internal System.Windows.Controls.Button ButtonTrayPrevious;

        internal System.Windows.Controls.Button ButtonTrayPlay;

        internal System.Windows.Controls.Button ButtonTrayPause;

        internal System.Windows.Controls.Button ButtonTrayNext;

        internal System.Windows.Controls.Grid grid_TrayVolume;

        internal System.Windows.Controls.TextBlock TextBlockVolume;

        internal System.Windows.Controls.Slider SliderVolume;

        internal System.Windows.Controls.Button ButtonTrayVolumeClose;

        internal System.Windows.Controls.Grid grid_MainContent;

        internal System.Windows.Controls.Grid grid_Song;

        internal System.Windows.Controls.StackPanel StackPanelPivotIndicator;

        internal Microsoft.Phone.Controls.Pivot MainPivot;

        internal System.Windows.Controls.TextBlock TextBlockLyrics;

        internal System.Windows.Controls.TextBlock TextblockLyricsStatus;

        internal System.Windows.Controls.Grid grid_SongCover;

        internal GoMusic.MyControls.MusicAlbum musicAlbum;

        internal System.Windows.Controls.Grid grid_PlayingSongs;

        internal Telerik.Windows.Controls.RadDataBoundListBox rad_PlayingSongs;

        internal System.Windows.Controls.TextBlock TextBlockSongInfo;

        internal System.Windows.Controls.Slider SliderSongSeeker;

        internal System.Windows.Controls.TextBlock TextBlockPlayingTime;

        internal System.Windows.Controls.TextBlock TextBlockTotalTime;

        internal System.Windows.Controls.Button ButtonRepeat;

        internal System.Windows.Controls.Button ButtonShuffle;

        internal System.Windows.Controls.Grid GridStatus;

        internal System.Windows.Controls.TextBlock tb_Status;

        private bool _contentLoaded;

        /// <summary>
        /// InitializeComponent
        /// </summary>
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public void InitializeComponent() {
            if (_contentLoaded) {
                return;
            }
            _contentLoaded = true;
            System.Windows.Application.LoadComponent(this, new System.Uri("/GoMusic;component/Views/LightTheme/NowPlayingPage_Square.xaml", System.UriKind.Relative));
            this.DiskSpin = ((System.Windows.Media.Animation.Storyboard)(this.FindName("DiskSpin")));
            this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
            this.SongMenuStates = ((System.Windows.VisualStateGroup)(this.FindName("SongMenuStates")));
            this.ToSongList = ((System.Windows.VisualState)(this.FindName("ToSongList")));
            this.ToSongCover = ((System.Windows.VisualState)(this.FindName("ToSongCover")));
            this.TrayVolumeStates = ((System.Windows.VisualStateGroup)(this.FindName("TrayVolumeStates")));
            this.TrayVolumeOpened = ((System.Windows.VisualState)(this.FindName("TrayVolumeOpened")));
            this.TrayVolumeClosed = ((System.Windows.VisualState)(this.FindName("TrayVolumeClosed")));
            this.LyricsStates = ((System.Windows.VisualStateGroup)(this.FindName("LyricsStates")));
            this.LyricsOpened = ((System.Windows.VisualState)(this.FindName("LyricsOpened")));
            this.LyricsClosed = ((System.Windows.VisualState)(this.FindName("LyricsClosed")));
            this.grid_Tray = ((System.Windows.Controls.Grid)(this.FindName("grid_Tray")));
            this.grid_TrayInfo = ((System.Windows.Controls.Grid)(this.FindName("grid_TrayInfo")));
            this.ImageTrayCover = ((Coding4Fun.Toolkit.Controls.SuperImage)(this.FindName("ImageTrayCover")));
            this.RunSong = ((System.Windows.Documents.Run)(this.FindName("RunSong")));
            this.RunArtist = ((System.Windows.Documents.Run)(this.FindName("RunArtist")));
            this.ButtonTrayPrevious = ((System.Windows.Controls.Button)(this.FindName("ButtonTrayPrevious")));
            this.ButtonTrayPlay = ((System.Windows.Controls.Button)(this.FindName("ButtonTrayPlay")));
            this.ButtonTrayPause = ((System.Windows.Controls.Button)(this.FindName("ButtonTrayPause")));
            this.ButtonTrayNext = ((System.Windows.Controls.Button)(this.FindName("ButtonTrayNext")));
            this.grid_TrayVolume = ((System.Windows.Controls.Grid)(this.FindName("grid_TrayVolume")));
            this.TextBlockVolume = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlockVolume")));
            this.SliderVolume = ((System.Windows.Controls.Slider)(this.FindName("SliderVolume")));
            this.ButtonTrayVolumeClose = ((System.Windows.Controls.Button)(this.FindName("ButtonTrayVolumeClose")));
            this.grid_MainContent = ((System.Windows.Controls.Grid)(this.FindName("grid_MainContent")));
            this.grid_Song = ((System.Windows.Controls.Grid)(this.FindName("grid_Song")));
            this.StackPanelPivotIndicator = ((System.Windows.Controls.StackPanel)(this.FindName("StackPanelPivotIndicator")));
            this.MainPivot = ((Microsoft.Phone.Controls.Pivot)(this.FindName("MainPivot")));
            this.TextBlockLyrics = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlockLyrics")));
            this.TextblockLyricsStatus = ((System.Windows.Controls.TextBlock)(this.FindName("TextblockLyricsStatus")));
            this.grid_SongCover = ((System.Windows.Controls.Grid)(this.FindName("grid_SongCover")));
            this.musicAlbum = ((GoMusic.MyControls.MusicAlbum)(this.FindName("musicAlbum")));
            this.grid_PlayingSongs = ((System.Windows.Controls.Grid)(this.FindName("grid_PlayingSongs")));
            this.rad_PlayingSongs = ((Telerik.Windows.Controls.RadDataBoundListBox)(this.FindName("rad_PlayingSongs")));
            this.TextBlockSongInfo = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlockSongInfo")));
            this.SliderSongSeeker = ((System.Windows.Controls.Slider)(this.FindName("SliderSongSeeker")));
            this.TextBlockPlayingTime = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlockPlayingTime")));
            this.TextBlockTotalTime = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlockTotalTime")));
            this.ButtonRepeat = ((System.Windows.Controls.Button)(this.FindName("ButtonRepeat")));
            this.ButtonShuffle = ((System.Windows.Controls.Button)(this.FindName("ButtonShuffle")));
            this.GridStatus = ((System.Windows.Controls.Grid)(this.FindName("GridStatus")));
            this.tb_Status = ((System.Windows.Controls.TextBlock)(this.FindName("tb_Status")));
        }
    }
}


text:
<?php

require_once 'MvcTemplateTiein/tests/testfiles/testclasses.php';

/**
 * Test the handler classes.
 *
 * @package MvcTemplateTiein
 * @subpackage Tests
 */
class ezcMvcTemplateViewTest extends ezcTestCase
{
    function setUp()
    {
        $this->baseDir = dirname( __FILE__ ) . '/../testfiles/views/template/';
    }

    function testSimpleView()
    {
        $view = new ezcMvcTemplateViewHandler( 'test1', $this->baseDir . 'simple.ezt' );
        $view->send( 'name', 'Churchill' );
        $view->send( 'quote', '"Genius is independent of situation."' );
        $view->process( true );

        self::assertEquals( file_get_contents( $this->baseDir . 'simple.ezt.txt' ), $view->getResult() );
    }

    public function testOneView()
    {
        $request = new ezcMvcRequest;
        $result  = new ezcMvcResult;
        $result->variables = array( 'name' => 'Churchill', 'quote' => '"If you are going through hell, keep going."' );

        $view    = new testOneTemplateView( $request, $result );
        $response = $view->createResponse();

        self::assertEquals( file_get_contents( $this->baseDir . 'oneview.ezt.txt' ), $response->body );
    }

    public function testTwoViews()
    {
        $request = new ezcMvcRequest;
        $result  = new ezcMvcResult;
        $result->variables = array(
            'name' => 'Churchill',
            'quote' => '"If you are going through hell, keep going."',
            'navMaxPages' => 5,
            'navCurrentPage' => 2
        );

        $view    = new testTwoTemplateViews( $request, $result );
        $response = $view->createResponse();

        self::assertEquals( file_get_contents( $this->baseDir . 'twoviews.ezt.txt' ), $response->body );
    }

    public function testNonExistingFile()
    {
        $request = new ezcMvcRequest;
        $result  = new ezcMvcResult;
        $result->variables = array(
            'name' => 'Churchill',
            'quote' => '"If you are going through hell, keep going."',
            'navMaxPages' => 5,
            'navCurrentPage' => 2
        );

        $view    = new testNonExistingTemplateView( $request, $result );

        $dir = dirname( __FILE__ );
        $dir = realpath( "$dir/.." );

        try
        {
            $response = $view->createResponse();
        }
        catch ( ezcTemplateFileNotFoundException $e )
        {
            self::assertEquals( "The requested template file '{$dir}/testfiles/views/template/not_here.ezt' does not exist.", $e->getMessage() );
        }
    }

    public static function suite()
    {
         return new PHPUnit_Framework_TestSuite( "ezcMvcTemplateViewTest" );
    }
}
?>


text:
<?php

namespace Hgraca\MicroOrm\DataSource\Exception;

use Exception;

class ExecutionException extends Exception
{
}


text:
package org.apache.beam.runners.direct;

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

import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import java.util.Map;
import org.apache.beam.sdk.io.Read;
import org.apache.beam.sdk.runners.AppliedPTransform;
import org.apache.beam.sdk.transforms.Flatten.PCollections;
import org.apache.beam.sdk.transforms.PTransform;

/**
 * A {@link RootInputProvider} that delegates to primitive {@link RootInputProvider} implementations
 * based on the type of {@link PTransform} of the application.
 */
class RootProviderRegistry {
  public static RootProviderRegistry defaultRegistry(EvaluationContext context) {
    ImmutableMap.Builder<Class<? extends PTransform>, RootInputProvider<?, ?, ?, ?>>
        defaultProviders = ImmutableMap.builder();
    defaultProviders
        .put(Read.Bounded.class, new BoundedReadEvaluatorFactory.InputProvider(context))
        .put(Read.Unbounded.class, new UnboundedReadEvaluatorFactory.InputProvider(context))
        .put(
            TestStreamEvaluatorFactory.DirectTestStreamFactory.DirectTestStream.class,
            new TestStreamEvaluatorFactory.InputProvider(context))
        .put(PCollections.class, new EmptyInputProvider());
    return new RootProviderRegistry(defaultProviders.build());
  }

  private final Map<Class<? extends PTransform>, RootInputProvider<?, ?, ?, ?>> providers;

  private RootProviderRegistry(
      Map<Class<? extends PTransform>, RootInputProvider<?, ?, ?, ?>> providers) {
    this.providers = providers;
  }

  public Collection<CommittedBundle<?>> getInitialInputs(
      AppliedPTransform<?, ?, ?> transform, int targetParallelism) throws Exception {
    Class<? extends PTransform> transformClass = transform.getTransform().getClass();
    RootInputProvider provider =
        checkNotNull(
            providers.get(transformClass),
            "Tried to get a %s for a Transform of type %s, but there is no such provider",
            RootInputProvider.class.getSimpleName(),
            transformClass.getSimpleName());
    return provider.getInitialInputs(transform, targetParallelism);
  }
}


text:
using Bloom.Analytics.Modules.LibraryModule.ViewModels;

namespace Bloom.Analytics.Modules.LibraryModule.Views
{
    /// <summary>
    /// Interaction logic for BarChartView.xaml
    /// </summary>
    public partial class BarChartView
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="BarChartView"/> class.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        public BarChartView(BarChartViewModel viewModel)
        {
            InitializeComponent();
            DataContext = viewModel;
        }
    }
}