text:
/*
 * An example that uses the EVP_MD*, EVP_DigestSign* and EVP_DigestVerify*
 * methods to calculate and verify a signature of two static buffers.
 */

#include <string.h>
#include <stdio.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/decoder.h>
#include "EVP_Signature_demo.h"

/*
 * This demonstration will calculate and verify a signature of data using
 * the soliloquy from Hamlet scene 1 act 3
 */

static const char *hamlet_1 =
    "To be, or not to be, that is the question,\n"
    "Whether tis nobler in the minde to suffer\n"
    "The slings and arrowes of outragious fortune,\n"
    "Or to take Armes again in a sea of troubles,\n"
;
static const char *hamlet_2 =
    "And by opposing, end them, to die to sleep;\n"
    "No more, and by a sleep, to say we end\n"
    "The heart-ache, and the thousand natural shocks\n"
    "That flesh is heir to? tis a consumation\n"
;

/*
 * For demo_sign, load EC private key priv_key from priv_key_der[].
 * For demo_verify, load EC public key pub_key from pub_key_der[].
 */
static EVP_PKEY *get_key(OSSL_LIB_CTX *libctx, const char *propq, int public)
{
    OSSL_DECODER_CTX *dctx = NULL;
    EVP_PKEY  *pkey = NULL;
    int selection;
    const unsigned char *data;
    size_t data_len;

    if (public) {
        selection = EVP_PKEY_PUBLIC_KEY;
        data =  pub_key_der;
        data_len = sizeof(pub_key_der);
    } else {
        selection =  EVP_PKEY_KEYPAIR;
        data = priv_key_der;
        data_len = sizeof(priv_key_der);
    }
    dctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, "DER", NULL, "EC",
                                         selection, libctx, propq);
    (void)OSSL_DECODER_from_data(dctx, &data, &data_len);
    OSSL_DECODER_CTX_free(dctx);
    if (pkey == NULL)
        fprintf(stderr, "Failed to load %s key.\n", public ? "public" : "private");
    return pkey;
}

static int demo_sign(OSSL_LIB_CTX *libctx,  const char *sig_name,
                     size_t *sig_out_len, unsigned char **sig_out_value)
{
    int result = 0, public = 0;
    size_t sig_len;
    unsigned char *sig_value = NULL;
    const char *propq = NULL;
    EVP_MD_CTX *sign_context = NULL;
    EVP_PKEY *priv_key = NULL;

    /* Get private key */
    priv_key = get_key(libctx, propq, public);
    if (priv_key == NULL) {
        fprintf(stderr, "Get private key failed.\n");
        goto cleanup;
    }
    /*
     * Make a message signature context to hold temporary state
     * during signature creation
     */
    sign_context = EVP_MD_CTX_new();
    if (sign_context == NULL) {
        fprintf(stderr, "EVP_MD_CTX_new failed.\n");
        goto cleanup;
    }
    /*
     * Initialize the sign context to use the fetched
     * sign provider.
     */
    if (!EVP_DigestSignInit_ex(sign_context, NULL, sig_name,
                              libctx, NULL, priv_key, NULL)) {
        fprintf(stderr, "EVP_DigestSignInit_ex failed.\n");
        goto cleanup;
    }
    /*
     * EVP_DigestSignUpdate() can be called several times on the same context
     * to include additional data.
     */
    if (!EVP_DigestSignUpdate(sign_context, hamlet_1, strlen(hamlet_1))) {
        fprintf(stderr, "EVP_DigestSignUpdate(hamlet_1) failed.\n");
        goto cleanup;
    }
    if (!EVP_DigestSignUpdate(sign_context, hamlet_2, strlen(hamlet_2))) {
        fprintf(stderr, "EVP_DigestSignUpdate(hamlet_2) failed.\n");
        goto cleanup;
    }
    /* Call EVP_DigestSignFinal to get signature length sig_len */
    if (!EVP_DigestSignFinal(sign_context, NULL, &sig_len)) {
        fprintf(stderr, "EVP_DigestSignFinal failed.\n");
        goto cleanup;
    }
    if (sig_len <= 0) {
        fprintf(stderr, "EVP_DigestSignFinal returned invalid signature length.\n");
        goto cleanup;
    }
    sig_value = OPENSSL_malloc(sig_len);
    if (sig_value == NULL) {
        fprintf(stderr, "No memory.\n");
        goto cleanup;
    }
    if (!EVP_DigestSignFinal(sign_context, sig_value, &sig_len)) {
        fprintf(stderr, "EVP_DigestSignFinal failed.\n");
        goto cleanup;
    }
    *sig_out_len = sig_len;
    *sig_out_value = sig_value;
    fprintf(stdout, "Generating signature:\n");
    BIO_dump_indent_fp(stdout, sig_value, sig_len, 2);
    fprintf(stdout, "\n");
    result = 1;

cleanup:
    /* OpenSSL free functions will ignore NULL arguments */
    if (!result)
        OPENSSL_free(sig_value);
    EVP_PKEY_free(priv_key);
    EVP_MD_CTX_free(sign_context);
    return result;
}

static int demo_verify(OSSL_LIB_CTX *libctx, const char *sig_name,
                       size_t sig_len, unsigned char *sig_value)
{
    int result = 0, public = 1;
    const char *propq = NULL;
    EVP_MD_CTX *verify_context = NULL;
    EVP_PKEY *pub_key = NULL;

    /*
     * Make a verify signature context to hold temporary state
     * during signature verification
     */
    verify_context = EVP_MD_CTX_new();
    if (verify_context == NULL) {
        fprintf(stderr, "EVP_MD_CTX_new failed.\n");
        goto cleanup;
    }
    /* Get public key */
    pub_key = get_key(libctx, propq, public);
    if (pub_key == NULL) {
        fprintf(stderr, "Get public key failed.\n");
        goto cleanup;
    }
    /* Verify */
    if (!EVP_DigestVerifyInit_ex(verify_context, NULL, sig_name,
                                libctx, NULL, pub_key, NULL)) {
        fprintf(stderr, "EVP_DigestVerifyInit failed.\n");
        goto cleanup;
    }
    /*
     * EVP_DigestVerifyUpdate() can be called several times on the same context
     * to include additional data.
     */
    if (!EVP_DigestVerifyUpdate(verify_context, hamlet_1, strlen(hamlet_1))) {
        fprintf(stderr, "EVP_DigestVerifyUpdate(hamlet_1) failed.\n");
        goto cleanup;
    }
    if (!EVP_DigestVerifyUpdate(verify_context, hamlet_2, strlen(hamlet_2))) {
        fprintf(stderr, "EVP_DigestVerifyUpdate(hamlet_2) failed.\n");
        goto cleanup;
    }
    if (!EVP_DigestVerifyFinal(verify_context, sig_value, sig_len)) {
        fprintf(stderr, "EVP_DigestVerifyFinal failed.\n");
        goto cleanup;
    }
    fprintf(stdout, "Signature verified.\n");
    result = 1;

cleanup:
    /* OpenSSL free functions will ignore NULL arguments */
    EVP_PKEY_free(pub_key);
    EVP_MD_CTX_free(verify_context);
    return result;
}

int main(void)
{
    OSSL_LIB_CTX *libctx = NULL;
    const char *sig_name = "SHA3-512";
    size_t sig_len = 0;
    unsigned char *sig_value = NULL;
    int result = 0;

    libctx = OSSL_LIB_CTX_new();
    if (libctx == NULL) {
        fprintf(stderr, "OSSL_LIB_CTX_new() returned NULL\n");
        goto cleanup;
    }
    if (!demo_sign(libctx, sig_name, &sig_len, &sig_value)) {
        fprintf(stderr, "demo_sign failed.\n");
        goto cleanup;
    }
    if (!demo_verify(libctx, sig_name, sig_len, sig_value)) {
        fprintf(stderr, "demo_verify failed.\n");
        goto cleanup;
    }
    result = 1;

cleanup:
    if (result != 1)
        ERR_print_errors_fp(stderr);
    /* OpenSSL free functions will ignore NULL arguments */
    OSSL_LIB_CTX_free(libctx);
    OPENSSL_free(sig_value);
    return result == 0;
}


text:
package chaparkhane

// DefaultServer use as default server.
var DefaultServer = &defaultServer
var defaultServer Server

// Server store
type Server struct {
	Status            int // States locate in this file.
	Manifest          Manifest
	Services          services
	UserConnections   userConnections
	RouterConnections routerConnections
	Security          security
}

// Server Status
const (
	// ServerStateStop indicate server had been stopped
	ServerStateStop int = iota
	// ServerStateRunning indicate server is working
	ServerStateRunning
	// ServerStateStopping indicate server want to stop
	ServerStateStopping
	// ServerStateStarting indicate server plan to start and working on it
	ServerStateStarting
)

// Init method use to initialize related object with default data to prevent from panic!
func (s *Server) Init() {
	if s == nil {
		s = DefaultServer
	}
	s.Services.init()
	s.UserConnections.init()
}

// Start will start the server.
func (s *Server) Start() (err error) {

	return
}

