text:
/* jshint indent: 2 */

import DataTypes from 'sequelize';
import Model from '../sequelize';

const Wardens = Model.define('wardens', {
  login_id: {
    type: DataTypes.STRING(30),
    allowNull: false,
    defaultValue: '',
    primaryKey: true,
  },
  hostel: {
    type: DataTypes.STRING(5),
    allowNull: false,
    defaultValue: '',
  },
  name: {
    type: DataTypes.STRING(50),
    allowNull: false,
    defaultValue: '',
  },
  chamber: {
    type: DataTypes.STRING(10),
    allowNull: true,
  },
  office: {
    type: DataTypes.STRING(20),
    allowNull: true,
  },
  residence: {
    type: DataTypes.STRING(20),
    allowNull: true,
  },
}, {
  tableName: 'wardens',
});

export default Wardens;

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Ilios\CoreBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

use Ilios\CoreBundle\Traits\IdentifiableEntityInterface;
use Ilios\CoreBundle\Traits\SchoolEntityInterface;
use Ilios\CoreBundle\Traits\TitledEntityInterface;
use Ilios\CoreBundle\Traits\OfferingsEntityInterface;

/**
 * Interface InstructorGroupInterface
 * @package Ilios\CoreBundle\Entity
 */
interface InstructorGroupInterface extends
    IdentifiableEntityInterface,
    TitledEntityInterface,
    OfferingsEntityInterface,
    SchoolEntityInterface,
    LoggableEntityInterface
{
    /**
     * @param Collection $learnerGroups
     */
    public function setLearnerGroups(Collection $learnerGroups);

    /**
     * @param LearnerGroupInterface $learnerGroup
     */
    public function addLearnerGroup(LearnerGroupInterface $learnerGroup);

    /**
     * @return ArrayCollection|LearnerGroupInterface[]
     */
    public function getLearnerGroups();

    /**
     * @param Collection $ilmSessions
     */
    public function setIlmSessions(Collection $ilmSessions);

    /**
     * @param IlmSessionInterface $ilmSession
     */
    public function addIlmSession(IlmSessionInterface $ilmSession);

    /**
     * @return ArrayCollection|IlmSessionInterface[]
     */
    public function getIlmSessions();

    /**
     * @param Collection $users
     */
    public function setUsers(Collection $users);

    /**
     * @param UserInterface $user
     */
    public function addUser(UserInterface $user);

    /**
     * @return ArrayCollection|UserInterface[]
     */
    public function getUsers();
}


text:
package lang

import (
	"fmt"
	"reflect"
	"strings"

	"github.com/mvader/bolt/runtime/stack"
)

// Fn is a function that receives N interface values and returns a single interface value.
type Fn func(*stack.Stack, ...interface{}) interface{}

// IsNil reports whether the given value is nil.
func IsNil(i interface{}) bool {
	if i == nil {
		return true
	}

	v := reflect.ValueOf(i)
	if v.IsValid() &&
		(v.Kind() == reflect.Ptr ||
			v.Kind() == reflect.Interface ||
			v.Kind() == reflect.Map ||
			v.Kind() == reflect.Slice) {
		return v.IsNil()
	}
	return false
}

// IsFalse reports whether the value is false or not.
// Only false and nil are said to be false.
func IsFalse(i interface{}) bool {
	v, ok := i.(bool)
	return (ok && !v) || IsNil(i)
}

// IsString reports whether the passed value is a string.
func IsString(i interface{}) bool {
	_, ok := i.(string)
	return ok
}

// CastString tries to cast the given interface to string and returns
// the resultant string and a boolean reporting whether the conversion
// was possible or not.
func CastString(i interface{}) (string, bool) {
	switch v := i.(type) {
	case string:
		return v, true
	case String:
		return string(v), true
	}
	return "", false
}

// IsFn reports whether the passed value meets the Fn spec.
func IsFn(i interface{}) bool {
	switch i.(type) {
	case Fn, func(*stack.Stack, ...interface{}) (interface{}, error):
		return true
	}
	return false
}

// CastFn tries to cast the given value to Fn and returns
// that Fn and a boolean reporting whether it was possible
// to perform the cast or not.
func CastFn(i interface{}) (Fn, bool) {
	switch v := i.(type) {
	case Fn:
		return v, true
	case func(*stack.Stack, ...interface{}) interface{}:
		return Fn(v), true
	}
	return nil, false
}

// IsInt reports whether the passed value is an int.
func IsInt(i interface{}) bool {
	switch i.(type) {
	case byte, uint16, uint32, uint64, uint, int, int8, int16, int32, int64:
		return true
	}
	return false
}

// CastInt tries to cast the given value to int and returns
// that int and a boolean reporting whether it was possible
// to perform the cast or not.
func CastInt(n interface{}) (int64, bool) {
	switch v := n.(type) {
	case int:
		return int64(v), true
	case int8:
		return int64(v), true
	case int16:
		return int64(v), true
	case int32:
		return int64(v), true
	case int64:
		return v, true
	case uint:
		return int64(v), true
	case uint16:
		return int64(v), true
	case uint32:
		return int64(v), true
	case uint64:
		return int64(v), true
	case byte:
		return int64(v), true
	default:
		return 0, false
	}
}

// IsFloat reports whether the passed value is a floating point number.
func IsFloat(i interface{}) bool {
	switch i.(type) {
	case float32, float64:
		return true
	}
	return false
}

// CastFloat tries to cast the given value to float and returns
// that float and a boolean reporting whether it was possible
// to perform the cast or not.
func CastFloat(n interface{}) (float64, bool) {
	switch v := n.(type) {
	case float32:
		return float64(v), true
	case float64:
		return v, true
	default:
		return .0, false
	}
}

// ForceCastFloat tries to cast the given value to float
// (if the value is int, will be also force-casted to float)
// and returns the casted float and a boolean reporting
// whether it was possible to perform the casting.
func ForceCastFloat(n interface{}) (float64, bool) {
	if v, ok := CastInt(n); ok {
		return float64(v), true
	}

	if v, ok := CastFloat(n); ok {
		return v, true
	}

	return .0, false
}

// IsBool reports whether the passed value is a boolean.
func IsBool(i interface{}) bool {
	_, ok := i.(bool)
	return ok
}

// IsSymbol reports whether the passed value is a Symbol.
func IsSymbol(i interface{}) bool {
	_, ok := i.(*Symbol)
	return ok
}

// IsKeyword reports whether the passed value is a Keyword.
func IsKeyword(i interface{}) bool {
	_, ok := i.(*Keyword)
	return ok
}

// IsList reports whether the given value is a List.
func IsList(i interface{}) bool {
	_, ok := i.(*List)
	return ok
}

// IsVector reports whether the given value is a Vector.
func IsVector(i interface{}) bool {
	_, ok := i.(*Vector)
	return ok
}

// IsSeq reports whether the passed value is a Seq.
func IsSeq(i interface{}) bool {
	_, ok := i.(Seq)
	return ok
}

// IsRune reports whether the passed value is a rune.
func IsRune(i interface{}) bool {
	_, ok := i.(rune)
	return ok
}

// printableRune returns a printable representation of a rune.
func printableRune(r rune) string {
	return "\\" + strings.Trim(fmt.Sprintf("%q", r), "'")
}

func printable(x interface{}) string {
	if IsNil(x) {
		x = "nil"
	}

	if IsRune(x) {
		x = printableRune(x.(rune))
	}

	return fmt.Sprint(x)
}


text:
layout: page
title: Pitts Gold Trade Award Ceremony
date: 2016-05-24
author: Tiffany Medina
tags: weekly links, java
status: published
summary: Vivamus auctor rhoncus orci, ut consectetur urna.
banner: images/banner/people.jpg
booking:
  startDate: 06/09/2016
  endDate: 06/12/2016
  ctyhocn: SAVDTHX
  groupCode: PGTAC
published: true
---
Pellentesque justo mi, facilisis vitae elit eget, sodales suscipit metus. Aenean fermentum nisi in sapien laoreet pellentesque. Aliquam ultricies, nisl eu interdum rhoncus, sapien enim finibus sem, vel pulvinar lorem urna sit amet mauris. Maecenas vitae neque ornare, varius mauris quis, fermentum mi. Duis auctor tellus ipsum, ac dapibus mauris pretium dapibus. Fusce bibendum suscipit felis et euismod. Suspendisse potenti. Fusce eu elit semper, pulvinar orci at, cursus felis. Quisque dictum pulvinar venenatis. Duis sed erat congue, pretium enim a, malesuada leo. Integer in nunc leo. In odio purus, accumsan sed justo vitae, ultrices porta nisi. Donec aliquam purus et felis cursus sodales. Donec pretium dolor sed lorem viverra aliquet. Nam ac tortor bibendum, vestibulum felis laoreet, varius lorem.

* Duis vitae mi maximus, convallis odio ac, aliquam ante
* Pellentesque rhoncus est fermentum, vestibulum sem id, iaculis felis
* Donec vitae turpis nec sem placerat venenatis a nec nisl
* Etiam porta sem et erat hendrerit, sit amet ultrices massa varius.

Aenean vitae maximus tellus. Curabitur magna dui, commodo vitae porta et, tincidunt nec lectus. In ac dapibus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pharetra rhoncus tempor. Phasellus euismod sem a mauris tristique, quis vestibulum eros molestie. Duis quis dignissim magna. Sed ac mi suscipit, dapibus arcu ut, facilisis est. Nulla sit amet justo in dui lobortis porttitor. Quisque vel justo finibus, porta leo id, scelerisque ex. Curabitur quis elit nec velit suscipit viverra non id massa.


text:
import { useEffect, useMemo } from 'react';
import { DragSourceImpl } from './DragSourceImpl';
export function useDragSource(spec, monitor, connector) {
    const handler = useMemo(()=>new DragSourceImpl(spec, monitor, connector)
    , [
        monitor,
        connector
    ]);
    useEffect(()=>{
        handler.spec = spec;
    }, [
        spec
    ]);
    return handler;
}

//# sourceMappingURL=useDragSource.js.map


text:
<?php

/**
 * This file is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
 */

use OA\CurlClient;

require __DIR__ . '/OA/CurlClient.php';

$pollId = $_GET['id'];

if (empty($pollId)) {
    header('Location: curl_index.php');
}

$curlClient = new CurlClient();

$choices = $curlClient->listChoices($pollId);
$pollData = $curlClient->getPollData($pollId);

?>
<!DOCTYPE html>

        <title>Edit a poll: <?php echo $pollData->title; ?></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

Edit a poll: <?php echo $pollData->title; ?>

Add a choice

                        <form method="POST" action="_choice_create.php">
                            <input name="poll_id" type="hidden" value="<?php echo $pollId; ?>">

                                <input name="label" type="text" class="form-control" placeholder="Label">

                            <button type="submit" class="btn btn-success">Submit</button>
                        </form>

Choices list

                            <?php foreach ($choices as $choice): ?>

                                    <?php echo $choice->label; ?>

                                        <a href="_choice_delete.php?id=<?php echo $choice->id . "&poll_id=$pollId"; ?>" class="btn btn-danger" role="button">Delete

                            <?php endforeach; ?>

                            Careful: there is no confirmation asked. Every deletion is final.
                            It can have a severe impact on an on-going poll.

                    Back to Polls Index

                <?php include 'caveat.php'; ?>


