text:
void protobuf_AddDesc_MessageRequestPing_2eproto();
void protobuf_AssignDesc_MessageRequestPing_2eproto();
void protobuf_ShutdownFile_MessageRequestPing_2eproto();

class MessageRequestPing;

// ===================================================================

class MessageRequestPing : public ::google::protobuf::MessageLite {
 public:
  MessageRequestPing();
  virtual ~MessageRequestPing();

  MessageRequestPing(const MessageRequestPing& from);

  inline MessageRequestPing& operator=(const MessageRequestPing& from) {
    CopyFrom(from);
    return *this;
  }

  inline const ::std::string& unknown_fields() const {
    return _unknown_fields_.GetNoArena(
        &::google::protobuf::internal::GetEmptyStringAlreadyInited());
  }

  inline ::std::string* mutable_unknown_fields() {
    return _unknown_fields_.MutableNoArena(
        &::google::protobuf::internal::GetEmptyStringAlreadyInited());
  }

  static const MessageRequestPing& default_instance();

  #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
  // Returns the internal default instance pointer. This function can
  // return NULL thus should not be used by the user. This is intended
  // for Protobuf internal code. Please use default_instance() declared
  // above instead.
  static inline const MessageRequestPing* internal_default_instance() {
    return default_instance_;
  }
  #endif

  void Swap(MessageRequestPing* other);

  // implements Message ----------------------------------------------

  inline MessageRequestPing* New() const { return New(NULL); }

  MessageRequestPing* New(::google::protobuf::Arena* arena) const;
  void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
  void CopyFrom(const MessageRequestPing& from);
  void MergeFrom(const MessageRequestPing& from);
  void Clear();
  bool IsInitialized() const;

  int ByteSize() const;
  bool MergePartialFromCodedStream(
      ::google::protobuf::io::CodedInputStream* input);
  void SerializeWithCachedSizes(
      ::google::protobuf::io::CodedOutputStream* output) const;
  void DiscardUnknownFields();
  int GetCachedSize() const { return _cached_size_; }
  private:
  void SharedCtor();
  void SharedDtor();
  void SetCachedSize(int size) const;
  void InternalSwap(MessageRequestPing* other);
  private:
  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
    return _arena_ptr_;
  }
  inline ::google::protobuf::Arena* MaybeArenaPtr() const {
    return _arena_ptr_;
  }
  public:

  ::std::string GetTypeName() const;

  // nested types ----------------------------------------------------

  // accessors -------------------------------------------------------

  // required string someText = 1 [default = ""];
  bool has_sometext() const;
  void clear_sometext();
  static const int kSomeTextFieldNumber = 1;
  const ::std::string& sometext() const;
  void set_sometext(const ::std::string& value);
  void set_sometext(const char* value);
  void set_sometext(const char* value, size_t size);
  ::std::string* mutable_sometext();
  ::std::string* release_sometext();
  void set_allocated_sometext(::std::string* sometext);

  // @@protoc_insertion_point(class_scope:MessageRequestPing)
 private:
  inline void set_has_sometext();
  inline void clear_has_sometext();

  ::google::protobuf::internal::ArenaStringPtr _unknown_fields_;
  ::google::protobuf::Arena* _arena_ptr_;

  ::google::protobuf::uint32 _has_bits_[1];
  mutable int _cached_size_;
  ::google::protobuf::internal::ArenaStringPtr sometext_;
  #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
  friend void  protobuf_AddDesc_MessageRequestPing_2eproto_impl();
  #else
  friend void  protobuf_AddDesc_MessageRequestPing_2eproto();
  #endif
  friend void protobuf_AssignDesc_MessageRequestPing_2eproto();
  friend void protobuf_ShutdownFile_MessageRequestPing_2eproto();

  void InitAsDefaultInstance();
  static MessageRequestPing* default_instance_;
};
// ===================================================================

// ===================================================================

#if !PROTOBUF_INLINE_NOT_IN_HEADERS
// MessageRequestPing