// New XP node calculate path (latency and capacity) to all exiting node and send new information to all exiting node
// XPs can recalculate path and tell others about any change just if any change to their physical links!
// - multiple routes to the same place to be assigned the same cost and will cause traffic to be distributed evenly over those routes

// var err error
// err = gp.CheckPacket()
// if err != nil {
// 	// Send response or just ignore packet
// 	// TODO : DDOS!!??
// 	return
// }

redpajama_set_name: RedPajamaGithub


text:
from re import sub
from sys import exc_info

from flask import request

from flask.ext.narf.filters import FilterSet
from flask.ext.narf.serializers import Serializer
from flask.ext.narf.deserializers import Deserializer
from flask.ext.narf.content_types import ContentType, JSON, CollectionPlusJSON

class Endpoint(object):
    """
    Endpoint object

    For tracking serializer, deserializer, filterset and the various content-types for a given
    endpoint.
    Also contains setup and teardown logic for all endpoints.
    """

    def __init__(self):
        """
        Initialize with default endpoint behavior.
        """
        self.FilterSet = None
        self.Deserializer = None
        self.content_type = None
        self.Serializer = None
        self.content_type_map = {}
        self.filter_set = None
        self.content_type = None

    def bind(self, api, path, func, decorated):
        """
        Bind this endpoint to the API at a specific path with a specific function
        """
        self.api = api
        self.path = path
        self.func = func
        self.decorated = decorated
        self.base_path = sub(r'<.+?>', '', path)
        if api.app:
            self.init_app(api.app)

    def init_app(self, app):
        """
        Initialize this endpoint with the Flask app when it's available
        """
        app.add_url_rule(self.path, self.func.__name__, view_func=self.decorated)
        # Generate the content_type_map with this priority:
        #   1. endpoint content-type overrides
        #   2. global content-type overrides
        #   3. default content-types
        for content_type, content_type_class in app.config['DEFAULT_CONTENT_TYPE_MAP'].items():
            self.content_type_map.setdefault(content_type, content_type_class)

    def setup_request(self):
        """
        Setup the request for this endpoint
        """
        best = request.accept_mimetypes.best_match(self.content_type_map.keys()) or 'text/html'
        self.content_type = self.content_type_map[best](self)
        if self.FilterSet:
            self.filter_set = self.FilterSet()
            self.filter_set.validate_inputs()

    def teardown_request(self):
        """
        Teardown the request for this endpoint (cleanup)
        """
        self.content_type = None
        self.filter_set = None

class NARF():
    """
    Not Another Rest Framework
    """

    def __init__(self, app=None):
        self.app = app
        self.endpoints = {}
        if app is not None:
            self.init_app(app)

    def init_app(self, app):
        """
        Initialize the NARF extension with this app
        """
        self.app = app
        # setup the default content-types taking into account global overrides
        app.config.setdefault(
            'DEFAULT_CONTENT_TYPE_MAP',
            {
                'text/html': JSON,
                JSON.CONTENT_TYPE: JSON,
                CollectionPlusJSON.CONTENT_TYPE: CollectionPlusJSON
            }
        )
        # Use the newstyle teardown_appcontext if it's available,
        # otherwise fall back to the request context
        if hasattr(app, 'teardown_appcontext'):
            app.teardown_appcontext(self.teardown)
        else:
            app.teardown_request(self.teardown)
        # initialize all the endpoints
        for endpoint in self.endpoints.values():
            endpoint.init_app(app)

    def teardown(self, exception):
        """
        Cleanup app context
        """
        pass

    def get_endpoint(self, name):
        endpoint = self.endpoints.get(name)
        if endpoint is None:
            endpoint = Endpoint()
            self.endpoints[name] = endpoint
        return endpoint

    def register_filterset(self, target):
        def decorator(func):
            endpoint = self.get_endpoint(func.__name__)
            endpoint.FilterSet = target
            return func
        return decorator

    def register_deserializer(self, target):
        def decorator(func):
            endpoint = self.get_endpoint(func.__name__)
            endpoint.Deserializer = target
            return func
        return decorator

    def register_serializer(self, target):
        def decorator(func):
            endpoint = self.get_endpoint(func.__name__)
            endpoint.Serializer = target
            return func
        return decorator

    def register_content_type(self, target):
        def decorator(func):
            endpoint = self.get_endpoint(func.__name__)
            endpoint.content_type_map[target.CONTENT_TYPE] = target
            return func
        return decorator

    def register(self, target):
        """
        Register endpoint component
        """
        if issubclass(target, FilterSet):
            return self.register_filterset(target)
        if issubclass(target, Deserializer):
            return self.register_deserializer(target)
        if issubclass(target, Serializer):
            return self.register_serializer(target)
        if issubclass(target, ContentType):
            return self.register_content_type(target)

    def endpoint(self, path):
        """
        Define an endpoint in the API
        """
        # decorate the endpoint
        def decorator(func):
            def decorated(*args, **kwargs):
                try:
                    endpoint.setup_request()
                    if endpoint.filter_set:
                        kwargs['filterset'] = endpoint.filter_set
                    returned_object = func(*args, **kwargs)
                    serialized_data = endpoint.content_type.serialize(returned_object)
                    response = endpoint.content_type.make_response(serialized_data)
                except Exception:
                    exc_type, exc_value, exc_traceback = exc_info()
                    response = endpoint.content_type.make_error_response(
                        exc_type, exc_value, exc_traceback
                    )
                endpoint.teardown_request()
                return response

            # setup the endpoint
            endpoint = self.get_endpoint(func.__name__)
            endpoint.bind(self, path, func, decorated)

            return func

        return decorator

    def resource(self, cls):
        """
        Define an entire resource
        """
        pass


text:
<?php
/**
 * Manipulate table and column constraints
 *
 * @package DBSteward
 * @subpackage mysql5
 * @license http://www.opensource.org/licenses/bsd-license.php Simplified BSD License
 * @author Austin Hyde <austin109@gmail.com>
 */

class mysql5_constraint extends sql99_constraint {

  public static function get_primary_key_name($node_table) {
    return "PRIMARY";
  }

  /**
   * create SQL To create the constraint passed in the $constraint array
   *
   * @return string
   */
  public static function get_constraint_sql($constraint, $with_alter_table=TRUE) {
    if ( ! is_array($constraint) ) {
      throw new exception("constraint is not an array?");
    }

    if ( strlen($constraint['table_name']) == 0 ) {
      var_dump(array_keys($constraint));
      throw new exception("table_name is blank");
    }

    switch ( strtoupper($constraint['type']) ) {
      case 'CHECK':
        // @TODO: Implement compatibility
        dbsteward::warning("Ignoring constraint '{$constraint['name']}' on table '{$constraint['table_name']}' because MySQL doesn't support the CHECK constraint");
        return "-- Ignoring constraint '{$constraint['name']}' on table '{$constraint['table_name']}' because MySQL doesn't support the CHECK constraint";
        break;
      case 'PRIMARY KEY':
        $sql = '';
        if ($with_alter_table) {
          $sql .= "ALTER TABLE " . mysql5::get_fully_qualified_table_name($constraint['schema_name'], $constraint['table_name']) . " ";
        }
        $sql .= "ADD PRIMARY KEY " . $constraint['definition'];
        if ($with_alter_table) {
          $sql .= ";";
        }
        return $sql;
        break;
      case 'FOREIGN KEY':
        // MySQL considers foreign keys to be a constraint constraining an index
        // naming the FK index and not the constraint (... ADD FOREIGN KEY name ...) results in the named index and an implicitly named constraint being created
        // naming the constraint and not the index (... ADD CONSTRAINT name FOREIGN KEY ...) results in both the index and constraint having the same name

        $constraint_name = mysql5::get_quoted_object_name($constraint['name']);
        $index_name = !empty($constraint['foreignIndexName']) ? mysql5::get_quoted_object_name($constraint['foreignIndexName']) : $constraint_name;

        $sql = '';
        if ($with_alter_table) {
          $sql .= "ALTER TABLE " . mysql5::get_fully_qualified_table_name($constraint['schema_name'], $constraint['table_name']) . " ";
        }
        $sql .=  "ADD CONSTRAINT ";
        $sql .= "$constraint_name FOREIGN KEY $index_name {$constraint['definition']}";

        // FOREIGN KEY ON DELETE / ON UPDATE handling
        if ( strcasecmp($constraint['type'], 'FOREIGN KEY') == 0 && !empty($constraint['foreignOnDelete']) ) {
          $sql .= " ON DELETE " . self::get_reference_option_sql($constraint['foreignOnDelete']);
        }
        if ( strcasecmp($constraint['type'], 'FOREIGN KEY') == 0 && !empty($constraint['foreignOnUpdate']) ) {
          $sql .= " ON UPDATE " . self::get_reference_option_sql($constraint['foreignOnUpdate']);
        }

        if ($with_alter_table) {
          $sql .= ";";
        }
        return $sql;
        break;
      case 'UNIQUE':
        $sql = '';
        if ($with_alter_table) {
          $sql .= "ALTER TABLE " . mysql5::get_fully_qualified_table_name($constraint['schema_name'], $constraint['table_name']) . " ";
        }
        $sql .= "ADD UNIQUE INDEX ";
        $sql .= mysql5::get_quoted_object_name($constraint['name']) . " {$constraint['definition']}";
        if ($with_alter_table) {
          $sql .= ";";
        }
        return $sql;
      default:
        // we shouldn't actually ever get here.
        throw new Exception("Unimplemented MySQL constraint {$constraint['type']}");
    }
  }