text:
import bind2vind = require( './index' );

// TESTS //

// The function returns a number...
{
	const shape = [ 3, 3, 3 ];
	const strides = [ 9, 6, 1 ];
	const offset = 0;
	const order = 'row-major';
	const idx = 17;
	const mode = 'throw';
	bind2vind( shape, strides, offset, order, idx, mode ); // $ExpectType number
}

// The compiler throws an error if the function is provided a first argument which is not an array-like object containing numbers...
{
	const strides = [ 9, 6, 1 ];
	const offset = 0;
	const order = 'row-major';
	const idx = 17;
	const mode = 'throw';
	bind2vind( true, strides, offset, order, idx, mode ); // $ExpectError
	bind2vind( false, strides, offset, order, idx, mode ); // $ExpectError
	bind2vind( null, strides, offset, order, idx, mode ); // $ExpectError
	bind2vind( undefined, strides, offset, order, idx, mode ); // $ExpectError
	bind2vind( '5', strides, offset, order, idx, mode ); // $ExpectError
	bind2vind( [ '1', '2' ], strides, offset, order, idx, mode ); // $ExpectError
	bind2vind( {}, strides, offset, order, idx, mode ); // $ExpectError
	bind2vind( ( x: number ): number => x, strides, offset, order, idx, mode ); // $ExpectError
}

// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers...
{
	const shape = [ 3, 3, 3 ];
	const offset = 0;
	const order = 'row-major';
	const idx = 17;
	const mode = 'throw';
	bind2vind( shape, true, offset, order, idx, mode ); // $ExpectError
	bind2vind( shape, false, offset, order, idx, mode ); // $ExpectError
	bind2vind( shape, null, offset, order, idx, mode ); // $ExpectError
	bind2vind( shape, undefined, offset, order, idx, mode ); // $ExpectError
	bind2vind( shape, '5', offset, order, idx, mode ); // $ExpectError
	bind2vind( shape, [ '1', '2' ], offset, order, idx, mode ); // $ExpectError
	bind2vind( shape, {}, offset, order, idx, mode ); // $ExpectError
	bind2vind( shape, ( x: number ): number => x, offset, order, idx, mode ); // $ExpectError
}

// The compiler throws an error if the function is provided a third argument which is not a number...
{
	const shape = [ 3, 3, 3 ];
	const strides = [ 9, 6, 1 ];
	const order = 'row-major';
	const idx = 17;
	const mode = 'throw';
	bind2vind( shape, strides, true, order, idx, mode ); // $ExpectError
	bind2vind( shape, strides, false, order, idx, mode ); // $ExpectError
	bind2vind( shape, strides, null, order, idx, mode ); // $ExpectError
	bind2vind( shape, strides, undefined, order, idx, mode ); // $ExpectError
	bind2vind( shape, strides, '5', order, idx, mode ); // $ExpectError
	bind2vind( shape, strides, [ '1', '2' ], order, idx, mode ); // $ExpectError
	bind2vind( shape, strides, {}, order, idx, mode ); // $ExpectError
	bind2vind( shape, strides, ( x: number ): number => x, order, idx, mode ); // $ExpectError
}

// The compiler throws an error if the function is provided a fourth argument which is not a known array order...
{
	const shape = [ 3, 3, 3 ];
	const strides = [ 9, 6, 1 ];
	const offset = 0;
	const idx = 17;
	const mode = 'throw';
	bind2vind( shape, strides, offset, true, idx, mode ); // $ExpectError
	bind2vind( shape, strides, offset, false, idx, mode ); // $ExpectError
	bind2vind( shape, strides, offset, null, idx, mode ); // $ExpectError
	bind2vind( shape, strides, offset, undefined, idx, mode ); // $ExpectError
	bind2vind( shape, strides, offset, '5', idx, mode ); // $ExpectError
	bind2vind( shape, strides, offset, [ '1', '2' ], idx, mode ); // $ExpectError
	bind2vind( shape, strides, offset, {}, idx, mode ); // $ExpectError
	bind2vind( shape, strides, offset, ( x: number ): number => x, idx, mode ); // $ExpectError
}

// The compiler throws an error if the function is provided a fifth argument which is not a number...
{
	const shape = [ 3, 3, 3 ];
	const strides = [ 9, 6, 1 ];
	const offset = 0;
	const order = 'row-major';
	const mode = 'throw';
	bind2vind( shape, strides, offset, order, true, mode ); // $ExpectError
	bind2vind( shape, strides, offset, order, false, mode ); // $ExpectError
	bind2vind( shape, strides, offset, order, null, mode ); // $ExpectError
	bind2vind( shape, strides, offset, order, undefined, mode ); // $ExpectError
	bind2vind( shape, strides, offset, order, '5', mode ); // $ExpectError
	bind2vind( shape, strides, offset, order, [ '1', '2' ], mode ); // $ExpectError
	bind2vind( shape, strides, offset, order, {}, mode ); // $ExpectError
	bind2vind( shape, strides, offset, order, ( x: number ): number => x, mode ); // $ExpectError
}

// The compiler throws an error if the function is provided a sixth argument which is not a known mode...
{
	const shape = [ 3, 3, 3 ];
	const strides = [ 9, 6, 1 ];
	const offset = 0;
	const order = 'row-major';
	const idx = 17;
	bind2vind( shape, strides, offset, order, idx, true ); // $ExpectError
	bind2vind( shape, strides, offset, order, idx, false ); // $ExpectError
	bind2vind( shape, strides, offset, order, idx, null ); // $ExpectError
	bind2vind( shape, strides, offset, order, idx, undefined ); // $ExpectError
	bind2vind( shape, strides, offset, order, idx, '5' ); // $ExpectError
	bind2vind( shape, strides, offset, order, idx, [ '1', '2' ] ); // $ExpectError
	bind2vind( shape, strides, offset, order, idx, {} ); // $ExpectError
	bind2vind( shape, strides, offset, order, idx, ( x: number ): number => x ); // $ExpectError
}

// The compiler throws an error if the function is provided insufficient arguments...
{
	const shape = [ 3, 3, 3 ];
	const strides = [ 9, 6, 1 ];
	const offset = 0;
	const order = 'row-major';
	const idx = 17;
	bind2vind(); // $ExpectError
	bind2vind( shape ); // $ExpectError
	bind2vind( shape, strides ); // $ExpectError
	bind2vind( shape, strides, offset ); // $ExpectError
	bind2vind( shape, strides, offset, order ); // $ExpectError
	bind2vind( shape, strides, offset, order, idx ); // $ExpectError
}


text:
module AccountProfiler
  module Parser
    class DigitalDataSize
      @@BYTE = 1
      @@KILO_BYTE = 1024 * @@BYTE
      @@MEGA_BYTE = 1024 * @@KILO_BYTE

      @@BYTE_UNIT = "B"
      @@KILO_BYTE_UNIT = "KB"
      @@MEGA_BYTE_UNIT = "MB"

      def initialize( n_bytes )
        @n_bytes = n_bytes
      end

      def self.from_string( digital_data_size_text )
        types = [
          DigitalDataType.new( @@BYTE_UNIT, @@BYTE ),
          DigitalDataType.new( @@KILO_BYTE_UNIT, @@KILO_BYTE ),
          DigitalDataType.new( @@MEGA_BYTE_UNIT, @@MEGA_BYTE )
        ]

        for type in types do
          if type.match?( digital_data_size_text )
            n_bytes = type.to_n_bytes( digital_data_size_text )
            return DigitalDataSize.new( n_bytes )
          end
        end

        raise ArgumentError,
          "The digital data size is in an unknown format.
            Accepted formats are '%d[,%d] [ B | KB | MB ]'"
      end

      def length_in_bytes()
        @n_bytes
      end
    end

    class DigitalDataType
      def initialize( unit_text, length_in_bytes )
        @regex = /(\d+)(,(\d+)){0,1}\s*#{unit_text}$/
        @length_in_bytes = length_in_bytes
      end

      def match?( digital_data_text )
        ( digital_data_text =~ @regex ) != nil
      end

      def to_n_bytes( digital_data_text )
        matched = @regex.match( digital_data_text )

        integer_part = matched[ 1 ]
        decimal_part = matched[ 3 ]

        n_units = integer_part.to_i()
        if decimal_part
          decimal_part = decimal_part.tr( ",","" )
          n_units = "#{integer_part}.#{decimal_part}"
          n_units = n_units.to_f()
        end

        n_units * @length_in_bytes
      end
    end
  end
end


text:
using System.Reflection;
using System.Xml;
using System.Xml.Schema;
using System.Collections;

namespace System.Xml.Serialization {
#if CONFIG_SERIALIZATION
	public class SoapReflectionImporter {

		SoapAttributeOverrides attributeOverrides;
		string initialDefaultNamespace;
		ArrayList includedTypes;
		ArrayList relatedMaps = new ArrayList ();
		ReflectionHelper helper = new ReflectionHelper();

		#region Constructors

		public SoapReflectionImporter (): this (null, null)
		{
		}

		public SoapReflectionImporter (SoapAttributeOverrides attributeOverrides): this (attributeOverrides, null)
		{
		}

		public SoapReflectionImporter (string defaultNamespace): this (null, defaultNamespace)
		{
		}

		public SoapReflectionImporter (SoapAttributeOverrides attributeOverrides, string defaultNamespace)
		{
			if (defaultNamespace == null) initialDefaultNamespace = String.Empty;
			else initialDefaultNamespace = defaultNamespace;

			if (attributeOverrides == null) this.attributeOverrides = new SoapAttributeOverrides();
			else this.attributeOverrides = attributeOverrides;
		}

		#endregion // Constructors

		#region Methods

		public XmlMembersMapping ImportMembersMapping (string elementName, string ns, XmlReflectionMember[] members)
		{
			return ImportMembersMapping (elementName, ns, members, true, true, false);
		}

		public XmlMembersMapping ImportMembersMapping (string elementName, string ns, XmlReflectionMember[] members, bool hasWrapperElement, bool writeAccessors)
		{
			return ImportMembersMapping (elementName, ns, members, hasWrapperElement, writeAccessors, false);
		}

		public XmlMembersMapping ImportMembersMapping (string elementName, string ns, XmlReflectionMember[] members, bool hasWrapperElement, bool writeAccessors, bool validate)
		{
			XmlMemberMapping[] mapping = new XmlMemberMapping[members.Length];
			for (int n=0; n<members.Length; n++)
			{
				XmlTypeMapMember mapMem = CreateMapMember (members[n], ns);
				mapping[n] = new XmlMemberMapping (members[n].MemberName, ns, mapMem, true);
			}
			XmlMembersMapping mps = new XmlMembersMapping (elementName, ns, hasWrapperElement, writeAccessors, mapping);
			mps.RelatedMaps = relatedMaps;
			mps.Format = SerializationFormat.Encoded;
			mps.Source = new MembersSerializationSource (elementName, hasWrapperElement, members, writeAccessors, false, null, includedTypes);
			return mps;
		}

		public XmlTypeMapping ImportTypeMapping (Type type)
		{
			return ImportTypeMapping (type, null);
		}

