text:
require 'opennebula/pool_element'

module OpenNebula
    class Template < PoolElement
        #######################################################################
        # Constants and Class Methods
        #######################################################################

        TEMPLATE_METHODS = {
            :allocate    => "template.allocate",
            :instantiate => "template.instantiate",
            :info        => "template.info",
            :update      => "template.update",
            :delete      => "template.delete",
            :chown       => "template.chown",
            :chmod       => "template.chmod",
            :clone       => "template.clone",
            :rename      => "template.rename"
        }

        # Creates a Template description with just its identifier
        # this method should be used to create plain Template objects.
        # +id+ the id of the user
        #
        # Example:
        #   template = Template.new(Template.build_xml(3),rpc_client)
        #
        def Template.build_xml(pe_id=nil)
            if pe_id
                obj_xml = "<VMTEMPLATE><ID>#{pe_id}</ID></VMTEMPLATE>"
            else
                obj_xml = "<VMTEMPLATE></VMTEMPLATE>"
            end

            XMLElement.build_xml(obj_xml,'VMTEMPLATE')
        end

        # Class constructor
        def initialize(xml, client)
            super(xml,client)

            @client = client
        end

        #######################################################################
        # XML-RPC Methods for the Template Object
        #######################################################################

        # Retrieves the information of the given Template.
        def info()
            super(TEMPLATE_METHODS[:info], 'VMTEMPLATE')
        end

        alias_method :info!, :info

        # Allocates a new Template in OpenNebula
        #
        # @param description [String] The contents of the Template.
        #
        # @return [nil, OpenNebula::Error] nil in case of success, Error
        #   otherwise
        def allocate(description)
            super(TEMPLATE_METHODS[:allocate], description)
        end

        # Deletes the Template
        def delete()
            super(TEMPLATE_METHODS[:delete])
        end

        # Creates a VM instance from a Template
        #
        # @param name [String] Name for the VM instance. If it is an empty
        #   string OpenNebula will set a default name
        # @param hold [true,false] false to create the VM in pending state,
        #   true to create it on hold
        # @param template [String] User provided Template to merge with the
        #   one being instantiated
        #
        # @return [Integer, OpenNebula::Error] The new VM id, Error
        #   otherwise
        def instantiate(name="", hold=false, template="")
            return Error.new('ID not defined') if !@pe_id

            name ||= ""
            hold = false if hold.nil?
            template ||= ""

            rc = @client.call(
                TEMPLATE_METHODS[:instantiate], @pe_id, name, hold, template)

            return rc
        end

        # Replaces the template contents
        #
        # @param new_template [String] New template contents
        # @param append [true, false] True to append new attributes instead of
        #   replace the whole template
        #
        # @return [nil, OpenNebula::Error] nil in case of success, Error
        #   otherwise
        def update(new_template, append=false)
            super(TEMPLATE_METHODS[:update], new_template, append ? 1 : 0)
        end

        # Publishes the Template, to be used by other users
        def publish
            set_publish(true)
        end

        # Unplubishes the Image
        def unpublish
            set_publish(false)
        end

        # Changes the owner/group
        # uid:: _Integer_ the new owner id. Set to -1 to leave the current one
        # gid:: _Integer_ the new group id. Set to -1 to leave the current one
        # [return] nil in case of success or an Error object
        def chown(uid, gid)
            super(TEMPLATE_METHODS[:chown], uid, gid)
        end

        # Changes the Template permissions.
        #
        # @param octet [String] Permissions octed , e.g. 640
        # @return [nil, OpenNebula::Error] nil in case of success, Error
        #   otherwise
        def chmod_octet(octet)
            super(TEMPLATE_METHODS[:chmod], octet)
        end

        # Changes the Template permissions.
        # Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
        #
        # @return [nil, OpenNebula::Error] nil in case of success, Error
        #   otherwise
        def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u,
                other_m, other_a)
            super(TEMPLATE_METHODS[:chmod], owner_u, owner_m, owner_a, group_u,
                group_m, group_a, other_u, other_m, other_a)
        end

        # Clones this Template into a new one
        #
        # @param [String] name for the new Template.
        #
        # @return [Integer, OpenNebula::Error] The new Template ID in case
        #   of success, Error otherwise
        def clone(name)
            return Error.new('ID not defined') if !@pe_id

            rc = @client.call(TEMPLATE_METHODS[:clone], @pe_id, name)

            return rc
        end

        # Renames this Template
        #
        # @param name [String] New name for the Template.
        #
        # @return [nil, OpenNebula::Error] nil in case of success, Error
        #   otherwise
        def rename(name)
            return call(TEMPLATE_METHODS[:rename], @pe_id, name)
        end

        #######################################################################
        # Helpers to get Template information
        #######################################################################

        # Returns the group identifier
        # [return] _Integer_ the element's group ID
        def gid
            self['GID'].to_i
        end

        def owner_id
            self['UID'].to_i
        end

        def public?
            if self['PERMISSIONS/GROUP_U'] == "1" || self['PERMISSIONS/OTHER_U'] == "1"
                true
            else
                false
            end
        end

    private

        def set_publish(published)
            group_u = published ? 1 : 0

            chmod(-1, -1, -1, group_u, -1, -1, -1, -1, -1)
        end
    end
end


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>phpDocumentor » \MiiCardOAuthServiceBase</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">

phpDocumentor

                                    API Documentation

Packages

 Default

 miiCard

                                    Charts

 Class hierarchy diagram

                                    Reports

 Errors
                175

 Markers

 Deprecated elements
                0

Back to top

                            Javascript is disabled; several features are only available
                            if Javascript is enabled.

<button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button>

<button class="btn details" title="Show descriptions and method names"></button><button class="btn simple" title="Show only method names"></button>

 Methods

Initialises a new MiiCardOAuthServiceBase with specified OAuth credentials.
__construct()

Gets the OAuth access token, or null if not set
getAccessToken()

Gets the OAuth access token secret, or null if not set
getAccessTokenSecret()

Gets the OAuth consumer key
getConsumerKey()

Gets the OAuth consumer secret
getConsumerSecret()

» Protected

Makes an OAuth-signed HTTP POST request
makeSignedRequest()

» Private

Makes an HTTP Post request, returning the response.
makeHttpRequest()

 Properties

» Protected

The OAuth access token, if known.
$_accessToken

The OAuth access token secret, if known.
$_accessTokenSecret

» Private

The OAuth consumer key.
$_consumerKey

The OAuth consumer secret.
$_consumerSecret

\

global

\MiiCardOAuthServiceBase

Base class for wrappers around an OAuth-protected API

abstract

package
miiCard.Consumers

 Methods

Initialises a new MiiCardOAuthServiceBase with specified OAuth credentials.

__construct(string $consumerKey, string $consumerSecret, string $accessToken, string $accessTokenSecret)

A consumer key and secret are mandatory - without them an InvalidArgumentException is thrown.
The caller may supply an access token and secret if they are known, or omit them if they intend
to make requests that aren't signed by an access token and secret (for example, as would be the
case during an initial OAuth exchange).