  public static function get_reference_option_sql($ref_opt) {
    // @TODO: "SET DEFAULT" is not supported by mysql
    return strtoupper(str_replace('_',' ',$ref_opt));
  }

  public static function get_constraint_drop_sql($constraint, $with_alter_table = TRUE) {
    if ( ! is_array($constraint) ) {
      throw new exception("constraint is not an array?");
    }

    if ( strlen($constraint['table_name']) == 0 ) {
      var_dump(array_keys($constraint));
      throw new exception("table_name is blank");
    }

    // because MySQL refuses to have consistent syntax
    switch ( strtoupper($constraint['type']) ) {
      case 'CHECK':
        // @TODO: Implement compatibility
        dbsteward::warning("Not dropping constraint '{$constraint['name']}' on table '{$constraint['table_name']}' because MySQL doesn't support the CHECK constraint");
        return "-- Not dropping constraint '{$constraint['name']}' on table '{$constraint['table_name']}' because MySQL doesn't support the CHECK constraint";
        break;
      case 'UNIQUE':
        $drop = "INDEX " . mysql5::get_quoted_object_name($constraint['name']);
        break;
      case 'PRIMARY KEY':
        $drop = "PRIMARY KEY";
        break;
      case 'FOREIGN KEY':
        $drop = "FOREIGN KEY " . mysql5::get_quoted_object_name($constraint['name']);
        break;
      case 'KEY':
        $drop = "KEY " . mysql5::get_quoted_object_name($constraint['name']);
        break;
      default:
        // we shouldn't actually ever get here.
        throw new Exception("Unimplemented MySQL constraint {$constraint['type']}");
    }

    $sql = '';
    if ($with_alter_table) {
      $sql .= "ALTER TABLE " . mysql5::get_fully_qualified_table_name($constraint['schema_name'], $constraint['table_name']) . " ";
    }
    $sql .= "DROP $drop";
    if ($with_alter_table) {
      $sql .= ";";
    }
    return $sql;
  }
}


text:
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License.  You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
namespace Microsoft.Hadoop.Avro.Schema
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;
    using System.Globalization;
    using System.IO;
    using System.Linq;
    using Newtonsoft.Json;

    /// <summary>
    ///     Base class for schema objects.
    /// </summary>
    [SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces",
        Justification = "It is a different namespace.")]
    public abstract class Schema
    {
        private readonly Dictionary<string, string> attributes;

        /// <summary>
        ///     Initializes a new instance of the <see cref="Schema" /> class.
        /// </summary>
        /// <param name="attributes">The attributes.</param>
        protected Schema(IDictionary<string, string> attributes)
        {
            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }

            this.attributes = new Dictionary<string, string>(attributes);
        }

        /// <summary>
        ///     Gets the attributes.
        /// </summary>
        public IDictionary<string, string> Attributes
        {
            get { return this.attributes; }
        }

        /// <summary>
        ///     Adds the attribute.
        /// </summary>
        /// <param name="attribute">The attribute.</param>
        /// <param name="value">The value.</param>
        public void AddAttribute(string attribute, string value)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException("attribute");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            this.attributes.Add(attribute, value);
        }

        /// <summary>
        ///     Returns a <see cref="System.String" /> that represents this instance in JSON format.
        /// </summary>
        /// <returns>
        ///     A <see cref="System.String" /> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            using (var result = new StringWriter(CultureInfo.InvariantCulture))
            {
                var writer = new JsonTextWriter(result);
                this.ToJson(writer, new HashSet<NamedSchema>());
                return result.ToString();
            }
        }

        /// <summary>
        ///     Converts current node to JSON according to the avro specification.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="seenSchemas">The seen schemas.</param>
        internal void ToJson(JsonTextWriter writer, HashSet<NamedSchema> seenSchemas)
        {
            this.ToJsonSafe(writer, seenSchemas);
        }

        /// <summary>
        ///     Converts current node to JSON according to the avro specification.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="seenSchemas">The seen schemas.</param>
        internal abstract void ToJsonSafe(JsonTextWriter writer, HashSet<NamedSchema> seenSchemas);

        #region Schema creation methods.

        /// <summary>
        /// Creates a <see cref="NullSchema" /> instance.
        /// </summary>
        /// <returns>An instance of the <see cref="NullSchema" />.</returns>
        public static NullSchema CreateNull()
        {
            return new NullSchema();
        }

        /// <summary>
        /// Creates a <see cref="BooleanSchema" /> instance.
        /// </summary>
        /// <returns>An instance of the <see cref="BooleanSchema" />.</returns>
        public static BooleanSchema CreateBoolean()
        {
            return new BooleanSchema();
        }

        /// <summary>
        /// Creates a <see cref="IntSchema" /> instance.
        /// </summary>
        /// <returns>An instance of the <see cref="IntSchema" />.</returns>
        public static IntSchema CreateInt()
        {
            return new IntSchema();
        }

        /// <summary>
        /// Creates a <see cref="LongSchema" /> instance.
        /// </summary>
        /// <returns>An instance of the <see cref="LongSchema" />.</returns>
        public static LongSchema CreateLong()
        {
            return new LongSchema();
        }

        /// <summary>
        /// Creates a <see cref="DoubleSchema" /> instance.
        /// </summary>
        /// <returns>An instance of the <see cref="DoubleSchema" />.</returns>
        public static DoubleSchema CreateDouble()
        {
            return new DoubleSchema();
        }

        /// <summary>
        /// Creates a <see cref="FloatSchema" /> instance.
        /// </summary>
        /// <returns>An instance of the <see cref="FloatSchema" />.</returns>
        public static FloatSchema CreateFloat()
        {
            return new FloatSchema();
        }

        /// <summary>
        /// Creates a <see cref="StringSchema" /> instance.
        /// </summary>
        /// <returns>An instance of the <see cref="StringSchema" />.</returns>
        public static StringSchema CreateString()
        {
            return new StringSchema();
        }

        /// <summary>
        /// Creates a <see cref="BytesSchema" /> instance.
        /// </summary>
        /// <returns>An instance of the <see cref="BytesSchema" />.</returns>
        public static BytesSchema CreateBytes()
        {
            return new BytesSchema();
        }

        /// <summary>
        /// Creates a <see cref="RecordSchema" /> instance.
        /// </summary>
        /// <param name="name">Record name.</param>
        /// <param name="ns">Record namespace.</param>
        /// <returns>An instance of the <see cref="RecordSchema" />.</returns>
        public static RecordSchema CreateRecord(string name, string ns)
        {
            return new RecordSchema(new NamedEntityAttributes(new SchemaName(name, ns), new List<string>(), string.Empty), typeof(AvroRecord));
        }

        /// <summary>
        /// Sets the fields.
        /// </summary>
        /// <param name="record">
        /// The record.
        /// </param>
        /// <param name="fields">
        /// The fields.
        /// </param>
        public static void SetFields(RecordSchema record, IEnumerable<RecordField> fields)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }

            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }

            if (record.Fields.Count != 0)
            {
                throw new InvalidOperationException("Fields can be set only on empty record.");
            }

            int fieldPosition = 0;
            foreach (var field in fields)
            {
                record.AddField(new RecordField(field.NamedEntityAttributes, field.TypeSchema, field.Order, field.HasDefaultValue, field.DefaultValue, field.MemberInfo, fieldPosition++));
            }
        }

        /// <summary>
        /// Creates a <see cref="RecordField" /> instance.
        /// </summary>
        /// <param name="fieldName">The field name.</param>
        /// <param name="fieldType">The field type.</param>
        /// <returns>An instance of the <see cref="RecordField" />.</returns>
        public static RecordField CreateField(string fieldName, TypeSchema fieldType)
        {
            if (string.IsNullOrEmpty(fieldName))
            {
                throw new ArgumentException("Field name is not allowed to be null or empty.");
            }

            if (fieldType == null)
            {
                throw new ArgumentNullException("fieldType");
            }

            return new RecordField(
                new NamedEntityAttributes(new SchemaName(fieldName), new List<string>(), string.Empty),
                fieldType,
                SortOrder.Ascending,
                false,
                null,
                null,
                -1);
        }

        /// <summary>
        /// Creates a <see cref="RecordField" /> instance.
        /// </summary>
        /// <param name="fieldName">The field name.</param>
        /// <param name="fieldType">The field type.</param>
        /// <param name="ns">The namespace.</param>
        /// <param name="aliases">The name aliases.</param>
        /// <param name="doc">The field documentation.</param>
        /// <param name="defaultValue">The field default value.</param>
        /// <param name="order">The field sorting order.</param>
        /// <returns>An instance of the <see cref="RecordField" />.</returns>
        public static RecordField CreateField(string fieldName, TypeSchema fieldType, string ns, IEnumerable<string> aliases, string doc, object defaultValue, SortOrder order)
        {
            return new RecordField(
                new NamedEntityAttributes(new SchemaName(fieldName, ns), aliases, doc),
                fieldType,
                order,
                defaultValue == null,
                defaultValue,
                null,
                -1);
        }

        /// <summary>
        /// Creates a <see cref="FixedSchema" /> instance.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="ns">The namespace.</param>
        /// <param name="size">The size.</param>
        /// <returns>An instance of the <see cref="FixedSchema" />.</returns>
        public static FixedSchema CreateFixed(string name, string ns, int size)
        {
            return new FixedSchema(new NamedEntityAttributes(new SchemaName(name, ns), new List<string>(), string.Empty), size, typeof(byte[]));
        }

        /// <summary>
        /// Creates a <see cref="EnumSchema" /> instance.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="ns">The namespace.</param>
        /// <param name="values">The values of the enum.</param>
        /// <returns>An instance of the <see cref="EnumSchema" />.</returns>
        public static EnumSchema CreateEnumeration(string name, string ns, IEnumerable<string> values)
        {
            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            var result = new EnumSchema(new NamedEntityAttributes(new SchemaName(name, ns), new List<string>(), string.Empty), typeof(Enum));
            values.ToList().ForEach(result.AddSymbol);
            return result;
        }

        /// <summary>
        /// Creates a <see cref="ArraySchema" /> instance.
        /// </summary>
        /// <param name="itemSchema">The schema of the items.</param>
        /// <returns>An instance of the <see cref="ArraySchema" />.</returns>
        public static ArraySchema CreateArray(TypeSchema itemSchema)
        {
            return new ArraySchema(itemSchema, typeof(Array));
        }

        /// <summary>
        /// Creates a <see cref="MapSchema" /> instance.
        /// </summary>
        /// <param name="valueSchema">The schema of the values.</param>
        /// <returns>An instance of the <see cref="MapSchema" />.</returns>
        public static MapSchema CreateMap(TypeSchema valueSchema)
        {
            return new MapSchema(new StringSchema(), valueSchema, typeof(Dictionary<,>));
        }

        /// <summary>
        /// Creates a <see cref="UnionSchema" /> instance.
        /// </summary>
        /// <param name="schemas">The schemas.</param>
        /// <returns>An instance of the <see cref="UnionSchema" />.</returns>
        public static UnionSchema CreateUnion(params TypeSchema[] schemas)
        {
            if (schemas == null)
            {
                throw new ArgumentNullException("schemas");
            }

            return new UnionSchema(new List<TypeSchema>(schemas), typeof(List<>));
        }

        #endregion //Schema creation methods.
    }
}


