text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/privacy/dlp/v2/dlp.proto

namespace Google\Cloud\Dlp\V2;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Pseudonymization method that generates surrogates via cryptographic hashing.
 * Uses SHA-256.
 * The key size must be either 32 or 64 bytes.
 * Outputs a 32 byte digest as an uppercase hex string
 * (for example, 41D1567F7F99F1DC2A5FAB886DEE5BEE).
 * Currently, only string and integer values can be hashed.
 *
 * Generated from protobuf message google.privacy.dlp.v2.CryptoHashConfig
 */
class CryptoHashConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * The key used by the hash function.
     *
     * Generated from protobuf field .google.privacy.dlp.v2.CryptoKey crypto_key = 1;
     */
    private $crypto_key = null;

    public function __construct() {
        \GPBMetadata\Google\Privacy\Dlp\V2\Dlp::initOnce();
        parent::__construct();
    }

    /**
     * The key used by the hash function.
     *
     * Generated from protobuf field .google.privacy.dlp.v2.CryptoKey crypto_key = 1;
     * @return \Google\Cloud\Dlp\V2\CryptoKey
     */
    public function getCryptoKey()
    {
        return $this->crypto_key;
    }

    /**
     * The key used by the hash function.
     *
     * Generated from protobuf field .google.privacy.dlp.v2.CryptoKey crypto_key = 1;
     * @param \Google\Cloud\Dlp\V2\CryptoKey $var
     * @return $this
     */
    public function setCryptoKey($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CryptoKey::class);
        $this->crypto_key = $var;

        return $this;
    }

}


text:
package com.amazonaws.services.simpledb.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.simpledb.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * GetAttributesRequest Marshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetAttributesRequestMarshaller implements Marshaller<Request<GetAttributesRequest>, GetAttributesRequest> {

    public Request<GetAttributesRequest> marshall(GetAttributesRequest getAttributesRequest) {

        if (getAttributesRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        Request<GetAttributesRequest> request = new DefaultRequest<GetAttributesRequest>(getAttributesRequest, "AmazonSimpleDB");
        request.addParameter("Action", "GetAttributes");
        request.addParameter("Version", "2009-04-15");
        request.setHttpMethod(HttpMethodName.POST);

        if (getAttributesRequest.getDomainName() != null) {
            request.addParameter("DomainName", StringUtils.fromString(getAttributesRequest.getDomainName()));
        }

        if (getAttributesRequest.getItemName() != null) {
            request.addParameter("ItemName", StringUtils.fromString(getAttributesRequest.getItemName()));
        }

        com.amazonaws.internal.SdkInternalList<String> attributeNamesList = (com.amazonaws.internal.SdkInternalList<String>) getAttributesRequest
                .getAttributeNames();
        if (!attributeNamesList.isEmpty() || !attributeNamesList.isAutoConstruct()) {
            int attributeNamesListIndex = 1;

            for (String attributeNamesListValue : attributeNamesList) {
                if (attributeNamesListValue != null) {
                    request.addParameter("AttributeName." + attributeNamesListIndex, StringUtils.fromString(attributeNamesListValue));
                }
                attributeNamesListIndex++;
            }
        }

        if (getAttributesRequest.getConsistentRead() != null) {
            request.addParameter("ConsistentRead", StringUtils.fromBoolean(getAttributesRequest.getConsistentRead()));
        }

        return request;
    }

}

redpajama_set_name: RedPajamaGithub


text:
from toee import *
from combat_standard_routines import *
from utilities import *

def san_insert_item( attachee, triggerer ):
	if (( triggerer.name == 8048 ) or ( triggerer.name == 8049 ) or ( triggerer.name == 1204 )):
		game.encounter_queue.append(3000)

	elif triggerer.name == 1004 and game.leader.map == 5010: #5010- Trader's shop
		if not 3000 in game.encounter_queue:
			game.encounter_queue.append(3000)

	elif triggerer.name == 1001 and game.leader.map == 5001 and attachee.name in [1, 3006, 4120, 6097, 6098, 6099, 6100]: # note: for some reason most of Lareth's item have a "name" field of 1, and another has 3006. Will be fixed in the future inside Protos.tab, for now this is a hotfix
		bro_smith = OBJ_HANDLE_NULL
		for npc in game.obj_list_vicinity( triggerer.location, OLC_NPC):
			if npc.name == 20005:
				bro_smith = npc
		if bro_smith == OBJ_HANDLE_NULL:
			return SKIP_DEFAULT
		if is_safe_to_talk(bro_smith, game.leader):
			pc_dude = game.leader
		else:
			pc_dude = party_closest(npc, 1, 0)

		if game.global_vars[452] & (2**6) == 0:
			if  pc_dude != OBJ_HANDLE_NULL and pc_dude.type == obj_t_pc:
				cur_money = pc_dude.money_get()
				game.char_ui_hide()
				game.timevent_add( smith_refund, ( cur_money ), 450, 1) # give money back to Smith
				game.timevent_add( pc_dude.item_get, ( attachee ), 750, 1) # get item back
				game.global_vars[452] |= 2**6
				pc_dude.begin_dialog( bro_smith, 1000 )
		elif attachee.obj_get_int(obj_f_item_wear_flags) & 256 != 0 and attachee.scripts[21] == 186: # Lareth's plate boots
			cur_money = pc_dude.money_get()
			game.char_ui_hide()
			game.timevent_add( smith_refund, ( cur_money ), 450, 1) # give money back to Smith
			game.timevent_add( pc_dude.item_get, ( attachee ), 750, 1) # get item back
			pc_dude.begin_dialog( bro_smith, 1050 )

	return SKIP_DEFAULT

def smith_refund(cur_money):
	game.leader.money_adj( cur_money - game.leader.money_get() )


text:
#ifndef LIB_RPC_NAMENODE_TRACKER_H
#define LIB_RPC_NAMENODE_TRACKER_H

#include "common/libhdfs_events_impl.h"
#include "common/namenode_info.h"

#include <asio/ip/tcp.hpp>

#include <memory>
#include <mutex>
#include <vector>

namespace hdfs {

/*
 *  Tracker gives the RpcEngine a quick way to use an endpoint that just
 *  failed in order to lookup a set of endpoints for a failover node.
 *
 *  Note: For now this only deals with 2 NameNodes, but that's the default
 *  anyway.
 */
class HANamenodeTracker {
 public:
  HANamenodeTracker(const std::vector<ResolvedNamenodeInfo> &servers,
                    ::asio::io_service *ioservice,
                    std::shared_ptr<LibhdfsEvents> event_handlers_);

  virtual ~HANamenodeTracker();

  bool is_enabled() const { return enabled_; }
  bool is_resolved() const { return resolved_; }

  // Pass in vector of endpoints held by RpcConnection, use endpoints to infer node
  // currently being used.  Swap internal state and set out to other node.
  // Note: This will always mutate internal state.  Use IsCurrentActive/Standby to
  // get info without changing state
  bool GetFailoverAndUpdate(const std::vector<::asio::ip::tcp::endpoint>& current_endpoints,
                            ResolvedNamenodeInfo& out);

 private:
  // See if endpoint ep is part of the list of endpoints for the active or standby NN
  bool IsCurrentActive_locked(const ::asio::ip::tcp::endpoint &ep) const;
  bool IsCurrentStandby_locked(const ::asio::ip::tcp::endpoint &ep) const;

  // If HA should be enabled, according to our options and runtime info like # nodes provided
  bool enabled_;
  // If we were able to resolve at least 1 HA namenode
  bool resolved_;

  // Keep service in case a second round of DNS lookup is required
  ::asio::io_service *ioservice_;

  // Event handlers, for now this is the simplest place to catch all failover events
  // and push info out to client application.  Possibly move into RPCEngine.
  std::shared_ptr<LibhdfsEvents> event_handlers_;

  // Only support 1 active and 1 standby for now.
  ResolvedNamenodeInfo active_info_;
  ResolvedNamenodeInfo standby_info_;

  // Aquire when switching from active-standby
  std::mutex swap_lock_;
};

} // end namespace hdfs
#endif // end include guard


text:
// Copyright 2019 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @fileoverview Rules service for the interaction.
 */

require('domain/objects/FractionObjectFactory.ts');

angular.module('oppia').factory('FractionInputRulesService', [
  'FractionObjectFactory',
  function(FractionObjectFactory) {
    var toFloat = function(fractionDict) {
      return FractionObjectFactory.fromDict(fractionDict).toFloat();
    };

    return {
      IsEquivalentTo: function(answer, inputs) {
        return toFloat(answer) === toFloat(inputs.f);
      },
      IsEquivalentToAndInSimplestForm: function(answer, inputs) {
        var simplestForm =
          FractionObjectFactory.fromDict(inputs.f).convertToSimplestForm();
        return toFloat(answer) === toFloat(inputs.f) &&
          angular.equals(answer, simplestForm);
      },
      IsExactlyEqualTo: function(answer, inputs) {
        // Only returns true if both answers are structurally equal.
        return angular.equals(answer, inputs.f);
      },
      IsLessThan: function(answer, inputs) {
        return toFloat(answer) < toFloat(inputs.f);
      },
      IsGreaterThan: function(answer, inputs) {
        return toFloat(answer) > toFloat(inputs.f);
      },
      HasIntegerPartEqualTo: function(answer, inputs) {
        var answerFraction = FractionObjectFactory.fromDict(answer);
        return answerFraction.getIntegerPart() === inputs.x;
      },
      HasNumeratorEqualTo: function(answer, inputs) {
        return answer.numerator === inputs.x;
      },
      HasDenominatorEqualTo: function(answer, inputs) {
        return answer.denominator === inputs.x;
      },
      HasNoFractionalPart: function(answer) {
        return answer.numerator === 0;
      },
      HasFractionalPartExactlyEqualTo: function(answer, inputs) {
        return (
          answer.numerator === inputs.f.numerator &&
          answer.denominator === inputs.f.denominator);
      },
    };
  }
]);


text:
int do_select_for_write( int fd );
int do_select_for_read( int fd );

// Send text to the Arduino
//void do_arduino_write( int fd, string& to_arduino );

// Read text from the Arduino
void do_arduino_read( int fd, string& from_arduino );

#endif		// stuffs_hpp


text:
import { keys, isEmpty, filter } from 'ramda'

import type { TTag } from '@/spec'
import { ICON_CMD } from '@/config'
import { groupByKey } from '@/utils/helper'

import type { TMenu } from './spec'

export const tags2Options = (tags: TTag[]): TMenu => {
  const groupedTags = groupByKey(tags, 'group')
  const formated = []

  keys(groupedTags).forEach((group, index) => {
    const icon =
      group === '城市'
        ? `${ICON_CMD}/navi/location.svg`
        : `${ICON_CMD}/navi/topic.svg`
    formated.push({
      id: index,
      title: group,
      icon,
      options: [{ id: '', title: '不限' }, ...groupedTags[group]],
    })
  })

  return formated
}

export const initActiveMap = (items: TMenu) => {
  const menuMap = {}
  for (let index = 0; index < items.length; index += 1) {
    const element = items[index]

    const content = element.options ? element.options[0] : element
    menuMap[element.id] = { ...content }
  }

  return menuMap
}

export const getSelectedTags = (activeMap: Record<string, TTag>): TTag[] => {
  const tagList = []

  const selectedIdx = filter(
    (key) => !isEmpty(activeMap[key].id),
    keys(activeMap),
  )

  selectedIdx.forEach((idx) => {
    if (activeMap[idx]) {
      tagList.push(activeMap[idx])
    }
  })

  return tagList
}


text:
import CircularProgress from 'material-ui/lib/circular-progress';

class Progress extends React.Component {
  render() {
    return(
      <CircularProgress
        mode="indeterminate"
        style={{
          paddingTop: '20px',
          paddingBottom: '20px',
          margin: '30px auto',
          display: 'block',
          width: '60px',
          height: '66px'
        }}
      />
    )
  };
}

export default Progress;


text:
#[=======================================================================[.rst:
CPack
-----

Build binary and source package installers.

Introduction
^^^^^^^^^^^^

The CPack module generates a file ``CPackConfig.cmake`` intended for
use in a subsequent run of  the :manual:`cpack <cpack(1)>` program
where it steers the generation of installers or/and source packages.

Inclusion of the CPack module adds two new build targets, ``package``
and ``package_source``, which build the binary and source installers
respectively.  The generated binary installers contain everything
installed via CMake's :command:`install` command (and the deprecated
commands :command:`install_files`, :command:`install_programs`, and
:command:`install_targets`).

