text:
"""
Resource Scheduling Offhours
============================

Custodian provides for time based filters, that allow for taking periodic
action on a resource, with resource schedule customization based on tag values.
A common use is offhours scheduling for asgs, and instances.

Features
========

- Flexible offhours scheduling with opt-in, opt-out selection, and timezone
  support.
- Resume during offhours support.
- Can be combined with other filters to get a particular set (
  resources with tag, vpc, etc).
- Can be combined with arbitrary actions

Policy Configuration
====================

We provide an `onhour` and `offhour` time filter, each should be used in a
different policy, they support the same configuration options

 - :weekends: default true, whether to leave resources off for the weekend
 - :weekend-only: default false, whether to turn the resource off only on the
   weekend
 - :default_tz: which tz to utilize when evaluating time
 - :tag: default maid_offhours, which resource tag key to look for the
   resource's schedule.
 - :opt-out: applies the default schedule to resource which do not specify
   any value. a value of `off` to disable/exclude the resource.

The default off hours and on hours are specified per the policy configuration
along with the opt-in/opt-out behavior. Resources can specify the timezone
that they wish to have this scheduled utilized with::

Tag Based Configuration
=======================

Note the tag name is configurable per policy configuration, examples below use
default tag name, ie. custodian_downtime.

- custodian_downtime:

An empty tag value implies night and weekend offhours using the default
time zone configured in the policy (tz=est if unspecified).

- custodian_downtime: tz=pt

Note all timezone aliases are referenced to a locality to ensure taking into
account local daylight savings time (if any).

- custodian_downtime: tz=Americas/Los_Angeles

A geography can be specified but must be in the time zone database.

Per http://www.iana.org/time-zones

- custodian_downtime: off

If offhours is configured to run in opt-out mode, this tag can be specified
to disable offhours on a given instance.

Policy examples
===============

Turn ec2 instances on and off

.. code-block:: yaml

   policies:
     - name: offhours-stop
       resource: ec2
       filters:
          - type: offhour
       actions:
         - stop

     - name: offhours-start
       resource: ec2
       filters:
         - type: onhour
       actions:
         - start

Here's doing the same with auto scale groups

.. code-block:: yaml

    policies:
      - name: asg-offhours-stop
        resource: ec2
        filters:
           - offhour
        actions:
           - suspend
      - name: asg-onhours-start
        resource: ec2
        filters:
           - onhour
        actions:
           - resume

Options
=======

- tag: the tag name to use when configuring
- default_tz: the default timezone to use when interpreting offhours
- offhour: the time to turn instances off, specified in 0-24
- onhour: the time to turn instances on, specified in 0-24
- opt-out: default behavior is opt in, as in ``tag`` must be present,
  with opt-out: true, the tag doesn't need to be present.

.. code-block:: yaml

   policies:
     - name: offhours-stop
       resource: ec2
       filters:
         - type: offhour
           tag: downtime
           onhour: 8
           offhour: 20

"""

# note we have to module import for our testing mocks
import datetime
import logging
from os.path import join

from dateutil import zoneinfo

from c7n.filters import Filter, FilterValidationError
from c7n.utils import type_schema, dumps

log = logging.getLogger('custodian.offhours')

class Time(Filter):

    schema = {
        'type': 'object',
        'properties': {
            'tag': {'type': 'string'},
            'default_tz': {'type': 'string'},
            'weekends': {'type': 'boolean'},
            'weekends-only': {'type': 'boolean'},
            'opt-out': {'type': 'boolean'},
            'debug': {'type': 'boolean'},
            }
        }

    time_type = None

    # Defaults and constants
    DEFAULT_TAG = "maid_offhours"
    DEFAULT_TZ = 'et'

    TZ_ALIASES = {
        'pdt': 'America/Los_Angeles',
        'pt': 'America/Los_Angeles',
        'pst': 'America/Los_Angeles',
        'est': 'America/New_York',
        'edt': 'America/New_York',
        'et': 'America/New_York',
        'cst': 'America/Chicago',
        'cdt': 'America/Chicago',
        'ct': 'America/Chicago',
        'mt': 'America/Denver',
        'gmt': 'Europe/London',
        'gt': 'Europe/London'}

    def __init__(self, data, manager=None):
        super(Time, self).__init__(data, manager)
        self.default_tz = self.data.get('default_tz', self.DEFAULT_TZ)
        self.weekends = self.data.get('weekends', True)
        self.weekends_only = self.data.get('weekends-only', False)
        self.opt_out = self.data.get('opt-out', False)
        self.tag_key = self.data.get('tag', self.DEFAULT_TAG).lower()
        self.default_schedule = self.get_default_schedule()
        self.parser = ScheduleParser(self.default_schedule)

        self.id_key = None

        self.opted_out = []
        self.parse_errors = []
        self.enabled_count = 0

    def validate(self):
        if self.get_tz(self.default_tz) is None:
            raise FilterValidationError(
                "Invalid timezone specified %s" % self.default_tz)
        hour = self.data.get("%shour" % self.time_type, self.DEFAULT_HR)
        if hour not in self.parser.VALID_HOURS:
            raise FilterValidationError("Invalid hour specified %s" % hour)
        return self

    def process(self, resources, event=None):
        resources = super(Time, self).process(resources)
        if self.parse_errors and self.manager and self.manager.log_dir:
            self.log.warning("parse errors %d", len(self.parse_errors))
            with open(join(
                    self.manager.log_dir, 'parse_errors.json'), 'w') as fh:
                dumps(self.parse_errors, fh=fh)
            self.parse_errors = []
        if self.opted_out and self.manager and self.manager.log_dir:
            self.log.debug("disabled count %d", len(self.opted_out))
            with open(join(
                    self.manager.log_dir, 'opted_out.json'), 'w') as fh:
                dumps(self.opted_out, fh=fh)
            self.opted_out = []
        return resources

    def __call__(self, i):
        value = self.get_tag_value(i)

        # Sigh delayed init, due to circle dep, process/init would be better but
        # unit testing is calling this direct.
        if self.id_key is None:
            self.id_key = (
                self.manager is None and 'InstanceId'
                or self.manager.get_model().id)

        # The resource tag is not present, if we're not running in an opt-out
        # mode, we're done.
        if value is False:
            if not self.opt_out:
                return False
            value = "" # take the defaults

        # Resource opt out, track and record
        if 'off' == value:
            self.opted_out.append(i)
            return False
        else:
            self.enabled_count += 1

        try:
            return self.process_resource_schedule(i, value)
        except:
            log.exception(
                "%s failed to process resource:%s value:%s",
                self.__class__.__name__, i[self.id_key], value)
            return False

    def process_resource_schedule(self, i, value):
        """Does the resource tag schedule and policy match the current time."""
        rid = i[self.id_key]
        if self.parser.has_resource_schedule(value):
            schedule = self.parser.parse(value)
        else:
            schedule = self.default_schedule

        if schedule is None:
            log.warning(
                "Invalid schedule on resource:%s value:%s", rid, value)
            self.parse_errors.append((rid, value))
            return False

        tz = self.get_tz(schedule['tz'])
        if not tz:
            log.warning(
                "Could not resolve tz on resource:%s value:%s", rid, value)
            self.parse_errors.append((rid, value))
            return False

        now = datetime.datetime.now(tz).replace(
            minute=0, second=0, microsecond=0)
        return self.match(now, schedule)

    def match(self, now, schedule):
        time = schedule.get(self.time_type, ())
        for item in time:
            days, hour = item.get("days"), item.get('hour')
            if now.weekday() in days and now.hour == hour:
                return True
        return False

    def get_tag_value(self, i):
        """Get the resource's tag value specifying its schedule."""
        # Look for the tag, Normalize tag key and tag value
        found = False
        for t in i.get('Tags', ()):
            if t['Key'].lower() == self.tag_key:
                found = t['Value']
        if found is False:
            return False
        # utf8, or do translate tables via unicode ord mapping
        value = found.lower().encode('utf8')
        # Some folks seem to be interpreting the docs quote marks as
        # literal for values.
        value = value.strip("'").strip('"').translate(None, ' ')
        return value

    @classmethod
    def get_tz(cls, tz):
        return zoneinfo.gettz(cls.TZ_ALIASES.get(tz, tz))

    def get_default_schedule(self):
        raise NotImplementedError("use subclass")

class OffHour(Time):

    schema = type_schema(
        'offhour', rinherit=Time.schema, required=['offhour', 'default_tz'],
        offhour={'type': 'integer', 'minimum': 0, 'maximum': 24})
    time_type = "off"

    DEFAULT_HR = 19

    def get_default_schedule(self):
        default = {'tz': self.default_tz, self.time_type: [
            {'hour': self.data.get(
                "%shour" % self.time_type, self.DEFAULT_HR)}]}
        if self.weekends_only:
            default[self.time_type][0]['days'] = [4]
        elif self.weekends:
            default[self.time_type][0]['days'] = range(5)
        else:
            default[self.time_type][0]['days'] = range(7)
        return default

class OnHour(Time):

    schema = type_schema(
        'onhour', rinherit=Time.schema, required=['onhour', 'default_tz'],
        onhour={'type': 'integer', 'minimum': 0, 'maximum': 24})
    time_type = "on"

    DEFAULT_HR = 7

    def get_default_schedule(self):
        default = {'tz': self.default_tz, self.time_type: [
            {'hour': self.data.get(
                "%shour" % self.time_type, self.DEFAULT_HR)}]}
        if self.weekends_only:
            # turn on monday
            default[self.time_type][0]['days'] = [0]
        elif self.weekends:
            default[self.time_type][0]['days'] = range(5)
        else:
            default[self.time_type][0]['days'] = range(7)
        return default