// required string someText = 1 [default = ""];
inline bool MessageRequestPing::has_sometext() const {
  return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void MessageRequestPing::set_has_sometext() {
  _has_bits_[0] |= 0x00000001u;
}
inline void MessageRequestPing::clear_has_sometext() {
  _has_bits_[0] &= ~0x00000001u;
}
inline void MessageRequestPing::clear_sometext() {
  sometext_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  clear_has_sometext();
}
inline const ::std::string& MessageRequestPing::sometext() const {
  // @@protoc_insertion_point(field_get:MessageRequestPing.someText)
  return sometext_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void MessageRequestPing::set_sometext(const ::std::string& value) {
  set_has_sometext();
  sometext_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
  // @@protoc_insertion_point(field_set:MessageRequestPing.someText)
}
inline void MessageRequestPing::set_sometext(const char* value) {
  set_has_sometext();
  sometext_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
  // @@protoc_insertion_point(field_set_char:MessageRequestPing.someText)
}
inline void MessageRequestPing::set_sometext(const char* value, size_t size) {
  set_has_sometext();
  sometext_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
      ::std::string(reinterpret_cast<const char*>(value), size));
  // @@protoc_insertion_point(field_set_pointer:MessageRequestPing.someText)
}
inline ::std::string* MessageRequestPing::mutable_sometext() {
  set_has_sometext();
  // @@protoc_insertion_point(field_mutable:MessageRequestPing.someText)
  return sometext_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* MessageRequestPing::release_sometext() {
  // @@protoc_insertion_point(field_release:MessageRequestPing.someText)
  clear_has_sometext();
  return sometext_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline void MessageRequestPing::set_allocated_sometext(::std::string* sometext) {
  if (sometext != NULL) {
    set_has_sometext();
  } else {
    clear_has_sometext();
  }
  sometext_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), sometext);
  // @@protoc_insertion_point(field_set_allocated:MessageRequestPing.someText)
}

#endif  // !PROTOBUF_INLINE_NOT_IN_HEADERS

// @@protoc_insertion_point(namespace_scope)

// @@protoc_insertion_point(global_scope)

#endif  // PROTOBUF_MessageRequestPing_2eproto__INCLUDED


text:
<?php

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model common\models\ComputerSummary */

$this->title = Yii::t('common', 'Create');
$this->params['breadcrumbs'][] = ['label' => Yii::t('computerSummary', 'Computer Summaries'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

    <?= $this->render('_form', ['model' => $model]) ?>

redpajama_set_name: RedPajamaGithub


text:
import { red500, indigo800, lightBlue500 } from 'material-ui/styles/colors';

export const providers = [
  { provider: 'twitter', color: lightBlue500 },
  { provider: 'facebook', color: indigo800 },
  { provider: 'google', color: red500 }
];


text:
@interface ViewController()

@property (nonatomic, strong) AVAudioPlayer* mPlayer;

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

	NSString * backgroundPath = [[NSBundle mainBundle] pathForResource:@"backgroundmusic" ofType:@"mp3"];

	NSURL * pathURL = [[NSURL alloc] initFileURLWithPath:backgroundPath];

	AVAudioPlayer * newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: pathURL error: nil];
	self.mPlayer = newPlayer;
	self.mPlayer.delegate = self;
	self.mPlayer.volume = 0.5;
	[self.mPlayer play];

	self.plug.delegate = self;
	self.game = [[Game alloc] initWithPlayers:self.players Id:self.myId];

	if(self.game.currentPlayer == self.game.me){
		// mount table to send

		NSMutableArray * resources = [[NSMutableArray alloc] init];

		NSMutableArray * numbers = [[NSMutableArray alloc] init];

		NSMutableArray * portTypes = [[NSMutableArray alloc]init];

		NSMutableArray * portResources = [[NSMutableArray alloc]init];

		NSDictionary * data;

		self.game.table.thief = nil;

		for(HexagonNode * hex in self.game.table.hexes){
			[resources addObject: [NSNumber numberWithInt:hex.resource]];
			[numbers addObject:[NSNumber numberWithInt:hex.number]];

			if(hex.resource == DESERT && self.game.table.thief == nil){
				self.game.table.thief = hex;
			}
		}

		for (VertexNode* vertex in self.game.table.vertexes) {

			[portTypes addObject:[NSNumber numberWithInt:vertex.port.type]];
			[portResources addObject:[NSNumber numberWithInt:vertex.port.resource]];

		}

		data = [NSDictionary dictionaryWithObjects:@[resources, numbers, self.game.table.deck.deck, portTypes, portResources] forKeys:@[@"resources",@"numbers",@"deck", @"portTypes", @"portResources"]];

		[self.plug sendMessage:MSG_TABLEREADY data:data];
	}

	// Configure the view.
    SKView * skView = (SKView *)self.view;
    //skView.showsFPS = YES;
    //skView.showsNodeCount = YES;

    // Present the scene.
	if(self.game.currentPlayer == self.game.me){
		// Create and configure the scene.
		self.scene = [MyScene sceneWithSize:skView.bounds.size andGame:self.game];
		self.scene.plug = self.plug;
		self.scene.plug.delegate = self.scene;
		self.scene.scaleMode = SKSceneScaleModeAspectFill;
		self.scene.tutorialMode = self.tutorialMode;
		[self.scene createTutorial];
		[skView presentScene:self.scene];
	}

	[self.scene addObserver:self forKeyPath:@"endGame" options:NSKeyValueObservingOptionNew context:nil];
}

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
	[self.scene removeObserver:self forKeyPath:@"endGame"];
	[self dismissViewControllerAnimated:YES completion:nil];
}

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return UIInterfaceOrientationMaskAllButUpsideDown;
    } else {
        return UIInterfaceOrientationMaskAll;
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

-(void)plug:(Plug *)plug hasClosedWithError:(BOOL)error{

}

-(void)plug:(Plug *)plug receivedMessage:(PlugMsgType)type data:(id)data{

	if(type == MSG_TABLEREADY){

		NSDictionary * received = data;

		self.game.table = [[Table alloc] initWithTable:received];
		[self.game.table initializeMinesForPlayers:self.game.players.count];
		self.scene = [MyScene sceneWithSize:self.view.bounds.size andGame:self.game];
		self.scene.plug = self.plug;
		self.scene.plug.delegate = self.scene;
		self.scene.scaleMode = SKSceneScaleModeAspectFill;
		self.scene.tutorialMode = self.tutorialMode;
		[self.scene createTutorial];
		[(SKView*)self.view presentScene:self.scene];
	}

}

-(void)plugHasConnected:(Plug *)plug{

}

- (void) audioPlayerDidFinishPlaying: (AVAudioPlayer *) player
                        successfully: (BOOL) completed {
    [self.mPlayer play];
}

@end


text:
§align:center
##### §ncovers1624§n
§rule{height:20}
§entity[player:covers1624]{size:128,track_mouse:true}

§rule{colour:0x606060,height:3,width:100%,top_pad:0}
covers1624 is the creator creator of... umm... nothing? Yet he single-handedly ported a large number of the well known mods to Minecraft 1.12.
He is the current maintainer of all Chicken Bones mods, a member of TeamCoFH, and has contributed to more mods than I can count!

Covers has also helped a lot with the server-side back end for Project Intelligence.
§rule{colour:0x606060,height:3,width:100%,top_pad:0}


text:
package org.ops4j.pax.web.service.tomcat.internal;

import javax.servlet.Servlet;

import org.ops4j.pax.web.service.spi.LifeCycle;
import org.ops4j.pax.web.service.spi.model.ContextModel;
import org.ops4j.pax.web.service.spi.model.ErrorPageModel;
import org.ops4j.pax.web.service.spi.model.EventListenerModel;
import org.ops4j.pax.web.service.spi.model.FilterModel;
import org.ops4j.pax.web.service.spi.model.SecurityConstraintMappingModel;
import org.ops4j.pax.web.service.spi.model.ServletModel;
import org.ops4j.pax.web.service.spi.model.WelcomeFileModel;
import org.osgi.service.http.HttpContext;

/**
 * Created with IntelliJ IDEA. User: romain.gilles Date: 6/10/12 Time: 6:27 PM
 * To change this template use File | Settings | File Templates.
 */
public interface ServerWrapper {
	void start();

	void stop();

	void addServlet(ServletModel model);

	void removeServlet(ServletModel model);

	void removeContext(HttpContext httpContext);

	void addErrorPage(ErrorPageModel model);

	void removeErrorPage(ErrorPageModel model);

	void addFilter(FilterModel filterModel);

	void removeFilter(FilterModel filterModel);

	void addEventListener(EventListenerModel eventListenerModel);

	void removeEventListener(EventListenerModel eventListenerModel);

	Servlet createResourceServlet(ContextModel contextModel, String alias,
								  String name);

	void addSecurityConstraintMapping(SecurityConstraintMappingModel secMapModel);

	LifeCycle getContext(ContextModel model);

	void addWelcomeFiles(WelcomeFileModel model);

	void removeWelcomeFiles(WelcomeFileModel model);

}


text:
<?php
namespace CakephpBlueimpUpload\Model\Entity;

use Cake\ORM\Entity;

/**
 * Upload Entity.
 */
class Upload extends Entity
{

    /**
     * Fields that can be mass assigned using newEntity() or patchEntity().
     *
     * @var array
     */
    protected $_accessible = [
        'original_filename' => true,
        'unique_filename' => true,
        'subfolder' => true,
        'mimetype' => true,
        'size' => true,
        'hash' => true,
        'upload_id' => true,
        'complete' => true,
        'label' => true,
        'created_by' => true,
        'modified_by' => true,
        'upload' => true,
    ];
}


text:
// Boost.Geometry

// Copyright (c) 2014 Oracle and/or its affiliates.

// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle

// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_FLATTENING_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_FLATTENING_HPP

#include <boost/geometry/core/radius.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>

#include <boost/geometry/algorithms/not_implemented.hpp>

namespace boost { namespace geometry
{

#ifndef DOXYGEN_NO_DISPATCH
namespace detail_dispatch
{

template <typename ResultType, typename Geometry, typename Tag = typename tag<Geometry>::type>
struct flattening
    : not_implemented<Tag>
{};

template <typename ResultType, typename Geometry>
struct flattening<ResultType, Geometry, srs_sphere_tag>
{
    static inline ResultType apply(Geometry const& /*geometry*/)
    {
        return ResultType(0);
    }
};

template <typename ResultType, typename Geometry>
struct flattening<ResultType, Geometry, srs_spheroid_tag>
{
    static inline ResultType apply(Geometry const& geometry)
    {
        return ResultType(get_radius<0>(geometry) - get_radius<2>(geometry))
                    / ResultType(get_radius<0>(geometry));
    }
};

} // namespace detail_dispatch
#endif // DOXYGEN_NO_DISPATCH

#ifndef DOXYGEN_NO_DETAIL
namespace detail
{

template <typename ResultType, typename Geometry>
ResultType flattening(Geometry const& geometry)
{
    return detail_dispatch::flattening<ResultType, Geometry>::apply(geometry);
}

} // namespace detail
#endif // DOXYGEN_NO_DETAIL

}} // namespace boost::geometry

#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_FLATTENING_HPP


text:
from __future__ import absolute_import

from base64 import b64encode, b64decode

from . import crypto, apiclient
from collections import namedtuple
from datetime import datetime

class Client:
    """
    The main entry point for the Delta SDK.

    An instance of this class will provide an interface to work and interact
    with the Delta API. The core domain objects (Identity, Secret and
    Event) are returned from method calls to this class, and themselves provide
    fluent interface that can be used to continue interactive with the Delta
    API. Consumers of this SDK can therefore choose whether they wish to
    construct all the calls from base values (i.e. id strings such as
    identity_id, secret_id, etc) or via the fluent interfaces (or a mixture of
    both).
    """

    def __init__(self, key_store, api_client_factory=apiclient.ApiClient):
        """
        Creates a new DeltaClient instance from the provided configuration.

        :param key_store: the key store
        :type key_store: :class:`~.DeltaKeyStore`
        :param api_client_factory: the API client factory
        :type api_client_factory:
           (:class:`~.DeltaKeyStore`) -> :class:`~.ApiClient`
        """
        self.__key_store = key_store
        self.__api_client = api_client_factory(key_store)

    @property
    def key_store(self):
        return self.__key_store

    @property
    def api_client(self):
        return self.__api_client

    def create_identity(self, external_id=None, metadata=None):
        """
        Creates a new identity in Delta.

        :param external_id: the external id to associate with the identity
        :type external_id: str | None
        :param metadata: the metadata to associate with the identity
        :type metadata: dict[str, str] | None
        :return: the identity
        :rtype: :class:`~.Identity`
        """
        private_signing_key = crypto.generate_private_key()
        private_encryption_key = crypto.generate_private_key()

        public_signing_key = crypto.serialize_public_key(
            private_signing_key.public_key())
        public_encryption_key = crypto.serialize_public_key(
            private_encryption_key.public_key())

        identity_id = self.api_client.register_identity(public_encryption_key,
                                                        public_signing_key,
                                                        external_id, metadata)

        self.key_store.store_keys(identity_id=identity_id,
                                  private_signing_key=private_signing_key,
                                  private_encryption_key=private_encryption_key)

        return Identity(self, identity_id, public_encryption_key,
                        external_id, metadata)

    def get_identity(self, identity_id, identity_to_retrieve=None):
        """
        Gets the identity matching the given identity id.

        :param str identity_id: the authenticating identity id
        :type identity_to_retrieve: str | None
        :return: the identity
        :rtype: :class:`~.Identity`
        """
        response = self.api_client.get_identity(
            identity_id,
            identity_to_retrieve if identity_to_retrieve else identity_id)

        return Identity(self,
                        response["id"],
                        response["cryptoPublicKey"],
                        response.get("externalId"),
                        response.get("metadata"))

    def get_identities_by_metadata(self, identity_id, metadata,
                                   page=None, page_size=None):
        """
        Gets a list of identities matching the given metadata key and value
        pairs, bound by the pagination parameters.

        :param str identity_id: the authenticating identity id
        :param metadata: the metadata key and value pairs to filter
        :type metadata: dict[str, str]
        :param page: the page number
        :type page: int | None
        :param page_size: the page size
        :type page_size: int | None
        :return: a generator of :class:`~.Identity` satisfying the request
        :rtype: generator of :class:`~.Identity`
        """
        identities = self.api_client.get_identities_by_metadata(
            identity_id, metadata, page, page_size)
        for identity in identities:
            yield Identity(self,
                           identity["id"],
                           identity["cryptoPublicKey"],
                           identity.get("externalId"),
                           identity.get("metadata"))

    def get_events(self, identity_id, secret_id=None, rsa_key_owner_id=None):
        """
        Gets a list of events associated filtered by secret id or RSA key owner
        or both secret id and RSA key owner.

        :param str identity_id: the authenticating identity id
        :param secret_id: the secret id of interest
        :type secret_id: str | None
        :param rsa_key_owner_id: the rsa key owner id of interest
        :type rsa_key_owner_id: str | None
        :return: a generator of audit events
        :rtype: generator of :class:`~.Event`
        """
        events = self.api_client.get_events(
            identity_id, secret_id, rsa_key_owner_id)
        for event in events:
            details = event["eventDetails"]
            timestamp = event["timestamp"]
            yield Event(
                event_details=EventDetails(
                    base_secret_id=details.get("baseSecretId"),
                    requestor_id=details.get("requesterId"),
                    rsa_key_owner_id=details.get("rsaKeyOwnerId"),
                    secret_id=details.get("secretId"),
                    secret_owner_id=details.get("secretOwnerId")
                ),
                host=event["host"],
                event_id=event["id"],
                source_ip=event["sourceIp"],
                timestamp=datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ"),
                event_type=event["type"]
            )

    def create_secret(self, identity_id, content):
        """
        Creates a new secret in Delta with the given byte contents.

        :param str identity_id: the authenticating identity id
        :param bytes content: the secret contents
        :return: the secret
        :rtype: :class:`~.Secret`
        """
        secret_key = crypto.generate_secret_key()
        iv = crypto.generate_initialisation_vector()

        public_key = self.key_store.get_private_encryption_key(
            identity_id).public_key()

        encrypted_key = crypto.encrypt_key_with_public_key(secret_key,
                                                           public_key)
        cipher_text, tag = crypto.encrypt(content, secret_key, iv)
        response = self.api_client.create_secret(
            requestor_id=identity_id,
            content=b64encode(cipher_text + tag).decode('utf-8'),
            encryption_details=dict(
                symmetricKey=b64encode(encrypted_key).decode('utf-8'),
                initialisationVector=b64encode(iv).decode('utf-8')
            ))

        return self.get_secret(identity_id, response["id"])

    def get_secret(self, identity_id, secret_id):
        """
        Gets the given secret by id.

        :param str identity_id: the authenticating identity id
        :param str secret_id: the id of the secret to retrieve
        :return: the secret
        :rtype: :class:`~.Secret`
        """
        response = self.api_client.get_secret(identity_id, secret_id)

        return Secret(self,
                      response["id"],
                      response["created"],
                      response["rsaKeyOwner"],
                      response["createdBy"],
                      EncryptionDetails(
                          response["encryptionDetails"]["symmetricKey"],
                          response["encryptionDetails"]["initialisationVector"]
                      ),
                      response.get("baseSecretId"))

    def get_secrets(self,
                    identity_id,
                    base_secret_id=None,
                    created_by=None,
                    rsa_key_owner_id=None,
                    metadata=None,
                    lookup_type=apiclient.SecretLookupType.any,
                    page=None,
                    page_size=None):
        """
        Gets a list of secrets based on the query parameters, bound by the
        pagination parameters.

        :param str identity_id: the authenticating identity id
        :param base_secret_id: the id of the base secret
        :type base_secret_id: str | None
        :param created_by: the id of the secret creator
        :type created_by: str | None
        :param rsa_key_owner_id: the id of the RSA key owner
        :type rsa_key_owner_id: str | None
        :param metadata: the metadata associated with the secret
        :type metadata: dict[str, str] | None
        :param lookup_type: the type of the lookup query
        :type lookup_type: :class:`~.SecretLookupType`
        :param page: the page number
        :type page: int | None
        :param page_size: the page size
        :type page_size: int | None
        :return: a generator of secrets satisfying the search criteria
        :rtype: generator of :class:`~.Secret`
        """
        secrets = self.api_client.get_secrets(
            identity_id, base_secret_id, created_by, rsa_key_owner_id,
            metadata, lookup_type, page, page_size)
        for secret in secrets:
            yield Secret(self,
                         secret_id=secret["id"],
                         created=secret["created"],
                         rsa_key_owner=secret.get("rsaKeyOwner"),
                         created_by=secret["createdBy"],
                         encryption_details=None,
                         base_secret_id=secret.get("baseSecret"))

    def get_secret_content_encrypted(self, identity_id, secret_id):
        """
        Gets the base64 encoded encrypted content given the secret id.

        Note that the returned encrypted content when decoded from base64 has a
        trailing 16 byte GCM authentication tag appended (i.e. the cipher text
        is the byte range [:-16] and the authentication tag is the remaining
        [-16:] bytes).

        :param str identity_id: the authenticating identity id
        :param str secret_id: the secret id
        :return: the encrypted content encoded in base64
        :rtype: str
        """
        return self.api_client.get_secret_content(identity_id, secret_id)

    def get_secret_content(self, identity_id, secret_id, symmetric_key,
                           initialisation_vector):
        """
        Gets the plaintext content, given the symmetric key and
        initialisation vector used for encryption.

        :param str identity_id: the authenticating identity id
        :param str secret_id: the secret id
        :param str symmetric_key:
            the symmetric key used for encryption encoded in base64
        :param str initialisation_vector:
            the initialisation vector encoded in base64
        :return: the plaintext content of the secret
        :rtype: bytes
        """
        encrypted_content = b64decode(
            self.get_secret_content_encrypted(identity_id, secret_id))

        decrypted_key = crypto.decrypt_with_private_key(
            b64decode(symmetric_key),
            self.key_store.get_private_encryption_key(identity_id))

        return crypto.decrypt(encrypted_content[:-16],
                              encrypted_content[-16:],
                              decrypted_key,
                              b64decode(initialisation_vector))

    def share_secret(self, identity_id, recipient_id, secret_id):
        """
        Shares the base secret with the specified recipient. The contents will
        be encrypted with the public encryption key of the RSA key owner, and a
        new secret key and initialisation vector will be generated. This call
        will result in a new derived secret being created and returned.

        :param str identity_id: the authenticating identity id
        :param str recipient_id: the target identity id to share the base secret
        :param str secret_id: the base secret id
        :return: the derived secret
        :rtype: :class:`~.Secret`
        """
        recipient = self.get_identity(identity_id, recipient_id)
        secret = self.get_secret(identity_id, secret_id)

        secret_key = crypto.generate_secret_key()
        iv = crypto.generate_initialisation_vector()

        public_key = crypto.deserialize_public_key(
            recipient.public_encryption_key)

        encrypted_key = crypto.encrypt_key_with_public_key(secret_key,
                                                           public_key)
        cipher_text, tag = crypto.encrypt(secret.get_content(), secret_key, iv)
        response = self.api_client.share_secret(
            requestor_id=identity_id,
            content=b64encode(cipher_text + tag).decode('utf-8'),
            encryption_details=dict(
                symmetricKey=b64encode(encrypted_key).decode('utf-8'),
                initialisationVector=b64encode(iv).decode('utf-8')),
            base_secret_id=secret.secret_id,
            rsa_key_owner_id=recipient.identity_id)

        return self.get_secret(recipient.identity_id, response["id"])

    def delete_secret(self, identity_id, secret_id):
        """
        Deletes the secret with the given secret id.

        :param str identity_id: the authenticating identity id
        :param str secret_id: the secret id
        """
        self.api_client.delete_secret(identity_id, secret_id)

    def get_secret_metadata(self, identity_id, secret_id):
        """
        Gets the metadata key and value pairs for the given secret.

        :param str identity_id: the authenticating identity id
        :param str secret_id: the secret id to be retrieved
        :return: the retrieved secret metadata dictionary and version tuple
        :rtype: (dict[str, str], int)
        """
        return self.api_client.get_secret_metadata(identity_id, secret_id)

    def add_secret_metadata(self, identity_id, secret_id, metadata):
        """
        Adds metadata to the given secret. The version number is required for
        optimistic locking on concurrent updates. An attempt to update metadata
        with outdated version will be rejected by the server. Passing in an
        empty metadata map will result in no changes to the metadata or
        version number.

        :param str identity_id: the authenticating identity id
        :param str secret_id: the secret id
        :param metadata: a map of metadata key and value pairs
        :type metadata: dict[str, str]
        """
        existing_metadata, existing_version = \
            self.get_secret_metadata(identity_id, secret_id)

        updated_metadata = existing_metadata.copy()
        updated_metadata.update(metadata)

        self.api_client.update_secret_metadata(
            identity_id, secret_id, updated_metadata, existing_version)

class Identity:
    """
    An instance of this class encapsulates an identity in Covata Delta. An
    identity can be a user, application, device or any other identifiable
    entity that can create secrets and/or be target recipient of a secret.

    An has two sets of asymmetric keys, for encryption and for signing of
    requests. Identities may also have optional, public, searchable metadata
    and a reference to an identifier in an external system.
    """

    def __init__(self, parent, identity_id, public_encryption_key,
                 external_id, metadata):
        """
        Creates a new identity in Delta with the provided metadata
        and external id.

        :param parent: the Delta client that constructed this instance
        :type parent: :class:`~.Client`
        :param identity_id: the id of the identity
        :param str public_encryption_key: the public signing key of the identity
        :param external_id: the external id of the identity
        :type external_id: str | None
        :param metadata: the metadata belonging to the identity
        :type metadata: dict[str, str] | None
        """
        self.__parent = parent
        self.__identity_id = identity_id
        self.__public_encryption_key = public_encryption_key
        self.__external_id = external_id
        self.__metadata = metadata

    @property
    def parent(self):
        return self.__parent

    @property
    def identity_id(self):
        return self.__identity_id

    @property
    def public_encryption_key(self):
        return self.__public_encryption_key

    @property
    def external_id(self):
        return self.__external_id

    @property
    def metadata(self):
        return self.__metadata

    def get_identity(self, identity_to_retrieve=None):
        """
        Gets the identity matching the given identity id.

        :type identity_to_retrieve: str | None
        :return: the identity
        :rtype: :class:`~.Identity`
        """
        return self.parent.get_identity(self.identity_id, identity_to_retrieve)

    def get_identities_by_metadata(self, metadata, page=None, page_size=None):
        """
        Gets a list of identities matching the given metadata key and value
        pairs, bound by the pagination parameters.

        :param metadata: the metadata key and value pairs to filter
        :type metadata: dict[str, str]
        :param page: the page number
        :type page: int | None
        :param page_size: the page size
        :type page_size: int | None
        :return: a generator of :class:`~.Identity` satisfying the request
        :rtype: generator of [:class:`~.Identity`]
        """
        return self.parent.get_identities_by_metadata(
            self.identity_id, metadata, page, page_size)

    def get_events(self, secret_id=None, rsa_key_owner_id=None):
        """
        Gets a list of events associated filtered by secret id or RSA key owner
        or both secret id and RSA key owner.

        :param secret_id: the secret id of interest
        :type secret_id: str | None
        :param rsa_key_owner_id: the rsa key owner id of interest
        :type rsa_key_owner_id: str | None
        :return: a generator of audit events
        :rtype: generator of :class:`~.Event`
        """
        return self.parent.get_events(
            self.identity_id, secret_id, rsa_key_owner_id)

    def get_secrets(self,
                    base_secret_id=None,
                    created_by=None,
                    rsa_key_owner_id=None,
                    metadata=None,
                    lookup_type=apiclient.SecretLookupType.any,
                    page=None,
                    page_size=None):
        """
        Gets a list of secrets based on the query parameters, bound by the
        pagination parameters.

        :param base_secret_id: the id of the base secret
        :type base_secret_id: str | None
        :param created_by: the id of the secret creator
        :type created_by: str | None
        :param rsa_key_owner_id: the id of the RSA key owner
        :type rsa_key_owner_id: str | None
        :param metadata: the metadata associated with the secret
        :type metadata: dict[str, str] | None
        :param lookup_type: the type of the lookup query
        :type lookup_type: :class:`~.SecretLookupType`
        :param page: the page number
        :type page: int | None
        :param page_size: the page size
        :type page_size: int | None
        :return: a generator of secrets satisfying the search criteria
        :rtype: generator of :class:`~.Secret`
        """
        return self.parent.get_secrets(
            self.identity_id, base_secret_id, created_by, rsa_key_owner_id,
            metadata, lookup_type, page, page_size)

    def create_secret(self, content):
        """
        Creates a new secret in Delta with the given contents.

        :param bytes content: the secret content
        :return: the secret
        :rtype: :class:`~.Secret`
        """
        return self.parent.create_secret(self.identity_id, content)

    def retrieve_secret(self, secret_id):
        """
        Retrieves a secret with this identity.

        :param str secret_id: the secret id
        :return: the secret
        :rtype: :class:`~.Secret`
        """
        return self.parent.get_secret(self.identity_id, secret_id)

    def delete_secret(self, secret_id):
        """
        Deletes the secret with the given secret id.

        :param str secret_id: the secret id
        """
        self.parent.delete_secret(self.identity_id, secret_id)

    def __repr__(self):
        return "{cls}(identity_id={identity_id})".format(
            cls=self.__class__.__name__, identity_id=self.identity_id)

class Secret:
    """
    An instance of this class encapsulates a secret in Covata Delta. A
    secret has contents, which is encrypted by a symmetric key algorithm as
    defined in the immutable EncryptionDetails class, holding information such
    as the symmetric (secret) key, initialisation vector and algorithm. The
    symmetric key is encrypted with the public encryption key of the RSA key
    owner. This class will return the decrypted contents and symmetric key if
    returned as a result of Client.
    """

    def __init__(self, parent, secret_id, created, rsa_key_owner, created_by,
                 encryption_details, base_secret_id=None):
        """
        Creates a new secret with the given parameters.

        :param parent: the Delta client that constructed this instance
        :type parent: :class:`~.Client`
        :param str secret_id: the id of the secret
        :param str created: the created date
        :param str rsa_key_owner: the identity id of the RSA key owner
        :param str created_by: the identity id of the secret creator
        :param encryption_details: the encryption details of the secret
        :type encryption_details: :class:`~.EncryptionDetails`
        """
        self.__parent = parent
        self.__secret_id = secret_id
        self.__created = created
        self.__rsa_key_owner = rsa_key_owner
        self.__created_by = created_by
        self.__encryption_details = encryption_details
        self.__base_secret_id = base_secret_id

    @property
    def parent(self):
        return self.__parent

    @property
    def secret_id(self):
        return self.__secret_id

    @property
    def created(self):
        return self.__created

    @property
    def rsa_key_owner(self):
        return self.__rsa_key_owner

    @property
    def created_by(self):
        return self.__created_by

    @property
    def encryption_details(self):
        return self.__encryption_details

    @property
    def base_secret_id(self):
        return self.__base_secret_id

    def get_content(self):
        """
        Gets the content of a secret, encrypted with the details defined in the
        encryption_details of this secret and encoded in base64.

        :return: the content of the secret encoded in base64
        :rtype: str
        """
        return self.parent.get_secret_content(
            self.rsa_key_owner,
            self.secret_id,
            self.encryption_details.symmetric_key,
            self.encryption_details.initialisation_vector)

    def share_with(self, identity_id):
        """
        Shares this secret with the target recipient identity. This action
        will create a new (derived) secret in Covata Delta, and the new
        secret will be returned to the caller.

        The credentials of the RSA key owner must be present in the local
        key store.

        :param str identity_id: the recipient identity id
        :return: the derived secret
        :rtype: :class:`~.Secret`
        """
        return self.parent.share_secret(
            self.created_by,
            identity_id,
            self.secret_id)

    def get_events(self, rsa_key_owner_id=None):
        """
        Gets a list of events associated filtered by this secret id or
        both this secret id and RSA key owner.

        The credentials of the secret creator must be present in the local
        key store.

        :param rsa_key_owner_id: the rsa key owner id of interest
        :type rsa_key_owner_id: str | None
        :return: a generator of audit events
        :rtype: generator of :class:`~.Event`
        """
        return self.parent.get_events(self.created_by, self.secret_id,
                                      rsa_key_owner_id)

    def get_derived_secrets(self, page=None, page_size=None):
        """
        Gets a list of secrets derived from this secret, bound by the pagination
        parameters.

        The credentials of the secret creator be present in the local
        key store.

        :param page: the page number
        :type page: int | None
        :param page_size: the page size
        :type page_size: int | None

        :return: a generator of secrets
        :rtype: generator of :class:`~.Secret`
        """

        self.parent.get_secrets(requestor_id=self.created_by,
                                base_secret_id=self.secret_id,
                                page=page,
                                page_size=page_size)

    def add_metadata(self, metadata):
        """
        Adds the key and value pairs in the provided map as metadata for this
        secret. If the metadata previously contained a mapping for the key, the
        old value is replaced by the specified value.

        :param metadata: a map of metadata key and value pairs
        :type metadata: dict[str, str]
        """
        self.parent.add_secret_metadata(
            self.created_by, self.secret_id, metadata)

    def get_metadata(self):
        """
        Gets the metadata for this secret. Metadata are key-value pairs of
        strings that can be added to a secret to facilitate description and
        lookup. Secrets can support any number of metadata elements, but each
        key or value has a limit of 256 characters.

        :return: the metadata for this secret
        :rtype: dict[str, str]
        """
        metadata, version = self.parent.get_secret_metadata(self.created_by,
                                                            self.secret_id)
        return metadata

    def __repr__(self):
        return "{cls}(secret_id={secret_id})".format(
            cls=self.__class__.__name__, secret_id=self.secret_id)

class EncryptionDetails:
    """
    This class holds the necessary key materials required to decrypt a
    particular secret. The symmetric key itself is protected by a public
    encryption key belonging to an identity.
    """

    def __init__(self, symmetric_key, initialisation_vector):
        """
        Creates a new encryption details with the given parameters.

        :param str symmetric_key: the symmetric key
        :param str initialisation_vector: the initialisation vector
        """
        self.__symmetric_key = symmetric_key
        self.__initialisation_vector = initialisation_vector

    @property
    def symmetric_key(self):
        return self.__symmetric_key

    @property
    def initialisation_vector(self):
        return self.__initialisation_vector

class EventDetails(namedtuple("EventDetails", [
    "base_secret_id", "requestor_id", "rsa_key_owner_id", "secret_id",
    "secret_owner_id"
])):
    """
    This class describes the details of an event related to a secret.
    Information includes the secret id, the owner identity id of the secret, and
    the identity id triggering the event.

    Additional information such as base secret id and
    RSA key owner id are also available for derived secrets.
    """

    def __init__(self, base_secret_id, requestor_id, rsa_key_owner_id,
                 secret_id, secret_owner_id):
        """
        Creates an instance of event details.

        :param str base_secret_id: the id of the base secret
        :param str requestor_id: the id of the requesting identity
        :param str rsa_key_owner_id: the id of the RSA key owner
        :param str secret_id: the id of the secret
        :param str secret_owner_id: the id of the secret owner
        """
        super(EventDetails, self).__init__()

class Event:
    """
    An instance of this class encapsulates an event in Covata Delta. An
    event is an audit entry representing an action undertaken by an
    identity on a secret.
    """

    def __init__(self,
                 event_details,
                 host,
                 event_id,
                 source_ip,
                 timestamp,
                 event_type):
        """
        Creates a new :class:`~.Event` with the given parameters.

        :param event_details: details of the audit event.
        :type event_details: :class:`~.EventDetails`
        :param str host: the host address
        :param str event_id: the identifier of the event object
        :param str source_ip: the source IP address
        :param timestamp: the timestamp of the event
        :type timestamp: datetime
        :param str event_type: the type of the event
        """
        self.__event_details = event_details
        self.__host = host
        self.__event_id = event_id
        self.__source_ip = source_ip
        self.__timestamp = timestamp
        self.__event_type = event_type

    @property
    def event_details(self):
        return self.__event_details

    @property
    def host(self):
        return self.__host

    @property
    def event_id(self):
        return self.__event_id

    @property
    def source_ip(self):
        return self.__source_ip

    @property
    def timestamp(self):
        return self.__timestamp

    @property
    def event_type(self):
        return self.__event_type

    def __repr__(self):
        return "{cls}(event_id={event_id})".format(
            cls=self.__class__.__name__, event_id=self.event_id)


text:
<?php

namespace Omnipay\Safecharge\Message;

/**
 * SafeCharge Credit Request
 */
class RefundRequest extends VoidRequest
{
    public function getData()
    {
        $data = parent::getData();

        $data['sg_TransType'] = 'Credit';

        return $data;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ShopifySharp.Filters;
using Xunit;
using System.Threading;

namespace ShopifySharp.Tests
{
    [Trait("Category", "User")]
    public class User_Tests : IClassFixture<User_Tests_Fixture>
    {
        private User_Tests_Fixture Fixture { get; }

        public User_Tests(User_Tests_Fixture fixture)
        {
            this.Fixture = fixture;
        }

        [Fact(Skip = "Cannot run without a Shopify Plus account.")]
        public async Task Lists_Users()
        {
            var result = await Fixture.Service.ListAsync();
            var list = result.Items;

            Assert.True(list.Any());
        }

        [Fact(Skip = "Cannot run without a Shopify Plus account.")]
        public async Task Gets_Users()
        {
            // Find an id
            var result = await Fixture.Service.ListAsync();
            var list = result.Items;
            var user = await Fixture.Service.GetAsync(list.First().Id.Value);

            Assert.NotNull(user);
            Assert.Equal(user.Id, list.First().Id);
        }

        [Fact(Skip = "Cannot run without a Shopify Plus account")]
        public async Task No_Ambiguous_List_Calls()
        {
            // This test simply ensures each of the three ListAsync methods can be called without an ambiguous call error
            var userFilter = new UserListFilter();
            var listFilter = userFilter.AsListFilter();
            var cancellationToken = new CancellationTokenSource().Token;

            var result = await Fixture.Service.ListAsync();
            result = await Fixture.Service.ListAsync(cancellationToken);
            result = await Fixture.Service.ListAsync(userFilter);
            result = await Fixture.Service.ListAsync(userFilter, cancellationToken);
            result = await Fixture.Service.ListAsync(listFilter);
            result = await Fixture.Service.ListAsync(listFilter, cancellationToken);
        }
    }

    public class User_Tests_Fixture : IAsyncLifetime
    {
        public UserService Service => new UserService(Utils.MyShopifyUrl, Utils.AccessToken);

        public Task InitializeAsync()
        {
            Service.SetExecutionPolicy(new LeakyBucketExecutionPolicy());

            return Task.CompletedTask;
        }

        public Task DisposeAsync() => Task.CompletedTask;
    }
}


text:
class CreateLaunchConfigurations < ActiveRecord::Migration
  def self.up
    create_table :launch_configurations do |t|
      t.integer :provider_account_id
      t.integer :server_id
      t.string :name
      t.string :launch_configuration_name
      t.string :description
      t.string :instance_type
      t.string :image_id
      t.string :ramdisk_id
      t.string :kernel_id
      t.string :key_name
      t.text :user_data
      t.timestamp :created_time

      t.timestamps
    end
    add_index :launch_configurations, :provider_account_id
    add_index :launch_configurations, :server_id
    add_index :launch_configurations, :name
    add_index :launch_configurations, :launch_configuration_name
    add_index :launch_configurations, :image_id

	create_table :load_balancers do |t|
	  t.integer :launch_configuration_id
	  t.string :name

	  t.timestamps
	end
	add_index :load_balancers, :launch_configuration_id

	create_table :launch_configurations_security_groups, :id => false do |t|
		t.integer :launch_configuration_id, :security_group_id
	end
	add_index :launch_configurations_security_groups, :launch_configuration_id, :name => :index_configurations_groups_on_configuration_id
	add_index :launch_configurations_security_groups, :security_group_id, :name => :index_configurations_groups_on_group_id

	create_table :block_device_mappings do |t|
	  t.integer :launch_configuration_id
	  t.string :virtual_name
	  t.string :device_name

	  t.timestamps
	end
	add_index :block_device_mappings, :launch_configuration_id
  end

  def self.down
    drop_table :launch_configurations
	drop_table :launch_configurations_security_groups
	drop_table :block_device_mappings
  end
end


text:
ACCEPTED

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

#### Published in
Persoonia 3(2): 185 (1964)

#### Original name
Hydnum thwaitesii Berk. & Broome, 1875

### Remarks
null


text:
using System.Threading.Tasks;
using Xamarin.Forms;
namespace NotNet.Core.Forms
{
	public interface INavigationLocator
	{
		/// <summary>
		/// Flag that indicates if the navigation bar should be visible when pushing the next page
		/// Note that this is not per page, but rather for any subsequent pages.
		/// Use the HideNavigationBar class to scoop it.
		/// </summary>
		/// <value><c>true</c> if show navigation bar; otherwise, <c>false</c>.</value>
		bool ShowNavigationBar { get; set; }
		/// <summary>
		/// Flag that indicates if the back button should be visible when pushing the next page
		/// Note that this is not per page, but rather for any subsequent pages.
		/// Use the HideBackbuttonClase class to scoop it.
		/// </summary>
		/// <value><c>true</c> if show navigation bar; otherwise, <c>false</c>.</value>

		bool ShowBackButton { get; set; }
		/// <summary>
		/// The current Xamarin.Forms navigation instance.
		/// </summary>
		/// <value>The navigation.</value>
		INavigation Navigation { get; }
		Task NavigateTo(string name);
		Task NavigateTo(string name, params object[] args);
		Task NavigateModalTo(string name);
		Task NavigateModalTo(string name, params object[] args);
		/// <summary>
		/// Activates the tab if the current page is a TabbedPage and the
		/// tab exists as a child
		/// </summary>
		/// <param name="tabTitle">The title of the tab </param>
		Task ActivateTab(string tabTitle);
		/// <summary>
		/// If the current page is a MasterDetailPage, this will open or close the master
		/// </summary>
		/// <value><c>true</c> if master visible; otherwise, <c>false</c>.</value>
		bool MasterVisible { set; get; }

		//NOTE VisualElement Should really be Page or View. Everyting else fails...
		Task NavigateTo<T>() where T : VisualElement;
		Task NavigateModalTo<T>() where T : VisualElement;
		Task NavigateTo<T>(params object[] args) where T : VisualElement;
		Task NavigateModalTo<T>(params object[] args) where T : VisualElement;

	}
}


text:
package com.dspro;

import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.DefaultStringRedisConnection;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.StringRedisConnection;
import org.springframework.data.redis.core.RedisCallback;

public abstract class StringRedisCallback<T> implements RedisCallback<T> {
    public StringRedisCallback() {
    }

    public T doInRedis(RedisConnection redis) throws DataAccessException {
        return this.doInRedis((new DefaultStringRedisConnection(redis)));
    }

    public abstract T doInRedis(StringRedisConnection redis);
}


text:
package com.piketec.tpt.api;

import java.rmi.RemoteException;

/**
 * A TestSet represents a set of {@link Scenario test cases}. Test cases have to be
 * selected explicitly but they can be restricted further dynamically by a {@link #getCondition()
 * test set conditon} or by restricting}them to test cases linked to requirments of a
 * {@link #getRequirementSet() selected requirement set}.
 */
public interface TestSet extends TestSetOrGroup {

  /**
   * @return The {@link RemoteCollection set} of all {@link Scenario test cases} that are assigned
   *         to this TestSet and are not suppresed by its test set condition (using
   *         default values to evaluate the condition).
   *
   * @throws RemoteException
   *           remote communication problem
   *
   * @deprecated Use {@link #getSelectedTestCasesOrGroups()}. This method will be removed in TPT 18.
   */
  @Deprecated
  public RemoteCollection<Scenario> getTestCases() throws RemoteException;

  /**
   * Get the selected test cases and test case groups without taking the test set condition into
   * account. If a group is contained in the set all descendent scenarios in this group are
   * contained in the set as well.
   *
   * Please note that you cannot remove items from this collection if test set {@link #isLocked()}
   *
   * @return The raw selected test cases and test case groups.
   * @throws RemoteException
   *           remote communication problem
   *
   * @see #isLocked()
   * @see #getCondition()
   * @see #isRestrictedToLinkedTestCases()
   */
  public RemoteCollection<ScenarioOrGroup> getSelectedTestCasesOrGroups() throws RemoteException;

  /**
   * Add a new test case to the test set.
   *

   * A test case is a {@link Scenario} that is placed directly or in any sub-group of the top level
   * {@link ScenarioGroup} of the top level {@link Testlet} of a TPT project.
   *

   *
   * @see ScenarioOrGroup#isTestcaseOrGroup()
   * @see Project#getTopLevelTestlet()
   * @see Testlet#getTopLevelScenarioOrGroup()
   * @see #isLocked()
   *
   * @param tc
   *          The test case to be added to the TestSet
   * @throws ApiException
   *

   *
If the test set is locked
   *
If the given Scenario is not a test case or not from the current TPT
   *           instance.
   *

   * @throws RemoteException
   *           remote communication problem
   */
  public void addTestCase(Scenario tc) throws ApiException, RemoteException;

  /**
   * A test set can be locked to avoid accidental changes of the set of selected
   * {@link ScenarioOrGroup test cases or test case groups}. No test cases can be added to or
   * removed from a locked test set.
   *
   * @return false if the scenario selection can be changed true otherwise
   * @throws RemoteException
   *           remote communication problem
   */
  public boolean isLocked() throws RemoteException;

  /**
   * A test set can be locked to avoid accidental changes of the set of selected
   * {@link ScenarioOrGroup test cases or test case groups}. No test cases can be added to or
   * removed from a locked test set.
   *
   * @param locked
   *          false to make the scenario selection editable true otherwise
   * @throws RemoteException
   *           remote communication problem
   */
  public void setLocked(boolean locked) throws RemoteException;

  /**
   * Get the test set condition. If the condition is {@link #isConditionEnabled() enabled} only test
   * cases that fulfill the condition are considered as part of the test set.
   * {@link #getSelectedTestCasesOrGroups() Selected} test cases that do not fulfill the condition
   * will be suppressed.
   *
   * @return the test set condition
   * @throws RemoteException
   *           remote communication problem
   *
   * @see #isConditionEnabled()
   */
  public String getCondition() throws RemoteException;

  /**
   * Get the test set condition. If the condition is {@link #isConditionEnabled() enabled} only test
   * cases that fulfill the condition are considered as part of the test set.
   * {@link #getSelectedTestCasesOrGroups() Selected} test cases that do not fulfill the condition
   * will be suppressed.
   *
   * @param condition
   *          The condition to set. null will be corrected to an empty string.
   * @throws RemoteException
   *           remote communication problem
   *
   * @see #setConditionEnabled(boolean)
   */
  public void setCondition(String condition) throws RemoteException;

  /**
   * Returns whether the {@link #getCondition() test set condition} is enabled. The condition will
   * only be evaluated and will only suppress selected test cases iff it is enabled.
   *
   * @return true if the test case condition will suppress selected test cases
   *         false otherwise.
   * @throws RemoteException
   *           remote communication problem
   *
   * @see #getCondition
   */
  public boolean isConditionEnabled() throws RemoteException;

  /**
   * Set if the {@link #getCondition() test set condition} is enabled. The condition will only be
   * evaluated and will only suppress selected test cases iff it is enabled.
   *
   * @param enabled
   *          true if the test case condition shall suppress selected test cases
   *          false otherwise.
   * @throws RemoteException
   *           remote communication problem
   *
   * @see #setCondition(String)
   */
  public void setConditionEnabled(boolean enabled) throws RemoteException;

  /**
   * Get the requirement set. The requirement set can be used to restrict the selected test cases to
   * test cases that are linked to a requirement of the given requirement set.
   *
   * @return The selected requirement set or null for the implicit requirement set
   *         containing all requirements.
   * @throws RemoteException
   *           remote communication problem
   *
   * @see #isRestrictedToLinkedTestCases()
   */
  public RequirementSet getRequirementSet() throws RemoteException;

  /**
   * Set the requirement set. The requirement set can be used to restrict the selected test cases to
   * test cases that are linked to a requirement of the given requirement set.
   *
   * @param requirementSet
   *          The requirement set to set or null for the implicit requirement set
   *          containing all requirements.
   * @throws RemoteException
   *           remote communication problem
   *
   * @see #setRestrictedToLinkedTestCases(boolean)
   */
  public void setRequirementSet(RequirementSet requirementSet) throws RemoteException;

  /**
   * Returns true iff only test cases linked to a requirement that is part of the
   * selected requirement set are considered as part of the test set.
   * {@link #getSelectedTestCasesOrGroups() Selected} test cases that are not linked to such a
   * requirement are suppressed.
   *
   * @return true if test cases are suppressed based on the selected requirement set
   *         false otherwise.
   * @throws RemoteException
   *           remote communication problem
   *
   * @see #getRequirementSet()
   */
  public boolean isRestrictedToLinkedTestCases() throws RemoteException;

  /**
   * Set iff only test cases linked to a requirement that is part of the selected requirement set
   * are considered as part of the test set. {@link #getSelectedTestCasesOrGroups() Selected} test
   * cases that are not linked to such a requirement will be suppressed.
   *
   * @param restrict
   *          true if test cases shall be suppressed based on the selected requirement
   *          set false otherwise.
   * @throws RemoteException
   *           remote communication problem
   *
   * @see #setRequirementSet(RequirementSet)
   */
  public void setRestrictedToLinkedTestCases(boolean restrict) throws RemoteException;

}


text:
/*
 *   This file is based on the source code of the Kafka spout of the Apache Storm project.
 *   (https://github.com/apache/storm/tree/master/external/storm-kafka)
 *   This file has been modified to work with Spark Streaming.
 */

package consumer.kafka;

public interface IBrokerReader {

	public GlobalPartitionInformation getCurrentBrokers();

	public void close();
}


text:
import looker from './looker';
import { getRandomizedWord } from './generator';

export function check(domainName) {
  return looker.isAvailable(domainName);
}

export async function scan(opts, callback) {
  for (let count = 0; count < opts.howMany; /*nothing*/) {
    for (const tld of opts.tlds) {
      const domain = getRandomizedWord(opts.length) + '.' + tld;

      try {
        const available = await looker.isAvailable(domain);
        callback(null, domain, available);

        if (available) {
          if (++count >= opts.howMany) {
            break;
          }
        }

      } catch (error) {
        callback(error, domain, false);
      }
    }
  }
}

export default {check, scan};


text:
namespace unisparks {

NetworkStatus Udp::update(NetworkStatus status) {
  if (status == INITIALIZING || status == CONNECTING) {
    int optval, flags;
    sockaddr_in if_addr;
    struct ip_mreq mc_group;

    assert(fd == 0); // must be true if status == connecting

    fd = socket(AF_INET, SOCK_DGRAM, 0);
    if (fd < 0) {
      error("Can't create client UDP socket");
      goto err;
    }

    optval = 1;
    if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) {
      error("Can't set reuseaddr option on UDP socket %d: %s", fd, strerror(errno));
      goto err;
    }

    flags = fcntl(fd, F_GETFL) | O_NONBLOCK;
    if (fcntl(fd, F_SETFL, flags) < 0) {
      error("Can't set UDP socket %d to nonblocking mode: %s", fd, strerror(errno));
      goto err;
    }

    memset((char*)&if_addr, 0, sizeof(if_addr));
    if_addr.sin_family = AF_INET;
    if_addr.sin_port = htons((unsigned short)port);
    if_addr.sin_addr.s_addr = htonl(INADDR_ANY);
    if (bind(fd, (struct sockaddr*)&if_addr, sizeof(if_addr)) < 0) {
      error("Can't bind UDP socket %d to port %d: %s", fd, port, strerror(errno));
      goto err;
    }

    mc_group.imr_multiaddr.s_addr = inet_addr(mcastAddr);
    mc_group.imr_interface.s_addr =
      htonl(INADDR_ANY); // inet_addr("203.106.93.94");
    if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mc_group,
                   sizeof(mc_group)) < 0) {
      error("Can't add UDP socket %d to multicast group %s: %s", fd, mcastAddr,
            strerror(errno));
      goto err;
    }

    info("Joined multicast group %s, listening on port %d, UDP socket %d",
         mcastAddr, port, fd);
    return CONNECTED;
  } else if (status == DISCONNECTING) {
    close(fd);
    info("Disconnected UDP socket %d", fd);
    fd = 0;
    return DISCONNECTED;
  }

  // Nothing to do
  return status;

err:
  if (fd) {
    close(fd);
    fd = 0;
  }
  error("UDP socket connection failed");
  return CONNECTION_FAILED;
}

int Udp::recv(void* buf, size_t bufsize) {
  if (!fd) {
    return -1;
  }

  const char* fromstr = nullptr;
  sockaddr_in fromaddr;
  socklen_t fromaddrlen = sizeof(fromaddr);
  int n = recvfrom(fd, buf, bufsize, 0,
                   reinterpret_cast<sockaddr*>(&fromaddr), &fromaddrlen);
  if (n < 0) {
    if (errno == EWOULDBLOCK || errno == EAGAIN) {
      return 0; // no data on nonblocking socket
    }
    error("Can't receive data on UDP socket %d: %s", fd, strerror(errno));
    goto err; // error reading
  }
  fromstr = inet_ntoa(fromaddr.sin_addr);
  debug("Received %d bytes on UDP socket %d from %s:%d", n, fd, fromstr,
        fromaddr.sin_port);
  return n;
err:
  return -1;
}

void Udp::send(void* buf, size_t bufsize) {
  if (!fd) {
    return; // -1;
  }

  sockaddr_in addr;
  memset((char*)&addr, 0, sizeof(addr));
  addr.sin_family = AF_INET;
  addr.sin_port = htons((unsigned short)port);
  addr.sin_addr.s_addr = inet_addr(mcastAddr);
  if (static_cast<size_t>(sendto(fd, buf, bufsize, 0, (struct sockaddr*)&addr,
                                 sizeof(addr))) != bufsize) {
    error("Can't send %d bytes on UDP socket %d: %s", bufsize, fd,
          strerror(errno));
    return; // -1;
  }
  debug("Sent %d bytes on UDP socket %d", bufsize, fd);
  //return bufsize;
}

} // namespace unisparks
#endif // ARDUINO


