text:
using System;
using System.Collections.Generic;
using System.Text;
using wojilu.Members.Users.Domain;
using wojilu.Members.Groups.Domain;
using wojilu.Members.Users.Service;
using wojilu.Web.Mvc;
using wojilu.Common.Msg.Service;
using wojilu.Members.Users.Interface;
using wojilu.Common.Msg.Interface;
using wojilu.Members.Groups.Interface;

namespace wojilu.Members.Groups.Service {

    public class InviteService : wojilu.Members.Groups.Interface.IInviteService {

        public IUserService userService { get; set; }
        public IMessageService msgService { get; set; }
        public IMemberGroupService mgrService { get; set; }

        public InviteService() {
            userService = new UserService();
            msgService = new MessageService();
            mgrService = new MemberGroupService();
        }

        public virtual DataPage<GroupInvite> GetPage( int groupId ) {

            return GroupInvite.findPage( "OwnerId=" + groupId );
        }

        public virtual Result Invite( User inviter, String receiver, Group group, String msg, String inviteUrl ) {

            Result result = this.getReceivers( receiver, group.Id );
            if (result.HasErrors) {
                return result;
            }

            List<User> users = result.Info as List<User>;

            foreach (User user in users) {

                GroupInvite g = new GroupInvite();
                g.Receiver = user;
                g.Inviter = inviter;

                g.OwnerId = group.Id;
                g.Msg = msg;
                g.Code = Guid.NewGuid().ToString();

                g.insert();

                //-----------send msg--------------------

                String lnkInvite = inviteUrl.Replace( "999", g.Id.ToString() ) + "?code=" + g.Code;

                String msgTitle = inviter.Name + " 诚邀您加入群组";

                String msgBody = string.Format( "{0} 诚邀您加入群组 "{2}", 请点击此处接受邀请。 ", inviter.Name, Link.ToMember( inviter ), group.Name, lnkInvite );
                msgBody += "

邀请信息:" + g.Msg;

                msgService.SendMsg( inviter, user.Name, msgTitle, msgBody );

            }

            return new Result();

        }

        private Result getReceivers( String rawReceiver, int groupId ) {

            Result result = new Result();
            if (strUtil.IsNullOrEmpty( rawReceiver )) {
                result.Add( lang.get( "exReceiverNotFound" ) );
                return result;
            }

            List<User> list = new List<User>();
            string[] strArray = rawReceiver.Trim().Split( separator );
            for (int i = 0; i < strArray.Length; i++) {
                User user = userService.IsExist( strArray[i] );
                if (user == null) {
                    result.Add( lang.get( "exReceiverNotFound" ) + ": \"" + strArray[i] + "\" " );
                    return result;
                }

                if (mgrService.IsGroupMember( user.Id, groupId )) {
                    result.Add( "用户 " + user.Name + " 已经是群组成员" );
                    return result;
                }

                list.Add( user );
            }
            result.Info = list;
            return result;
        }

        private static readonly char[] separator = new char[] { ',', ',', '、', '/', '|' };

    }

}


text:
<?php

namespace Application;

use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
use Zend\Session\Config\SessionConfig;
use Zend\Session\Validator\HttpUserAgent;
use Zend\Session\Validator\RemoteAddr;
use Zend\Session\SessionManager;
use Zend\Session\Container;
use Application\Utility\Utilities;
use Application\Model\User;
use Application\Model\UserTable;
use Application\Model\Project;
use Application\Model\ProjectTable;
use Application\Model\ViewProjectMin;
use Application\Model\ViewProjectMinTable;
use Application\Model\ViewProjectDetails;
use Application\Model\ViewProjectDetailsTable;
use Application\Model\ViewProjectsMembersSpecializations;
use Application\Model\ViewProjectsMembersSpecializationsTable;
use Application\Model\ProjectsUsersMembers;
use Application\Model\ProjectsUsersMembersTable;
use Application\Model\Task;
use Application\Model\TaskTable;
use Application\Model\ViewUsersProjects;
use Application\Model\ViewUsersProjectsTable;
use Application\Model\ViewUsersTasks;
use Application\Model\ViewUsersTasksTable;
use Application\Model\UsersTasksAffectations;
use Application\Model\UsersTasksAffectationsTable;
use Application\Model\ViewTasksUsers;
use Application\Model\ViewTasksUsersTable;
use Application\Model\Event;
use Application\Model\EventTable;
use Application\Model\EventOnProjects;
use Application\Model\EventOnProjectsTable;
use Application\Model\EventUser;
use Application\Model\EventUserTable;
use Application\Model\ViewEvent;
use Application\Model\ViewEventTable;
use Application\Model\EventType;
use Application\Model\EventTypeTable;
use Application\Model\EventOnTask;
use Application\Model\EventOnTaskTable;
use Application\Model\ProjectsUsersSpecializations;
use Application\Model\ProjectsUsersSpecializationsTable;

@ini_set('zend_monitor.enable', 0);
if(@function_exists('output_cache_disable')) {
    @output_cache_disable();
}
if(isset($_GET['debugger_connect']) && $_GET['debugger_connect'] == 1) {
    if(function_exists('debugger_connect'))  {
        debugger_connect();
        exit();
    } else {
        echo "No connector is installed.";
    }
}

class Module
{
   public function onBootstrap(MvcEvent $e)
   {
      // Useful for getting the current controller and action's names in views.
		$eventManager = $e->getApplication()->getEventManager();
      $eventManager->attach(
         'dispatch',
         function($e) {
            $routeMatch = $e->getRouteMatch();
            $viewModel = $e->getViewModel();
            $viewModel->setVariable('controller', $routeMatch->getParam('controller'));
            $viewModel->setVariable('action', $routeMatch->getParam('action'));
         }
      );
      // Initialize route listener.
      $moduleRouteListener = new ModuleRouteListener();
      $moduleRouteListener->attach($eventManager);

		// Calls the bootstrap used for the session management.
		$this->initSession(array(
			'remember_me_seconds' => 300,	// The session stay persisting 5 minutes after the browser closing.
			'use_cookies' => true,
			'cookie_httponly' => true,
		));
   }