text:
module Kibali
  module SubjectExtensions

# #############################################################################
# #############################################################################

# ------------------------------------------------------------------------------
# has_role? -- returns true if subject has the given role
# ------------------------------------------------------------------------------
    def has_role?(role_name)
      !get_role( role_name ).nil?
    end

# ------------------------------------------------------------------------------
# has_role! -- forces subject to have the given role
# ------------------------------------------------------------------------------
      def has_role!(role_name)
        role = _auth_role_class.where( :name => role_name.to_s ).   # acts as the find part
               first_or_create( :name => role_name.to_s )           # acts as the create part
        role_objects << role unless self.role_objects.member?(role)
        role
      end

# ------------------------------------------------------------------------------
# remove_role! -- foreces subject to NOT have the given role
# ------------------------------------------------------------------------------
      def remove_role!(role_name)
        role_objects.delete( get_role( role_name ) )
      end

# ------------------------------------------------------------------------------
# get_role -- returns a role obj for subject; else nil
# EXCEPTION: EmptyRolesException if role_objects collection is empty
# ------------------------------------------------------------------------------
      def get_role( role_name=nil )

        raise Kibali::EmptyRoles  if role_objects.empty?

        if role_name.nil?
           role_objects.first
        else
           role_objects.where( :name => role_name.to_s ).first
        end

      end

# #############################################################################
    private
# #############################################################################

# #############################################################################
      protected
# #############################################################################

# ------------------------------------------------------------------------------
# _auth_role_class -- retuns the Klass for the Role model
# ------------------------------------------------------------------------------
      def _auth_role_class
        self.class._auth_role_class_name.constantize
      end

# ------------------------------------------------------------------------------
# _auth_role_assoc -- returns the habtm symbol for the array of subject.roles
# ------------------------------------------------------------------------------
      def _auth_role_assoc
        self.class._auth_role_assoc_name
      end

# ------------------------------------------------------------------------------
# role_objects -- returns the habtm array of roles for the subject
# ------------------------------------------------------------------------------
      def role_objects
        send(self._auth_role_assoc)
      end
#
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------

# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------

# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------

# #############################################################################
# #############################################################################

  end
end


text:
Role Based Access Control for Goji.
Inspired by Yii.


text:
package io.cattle.platform.activity.impl;

import io.cattle.platform.activity.Entry;
import io.cattle.platform.core.model.Service;
import io.cattle.platform.core.model.ServiceLog;

public class EntryImpl implements Entry {
    ActivityLogImpl logImpl;
    Service owner;
    ServiceLog auditLog;
    boolean failed;
    String message;

    public EntryImpl(ActivityLogImpl logImpl, Service owner, ServiceLog auditLog) {
        super();
        this.logImpl = logImpl;
        this.owner = owner;
        this.auditLog = auditLog;
    }

    @Override
    public void close() {
        logImpl.close(this);
    }

    @Override
    public void exception(Throwable t) {
        logImpl.exception(this, t);
    }

    public Object getOwner() {
        return owner;
    }

}


text:
class Flash < Cask
  version '15.0.0.189'
  sha256 'e9fba4902df0abaa6054c7e4572841abf25564de6ffdf6d30416fb7e3f30ab27'

  url 'http://fpdownload.macromedia.com/get/flashplayer/current/licensing/mac/install_flash_player_15_osx_pkg.dmg'
  homepage 'https://www.adobe.com/products/flashplayer/distribution3.html'
  license :unknown

  pkg 'Install Adobe Flash Player.pkg'

  uninstall :pkgutil => 'com.adobe.pkg.FlashPlayer',
            :delete  => '/Library/Internet Plug-Ins/Flash Player.plugin'
  zap       :delete => [
                        '~/Library/Caches/Adobe/Flash Player',
                        '~/Library/Logs/FlashPlayerInstallManager.log',
                       ]
end


text:
START_ATF_NAMESPACE
    namespace Detail
    {

        Info::CNetFrameRatector_CNetFrameRate2_ptr CNetFrameRatector_CNetFrameRate2_next(nullptr);
        Info::CNetFrameRatector_CNetFrameRate2_clbk CNetFrameRatector_CNetFrameRate2_user(nullptr);

        Info::CNetFrameRateCalcFrameRate4_ptr CNetFrameRateCalcFrameRate4_next(nullptr);
        Info::CNetFrameRateCalcFrameRate4_clbk CNetFrameRateCalcFrameRate4_user(nullptr);

        void CNetFrameRatector_CNetFrameRate2_wrapper(struct CNetFrameRate* _this)
        {
           CNetFrameRatector_CNetFrameRate2_user(_this, CNetFrameRatector_CNetFrameRate2_next);
        };
        void CNetFrameRateCalcFrameRate4_wrapper(struct CNetFrameRate* _this)
        {
           CNetFrameRateCalcFrameRate4_user(_this, CNetFrameRateCalcFrameRate4_next);
        };

        ::std::array<hook_record, 2> CNetFrameRate_functions =
        {
            _hook_record {
                (LPVOID)0x14047c990L,
                (LPVOID *)&CNetFrameRatector_CNetFrameRate2_user,
                (LPVOID *)&CNetFrameRatector_CNetFrameRate2_next,
                (LPVOID)cast_pointer_function(CNetFrameRatector_CNetFrameRate2_wrapper),
                (LPVOID)cast_pointer_function((void(CNetFrameRate::*)())&CNetFrameRate::ctor_CNetFrameRate)
            },
            _hook_record {
                (LPVOID)0x14047d8c0L,
                (LPVOID *)&CNetFrameRateCalcFrameRate4_user,
                (LPVOID *)&CNetFrameRateCalcFrameRate4_next,
                (LPVOID)cast_pointer_function(CNetFrameRateCalcFrameRate4_wrapper),
                (LPVOID)cast_pointer_function((void(CNetFrameRate::*)())&CNetFrameRate::CalcFrameRate)
            },
        };
    }; // end namespace Detail
END_ATF_NAMESPACE