text:
package com.spun.util.servlets.tests;

import java.io.File;
import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import junit.framework.TestCase;

import com.spun.util.ObjectUtils;
import com.spun.util.io.FileUtils;
import com.spun.util.parser.TemplateError;
import com.spun.util.servlets.BasicServlet;
import com.spun.util.servlets.SecondaryErrorProcessor;
import com.spun.util.servlets.ServletLogWriterFactory;

public class ServletLogFileTest
  extends TestCase
{

  /***********************************************************************/
  public void testLogFileCreation() throws Exception
  {
    File directory = setupTempLogDirectory();
    File logTemplate = createLogTemplate(directory);
    String logToFile = directory.getAbsolutePath() + File.separator + "logs" + File.separator + "ErrorThrowingServlet.log";
    ServletLogWriterFactory.reset();
    new ErrorThrowingServlet(logTemplate.getAbsolutePath()).doGet(new MockHttpServletRequest(), new MockHttpServletResponse());

    File file = new File(logToFile);
    assertTrue(file.exists());
    assertTrue(FileUtils.readFile(file).contains("supposed to happen"));
    FileUtils.deleteDirectory(directory);
  }
  public void testTwice() throws Exception
  {
    testLogFileCreation();
  }
  private File createLogTemplate(File directory) throws IOException
  {
    File logs = new File(directory.getAbsolutePath() + File.separator + "logtemplate.txt");
    assertTrue("error template created", logs.createNewFile());
    return logs;
  }
  private File setupTempLogDirectory() throws IOException
  {
    File directory = FileUtils.createTempDirectory();
    File logs = new File(directory.getAbsolutePath() + File.separator + "logs");
    logs.mkdir();
    String TOMCAT_DIRECTORY = "catalina.base";
    System.setProperty(TOMCAT_DIRECTORY, directory.getAbsolutePath());
    return directory;
  }
  /***********************************************************************/
  public static class ErrorThrowingServlet extends BasicServlet implements SecondaryErrorProcessor
  {
    String errorTemplate = null;

    public ErrorThrowingServlet(String errorTemplate)
    {
      this.errorTemplate = errorTemplate;
    }
    /***********************************************************************/
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    {
      try
      {
        throw new ArithmeticException("This error is supposed to happen.");
      }
      catch (ArithmeticException t)
      {
        try
        {
          processError(t, req,this);
        }
        catch(Throwable t2)
        {
          ObjectUtils.throwAsError(t2);
        }
      }
    }
    /***********************************************************************/
    protected String getErrorTemplate()
    {
      return errorTemplate;
    }
    @Override
    public String processError(TemplateError error, Throwable t2)
    {
      throw ObjectUtils.throwAsError(t2);
    }
  }

  /***********************************************************************/
  /***********************************************************************/
}