class ScheduleParser(object):
    """Parses tag values for custom on/off hours schedules.

    At the minimum the ``on`` and ``off`` values are required. Each of
    these must be seperated by a ``;`` in the format described below.

    **Schedule format**::

        # up mon-fri from 7am-7pm; eastern time
        off=(M-F,19);on=(M-F,7)
        # up mon-fri from 6am-9pm; up sun from 10am-6pm; pacific time
        off=[(M-F,21),(U,18)];on=[(M-F,6),(U,10)];tz=pt

    **Possible values**:

        +------------+----------------------+
        | field      | values               |
        +============+======================+
        | days       | M, T, W, H, F, S, U  |
        +------------+----------------------+
        | hours      | 0, 1, 2, ..., 22, 23 |
        +------------+----------------------+

        Days can be specified in a range (ex. M-F).

    If the timezone is not supplied, it is assumed ET (eastern time), but this
    default can be configurable.

    **Parser output**:

    The schedule parser will return a ``dict`` or ``None`` (if the schedule is
    invalid)::

        # off=[(M-F,21),(U,18)];on=[(M-F,6),(U,10)];tz=pt
        {
          off: [
            { days: "M-F", hour: 21 },
            { days: "U", hour: 18 }
          ],
          on: [
            { days: "M-F", hour: 6 },
            { days: "U", hour: 10 }
          ],
          tz: "pt"
        }

    """

    DAY_MAP = {'m': 0, 't': 1, 'w': 2, 'h': 3, 'f': 4, 's': 5, 'u': 6}
    VALID_HOURS = tuple(range(24))

    def __init__(self, default_schedule):
        self.default_schedule = default_schedule
        self.cache = {}

    def parse(self, tag_value):
        # check the cache
        if tag_value in self.cache:
            return self.cache[tag_value]

        schedule = {}

        # parse schedule components
        pieces = tag_value.split(';')
        for piece in pieces:
            kv = piece.split('=')
            # components must by key=value
            if not len(kv) == 2:
                return None
            key, value = kv
            if key not in ('on', 'off', 'tz'):
                return None
            if key != 'tz':
                value = self.parse_resource_schedule(value)
            if value is None:
                return None
            schedule[key] = value

        # add default timezone, if none supplied or blank
        if not schedule.get('tz'):
            schedule['tz'] = self.default_schedule['tz']

        # cache
        self.cache[tag_value] = schedule
        return schedule

    @staticmethod
    def has_resource_schedule(tag_value):
        if 'off=' in tag_value and 'on=' in tag_value:
            return True
        return False

    def parse_resource_schedule(self, lexeme):
        parsed = []
        exprs = lexeme.translate(None, '[]').split(',(')
        for e in exprs:
            tokens = e.translate(None, '()').split(',')
            # custom hours must have two parts: (<days>, <hour>)
            if not len(tokens) == 2:
                return None
            if not tokens[1].isdigit():
                return None
            hour = int(tokens[1])
            if hour not in self.VALID_HOURS:
                return None
            days = self.expand_day_range(tokens[0])
            if not days:
                return None
            parsed.append({'days': days, 'hour': hour})
        return parsed

    def expand_day_range(self, days):
        # single day specified
        if days in self.DAY_MAP:
            return [self.DAY_MAP[days]]
        day_range = [d for d in map(self.DAY_MAP.get, days.split('-'))
                     if d is not None]
        if not len(day_range) == 2:
            return None
        # support wrap around days aka friday-monday = 4,5,6,0
        if day_range[0] > day_range[1]:
            return range(day_range[0], 7) + range(day_range[1]+1)
        return range(min(day_range), max(day_range) + 1)


text:
"use strict";
var assign = require('../../../../lib/utils').assign;

exports['Correctly execute count command against replicaset with a single member'] = {
  metadata: {
    requires: {
      generators: true,
      topology: "single"
    }
  },

  test: function(configuration, test) {
    var ReplSet = configuration.require.ReplSet,
      ObjectId = configuration.require.BSON.ObjectId,
      ReadPreference = configuration.require.ReadPreference,
      Connection = require('../../../../lib/connection/connection'),
      Long = configuration.require.BSON.Long,
      co = require('co'),
      mockupdb = require('../../../mock');

    // Contain mock server
    var primaryServer = null;
    var firstSecondaryServer = null;
    var secondSecondaryServer = null;
    var arbiterServer = null;
    var running = true;
    var currentIsMasterIndex = 0;

    // Default message fields
    var defaultFields = {
      "setName": "rs", "setVersion": 1, "electionId": new ObjectId(),
      "maxBsonObjectSize" : 16777216, "maxMessageSizeBytes" : 48000000,
      "maxWriteBatchSize" : 1000, "localTime" : new Date(), "maxWireVersion" : 4,
      "minWireVersion" : 0, "ok" : 1, "hosts": ["localhost:32000"]
    }

    // Primary server states
    var primary = [assign({}, defaultFields, {
      "ismaster":true, "secondary":false, "me": "localhost:32000", "primary": "localhost:32000", "tags" : { "loc" : "ny" }
    })];

    // Boot the mock
    co(function*() {
      primaryServer = yield mockupdb.createServer(32000, 'localhost');

      // Primary state machine
      co(function*() {
        while(running) {
          var request = yield primaryServer.receive();
          var doc = request.document;
          // console.log("======== doc")
          // console.dir(doc)

          if(doc.ismaster) {
            request.reply(primary[currentIsMasterIndex]);
          } else if(doc.count) {
            request.reply({ok:1, n:1});
          }
        }
      }).catch(function(err) {
        // console.log(err.stack);
      });
    });

    Connection.enableConnectionAccounting();
    // Attempt to connect
    var server = new ReplSet([{ host: 'localhost', port: 32000 }], {
        setName: 'rs',
        connectionTimeout: 3000,
        socketTimeout: 0,
        haInterval: 2000,
        size: 1,
        disconnectHandler: {
          add: function() {}, execute: function() {}
        }
    });

    server.on('connect', function(server) {
      server.command('test.test', {count: 'test'}, function() {
        primaryServer.destroy();
        server.destroy();
        running = false;
        test.done();
      });
    });

    // Gives proxies a chance to boot up
    setTimeout(function() {
      server.connect();
    }, 100)
  }
}

exports['Correctly execute count command against replicaset with a single member and secondaryPreferred'] = {
  metadata: {
    requires: {
      generators: true,
      topology: "single"
    }
  },

  test: function(configuration, test) {
    var ReplSet = configuration.require.ReplSet,
      ObjectId = configuration.require.BSON.ObjectId,
      ReadPreference = configuration.require.ReadPreference,
      Connection = require('../../../../lib/connection/connection'),
      Long = configuration.require.BSON.Long,
      co = require('co'),
      mockupdb = require('../../../mock');

    // Contain mock server
    var primaryServer = null;
    var firstSecondaryServer = null;
    var secondSecondaryServer = null;
    var arbiterServer = null;
    var running = true;
    var currentIsMasterIndex = 0;

    // Default message fields
    var defaultFields = {
      "setName": "rs", "setVersion": 1, "electionId": new ObjectId(),
      "maxBsonObjectSize" : 16777216, "maxMessageSizeBytes" : 48000000,
      "maxWriteBatchSize" : 1000, "localTime" : new Date(), "maxWireVersion" : 4,
      "minWireVersion" : 0, "ok" : 1, "hosts": ["localhost:32000"]
    }

    // Primary server states
    var primary = [assign({}, defaultFields, {
      "ismaster":true, "secondary":false, "me": "localhost:32000", "primary": "localhost:32000", "tags" : { "loc" : "ny" }
    })];

    // Boot the mock
    co(function*() {
      primaryServer = yield mockupdb.createServer(32000, 'localhost');

      // Primary state machine
      co(function*() {
        while(running) {
          var request = yield primaryServer.receive();
          var doc = request.document;
          // console.log("======== doc")
          // console.dir(doc)

          if(doc.ismaster) {
            request.reply(primary[currentIsMasterIndex]);
          } else if(doc.count) {
            request.reply({ok:1, n:1});
          }
        }
      }).catch(function(err) {
        console.log(err.stack);
      });
    });

    Connection.enableConnectionAccounting();
    // Attempt to connect
    var server = new ReplSet([{ host: 'localhost', port: 32000 }], {
        setName: 'rs',
        connectionTimeout: 3000,
        socketTimeout: 0,
        haInterval: 2000,
        size: 1,
        disconnectHandler: {
          add: function() {}, execute: function() {}
        }
    });

    server.on('connect', function(server) {
      server.command('test.test', {count: 'test'}, {readPreference: ReadPreference.secondaryPreferred}, function() {
        primaryServer.destroy();
        server.destroy();
        running = false;
        test.done();
      });
    });

    // Gives proxies a chance to boot up
    setTimeout(function() {
      server.connect();
    }, 100)
  }
}

redpajama_set_name: RedPajamaGithub


text:
package acceptance

import (
	"path/filepath"
	"testing"

	"golang.org/x/net/context"

	"github.com/cockroachdb/cockroach/pkg/acceptance/cluster"
	"github.com/cockroachdb/cockroach/pkg/util/log"
	"github.com/docker/docker/api/types/container"
)

const testGlob = "../cli/interactive_tests/test*.tcl"
const containerPath = "/go/src/github.com/cockroachdb/cockroach/cli/interactive_tests"

var cmdBase = []string{
	"/usr/bin/env",
	"COCKROACH_SKIP_UPDATE_CHECK=1",
	"/usr/bin/expect",
}