		public XmlTypeMapping ImportTypeMapping (Type type, string defaultNamespace)
		{
			if (type == null)
				throw new ArgumentNullException ("type");

			if (type == typeof (void))
				throw new InvalidOperationException ("Type " + type.Name + " may not be serialized.");

			if (defaultNamespace == null) defaultNamespace = initialDefaultNamespace;
			if (defaultNamespace == null) defaultNamespace = string.Empty;

			XmlTypeMapping map;
			switch (TypeTranslator.GetTypeData(type).SchemaType)
			{
				case SchemaTypes.Class: map = ImportClassMapping (type, defaultNamespace); break;
				case SchemaTypes.Array: map = ImportListMapping (type, defaultNamespace); break;
				case SchemaTypes.XmlNode: throw CreateTypeException (type);
				case SchemaTypes.Primitive: map = ImportPrimitiveMapping (type, defaultNamespace); break;
				case SchemaTypes.Enum: map = ImportEnumMapping (type, defaultNamespace); break;
				case SchemaTypes.XmlSerializable:
				default: throw new NotSupportedException ("Type " + type.FullName + " not supported for XML stialization");
			}
			map.RelatedMaps = relatedMaps;
			map.Format = SerializationFormat.Encoded;
			map.Source = new SoapTypeSerializationSource (type, attributeOverrides, defaultNamespace, includedTypes);
			return map;
		}

		XmlTypeMapping CreateTypeMapping (TypeData typeData, string defaultXmlType, string defaultNamespace)
		{
			string membersNamespace = defaultNamespace;
			bool includeInSchema = true;

			SoapAttributes atts = null;
			if (defaultXmlType == null) defaultXmlType = typeData.XmlType;

			if (!typeData.IsListType)
			{
				if (attributeOverrides != null)
					atts = attributeOverrides[typeData.Type];

				if (atts != null && typeData.SchemaType == SchemaTypes.Primitive)
					throw new InvalidOperationException ("SoapType attribute may not be specified for the type " + typeData.FullTypeName);
			}

			if (atts == null)
				atts = new SoapAttributes (typeData.Type);

			if (atts.SoapType != null)
			{
				if (atts.SoapType.Namespace != null && atts.SoapType.Namespace != string.Empty)
					membersNamespace = atts.SoapType.Namespace;

				if (atts.SoapType.TypeName != null && atts.SoapType.TypeName != string.Empty)
					defaultXmlType = atts.SoapType.TypeName;

				includeInSchema = atts.SoapType.IncludeInSchema;
			}

			if (membersNamespace == null) membersNamespace = "";
			XmlTypeMapping map = new XmlTypeMapping (defaultXmlType, membersNamespace, typeData, defaultXmlType, membersNamespace);
			map.IncludeInSchema = includeInSchema;
			relatedMaps.Add (map);

			return map;
		}

		XmlTypeMapping ImportClassMapping (Type type, string defaultNamespace)
		{
			if (type.IsValueType) throw CreateStructException (type);
			if (type == typeof (object)) defaultNamespace = XmlSchema.Namespace;

			ReflectionHelper.CheckSerializableType (type);

			TypeData typeData = TypeTranslator.GetTypeData (type);
			XmlTypeMapping map = helper.GetRegisteredClrType (type, GetTypeNamespace (typeData, defaultNamespace));
			if (map != null) return map;

			map = CreateTypeMapping (typeData, null, defaultNamespace);
			helper.RegisterClrType (map, type, map.Namespace);
			map.MultiReferenceType = true;

			ClassMap classMap = new ClassMap ();
			map.ObjectMap = classMap;

			// Import members

			try
			{
				ICollection members = GetReflectionMembers (type);
				foreach (XmlReflectionMember rmember in members)
				{
					if (rmember.SoapAttributes.SoapIgnore) continue;
					classMap.AddMember (CreateMapMember (rmember, map.Namespace));
				}
			}
			catch (Exception ex)
			{
				throw helper.CreateError (map, ex.Message);
			}

			// Import included classes

			SoapIncludeAttribute[] includes = (SoapIncludeAttribute[])type.GetCustomAttributes (typeof (SoapIncludeAttribute), false);
			for (int n=0; n<includes.Length; n++)
			{
				Type includedType = includes[n].Type;
				ImportTypeMapping (includedType);
			}

			if (type == typeof (object) && includedTypes != null)
			{
				foreach (Type intype in includedTypes)
					map.DerivedTypes.Add (ImportTypeMapping (intype));
			}

			// Register inheritance relations

			if (type.BaseType != null)
			{
				XmlTypeMapping bmap = ImportClassMapping (type.BaseType, defaultNamespace);

				if (type.BaseType != typeof (object))
					map.BaseMap = bmap;

				// At this point, derived classes of this map must be already registered

				RegisterDerivedMap (bmap, map);
			}

			return map;
		}

		void RegisterDerivedMap (XmlTypeMapping map, XmlTypeMapping derivedMap)
		{
			map.DerivedTypes.Add (derivedMap);
			map.DerivedTypes.AddRange (derivedMap.DerivedTypes);

			if (map.BaseMap != null)
				RegisterDerivedMap (map.BaseMap, derivedMap);
			else {
				XmlTypeMapping obmap = ImportTypeMapping (typeof(object));
				if (obmap != map)
					obmap.DerivedTypes.Add (derivedMap);
			}
		}

		string GetTypeNamespace (TypeData typeData, string defaultNamespace)
		{
			string membersNamespace = defaultNamespace;

			SoapAttributes atts = null;

			if (!typeData.IsListType)
			{
				if (attributeOverrides != null)
					atts = attributeOverrides[typeData.Type];
			}

			if (atts == null)
				atts = new SoapAttributes (typeData.Type);

			if (atts.SoapType != null)
			{
				if (atts.SoapType.Namespace != null && atts.SoapType.Namespace != string.Empty)
					membersNamespace = atts.SoapType.Namespace;
			}

			if (membersNamespace == null) return "";
			else return membersNamespace;
		}

		XmlTypeMapping ImportListMapping (Type type, string defaultNamespace)
		{
			TypeData typeData = TypeTranslator.GetTypeData (type);
			XmlTypeMapping map = helper.GetRegisteredClrType (type, XmlSerializer.EncodingNamespace);
			if (map != null) return map;

			ListMap obmap = new ListMap ();
			TypeData itemTypeData = typeData.ListItemTypeData;

			map = CreateTypeMapping (typeData, "Array", XmlSerializer.EncodingNamespace);
			helper.RegisterClrType (map, type, XmlSerializer.EncodingNamespace);
			map.MultiReferenceType = true;
			map.ObjectMap = obmap;

			XmlTypeMapElementInfo elem = new XmlTypeMapElementInfo (null, itemTypeData);

			if (elem.TypeData.IsComplexType) {
				elem.MappedType = ImportTypeMapping (typeData.ListItemType, defaultNamespace);
				elem.TypeData = elem.MappedType.TypeData;
			}

			elem.ElementName = "Item";
			elem.Namespace = string.Empty;
			elem.IsNullable = true;	// By default, items are nullable

			XmlTypeMapElementInfoList list = new XmlTypeMapElementInfoList();
			list.Add (elem);

			obmap.ItemInfo = list;
			XmlTypeMapping objMap = ImportTypeMapping (typeof(object), defaultNamespace);
			objMap.DerivedTypes.Add (map);

			// Register any of the including types as a derived class of object
			SoapIncludeAttribute[] includes = (SoapIncludeAttribute[])type.GetCustomAttributes (typeof (SoapIncludeAttribute), false);
			for (int i = 0; i < includes.Length; i++)
			{
				Type includedType = includes[i].Type;
				objMap.DerivedTypes.Add(ImportTypeMapping (includedType, defaultNamespace));
			}

			return map;
		}

		XmlTypeMapping ImportPrimitiveMapping (Type type, string defaultNamespace)
		{
			TypeData typeData = TypeTranslator.GetTypeData (type);
			XmlTypeMapping map = helper.GetRegisteredClrType (type, GetTypeNamespace (typeData, defaultNamespace));
			if (map != null) return map;
			map = CreateTypeMapping (typeData, null, defaultNamespace);
			helper.RegisterClrType (map, type, map.Namespace);
			return map;
		}

		XmlTypeMapping ImportEnumMapping (Type type, string defaultNamespace)
		{
			TypeData typeData = TypeTranslator.GetTypeData (type);
			XmlTypeMapping map = helper.GetRegisteredClrType (type, GetTypeNamespace (typeData, defaultNamespace));
			if (map != null) return map;
			map = CreateTypeMapping (typeData, null, defaultNamespace);
			helper.RegisterClrType (map, type, map.Namespace);

			map.MultiReferenceType = true;

			string [] names = Enum.GetNames (type);
			EnumMap.EnumMapMember[] members = new EnumMap.EnumMapMember[names.Length];
			for (int n=0; n<names.Length; n++)
			{
				MemberInfo[] mem = type.GetMember (names[n]);
				string xmlName = names[n];
				object[] atts = mem[0].GetCustomAttributes (typeof(SoapEnumAttribute), false);
				if (atts.Length > 0) xmlName = ((SoapEnumAttribute)atts[0]).Name;
				members[n] = new EnumMap.EnumMapMember (xmlName, names[n]);
			}

			bool isFlags = type.GetCustomAttributes (typeof(FlagsAttribute),false).Length > 0;
			map.ObjectMap = new EnumMap (members, isFlags);
			ImportTypeMapping (typeof(object), defaultNamespace).DerivedTypes.Add (map);
			return map;
		}

		ICollection GetReflectionMembers (Type type)
		{
			ArrayList members = new ArrayList();
			PropertyInfo[] properties = type.GetProperties (BindingFlags.Instance | BindingFlags.Public);
			foreach (PropertyInfo prop in properties)
			{
				if (!prop.CanRead) continue;
				if (!prop.CanWrite && TypeTranslator.GetTypeData (prop.PropertyType).SchemaType != SchemaTypes.Array)
					continue;

				SoapAttributes atts = attributeOverrides[type, prop.Name];
				if (atts == null) atts = new SoapAttributes (prop);
				if (atts.SoapIgnore) continue;
				XmlReflectionMember member = new XmlReflectionMember(prop.Name, prop.PropertyType, atts);
				members.Add (member);
			}

			FieldInfo[] fields = type.GetFields (BindingFlags.Instance | BindingFlags.Public);
			foreach (FieldInfo field in fields)
			{
				SoapAttributes atts = attributeOverrides[type, field.Name];
				if (atts == null) atts = new SoapAttributes (field);
				if (atts.SoapIgnore) continue;
				XmlReflectionMember member = new XmlReflectionMember(field.Name, field.FieldType, atts);
				members.Add (member);
			}
			return members;
		}