text:
module Layer
  module Handler

    class Engine < ::Rails::Engine
      initializer "layer_handler.action_view" do |app|
        ActiveSupport.on_load :action_view do
          require_relative "handler/rails/view_helpers"
          include Layer::Handler::ViewHelpers
        end
      end
    end

    class << self
      attr_accessor :configuration
    end

    def self.configure
      self.configuration ||= Configuration.new
      yield(configuration)
    end

    class Configuration
      attr_accessor :gtm_id

      def initialize
        @gtm_id = nil
      end
    end

  end
end


text:
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2015 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
////////////////////////////////////////////////////////////////////////////////

package com.puppycrawl.tools.checkstyle.checks.naming;

import com.puppycrawl.tools.checkstyle.api.TokenTypes;

/**
 *

 * Checks that class type parameter names conform to a format specified
 * by the format property.  The format is a
 * {@link java.util.regex.Pattern regular expression} and defaults to
 * ^[A-Z]$.
 *

 *

 * An example of how to configure the check is:
 *

 *

 * <module name="MethodTypeParameterName"/>
 *

 *

 * An example of how to configure the check for names that are only a single
 * letter is
 *

 *

 * <module name="MethodTypeParameterName">
 *    <property name="format" value="^[a-zA-Z]$"/>
 * </module>
 *

 *
 * @author Travis Schneeberger
 */