Parameters

$consumerKey

string
The OAuth consumer key.

$consumerSecret

string
The OAuth consumer secret.

$accessToken

string
The OAuth access token.

$accessTokenSecret

string
The OAuth access token secret.

Gets the OAuth access token, or null if not set

getAccessToken()

Inherited

inherited_from
\OAuthSignedRequestMaker::getAccessToken()

Gets the OAuth access token secret, or null if not set

getAccessTokenSecret()

Inherited

inherited_from
\OAuthSignedRequestMaker::getAccessTokenSecret()

Gets the OAuth consumer key

getConsumerKey()

Inherited

inherited_from
\OAuthSignedRequestMaker::getConsumerKey()

Gets the OAuth consumer secret

getConsumerSecret()

Inherited

inherited_from
\OAuthSignedRequestMaker::getConsumerSecret()

Makes an OAuth-signed HTTP POST request

makeSignedRequest(string $url, mixed $params, array $headers, bool $rawPostBody)

Inherited

Makes signed requests both during the initial OAuth exchange (where OAuth parameters are sent form-encoded
as part of the body of the request, with $rawPostBody = false) and afterwards when accessing the API (when
JSON-encoded parameters are sent raw in the body of the request).

inherited_from
\OAuthSignedRequestMaker::makeSignedRequest()

Parameters

$url

string
The URL to be requested.

$params

mixed
An array of parameters to be sent with the request as a post body (if $rawPostBody = false), or a string containing the raw post body to be sent (if $rawPostBody = true).

$headers

array
Additional HTTP headers to be sent with the request.

$rawPostBody

bool
If true, $params is interpreted as pre-parsed content to be dropped into the body of the request as-is. If false, the default, $params is interpreted as an array of key-value pairs to be form-encoded and sent in the body of the request.

Makes an HTTP Post request, returning the response.

makeHttpRequest(string $url, mixed $params, array $headers, bool $rawPostBody)

Inherited

inherited_from
\OAuthSignedRequestMaker::makeHttpRequest()

Parameters

$url

string
The URL to be requested.

$params

mixed
An array of parameters to be sent with the request as a post body (if $rawPostBody = false), or a string containing the raw post body to be sent (if $rawPostBody = true).

$headers

array
Additional HTTP headers to be sent with the request.

$rawPostBody

bool
If true, $params is interpreted as pre-parsed content to be dropped into the body of the request as-is. If false, the default, $params is interpreted as an array of key-value pairs to be form-encoded and sent in the body of the request.

 Properties

The OAuth access token, if known.

$_accessToken

Inherited

inherited_from
\OAuthSignedRequestMaker::$$_accessToken

The OAuth access token secret, if known.

$_accessTokenSecret

Inherited

inherited_from
\OAuthSignedRequestMaker::$$_accessTokenSecret

The OAuth consumer key.

$_consumerKey

Inherited

inherited_from
\OAuthSignedRequestMaker::$$_consumerKey

The OAuth consumer secret.

$_consumerSecret

Inherited

inherited_from
\OAuthSignedRequestMaker::$$_consumerSecret

            Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.

            Documentation is powered by phpDocumentor 2.0.0a10 and

            generated on 2012-12-10T16:23:18Z.

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Oro\Bundle\SecurityBundle\Tests\Unit\Fixtures\Models\CMS;

/**
 * @Entity
 * @Table(name="cms_articles")
 */
class CmsArticle
{
    /**
     * @Id
     * @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    public $id;

    /**
     * @Column(type="string", length=255)
     */
    public $topic;

    /**
     * @Column(type="text")
     */
    public $text;

    /**
     * @ManyToOne(targetEntity="CmsUser", inversedBy="articles")
     * @JoinColumn(name="user_id", referencedColumnName="id")
     */
    public $user;

    /**
     * @OneToMany(targetEntity="CmsComment", mappedBy="article")
     */
    public $comments;

    /**
     * @Version @column(type="integer")
     */
    public $version;

    /**
     * @OneToOne(targetEntity="CmsOrganization", inversedBy="address")
     * @JoinColumn(name="organization", referencedColumnName="id")
     */
    public $organization;

    public function setAuthor(CmsUser $author)
    {
        $this->user = $author;
    }

    public function addComment(CmsComment $comment)
    {
        $this->comments[] = $comment;
        $comment->setArticle($this);
    }

    /**
     * @param mixed $organization
     */
    public function setOrganization($organization)
    {
        $this->organization = $organization;
    }

    /**
     * @return mixed
     */
    public function getOrganization()
    {
        return $this->organization;
    }
}


text:
import asyncio
import argparse
import logging
from rssbot import bot
import sys

logger = logging.getLogger('main.py')
logger.setLevel(logging.DEBUG)
logging.basicConfig(level=logging.DEBUG)

def setup():
    b = bot.Bot()
    loop = asyncio.get_event_loop()
    loop.run_until_complete(b.setup())

def start(forever=False):
    b = bot.Bot()
    loop = asyncio.get_event_loop()
    app = loop.run_until_complete(b.start(auto_start=forever))
    if forever:
        b.story.forever(loop)
    return app

def parse_args(args):
    parser = argparse.ArgumentParser(prog=bot.BOT_NAME)
    parser.add_argument('--setup', action='store_true', default=False, help='setup bot')
    parser.add_argument('--start', action='store_true', default=False, help='start bot')
    return parser.parse_args(args), parser

def main():
    parsed, parser = parse_args(sys.argv[1:])
    if parsed.setup:
        return setup()

    if parsed.start:
        return start(forever=True)

    parser.print_help()

if __name__ == '__main__':
    main()


text:
<?php

namespace FreshmailTest\Command\Subscriber;

use Freshmail\Command\Subscriber\Create;
use Freshmail\Command\Subscriber\Delete;
use Freshmail\Model\Subscriber;
use Freshmail\Model\SubscriptionList;
use FreshmailTest\FreshmailServiceAwareTest;

class DeleteTest extends FreshmailServiceAwareTest
{
    public function testConstructor()
    {
        $deleteCommand = new Delete(new Subscriber());

        $this->assertInstanceOf(Subscriber::class, $deleteCommand->getSubscriber());
    }

    public function testGetMethod()
    {
        $deleteCommand = new Delete(new Subscriber());

        $this->assertEquals(Delete::METHOD_POST, $deleteCommand->getMethod());
    }

    public function testValidate()
    {
        $subscriber = new Subscriber();
        $subscriber->setList(new SubscriptionList());

        $deleteCommand = new Delete($subscriber);

        $this->assertFalse($deleteCommand->isValid());
        $this->assertCount(2, $deleteCommand->getErrorMessages());
    }

    public function testGetPath()
    {
        $deleteCommand = new Delete(new Subscriber());

        $this->assertEquals('/subscriber/delete', $deleteCommand->getPath());
    }