For certain kinds of binary installers (including the graphical
installers on macOS and Windows), CPack generates installers that
allow users to select individual application components to install.
See :module:`CPackComponent` module for further details.

CPack Generators
^^^^^^^^^^^^^^^^

The :variable:`CPACK_GENERATOR` variable has different meanings in different
contexts.  In a ``CMakeLists.txt`` file, :variable:`CPACK_GENERATOR` is a
*list of generators*: and when :manual:`cpack <cpack(1)>` is run with no other
arguments, it will iterate over that list and produce one package for each
generator.  In a :variable:`CPACK_PROJECT_CONFIG_FILE`,
:variable:`CPACK_GENERATOR` is a *string naming a single generator*.  If you
need per-cpack-generator logic to control *other* cpack settings, then you
need a :variable:`CPACK_PROJECT_CONFIG_FILE`.

The CMake source tree itself contains a :variable:`CPACK_PROJECT_CONFIG_FILE`.
See the top level file ``CMakeCPackOptions.cmake.in`` for an example.

If set, the :variable:`CPACK_PROJECT_CONFIG_FILE` is included automatically
on a per-generator basis.  It only need contain overrides.

Here's how it works:

* :manual:`cpack <cpack(1)>` runs
* it includes ``CPackConfig.cmake``
* it iterates over the generators given by the ``-G`` command line option,
  or if no such option was specified, over the list of generators given by
  the :variable:`CPACK_GENERATOR` variable set in the ``CPackConfig.cmake``
  input file.
* foreach generator, it then

  - sets :variable:`CPACK_GENERATOR` to the one currently being iterated
  - includes the :variable:`CPACK_PROJECT_CONFIG_FILE`
  - produces the package for that generator

This is the key: For each generator listed in :variable:`CPACK_GENERATOR` in
``CPackConfig.cmake``, cpack will *reset* :variable:`CPACK_GENERATOR`
internally to *the one currently being used* and then include the
:variable:`CPACK_PROJECT_CONFIG_FILE`.

Variables common to all CPack Generators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Before including this CPack module in your ``CMakeLists.txt`` file, there
are a variety of variables that can be set to customize the resulting
installers.  The most commonly-used variables are:

.. variable:: CPACK_PACKAGE_NAME

  The name of the package (or application).  If not specified, it defaults to
  the project name.

.. variable:: CPACK_PACKAGE_VENDOR

  The name of the package vendor. (e.g., "Kitware").  The default is "Humanity".

.. variable:: CPACK_PACKAGE_DIRECTORY

  The directory in which CPack is doing its packaging.  If it is not set
  then this will default (internally) to the build dir.  This variable may
  be defined in a CPack config file or from the :manual:`cpack <cpack(1)>`
  command line option ``-B``.  If set, the command line option overrides the
  value found in the config file.

.. variable:: CPACK_PACKAGE_VERSION_MAJOR

  Package major version.  This variable will always be set, but its default
  value depends on whether or not version details were given to the
  :command:`project` command in the top level CMakeLists.txt file.  If version
  details were given, the default value will be
  :variable:`CMAKE_PROJECT_VERSION_MAJOR`.  If no version details were given,
  a default version of 0.1.1 will be assumed, leading to
  ``CPACK_PACKAGE_VERSION_MAJOR`` having a default value of 0.

.. variable:: CPACK_PACKAGE_VERSION_MINOR

  Package minor version.  The default value is determined based on whether or
  not version details were given to the :command:`project` command in the top
  level CMakeLists.txt file.  If version details were given, the default
  value will be :variable:`CMAKE_PROJECT_VERSION_MINOR`, but if no minor
  version component was specified then ``CPACK_PACKAGE_VERSION_MINOR`` will be
  left unset.  If no project version was given at all, a default version of
  0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_MINOR`` having a
  default value of 1.

.. variable:: CPACK_PACKAGE_VERSION_PATCH

  Package patch version.  The default value is determined based on whether or
  not version details were given to the :command:`project` command in the top
  level CMakeLists.txt file.  If version details were given, the default
  value will be :variable:`CMAKE_PROJECT_VERSION_PATCH`, but if no patch
  version component was specified then ``CPACK_PACKAGE_VERSION_PATCH`` will be
  left unset.  If no project version was given at all, a default version of
  0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_PATCH`` having a
  default value of 1.

.. variable:: CPACK_PACKAGE_DESCRIPTION

  A description of the project, used in places such as the introduction
  screen of CPack-generated Windows installers.  If not set, the value of
  this variable is populated from the file named by
  :variable:`CPACK_PACKAGE_DESCRIPTION_FILE`.

.. variable:: CPACK_PACKAGE_DESCRIPTION_FILE

  A text file used to describe the project when
  :variable:`CPACK_PACKAGE_DESCRIPTION` is not explicitly set.  The default
  value for ``CPACK_PACKAGE_DESCRIPTION_FILE`` points to a built-in template
  file ``Templates/CPack.GenericDescription.txt``.

.. variable:: CPACK_PACKAGE_DESCRIPTION_SUMMARY

  Short description of the project (only a few words).  If the
  :variable:`CMAKE_PROJECT_DESCRIPTION` variable is set, it is used as the
  default value, otherwise the default will be a string generated by CMake
  based on :variable:`CMAKE_PROJECT_NAME`.

.. variable:: CPACK_PACKAGE_HOMEPAGE_URL

  Project homepage URL.  The default value is taken from the
  :variable:`CMAKE_PROJECT_HOMEPAGE_URL` variable, which is set by the top
  level :command:`project` command, or else the default will be empty if no
  URL was provided to :command:`project`.

.. variable:: CPACK_PACKAGE_FILE_NAME

  The name of the package file to generate, not including the
  extension.  For example, ``cmake-2.6.1-Linux-i686``.  The default value
  is::

    ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}

.. variable:: CPACK_PACKAGE_INSTALL_DIRECTORY

  Installation directory on the target system. This may be used by some
  CPack generators like NSIS to create an installation directory e.g.,
  "CMake 2.5" below the installation prefix.  All installed elements will be
  put inside this directory.

.. variable:: CPACK_PACKAGE_ICON

  A branding image that will be displayed inside the installer (used by GUI
  installers).

.. variable:: CPACK_PACKAGE_CHECKSUM

  An algorithm that will be used to generate an additional file with the
  checksum of the package.  The output file name will be::

    ${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_CHECKSUM}

  Supported algorithms are those listed by the
  :ref:`string(\<HASH\>) <Supported Hash Algorithms>` command.

.. variable:: CPACK_PROJECT_CONFIG_FILE

  CPack-time project CPack configuration file.  This file is included at cpack
  time, once per generator after CPack has set :variable:`CPACK_GENERATOR`
  to the actual generator being used.  It allows per-generator setting of
  ``CPACK_*`` variables at cpack time.

.. variable:: CPACK_RESOURCE_FILE_LICENSE

  License to be embedded in the installer.  It will typically be displayed
  to the user by the produced installer (often with an explicit "Accept"
  button, for graphical installers) prior to installation.  This license
  file is NOT added to the installed files but is used by some CPack generators
  like NSIS.  If you want to install a license file (may be the same as this
  one) along with your project, you must add an appropriate CMake
  :command:`install` command in your ``CMakeLists.txt``.

.. variable:: CPACK_RESOURCE_FILE_README

  ReadMe file to be embedded in the installer.  It typically describes in
  some detail the purpose of the project during the installation.  Not all
  CPack generators use this file.

.. variable:: CPACK_RESOURCE_FILE_WELCOME

  Welcome file to be embedded in the installer.  It welcomes users to this
  installer.  Typically used in the graphical installers on Windows and Mac
  OS X.

.. variable:: CPACK_MONOLITHIC_INSTALL

  Disables the component-based installation mechanism.  When set, the
  component specification is ignored and all installed items are put in a
  single "MONOLITHIC" package.  Some CPack generators do monolithic
  packaging by default and may be asked to do component packaging by
  setting ``CPACK_<GENNAME>_COMPONENT_INSTALL`` to ``TRUE``.

.. variable:: CPACK_GENERATOR

  List of CPack generators to use.  If not specified, CPack will create a
  set of options following the naming pattern
  :variable:`CPACK_BINARY_<GENNAME>` (e.g. ``CPACK_BINARY_NSIS``) allowing
  the user to enable/disable individual generators.  If the ``-G`` option is
  given on the :manual:`cpack <cpack(1)>` command line, it will override this
  variable and any ``CPACK_BINARY_<GENNAME>`` options.

.. variable:: CPACK_OUTPUT_CONFIG_FILE

  The name of the CPack binary configuration file.  This file is the CPack
  configuration generated by the CPack module for binary installers.
  Defaults to ``CPackConfig.cmake``.

.. variable:: CPACK_PACKAGE_EXECUTABLES

  Lists each of the executables and associated text label to be used to
  create Start Menu shortcuts.  For example, setting this to the list
  ``ccmake;CMake`` will create a shortcut named "CMake" that will execute the
  installed executable ``ccmake``.  Not all CPack generators use it (at least
  NSIS, WIX and OSXX11 do).

.. variable:: CPACK_STRIP_FILES

  List of files to be stripped.  Starting with CMake 2.6.0,
  ``CPACK_STRIP_FILES`` will be a boolean variable which enables
  stripping of all files (a list of files evaluates to ``TRUE`` in CMake,
  so this change is compatible).

.. variable:: CPACK_VERBATIM_VARIABLES

  If set to ``TRUE``, values of variables prefixed with ``CPACK_`` will be
  escaped before being written to the configuration files, so that the cpack
  program receives them exactly as they were specified.  If not, characters
  like quotes and backslashes can cause parsing errors or alter the value
  received by the cpack program.  Defaults to ``FALSE`` for backwards
  compatibility.

Variables for Source Package Generators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The following CPack variables are specific to source packages, and
will not affect binary packages:

.. variable:: CPACK_SOURCE_PACKAGE_FILE_NAME

  The name of the source package.  For example ``cmake-2.6.1``.