	// Session management.
	public function initSession($config)
	{
		$sessionConfig = new SessionConfig();
		$sessionConfig->setOptions($config);

		$sessionManager = new SessionManager($sessionConfig);
		$sessionManager->getValidatorChain()
			->attach(
				'session.validate',
				array(new RemoteAddr(), 'isValid')		// Validate the session by the user's IP address, for avoiding hijacking.
			);
		$sessionManager->getValidatorChain()
			->attach(
				'session.validate',
				array(new HttpUserAgent(), 'isValid')	// While the RemoteAddr validator can be spoofed or bypassed by a proxy, we also enable the HttpUserAgent one, which uses the HTTP user agent to validate the request.
			);
		$sessionManager->start();
		Container::setDefaultManager($sessionManager);
	}

    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getAutoloaderConfig()
    {
        return array(
			'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

	// Load objects related to the database's data.
	public function getServiceConfig()
	{
		return array(
			'factories' => array(
                // Return an instance of the Utility/Utilities class when a controler invoks the 'Application\Utility\Utilities' object.
                'Application\Utility\Utilities' => function($sm) { return new Utilities(); },
                // Declare the gateway between the database's entity (table,
                //  view, ...) and the exchange's class.
                'UserTableGateway' => function ($sm) { // Change the gateway's name.
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new User()); // Change the instance's class name.
                    return new TableGateway('users', $dbAdapter, null, $resultSetPrototype); // Change the table's name (this IS the table's name in the database).
                },
                // Use the gateway to give the [NameTable]Table's file the
                // exchange's class as parameter.
                'Application\Model\UserTable' =>  function($sm) { // Change the class' name.
                    $tableGateway = $sm->get('UserTableGateway'); // Change the gateway's name.
                    $table = new UserTable($tableGateway); // Change the instance's class name.
                    return $table;
                },
                'TaskTableGateway' => function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new Task()); // Change the instance's class name.
                    return new TableGateway('tasks', $dbAdapter, null, $resultSetPrototype); // Change the table's name (this IS the table's name in the database).
                },
                'Application\Model\TaskTable' =>  function($sm) { // Change the class' name.
                    $tableGateway = $sm->get('TaskTableGateway'); // Change the gateway's name.
                    $table = new TaskTable($tableGateway); // Change the instance's class name.
                    return $table;
                },
                'ProjectTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new Project());
                    return new TableGateway('projects', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ProjectTable' =>  function($sm) {
                    $tableGateway = $sm->get('ProjectTableGateway');
                    $table = new ProjectTable($tableGateway);
                    return $table;
                },
                'ViewProjectMinTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new ViewProjectMin());
                    return new TableGateway('view_projects_min', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ViewProjectMinTable' =>  function($sm) {
                    $tableGateway = $sm->get('ViewProjectMinTableGateway');
                    $table = new ViewProjectMinTable($tableGateway);
                    return $table;
                },
                'ViewProjectDetailsTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new ViewProjectDetails());
                    return new TableGateway('view_projects_details', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ViewProjectDetailsTable' =>  function($sm) {
                    $tableGateway = $sm->get('ViewProjectDetailsTableGateway');
                    $table = new ViewProjectDetailsTable($tableGateway);
                    return $table;
                },
                'ProjectsUsersMembersTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new ProjectsUsersMembers());
                    return new TableGateway('projectsUsersMembers', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ProjectsUsersMembersTable' =>  function($sm) {
                    $tableGateway = $sm->get('ProjectsUsersMembersTableGateway');
                    $table = new ProjectsUsersMembersTable($tableGateway);
                    return $table;
                },
                'ViewUsersProjectsTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new ViewUsersProjects());
                    return new TableGateway('view_users_projects', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ViewUsersProjectsTable' =>  function($sm) {
                    $tableGateway = $sm->get('ViewUsersProjectsTableGateway');
                    $table = new ViewUsersProjectsTable($tableGateway);
                    return $table;
                },
                'ViewUsersTasksTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new ViewUsersTasks());
                    return new TableGateway('view_users_tasks', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ViewUsersTasksTable' =>  function($sm) {
                    $tableGateway = $sm->get('ViewUsersTasksTableGateway');
                    $table = new ViewUsersTasksTable($tableGateway);
                    return $table;
                },
                'UsersTasksAffectationsTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new UsersTasksAffectations());
                    return new TableGateway('usersTasksAffectations', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\UsersTasksAffectationsTable' =>  function($sm) {
                    $tableGateway = $sm->get('UsersTasksAffectationsTableGateway');
                    $table = new UsersTasksAffectationsTable($tableGateway);
                    return $table;
                },
                'ViewProjectsMembersSpecializationsTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new ViewProjectsMembersSpecializations());
                    return new TableGateway('view_projects_members_specializations', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ViewProjectsMembersSpecializationsTable' =>  function($sm) {
                    $tableGateway = $sm->get('ViewProjectsMembersSpecializationsTableGateway');
                    $table = new ViewProjectsMembersSpecializationsTable($tableGateway);
                    return $table;
                },
                'ViewTasksUsersTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new ViewTasksUsers());
                    return new TableGateway('view_tasks_users', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ViewTasksUsersTable' =>  function($sm) {
                    $tableGateway = $sm->get('ViewTasksUsersTableGateway');
                    $table = new ViewTasksUsersTable($tableGateway);
                    return $table;
                },
                'EventTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new Event());
                    return new TableGateway('events', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\EventTable' =>  function($sm) {
                    $tableGateway = $sm->get('EventTableGateway');
                    $table = new EventTable($tableGateway);
                    return $table;
                },
                'EventOnProjectsTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new EventOnProjects());
                    return new TableGateway('eventsOnProjects', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\EventOnProjectsTable' =>  function($sm) {
                    $tableGateway = $sm->get('EventOnProjectsTableGateway');
                    $table = new EventOnProjectsTable($tableGateway);
                    return $table;
                },
                'EventUserTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new EventUser());
                    return new TableGateway('eventsUsers', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\EventUserTable' =>  function($sm) {
                    $tableGateway = $sm->get('EventUserTableGateway');
                    $table = new EventUserTable($tableGateway);
                    return $table;
                },
                'ViewEventTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new ViewEvent());
                    return new TableGateway('view_events', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ViewEventTable' =>  function($sm) {
                    $tableGateway = $sm->get('ViewEventTableGateway');
                    $table = new ViewEventTable($tableGateway);
                    return $table;
                },
                'EventTypeTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new EventType());
                    return new TableGateway('eventTypes', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\EventTypeTable' =>  function($sm) {
                    $tableGateway = $sm->get('EventTypeTableGateway');
                    $table = new EventTypeTable($tableGateway);
                    return $table;
                },
                'EventOnTaskTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new EventOnTask());
                    return new TableGateway('eventsOnTasks', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\EventOnTaskTable' =>  function($sm) {
                    $tableGateway = $sm->get('EventOnTaskTableGateway');
                    $table = new EventOnTaskTable($tableGateway);
                    return $table;
                },
                'ProjectsUsersSpecializationsTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new ProjectsUsersSpecializations());
                    return new TableGateway('projectsUsersSpecializations', $dbAdapter, null, $resultSetPrototype);
                },
                'Application\Model\ProjectsUsersSpecializationsTable' =>  function($sm) {
                    $tableGateway = $sm->get('ProjectsUsersSpecializationsTableGateway');
                    $table = new ProjectsUsersSpecializationsTable($tableGateway);
                    return $table;
                },
				// Configure the session service.
				'Zend\Session\SessionManager' => function ($sm) {
                    $config = $sm->get('config');
                    if (isset($config['session'])) {
                        $session = $config['session'];

                        $sessionConfig = null;
                        if (isset($session['config'])) {
                            $class = isset($session['config']['class'])  ? $session['config']['class'] : 'Zend\Session\Config\SessionConfig';
                            $options = isset($session['config']['options']) ? $session['config']['options'] : array();
                            $sessionConfig = new $class();
                            $sessionConfig->setOptions($options);
                        }

                        $sessionStorage = null;
                        if (isset($session['storage'])) {
                            $class = $session['storage'];
                            $sessionStorage = new $class();
                        }

                        $sessionSaveHandler = null;
                        if (isset($session['save_handler'])) {
                            // class should be fetched from service manager since it will require constructor arguments
                            $sessionSaveHandler = $sm->get($session['save_handler']);
                        }

                        $sessionManager = new SessionManager($sessionConfig, $sessionStorage, $sessionSaveHandler);

                        if (isset($session['validator'])) {
                            $chain = $sessionManager->getValidatorChain();
                            foreach ($session['validator'] as $validator) {
                                $validator = new $validator();
                                $chain->attach('session.validate', array($validator, 'isValid'));

                            }
                        }
                    } else {
                        $sessionManager = new SessionManager();
                    }
                    Container::setDefaultManager($sessionManager);
                    return $sessionManager;
                },
			),
		);
	}
}

