text:
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#269](https://github.com/googleapis/java-shell/issues/269)) ([ae92683](https://github.com/googleapis/java-shell/commit/ae92683b920d6fd98f186e7013044719dad95ceb))
* Update dependency jinja2 to v3.1.2 ([#258](https://github.com/googleapis/java-shell/issues/258)) ([dd25cbc](https://github.com/googleapis/java-shell/commit/dd25cbc91d59facf0a3fdb76a77d8a71d64a7ca0))
* Update dependency keyring to v23.9.3 ([#259](https://github.com/googleapis/java-shell/issues/259)) ([7769f1e](https://github.com/googleapis/java-shell/commit/7769f1e9a9cc7a058d65667314df2963313d9188))
* Update dependency markupsafe to v2.1.1 ([#260](https://github.com/googleapis/java-shell/issues/260)) ([3b66c4e](https://github.com/googleapis/java-shell/commit/3b66c4e11d1a799b097d2b59425076ecd752a480))
* Update dependency protobuf to v3.20.2 ([#261](https://github.com/googleapis/java-shell/issues/261)) ([9d842ca](https://github.com/googleapis/java-shell/commit/9d842ca25d2d6c97845e089abf13f523c88beb5a))
* Update dependency protobuf to v4 ([#266](https://github.com/googleapis/java-shell/issues/266)) ([d6c21e4](https://github.com/googleapis/java-shell/commit/d6c21e40871aa1fe751641826a91b6e0d0805b92))
* Update dependency pyjwt to v2.5.0 ([#262](https://github.com/googleapis/java-shell/issues/262)) ([e5194df](https://github.com/googleapis/java-shell/commit/e5194df1217b3af9e5e25b1b5a811f8cda006349))
* Update dependency requests to v2.28.1 ([#263](https://github.com/googleapis/java-shell/issues/263)) ([defd300](https://github.com/googleapis/java-shell/commit/defd30095abd34c2c0ebe232d6a70068a0c76b53))
* Update dependency typing-extensions to v4.3.0 ([#264](https://github.com/googleapis/java-shell/issues/264)) ([934e15c](https://github.com/googleapis/java-shell/commit/934e15c677c4d2db72c74a5b162c9849d472cf17))
* Update dependency zipp to v3.8.1 ([#265](https://github.com/googleapis/java-shell/issues/265)) ([fb953ea](https://github.com/googleapis/java-shell/commit/fb953eae17f62b96d70d02c6ab021a497ec0d722))

## [2.2.7](https://github.com/googleapis/java-shell/compare/v2.2.6...v2.2.7) (2022-09-27)

### Dependencies

* Update dependency cachetools to v5 ([#255](https://github.com/googleapis/java-shell/issues/255)) ([fa9b52a](https://github.com/googleapis/java-shell/commit/fa9b52ad9f0037827e9419d1d3163b71473d7927))

## [2.2.6](https://github.com/googleapis/java-shell/compare/v2.2.5...v2.2.6) (2022-09-15)

### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.3 ([#249](https://github.com/googleapis/java-shell/issues/249)) ([7515d3d](https://github.com/googleapis/java-shell/commit/7515d3dd5f80e775ca82a8f5e344d0d26927e7d3))

## [2.2.5](https://github.com/googleapis/java-shell/compare/v2.2.4...v2.2.5) (2022-09-09)

### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#244](https://github.com/googleapis/java-shell/issues/244)) ([726c1d5](https://github.com/googleapis/java-shell/commit/726c1d57c68064fcb8590059e969ec881dac5173))

## [2.2.4](https://github.com/googleapis/java-shell/compare/v2.2.3...v2.2.4) (2022-08-11)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v3 ([#234](https://github.com/googleapis/java-shell/issues/234)) ([7e57595](https://github.com/googleapis/java-shell/commit/7e5759569653b292450a0063ae43015f26797350))

## [2.2.3](https://github.com/googleapis/java-shell/compare/v2.2.2...v2.2.3) (2022-07-13)

### Bug Fixes

* enable longpaths support for windows test ([#1485](https://github.com/googleapis/java-shell/issues/1485)) ([#227](https://github.com/googleapis/java-shell/issues/227)) ([840323b](https://github.com/googleapis/java-shell/commit/840323bc9230a5949072f914a3eebad2e9be7eb5))

## [2.2.2](https://github.com/googleapis/java-shell/compare/v2.2.1...v2.2.2) (2022-07-01)

### Bug Fixes

* update gapic-generator-java with mock service generation fixes ([#209](https://github.com/googleapis/java-shell/issues/209)) ([f5cc96d](https://github.com/googleapis/java-shell/commit/f5cc96d8a053e09633c1a90dbac0e10e6f7df5fc))

## [2.2.1](https://github.com/googleapis/java-shell/compare/v2.2.0...v2.2.1) (2022-06-23)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#215](https://github.com/googleapis/java-shell/issues/215)) ([1df50b7](https://github.com/googleapis/java-shell/commit/1df50b71c4c33721233cf2dccad70e325d5033b8))

## [2.2.0](https://github.com/googleapis/java-shell/compare/v2.1.12...v2.2.0) (2022-05-24)

### Features

* add build scripts for native image testing in Java 17 ([#1440](https://github.com/googleapis/java-shell/issues/1440)) ([#208](https://github.com/googleapis/java-shell/issues/208)) ([9c2a201](https://github.com/googleapis/java-shell/commit/9c2a201ce9f60cc1afbad473c8af9cf92d93bd55))

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.12.0 ([#207](https://github.com/googleapis/java-shell/issues/207)) ([f88dd65](https://github.com/googleapis/java-shell/commit/f88dd65088abd3d50a524630ffcc2a6f00d6f9eb))

### [2.1.12](https://github.com/googleapis/java-shell/compare/v2.1.11...v2.1.12) (2022-04-15)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.10.0 ([#196](https://github.com/googleapis/java-shell/issues/196)) ([10b60cf](https://github.com/googleapis/java-shell/commit/10b60cf56aefc5577f880e42918ca41abab0dc23))

### [2.1.11](https://github.com/googleapis/java-shell/compare/v2.1.10...v2.1.11) (2022-03-29)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.9.0 ([#189](https://github.com/googleapis/java-shell/issues/189)) ([54fe878](https://github.com/googleapis/java-shell/commit/54fe878da9cb0d728b854fd32157c59864cde036))

### [2.1.10](https://github.com/googleapis/java-shell/compare/v2.1.9...v2.1.10) (2022-03-02)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.8.0 ([#180](https://github.com/googleapis/java-shell/issues/180)) ([542a85e](https://github.com/googleapis/java-shell/commit/542a85e3f2102764fb6cbba56040c58b3709c507))

### [2.1.9](https://github.com/googleapis/java-shell/compare/v2.1.8...v2.1.9) (2022-02-11)

### Dependencies

* update actions/github-script action to v6 ([#167](https://github.com/googleapis/java-shell/issues/167)) ([a77c8ff](https://github.com/googleapis/java-shell/commit/a77c8ffdeb43288b674be30d23dd302a0b2b8401))

### [2.1.8](https://github.com/googleapis/java-shell/compare/v2.1.7...v2.1.8) (2022-02-03)

### Dependencies

* **java:** update actions/github-script action to v5 ([#1339](https://github.com/googleapis/java-shell/issues/1339)) ([#156](https://github.com/googleapis/java-shell/issues/156)) ([34500c8](https://github.com/googleapis/java-shell/commit/34500c8e3da361918023e0db0c5a551aecb9fb10))
* update actions/github-script action to v5 ([#154](https://github.com/googleapis/java-shell/issues/154)) ([0161482](https://github.com/googleapis/java-shell/commit/0161482526153b02e1b3208903d257258e81937a))
* update actions/setup-java action to v2 ([#155](https://github.com/googleapis/java-shell/issues/155)) ([dfcb8e0](https://github.com/googleapis/java-shell/commit/dfcb8e0227dcead494dc0cfa19c7e57f7b46e241))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.7.0 ([#158](https://github.com/googleapis/java-shell/issues/158)) ([8809a60](https://github.com/googleapis/java-shell/commit/8809a602fe92d92fba62357b557278fe1e034e26))

### [2.1.7](https://www.github.com/googleapis/java-shell/compare/v2.1.6...v2.1.7) (2022-01-07)

### Bug Fixes

* **java:** add -ntp flag to native image testing command ([#1299](https://www.github.com/googleapis/java-shell/issues/1299)) ([#133](https://www.github.com/googleapis/java-shell/issues/133)) ([8fa6a67](https://www.github.com/googleapis/java-shell/commit/8fa6a67dc0e843cf86c9eb21e47b7d1bff240860))

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.6.0 ([#138](https://www.github.com/googleapis/java-shell/issues/138)) ([79f660f](https://www.github.com/googleapis/java-shell/commit/79f660f36bf8fc2e3da6227514296f135c5c4667))

### [2.1.6](https://www.github.com/googleapis/java-shell/compare/v2.1.5...v2.1.6) (2021-12-03)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.1 ([#129](https://www.github.com/googleapis/java-shell/issues/129)) ([d9e85a8](https://www.github.com/googleapis/java-shell/commit/d9e85a876e0a2a8ea535a0768f9fc3bb95a7e2a6))

### [2.1.5](https://www.github.com/googleapis/java-shell/compare/v2.1.4...v2.1.5) (2021-11-15)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.0 ([#121](https://www.github.com/googleapis/java-shell/issues/121)) ([6d1f176](https://www.github.com/googleapis/java-shell/commit/6d1f176fcf4e457dc96eb746b6eb32ee9e6924ff))

### [2.1.4](https://www.github.com/googleapis/java-shell/compare/v2.1.3...v2.1.4) (2021-10-26)

### Bug Fixes

* **java:** java 17 dependency arguments ([#1266](https://www.github.com/googleapis/java-shell/issues/1266)) ([#110](https://www.github.com/googleapis/java-shell/issues/110)) ([3815f56](https://www.github.com/googleapis/java-shell/commit/3815f56ee7c41cc37055945f78d4caed47d3a82d))

### [2.1.3](https://www.github.com/googleapis/java-shell/compare/v2.1.2...v2.1.3) (2021-10-19)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.4.0 ([#104](https://www.github.com/googleapis/java-shell/issues/104)) ([b482d97](https://www.github.com/googleapis/java-shell/commit/b482d970684c549e509e87ac5ad3f256f967d2cc))

### [2.1.2](https://www.github.com/googleapis/java-shell/compare/v2.1.1...v2.1.2) (2021-09-22)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.3.0 ([#89](https://www.github.com/googleapis/java-shell/issues/89)) ([51405ff](https://www.github.com/googleapis/java-shell/commit/51405ffde08f35c9bb1f18c27942926a91570bda))

### [2.1.1](https://www.github.com/googleapis/java-shell/compare/v2.1.0...v2.1.1) (2021-09-14)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.2.1 ([#82](https://www.github.com/googleapis/java-shell/issues/82)) ([ffe380d](https://www.github.com/googleapis/java-shell/commit/ffe380d3cef0bbe63b2f21b489dcc74352c264aa))

## [2.1.0](https://www.github.com/googleapis/java-shell/compare/v2.0.2...v2.1.0) (2021-08-31)

### Features

* Remove use of deprecated gradle command in java README ([#1196](https://www.github.com/googleapis/java-shell/issues/1196)) ([#66](https://www.github.com/googleapis/java-shell/issues/66)) ([999e72c](https://www.github.com/googleapis/java-shell/commit/999e72c4d3057bf867b8a391d88b128e8dcb2ba6))

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.2.0 ([#69](https://www.github.com/googleapis/java-shell/issues/69)) ([12a2999](https://www.github.com/googleapis/java-shell/commit/12a299956a4cf638aa6ada2c06a5f4a75075749e))

### [2.0.2](https://www.github.com/googleapis/java-shell/compare/v2.0.1...v2.0.2) (2021-08-23)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.1.0 ([#60](https://www.github.com/googleapis/java-shell/issues/60)) ([4b784bb](https://www.github.com/googleapis/java-shell/commit/4b784bb25f891afae4b2ee1439dbae4b35cb643f))

### [2.0.1](https://www.github.com/googleapis/java-shell/compare/v2.0.0...v2.0.1) (2021-08-12)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.0.1 ([#54](https://www.github.com/googleapis/java-shell/issues/54)) ([21bedab](https://www.github.com/googleapis/java-shell/commit/21bedabc96cf88aed44192da08ed9931fb00f1ec))

## [2.0.0](https://www.github.com/googleapis/java-shell/compare/v1.0.0...v2.0.0) (2021-08-06)

### ⚠ BREAKING CHANGES

* release gapic-generator-java v2.0.0 (#48)

### Features

* release gapic-generator-java v2.0.0 ([#48](https://www.github.com/googleapis/java-shell/issues/48)) ([8e485f2](https://www.github.com/googleapis/java-shell/commit/8e485f290f377afd8f10003749978adbf95405ca))

### Bug Fixes

* owlbot post-processor should generate README ([#1154](https://www.github.com/googleapis/java-shell/issues/1154)) ([#34](https://www.github.com/googleapis/java-shell/issues/34)) ([2a723df](https://www.github.com/googleapis/java-shell/commit/2a723dfeae11fcd71a0148b2f1d3961ac5682c1b)), closes [#1146](https://www.github.com/googleapis/java-shell/issues/1146) [#1147](https://www.github.com/googleapis/java-shell/issues/1147)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2 ([#49](https://www.github.com/googleapis/java-shell/issues/49)) ([82de6d1](https://www.github.com/googleapis/java-shell/commit/82de6d1b7fbe9d77385c37051e62e5a08e1371f5))

## [1.0.0](https://www.github.com/googleapis/java-shell/compare/v0.1.1...v1.0.0) (2021-07-01)

### Features

* promote to 1.0.0 ([#29](https://www.github.com/googleapis/java-shell/issues/29)) ([cb7e34d](https://www.github.com/googleapis/java-shell/commit/cb7e34df8f09c54dde2e36e6edd02c3179bb0020))

### Bug Fixes

* Add `shopt -s nullglob` to dependencies script ([#1130](https://www.github.com/googleapis/java-shell/issues/1130)) ([#26](https://www.github.com/googleapis/java-shell/issues/26)) ([82b74ef](https://www.github.com/googleapis/java-shell/commit/82b74efd4c1f2040c161244e842f7a3b16ca3153))

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.4.0 ([#28](https://www.github.com/googleapis/java-shell/issues/28)) ([1651ff8](https://www.github.com/googleapis/java-shell/commit/1651ff83ffec3bb020372fc07a9bd6674e2fcab5))

### [0.1.1](https://www.github.com/googleapis/java-shell/compare/v0.1.0...v0.1.1) (2021-06-04)

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.3.0 ([#16](https://www.github.com/googleapis/java-shell/issues/16)) ([5459be9](https://www.github.com/googleapis/java-shell/commit/5459be9746e663fbce788d9553f814dd74ee2517))

## 0.1.0 (2021-06-03)

### Features

* initial generation ([ed28275](https://www.github.com/googleapis/java-shell/commit/ed2827505d9d3da4591b5f49a4534d112d73979b))

### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.21.1 ([#8](https://www.github.com/googleapis/java-shell/issues/8)) ([a6e82c1](https://www.github.com/googleapis/java-shell/commit/a6e82c10a214442caee506953338fa17c797377d))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v1 ([#10](https://www.github.com/googleapis/java-shell/issues/10)) ([e6a522a](https://www.github.com/googleapis/java-shell/commit/e6a522ab0f666940de4bff748a65ab8c64c96a4e))


text:
import DeferredMixin from "ember-runtime/mixins/deferred";
import {get} from "ember-metal/property_get";
import EmberObject from "ember-runtime/system/object";

var Deferred = EmberObject.extend(DeferredMixin);

Deferred.reopenClass({
  promise: function(callback, binding) {
    var deferred = Deferred.create();
    callback.call(binding, deferred);
    return deferred;
  }
});

export default Deferred;

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Satooshi\Bundle\CoverallsV1Bundle\Entity;

/**
 * Metrics.
 *
 * @author Kitamura Satoshi <with.no.parachute@gmail.com>
 */
class Metrics
{
    /**
     * Number of statements.
     *
     * @var int
     */
    protected $statements;

    /**
     * Number of covered statements.
     *
     * @var int
     */
    protected $coveredStatements;

    /**
     * Line coverage.
     *
     * @var float
     */
    protected $lineCoverage;

    /**
     * Constructor.
     *
     * @param array $coverage Coverage data.
     */
    public function __construct(array $coverage = array())
    {
        if (!empty($coverage)) {
            // statements
            // not null
            $statementsArray = array_filter(
                $coverage,
                function ($line) {
                    return $line !== null;
                }
            );
            $this->statements = count($statementsArray);

            // coveredstatements
            // gt 0
            $coveredArray = array_filter(
                $statementsArray,
                function ($line) {
                    return $line > 0;
                }
            );
            $this->coveredStatements = count($coveredArray);
        } else {
            $this->statements = 0;
            $this->coveredStatements = 0;
        }
    }

    // API

    /**
     * Merge other metrics.
     *
     * @param Metrics $that
     */
    public function merge(Metrics $that)
    {
        $this->statements        += $that->statements;
        $this->coveredStatements += $that->coveredStatements;
        $this->lineCoverage = null; // clear previous data
    }

    // internal method

    /**
     * Calculate line coverage.
     *
     * @param int $statements        Number of statements.
     * @param int $coveredStatements Number of covered statements.
     *
     * @return float
     */
    protected function calculateLineCoverage($statements, $coveredStatements)
    {
        if ($statements === 0) {
            return 0;
        }

        return ($coveredStatements / $statements) * 100;
    }

    // accessor

    /**
     * Return whether the source file has executable statements.
     *
     * @return bool
     */
    public function hasStatements()
    {
        return $this->statements !== 0;
    }

    /**
     * Return number of statements.
     *
     * @return int
     */
    public function getStatements()
    {
        return $this->statements;
    }

    /**
     * Return number of covered statements.
     *
     * @return int
     */
    public function getCoveredStatements()
    {
        return $this->coveredStatements;
    }

    /**
     * Return line coverage.
     *
     * @return float
     */
    public function getLineCoverage()
    {
        if (!isset($this->lineCoverage)) {
            $this->lineCoverage = $this->calculateLineCoverage($this->statements, $this->coveredStatements);
        }

        return $this->lineCoverage;
    }
}


text:
Redis replication adopts a slave-master architecture. This module configure the master
that slave will link to. Redis does only user one master.

    module.exports = (service) ->
      options = service.options

## Identities

The Redis package does create the redis user.

      # Group
      options.group = name: options.group if typeof options.group is 'string'
      options.group ?= {}
      options.group.name ?= 'redis'
      options.group.system ?= true
      # User
      options.user = name: options.user if typeof options.user is 'string'
      options.user ?= {}
      options.user.name ?= 'redis'
      options.user.system ?= true
      options.user.comment ?= 'Redis Database Server'
      options.user.home ?= "/var/lib/#{options.user.name}"
      options.user.groups ?= []
      options.user.gid = options.group.name

## Master Configuration

      # Misc
      options.fqdn ?= service.node.fqdn
      options.hostname = service.node.hostname
      options.iptables ?= service.deps.iptables and service.deps.iptables.options.action is 'start'
      options.clean_logs ?= false
      options.conf_dir ?= "/etc/redis"
      options.pid_dir ?= '/var/run/redis'
      options.log_dir ?= '/var/log/redis'

## Configuration

      options.conf ?= {}
      options.conf['port'] ?= '6379'
      options.conf['pidfile'] ?= "#{options.pid_dir}/redis.pid"
      options.conf['daemonize'] ?= 'no'
      options.conf['tcp-backlog'] ?= '511' #somaxconn #tcp_max_syn_backlog
      options.conf['bind'] ?= '0.0.0.0'
      options.conf['timeout'] ?= '0'
      options.conf['loglevel'] ?= 'notice'
      options.conf['logfile'] ?= "#{options.log_dir}/redis.log"
      options.conf['databases'] ?= '16'

## Snapshotting

      options.conf['save'] ?= '900 1' #save <seconds> <changes>
      options.conf['stop-writes-on-bgsave-error'] ?= 'yes'
      options.conf['rdbcompression'] ?= 'yes'
      options.conf['rdbchecksum'] ?= 'yes'
      options.conf['dbfilename'] ?= 'dump.rdb'
      options.conf['dir'] ?= "#{options.user.home}/snapshots"
      options.conf['appendonly'] ?= 'yes'

## Replication
Options by default configured from [Redis Official][redis-replication] documentation

      options.conf['slave-serve-stale-data'] ?= 'yes'
      options.conf['min-slaves-to-write'] ?= '1'
      options.conf['min-slaves-max-lag'] ?= '30'

## Security
Add password authentication

      options.master_password ?= 'redis123'
      throw Error 'Missing Redis master password' unless options.master_password?
      options.conf['requirepass'] ?= options.master_password

## Wait

      options.wait =
        host: service.node.fqdn
        port: options.conf.port

## Dependencies

    quote = require 'regexp-quote'

[redis-replication]:https://redis.io/topics/replication
[redis-cluster]: https://redis.io/topics/cluster-tutorial


text:
require 'securerandom'

module KaModUsers
  module V1
    class SessionsController < KaModUsers::ApplicationController
      before_filter :authenticate, :only => ["destroy"]

      def create
        if params[:access_token].nil? || params[:website_id].nil?
          head :bad_request
        else
          # validate token etc.
          fb_client = Facebook::Client.new(:token => params[:access_token])
          fb_user = fb_client.me

          # we couldn't use the access_token on Facebook api
          unless fb_user.nil?
            # this can also be done in one shot with a single request to the users extension!
            user = RestClient.get User.resource.to_s, {:params => {'filter[email]' => fb_user['email']}}
            # RestClient should do this by itself! Response headers are correct, strange that it is not decoding it!
            user = ActiveSupport::JSON.decode(user)

            if user.nil?
              user = User.resource.post({:user => {:email => fb_user['email'], :website_id => params[:website_id]}})
              user = ActiveSupport::JSON.decode(user)
            end

            token = User.resource["#{user['id']}/tokens"].post({:token => {:external_token => params[:access_token], :website_id => params[:website_id]}})
            token = ActiveSupport::JSON.decode(token)

            render json: {:token => token, :user => user}
          else
            head :bad_request
          end
        end
      end

      def destroy
      	Token.resource[@current_user['token']].delete
        head :ok
      end
    end
  end
end


text:
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var qc;
(function (qc) {
    var demo;
    (function (demo) {
        var Test = (function (_super) {
            __extends(Test, _super);
            function Test(gameObject) {
                _super.call(this, gameObject);
                this.serializableFields = {
                    clue: qc.Serializer.STRING
                };
                // Init the behaviour
                this.clue = 'Hello';
            }
            Test.prototype.onClick = function (e) {
                alert(this.clue);
            };
            Test.prototype.update = function () {
                this.gameObject.rotation += 0.2;
            };
            return Test;
        })(qc.Behaviour);
        demo.Test = Test;
        qc.registerBehaviour('qc.demo.Test', Test);
    })(demo = qc.demo || (qc.demo = {}));
})(qc || (qc = {}));
//# sourceMappingURL=ts.js.map


text:
package minium.cucumber;

import static java.util.Collections.emptyList;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import minium.cucumber.data.MiniumFeatureBuilder;

import org.junit.Test;

import com.google.common.collect.Maps;

import cucumber.runtime.io.Resource;
import cucumber.runtime.model.CucumberFeature;

public class FeatureLineOffsetsTest {

    public static final List<Object> NO_FILTERS = emptyList();

    @Test
    public void testLinesOffSetsWithoutChanges() throws IOException {
        List<CucumberFeature> features = new ArrayList<CucumberFeature>();
        Map<Integer, Integer> lineOffset;
        try (MiniumFeatureBuilder builder = new MiniumFeatureBuilder(features, true)) {
            Resource resource = createResourceMock("example-without-comments.feature");
            builder.parse(resource, NO_FILTERS);
            lineOffset = builder.getLineOffset();
        }
        assertTrue(lineOffset.values().isEmpty());
        assertTrue(lineOffset.keySet().isEmpty());
    }

    @Test
    public void testLinesOffSetslWithExamples() throws IOException {
        Map<Integer, Integer> lineOffsetExpected = Maps.newTreeMap();
        lineOffsetExpected.put(21, 22);
        lineOffsetExpected.put(22, 24);
        lineOffsetExpected.put(23, 26);
        lineOffsetExpected.put(24, 28);
        lineOffsetExpected.put(25, 36);
        lineOffsetExpected.put(26, 37);
        lineOffsetExpected.put(27, 38);
        lineOffsetExpected.put(32, 47);
        lineOffsetExpected.put(33, 48);
        lineOffsetExpected.put(34, 49);
        List<CucumberFeature> features = new ArrayList<CucumberFeature>();
        Map<Integer, Integer> lineOffset;
        try (MiniumFeatureBuilder builder = new MiniumFeatureBuilder(features, true)) {
            Resource resource = createResourceMock("example-with-comments.feature");
            builder.parse(resource, NO_FILTERS);
            lineOffset = builder.getLineOffset();
        }
        assertTrue(lineOffsetExpected.equals(lineOffset));
    }

    @Test
    public void testLinesOffSetsWithDataTables() throws IOException {
        Map<Integer, Integer> lineOffsetExpected = Maps.newTreeMap();
        lineOffsetExpected.put(14, 16);
        lineOffsetExpected.put(15, 17);
        lineOffsetExpected.put(16, 18);
        lineOffsetExpected.put(22, 24);
        lineOffsetExpected.put(23, 25);
        lineOffsetExpected.put(24, 26);
        lineOffsetExpected.put(28, 30);
        lineOffsetExpected.put(29, 31);
        lineOffsetExpected.put(30, 32);
        List<CucumberFeature> features = new ArrayList<CucumberFeature>();
        Map<Integer, Integer> lineOffset;
        try (MiniumFeatureBuilder builder = new MiniumFeatureBuilder(features, true)) {
            Resource resource = createResourceMock("feature-to-test-offsets.feature");
            builder.parse(resource, NO_FILTERS);
            lineOffset = builder.getLineOffset();
        }

        assertTrue(lineOffsetExpected.equals(lineOffset));
    }

    private Resource createResourceMock(String featurePath) throws IOException {
        Resource resource = mock(Resource.class);
        when(resource.getPath()).thenReturn(featurePath);
        when(resource.getInputStream()).thenReturn(FeatureDecoratorTest.class.getClassLoader().getResourceAsStream(featurePath));
        return resource;
    }
}


text:
. /etc/rc.subr

name="smtp_update"
rcvar=${name}_enable
# smtp_update is set by rc.conf

start_cmd="${name}_start"
stop_cmd="${name}_stop"

SNMPTRAP_BIN=/usr/local/bin/snmptrap
COMMUNITY=private
REMOTE_HOST=mail.domain.com
DOMAIN=`hostname`
SCRIPT=`basename $0`
LOCKFILE=/var/tmp/$SCRIPT

if [ ! -x $SNMPTRAP_BIN ]; then
    exit 1
fi

smtp_update_start() {
    STDOUT="Adding domain to Sendmail host:"

    if [ ! -e $LOCKFILE ]; then
        $SNMPTRAP_BIN -v 2c -c $COMMUNITY $REMOTE_HOST "" SNMPv2-MIB::snmpTrap.2.0 SNMPv2-MIB::sysLocation.0 s $DOMAIN

        if [ $? -eq 0 ]; then
            echo "$STDOUT success"
            touch $LOCKFILE
        else
            echo "$STDOUT failed"
            exit 1
        fi
    fi
}

smtp_update_stop() {
    STDOUT="Removing domain from Sendmail host:"

    if [ -e $LOCKFILE ]; then
        $SNMPTRAP_BIN -v 2c -c $COMMUNITY $REMOTE_HOST "" SNMPv2-MIB::snmpTrap.2.1 SNMPv2-MIB::sysLocation.0 s $DOMAIN

        if [ $? -eq 0 ]; then
            echo "$STDOUT success"
            rm -f $LOCKFILE
        else
            echo "$STDOUT failed"
            exit 1
        fi
    fi
}

load_rc_config ${name}
run_rc_command "$1"


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

#include <memory>
#include <string>
#include <vector>

#include <gtest/gtest.h>

#include "arrow/compute/function.h"
#include "arrow/compute/registry.h"
#include "arrow/result.h"
#include "arrow/status.h"
#include "arrow/testing/gtest_util.h"
#include "arrow/util/macros.h"

namespace arrow {
namespace compute {

using MakeFunctionRegistry = std::function<std::unique_ptr<FunctionRegistry>()>;
using GetNumFunctions = std::function<int()>;
using GetFunctionNames = std::function<std::vector<std::string>()>;
using TestRegistryParams =
    std::tuple<MakeFunctionRegistry, GetNumFunctions, GetFunctionNames, std::string>;

struct TestRegistry : public ::testing::TestWithParam<TestRegistryParams> {};

TEST(TestRegistry, CreateBuiltInRegistry) {
  // This does DCHECK_OK internally for now so this will fail in debug builds
  // if there is a problem initializing the global function registry
  FunctionRegistry* registry = GetFunctionRegistry();
  ARROW_UNUSED(registry);
}

TEST_P(TestRegistry, Basics) {
  auto registry_factory = std::get<0>(GetParam());
  auto registry_ = registry_factory();
  auto get_num_funcs = std::get<1>(GetParam());
  int n_funcs = get_num_funcs();
  auto get_func_names = std::get<2>(GetParam());
  std::vector<std::string> func_names = get_func_names();
  ASSERT_EQ(n_funcs, registry_->num_functions());

  std::shared_ptr<Function> func = std::make_shared<ScalarFunction>(
      "f1", Arity::Unary(), /*doc=*/FunctionDoc::Empty());
  ASSERT_OK(registry_->AddFunction(func));
  ASSERT_EQ(n_funcs + 1, registry_->num_functions());

  func = std::make_shared<VectorFunction>("f0", Arity::Binary(),
                                          /*doc=*/FunctionDoc::Empty());
  ASSERT_OK(registry_->AddFunction(func));
  ASSERT_EQ(n_funcs + 2, registry_->num_functions());

  ASSERT_OK_AND_ASSIGN(std::shared_ptr<const Function> f1, registry_->GetFunction("f1"));
  ASSERT_EQ("f1", f1->name());

  // Non-existent function
  ASSERT_RAISES(KeyError, registry_->GetFunction("f2"));

  // Try adding a function with name collision
  func = std::make_shared<ScalarAggregateFunction>("f1", Arity::Unary(),
                                                   /*doc=*/FunctionDoc::Empty());
  ASSERT_RAISES(KeyError, registry_->AddFunction(func));

  // Allow overwriting by flag
  ASSERT_OK(registry_->AddFunction(func, /*allow_overwrite=*/true));
  ASSERT_OK_AND_ASSIGN(f1, registry_->GetFunction("f1"));
  ASSERT_EQ(Function::SCALAR_AGGREGATE, f1->kind());

  std::vector<std::string> expected_names(func_names);
  for (auto name : {"f0", "f1"}) {
    expected_names.push_back(name);
  }
  std::sort(expected_names.begin(), expected_names.end());
  ASSERT_EQ(expected_names, registry_->GetFunctionNames());

  // Aliases
  ASSERT_RAISES(KeyError, registry_->AddAlias("f33", "f3"));
  ASSERT_OK(registry_->AddAlias("f11", "f1"));
  ASSERT_OK_AND_ASSIGN(std::shared_ptr<const Function> f2, registry_->GetFunction("f11"));
  ASSERT_EQ(func, f2);
}

// Define a custom print since the default Googletest print trips Valgrind
void PrintTo(const TestRegistryParams& param, std::ostream* os) {
  (*os) << "TestRegistryParams{"
        << "get_num_funcs()=" << std::get<1>(param)() << ", get_func_names()=";
  for (std::string func_name : std::get<2>(param)()) {
    (*os) << func_name;
  }
  (*os) << ", name=" << std::get<3>(param) << "}";
}

INSTANTIATE_TEST_SUITE_P(
    TestRegistry, TestRegistry,
    testing::Values(
        TestRegistryParams{std::make_tuple(
            static_cast<MakeFunctionRegistry>([]() { return FunctionRegistry::Make(); }),
            []() { return 0; }, []() { return std::vector<std::string>{}; }, "default")},
        TestRegistryParams{std::make_tuple(
            static_cast<MakeFunctionRegistry>([]() {
              return FunctionRegistry::Make(GetFunctionRegistry());
            }),
            []() { return GetFunctionRegistry()->num_functions(); },
            []() { return GetFunctionRegistry()->GetFunctionNames(); }, "nested")}));

TEST(TestRegistry, RegisterTempFunctions) {
  auto default_registry = GetFunctionRegistry();
  constexpr int rounds = 3;
  for (int i = 0; i < rounds; i++) {
    auto registry = FunctionRegistry::Make(default_registry);
    for (std::string func_name : {"f1", "f2"}) {
      std::shared_ptr<Function> func = std::make_shared<ScalarFunction>(
          func_name, Arity::Unary(), /*doc=*/FunctionDoc::Empty());
      ASSERT_OK(registry->CanAddFunction(func));
      ASSERT_OK(registry->AddFunction(func));
      ASSERT_RAISES(KeyError, registry->CanAddFunction(func));
      ASSERT_RAISES(KeyError, registry->AddFunction(func));
      ASSERT_OK(default_registry->CanAddFunction(func));
    }
  }
}

TEST(TestRegistry, RegisterTempAliases) {
  auto default_registry = GetFunctionRegistry();
  std::vector<std::string> func_names = default_registry->GetFunctionNames();
  constexpr int rounds = 3;
  for (int i = 0; i < rounds; i++) {
    auto registry = FunctionRegistry::Make(default_registry);
    for (std::string func_name : func_names) {
      std::string alias_name = "alias_of_" + func_name;
      std::shared_ptr<Function> func = std::make_shared<ScalarFunction>(
          func_name, Arity::Unary(), /*doc=*/FunctionDoc::Empty());
      ASSERT_RAISES(KeyError, registry->GetFunction(alias_name));
      ASSERT_OK(registry->CanAddAlias(alias_name, func_name));
      ASSERT_OK(registry->AddAlias(alias_name, func_name));
      ASSERT_OK(registry->GetFunction(alias_name));
      ASSERT_OK(default_registry->GetFunction(func_name));
      ASSERT_RAISES(KeyError, default_registry->GetFunction(alias_name));
    }
  }
}

template <int kExampleSeqNum>
class ExampleOptions : public FunctionOptions {
 public:
  explicit ExampleOptions(std::shared_ptr<Scalar> value);
  std::shared_ptr<Scalar> value;
};

template <int kExampleSeqNum>
class ExampleOptionsType : public FunctionOptionsType {
 public:
  static const FunctionOptionsType* GetInstance() {
    static std::unique_ptr<FunctionOptionsType> instance(
        new ExampleOptionsType<kExampleSeqNum>());
    return instance.get();
  }
  const char* type_name() const override {
    static std::string name = std::string("example") + std::to_string(kExampleSeqNum);
    return name.c_str();
  }
  std::string Stringify(const FunctionOptions& options) const override {
    return type_name();
  }
  bool Compare(const FunctionOptions& options,
               const FunctionOptions& other) const override {
    return true;
  }
  std::unique_ptr<FunctionOptions> Copy(const FunctionOptions& options) const override {
    const auto& opts = static_cast<const ExampleOptions<kExampleSeqNum>&>(options);
    return std::make_unique<ExampleOptions<kExampleSeqNum>>(opts.value);
  }
};
template <int kExampleSeqNum>
ExampleOptions<kExampleSeqNum>::ExampleOptions(std::shared_ptr<Scalar> value)
    : FunctionOptions(ExampleOptionsType<kExampleSeqNum>::GetInstance()),
      value(std::move(value)) {}

TEST(TestRegistry, RegisterTempFunctionOptionsType) {
  auto default_registry = GetFunctionRegistry();
  std::vector<const FunctionOptionsType*> options_types = {
      ExampleOptionsType<1>::GetInstance(),
      ExampleOptionsType<2>::GetInstance(),
  };
  constexpr int rounds = 3;
  for (int i = 0; i < rounds; i++) {
    auto registry = FunctionRegistry::Make(default_registry);
    for (auto options_type : options_types) {
      ASSERT_OK(registry->CanAddFunctionOptionsType(options_type));
      ASSERT_OK(registry->AddFunctionOptionsType(options_type));
      ASSERT_RAISES(KeyError, registry->CanAddFunctionOptionsType(options_type));
      ASSERT_RAISES(KeyError, registry->AddFunctionOptionsType(options_type));
      ASSERT_OK(default_registry->CanAddFunctionOptionsType(options_type));
    }
  }
}

TEST(TestRegistry, RegisterNestedFunctions) {
  auto default_registry = GetFunctionRegistry();
  std::shared_ptr<Function> func1 = std::make_shared<ScalarFunction>(
      "f1", Arity::Unary(), /*doc=*/FunctionDoc::Empty());
  std::shared_ptr<Function> func2 = std::make_shared<ScalarFunction>(
      "f2", Arity::Unary(), /*doc=*/FunctionDoc::Empty());
  constexpr int rounds = 3;
  for (int i = 0; i < rounds; i++) {
    auto registry1 = FunctionRegistry::Make(default_registry);

    ASSERT_OK(registry1->CanAddFunction(func1));
    ASSERT_OK(registry1->AddFunction(func1));

    for (int j = 0; j < rounds; j++) {
      auto registry2 = FunctionRegistry::Make(registry1.get());

      ASSERT_OK(registry2->CanAddFunction(func2));
      ASSERT_OK(registry2->AddFunction(func2));
      ASSERT_RAISES(KeyError, registry2->CanAddFunction(func2));
      ASSERT_RAISES(KeyError, registry2->AddFunction(func2));
      ASSERT_OK(default_registry->CanAddFunction(func2));
    }

    ASSERT_RAISES(KeyError, registry1->CanAddFunction(func1));
    ASSERT_RAISES(KeyError, registry1->AddFunction(func1));
    ASSERT_OK(default_registry->CanAddFunction(func1));
  }
}

}  // namespace compute
}  // namespace arrow


text:
#include "stdafx.h"

#if defined(_WIN32_WCE) && !defined( OS_PLATFORM_MOTCE )
#include <soundfile.h>
#endif

#include <common/RhodesApp.h>
#include <common/rhoparams.h>

#include "Alert.h"
#include "MainWindow.h"
#include "Vibrate.h"
#include "common/RhoAppAdapter.h"

extern "C" HWND getMainWnd();

/**
 ********************************************************************************
 * CAlertDialog members.
 ********************************************************************************
 */

//TODO:
//      - smart alignment and win32
//      - review for memory leaks.

typedef CWinTraits <WS_CAPTION  | WS_VISIBLE | WS_POPUP | DS_CENTER> CAlertDialogTraits;

CAlertDialog::CAlertDialog(Params *params)
{
	m_title    = params->m_title;
	m_message  = params->m_message;
	m_callback = params->m_callback;
	m_icon     = params->m_icon;

	int id = ID_ALERT_DLG_BUTTON_FIRST;
    for (int i = 0; i < (int)params->m_buttons.size(); i++)
    {
		if(id > ID_ALERT_DLG_BUTTON_LAST)
        {
			LOG(ERROR) + "too many buttons";
			break;
		}
        m_buttons.addElement(CustomButton( params->m_buttons.elementAt(i).m_strCaption,
            params->m_buttons.elementAt(i).m_strID, id++));
	}

	/*for (Hashtable<String, String>::iterator itr = params->m_buttons.begin(); itr != params->m_buttons.end(); ++itr) {
		if(id > ID_ALERT_DLG_BUTTON_LAST) {
			LOG(ERROR) + "too many buttons";
			break;
		}
		m_buttons.addElement(CustomButton(itr->first, itr->second, id++));
	}*/
}

CAlertDialog::~CAlertDialog()
{
}

void CAlertDialog::DoInitTemplate()
{
#ifdef OS_WINCE
	int initialWidth  = GetSystemMetrics(SM_CXSCREEN)/3;
#else
	int initialWidth  = CMainWindow::getScreenWidth()/3;
#endif
	int initialHeight = initialWidth/3;

	m_Template.Create(false, convertToStringW(m_title).c_str(),
						0,
						0,
						initialWidth,
						initialHeight,
						CAlertDialogTraits::GetWndStyle(0),
						CAlertDialogTraits::GetWndExStyle(0));
}

void CAlertDialog::DoInitControls()
{
}

LRESULT CAlertDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL&bHandled)
{

#define MAX(i, j)   ((i) > (j) ? (i) : (j))
#define MIN(i, j)   ((i) < (j) ? (i) : (j))

	const int GAP    = 12; //space around dialog
	const int INDENT = 14;  //for dialog items

#ifdef OS_WINCE
	unsigned int maxWidth  = GetSystemMetrics(SM_CXSCREEN) - (GAP * 2);
	unsigned int maxHeight = GetSystemMetrics(SM_CYSCREEN) - (GAP * 2);
#else
	int maxWidth  = CMainWindow::getScreenWidth() - (GAP * 2);
	int maxHeight = CMainWindow::getScreenHeight() - (GAP * 2);
#endif
	int xBorderWidth = GetSystemMetrics(SM_CXEDGE);
	int yBorderWidth = GetSystemMetrics(SM_CYEDGE);
	CClientDC dc(m_hWnd);
	TEXTMETRIC tm = { 0 };
	RECT rect = {0}, dlgRect, iconRect = {0 }, msgRect = { 0 }, buttonsRect = { 0 };

	GetClientRect(&dlgRect);

	/***************************************************************************
      Icon.
	 ***************************************************************************/
	HICON hIcon = loadIcon();
	if (hIcon == NULL) {
		LOG(ERROR) + "Failed to load icon";
	} else {
		iconRect.left = INDENT;
		iconRect.top  = INDENT;
		iconRect.right  = iconRect.left + GetSystemMetrics(SM_CXICON);
		iconRect.bottom = iconRect.top + GetSystemMetrics(SM_CYICON);

		m_iconCtrl.Create(m_hWnd, iconRect, NULL, WS_CHILD | WS_VISIBLE | SS_ICON);
		m_iconCtrl.SetIcon(hIcon);
	}
	int iconHeight = iconRect.bottom - iconRect.top;
	int iconWidth  = iconRect.left - iconRect.right;

	/***************************************************************************
	  Message.
	 ***************************************************************************/
	GetClientRect(&dlgRect);

	//create control
	m_messageCtrl.Create(m_hWnd, CWindow::rcDefault, NULL, WS_CHILD | WS_VISIBLE);

	//change control  font to normal
	HFONT hFont = m_messageCtrl.GetFont();
	LOGFONT fontAttributes = { 0 };
    ::GetObject(hFont, sizeof(fontAttributes), &fontAttributes);
    fontAttributes.lfWeight = FW_NORMAL;
	hFont = CreateFontIndirect(&fontAttributes);
	m_messageCtrl.SetFont(hFont);

	//get text metrics
	dc.GetTextMetrics(&tm);

	int msgWidth  =  (int)(m_message.length() * (tm.tmAveCharWidth * 1.3) + (2 * INDENT));
	int msgHeight =  tm.tmHeight + tm.tmExternalLeading + tm.tmInternalLeading;

	int desiredDlgWidth = iconRect.right + msgWidth + (INDENT * 2);

	//space around label on buttons.
	const int btnHIndent = 12; //horizontal
	const int btnVIndent = 8;  //vertical

	int btnsNum = m_buttons.size();
	int btnsHeight =tm.tmHeight + btnVIndent;

	//if desired widht is bigger than current - make dialog window bigger
	if (desiredDlgWidth > (dlgRect.right - dlgRect.left)) {
		// if desired width is bigger than maximum width
		// - recalculate dialog window with wrapped text
		if (desiredDlgWidth >= (int)maxWidth) {
			msgWidth = maxWidth - (iconRect.right + INDENT*2 + xBorderWidth*2);
			msgHeight = (((m_message.length() * tm.tmAveCharWidth) / msgWidth) + 1)
						* (tm.tmHeight + tm.tmExternalLeading + tm.tmInternalLeading);
			desiredDlgWidth = maxWidth;
		}

		MoveWindow(0, 0, desiredDlgWidth,
					MAX(iconRect.bottom, msgHeight) + GetSystemMetrics(SM_CYCAPTION) + INDENT + yBorderWidth * 2 +
                    btnsHeight);
	} else {
		//TODO: centering message
	}

	m_messageCtrl.SetWindowText(convertToStringW(m_message).c_str());

	//LOG(INFO) + "iconHeight  msgHeight " + iconHeight + " "+ msgHeight;

	if (iconHeight > msgHeight) {
		msgRect.left = iconRect.right + INDENT;
		msgRect.top  = iconRect.top + (iconHeight - msgHeight)/2;
		msgRect.right  = msgRect.left + msgWidth;
		msgRect.bottom = msgRect.top + msgHeight;
		//center message on icon
		m_messageCtrl.MoveWindow(iconRect.right + INDENT, iconRect.top + (iconHeight - msgHeight)/2, msgWidth, msgHeight);
	} else {
		msgRect.left = iconRect.right + INDENT;
		msgRect.top  = iconRect.top;
		msgRect.right  = msgRect.left + msgWidth;
		msgRect.bottom = msgRect.top + msgHeight;
		m_messageCtrl.MoveWindow(iconRect.right + INDENT, iconRect.top, msgWidth, msgHeight);
		//center icon on message
		if (hIcon) {
			m_iconCtrl.MoveWindow(INDENT, iconRect.top + (msgHeight - iconHeight)/2, iconWidth, iconHeight);
			m_iconCtrl.SetIcon(hIcon);
		}
	}

	//for Wait dailog text should be centered
	if (m_buttons.size() == 0) {
		m_messageCtrl.CenterWindow();
	}

	/***************************************************************************
	  Buttons.
	 ***************************************************************************/

	GetClientRect(&dlgRect);

	//for (Vector<CustomButton>::iterator itr = m_buttons.begin(); itr != m_buttons.end(); ++itr) {
	//	btnsWidth += (itr->m_title.length() * tm.tmAveCharWidth) + btnHIndent + (INDENT * 2);
	//}

	POINT point;
	point.x = INDENT, point.y = (iconHeight > msgHeight ? point.y = iconHeight + 6 : msgHeight + 2) + INDENT;

	unsigned int btnWidth = 87, btnHeight = 0;
	btnHeight = tm.tmHeight + btnVIndent;

	//if (iconHeight + msgHeight + INDENT + btnHeight + INDENT > dlgRect.) {
	//}

	for (Vector<CustomButton>::iterator itr = m_buttons.begin(); itr != m_buttons.end(); ++itr)
    {
		//btnWidth = (itr->m_title.length() * tm.tmAveCharWidth) + btnHIndent;

		RECT rc = {point.x, point.y, point.x + btnWidth, point.y + btnHeight};
		itr->Create(m_hWnd, rc,
					convertToStringW(itr->m_title).c_str(),
					WS_CHILD | WS_VISIBLE, 0,
					itr->m_numId);

		point.x += btnWidth + INDENT;
	}

	CenterWindow();

	return bHandled = FALSE;

#undef MAX
#undef MIN
}

bool CAlertDialog::findButton(int id, CustomButton &btn)
{
	for (Vector<CustomButton>::iterator itr = m_buttons.begin(); itr != m_buttons.end(); ++itr) {
		if (itr->m_numId == id) {
			btn = *itr;
			return true;
		}
	}

	return false;
}

LRESULT CAlertDialog::OnAlertDialogButton (WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	CustomButton cbtn;
	if (findButton((int) wID, cbtn))
		rho_rhodesapp_callPopupCallback(m_callback.c_str(), cbtn.m_strId.c_str(), cbtn.m_title.c_str());
	else
		LOG(ERROR) + "internal error";

	EndDialog(wID);
	return 0;
}

HICON CAlertDialog::loadIcon()
{
	HICON hIcon = NULL;

	struct iconTable_s {
		String name;
#ifdef OS_WINCE
		int id;
#else
		LPWSTR id;
#endif
	} iconTable[] =	{
#ifdef OS_WINCE
						{ "alert",    MB_ICONWARNING     },
						{ "question", MB_ICONQUESTION    },
						{ "info",     MB_ICONINFORMATION }
#else
						{ "alert",    IDI_WARNING },
						{ "question", IDI_QUESTION    },
						{ "info",     IDI_INFORMATION }
#endif
					};

#ifdef OS_WINCE
	int iconId = 0;
#else
	LPWSTR iconId = NULL;
#endif

	for (int i = 0; i < (sizeof(iconTable)/sizeof(iconTable[0])); i++)
	{
		//LOG(ERROR) + "ICON == " + iconTable[i].name;
		if (iconTable[i].name == m_icon)
			iconId = iconTable[i].id;
	}

	if (iconId != 0)
	{
#ifdef OS_WINCE
		HMODULE hGWES = LoadLibraryEx( L"gwes.exe", NULL, LOAD_LIBRARY_AS_DATAFILE );
		hIcon = LoadIcon(hGWES, MAKEINTRESOURCE(iconId));
#else
		hIcon = LoadIcon(NULL, iconId);
#endif
	}
	//TODO: if icon has predefined type - try to load it from system resources.

	return hIcon;
}

/**
 ********************************************************************************
 * CAlert members.
 ********************************************************************************
 */

IMPLEMENT_LOGCLASS(CAlert, "Alert");

void CAlert::showPopup(CAlertDialog::Params *params)
{
    HWND main_wnd = getMainWnd();
	::PostMessage(main_wnd, WM_ALERT_SHOW_POPUP, 0, (LPARAM ) params);
}

#if _WIN32_WCE > 0x501 && !defined( OS_PLATFORM_CE )
void CAlert::vibrate(int duration_ms)
{
    CVibrate::getCVibrate().toggle(duration_ms);
}

void CAlert::playFile(String fileName)
{
    rho::String path = RHODESAPP().getRhoRootPath() + "apps" + fileName;

    HSOUND hSound;

    rho::String::size_type pos = 0;
    while ( (pos = path.find('/', pos)) != rho::String::npos ) {
        path.replace( pos, 1, "\\");
        pos++;
    }

    StringW strPathW = convertToStringW(path);
    HRESULT hr = SndOpen( strPathW.c_str(), &hSound);
    hr = SndPlayAsync (hSound, 0);

    if (hr != S_OK) {
        LOG(WARNING) + "OnAlertPlayFile: failed to play file";
    }

    WaitForSingleObject(hSound, INFINITE);

    hr = SndClose(hSound);
    SndStop(SND_SCOPE_PROCESS, NULL);
}

#endif //_WIN32_WCE

extern "C" void alert_show_status(const char* szTitle, const char* szMessage, const char* szHide)
{
    String message = szMessage ? szMessage : "";
    String title = szTitle ? szTitle : "";
    Vector<CAlertDialog::Params::CAlertButton> buttons;
    //buttons.addElement( CAlertDialog::Params::CAlertButton(szHide, "") );

    CAlert::showPopup(new CAlertDialog::Params(title, message, String(), String(), buttons, CAlertDialog::Params::DLG_STATUS ));
}

extern "C" void alert_show_popup(rho_param *p)
{
	if (p->type == RHO_PARAM_STRING) {
		CAlert::showPopup(new CAlertDialog::Params(String(p->v.string)));
	} else if (p->type == RHO_PARAM_HASH) {
		String title, message, callback, icon;
		String btnId, btnTitle;
		//Hashtable<String, String> buttons;
        Vector<CAlertDialog::Params::CAlertButton> buttons;

		for (int i = 0, lim = p->v.hash->size; i < lim; ++i) {
			char *name = p->v.hash->name[i];
            rho_param *value = p->v.hash->value[i];

			if (strcasecmp(name, "title") == 0) {
                if (value->type != RHO_PARAM_STRING) {
                    RAWLOG_ERROR("'title' should be string");
                    continue;
                }
                title = value->v.string;
            }
			else if (strcasecmp(name, "message") == 0) {
                if (value->type != RHO_PARAM_STRING) {
                    RAWLOG_ERROR("'message' should be string");
                    continue;
                }
                message = value->v.string;
            }
            else if (strcasecmp(name, "callback") == 0) {
                if (value->type != RHO_PARAM_STRING) {
                    RAWLOG_ERROR("'callback' should be string");
                    continue;
                }
                callback = value->v.string;
            } else if (strcasecmp(name, "icon") == 0) {
                if (value->type != RHO_PARAM_STRING) {
                    RAWLOG_ERROR("'title' should be string");
                    continue;
                }
                icon = value->v.string;
            }

            else if (strcasecmp(name, "buttons") == 0) {
				if (value->type != RHO_PARAM_ARRAY) {
                    RAWLOG_ERROR("'buttons' should be array");
                    continue;
                }
				for (int j = 0, limj = value->v.array->size; j < limj; ++j) {
					rho_param *arrValue = value->v.array->value[j];
					switch (arrValue->type) {
						case RHO_PARAM_STRING:
							btnId    = arrValue->v.string;
							btnTitle = arrValue->v.string;
							break;
						case RHO_PARAM_HASH:
							for (int k = 0, limk = arrValue->v.hash->size; k < limk; ++k) {
                                char *sName = arrValue->v.hash->name[k];
                                rho_param *sValue = arrValue->v.hash->value[k];
                                if (sValue->type != RHO_PARAM_STRING) {
                                    RAWLOG_ERROR("Illegal type of button item's value");
                                    continue;
                                }
                                if (strcasecmp(sName, "id") == 0)
                                    btnId = sValue->v.string;
                                else if (strcasecmp(sName, "title") == 0)
                                    btnTitle = sValue->v.string;
                            }
							break;
						default:
							RAWLOG_ERROR("Illegal type of button item");
							continue;
					}
					if (btnId == "" || btnTitle == "") {
						RAWLOG_ERROR("Incomplete button item");
						continue;
					}

                    buttons.addElement( CAlertDialog::Params::CAlertButton(btnTitle, btnId) );
				}
			}//buttons
		}

		CAlert::showPopup(new CAlertDialog::Params(title, message, icon, callback, buttons, CAlertDialog::Params::DLG_CUSTOM));
	}
}

extern "C" void alert_vibrate(int duration_ms) {
#if _WIN32_WCE > 0x501 && !defined( OS_PLATFORM_CE )
    CAlert::vibrate(duration_ms);
#endif
}

extern "C" void alert_play_file(char* file_name, char* media_type) {
#if _WIN32_WCE > 0x501 && !defined( OS_PLATFORM_CE )
    CAlert::playFile(file_name);
#endif
}

extern "C" void alert_hide_popup()
{
	HWND main_wnd = getMainWnd();
	::PostMessage(main_wnd, WM_ALERT_HIDE_POPUP, 0, 0);
}


text:
using namespace BOOST_SPIRIT_CLASSIC_NS;

void shortest_alternative_parser_test()
{
    typedef
        shortest_alternative<
            shortest_alternative<
                shortest_alternative<
                    strlit<>,
                    strlit<> >,
                strlit<> >,
            strlit<> >
    parser_t;

    parser_t short_rule =
        shortest_d[
            str_p("a")
            | str_p("aa")
            | str_p("aaa")
            | str_p("aaaa")
        ];

    BOOST_TEST(parse("a", short_rule).full);
    BOOST_TEST(parse("aa", short_rule).length == 1);
    BOOST_TEST(parse("aaa", short_rule).length == 1);
    BOOST_TEST(parse("aaaa", short_rule).length == 1);

    short_rule =
        shortest_d[
            str_p("d")
            | str_p("cd")
            | str_p("bcd")
            | str_p("abcd")
        ];

    BOOST_TEST(parse("d", short_rule).full);
    BOOST_TEST(parse("cd", short_rule).full);
    BOOST_TEST(parse("bcd", short_rule).full);
    BOOST_TEST(parse("abcd", short_rule).full);
}

int
main()
{
    shortest_alternative_parser_test();
    return boost::report_errors();
}


text:
import unittest
import sys

from cli.command.monitor_cli_parser import MonitorCLIParser
from cli.command.monitor_cli_parser import DagdaMonitorParser
from cli.command.monitor_cli_parser import monitor_parser_text

class MonitorCLIParserTestCase(unittest.TestCase):

    def test_empty_args(self):
        empty_args = generate_args('69dbf26ab368', False, False)
        status = MonitorCLIParser.verify_args(empty_args)
        self.assertEqual(status, 1)

    def test_all_args(self):
        empty_args = generate_args('69dbf26ab368', True, True)
        status = MonitorCLIParser.verify_args(empty_args)
        self.assertEqual(status, 2)

    def test_check_full_happy_path(self):
        sys.argv = ['dagda.py', 'monitor', '69dbf26ab368', '--start']
        parsed_args = MonitorCLIParser()
        self.assertEqual(parsed_args.get_container_id(), '69dbf26ab368')

    def test_check_exit_1(self):
        sys.argv = ['dagda.py', 'monitor', '69dbf26ab368']
        with self.assertRaises(SystemExit) as cm:
            MonitorCLIParser()
        self.assertEqual(cm.exception.code, 1)

    def test_DagdaMonitorParser_exit_2(self):
        with self.assertRaises(SystemExit) as cm:
            DagdaMonitorParser().error("fail")
        self.assertEqual(cm.exception.code, 2)

    def test_DagdaMonitorParser_format_help(self):
        self.assertEqual(DagdaMonitorParser().format_help(), monitor_parser_text)

# -- Util methods

def generate_args(container_id, start, stop):
    return AttrDict([('container_id', container_id), ('start', start), ('stop', stop)])

# -- Util classes

class AttrDict(dict):
    def __init__(self, *args, **kwargs):
        super(AttrDict, self).__init__(*args, **kwargs)
        self.__dict__ = self

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


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <string name="team">Družstvo</string>
  <string name="teams">Tímy</string>
  <plurals name="nbMembers">
    <item quantity="one">%s člen</item>
    <item quantity="few">%s členov</item>
    <item quantity="many">%s členov</item>
    <item quantity="other">%s členov</item>
  </plurals>
  <string name="allTeams">Všetky tímy</string>
  <string name="leaderTeams" comment="This is the button for 'teams lead by you' in the teams navigation sidebar">Vedúci družstiev</string>
  <string name="newTeam">Nový tím</string>
  <string name="myTeams">Moje tímy</string>
  <string name="noTeamFound">Nenašiel sa tím</string>
  <string name="joinTeam">Vstúpiť do tímu</string>
  <string name="quitTeam">Opustiť tím</string>
  <string name="manuallyReviewAdmissionRequests">Ručne skontrolujte žiadosti o prijatie</string>
  <string name="manuallyReviewAdmissionRequestsHelp">Ak je táto možnosť začiarknutá, hráči budú musieť napísať žiadosť o vstup do družstva, ktorú môžete následne prijať alebo odmietnuť.</string>
  <plurals name="teamLeaders">
    <item quantity="one">Vedúci družstva</item>
    <item quantity="few">Lídri tímu</item>
    <item quantity="many">Lídri tímu</item>
    <item quantity="other">Vedúci družstiev</item>
  </plurals>
  <string name="teamRecentMembers">Noví členovia tímu</string>
  <string name="kickSomeone">Vyhodiť niekoho z tímu</string>
  <string name="whoToKick">Koho chcete vyhodiť z družstva?</string>
  <plurals name="xJoinRequests">
    <item quantity="one">%s žiadosť o vstup</item>
    <item quantity="few">%s žiadosti o vstup</item>
    <item quantity="many">%s žiadostí o vstup</item>
    <item quantity="other">%s žiadostí o vstup</item>
  </plurals>
  <string name="willBeReviewed">Vaša žiadosť o vstup do družstva bude posúdená vedúcim družstva.</string>
  <string name="beingReviewed">Vaša žiadosť o vstup do družstva je posudzovaná vedúcim družstva.</string>
  <string name="requestDeclined">Vedúci družstva zamietol vašu žiadosť o vstup.</string>
  <string name="subToTeamMessages">Prihlásiť sa k odberu správ družstva</string>
  <string name="teamBattle">Súboj družstiev</string>
  <string name="teamBattleOverview">Súboj viacerých družstiev, pričom každý hráč získava body pre svoje družstvo</string>
  <string name="teamTournament">Turnaj družstiev</string>
  <string name="teamTournamentOverview">Turnaj formou arény, do ktorého sa môžu pripojiť iba členovia vášho družstva</string>
  <string name="swissTournamentOverview">Švajčiarsky systém turnaja, do ktorého sa môžu zapojiť len členovia vášho družstva</string>
  <string name="messageAllMembers">Správa všetkým členom</string>
  <string name="messageAllMembersOverview">Poslať súkromnú správu každému členovi družstva</string>
  <string name="messageAllMembersLongDescription">Poslať súkromnú správu VŠETKÝM členom družstva.
Týmto spôsobom môžete aj zavolať hráčov do turnaja alebo súboja družstiev.
Hráči, ktorí nemajú záujem o prijímanie vašich správ, môžu opustiť vaše družstvo.</string>
  <string name="teamsIlead">Družstvá ktoré vediem</string>
  <string name="youWayWantToLinkOneOfTheseTournaments">Možno by ste chceli prepojiť jeden z týchto nadchádzajúcich turnajov?</string>
  <string name="usersWhoCanManageThisTeam">Užívatelia, ktorí môžu spravovať toto družstvo</string>
  <string name="leadersChat">Diskusia vedúcich</string>
  <string name="closeTeam">Zrušiť družstvo</string>
  <string name="closeTeamDescription">Zruší družstvo natrvalo.</string>
  <string name="entryCode">Vstupný kód družstva</string>
  <string name="entryCodeDescriptionForLeader">(Voliteľné) Vstupný kód, ktorý musia noví členovia poznať, aby sa mohli pripojiť k družstvu.</string>
  <string name="incorrectEntryCode">Nesprávny vstupný kód.</string>
  <string name="teamAlreadyExists">Toto družstvo už existuje.</string>
  <string name="upcomingTourns">Nadchádzajúce turnaje</string>
  <string name="completedTourns">Ukončené turnaje</string>
  <string name="declinedRequests">Zamietnuté žiadosti</string>
</resources>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.jivesoftware.os.routing.bird.inheritance.poms</groupId>
    <artifactId>global-repo-management</artifactId>
    <version>0.211-SNAPSHOT</version>
    <packaging>pom</packaging>

    <inceptionYear>2013</inceptionYear>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <url>https://github.com/jivesoftware/routing-bird</url>
        <connection>scm:git:git://github.com/jivesoftware/routing-bird.git</connection>
        <developerConnection>scm:git:git@github.com:jivesoftware/routing-bird.git</developerConnection>
    </scm>
    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <distributionManagement>
                <repository>
                    <id>modified-thirdparty</id>
                    <name>Jive Internal Repository</name>
                    <url>http://nexus-int.eng.jiveland.com/content/repositories/modified-thirdparty</url>
                </repository>
            </distributionManagement>
        </profile>
        <profile>
            <id>upena</id>
            <distributionManagement>
                <repository>
                    <id>upena-repo</id>
                    <name>Upena Repository</name>
                    <url>https://localhost:1175/repo</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>
</project>


text:
// flow-typed signature: 627ecb6b502b7d8e4dc36197483e2627
// flow-typed version: <<STUB>>/flow_v^0.2.3/flow_v0.45.0

/**
 * This is an autogenerated libdef stub for:
 *
 *   'flow'
 *
 * Fill this stub out by replacing all the `any` types.
 *
 * Once filled out, we encourage you to share your work with the
 * community by sending a pull request to:
 * https://github.com/flowtype/flow-typed
 */

declare module 'flow' {
  declare module.exports: any;
}

/**
 * We include stubs for each file inside this npm package in case you need to
 * require those files directly. Feel free to delete any files that aren't
 * needed.
 */
declare module 'flow/examples/keystore' {
  declare module.exports: any;
}

declare module 'flow/examples/multi' {
  declare module.exports: any;
}

declare module 'flow/examples/serialForEach' {
  declare module.exports: any;
}

declare module 'flow/examples/simple' {
  declare module.exports: any;
}

declare module 'flow/flow' {
  declare module.exports: any;
}

declare module 'flow/tests' {
  declare module.exports: any;
}

// Filename aliases
declare module 'flow/examples/keystore.js' {
  declare module.exports: $Exports<'flow/examples/keystore'>;
}
declare module 'flow/examples/multi.js' {
  declare module.exports: $Exports<'flow/examples/multi'>;
}
declare module 'flow/examples/serialForEach.js' {
  declare module.exports: $Exports<'flow/examples/serialForEach'>;
}
declare module 'flow/examples/simple.js' {
  declare module.exports: $Exports<'flow/examples/simple'>;
}
declare module 'flow/flow.js' {
  declare module.exports: $Exports<'flow/flow'>;
}
declare module 'flow/tests.js' {
  declare module.exports: $Exports<'flow/tests'>;
}


text:
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE NoImplicitPrelude  #-}
{-# LANGUAGE OverloadedStrings  #-}

-- |
-- Module      : Data.Binary.Tagged.Internal
-- Copyright   : (c) Justin Le 2015
-- License     : MIT
--
-- Maintainer  : justin@jle.im
-- Stability   : unstable
-- Portability : portable
--
-- Internals for the library, exported in case you should need it.
-- Usually, the parts you would need should be re-exported in
-- "Data.Binary.Tagged".
--

module Data.Binary.Tagged.Internal (
    -- * Data types
    Tagged          -- abstract, instances: Show, Eq, Binary, Typeable, Generic
  , TagFingerprint  -- abstract, instances: Show, Eq, Ord, Binary, Typeable, Generic, Default
    -- * Tagging and extracting data
  , tag             -- :: Typeable a => a -> Tagged a
  , getTagged       -- :: Typeable a => Tagged a -> Maybe a
  , tagMatched      -- :: Typeable a => Tagged a -> Bool
    -- * 'TagFingerprint' utilities
  , typeFingerprint -- :: Typeable a => a -> TagFingerprint
  , tagFingerprint  -- :: Tagged a -> TagFingerprint
  , bsFingerprint   -- :: ByteString -> Maybe TagFingerprint
  , emptyTagFP      -- :: TagFingerprint
  ) where

import Control.Monad hiding       (mapM_)
import Data.Binary
import Data.Binary.Get
import Data.ByteString.Lazy.Char8 as LC
import Data.Digest.Pure.MD5
import Data.Maybe
import Data.Typeable
import GHC.Generics
import Prelude.Compat

-- | A data type tupling together data with a 'TagFingerprint',
-- representing data tagged with its type.
--
-- It's best to interface directly with data using 'encodeTagged',
-- 'decodeTagged', etc, using 'tag' to tag data and 'extractTagged' to
-- extract data from valid tagged data.  This type is exported mostly when
-- you want to specifically decode a 'ByteString' into tagged data, and
-- manually extract it yourself.  If you are writing a framework, it is
-- preferred to handle this for the end user.
data Tagged a = Tagged !TagFingerprint !a
                deriving (Show, Eq, Generic, Typeable)

instance Binary a => Binary (Tagged a) where
    put (Tagged fp x) = do
      put TagLead
      put fp
      put x
    get = do
      _ <- get :: Get TagLead
      Tagged <$> get <*> get

-- | A data type representing a fingerprint for a 'Typeable' type.
-- Ideally, this would be 'Data.Typeable.Internal''s own 'Fingerprint'
-- types; however, for some reason, the fingerprints for the same data type
-- from the same modules differ between different GHC backends.  So for
-- now, it is just a 'ByteString' representation of the name of the type.
-- This is literally a bad idea, and so two types with the same name but
-- from different modules will share a non-unique 'TagFingerprint'.
-- Hopefully in the future when I find out a way to fix this or the GHC
-- backend maintainers find a way to provide consistent type fingerprints,
-- this will be fixed.
--
-- This type is mostly used for the ability to categorized Tagged items
-- by their type.
--
-- 'emptyTagFP' gives a 'TagFingerprint' that will most likely never be
-- matched by any actual tag from a real type, so can be used as a test if
-- needed.  This replaces functionality that used to come from the
-- 'Default' instance.
newtype TagFingerprint = TagFP MD5Digest
                         deriving (Show, Typeable, Generic, Eq, Ord)

instance Binary TagFingerprint

-- | 'TagFingerprint' that is meant to never be matched by any actual
-- normal type's 'TagFingerprint'.
emptyTagFP :: TagFingerprint
emptyTagFP = TagFP (md5 "")

-- | Put at the start of a 'Tagged' to signify that it is a 'Tagged'.
data TagLead = TagLead

instance Binary TagLead where
    put _ = mapM_ put leadingBytes
    get = do
      forM_ leadingBytes $ \b ->
        guard . (== b) =<< get
      return TagLead

leadingBytes :: [Word8]
leadingBytes = [0xfe,0xfe]

-- | Wrap data inside a 'Tagged' tuple.
tag :: Typeable a => a -> Tagged a
tag x = Tagged (typeFingerprint x) x

-- | Compute the 'Fingerprint' representing a type.  It is non-strict on
-- its parameter, so passing in undefined should work if you want to just
-- get the 'Fingerprint' of a specific type without having data of that
-- type on hand:
--
-- > typeFingerprint (undefined :: Int)
--
typeFingerprint :: Typeable a => a -> TagFingerprint
typeFingerprint = TagFP . md5 . LC.pack . show . typeOf

-- | Extract data out of a 'Tagged', but only the type of the data matches
-- the type represented by the fingerprint.  It is polymorphic on its
-- output and meant to be used when decoding a 'Tagged' item with a desired
-- type.
getTagged :: Typeable a => Tagged a -> Maybe a
getTagged (Tagged tfp x) | tfp == xfp = Just x
                         | otherwise  = Nothing
  where
    xfp = typeFingerprint x

-- | Check if the type inside the 'Tagged' matches the fingerprint.
tagMatched :: Typeable a => Tagged a -> Bool
tagMatched = isJust . getTagged

-- | Extract the 'Fingerprint' out of a 'Tagged'.  Mostly used so that you
-- can categorize and associate Tagged items; to check if a 'Tagged' is
-- of a desired typed, 'getTagged' and 'tagMatched' might be more useful.
tagFingerprint :: Tagged a -> TagFingerprint
tagFingerprint (Tagged fp _) = fp

-- | With a 'ByteString', expecting tagged data, returns the 'Fingerprint'
-- that the data is tagged with.  Returns @Nothing@ if the data is not
-- decodable as tagged data.  Might accidentally decode untagged data
-- though!
bsFingerprint :: ByteString -> Maybe TagFingerprint
bsFingerprint bs = case getRes of
                     Left _         -> Nothing
                     Right (_,_,fp) -> Just fp

  where
    getRes  = flip runGetOrFail bs $ do
                _ <- get :: Get TagLead
                get


text:
namespace HikingPlanAndRescue.Services.Data.Contracts
{
    using Common.Contracts;
    using HikingPlanAndRescue.Data.Models;

    public interface ITrackVotesService : IBaseDataWithCreatorService<TrackVote>
    {
        void AddVote(TrackVote vote);

        int GetTrackVotesSum(int trackId);
    }
}


text:
@import CoreData;

@class DATAStack;

static NSString * const SyncCustomPrimaryKey = @"hyper.isPrimaryKey";
static NSString * const SyncCustomRemoteKey = @"hyper.remoteKey";

@interface Sync : NSObject

+ (void)changes:(NSArray *)changes
  inEntityNamed:(NSString *)entityName
      dataStack:(DATAStack *)dataStack
     completion:(void (^)(NSError *error))completion;

+ (void)changes:(NSArray *)changes
  inEntityNamed:(NSString *)entityName
      predicate:(NSPredicate *)predicate
      dataStack:(DATAStack *)dataStack
     completion:(void (^)(NSError *error))completion;

+ (void)changes:(NSArray *)changes
  inEntityNamed:(NSString *)entityName
         parent:(NSManagedObject *)parent
      dataStack:(DATAStack *)dataStack
     completion:(void (^)(NSError *error))completion;

@end


text:
'use strict';

const Hapi = require('@hapi/hapi');
const Joi = require('joi');
const Basic = require('@hapi/basic');
const Blipp = require('blipp');
const Inert = require('@hapi/inert');
const Vision = require('@hapi/vision');

const HapiSwagger = require('../');

const swaggerOptions = {
  info: {
    title: 'Test API Documentation',
    description: 'This is a sample example of API documentation.'
  },
  auth: 'simple'
};

const users = {
  jane: {
    username: 'jane',
    password: 'password', // in real world store Bcrypt 'secret' here
    name: 'Jane Jones',
    id: '2133d32a'
  }
};

const validate = function (request, username, password) {
  const user = users[username];
  if (!user) {
    return { isValid: false, credentials: null };
  }

  const isValid = password === user.password;
  let credentials = null;
  if (isValid) {
    credentials = { id: user.id, name: user.name };
  }

  return { isValid, credentials };
};

const ser = async () => {
  const server = Hapi.Server({
    host: 'localhost',
    port: 3000
  });

  await server.register(Basic);
  server.auth.strategy('simple', 'basic', { validate });
  server.auth.default('simple');

  // Blipp - Needs updating for Hapi v17.x
  await server.register([
    Inert,
    Vision,
    Blipp,
    {
      plugin: HapiSwagger,
      options: swaggerOptions
    }
  ]);

  server.route({
    method: 'PUT',
    path: '/v1/store/{id?}',
    options: {
      handler: function (request, h) {
        return h.response('success');
      },
      description: 'Update sum',
      notes: ['Update a sum in our data store'],
      plugins: {
        'hapi-swagger': {
          payloadType: 'form'
        }
      },
      tags: ['api'],
      validate: {
        params: Joi.object({
          id: Joi.string().required().description('the id of the sum in the store')
        }),
        payload: Joi.object({
          a: Joi.number().required().description('the first number'),

          b: Joi.number().required().description('the second number'),

          operator: Joi.string()
            .required()
            .default('+')
            .valid('+', '-', '/', '*')
            .description('the operator i.e. + - / or *'),

          equals: Joi.number().required().description('the result of the sum')
        })
      }
    }
  });

  await server.start();
  return server;
};

ser()
  .then((server) => {
    console.log(`Server listening on ${server.info.uri}`);
  })
  .catch((err) => {
    console.error(err);
    process.exit(1);
  });


text:
package org.apache.hadoop.fs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.util.Shell;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.HashSet;
import java.util.Set;

import static org.junit.Assert.*;

/**
 * This test class checks basic operations with {@link HarFileSystem} including
 * various initialization cases, getters, and modification methods.
 *
 * NB: to run this test from an IDE make sure the folder
 * "hadoop-common-project/hadoop-common/src/main/resources/" is added as a
 * source path. This will allow the system to pick up the "core-default.xml" and
 * "META-INF/services/..." resources from the class-path in the runtime.
 */
public class TestHarFileSystemBasics {

  private static final String ROOT_PATH = System.getProperty("test.build.data",
      "build/test/data");
  private static final Path rootPath;
  static {
    String root = new Path(new File(ROOT_PATH).getAbsolutePath(), "localfs")
      .toUri().getPath();
    // Strip drive specifier on Windows, which would make the HAR URI invalid and
    // cause tests to fail.
    if (Shell.WINDOWS) {
      root = root.substring(root.indexOf(':') + 1);
    }
    rootPath = new Path(root);
  }

  // NB: .har suffix is necessary
  private static final Path harPath = new Path(rootPath, "path1/path2/my.har");

  private FileSystem localFileSystem;
  private HarFileSystem harFileSystem;
  private Configuration conf;

  /*
   * creates and returns fully initialized HarFileSystem
   */
  private HarFileSystem createHarFileSystem(final Configuration conf)
      throws Exception {
    localFileSystem = FileSystem.getLocal(conf);
    localFileSystem.initialize(new URI("file:///"), conf);
    localFileSystem.mkdirs(rootPath);
    localFileSystem.mkdirs(harPath);
    final Path indexPath = new Path(harPath, "_index");
    final Path masterIndexPath = new Path(harPath, "_masterindex");
    localFileSystem.createNewFile(indexPath);
    assertTrue(localFileSystem.exists(indexPath));
    localFileSystem.createNewFile(masterIndexPath);
    assertTrue(localFileSystem.exists(masterIndexPath));

    writeVersionToMasterIndexImpl(HarFileSystem.VERSION, masterIndexPath);

    final HarFileSystem harFileSystem = new HarFileSystem(localFileSystem);
    final URI uri = new URI("har://" + harPath.toString());
    harFileSystem.initialize(uri, conf);
    return harFileSystem;
  }

  private HarFileSystem createHarFileSystem(final Configuration conf, Path aHarPath)
      throws Exception {
    localFileSystem.mkdirs(aHarPath);
    final Path indexPath = new Path(aHarPath, "_index");
    final Path masterIndexPath = new Path(aHarPath, "_masterindex");
    localFileSystem.createNewFile(indexPath);
    assertTrue(localFileSystem.exists(indexPath));
    localFileSystem.createNewFile(masterIndexPath);
    assertTrue(localFileSystem.exists(masterIndexPath));

    writeVersionToMasterIndexImpl(HarFileSystem.VERSION, masterIndexPath);

    final HarFileSystem harFileSystem = new HarFileSystem(localFileSystem);
    final URI uri = new URI("har://" + aHarPath.toString());
    harFileSystem.initialize(uri, conf);
    return harFileSystem;
  }

  private void writeVersionToMasterIndexImpl(int version, Path masterIndexPath) throws IOException {
    // write Har version into the master index:
    final FSDataOutputStream fsdos = localFileSystem.create(masterIndexPath);
    try {
      String versionString = version + "\n";
      fsdos.write(versionString.getBytes("UTF-8"));
      fsdos.flush();
    } finally {
      fsdos.close();
    }
  }

  @Before
  public void before() throws Exception {
    final File rootDirIoFile = new File(rootPath.toUri().getPath());
    rootDirIoFile.mkdirs();
    if (!rootDirIoFile.exists()) {
      throw new IOException("Failed to create temp directory ["
          + rootDirIoFile.getAbsolutePath() + "]");
    }
    // create Har to test:
    conf = new Configuration();
    harFileSystem = createHarFileSystem(conf);
  }

  @After
  public void after() throws Exception {
    // close Har FS:
    final FileSystem harFS = harFileSystem;
    if (harFS != null) {
      harFS.close();
      harFileSystem = null;
    }
    // cleanup: delete all the temporary files:
    final File rootDirIoFile = new File(rootPath.toUri().getPath());
    if (rootDirIoFile.exists()) {
      FileUtil.fullyDelete(rootDirIoFile);
    }
    if (rootDirIoFile.exists()) {
      throw new IOException("Failed to delete temp directory ["
          + rootDirIoFile.getAbsolutePath() + "]");
    }
  }

  // ======== Positive tests:

  @Test
  public void testPositiveHarFileSystemBasics() throws Exception {
    // check Har version:
    assertEquals(HarFileSystem.VERSION, harFileSystem.getHarVersion());

    // check Har URI:
    final URI harUri = harFileSystem.getUri();
    assertEquals(harPath.toUri().getPath(), harUri.getPath());
    assertEquals("har", harUri.getScheme());

    // check Har home path:
    final Path homePath = harFileSystem.getHomeDirectory();
    assertEquals(harPath.toUri().getPath(), homePath.toUri().getPath());

    // check working directory:
    final Path workDirPath0 = harFileSystem.getWorkingDirectory();
    assertEquals(homePath, workDirPath0);

    // check that its impossible to reset the working directory
    // (#setWorkingDirectory should have no effect):
    harFileSystem.setWorkingDirectory(new Path("/foo/bar"));
    assertEquals(workDirPath0, harFileSystem.getWorkingDirectory());
  }

  @Test
  public void testPositiveNewHarFsOnTheSameUnderlyingFs() throws Exception {
    // Init 2nd har file system on the same underlying FS, so the
    // metadata gets reused:
    final HarFileSystem hfs = new HarFileSystem(localFileSystem);
    final URI uri = new URI("har://" + harPath.toString());
    hfs.initialize(uri, new Configuration());
    // the metadata should be reused from cache:
    assertTrue(hfs.getMetadata() == harFileSystem.getMetadata());
  }

  @Test
  public void testPositiveLruMetadataCacheFs() throws Exception {
    // Init 2nd har file system on the same underlying FS, so the
    // metadata gets reused:
    HarFileSystem hfs = new HarFileSystem(localFileSystem);
    URI uri = new URI("har://" + harPath.toString());
    hfs.initialize(uri, new Configuration());
    // the metadata should be reused from cache:
    assertTrue(hfs.getMetadata() == harFileSystem.getMetadata());

    // Create more hars, until the cache is full + 1; the last creation should evict the first entry from the cache
    for (int i = 0; i <= hfs.METADATA_CACHE_ENTRIES_DEFAULT; i++) {
      Path p = new Path(rootPath, "path1/path2/my" + i +".har");
      createHarFileSystem(conf, p);
    }

    // The first entry should not be in the cache anymore:
    hfs = new HarFileSystem(localFileSystem);
    uri = new URI("har://" + harPath.toString());
    hfs.initialize(uri, new Configuration());
    assertTrue(hfs.getMetadata() != harFileSystem.getMetadata());
  }

  @Test
  public void testPositiveInitWithoutUnderlyingFS() throws Exception {
    // Init HarFS with no constructor arg, so that the underlying FS object
    // is created on demand or got from cache in #initialize() method.
    final HarFileSystem hfs = new HarFileSystem();
    final URI uri = new URI("har://" + harPath.toString());
    hfs.initialize(uri, new Configuration());
  }

  @Test
  public void testPositiveListFilesNotEndInColon() throws Exception {
    // re-initialize the har file system with host name
    // make sure the qualified path name does not append ":" at the end of host name
    final URI uri = new URI("har://file-localhost" + harPath.toString());
    harFileSystem.initialize(uri, conf);
    Path p1 = new Path("har://file-localhost" + harPath.toString());
    Path p2 = harFileSystem.makeQualified(p1);
    assertTrue(p2.toUri().toString().startsWith("har://file-localhost/"));
  }

 @Test
  public void testListLocatedStatus() throws Exception {
    String testHarPath = this.getClass().getResource("/test.har").getPath();
    URI uri = new URI("har://" + testHarPath);
    HarFileSystem hfs = new HarFileSystem(localFileSystem);
    hfs.initialize(uri, new Configuration());

    // test.har has the following contents:
    //   dir1/1.txt
    //   dir1/2.txt
    Set<String> expectedFileNames = new HashSet<String>();
    expectedFileNames.add("1.txt");
    expectedFileNames.add("2.txt");

    // List contents of dir, and ensure we find all expected files
    Path path = new Path("dir1");
    RemoteIterator<LocatedFileStatus> fileList = hfs.listLocatedStatus(path);
    while (fileList.hasNext()) {
      String fileName = fileList.next().getPath().getName();
      assertTrue(fileName + " not in expected files list", expectedFileNames.contains(fileName));
      expectedFileNames.remove(fileName);
    }
    assertEquals("Didn't find all of the expected file names: " + expectedFileNames,
                 0, expectedFileNames.size());
  }

  // ========== Negative:

  @Test
  public void testNegativeInitWithoutIndex() throws Exception {
    // delete the index file:
    final Path indexPath = new Path(harPath, "_index");
    localFileSystem.delete(indexPath, false);
    // now init the HarFs:
    final HarFileSystem hfs = new HarFileSystem(localFileSystem);
    final URI uri = new URI("har://" + harPath.toString());
    try {
      hfs.initialize(uri, new Configuration());
      Assert.fail("Exception expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }
  }

  @Test
  public void testNegativeGetHarVersionOnNotInitializedFS() throws Exception {
    final HarFileSystem hfs = new HarFileSystem(localFileSystem);
    try {
      int version = hfs.getHarVersion();
      Assert.fail("Exception expected, but got a Har version " + version + ".");
    } catch (IOException ioe) {
      // ok, expected.
    }
  }

  @Test
  public void testNegativeInitWithAnUnsupportedVersion() throws Exception {
    // NB: should wait at least 1 second to ensure the timestamp of the master
    // index will change upon the writing, because Linux seems to update the
    // file modification
    // time with 1 second accuracy:
    Thread.sleep(1000);
    // write an unsupported version:
    writeVersionToMasterIndexImpl(7777, new Path(harPath, "_masterindex"));
    // init the Har:
    final HarFileSystem hfs = new HarFileSystem(localFileSystem);

    // the metadata should *not* be reused from cache:
    assertFalse(hfs.getMetadata() == harFileSystem.getMetadata());

    final URI uri = new URI("har://" + harPath.toString());
    try {
      hfs.initialize(uri, new Configuration());
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }
  }

  @Test
  public void testNegativeHarFsModifications() throws Exception {
    // all the modification methods of HarFS must lead to IOE.
    final Path fooPath = new Path(rootPath, "foo/bar");
    localFileSystem.createNewFile(fooPath);
    try {
      harFileSystem.create(fooPath, new FsPermission("+rwx"), true, 1024,
          (short) 88, 1024, null);
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }

    try {
      harFileSystem.setReplication(fooPath, (short) 55);
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }

    try {
      harFileSystem.delete(fooPath, true);
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }

    try {
      harFileSystem.mkdirs(fooPath, new FsPermission("+rwx"));
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }

    final Path indexPath = new Path(harPath, "_index");
    try {
      harFileSystem.copyFromLocalFile(false, indexPath, fooPath);
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }

    try {
      harFileSystem.startLocalOutput(fooPath, indexPath);
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }

    try {
      harFileSystem.completeLocalOutput(fooPath, indexPath);
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }

    try {
      harFileSystem.setOwner(fooPath, "user", "group");
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }

    try {
      harFileSystem.setPermission(fooPath, new FsPermission("+x"));
      Assert.fail("IOException expected.");
    } catch (IOException ioe) {
      // ok, expected.
    }
  }

}


text:
namespace Google.Cloud.Video.Stitcher.V1.Snippets
{
    // [START videostitcher_v1_generated_VideoStitcherService_GetSlate_sync]
    using Google.Cloud.Video.Stitcher.V1;

    public sealed partial class GeneratedVideoStitcherServiceClientSnippets
    {
        /// <summary>Snippet for GetSlate</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void GetSlateRequestObject()
        {
            // Create client
            VideoStitcherServiceClient videoStitcherServiceClient = VideoStitcherServiceClient.Create();
            // Initialize request argument(s)
            GetSlateRequest request = new GetSlateRequest
            {
                SlateName = SlateName.FromProjectLocationSlate("[PROJECT]", "[LOCATION]", "[SLATE]"),
            };
            // Make the request
            Slate response = videoStitcherServiceClient.GetSlate(request);
        }
    }
    // [END videostitcher_v1_generated_VideoStitcherService_GetSlate_sync]
}


text:
/**
*	com.boneyard.ioc.Context Class Tests
*	@author Patricio Ferreira <3dimentionar@gmail.com>
**/
define(['ioc/engine/helpers/injector',
		'ioc/engine/helpers/dependency',
		'ioc/engine/annotation/bone',
		'util/adt/collection'], function(Injector, Dependency, Bone, Collection) {

	describe('com.boneyard.ioc.helpers.Injector', function() {

		before(function() {
			this.boneComplex = { complex: {
				$module: 'ui/view',
				$params: {
					id: 'view',
					views: ['$bone!boneObj', true],
					render: '$bone!boneBool',
					other: { option: [{ key: '$bone!boneArr'}, 100] }
				}
			}};
			this.bone = new Bone(this.boneComplex);
		});

		after(function() {
			delete this.boneComplex;
			delete this.bone;
		});

		describe('#new()', function() {

			it('Should return an instance of an Injector', function() {
				var spyGet = sinon.spy(this.bone, 'get');
				var spyRetrieve = sinon.spy(this.bone, 'retrieve');

				this.injector = new Injector(this.bone);

				expect(spyGet.calledOnce);
				expect(spyRetrieve.called);

				this.bone.get.restore();
				this.bone.retrieve.restore();
			});

		});

		describe('#getDependencies()', function() {

			it('Should return a collection of dependencies', function() {
				expect(this.injector.getDependencies()).to.be.a(Collection);
				expect(this.injector.getDependencies().size()).to.be(3);
			});

		});

		describe('#create()', function() {

			it('Should create and assign an instance into the bone', function() {
				var factoryMock = sinon.mock(this.injector.getFactory());

				factoryMock
					.expects('create')
					.once()
					.returns(new Array());

				expect(this.injector.create(this.bone));
				expect(this.injector.get()._$created).to.be.ok();
				expect(this.injector.get()._$created).to.be.an('array');

				factoryMock.verify();
				factoryMock.restore();
			});

			it('Should not create and assign an instance into the bone, the bone is not a module', function() {
				var factoryMock = sinon.mock(this.injector.getFactory());
				var isModuleStub = sinon.stub(this.bone, 'isModule').returns(false);

				factoryMock
					.expects('create')
					.never()
					.returns(new Array());

				expect(this.injector.create(this.bone)).to.be.an(Injector);

				factoryMock.verify();
				factoryMock.restore();
				this.bone.isModule.restore();
			});

		});

		describe('#resolve()', function() {

			it('Should invoke resolve method on every dependency', function() {
				var resolveStub = sinon.stub(Dependency.prototype, 'resolve');

				resolveStub.onFirstCall().returns(new Dependency({
					expression: '$bone!boneObj',
					property: '0',
					target: this.boneComplex.complex.$params.views,
					bone: this.bone
				}));

				resolveStub.onSecondCall().returns(new Dependency({
					expression: '$bone!boneBool',
					property: 'render',
					target: this.boneComplex.complex.$params,
					bone: this.bone
				}));

				resolveStub.onThirdCall().returns(new Dependency({
					expression: '$bone!boneArr',
					property: 'key',
					target: this.boneComplex.complex.$params.other.option[0],
					bone: this.bone
				}));

				this.injector = new Injector(this.bone);

				var spyInvoke = sinon.spy(this.injector.getDependencies(), 'invoke')
					.withArgs('resolve', this.injector, this.bone.getEngine().getFactory());
				var result = this.injector.resolve(this.bone.getEngine().getFactory());

				expect(spyInvoke.calledOnce);
				expect(result).to.be.ok();
				expect(result).not.be.empty();
				expect(result).to.have.length(3);
				expect(result[1].getExpression()).to.be('$bone!boneBool');

				resolveStub.restore();
				this.injector.getDependencies().invoke.restore();
			});

		});

		describe('#inject()', function() {

			it('Should inject dependency into targets property on the current bone property', function() {
				var dependency = new Dependency({
					expression: '$bone!boneObj',
					property: '0',
					target: this.boneComplex.complex.$params.views,
					bone: this.bone
				});

				var stubGet = sinon.stub(dependency, 'get').returns(this.bone);
				var result = this.injector.inject(dependency);

				expect(result).to.be.ok();
				expect(result).to.be.a(Dependency);
				expect(result.getExpression()).to.be(dependency.getExpression());
				expect(result.getTarget()[result.getProperty()]).to.be.a(Bone);

				stubGet.restore();
			});

			it('Should inject dependency and delete partial function as on hold', function() {
				var dependency = new Dependency({
					expression: '$bone!boneObj',
					property: '0',
					target: this.boneComplex.complex.$params.views,
					bone: this.bone,
					hold: function() {}
				});

				var stubGet = sinon.stub(dependency, 'get').returns(this.bone);
				var stubHold = sinon.stub(dependency, 'hold').returns(_.bind(this.injector.inject, this.injector, dependency));
				var result = this.injector.inject(dependency);

				expect(result).to.be.ok();
				expect(result).to.be.a(Dependency);
				expect(result.hold).to.be(undefined);

				stubGet.restore();
				stubHold.restore();
			});

		});

		describe('#hold()', function() {

			it('Should assign inject method as a partial function in the current dependency', function() {
				var dependency = new Dependency({
					expression: '$bone!boneObj',
					property: '0',
					target: this.boneComplex.complex.$params.views,
					bone: this.bone
				});
				var injectStub = sinon.stub(this.injector, 'inject').returns(dependency);
				var result = this.injector.hold(dependency);
				var holdResult = result.hold();

				expect(result).to.be.ok();
				expect(result).to.be.a(Dependency);
				expect(result.hold).to.be.a('function');
				expect(injectStub.calledOnce);

				injectStub.restore();
			});

		});

	});

});