		private XmlTypeMapMember CreateMapMember (XmlReflectionMember rmember, string defaultNamespace)
		{
			XmlTypeMapMember mapMember;
			SoapAttributes atts = rmember.SoapAttributes;
			TypeData typeData = TypeTranslator.GetTypeData (rmember.MemberType);

			if (atts.SoapAttribute != null)
			{
				// An attribute

				if (atts.SoapElement != null)
					throw new Exception ("SoapAttributeAttribute and SoapElementAttribute cannot be applied to the same member");

				XmlTypeMapMemberAttribute mapAttribute = new XmlTypeMapMemberAttribute ();
				if (atts.SoapAttribute.AttributeName == null)
					mapAttribute.AttributeName = rmember.MemberName;
				else
					mapAttribute.AttributeName = atts.SoapAttribute.AttributeName;

				mapAttribute.Namespace = (atts.SoapAttribute.Namespace != null) ? atts.SoapAttribute.Namespace : "";
				if (typeData.IsComplexType)
					mapAttribute.MappedType = ImportTypeMapping (typeData.Type, defaultNamespace);

				typeData = TypeTranslator.GetTypeData (rmember.MemberType, atts.SoapAttribute.DataType);
				mapMember = mapAttribute;
			}
			else
			{
				if (typeData.SchemaType == SchemaTypes.Array) mapMember = new XmlTypeMapMemberList ();
				else mapMember = new XmlTypeMapMemberElement ();

				if (atts.SoapElement != null && atts.SoapElement.DataType != null)
					typeData = TypeTranslator.GetTypeData (rmember.MemberType, atts.SoapElement.DataType);

				// Creates an ElementInfo that identifies the element
				XmlTypeMapElementInfoList infoList = new XmlTypeMapElementInfoList();
				XmlTypeMapElementInfo elem = new XmlTypeMapElementInfo (mapMember, typeData);

				elem.ElementName = (atts.SoapElement != null && atts.SoapElement.ElementName != null) ? atts.SoapElement.ElementName : rmember.MemberName;
				elem.Namespace = string.Empty;
				elem.IsNullable = (atts.SoapElement != null) ? atts.SoapElement.IsNullable : false;
				if (typeData.IsComplexType)
					elem.MappedType = ImportTypeMapping (typeData.Type, defaultNamespace);

				infoList.Add (elem);
				((XmlTypeMapMemberElement)mapMember).ElementInfo = infoList;
			}

			mapMember.TypeData = typeData;
			mapMember.Name = rmember.MemberName;
			mapMember.IsReturnValue = rmember.IsReturnValue;
			return mapMember;
		}

		public void IncludeType (Type type)
		{
			if (type == null)
				throw new ArgumentNullException ("type");

			if (includedTypes == null) includedTypes = new ArrayList ();
			if (!includedTypes.Contains (type))
				includedTypes.Add (type);
		}

		public void IncludeTypes (ICustomAttributeProvider provider)
		{
			object[] ats = provider.GetCustomAttributes (typeof(SoapIncludeAttribute), true);
			foreach (SoapIncludeAttribute at in ats)
				IncludeType (at.Type);
		}

		Exception CreateTypeException (Type type)
		{
			return new NotSupportedException ("The type " + type.FullName + " may not be serialized with SOAP-encoded messages. Set the Use for your message to Literal");
		}

		Exception CreateStructException (Type type)
		{
			return new NotSupportedException ("Cannot serialize " + type.FullName + ". Nested structs are not supported with encoded SOAP");
		}

		#endregion // Methods
	}
#endif // CONFIG_SERIALIZATION
}


text:
:orphan:

.. _quickguide:

Quick Guide
###########

Instructions are slightly different on whether you use ROS or not. For ROS, instructions will work whether you build ``ROS`` from source or not.

.. toggle_table::
   :arg1: From Source
   :arg2: From ROS packages

Install
*******

Install ``ORK`` as detailed on the :ref:`Install <install>` page.

If you want to visualize data in the database, you also need to run (be sure to have installed couchapp sudo pip install -U couchapp):

.. toggle:: From Source

   .. code-block:: bash

      cd object_recognition_core/web_ui && ./push.sh

.. toggle:: From ROS packages

   .. code-block:: bash

      rosrun object_recognition_core push.sh

Setup Your Environment
**********************

You need to setup your environment:

.. toggle:: From Source

   .. code-block:: bash

      source devel/setup.sh

.. toggle:: From ROS packages

   .. code-block:: bash

      source /opt/ros/DISTRO_NAME/setup.sh

This will add all the necessary packages to your ``PATH``, ``LD_LIBRARY_PATH`` and ``PYTHONPATH``.

.. toggle:: From ROS packages

   .. rubric:: Setup ROS

   Terminal 1:

   .. code-block:: sh

      roscore

   Terminal 2:

   .. code-block:: sh

      roslaunch openni_launch openni.launch

Setup the capture workspace
***************************

First capture an ORB template of your capture workspace. It  should be take from an planar frontal view, and the center of the image should be filled by the plane. Press 's' to save an image. The result will be placed in the directory given, e.g. my_textured_plane. Press 'q' to quit the template capture program.

.. toggle:: From Source

   .. code-block:: sh

      ./object_recognition_capture/apps/orb_template -o my_textured_plane

.. toggle:: From ROS packages

   Terminal 3:

   .. code-block:: sh

      rosrun object_recognition_capture orb_template -o my_textured_plane

   Try out tracking to see if you got a good template. Press 'q' to quit.

   .. code-block:: sh

      rosrun object_recognition_capture orb_track --track_directory my_textured_plane

   Uuse the SXGA (roughly 1 megapixel) mode of your openni device if possible.

   .. code-block:: sh

      rosrun dynamic_reconfigure dynparam set /camera/driver image_mode 1
      rosrun dynamic_reconfigure dynparam set /camera/driver depth_registration True

Capture objects
***************

Once you are happy with the workspace tracking, its time to capure an object. Place an object at the origin of the workspace. An run the capture program in preview mode. Make sure the mask and pose are being picked up.

.. toggle:: From Source

   .. code-block:: sh

      ./object_recognition_capture/apps/capture -i my_textured_plane --seg_z_min 0.01 -o silk.bag --preview

.. toggle:: From ROS packages

   .. code-block:: sh

      rosrun object_recognition_capture capture -i my_textured_plane --seg_z_min 0.01 -o silk.bag --preview

When satisified by the preview mode, run it for real.  The following will capture a bag of 60 views where each view is normally distributed on the view sphere. The mask and pose displays should only refresh when a novel view is captured. The program will finish when 35 (-n) views are captured. Press 'q' to quit early.

.. toggle:: From Source

   .. code-block:: sh

      ./object_recognition_capture/apps/capture -i my_textured_plane --seg_z_min 0.01 -o silk.bag

.. toggle:: From ROS packages

   .. code-block:: sh

      rosrun object_recognition_capture capture -i my_textured_plane --seg_z_min 0.01 -o silk.bag

Now time for upload. Make sure you install couch db on your machine. Give the object a name and useful tags seperated by a space, e.g. milk soy silk.

.. toggle:: From Source

   .. code-block:: sh

      ./object_recognition_capture/apps/upload -i silk.bag -n 'Silk' milk soy silk --commit

.. toggle:: From ROS packages

   .. code-block:: sh

      rosrun object_recognition_capture upload -i silk.bag -n 'Silk' milk soy silk --commit

Train objects
*************

Repeat the steps above for the objects you would like to recognize. Once you have captured and uploaded all of the data, it time to mesh and train object recognition.

Meshing objects can be done in a batch mode as follows:

.. toggle:: From Source

   .. code-block:: sh

      ./object_recognition_reconstruction/apps/mesh_object --all --visualize --commit

.. toggle:: From ROS packages

   .. code-block:: sh

    rosrun object_recognition_reconstruction mesh_object --all --visualize --commit

The currently stored models are on http://localhost:5984/or_web_ui/_design/viewer/meshes.html

Next objects should be trained. It may take some time between objects, this is normal. Also, this quickguide assumes that you are using :ref:`TOD <orktod:tod>` which only works for textured objects. Please refer to the documentation of other methods.

.. toggle:: From Source

   .. code-block:: sh

      ./object_recognition_core/apps/training \
      -c object_recognition_tod/conf/training.ork \
      --visualize

.. toggle:: From ROS packages

   .. code-block:: sh

      rosrun object_recognition_core training \
      -c `rospack find object_recognition_tod`/conf/training.ork \
      --visualize

Detect objects
**************

Now we're ready for detection. First launch rviz, it should be subscribed to the right markers for recognition results. /markers is used for the results, and it is a marker array.

.. toggle:: From Source

   .. code-block:: sh

      ./rosrun object_recognition_core/apps/detection \
      -c object_recognition_tod/conf/detection.ork \
      --visualize

.. toggle:: From ROS packages

   .. code-block:: sh

      rosrun object_recognition_core detection \
      -c `rospack find object_recognition_tod`/conf/detection.ros.ork \
      --visualize


text:
Script

      angular
        .module('myApp.controllers', [])
        .controller('MyController', ['$scope', function($scope){
        }]);

      angular
        .module('myApp.services', [])
        .factory('MyFactory', [function () {
        }]);

      angular
        .module('myApp.filters', [])
        .filter(function(index) {
          return something;
        });

      angular
        .module('myApp.directives', [])
        .directive('myDirective', [function(){
        }]);

      angular.module('myApp', ['myApp.controllers', 'myApp.services', 'myApp.filters', 'myApp.directives']);

      angular.bootstrap(document, ['myApp'])


text:
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests.Responses;
using osuTK;
using System;
using System.Collections.Generic;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Online.API.Requests;

namespace osu.Game.Overlays.Rankings
{
    public class SpotlightSelector : VisibilityContainer, IHasCurrentValue<APISpotlight>
    {
        private const int duration = 300;

        private readonly Box background;
        private readonly SpotlightsDropdown dropdown;

        private readonly BindableWithCurrent<APISpotlight> current = new BindableWithCurrent<APISpotlight>();

        public Bindable<APISpotlight> Current
        {
            get => current.Current;
            set => current.Current = value;
        }

        public IEnumerable<APISpotlight> Spotlights
        {
            get => dropdown.Items;
            set => dropdown.Items = value;
        }

        protected override bool StartHidden => true;

        private readonly InfoColumn startDateColumn;
        private readonly InfoColumn endDateColumn;
        private readonly InfoColumn mapCountColumn;
        private readonly InfoColumn participantsColumn;
        private readonly Container content;