redpajama_set_name: RedPajamaGithub


text:
(function(window){

    //Get element by id
    window.geid = function(elem_id){
        return document.getElementById(elem_id);
    };

    //Get element by selector
    window.qs = function(selector) {
        return document.querySelector(selector);
    };

    window.qsa = function(selector) {
        return document.querySelectorAll(selector);
    };

    window.attachEvent = function (target, type, callback) {
      console.log(target + ":" + callback);
      target.addEventListener(type, callback);
    };

    String.prototype.capitalize = function(){
      return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
    };

})(window);


text:
package kantan.csv
package ops

/** Provides syntax for encoding values as CSV rows.
  *
  * Importing `kantan.csv.ops._` will add [[asCsvRow]] to any type `A` such that there exists an implicit
  * `RowEncoder[A]` in scope.
  */
final class CsvRowEncoderOps[A: RowEncoder](val a: A) {

  /** Encodes a value as a CSV row.
    *
    * @example
    * {{{
    * scala> List(1, 2, 3).asCsvRow
    * res0: Seq[String] = List(1, 2, 3)
    * }}}
    */
  def asCsvRow: Seq[String] =
    RowEncoder[A].encode(a)
}

trait ToCsvRowEncoderOps {
  implicit def toCsvRowEncoderOps[A: HeaderEncoder](a: A): CsvRowEncoderOps[A] =
    new CsvRowEncoderOps(a)(HeaderEncoder[A].rowEncoder)
}

object rowEncoder extends ToCsvRowEncoderOps


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
* @name: S15.5.4.16_A7;
* @section: 15.5.4.16, 13.2;
* @assertion: String.prototype.toLowerCase can't be used as constructor;
* @description: Checking if creating the String.prototype.toLowerCase object fails;
*/

var __FACTORY = String.prototype.toLowerCase;

try {
  var __instance = new __FACTORY;
  $FAIL('#1: var __FACTORY = String.prototype.toLowerCase; "__instance = new __FACTORY" lead to throwing exception');
} catch (e) {
  if ((e instanceof TypeError) !== true) {
    $ERROR('#1.1: var __FACTORY = String.prototype.toLowerCase; "__instance = new __FACTORY" throws a TypeError. Actual: ' + (e));
  }
};


text:
package stats

import (
	"time"

	"context"

	"github.com/aws/amazon-ecs-agent/agent/config"
	"github.com/aws/amazon-ecs-agent/agent/dockerclient/dockerapi"
	"github.com/aws/amazon-ecs-agent/agent/stats/resolver"
)

// ContainerStats encapsulates the raw CPU and memory utilization from cgroup fs.
type ContainerStats struct {
	cpuUsage          uint64
	memoryUsage       uint64
	storageReadBytes  uint64
	storageWriteBytes uint64
	networkStats      *NetworkStats
	timestamp         time.Time
}

// NetworkStats contains the network stats information for a container
type NetworkStats struct {
	RxBytes          uint64  `json:"rxBytes"`
	RxDropped        uint64  `json:"rxDropped"`
	RxErrors         uint64  `json:"rxErrors"`
	RxPackets        uint64  `json:"rxPackets"`
	TxBytes          uint64  `json:"txBytes"`
	TxDropped        uint64  `json:"txDropped"`
	TxErrors         uint64  `json:"txErrors"`
	TxPackets        uint64  `json:"txPackets"`
	RxBytesPerSecond float32 `json:"rxBytesPerSecond"`
	TxBytesPerSecond float32 `json:"txBytesPerSecond"`
}

// UsageStats abstracts the format in which the queue stores data.
type UsageStats struct {
	CPUUsagePerc      float32       `json:"cpuUsagePerc"`
	MemoryUsageInMegs uint32        `json:"memoryUsageInMegs"`
	StorageReadBytes  uint64        `json:"storageReadBytes"`
	StorageWriteBytes uint64        `json:"storageWriteBytes"`
	NetworkStats      *NetworkStats `json:"networkStats"`
	Timestamp         time.Time     `json:"timestamp"`
	cpuUsage          uint64
	// sent indicates if the stat has been sent to TACS already.
	sent bool
}

// ContainerMetadata contains meta-data information for a container.
type ContainerMetadata struct {
	DockerID    string `json:"-"`
	Name        string `json:"-"`
	NetworkMode string `json:"-"`
}

// TaskMetadata contains meta-data information for a task.
type TaskMetadata struct {
	TaskArn string `json:"-"`
	TaskId  string `json:"-"`
	// ContainerPID is the PID of the pause container in the awsvpc task.
	ContainerPID     string   `json:"-"`
	DeviceName       []string `json:"-"`
	NumberContainers int      `json:"-"`
}

// StatsContainer abstracts methods to gather and aggregate utilization data for a container.
type StatsContainer struct {
	containerMetadata *ContainerMetadata
	ctx               context.Context
	cancel            context.CancelFunc
	client            dockerapi.DockerClient
	statsQueue        *Queue
	resolver          resolver.ContainerMetadataResolver
	config            *config.Config
}