.. variable:: CPACK_SOURCE_STRIP_FILES

  List of files in the source tree that will be stripped.  Starting with
  CMake 2.6.0, ``CPACK_SOURCE_STRIP_FILES`` will be a boolean
  variable which enables stripping of all files (a list of files evaluates
  to ``TRUE`` in CMake, so this change is compatible).

.. variable:: CPACK_SOURCE_GENERATOR

  List of generators used for the source packages.  As with
  :variable:`CPACK_GENERATOR`, if this is not specified then CPack will
  create a set of options (e.g. ``CPACK_SOURCE_ZIP``) allowing
  users to select which packages will be generated.

.. variable:: CPACK_SOURCE_OUTPUT_CONFIG_FILE

  The name of the CPack source configuration file.  This file is the CPack
  configuration generated by the CPack module for source installers.
  Defaults to ``CPackSourceConfig.cmake``.

.. variable:: CPACK_SOURCE_IGNORE_FILES

  Pattern of files in the source tree that won't be packaged when building
  a source package.  This is a list of regular expression patterns (that
  must be properly escaped), e.g.,
  ``/CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*``

Variables for Advanced Use
^^^^^^^^^^^^^^^^^^^^^^^^^^

The following variables are for advanced uses of CPack:

.. variable:: CPACK_CMAKE_GENERATOR

  What CMake generator should be used if the project is a CMake
  project.  Defaults to the value of :variable:`CMAKE_GENERATOR`.  Few users
  will want to change this setting.

.. variable:: CPACK_INSTALL_CMAKE_PROJECTS

  List of four values that specify what project to install.  The four values
  are: Build directory, Project Name, Project Component, Directory.  If
  omitted, CPack will build an installer that installs everything.

.. variable:: CPACK_SYSTEM_NAME

  System name, defaults to the value of :variable:`CMAKE_SYSTEM_NAME`,
  except on Windows where it will be ``win32`` or ``win64``.

.. variable:: CPACK_PACKAGE_VERSION

  Package full version, used internally.  By default, this is built from
  :variable:`CPACK_PACKAGE_VERSION_MAJOR`,
  :variable:`CPACK_PACKAGE_VERSION_MINOR`, and
  :variable:`CPACK_PACKAGE_VERSION_PATCH`.

.. variable:: CPACK_TOPLEVEL_TAG

  Directory for the installed files.

.. variable:: CPACK_INSTALL_COMMANDS

  Extra commands to install components.

.. variable:: CPACK_INSTALLED_DIRECTORIES

  Extra directories to install.

.. variable:: CPACK_PACKAGE_INSTALL_REGISTRY_KEY

  Registry key used when installing this project.  This is only used by
  installers for Windows.  The default value is based on the installation
  directory.

.. variable:: CPACK_CREATE_DESKTOP_LINKS

  List of desktop links to create.  Each desktop link requires a
  corresponding start menu shortcut as created by
  :variable:`CPACK_PACKAGE_EXECUTABLES`.

.. variable:: CPACK_BINARY_<GENNAME>

  CPack generated options for binary generators.  The ``CPack.cmake`` module
  generates (when :variable:`CPACK_GENERATOR` is not set) a set of CMake
  options (see CMake :command:`option` command) which may then be used to
  select the CPack generator(s) to be used when building the ``package``
  target or when running :manual:`cpack <cpack(1)>` without the ``-G`` option.

#]=======================================================================]

# Define this var in order to avoid (or warn) concerning multiple inclusion
if(CPack_CMake_INCLUDED)
  message(WARNING "CPack.cmake has already been included!!")
else()
  set(CPack_CMake_INCLUDED 1)
endif()

# Pick a configuration file
set(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
if(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  set(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
endif()
set(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
if(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  set(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
endif()

# Backward compatibility
# Include CPackComponent macros if it has not already been included before.
include(CPackComponent)

# Macro for setting values if a user did not overwrite them
# Mangles CMake-special characters. Only kept for backwards compatibility.
macro(cpack_set_if_not_set name value)
  message(DEPRECATION "cpack_set_if_not_set is obsolete; do not use.")
  _cpack_set_default("${name}" "${value}")
endmacro()

# cpack_encode_variables - Function to encode variables for the configuration file
# find any variable that starts with CPACK and create a variable
# _CPACK_OTHER_VARIABLES_ that contains SET commands for
# each cpack variable.  _CPACK_OTHER_VARIABLES_ is then
# used as an @ replacment in configure_file for the CPackConfig.
function(cpack_encode_variables)
  set(commands "")
  get_cmake_property(res VARIABLES)
  foreach(var ${res})
    if(var MATCHES "^CPACK")
      if(CPACK_VERBATIM_VARIABLES)
        _cpack_escape_for_cmake(value "${${var}}")
      else()
        set(value "${${var}}")
      endif()

      string(APPEND commands "\nset(${var} \"${value}\")")
    endif()
  endforeach()

  set(_CPACK_OTHER_VARIABLES_ "${commands}" PARENT_SCOPE)
endfunction()

# Internal use functions
function(_cpack_set_default name value)
  if(NOT DEFINED "${name}")
    set("${name}" "${value}" PARENT_SCOPE)
  endif()
endfunction()

function(_cpack_escape_for_cmake var value)
  string(REGEX REPLACE "([\\\$\"])" "\\\\\\1" escaped "${value}")
  set("${var}" "${escaped}" PARENT_SCOPE)
endfunction()

# Set the package name
_cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")

# Set the package version
if(CMAKE_PROJECT_VERSION_MAJOR GREATER_EQUAL 0)
  _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_PROJECT_VERSION_MAJOR}")
  if(CMAKE_PROJECT_VERSION_MINOR GREATER_EQUAL 0)
    _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_PROJECT_VERSION_MINOR}")
    if(CMAKE_PROJECT_VERSION_PATCH GREATER_EQUAL 0)
      _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}")
    endif()
  endif()
else()
  _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0")
  _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1")
  _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1")
endif()
if(NOT DEFINED CPACK_PACKAGE_VERSION)
  set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}")
  if(CPACK_PACKAGE_VERSION_MINOR GREATER_EQUAL 0)
    string(APPEND CPACK_PACKAGE_VERSION ".${CPACK_PACKAGE_VERSION_MINOR}")
    if(CPACK_PACKAGE_VERSION_PATCH GREATER_EQUAL 0)
      string(APPEND CPACK_PACKAGE_VERSION ".${CPACK_PACKAGE_VERSION_PATCH}")
    endif()
  endif()
endif()

_cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity")
if(CMAKE_PROJECT_DESCRIPTION)
  _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY
    "${CMAKE_PROJECT_DESCRIPTION}")
else()
  _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY
    "${CMAKE_PROJECT_NAME} built using CMake")
endif()
if(CMAKE_PROJECT_HOMEPAGE_URL)
  _cpack_set_default(CPACK_PACKAGE_HOMEPAGE_URL
    "${CMAKE_PROJECT_HOMEPAGE_URL}")
endif()

_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_FILE
  "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
_cpack_set_default(CPACK_RESOURCE_FILE_LICENSE
  "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
_cpack_set_default(CPACK_RESOURCE_FILE_README
  "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
_cpack_set_default(CPACK_RESOURCE_FILE_WELCOME
  "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")

_cpack_set_default(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")

# Set default directory creation permissions mode
if(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS)
  _cpack_set_default(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
    "${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS}")
endif()

if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
  set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
endif()

if(CPACK_NSIS_MODIFY_PATH)
  set(CPACK_NSIS_MODIFY_PATH ON)
endif()

set(__cpack_system_name ${CMAKE_SYSTEM_NAME})
if(__cpack_system_name MATCHES "Windows")
  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    set(__cpack_system_name win64)
  else()
    set(__cpack_system_name win32)
  endif()
endif()
_cpack_set_default(CPACK_SYSTEM_NAME "${__cpack_system_name}")

# Root dir: default value should be the string literal "$PROGRAMFILES"
# for backwards compatibility. Projects may set this value to anything.
# When creating 64 bit binaries we set the default value to "$PROGRAMFILES64"
if("x${__cpack_system_name}" STREQUAL "xwin64")
  set(__cpack_root_default "$PROGRAMFILES64")
else()
  set(__cpack_root_default "$PROGRAMFILES")
endif()
_cpack_set_default(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")

# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
_cpack_set_default(CPACK_PACKAGE_FILE_NAME
  "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
_cpack_set_default(CPACK_PACKAGE_INSTALL_DIRECTORY
  "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
_cpack_set_default(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
  "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
_cpack_set_default(CPACK_PACKAGE_DEFAULT_LOCATION "/")
_cpack_set_default(CPACK_PACKAGE_RELOCATABLE "true")

# always force to exactly "true" or "false" for CPack.Info.plist.in:
if(CPACK_PACKAGE_RELOCATABLE)
  set(CPACK_PACKAGE_RELOCATABLE "true")
else()
  set(CPACK_PACKAGE_RELOCATABLE "false")
endif()

macro(cpack_check_file_exists file description)
  if(NOT EXISTS "${file}")
    message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.")
  endif()
endmacro()

cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description")
cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}"    "license resource")
cpack_check_file_exists("${CPACK_RESOURCE_FILE_README}"     "readme resource")
cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}"    "welcome resource")

macro(cpack_optional_append _list _cond _item)
  if(${_cond})
    set(${_list} ${${_list}} ${_item})
  endif()
endmacro()

# Provide options to choose generators we might check here if the required
# tools for the generators exist and set the defaults according to the
# results.
if(NOT CPACK_GENERATOR)
  if(UNIX)
    if(CYGWIN)
      option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON)
    else()
      if(APPLE)
        option(CPACK_BINARY_BUNDLE       "Enable to build OSX bundles"      OFF)
        option(CPACK_BINARY_DRAGNDROP    "Enable to build OSX Drag And Drop package" OFF)
        option(CPACK_BINARY_OSXX11       "Enable to build OSX X11 packages"      OFF)
        option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF)
        option(CPACK_BINARY_PRODUCTBUILD "Enable to build productbuild packages" OFF)
      else()
        option(CPACK_BINARY_TZ  "Enable to build TZ packages"     ON)
      endif()
      option(CPACK_BINARY_DEB  "Enable to build Debian packages"  OFF)
      option(CPACK_BINARY_FREEBSD  "Enable to build FreeBSD packages"  OFF)
      option(CPACK_BINARY_NSIS "Enable to build NSIS packages"    OFF)
      option(CPACK_BINARY_RPM  "Enable to build RPM packages"     OFF)
      option(CPACK_BINARY_STGZ "Enable to build STGZ packages"    ON)
      option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages"    OFF)
      option(CPACK_BINARY_TGZ  "Enable to build TGZ packages"     ON)
      option(CPACK_BINARY_TXZ  "Enable to build TXZ packages"     OFF)
    endif()
  else()
    option(CPACK_BINARY_7Z    "Enable to build 7-Zip packages" OFF)
    option(CPACK_BINARY_NSIS  "Enable to build NSIS packages" ON)
    option(CPACK_BINARY_NUGET "Enable to build NuGet packages" OFF)
    option(CPACK_BINARY_WIX   "Enable to build WiX packages" OFF)
    option(CPACK_BINARY_ZIP   "Enable to build ZIP packages" OFF)
  endif()
  option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF)

  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_7Z           7Z)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_BUNDLE       Bundle)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_CYGWIN       CygwinBinary)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_DEB          DEB)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_DRAGNDROP    DragNDrop)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_FREEBSD      FREEBSD)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_IFW          IFW)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_NSIS         NSIS)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_NUGET        NuGet)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_OSXX11       OSXX11)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_PACKAGEMAKER PackageMaker)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_PRODUCTBUILD productbuild)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_RPM          RPM)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_STGZ         STGZ)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TBZ2         TBZ2)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TGZ          TGZ)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TXZ          TXZ)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TZ           TZ)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_WIX          WIX)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_ZIP          ZIP)