        public SpotlightSelector()
        {
            RelativeSizeAxes = Axes.X;
            Height = 100;
            Add(content = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Children = new Drawable[]
                {
                    background = new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = 10 },
                        Children = new Drawable[]
                        {
                            dropdown = new SpotlightsDropdown
                            {
                                Anchor = Anchor.TopCentre,
                                Origin = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.X,
                                Current = Current,
                                Depth = -float.MaxValue
                            },
                            new FillFlowContainer
                            {
                                Anchor = Anchor.BottomRight,
                                Origin = Anchor.BottomRight,
                                AutoSizeAxes = Axes.Both,
                                Direction = FillDirection.Horizontal,
                                Spacing = new Vector2(15, 0),
                                Children = new Drawable[]
                                {
                                    startDateColumn = new InfoColumn(@"Start Date"),
                                    endDateColumn = new InfoColumn(@"End Date"),
                                    mapCountColumn = new InfoColumn(@"Map Count"),
                                    participantsColumn = new InfoColumn(@"Participants")
                                }
                            }
                        }
                    }
                }
            });
        }

        [BackgroundDependencyLoader]
        private void load(OverlayColourProvider colourProvider)
        {
            background.Colour = colourProvider.Dark3;
        }

        public void ShowInfo(GetSpotlightRankingsResponse response)
        {
            startDateColumn.Value = dateToString(response.Spotlight.StartDate);
            endDateColumn.Value = dateToString(response.Spotlight.EndDate);
            mapCountColumn.Value = response.BeatmapSets.Count.ToString();
            participantsColumn.Value = response.Spotlight.Participants?.ToString("N0");
        }

        protected override void PopIn() => content.FadeIn(duration, Easing.OutQuint);

        protected override void PopOut() => content.FadeOut(duration, Easing.OutQuint);

        private string dateToString(DateTimeOffset date) => date.ToString("yyyy-MM-dd");

        private class InfoColumn : FillFlowContainer
        {
            public string Value
            {
                set => valueText.Text = value;
            }

            private readonly OsuSpriteText valueText;

            public InfoColumn(string name)
            {
                AutoSizeAxes = Axes.Both;
                Direction = FillDirection.Vertical;
                Children = new Drawable[]
                {
                    new OsuSpriteText
                    {
                        Text = name,
                        Font = OsuFont.GetFont(size: 10),
                    },
                    new Container
                    {
                        AutoSizeAxes = Axes.X,
                        Height = 20,
                        Child = valueText = new OsuSpriteText
                        {
                            Anchor = Anchor.BottomLeft,
                            Origin = Anchor.BottomLeft,
                            Font = OsuFont.GetFont(size: 18, weight: FontWeight.Light),
                        }
                    }
                };
            }

            [BackgroundDependencyLoader]
            private void load(OverlayColourProvider colourProvider)
            {
                valueText.Colour = colourProvider.Content2;
            }
        }

        private class SpotlightsDropdown : OsuDropdown<APISpotlight>
        {
            private DropdownMenu menu;

            protected override DropdownMenu CreateMenu() => menu = base.CreateMenu().With(m => m.MaxHeight = 400);

            [BackgroundDependencyLoader]
            private void load(OverlayColourProvider colourProvider)
            {
                menu.BackgroundColour = colourProvider.Background5;
                AccentColour = colourProvider.Background6;
            }
        }
    }
}


text:
#ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
#define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H

#include <grpc++/impl/codegen/config_protobuf.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc/impl/codegen/grpc_types.h>

namespace grpc {

/// Interface between the codegen library and the minimal subset of core
/// features required by the generated code.
///
/// All undocumented methods are simply forwarding the call to their namesakes.
/// Please refer to their corresponding documentation for details.
///
/// \warning This interface should be considered internal and private.
class CoreCodegenInterface {
 public:
  /// Upon a failed assertion, log the error.
  virtual void assert_fail(const char* failed_assertion) = 0;

  virtual grpc_completion_queue* grpc_completion_queue_create(
      void* reserved) = 0;
  virtual void grpc_completion_queue_destroy(grpc_completion_queue* cq) = 0;
  virtual grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq,
                                                 void* tag,
                                                 gpr_timespec deadline,
                                                 void* reserved) = 0;

  virtual void* gpr_malloc(size_t size) = 0;
  virtual void gpr_free(void* p) = 0;

  virtual void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) = 0;

  virtual void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
                                            grpc_byte_buffer* buffer) = 0;
  virtual void grpc_byte_buffer_reader_destroy(
      grpc_byte_buffer_reader* reader) = 0;
  virtual int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
                                           gpr_slice* slice) = 0;

  virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice,
                                                        size_t nslices) = 0;

  virtual gpr_slice gpr_slice_malloc(size_t length) = 0;
  virtual void gpr_slice_unref(gpr_slice slice) = 0;
  virtual gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) = 0;
  virtual void gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) = 0;
  virtual void gpr_slice_buffer_pop(gpr_slice_buffer* sb) = 0;

  virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0;
  virtual void grpc_metadata_array_destroy(grpc_metadata_array* array) = 0;

  virtual const Status& ok() = 0;
  virtual const Status& cancelled() = 0;

  virtual gpr_timespec gpr_inf_future(gpr_clock_type type) = 0;
};

extern CoreCodegenInterface* g_core_codegen_interface;

/// Codegen specific version of \a GPR_ASSERT.
#define GPR_CODEGEN_ASSERT(x)                          \
  do {                                                 \
    if (!(x)) {                                        \
      grpc::g_core_codegen_interface->assert_fail(#x); \
    }                                                  \
  } while (0)

}  // namespace grpc

#endif  // GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H


text:
package org.ooc.gui;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;

import org.ooc.errors.AssemblyManager;
import org.ooc.errors.SourceContext;
import org.ooc.nodes.others.SyntaxNode;
import org.ooc.nodes.others.SyntaxNodeList;
import org.ubi.CompilationFailedError;

/**
 * A widget which represents every node in the syntax tree.
 *
 * @author Amos Wenger
 */
public class SyntaxTreeWidget extends JPanel {

	/**
	 *
	 */
	protected static final long serialVersionUID = 6559650063649450237L;

	SyntaxTreeNode root;
	TreeModel model;
	JTree tree;
	AssemblyManager manager;
	int passNumber;
	protected String title;

	/**
	 * Shows tree of 'source', show errors in errorsPanel
	 * @param errorsPanel
	 * @param source
	 */
	public SyntaxTreeWidget(final ErrorsPanel errorsPanel, SourceContext source) {

		this(errorsPanel, new AssemblyManager(source), 0);

	}

	SyntaxTreeWidget(final ErrorsPanel errorsPanel, final AssemblyManager manager, final int passNumber) {

		super(new BorderLayout());

		this.manager = manager;
		manager.addAssemblyErrorListener(errorsPanel);

		if(passNumber == 0) {
			manager.queueRecursive(manager.getContext().source.getRoot(), "Initial SyntaxTreeTab request to queue all nodes recursively.");
		}

		this.root = new SyntaxTreeNode(manager, manager.getContext().source.getRoot());
		this.model = new DefaultTreeModel(root);
		this.tree = new JTree(model);
		this.passNumber = passNumber;
		this.add(new JScrollPane(tree));

		JPanel toolbar = new JPanel();
		toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.LINE_AXIS));
		this.add(toolbar, BorderLayout.NORTH);

		JButton next = new JButton();
		try {
			next.setIcon(new ImageIcon(ImageIO.read(Thread.currentThread()
					.getContextClassLoader().getResource("org/ooc/gui/skip_forward-40x40.png"))));
		} catch (IOException ex) {
			next.setText(">> next pass >>");
		}
		next.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent ev) {
				try {
					manager.doPass();
				} catch(CompilationFailedError e) { /* Well, we've gotta let the people debug, ain't it ? */ }

				SyntaxTreeWidget nextTab = new SyntaxTreeWidget(errorsPanel, manager, passNumber+1);
				JTabbedPane tabbedPane = (JTabbedPane) SyntaxTreeWidget.this.getParent();
				tabbedPane.addTab(nextTab.getTitle(), nextTab);
				tabbedPane.setSelectedComponent(nextTab);

				try {
					SyntaxTreeNode selected = (SyntaxTreeNode) tree.getSelectionPath().getLastPathComponent();
					SyntaxTreeNode node = nextTab.root.findNode(selected.getNode().hash);
					nextTab.tree.setSelectionPath(new TreePath(node.getPath()));
				} catch(Exception e) { /* Well, then I guess you'll just have to fsck off. */ }
			}
		});
		toolbar.add(next);

		final JTextField go = new JTextField();
		go.addKeyListener(new KeyAdapter() {

			@Override
			public void keyPressed(KeyEvent e) {
				if(e.getKeyCode() == KeyEvent.VK_ENTER) {
					int hash = Integer.parseInt(go.getText());
					SyntaxTreeNode node = root.findNode(hash);
					if(node == null) {
						JOptionPane.showMessageDialog(SyntaxTreeWidget.this,
								"SyntaxNode with hash #"+hash+" not found!",
								"Easter Egg", JOptionPane.WARNING_MESSAGE);
					} else {
						tree.setSelectionPath(new TreePath(node.getPath()));
					}
				}
			}
		});
		go.setFont(Font.decode("Sans-plain-24"));
		toolbar.add(go);

		tree.addMouseListener(new MouseAdapter() {

			@Override
			public void mouseClicked(MouseEvent e) {
				if(e.getButton() == 3) {
					TreePath path = tree.getClosestPathForLocation(e.getX(), e.getY());
					SyntaxTreeNode node = (SyntaxTreeNode) path.getLastPathComponent();
					JOptionPane.showMessageDialog(SyntaxTreeWidget.this, node.getInfo());
				}
			}

		});

		process(root);

		title = manager.getContext().source.getInfo().fullName+" #"+passNumber;

	}

	protected void process(SyntaxTreeNode treeNode) {

		SyntaxNode node = treeNode.getNode();
		if(node instanceof SyntaxNodeList) {
			SyntaxNodeList list = (SyntaxNodeList) node;
			for(SyntaxNode child: list.nodes) {
				SyntaxTreeNode childTreeNode = new SyntaxTreeNode(manager, child);
				treeNode.add(childTreeNode);
				process(childTreeNode);
			}
		}

	}

	/**
	 * @return the title of this source context
	 */
	public String getTitle() {

		return title;

	}

}


text:
package org.apache.hadoop.hive.ql.udf.generic;

import java.lang.reflect.Method;
import java.util.Arrays;

import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.udf.UDFType;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector;
import org.apache.hadoop.util.ReflectionUtils;

/**
 * A simple generic udf to call java static functions via reflection.
 */
@Description(name = "reflect",
  value = "_FUNC_(class,method[,arg1[,arg2..]]) calls method with reflection",
  extended = "Use this UDF to call Java methods by matching the argument signature\n")
@UDFType(deterministic = false)
public class GenericUDFReflect extends AbstractGenericUDFReflect {

  private transient StringObjectInspector inputClassNameOI;
  private transient StringObjectInspector inputMethodNameOI;

  StringObjectInspector classNameOI;
  StringObjectInspector methodNameOI;

  @Override
  public ObjectInspector initialize(ObjectInspector[] arguments)
  throws UDFArgumentException {

    if (arguments.length < 2) {
      throw new UDFArgumentLengthException(
          "The function GenericUDFReflect(class,method[,arg1[,arg2]...])"
          + " accepts 2 or more arguments.");
    }

    for (int i = 0; i < 2; i++) {
      if (!(arguments[i] instanceof StringObjectInspector)) {
        throw new UDFArgumentTypeException(i,
            "The first 2 parameters of GenericUDFReflect(class,method[,arg1[,arg2]...])"
            + " should be string.");
      }
    }
    inputClassNameOI = (StringObjectInspector) arguments[0];
    inputMethodNameOI = (StringObjectInspector) arguments[1];

    classNameOI = (StringObjectInspector)
        ObjectInspectorUtils.getStandardObjectInspector(arguments[0]);
    methodNameOI = (StringObjectInspector)
        ObjectInspectorUtils.getStandardObjectInspector(arguments[1]);

    setupParameterOIs(arguments, 2);

    return PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(
        PrimitiveCategory.STRING);
  }

  Class<?> c;
  Object o;
  Method m;
  Object className;
  Object methodName;