// taskDefinition encapsulates family and version strings for a task definition
type taskDefinition struct {
	family  string
	version string
}

type NetworkStatsPerSec struct {
	RxBytesPerSecond float32 `json:"rx_bytes_per_sec"`
	TxBytesPerSecond float32 `json:"tx_bytes_per_sec"`
}


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Interface net.nicholaswilliams.java.licensing.licensor.interfaces.spi.OutputDevice (LicenseManager 1.1.0 API Documentation)</title>
<meta name="date" content="2013-04-25">
<link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
net.nicholaswilliams.java.licensing.licensor.interfaces.spi.OutputDevice

Packages that use OutputDevice

Package
Description

net.nicholaswilliams.java.licensing.licensor.interfaces.cli.spi

net.nicholaswilliams.java.licensing.licensor.interfaces.spi

Uses of OutputDevice in net.nicholaswilliams.java.licensing.licensor.interfaces.cli.spi

Subinterfaces of OutputDevice in net.nicholaswilliams.java.licensing.licensor.interfaces.cli.spi

Modifier and Type
Interface and Description

interface
TextInterfaceDevice

Specifies an interface for interacting with text devices in order to abstract the details of interaction away from
 the application code.

Classes in net.nicholaswilliams.java.licensing.licensor.interfaces.cli.spi that implement OutputDevice

Modifier and Type
Class and Description

class
AbstractTextInterfaceDevice

An abstract implementation of TextInterfaceDevice that implements any common utilities among all interface
 devices.

class
ConsoleInterfaceDevice

The default implementation of TextInterfaceDevice.

Uses of OutputDevice in net.nicholaswilliams.java.licensing.licensor.interfaces.spi

Methods in net.nicholaswilliams.java.licensing.licensor.interfaces.spi with parameters of type OutputDevice

Modifier and Type
Method and Description

char[]
PasswordPrompter.promptForValidPassword(int minLength,
                      int maxLength,
                      String promptMessage,
                      String promptConfirmMessage,
                      String lengthError,
                      String matchError,
                      OutputDevice device)

Prompts for a valid password by asking for the password using PasswordPrompter.readPassword(String, Object...), checking
 its length against the constraints, asking for the password to be confirmed, and checking to make sure the
 passwords match.

char[]
AbstractPasswordPrompter.promptForValidPassword(int minLength,
                      int maxLength,
                      String promptMessage,
                      String promptConfirmMessage,
                      String lengthError,
                      String matchError,
                      OutputDevice device)

Prompts for a valid password by asking for the password using PasswordPrompter.readPassword(String, Object...), checking
 its length against the constraints, asking for the password to be confirmed, and checking to make sure the
 passwords match.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2010-2013 NWTS Java Code. All Rights 							Reserved. Licensed Under the Apache 							License version 2.0.


text:
#include "SkDiscardableMemory.h"
#include "SkResourceCache.h"
#include "Test.h"

namespace {
static void* gGlobalAddress;
struct TestingKey : public SkResourceCache::Key {
    intptr_t    fValue;

    TestingKey(intptr_t value) : fValue(value) {
        this->init(&gGlobalAddress, sizeof(fValue));
    }
};
struct TestingRec : public SkResourceCache::Rec {
    TestingRec(const TestingKey& key, uint32_t value) : fKey(key), fValue(value) {}

    TestingKey  fKey;
    intptr_t    fValue;

    const Key& getKey() const SK_OVERRIDE { return fKey; }
    size_t bytesUsed() const SK_OVERRIDE { return sizeof(fKey) + sizeof(fValue); }

    static bool Visitor(const SkResourceCache::Rec& baseRec, void* context) {
        const TestingRec& rec = static_cast<const TestingRec&>(baseRec);
        intptr_t* result = (intptr_t*)context;

        *result = rec.fValue;
        return true;
    }
};
}

static const int COUNT = 10;
static const int DIM = 256;

static void test_cache(skiatest::Reporter* reporter, SkResourceCache& cache, bool testPurge) {
    for (int i = 0; i < COUNT; ++i) {
        TestingKey key(i);
        intptr_t value = -1;

        REPORTER_ASSERT(reporter, !cache.find(key, TestingRec::Visitor, &value));
        REPORTER_ASSERT(reporter, -1 == value);

        cache.add(SkNEW_ARGS(TestingRec, (key, i)));

        REPORTER_ASSERT(reporter, cache.find(key, TestingRec::Visitor, &value));
        REPORTER_ASSERT(reporter, i == value);
    }

    if (testPurge) {
        // stress test, should trigger purges
        for (int i = 0; i < COUNT * 100; ++i) {
            TestingKey key(i);
            cache.add(SkNEW_ARGS(TestingRec, (key, i)));
        }
    }

    // test the originals after all that purging
    for (int i = 0; i < COUNT; ++i) {
        intptr_t value;
        (void)cache.find(TestingKey(i), TestingRec::Visitor, &value);
    }

    cache.setTotalByteLimit(0);
}

#include "SkDiscardableMemoryPool.h"

static SkDiscardableMemoryPool* gPool;
static SkDiscardableMemory* pool_factory(size_t bytes) {
    SkASSERT(gPool);
    return gPool->create(bytes);
}

DEF_TEST(ImageCache, reporter) {
    static const size_t defLimit = DIM * DIM * 4 * COUNT + 1024;    // 1K slop

    {
        SkResourceCache cache(defLimit);
        test_cache(reporter, cache, true);
    }
    {
        SkAutoTUnref<SkDiscardableMemoryPool> pool(
                SkDiscardableMemoryPool::Create(defLimit, NULL));
        gPool = pool.get();
        SkResourceCache cache(pool_factory);
        test_cache(reporter, cache, true);
    }
    {
        SkResourceCache cache(SkDiscardableMemory::Create);
        test_cache(reporter, cache, false);
    }
}