func TestDockerCLI(t *testing.T) {
	containerConfig := container.Config{
		Image: postgresTestImage,
		Cmd:   []string{"stat", cluster.CockroachBinaryInContainer},
	}
	ctx := context.Background()
	if err := testDockerOneShot(ctx, t, "cli_test", containerConfig); err != nil {
		t.Skipf(`TODO(dt): No binary in one-shot container, see #6086: %s`, err)
	}

	paths, err := filepath.Glob(testGlob)
	if err != nil {
		t.Fatal(err)
	}
	if len(paths) == 0 {
		t.Fatalf("no testfiles found (%v)", testGlob)
	}

	verbose := testing.Verbose() || log.V(1)
	for _, p := range paths {
		testFile := filepath.Base(p)
		testPath := filepath.Join(containerPath, testFile)
		t.Run(testFile, func(t *testing.T) {
			cmd := cmdBase
			if verbose {
				cmd = append(cmd, "-d")
			}
			cmd = append(cmd, "-f", testPath, cluster.CockroachBinaryInContainer)
			containerConfig.Cmd = cmd
			if err := testDockerOneShot(ctx, t, "cli_test", containerConfig); err != nil {
				t.Error(err)
			}
		})
	}
}


text:
/**
 * Shuffles the contents of the given array using the Fisher-Yates implementation.
 *
 * The original array is modified directly and returned.
 *
 * @function Phaser.Utils.Array.Shuffle
 * @since 3.0.0
 *
 * @generic T
 * @genericUse {T[]} - [array,$return]
 *
 * @param {T[]} array - The array to shuffle. This array is modified in place.
 *
 * @return {T[]} The shuffled array.
 */
var Shuffle = function (array)
{
    for (var i = array.length - 1; i > 0; i--)
    {
        var j = Math.floor(Math.random() * (i + 1));
        var temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }

    return array;
};

module.exports = Shuffle;


text:
// MESSAGE SERIAL_UDB_EXTRA_F5 PACKING

#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5 173

MAVPACKED(
typedef struct __mavlink_serial_udb_extra_f5_t {
 float sue_YAWKP_AILERON; /*< Serial UDB YAWKP_AILERON Gain for Proporional control of navigation*/
 float sue_YAWKD_AILERON; /*< Serial UDB YAWKD_AILERON Gain for Rate control of navigation*/
 float sue_ROLLKP; /*< Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization*/
 float sue_ROLLKD; /*< Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization*/
 float sue_YAW_STABILIZATION_AILERON; /*< YAW_STABILIZATION_AILERON Proportional control*/
 float sue_AILERON_BOOST; /*< Gain For Boosting Manual Aileron control When Plane Stabilized*/
}) mavlink_serial_udb_extra_f5_t;

#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN 24
#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN 24
#define MAVLINK_MSG_ID_173_LEN 24
#define MAVLINK_MSG_ID_173_MIN_LEN 24

#define MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC 121
#define MAVLINK_MSG_ID_173_CRC 121

#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F5 { \
	173, \
	"SERIAL_UDB_EXTRA_F5", \
	6, \
	{  { "sue_YAWKP_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAWKP_AILERON) }, \
         { "sue_YAWKD_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAWKD_AILERON) }, \
         { "sue_ROLLKP", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f5_t, sue_ROLLKP) }, \
         { "sue_ROLLKD", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f5_t, sue_ROLLKD) }, \
         { "sue_YAW_STABILIZATION_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAW_STABILIZATION_AILERON) }, \
         { "sue_AILERON_BOOST", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_serial_udb_extra_f5_t, sue_AILERON_BOOST) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_SERIAL_UDB_EXTRA_F5 { \
	"SERIAL_UDB_EXTRA_F5", \
	6, \
	{  { "sue_YAWKP_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAWKP_AILERON) }, \
         { "sue_YAWKD_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAWKD_AILERON) }, \
         { "sue_ROLLKP", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_serial_udb_extra_f5_t, sue_ROLLKP) }, \
         { "sue_ROLLKD", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_serial_udb_extra_f5_t, sue_ROLLKD) }, \
         { "sue_YAW_STABILIZATION_AILERON", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_serial_udb_extra_f5_t, sue_YAW_STABILIZATION_AILERON) }, \
         { "sue_AILERON_BOOST", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_serial_udb_extra_f5_t, sue_AILERON_BOOST) }, \
         } \
}
#endif

/**
 * @brief Pack a serial_udb_extra_f5 message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param sue_YAWKP_AILERON Serial UDB YAWKP_AILERON Gain for Proporional control of navigation
 * @param sue_YAWKD_AILERON Serial UDB YAWKD_AILERON Gain for Rate control of navigation
 * @param sue_ROLLKP Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization
 * @param sue_ROLLKD Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization
 * @param sue_YAW_STABILIZATION_AILERON YAW_STABILIZATION_AILERON Proportional control
 * @param sue_AILERON_BOOST Gain For Boosting Manual Aileron control When Plane Stabilized
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_serial_udb_extra_f5_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
						       float sue_YAWKP_AILERON, float sue_YAWKD_AILERON, float sue_ROLLKP, float sue_ROLLKD, float sue_YAW_STABILIZATION_AILERON, float sue_AILERON_BOOST)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN];
	_mav_put_float(buf, 0, sue_YAWKP_AILERON);
	_mav_put_float(buf, 4, sue_YAWKD_AILERON);
	_mav_put_float(buf, 8, sue_ROLLKP);
	_mav_put_float(buf, 12, sue_ROLLKD);
	_mav_put_float(buf, 16, sue_YAW_STABILIZATION_AILERON);
	_mav_put_float(buf, 20, sue_AILERON_BOOST);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN);
#else
	mavlink_serial_udb_extra_f5_t packet;
	packet.sue_YAWKP_AILERON = sue_YAWKP_AILERON;
	packet.sue_YAWKD_AILERON = sue_YAWKD_AILERON;
	packet.sue_ROLLKP = sue_ROLLKP;
	packet.sue_ROLLKD = sue_ROLLKD;
	packet.sue_YAW_STABILIZATION_AILERON = sue_YAW_STABILIZATION_AILERON;
	packet.sue_AILERON_BOOST = sue_AILERON_BOOST;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN);
#endif

	msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC);
}

/**
 * @brief Pack a serial_udb_extra_f5 message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param sue_YAWKP_AILERON Serial UDB YAWKP_AILERON Gain for Proporional control of navigation
 * @param sue_YAWKD_AILERON Serial UDB YAWKD_AILERON Gain for Rate control of navigation
 * @param sue_ROLLKP Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization
 * @param sue_ROLLKD Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization
 * @param sue_YAW_STABILIZATION_AILERON YAW_STABILIZATION_AILERON Proportional control
 * @param sue_AILERON_BOOST Gain For Boosting Manual Aileron control When Plane Stabilized
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_serial_udb_extra_f5_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
							   mavlink_message_t* msg,
						           float sue_YAWKP_AILERON,float sue_YAWKD_AILERON,float sue_ROLLKP,float sue_ROLLKD,float sue_YAW_STABILIZATION_AILERON,float sue_AILERON_BOOST)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN];
	_mav_put_float(buf, 0, sue_YAWKP_AILERON);
	_mav_put_float(buf, 4, sue_YAWKD_AILERON);
	_mav_put_float(buf, 8, sue_ROLLKP);
	_mav_put_float(buf, 12, sue_ROLLKD);
	_mav_put_float(buf, 16, sue_YAW_STABILIZATION_AILERON);
	_mav_put_float(buf, 20, sue_AILERON_BOOST);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN);
#else
	mavlink_serial_udb_extra_f5_t packet;
	packet.sue_YAWKP_AILERON = sue_YAWKP_AILERON;
	packet.sue_YAWKD_AILERON = sue_YAWKD_AILERON;
	packet.sue_ROLLKP = sue_ROLLKP;
	packet.sue_ROLLKD = sue_ROLLKD;
	packet.sue_YAW_STABILIZATION_AILERON = sue_YAW_STABILIZATION_AILERON;
	packet.sue_AILERON_BOOST = sue_AILERON_BOOST;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN);
#endif

	msg->msgid = MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC);
}

/**
 * @brief Encode a serial_udb_extra_f5 struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param serial_udb_extra_f5 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_serial_udb_extra_f5_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_serial_udb_extra_f5_t* serial_udb_extra_f5)
{
	return mavlink_msg_serial_udb_extra_f5_pack(system_id, component_id, msg, serial_udb_extra_f5->sue_YAWKP_AILERON, serial_udb_extra_f5->sue_YAWKD_AILERON, serial_udb_extra_f5->sue_ROLLKP, serial_udb_extra_f5->sue_ROLLKD, serial_udb_extra_f5->sue_YAW_STABILIZATION_AILERON, serial_udb_extra_f5->sue_AILERON_BOOST);
}

/**
 * @brief Encode a serial_udb_extra_f5 struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param serial_udb_extra_f5 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_serial_udb_extra_f5_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_serial_udb_extra_f5_t* serial_udb_extra_f5)
{
	return mavlink_msg_serial_udb_extra_f5_pack_chan(system_id, component_id, chan, msg, serial_udb_extra_f5->sue_YAWKP_AILERON, serial_udb_extra_f5->sue_YAWKD_AILERON, serial_udb_extra_f5->sue_ROLLKP, serial_udb_extra_f5->sue_ROLLKD, serial_udb_extra_f5->sue_YAW_STABILIZATION_AILERON, serial_udb_extra_f5->sue_AILERON_BOOST);
}

/**
 * @brief Send a serial_udb_extra_f5 message
 * @param chan MAVLink channel to send the message
 *
 * @param sue_YAWKP_AILERON Serial UDB YAWKP_AILERON Gain for Proporional control of navigation
 * @param sue_YAWKD_AILERON Serial UDB YAWKD_AILERON Gain for Rate control of navigation
 * @param sue_ROLLKP Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization
 * @param sue_ROLLKD Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization
 * @param sue_YAW_STABILIZATION_AILERON YAW_STABILIZATION_AILERON Proportional control
 * @param sue_AILERON_BOOST Gain For Boosting Manual Aileron control When Plane Stabilized
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_serial_udb_extra_f5_send(mavlink_channel_t chan, float sue_YAWKP_AILERON, float sue_YAWKD_AILERON, float sue_ROLLKP, float sue_ROLLKD, float sue_YAW_STABILIZATION_AILERON, float sue_AILERON_BOOST)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN];
	_mav_put_float(buf, 0, sue_YAWKP_AILERON);
	_mav_put_float(buf, 4, sue_YAWKD_AILERON);
	_mav_put_float(buf, 8, sue_ROLLKP);
	_mav_put_float(buf, 12, sue_ROLLKD);
	_mav_put_float(buf, 16, sue_YAW_STABILIZATION_AILERON);
	_mav_put_float(buf, 20, sue_AILERON_BOOST);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC);
#else
	mavlink_serial_udb_extra_f5_t packet;
	packet.sue_YAWKP_AILERON = sue_YAWKP_AILERON;
	packet.sue_YAWKD_AILERON = sue_YAWKD_AILERON;
	packet.sue_ROLLKP = sue_ROLLKP;
	packet.sue_ROLLKD = sue_ROLLKD;
	packet.sue_YAW_STABILIZATION_AILERON = sue_YAW_STABILIZATION_AILERON;
	packet.sue_AILERON_BOOST = sue_AILERON_BOOST;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, (const char *)&packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC);
#endif
}

/**
 * @brief Send a serial_udb_extra_f5 message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_serial_udb_extra_f5_send_struct(mavlink_channel_t chan, const mavlink_serial_udb_extra_f5_t* serial_udb_extra_f5)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_serial_udb_extra_f5_send(chan, serial_udb_extra_f5->sue_YAWKP_AILERON, serial_udb_extra_f5->sue_YAWKD_AILERON, serial_udb_extra_f5->sue_ROLLKP, serial_udb_extra_f5->sue_ROLLKD, serial_udb_extra_f5->sue_YAW_STABILIZATION_AILERON, serial_udb_extra_f5->sue_AILERON_BOOST);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, (const char *)serial_udb_extra_f5, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC);
#endif
}

#if MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_serial_udb_extra_f5_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  float sue_YAWKP_AILERON, float sue_YAWKD_AILERON, float sue_ROLLKP, float sue_ROLLKD, float sue_YAW_STABILIZATION_AILERON, float sue_AILERON_BOOST)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char *buf = (char *)msgbuf;
	_mav_put_float(buf, 0, sue_YAWKP_AILERON);
	_mav_put_float(buf, 4, sue_YAWKD_AILERON);
	_mav_put_float(buf, 8, sue_ROLLKP);
	_mav_put_float(buf, 12, sue_ROLLKD);
	_mav_put_float(buf, 16, sue_YAW_STABILIZATION_AILERON);
	_mav_put_float(buf, 20, sue_AILERON_BOOST);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, buf, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC);
#else
	mavlink_serial_udb_extra_f5_t *packet = (mavlink_serial_udb_extra_f5_t *)msgbuf;
	packet->sue_YAWKP_AILERON = sue_YAWKP_AILERON;
	packet->sue_YAWKD_AILERON = sue_YAWKD_AILERON;
	packet->sue_ROLLKP = sue_ROLLKP;
	packet->sue_ROLLKD = sue_ROLLKD;
	packet->sue_YAW_STABILIZATION_AILERON = sue_YAW_STABILIZATION_AILERON;
	packet->sue_AILERON_BOOST = sue_AILERON_BOOST;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5, (const char *)packet, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_MIN_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_CRC);
#endif
}
#endif

#endif

// MESSAGE SERIAL_UDB_EXTRA_F5 UNPACKING

/**
 * @brief Get field sue_YAWKP_AILERON from serial_udb_extra_f5 message
 *
 * @return Serial UDB YAWKP_AILERON Gain for Proporional control of navigation
 */
static inline float mavlink_msg_serial_udb_extra_f5_get_sue_YAWKP_AILERON(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  0);
}