  @Override
  public Object evaluate(DeferredObject[] arguments) throws HiveException {

    // Try to find the class
    // Skip class loading if the class name didn't change
    boolean classNameChanged = false;

    Object newClassName = arguments[0].get();

    // We compare class name/method name using ObjectInspectorUtils.compare(...), to avoid
    // any object conversion (which may cause object creation) in most cases, when the class
    // name/method name is constant Java String, or constant Text (StringWritable).
    if (className == null || ObjectInspectorUtils.compare(className, classNameOI, newClassName,
        inputClassNameOI) != 0) {
      className = ObjectInspectorUtils.copyToStandardObject(newClassName, inputClassNameOI);
      String classNameString = classNameOI.getPrimitiveJavaObject(className);
      try {
        c = Class.forName(classNameString);
      } catch (ClassNotFoundException ex) {
        throw new HiveException("UDFReflect evaluate ", ex);
      }
      try {
        o = null;
        o = ReflectionUtils.newInstance(c, null);
      } catch (Exception e) {
        // ignored
      }
      classNameChanged = true;
    }

    // Try to find the method
    // Skip method finding if the method name didn't change, and class name didn't change.
    Object newMethodName = arguments[1].get();

    if (methodName == null || ObjectInspectorUtils.compare(methodName, methodNameOI, newMethodName,
        inputMethodNameOI) != 0 || classNameChanged) {
      methodName = ObjectInspectorUtils.copyToStandardObject(newMethodName, inputMethodNameOI);
      String methodNameString = methodNameOI.getPrimitiveJavaObject(methodName);
      try {
        m = findMethod(c, methodNameString, String.class, false);
      } catch (Exception e) {
        throw new HiveException("UDFReflect getMethod ", e);
      }
    }

    Object[] parameterJavaValues = setupParameters(arguments, 2);

    try {
      return String.valueOf(m.invoke(o, parameterJavaValues));
    } catch (Exception e1) {
      System.err.println("UDFReflect evaluate " + e1 + " method = " + m + " args = " +
          Arrays.asList(parameterJavaValues));
    }
    return null;
  }

  @Override
  protected String functionName() {
    return "reflect";
  }
}


text:
//
//  ADTokenCacheValue.h
//  ADALiOS
//
//  Created by Boris Vidolov on 10/15/13.
//  Copyright (c) 2013 MS Open Tech. All rights reserved.
//

#import <Foundation/Foundation.h>

/*! Encapsulates the values of the token cache */
@interface ADTokenCacheValue : NSObject

/*! An access token that can be used directly for the resource if it
 has not expired. See the expirationTime for the latter. */
@property NSString* accessToken;

/*! In case of expiration the supplied refreshToken can be used to obtain
 an access token. This property can be null if the server did not supply
 a refresh token*/
@property NSString* refreshToken;

/*! Defines until when the access token is valid */
@property NSDate* expirationTime;

/* The user whose credentials have been used to extract the token.
 This property is used for sign off scenarios, where the cache needs to be
 cleaned for a specific user */
@property NSDate* user;

@end


text:
from setuptools import setup, find_packages

setup(
    name='relaypy',
    version='0.1.dev0',
    description="Relay Python Experiment",
    author="Martijn Faassen",
    author_email="faassen@startifact.com",
    license="BSD",
    packages=find_packages(),
    include_package_data=True,
    zip_safe=False,
    install_requires=[
        'setuptools',
        'graphql-relay',
        'graphql-wsgi',
        'webob'
    ],
    entry_points={
        'console_scripts': [
            'relaypy_server = relaypy.server:server',
        ]
    },
)


text:
$Vc = "###VCENTER###"
$vcUser = "###VCENTER_ADMIN###"
$vcPass = '###VCENTER_PASSWD###'
$Datacenter = "###VCENTER_DATACENTER###"
$Cluster = "###VCENTER_CLUSTER###"

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false -DefaultVIServerMode multiple | out-null
Connect-VIServer -Server $Vc -User $vcUser -Password $vcPass | out-null

Foreach ( $vAPP in Get-VApp -Location ( Get-Cluster -Name $Cluster ) | Where {$_.name -match "cPod-*"}  ) {
	Write-Host "$vAPP"
	Foreach ( $VM in Get-VM -Location ( Get-VApp -Name $vAPP ) ) {
		Write-Host "-- $VM"
	}
}

Disconnect-VIServer -Confirm:$false


text:
layout: page
title: About
permalink: /about
order: 9999
---
# {{ site.product_name }}

{{ site.description }}

{{ site.product_name }} is proudly maintained with :sparkling_heart: by the Slack Developer Tools team

  * [License]()
  * [Code of Conduct]()
  * [Contributing]()
  * [Contributor License Agreement]()


text:
<?php

declare(strict_types=1);

/**
 * This file is part of Narrowspark Framework.
 *
 * (c) Daniel Bannert <d.bannert@anolilab.de>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Viserio\Component\Container\Tests\Integration;

use Invoker\Exception\NotCallableException;
use Invoker\Exception\NotEnoughParametersException;
use Invoker\Invoker;
use PHPUnit\Framework\Assert;
use stdClass;
use Viserio\Component\Container\AbstractCompiledContainer;
use Viserio\Component\Container\ContainerBuilder;
use Viserio\Component\Container\Dumper\PhpDumper;
use Viserio\Component\Container\Tests\Fixture\Invoke\InvokeCallableClass;
use Viserio\Component\Container\Tests\Fixture\Method\ClassWithMethods;

/**
 * @internal
 *
 * @covers \Viserio\Component\Container\ContainerBuilder
 *
 * @small
 */
final class ContainerCallTest extends BaseContainerTest
{
    /** @var string */
    protected const COMPILATION_DIR = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'Fixture' . \DIRECTORY_SEPARATOR . 'Compiled' . \DIRECTORY_SEPARATOR . 'Call' . \DIRECTORY_SEPARATOR;

    protected function tearDown(): void
    {
        parent::tearDown();

        \array_map(static function ($value): void {
            @\unlink($value);
        }, \glob(self::COMPILATION_DIR . '*', \GLOB_NOSORT));

        @\rmdir(self::COMPILATION_DIR);
    }

    public function testNoParameters(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $result = $container->call(function () {
            return 42;
        });

        self::assertEquals(42, $result);
    }

    public function testParametersOrdered(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $result = $container->call(function ($foo, $bar) {
            return $foo . $bar;
        }, ['foo', 'bar']);

        self::assertEquals('foobar', $result);
    }

    public function testParametersIndexedByName(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $result = $container->call(function ($foo, $bar) {
            return $foo . $bar;
        }, [
            // Reverse order: should still work
            'bar' => 'buzz',
            'foo' => 'fizz',
        ]);

        self::assertEquals('fizzbuzz', $result);
    }

    public function testParameterWithDefinitionsIndexed(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className, static function (ContainerBuilder $builder): void {
            $builder->setParameter('bar', 'bam');
        });

        $result = $container->call(function ($foo, $bar) {
            Assert::assertInstanceOf('stdClass', $bar);

            return $foo;
        }, [
            'bar' => $container->make('stdClass'),
            'foo' => $container->getParameter('bar'),
        ]);

        self::assertEquals('bam', $result);
    }

    public function testParameterWithDefinitionsNotIndexed(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className, static function (ContainerBuilder $builder): void {
            $builder->setParameter('bar', 'bam');
        });

        $result = $container->call(function ($foo, $bar) {
            Assert::assertInstanceOf('stdClass', $bar);

            return $foo;
        }, [$container->getParameter('bar'), $container->make('stdClass')]);

        self::assertEquals('bam', $result);
    }

    public function testParameterDefaultValue(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $result = $container->call(function ($foo = 'hello') {
            return $foo;
        });

        self::assertEquals('hello', $result);
    }

    public function testParameterExplicitValueOverridesDefaultValue(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $result = $container->call(static function ($foo = 'hello') {
            return $foo;
        }, [
            'foo' => 'test',
        ]);

        self::assertEquals('test', $result);

        $result = $container->call(static function ($foo = 'hello') {
            return $foo;
        }, ['test']);

        self::assertEquals('test', $result);
    }

    public function testParameterFromTypeHint(): void
    {
        $value = new stdClass();
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className, static function (ContainerBuilder $builder) use ($value): void {
            $builder->bind('stdClass', $value)
                ->setPublic(true);
        });

        $result = $container->call(static function (stdClass $foo) {
            return $foo;
        });

        self::assertEquals($value, $result);
    }

    public function testCallWithObjectMethod(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $object = new ClassWithMethods();
        $result = $container->call([$object, 'foo']);

        self::assertEquals(42, $result);
    }

    public function testCreatesAndCallsClassMethodsUsingContainer(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className, static function (ContainerBuilder $builder): void {
            $builder->bind(ClassWithMethods::class, new ClassWithMethods())
                ->setPublic(true);
        });

        $result = $container->call(ClassWithMethods::class . '@foo');

        self::assertEquals(42, $result);
    }

    public function testCallsStaticMethods(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $class = ClassWithMethods::class;
        $result = $container->call([$class, 'bar']);

        self::assertEquals(24, $result);
    }

    public function testCallsInvokableObject(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $result = $container->call(new InvokeCallableClass());

        self::assertEquals(42, $result);
    }

    public function testParameterFromTypeHintWithDefault(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $value = new stdClass();
        $container->set('stdClass', $value);

        $result = $container->call(function (?stdClass $foo = null) {
            return $foo;
        });

        self::assertEquals($value, $result);
    }

    public function testCreatesAndCallsInvokableObjectsUsingContainer(): void
    {
        $container = $this->getCompiledContainer(\ucfirst(__FUNCTION__), static function (ContainerBuilder $builder): void {
            $builder->bind(InvokeCallableClass::class, new InvokeCallableClass())
                ->setPublic(true);
        });

        $result = $container->call(InvokeCallableClass::class);

        self::assertEquals(42, $result);
    }

    public function testCallsFunction(): void
    {
        $className = \ucfirst(__FUNCTION__);

        $container = $this->getCompiledContainer($className);

        $result = $container->call('callFunctionTestFunction', [
            'str' => 'foo',
        ]);

        self::assertEquals(3, $result);
    }

    public function testSetInvoker(): void
    {
        $container = new class() extends AbstractCompiledContainer {
            public $invoker;
        };

        $container->setInvoker($invoker = new Invoker());

        self::assertSame($container->invoker, $invoker);
    }

    public function testNotEnoughParametersGivenForCallable(): void
    {
        $this->expectException(NotEnoughParametersException::class);
        $this->expectExceptionMessage('Unable to invoke the callable because no value was given for parameter 1 ($foo)');

        $container = $this->getCompiledContainer(\ucfirst(__FUNCTION__));

        $container->call(function ($foo): void {
        });
    }

    public function testNotACallable(): void
    {
        $this->expectException(NotCallableException::class);
        $this->expectExceptionMessage('\'foo\' is neither a callable nor a valid container entry');

        $container = $this->getCompiledContainer(\ucfirst(__FUNCTION__));

        $container->call('foo');
    }

    /**
     * @param string        $className
     * @param null|callable $callback
     *
     * @throws \Viserio\Contract\Container\Exception\CircularDependencyException
     *
     * @return \Viserio\Component\Container\AbstractCompiledContainer
     */
    private function getCompiledContainer(string $className, ?callable $callback = null): AbstractCompiledContainer
    {
        if ($callback !== null) {
            $callback($this->containerBuilder);
        }

        $this->containerBuilder->compile();

        PhpDumper::dumpCodeToFile(self::COMPILATION_DIR . $className . '.php', (new PhpDumper($this->containerBuilder))->dump(['class' => $className]));

        require self::COMPILATION_DIR . $className . '.php';

        return new $className();
    }
}


