text:
using System.Collections.Generic;
using System.Security.Principal;
using System.Web;
using Moq;
using Moq.Language.Flow;

namespace CIAUTH.Tests
{
    public static class Mocking
    {
        public static void ReturnsInOrder<T, TResult>(this ISetup<T, TResult> setup,
                                                      params TResult[] results) where T : class
        {
            setup.Returns(new Queue<TResult>(results).Dequeue);
        }

        public static HttpContextBase FakeHttpContext()
        {
            var context = new Mock<HttpContextBase>();
            var request = new Mock<HttpRequestBase>();
            var response = new Mock<HttpResponseBase>();
            response.SetupAllProperties();
            var session = new Mock<HttpSessionStateBase>();
            var server = new Mock<HttpServerUtilityBase>();
            var user = new Mock<IPrincipal>();
            var identity = new Mock<IIdentity>();

            request.Setup(req => req.ApplicationPath).Returns("~/");
            request.Setup(req => req.AppRelativeCurrentExecutionFilePath).Returns("~/");
            request.Setup(req => req.PathInfo).Returns(string.Empty);
            response.Setup(res => res.ApplyAppPathModifier(It.IsAny<string>()))
                .Returns((string virtualPath) => virtualPath);
            user.Setup(usr => usr.Identity).Returns(identity.Object);
            identity.SetupGet(ident => ident.IsAuthenticated).Returns(true);

            context.Setup(ctx => ctx.Request).Returns(request.Object);
            context.Setup(ctx => ctx.Response).Returns(response.Object);
            context.Setup(ctx => ctx.Session).Returns(session.Object);
            context.Setup(ctx => ctx.Server).Returns(server.Object);
            context.Setup(ctx => ctx.User).Returns(user.Object);

            return context.Object;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import * as _ from 'lodash';
import {createAction} from 'redux-actions';
import {CONFIG} from '../../../config/index';
import {fireAjax} from '../../../services/index';
import * as constants from '../../../redux/constants';
import {show_loading, hide_loading} from '../../../redux/generic/actions/frontend';
import 'whatwg-fetch';

// --------add new valiable-------

export function success_add_variable (data) {
  return createAction(constants.ACTION_SUCCESS_ADD_VARIABLE)(data);
}
export function error_add_varaible (data) {
  return createAction(constants.ACTION_ERROR_ADD_VARIABLE)(data);
}

function async_saveVariable (id, variable) {
  return fireAjax('POST', '', {
    action:        'create_template_variable',
    name:          variable.varCode,
    value:         variable.varValue,
    variable_type: variable.varType
  });
}

function async_editVariable (id, variable) {
  return fireAjax('POST', '', {
    action:        'update_template_variable',
    id:            id,
    name:          variable.varCode,
    value:         variable.varValue,
    variable_type: variable.varType
  });
}

export function saveVariable (id, variable) {
  return (dispatch, getState) => {
    return new Promise((resolve, reject) => {
      dispatch(show_loading());
      if (id == '') {
        async_saveVariable(id, variable).then((json) => {
          dispatch(hide_loading()); // hide loading icon
          if (json.error == 0) {
            dispatch(success_add_variable(json.data));
            dispatch(get_variable());
            resolve(json.data);
          } else {
            dispatch(error_add_varaible(json.error[0]));
          }
        },
        (error) => {
          dispatch(hide_loading()); // hide loading icon
          dispatch(error_add_varaible('error occurs'));
        }
);
      } else {
        async_editVariable(id, variable).then((json) => {
          dispatch(hide_loading()); // hide loading icon
          if (json.error == 0) {
            dispatch(success_add_variable(json.data));
            dispatch(get_variable());
            resolve(json.data);
          } else {
            dispatch(error_add_varaible(json.error[0]));
          }
        },
          (error) => {
            dispatch(hide_loading()); // hide loading icon
            dispatch(error_add_varaible('error occurs'));
          }
        );
      }
    });
  };
}

// ------------Get valiables---------

function async_get_variable () {
  return fireAjax('POST', '', {
    action: 'get_template_variable'
  });
}

export function success_variable_get (data) {
  return createAction(constants.ACTION_SUCCESS_VARIABLE_GET)(data);
}

export function get_variable () {
  return function (dispatch, getState) {
    return new Promise((resolve, reject) => {
      dispatch(show_loading()); // show loading icon
      async_get_variable().then((json) => {
        dispatch(hide_loading());
        if (typeof json !== 'undefined' && json.length > 0) {
          let data = json;
          dispatch(success_variable_get(data));
          resolve(data);
        } else {
          dispatch(success_variable_get([]));
        }
      }, (error) => {
        dispatch(hide_loading());// hide loading icon
        dispatch(success_variable_get([]));
      }
			);
    });
  };
}

// ----------delete Variables---------------

function async_delete_variable (id) {
  return fireAjax('POST', '', {
    action: 'delete_template_variable',
    id:     id
  });
}

export function deleteVariable (id) {
  return function (dispatch, getState) {
    return new Promise((resolve, reject) => {
      dispatch(show_loading()); // show loading icon
      async_delete_variable(id).then((json) => {
        dispatch(hide_loading()); // hide loading icon
        if (json.error == 0) {
          dispatch(get_variable());
          resolve(json.data.message);
        } else {
          dispatch(get_variable());
          resolve(json.data.message);
        }
      }, (error) => {
        dispatch(hide_loading());// hide loading icon
        reject('error occurs!!');
      }
			);
    });
  };
}

// ----------------get templates -------------

export function success_get_template (data) {
  return createAction(constants.ACTION_SUCCESS_GET_TEMPLATES)(data);
}

function async_get_templates () {
  return fireAjax('POST', '', {
    action: 'get_email_template'
  });
}
export function get_templates () {
  return function (dispatch, getState) {
    return new Promise((resolve, reject) => {
      dispatch(show_loading());
      async_get_templates().then((json) => {
        dispatch(hide_loading());
        if (typeof json !== 'undefined' && json.length > 0) {
          let data = json;
          dispatch(success_get_template(data));
          resolve(data);
        } else {
          dispatch(success_get_template([]));
        }
      }, (error) => {
        dispatch(hide_loading()); // hide loading icon
        reject('error occurs!!');
      }
			);
    });
  };
}

// -------------------save template ------------

function async_save_template (t_name, t_subject, t_body) {
  return fireAjax('POST', '', {
    action:  'create_email_template',
    name:    t_name,
    subject: t_subject,
    body:    t_body
  });
}
function async_update_template (t_id, t_name, t_subject, t_body) {
  return fireAjax('POST', '', {
    action:  'update_email_template',
    id:      t_id,
    name:    t_name,
    subject: t_subject,
    body:    t_body
  });
}
export function save_templates (t_id, t_name, t_subject, t_body) {
  return function (dispatch, getState) {
    return new Promise((resolve, reject) => {
      dispatch(show_loading());
      if (_.isEmpty(t_id)) {
        async_save_template(t_name, t_subject, t_body).then((json) => {
          dispatch(hide_loading());
          dispatch(get_templates());
          resolve(json.data.message);
        },
					(error) => {
  dispatch(hide_loading()); // hide loading icon
  reject('error occurs!!');
});
      } else {
        async_update_template(t_id, t_name, t_subject, t_body).then((json) => {
          dispatch(hide_loading());
          dispatch(get_templates());
          resolve(json.data.message);
        }, (error) => {
          dispatch(hide_loading()); // hide loading icon
          reject('error occurs!!');
        }
				);
      }
    });
  };
}

// --------------Delete template-------------

function async_delete_template (t_id) {
  return fireAjax('POST', '', {
    action: 'delete_email_template',
    id:     t_id
  });
}

export function delete_template (t_id) {
  return function (dispatch, getState) {
    return new Promise((resolve, reject) => {
      dispatch(show_loading());
      async_delete_template(t_id).then((json) => {
        dispatch(hide_loading());
        if (json.error) {
          reject(json.data.message);
        } else {
          dispatch(get_templates());
          resolve();
        }
      }, (error) => {
        dispatch(hide_loading());
        reject('error occurs!!');
      }
			);
    });
  };
}

// ------------send_mail functionality------------

function async_send_mail (email) {
  return fireAjax('POST', '', {
    action: 'send_employee_email',
    email:  email
  });
}

export function send_mail (email) {
  return function (dispatch, getState) {
    return new Promise((resolve, reject) => {
      dispatch(show_loading());
      async_send_mail(email).then((json) => {
        dispatch(hide_loading());
        if (json.error) {
          reject(json.data.message);
        } else {
          dispatch(get_templates());
          resolve(json.data.message);
        }
      }, (error) => {
        dispatch(hide_loading());
        reject('error occurs!!');
      }
			);
    });
  };
}

// -------------------Download PDF ------------

function async_download_template (template, fileName) {
  return fireAjax('POST', '', {
    action:    'create_pdf',
    template:  template,
    file_name: fileName
  });
}
export function download_pdf (template, fileName) {
  return function (dispatch, getState) {
    return new Promise((resolve, reject) => {
      dispatch(show_loading());
      async_download_template(template, fileName).then((json) => {
        dispatch(hide_loading());
        resolve(json.data);
      }, (error) => {
        dispatch(hide_loading());
        reject('error occurs!!');
      }
				);
    });
  };
}

/* export function fetchVariable(){
	return (dispatch,getState)=>{
		return new Promise((resolve,reject)=>{
			Meteor.call('fetchAllVariable',(err,data)=>{
				if(err){
					reject(err)
				}else{
					if(data.length > 0){
						dispatch(success_fetch_variable(data))
						resolve('variable loading completed')
					}else{
						dispatch(success_fetch_variable(data))
						resolve('No variable in database')
					}
				}
			})
		})
	}
}

export function deleteVariable( id ){
	return (dispatch,getState) => {
		return new Promise( (resolve,reject) => {
			Meteor.call('deleteVariable', id , (err, data) => {
				if(err){
					reject(err)
				}else{
					dispatch ( fetchVariable(data) )
					resolve(data)
				}
			})
		})
	}
}

export function success_fetch_variable( data ){
	return createAction( ACTION_SUCCESS_FETCH_VARIABLE )( data )
}*/


text:
#include "UIObject.h"
#include "PC.h"

class CCastUI final : public CUIObject
{
public:
	CCastUI( CPC & player ) : m_Player(player) {}
	~CCastUI(void);

	void LoadSprites();

	// --------------------------------
	//	IRenderObject
	// --------------------------------
	void Update( float deltaTime );
	void Render();

private:
	CPC & m_Player;
	//std::vector<CSprite *> m_Sprites;
	std::map<std::string, CSprite *> m_Sprites;
};


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace DropnWatch
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "credentials",
                url: "{controller}/credentials",
                defaults: new { controller = "Home", action = "Credentials" }
            );