public class MethodTypeParameterNameCheck
    extends AbstractTypeParameterNameCheck {
    /** Creates a new {@code MethodTypeParameterNameCheck} instance. */
    public MethodTypeParameterNameCheck() {
        super("^[A-Z]$");
    }

    @Override
    protected final int getLocation() {
        return TokenTypes.METHOD_DEF;
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Interface org.primaresearch.labels.Label (PrimaBasic API)</title>
<meta name="date" content="2021-01-30">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
org.primaresearch.labels.Label

Packages that use Label

Package
Description

org.primaresearch.labels

Uses of Label in org.primaresearch.labels

Classes in org.primaresearch.labels that implement Label

Modifier and Type
Class and Description

class
LabelImpl

Methods in org.primaresearch.labels that return types with arguments of type Label

Modifier and Type
Method and Description

java.util.List<Label>
LabelGroup.getLabels()

Methods in org.primaresearch.labels with parameters of type Label

Modifier and Type
Method and Description

void
Labels.addLabel(Label label)

void
LabelGroup.addLabel(Label label)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2019 PRImA Research Lab. All Rights Reserved.


text:
package redis.clients.redisson.remote;

import java.io.Serializable;

/**
 *
 * @author Nikita Koksharov
 *
 */
public class RemoteServiceCancelRequest implements Serializable {

    private static final long serialVersionUID = -4800574267648904260L;

    private String responseId;
    private boolean mayInterruptIfRunning;

    public RemoteServiceCancelRequest() {
    }

    public RemoteServiceCancelRequest(boolean mayInterruptIfRunning) {
        this(mayInterruptIfRunning, null);
    }

    public RemoteServiceCancelRequest(boolean mayInterruptIfRunning, String responseId) {
        super();
        this.mayInterruptIfRunning = mayInterruptIfRunning;
        this.responseId = responseId;
    }

    public String getResponseId() {
        return responseId;
    }

    public boolean isMayInterruptIfRunning() {
        return mayInterruptIfRunning;
    }

}


text:
@interface DAVRequest ()

- (void)didFail:(NSError *)error;
- (void)didFinish;

@end

@implementation DAVRequest

NSString *const DAVClientErrorDomain = @"com.MattRajca.DAVKit.error";

#define DEFAULT_TIMEOUT 60

@synthesize path = _path;
@synthesize delegate = _delegate;

- (id)initWithPath:(NSString *)aPath {
	self = [super init];
	if (self) {
		_path = [aPath == nil ? @"" : aPath copy];
	}
	return self;
}

- (NSURL *)concatenatedURLWithPath:(NSString *)aPath {
	NSParameterAssert(aPath != nil);

	return [self.rootURL URLByAppendingPathComponent:aPath];
}

- (BOOL)isConcurrent {
	return YES;
}

- (BOOL)isExecuting {
	return _executing;
}

- (BOOL)isFinished {
	return _done;
}

- (BOOL)isCancelled {
	return _cancelled;
}

- (void)cancelWithCode:(NSInteger)code {
	[self willChangeValueForKey:@"isCancelled"];

	[_connection cancel];
	_cancelled = YES;

	[self didFail:[NSError errorWithDomain:DAVClientErrorDomain code:code userInfo:nil]];

	[self didChangeValueForKey:@"isCancelled"];
}

- (void)cancel {
	[self cancelWithCode:-1];
}

- (void)start {
	if (![NSThread isMainThread]) {
		[self performSelectorOnMainThread:@selector(start)
							   withObject:nil waitUntilDone:NO];

		return;
	}

	[self willChangeValueForKey:@"isExecuting"];

	_executing = YES;
	_connection = [NSURLConnection connectionWithRequest:[self request]
												delegate:self];

	if ([_delegate respondsToSelector:@selector(requestDidBegin:)])
		[_delegate requestDidBegin:self];

	[self didChangeValueForKey:@"isExecuting"];
}

- (NSURLRequest *)request {
	@throw [NSException exceptionWithName:NSInternalInconsistencyException
								   reason:@"Subclasses of DAVRequest must override 'request'"
								 userInfo:nil];

	return nil;
}

- (id)resultForData:(NSData *)data {
	return nil;
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
	if (!_data) {
		_data = [[NSMutableData alloc] init];
	}

	[_data appendData:data];
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
	[self didFail:error];
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
	if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
		NSInteger code = [(NSHTTPURLResponse *)response statusCode];

		if (code >= 400) {
			[self cancelWithCode:code];
		}
	}
}

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
	BOOL result = [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodDefault] ||
	[protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPBasic] ||
	[protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPDigest] ||
	[protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];

	return result;
}

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
	if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
		if (self.allowUntrustedCertificate)
			[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]
				 forAuthenticationChallenge:challenge];

		[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
	} else {
		if ([challenge previousFailureCount] == 0) {
			NSURLCredential *credential = [NSURLCredential credentialWithUser:self.credentials.username
																	 password:self.credentials.password
																  persistence:NSURLCredentialPersistenceNone];

			[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
		} else {
			// Wrong login/password
			[[challenge sender] cancelAuthenticationChallenge:challenge];
		}
	}
}