    public function testGetData()
    {
        $list = new SubscriptionList();
        $list->setHash('hash');

        $subscriber = new Subscriber();
        $subscriber->setEmail('test@email.com')
            ->setList($list);

        $deleteCommand = new Delete($subscriber);
        $data = $deleteCommand->getData();

        $this->assertArrayHasKey('email', $data);
        $this->assertArrayHasKey('list', $data);
    }

    public function testExecute()
    {
        $list = new SubscriptionList();
        $list->setHash($this->getEnvironmentVariable('TEST_LIST'));

        $subscriber = new Subscriber();
        $subscriber->setEmail($this->generateRandomEmail())
            ->setList($list);

        $createCommand = new Create($subscriber);
        $this->freshmail->executeCommand($createCommand);

        $deleteCommand = new Delete($subscriber);
        $this->freshmail->executeCommand($deleteCommand);
    }
}


text:
cask "workflowy" do
  version "1.3.7-1890"
  sha256 "e51fdc34a9a017a83ab9cc9f37ac5a5a4fd81456556198b76a7d8c53a0c1ac13"

  url "https://github.com/workflowy/desktop/releases/download/v#{version}/WorkFlowy.zip",
      verified: "github.com/workflowy/desktop/"
  name "WorkFlowy"
  desc "Notetaking tool"
  homepage "https://workflowy.com/downloads/mac/"

  auto_updates true

  app "WorkFlowy.app"

  zap trash: [
    "~/Library/Application Support/WorkFlowy",
    "~/Library/Preferences/com.workflowy.desktop.plist",
    "~/Library/Saved Application State/com.workflowy.desktop.savedState",
  ]
end


text:
<?php

namespace Jackalope\Transport\Logging;

use Psr\Log\LoggerInterface as Psr3LoggerInterface;

/**
 * Logs to a PSR-3 Logger.
 *
 * @author Lukas Kahwe Smith <smith@pooteeweet.org>
 */
class Psr3Logger implements LoggerInterface
{
    const MAX_STRING_LENGTH = 32;
    const BINARY_DATA_VALUE = '(binary value)';

    /**
     * @var LoggerInterface
     */
    protected $logger;

    /**
     * If the logger is enabled (log calls) or not.
     *
     * @var boolean
     */
    public $enabled = true;

    /**
     * Constructor.
     *
     * @param Psr3LoggerInterface $logger    A logger instance
     */
    public function __construct(Psr3LoggerInterface $logger = null)
    {
        $this->logger = $logger;
    }

    /**
     * {@inheritdoc}
     */
    public function startCall($method, array $params = null, array $env = null)
    {
        if ($this->enabled && $this->logger) {
            if (is_array($params)) {
                foreach ($params as $index => $param) {
                    if (!is_string($params[$index])) {
                        continue;
                    }

                    // non utf-8 strings break json encoding
                    if (!preg_match('#[\p{L}\p{N} ]#u', $params[$index])) {
                        $params[$index] = self::BINARY_DATA_VALUE;
                        continue;
                    }

                    // detect if the too long string must be shorten
                    if (function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($params[$index])) {
                        if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], $encoding)) {
                            $params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, $encoding).' [...]';
                            continue;
                        }
                    } else {
                        if (self::MAX_STRING_LENGTH < strlen($params[$index])) {
                            $params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6).' [...]';
                            continue;
                        }
                    }
                }
            }

            $this->logger->info($method, array('params' => $params, 'env' => $env));
        }
    }

    /**
     * {@inheritdoc}
     */
    public function stopCall()
    {
    }
}


text:
  #include <windows.h>
  #include <gl/glew.h>
#endif
#if defined(__APPLE__)
  #include <OpenGL/gl3.h>
  #ifndef GL_TESS_CONTROL_SHADER
      #define GL_TESS_CONTROL_SHADER 0x00008e88
  #endif
  #ifndef GL_TESS_EVALUATION_SHADER
      #define GL_TESS_EVALUATION_SHADER 0x00008e87
  #endif
  #ifndef GL_PATCHES
      #define GL_PATCHES 0x0000000e
  #endif
#else
  #include <GL/gl.h>
#endif
#include <caml/bigarray.h>
#include <string.h>
#include "utils.h"
#include "types_stubs.h"

#define TEX(_a) (*(GLuint*) Data_custom_val(_a))

#define MLvar_Minify  (254173077)

#define MLvar_Magnify (-1011094397)

#define MLvar_Wrap (1940966357)

void finalise_tex(value v)
{
  glDeleteTextures(1,&TEX(v));
}

int compare_tex(value v1, value v2)
{
  GLuint i1 = TEX(v1);
  GLuint i2 = TEX(v2);
  if(i1 < i2) return -1;
  else if(i1 == i2) return 0;
  else return 1;
}

intnat hash_tex(value v)
{
  GLuint i = TEX(v);
  return i;
}

static struct custom_operations tex_custom_ops = {
  "texture GC handling",
  finalise_tex,
  compare_tex,
  hash_tex,
  custom_serialize_default,
  custom_deserialize_default
};

// INPUT   nothing
// OUTPUT  a fresh texture id
CAMLprim value
caml_create_texture(value unit)
{
  CAMLparam0();
  CAMLlocal1(v);

  GLuint buf[1];
  glGenTextures(1, buf);
  v = caml_alloc_custom( &tex_custom_ops, sizeof(GLuint), 0, 1);
  memcpy( Data_custom_val(v), buf, sizeof(GLuint) );

  CAMLreturn(v);
}

// INPUT   a binding point and a texture id option
// OUTPUT  nothing, binds the texture
CAMLprim value
caml_bind_texture(value point, value tex_opt)
{
  CAMLparam2(point, tex_opt);

  if(tex_opt == Val_none)
    glBindTexture(Target_val(point), 0);
  else
    glBindTexture(Target_val(point), TEX(Some_val(tex_opt)));

  CAMLreturn(Val_unit);
}

// INPUT   an int (texture location)
// OUTPUT  nothing, activates the texture location
CAMLprim value
caml_activate_texture(value loc)
{
  CAMLparam1(loc);

  glActiveTexture(GL_TEXTURE0 + Int_val(loc));

  CAMLreturn(Val_unit);
}

// INPUT   a texture target, a level, a pixel format, a size, a texture format, some data
// OUTPUT  nothing, binds an image to the current texture2D
CAMLprim value
caml_tex_image_2D_native(value target, value lvl, value fmt, value size, value tfmt, value data)
{
  CAMLparam5(target, fmt, size, tfmt, data);
  CAMLxparam1(lvl);

  glTexImage2D(Target_val(target),
               Int_val(lvl),
               TextureFormat_val(tfmt),
               Int_val(Field(size,0)),
               Int_val(Field(size,1)),
               0,
               PixelFormat_val(fmt),
               GL_UNSIGNED_BYTE,
               (data == Val_none)? NULL : String_val(Some_val(data)));

  CAMLreturn(Val_unit);
}