/**
 * @brief Get field sue_YAWKD_AILERON from serial_udb_extra_f5 message
 *
 * @return Serial UDB YAWKD_AILERON Gain for Rate control of navigation
 */
static inline float mavlink_msg_serial_udb_extra_f5_get_sue_YAWKD_AILERON(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  4);
}

/**
 * @brief Get field sue_ROLLKP from serial_udb_extra_f5 message
 *
 * @return Serial UDB Extra ROLLKP Gain for Proportional control of roll stabilization
 */
static inline float mavlink_msg_serial_udb_extra_f5_get_sue_ROLLKP(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  8);
}

/**
 * @brief Get field sue_ROLLKD from serial_udb_extra_f5 message
 *
 * @return Serial UDB Extra ROLLKD Gain for Rate control of roll stabilization
 */
static inline float mavlink_msg_serial_udb_extra_f5_get_sue_ROLLKD(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  12);
}

/**
 * @brief Get field sue_YAW_STABILIZATION_AILERON from serial_udb_extra_f5 message
 *
 * @return YAW_STABILIZATION_AILERON Proportional control
 */
static inline float mavlink_msg_serial_udb_extra_f5_get_sue_YAW_STABILIZATION_AILERON(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  16);
}

/**
 * @brief Get field sue_AILERON_BOOST from serial_udb_extra_f5 message
 *
 * @return Gain For Boosting Manual Aileron control When Plane Stabilized
 */
static inline float mavlink_msg_serial_udb_extra_f5_get_sue_AILERON_BOOST(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  20);
}

/**
 * @brief Decode a serial_udb_extra_f5 message into a struct
 *
 * @param msg The message to decode
 * @param serial_udb_extra_f5 C-struct to decode the message contents into
 */
static inline void mavlink_msg_serial_udb_extra_f5_decode(const mavlink_message_t* msg, mavlink_serial_udb_extra_f5_t* serial_udb_extra_f5)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	serial_udb_extra_f5->sue_YAWKP_AILERON = mavlink_msg_serial_udb_extra_f5_get_sue_YAWKP_AILERON(msg);
	serial_udb_extra_f5->sue_YAWKD_AILERON = mavlink_msg_serial_udb_extra_f5_get_sue_YAWKD_AILERON(msg);
	serial_udb_extra_f5->sue_ROLLKP = mavlink_msg_serial_udb_extra_f5_get_sue_ROLLKP(msg);
	serial_udb_extra_f5->sue_ROLLKD = mavlink_msg_serial_udb_extra_f5_get_sue_ROLLKD(msg);
	serial_udb_extra_f5->sue_YAW_STABILIZATION_AILERON = mavlink_msg_serial_udb_extra_f5_get_sue_YAW_STABILIZATION_AILERON(msg);
	serial_udb_extra_f5->sue_AILERON_BOOST = mavlink_msg_serial_udb_extra_f5_get_sue_AILERON_BOOST(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN? msg->len : MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN;
        memset(serial_udb_extra_f5, 0, MAVLINK_MSG_ID_SERIAL_UDB_EXTRA_F5_LEN);
	memcpy(serial_udb_extra_f5, _MAV_PAYLOAD(msg), len);
#endif
}


text:
<?php

namespace Composer\Test\Downloader;

use Composer\Downloader\ZipDownloader;
use Composer\Package\PackageInterface;
use Composer\Test\TestCase;
use Composer\Util\Filesystem;
use Composer\Util\HttpDownloader;
use Composer\Util\Loop;

class ZipDownloaderTest extends TestCase
{
    /** @var string */
    private $testDir;
    /** @var \Composer\Util\HttpDownloader */
    private $httpDownloader;
    /** @var \Composer\IO\IOInterface&\PHPUnit\Framework\MockObject\MockObject */
    private $io;
    /** @var \Composer\Config&\PHPUnit\Framework\MockObject\MockObject */
    private $config;
    /** @var \Composer\Package\PackageInterface&\PHPUnit\Framework\MockObject\MockObject */
    private $package;

    public function setUp()
    {
        $this->testDir = $this->getUniqueTmpDirectory();
        $this->io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
        $this->config = $this->getMockBuilder('Composer\Config')->getMock();
        $dlConfig = $this->getMockBuilder('Composer\Config')->getMock();
        $this->httpDownloader = new HttpDownloader($this->io, $dlConfig);
        $this->package = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
    }

    public function tearDown()
    {
        $fs = new Filesystem;
        $fs->removeDirectory($this->testDir);
        $this->setPrivateProperty('hasZipArchive', null);
    }

    /**
     * @param string $name
     * @param mixed $value
     * @param ?\Composer\Test\Downloader\MockedZipDownloader $obj
     * @return void
     */
    public function setPrivateProperty($name, $value, $obj = null)
    {
        $reflectionClass = new \ReflectionClass('Composer\Downloader\ZipDownloader');
        $reflectedProperty = $reflectionClass->getProperty($name);
        $reflectedProperty->setAccessible(true);
        if ($obj === null) {
            $reflectedProperty->setValue($value);
        } else {
            $reflectedProperty->setValue($obj, $value);
        }
    }

    public function testErrorMessages()
    {
        if (!class_exists('ZipArchive')) {
            $this->markTestSkipped('zip extension missing');
        }

        $this->config->expects($this->any())
            ->method('get')
            ->with('vendor-dir')
            ->will($this->returnValue($this->testDir));

        $this->package->expects($this->any())
            ->method('getDistUrl')
            ->will($this->returnValue($distUrl = 'file://'.__FILE__))
        ;
        $this->package->expects($this->any())
            ->method('getDistUrls')
            ->will($this->returnValue(array($distUrl)))
        ;
        $this->package->expects($this->atLeastOnce())
            ->method('getTransportOptions')
            ->will($this->returnValue(array()))
        ;

        $downloader = new ZipDownloader($this->io, $this->config, $this->httpDownloader);

        try {
            $loop = new Loop($this->httpDownloader);
            $promise = $downloader->download($this->package, $path = sys_get_temp_dir().'/composer-zip-test');
            $loop->wait(array($promise));
            $downloader->install($this->package, $path);

            $this->fail('Download of invalid zip files should throw an exception');
        } catch (\Exception $e) {
            $this->assertStringContainsString('is not a zip archive', $e->getMessage());
        }
    }