- (void)didFail:(NSError *)error {
	if ([_delegate respondsToSelector:@selector(request:didFailWithError:)]) {
		[_delegate request:self didFailWithError:error];
	}

	[self didFinish];
}

- (void)didFinish {
	[self willChangeValueForKey:@"isExecuting"];
	[self willChangeValueForKey:@"isFinished"];

	_done = YES;
	_executing = NO;

	[self didChangeValueForKey:@"isExecuting"];
	[self didChangeValueForKey:@"isFinished"];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
	if ([_delegate respondsToSelector:@selector(request:didSucceedWithResult:)]) {
		id result = [self resultForData:_data];

		[_delegate request:self didSucceedWithResult:result];
	}

	[self didFinish];
}

@end

@implementation DAVRequest (Private)

- (NSMutableURLRequest *)newRequestWithPath:(NSString *)path method:(NSString *)method {
	NSURL *url = [self concatenatedURLWithPath:path];

	NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
	[request setHTTPMethod:method];
	[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
    [request setTimeoutInterval:DEFAULT_TIMEOUT];

	return request;
}

@end


text:
from django.db import models
import reversion

class Page(models.Model):
    """Simple Wiki page model"""
    title = models.CharField(max_length=255, primary_key=True)
    content = models.TextField(blank=True)

    def __unicode__(self):
        return self.title

reversion.register(Page)


text:
package org.oseraf.bullseye.store

import scala.collection.mutable

/**
 * Created by nhamblet.
 */
trait WriteEventPublisherPlugin extends EntityStore {
  var writeListeners = new mutable.ArrayBuffer[WriteEventListener]()

  abstract override def addEntity(id: EntityStore.ID, entity: Entity): Boolean =
    returning(super.addEntity(id, entity)) { writeListeners.foreach(_.handleAddEntityEvent(id)) }
  abstract override def addRelationship(id: EntityStore.ID, relationship: Relationship): Boolean =
    returning(super.addRelationship(id, relationship)) { writeListeners.foreach(_.handleAddRelationshipEvent(id)) }

  abstract override def updateEntity(id: EntityStore.ID, entity: Entity): Boolean =
    returning(super.updateEntity(id, entity)) { writeListeners.foreach(_.handleUpdateEntityEvent(id)) }
  abstract override def updateRelationship(id: EntityStore.ID, relationship: Relationship): Boolean =
    returning(super.updateRelationship(id, relationship)) { writeListeners.foreach(_.handleUpdateRelationshipEvent(id)) }

  abstract override def removeEntity(id: EntityStore.ID): Boolean =
    returning(super.removeEntity(id)) { writeListeners.foreach(_.handleRemoveEntityEvent(id)) }
  abstract override def removeRelationship(id: EntityStore.ID): Boolean =
    returning(super.removeRelationship(id)) { writeListeners.foreach(_.handleRemoveRelationshipEvent(id)) }

  def addListener(listener: WriteEventListener) =
    writeListeners.append(listener)

  def removeListener(listener: WriteEventListener) =
    writeListeners.filter(_ != listener)

  private def returning(b: Boolean)(blk: => Unit) = {
    val res = b
    if (res) blk
    res
  }
}

trait WriteEventListener {
  def handleAddEntityEvent(id: EntityStore.ID)
  def handleAddRelationshipEvent(id: EntityStore.ID)

  def handleRemoveEntityEvent(id: EntityStore.ID)
  def handleRemoveRelationshipEvent(id: EntityStore.ID)

  def handleUpdateEntityEvent(id: EntityStore.ID)
  def handleUpdateRelationshipEvent(id: EntityStore.ID)
}


text:
package cn.com.ichile.topvideonews.db;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

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

import cn.com.ichile.topvideonews.Cons;
import cn.com.ichile.topvideonews.domain.VideoBean;

/**
 * FBI WARNING ! MAGIC ! DO NOT TOUGH !
 * Created by WangZQ on 2016/12/30 - 10:40.
 */

public class OriginalDao {
    private CusDbHelper mCusDbHelper;
    private SQLiteDatabase db;

    public OriginalDao(Context context, DatabaseErrorHandler databaseErrorHandler) {
        mCusDbHelper = new CusDbHelper(context, databaseErrorHandler);
    }

    /**
     * @return the row ID of the newly inserted row, or -1 if an error occurred
     */
    public long add(VideoBean videoBean) throws Exception {
        db = mCusDbHelper.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put("video_token", videoBean.getToken());
        values.put("video_url", videoBean.getUrl());
        values.put("video_title", videoBean.getTitle());
        values.put("video_image", videoBean.getImage());
        values.put("video_thumb", videoBean.getThumb());
        values.put("video_src", videoBean.getAuthor());
        long insert = db.insert(Cons.TB_ORIGINAL, null, values);
        db.close();
        return insert;
    }

    /**
     * the row ID of the newly inserted row, or -1 if an error occurred
     * @param list
     * @return
     * @throws Exception
     */
    public long addAll(List<VideoBean> list) throws Exception {
        db = mCusDbHelper.getWritableDatabase();
        long insert = -1;
        for (VideoBean videoBean : list) {
            ContentValues values = new ContentValues();
            values.put("video_token", videoBean.getToken());
            values.put("video_url", videoBean.getUrl());
            values.put("video_title", videoBean.getTitle());
            values.put("video_image", videoBean.getImage());
            values.put("video_thumb", videoBean.getThumb());
            values.put("video_src", videoBean.getAuthor());
            insert = db.insert(Cons.TB_ORIGINAL, null, values);
        }
        db.close();
        return insert;
    }

    /**
     * the number of rows affected if a whereClause is passed in,
     * 0 otherwise. To remove all rows and get a count pass "1" as the whereClause
     */
    public int deleteAll() throws Exception {
        db = mCusDbHelper.getWritableDatabase();
        String whereClause = null;
        String[] args = null;
        int delete = db.delete(Cons.TB_ORIGINAL, whereClause, args);
        db.close();
        return delete;
    }

    public VideoBean queryByToken(String token) throws Exception {
        db = mCusDbHelper.getWritableDatabase();
        boolean distinct = true;
        String table = Cons.TB_ORIGINAL;
        String[] columns = null;
        String selection = "token=?";
        String[] selectionArgs = new String[]{String.valueOf(token)};
        String groupBy = null;
        String having = null;
        String orderBy = "_id DESC";
        String limit = null;
        Cursor cursor = db.query(distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit);
        VideoBean videoBean = new VideoBean();
        cursor.moveToPosition(-1);
        while (cursor.moveToNext()) {
            videoBean.setId(cursor.getString(cursor.getColumnIndex("_id")));
            videoBean.setToken(cursor.getString(cursor.getColumnIndex("video_token")));
            videoBean.setImage(cursor.getString(cursor.getColumnIndex("video_image")));
            videoBean.setAuthor(cursor.getString(cursor.getColumnIndex("video_src")));
            videoBean.setThumb(cursor.getString(cursor.getColumnIndex("video_thumb")));
            videoBean.setTitle(cursor.getString(cursor.getColumnIndex("video_title")));
            videoBean.setUrl(cursor.getString(cursor.getColumnIndex("video_url")));
        }
        cursor.close();
        db.close();
        return videoBean;
    }

    /**
     * @param count query COUNT items
     */
    public List<VideoBean> queryList(int count) throws Exception {
        List<VideoBean> list = queryNextList(count, 0);
        return list;
    }

    public List<VideoBean> queryAll() throws Exception {
        List<VideoBean> list = queryNextList(0, 0);
        return list;
    }

    /**
     * @param count
     * @param currentPosition query next COUNT items from CURRENTPOSITION
     */
    public List<VideoBean> queryNextList(int count, int currentPosition) throws Exception {
        db = mCusDbHelper.getWritableDatabase();
        boolean distinct = true;
        String table = Cons.TB_ORIGINAL;
        String[] columns = null;

        String selection;
        String[] selectionArgs;
        if (currentPosition <= 0) {
            selection = null;
            selectionArgs = null;
        } else {
            selection = "_id >= ?";
            selectionArgs = new String[]{String.valueOf(currentPosition)};
        }
        String groupBy = null;
        String having = null;
        String orderBy = "_id";
        String limit = count <= 0 ? null : String.valueOf(count);
        Cursor cursor = db.query(distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit);
        List<VideoBean> list = new ArrayList<>();
        cursor.moveToPosition(-1);
        while (cursor.moveToNext()) {
            VideoBean videoBean = new VideoBean();
            videoBean.setId(cursor.getString(cursor.getColumnIndex("_id")));
            videoBean.setToken(cursor.getString(cursor.getColumnIndex("video_token")));
            videoBean.setImage(cursor.getString(cursor.getColumnIndex("video_image")));
            videoBean.setAuthor(cursor.getString(cursor.getColumnIndex("video_src")));
            videoBean.setThumb(cursor.getString(cursor.getColumnIndex("video_thumb")));
            videoBean.setTitle(cursor.getString(cursor.getColumnIndex("video_title")));
            videoBean.setUrl(cursor.getString(cursor.getColumnIndex("video_url")));
            Log.i("daodaodao",videoBean.toString());
            list.add(videoBean);
        }
        cursor.close();
        db.close();
        return list;
    }

}


text:
package com.storesales.tools;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;

/**
 * 响应工具
 *
 * @author
 * @since
 * @version 0.1 初始版本
 *
 */
public class ResponseUtil {
	private static String DEFAULT_CHARACTER_ENCODING ="UTF-8";
	/**
	 * 输出JSON内容 (字符编码为UTF-8)
	 *
	 * @param response
	 * @param responseMap
	 */
	public static void writeJSON(HttpServletResponse response, Map<String, Object> responseMap) {
		response.setCharacterEncoding(DEFAULT_CHARACTER_ENCODING);
		response.setContentType("application/x-json");
		response.setHeader("Cache-Control", "no-cache");
		Gson gson = new GsonBuilder().enableComplexMapKeySerialization().create();
		try {
			PrintWriter writer = response.getWriter();
			writer.write(gson.toJson(responseMap));
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	/**
	 * 输出文本内容 (字符编码为UTF-8)
	 *
	 * @param response
	 * @param responseMap
	 */
	public static void write(HttpServletResponse response, String content) {
		response.setCharacterEncoding(DEFAULT_CHARACTER_ENCODING);
		response.setContentType("application/x-json");
		response.setHeader("Cache-Control", "no-cache");
		try {
			PrintWriter writer = response.getWriter();
			writer.write(content);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	public static void write(HttpServletResponse response, Boolean content) {
		write(response, content + "");
	}

	/**
	 * 输出JSON内容 (字符编码为UTF-8)
	 *
	 * @param response
	 * @param responseMap
	 */
	public static void writeJSON(HttpServletResponse response, JsonObject jsonObject) {
		response.setCharacterEncoding(DEFAULT_CHARACTER_ENCODING);
		response.setContentType("application/x-json");
		response.setHeader("Cache-Control", "no-cache");
		try {
			PrintWriter writer = response.getWriter();
			writer.write(jsonObject.toString());
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}


text:
/**
 * Memory cache implementations for image pipeline.
 */
package com.facebook.imagepipeline.cache;


text:
Custom launcher to skip the bundled C# launcher in The Amazing Spider-Man 2 on PC.

## Introduction

The default launcher is coded in older C# and have a tendency to break on all kinds of computers.
Hence, this workaround.

* ASM2Launcher.exe is a really simple C++ application that only does one thing and one thing only: launches Game.exe.
* The real ASM2Launcher.exe takes care of all kinds of things, such as validating settings according to the reported VRAM of the primary GPU (can cause issues with hybrid platforms such as Nvidia Optimus) as well as allows keybinds to be reconfigured.

This custom launcher can be used to skip the launcher completely, and hopefully also manages to make the game playable on computers that fail to start the original launcher properly. Please be aware that settings must instead be manually changed through the registry and/or input.dat. Refer to the various subfolders under Settings for how to do so.

## Installation

1. Navigate to the game folder.
2. Rename/remove the original ASM2Launcher.exe
3. Move the included custom launcher from here to the game folder.
4. Use the various registry files in the Settings subfolder in this archive to tweak the settings of the game.

## Source code

```
// ASM2Launcher.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <Windows.h>

VOID startup(LPCTSTR lpApplicationName)
{
	// https://stackoverflow.com/questions/15435994/how-do-i-open-an-exe-from-another-c-exe/15440094

	// additional information
	STARTUPINFO si;
	PROCESS_INFORMATION pi;

	// set the size of the structures
	ZeroMemory(&si, sizeof(si));
	si.cb = sizeof(si);
	ZeroMemory(&pi, sizeof(pi));

	// start the program up
	CreateProcess(
		lpApplicationName, // the path
		NULL, // Command line
		NULL, // Process handle not inheritable
		NULL, // Thread handle not inheritable
		FALSE, // Set handle inheritance to FALSE
		0, // No creation flags
		NULL, // Use parent's environment block
		NULL, // Use parent's starting directory
		&si, // Pointer to STARTUPINFO structure
		&pi // Pointer to PROCESS_INFORMATION structure (removed extra parentheses)
	);
	// Close process and thread handles.
	CloseHandle(pi.hProcess);
	CloseHandle(pi.hThread);
}

int main()
{
	LPCTSTR ASM2Game = L"Game.exe";
	startup(ASM2Game);
	return 0;
}
```

## License

https://github.com/Idearum/Skip-ASM2Launcher/blob/master/LICENSE