DEF_TEST(ImageCache_doubleAdd, r) {
    // Adding the same key twice should be safe.
    SkResourceCache cache(4096);

    TestingKey key(1);

    cache.add(SkNEW_ARGS(TestingRec, (key, 2)));
    cache.add(SkNEW_ARGS(TestingRec, (key, 3)));

    // Lookup can return either value.
    intptr_t value = -1;
    REPORTER_ASSERT(r, cache.find(key, TestingRec::Visitor, &value));
    REPORTER_ASSERT(r, 2 == value || 3 == value);
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<meta name="description" content="description"/>
<meta name="keywords" content="keywords"/>
<meta name="author" content="author"/>
<link rel="stylesheet" type="text/css" href="stylesheets/blog.css" media="screen"/>
<title>EDA Bootcamp</title>

		Pairing and Giving Feedback

Pairing

 One Emotion!

'Awkwardness'.  That is the one emotion that stands out for me.  The awkwardness of working with someone you have not met personally
				and know very little about. Someone who is a bit of a mystery, you don't know about their experience, knowledge or personality. The awkwardness of relating via the internet.  No body language or facial expressions to read.  The awful delay in remote sharing, that second or two delay can lead
				to difficult communication.  The awkwardness of not wanting to appear foolish but also not wanting to appear a 'know-it-all'.  Just awkward!

I haven't had much opportunity to pair yet.  The C# stream is quite small and all at different stages.  Pairing hasn't been a high priority as
				we all try to get on top of the content.  I did a face to face session that was far more satisfying and helpful than the hangout sessions.  It was more satisfying, helpful and productive.

 Kind Actionable and Specific Feedback

Respect is at the root of all good feedback.  If you respond to your pair in a respectful manner you will met the required principles of EDA pairing. The principles require our feedback to each other to be kind.  This means framing your response in a way that is designed to support and encourage without negativity or sharpness.  It should be considered and measured, in a tone that you would want to have others address you.

Actionable feedback means that you are able to actually do something as a result of the feedback.  If the feedback relates to something you have no control over then it is not actionable.  The recipient should be able to follow through with your advice or feedback and actually make a change as a result of receiving it.  It needs to be specific and do-able.

My experience of Feedback

 The lack of pairing has resulted in a lack of feedback.  In fact, no feedback!  However, I can give myself some feedback.  My feedback to myself is relax and just go with it!  Try to stick more with the navigator/driver scenario.  Also take your time.  I find the stimuli from multiple sources similtaneously a bit overwhelming.  Typing, thinking all at the same time is hard!

Writing feedback was a bit challenging.  It was difficult to come up with any actionable and specific to help my pair.  It is something that I will have to work on.  I found I didn't have much to contribute.

Conclusion

 I am a bit ambivalent about pairing in the very formal way that is prescribed in the course.  I would prefer a less formal situation where we
				were just able to share and teach each other.  I think it is good to have it prescribed so that we do work with a wide group of different individuals.  The tendency would be to spend time with the people you connect best with, which does not necessarily replicate the work environment.

Home

Technical Blogs

Web Site Design

Margins, Borders and Padding

Why JavaScript

C# Looping

C# Methods and things

C# Variable Scope

SQL

Cultural Blogs

Shareef's Fireside Chat

Thinking and Learning Styles

Large IT project failures

Pairing and Giving Feedback

Stereotype Threat

Affirmation and Stereotype Threat

Miscellaneous

Introduction Exercise

Baking a Carob Cake

Delving into Design - Wireframes

© 2014 design by Karen Larsen with help from Viktor Persson URL: http://templates.arcsin.se>


text:
=head1 LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2019] EMBL-European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

# This module replicates the generic UCSC parser for mouse specific data
# This prevents cross-mapping between species by treating each species as a separate source

package XrefParser::UCSC_mouse_parser;

use base qw( XrefParser::UCSCParser);

1;


text:
define([
    './rb-text-control.tpl.html'
], function (template) {

    /**
     * @ngdoc directive
     * @name rbTextControl
     * @module rb-text-control
     *
     * @restrict E
     *
     * @description Contains the label, input, help message and validation for a text input control.
     *
     * @usage
     * <hljs lang="html">
     *     <form name="userForm">
     *         <rb-text-control
     *             form="userForm"
     *             label="Your Name"
     *             placeholder="Enter your name..."
     *             name="name"
     *             type="text"
     *             ng-model="demoCtrl.data.name"
     *             on-change="demoCtrl.anyFunction(value)"
     *             is-required="true"
     *             help-message="This is what we will call you!">
     *         </rb-text-control>
     *     </form>
     * </hljs>
     *
     * @ngInject
     */
    function rbTextControlDirective () {

        return {
            scope: {
                isDisabled: '@',
                isRequired: '@',
                isReadonly: '@',
                label: '@',
                placeholder: '@',
                helpMessage: '@',
                ngModel: '=',
                form: '=',
                name: '@',
                type: '@',
                numberSteps: '@',
                small: '@',
                onChange: '&',
                modelOptions: '@',
                maxDigits: '@',
                maxValue: '@?',
                minValue: '@?'
            },
            restrict: 'E',
            replace: true,
            template: template,
            controller: /*@ngInject*/ function ($scope, $element) {
                $scope.modelOptions = {
                    updateOnDefault: true,
                    updateOn: 'default blur',
                    debounce: {
                        'default': 700,
                        'blur': 0
                    }
                };
                if ($scope.type === 'password') {
                    $scope.modelOptions.debounce.default = 0;
                }
                $scope.$watch(function watchmen () {
                    if (!$scope.ngModel) {
                        $scope.isPopulated = '';
                        return;
                    }
                    $scope.isPopulated = ($scope.ngModel.toString() !== '');
                });
            },
            link: function (scope, element, attributes) {
                scope.numberSteps = scope.numberSteps || 0;
                if (scope.type === 'currency') {
                    scope.inputType = 'number';
                    scope.numberSteps = scope.numberSteps || 0.01;
                } else {
                    scope.inputType = scope.type;
                }
            }
        };
    }

    return rbTextControlDirective;
});


text:
package com.itranswarp.jxrest;

/**
 * Internal use only.
 *
 * @author Michael Liao
 */
class ApiNotFoundException extends RuntimeException {

}


text:
var jsdom = require('../../lib/jsdom');
var serializeDocument = require('../../lib/jsdom').serializeDocument;