endif()

# Provide options to choose source generators
if(NOT CPACK_SOURCE_GENERATOR)
  if(UNIX)
    if(CYGWIN)
      option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON)
    else()
      option(CPACK_SOURCE_RPM  "Enable to build RPM source packages"  OFF)
      option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
      option(CPACK_SOURCE_TGZ  "Enable to build TGZ source packages"  ON)
      option(CPACK_SOURCE_TXZ  "Enable to build TXZ source packages"  ON)
      option(CPACK_SOURCE_TZ   "Enable to build TZ source packages"   ON)
      option(CPACK_SOURCE_ZIP  "Enable to build ZIP source packages"  OFF)
    endif()
  else()
    option(CPACK_SOURCE_7Z  "Enable to build 7-Zip source packages" ON)
    option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
  endif()

  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_7Z      7Z)
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_CYGWIN  CygwinSource)
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_RPM     RPM)
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TBZ2    TBZ2)
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TGZ     TGZ)
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TXZ     TXZ)
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TZ      TZ)
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_ZIP     ZIP)
endif()

# mark the above options as advanced
mark_as_advanced(
  CPACK_BINARY_7Z
  CPACK_BINARY_BUNDLE
  CPACK_BINARY_CYGWIN
  CPACK_BINARY_DEB
  CPACK_BINARY_DRAGNDROP
  CPACK_BINARY_FREEBSD
  CPACK_BINARY_IFW
  CPACK_BINARY_NSIS
  CPACK_BINARY_NUGET
  CPACK_BINARY_OSXX11
  CPACK_BINARY_PACKAGEMAKER
  CPACK_BINARY_PRODUCTBUILD
  CPACK_BINARY_RPM
  CPACK_BINARY_STGZ
  CPACK_BINARY_TBZ2
  CPACK_BINARY_TGZ
  CPACK_BINARY_TXZ
  CPACK_BINARY_TZ
  CPACK_BINARY_WIX
  CPACK_BINARY_ZIP
  CPACK_SOURCE_7Z
  CPACK_SOURCE_CYGWIN
  CPACK_SOURCE_RPM
  CPACK_SOURCE_TBZ2
  CPACK_SOURCE_TGZ
  CPACK_SOURCE_TXZ
  CPACK_SOURCE_TZ
  CPACK_SOURCE_ZIP
  )