text:
class CreateSingleUseLinks < ActiveRecord::Migration
  def change
    create_table :single_use_links do |t|
      t.string :downloadKey
      t.string :path
      t.string :itemId
      t.datetime :expires

      t.timestamps
    end
  end
end


text:
require 'spec_helper'

describe "Test Retriever" do

  before(:each) do
    Mail.defaults do
      retriever_method :test
    end
  end

  it "should have no emails initially" do
    expect(Mail.all).to be_empty
  end

  describe "all" do

    before do
      @emails = populate(15)
    end

    it "should return all emails without a block" do
      expect(Mail.all).to eq @emails
    end

    it "should return all emails with a block" do
      messages = []
      Mail.all { |message| messages << message }
      expect(messages).to eq @emails
    end

  end

  describe "find" do

    before do
      @emails = populate(15)
    end

    it "should handle the :count option" do
      expect(Mail.find(:count => :all)).to eq @emails
      expect(Mail.find(:count => 1)).to eq @emails.first
      expect(Mail.find(:count => 5)).to eq @emails[0, 5]
    end

    it "should handle the :order option" do
      expect(Mail.find(:order => :asc)).to eq @emails
      expect(Mail.find(:order => :desc)).to eq @emails.reverse
    end

    it "should handle the :what option" do
      expect(Mail.find(:what => :first)).to eq @emails
      expect(Mail.find(:what => :first, :count => 5)).to eq @emails[0, 5]
      expect(Mail.find(:what => :last)).to eq @emails
      expect(Mail.find(:what => :last, :count => 5)).to eq @emails[10, 5]
    end

    it "should handle the both of :what and :order option with :count => 1" do
      expect(Mail.find(:count => 1, :what => :last, :order => :asc)).to eq @emails.last
      expect(Mail.find(:count => 1, :what => :first, :order => :desc)).to eq @emails.first
    end

    it "should handle the :delete_after_find option" do
      expect(Mail.find(:delete_after_find => false)).to eq @emails
      expect(Mail.find(:delete_after_find => false)).to eq @emails
      expect(Mail.find(:delete_after_find => true)).to eq @emails
      expect(Mail.find(:delete_after_find => false)).to be_empty
    end

    it "should handle the both of :delete_after_find and :count option" do
      expect do
        expect(Mail.find(:count => 5, :delete_after_find => true).size).to eq(5)
      end.to change { Mail.all.size }.by(-5)
      expect do
        expect(Mail.find(:count => 5, :delete_after_find => true).size).to eq(5)
      end.to change { Mail.all.size }.by(-5)
    end

    it "should handle the both of :count and :delete_after_find option" do
      15.times do |idx|
        expect do
          expect(Mail.find(:count => 1, :delete_after_find => true)).to eq @emails[idx]
        end.to change { Mail.all.size }.by(-1)
      end
      expect(Mail.find(:count => 1, :delete_after_find => true)).to be_empty
    end

    it "should handle the :delete_after_find option with messages marked not for delete" do
      i = 0
      messages = []
      Mail.find(:delete_after_find => true) do |message|
        if i % 2
          message.mark_for_delete = false
          messages << message
        end
        i += 1
      end
      expect(Mail.all).to eq messages
    end

  end

  private

  def populate(count)
    (1..count).map do
      Mail.new do
        to 'mikel@me.com'
        from 'you@you.com'
        subject 'testing'
        body 'hello'
      end
    end.tap do |emails|
      Mail::TestRetriever.emails = emails.dup
    end
  end

end


text: Amicable Numbers Python Parallel Calculator


text:
require 'complex'

require 'implemesh/operations/transform'

module Implemesh
  module Operations
    module DFT

      def self.perform(signal, params = {})
        inverse = params[:inverse] || false
        DFT.new(signal, inverse).perform
      end

      class DFT < Transform

        def proccess_array
          sign = inverse ? 1 : -1
          result = []

          array.size.times do |index|
            result[index] = 0
            array.each_with_index do |inner, inner_index|
              result[index] += Complex(*inner) * Math.exp(sign * 2 * Math::PI * Complex::I * index * inner_index / array.size)
            end
            if inverse
              result[index] /= array.size
            end
            result[index] = result[index].rectangular
          end

          result
        end
      end
    end
  end
end


text:
package ldap

import (
	"errors"

	"gopkg.in/asn1-ber.v1"
)

type SimpleBindRequest struct {
	Username string
	Password string
	Controls []Control
}

type SimpleBindResult struct {
	Controls []Control
}

func NewSimpleBindRequest(username string, password string, controls []Control) *SimpleBindRequest {
	return &SimpleBindRequest{
		Username: username,
		Password: password,
		Controls: controls,
	}
}

func (bindRequest *SimpleBindRequest) encode() *ber.Packet {
	request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
	request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
	request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, bindRequest.Username, "User Name"))
	request.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, bindRequest.Password, "Password"))

	request.AppendChild(encodeControls(bindRequest.Controls))

	return request
}

func (l *Conn) SimpleBind(simpleBindRequest *SimpleBindRequest) (*SimpleBindResult, error) {
	messageID := l.nextMessageID()

	packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
	packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, messageID, "MessageID"))
	encodedBindRequest := simpleBindRequest.encode()
	packet.AppendChild(encodedBindRequest)

	if l.Debug {
		ber.PrintPacket(packet)
	}

	channel, err := l.sendMessage(packet)
	if err != nil {
		return nil, err
	}
	if channel == nil {
		return nil, NewError(ErrorNetwork, errors.New("ldap: could not send message"))
	}
	defer l.finishMessage(messageID)

	packetResponse, ok := <-channel
	if !ok {
		return nil, NewError(ErrorNetwork, errors.New("ldap: channel closed"))
	}
	packet, err = packetResponse.ReadPacket()
	l.Debug.Printf("%d: got response %p", messageID, packet)
	if err != nil {
		return nil, err
	}

	if l.Debug {
		if err := addLDAPDescriptions(packet); err != nil {
			return nil, err
		}
		ber.PrintPacket(packet)
	}

	result := &SimpleBindResult{
		Controls: make([]Control, 0),
	}

	if len(packet.Children) == 3 {
		for _, child := range packet.Children[2].Children {
			result.Controls = append(result.Controls, DecodeControl(child))
		}
	}

	resultCode, resultDescription := getLDAPResultCode(packet)
	if resultCode != 0 {
		return result, NewError(resultCode, errors.New(resultDescription))
	}

	return result, nil
}

func (l *Conn) Bind(username, password string) error {
	messageID := l.nextMessageID()

	packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
	packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, messageID, "MessageID"))
	bindRequest := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
	bindRequest.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
	bindRequest.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, username, "User Name"))
	bindRequest.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, password, "Password"))
	packet.AppendChild(bindRequest)

	if l.Debug {
		ber.PrintPacket(packet)
	}

	channel, err := l.sendMessage(packet)
	if err != nil {
		return err
	}
	if channel == nil {
		return NewError(ErrorNetwork, errors.New("ldap: could not send message"))
	}
	defer l.finishMessage(messageID)

	packetResponse, ok := <-channel
	if !ok {
		return NewError(ErrorNetwork, errors.New("ldap: channel closed"))
	}
	packet, err = packetResponse.ReadPacket()
	l.Debug.Printf("%d: got response %p", messageID, packet)
	if err != nil {
		return err
	}

	if l.Debug {
		if err := addLDAPDescriptions(packet); err != nil {
			return err
		}
		ber.PrintPacket(packet)
	}

	resultCode, resultDescription := getLDAPResultCode(packet)
	if resultCode != 0 {
		return NewError(resultCode, errors.New(resultDescription))
	}

	return nil
}


text:
<content>
	<dom>
		<login-title>Access</login-title>
		<username>Username</username>
		<password>Password</password>
		<button-login>Log in</button-login>
		<error-login>Access not allowed</error-login>
		<error-description>Verify your user and/or password to be correct</error-description>
	</dom>
</content>


text:
set -o pipefail
set -o nounset
set -o errexit

: "${KUBECONFIG:?}"
: "${TEST_NAMESPACE:?}"
: "${TEST_ARTIFACTS_DIR:?}"
: "${KUBECTL:=kubectl}"

echo "Using the ${KUBECTL} kubectl binary"
echo "Using the ${TEST_ARTIFACTS_DIR} output directory"
mkdir -p "${TEST_ARTIFACTS_DIR}"

commands=()
commands+=("get catalogsources -o yaml")
commands+=("get subscriptions -o yaml")
commands+=("get operatorgroups -o yaml")
commands+=("get clusterserviceversions -o yaml")
commands+=("get installplans -o yaml")
commands+=("get pods -o wide")
commands+=("get events --sort-by .lastTimestamp")