exports.tests = {
  notfound_getelementsbyclassname: function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    var p = doc.createElement("p");
    p.className = "unknown";
    body.appendChild(p);
    var elements = doc.getElementsByClassName("first-p");
    test.equal(elements.length, 0, "no results");
    test.done();
  },

  basic_getelementsbyclassname: function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    var p = doc.createElement("p");
    p.className = "first-p";
    body.appendChild(p);
    var elements = doc.getElementsByClassName("first-p");
    test.equal(elements.item(0), p, 'p and first-p');
    test.done();
  },

  multiple_getelementsbyclassname: function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    var p = doc.createElement("p");
    p.className = "first-p second third";
    body.appendChild(p);
    var first = doc.getElementsByClassName("first-p").item(0);
    var second = doc.getElementsByClassName("second").item(0);
    var third = doc.getElementsByClassName("third").item(0);
    test.equal(first, p, 'p and first-p');
    test.equal(second, p, 'p and second');
    test.equal(third, p, 'p and third');
    test.done();
  },

  testclassnameworksasexpected: function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    var p = doc.createElement("p");
    p.setAttribute("class", "first-p");
    test.equal(p.className, 'first-p', 'class attribute is same as className');
    p.className += " second";
    test.equal(p.className, 'first-p second', 'className getter/setter');
    test.done();
  },

  basic_getelementbyid: function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    var p = doc.createElement("p");
    p.id = "theid";
    body.appendChild(p);
    var element = doc.getElementById("theid");
    test.equal(element, p, "p and #theid");
    test.done();
  },

  nonexistant_getelementbyid: function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    var p = doc.createElement("p");
    p.id = "theid";
    body.appendChild(p);
    var element = doc.getElementById("non-existant-id");
    test.equal(element, null, "p and #theid");
    test.done();
  },

  remove_nonexistantattribute: function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    test.doesNotThrow(function(){ body.removeAttribute("non-existant"); }), 'setValue_throws_NO_MODIFICATION_ERR';
    test.done();
  },

  render_singletag: function(test) {
    var doc = jsdom.jsdom();

    var p = doc.createElement("p");
    var img = doc.createElement("img");
    p.appendChild(img);
    var out = p.outerHTML;
    test.equal(out.match(/<\/img>/), null, 'end tag not included in output')
    test.done();
  },

  render_specialchars: function(test) {
    var doc = jsdom.jsdom();

	  var p = doc.createElement("p");
	  var specials = '"<>&\xA0';
	  var escapedSpecials = '"<>& ';
	  p.setAttribute("specials", specials);
	  p.innerHTML = escapedSpecials;
	  var pp = doc.createElement("p");
	  pp.appendChild(p);
	  test.equal(pp.innerHTML, '<p specials=""<>& ">"<>&
');
	  test.done();
  },

  parse_scripttags: function(test) {
    var doc = jsdom.jsdom();
    var head = doc.head;

    var scriptHtml = '';
    head.innerHTML = scriptHtml;
    test.equal(scriptHtml, head.innerHTML, "original and processed");
    test.done();
  },

  parse_styletags: function(test) {
    var doc = jsdom.jsdom();
    var head = doc.head;
    var styleHtml = '';
    head.innerHTML = styleHtml;
    test.equal(styleHtml, head.innerHTML, "original and processed");
    test.done();
  },

  parse_doublespacetags: function(test) {
    var doc = jsdom.jsdom();
    var html = '';
    test.doesNotThrow(function(){ doc.write(html); }), 'setValue_throws_INVALID_CHARACTER_ERR';
    test.done();
  },

  serialize_styleattribute: function(test) {
    var doc = jsdom.jsdom();

    doc.documentElement.style.color = 'black';
    doc.documentElement.style.backgroundColor = 'white';
    test.equal(doc.documentElement.outerHTML,
      '');
    test.done();
  },

  innerhtml_removeallchildren: function(test) {
    var doc = jsdom.jsdom();
    var body = doc.body;

    body.appendChild(doc.createElement('p'));
    body.innerHTML = "";
    test.equal(body.childNodes.length, 0, 'still has children');
    test.done();
  },

  innerhtml_null: function(test) {
    var doc = jsdom.jsdom();
    var body = doc.body;

    body.appendChild(doc.createElement('p'));
    body.innerHTML = null;
    test.equal(body.childNodes.length, 0, 'still has children');
    test.done();
  },

  serialize_html5_doctype: function(test) {
    var doc = jsdom.jsdom();
    var dom = doc.implementation;

    var doctype = dom.createDocumentType('html', '', '');
    var document = dom.createDocument(null, null, doctype);
    var regexp = /^\s*<!DOCTYPE html>/;
    test.ok(regexp.test(serializeDocument(document)), 'HTML 5 doctype did not serialize correctly');
    test.done();
  },

  serialize_html4_strict_doctype: function(test) {
    var doc = jsdom.jsdom();
    var dom = doc.implementation;

    var doctype = dom.createDocumentType('html', '-//W3C//DTD HTML 4.01//EN', 'http://www.w3.org/TR/html4/strict.dtd');
    var document = dom.createDocument(null, null, doctype);
    var regexp = /^\s*<!DOCTYPE html PUBLIC "-\/\/W3C\/\/DTD HTML 4.01\/\/EN" "http:\/\/www.w3.org\/TR\/html4\/strict.dtd">/;
    test.ok(regexp.test(serializeDocument(document)), 'HTML 4 strict doctype did not serialize correctly');
    test.done();
  },

  serialize_system_doctype: function(test) {
    var doc = jsdom.jsdom();
    var dom = doc.implementation;

    var doctype = dom.createDocumentType('foo', '', 'foo.dtd');
    var document = dom.createDocument(null, null, doctype);
    var regexp = /^\s*<!DOCTYPE foo SYSTEM "foo.dtd">/;
    test.ok(regexp.test(serializeDocument(document)), 'Doctype did not serialize correctly');
    test.done();
  },

  serialize_doctype_containing_quotes: function(test) {
    var doc = jsdom.jsdom();
    var dom = doc.implementation;

    var doctype = dom.createDocumentType('foo', '', 'foo "bar".dtd');
    var document = dom.createDocument(null, null, doctype);
    var regexp = /^\s*<!DOCTYPE foo SYSTEM \'foo "bar".dtd\'>/;
    test.ok(regexp.test(serializeDocument(document)), 'Doctype did not serialize correctly');
    test.done();
  },

  parse_doctype_containing_newline : function(test) {
    var html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n \
             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n';

    var doc = jsdom.jsdom();
    doc.write(html);
    test.ok(!!doc.doctype, 'doctype should not be falsy');
    test.done();
  },

  basic_nodelist_indexOf : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    var p = doc.createElement("p");
    body.appendChild(p);
    var div = doc.createElement("div");
    body.appendChild(div);
    var span = doc.createElement("span");
    body.appendChild(span);
    var index = body.childNodes._toArray().indexOf(span);
    test.equal(index, 2, "indexOf 'span' in childNodes")
    test.done();
  },

  nonexistant_nodelist_indexOf : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    var p = doc.createElement("p");
    body.appendChild(p);
    var div = doc.createElement("div");
    p.appendChild(div);
    var index = body.childNodes._toArray().indexOf(div);
    test.equal(index, -1, "indexOf 'span' in childNodes")
    test.done();
  },

  input_fires_click_event : function(test) {
    doc = jsdom.jsdom(
      '' +
        '<input type="checkbox" id="check" value="check" />' +
      '')

    var checkbox = doc.getElementById("check");

    checkbox.addEventListener("click", function(event) {
      test.equal(event.type, "click", "event type");
      test.equal(event.target, checkbox, "event type");
      test.done();
    })

    checkbox.click();
  },

  basic_radio_selected : function(test) {
    doc = jsdom.jsdom(
      '' +
        '<input type="radio" id="rad0" value="rad0" name="radioGroup0" />' +
        '<input type="radio" id="rad1" value="rad1" name="radioGroup0" checked="checked" />' +
        '<input type="radio" id="rad2" value="rad2" name="radioGroup1" />' +
      '')

    var radio0 = doc.getElementById("rad0");
    var radio1 = doc.getElementById("rad1");
    var radio2 = doc.getElementById("rad2");

    test.ok(!radio0.checked, "radio not checked");
    test.ok(radio1.checked, "radio checked");
    test.ok(!radio2.checked, "radio not checked");

    radio2.click()
    radio0.click();
    test.ok(radio0.checked, "radio checked");
    test.ok(!radio1.checked, "radio not checked");
    test.ok(radio2.checked, "radio checked");

    radio1.click();
    test.ok(!radio0.checked, "radio not checked");
    test.ok(radio1.checked, "radio checked");
    test.ok(radio2.checked, "radio checked");

    test.done();
  },

  radio_no_click_deselected : function(test) {
    doc = jsdom.jsdom(
      '' +
        '<input type="radio" id="rad0" value="rad0" name="radioGroup0" />' +
      '')

    var radio0 = doc.getElementById("rad0");

    radio0.click();
    test.ok(radio0.checked, "radio checked");

    radio0.click();
    test.ok(radio0.checked, "radio checked");

    test.done();
  },

  select_set_value_updates_value : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    body.innerHTML =
      '<select id="selectElement">' +
        '<option value="x">x</option><option value="y">y</option>' +
      '</select>';

    var select = doc.getElementById("selectElement");

    select.value = "x"
    test.equal(select.value, "x", "select element value");

    select.value = "y"
    test.equal(select.value, "y", "select element selectedIndex");

    test.done();
  },

  select_set_value_updates_selectedIndex : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    body.innerHTML =
      '<select id="selectElement">' +
        '<option value="x">x</option><option value="y">y</option>' +
      '</select>';

    var select = doc.getElementById("selectElement");

    select.value = "x"
    test.equal(select.selectedIndex, 0, "select element selectedIndex");

    select.value = "y"
    test.equal(select.selectedIndex, 1, "select element selectedIndex");

    test.done();
  },

  select_set_value_updates_option_selected : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    body.innerHTML =
      '<select id="selectElement">' +
        '<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
      '</select>';

    var select = doc.getElementById("selectElement");
    var option0 = doc.getElementById("optX");
    var option1 = doc.getElementById("optY");

    select.value = "x";
    test.ok(option0.selected, "option element selected");

    select.value = "y";
    test.ok(option1.selected, "option element selected");

    test.done();
  },

  select_set_selectedIndex_updates_value : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    body.innerHTML =
      '<select id="selectElement">' +
        '<option value="x">x</option><option value="y">y</option>' +
      '</select>';

    var select = doc.getElementById("selectElement");

    select.selectedIndex = 0
    test.equal(select.value, "x", "select element selectedIndex");

    select.selectedIndex = 1
    test.equal(select.value, "y", "select element selectedIndex");

    test.done();
  },

  select_set_selectedIndex_updates_selectedIndex : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    body.innerHTML =
      '<select id="selectElement">' +
        '<option value="x">x</option><option value="y">y</option>' +
      '</select>';

    var select = doc.getElementById("selectElement");

    select.selectedIndex = 0
    test.equal(select.selectedIndex, 0, "select element selectedIndex");

    select.selectedIndex = 1
    test.equal(select.selectedIndex, 1, "select element selectedIndex");

    test.done();
  },

  select_set_selectedIndex_updates_option_selected : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    body.innerHTML =
      '<select id="selectElement">' +
        '<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
      '</select>';

    var select = doc.getElementById("selectElement");
    var option0 = doc.getElementById("optX");
    var option1 = doc.getElementById("optY");

    select.selectedIndex = 0;
    test.ok(option0.selected, "option element selected");
    test.ok(!option1.selected, "option element selected");

    select.selectedIndex = 1;
    test.ok(option1.selected, "option element selected");
    test.ok(!option0.selected, "option element selected");

    test.done();
  },

  select_set_option_selected_updates_value : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    body.innerHTML =
      '<select id="selectElement">' +
        '<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
      '</select>';

    var select = doc.getElementById("selectElement");
    var option0 = doc.getElementById("optX");
    var option1 = doc.getElementById("optY");

    select.selectedIndex = 0;
    option0.selected = true;
    test.equal(select.value, "x", "select element value");

    option1.selected = true;
    test.equal(select.value, "y", "select element value");

    test.done();
  },

  select_set_option_selected_updates_selectedIndex : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    body.innerHTML =
      '<select id="selectElement">' +
        '<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
      '</select>';

    var select = doc.getElementById("selectElement");
    var option0 = doc.getElementById("optX");
    var option1 = doc.getElementById("optY");

    option0.selected = true;
    test.equal(select.selectedIndex, 0, "select element selectedIndex");

    option1.selected = true;
    test.equal(select.selectedIndex, 1, "select element selectedIndex");

    test.done();
  },

  select_set_option_selected_updates_option_selected : function(test) {
    var doc = jsdom.jsdom();
    var html = doc.documentElement;
    var body = doc.body;

    body.innerHTML =
      '<select id="selectElement">' +
        '<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
      '</select>';

    var select = doc.getElementById("selectElement");
    var option0 = doc.getElementById("optX");
    var option1 = doc.getElementById("optY");

    option0.selected = true;
    test.ok(option0.selected, "option element selected");
    test.ok(!option1.selected, "option element selected");

    option1.selected = true;
    test.ok(option1.selected, "option element selected");
    test.ok(!option0.selected, "option element selected");

    test.done();
  },
};