# Set some other variables
_cpack_set_default(CPACK_INSTALL_CMAKE_PROJECTS
  "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
_cpack_set_default(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
_cpack_set_default(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
# if the user has set CPACK_NSIS_DISPLAY_NAME remember it
if(DEFINED CPACK_NSIS_DISPLAY_NAME)
  set(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
endif()
# if the user has set CPACK_NSIS_DISPLAY
# explicitly, then use that as the default
# value of CPACK_NSIS_PACKAGE_NAME  instead
# of CPACK_PACKAGE_INSTALL_DIRECTORY
_cpack_set_default(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")

if(CPACK_NSIS_DISPLAY_NAME_SET)
  _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_NSIS_DISPLAY_NAME}")
else()
  _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
endif()

_cpack_set_default(CPACK_OUTPUT_CONFIG_FILE
  "${CMAKE_BINARY_DIR}/CPackConfig.cmake")

_cpack_set_default(CPACK_SOURCE_OUTPUT_CONFIG_FILE
  "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")

_cpack_set_default(CPACK_SET_DESTDIR OFF)
_cpack_set_default(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

_cpack_set_default(CPACK_NSIS_INSTALLER_ICON_CODE "")
_cpack_set_default(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")

# WiX specific variables
_cpack_set_default(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")

# set sysroot so SDK tools can be used
if(CMAKE_OSX_SYSROOT)
  _cpack_set_default(CPACK_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}")
endif()

_cpack_set_default(CPACK_BUILD_SOURCE_DIRS "${CMAKE_SOURCE_DIR};${CMAKE_BINARY_DIR}")

if(DEFINED CPACK_COMPONENTS_ALL)
  if(CPACK_MONOLITHIC_INSTALL)
    message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")
    set(CPACK_COMPONENTS_ALL)
  else()
    # The user has provided the set of components to be installed as
    # part of a component-based installation; trust her.
    set(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE)
  endif()
else()
  # If the user has not specifically requested a monolithic installer
  # but has specified components in various "install" commands, tell
  # CPack about those components.
  if(NOT CPACK_MONOLITHIC_INSTALL)
    get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
    list(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN)
    if(CPACK_COMPONENTS_LEN EQUAL 1)
      # Only one component: this is not a component-based installation
      # (at least, it isn't a component-based installation, but may
      # become one later if the user uses the cpack_add_* commands).
      set(CPACK_COMPONENTS_ALL)
    endif()
    set(CPACK_COMPONENTS_LEN)
  endif()
endif()

# CMake always generates a component named "Unspecified", which is
# used to install everything that doesn't have an explicitly-provided
# component. Since these files should always be installed, we'll make
# them hidden and required.
set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)

cpack_encode_variables()
configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY)

# Generate source file
_cpack_set_default(CPACK_SOURCE_INSTALLED_DIRECTORIES
  "${CMAKE_SOURCE_DIR};/")
_cpack_set_default(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
_cpack_set_default(CPACK_SOURCE_PACKAGE_FILE_NAME
  "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")

set(__cpack_source_ignore_files_default
  "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#")
if(NOT CPACK_VERBATIM_VARIABLES)
  _cpack_escape_for_cmake(__cpack_source_ignore_files_default
    "${__cpack_source_ignore_files_default}")
endif()
_cpack_set_default(CPACK_SOURCE_IGNORE_FILES "${__cpack_source_ignore_files_default}")

set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
set(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
set(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
set(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
set(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}")
set(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}")

set(CPACK_RPM_PACKAGE_SOURCES "ON")

cpack_encode_variables()
configure_file("${cpack_source_input_file}"
  "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY)


text:
/*
 * The Spring Framework is published under the terms
 * of the Apache Software License.
 */

package org.springframework.benchmark;

import org.aopalliance.intercept.MethodInterceptor;

import org.springframework.aop.framework.ProxyFactory;

/**
 * @author Rod Johnson
 */
public class ManyAdviceStaticAopTest extends StaticAopTest {

	private int advices;

	public void setAdvices(int advices) {
		this.advices = advices;
	}

	protected void addFurtherAdvice(ProxyFactory pf) {
		System.err.println("Adding " + advices + " further advices");

		for (int i = 0; i < advices; i++) {
			MethodInterceptor mi = new Advices.NopInterceptor();
			pf.addAdvice(mi);
		}
		if (pf.getAdvisors().length <= this.advices) {
			throw new RuntimeException("Too few advices");
		}
	}

}


text:
function [ row ] = newModelRow(X, y, model, nModel, kernel)
    row =  y .* modelOut(X, model{nModel}, kernel);
end


text:
published: true
title: Self-documented state machine via PlantUML
description: Generating state diagrams for existing state machine with the help of NUnit and PlantUML
layout: post
tags: [PlantUML, UML, StatePattern, NUnit, dotnet]
comments: true
---

A [state diagram](https://en.wikipedia.org/wiki/State_diagram) is a type of diagram used in order to describe the behavior of an entity. For instance, here is the example of an elevator made with the help of `PlantUML`.

![State diagram example](/img/state-diagram-example.svg "State diagram example" ){:style="width:40%" class="block-center"}

The elevator can be in `Stopped` or `Moving` states, where a transition between them is a result of `Next` or `Stop` actions. So for an ancient man, it will be pretty easy to get how the elevator works :)

## Problem

Having great documentation for growing app is a hard task because it quickly becomes outdated and can lead to disinformation. Recently, I showed [how to generate sequence diagrams automatically](/2019/02/04/self-documented-app.html). Now, I would like to set up self-documenting for an entity that makes use of state pattern. How to do that with minimal afford?

## Solution

Let's look into `UserState` example [described here](/2019/02/12/state-pattern-using-entity-framework.html). It is a demonstration of the user login process, you may check [the source code](https://github.com/gaevoy/Gaev.Blog.Examples/blob/1.4.2/Gaev.Blog.Examples.StateViaEF/User.cs) to have a clue.

The approach is [the same as before](/2019/02/04/self-documented-app.html) - you don't have to add any dependency to your application source code. All you need is logger and tests, the rest `PlantUML` will do for you. I'm pretty sure you already have those two.

The idea is using logger to write `PlantUML` code. The test runs, as a result, it produces logs, then the logs are captured and converted to state diagram via `PlantUML` automatically.

In the example above, it has [unit tests](https://github.com/gaevoy/Gaev.Blog.Examples/blob/1.4.2/Gaev.Blog.Examples.StateViaEF/UserTests.cs) and I'm going to adapt them.

```c#
[Test]
public void It_should_login()
{
    // Given
    var user = new User();

    // When
    user.State.Login("test");

    // Then
    Assert.That(user.State.HasAccess, Is.True);
    Assert.That(user.State, Is.TypeOf<UserIsAuthorized>());
}
```

Adapted test just captures logs and nothing more.

```c#
private ILogger _logger = new LoggerConfiguration()
    .WriteTo.Console(outputTemplate: "{Message}")
    .MinimumLevel.Debug()
    .CreateLogger();

[Test]
public void It_should_login()
{
    // Given
    var user = new TestUser(_logger);

    // When
    user.State.Login("test");

    // Then
    Assert.That(user.State.HasAccess, Is.True);
    Assert.That(user.State, Is.TypeOf<UserIsAuthorized>());
}
```

Where `TestUser` is derived from `User` in order to capture the state changes and convert it into `PlantUML` code. Pay attention that I'm checking `_logger.IsEnabled(LogEventLevel.Debug)` it means there will be no performance penalty if this code runs in production.

```c#
public class TestUser : User
{
    private readonly ILogger _logger;

    public TestUser(ILogger logger)
    {
        _logger = logger;
    }

    public override void OnStateChanged(UserState prev, UserState next)
    {
        if (_logger.IsEnabled(LogEventLevel.Debug))
        {
            var callingMethod = new StackTrace().GetFrame(2).GetMethod();
            _logger.Debug($"{prev.GetType().Name} --> {next.GetType().Name} : {callingMethod.Name}");
        }
    }
}
```

The logic of capturing logs is in place. Let's generate the diagram by the logs.

```c#
[Test]
public void PlantUml_should_build_state_diagram()
{
    // Given
    var planUmlCode = new List<string>();
    _logger = Substitute.For<ILogger>();
    _logger.IsEnabled(LogEventLevel.Debug).Returns(true);
    _logger.When(e => e.Debug(Arg.Any<string>())).Do(e => planUmlCode.Add(e.Arg<string>()));

    // When
    It_should_login();
    It_should_show_captcha();
    It_should_validate_captcha();
    It_should_be_blocked();
    It_should_logout();

    // Then
    var veryFirstState = planUmlCode[0].Substring(0, planUmlCode[0].IndexOf(" --> "));
    planUmlCode.Add($"[*] --> {veryFirstState}");
    var code = string.Join("\n", planUmlCode.Distinct());
    var diagramUrl = new RendererFactory()
        .CreateRenderer()
        .RenderAsUri(code, OutputFormat.Png);
    Console.WriteLine(diagramUrl);
}
```

The line `[*] --> {veryFirstState}` forces `PlantUML` to generate state diagram instead of sequence. The rendering itself is done by good friend `PlantUml.Net` package. `PlantUML` cannot generate `ASCII` state diagram correct, well then `PNG` or `SVG` to the rescue. It is nice to have URL of the diagram, so even if the test is run by `Continuous Integration` server, anyone still is able to open the diagram, that is why `RenderAsUri` method is used.

Finally, the result is awesome!

![State diagram built by unit tests](/img/self-documented-fsm.png "State diagram built by unit tests")

See complete example here [Gaev.Blog.Examples.SelfDocumentedFSM](https://github.com/gaevoy/Gaev.Blog.Examples/tree/1.4.2/Gaev.Blog.Examples.SelfDocumentedFSM/).


text:
if [ $# -eq 0 ]; then
    echo "Usage: ./run-single-test.sh [skip] <path-to-test-script> [<arg1> <arg2> ...]"
    exit 1
fi

END_TO_END_DIR="`dirname \"$0\"`" # relative
END_TO_END_DIR="`( cd \"$END_TO_END_DIR\" && pwd -P)`" # absolutized and normalized
if [ -z "$END_TO_END_DIR" ] ; then
    # error; for some reason, the path is not accessible
    # to the script (e.g. permissions re-evaled after suid)
    exit 1  # fail
fi

export END_TO_END_DIR

if [ -z "$FLINK_DIR" ] ; then
    echo "You have to export the Flink distribution directory as FLINK_DIR"
    exit 1
fi

source "${END_TO_END_DIR}/../tools/ci/maven-utils.sh"
source "${END_TO_END_DIR}/test-scripts/test-runner-common.sh"

cleanup_tmp_files

FLINK_DIR="`( cd \"$FLINK_DIR\" && pwd -P )`" # absolutized and normalized

echo "flink-end-to-end-test directory: $END_TO_END_DIR"
echo "Flink distribution directory: $FLINK_DIR"

if [[ "$1" = "skip" ]]; then
    run_test "${*:2}" "${*:2}" "skip_check_exceptions"
else
    run_test "$*" "$*"
fi

exit 0


text:
const { PCRE } = require('pcre-to-regexp');

// `ts-node` default "target" is "es5" which transpiles `class` statements and
// is incompatible with dependencies that use ES6 native `class`. Setting the
// "target" to "es2018" or newer prevents the `class` transpilation.
//
// See: https://github.com/vercel/vercel/discussions/4724
// See: https://github.com/TypeStrong/ts-node/issues/903
class P extends PCRE {}

export default (req, res) => {
  const p = new P('hi'); // This line should not throw an error
  console.log(p);
  res.send({ ok: true });
};


text:
CKEDITOR.plugins.setLang( 'mindtouchsave', 'de',
{
	'cancel' : 'Abbrechen'
});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace NMF.Models
{
    [AttributeUsage(AttributeTargets.Property)]
    public class OppositeAttribute : Attribute
    {
        public PropertyInfo Property { get; private set; }

        public OppositeAttribute(Type oppositeType, string propertyName)
        {
            if (oppositeType == null) throw new ArgumentNullException("oppositeType");
            if (propertyName == null) throw new ArgumentNullException("propertyName");

            Property = oppositeType.GetProperty(propertyName);
        }
    }
}


text:
<!DOCTYPE html>

<link th:href="@{/assets/css/signin.css}" rel="stylesheet" />

Welcome to Tifragment

		<form class="form-signin" th:action="@{/j_spring_security_check}" method="post">

Wrong Username or Password

Logout Success

Please Sign In

			<input type="text" name="j_username" class="form-control" placeholder="Username" required="required" autofocus="autofocus"/>
			<input type="password" name="j_password" class="form-control" placeholder="Password" required="required" />

				<input type="checkbox" value="remember-me" /> Remember me

				<button class="btn btn-primary" type="submit">Sign In</button>
				<button class="btn btn-default" type="reset">Reset</button>

		</form>


text:
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.components.autofill_assistant.user_data;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.DrawableRes;
import androidx.annotation.Nullable;

import org.chromium.components.autofill_assistant.AssistantAutofillProfile;
import org.chromium.components.autofill_assistant.AssistantEditor;
import org.chromium.components.autofill_assistant.AssistantEditor.AssistantContactEditor;
import org.chromium.components.autofill_assistant.AssistantOptionModel.ContactModel;
import org.chromium.components.autofill_assistant.R;

import java.util.ArrayList;
import java.util.List;

/**
 * The contact details section of the Autofill Assistant payment request.
 */
public class AssistantContactDetailsSection extends AssistantCollectUserDataSection<ContactModel> {
    @Nullable
    private AssistantContactEditor mEditor;
    private AssistantCollectUserDataModel.ContactDescriptionOptions mSummaryOptions;
    private AssistantCollectUserDataModel.ContactDescriptionOptions mFullOptions;

    AssistantContactDetailsSection(Context context, ViewGroup parent) {
        super(context, parent, R.layout.autofill_assistant_contact_summary,
                R.layout.autofill_assistant_contact_full,
                context.getResources().getDimensionPixelSize(
                        R.dimen.autofill_assistant_payment_request_title_padding),
                context.getString(R.string.payments_add_contact),
                context.getString(R.string.payments_add_contact));
    }

    @Override
    @Nullable
    protected AssistantEditor<ContactModel> getEditor() {
        return mEditor;
    }

    public void setEditor(@Nullable AssistantContactEditor editor) {
        mEditor = editor;
        updateVisibility();
        if (mEditor == null) {
            return;
        }

        for (ContactModel item : getItems()) {
            mEditor.addContactInformationForAutocomplete(item.mOption);
        }
    }

    @Override
    protected void updateFullView(View fullView, @Nullable ContactModel model) {
        if (model == null || mFullOptions == null) {
            return;
        }

        TextView fullViewText = fullView.findViewById(R.id.contact_full);
        String description = createContactDescription(mFullOptions, model.mOption);
        fullViewText.setText(description);
        hideIfEmpty(fullViewText);

        TextView errorView = fullView.findViewById(R.id.incomplete_error);
        if (model.mErrors.isEmpty()) {
            errorView.setText("");
            errorView.setVisibility(View.GONE);
        } else {
            errorView.setText(TextUtils.join("\n", model.mErrors));
            errorView.setVisibility(View.VISIBLE);
        }
    }

    @Override
    protected void updateSummaryView(View summaryView, @Nullable ContactModel model) {
        if (model == null || mSummaryOptions == null) {
            return;
        }

        TextView contactSummaryView = summaryView.findViewById(R.id.contact_summary);
        String description = createContactDescription(mSummaryOptions, model.mOption);
        contactSummaryView.setText(description);
        hideIfEmpty(contactSummaryView);

        summaryView.findViewById(R.id.incomplete_error)
                .setVisibility(model.mErrors.isEmpty() ? View.GONE : View.VISIBLE);
    }

    @Override
    protected @DrawableRes int getEditButtonDrawable(ContactModel model) {
        return R.drawable.ic_edit_24dp;
    }

    @Override
    protected String getEditButtonContentDescription(ContactModel model) {
        return mContext.getString(R.string.payments_edit_contact_details_label);
    }

    @Override
    protected boolean areEqual(@Nullable ContactModel modelA, @Nullable ContactModel modelB) {
        if (modelA == null || modelB == null) {
            return modelA == modelB;
        }
        return TextUtils.equals(modelA.mOption.getGUID(), modelB.mOption.getGUID());
    }

    /**
     * The Chrome profiles have changed externally. This will rebuild the UI with the new/changed
     * set of contacts derived from the profiles, while keeping the selected item if possible.
     */
    void onContactsChanged(List<ContactModel> contacts) {
        if (shouldIgnoreItemChangeNotification()) {
            return;
        }

        int selectedContactIndex = -1;
        if (mSelectedOption != null) {
            for (int i = 0; i < contacts.size(); i++) {
                if (areEqual(contacts.get(i), mSelectedOption)) {
                    selectedContactIndex = i;
                    break;
                }
            }
        }

        // Replace current set of items, keep selection if possible.
        setItems(contacts, selectedContactIndex);
    }

    void setContactSummaryOptions(AssistantCollectUserDataModel.ContactDescriptionOptions options) {
        mSummaryOptions = options;
        updateViews();
    }

    void setContactFullOptions(AssistantCollectUserDataModel.ContactDescriptionOptions options) {
        mFullOptions = options;
        updateViews();
    }

    @Override
    protected void addOrUpdateItem(ContactModel model, boolean select, boolean notify) {
        super.addOrUpdateItem(model, select, notify);

        if (mEditor != null) {
            mEditor.addContactInformationForAutocomplete(model.mOption);
        }
    }

    /**
     * Creates a "\n"-separated description of {@code contact} using {@code options}.
     */
    private String createContactDescription(
            AssistantCollectUserDataModel.ContactDescriptionOptions options,
            AssistantAutofillProfile contact) {
        List<String> descriptionLines = new ArrayList<>();
        for (int i = 0;
                i < options.mFields.length && descriptionLines.size() < options.mMaxNumberLines;
                i++) {
            String line = "";
            switch (options.mFields[i]) {
                case AssistantContactField.NAME_FULL:
                    line = contact.getFullName();
                    break;
                case AssistantContactField.EMAIL_ADDRESS:
                    line = contact.getEmailAddress();
                    break;
                case AssistantContactField.PHONE_HOME_WHOLE_NUMBER:
                    line = contact.getPhoneNumber();
                    break;
                default:
                    assert false : "profile field not handled";
                    break;
            }
            if (!TextUtils.isEmpty(line)) {
                descriptionLines.add(line);
            }
        }
        return TextUtils.join("\n", descriptionLines);
    }
}


text:
@charset "utf-8";

/* CSS Browser Reset
------------------------------------------------------------ */
html, body, div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, font, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var,b, u, i, center,dl, dt, dd, ol, ul, li,fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; }
body { line-height: 1; }
ol, ul { list-style: none; }
blockquote, q { quotes: none; }
blockquote:before, blockquote:after,
q:before, q:after { content: ''; content: none; }

/* remember to define focus styles!
------------------------------------------------------------ */
:focus { outline: 0; }

/* remember to highlight inserts somehow!
------------------------------------------------------------ */
ins { text-decoration: none; }
del { text-decoration: line-through; }

/* tables still need 'cellspacing="0"' in the markup
------------------------------------------------------------ */
table { border-collapse: collapse; border-spacing: 0; }

/* Layout Styles
------------------------------------------------------------ */
body { font: 11px/14px Arial, Helvetica, sans-serif; }
body { margin: 0 auto; background: #e5f1f4 url(../images/background-images/body-bg-grad.jpg) repeat-x top left; }
.header { margin: 0 auto; padding-top: 6px; width: 960px; height: 86px; background: url(../images/background-images/header-bg.gif) repeat-x top left; }
.header .logo { margin: 0 0 0 23px; width: 133px; height: 44px; background: url(../images/logo/auxilio-logo.png) no-repeat top left; clear: right; }
.header .search-wrapper { margin: -30px 24px 0 0; float: right; clear: both; }
.header .search-wrapper ul { list-style-type: none; }
.header .search-wrapper ul li { float: left; }
.header .search-wrapper ul li.srch-txt { padding-right: 5px; line-height: 20px; color: #fff; opacity: 0.6; filter: alpha(opacity=60); }
.header .search-wrapper ul li input[type=text] { padding: 3px 2px 2px 3px; width: 111px; height: 15px; text-align: left; background: #5884ac; border: 1px solid #a7c6df; font-size: 11px; color: #fff; }
.header .search-wrapper ul li .arrow { margin-left: 1px; width: 20px; height: 20px; background: url(../images/buttons/srch-arrow.gif) no-repeat top left; border: none; }
.header .search-wrapper ul li .arrow:hover { cursor: pointer; cursor: hand; }
.building-bg { margin: 0 auto; width: 960px; height: 515px; background: url(../images/background-images/slide-bg.png) no-repeat top left; }
.building-bg div { padding: 14px 0 14px 27px; }
.building-bg div h1 { font: 700 32px Arial, Helvetica, sans-serif; color: #fff; letter-spacing: .014em; }
.building-bg div h2 { margin-top: 5px; font: 700 16px Arial, Helvetica, sans-serif; color: #fff; }
.slider-wrapper { margin: 0 auto; width: 960px; }
.sub-promo-bg { margin: 0 auto; width: 960px; height: 234px; background: url(../images/background-images/sub-promo-grad-bg.png) repeat-x top left; border-top: 1px solid #acacac; }
.footer { margin: 0 auto; width: 960px; height: 30px; background: #8f9799; border: none; }
.footer ul { list-style-type: none; }
.footer ul li { float: left; color: #fff; line-height: 30px; }
.footer ul li.copy { padding-left: 30px; }
.footer ul li a:link,
.footer ul li a:visited { padding-left: 15px; color: #fff; text-decoration: none; display: block; }
.footer ul li a:hover { text-decoration: underline; }

/* Header Navigation Styles
------------------------------------------------------------ */
.header-nav-wrapper { width: 960px }
.header-nav-wrapper ul { padding: 9px 5px 0; }
.header-nav-wrapper ul li { float: left; }
.header-nav-wrapper ul li a { margin-bottom: 2px; padding: 0 24px; display: block; }
.header-nav-wrapper ul li a:link,
.header-nav-wrapper ul li a:visited { font: 13px/24px Arial, Helvetica, sans-serif; font-weight: bold; color: #fff; text-decoration: none; text-transform: uppercase; }
.header-nav-wrapper ul li.pipe { width: 1px; height: 24px; background: url(../images/background-images/vert-pipe.png) no-repeat center left; }

/* Anchor Rollover Setup
------------------------------------------------------------ */
#comp-sub, #serv-sub, #hosp-part-sub, #media-sub, #invtr-sub, #contact-sub, #faq-sub { display: none; }

/* Header Sub Menu Styles
------------------------------------------------------------ */

/* Company */
#comp-sub { position: absolute; margin: 0 0 0 -5px; padding: 5px; width: 150px; height: auto; background: #e5ffcc; border: 1px solid #999; border-top: none; z-index: 10000; }
#comp-sub ul { padding: 0; }
#comp-sub ul li { padding: 0 0 5px 0; float: none; }
#comp-sub ul li a:link,
#comp-sub ul li a:visited { margin: 0; padding: 0 0 0 23px; font: 11px/14px Arial, Helvetica, sans-serif; font-weight: normal; color: #333; text-decoration: none; text-transform: capitalize; }
#comp-sub ul li a:hover { text-decoration: underline; }

/* Services */
#serv-sub { position: absolute; margin: 0 0 0 -3px; padding: 5px; width: 150px; height: auto; background: #e5ffcc; border: 1px solid #999; border-top: none; z-index: 10000; }
#serv-sub ul { padding: 0; }
#serv-sub ul li { padding: 0 0 5px 0; float: none; }
#serv-sub ul li a:link,
#serv-sub ul li a:visited { margin: 0; padding: 0 0 0 21px; font: 11px/14px Arial, Helvetica, sans-serif; font-weight: normal; color: #333; text-decoration: none; text-transform: capitalize; }
#serv-sub ul li a:hover { text-decoration: underline; }

/* Hospital Partners */
#hosp-part-sub { position: absolute; margin: 0 0 0 -3px; padding: 5px; width: 180px; height: auto; background: #e5ffcc; border: 1px solid #999; border-top: none; z-index: 10000; }
#hosp-part-sub ul { padding: 0; }
#hosp-part-sub ul li { padding: 0 0 5px 0; float: none; }
#hosp-part-sub ul li a:link,
#hosp-part-sub ul li a:visited { margin: 0; padding: 0 0 0 21px; font: 11px/14px Arial, Helvetica, sans-serif; font-weight: normal; color: #333; text-decoration: none; text-transform: capitalize; }
#hosp-part-sub ul li a:hover { text-decoration: underline; }

/* Media Center */
#media-sub { position: absolute; margin: 0 0 0 -3px; padding: 5px; width: 150px; height: auto; background: #e5ffcc; border: 1px solid #999; border-top: none; z-index: 10000; }
#media-sub ul { padding: 0; }
#media-sub ul li { padding: 0 0 5px 0; float: none; }
#media-sub ul li a:link,
#media-sub ul li a:visited { margin: 0; padding: 0 0 0 21px; font: 11px/14px Arial, Helvetica, sans-serif; font-weight: normal; color: #333; text-decoration: none; text-transform: capitalize; }
#media-sub ul li a:hover { text-decoration: underline; }

/* Promo Slider Styles
------------------------------------------------------------ */
.scrollable { margin: -413px auto 0 auto; position: relative; overflow: hidden; width: 960px; height: 304px; clear: both; }
.scrollable div { float: left; display: block; width: 960px; }
.scrollable .items { width: 20000em; position: absolute; clear: both; }
.scrollable .active { z-index: 9999; position: relative; }
a.browse { position: absolute; width: 28px; height: 25px; background: url(../images/buttons/arrow-next-prev-sprite.png) no-repeat; }
a.prev { position: absolute; background-position: bottom left; }
a.next { position: absolute; background-position: top left; }
a.left { position: absolute; margin: 140px 0 0 15px; z-index: 99999; }
a.right { position: absolute; margin: -164px 0 0 916px; z-index: 99999; }
a.left:hover,
a.right:hover { cursor: hand; cursor: pointer; }
.grey-panel-wrapper { padding: 18px 0 0 60px; }

/* Promo Slider - One
------------------------------------------------------------ */
.grey-panel-1 { width: 363px; height: 268px; background: url(../images/background-images/grey-panel-1.png) no-repeat top left; }
.grey-panel-1 .btn-view-study { position: absolute; margin: 218px 0 0 103px; width: 150px; height: 38px; background: none; border: none; }
.grey-panel-1 .btn-view-study:hover { cursor: hand; cursor: pointer; }
.grey-panel-1 .btn-view-study span { display: none; }

/* Promo Slider - Two
------------------------------------------------------------ */
.grey-panel-2 { width: 363px; height: 268px; background: url(../images/background-images/grey-panel-2.png) no-repeat top left; }
.grey-panel-2 .btn-view-study { position: absolute; margin: 218px 0 0 103px; width: 150px; height: 38px; background: none; border: none; }
.grey-panel-2 .btn-view-study:hover { cursor: hand; cursor: pointer; }
.grey-panel-2 .btn-view-study span { display: none; }

/* Promo Slider - Three
------------------------------------------------------------ */
.grey-panel-3 { width: 363px; height: 268px; background: url(../images/background-images/grey-panel-3.png) no-repeat top left; }
.grey-panel-3 .btn-view-study { position: absolute; margin: 218px 0 0 103px; width: 150px; height: 38px; background: none; border: none; }
.grey-panel-3 .btn-view-study:hover { cursor: hand; cursor: pointer; }
.grey-panel-3 .btn-view-study span { display: none; }

/* Promo Slider - Four
------------------------------------------------------------ */
.grey-panel-4 { width: 363px; height: 268px; background: url(../images/background-images/grey-panel-4.png) no-repeat top left; }
.grey-panel-4 .btn-view-study { position: absolute; margin: 218px 0 0 103px; width: 150px; height: 38px; background: none; border: none; }
.grey-panel-4 .btn-view-study:hover { cursor: hand; cursor: pointer; }
.grey-panel-4 .btn-view-study span { display: none; }

/* Sub Promo Area
------------------------------------------------------------ */
.sub-promo { position: absolute; margin: 0 auto; width: 960px; height: 235px; clear: both; }
.sub-promo ul { margin: 0 auto; padding: 25px;  }
.sub-promo ul li { width: 29%; min-height: 190px; float: left; }
.sub-promo .col-1 { padding-right: 25px; }
.sub-promo .col-2 { padding: 0 25px; border-left: 1px solid #ccc; border-right: 1px solid #ccc; }
.sub-promo .col-3 { padding-left: 25px; }
.sub-promo .col-1 h2 a:link,
.sub-promo .col-1 h2 a:visited,
.sub-promo .col-2 h2 a:link,
.sub-promo .col-2 h2 a:visited,
.sub-promo .col-3 h2 a:link,
.sub-promo .col-3 h2 a:visited { color: #fff; text-decoration: none; }
.sub-promo .col-1 h2 a:hover,
.sub-promo .col-2 h2 a:hover,
.sub-promo .col-3 h2 a:hover { text-decoration: underline; }
.sub-promo .col-1 h2 { margin-bottom: 7px; padding: 18px 90px 0 70px; height: 52px; background: url(../images/icons/sub-promo-icons.png) no-repeat -5px top; font: 17px/18px Arial, Helvetica, sans-serif; font-weight: bold; }
.sub-promo .col-2 h2 { margin-bottom: 7px; padding: 18px 90px 0 70px; height: 52px; background: url(../images/icons/sub-promo-icons.png) no-repeat -5px -70px; font: 17px/36px Arial, Helvetica, sans-serif; font-weight: bold; }
.sub-promo .col-3 h2 { margin-bottom: 7px; padding: 18px 90px 0 70px; height: 52px; background: url(../images/icons/sub-promo-icons.png) no-repeat -5px -140px; font: 17px/18px Arial, Helvetica, sans-serif; font-weight: bold; }
.sub-promo .col-1 p,
.sub-promo .col-2 p,
.sub-promo .col-3 p { font: 14px/16px Arial, Helvetica, sans-serif; color: #fff; font-weight: 500; }


text:
package de.errorcraftlp.sugarplus.gui;

import net.minecraft.util.ResourceLocation;
import de.errorcraftlp.sugarplus.Sugarplus;

/**
 *
 * This the class of the mystic sugar {@link GuiScreenBase gui}.
 *
 * @see GuiScreenBase
 *
 * @author ErrorCraftLP
 *
 * @since 3.2.0
 *
 */
public class GuiMysticSugar extends GuiScreenBase {

	@Override
	public ResourceLocation getTexture() {

		return new ResourceLocation(Sugarplus.MOD_ID, "textures/gui/MysticSugar.png");

	}

}


text:
function gb=gabor2D(sigma,orient,wavel,phase,aspect,pxsize)
%function gb=gabor2D(sigma,orient,wavel,phase,aspect)
%
% This function produces a numerical approximation to 2D Gabor function.
% Parameters:
% sigma  = standard deviation of Gaussian envelope, this in-turn controls the
%          size of the result (pixels)
% orient = orientation of the Gabor clockwise from the vertical (degrees)
% wavel  = the wavelength of the sin wave (pixels)
% phase  = the phase of the sin wave (degrees)
% aspect = aspect ratio of Gaussian envelope (0 = no "width" to envelope,
%          1 = circular symmetric envelope)
% pxsize = the size of the filter (optional). If not specified, size is 5*sigma.
if nargin<6
  pxsize=fix(5*sigma);
end
if mod(pxsize,2)==0, pxsize=pxsize+1; end %give mask an odd dimension
[x y]=meshgrid(-fix(pxsize/2):fix(pxsize/2),fix(-pxsize/2):fix(pxsize/2));

% Rotation
orient=-orient*pi/180;
x_theta=x*cos(orient)+y*sin(orient);
y_theta=-x*sin(orient)+y*cos(orient);

phase=phase*pi/180;
freq=2*pi./wavel;

gb=exp(-0.5.*( ((x_theta.^2)/(sigma^2)) ...
			 + ((y_theta.^2)/((aspect*sigma)^2)) )) ...
   .* (cos(freq*y_theta+phase) - cos(phase).*exp(-0.25.*((sigma*freq).^2)));

if abs(sum(sum(gb)))./sum(sum(abs(gb)))>0.01
  disp('WARNING unbalanced Gabor');
  abs(sum(sum(gb)))./sum(sum(abs(gb)))
end


text:
<?php

/**
 * @license Apache 2.0
 */

namespace Swagger\Annotations;

/**
 * @Annotation
 *
 * A Swagger "Header Object" https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#headerObject
 */
class Header extends AbstractAnnotation
{
    /**
     * @var string
     */
    public $header;

    /**
     * @var string
     */
    public $description;

    /**
     * The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of "string", "number", "integer", "boolean", "array" or "file". If type is "file", the consumes MUST be either "multipart/form-data" or " application/x-www-form-urlencoded" and the parameter MUST be in "formData".
     * @var string
     */
    public $type;

    /**
     * The extending format for the previously mentioned type. See Data Type Formats for further details.
     * @var string
     */
    public $format;

    /**
     * Required if type is "array". Describes the type of items in the array.
     * @var Items
     */
    public $items;

    /**
     * @var string Determines the format of the array if type array is used. Possible values are: csv - comma separated values foo,bar. ssv - space separated values foo bar. tsv - tab separated values foo\tbar. pipes - pipe separated values foo|bar. multi - corresponds to multiple parameter instances instead of multiple values for a single instance foo=bar&foo=baz. This is valid only for parameters in "query" or "formData". Default value is csv.
     */
    public $collectionFormat;

    /**
     * Sets a default value to the parameter. The type of the value depends on the defined type. See http://json-schema.org/latest/json-schema-validation.html#anchor101.
     * @var mixed
     */
    public $default = UNDEFINED;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor17.
     * @var number
     */
    public $maximum;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor17.
     * @var boolean
     */
    public $exclusiveMaximum;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor21.
     * @var number
     */
    public $minimum;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor21.
     * @var boolean
     */
    public $exclusiveMinimum;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor26.
     * @var integer
     */
    public $maxLength;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor29.
     * @var integer
     */
    public $minLength;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor33.
     * @var string
     */
    public $pattern;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor42.
     * @var integer
     */
    public $maxItems;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor45.
     * @var integer
     */
    public $minItems;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor49.
     * @var boolean
     */
    public $uniqueItems;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor76.
     * @var array
     */
    public $enum;

    /**
     * See http://json-schema.org/latest/json-schema-validation.html#anchor14.
     * @var number
     */
    public $multipleOf;

    /** @inheritdoc */
    public static $_required = ['type'];

    /** @inheritdoc */
    public static $_types = [
        'header' => 'string',
        'description' => 'string',
        'format' => 'string',
        'collectionFormat' => ['csv', 'ssv', 'tsv', 'pipes', 'multi'],
        'maximum' => 'number',
        'exclusiveMaximum' => 'boolean',
        'minimum' => 'number',
        'exclusiveMinimum' => 'boolean',
        'maxLength' => 'integer',
        'minLength' => 'integer',
        'pattern' => 'string',
        'maxItems' => 'integer',
        'minItems' => 'integer',
        'uniqueItems' => 'boolean',
        'multipleOf' => 'integer',
    ];

    /** @inheritdoc */
    public static $_nested = [
        'Swagger\Annotations\Items' => 'items'
    ];

    /** @inheritdoc */
    public static $_parents = [
        'Swagger\Annotations\Response'
    ];
}


text:
<?php

/**
 * Created by PhpStorm.
 * User: juan2ramos
 * Date: 13/08/15
 * Time: 23:43
 */
class Users_model extends CI_Model
{
    function __construct()
    {
        parent::__construct();
        $this->load->database();
    }
    function get_users() {
        $query = $this->db->get('users', 10);
        return $query->result();;
    }

    function addUser($postData){
        $this->db->insert('users', $postData);

    }
}


text:
/*can@2.2.7#view/scanner*/
var can = require('./view.js');
var elements = require('./elements.js');
var viewCallbacks = require('./callbacks/callbacks.js');
var newLine = /(\r|\n)+/g, notEndTag = /\//, clean = function (content) {
        return content.split('\\').join('\\\\').split('\n').join('\\n').split('"').join('\\"').split('\t').join('\\t');
    }, getTag = function (tagName, tokens, i) {
        if (tagName) {
            return tagName;
        } else {
            while (i < tokens.length) {
                if (tokens[i] === '<' && !notEndTag.test(tokens[i + 1])) {
                    return elements.reverseTagMap[tokens[i + 1]] || 'span';
                }
                i++;
            }
        }
        return '';
    }, bracketNum = function (content) {
        return --content.split('{').length - --content.split('}').length;
    }, myEval = function (script) {
        eval(script);
    }, attrReg = /([^\s]+)[\s]*=[\s]*$/, startTxt = 'var ___v1ew = [];', finishTxt = 'return ___v1ew.join(\'\')', put_cmd = '___v1ew.push(\n', insert_cmd = put_cmd, htmlTag = null, quote = null, beforeQuote = null, rescan = null, getAttrName = function () {
        var matches = beforeQuote.match(attrReg);
        return matches && matches[1];
    }, status = function () {
        return quote ? '\'' + getAttrName() + '\'' : htmlTag ? 1 : 0;
    }, top = function (stack) {
        return stack[stack.length - 1];
    }, Scanner;
can.view.Scanner = Scanner = function (options) {
    can.extend(this, {
        text: {},
        tokens: []
    }, options);
    this.text.options = this.text.options || '';
    this.tokenReg = [];
    this.tokenSimple = {
        '<': '<',
        '>': '>',
        '"': '"',
        '\'': '\''
    };
    this.tokenComplex = [];
    this.tokenMap = {};
    for (var i = 0, token; token = this.tokens[i]; i++) {
        if (token[2]) {
            this.tokenReg.push(token[2]);
            this.tokenComplex.push({
                abbr: token[1],
                re: new RegExp(token[2]),
                rescan: token[3]
            });
        } else {
            this.tokenReg.push(token[1]);
            this.tokenSimple[token[1]] = token[0];
        }
        this.tokenMap[token[0]] = token[1];
    }
    this.tokenReg = new RegExp('(' + this.tokenReg.slice(0).concat([
        '<',
        '>',
        '"',
        '\''
    ]).join('|') + ')', 'g');
};
Scanner.prototype = {
    helpers: [],
    scan: function (source, name) {
        var tokens = [], last = 0, simple = this.tokenSimple, complex = this.tokenComplex;
        source = source.replace(newLine, '\n');
        if (this.transform) {
            source = this.transform(source);
        }
        source.replace(this.tokenReg, function (whole, part) {
            var offset = arguments[arguments.length - 2];
            if (offset > last) {
                tokens.push(source.substring(last, offset));
            }
            if (simple[whole]) {
                tokens.push(whole);
            } else {
                for (var i = 0, token; token = complex[i]; i++) {
                    if (token.re.test(whole)) {
                        tokens.push(token.abbr);
                        if (token.rescan) {
                            tokens.push(token.rescan(part));
                        }
                        break;
                    }
                }
            }
            last = offset + part.length;
        });
        if (last < source.length) {
            tokens.push(source.substr(last));
        }
        var content = '', buff = [startTxt + (this.text.start || '')], put = function (content, bonus) {
                buff.push(put_cmd, '"', clean(content), '"' + (bonus || '') + ');');
            }, endStack = [], lastToken, startTag = null, magicInTag = false, specialStates = {
                attributeHookups: [],
                tagHookups: [],
                lastTagHookup: ''
            }, popTagHookup = function () {
                specialStates.lastTagHookup = specialStates.tagHookups.pop() + specialStates.tagHookups.length;
            }, tagName = '', tagNames = [], popTagName = false, bracketCount, specialAttribute = false, i = 0, token, tmap = this.tokenMap, attrName;
        htmlTag = quote = beforeQuote = null;
        for (; (token = tokens[i++]) !== undefined;) {
            if (startTag === null) {
                switch (token) {
                case tmap.left:
                case tmap.escapeLeft:
                case tmap.returnLeft:
                    magicInTag = htmlTag && 1;
                case tmap.commentLeft:
                    startTag = token;
                    if (content.length) {
                        put(content);
                    }
                    content = '';
                    break;
                case tmap.escapeFull:
                    magicInTag = htmlTag && 1;
                    rescan = 1;
                    startTag = tmap.escapeLeft;
                    if (content.length) {
                        put(content);
                    }
                    rescan = tokens[i++];
                    content = rescan.content || rescan;
                    if (rescan.before) {
                        put(rescan.before);
                    }
                    tokens.splice(i, 0, tmap.right);
                    break;
                case tmap.commentFull:
                    break;
                case tmap.templateLeft:
                    content += tmap.left;
                    break;
                case '<':
                    if (tokens[i].indexOf('!--') !== 0) {
                        htmlTag = 1;
                        magicInTag = 0;
                    }
                    content += token;
                    break;
                case '>':
                    htmlTag = 0;
                    var emptyElement = content.substr(content.length - 1) === '/' || content.substr(content.length - 2) === '--', attrs = '';
                    if (specialStates.attributeHookups.length) {
                        attrs = 'attrs: [\'' + specialStates.attributeHookups.join('\',\'') + '\'], ';
                        specialStates.attributeHookups = [];
                    }
                    if (tagName + specialStates.tagHookups.length !== specialStates.lastTagHookup && tagName === top(specialStates.tagHookups)) {
                        if (emptyElement) {
                            content = content.substr(0, content.length - 1);
                        }
                        buff.push(put_cmd, '"', clean(content), '"', ',can.view.pending({tagName:\'' + tagName + '\',' + attrs + 'scope: ' + (this.text.scope || 'this') + this.text.options);
                        if (emptyElement) {
                            buff.push('}));');
                            content = '/>';
                            popTagHookup();
                        } else if (tokens[i] === '<' && tokens[i + 1] === '/' + tagName) {
                            buff.push('}));');
                            content = token;
                            popTagHookup();
                        } else {
                            buff.push(',subtemplate: function(' + this.text.argNames + '){\n' + startTxt + (this.text.start || ''));
                            content = '';
                        }
                    } else if (magicInTag || !popTagName && elements.tagToContentPropMap[tagNames[tagNames.length - 1]] || attrs) {
                        var pendingPart = ',can.view.pending({' + attrs + 'scope: ' + (this.text.scope || 'this') + this.text.options + '}),"';
                        if (emptyElement) {
                            put(content.substr(0, content.length - 1), pendingPart + '/>"');
                        } else {
                            put(content, pendingPart + '>"');
                        }
                        content = '';
                        magicInTag = 0;
                    } else {
                        content += token;
                    }
                    if (emptyElement || popTagName) {
                        tagNames.pop();
                        tagName = tagNames[tagNames.length - 1];
                        popTagName = false;
                    }
                    specialStates.attributeHookups = [];
                    break;
                case '\'':
                case '"':
                    if (htmlTag) {
                        if (quote && quote === token) {
                            quote = null;
                            var attr = getAttrName();
                            if (viewCallbacks.attr(attr)) {
                                specialStates.attributeHookups.push(attr);
                            }
                            if (specialAttribute) {
                                content += token;
                                put(content);
                                buff.push(finishTxt, '}));\n');
                                content = '';
                                specialAttribute = false;
                                break;
                            }
                        } else if (quote === null) {
                            quote = token;
                            beforeQuote = lastToken;
                            attrName = getAttrName();
                            if (tagName === 'img' && attrName === 'src' || attrName === 'style') {
                                put(content.replace(attrReg, ''));
                                content = '';
                                specialAttribute = true;
                                buff.push(insert_cmd, 'can.view.txt(2,\'' + getTag(tagName, tokens, i) + '\',' + status() + ',this,function(){', startTxt);
                                put(attrName + '=' + token);
                                break;
                            }
                        }
                    }
                default:
                    if (lastToken === '<') {
                        tagName = token.substr(0, 3) === '!--' ? '!--' : token.split(/\s/)[0];
                        var isClosingTag = false, cleanedTagName;
                        if (tagName.indexOf('/') === 0) {
                            isClosingTag = true;
                            cleanedTagName = tagName.substr(1);
                        }
                        if (isClosingTag) {
                            if (top(tagNames) === cleanedTagName) {
                                tagName = cleanedTagName;
                                popTagName = true;
                            }
                            if (top(specialStates.tagHookups) === cleanedTagName) {
                                put(content.substr(0, content.length - 1));
                                buff.push(finishTxt + '}}) );');
                                content = '><';
                                popTagHookup();
                            }
                        } else {
                            if (tagName.lastIndexOf('/') === tagName.length - 1) {
                                tagName = tagName.substr(0, tagName.length - 1);
                            }
                            if (tagName !== '!--' && viewCallbacks.tag(tagName)) {
                                if (tagName === 'content' && elements.tagMap[top(tagNames)]) {
                                    token = token.replace('content', elements.tagMap[top(tagNames)]);
                                }
                                specialStates.tagHookups.push(tagName);
                            }
                            tagNames.push(tagName);
                        }
                    }
                    content += token;
                    break;
                }
            } else {
                switch (token) {
                case tmap.right:
                case tmap.returnRight:
                    switch (startTag) {
                    case tmap.left:
                        bracketCount = bracketNum(content);
                        if (bracketCount === 1) {
                            buff.push(insert_cmd, 'can.view.txt(0,\'' + getTag(tagName, tokens, i) + '\',' + status() + ',this,function(){', startTxt, content);
                            endStack.push({
                                before: '',
                                after: finishTxt + '}));\n'
                            });
                        } else {
                            last = endStack.length && bracketCount === -1 ? endStack.pop() : { after: ';' };
                            if (last.before) {
                                buff.push(last.before);
                            }
                            buff.push(content, ';', last.after);
                        }
                        break;
                    case tmap.escapeLeft:
                    case tmap.returnLeft:
                        bracketCount = bracketNum(content);
                        if (bracketCount) {
                            endStack.push({
                                before: finishTxt,
                                after: '}));\n'
                            });
                        }
                        var escaped = startTag === tmap.escapeLeft ? 1 : 0, commands = {
                                insert: insert_cmd,
                                tagName: getTag(tagName, tokens, i),
                                status: status(),
                                specialAttribute: specialAttribute
                            };
                        for (var ii = 0; ii < this.helpers.length; ii++) {
                            var helper = this.helpers[ii];
                            if (helper.name.test(content)) {
                                content = helper.fn(content, commands);
                                if (helper.name.source === /^>[\s]*\w*/.source) {
                                    escaped = 0;
                                }
                                break;
                            }
                        }
                        if (typeof content === 'object') {
                            if (content.startTxt && content.end && specialAttribute) {
                                buff.push(insert_cmd, 'can.view.toStr( ', content.content, '() ) );');
                            } else {
                                if (content.startTxt) {
                                    buff.push(insert_cmd, 'can.view.txt(\n' + (typeof status() === 'string' || (content.escaped != null ? content.escaped : escaped)) + ',\n\'' + tagName + '\',\n' + status() + ',\nthis,\n');
                                } else if (content.startOnlyTxt) {
                                    buff.push(insert_cmd, 'can.view.onlytxt(this,\n');
                                }
                                buff.push(content.content);
                                if (content.end) {
                                    buff.push('));');
                                }
                            }
                        } else if (specialAttribute) {
                            buff.push(insert_cmd, content, ');');
                        } else {
                            buff.push(insert_cmd, 'can.view.txt(\n' + (typeof status() === 'string' || escaped) + ',\n\'' + tagName + '\',\n' + status() + ',\nthis,\nfunction(){ ' + (this.text.escape || '') + 'return ', content, bracketCount ? startTxt : '}));\n');
                        }
                        if (rescan && rescan.after && rescan.after.length) {
                            put(rescan.after.length);
                            rescan = null;
                        }
                        break;
                    }
                    startTag = null;
                    content = '';
                    break;
                case tmap.templateLeft:
                    content += tmap.left;
                    break;
                default:
                    content += token;
                    break;
                }
            }
            lastToken = token;
        }
        if (content.length) {
            put(content);
        }
        buff.push(';');
        var template = buff.join(''), out = { out: (this.text.outStart || '') + template + ' ' + finishTxt + (this.text.outEnd || '') };
        myEval.call(out, 'this.fn = (function(' + this.text.argNames + '){' + out.out + '});\r\n//# sourceURL=' + name + '.js');
        return out;
    }
};
can.view.pending = function (viewData) {
    var hooks = can.view.getHooks();
    return can.view.hook(function (el) {
        can.each(hooks, function (fn) {
            fn(el);
        });
        viewData.templateType = 'legacy';
        if (viewData.tagName) {
            viewCallbacks.tagHandler(el, viewData.tagName, viewData);
        }
        can.each(viewData && viewData.attrs || [], function (attributeName) {
            viewData.attributeName = attributeName;
            var callback = viewCallbacks.attr(attributeName);
            if (callback) {
                callback(el, viewData);
            }
        });
    });
};
can.view.tag('content', function (el, tagData) {
    return tagData.scope;
});
can.view.Scanner = Scanner;
module.exports = Scanner;


text:
package org.apache.mahout.classifier.sequencelearning.hmm;

import com.google.common.io.Closeables;
import org.apache.commons.cli2.CommandLine;
import org.apache.commons.cli2.Group;
import org.apache.commons.cli2.Option;
import org.apache.commons.cli2.OptionException;
import org.apache.commons.cli2.builder.ArgumentBuilder;
import org.apache.commons.cli2.builder.DefaultOptionBuilder;
import org.apache.commons.cli2.builder.GroupBuilder;
import org.apache.commons.cli2.commandline.Parser;
import org.apache.mahout.common.CommandLineUtil;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Command-line tool for generating random sequences by given HMM
 */
public final class RandomSequenceGenerator {

  private RandomSequenceGenerator() {
  }

  public static void main(String[] args) throws IOException {
    DefaultOptionBuilder optionBuilder = new DefaultOptionBuilder();
    ArgumentBuilder argumentBuilder = new ArgumentBuilder();

    Option outputOption = optionBuilder.withLongName("output").
      withDescription("Output file with sequence of observed states").
      withShortName("o").withArgument(argumentBuilder.withMaximum(1).withMinimum(1).
      withName("path").create()).withRequired(false).create();

    Option modelOption = optionBuilder.withLongName("model").
      withDescription("Path to serialized HMM model").
      withShortName("m").withArgument(argumentBuilder.withMaximum(1).withMinimum(1).
      withName("path").create()).withRequired(true).create();

    Option lengthOption = optionBuilder.withLongName("length").
      withDescription("Length of generated sequence").
      withShortName("l").withArgument(argumentBuilder.withMaximum(1).withMinimum(1).
      withName("number").create()).withRequired(true).create();

    Group optionGroup = new GroupBuilder().
      withOption(outputOption).withOption(modelOption).withOption(lengthOption).
      withName("Options").create();

    try {
      Parser parser = new Parser();
      parser.setGroup(optionGroup);
      CommandLine commandLine = parser.parse(args);

      String output = (String) commandLine.getValue(outputOption);

      String modelPath = (String) commandLine.getValue(modelOption);

      int length = Integer.parseInt((String) commandLine.getValue(lengthOption));

      //reading serialized HMM
      DataInputStream modelStream = new DataInputStream(new FileInputStream(modelPath));
      HmmModel model;
      try {
        model = LossyHmmSerializer.deserialize(modelStream);
      } finally {
        Closeables.closeQuietly(modelStream);
      }

      //generating observations
      int[] observations = HmmEvaluator.predict(model, length, System.currentTimeMillis());

      //writing output
      PrintWriter writer = new PrintWriter(new FileOutputStream(output), true);
      try {
        for (int observation : observations) {
          writer.print(observation);
          writer.print(' ');
        }
      } finally {
        Closeables.closeQuietly(writer);
      }
    } catch (OptionException e) {
      CommandLineUtil.printHelp(optionGroup);
    }
  }
}


text:
import os
import unittest

import gevent.monkey; gevent.monkey.patch_all()

if __name__ == '__main__':
  test_suites = unittest.defaultTestLoader.discover(
    start_dir=os.path.join(os.path.dirname(__file__), 'tests'),
    pattern='test_*.py')
  runner = unittest.TextTestRunner(verbosity=2)
  for test_suite in test_suites:
    runner.run(test_suite)