            routes.MapRoute(
               name: "models",
               url: "{controller}/models",
               defaults: new { controller = "Home", action = "Models" }
           );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}


text:
<?php
/**
 * ItemRestrictionItem
 *
 * PHP version 5
 *
 * @category Class
 * @package  ultracart\v2
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * UltraCart Rest API V2
 *
 * UltraCart REST API Version 2
 *
 * OpenAPI spec version: 2.0.0
 * Contact: support@ultracart.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 2.4.15-SNAPSHOT
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

namespace ultracart\v2\models;

use \ArrayAccess;
use \ultracart\v2\ObjectSerializer;

/**
 * ItemRestrictionItem Class Doc Comment
 *
 * @category Class
 * @package  ultracart\v2
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class ItemRestrictionItem implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $swaggerModelName = 'ItemRestrictionItem';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'restrict_merchant_item_id' => 'string',
        'restrict_merchant_item_oid' => 'int',
        'type' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'restrict_merchant_item_id' => null,
        'restrict_merchant_item_oid' => 'int32',
        'type' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerTypes()
    {
        return self::$swaggerTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerFormats()
    {
        return self::$swaggerFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'restrict_merchant_item_id' => 'restrict_merchant_item_id',
        'restrict_merchant_item_oid' => 'restrict_merchant_item_oid',
        'type' => 'type'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'restrict_merchant_item_id' => 'setRestrictMerchantItemId',
        'restrict_merchant_item_oid' => 'setRestrictMerchantItemOid',
        'type' => 'setType'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'restrict_merchant_item_id' => 'getRestrictMerchantItemId',
        'restrict_merchant_item_oid' => 'getRestrictMerchantItemOid',
        'type' => 'getType'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$swaggerModelName;
    }

    const TYPE_CAN_NOT_BE_PURCHASED_WITH = 'can not be purchased with';
    const TYPE_CAN_ONLY_BE_PURCHASED_WITH = 'can only be purchased with';
    const TYPE_MUST_BE_PURCHASED_WITH = 'must be purchased with';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getTypeAllowableValues()
    {
        return [
            self::TYPE_CAN_NOT_BE_PURCHASED_WITH,
            self::TYPE_CAN_ONLY_BE_PURCHASED_WITH,
            self::TYPE_MUST_BE_PURCHASED_WITH,
        ];
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['restrict_merchant_item_id'] = isset($data['restrict_merchant_item_id']) ? $data['restrict_merchant_item_id'] : null;
        $this->container['restrict_merchant_item_oid'] = isset($data['restrict_merchant_item_oid']) ? $data['restrict_merchant_item_oid'] : null;
        $this->container['type'] = isset($data['type']) ? $data['type'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getTypeAllowableValues();
        if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }

    /**
     * Gets restrict_merchant_item_id
     *
     * @return string
     */
    public function getRestrictMerchantItemId()
    {
        return $this->container['restrict_merchant_item_id'];
    }

    /**
     * Sets restrict_merchant_item_id
     *
     * @param string $restrict_merchant_item_id Restrict item id
     *
     * @return $this
     */
    public function setRestrictMerchantItemId($restrict_merchant_item_id)
    {
        $this->container['restrict_merchant_item_id'] = $restrict_merchant_item_id;

        return $this;
    }

    /**
     * Gets restrict_merchant_item_oid
     *
     * @return int
     */
    public function getRestrictMerchantItemOid()
    {
        return $this->container['restrict_merchant_item_oid'];
    }

    /**
     * Sets restrict_merchant_item_oid
     *
     * @param int $restrict_merchant_item_oid Restrict item object identifier
     *
     * @return $this
     */
    public function setRestrictMerchantItemOid($restrict_merchant_item_oid)
    {
        $this->container['restrict_merchant_item_oid'] = $restrict_merchant_item_oid;

        return $this;
    }

    /**
     * Gets type
     *
     * @return string
     */
    public function getType()
    {
        return $this->container['type'];
    }