text:
import React, { PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './ListItem.css';

function ListItem({ employee }) {
  if(!employee){ return (

); }

  return (

        {employee.firstname} {employee.lastname}

  );
}

export default withStyles(s)(ListItem);


text:
using TddEbook.TddToolkit.ImplementationDetails;
using TddEbook.TddToolkit.ImplementationDetails.Common;
using TddEbook.TddToolkit.ImplementationDetails.ConstraintAssertions;
using TddEbook.TddToolkit.ImplementationDetails.ConstraintAssertions.CustomCollections;

namespace TddEbook.TddToolkit.Helpers.Constraints.InequalityOperator
{
  public class StateBasedEqualityMustBeImplementedInTermsOfInequalityOperator : IConstraint
  {
    private readonly ValueObjectActivator _activator;

    public StateBasedEqualityMustBeImplementedInTermsOfInequalityOperator(ValueObjectActivator activator)
    {
      _activator = activator;
    }

    public void CheckAndRecord(ConstraintsViolations violations)
    {
      var instance1 = _activator.CreateInstanceAsValueObjectWithFreshParameters();
      var instance2 = _activator.CreateInstanceAsValueObjectWithPreviousParameters();

      RecordedAssertions.DoesNotThrow(() =>
        RecordedAssertions.False(Are.NotEqualInTermsOfInEqualityOperator(_activator.TargetType, instance1, instance2),
          "a != b should return false if both are created with the same arguments", violations),
          "a != b should return false if both are created with the same arguments", violations);
      RecordedAssertions.DoesNotThrow(() =>
        RecordedAssertions.False(Are.NotEqualInTermsOfInEqualityOperator(_activator.TargetType, instance2, instance1),
          "b != a should return false if both are created with the same arguments", violations),
          "b != a should return false if both are created with the same arguments", violations);
    }
  }
}


text:
require "spec_helper"

describe Tataki::Converter::Combine do
  let(:skk_converter) { Tataki::Converter::SkkJisyo.new }
  let(:alphabet_converter) { Tataki::Converter::Alphabet.new }

  describe ".to_kana" do
    shared_examples "converts_kana" do |sentence, kana|
      it "converts #{sentence.inspect} to #{kana.inspect}" do
        expect(converter.to_kana(sentence)).to eq(kana)
      end
    end

    context "when skk-jisyo + alphabet" do
      let(:converter) do
        Tataki::Converter::Combine.new(skk_converter, alphabet_converter)
      end

      include_examples "converts_kana", "X線の研究をしています", "えっくすせんのけんきゅうをしています"
      include_examples "converts_kana", "X線研究者", "えっくすせんけんきゅうしゃ"
      include_examples "converts_kana", "電気通信大学X線研究", "でんきつうしんだいがくえっくすせんけんきゅう"
      include_examples "converts_kana", "DNAは螺旋状の構造らしい", "でぃーえぬえーはらせんじょうのこうぞうらしい"
    end
  end
end


text:
let ctrl = () => {

};

ctrl.$inject = [];

export default app => app.controller('CategoryCtrl', ctrl);


text:
import java.util.ArrayList;
import java.util.List;

public class Data {

	private String[] data = new String[]{
			"A brilliant, festive study of JS Bach uses literature and painting to illuminate his 'dance-impregnated' music, writes Peter Conrad",
			"Fatima Bhutto on Malala Yousafzai's fearless and still-controversial memoir",
			"Grisham's sequel to A Time to Kill is a solid courtroom drama about racial prejudice marred by a flawless white hero, writes John O'Connell",
			"This strange repackaging of bits and pieces does the Man Booker winner no favours, says Sam Leith",
			"Another book with music related content"
	};

	public String[] get(String key) {

		List<String> listResult = new ArrayList<String>();

		for(String line: this.data){
			if(line.contains(key)) {
				listResult.add(line);
			}
		}

		String[] result = new String[listResult.size()];
		result = listResult.toArray(result);

		return result;
	}
}


text:
// --------------------------------------------------------------------------------------------
// <copyright file="FunctionElementSelector.cs" company="Effort Team">
//     Copyright (C) Effort Team
//
//     Permission is hereby granted, free of charge, to any person obtaining a copy
//     of this software and associated documentation files (the "Software"), to deal
//     in the Software without restriction, including without limitation the rights
//     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//     copies of the Software, and to permit persons to whom the Software is
//     furnished to do so, subject to the following conditions:
//
//     The above copyright notice and this permission notice shall be included in
//     all copies or substantial portions of the Software.
//
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//     THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------

namespace Effort.Internal.StorageSchema
{
    using System;
    using System.Collections.Generic;
    using System.Xml.Linq;
    using Effort.Internal.Common.XmlProcessing;

    internal class FunctionElementSelector : IElementSelector
    {
        private StorageSchemaContentNameProvider nameProvider;

        public FunctionElementSelector(StorageSchemaContentNameProvider nameProvider)
        {
            if (nameProvider == null)
            {
                throw new ArgumentNullException("nameProvider");
            }

            this.nameProvider = nameProvider;
        }

        public IEnumerable<XElement> SelectElements(XElement root)
        {
            if (root == null)
            {
                throw new ArgumentNullException("root");
            }

            if (root.Name != this.nameProvider.SchemaElement)
            {
                throw new ArgumentException("", "root");
            }

            return root.Elements(this.nameProvider.FunctionElement);
        }
    }
}


text:
"use strict";

const { BrokerOptionsError } = require("../../errors");

const Types = {
	Base: require("./base"),
	Counter: require("./counter"),
	Gauge: require("./gauge"),
	Histogram: require("./histogram"),
	Info: require("./info"),
};

/**
 * Get MetricType class by name.
 *
 * @param {String} name
 * @returns
 */
function getByName(name) {
	/* istanbul ignore next */
	if (!name)
		return null;

	let n = Object.keys(Types).find(n => n.toLowerCase() == name.toLowerCase());
	if (n)
		return Types[n];
}

/**
 * Resolve metric type by name
 *
 * @param {string} type
 * @returns {BaseMetric}
 * @memberof ServiceBroker
 */
function resolve(type) {
	const TypeClass = getByName(type);
	if (!TypeClass)
		throw new BrokerOptionsError(`Invalid metric type '${type}'.`, { type });

	return TypeClass;
}

function register(name, value) {
	Types[name] = value;
}

module.exports = Object.assign(Types, { resolve, register });


text:
<?php

namespace OPNsense\AcmeClient\LeAutomation;

use OPNsense\AcmeClient\LeAutomationInterface;
use OPNsense\AcmeClient\LeUtils;

/**
 * Run selected configd command
 * @package OPNsense\AcmeClient
 */
class ConfigdGeneric extends Base implements LeAutomationInterface
{
    public function prepare()
    {
        // Make sure a configd command was specified.
        if (empty((string)$this->config->configd_generic_command)) {
            LeUtils::log_error('no configd command specified for automation: ' . $this->config->name);
            return false;
        }

        $this->command = (string)$this->config->configd_generic_command;
        return true;
    }
}


text:
import React from "react";
import {FormGroup} from "helpers/reactstrap";
import {SignalPicker} from "../views/CommShortRange/signalsCore";
export default ({updateArgs, args}) => {
  const shortRangeComm = {signals: args.signals || []};
  return (
    <FormGroup
      className="macro-commUpdateSignals"
      style={{minHeight: "50vh", height: "100%"}}
    >
      <SignalPicker
        shortRangeComm={shortRangeComm}
        saveSignals={signals => updateArgs("signals", signals)}
      />
    </FormGroup>
  );
};