    public function testZipArchiveOnlyFailed()
    {
        $this->setExpectedException('RuntimeException', 'There was an error extracting the ZIP file');
        if (!class_exists('ZipArchive')) {
            $this->markTestSkipped('zip extension missing');
        }

        $this->setPrivateProperty('hasZipArchive', true);
        $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader);
        $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
        $zipArchive->expects($this->at(0))
            ->method('open')
            ->will($this->returnValue(true));
        $zipArchive->expects($this->at(1))
            ->method('extractTo')
            ->will($this->returnValue(false));

        $this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
        $promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
        $this->wait($promise);
    }

    public function testZipArchiveExtractOnlyFailed()
    {
        $this->setExpectedException('RuntimeException', 'The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): Not a directory');
        if (!class_exists('ZipArchive')) {
            $this->markTestSkipped('zip extension missing');
        }

        $this->setPrivateProperty('hasZipArchive', true);
        $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader);
        $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
        $zipArchive->expects($this->at(0))
            ->method('open')
            ->will($this->returnValue(true));
        $zipArchive->expects($this->at(1))
            ->method('extractTo')
            ->will($this->throwException(new \ErrorException('Not a directory')));

        $this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
        $promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
        $this->wait($promise);
    }

    public function testZipArchiveOnlyGood()
    {
        if (!class_exists('ZipArchive')) {
            $this->markTestSkipped('zip extension missing');
        }

        $this->setPrivateProperty('hasZipArchive', true);
        $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader);
        $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
        $zipArchive->expects($this->at(0))
            ->method('open')
            ->will($this->returnValue(true));
        $zipArchive->expects($this->at(1))
            ->method('extractTo')
            ->will($this->returnValue(true));

        $this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
        $promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
        $this->wait($promise);
    }

    public function testSystemUnzipOnlyFailed()
    {
        $this->setExpectedException('Exception', 'Failed to extract : (1) unzip');
        $this->setPrivateProperty('isWindows', false);
        $this->setPrivateProperty('hasZipArchive', false);
        $this->setPrivateProperty('unzipCommands', array(array('unzip', 'unzip -qq %s -d %s')));

        $procMock = $this->getMockBuilder('Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock();
        $procMock->expects($this->any())
            ->method('getExitCode')
            ->will($this->returnValue(1));
        $procMock->expects($this->any())
            ->method('isSuccessful')
            ->will($this->returnValue(false));
        $procMock->expects($this->any())
            ->method('getErrorOutput')
            ->will($this->returnValue('output'));

        $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
        $processExecutor->expects($this->at(0))
            ->method('executeAsync')
            ->will($this->returnValue(\React\Promise\resolve($procMock)));

        $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
        $promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
        $this->wait($promise);
    }

    public function testSystemUnzipOnlyGood()
    {
        $this->setPrivateProperty('isWindows', false);
        $this->setPrivateProperty('hasZipArchive', false);
        $this->setPrivateProperty('unzipCommands', array(array('unzip', 'unzip -qq %s -d %s')));

        $procMock = $this->getMockBuilder('Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock();
        $procMock->expects($this->any())
            ->method('getExitCode')
            ->will($this->returnValue(0));
        $procMock->expects($this->any())
            ->method('isSuccessful')
            ->will($this->returnValue(true));
        $procMock->expects($this->any())
            ->method('getErrorOutput')
            ->will($this->returnValue('output'));

        $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
        $processExecutor->expects($this->at(0))
            ->method('executeAsync')
            ->will($this->returnValue(\React\Promise\resolve($procMock)));

        $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
        $promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
        $this->wait($promise);
    }

    public function testNonWindowsFallbackGood()
    {
        if (!class_exists('ZipArchive')) {
            $this->markTestSkipped('zip extension missing');
        }

        $this->setPrivateProperty('isWindows', false);
        $this->setPrivateProperty('hasZipArchive', true);

        $procMock = $this->getMockBuilder('Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock();
        $procMock->expects($this->any())
            ->method('getExitCode')
            ->will($this->returnValue(1));
        $procMock->expects($this->any())
            ->method('isSuccessful')
            ->will($this->returnValue(false));
        $procMock->expects($this->any())
            ->method('getErrorOutput')
            ->will($this->returnValue('output'));

        $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
        $processExecutor->expects($this->at(0))
            ->method('executeAsync')
            ->will($this->returnValue(\React\Promise\resolve($procMock)));

        $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
        $zipArchive->expects($this->at(0))
            ->method('open')
            ->will($this->returnValue(true));
        $zipArchive->expects($this->at(1))
            ->method('extractTo')
            ->will($this->returnValue(true));

        $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
        $this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
        $promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
        $this->wait($promise);
    }

    public function testNonWindowsFallbackFailed()
    {
        $this->setExpectedException('Exception', 'There was an error extracting the ZIP file');
        if (!class_exists('ZipArchive')) {
            $this->markTestSkipped('zip extension missing');
        }

        $this->setPrivateProperty('isWindows', false);
        $this->setPrivateProperty('hasZipArchive', true);

        $procMock = $this->getMockBuilder('Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock();
        $procMock->expects($this->any())
            ->method('getExitCode')
            ->will($this->returnValue(1));
        $procMock->expects($this->any())
            ->method('isSuccessful')
            ->will($this->returnValue(false));
        $procMock->expects($this->any())
            ->method('getErrorOutput')
            ->will($this->returnValue('output'));

        $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
        $processExecutor->expects($this->at(0))
          ->method('executeAsync')
          ->will($this->returnValue(\React\Promise\resolve($procMock)));

        $zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
        $zipArchive->expects($this->at(0))
          ->method('open')
          ->will($this->returnValue(true));
        $zipArchive->expects($this->at(1))
          ->method('extractTo')
          ->will($this->returnValue(false));

        $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
        $this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
        $promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
        $this->wait($promise);
    }

    /**
     * @param ?\React\Promise\PromiseInterface $promise
     * @return void
     */
    private function wait($promise)
    {
        if (null === $promise) {
            return;
        }

        $e = null;
        $promise->then(function () {
            // noop
        }, function ($ex) use (&$e) {
            $e = $ex;
        });

        if ($e) {
            throw $e;
        }
    }
}

class MockedZipDownloader extends ZipDownloader
{
    public function download(PackageInterface $package, $path, PackageInterface $prevPackage = null, $output = true)
    {
        return \React\Promise\resolve();
    }

    public function install(PackageInterface $package, $path, $output = true)
    {
        return \React\Promise\resolve();
    }

    public function extract(PackageInterface $package, $file, $path)
    {
        return parent::extract($package, $file, $path);
    }
}


text:
title: CheckBox Object
page_title: CheckBox Object - RadCheckBox
description: Check our Web Forms article about CheckBox Object.
slug: checkbox/client-side-programming/checkbox-object
tags: checkbox,object
published: True
position: 1
---

# CheckBox Object

The following table lists the most important members of the client-side RadCheckBox object:

>caption Public Properties

| Name | Description |
| ------ | ------ |
| **get_checked** |Returns a bool value, indicating whether the checkbox is checked.|
| **set_checked** |Sets a nullable boolean value that indicates whether the checkbox is checked. When a null value is set, the value will default to false.|
| **get_enabled** |Returns a value, indicating whether the checkbox control is enabled.|
| **set_enabled** |Sets whether the checkbox is enabled.|
| **get_text** |The text displayed in the RadCheckBox control.|
| **set_text** |Sets the text displayed in the RadCheckBox control.|
| **get_toolTip** |Gets the text displayed when the mouse pointer hovers over the RadCheckBox control.|
| **set_toolTip** |Sets the text displayed when the mouse pointer hovers over the RadCheckBox control.|
| **get_uniqueID** |Gets the unique, hierarchically qualified identifier for the RadCheckBox control.|
| **get_textElement** |Gets a reference to the HTML element that holds the text of the RadCheckBox control.|
| **get_cssClass** |Gets the Cascading Style Sheet (CSS) class rendered by the RadCheckBox control on the client.|
| **get_disabledCssClass** |Gets the CSS class applied when the control is disabled.|
| **get_hoveredCssClass** |Gets the CSS class applied to the RadCheckBox control when the mouse pointer is over the control.|
| **get_pressedCssClass** |Gets the CSS class applied to the RadCheckBox control when the control is pressed.|
| **get_commandName** |Gets the command name associated with the RadCheckBox control that is passed to the Command event.|
| **set_commandName** |Sets the command name associated with the RadCheckBox control that is passed to the Command event.|
| **get_commandArgument** |Gets an optional parameter passed to the Command event along with the associated CommandName.|
| **set_commandArgument** |Sets an optional parameter passed to the Command event along with the associated CommandName.|
| **get_autoPostBack** |Gets a bool value indicating whether the RadCheckBox control automatically posts back to the server when clicked.|
| **set_autoPostBack** |Sets a bool value indicating whether the RadCheckBox control automatically posts back to the server when clicked.| <<Comment: Please verify that the sentence should begin "Sets a bool value">>
| **get_height** |Gets the height of the RadCheckBox control.|
| **get_width** |Gets the width of the RadCheckBox control.|
| **get_visible** |Gets a bool value indicating whether the checkbox is visible.|
| **set_visible** |Shows/hides the checkbox.|
| **get_validationGroup** |Gets the name of ValidationGroup to which RadCheckBox is assigned.|
| **set_validationGroup** |Sets the validation group to which RadCheckBox should be assigned.|

>caption Public Methods

| Name | Description |
| ------ | ------ |
| **focus** |Brings the focus to the RadCheckBox control.|
| **click** |Executes programmatic checkbox click. Accepts an optional boolean parameter that specifies whether the client-side [clicking event]({%slug checkbox/client-side-programming/events/onclientclicking%}) of RadCheckBox will be fired when the control is clicked programmatically. If the function is called without parameter, the clicking event will not be fired.|

>caption Methods for Modifying Client-side Event Handlers Dynamically

| Name | Description |
| ------ | ------ |
| **add_load** |The name of the JavaScript function called when the control loads.|
| **remove_load** |Removes a handler for the load event.|
| **add_clicking** |The name of the JavaScript function called when the RadCheckBox control is clicked.|
| **remove_clicking** |Removes a handler for the clicking event.|
| **add_checkedChanging** |The name of the JavaScript function called before the checked state of the checkbox is changed.|
| **remove_checkedChanging** |Removes a handler for the checkedChanging event.|
| **add_checkedChanged** |The name of the JavaScript function called when the checked state of the checkbox is changed.|
| **remove_checkedChanged** |Removes a handler for the checkedChanged event.|
| **add_clicked** |The name of the JavaScript function called when the RadCheckBox control is clicked.|
| **remove_clicked** |Removes a handler for the clicked event.|
| **add_mouseOver** |The name of the JavaScript function called when the mouse hovers over the control.|
| **remove_mouseOver** |Removes a handler for the mouseOver event.|
| **add_mouseOut** |The name of the JavaScript function when the mouse leaves the control.|
| **remove_mouseOut** |Removes a handler for the mouseOut event.|

You can read more on the subject in the [Setting Client Event Handlers by Using JavaScript]({%slug checkbox/client-side-programming/events/setting-event-handlers-via-javascript%}) help article.

## See Also

 * [Client-side Programming Overview]({%slug checkbox/client-side-programming/overview%})


text:
<?php
namespace Choreizo\Bundle\BaseBundle\Form;
use Choreizo\Bundle\BaseBundle\Form\ApiForm;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class UserForm extends ApiForm
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('first_name')
            ->add('last_name');
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(
            array(
                'data_class' => 'Choreizo\Bundle\BaseBundle\Entity\User',
                'csrf_protection' => false
            )
        );
    }

    public function getName()
    {
        return '';
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ventanas;

import java.util.Date;

/**
 *
 * @author 7FPROG02
 */
public class Parte extends javax.swing.JFrame {

    private String fechaParte;
    /**
     * Creates new form Parte
     */
    public Parte() {
        initComponents();

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTextField2 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        uKmPrincipio = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        uKmFinal = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        uGastoGasoil = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        uGastosAutopista = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        uGastosDieta = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        uIncidencias = new javax.swing.JTextArea();
        jButton2 = new javax.swing.JButton();
        jLabel10 = new javax.swing.JLabel();
        uHorasExtra = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();

        jTextField2.setText("jTextField2");

        jLabel11.setText("jLabel11");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Andalus", 1, 24)); // NOI18N
        jLabel1.setText("PARTE DE JORNADA");

        jButton1.setText("Completar");

        jLabel2.setText("Kilometros al principio de la jornada: *");

        jLabel3.setText("Kilometros al final de la jornada : *");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        jLabel4.setText("Gastos: ");

        jLabel5.setText("Gasto en gasoil :");

        jLabel6.setText("Gasto en autopistas/peajes: ");

        jLabel7.setText("Gasto en dietas :");

        jLabel8.setText("Otros gastos:");

        jLabel9.setText("Incidencias : ");

        uIncidencias.setColumns(20);
        uIncidencias.setRows(5);
        jScrollPane1.setViewportView(uIncidencias);

        jButton2.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        jButton2.setText("Validar");
        jButton2.setEnabled(false);

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        jLabel10.setText("Horas Extras: ");

        uHorasExtra.setEditable(false);

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        jLabel12.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jLabel12PropertyChange(evt);
            }
        });

        jLabel18.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel18.setForeground(new java.awt.Color(255, 51, 51));
        jLabel18.setText("* Campos obligatorios");
        jLabel18.setBorder(javax.swing.BorderFactory.createCompoundBorder());

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(43, 43, 43)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel6)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(uGastosAutopista))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(69, 69, 69)
                                        .addComponent(uGastoGasoil, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(74, 74, 74)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8)))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(uKmFinal, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(uKmPrincipio, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 348, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(uGastosDieta, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addComponent(uHorasExtra, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(57, 57, 57)
                        .addComponent(jButton2)
                        .addGap(117, 117, 117)))
                .addGap(42, 42, 42))
            .addGroup(layout.createSequentialGroup()
                .addGap(320, 320, 320)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(21, 21, 21))
            .addGroup(layout.createSequentialGroup()
                .addGap(385, 385, 385)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(75, 75, 75))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(uKmPrincipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(uKmFinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(72, 72, 72)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(uGastoGasoil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(uGastosDieta, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(uGastosAutopista, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(34, 34, 34)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(uHorasExtra, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jLabel12PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jLabel12PropertyChange
        Date hoy = new Date ();

        String fecha = hoy.toString();
        jLabel12.setText(fecha);

    }//GEN-LAST:event_jLabel12PropertyChange

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Parte.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Parte.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Parte.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Parte.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Parte().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField uGastoGasoil;
    private javax.swing.JTextField uGastosAutopista;
    private javax.swing.JTextField uGastosDieta;
    private javax.swing.JTextField uHorasExtra;
    private javax.swing.JTextArea uIncidencias;
    private javax.swing.JTextField uKmFinal;
    private javax.swing.JTextField uKmPrincipio;
    // End of variables declaration//GEN-END:variables
}


text:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

#pragma once

#include <string>

#include <gazebo/gazebo.hh>

#include "simulation/gz_msgs/msgs.h"

/**
 * \brief Plugin for reading the range of obstacles.
 *
 * This plugin publishes the range of obstacles detected by a sonar
 * rangefinder every physics update.
 *
 * To add a rangefinder to your robot, add the following XML to your
 * robot model:
 *
 *     <plugin name="my_rangefinder" filename="librangefinder.so">
 *       <sensor>Sensor Name</sensor>
 *       <topic>~/my/topic</topic>
 *     </plugin>
 *
 * - `sensor`: Name of the sonar sensor that this rangefinder uses.
 * - `topic`: Optional. Message will be published as a gazebo.msgs.Float64.
 */
class Rangefinder : public gazebo::ModelPlugin {
 public:
  /// \brief Load the rangefinder and configures it according to the sdf.
  void Load(gazebo::physics::ModelPtr model, sdf::ElementPtr sdf);

  /// \brief Sends out the rangefinder reading each timestep.
  void Update(const gazebo::common::UpdateInfo& info);

 private:
  /// \brief Publish the range on this topic.
  std::string topic;

  /// \brief The sonar sensor that this rangefinder uses
  gazebo::sensors::SonarSensorPtr sensor;

  /// \brief The model to which this is attached.
  gazebo::physics::ModelPtr model;

  /// \brief Pointer to the world update function.
  gazebo::event::ConnectionPtr updateConn;

  /// \brief The node on which we're advertising.
  gazebo::transport::NodePtr node;

  /// \brief Publisher handle.
  gazebo::transport::PublisherPtr pub;
};


text:
set hive.exec.compress.output=false;
set hive.exec.compress.output;

--CREATE RESULT TABLE. Store query result externally in output_dir/qXXresult/
DROP TABLE IF EXISTS ${hiveconf:RESULT_TABLE};
CREATE TABLE ${hiveconf:RESULT_TABLE} (
  am_pm_ratio decimal(15,4)
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
STORED AS ${env:BIG_BENCH_hive_default_fileformat_result_table} LOCATION '${hiveconf:RESULT_DIR}';

-- Begin: the real query part
INSERT INTO TABLE ${hiveconf:RESULT_TABLE}
SELECT CAST(amc as double) / CAST(pmc as double) am_pm_ratio
FROM (
  SELECT COUNT(*) amc
  FROM web_sales ws
  JOIN household_demographics hd ON hd.hd_demo_sk = ws.ws_ship_hdemo_sk
  AND hd.hd_dep_count = ${hiveconf:q14_dependents}
  JOIN time_dim td ON td.t_time_sk = ws.ws_sold_time_sk
  AND td.t_hour >= ${hiveconf:q14_morning_startHour}
  AND td.t_hour <= ${hiveconf:q14_morning_endHour}
  JOIN web_page wp ON wp.wp_web_page_sk = ws.ws_web_page_sk
  AND wp.wp_char_count >= ${hiveconf:q14_content_len_min}
  AND wp.wp_char_count <= ${hiveconf:q14_content_len_max}
) at
JOIN (
  SELECT COUNT(*) pmc
  FROM web_sales ws
  JOIN household_demographics hd ON ws.ws_ship_hdemo_sk = hd.hd_demo_sk
  AND hd.hd_dep_count = ${hiveconf:q14_dependents}
  JOIN time_dim td ON td.t_time_sk = ws.ws_sold_time_sk
  AND td.t_hour >= ${hiveconf:q14_evening_startHour}
  AND td.t_hour <= ${hiveconf:q14_evening_endHour}
  JOIN web_page wp ON wp.wp_web_page_sk = ws.ws_web_page_sk
  AND wp.wp_char_count >= ${hiveconf:q14_content_len_min}
  AND wp.wp_char_count <= ${hiveconf:q14_content_len_max}
) pt
--result is a single line
;


text:
package com.amrendra.gridgame.game;

/**
 * Created by Amrendra Kumar on 24/10/15.
 */
public class GameConstants {
    public static final int GAME_DURATION = 45;//sec
    public static final int MAX_DIMENSIONS = 20;
    public static final String HIGH_SCORE = "HIGH_SCORE";
    public static final String CURRENT_SCORE = "CURRENT_SCORE";
}


text:
<?php
namespace AppBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

class Configuration implements ConfigurationInterface
{
	public function getConfigTreeBuilder()
	{
		$treeBuilder = new TreeBuilder();
		$treeBuilder
			->root('app')
			->children()
                ->scalarNode('api_public_path')->isRequired()->end()
                ->variableNode('registration_secrets')->isRequired()->end()
			->end();

		return $treeBuilder;
	}
}


text:
package org.join.ws.receiver;

import java.util.HashMap;
import java.util.Map;

import org.join.ws.Constants.Config;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

/**
 * @brief 网络状态接收者
 * @author Join
 */
public class NetworkReceiver extends BroadcastReceiver {

    static final String TAG = "NetworkReceiver";
    static final boolean DEBUG = false || Config.DEV_MODE;

    private static Map<Context, NetworkReceiver> mReceiverMap = new HashMap<Context, NetworkReceiver>();

    private OnNetworkListener mListener;

    public NetworkReceiver(OnNetworkListener listener) {
        mListener = listener;
    }

    /**
     * 注册
     */
    public static void register(Context context, OnNetworkListener listener) {
        if (mReceiverMap.containsKey(context)) {
            if (DEBUG)
                Log.d(TAG, "This context already registered.");
            return;
        }

        NetworkReceiver receiver = new NetworkReceiver(listener);

        IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
        context.registerReceiver(receiver, filter);

        mReceiverMap.put(context, receiver);

        if (DEBUG)
            Log.d(TAG, "NetworkReceiver registered.");
    }

    /**
     * 注销
     */
    public static void unregister(Context context) {
        NetworkReceiver receiver = mReceiverMap.remove(context);
        if (receiver != null) {
            context.unregisterReceiver(receiver);
            receiver = null;

            if (DEBUG)
                Log.d(TAG, "NetworkReceiver unregistered.");
        }
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        ConnectivityManager conn = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo info = conn.getActiveNetworkInfo();

        if (DEBUG)
            Log.d(TAG, intent.getAction() + "\ngetActiveNetworkInfo: " + info);

        if (info != null) {
            boolean isWifi = info.getType() == ConnectivityManager.TYPE_WIFI;
            if (mListener != null) {
                mListener.onConnected(isWifi);
            }
        } else {
            if (mListener != null) {
                mListener.onDisconnected();
            }
        }

    }
}


text:
/*** Included Header Files ***/
#include "C_CodeGen.h"
#include <iostream>
#include <boost/program_options/cmdline.hpp>
#include <boost/program_options/environment_iterator.hpp>
#include <boost/program_options/eof_iterator.hpp>
#include <boost/program_options/errors.hpp>
#include <boost/program_options/option.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/positional_options.hpp>
#include <boost/program_options/value_semantic.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/version.hpp>

/*** Namespace Declaration ***/
namespace po = boost::program_options;

/*** Globally Define Variables ***/
std::string _outputDir;
std::string _esmolFile;
bool		_debugOutput;

/***************************************************************************************/

// Process the command line arguments
bool processCmdLine( int argc, char **argv ) {
	// Setup the options description
	po::options_description optionsDesc("Allowed Options");
	optionsDesc.add_options()
		( "help,h", "Usage information.")
		( "output-directory,p", po::value<std::string>(&_outputDir)->default_value(std::string("Generated")), "Output Directory.")
		( "esmol-file,f", po::value<std::string>(&_esmolFile), "ESMoL model file (*.mga).")
		( "debug-output,d", "Show the debug output.")
	;

	// Setup positional options
	po::positional_options_description popt_desc;
	// Prepare and parse the command line
	po::variables_map vm;
	try {
		po::store(po::command_line_parser( argc, argv ).options(optionsDesc).positional(popt_desc ).run(), vm );
	}
	catch (...) {
		std::cout << "Invalid command line format.\n";
		std::cout << optionsDesc << std::endl;
		return false;
	}
	po::notify(vm);

	// See if help was asked for
	if (vm.count( "help" )) {
		std::cout << optionsDesc << std::endl;
		return false;
	}

	// Make sure there was an output directory
	if (vm.count("output-directory") == 0)
	{
		std::cout << "Output directory must be specified." << std::endl;
		return false;
	}
	// Make sure there is either an esmol or and abstract model file
	if ( vm.count("esmol-file") == 0 ) {
			std::cout << "An ESMoL model file must be specified." << std::endl;
		return false;
	}
	// Set the option value for debug output
	_debugOutput = vm.count("debug-output") != 0;
	// All set - return true
	return true;
}

int main( int argc, char **argv ) {
	try {
		// Process the command line
		if (!processCmdLine(argc, argv)) {
			exit(0);
		}
		// Now process the results file into the model file
		CCodeGen codeGen(_outputDir, _esmolFile, _debugOutput);
		// Finish It Up
	}
	catch( ... ) {
		std::cout << "Caught an exception\n";
	}
	return 0;
}

/***************************************************************************************/


text:
"""Unit tests for the fetch_builds module."""

import errno
import unittest

# The third-party mock module is expected to be available in PYTHONPATH.
import mock

import fetch_build

# The tests below test private functions (W0212).
# Some methods don't reference self because they use the mock module (R0201).
# pylint: disable=R0201,W0212
class FetchBuildTest(unittest.TestCase):

  def setUp(self):
    # Mocks of the os and bisect_utils modules are used in the methods below.
    cloud_storage_patcher = mock.patch('fetch_build.cloud_storage')
    self.mock_cloud_storage = cloud_storage_patcher.start()
    self.addCleanup(cloud_storage_patcher.stop)

  @mock.patch('fetch_build.os.path.exists')
  def test_FetchFromCloudStorage_FileFound(self, mock_os_path_exists):
    self.mock_cloud_storage.Exists.return_value = True
    mock_os_path_exists.return_value = True
    local_path = fetch_build.FetchFromCloudStorage(
        'my_bucket', 'remote/foo.zip', 'local')
    self.assertEqual('local/foo.zip', local_path)
    self.mock_cloud_storage.Get.assert_called_with(
        'my_bucket', 'remote/foo.zip', 'local/foo.zip')

  def test_FetchFromCloudStorage_FileNotFound(self):
    self.mock_cloud_storage.Exists.return_value = False
    local_path = fetch_build.FetchFromCloudStorage(
        'my_bucket', 'remote/foo.zip', 'local')
    self.assertIsNone(local_path)
    self.assertFalse(self.mock_cloud_storage.Get.called)

class BuildArchiveTest(unittest.TestCase):

  def test_CreatePerfBuildArchive(self):
    archive = fetch_build.BuildArchive.Create(fetch_build.PERF_BUILDER)
    self.assertEqual('chrome-perf', archive.BucketName())
    self.assertTrue(isinstance(archive, fetch_build.PerfBuildArchive))

  def test_CreateFullBuildArchive(self):
    archive = fetch_build.BuildArchive.Create(fetch_build.FULL_BUILDER)
    archive._platform = 'linux'
    self.assertEqual('chromium-linux-archive', archive.BucketName())
    self.assertTrue(isinstance(archive, fetch_build.FullBuildArchive))

  def test_BuildArchive_NonExistentType(self):
    self.assertRaises(
        NotImplementedError, fetch_build.BuildArchive.Create, 'other')

  def test_FullBuildArchive_Linux(self):
    archive = fetch_build.FullBuildArchive()
    archive._platform = 'linux'
    self.assertEqual('chromium-linux-archive', archive.BucketName())
    self.assertEqual(
        'chromium.linux/Linux Builder/full-build-linux_1234567890abcdef.zip',
        archive.FilePath('1234567890abcdef'))

  def test_FullBuildArchive_Android(self):
    archive = fetch_build.FullBuildArchive()
    archive._platform = 'android'
    self.assertEqual('chromium-android', archive.BucketName())
    self.assertEqual(
        'android_main_rel/full-build-linux_1234567890abcdef.zip',
        archive.FilePath('1234567890abcdef'))

  def test_FullBuildArchive_Linux_BuilderName(self):
    archive = fetch_build.FullBuildArchive()
    archive._platform = 'linux'
    self.assertEqual('linux_full_bisect_builder', archive.GetBuilderName())

  def test_FullBuildArchive_Windows_BuildTime(self):
    archive = fetch_build.FullBuildArchive()
    archive._platform = 'win'
    self.assertEqual(14400, archive.GetBuilderBuildTime())

  def test_PerfBuildArchive_Linux(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'linux'
    self.assertEqual('chrome-perf', archive.BucketName())
    self.assertEqual(
        'Linux Builder/full-build-linux_1234567890abcdef.zip',
        archive.FilePath('1234567890abcdef'))

  def test_PerfBuildArchive_Android(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'android'
    self.assertEqual('chrome-perf', archive.BucketName())
    self.assertEqual(
        'android_perf_rel/full-build-linux_123456.zip',
        archive.FilePath('123456'))

  def test_PerfBuildArchive_AndroidArm64(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'android_arm64'
    self.assertEqual('chrome-perf', archive.BucketName())
    self.assertEqual(
        'android_perf_rel_arm64/full-build-linux_123456.zip',
        archive.FilePath('123456'))

  def test_PerfBuildArchive_64BitWindows(self):
    archive = fetch_build.PerfBuildArchive(target_arch='x64')
    archive._platform = 'win64'
    self.assertEqual('chrome-perf', archive.BucketName())
    self.assertEqual(
        'Win x64 Builder/full-build-win32_123456.zip',
        archive.FilePath('123456'))

  def test_PerfBuildArchive_WithDepsPatchSha(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'linux'
    self.assertEqual(
        'Linux Builder/full-build-linux_123456'
        '_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.zip',
        archive.FilePath(123456, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'))

  def test_PerfBuildArchive_64BitWindows_BuilderName(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'win64'
    self.assertEqual('win_x64_perf_bisect_builder', archive.GetBuilderName())

  def test_PerfBuildArchive_64BitWindows_BuildTime(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'win64'
    self.assertEqual(14400, archive.GetBuilderBuildTime())

  def test_PerfBuildArchive_Windows_BuilderName(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'win'
    self.assertEqual('win_perf_bisect_builder', archive.GetBuilderName())

  def test_PerfBuildArchive_Windows_BuildTime(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'win'
    self.assertEqual(14400, archive.GetBuilderBuildTime())

  def test_PerfBuildArchive_Linux_BuilderName(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'linux'
    self.assertEqual('linux_perf_bisect_builder', archive.GetBuilderName())

  def test_PerfBuildArchive_Linux_BuildTime(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'linux'
    self.assertEqual(14400, archive.GetBuilderBuildTime())

  def test_PerfBuildArchive_Android_BuilderName(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'android'
    self.assertEqual('android_perf_bisect_builder', archive.GetBuilderName())

  def test_PerfBuildArchive_Android_BuildTime(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'android'
    self.assertEqual(14400, archive.GetBuilderBuildTime())

  def test_PerfBuildArchive_Mac_BuilderName(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'mac'
    self.assertEqual('mac_perf_bisect_builder', archive.GetBuilderName())

  def test_PerfBuildArchive_mac_BuildTime(self):
    archive = fetch_build.PerfBuildArchive()
    archive._platform = 'mac'
    self.assertEqual(14400, archive.GetBuilderBuildTime())

  def test_GetBuildBotUrl_Perf(self):
    self.assertEqual(
        fetch_build.PERF_TRY_SERVER_URL,
        fetch_build.GetBuildBotUrl(fetch_build.PERF_BUILDER))

  def test_GetBuildBotUrl_full(self):
    self.assertEqual(
        fetch_build.LINUX_TRY_SERVER_URL,
        fetch_build.GetBuildBotUrl(fetch_build.FULL_BUILDER))

class UnzipTest(unittest.TestCase):

  def setUp(self):
    # Mocks of the os and bisect_utils modules are used in the methods below.
    os_patcher = mock.patch('fetch_build.os')
    self.mock_os = os_patcher.start()
    self.addCleanup(os_patcher.stop)

    bisect_utils_patcher = mock.patch('fetch_build.bisect_utils')
    self.mock_bisect_utils = bisect_utils_patcher.start()
    self.addCleanup(bisect_utils_patcher.stop)

  @mock.patch('fetch_build._MakeDirectory')
  @mock.patch('fetch_build._UnzipUsingCommand')
  def test_Unzip_Linux(self, mock_UnzipUsingCommand, mock_MakeDirectory):
    self.mock_bisect_utils.IsLinuxHost.return_value = True
    self.mock_bisect_utils.IsMacHost.return_value = False
    self.mock_bisect_utils.IsWindowsHost.return_value = False
    fetch_build.Unzip('x.zip', 'out_dir', verbose=False)
    mock_MakeDirectory.assert_called_with('out_dir')
    mock_UnzipUsingCommand.assert_called_with(
        ['unzip', '-o'], 'x.zip', 'out_dir')

  @mock.patch('fetch_build._MakeDirectory')
  @mock.patch('fetch_build._UnzipUsingZipFile')
  def test_Unzip_Mac_LargeFile(
      self, mock_UnzipUsingZipFile, mock_MakeDirectory):
    # The zipfile module is used to unzip on mac when the file is > 4GB.
    self.mock_bisect_utils.IsLinuxHost.return_value = False
    self.mock_bisect_utils.IsMacHost.return_value = True
    self.mock_bisect_utils.IsWindowsHost.return_value = False
    self.mock_os.path.getsize.return_value = 2 ** 33  # 8GB
    fetch_build.Unzip('x.zip', 'out_dir', verbose=False)
    mock_MakeDirectory.assert_called_with('out_dir')
    mock_UnzipUsingZipFile.assert_called_with('x.zip', 'out_dir', False)

  def test_UnzipUsingCommand(self):
    # The _UnzipUsingCommand function should move to the output
    # directory and run the command with the file's absolute path.
    self.mock_os.path.abspath.return_value = '/foo/some/path/x.zip'
    self.mock_os.getcwd.return_value = 'curr_dir'
    self.mock_bisect_utils.RunProcess.return_value = 0
    fetch_build._UnzipUsingCommand(['unzip'], 'x.zip', 'out_dir')
    self.mock_os.chdir.assert_has_calls(
        [mock.call('out_dir'), mock.call('curr_dir')])
    self.mock_bisect_utils.RunProcess.assert_called_with(
        ['unzip', '/foo/some/path/x.zip'])

  def test_MakeDirectory(self):
    # _MakeDirectory uses os.makedirs.
    fetch_build._MakeDirectory('some/path')
    self.mock_os.makedirs.assert_called_with('some/path')

  def test_MakeDirectory_RaisesError(self):
    self.mock_os.makedirs.side_effect = OSError()
    self.assertRaises(OSError, fetch_build._MakeDirectory, 'some/path')

  def test_MakeDirectory_NoErrorIfDirectoryAlreadyExists(self):
    already_exists = OSError()
    already_exists.errno = errno.EEXIST
    self.mock_os.makedirs.side_effect = already_exists
    fetch_build._MakeDirectory('some/path')

  @mock.patch('fetch_build.shutil')
  def test_RemoveDirectoryTree(self, mock_shutil):
    # _RemoveDirectoryTree uses shutil.rmtree.
    fetch_build._RemoveDirectoryTree('some/path')
    mock_shutil.rmtree.assert_called_with('some/path')

if __name__ == '__main__':
  unittest.main()


text:
<?php

namespace frontend\modules\advisor;

class Advisor extends \yii\base\Module
{
    public $controllerNamespace = 'frontend\modules\advisor\controllers';

    public function init()
    {
        parent::init();

        // custom initialization code goes here
    }
}


text:
package com.twitter.finagle.mysql.transport

import com.twitter.io.Buf
import org.jboss.netty.buffer.{ChannelBuffer, ChannelBuffers}
import org.jboss.netty.channel.{ChannelPipelineFactory, Channels, _}
import org.jboss.netty.handler.codec.frame.FrameDecoder
import scala.util.control.NonFatal

/**
 * Decodes logical MySQL packets that could be fragmented across
 * frames. MySQL packets are a length encoded set of bytes written
 * in little endian byte order.
 */
class PacketFrameDecoder extends FrameDecoder {
  override def decode(ctx: ChannelHandlerContext, channel: Channel, buffer: ChannelBuffer): Packet = {
    if (buffer.readableBytes < Packet.HeaderSize)
      return null

    buffer.markReaderIndex()

    val header = new Array[Byte](Packet.HeaderSize)
    buffer.readBytes(header)
    val br = MysqlBuf.reader(header)

    val length = br.readUnsignedMediumLE()
    val seq  = br.readUnsignedByte()

    if (buffer.readableBytes < length) {
      buffer.resetReaderIndex()
      return null
    }

    val body = new Array[Byte](length)
    buffer.readBytes(body)

    Packet(seq, Buf.ByteArray.Owned(body))
  }
}

class PacketEncoder extends SimpleChannelDownstreamHandler {
  override def writeRequested(ctx: ChannelHandlerContext, evt: MessageEvent) =
    evt.getMessage match {
      case p: Packet =>
        try {
          val cb = ChannelBuffers.copiedBuffer(Buf.ByteArray.Owned.extract(p.toBuf))
          Channels.write(ctx, evt.getFuture, cb, evt.getRemoteAddress)
        } catch {
          case NonFatal(e) =>
            evt.getFuture.setFailure(new ChannelException(e.getMessage))
        }

      case unknown =>
        evt.getFuture.setFailure(new ChannelException(
          "Unsupported request type %s".format(unknown.getClass.getName)))
    }
}

/**
 * A Netty3 pipeline that is responsible for framing network
 * traffic in terms of mysql logical packets.
 */
object MysqlClientPipelineFactory extends ChannelPipelineFactory {
  def getPipeline = {
    val pipeline = Channels.pipeline()
    pipeline.addLast("packetDecoder", new PacketFrameDecoder)
    pipeline.addLast("packetEncoder", new PacketEncoder)
    pipeline
  }
}


text:
module Jen
  module Factory
    module Construction
      def construct!(opts={},*args,&block)
	logger.debug "=== construct! component_name=#{self.identifier}"
	object = self.target_class.new
	assign_object_attributes!(object,opts)
	logger.debug "--- assigned obj attrs: #{object.inspect}"
	object
      end

      # handle traits/aspects...

      protected

      def assign_attribute!(obj,attr)
	logger.debug "=== assigning attribute #{attr.identifier}"
	target_attr = detect_instance_method self.target_class, attr.identifier
	attr_method = "#{target_attr}="

	attr_value = attr.evaluate!

	logger.debug "--- assigning attribute to object"

	logger.debug "--- attribute method #{attr_method}"
	logger.debug "--- attribute value #{attr_value}"
	logger.debug "--- obj before: #{obj.inspect}"
	obj.send attr_method, attr_value
	logger.debug "--- obj after: #{obj.inspect}"
      end

      def assign_object_attributes!(object,provided_attributes)
	logger.debug "=== assigning object attributes (#{self.identifier})"

	provided_attr_names = provided_attributes.keys
	self.attributes.each do |attr|
	  unless provided_attr_names.include?(attr.identifier)
	    assign_attribute!(object,attr)
	  end
	end

	provided_attributes.each do |k,v|
	  object.send("#{k}=".to_sym, v)
	end
      end
    end
  end
end


text:
namespace System.Windows.Forms
{
    public partial class DoubleBufferedPanel : Panel
    {
        public DoubleBufferedPanel()
        {
            DoubleBuffered = true;
        }
    }
}