text:
/**
 * Autogenerated by Thrift Compiler (0.9.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.sentry.provider.db.generic.service.thrift;

import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentryRole._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryRole");

  private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)2);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new TSentryRoleStandardSchemeFactory());
    schemes.put(TupleScheme.class, new TSentryRoleTupleSchemeFactory());
  }

  private String roleName; // required
  private Set<String> groups; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    ROLE_NAME((short)1, "roleName"),
    GROUPS((short)2, "groups");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // ROLE_NAME
          return ROLE_NAME;
        case 2: // GROUPS
          return GROUPS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryRole.class, metaDataMap);
  }

  public TSentryRole() {
  }

  public TSentryRole(
    String roleName,
    Set<String> groups)
  {
    this();
    this.roleName = roleName;
    this.groups = groups;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TSentryRole(TSentryRole other) {
    if (other.isSetRoleName()) {
      this.roleName = other.roleName;
    }
    if (other.isSetGroups()) {
      Set<String> __this__groups = new HashSet<String>();
      for (String other_element : other.groups) {
        __this__groups.add(other_element);
      }
      this.groups = __this__groups;
    }
  }

  public TSentryRole deepCopy() {
    return new TSentryRole(this);
  }

  @Override
  public void clear() {
    this.roleName = null;
    this.groups = null;
  }

  public String getRoleName() {
    return this.roleName;
  }

  public void setRoleName(String roleName) {
    this.roleName = roleName;
  }

  public void unsetRoleName() {
    this.roleName = null;
  }

  /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
  public boolean isSetRoleName() {
    return this.roleName != null;
  }

  public void setRoleNameIsSet(boolean value) {
    if (!value) {
      this.roleName = null;
    }
  }

  public int getGroupsSize() {
    return (this.groups == null) ? 0 : this.groups.size();
  }

  public java.util.Iterator<String> getGroupsIterator() {
    return (this.groups == null) ? null : this.groups.iterator();
  }

  public void addToGroups(String elem) {
    if (this.groups == null) {
      this.groups = new HashSet<String>();
    }
    this.groups.add(elem);
  }

  public Set<String> getGroups() {
    return this.groups;
  }

  public void setGroups(Set<String> groups) {
    this.groups = groups;
  }

  public void unsetGroups() {
    this.groups = null;
  }

  /** Returns true if field groups is set (has been assigned a value) and false otherwise */
  public boolean isSetGroups() {
    return this.groups != null;
  }

  public void setGroupsIsSet(boolean value) {
    if (!value) {
      this.groups = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ROLE_NAME:
      if (value == null) {
        unsetRoleName();
      } else {
        setRoleName((String)value);
      }
      break;

    case GROUPS:
      if (value == null) {
        unsetGroups();
      } else {
        setGroups((Set<String>)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ROLE_NAME:
      return getRoleName();

    case GROUPS:
      return getGroups();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case ROLE_NAME:
      return isSetRoleName();
    case GROUPS:
      return isSetGroups();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof TSentryRole)
      return this.equals((TSentryRole)that);
    return false;
  }

  public boolean equals(TSentryRole that) {
    if (that == null)
      return false;

    boolean this_present_roleName = true && this.isSetRoleName();
    boolean that_present_roleName = true && that.isSetRoleName();
    if (this_present_roleName || that_present_roleName) {
      if (!(this_present_roleName && that_present_roleName))
        return false;
      if (!this.roleName.equals(that.roleName))
        return false;
    }

    boolean this_present_groups = true && this.isSetGroups();
    boolean that_present_groups = true && that.isSetGroups();
    if (this_present_groups || that_present_groups) {
      if (!(this_present_groups && that_present_groups))
        return false;
      if (!this.groups.equals(that.groups))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();

    boolean present_roleName = true && (isSetRoleName());
    builder.append(present_roleName);
    if (present_roleName)
      builder.append(roleName);

    boolean present_groups = true && (isSetGroups());
    builder.append(present_groups);
    if (present_groups)
      builder.append(groups);

    return builder.toHashCode();
  }

  public int compareTo(TSentryRole other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    TSentryRole typedOther = (TSentryRole)other;

    lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRoleName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGroups()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("TSentryRole(");
    boolean first = true;

    sb.append("roleName:");
    if (this.roleName == null) {
      sb.append("null");
    } else {
      sb.append(this.roleName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("groups:");
    if (this.groups == null) {
      sb.append("null");
    } else {
      sb.append(this.groups);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (!isSetRoleName()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
    }

    if (!isSetGroups()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
    }

    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TSentryRoleStandardSchemeFactory implements SchemeFactory {
    public TSentryRoleStandardScheme getScheme() {
      return new TSentryRoleStandardScheme();
    }
  }

  private static class TSentryRoleStandardScheme extends StandardScheme<TSentryRole> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryRole struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // ROLE_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.roleName = iprot.readString();
              struct.setRoleNameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // GROUPS
            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
              {
                org.apache.thrift.protocol.TSet _set24 = iprot.readSetBegin();
                struct.groups = new HashSet<String>(2*_set24.size);
                for (int _i25 = 0; _i25 < _set24.size; ++_i25)
                {
                  String _elem26; // required
                  _elem26 = iprot.readString();
                  struct.groups.add(_elem26);
                }
                iprot.readSetEnd();
              }
              struct.setGroupsIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TSentryRole struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.roleName != null) {
        oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
        oprot.writeString(struct.roleName);
        oprot.writeFieldEnd();
      }
      if (struct.groups != null) {
        oprot.writeFieldBegin(GROUPS_FIELD_DESC);
        {
          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
          for (String _iter27 : struct.groups)
          {
            oprot.writeString(_iter27);
          }
          oprot.writeSetEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TSentryRoleTupleSchemeFactory implements SchemeFactory {
    public TSentryRoleTupleScheme getScheme() {
      return new TSentryRoleTupleScheme();
    }
  }

  private static class TSentryRoleTupleScheme extends TupleScheme<TSentryRole> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeString(struct.roleName);
      {
        oprot.writeI32(struct.groups.size());
        for (String _iter28 : struct.groups)
        {
          oprot.writeString(_iter28);
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.roleName = iprot.readString();
      struct.setRoleNameIsSet(true);
      {
        org.apache.thrift.protocol.TSet _set29 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
        struct.groups = new HashSet<String>(2*_set29.size);
        for (int _i30 = 0; _i30 < _set29.size; ++_i30)
        {
          String _elem31; // required
          _elem31 = iprot.readString();
          struct.groups.add(_elem31);
        }
      }
      struct.setGroupsIsSet(true);
    }
  }

}


text:
import { mount, Wrapper } from '@vue/test-utils';
import moment from 'moment';
import Vue from 'vue';
import { addMessages } from '../../../tests/helpers/lang';
import { renderComponent, WrapChildrenStub } from '../../../tests/helpers/render';
import uuid from '../../utils/uuid/uuid';
import ErrorMessagePlugin, { MErrorMessage } from './error-message';

jest.mock('../../utils/uuid/uuid');
(uuid.generate as jest.Mock).mockReturnValue('uuid');

describe('MErrorMessage', () => {
    let userAgent: string = window.navigator.userAgent;
    beforeEach(() => {
        Vue.use(ErrorMessagePlugin);
        addMessages(Vue, ['components/error-message/error-message.lang.fr.json']);

        userAgent = window.navigator.userAgent;
        Object.defineProperty(window.navigator, 'userAgent', { value: 'modul-user-agent', configurable: true });
    });

    afterEach(() => {
        Object.defineProperty(window.navigator, 'userAgent', { value: userAgent, configurable: true });
    });

    it('should render correctly collapsed', () => {
        const error: Wrapper<MErrorMessage> = mount(MErrorMessage, {
            localVue: Vue
        });

        return expect(renderComponent(error.vm)).resolves.toMatchSnapshot();
    });

    it('should render correctly expanded', () => {
        const error: Wrapper<MErrorMessage> = mount(MErrorMessage, {
            localVue: Vue,
            propsData: {
                date: moment('2018-01-02T00:01:02'),
                referenceNumber: '123456879'
            },
            stubs: {
                'm-accordion': WrapChildrenStub('div'),
                'm-panel': WrapChildrenStub('div')
            }
        });

        return expect(renderComponent(error.vm)).resolves.toMatchSnapshot();
    });

    describe('given error', () => {
        it('should render correctly expanded', () => {
            const error: Wrapper<MErrorMessage> = mount(MErrorMessage, {
                localVue: Vue,
                propsData: {
                    date: moment('2018-01-02T00:01:02'),
                    referenceNumber: '123456879',
                    error: {
                        message: 'An error message'
                    }
                },
                stubs: {
                    'm-accordion': WrapChildrenStub('div'),
                    'm-panel': WrapChildrenStub('div')
                }
            });

            return expect(renderComponent(error.vm)).resolves.toMatchSnapshot();
        });

        it('should render correctly expanded with stack trace on', () => {
            const error: Wrapper<MErrorMessage> = mount(MErrorMessage, {
                localVue: Vue,
                propsData: {
                    date: moment('2018-01-02T00:01:02'),
                    referenceNumber: '123456879',
                    error: {
                        message: 'An error message'
                    },
                    stacktrace: true
                },
                stubs: {
                    'm-accordion': WrapChildrenStub('div'),
                    'm-panel': WrapChildrenStub('div')
                }
            });

            return expect(renderComponent(error.vm)).resolves.toMatchSnapshot();
        });
    });

    describe('given error with stack trace', () => {
        it('should render correctly expanded', () => {
            const error: Wrapper<MErrorMessage> = mount(MErrorMessage, {
                localVue: Vue,
                propsData: {
                    date: moment('2018-01-02T00:01:02'),
                    referenceNumber: '123456879',
                    error: {
                        message: 'An error message',
                        stack: 'This is a stack trace'
                    }
                },
                stubs: {
                    'm-accordion': WrapChildrenStub('div'),
                    'm-panel': WrapChildrenStub('div')
                }
            });

            return expect(renderComponent(error.vm)).resolves.toMatchSnapshot();
        });

        it('should render correctly expanded with stack trace on', () => {
            const error: Wrapper<MErrorMessage> = mount(MErrorMessage, {
                localVue: Vue,
                propsData: {
                    date: moment('2018-01-02T00:01:02'),
                    referenceNumber: '123456879',
                    error: {
                        message: 'An error message',
                        stack: 'This is a stack trace'
                    },
                    stacktrace: true
                },
                stubs: {
                    'm-accordion': WrapChildrenStub('div'),
                    'm-panel': WrapChildrenStub('div')
                }
            });

            return expect(renderComponent(error.vm)).resolves.toMatchSnapshot();
        });
    });
});


text:
package com.sequenceiq.cloudbreak.cloud.aws.common.subnetselector;

import java.util.List;

import com.sequenceiq.cloudbreak.cloud.model.CloudSubnet;

public class SubnetHelper {

    public long countDifferentAZs(List<CloudSubnet> chosenSubnets) {
        return chosenSubnets.stream().map(CloudSubnet::getAvailabilityZone).distinct().count();
    }
}


text:
// Copyright (c) 2013 David Gallardo Moreno. All rights reserved.

/**
 * @fileoverview ShaderProgram component.
 * @author David Gallardo Moreno (portalg@gmail.com)
 */

goog.provide('ss2d.ShaderProgram');

/**
 * @constructor
 * @param {ss2d.ShaderProgram[]} shaders Shader sources list
 * @param {string[]} uniforms Uniform names
 * @param {string[]} attributes Attribute names
 */
ss2d.ShaderProgram = function(shaders, uniforms, attributes)
{
	var gl = ss2d.CURRENT_VIEW.mContext;
	this.mProgramId = gl.createProgram();
	this.mUniforms = {};
	this.mAttributes = {};
	for(var shaderIndex in shaders)
	{
		var shader = shaders[shaderIndex];
		gl.attachShader(this.mProgramId, shader.mShaderId);
	}

	gl.linkProgram(this.mProgramId);
	if (!gl.getProgramParameter(this.mProgramId, gl.LINK_STATUS))
 	{
		throw 'Link error';
	}

  	this.use(gl);

  	for(var uIndex in uniforms)
	{
		var uniformName = uniforms[uIndex];
		this.mUniforms[uniformName] = gl.getUniformLocation(this.mProgramId, uniformName);
	}

	for(var aIndex in attributes)
	{
		var attributeName = attributes[aIndex];
		this.mAttributes[attributeName] = gl.getAttribLocation(this.mProgramId, attributeName);
		//gl.enableVertexAttribArray(this.mAttributes[attributeName]);
	}

	ss2d.ShaderProgram.PROGRAM_IN_USE = null
};

/**
 * Active program
 */
ss2d.ShaderProgram.PROGRAM_IN_USE = null;

/**
 * Active this program
 * @param {WebGLContext} gl
 */
ss2d.ShaderProgram.prototype.use = function(gl)
{
	if(ss2d.ShaderProgram.PROGRAM_IN_USE != this)
	{
		//disable previous
		var piu = ss2d.ShaderProgram.PROGRAM_IN_USE;
		if(piu != null)
		{
			for(var aIndex in piu.mAttributes)
			{
				gl.disableVertexAttribArray(piu.mAttributes[aIndex]);
			}
		}

		//enable current
		for(var aIndex in this.mAttributes)
		{
			gl.enableVertexAttribArray(this.mAttributes[aIndex]);
		}
		gl.useProgram(this.mProgramId);
		ss2d.ShaderProgram.PROGRAM_IN_USE = this;
	}
};


text:
@REM Copyright (c) Microsoft. All rights reserved.
@REM Licensed under the MIT license. See LICENSE file in the project root for full license information.

@setlocal EnableExtensions EnableDelayedExpansion
@echo off

set build-root=%~dp0\..\..
for %%i in ("%build-root%") do set build-root=%%~fi

set nuget_feed=%1

if not defined nuget_feed (
	choice /C yn /M "No feed specified. Are you sure you want to publish to Nuget.org"
	if not !errorlevel!==1 goto :eof
)

rem -----------------------------------------------------------------------------
rem -- Build all native client configurations & platforms
rem -----------------------------------------------------------------------------
call %build-root%\c\build_all\windows\build_client.cmd --platform Win32
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
call %build-root%\c\build_all\windows\build_client.cmd --platform x64
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!

rem -----------------------------------------------------------------------------
rem -- Create NuGet Packages
rem -----------------------------------------------------------------------------
echo Y | call %build-root%\c\build_all\packaging\windows\rebuild_nugets.cmd
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

echo Y | call %build-root%\c\azure-c-shared-utility\build_all\packaging\windows\rebuild_nugets.cmd
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

echo Y | call %build-root%\c\azure-uamqp-c\build_all\packaging\windows\rebuild_nugets.cmd
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

echo Y | call %build-root%\c\azure-umqtt-c\build_all\packaging\windows\rebuild_nugets.cmd
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!

rem -----------------------------------------------------------------------------
rem -- Publish csharp NuGet Packages
rem -----------------------------------------------------------------------------
if not defined nuget_feed (
	echo Y | call %build-root%\build\release\push_nugets.cmd --path %build-root%\c\azure-c-shared-utility\build_all\packaging\windows
	if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
	echo Y | call %build-root%\build\release\push_nugets.cmd --path %build-root%\c\azure-uamqp-c\build_all\packaging\windows
	if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
	echo Y | call %build-root%\build\release\push_nugets.cmd --path %build-root%\c\azure-umqtt-c\build_all\packaging\windows
	if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
	echo Y | call %build-root%\build\release\push_nugets.cmd --path %build-root%\c\build_all\packaging\windows
	if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
) else (
	echo Y Y | call %build-root%\build\release\push_nugets.cmd --path %build-root%\c\azure-c-shared-utility\build_all\packaging\windows --feed %nuget_feed%
	if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
	echo Y Y | call %build-root%\build\release\push_nugets.cmd --path %build-root%\c\azure-uamqp-c\build_all\packaging\windows --feed %nuget_feed%
	if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
	echo Y Y | call %build-root%\build\release\push_nugets.cmd --path %build-root%\c\azure-umqtt-c\build_all\packaging\windows --feed %nuget_feed%
	if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
	echo Y Y | call %build-root%\build\release\push_nugets.cmd --path %build-root%\c\build_all\packaging\windows --feed %nuget_feed%
	if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
)


text:
(function ( global, factory ) {
	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
	typeof define === 'function' && define.amd ? define(factory) :
	(global.MarkdownEditor = factory());
}(this, (function () { 'use strict';

var template = (function () {
  return {
    onrender() {
      this.valueObserver = this.observe('value', (newValue, oldValue) => {
        if(newValue !== oldValue) {
          this.set({value: newValue});
          this.refs.editor.value = newValue;
        }
      });
    },

    data() {
      return {
        value: ''
      };
    },

    methods: {
      changed() {
        const value = this.refs.editor.value;
        this.set({ value });
        this.fire('changed', { value });
      }
    }

  };
}());

let addedCss = false;
function addCss () {
	var style = createElement( 'style' );
	style.textContent = "\n  .markdown-input[svelte-966191626], [svelte-966191626] .markdown-input {\n    position: absolute;\n    display: block;\n    border: 1px solid #ccc;\n    border-top: none;\n    border-left: none;\n    border-bottom-right-radius: 5px;\n    resize: none;\n    width: 50%;\n    height: calc(100% - 35px)\n  }\n\n  .markdown-input[svelte-966191626]:focus, [svelte-966191626] .markdown-input:focus {\n    outline: none;\n    box-shadow: none;\n  }\n";
	appendNode( style, document.head );

	addedCss = true;
}

function renderMainFragment ( root, component ) {
	var textarea = createElement( 'textarea' );
	textarea.setAttribute( 'svelte-966191626', '' );
	component.refs.editor = textarea;

	function keyupHandler ( event ) {
		component.changed();
	}

	textarea.addEventListener( 'keyup', keyupHandler, false );

	textarea.name = "markdown-input";
	textarea.id = "markdown-input";
	textarea.className = "markdown-input";

	var text = createText( root.value );
	appendNode( text, textarea );

	return {
		mount: function ( target, anchor ) {
			insertNode( textarea, target, anchor );
		},

		update: function ( changed, root ) {
			text.data = root.value;
		},

		teardown: function ( detach ) {
			if ( component.refs.editor === textarea ) component.refs.editor = null;
			textarea.removeEventListener( 'keyup', keyupHandler, false );

			if ( detach ) {
				detachNode( textarea );
			}
		},
	};
}

function MarkdownEditor ( options ) {
	options = options || {};

	this.refs = {}
	this._state = Object.assign( template.data(), options.data );

	this._observers = {
		pre: Object.create( null ),
		post: Object.create( null )
	};

	this._handlers = Object.create( null );

	this._root = options._root;
	this._yield = options._yield;

	if ( !addedCss ) addCss();

	this._fragment = renderMainFragment( this._state, this );
	if ( options.target ) this._fragment.mount( options.target, null );

	if ( options._root ) {
		options._root._renderHooks.push({ fn: template.onrender, context: this });
	} else {
		template.onrender.call( this );
	}
}

MarkdownEditor.prototype = template.methods;

MarkdownEditor.prototype.get = function get( key ) {
 	return key ? this._state[ key ] : this._state;
 };

MarkdownEditor.prototype.fire = function fire( eventName, data ) {
 	var handlers = eventName in this._handlers && this._handlers[ eventName ].slice();
 	if ( !handlers ) return;

 	for ( var i = 0; i < handlers.length; i += 1 ) {
 		handlers[i].call( this, data );
 	}
 };

MarkdownEditor.prototype.observe = function observe( key, callback, options ) {
 	var group = ( options && options.defer ) ? this._observers.pre : this._observers.post;

 	( group[ key ] || ( group[ key ] = [] ) ).push( callback );

 	if ( !options || options.init !== false ) {
 		callback.__calling = true;
 		callback.call( this, this._state[ key ] );
 		callback.__calling = false;
 	}

 	return {
 		cancel: function () {
 			var index = group[ key ].indexOf( callback );
 			if ( ~index ) group[ key ].splice( index, 1 );
 		}
 	};
 };

MarkdownEditor.prototype.on = function on( eventName, handler ) {
 	var handlers = this._handlers[ eventName ] || ( this._handlers[ eventName ] = [] );
 	handlers.push( handler );

 	return {
 		cancel: function () {
 			var index = handlers.indexOf( handler );
 			if ( ~index ) handlers.splice( index, 1 );
 		}
 	};
 };

MarkdownEditor.prototype.set = function set ( newState ) {
	var oldState = this._state;
	this._state = Object.assign( {}, oldState, newState );

	dispatchObservers( this, this._observers.pre, newState, oldState );
	if ( this._fragment ) this._fragment.update( newState, this._state );
	dispatchObservers( this, this._observers.post, newState, oldState );
};

MarkdownEditor.prototype.teardown = function teardown ( detach ) {
	this.fire( 'teardown' );

	this._fragment.teardown( detach !== false );
	this._fragment = null;

	this._state = {};
};

function dispatchObservers( component, group, newState, oldState ) {
	for ( var key in group ) {
		if ( !( key in newState ) ) continue;

		var newValue = newState[ key ];
		var oldValue = oldState[ key ];

		if ( newValue === oldValue && typeof newValue !== 'object' ) continue;

		var callbacks = group[ key ];
		if ( !callbacks ) continue;

		for ( var i = 0; i < callbacks.length; i += 1 ) {
			var callback = callbacks[i];
			if ( callback.__calling ) continue;

			callback.__calling = true;
			callback.call( component, newValue, oldValue );
			callback.__calling = false;
		}
	}
}

function createElement( name ) {
	return document.createElement( name );
}

function detachNode( node ) {
	node.parentNode.removeChild( node );
}

function insertNode( node, target, anchor ) {
	target.insertBefore( node, anchor );
}

function createText( data ) {
	return document.createTextNode( data );
}

function appendNode( node, target ) {
	target.appendChild( node );
}

return MarkdownEditor;

})));


text:
/*
 * TwoLineEnviroment.h
 *
 *  Created on: 2016年5月17日
 *      Author: Administrator
 */

#pragma once
#ifndef TRADE_SYS_ENVIRONMENT_IMP_TWOLINEENVIRONMENT_H_
#define TRADE_SYS_ENVIRONMENT_IMP_TWOLINEENVIRONMENT_H_

#include "../../../indicator/Indicator.h"
#include "../EnvironmentBase.h"

namespace hku {

class TwoLineEnvironment : public EnvironmentBase {
public:
    TwoLineEnvironment();
    TwoLineEnvironment(const Indicator& fast, const Indicator& slow);
    virtual ~TwoLineEnvironment();

    virtual void _calculate() override;
    virtual EnvironmentPtr _clone() override;

private:
    Indicator m_fast;
    Indicator m_slow;

//============================================
// 序列化支持
//============================================
#if HKU_SUPPORT_SERIALIZATION
    friend class boost::serialization::access;
    template <class Archive>
    void serialize(Archive& ar, const unsigned int version) {
        ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(EnvironmentBase);
        ar& BOOST_SERIALIZATION_NVP(m_fast);
        ar& BOOST_SERIALIZATION_NVP(m_slow);
    }
#endif
};

} /* namespace hku */

#endif /* TRADE_SYS_ENVIRONMENT_IMP_TWOLINEENVIRONMENT_H_ */


text:
package play.mvc.results;

import java.util.Map;
import play.Logger;

import play.Play;
import play.exceptions.UnexpectedException;
import play.libs.MimeTypes;
import play.mvc.Http;
import play.mvc.Http.Request;
import play.mvc.Http.Response;
import play.mvc.Scope;
import play.templates.TemplateLoader;

/**
 * 500 Error
 */
public class Error extends Result {

    private int status;

    public Error(String reason) {
        super(reason);
        this.status = Http.StatusCode.INTERNAL_ERROR;
    }

    public Error(int status, String reason) {
        super(reason);
        this.status = status;
    }

    public void apply(Request request, Response response) {
        response.status = status;
        String format = request.format;
        if (request.isAjax() && "html".equals(format)) {
            format = "txt";
        }
        response.contentType = MimeTypes.getContentType("xx." + format);
        Map<String, Object> binding = Scope.RenderArgs.current().data;
        binding.put("exception", this);
        binding.put("result", this);
        binding.put("session", Scope.Session.current());
        binding.put("request", Http.Request.current());
        binding.put("flash", Scope.Flash.current());
        binding.put("params", Scope.Params.current());
        binding.put("play", new Play());
        String errorHtml = getMessage();
        try {
            errorHtml = TemplateLoader.load("errors/" + this.status + "." + (format == null ? "html" : format)).render(binding);
        } catch (Exception e) {
            Logger.warn(e, "Error page caused an error");
        }
        try {
            response.out.write(errorHtml.getBytes("utf-8"));
        } catch (Exception e) {
            throw new UnexpectedException(e);
        }
    }
}


text:
<?xml version="1.0"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.lucien</groupId>
		<artifactId>spirit-parent</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
	<artifactId>spirit-admin-api</artifactId>
	<name>${project.artifactId}</name>
	<url>http://maven.apache.org</url>
	<properties>
		<project.build.sourceEncoding>${file-encoding}</project.build.sourceEncoding>
	</properties>
	<dependencies>
		<dependency>
			<groupId>com.lucien</groupId>
			<artifactId>spirit-common</artifactId>
			<version>${spirit-common-version}</version>
		</dependency>
		<dependency>
			<groupId>com.lucien</groupId>
			<artifactId>spirit-core</artifactId>
			<version>${spirit-core-version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>org.hibernate.javax.persistence</groupId>
			<artifactId>hibernate-jpa-2.0-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.tomcat</groupId>
			<artifactId>tomcat-servlet-api</artifactId>
		</dependency>
	</dependencies>
</project>


text:
cd /projects
cat /readme.txt


text:
package technology.tikal.accounts.service;

import org.springframework.validation.BindingResult;

import technology.tikal.accounts.model.config.RoleAuthorityMapEntry;
import technology.tikal.accounts.model.config.SessionDaoRestConfig;
/**
 *
 * @author Nekorp
 *
 */
public interface AccountsConfig {

    void setSessionRestConfig(SessionDaoRestConfig config, BindingResult result);
    void setSessionAuthorityConfig(RoleAuthorityMapEntry config, BindingResult result);
}


text:
package de.moving.turtle.api;

import org.springframework.data.annotation.Id;

import java.math.BigDecimal;

/**
 * @author Stefan Scheffler(sscheffler@avantgarde-labs.de)
 */
public abstract class ResolvedRecord implements Record {

    @Id
    public String id;
    public String date;
    public BigDecimal value;
    public String purchaser;
    public String usage;

    protected ResolvedRecord(String date, BigDecimal value, String purchaser, String usage) {
        this.date = date;
        this.value = value;
        this.purchaser = purchaser;
        this.usage = usage;
    }

    @Override
    public String date() {
        return date;
    }

    @Override
    public BigDecimal value() {
        return value;
    }

    @Override
    public String purchaser() {
        return purchaser;
    }

    @Override
    public String usage() {
        return usage;
    }

    @Override
    public String toString() {
        return "ResolvedRecord{" +
                "date='" + date + '\'' +
                ", value=" + value +
                ", purchaser='" + purchaser + '\'' +
                ", usage='" + usage + '\'' +
                '}';
    }
}


text:
////////////////////////////////////////////////////////////////////
//  Archontis Politis
//  archontis.politis@aalto.fi
//  David Poirier-Quinot
//  davipoir@ircam.fr
////////////////////////////////////////////////////////////////////
//
//  JSAmbisonics a JavaScript library for higher-order Ambisonics
//  The library implements Web Audio blocks that perform
//  typical ambisonic processing operations on audio signals.
//
////////////////////////////////////////////////////////////////////

/////////////////////////////
/* MULTI-CHANNEL CONVOLVER */
/////////////////////////////

export default class convolver {

    constructor(audioCtx, order) {

        this.initialized = false;

        this.ctx = audioCtx;
        this.order = order;
        this.nCh = (order + 1) * (order + 1);
        this.encFilters = new Array(this.nCh);
        this.encFilterNodes = new Array(this.nCh);
        // input and output nodes
        this.in = this.ctx.createGain();
        this.in.channelCountMode = 'explicit';
        this.in.channelCount = 1;
        this.out = this.ctx.createChannelMerger(this.nCh);
        // convolver nodes
        for (var i = 0; i < this.nCh; i++) {
            this.encFilterNodes[i] = this.ctx.createConvolver();
            this.encFilterNodes[i].normalize = false;
        }
        // create audio connections
        for (var i = 0; i < this.nCh; i++) {
            this.in.connect(this.encFilterNodes[i]);
            this.encFilterNodes[i].connect(this.out, 0, i);
        }

        this.initialized = true;
    }

    updateFilters(audioBuffer) {
        // assign filters to convolvers
        for (var i = 0; i < this.nCh; i++) {
            this.encFilters[i] = this.ctx.createBuffer(1, audioBuffer.length, audioBuffer.sampleRate);
            this.encFilters[i].getChannelData(0).set(audioBuffer.getChannelData(i));

            this.encFilterNodes[i].buffer = this.encFilters[i];
        }
    }

}


text:
describe("right menu", function() {
  var view;
  beforeEach(function() {
    cdb.templates.add(new cdb.core.Template({
      name: 'table/views/right_panel',
      compiled: _.template(
      '
' +
        '
' +
          '' +
          '' +
          '' +
          '' +
        '
' +
        '
' +
        '
' +
      '
'
      )
    }));
    view = new cdb.admin.RightMenu();
  });

  it("should render", function() {
    var el = view.render().$el;
    expect(el.find('.layer-sidebar')).toBeTruthy();
    expect(el.find('.layer-views')).toBeTruthy();
  });

  it("should add view and a button", function() {
    var v = new cdb.core.View();
    v.buttonClass = 'testButtonClass';
    v.type = 'tool';
    view.render();
    view.addModule(v);
    expect(view.$el.find('.layer-views').children().length).toEqual(1);
    expect(view.$el.find('.tools').children().length).toEqual(1);
  });

  it("should activate right panel and add a selected class in the button", function() {
    var v = new cdb.core.View();
    v.buttonClass = 'testButtonClass';
    v.type = 'tool';
    view.render();
    view.addModule(v);

    var v2 = new cdb.core.View();
    v2.buttonClass = 'testButtonClass2';
    v2.type = 'tool';
    view.addModule(v2);

    expect(view.panels.activeTab).toEqual('testButtonClass2');

    view.$('.layer-sidebar .testButtonClass').trigger('click');

    expect(view.panels.activeTab).toEqual('testButtonClass');

    //expect(view.buttons[0].$el.attr('class')).toEqual('testButtonClass selected');
  });

  it("should hide tools related to a section and remove selected class in the button", function() {
    var v = new cdb.core.View();
    v.buttonClass = 'testButtonClass';
    v.type = 'tool';
    view.render();
    view.addModule(v, 'table');

    var v2 = new cdb.core.View();
    v2.buttonClass = 'testButtonClass2';
    v2.type = 'tool';
    view.addModule(v2, 'map');

    view.showTools('map');
    expect(view.buttons[0].$el.css('display')).toEqual('none');
    view.showTools('table');
    expect(view.buttons[0].$el.css('display')).not.toEqual('none');

    expect(view.buttons[0].$el.attr('class')).toEqual('testButtonClass');
  });

  it("should hide tool on add if the section is disabled", function() {
    var v = new cdb.core.View();
    v.buttonClass = 'testButtonClass';
    v.type = 'tool';
    view.render();
    view.addModule(v, 'table');

    view.showTools('table');

    var v2 = new cdb.core.View();
    v2.buttonClass = 'testButtonClass2';
    v2.type = 'tool';
    view.addModule(v2, 'map');

    expect(view.buttons[0].$el.css('display')).not.toEqual('none');
    expect(view.buttons[1].$el.css('display')).toEqual('none');
  });

  it("should add tool buttons", function() {
    view.render();
    var b = view.addToolButton('testing', 'table');
    view.addToolButton('testing2', 'map');
    expect(view.buttons[0].className).toEqual('testing');
    expect(view.buttons[0]).toEqual(b);
    view.showTools('map');
    view.addToolButton('testing3', 'table');
    expect(view.buttons[0].$el.css('display')).toEqual('none');
    expect(view.buttons[1].$el.css('display')).not.toEqual('none');
    expect(view.buttons[2].$el.css('display')).toEqual('none');
  });
});


text:
package cn.ytxu.androidbackflow.sample.fragments.multi_fragment.letter;

/**
 * Created by ytxu on 17/1/5.
 */
public class MFLetterCFragment extends MFBaseLetterFragment {
}


text:
module TwentyOne where

import           Data.List  (find, maximumBy, sortBy, tails)
import           Data.Maybe (catMaybes, fromJust)
import           Data.Ord   (comparing)

------------------------------------------------------------------------------
-- Stuff you can have
------------------------------------------------------------------------------

data Item = Item { itemName   :: String
                 , itemCost   :: Int
                 , itemDamage :: Int
                 , itemArmor  :: Int }
            deriving (Show)

data Inventory = Inventory { weapon :: Item
                           , armor  :: Maybe Item
                           , rings  :: [Item] }
                 deriving Show

inventoryTotal :: (Item -> Int) -> Inventory -> Int
inventoryTotal f = sum . map f . allItems
  where
    allItems p = [weapon p] ++ catMaybes [armor p] ++ rings p

inventoryCost :: Inventory -> Int
inventoryCost = inventoryTotal itemCost

availableWeapons :: [Item]
availableWeapons = [ Item "Dagger"      8 4 0
                   , Item "Shortsword" 10 5 0
                   , Item "Warhammer"  25 6 0
                   , Item "Longsword"  40 7 0
                   , Item "Greataxe"   74 8 0
                   ]

availableArmor :: [Item]
availableArmor = [ Item "Leather"     13 0 1
                 , Item "Chainmail"   31 0 2
                 , Item "Splintmail"  53 0 3
                 , Item "Bandedmail"  75 0 4
                 , Item "Platemail"  102 0 5
                 ]

availableRings :: [Item]
availableRings = [ Item "Damage +1"   25 1 0
                 , Item "Damage +2"   50 2 0
                 , Item "Damage +3"  100 3 0
                 , Item "Defense +1"  20 0 1
                 , Item "Defense +2"  40 0 2
                 , Item "Defense +3"  80 0 3
                 ]

possibleInventories :: [Inventory]
possibleInventories = Inventory <$> availableWeapons <*> possibleArmor <*> possibleRingSelections
  where
    possibleArmor = Nothing : map Just availableArmor
    possibleRingSelections = [[]] ++ map (:[]) availableRings ++ pairs availableRings

pairs :: [a] -> [[a]]
pairs xs = concatMap (\(c, rest) -> map (\d -> [c, d]) rest) $ zip xs (takeWhile (not . null) . drop 1 $ tails xs) -- ugh

------------------------------------------------------------------------------
-- Players and fighting
------------------------------------------------------------------------------

data PlayerRole = You | Boss
                deriving (Eq, Show)

data Player = Player { role         :: PlayerRole
                     , hitPoints    :: Int
                     , playerDamage :: Int
                     , playerArmor  :: Int }
              deriving (Show)

damage :: Player -> Player -> Int
damage attacker defender = max 1 (playerDamage attacker - playerArmor defender)

attack :: Player -> Player -> Player
attack attacker defender =
  defender { hitPoints = max 0 (hitPoints defender - damage attacker defender) }

winner :: Player -> Player -> Player
winner a b = mostHitpoints . fromJust . find gameOver $ rounds
  where
    rounds = iterate attackAndSwap (a, b)
    attackAndSwap (a', b') = (attack a' b', a')
    gameOver (a', b') = hitPoints a' == 0 || hitPoints b' == 0
    mostHitpoints (a', b') = maximumBy (comparing hitPoints) [a', b']

------------------------------------------------------------------------------
-- The showdown
------------------------------------------------------------------------------

youWithInventory :: Inventory -> Player
youWithInventory i = Player You 100 (inventoryTotal itemDamage i) (inventoryTotal itemArmor i)

boss :: Player
boss = Player Boss 100 8 2

youWinWith :: Inventory -> Bool
youWinWith inv = You == role victor
  where
    you = youWithInventory inv
    victor = winner you boss

cheapestWin :: Maybe Inventory
cheapestWin = find youWinWith cheapestInventories

cheapestInventories :: [Inventory]
cheapestInventories = sortBy (comparing inventoryCost) possibleInventories

priciestLoss :: Maybe Inventory
priciestLoss = find (not . youWinWith) priciestInventories

priciestInventories :: [Inventory]
priciestInventories = sortBy (flip $ comparing inventoryCost) possibleInventories

twentyOne :: (Int, Int)
twentyOne = ( inventoryCost $ fromJust cheapestWin
            , inventoryCost $ fromJust priciestLoss
            )