    /**
     * Sets type
     *
     * @param string $type Restriction type
     *
     * @return $this
     */
    public function setType($type)
    {
        $allowedValues = $this->getTypeAllowableValues();
        if (!is_null($type) && !in_array($type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['type'] = $type;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}


text:
////////////////////////////////////////////////////////////////////////////////
// internal header
////////////////////////////////////////////////////////////////////////////////

//------------------------------------------------------------------------------
//OS

#if defined(GKC_OS_WINDOWS)
	#include "Windows/console_api.h"
#elif defined(GKC_OS_LINUX)
	#include "Linux/console_api.h"
#else
	#error Error OS type!
#endif

//------------------------------------------------------------------------------
//stdout tools

// stdout_attr_helper

class stdout_attr_helper
{
public:
	BEGIN_NOINLINE
	static stdout_attr& get_attr() throw()
	END_NOINLINE
	{
		static stdout_attr l_stdout_attr;
		return l_stdout_attr;
	}
};

// stdout_attr_restore

class stdout_attr_restore
{
public:
	stdout_attr_restore(stdout_attr& attr) throw() : m_attr(attr)
	{
	}
	~stdout_attr_restore() throw()
	{
		m_attr.Restore();
	}

private:
	stdout_attr&  m_attr;
};

//------------------------------------------------------------------------------

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


text:
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]

## [1.0.7] - 2016-10-17

### Fixed
* ensure that contains()/within() can compare the geometry of GeoJSON feature objects. [#281](https://github.com/Esri/Terraformer/issues/281)

### Removed
* the minified library and archived versions have been removed from source control

## [1.0.6] - 2016-08-17

### Added
* typings for TypeScript folks (thx [@JeffJacobson](https://github.com/JeffJacobson)) [#20](https://github.com/Esri/terraformer-wkt-parser/pull/20)
* lots of little website improvements

## [1.0.5] - 2015-03-14

### Changed

* Use Jarvis March for convex hulls

## [1.0.4] - 2014-08-06

### Fixed

* Internal improvements to `addVertex()` and `arrayIntersectsArrays`

### Added

* new `isConvex()` method

## [1.0.3] - 2014-02-24

### Fixed

* MultiPolygons can now be closed with the `multipolygon.close()` method.
* Circles are now closed properly [#234](https://github.com/Esri/Terraformer/pull/234)

## [1.0.2] - 2013-12-16

This release fixes several issues related to convexHull and ensures the Polygons are closed under a variety of situations.

### Breaking Changes

primitive.convexHull() now always returns null or a valid Terraformer.Polygon. It will not return arrays or throw errors.

### Fixed

* `Terraformer.Circle` is now closed.
* `Polygon`s returned by `primitive.convexHull()` are now closed.

### Added

* `primitive.convexHull()`` will now handle features.

## [1.0.1] - 2013-11-12

Initial Release

[unreleased]: https://github.com/Esri/Terraformer/compare/v1.0.7...HEAD
[1.0.7]: https://github.com/Esri/Terraformer/compare/v1.0.6...v1.0.7
[1.0.6]: https://github.com/Esri/Terraformer/compare/v1.0.5...v1.0.6
[1.0.5]: https://github.com/Esri/Terraformer/compare/v1.0.4...v1.0.5
[1.0.4]: https://github.com/Esri/Terraformer/compare/v1.0.3...v1.0.4
[1.0.3]: https://github.com/Esri/Terraformer/compare/v1.0.2...v1.0.3
[1.0.2]: https://github.com/Esri/Terraformer/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/Esri/Terraformer/releases/tag/v1.0.1


text:
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'weather_reporter'
require 'helpers/weather_symbol'
require 'webmock/rspec'
require 'pry'

WebMock.disable_net_connect!(allow_localhost: true)

RSpec.configure do |config|
  # json = JSON.parse(File.read("spec/fixtures/weather.json"))
  config.before(:each) do
    stub_request(:get, "http://api.apixu.com/v1/current.json?key=5f7c4e53a0d645d382a14830173004&q=kathmandu").
    with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
    to_return(status: 200, body: '{"location": {"name": "Kathmandu"} }', headers: {})
  end
end


text:
<?php
class InitialMigration extends CakeMigration {

/**
 * Migration description
 *
 * @var string
 * @access public
 */
	public $description = '';

/**
 * Actions to be performed
 *
 * @var array $migration
 * @access public
 */
	public $migration = array(
		'up' => array(
			'create_table' => array(
				'developers' => array(
					'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
					'github_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10, 'key' => 'unique'),
					'full_name' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 50, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'email' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 70, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'gravatar_id' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 100, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'access_token' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 100, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
					'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
					'has_commit_access' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
					'indexes' => array(
						'PRIMARY' => array('column' => 'id', 'unique' => 1),
						'github_id' => array('column' => 'github_id', 'unique' => 1),
					),
					'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
				),
				'reports' => array(
					'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
					'error_message' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 150, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'error_name' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 50, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'pma_version' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 50, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'php_version' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 15, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'browser' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 40, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'user_os' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'server_software' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 100, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'status' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'steps' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'stacktrace' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'full_report' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
					'related_report_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
					'sourceforge_bug_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
					'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
					'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
					'indexes' => array(
						'PRIMARY' => array('column' => 'id', 'unique' => 1),
					),
					'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
				),
			),
		),
		'down' => array(
			'drop_table' => array(
				'developers', 'reports'
			),
		),
	);

/**
 * Before migration callback
 *
 * @param string $direction, up or down direction of migration process
 * @return boolean Should process continue
 * @access public
 */
	public function before($direction) {
		return true;
	}

/**
 * After migration callback
 *
 * @param string $direction, up or down direction of migration process
 * @return boolean Should process continue
 * @access public
 */
	public function after($direction) {
		return true;
	}
}


text:
Drop-in GW2 tooltips for your site. Feedback and pull-requests welcome.

## Getting Started

### Enjin Guild site

To use GW2 Wikitips on your Enjin site, go to Admin > Settings > Code Injection. Paste the following HTML into the *Footer* box. *Injecting it in the Footer box ensures that jQuery (provided by Enjin) is loaded before GW2 Wikitips.*

```HTML
<link rel="stylesheet" href="//cdn.jsdelivr.net/qtip2/2.2.1/jquery.qtip.min.css">
<script src="//cdn.jsdelivr.net/qtip2/2.2.1/jquery.qtip.min.js"></script>
<script data-wikitip-style="qtip-bootstrap" src="http://f1337.github.io/gw2-wikitips/gw2-wikitips.js"></script>
```

Save the changes, and now links to the GW2 wiki should present tooltips on hover:

```
[url=http://wiki.guildwars2.com/wiki/Absolute_Resolution]Absolute Resolution[/url]
```

### Static HTML Page

Download the [latest gw2-wikitips](https://raw.githubusercontent.com/f1337/gw2-wikitips/master/gw2-wikitips.js), and put it with your other JavaScript files.

```HTML
<html>
	<head>
	<!-- first jQuery -->
	<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
	<!-- then qTip2 (optional, but recommended) -->
	<link rel="stylesheet" href="//cdn.jsdelivr.net/qtip2/2.2.1/jquery.qtip.min.css">
	<script src="//cdn.jsdelivr.net/qtip2/2.2.1/jquery.qtip.min.js"></script>
	<!-- finally, gw2-wikitips -->
	<script data-wikitip-style="qtip-bootstrap" src="/path/to/gw2-wikitips.js"></script>
</head>
```

Then add some links to the GW2 wiki:

```HTML
<a href="https://wiki.guildwars2.com/wiki/Strength_in_Numbers">Strength in Numbers</a>
<a href="https://wiki.guildwars2.com/wiki/Virtue_of_Justice">Virtue of Justice</a>
<a href="https://wiki.guildwars2.com/wiki/Empower">Empower</a>
<a href="https://wiki.guildwars2.com/wiki/Superior_Rune_of_the_Trooper">Superior Rune of the Trooper</a>
```

## Style

The `data-wikitip-style` attribute accepts any [qTip2 styles](http://qtip2.com/options#style), space-separated:

```HTML
<script data-wikitip-style="qtip-blue qtip-shadow qtip-rounded" src="gw2-wikitips.js"></script>
```

## Development

In order to hack/fiddle/contribute, you'll probably want to use `requirejs` for instant gratification/feedback:

### Installing requirejs

```shell
npm install
```

### Using requirejs

```HTML
<script data-main="app" src="requirejs.js"></script>
```

### Building

If you didn't already `npm install`, go ahead and do so, then create the static single-file build like so:

```shell
node ./node_modules/requirejs/bin/r.js -o build.js
```


text:
package.path = './spec/?.lua;../src/?.lua;'..package.path

describe("Statsd interface", function()
  it("", function()
    assert.are.equal(true, true)
  end)
end)


text:
#include <aws/cloudfront/model/CreateStreamingDistributionWithTags2017_03_25Request.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>

#include <utility>

using namespace Aws::CloudFront::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;

CreateStreamingDistributionWithTags2017_03_25Request::CreateStreamingDistributionWithTags2017_03_25Request() :
    m_streamingDistributionConfigWithTagsHasBeenSet(false)
{
}

Aws::String CreateStreamingDistributionWithTags2017_03_25Request::SerializePayload() const
{
  XmlDocument payloadDoc = XmlDocument::CreateWithRootNode("StreamingDistributionConfigWithTags");

  XmlNode parentNode = payloadDoc.GetRootElement();
  parentNode.SetAttributeValue("xmlns", "http://cloudfront.amazonaws.com/doc/2017-03-25/");

  m_streamingDistributionConfigWithTags.AddToNode(parentNode);
  if(parentNode.HasChildren())
  {
    return payloadDoc.ConvertToString();
  }

  return "";
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Bungeecord Minigame — BlockBall 6.31.0 documentation</title>

    <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />

    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />

        <link rel="index" title="Index"
              href="../genindex.html"/>
        <link rel="search" title="Search" href="../search.html"/>
    <link rel="top" title="BlockBall 6.31.0 documentation" href="../index.html"/>
        <link rel="up" title="Game Modes" href="index.html"/>
        <link rel="next" title="Customizing" href="../customizing/index.html"/>
        <link rel="prev" title="MiniGame" href="minigame.html"/>

             BlockBall

                6.31.0

  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

Getting Started

Game Modes

Base Game

HubGame

MiniGame

Bungeecord Minigame

Configuring on your GameServer

Configuring on your Hubserver

Customizing

Commands

General

Developer API

FAQ

Contributing to BlockBall

          BlockBall

Docs »

Game Modes »

Bungeecord Minigame

               Edit on GitHub

Bungeecord Minigame¶

The Game Mode Bungeecord Minigame is a advanced game mode to give BlockBall the rights to manage it's on game server.

Warning

This guide will not explain how BungeeCord  works so do not continue if you are not familiar with it.

Make sure you created a Base Game first before you continue.

Please take a look at associated words which will be used in this guide:

Gameserver: Server where the BlockBall arena is located and BlockBall is managing it.

Hubserver: Any other server where players can join the Gameserver.

Configuring on your GameServer¶

Let's start by creating a server where BlockBall manages its state.

Join your game server with the plugin BlockBall installed.

Create a Base Game on this server.

Go to the Settings Page of your arena and select the GameType Bungee.

Open the Game Settings Page

Set the lobby spawnpoint and the leave spawnpoint.

Customize the other available options to your own needs.

Note

If you have got just one Hubserver you can simply enter the Hubserver name into the Fallback Server setting to let players get automatically connected back to the Hubserver if a match ends.

Note

If you have got multiple Hubserver you should edit the Leave Server Kick Message to create a custom kick message. Install a BungeeCord plugin which redirects players across your network when a player gets kicked from a server with a certain message.

After you have pressed Save and Reload the first time the game is automatically managing the server and starting a game.

You also need to configure a Restart Script to automatically restart the server after a game ends.

Note

You can optionally change the server motd by editing the generated bungeecord.yml file in the BlockBall folder.

Configuring on your Hubserver¶

BlockBall contains a system to offer signs which connects BlockBall Gameserver to Hubservers. This means you can
place signs on your HubServer which connect players to Gameservers.

Note

The following section is entirely optional. It is probably even better to install a minigame server management plugin to allow sign joining.

Setup your Hubserver server with the plugin BlockBall installed.

Copy the bungeecord.yml file from your Gameserver folder into the Hubserver folder.

Make sure the content of the bungeecord.yml on your Hubserver is exactly the same as the bungeecord.yml on your Gameserver.

Enable the server linking config option in your config.yml on your Hubserver

config.yml

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

# Game settings

# allow-server-linking: Enable this to allow linking via BungeeCord between other servers with BlockBall installed.

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

game:
  allow-server-linking: true

Join your Hubserver and type /blockballbungeecord <server> (<server> name of your Gameserver)

Rightclick on a sign and if everything is working correctly the sign will display something

You probably need to restart your Gameserver or change the server name if the sign displays No connection

Finally, you can join the game by clicking on the sign.

        Next

         Previous

        © Copyright 2015 - 2022, Shynixn.


text:
"""
Create training and validation sets

Usage:
    NOTE: Execute from ci-models directory
    python create_trainval_set.py \
        --out_path <ci_devkit directory (CIdevkit)> \
        --train 0.75 --val 0.25
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import argparse, os
from halo import Halo

def parse_args():
    """
    Parse command line arguments.

    Parameters:
        None
    Returns:
        parser arguments
    """
    parser = argparse.ArgumentParser(
        description='Create Train/Val Split')
    optional = parser._action_groups.pop()
    required = parser.add_argument_group('required_arguments')
    required.add_argument('--out_path',
        dest='out_path',
        help='CI Devkit directory (CIdevkit)')
    required.add_argument('--train',
        dest='train',
        help='Percentage for training set (i.e. 0.75, 0.80, etc.)',
        type=float,
        default=0.75)
    required.add_argument('--val',
        dest='val',
        help='Percentage for validation set (i.e. 0.25, 0.20, etc.)',
        type=float,
        default=0.25)
    parser._action_groups.append(optional)
    return parser.parse_args()

if __name__ == '__main__':
    args = parse_args() # Command line parameters

    if not (float(args.train) + float(args.val) == 1):
        print('Training and validation set percentages must equal 1 (i.e. 0.75/0.25)')
        exit(0)

    spinner = Halo(text='Converting', spinner='dots')
    spinner.start()

    if not os.path.exists('data'):
        os.makedirs('data')

    # Determine modulo for training and validation set
    train, val, idx = 20 * args.train, 20*args.val, 0
    f_train = open(os.path.join('data', 'train.txt'), 'w')
    f_val = open(os.path.join('data', 'val.txt'), 'w')

    # Iterate through all images and create training and validation sets (files)
    for img in sorted(os.listdir(os.path.join(args.out_path, 'CI2018', 'JPEGImages'))):
        img_name = img.split('.')[0]
        if idx % 20 < 15:
            f_train.write(img_name + '\n')
        else:
            f_val.write(img_name + '\n')
        idx += 1

    spinner.stop()

    # Close training and validation set files
    f_train.close()
    f_val.close()


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis
{
    /// <summary>
    /// Holds input nodes that are shared between generators and always exist
    /// </summary>
    internal static class SharedInputNodes
    {
        public static readonly InputNode<Compilation> Compilation = new InputNode<Compilation>(b => ImmutableArray.Create(b.Compilation));

        public static readonly InputNode<ParseOptions> ParseOptions = new InputNode<ParseOptions>(b => ImmutableArray.Create(b.DriverState.ParseOptions));

        public static readonly InputNode<AdditionalText> AdditionalTexts = new InputNode<AdditionalText>(b => b.DriverState.AdditionalTexts);

        public static readonly InputNode<SyntaxTree> SyntaxTrees = new InputNode<SyntaxTree>(b => b.Compilation.SyntaxTrees.ToImmutableArray());

        public static readonly InputNode<AnalyzerConfigOptionsProvider> AnalyzerConfigOptions = new InputNode<AnalyzerConfigOptionsProvider>(b => ImmutableArray.Create(b.DriverState.OptionsProvider));
    }
}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Dasyscypha abieticola Henn. & Shirai

### Remarks
null


text:
package uk.co.markormesher.android_utils;

import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Pair;

import java.util.ArrayList;

public class BroadcastUtils {

	/**
	 * Sends a local broadcast.
	 *
	 * @param intent the {@code Intent} to broadcast
	 */
	public static void send(Intent intent) {
		LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(Global.getContext());
		lbm.sendBroadcast(intent);
	}

	/**
	 * Sends a local broadcast.
	 *
	 * @param action the action for the intent
	 * @param params the parameters for the intent
	 */
	@SafeVarargs
	public static void send(String action, Pair<String, Object>... params) {
		send(IntentBuilder.build(action, params));
	}

	/**
	 * Registers a local broadcast receiver.
	 *
	 * @param receiver     the receiver to register
	 * @param intentFilter the {@code IntentFilter}
	 */
	public static void registerReceiver(BroadcastReceiver receiver, IntentFilter intentFilter) {
		LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(Global.getContext());
		lbm.registerReceiver(receiver, intentFilter);
	}

	/**
	 * Unregisters a local broadcast receiver.
	 *
	 * @param receiver the receiver to unregister
	 */
	public static void unregisterReceiver(BroadcastReceiver receiver) {
		LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(Global.getContext());
		lbm.unregisterReceiver(receiver);
	}

	/**
	 * Skeleton code for a simple Broadcast receiver manager.
	 */
	public abstract static class AbstractReceiverManager {

		// state
		private boolean registered = false;

		// receivers
		private ArrayList<Pair<IntentFilter, BroadcastReceiver>> receivers = new ArrayList<>();

		/**
		 * Adds a broadcast receiver to be managed by this class.
		 *
		 * @param intentFilter the {@code IntentFilter} to register this receiver with
		 * @param receiver     the {@code BroadcastReceiver} to register
		 */
		protected void addReceiver(IntentFilter intentFilter, BroadcastReceiver receiver) {
			receivers.add(new Pair<>(intentFilter, receiver));
		}

		/**
		 * Adds a broadcast receiver to be managed by this class.
		 *
		 * @param intentFilterString a {@code String} to create an {@code IntentFilter} from to register this receiver with
		 * @param receiver           the {@code BroadcastReceiver} to register
		 */
		protected void addReceiver(String intentFilterString, BroadcastReceiver receiver) {
			addReceiver(new IntentFilter(intentFilterString), receiver);
		}

		/**
		 * Registers all receivers, if they are not registered already.
		 */
		public final void registerAll() {
			if (registered) return;
			registered = true;

			for (Pair<IntentFilter, BroadcastReceiver> item : receivers) {
				registerReceiver(item.second, item.first);
			}
		}

		/**
		 * Unregisters all receivers, if they are already registered.
		 */
		public final void unregisterAll() {
			if (!registered) return;
			registered = false;

			for (Pair<IntentFilter, BroadcastReceiver> item : receivers) {
				unregisterReceiver(item.second);
			}
		}

		/**
		 * Checks whether the receivers are registered.
		 *
		 * @return whether the receivers are registered
		 */
		public boolean isRegistered() {
			return registered;
		}

		/**
		 * Gets the current list of receivers.
		 *
		 * @return the current list of receivers
		 */
		public ArrayList<Pair<IntentFilter, BroadcastReceiver>> getReceivers() {
			return receivers;
		}
	}

}


text:
const Plugin = require('../src/plugin');
const tap = require('tap');
const path = require('path');

let plugin = new Plugin({});

tap.test('getDataDependencies', function (test) {
  test.plan(5);

  test.test('should resolve with dependencies', function (test) {
    return plugin.getDataDependencies(path.resolve('test/get-data-dependencies/index.js')).then(
      function (results) {
        test.same(results.sort(), [
          path.resolve('test/get-data-dependencies/index.js'),
          path.resolve('test/get-data-dependencies/foo.js')
        ].sort());

        test.end();
      },
      function (err) {
        test.fail(err);

        test.end();
      }
    )
  });

  test.test('should resolve with dependencies on error', function (test) {
    return plugin.getDataDependencies(path.resolve('test/get-data-dependencies/error/index.js')).then(
      function (results) {
        test.same(results.sort(), [
          path.resolve('test/get-data-dependencies/error/index.js')
        ].sort());

        test.end();
      },
      function (err) {
        test.fail(err);

        test.end();
      }
    )
  });

  test.test('should resolve with dependencies on parse error', function (test) {
    return plugin.getDataDependencies(path.resolve('test/get-data-dependencies/parse-error/index.js')).then(
      function (results) {
        test.same(results.sort(), [
          path.resolve('test/get-data-dependencies/parse-error/index.js')
        ].sort());

        test.end();
      },
      function (err) {
        test.fail(err);

        test.end();
      }
    )
  });

  test.test('should resolve with dependencies on missing dependency', function (test) {
    return plugin.getDataDependencies(path.resolve('test/get-data-dependencies/missing/index.js')).then(
      function (results) {
        test.same(results.sort(), [
          path.resolve('test/get-data-dependencies/missing/index.js'),
          path.resolve('test/get-data-dependencies/missing/foo.js'),
          path.resolve('test/get-data-dependencies/missing/foo/index.js'),
          path.resolve('test/get-data-dependencies/missing/bar.js'),
          path.resolve('test/get-data-dependencies/missing/bar.html'),
          path.resolve('test/get-data-dependencies/missing/bar.twig')
        ].sort());

        test.end();
      },
      function (err) {
        test.fail(err);

        test.end();
      }
    )
  });

  test.test('should resolve with dependencies when data requires a twig template', function (test) {
    return plugin.getDataDependencies(path.resolve('test/get-data-dependencies/data-with-twig-template/index.js')).then(
      function (results) {
        test.same(results.sort(), [
          path.resolve('test/get-data-dependencies/data-with-twig-template/index.js'),
          path.resolve('test/get-data-dependencies/data-with-twig-template/foo.twig'),
          path.resolve('test/get-data-dependencies/data-with-twig-template/bar.twig')
        ].sort());

        test.end();
      },
      function (err) {
        test.fail(err);

        test.end();
      }
    )
  });
});


text:
package fr.univ.nantes.roomanager.dao.reservation

import fr.univ.nantes.roomanager.bean.ReservationBean

/**
 * @author Pierre Gaultier
 * @author Alexis Giraudet
 */
class ReservationDaoImpl extends ReservationDao {
  private var increment: Int = 0
  private var reservations: Set[ReservationBean] = Set()

  override def get(id: Int): ReservationBean = {
    val reservation: ReservationBean = reservations.find((reservation: ReservationBean) => reservation.getId() == id).get
    new Reservation(reservation.getId(), reservation)
  }

  override def update(reservation: ReservationBean): Unit = {
    if (reservations.contains(reservation)) {
      var newReservation: Reservation = new Reservation(reservation.getId(), reservation)
      if (!reservations.exists((other: ReservationBean) => newReservation.uniqueConstraint(other)))
        reservations += newReservation
      else
        throw new Exception()
    }
    else
      throw new Exception()
  }

  override def delete(reservation: ReservationBean): Unit = reservations -= reservation

  override def find(predicate: (ReservationBean) => Boolean): Traversable[ReservationBean] = {
    var retReservations: Set[ReservationBean] = Set()
    reservations.filter(predicate).foreach((reservation: ReservationBean) => retReservations += new Reservation(reservation.getId(), reservation))
    retReservations
  }

  override def create(reservation: ReservationBean): ReservationBean = {
    var newReservation: Reservation = new Reservation(increment, reservation)
    if (reservations.exists((other: ReservationBean) => newReservation.uniqueConstraint(other)))
      throw new Exception()
    reservations += newReservation
    increment += 1
    new Reservation(newReservation.getId(), newReservation)
  }

  override def getAll(): Traversable[ReservationBean] = {
    var retReservations: Set[ReservationBean] = Set()
    reservations.foreach((reservation: ReservationBean) => retReservations += new Reservation(reservation.getId(), reservation))
    retReservations
  }
}


text:
require 'spec_helper'

describe CursorQuery do
end


text:
if [ -x /usr/bin/update-desktop-database ]; then
  /usr/bin/update-desktop-database usr/share/applications >/dev/null 2>&1
fi

if [ -x /usr/bin/gtk-update-icon-cache ] \
  && [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
  /usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
fi


text:
package com.knewton.mapreduce;

import org.apache.cassandra.io.sstable.SSTableIdentityIterator;

import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * Abstract mapper class that takes in a row key as its key and a column as its value.
 *
 * @author Giannis Neokleous
 *
 */
public class SSTableRowRecordReader extends SSTableRecordReader<ByteBuffer,
        SSTableIdentityIterator> {

    /**
     * Gets the next key and value in the table.
     *
     * @return True if there's more keys. False otherwise.
     */
    @Override
    public boolean nextKeyValue() throws IOException, InterruptedException {
        if (tableScanner.hasNext()) {
            SSTableIdentityIterator row = (SSTableIdentityIterator) tableScanner.next();
            currentKey = row.getKey().getKey();
            currentValue = row;
            incKeysRead(1);
            return true;
        }
        currentKey = null;
        currentValue = null;
        return false;
    }

}


text:
import React from 'react';
import { assert } from 'chai';
import { createShallow, getClasses } from '@material-ui/core/test-utils';
import Card from './Card';
import Paper from '../Paper';

describe('<Card />', () => {
  let shallow;
  let classes;

  before(() => {
    shallow = createShallow({ dive: true });
    classes = getClasses(<Card />);
  });

  it('should render Paper with the root class', () => {
    const wrapper = shallow(<Card />);
    assert.strictEqual(wrapper.type(), Paper);
    assert.strictEqual(wrapper.props().elevation, 1);
  });

  it('should have the root and custom class', () => {
    const wrapper = shallow(<Card className="card" />);
    assert.strictEqual(wrapper.hasClass(classes.root), true);
    assert.strictEqual(wrapper.hasClass('card'), true);
  });

  it('should render Paper with 8dp', () => {
    const wrapper = shallow(<Card raised />);
    assert.strictEqual(wrapper.props().elevation, 8);
  });

  it('should spread custom props on the root node', () => {
    const wrapper = shallow(<Card data-my-prop="woofCard" />);
    assert.strictEqual(wrapper.props()['data-my-prop'], 'woofCard');
  });
});


text:
namespace Vulcan
{
    sealed class GraphTree // Узел дерева
    {
        public int Attribute; // Номер признака
        public bool Value; // Значение ребра
        public int Class; // Номер класса
        public int X; // Координаты узла
        public int Y; // в графе
        public GraphTree Left; // Левая ветвь
        public GraphTree Right; // Правая ветвь
    }
}


text:
using System.Web.Mvc;
using System.Web.Security;

namespace Frapid.Account.Controllers
{
    public class SignOutController : BaseAuthenticationController
    {
        [Route("account/sign-out")]
        [Route("account/log-out")]
        [Authorize]
        public ActionResult SignOut()
        {
            FormsAuthentication.SignOut();
            return Redirect("/account/sign-in");
        }
    }
}


text: Scripts that I use


text:
import React from "react";
import { mount } from "enzyme";
import { TextField } from "../index";

import renderer from "react-test-renderer";

describe("Test Input component render", () => {
  it("Render correctly", () => {
    const tree = renderer
      .create(
        <TextField
          className={"class"}
          type={"text"}
          id={"ID"}
          name={"InputName"}
          required
          value={"Value"}
          disabled="false"
          hidden={false}
          maxLength={15}
          placeholder={"Text here"}
          valid={() => {
            return { status: null, message: null };
          }}
          onChange={() => {
            return true;
          }}
          uppercase={false}
        />
      )
      .toJSON();
    expect(tree).toMatchSnapshot();
  });
});

function _validate(input, positiveCase) {
  const component = mount(
    <TextField
      valid={function() {
        if (!isNaN(component.state().value)) {
          if (parseInt(component.state().value) > 0) {
            return { status: "success", message: null };
          }
        }
        return { status: "error", message: "That is NOT a number" };
      }}
    />
  );

  expect(component.state().status).toEqual(null);
  component.setState({ value: input });
  component.find("input").simulate("change");
  if (positiveCase) {
    expect(component.state().status).toEqual("success");
  } else {
    expect(component.state().message).toEqual("That is NOT a number");
    expect(component.state().status).toEqual("error");
  }
}

describe("Suite - Validator checking", () => {
  it("Check validator use - Only number greater than zero allowed - Positive case ", function() {
    _validate("121", true);
  });
  it("Check validator use - Only number greater than zero allowed - Positive case ", function() {
    _validate("11", true);
  });
  it("Check validator use - Only number greater than zero allowed - Negative case ", function() {
    _validate("aa", false);
  });
  it("Check validator use - Only number greater than zero allowed - Negative case ", function() {
    _validate("1a1", false);
  });
  it("Check validator use - Only number greater than zero allowed - Negative case ", function() {
    _validate("-2", false);
  });
  it("Check validator use - Only number greater than zero allowed - Negative case ", function() {
    _validate("", false);
  });
});

describe("Suite - events", () => {
  it("change updates value to uppercase if uppercase prop is true", () => {
    const tf = mount(<TextField label="name" uppercase />);

    tf.find("input").simulate("change", { target: { value: "Jon" } });
    expect(tf.state().value).toBe("JON");
  });

  it("change calls onChange function if present", () => {
    const handleChange = jest.fn();
    const tf = mount(<TextField label="name" onChange={handleChange} />);

    tf.find("input").simulate("change", { target: { value: "Jon" } });
    expect(handleChange).toBeCalled();
  });

  it("focus calls onFocus if onFocus is a function", () => {
    const handleFocus = jest.fn();
    const tf = mount(<TextField label="name" onFocus={handleFocus} />);

    tf.find("input").simulate("focus");
    expect(handleFocus).toBeCalled();
  });

  it("handle paste with no mask", () => {
    const event = {
      preventDefault: jest.fn(),
      clipboardData: {
        getData: jest.fn().mockImplementation(() => {
          return "02";
        })
      }
    };
    const tf = mount(<TextField label="Expiration Date" value="0" />);
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance()._handleChange = jest.fn();
    window.setTimeout = jest.fn();

    tf.find("input").simulate("paste", event);
    expect(tf.instance()._updateMaskSelection).not.toBeCalled();
    expect(tf.instance()._handleChange).not.toBeCalled();
    expect(window.setTimeout).not.toBeCalled();
  });

  it("handle key press with no mask", () => {
    const event = {
      preventDefault: jest.fn(),
      key: "1"
    };
    const tf = mount(<TextField label="Expiration Date" value="02" />);
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance()._handleChange = jest.fn();

    tf.find("input").simulate("keypress", event);
    expect(tf.instance()._updateMaskSelection).not.toBeCalled();
    expect(tf.instance()._handleChange).not.toBeCalled();
  });
});

describe("Suite - Mask", () => {
  it("updates value from mask.getValue", () => {
    const tf = mount(
      <TextField label="Expiration Date" value="04" mask="11/1111" />
    );
    expect(tf.state().value).toBe("04/____");
  });

  it("CWRP updates value from mask.getValue", () => {
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.setProps({ value: "04" });
    expect(tf.state().value).toBe("04/____");
  });

  it("CWRP sets mask pattern if mask is updated", () => {
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance().mask.setPattern = jest.fn();
    tf.setProps({ value: "04", mask: "11/11" });
    expect(tf.instance().mask.setPattern).toBeCalled();
  });

  it("handle change does not update mask selection if mask value equals value", () => {
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.getValue = jest.fn().mockImplementation(() => {
      return "04/2019";
    });

    tf.find("input").simulate("change", { target: { value: "04/2019" } });
    expect(tf.instance()._updateMaskSelection).not.toBeCalled();
  });

  it("handle change updates mask selection if mask value does not equal value", () => {
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.backspace = jest.fn();

    tf.find("input").simulate("change", { target: { value: "04" } });
    expect(tf.instance()._updateMaskSelection).toBeCalled();
    expect(tf.instance().mask.backspace).toBeCalled();
  });

  it("handle change only updates mask once when !newValue", () => {
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance()._getMaskDisplayValue = jest.fn().mockImplementation(() => {
      return false;
    });
    tf.instance().mask.backspace = jest.fn();

    tf.find("input").simulate("change", { target: { value: "04" } });
    expect(tf.instance()._updateMaskSelection.mock.calls.length).toBe(1);
    expect(tf.instance().mask.backspace).toBeCalled();
  });

  it("handle change updates mask selection if mask value does not equal value && value greater than maskValue length", () => {
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.backspace = jest.fn();
    tf.instance().mask.getValue = jest.fn().mockImplementation(() => {
      return 1;
    });

    tf.find("input").simulate("change", { target: { value: "04" } });
    expect(tf.instance()._updateMaskSelection).toBeCalled();
    expect(tf.instance().mask.backspace).not.toBeCalled();
  });

  it("handle key press updates mask selection if key is not meta/alt/ctrl/enter", () => {
    const event = {
      preventDefault: jest.fn(),
      key: "0"
    };
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.backspace = jest.fn();
    tf.instance()._handleChange = jest.fn();

    tf.find("input").simulate("keypress", event);
    expect(tf.instance()._updateMaskSelection).toBeCalled();
    expect(event.preventDefault).toBeCalled();
    expect(tf.instance()._handleChange).toBeCalled();
  });

  it("handle key press with Enter key", () => {
    const event = {
      preventDefault: jest.fn(),
      key: "Enter"
    };
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.backspace = jest.fn();
    tf.instance()._handleChange = jest.fn();

    tf.find("input").simulate("keypress", event);
    expect(tf.instance()._updateMaskSelection).not.toBeCalled();
    expect(event.preventDefault).not.toBeCalled();
    expect(tf.instance()._handleChange).not.toBeCalled();
  });

  it("handle key press with event data", () => {
    const event = {
      preventDefault: jest.fn(),
      data: "1"
    };
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.input = jest.fn().mockImplementation(() => {
      return true;
    });
    tf.instance()._handleChange = jest.fn();

    tf.find("input").simulate("keypress", event);
    expect(tf.instance()._updateMaskSelection).toBeCalled();
    expect(event.preventDefault).toBeCalled();
    expect(tf.instance()._handleChange).toBeCalled();
  });

  it("handle key press when mask input returns false", () => {
    const event = {
      preventDefault: jest.fn(),
      data: "1"
    };
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.input = jest.fn().mockImplementation(() => {
      return false;
    });
    tf.instance()._handleChange = jest.fn();

    tf.find("input").simulate("keypress", event);
    expect(tf.instance()._handleChange).not.toBeCalled();
  });

  it("handle key down updates mask on backspace", () => {
    const event = {
      preventDefault: jest.fn(),
      key: "Backspace"
    };
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.backspace = jest.fn().mockImplementation(() => {
      return true;
    });
    tf.instance()._handleChange = jest.fn();

    tf.find("input").simulate("keyDown", event);
    expect(tf.instance()._updateMaskSelection).toBeCalled();
    expect(event.preventDefault).toBeCalled();
    expect(tf.instance()._handleChange).toBeCalled();
  });

  it("handle key down updates mask on backspace", () => {
    const event = {
      preventDefault: jest.fn(),
      key: "Backspace"
    };
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.backspace = jest.fn().mockImplementation(() => {
      return true;
    });
    tf.instance()._handleChange = jest.fn();
    tf.instance()._getMaskDisplayValue = jest.fn().mockImplementation(() => {
      return false;
    });

    tf.find("input").simulate("keyDown", event);
    expect(tf.instance()._updateMaskSelection.mock.calls.length).toBe(1);
    expect(event.preventDefault).toBeCalled();
    expect(tf.instance()._handleChange).toBeCalled();
  });

  it("handle key down when mask.backspace returns false", () => {
    const event = {
      preventDefault: jest.fn(),
      key: "Backspace"
    };
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.backspace = jest.fn().mockImplementation(() => {
      return false;
    });
    tf.instance()._handleChange = jest.fn();

    tf.find("input").simulate("keyDown", event);
    expect(tf.instance()._updateMaskSelection.mock.calls.length).toBe(1);
    expect(event.preventDefault).toBeCalled();
    expect(tf.instance()._handleChange).toBeCalled();
  });

  it("handle key down not backspace", () => {
    const event = {
      preventDefault: jest.fn(),
      key: "01"
    };
    const tf = mount(
      <TextField label="Expiration Date" value="02" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance()._handleChange = jest.fn();

    tf.find("input").simulate("keyDown", event);
    expect(tf.instance()._updateMaskSelection).not.toBeCalled();
    expect(event.preventDefault).not.toBeCalled();
    expect(tf.instance()._handleChange).not.toBeCalled();
  });

  it("handle paste with mask", () => {
    const event = {
      preventDefault: jest.fn(),
      clipboardData: {
        getData: jest.fn().mockImplementation(() => {
          return "02";
        })
      }
    };
    const tf = mount(
      <TextField label="Expiration Date" value="0" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance()._handleChange = jest.fn();

    tf.find("input").simulate("paste", event);
    expect(tf.instance()._updateMaskSelection).toBeCalled();
    expect(event.preventDefault).toBeCalled();
    expect(tf.instance()._handleChange).toBeCalled();
  });

  it("handle paste with mask when mask.paste returns false", () => {
    const event = {
      preventDefault: jest.fn(),
      clipboardData: {
        getData: jest.fn().mockImplementation(() => {
          return "02";
        })
      }
    };
    const tf = mount(
      <TextField label="Expiration Date" value="0" mask="11/1111" />
    );
    tf.instance()._updateMaskSelection = jest.fn();
    tf.instance().mask.paste = jest.fn().mockImplementation(() => {
      return false;
    });
    tf.instance()._handleChange = jest.fn();
    window.setTimeout = jest.fn();

    tf.find("input").simulate("paste", event);
    expect(tf.instance()._updateMaskSelection).toBeCalled();
    expect(event.preventDefault).toBeCalled();
    expect(tf.instance()._handleChange).toBeCalled();
    expect(window.setTimeout).not.toBeCalled();
  });
});


text:
package org.apache.flink.table.examples.utils;

import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
import org.apache.flink.test.junit5.MiniClusterExtension;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.RegisterExtension;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

/** Test base for validating the example output to stdout. */
public abstract class ExampleOutputTestBase {

    @RegisterExtension
    private static final MiniClusterExtension MINI_CLUSTER_RESOURCE =
            new MiniClusterExtension(
                    new MiniClusterResourceConfiguration.Builder()
                            .setNumberTaskManagers(1)
                            .setNumberSlotsPerTaskManager(1)
                            .build());

    private PrintStream originalPrintStream;

    private ByteArrayOutputStream testOutputStream;

    @BeforeEach
    void before() {
        originalPrintStream = System.out;
        testOutputStream = new ByteArrayOutputStream();
        System.setOut(new PrintStream(testOutputStream));
    }

    protected String getOutputString() {
        return testOutputStream.toString();
    }

    @AfterEach
    void after() {
        System.setOut(originalPrintStream);
    }
}


text:
layout: post
title: What is Silverlight?
---

![Microsoft silverlight](http://d2rormqr1qwzpz.cloudfront.net/uploads/0/5/31462-silverlight_teaser.jpg)

[courtesy](http://www.tested.com/tech/web/3143-rumor-silverlight-5-to-be-the-final-version-of-microsofts-plug-in/)

Recently, I was learning about `Silverlight` for a project. Here is what I'm keeping for future reference:

# Silverlight 5
A Microsoft platform for developing and deploying Rich internet applications. Right now, it's a **depreceated** technology.
Runs as a browser plugin.
Supports .NET languages like `C#` and `VB.NET`, `IronPython` and `IronRuby` using DLR (Dynamic Language Runtime).

# Installation:

There're 3 options:

 - Install silverlight using WPI
 - Install Expression blend for designing purposes
 - Install XNA Game studio for working with 3D

We also need to install the Silverlight SDK.

# Creating a Silverlight project

 - Create a new project in [VS](https://www.visualstudio.com) under `C#` -> `Silverlight`

![Creating a Silverlight project](https://lh3.googleusercontent.com/V06tfnM0rmM84LVLfZhIT263P6BcB85WE6Dvf-6JeLN2o90YgYVJgydYh8DtEA5Lg5mmW34TN9JwqRwwlSzvjGSNN2jiMLRXWN_81hw00JAiK50Z2ozgMQSVMud-D1TPnZ_-EoT5MpdI0R2TLpimDDjQHGkX_FhMJHAblBafUozDiv5OtzN9Jk7wSl6uAjla7RQXQvu92YmMVR6SAvmqa2wUl-CYzwFjCPSqXZuSKxsIsttSGN7_Esjd4MtIeSZnXaAjgNYpbEF0jUmU2vO01GnR38lDU85ft7MgIh7pQeRXN1xzJiSDnjREaDn5R5w2HPQJNrk0J15KAu_v0cQvtvaMnDbYznnUEqcCbgkdK0lTEgpY8s_8e9KsFr8i57De_WATOCV0rcLlLz27GuQzcsY3aer-lCUGdeRlU5Cw2y1Rp2Ba_XJy1CW4VXCKJe_aOMuQq01E6iDep74NqRCUXcH-587DCjCoKNkqBQrl9koxxakNDS8hFs_TOByVJQKcJzxCzOiJ0TZ0hdt15M335dqXFtX__QmgmYOWc7onrsFqTvk0PI4DeSTenjtXt8ptQ8S52bOPiHbnJQ332IPm24zBkCAL9Zk=w955-h582-no)

 - Make sure to check **Host the Silverlight application in a new website**

# Running the project

If the developer runtime for `Silverlight` is not installed, the following popup will be shown

![developer runtime for Silverlight is not installed](https://lh3.googleusercontent.com/RdPeAPujcDG9EpUDIcLGI6R0aNr4gCKmgvu6Zz0cTGc6F8J5htppsiNEgLk2VrVWMoGM0gwQxIsUOiSDmoQVbr_vyAnvyqO_yJiSqpLj7L9KGWMtrCj4KAKf6SjR6o3zjPxNzQrmKjYf2RvsCgPRGPjtoTso6ulSwdarqBzTUFmVSgMO6gQdnI-tm2mCshMyF2fgCw1vILn7oKlAFOII5f4SMcnA71JT7-6jsZ3U4C4lpF3AUyF5SHknlKzF80YTy0C9eWl7SjmL1rI9MmpoZ2L4ulkkeRTZkyRnnCUR7WWxQY9D6HPJQ3OVuRdFQ7dwxXm_psvtWhvohTOQndIp-K6N2-vhpGBPNoBDJH1WDAzFyTgs5RB0U8BtDwfNL3lgnkh1hwPUC4TBm01s6wc0vby7JTP78NRpeBA9CSc0IXPs0GxGTsURejRGbN9m4rs9ZeH9XiRe-l6_F4IPxRScyQSobpTYK5pEvU5WUxLz3JGKsYGCqYyO9u2deoBHgfOXdYChet_Jz-eM8gAPUtPHmSTHI7AaN29maOQPLcfMKooYsXjlHshYu-Ri6d5NvBuuxfs5z2hs3lPhNzOkl1Y7Z9qL8acnhIk=w497-h199-no)

When running the project, in case the `Silverlight` is not installed in the browser, the following browser notification will be shown:

![Running Silverlight in Chrome](https://lh3.googleusercontent.com/FNzB1QBestDTfS1pRNWXFd_VAfBAKY4AnQU_D8f7B_3m5so3M-ZVGLPhxaIGJ-d5ep7pMU99zioVkOeUWbxdIP4Eo1EE8d1xBDegZ8ee1X3K-VtukN1H47gdc2mqP8codvc9Ux2NMydnmUw35flAVm4gjqxl77HSDChLC1i-Lcx8N60RzGZi_AwmBecs9-2XjVHoeiR5b0FJ1yRUYs37m96thWmHGW3hNGOrze33BDJqeVs1_fdklnG_Xoa6k9A1BTLykuxIvGkJsNFyt3sTs3QiCpR0pdFU1GqrfPjRvoQLZZ92c13iUT-9J-s6_3r9gVnj8Il0rHZ73pbQmn32JOt8vMOHvfAI8NK34tZALKlRMQV3Jw6dIhtLcw0uN0YJLEpBFlEz9NK85DkUaRra4qOk8a30kpDVc2CUyD8LwMEgbEwJW2ETwxLG04Yyporj4xR1CCqGcWk0-UtS6un9AfS3tEnVJrCeciWmdMFL69orcEYx4JhkDagvz92BuxzgAYJvfXLjtWt1ZQGWbOjIiGXSJu2A9uXAH1qhr0-uL_73S3TN4zmK7-2Az-l_mrB7Dii8sHhItGKWrK7IFPfpGLMUnd7CsWM=w357-h278-no)

>Clicking the install link will take us to the Microsoft website for downloading and installing the plugin

# Visual studio settings

From the VS main menu's Tools -> Options

 - For All languages: enable `word warp` and `line number` under General node
 - Set `Tab` and `indent size` to 2 under Tabs node. Also keep tabs

# Assemblies

There are two types of Microsoft Silverlight assemblies:

The core Silverlight assemblies

 - `mscorlib.dll`
 - `System.Core.dll`
 - `system.dll`
 - `System.Net.dll`
 - `System.Windows.dll`

SDK assemblies, which are used for additional functionalities.

# Structure of a Silverlight project

 - App.xaml file contains Global settings and global events
 - MainPage.xaml is the main Silverlight UI

`Path in web` setting specifies where to put the output `.xap` files. In the image shown, it's `ClientBin` folder.

The initial / startup control can be set from `App.xaml.cs`.

The Silverlight application is compiled into a `.dll` which is then used by the Silverlight runtime.

The `.csproj` file contains the build instructions. During build, VS executes the build instructions contained in the `.csproj` file. One of the instructions calls the language compiler such as `csc.exe` for `C#`, `vbc.exe` for `VB.NET`

Although the process is build, a lot of devs call it compiling.

With Solution configuration set to `Debug`, the Visual studio will create a `Debug` folder inside the `Bin` folder of the project. In general cases, there will be **5** files

 - The application `AppManifest` file - contains the application information
 - The application `.dll` file - the actual code which will be loaded by the Silverlight runtime when executing the project
 - The application `.pdb` file - the portable debug file for the project
 - The application `.xap` file - the zipped bundle of `AppManifest` and the application `.dll`s. This is useful in cases when the application uses SDK assemblies. The zip bundle will help the client download the SDK `.dll`s
 - The application test `.html` file - the application test file generated by the `Properties` -> `Debug` -> `Start Action` set to `Dynamically generate a test page`

# Deployment

When doing the deployment, the mime types need to be mapped in IIS by following the below steps:

 - Select the application in concern from Sites node
 - Double click `Mime Types` and the entries as shown below:

`.xap` -> `application/x-silverlight` - For Silverlight 1 and later
`.xap` -> `application/x-silverlight-2` (-2 means the second implementation of the mime type) - For Silverlight 2 to 5
`.xaml` -> 'application/xaml+xml'

When the application starts up, the `Test` HTML page (generated inside the `Bin` folder) asks the browser to load the Silverlight plugin which is specified in the following tag:

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">

The browser plugin then later asks for the `.xap` file. Which is basically a `.zip` folder containing application and other `.dlls` with information inside the application manifest file.

To not allow browser to load the default error page when the Silverlight plugin isn't available, set the `object` tag's `autoUpgrade` parameter to `false`

<param name="autoUpgrade" value="false" />

with url set to the download link of the required Silverlight plugin. The javascript `onSilverlightError` needs to be used. The `ErrorCode` to watch for is `8001`:

function onSilverlightError(sender, args) {

	if (args.ErrorCode == 8001) {
		//code to run when correct Silverlight plugin version isn't available
	}
}

The Silverlight code behind files are in `partial` classes (one holding the event handling, another for the UI handling).
Using a `XAML` element is equal to instantiating a `.NET` class. The `XML` elements are validated against xml namespaces.

# Binding

To assign run time calculation of value and assing to a property we need to use Markup extensions. These classes do binding and resource lookup.

When we assign a property in XAML, we're passing a

 - string
 - passed through a TypeConverter (and the conversion happens at the compile time)

**Passing values at compile time**

<TextBox Text='abc' Background='Orange' />

**Passing values at run time**

<TextBox Text='{local:LatinWords}' Background='{StaticResource warning}' />

Types of data binding in XAML are:

 - Binding: binding by Data source
 - Template: get value from control template and assign it to property
 - StaticResource: Lookup resource defined in ResourceDictionary
 - Null: Assing null value to preperty
 - Element to element binding:

<!-- Make this element idenfiable by name -->
<TextBox Text='Hello' x:Name='textHello' Background='Goldenrod' />
<!-- Assign value from the above textHello to this element -->
<TextBox Text='Goodbye' Background='{Binding ElementName=textHello, Path=Background}' />

 - Self binding:

<!-- Read value red from Text property and assign it to Background property -->
<TextBox Text='Red' Background='{Binding Text, RelativeSource={RelativeSource Self }}' />

 - StaticResource binding:

<!-- Define a static resource -->
<LinearGradientBrush x:Key='seaBrush'>
	<LinearGradientBrush.GradientStops>
		<GradientStop Offset="0" Color="Yellow" />
		<GradientStop Offset="0.5" Color="Orange" />
		<GradientStop Offset="0.8" Color="LightCoral" />
	</LinearGradientBrush.GradientStops>
</LinearGradientBrush>

<!-- use the seaBrush static resource for the Background property -->
<TextBox Text='StaticResource' Background='{StaticResource seaBrush}' />

 - Null binding:

<!-- Null MarkupExtension -->
<TextBox Text='Null MarkupExtension' Background='{x:Null}' />

 - Custom markup extension binding:

<!-- The XML namespace abc is defined which refers to abcLib in UserControl -->
<UserControl xmlns:abc='clr-namespace:abcLib;assembly=abcLib' >

		... rest of the code ...

<!-- use our custom markup extension-->
<TextBox Text='{abc:LatinWords WordCount=5}' Background='{x:Null}' />
</UserControl>

and the implementation of custom markup extension is:

namespace abcLib
{
  public class LatinWords : IMarkupExtension<string>
  {

    public bool RandomStartPoint { get; set; }
    public int WordCount { get; set; }

    private Int32 _numberOfWords;
    private static Random ran = new Random();
    private string[] _words;

    public void SetupWords()
    {
      // for demo limit the number of words to 100
      if (WordCount <= 1)
      {
        _numberOfWords = 1;
      }
      if (_numberOfWords > 100)
      {
        _numberOfWords = 100;
      }
      else
      {
        _numberOfWords = WordCount;
      }

      _words = _sourceString.Split(' ');

    }
    public string ProvideValue(IServiceProvider serviceProvider)
    {
      SetupWords();
      int skipCount = 0;
      if (this.RandomStartPoint)
      {
        skipCount = ran.Next(3, 20);
      }
      return string.Join(" ", _words.Skip(skipCount).Take(_numberOfWords).ToArray());
    }

    private string _sourceString = "Lorem ipsum. ";

  }
}

# Dependency property system - DPS

Silverlight uses a unique property system which was invented by WPF team. This provides services for UI like Animation, Templates, Styles and reduces critical resource usage (e.g. memory). It has two parts:

 - Dependency properties
 - Attached properties

When creating own user controls, dependency property (e.g. on Button element: FontSize) and .NET property **both** are correct ways to expose a property on them.

 - First, create a dependency property to work with the Silverlight services like data binding
 - Second, create a .NET property to set and read property values in code

**Value resolution priorities**

 1. Active animation
 2. Local value
 3. Templated properties
 4. Style setters
 5. Property value inheritance
 6. Default

Case:
 - If the `local value` for a property is set to **20** and the control in concern is getting animated changing property value from **40 to 80**
 - When we query the value of the property, the value set by the current animation step will be returned, as per the above priority list

**Setting dependency properties using code:**

 - In `XAML` file

<Button x:Name='sampleButton' Content='Set the Properties in Code' Click='sampleButton_Click' />

 - In code behind

		private void sampleButton_Click(object sender, RoutedEventArgs e)
		{
			sampleButton.FontSize = 40;  // using a .NET wrapper to set value

			double size = sampleButton.FontSize; // use the .NET wrapper to read value

			// use the DP system directly

			sampleButton.SetValue(FontSizeProperty, 30);
			size = (double)sampleButton.GetValue(FontSizeProperty);

		}

Silverlight elements and controls (default or custom) have lots of dependency properties. This system provides services such as animation, data binding, control templates and styles to the Silverlight elements.To get these services a developer needs to write 'ugly' registration code.

An example of declaring and registering a dependency property is:

	public partial class StarShape : UserControl {

	public StarShape()
	{
		InitializeComponent();
	}

	//declaring
	public static readonly DependencyProperty PointsProperty;

		//registering
		static StarShape()
		{

			// 2. Register with the DP system
			PointsProperty = DependencyProperty.Register("Points", typeof(double), typeof(StarShape), null);

		}
	}

Notice that the property is declared readonly, which means it can only be instantiated in it's static constructor.

# Attached dependency property

They are a special dependency property to provide decoupled extensible model. We can think of it as a 'global property' meaning it is available to all controls in Silverlight runtime.

It is owned and registered by a Type. The method for the same is `DependencyProperty.RegisterAttached`. It uses the dotted syntax `TypeName.AttachedProperty`. These properties are mostly used in layout panels Canvas, Grid, DockPanel.

**Key points:**

 - Attached property value is stored in DPS
 - Value is assigned with element assigning the value
 - The owning class will query the value from the DPs

[Photos](https://goo.gl/photos/fWU5PoCK333JNVpA8)


text:
package network::juniper::common::ive::mode::disk;

use base qw(centreon::plugins::mode);

use strict;
use warnings;

sub new {
    my ($class, %options) = @_;
    my $self = $class->SUPER::new(package => __PACKAGE__, %options);
    bless $self, $class;

    $options{options}->add_options(arguments =>
                                {
                                  "warning:s"               => { name => 'warning', },
                                  "critical:s"              => { name => 'critical', },
                                });

    return $self;
}

sub check_options {
    my ($self, %options) = @_;
    $self->SUPER::init(%options);

    if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
        $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
        $self->{output}->option_exit();
    }
    if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
        $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
        $self->{output}->option_exit();
    }
}

sub run {
    my ($self, %options) = @_;
    $self->{snmp} = $options{snmp};

    my $oid_diskFullPercent = '.1.3.6.1.4.1.12532.25.0';

    my $result = $self->{snmp}->get_leef(oids => [$oid_diskFullPercent], nothing_quit => 1);
    my $exit_code = $self->{perfdata}->threshold_check(value => $result->{$oid_diskFullPercent},
                                threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
    $self->{output}->output_add(severity => $exit_code,
                                short_msg => sprintf("Disk Usage is %.2f%%",
                                    $result->{$oid_diskFullPercent}));
    $self->{output}->perfdata_add(label => 'used', unit => '%',
                                  value => sprintf("%.2f", $result->{$oid_diskFullPercent}),
                                  warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
                                  critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
                                  min => 0, max => 100);

    $self->{output}->display();
    $self->{output}->exit();
}

1;

__END__

=head1 MODE

Check disk usage (JUNIPER-IVE-MIB).

=over 8

=item B<--warning>

Threshold warning in percent.

=item B<--critical>

Threshold critical in percent.

=back

=cut


text:
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>MoveBillboardGroup</title>

MoveBillboardGroup()

语法

MoveBillboardGroup(#BillboardGroup, x, y, z [, Mode])

概要

Moves a billboard group by the specified x, y and z values. This is by default a relative move,
based on the current location of the billboard group.

参数

#BillboardGroup

The billboard group to move.

x, y, z

The new position of the billboard group.

模式 (可选)

它可以是下列值之一︰

  #PB_Relative: relative move, from the current billboard group position (default).
  #PB_Absolute: absolute move to the specified position.

combined with one of the following values:

  #PB_Local : local move.
  #PB_Parent: move relative to the parent position.
  #PB_World : move relative to the world.

返回值

无.

已支持操作系统
所有

<- MoveBillboard() - Billboard Index - RemoveBillboard() ->


text:
from jedi.evaluate.base_context import ContextSet, NO_CONTEXTS
from jedi.common.utils import monkeypatch

class AbstractLazyContext(object):
    def __init__(self, data):
        self.data = data

    def __repr__(self):
        return '<%s: %s>' % (self.__class__.__name__, self.data)

    def infer(self):
        raise NotImplementedError

class LazyKnownContext(AbstractLazyContext):
    """data is a context."""
    def infer(self):
        return ContextSet(self.data)

class LazyKnownContexts(AbstractLazyContext):
    """data is a ContextSet."""
    def infer(self):
        return self.data

class LazyUnknownContext(AbstractLazyContext):
    def __init__(self):
        super(LazyUnknownContext, self).__init__(None)

    def infer(self):
        return NO_CONTEXTS

class LazyTreeContext(AbstractLazyContext):
    def __init__(self, context, node):
        super(LazyTreeContext, self).__init__(node)
        self._context = context
        # We need to save the predefined names. It's an unfortunate side effect
        # that needs to be tracked otherwise results will be wrong.
        self._predefined_names = dict(context.predefined_names)

    def infer(self):
        with monkeypatch(self._context, 'predefined_names', self._predefined_names):
            return self._context.eval_node(self.data)

def get_merged_lazy_context(lazy_contexts):
    if len(lazy_contexts) > 1:
        return MergedLazyContexts(lazy_contexts)
    else:
        return lazy_contexts[0]

class MergedLazyContexts(AbstractLazyContext):
    """data is a list of lazy contexts."""
    def infer(self):
        return ContextSet.from_sets(l.infer() for l in self.data)


text:
import os

class LocalMixin(object):
    """Mixin designed for local installation, that uses the Django dev server.
    """
    DEBUG = True
    DOMAIN = 'localhost'
    PORT = '8000'
    MANAGERS = ADMINS = (
        ('David Seddon', 'david@seddonym.me'),
    )

    STATIC_ROOT = ''

    @property
    def STATICFILES_DIRS(self):
        return (os.path.join(self.PROJECT_ROOT, 'static'),)

    @property
    def COMPRESS_ROOT(self):
        return os.path.join(self.PROJECT_ROOT, 'compressed')

    @property
    def LOG_PATH(self):
        return os.path.join('/var/log/django', self.PROJECT_NAME)

    @property
    def PROJECT_ROOT(self):
        return os.path.join('/home/david/www', self.PROJECT_NAME)

class WebfactionMixin(object):
    """Mixin designed for sites hosted on Webfaction using the
    nginx / uwsgi approach.

    Required:

        WEBFACTION_USER
        WEBFACTION_APPNAME
    """

    @property
    def PROJECT_ROOT(self):
        return '/home/%s/webapps/%s/project' % (self.WEBFACTION_USER,
                                                self.WEBFACTION_APPNAME)

    @property
    def STATICFILES_DIRS(self):
        return (os.path.join(self.PROJECT_ROOT, 'static'),)

    @property
    def LOG_PATH(self):
        return '/home/%s/logs/user/%s/' % (self.WEBFACTION_USER,
                                           self.WEBFACTION_APPNAME)

    @property
    def STATIC_ROOT(self):
        return '/home/%s/webapps/%s/static' % (self.WEBFACTION_USER,
                                               self.WEBFACTION_APPNAME)

    @property
    def MEDIA_ROOT(self):
        return '/home/%s/webapps/%s/uploads' % (self.WEBFACTION_USER,
                                                self.WEBFACTION_APPNAME)

    @property
    def DEFAULT_DATABASE_NAME(self):
        return '%s_%s' % (self.PROJECT_NAME, self.WEBFACTION_APPNAME)

    @property
    def DEFAULT_DATABASE_USER(self):
        return self.DEFAULT_DATABASE_NAME

    EMAIL_HOST = 'smtp.webfaction.com'

class WebfactionDevMixin(WebfactionMixin):
    """Mixin designed for dev site hosted on Webfaction using the
    nginx / uwsgi approach.

    Required:

        WEBFACTION_USER
    """
    DEBUG = True
    WEBFACTION_APPNAME = 'dev'

class WebfactionLiveMixin(WebfactionMixin):
    """Mixin designed for live site hosted on Webfaction using the
    nginx / uwsgi approach.

    Required:

        WEBFACTION_USER
    """
    DEBUG = False
    WEBFACTION_APPNAME = 'live'


text:
import { ErrorLike } from "./types";

const newline = /\r?\n/;
const onoCall = /\bono[ @]/;

/**
 * The Property Descriptor of a lazily-computed `stack` property.
 */
interface LazyStack {
  configurable: true;

  /**
   * Lazily computes the error's stack trace.
   */
  get(): string | undefined;
}

/**
 * Is the property lazily computed?
 */
export function isLazyStack(stackProp: PropertyDescriptor | undefined): stackProp is LazyStack {
  return Boolean(
    stackProp &&
    stackProp.configurable &&
    typeof stackProp.get === "function"
  );
}

/**
 * Is the stack property writable?
 */
export function isWritableStack(stackProp: PropertyDescriptor | undefined): boolean {
  return Boolean(
    // If there is no stack property, then it's writable, since assigning it will create it
    !stackProp ||
    stackProp.writable ||
    typeof stackProp.set === "function"
  );
}

/**
 * Appends the original `Error.stack` property to the new Error's stack.
 */
export function joinStacks(newError: ErrorLike, originalError?: ErrorLike): string | undefined {
  let newStack = popStack(newError.stack);
  let originalStack = originalError ? originalError.stack : undefined;

  if (newStack && originalStack) {
    return newStack + "\n\n" + originalStack;
  }
  else {
    return newStack || originalStack;
  }
}

/**
 * Calls `joinStacks` lazily, when the `Error.stack` property is accessed.
 */
export function lazyJoinStacks(lazyStack: LazyStack, newError: ErrorLike, originalError?: ErrorLike): void {
  if (originalError) {
    Object.defineProperty(newError, "stack", {
      get: () => {
        let newStack = lazyStack.get.apply(newError);
        return joinStacks({ stack: newStack }, originalError);
      },
      enumerable: false,
      configurable: true
    });
  }
  else {
    lazyPopStack(newError, lazyStack);
  }
}

/**
 * Removes Ono from the stack, so that the stack starts at the original error location
 */
function popStack(stack: string | undefined): string | undefined {
  if (stack) {
    let lines = stack.split(newline);

    // Find the Ono call(s) in the stack, and remove them
    let onoStart;
    for (let i = 0; i < lines.length; i++) {
      let line = lines[i];

      if (onoCall.test(line)) {
        if (onoStart === undefined) {
          // We found the first Ono call in the stack trace.
          // There may be other subsequent Ono calls as well.
          onoStart = i;
        }
      }
      else if (onoStart !== undefined) {
        // We found the first non-Ono call after one or more Ono calls.
        // So remove the Ono call lines from the stack trace
        lines.splice(onoStart, i - onoStart);
        break;
      }
    }

    if (lines.length > 0) {
      return lines.join("\n");
    }
  }

  // If we get here, then the stack doesn't contain a call to `ono`.
  // This may be due to minification or some optimization of the JS engine.
  // So just return the stack as-is.
  return stack;
}

/**
 * Calls `popStack` lazily, when the `Error.stack` property is accessed.
 */
function lazyPopStack(error: ErrorLike, lazyStack: LazyStack): void {
  Object.defineProperty(error, "stack", {
    get: () => popStack(lazyStack.get.apply(error)),
    enumerable: false,
    configurable: true
  });
}


text:
package org.radargun.producer;

import org.testng.annotations.Test;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * Tests the Group Producer Rate Factory component
 *
 * @author Pedro Ruivo
 * @since 1.1
 */
@Test
public class GroupProducerRateFactoryTest {

   public void testProducerRate() {
      //10000 tx/sec, 10 nodes
      int numberOfNodes = 10;
      for (int i = 0; i < numberOfNodes; ++i) {
         GroupProducerRateFactory groupProducerRateFactory = new GroupProducerRateFactory(10000, numberOfNodes, i, 10);
         ProducerRate[] pr = groupProducerRateFactory.create();

         assert pr.length == 10 : "Expected 10 producers";
         assertProducerRate(0.1D, pr);
      }
   }

   public void testSlowProducers() {
      //500 tx/sec, 2 nodes

      int numberOfNodes = 2;
      for (int i = 0; i < numberOfNodes; ++i) {
         GroupProducerRateFactory groupProducerRateFactory = new GroupProducerRateFactory(500, numberOfNodes, i, 10);
         ProducerRate[] pr = groupProducerRateFactory.create();

         assert pr.length == 3 : "Expected 3 producers";
         assertProducerRate(0.1D, pr[0], pr[1]);
         assertProducerRate(0.05D, pr[2]);
      }
   }

   public void testUnbalancedNodesAndSlowProducers() {
      //500 tx/sec, 3 nodes
      GroupProducerRateFactory groupProducerRateFactory = new GroupProducerRateFactory(500, 3, 0, 10);
      ProducerRate[] pr = groupProducerRateFactory.create();

      assert pr.length == 2 : "Expected 2 producers";
      assertProducerRate(0.1D, pr[0]);
      assertProducerRate(0.067D, pr[1]);

      groupProducerRateFactory = new GroupProducerRateFactory(500, 3, 1, 10);
      pr = groupProducerRateFactory.create();

      assert pr.length == 2 : "Expected 2 producers";
      assertProducerRate(0.1D, pr[0]);
      assertProducerRate(0.067D, pr[1]);

      groupProducerRateFactory = new GroupProducerRateFactory(500, 3, 2, 10);
      pr = groupProducerRateFactory.create();

      assert pr.length == 2 : "Expected 2 producers";
      assertProducerRate(0.1D, pr[0]);
      assertProducerRate(0.066D, pr[1]);
   }

   private void assertProducerRate(double lambda, ProducerRate... producers) {
      for (ProducerRate producerRate : producers) {
         BigDecimal bg = new BigDecimal(producerRate.getLambda());
         bg = bg.setScale(3, RoundingMode.HALF_UP);
         assert lambda == bg.doubleValue() : "Different Lambda detected! " + lambda + "!=" +
               producerRate.getLambda();
      }
   }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" type="text/css" href="css/main.css">
    <title>Vali Admin</title>

      Vali

You have 4 new notifications.

Lisa sent you a mail2min ago

Server Not Working2min ago

Transaction xyz complete2min ago

See all notifications.

 Settings

 Profile

 Logout

John Doe

Frontend Developer

Dashboard

UI Elements

 Bootstrap Elements

 Font Icons

 Cards

 Widgets

Charts

Forms

 Form Componants

 Custom Componants

 Form Samples

 Form Notifications

Tables

 Basic Tables

 Data Tables

Pages

 Blank Page

 Login Page

 User Page

 Lockscreen Page

 Error Page

 Invoice Page

 Calendar Page

 Mailbox

MultiLavel Menu

 Level One

 Level One

 Level Two

 Level Two

 Widgets

Small widgets to interactively displaying data

UI

Widgets

Users

 5

Likes

 25

Uploades

 10

Stars

 500

Users

 5

Likes

 25

Uploades

 10

Stars

 500