CAMLprim value
caml_tex_image_2D_bytecode(value *argv, int argn)
{
  return caml_tex_image_2D_native(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
}

// INPUT   a texture target, a level, an offset, a size, a pixel format, some data
// OUTPUT  nothing, binds an subimage to the current texture2D
CAMLprim value
caml_tex_subimage_2D_native(value target, value lvl, value off, value size, value fmt, value data)
{
  CAMLparam5(target, lvl, off, size, fmt);
  CAMLxparam1(data);

  glTexSubImage2D(Target_val(target),
                  Int_val(lvl),
                  Int_val(Field(off,0)),
                  Int_val(Field(off,1)),
                  Int_val(Field(size,0)),
                  Int_val(Field(size,1)),
                  PixelFormat_val(fmt),
                  GL_UNSIGNED_BYTE,
                  String_val(data));

  CAMLreturn(Val_unit);
}

CAMLprim value
caml_tex_subimage_2D_bytecode(value *argv, int argn)
{
  return caml_tex_subimage_2D_native(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
}

// INPUT   a texture target, a number of mipmaps, a texture format, a texture size
// OUTPUT  nothing, allocates the space for a texture2D
CAMLprim value
caml_tex_storage_2D(value target, value lvls, value tfmt, value size)
{
  CAMLparam4(target,lvls,tfmt,size);

  glTexStorage2D(Target_val(target),
                 Int_val(lvls),
                 TextureFormat_val(tfmt),
                 Int_val(Field(size,0)),
                 Int_val(Field(size,1)));

  CAMLreturn(Val_unit);
}

// INPUT   a texture target, a level, a pixel format, a size, a texture format, some data
// OUTPUT  nothing, binds an image to the current texture3D
CAMLprim value
caml_tex_image_3D_native(value target, value lvl, value fmt, value size, value tfmt, value data)
{
  CAMLparam5(target, fmt, size, tfmt, data);
  CAMLxparam1(lvl);

  glTexImage3D(Target_val(target),
               Int_val(lvl),
               TextureFormat_val(tfmt),
               Int_val(Field(size,0)),
               Int_val(Field(size,1)),
               Int_val(Field(size,2)),
               0,
               PixelFormat_val(fmt),
               GL_UNSIGNED_BYTE,
               (data == Val_none)? NULL : String_val(Some_val(data)));

  CAMLreturn(Val_unit);
}

CAMLprim value
caml_tex_image_3D_bytecode(value *argv, int argn)
{
  return caml_tex_image_3D_native(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
}

// INPUT   a texture target, a level, an offset, a size, a pixel format, some data
// OUTPUT  nothing, binds an subimage to the current texture3D
CAMLprim value
caml_tex_subimage_3D_native(value target, value lvl, value off, value size, value fmt, value data)
{
  CAMLparam5(target, lvl, off, size, fmt);
  CAMLxparam1(data);

  glTexSubImage3D(Target_val(target),
                  Int_val(lvl),
                  Int_val(Field(off,0)),
                  Int_val(Field(off,1)),
                  Int_val(Field(off,2)),
                  Int_val(Field(size,0)),
                  Int_val(Field(size,1)),
                  Int_val(Field(size,2)),
                  PixelFormat_val(fmt),
                  GL_UNSIGNED_BYTE,
                  String_val(data));

  CAMLreturn(Val_unit);
}

CAMLprim value
caml_tex_subimage_3D_bytecode(value *argv, int argn)
{
  return caml_tex_subimage_3D_native(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
}

// INPUT   a texture target, a number of mipmaps, a texture format, a texture size
// OUTPUT  nothing, allocates the space for a texture3D
CAMLprim value
caml_tex_storage_3D(value target, value lvls, value tfmt, value size)
{
  CAMLparam4(target,lvls,tfmt,size);

  glTexStorage3D(Target_val(target),
                 Int_val(lvls),
                 TextureFormat_val(tfmt),
                 Int_val(Field(size,0)),
                 Int_val(Field(size,1)),
                 Int_val(Field(size,2)));

  CAMLreturn(Val_unit);
}

// INPUT   a variant containing the texture type and a min/mag filter
// OUTPUT  nothing, sets the texture parameter
CAMLprim value
caml_tex_parameter(value typ, value loc)
{
  CAMLparam2(typ, loc);

  if(Field(loc, 0) == MLvar_Magnify)
    glTexParameteri(Target_val(typ), GL_TEXTURE_MAG_FILTER, Magnify_val(Field(loc, 1)));
  else if(Field(loc, 0) == MLvar_Minify)
    glTexParameteri(Target_val(typ), GL_TEXTURE_MIN_FILTER, Minify_val(Field(loc, 1)));
  else if(Field(loc, 0) == MLvar_Wrap) {
    glTexParameteri(Target_val(typ), GL_TEXTURE_WRAP_S, Wrap_val(Field(loc, 1)));
    glTexParameteri(Target_val(typ), GL_TEXTURE_WRAP_R, Wrap_val(Field(loc, 1)));
    glTexParameteri(Target_val(typ), GL_TEXTURE_WRAP_T, Wrap_val(Field(loc, 1)));
  }
  else {
    caml_failwith("Caml polymorphic variant error in tex_parameter_2D(1)");
  }

  CAMLreturn(Val_unit);
}

// INPUT   a texture ID
// OUTPUT  nothing, deletes the texture
CAMLprim value
caml_destroy_texture(value id)
{
  CAMLparam1(id);

  glDeleteTextures(1, &TEX(id));

  CAMLreturn(Val_unit);
}


text:
#ifndef _SDM_MD_AFCLOCK_C_
#define _SDM_MD_AFCLOCK_C_

#if 0

#include "SDMMD_AFCLock.h"
#include "CFRuntime.h"
#include "SDMMD_Functions.h"

static CFTypeID _kSDMMD_AFCLockRefID = _kCFRuntimeNotATypeID;

static CFRuntimeClass _kSDMMD_AFCLockRefClass = {0};

void SDMMD_AFCLockRefClassInitialize(void) {
    _kSDMMD_AFCLockRefClass.version = 0;
    _kSDMMD_AFCLockRefClass.className = "SDMMD_AFCLockRef";
    _kSDMMD_AFCLockRefClass.init = NULL;
    _kSDMMD_AFCLockRefClass.copy = NULL;
    _kSDMMD_AFCLockRefClass.finalize = NULL;
    _kSDMMD_AFCLockRefClass.equal = NULL;
    _kSDMMD_AFCLockRefClass.hash = NULL;
    _kSDMMD_AFCLockRefClass.copyFormattingDesc = NULL;
    _kSDMMD_AFCLockRefClass.copyDebugDesc = NULL;
	_kSDMMD_AFCLockRefClass.reclaim = NULL;
    _kSDMMD_AFCLockRefID = _CFRuntimeRegisterClass((const CFRuntimeClass * const)&_kSDMMD_AFCLockRefClass);
}

CFTypeID SDMMD_AFCLockGetTypeID(void) {
    return _kSDMMD_AFCLockRefID;
}

SDMMD_AFCLockRef SDMMD_AFCLockCreate() {
	uint32_t extra = sizeof(AFCLockClassBody);
	SDMMD_AFCLockRef lock = calloc(0x1, sizeof(SDMMD_AFCLockClass));
	lock = (SDMMD_AFCLockRef)_CFRuntimeCreateInstance(kCFAllocatorDefault, _kSDMMD_AFCLockRefID, extra, NULL);
	if (lock) {
		sdmmd_mutex_init(lock->ivars.mutex_lock);
	}
	return lock;
}

sdmmd_return_t SDMMD_AFCLockLock(SDMMD_AFCLockRef lock) {
	sdmmd_return_t result = 0xe8004017;
	if (lock) {
		result = pthread_mutex_lock(&(lock->ivars.mutex_lock));
	} else {
		result = 0xe8004007;
	}
	return result;
}

sdmmd_return_t SDMMD_AFCLockUnlock(SDMMD_AFCLockRef lock) {
	sdmmd_return_t result = 0xe8004017;
	if (lock) {
		result = pthread_mutex_unlock(&(lock->ivars.mutex_lock));
	} else {
		result = 0xe8004007;
	}
	return result;
}

#endif

#endif


text:
package sg.ncl.service.data.exceptions;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
import sg.ncl.common.exception.base.NotFoundException;

/**
 * Created by dcsjnh on 30/5/2017.
 */
@ResponseStatus(code = HttpStatus.NOT_FOUND, reason = "There are no data license.")
public class DataLicenseNotFoundException extends NotFoundException {

    public DataLicenseNotFoundException(final String message) {
        super(message);
    }

}


text:
<!doctype html>

  <meta charset="utf-8">

  <link rel="canonical" href="<%host%>/components/amp-font/">
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

  <amp-font
    layout="nodisplay"
    font-family="Font Does Not exist"
    timeout="2000"
    on-error-remove-class="unavailable-font-loading"
    on-error-add-class="unavailable-font-missing"
    on-load-remove-class="unavailable-font-loading"
    on-load-add-class="unavailable-font-loaded">
  </amp-font>

    <amp-font
    layout="nodisplay"
    font-family="Tangerine"
    timeout="2000"
    on-error-remove-class="tangerine-loading"
    on-error-add-class="tangerine-missing"
    on-load-remove-class="tangerine-loading"
    on-load-add-class="tangerine-loaded">
  </amp-font>

    This text is displayed in red if the chosen font is not supported.

    This text is displayed in red if the chosen font is not supported.

  <amp-font
    layout="nodisplay"
    font-family="Another Font That Does Not exist"
    timeout="0"
    on-error-remove-class="another-unavailable-font-loading"
    on-error-add-class="another-unavailable-font-missing"
    on-load-remove-class="another-unavailable-font-loading"
    on-load-add-class="another-unavailable-font-loaded">
  </amp-font>

    This text is displayed in red if the chosen font is not cached.


text:
.class public abstract Lcom/fasterxml/jackson/databind/jsontype/impl/TypeIdResolverBase;
.super Ljava/lang/Object;
.source ""

# interfaces
.implements Lcom/fasterxml/jackson/databind/jsontype/TypeIdResolver;

# instance fields
.field protected final _baseType:Lcom/fasterxml/jackson/databind/JavaType;

.field protected final _typeFactory:Lcom/fasterxml/jackson/databind/type/TypeFactory;

# direct methods
.method protected constructor <init>(Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/type/TypeFactory;)V
    .locals 0

    .line 18
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 19
    iput-object p1, p0, Lcom/fasterxml/jackson/databind/jsontype/impl/TypeIdResolverBase;->_baseType:Lcom/fasterxml/jackson/databind/JavaType;

    .line 20
    iput-object p2, p0, Lcom/fasterxml/jackson/databind/jsontype/impl/TypeIdResolverBase;->_typeFactory:Lcom/fasterxml/jackson/databind/type/TypeFactory;

    .line 21
    return-void
.end method

# virtual methods
.method public idFromBaseType()Ljava/lang/String;
    .locals 2

    .line 36
    iget-object v0, p0, Lcom/fasterxml/jackson/databind/jsontype/impl/TypeIdResolverBase;->_baseType:Lcom/fasterxml/jackson/databind/JavaType;

    invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/JavaType;->getRawClass()Ljava/lang/Class;

    move-result-object v0

    const/4 v1, 0x0

    invoke-virtual {p0, v1, v0}, Lcom/fasterxml/jackson/databind/jsontype/impl/TypeIdResolverBase;->idFromValueAndType(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public init(Lcom/fasterxml/jackson/databind/JavaType;)V
    .locals 0

    .line 26
    return-void
.end method


text:
module RedmineGitHosting
  module Utils
    module Git
      extend self

      REF_COMPONENT_PART  = '[\\.\\-\\w_\\*]+'
      REF_COMPONENT_REGEX = %r{\A(refs/)?((#{REF_COMPONENT_PART})/)?(#{REF_COMPONENT_PART}(/#{REF_COMPONENT_PART})*)\z}.freeze

      # Parse a reference component. Two possibilities:
      #
      # 1) refs/type/name
      # 2) name
      #
      def parse_refspec(spec)
        parsed_refspec = spec.match REF_COMPONENT_REGEX
        return if parsed_refspec.nil?

        if parsed_refspec[1]
          # Should be first class.  If no type component, return fail
          { type: parsed_refspec[3], name: parsed_refspec[4] } if parsed_refspec[3]
        elsif parsed_refspec[3]
          { type: nil, name: "#{parsed_refspec[3]}/#{parsed_refspec[4]}" }
        else
          { type: nil, name: parsed_refspec[4] }
        end
      end

      def author_name(committer)
        committer.gsub(/\A([^<]+)\s+.*\z/, '\1')
      end

      def author_email(committer)
        committer.gsub(/\A.*<([^>]+)>.*\z/, '\1')
      end
    end
  end
end


text:
<?php
namespace BaseCRM;

class NotesServiceTest extends TestCase
{
  public function setUp()
  {
    parent::setUp();
  }

  public function testAllMethodExists()
  {
    $this->assertTrue(method_exists(self::$client->notes, 'all'));
  }

  public function testCreateMethodExists()
  {
    $this->assertTrue(method_exists(self::$client->notes, 'create'));
  }

  public function testGetMethodExists()
  {
    $this->assertTrue(method_exists(self::$client->notes, 'get'));
  }

  public function testUpdateMethodExists()
  {
    $this->assertTrue(method_exists(self::$client->notes, 'update'));
  }

  public function testDestroyMethodExists()
  {
    $this->assertTrue(method_exists(self::$client->notes, 'destroy'));
  }

  public function testAll()
  {
    $notes = self::$client->notes->all(['page' => 1]);
    $this->assertInternalType('array', $notes);

  }

  public function testCreate()
  {
    $this->assertInternalType('array', self::$note);
    $this->assertGreaterThanOrEqual(1, count(self::$note));

  }

  public function testGet()
  {
    $foundNote = self::$client->notes->get(self::$note['id']);
    $this->assertInternalType('array', $foundNote);
    $this->assertEquals($foundNote['id'], self::$note['id']);

  }

  public function testUpdate()
  {
    $updatedNote = self::$client->notes->update(self::$note['id'], self::$note);
    $this->assertInternalType('array', $updatedNote);
    $this->assertEquals($updatedNote['id'], self::$note['id']);

  }

  public function testDestroy()
  {
    $newNote = self::createNote();
    $this->assertTrue(self::$client->notes->destroy($newNote['id']));

  }
}


text:
create or replace view testview
(
 id, --Test comment
    report_id,
    report_element_id,
    parent_id,
    chapterNo,
    sequenceNo,
    title_de,
    title_en,
    is_direct_restricted,
    is_inherited_restricted,
    has_note,
    current_status_code,
    report_element_discriminator,
    has_childs,
    validation_needed,
 -- this is required that ef6 can use this view with a primary key!
 constraint v_report_tree primary key (id) rely disable
)
as
with
    restr as (
        select
            entityid reid
            , max(isdirectrestricted) isDirectRestricted
            , case when min(isdirectrestricted) = 0 then 1 else 0 end isIndirectRestricted
        from
            v_report_element_restrictions
        where restrictionstart < sysdate and restrictionend > sysdate
        group by
            entityid
    ),
    notes as (
        SELECT
            report_element_id,
            1 hasNote
        FROM
            report_element_note
        where
            deleted = 0
        group by
            report_element_id
    ),
    vaidationNeeded as (
        SELECT
            report_element_id
            , 1 ValidationNeeded
        FROM
            v_formatted_data_item_value_usage
        WHERE
            validationstatus = 'notvalidated'
        group by
            report_element_id
    ),
    contentText as (
        select
            *
        from
        (
                select
                    re.id report_element_id
                    , lang.code
                    , CASE
                        WHEN re.discriminator = 'DISCRIMA' THEN to_char('[' || SUBSTR(Regexp_replace(ce.text, '<.+?>'),0,30) || '...]')
                        ELSE to_char(Regexp_replace(ce.text, '<.+?>')) end text
                from
                    content_element ce
                        inner join content c on c.id = ce.content_id
                        inner join language lang on lang.id = ce.language_id
                        inner join report_element re on c.id = nvl(re.text_content_id,re.title_content_id)
                where
                    c.deleted = 0
                    and ce.deleted = 0
                order by
                    re.id, ce.content_id
        )
        PIVOT  (min(Text) AS lang_text FOR (code) IN ('EY' AS DE, 'OH' AS EN))
    )
select
 SYS_GUID() id
    , re.report_id report_id
    , re.id report_element_id
    , re.parent_id parent_id
    , report_helper.ReportElementNo(re.id) chapterNo
    , re.sequence_no sequenceNo
    , ct.de_lang_text title_de
    , ct.en_lang_text title_en
    , cast(nvl(restr.isDirectRestricted,0) as number(1)) is_direct_restricted
    , cast(nvl(restr.isIndirectRestricted,0) as number(1)) is_inherited_restricted
    , cast(nvl(notes.hasNote,0) as number(1)) has_note
    , re.status_code current_status_code
    , re.discriminator report_element_discriminator
    , cast((case when exists(select 1 from report_element re2 where re2.parent_id = re.id and deleted = 0) then 1 else 0 end) as number(1)) has_childs
    , cast(nvl(valNeed.ValidationNeeded,0) as number(1)) validation_needed
from
    report_element re
    left outer join contentText ct on ct.report_element_id = re.id
    left outer join restr restr on restr.reid = re.id
    left outer join notes notes on notes.report_element_id = re.id
    left outer join vaidationNeeded valNeed on valNeed.report_element_id = re.id
where
    re.deleted = 0
start with re.parent_id is null
connect by prior re.id = re.parent_id
order siblings by sequenceno;


text:
a local multiplayer game composed of many short games

currently it has two raw games.. and may not have more.. don't expect anything.


text:
using System;

namespace UserIdentity.DataAccess.Models
{
    public class User
    {
        public Guid Id { get; set; }
        public string Email { get; set; }
        public bool EmailConfirmed { get; set; }
        public string PhoneNumber { get; set; }
        public bool LockoutEnabled { get; set; }
        public DateTime? LockoutEndDateTimeUtc { get; set; }
    }
}


text:
title: How to Run the Examples
type: docs
weight: 70
url: /net/how-to-run-the-examples/
---

## **Software Requirements**
Please make sure you meet the following requirements before downloading and running the examples.

1. Visual Studio 2010 or higher
1. NuGet Package Manager installed in Visual Studio. Make sure that the latest NuGet API version is installed in Visual Studio. For details on how to install NuGet package manager please check <http://docs.nuget.org/ndocs/guides/install-nuget>
1. Go to Tools->Options->NuGet Package Manager->Package Sources and make sure that the option **nuget.org** is checked
1. Examples project uses NuGet Automatic Package Restore feature, therefore, you should have an active internet connection. If you do not have an active internet connection on the machine where examples are to be executed please check [Installation](http://www.aspose.com/docs/display/barcodenet/Installation) and manually add a reference to Aspose.BarCode.dll in the example project.
## **Download from GitHub**
All examples of Aspose.BarCode for .NET are hosted on [GitHub](https://github.com/aspose-barcode/Aspose.BarCode-for-.NET).

- You can either clone the repository using your favourite GitHub client or download the ZIP file from [here](https://github.com/aspose-barcode/Aspose.BarCode-for-.NET/archive/master.zip).
- Extract the contents of the ZIP file to any folder on your computer. All the examples are located in the **Examples** folder.
- There is a Visual Studio solution files, Aspose.BarCode.Examples.CSharp.sln in the folder.
- The project is created in Visual Studio 2013, but the solution file is compatible with Visual Studio 2010 SP1 and higher.
- Open the solution file in Visual Studio and build the project.
- On the first run, the dependencies will automatically be downloaded via NuGet.
- **Data** folder at the root folder of **Examples** contains input files used in code examples. It is mandatory that you download the **Data** folder along with the examples project.
- Open RunExamples.cs file, all the examples are called from here.
- Uncomment the examples you want to run from within the project.

Please feel free to reach out using our [Forums ](https://forum.aspose.com/c/barcode)if you have any issues setting up or running the examples.
## **Contribute**
If you like to add or improve an example, we encourage you to contribute to the project. All examples and showcase projects in this repository are open source and can be freely used in your own applications.

To contribute, you can fork the repository, edit the source code and create a pull request. We will review the changes and include it in the repository if found helpful.


text:
<?php

/**
 * Terminate Type 3 font definition
 *
 * @phpstub
 *
 * @param resource $pdfdoc
 *
 * @return bool
 */
function PDF_end_font($pdfdoc)
{
}


text:
title: Setup
description: How to deploy and upgrade Istio in various environments such as Kubernetes and Consul.
weight: 15
icon: setup
---


text:
usermod  --uid "${PHP_UID}" --shell /bin/bash --home /home www-data > /dev/null
groupmod --gid "${PHP_GID}" www-data > /dev/null


text:
namespace content {

// Setting to control cursor display based on either mouse movement or always
// forced to be enabled.
enum CursorDisplaySetting {
  kCursorAlwaysEnabled,
  kCursorEnabledOnMouseMovement
};

// CursorRenderer is an abstract base class that handles all the
// non-platform-specific common cursor rendering functionality.
//
// In order to track the cursor, the platform-specific implementation
// will listen to mouse events.
class CONTENT_EXPORT CursorRenderer {
 public:
  static std::unique_ptr<CursorRenderer> Create(gfx::NativeView view);

  CursorRenderer(gfx::NativeView captured_view,
                 CursorDisplaySetting cursor_display);

  virtual ~CursorRenderer();

  // Clears the cursor state being tracked. Called when there is a need to
  // reset the state.
  void Clear();

  // Takes a snapshot of the current cursor state and determines whether
  // the cursor will be rendered, which cursor image to render, and at what
  // location within |region_in_frame| to render it. Returns true if cursor
  // needs to be rendered.
  bool SnapshotCursorState(const gfx::Rect& region_in_frame);

  // Renders cursor on the |target| video frame.
  void RenderOnVideoFrame(media::VideoFrame* target) const;

  // Returns a weak pointer.
  base::WeakPtr<CursorRenderer> GetWeakPtr();

 protected:
  enum {
    // Minium movement before cursor is rendered on frame.
    MIN_MOVEMENT_PIXELS = 15,
    // Maximum idle time allowed before we stop rendering the cursor on frame.
    MAX_IDLE_TIME_SECONDS = 2
  };

  // Returns true if the captured view is a part of an active application
  // window.
  virtual bool IsCapturedViewActive() = 0;

  // Returns the size of the captured view (view coordinates).
  virtual gfx::Size GetCapturedViewSize() = 0;

  // Returns the cursor's position within the captured view (view coordinates).
  virtual gfx::Point GetCursorPositionInView() = 0;

  // Returns the last-known mouse cursor.
  virtual gfx::NativeCursor GetLastKnownCursor() = 0;

  // Returns the image of the last-known mouse cursor and its hotspot.
  virtual SkBitmap GetLastKnownCursorImage(gfx::Point* hot_point) = 0;

  // Called by subclasses to report mouse events within the captured view.
  void OnMouseMoved(const gfx::Point& location, base::TimeTicks timestamp);
  void OnMouseClicked(const gfx::Point& location, base::TimeTicks timestamp);

 private:
  friend class CursorRendererAuraTest;

  const gfx::NativeView captured_view_;

  // Snapshot of cursor, source size, scale, position, and cursor bitmap;
  // as of the last call to SnapshotCursorState.
  float last_x_scale_;
  float last_y_scale_;
  gfx::NativeCursor last_cursor_;
  gfx::Point cursor_position_in_frame_;
  gfx::Point last_cursor_hot_point_;
  SkBitmap scaled_cursor_bitmap_;

  // Updated in mouse event listener and used to make a decision on
  // when the cursor is rendered.
  base::TimeTicks last_mouse_movement_timestamp_;
  float last_mouse_position_x_;
  float last_mouse_position_y_;
  bool cursor_displayed_;

  // Controls whether cursor is displayed based on active mouse movement.
  CursorDisplaySetting cursor_display_setting_;

  // Allows tests to replace the clock.
  base::DefaultTickClock default_tick_clock_;
  base::TickClock* tick_clock_;

  base::WeakPtrFactory<CursorRenderer> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(CursorRenderer);
};

}  // namespace content

#endif  // CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_H_


text:
Web Server Notifier displays the Web server that generated the current page.  Many server software can be identified through an icon, such as Apache, IIS, Nginx, GWS, Lighttpd, etc.

This notifier can display more information when clicked.

## Philosophy

Being a general extension that does only one thing, without any feature.

* * *

Copyright (c) 2010-2014 Cyril Wack, released under the [MIT license](LICENSE.md)


text:
import scanFP as fp
import gray
import os
import time
import sys
from subprocess import call
import db
import sendNotification as sn

db.createdb()
# for i in range(5):
print "Place your next finger..."
roll_no = str(sys.argv[1])
name = "./Gallery/" + roll_no
fp.scan()
gray.grayscale()
call(["./mindtct","-b","-m1","grayout.png",name])
db.updatedb(sys.argv[1])
	# time.sleep(3)
db.displaydb()


text:
/*global process */

var sf = require('../../../lib/jsforce');
/**
 * Supporting power-assert
 */
require('espower-loader')({
  // directory where match starts with
  cwd: process.cwd(),
  // glob pattern using minimatch module
  pattern: 'test/**/*.test.js'
});

require('../async-check');

/**
 *
 */
module.exports = {

  isNodeJS: true,

  assert: require('power-assert'),

  createConnection: function(config) {
    return new sf.Connection({
      loginUrl: config.loginUrl,
      logLevel: config.logLevel
    });
  },

  establishConnection: function(conn, config, done) {
    conn.login(config.username, config.password, function(err, result) {
      if (err) { throw err; }
      if (!conn.accessToken) { throw new Error("No access token. Invalid login."); }
    }.check(done));
  }

};


text:
extern BCGCONTROLBARDLLEXPORT UINT BCGM_ON_CLOSEPOPUPWINDOW;

class BCGCONTROLBARDLLEXPORT CBCGPopupWndButton : public CBCGButton
{
	friend class CBCGPopupWindow;

public:
	CBCGPopupWndButton ()
	{
		m_bIsCaptionButton = FALSE;
		m_bIsCloseButton = FALSE;
	}

	BOOL IsCaptionButton () const
	{
		return m_bIsCaptionButton;
	}

	BOOL IsCloseButton () const
	{
		return m_bIsCloseButton;
	}

protected:
	virtual void OnFillBackground (CDC* pDC, const CRect& rectClient);
	virtual void OnDrawBorder (CDC* pDC, CRect& rectClient, UINT uiState);
	virtual void OnDraw (CDC* pDC, const CRect& rect, UINT uiState);

	BOOL	m_bIsCaptionButton;
	BOOL	m_bIsCloseButton;
};

/////////////////////////////////////////////////////////////////////////////
// CBCGPopupWindow window

class BCGCONTROLBARDLLEXPORT CBCGPopupWindow : public CWnd
{
	friend CBCGPopupDlg;

	DECLARE_DYNAMIC(CBCGPopupWindow)

// Construction
public:
	CBCGPopupWindow();

// Attributes
public:

	CBCGPopupMenu::ANIMATION_TYPE GetAnimationType ()
	{
		return m_AnimationType;
	}

	void SetAnimationType (CBCGPopupMenu::ANIMATION_TYPE type)
	{
		m_AnimationType = type;
	}

	void SetAnimationSpeed (UINT nSpeed)
	{
		if (nSpeed == 0 || nSpeed > 200)
		{
			ASSERT (FALSE);
			return;
		}

		m_AnimationSpeed = nSpeed;
	}

	UINT GetAnimationSpeed () const
	{
		return m_AnimationSpeed;
	}

	void SetTransparency (BYTE nTransparency)
	{
		if (nTransparency < 0 || nTransparency > 255)
		{
			ASSERT (FALSE);
			return;
		}

		m_nTransparency = nTransparency;
	}

	BYTE GetTransparency () const
	{
		return m_nTransparency;
	}

	void SetSmallCaption (BOOL bSmallCaption = TRUE)
	{
		m_bSmallCaption = bSmallCaption;
	}

	BOOL HasSmallCaption () const
	{
		return m_bSmallCaption;
	}

	void SetAutoCloseTime (int nTime)	// ms
	{
		m_nAutoCloseTime = nTime;
	}

	int GetAutoCloseTime () const		// ms
	{
		return m_nAutoCloseTime;
	}

	CPoint GetLastPos () const
	{
		return 	m_ptLastPos;
	}

protected:
	CWnd*				m_pWndOwner;
	BOOL				m_bIsActive;
	UINT				m_uiDlgResID;
	CBCGPopupDlg*		m_pWndDlg;
	BOOL				m_bHasCloseButton;
	HMENU				m_hMenu;
	int					m_nAutoCloseTime;	// ms
	BOOL				m_bSmallCaption;
	BYTE				m_nTransparency;	// (0..255)

	CBCGPopupWndButton	m_btnClose;
	CBCGPopupWndButton	m_btnMenu;

	int					m_nBtnMarginVert;
	int					m_nBtnMarginHorz;

	CPoint				m_ptLastPos;
	BOOL				m_bMoving;
	CPoint				m_ptStartMove;

	//----------------------
	// Animation attributes:
	//----------------------
	CBCGPopupMenu::ANIMATION_TYPE	m_AnimationType;
	UINT					m_AnimationSpeed;
	UINT					m_nAnimationAlpha;
	BOOL					m_bAnimationIsDone;
	CSize					m_AnimSize;
	CSize					m_FinalSize;
	BOOL					m_bIsAnimRight;
	BOOL					m_bIsAnimDown;
	int						m_iFadePercent;
	int						m_iFadeStep;
	int						m_nAnimStepX;
	int						m_nAnimStepY;
	BOOL					m_bFadeOutAnimation;

	CBitmap					m_bmpScreenSrc;
	CBitmap					m_bmpScreenDst;
	CBitmap					m_bmpScreenTmp;

	COLORREF*				m_cFadeSrcBits;
	COLORREF*				m_cFadeDstBits;
	COLORREF*				m_cFadeTmpBits;

// Operations
public:
	BOOL ProcessCommand (HWND hwnd);

protected:
	CRect GetCaptionRect ();
	void StartAnimation (BOOL bShow = TRUE);
	void DrawAnimation (CDC* pPaintDC);

	BOOL CommonCreate (CPoint ptPos, CBCGPopupWndParams* pParams = NULL);

	void StartWindowMove ();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CBCGPopupWindow)
	public:
	virtual BOOL Create(CWnd* pWndOwner, UINT uiDlgResID, HMENU hMenu = NULL, CPoint ptPos = CPoint (-1, -1), CRuntimeClass* pRTIDlgBar = RUNTIME_CLASS(CBCGPopupDlg));
	virtual BOOL Create(CWnd* pWndOwner, CBCGPopupWndParams& params, HMENU hMenu = NULL, CPoint ptPos = CPoint (-1, -1));
	//}}AFX_VIRTUAL
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);

	virtual void OnDraw (CDC* pDC);
	virtual int GetCaptionHeight ();

// Implementation
public:
	virtual ~CBCGPopupWindow();

	// Generated message map functions
protected:
	//{{AFX_MSG(CBCGPopupWindow)
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnNcDestroy();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
	afx_msg void OnDestroy();
	afx_msg void OnClose();
	afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnCancelMode();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	//}}AFX_MSG
	afx_msg LRESULT OnPrintClient(WPARAM wp, LPARAM lp);
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_BCGPOPUPWINDOW_H__4DE5ED2B_6089_4A54_BF22_113C2C5FA4C0__INCLUDED_)


text:
package org.hswebframework.web.counter.redis;

import org.hswebframework.web.concurrent.counter.Counter;
import org.hswebframework.web.concurrent.counter.CounterManager;
import org.junit.Assert;
import org.redisson.Redisson;
import org.redisson.config.Config;

import static org.junit.Assert.*;

/**
 * TODO 完成注释
 *
 * @author zhouhao
 */
public class RedissonCounterTest {

    public static void main(String[] args) throws InterruptedException {
        Config config = new Config();
//        config.setUseLinuxNativeEpoll(true);
        config.useSingleServer().setAddress("127.0.0.1:6379");
        Redisson redisson = (Redisson) Redisson.create(config);

        CounterManager counterManager = new RedissonCounterManager(redisson);
        //重置
        counterManager.getCounter("test").set(0);

        for (int i = 0; i < 100; i++) {
            new Thread(() -> counterManager.getCounter("test").increment()).start();
        }

        Thread.sleep(500);
        Assert.assertEquals(counterManager.getCounter("test").get(), 100);
        redisson.shutdown();

    }
}


text:
import React from 'react';
import invariant from 'invariant';
import getRouteParams from './getRouteParams';

var { array, func, object } = React.PropTypes;

/**
 * A <RoutingContext> renders the component tree for a given router state
 * and sets the history object and the current location in context.
 */
var RoutingContext = React.createClass({

  propTypes: {
    history: object.isRequired,
    createElement: func.isRequired,
    location: object.isRequired,
    routes: array.isRequired,
    params: object.isRequired,
    components: array.isRequired
  },

  getDefaultProps() {
    return {
      createElement: React.createElement
    };
  },

  childContextTypes: {
    history: object.isRequired,
    location: object.isRequired
  },

  getChildContext() {
    return {
      history: this.props.history,
      location: this.props.location
    };
  },

  createElement(component, props) {
    return component == null ? null : this.props.createElement(component, props);
  },

  render() {
    var { history, location, routes, params, components } = this.props;
    var element = null;

    if (components) {
      element = components.reduceRight((element, components, index) => {
        if (components == null)
          return element; // Don't create new children; use the grandchildren.

        var route = routes[index];
        var routeParams = getRouteParams(route, params);
        var props = {
          history,
          location,
          params,
          route,
          routeParams,
          routes
        };

        if (element)
          props.children = element;

        if (typeof components === 'object') {
          var elements = {};

          for (var key in components)
            if (components.hasOwnProperty(key))
              elements[key] = this.createElement(components[key], props);

          return elements;
        }

        return this.createElement(components, props);
      }, element);
    }

    invariant(
      element === null || element === false || React.isValidElement(element),
      'The root route must render a single element'
    );

    return element;
  }

});

export default RoutingContext;