echo "Storing the test artifact output in the ${TEST_ARTIFACTS_DIR} directory"
for command in "${commands[@]}"; do
    echo "Collecting ${command} output..."
    COMMAND_OUTPUT_FILE=${TEST_ARTIFACTS_DIR}/${command// /_}
    ${KUBECTL} -n ${TEST_NAMESPACE} ${command} >> "${COMMAND_OUTPUT_FILE}"
done


text:
require "remote-xml-reader/version"
require 'open-uri'
require 'nokogiri'

module Remote
  module Xml
    class Reader
      def self.open(remote_url)
        raise ArgumentError, "A URI is required" unless remote_url
        begin
          Kernel.open(remote_url)
        rescue Errno::ENOENT
          raise ArgumentError, "This URI is invalid"
        end
      end

      def initialize(remote_url)
        @remote_xml = Remote::Xml::Reader.open(remote_url).read
      end

      def read
        @remote_xml
      end

      def child_nodes_to_hash(node_name)
        out = []
        children_of_named_node(node_name).each do |named_node|
          attribute_hash = children_to_hash(named_node)
          out << attribute_hash unless attribute_hash.empty?
        end
        out
      end

      def children_of_named_node(node_name)
        Nokogiri::XML(read).xpath("//#{node_name}/*").to_a
      end

      private
      def children_to_hash(node)
        attributes = {}
        node.element_children.each do |element|
          if element.element_children.empty? then
            attributes[element.node_name.to_sym] = element.text
          end
        end
        attributes
      end

    end
  end
end


text:
namespace glbinding
{

using ProcAddress = void(*)();

GLBINDING_API ProcAddress getProcAddress(const char * name);

} // namespace glbinding


text:
package com.googlecode.kanbanik.client.messaging.messages.modules;

import com.googlecode.kanbanik.client.messaging.BaseMessage;

public class ModuleDeactivatedMessage extends BaseMessage<Class<?>> {

	public ModuleDeactivatedMessage(Class<?> payload, Object source) {
		super(payload, source);
	}

}


text:
package com.mpdeimos.foodscraper;

import com.mpdeimos.foodscraper.data.IBistro;
import com.mpdeimos.foodscraper.data.IDish;
import com.mpdeimos.foodscraper.data.IMenu;
import com.mpdeimos.webscraper.Scraper;
import com.mpdeimos.webscraper.Scraper.ScraperBuilder;
import com.mpdeimos.webscraper.ScraperException;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;

/**
 * Retrieves menus from all configured bistros.
 *
 * @author mpdeimos
 */
public class Retriever
{
	/** List of available bistros. */
	private final Iterable<IBistro> bistros = BistroRegistry.createBistros();

	/** Indicates whether the bistro websites have been scraped. */
	private boolean retrieved = false;

	/**
	 * @return A list of bistros including their daily menus.
	 */
	public Iterable<IBistro> getBistros()
	{
		return this.bistros;
	}

	/**
	 * @return A list of bistros including todays menus.
	 */
	public Iterable<Entry<IBistro, IMenu>> getTodaysMenu()
	{
		Map<IBistro, IMenu> today = new LinkedHashMap<>();

		for (IBistro bistro : this.getBistros())
		{
			for (IMenu menu : bistro.getMenu())
			{
				if (isToday(menu.getDate()))
				{
					today.put(bistro, menu);
				}
			}
			if (!today.containsKey(bistro))
			{
				today.put(bistro, new IMenu()
				{

					@Override
					public Iterable<IDish> getDishes()
					{
						return new ArrayList<IDish>(0);
					}

					@Override
					public Date getDate()
					{
						return new Date(); // today
					}
				});
			}
		}

		return today.entrySet();
	}

	/**
	 * Retrieves the daily meals from the bistro websites. If an exception
	 * occurs, there might still some valid data be retrieved.
	 */
	public void retrieve() throws ScraperException
	{
		if (this.retrieved)
		{
			return;
		}

		ScraperBuilder builder = Scraper.builder();
		for (IBistro bistro : this.bistros)
		{
			builder.add(bistro);
		}
		builder.build().scrape();

		this.retrieved = true;
	}

	/**
	 * @return true if the passed date is today.
	 */
	private static boolean isToday(Date date)
	{
		if (date == null)
		{
			return false;
		}

		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		Calendar now = Calendar.getInstance();
		return cal.get(Calendar.YEAR) == now.get(Calendar.YEAR)
				&& cal.get(Calendar.DAY_OF_YEAR) == now.get(
						Calendar.DAY_OF_YEAR);
	}

	/**
	 * Main program entry point.
	 */
	public static void main(String[] args)
	{
		Retriever retriever = new Retriever();
		try
		{
			retriever.retrieve();
		}
		catch (ScraperException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Iterable<Entry<IBistro, IMenu>> todaysMenu = retriever.getTodaysMenu();
		System.out.println(todaysMenu);
	}
}


text:
package net.iryndin.lunchapp.model;

import java.util.List;

public class RestaurantVotesDTO {
    private RestaurantDTO restaurant;
    private List<String> usernames;

    public RestaurantDTO getRestaurant() {
        return restaurant;
    }

    public void setRestaurant(RestaurantDTO restaurant) {
        this.restaurant = restaurant;
    }

    public List<String> getUsernames() {
        return usernames;
    }

    public void setUsernames(List<String> usernames) {
        this.usernames = usernames;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Petri Net Plans: learnpnp::TDLambda Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

Petri Net Plans

Main Page

Related Pages

Namespaces

Classes

Files

Class List

Class Hierarchy

Class Members

learnpnp

TDLambda

Public Types |
Public Member Functions

learnpnp::TDLambda Class Reference

An on-policy learning algorithm based on TD(lambda)
 More...

#include <TDLambda.h>

Inheritance diagram for learnpnp::TDLambda:

  <map id="learnpnp::TDLambda_map" name="learnpnp::TDLambda_map">
<area href="classlearnpnp_1_1_learner.html" title="A generic algorithm based on a value function." alt="learnpnp::Learner" shape="rect" coords="0,0,128,24"/>
</map>

List of all members.

Public Types

typedef TDLParams 	ParamType

Public Member Functions

 	TDLambda (const std::string &filePath, const TDLParams &parameters)

 	ctor.

 	TDLambda (const std::string &filePath, const TDLParams &parameters, AlphaScheduler *sched)

virtual void 	updateV (const Marking &current, double reward, const Marking &next)

 	Performs the actual update to the value function according to a transition between two states.

virtual void 	tick ()

 	Notifies the learner that one time step has passed although the marking has not changed.

virtual void 	finalizeV ()

 	Performs final computations before saving the value function.

virtual 	~TDLambda ()

Detailed Description

An on-policy learning algorithm based on TD(lambda)

Author:

Matteo Leonetti

Member Typedef Documentation

          typedef TDLParams learnpnp::TDLambda::ParamType

Constructor & Destructor Documentation

          learnpnp::TDLambda::TDLambda
          (
          const std::string &
          filePath,

          const TDLParams &
          parameters

          )

ctor.

Parameters:

filePath	is the file to store and retrieve the value function

parameters	is the collection of the parameters for the algorithm

          learnpnp::TDLambda::TDLambda
          (
          const std::string &
          filePath,

          const TDLParams &
          parameters,

          AlphaScheduler *
          sched

          )

          virtual learnpnp::TDLambda::~TDLambda
          (
          	)
           [virtual]

Member Function Documentation

          virtual void learnpnp::TDLambda::finalizeV
          (
          	)
           [virtual]

Performs final computations before saving the value function.

Implements learnpnp::Learner.

          virtual void learnpnp::TDLambda::tick
          (
          	)
           [virtual]

Notifies the learner that one time step has passed although the marking has not changed.

Implements learnpnp::Learner.

          virtual void learnpnp::TDLambda::updateV
          (
          const Marking &
          current,

          double
          reward,

          const Marking &
          next

          )
          	 [virtual]

Performs the actual update to the value function according to a transition between two states.

It is called by update() after i has made sure that the marking used (current and next) have an initialised value.

Parameters:

current	the state before the transition occurred

reward	the reward accumulated since the last transition happened

next	the state after the transition occurred

Implements learnpnp::Learner.

The documentation for this class was generated from the following file:

include/pnp/learning_plan/algo/TDLambda.h

<address class="footer">
Generated on Thu Oct 9 2014 02:16:35 for Petri Net Plans by

 1.7.6.1
</address>


text:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <winpr/crt.h>
#include <winpr/stream.h>

#include "rdpgfx_common.h"

#include "rdpgfx_codec.h"

int rdpgfx_decode_uncompressed(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd)
{
	return 1;
}

int rdpgfx_decode_remotefx(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd)
{
	return 1;
}

int rdpgfx_decode_clear(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd)
{
	return 1;
}

int rdpgfx_decode_planar(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd)
{
	return 1;
}

int rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s, RDPGFX_H264_METABLOCK* meta)
{
	UINT32 index;
	RDPGFX_RECT16* regionRect;
	RDPGFX_H264_QUANT_QUALITY* quantQualityVal;

	if (Stream_GetRemainingLength(s) < 4)
		return -1;

	Stream_Read_UINT32(s, meta->numRegionRects); /* numRegionRects (4 bytes) */

	if (Stream_GetRemainingLength(s) < (meta->numRegionRects * 8))
		return -1;

	meta->regionRects = (RDPGFX_RECT16*) malloc(meta->numRegionRects * sizeof(RDPGFX_RECT16));

	if (!meta->regionRects)
		return -1;

	meta->quantQualityVals = (RDPGFX_H264_QUANT_QUALITY*) malloc(meta->numRegionRects * sizeof(RDPGFX_H264_QUANT_QUALITY));

	if (!meta->quantQualityVals)
		return -1;

	printf("H264_METABLOCK: numRegionRects: %d\n", (int) meta->numRegionRects);

	for (index = 0; index < meta->numRegionRects; index++)
	{
		regionRect = &(meta->regionRects[index]);
		rdpgfx_read_rect16(s, regionRect);

		printf("regionRects[%d]: left: %d top: %d right: %d bottom: %d\n",
				index, regionRect->left, regionRect->top, regionRect->right, regionRect->bottom);
	}

	if (Stream_GetRemainingLength(s) < (meta->numRegionRects * 2))
		return -1;

	for (index = 0; index < meta->numRegionRects; index++)
	{
		quantQualityVal = &(meta->quantQualityVals[index]);
		Stream_Read_UINT8(s, quantQualityVal->qpVal); /* qpVal (1 byte) */
		Stream_Read_UINT8(s, quantQualityVal->qualityVal); /* qualityVal (1 byte) */

		quantQualityVal->qp = quantQualityVal->qpVal & 0x3F;
		quantQualityVal->r = (quantQualityVal->qpVal >> 6) & 1;
		quantQualityVal->p = (quantQualityVal->qpVal >> 7) & 1;

		printf("quantQualityVals[%d]: qp: %d r: %d p: %d qualityVal: %d\n",
				index, quantQualityVal->qp, quantQualityVal->r, quantQualityVal->p, quantQualityVal->qualityVal);
	}

	return 1;
}

int rdpgfx_decode_h264(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd)
{
	int status;
	wStream* s;
	RDPGFX_H264_BITMAP_STREAM h264;
	RdpgfxClientContext* context = (RdpgfxClientContext*) gfx->iface.pInterface;

	s = Stream_New(cmd->data, cmd->length);

	if (!s)
		return -1;

	status = rdpgfx_read_h264_metablock(gfx, s, &(h264.meta));

	if (status < 0)
		return -1;

	h264.data = Stream_Pointer(s);
	h264.length = (UINT32) Stream_GetRemainingLength(s);

	Stream_Free(s, FALSE);

	cmd->extra = (void*) &h264;

	if (context && context->SurfaceCommand)
	{
		context->SurfaceCommand(context, cmd);
	}

	free(h264.meta.regionRects);
	free(h264.meta.quantQualityVals);

	return 1;
}

int rdpgfx_decode_alpha(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd)
{
	return 1;
}

int rdpgfx_decode_progressive(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd)
{
	return 1;
}

int rdpgfx_decode(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd)
{
	int status;

	switch (cmd->codecId)
	{
		case RDPGFX_CODECID_UNCOMPRESSED:
			status = rdpgfx_decode_uncompressed(gfx, cmd);
			break;

		case RDPGFX_CODECID_CAVIDEO:
			status = rdpgfx_decode_remotefx(gfx, cmd);
			break;

		case RDPGFX_CODECID_CLEARCODEC:
			status = rdpgfx_decode_clear(gfx, cmd);
			break;

		case RDPGFX_CODECID_PLANAR:
			status = rdpgfx_decode_planar(gfx, cmd);
			break;

		case RDPGFX_CODECID_H264:
			status = rdpgfx_decode_h264(gfx, cmd);
			break;

		case RDPGFX_CODECID_ALPHA:
			status = rdpgfx_decode_alpha(gfx, cmd);
			break;

		case RDPGFX_CODECID_CAPROGRESSIVE:
			status = rdpgfx_decode_progressive(gfx, cmd);
			break;

		case RDPGFX_CODECID_CAPROGRESSIVE_V2:
			break;
	}

	return 1;
}