text:
namespace reorder {
namespace transforms {

namespace {

typedef BasicBlockSubGraphLayoutTransform::BasicBlockMap BasicBlockMap;

using testing::BasicBlockTest;
using testing::ContainerEq;

class BasicBlockSubGraphLayoutTransformTest : public BasicBlockTest {
 public:
  virtual void SetUp() OVERRIDE {
    BasicBlockTest::SetUp();
    ASSERT_NO_FATAL_FAILURE(InitBlockGraph());
    ASSERT_NO_FATAL_FAILURE(InitBasicBlockSubGraph());
  }

  bool Insert(size_t offset, size_t block_index, size_t bb_index) {
    return bb_map_.insert(std::make_pair(
        offset,
        std::make_pair(block_index, bb_index))).second;
  }

  void LayoutIsAsExpected() {
    BasicBlockMap bb_map;

    size_t bd_idx = 0;
    BasicBlockSubGraph::BlockDescriptionList::const_iterator bd_it =
        subgraph_.block_descriptions().begin();
    for (; bd_it != subgraph_.block_descriptions().end(); ++bd_it, ++bd_idx) {
      size_t bb_idx = 0;
      BasicBlockSubGraph::BasicBlockOrdering::const_iterator bb_it =
          bd_it->basic_block_order.begin();
      for (; bb_it != bd_it->basic_block_order.end(); ++bb_it, ++bb_idx) {
        size_t bb_offset = (*bb_it)->offset();
        ASSERT_TRUE(bb_map.insert(std::make_pair(
            bb_offset, std::make_pair(bd_idx, bb_idx))).second);
      }
    }
    EXPECT_THAT(bb_map, ContainerEq(bb_map_));
  }

  BasicBlockMap bb_map_;
};

}  // namespace

TEST_F(BasicBlockSubGraphLayoutTransformTest, NonContiguousBlockIndicesFails) {
  // This is a valid map, but we use block indices of 0 and 2 rather than 0 and
  // 1.
  ASSERT_TRUE(Insert(0, 0, 0));
  ASSERT_TRUE(Insert(23, 0, 1));
  ASSERT_TRUE(Insert(24, 0, 2));
  ASSERT_TRUE(Insert(31, 0, 3));
  ASSERT_TRUE(Insert(36, 0, 4));
  ASSERT_TRUE(Insert(37, 2, 0));
  ASSERT_TRUE(Insert(42, 2, 1));
  ASSERT_TRUE(Insert(49, 2, 2));
  ASSERT_TRUE(Insert(52, 2, 3));
  ASSERT_TRUE(Insert(64, 2, 4));
  BasicBlockSubGraphLayoutTransform tx(bb_map_);
  EXPECT_FALSE(tx.TransformBasicBlockSubGraph(
      &policy_, &block_graph_, &subgraph_));
}

TEST_F(BasicBlockSubGraphLayoutTransformTest,
       NonContiguousBasicBlockPositionsFails) {
  // This is a valid map, but we use non-contiguous basic block positions.
  ASSERT_TRUE(Insert(0, 0, 0));
  ASSERT_TRUE(Insert(23, 0, 1));
  ASSERT_TRUE(Insert(24, 0, 2));
  ASSERT_TRUE(Insert(31, 0, 3));
  ASSERT_TRUE(Insert(36, 0, 4));
  ASSERT_TRUE(Insert(37, 0, 5));
  ASSERT_TRUE(Insert(42, 0, 6));
  ASSERT_TRUE(Insert(49, 0, 7));
  ASSERT_TRUE(Insert(52, 0, 8));
  ASSERT_TRUE(Insert(64, 0, 10));
  BasicBlockSubGraphLayoutTransform tx(bb_map_);
  EXPECT_FALSE(tx.TransformBasicBlockSubGraph(
      &policy_, &block_graph_, &subgraph_));
}

TEST_F(BasicBlockSubGraphLayoutTransformTest, Identity) {
  ASSERT_TRUE(Insert(0, 0, 0));
  ASSERT_TRUE(Insert(23, 0, 1));
  ASSERT_TRUE(Insert(24, 0, 2));
  ASSERT_TRUE(Insert(31, 0, 3));
  ASSERT_TRUE(Insert(36, 0, 4));
  ASSERT_TRUE(Insert(37, 0, 5));
  ASSERT_TRUE(Insert(42, 0, 6));
  ASSERT_TRUE(Insert(49, 0, 7));
  ASSERT_TRUE(Insert(52, 0, 8));
  ASSERT_TRUE(Insert(64, 0, 9));

  BasicBlockSubGraphLayoutTransform tx(bb_map_);
  EXPECT_TRUE(tx.TransformBasicBlockSubGraph(
      &policy_, &block_graph_, &subgraph_));
  LayoutIsAsExpected();
}

TEST_F(BasicBlockSubGraphLayoutTransformTest, CodeAndDataSplit) {
  // Code blocks.
  ASSERT_TRUE(Insert(0, 0, 0));
  ASSERT_TRUE(Insert(24, 0, 1));
  ASSERT_TRUE(Insert(31, 0, 2));
  ASSERT_TRUE(Insert(36, 0, 3));
  ASSERT_TRUE(Insert(37, 0, 4));
  ASSERT_TRUE(Insert(42, 0, 5));
  ASSERT_TRUE(Insert(49, 0, 6));

  // Data blocks.
  ASSERT_TRUE(Insert(52, 1, 0));
  ASSERT_TRUE(Insert(64, 1, 1));

  // We explicitly do not specify the BB at offset 23, which consists of
  // padding that can be deleted.

  BasicBlockSubGraphLayoutTransform tx(bb_map_);
  EXPECT_TRUE(tx.TransformBasicBlockSubGraph(
      &policy_, &block_graph_, &subgraph_));
  LayoutIsAsExpected();
}

namespace {

class BasicBlockLayoutTransformTest : public BasicBlockTest {
 public:
  typedef BasicBlockLayoutTransform::Order Order;

  virtual void SetUp() OVERRIDE {
    BasicBlockTest::SetUp();
    header_block_ = block_graph_.AddBlock(BlockGraph::DATA_BLOCK,
        10, "Dummy Header Block");
    ASSERT_TRUE(header_block_ != NULL);
    ASSERT_NO_FATAL_FAILURE(InitBlockGraph());
  }

  BlockGraph::Block* header_block_;
};

}  // namespace

TEST_F(BasicBlockLayoutTransformTest, NewSectionNoBlocksFails) {
  Order order;
  order.sections.resize(1);
  order.sections[0].id = Order::SectionSpec::kNewSectionId;
  order.sections[0].name = ".text.new";
  order.sections[0].characteristics = text_section_->characteristics();
  order.sections[0].blocks.resize(0);

  BasicBlockLayoutTransform tx(&order);
  EXPECT_FALSE(tx.TransformBlockGraph(
      &policy_, &block_graph_, header_block_));
}

TEST_F(BasicBlockLayoutTransformTest, InvalidExistingSectionFails) {
  Order order;
  order.sections.resize(1);
  order.sections[0].id = 47;
  order.sections[0].name = "foobar";
  // Leave characteristics initialized to the default value.
  order.sections[0].blocks.resize(1);
  order.sections[0].blocks[0].block = assembly_func_;

  BasicBlockLayoutTransform tx(&order);
  EXPECT_FALSE(tx.TransformBlockGraph(
      &policy_, &block_graph_, header_block_));
}

TEST_F(BasicBlockLayoutTransformTest, ReorderSection) {
  Order order;
  order.sections.resize(1);

  order.sections[0].id = text_section_->id();
  order.sections[0].name = text_section_->name();
  order.sections[0].blocks.resize(3);
  order.sections[0].blocks[0].block = func2_;
  order.sections[0].blocks[1].block = assembly_func_;
  order.sections[0].blocks[2].block = func1_;

  BasicBlockLayoutTransform tx(&order);
  EXPECT_TRUE(tx.TransformBlockGraph(
      &policy_, &block_graph_, header_block_));

  // No new blocks or sections were created.
  EXPECT_EQ(5u, block_graph_.blocks().size());
  EXPECT_EQ(2u, block_graph_.sections().size());
}

TEST_F(BasicBlockLayoutTransformTest, CreateNewSection) {
  Order order;
  order.sections.resize(2);

  order.sections[0].id = text_section_->id();
  order.sections[0].name = ".text.hot";
  order.sections[0].characteristics = text_section_->characteristics();
  order.sections[0].blocks.resize(1);
  order.sections[0].blocks[0].block = assembly_func_;

  order.sections[1].id = Order::SectionSpec::kNewSectionId;
  order.sections[1].name = ".text.cold";
  order.sections[1].characteristics = text_section_->characteristics();
  order.sections[1].blocks.resize(2);
  order.sections[1].blocks[0].block = func1_;
  order.sections[1].blocks[1].block = func2_;

  // Remember these for validation post-transform.
  DWORD text_section_characteristics = text_section_->characteristics();

  BasicBlockLayoutTransform tx(&order);
  EXPECT_TRUE(tx.TransformBlockGraph(
      &policy_, &block_graph_, header_block_));

  // No new blocks were created, but one new section was.
  EXPECT_EQ(5u, block_graph_.blocks().size());
  EXPECT_EQ(3u, block_graph_.sections().size());

  // The .text section has been renamed but the characteristics are the same.
  EXPECT_EQ(order.sections[0].name, text_section_->name());
  EXPECT_EQ(text_section_characteristics, text_section_->characteristics());
  EXPECT_EQ(text_section_->id(), assembly_func_->section());

  // The new section is as expected.
  BlockGraph::Section* new_section =
      &(block_graph_.sections_mutable().rbegin()->second);
  EXPECT_EQ(order.sections[1].id, new_section->id());
  EXPECT_EQ(order.sections[1].name, new_section->name());
  EXPECT_EQ(order.sections[1].characteristics, new_section->characteristics());
  EXPECT_EQ(new_section->id(), func1_->section());
  EXPECT_EQ(new_section->id(), func2_->section());
}

TEST_F(BasicBlockLayoutTransformTest, SplitBlock) {
  Order order;
  order.sections.resize(2);

  Order::OffsetVector assembly_func_code_bbs;
  assembly_func_code_bbs.push_back(0);
  assembly_func_code_bbs.push_back(24);
  assembly_func_code_bbs.push_back(31);
  assembly_func_code_bbs.push_back(36);
  assembly_func_code_bbs.push_back(37);
  assembly_func_code_bbs.push_back(42);
  assembly_func_code_bbs.push_back(49);

  Order::OffsetVector assembly_func_data_bbs;
  assembly_func_data_bbs.push_back(52);
  assembly_func_data_bbs.push_back(64);

  order.sections[0].id = text_section_->id();
  order.sections[0].name = text_section_->name();
  order.sections[0].characteristics = text_section_->characteristics();
  order.sections[0].blocks.resize(3);
  order.sections[0].blocks[0].block = func1_;
  order.sections[0].blocks[1].block = func2_;
  order.sections[0].blocks[2].block = assembly_func_;
  order.sections[0].blocks[2].basic_block_offsets = assembly_func_code_bbs;

  order.sections[1].id = data_section_->id();
  order.sections[1].name = data_section_->name();
  order.sections[1].characteristics = data_section_->characteristics();
  order.sections[1].blocks.resize(2);
  order.sections[1].blocks[0].block = data_;
  order.sections[1].blocks[1].block = assembly_func_;
  order.sections[1].blocks[1].basic_block_offsets = assembly_func_data_bbs;

  BlockGraph::BlockId old_assembly_func_id = assembly_func_->id();

  BasicBlockLayoutTransform tx(&order);
  EXPECT_TRUE(tx.TransformBlockGraph(
      &policy_, &block_graph_, header_block_));

  // One new block has been created and no new sections.
  EXPECT_EQ(6u, block_graph_.blocks().size());
  EXPECT_EQ(2u, block_graph_.sections().size());

  // The assembly func block no longer exists.
  EXPECT_TRUE(block_graph_.GetBlockById(old_assembly_func_id) == NULL);

  // Get the 2 new blocks that replaced the assembly func.
  BlockGraph::BlockMap::reverse_iterator block_it =
      block_graph_.blocks_mutable().rbegin();
  BlockGraph::Block* new_block2 = &((block_it++)->second);
  BlockGraph::Block* new_block1 = &(block_it->second);

  // We expect these blocks to be in the appropriate sections, and the order to
  // have been updated.
  EXPECT_EQ(text_section_->id(), new_block1->section());
  EXPECT_EQ(data_section_->id(), new_block2->section());
  EXPECT_EQ(order.sections[0].blocks[2].block, new_block1);
  EXPECT_EQ(order.sections[1].blocks[1].block, new_block2);
}

}  // namespace transforms
}  // namespace reorder


text:
require 'rubygems'
require 'loquacious'

#
# The configuration for the presences tokyo tyrant instance
#
# The options available in the instance_defaults section of the manager
# configuration are also able to be set here.
#
Loquacious::Configuration.for( "presences" ) do

  desc "The hostname this instance will listen on. The default is all"
  host "0.0.0.0"

  desc "The port this tyrant will listen on.  The default is 1978"
  port 19860

  desc <<-txt
  The type of database this instance will be.  Options are:
  |    memory-hash - an in memory hash database
  |    memory-tree - an in memory B+ tree database
  |    hash        - an on disk hash database
  |    tree        - an on disk B+ tree database
  |    fixed       - an on disk fixed length database
  |    table       - an on disk table database
  txt
  type "table"

  desc <<-txt
  Mode of the server in relation to the database.  It can be a combination of
  the following:
  |    w - it is a database writer
  |    r - it is a database reader
  |    c - it creates the database if it does not exist
  |    t - it truncates the database if it does exist
  |    e - do not lock the database when doing operations
  |    f - use a non-blocking lock when doing operations
  txt
  mode "wc"

  desc <<-txt
  The options for data stored in the database.  They include one of the
  compression options:
  |    d - Deflate
  |    b - BZIP2
  |    t - TCBS
  and
  |    l - allow the database to be larger than 2GB
  txt
  opts "ld"

  desc <<-txt
  Tuning parameters.  Each of these alters a tuning parameter on the database.
  Not all of them are applicable to all database types
  txt

  tuning_params {
    desc <<-txt
    The number of elements in the bucket array.  Supported in hash, B+ tree
    and table databases.  It is also used in the in-memory hash database.
    It should be between 1 and 4 times the number of all records to be stored.
    txt
    bnum 200000

    desc <<-txt
    The maximum number of records to store in the database.  This is only
    used in the in-memory databases.
    txt
    capnum nil

    desc <<-txt
    The maximum amount of memory to use in the server.  This is only used
    in the in-memory databases.
    txt
    capsize nil

    desc <<-txt
    Aligment power.  The byte alignment of records.  This specifies a power
    of two.  The default value is 4 meaning that all records are aligned on
    16 byte boundaries.

    This applies to on disk Hash, B+ tree and Table databases.
    txt
    apow nil

    desc <<-txt
    Free block pool power.  This is the maximum number of elements in the free
    block pool as a power of 2.  The default is 10 meaning that there are a
    maximum of 1024 free blocks.

    This applies to on disk hash, B+ tree and Table databases.
    txt
    fpow nil

    desc <<-txt
    The maximum number of records to be cached.  If set to 0 or less then
    the cache is disabled.  That is the default.

    This applies to on disk Hash and Table databases.
    txt
    rcnum nil

    desc <<-txt
    The size of the memory mapped region.  By default this is 64 megabytes.

    This applies to on disk Hash, B+ tree and Table databases.
    txt
    xmsiz

    desc <<-txt
    Auto defragmentation configuration.  This controls how the automatic
    defragmentation of databases is preformed.  It is the 'step'
    number.  It is off by default.

    This applies to on disk Hash, B+ tree and Table databases.
    txt
    dfunit nil

    desc <<-txt
    The maximum number of leaf nodes to be cached.  The default is 4096.

    This applies to B+ tree and Table databses
    txt
    lcnum nil

    desc <<-txt
    The maximum number of non-leaf nodes to be cached.  The default is 512.

    This applies to B+ tree and Table databses
    txt
    ncnum nil

    desc <<-txt
    The number of members in each leaf page.  The default is 128.

    This applies to B+ tree databases.
    txt
    lmemb nil

    desc <<-txt
    The number of members in each non-leaf page.  The default is 128.

    This applies to B+ tree databases.
    txt
    nmemb nil

    desc <<-txt
    The width of the value of each record in a fixed length database.
    The default is 255.
    txt
    width nil

    desc <<-txt
    The file size limit of the fixed database file.  The default is 256 MB.
    txt
    limsiz nil

  }

  desc <<-txt
  The directory holding the database file.  By default this is relative
  to the instance directory.  If you want to put it somewhere else, then
  put the full path here.
  txt
  data_dir "data"

  desc <<-txt
  The directory holding the update logs.  By default this is relative
  to the instance directory.  If you want to put it somewhere else, then
  put the full path here.
  txt
  ulog_dir "ulog"

  desc <<-txt
  The pid file location.  By default this is relative to the instance
  directory.  If you want it place somewhere else, then put the full
  path here.
  txt
  pid_file "presences.pid"

  desc <<-txt
  The log file location.  By default this is relative to the instance
  directory.  If you want it place somewhere else, then put the full
  path here.
  txt
  log_file "log/presences.log"

  desc <<-txt
  If this instance is to replicate the data from another instance then
  set that instances host here.
  txt
  master_server nil

  desc <<-txt
  If this instance is to replicate the data from another instance then
  set that instances port here.
  txt
  master_port nil

  desc <<-txt
  This is the server id of this instance when it is part of a replication.
  This must be set, and it must be unique within the set of hosts doing
  replication.
  txt
  server_id nil

  desc <<-txt
  If this server is replicating data from a master, then it must have
  this set to the location of a replication timestamp file.  The
  default is relative to the instance directory.
  txt
  replication_timestamp_file "presences.rts"

  desc <<-txt
  The name of a file to load as a lua extension.  By default this
  is relative to the root of the instance directory.  This file will
  only be loaded if it exists.
  txt
  lua_extension_file "lua/presences.lua"

  desc <<-txt
  You may specify a lua function and a periodicity in which it is to
  be called.  This lua function must be available from within the
  lua_extension_file that is loaded.

  The periodicity is really the time to wait between calls.
  txt
  periodic_command {
    desc "The function to call"
    name nil

    desc "how often to call"
    period nil
  }
end

if $0 == __FILE__ then
  help = Loquacious::Configuration.help_for("presences", :colorize => true)
  help.show :values => true
end

redpajama_set_name: RedPajamaGithub


text:
title: Combine an Array into a String Using the join Method
---
## Combine an Array into a String Using the join Method

### Problem Explanation

Use the `join` method (among others) inside the `sentensify` function to make a sentence from the words in the string `str`. The function should return a string. For example, "I-like-Star-Wars" would be converted to "I like Star Wars". For this challenge, do not use the `replace` method.

#### Relevant Links:
  - [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join)
  - [String.prototype.split()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)
  - [Regular Expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)

### Hint1
You may need to convert the string to an array first.

### Hint2
You may need to use regular expression to split the string.

### Solution:
```javascript
function sentensify(str) {
  // Add your code below this line
  return str.split(/\W/).join(' ');
  // Add your code above this line
}
sentensify("May-the-force-be-with-you");
```


text:
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "@angular/common", "@angular/core", "../backdrop/backdrop.module", "../button/button.module", "./picker-component", "./picker-column"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var common_1 = require("@angular/common");
    var core_1 = require("@angular/core");
    var backdrop_module_1 = require("../backdrop/backdrop.module");
    var button_module_1 = require("../button/button.module");
    var picker_component_1 = require("./picker-component");
    var picker_column_1 = require("./picker-column");
    /**
     * @hidden
     */
    var PickerModule = (function () {
        function PickerModule() {
        }
        /**
         * @return {?}
         */
        PickerModule.forRoot = function () {
            return {
                ngModule: PickerModule, providers: []
            };
        };
        return PickerModule;
    }());
    PickerModule.decorators = [
        { type: core_1.NgModule, args: [{
                    imports: [
                        backdrop_module_1.BackdropModule,
                        button_module_1.ButtonModule,
                        common_1.CommonModule
                    ],
                    declarations: [
                        picker_component_1.PickerCmp,
                        picker_column_1.PickerColumnCmp
                    ],
                    exports: [
                        picker_component_1.PickerCmp,
                        picker_column_1.PickerColumnCmp
                    ],
                    entryComponents: [
                        picker_component_1.PickerCmp
                    ]
                },] },
    ];
    /**
     * @nocollapse
     */
    PickerModule.ctorParameters = function () { return []; };
    exports.PickerModule = PickerModule;
    function PickerModule_tsickle_Closure_declarations() {
        /** @type {?} */
        PickerModule.decorators;
        /**
         * @nocollapse
         * @type {?}
         */
        PickerModule.ctorParameters;
    }
});
//# sourceMappingURL=picker.module.js.map


text:
class Purchase < ActiveRecord::Base
end


text:
"""Resource manager for datablox-caretaker 1.0
"""

# Common stdlib imports
import sys
import os
import os.path
## import commands

# fix path if necessary (if running from source or running as test)
try:
    import engage.utils
except:
    sys.exc_clear()
    dir_to_add_to_python_path = os.path.abspath((os.path.join(os.path.dirname(__file__), "../../../..")))
    sys.path.append(dir_to_add_to_python_path)

import engage.drivers.service_manager as service_manager
import engage.drivers.utils
# Drivers compose *actions* to implement their methods.
from engage.drivers.action import *

# setup errors
from engage.utils.user_error import UserError, EngageErrInf
import gettext
_ = gettext.gettext

errors = { }

def define_error(error_code, msg):
    global errors
    error_info = EngageErrInf(__name__, error_code, msg)
    errors[error_info.error_code] = error_info

# error codes
# FILL IN
ERR_BAD_PW_FILE = 1

define_error(ERR_BAD_PW_FILE,
             _("Master password file path seems to be changed from the default, which is not supported. Expecting %(exp)s, got %(act)s"))

# setup logging
from engage.utils.log_setup import setup_engage_logger
logger = setup_engage_logger(__name__)

# this is used by the package manager to locate the packages.json
# file associated with the driver
def get_packages_filename():
    return engage.drivers.utils.get_packages_filename(__file__)

def make_context(resource_json, sudo_password_fn, dry_run=False):
    """Create a Context object (defined in engage.utils.action). This contains
    the resource's metadata in ctx.props, references to the logger and sudo
    password function, and various helper functions. The context object is used
    by individual actions.

    If your resource does not need the sudo password, you can just pass in
    None for sudo_password_fn.
    """
    ctx = Context(resource_json, logger, __file__,
                  sudo_password_fn=sudo_password_fn,
                  dry_run=dry_run)
    ctx.check_port('config_port',
                  pid_file=unicode,
                  config_dir=unicode,
                  log_file=unicode)
    ctx.check_port('input_ports.datablox_framework',
                  caretaker_exe=unicode,
                  BLOXPATH=unicode)
    ctx.check_port('input_ports.host',
                   genforma_home=unicode,
                   log_directory=unicode)

    # add any extra computed properties here using the ctx.add() method.
    return ctx

def np(path):
    return os.path.abspath(os.path.expanduser(path))

# Now, define the main resource manager class for the driver. If this driver is
# a service, inherit from service_manager.Manager instead of
# resource_manager.Manager. If you need the sudo password, add
# PasswordRepoMixin to the inheritance list.
#
class Manager(service_manager.Manager):
    # need to ensure that a password file is generated, as there might
    # be blocks that require a password.
    REQUIRES_PASSWORD_FILE = True
    def __init__(self, metadata, dry_run=False):
        package_name = "%s %s" % (metadata.key["name"],
                                  metadata.key["version"])
        service_manager.Manager.__init__(self, metadata, package_name)
        self.ctx = make_context(metadata.to_json(),
                                None, # self._get_sudo_password,
                                dry_run=dry_run)

    def validate_pre_install(self):
        pass
        ## """The password file resource lets one change the location of
        ## the master password file, but we don't currently support that.
        ## """
        ## p = self.ctx.props
        ## act_pw_file = np(p.input_ports.master_password_file.password_file)
        ## exp_pw_file = np(os.path.join(p.input_ports.host.genforma_home,
        ##                               "config/master.pw"))
        ## if act_pw_file != exp_pw_file:
        ##     raise UserError(errors[ERR_BAD_PW_FILE],
        ##                     msg_args={"act":act_pw_file,
        ##                               "exp":exp_pw_file})

    def is_installed(self):
        return os.path.exists(self.ctx.props.config_port.config_dir)

    def install(self, package):
        p = self.ctx.props
        self.ctx.r(ensure_dir_exists, p.config_port.config_dir)
        # BLOXPATH should be created by datablox framework?
        self.ctx.r(ensure_dir_exists,
                   p.input_ports.datablox_framework.BLOXPATH)

    def validate_post_install(self):
        pass

    def start(self):
        p = self.ctx.props
        self.ctx.r(start_server,
                   [p.input_ports.datablox_framework.caretaker_exe,
                    "--bloxpath=%s" % p.input_ports.datablox_framework.BLOXPATH,
                    "--config-dir=%s" % p.config_port.config_dir,
                    "--log-dir=%s" % p.input_ports.host.log_directory],
                   p.config_port.log_file,
                   p.config_port.pid_file)

    def stop(self):
        p = self.ctx.props
        self.ctx.r(stop_server,
                   p.config_port.pid_file)

    def is_running(self):
        p = self.ctx.props
        return self.ctx.rv(get_server_status,
                           p.config_port.pid_file) != None

    def get_pid_file_path(self):
        return self.ctx.props.config_port.pid_file


text:
<?xml version="1.0" encoding="utf-8"?>

<!--
@package      hubzero-cms
@copyright    Copyright 2005-2019 HUBzero Foundation, LLC.
@license      http://opensource.org/licenses/MIT MIT
-->

<metadata>
	<layout title="Standard Storage Manager Layout">
		<message>
			<![CDATA[STANDARD STORAGE MANAGER LAYOUT DESC]]>
		</message>
	</layout>
	<state>
		<name>Standard Storage Manager Layout</name>
		<description>STANDARD STORAGE MANAGER LAYOUT DESC</description>
		<params>
		</params>
	</state>
</metadata>


text:
$(document).ready(function() {
    $( ".roll" ).addClass("animated rollIn");

    setTimeout(function(){
        $( ".roll2" ).css("display", "block");
        $( ".roll2" ).addClass("animated rollIn");
    }, 3000);

    $(".roll2").click(function(){
        $(".roll2").css("display", "none");
        $(".wrapper").css("display", "block");
    })
});

$(document).ready(function() {

    // Token Engine
    var token = new Object();
    var color = new Array("blue", "yellow", "pink", "red", "black", "grey", "orange", "green", "purple");
    var counter;
    var points = 0;
    var tokenToClick;
    var clickedToken;
    var level = 1;
    var clickcolor;

    var seconds_left = 7;
    var shuffe = new Array(0,1,2,3,4,5,6,7,8);

    // Array with Messages for the Different Colors
    var blueMsg = new Array("sein ... Wunder erleben", "mit einem ... Auge davonkommen", "mit einem ... Auge davonkommen", "... Blut in den Adern haben", "sein ... Wunder erleben");
    var yellowMsg = new Array("das ... Fiber", "... Galle","... vor Neid","Lebensfreude","Sonne","Schwefel");
    var pinkMsg = new Array("etwas in ... Licht schildern","nicht in ... Laune sein","eine Lage ist nicht ...","etwas durch eine ... Brille sehen","pink");
    var redMsg = new Array("... werden", "ein ... Tuch für jemanden sein","... Zahlen","einen Tag im Kalender ... anstreichen","der ... Faden");
    var blackMsg = new Array("... Diamanten","sich ... Ärgern","ins ... treffen","das ... Schaf sein","der ... Mann");
    var greyMsg = new Array("bei Nacht sind alle Katzen ...","der ... Alltag","sich wegen etwas keine ... Haare wachsen lassen","alles grau in ... sehen","jemandem ... es vor etwas");
    var orangeMsg = new Array("Salt war früher ..", "orange","orange","orange","orange");
    var greenMsg = new Array("auf keinen ... Zweig kommen", "... Licht geben","dasselbe in ...","Ach du ... Neune!","noch ... hinter den Ohren sein");
    var purpleMsg = new Array("die Magie","Farbe des Hinduismus","die Phantasie","Eitelkeit","Rangfarbe der Bischöfe");

    // on window load roll all Element in
    function  rollIn()
    {

    }

    function getColorMsg()
    {
        var result = '';
        if(clickcolor == 'blue')
        {
            result = Math.floor((Math.random() * 5));
            return blueMsg[result];
        }
        if(clickcolor == 'yellow')
        {
            result = Math.floor((Math.random() * 5));
            return yellowMsg[result];
        }
        if(clickcolor == 'pink')
        {
            result = Math.floor((Math.random() * 5));
            return pinkMsg[result];
        }
        if(clickcolor == 'pink')
        {
            result = Math.floor((Math.random() * 5));
            return pinkMsg[result];
        }
        if(clickcolor == 'red')
        {
            result = Math.floor((Math.random() * 5));
            return redMsg[result];
        }
        if(clickcolor == 'black')
        {
            result = Math.floor((Math.random() * 5));
            return blackMsg[result];
        }
        if(clickcolor == 'grey')
        {
            result = Math.floor((Math.random() * 5));
            return greyMsg[result];
        }
        if(clickcolor == 'orange')
        {
            result = Math.floor((Math.random() * 5));
            return orangeMsg[result];
        }
        if(clickcolor == 'green')
        {
            result = Math.floor((Math.random() * 5));
            return greenMsg[result];
        }
        if(clickcolor == 'purple')
        {
            result = Math.floor((Math.random() * 5));
            return purpleMsg[result];
        }
        else
        {
            var x = new Array("wrong color");
            return x;
        }
    }

    // Shuffle a array and return the shuffled Array
    function anyShuffle(array) {

        var counterx = array.length;

        // While there are elements in the array
        while (counterx > 0) {
            // Pick a random index
            var index = Math.floor(Math.random() * counterx);

            // Decrease counter by 1
            counterx--;

            // And swap the last element with it
            var temp = array[counterx];
            array[counterx] = array[index];
            array[index] = temp;
        }

        return shuffe;
    }

    // add Colors MSG Array with index
    // blue = 0;
    // yellow = 1
    // pink = 2
    // red = 3
    // black = 4
    //var allColorMsg = new Array(blueMsg, );

    function shuffle() {

        var counterx = shuffe.length;

        // While there are elements in the array
        while (counterx > 0) {
            // Pick a random index
            var index = Math.floor(Math.random() * counterx);

            // Decrease counter by 1
            counterx--;

            // And swap the last element with it
            var temp = shuffe[counterx];
            shuffe[counterx] = shuffe[index];
            shuffe[index] = temp;
        }

        return shuffe;
    }

    $(".gametoken").click(function(event) {
        clickedToken = event.target.id;
        console.log(event.target.id);
        console.log("Timer: " + counter);

        // check if right Field clicked and timer not null, reward points
        checkTokenClick();
    });

    $("#gamestart").click(function(event){
        seconds_left = 8;
        points = 0;
        $("#punkte").text(points);
        setTokenColor();
        startTimer();
        setTokenToClick();
    });

    function setTokenColor()
    {
        shuffle();
        token.first = shuffe[0];
        token.second = shuffe[1];
        token.third = shuffe[2];
        token.four = shuffe[3];

        $("#1").css("background-color", color[token.first]);
        $("#2").css("background-color", color[token.second]);
        $("#3").css("background-color", color[token.third]);
        $("#4").css("background-color", color[token.four]);
    }

    function startTimer()
    {
        var interval = setInterval(function() {
            document.getElementById('timer_div').innerHTML = '
' + --seconds_left + '
';
            counter = seconds_left;
            if (seconds_left <= 0)
            {
                document.getElementById('timer_div').innerHTML = '
Game Over!
';
                clearInterval(interval);
            }
        }, 1000);
    }

    function checkTimerIsRunning()
    {
        if(counter > 0)
        {
            return true;
        }
    }

    function setTokenToClick()
    {
        tokenToClick = Math.floor((Math.random() * 4) + 1);
        clickcolor = tokenClickColor(tokenToClick);
        console.log("Color click number " + tokenToClick );
        console.log("Color to click: " + clickcolor);

        var msg = getColorMsg();
        console.log(msg);
        document.getElementById('message').innerHTML = '
 ' + msg + '
';
    }

    function tokenClickColor(clicknumber)
    {
        if(clicknumber == 1)
        {
            return color[token.first];
        }
        if(clicknumber == 2)
        {
            return color[token.second];
        }
        if(clicknumber == 3)
        {
            return color[token.third];
        }
        if(clicknumber == 4)
        {
            return color[token.four];
        }

    }

    function myFunction()
    {
        $( "#"+clickedToken ).addClass("animated flash");
        setTimeout(function(){
            $( "#"+clickedToken ).removeClass("animated flash")
        }, 500);

    }

    function checkTokenClick()
    {
        console.log("check");
        console.log(tokenToClick);
        console.log(clickedToken);
        if(tokenToClick == clickedToken)
        {
            console.log("Treffer");
            var timer = checkTimerIsRunning();
            if(timer == true)
            {
                // add a Selector Boder color
                myFunction();

                points = points + 5;
                $("#punkte").text(points);

                // neue runde starten Level OK
                // neuer Timer
                // neue Token
                setTokenColor();
                seconds_left = 7;
                setTokenToClick();
            }
        }
        else
        {
            $( "#"+clickedToken ).addClass("animated hinge");
            setTimeout(function(){
                $(".wrapper").fadeOut();
                setTimeout(function(){
                        $(".over").css("display", "block");
                        $(".over").addClass("animated zoomIn");
                    }, 1800);
                ;
                $( "#"+clickedToken ).removeClass("animated hinge")
            }, 3000);

            // falscher Token geclicked, Spiel zuende
            seconds_left = 0;
            document.getElementById('timer_div').innerHTML = 'Spiel zuende!';
        }
    }
});


text:
ACCEPTED

#### According to
Interim Register of Marine and Nonmarine Genera

#### Published in
Bulletin Br. Mus. Nat. Hist. (Zool. ) 48 (2): 121.

#### Original name
null

### Remarks
null


text:
module.exports = Loop;

var Messenger = require('./Messenger.js');

/**
 * Game loop with independent clock events for fixed durations and variable
 * durations.
 * @param {Messenger} messenger
 * @constructor
 */
function Loop(messenger)
{
  // Messenger we'll use for clock signals
  this.messenger = messenger || new Messenger();

  this.fixedDuration = 8;
  this.started       = false;

  // Live stats
  this.currentTime        = 0;
  this.fixedStepsPerFrame = 0;
  this.fixedTimePerFrame  = 0;
  this.renderTimePerFrame = 0;
  this.frameTime          = 0;
}

/**
 * Happens at a variable rate based on system (render loop)
 * @event
 */
Loop.TICK = 'Loop#TICK';

/**
 * Happens at a fixed length (simulation loop)
 * @event
 */
Loop.FIXED_TICK = 'Loop#FIXED_TICK';

/**
 * Fire.
 */
Loop.prototype.start = function()
{
  if (this.started) return;

  // Loop params and syncing
  var lastTime  = 0;
  var simAcc    = 0;
  var simTime   = 0;
  var simStep   = this.fixedDuration;
  var messenger = this.messenger;
  var _this     = this;

  // Stats
  var simStart = 0;
  var renderStart = 0;
  var frameStart = 0;

  function loop(time) {
    global.requestAnimationFrame(loop);

    // Log duration of each raf-fired frame
    if (frameStart)
      _this.frameTime = global.performance.now() - frameStart;
    frameStart = global.performance.now();

    // Determine what our delta is since last raf-frame
    var dt = lastTime ? time - lastTime : 0;

    messenger.resetCounters();

    // Dump as much time that has passed into the simulator time accumulator.
    simAcc += dt;

    // Continue to step the fixed loop until we run out of time on the
    // accumulator
    _this.fixedStepsPerFrame = 0;
    simStart = global.performance.now();
    while (simAcc >= simStep) {
      messenger.trigger(Loop.FIXED_TICK, simStep, simTime);
      simTime += simStep;
      simAcc -= simStep;
      _this.fixedStepsPerFrame++;
    }
    _this.fixedTimePerFrame = global.performance.now() - simStart;
    _this.currentTime = simTime;

    // Fire the variable step clock once
    renderStart = global.performance.now();
    messenger.trigger(Loop.TICK, dt, time);
    _this.renderTimePerFrame = global.performance.now() - renderStart;
    lastTime = time;
  }

  // BOOM
  global.requestAnimationFrame(loop);
  this.started = true;
};

/**
 * Convenience function for variable tick event.
 * @param {Function} fn
 */
Loop.prototype.onTick = function(fn)
{
  return this.messenger.listenTo(Loop.TICK, fn);
};

/**
 * Convenience function for fixed tick event.
 * @param {Function} fn
 */
Loop.prototype.onFixedTick = function(fn)
{
  return this.messenger.listenTo(Loop.FIXED_TICK, fn);
};


text:
extern "C" {
#endif

typedef struct {
  int test_num;
  int num_passed;
  int num_failed;
  int num_skipped;
} test_batch_runner;

test_batch_runner *test_batch_runner_new();

void SKIP(test_batch_runner *runner, int num_tests);

void OK(test_batch_runner *runner, int cond, const char *msg, ...);

void INT_EQ(test_batch_runner *runner, int got, int expected, const char *msg,
            ...);

void STR_EQ(test_batch_runner *runner, const char *got, const char *expected,
            const char *msg, ...);

int test_ok(test_batch_runner *runner);

void test_print_summary(test_batch_runner *runner);

#ifdef __cplusplus
}
#endif

#endif


text:
using AutoMapper;
using StudentSystem.Models;
using StudentSystem.Services.Models;

namespace StudentSystem.Services
{
    public static class MappingConfig
    {
        public static void RegisterMappings()
        {
            Mapper.CreateMap<Student, StudentModel>()
                .ForMember(
                    dest => dest.Id,
                    src => src.MapFrom(obj => obj.StudentIdentification));

            Mapper.CreateMap<StudentModel, Student>()
                .ForMember(
                    dest => dest.StudentIdentification,
                    src => src.MapFrom(obj => obj.Id));

            Mapper.CreateMap<Course, CourseModel>()
                .ForMember(
                    dest => dest.CourseId,
                    src => src.MapFrom(obj => obj.Id));

            Mapper.CreateMap<CourseModel, Course>();

            Mapper.CreateMap<Homework, HomeworkModel>();

            Mapper.CreateMap<Test, TestModel>();
        }
    }
}


text:
import {eq} from "prosemirror-test-builder"
import {Node} from "prosemirror-model"
import ist from "ist"

import {schema, defaultMarkdownParser, defaultMarkdownSerializer, MarkdownSerializer} from "prosemirror-markdown"

import {doc, blockquote, h1, h2, p, hr, li, ol, ol3, ul, pre, em, strong, code, a, link, br, img} from "./build.js"

function parse(text: string, doc: Node) {
  ist(defaultMarkdownParser.parse(text), doc, eq)
}

function serialize(doc: Node, text: string) {
  ist(defaultMarkdownSerializer.serialize(doc), text)
}

function same(text: string, doc: Node) {
  parse(text, doc)
  serialize(doc, text)
}

describe("markdown", () => {
  it("parses a paragraph", () =>
     same("hello!",
          doc(p("hello!"))))

  it("parses headings", () =>
     same("# one\n\n## two\n\nthree",
          doc(h1("one"), h2("two"), p("three"))))

  it("parses a blockquote", () =>
     same("> once\n\n> > twice",
          doc(blockquote(p("once")), blockquote(blockquote(p("twice"))))))

  // FIXME bring back testing for preserving bullets and tight attrs
  // when supported again

  it("parses a bullet list", () =>
     same("* foo\n\n  * bar\n\n  * baz\n\n* quux",
          doc(ul(li(p("foo"), ul(li(p("bar")), li(p("baz")))), li(p("quux"))))))

  it("parses an ordered list", () =>
     same("1. Hello\n\n2. Goodbye\n\n3. Nest\n\n   1. Hey\n\n   2. Aye",
          doc(ol(li(p("Hello")), li(p("Goodbye")), li(p("Nest"), ol(li(p("Hey")), li(p("Aye"))))))))

  it("preserves ordered list start number", () =>
     same("3. Foo\n\n4. Bar",
          doc(ol3(li(p("Foo")), li(p("Bar"))))))

  it("parses a code block", () =>
     same("Some code:\n\n```\nHere it is\n```\n\nPara",
          doc(p("Some code:"), schema.node("code_block", {params: ""}, [schema.text("Here it is")]), p("Para"))))

  it("parses an intended code block", () =>
     parse("Some code:\n\n    Here it is\n\nPara",
          doc(p("Some code:"), pre("Here it is"), p("Para"))))

  it("parses a fenced code block with info string", () =>
     same("foo\n\n```javascript\n1\n```",
          doc(p("foo"), schema.node("code_block", {params: "javascript"}, [schema.text("1")]))))

  it("parses inline marks", () =>
     same("Hello. Some *em* text, some **strong** text, and some `code`",
          doc(p("Hello. Some ", em("em"), " text, some ", strong("strong"), " text, and some ", code("code")))))

  it("parses overlapping inline marks", () =>
     same("This is **strong *emphasized text with `code` in* it**",
          doc(p("This is ", strong("strong ", em("emphasized text with ", code("code"), " in"), " it")))))

  it("parses links inside strong text", () =>
     same("**[link](foo) is bold**",
          doc(p(strong(a("link"), " is bold")))))

  it("parses emphasis inside links", () =>
    same("[link *foo **bar** `#`*](foo)",
         doc(p(a("link ", em("foo ", strong("bar"), " ", code("#")))))))

  it("parses code mark inside strong text", () =>
     same("**`code` is bold**",
          doc(p(strong(code("code"), " is bold")))))

  it("parses code mark containing backticks", () =>
     same("``` one backtick: ` two backticks: `` ```",
          doc(p(code("one backtick: ` two backticks: ``")))))

  it("parses code mark containing only whitespace", () =>
     serialize(doc(p("Three spaces: ", code("   "))),
               "Three spaces: `   `"))

  it("parses hard breaks", () => {
    same("foo\\\nbar", doc(p("foo", br(), "bar")))
    same("*foo\\\nbar*", doc(p(em("foo", br(), "bar"))))
  })

  it("parses links", () =>
     same("My [link](foo) goes to foo",
          doc(p("My ", a("link"), " goes to foo"))))

  it("parses urls", () =>
     same("Link to <https://prosemirror.net>",
          doc(p("Link to ", link({href: "https://prosemirror.net"}, "https://prosemirror.net")))))

  it("correctly serializes relative urls", () => {
    same("[foo.html](foo.html)",
         doc(p(link({href: "foo.html"}, "foo.html"))))
  })

  it("can handle link titles", () => {
    same('[a](x.html "title \\"quoted\\"")',
         doc(p(link({href: "x.html", title: 'title "quoted"'}, "a"))))
  })

  it("doesn't escape underscores in link", () => {
    same('[link](http://foo.com/a_b_c)',
         doc(p(link({href: "http://foo.com/a_b_c"}, "link"))))
  })

  it("parses emphasized urls", () =>
     same("Link to *<https://prosemirror.net>*",
          doc(p("Link to ", em(link({href: "https://prosemirror.net"}, "https://prosemirror.net"))))))

  it("parses an image", () =>
     same("Here's an image: ![x](img.png)",
          doc(p("Here's an image: ", img()))))

  it("parses a line break", () =>
     same("line one\\\nline two",
          doc(p("line one", br(), "line two"))))

  it("parses a horizontal rule", () =>
     same("one two\n\n---\n\nthree",
          doc(p("one two"), hr(), p("three"))))

  it("ignores HTML tags", () =>
     same("Foo < img> bar",
          doc(p("Foo < img> bar"))))

  it("doesn't accidentally generate list markup", () =>
     same("1\\. foo",
          doc(p("1. foo"))))

  it("doesn't fail with line break inside inline mark", () =>
     same("**text1\ntext2**", doc(p(strong("text1\ntext2")))))

  it("drops trailing hard breaks", () =>
     serialize(doc(p("a", br(), br())), "a"))

  it("expels enclosing whitespace from inside emphasis", () =>
     serialize(doc(p("Some emphasized text with", strong(em("  whitespace   ")), "surrounding the emphasis.")),
               "Some emphasized text with  ***whitespace***   surrounding the emphasis."))

  it("drops nodes when all whitespace is expelled from them", () =>
     serialize(doc(p("Text with", em(" "), "an emphasized space")),
               "Text with an emphasized space"))

  it("preserves list tightness", () => {
    same("* foo\n* bar", doc(ul({tight: true}, li(p("foo")), li(p("bar")))))
    same("1. foo\n2. bar", doc(ol({tight: true}, li(p("foo")), li(p("bar")))))
  })

  it("doesn't put a code block after a list item inside the list item", () =>
     same("* list item\n\n```\ncode\n```",
          doc(ul({tight: true}, li(p("list item"))), pre("code"))))

  it("doesn't escape characters in code", () =>
     same("foo`*`", doc(p("foo", code("*")))))

  it("doesn't escape underscores between word characters", () =>
     same("abc_def", doc(p("abc_def"))))

   it("doesn't escape strips of underscores between word characters", () =>
     same("abc___def", doc(p("abc___def"))))

   it("escapes underscores at word boundaries", () =>
     same("\\_abc\\_", doc(p("_abc_"))))

   it("escapes underscores surrounded by non-word characters", () =>
     same("/\\_abc\\_)", doc(p("/_abc_)"))))

  it("ensure no escapes in url", () =>
    parse("[text](https://example.com/_file/#~anchor)",
          doc(p(a({href: "https://example.com/_file/#~anchor"}, "text")))))

  // Issue #65
  it("ensure no escapes in autolinks", () =>
    same("<https://example.com/_file/#~anchor>",
         doc(p(a({href: "https://example.com/_file/#~anchor"}, "https://example.com/_file/#~anchor")))))

  // Issue #73
  it("escape ! in front of links", () =>
    serialize(doc(p("!", a("text"))), "\\![text](foo)"))

  // Issue #78
  it("escape of URL in links and images", () => {
    serialize(doc(p(a({href: "foo):"}, "link"))), "[link](foo\\):)")
    serialize(doc(p(a({href: "(foo"}, "link"))), "[link](\\(foo)")
    serialize(doc(p(img({src: "foo):"}))), "![x](foo\\):)")
    serialize(doc(p(img({src: "(foo"}))), "![x](\\(foo)")
    serialize(doc(p(a({title: "bar", href: "foo%20\""}, "link"))), "[link](foo%20\\\" \"bar\")")
  })

  it("escapes extra characters from options", () => {
    let markdownSerializer = new MarkdownSerializer(defaultMarkdownSerializer.nodes,
                                                    defaultMarkdownSerializer.marks,
                                                    {escapeExtraCharacters: /[\|!]/g})
    ist(markdownSerializer.serialize(doc(p("foo|bar!"))), "foo\\|bar\\!")
  })

  it("escapes list markers inside lists", () => {
    same("* 1\\. hi\n\n* x", doc(ul(li(p("1. hi")), li(p("x")))))
  })

  // Issue #88
  it("code block fence adjusts to content", () => {
    same("````\n```\ncode\n```\n````", doc(pre("```\ncode\n```")))
  })
})


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_wrapper"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@color/navdrawer_background"
    android:clickable="true"
    android:orientation="vertical">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="140dp"
        android:background="@drawable/nav_drawer_background"
        android:gravity="top"
        android:paddingLeft="16dp"
        android:paddingBottom="8dp"
        android:id="@+id/rlNavDrawer_cabecera">

        <de.hdodenhof.circleimageview.CircleImageView
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/fragmen_perfil_ajeno_image_user"
            android:layout_width="50dp"
            android:layout_height="50dp"
            app:border_width="2dp"
            app:border_color="@color/blanco"
            android:src="@drawable/user_undefined"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_marginTop="15dp" />

        <TextView
            android:id="@+id/fragmen_perfil_ajeno_user_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="end|center_vertical"
            android:layout_toRightOf="@+id/fragmen_perfil_ajeno_image_user"
            android:layout_alignTop="@+id/fragmen_perfil_ajeno_image_user"
            android:layout_gravity="bottom"
            android:textSize="16sp"
            android:paddingLeft="8dp"
            android:paddingTop="8dp"
            android:text="Se me ha orvidao"
            android:textColor="@android:color/white" />

        <TextView
            android:id="@+id/fragmen_perfil_ajeno_user_email"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="end|top"
            android:layout_alignLeft="@+id/fragmen_perfil_ajeno_user_name"
            android:layout_alignBottom="@+id/fragmen_perfil_ajeno_image_user"
            android:textSize="12sp"
            android:paddingLeft="8dp"
            android:paddingBottom="8dp"
            android:text="Er email shuloo"
            android:textColor="@android:color/white" />

        <LinearLayout
            android:id="@+id/fragmen_perfil_ajeno_user_layout_titles"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/fragmen_perfil_ajeno_image_user"
            android:paddingTop="20dp"
            android:orientation="horizontal">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/fragmen_perfil_ajeno_title_gifts"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/navdrawer_user_gifts"
                    style="@style/NavDrawerTitleText"/>

                <TextView
                    android:id="@+id/fragmen_perfil_ajeno_subtitle_gifts"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="23"
                    style="@style/NavDrawerSubtitleText"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/fragmen_perfil_ajeno_title_following"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/navdrawer_user_followings"
                    style="@style/NavDrawerTitleText"/>

                <TextView
                    android:id="@+id/fragmen_perfil_ajeno_subtitle_following"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="45"
                    style="@style/NavDrawerSubtitleText"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:paddingRight="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/fragmen_perfil_ajeno_title_followers"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/navdrawer_user_followers"
                    style="@style/NavDrawerTitleText"/>

                <TextView
                    android:id="@+id/fragmen_perfil_ajeno_subtitle_followers"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="56"
                    style="@style/NavDrawerSubtitleText"/>

            </LinearLayout>

        </LinearLayout>

    </RelativeLayout>

    <GridView
        android:id="@+id/perfil_ajeno_grid"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:numColumns="1"
        android:verticalSpacing="16dp"
        android:horizontalSpacing="16dp"
        android:padding="5dp"
        android:clipToPadding="false"
        android:stretchMode="columnWidth"
        android:gravity="center"
        />
</LinearLayout>


text:
package com.cloudera.util;

import java.io.File;

import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.ContextHandlerCollection;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.DefaultServlet;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.webapp.WebAppContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.cloudera.util.StatusHttpServer.StackServlet;
import com.google.common.base.Preconditions;

/**
 *

 * An embedded Jetty HTTP server that support both normal and exploded war file
 * deployment. Those that wish to expose HTTP services should create an instance
 * of this class, configure the server via accessor methods, and then call
 * {@link #start()}.
 *

 *

 * Resources internally are allocated upon the first call to {@link #start()}.
 * This includes scanning of the configured webapp directory for applications if
 * {@link #getScanForApps()} is true (the default). Mostly this class is a thin
 * wrapper around Jetty's {@link Server} class and behaves as Jetty does. Both
 * traditional and exploded war formats are supported in the webapp directory.
 * In the case of exploded directories, the directory name is used as the
 * context. For war files, everything from the first instance of ".war" to the
 * end of the file name (inclusive) is stripped and the remainder is used for
 * the context name.
 *

 *

 * Name examples:
 *

 *

 *

 * Name
 * Type
 * Context
 *

 *

 * app.war
 * file
 * app
 *

 *

 * app
 * dir
 * app
 *

 *

 * app.war
 * dir
 * app.war
 *

 *

 * app.war.war
 * file
 * app
 *

 *

 *
 *

 *

 * Example usage:
 *

 *
 *

 * InternalHttpServer server = new InternalHttpServer();
 *
 * // applicationHome/webapps/ will be scanned for war files and directories.
 * server.setWebappDir(new File(applicationHome, "webapps"));
 * server.setPort(8080);
 * server.setBindAddress("0.0.0.0");
 *
 * server.start();
 *
 * // at some later time...
 * server.stop();
 *

 */
public class InternalHttpServer {

  private static final Logger logger = LoggerFactory
      .getLogger(InternalHttpServer.class);

  private Server server;
  private File webappDir;
  private int port;
  private String bindAddress;
  private boolean scanForApps;
  private ContextHandlerCollection handlers;

  public InternalHttpServer() {
    port = 0;
    bindAddress = "0.0.0.0";
    scanForApps = true;
    handlers = new ContextHandlerCollection();
  }

  public void initialize() {
    if (server == null) {

      server = new Server();
      Connector connector = new SelectChannelConnector();

      connector.setPort(port);
      connector.setHost(bindAddress);

      server.addConnector(connector);
      server.addHandler(handlers);
    }
  }

  protected void registerApplications() {
    logger.debug("Registering webapps in {}", webappDir);

    if (webappDir.isDirectory()) {
      for (File entry : webappDir.listFiles()) {
        tryRegisterApplication(server, entry);
      }
    } else {
      tryRegisterApplication(server, webappDir);
    }
  }

  private boolean tryRegisterApplication(Server server, File path) {
    String name;

    logger.debug("checking {}", path);

    if (path.isFile()) {
      int idx = path.getName().indexOf(".war");

      if (idx > -1) {
        name = path.getName().substring(0, idx);
      } else {
        return false;
      }
    } else {
      name = path.getName();
    }

    logger.debug("creating context {} -> {}", name, path);

    // WebAppContext is for loading war files.
    WebAppContext handler = new WebAppContext(path.getPath(), "/" + name);

    handler.setParentLoaderPriority(true);

    handlers.addHandler(handler);

    return true;
  }

  /**
   *

   * Start a configured HTTP server. Users should have already injected all the
   * necessary configuration parameters at this point. It is not considered safe
   * to call start() more than once and will lead to undefined behavior.
   *

   *

   * The configured webappDir is not scanned for applications until start() is
   * called.
   *

   *
   * @throws InternalHttpServerException
   */
  public void start() {
    Preconditions.checkState(webappDir != null, "Webapp dir can not be null");

    initialize();

    if (scanForApps) {
      registerApplications();
    } else {
      logger.info("Not scanning for webapps");
    }

    logger.info("Starting internal HTTP server");

    try {
      server.start();

      logger.info("Server started");
    } catch (Exception e) {
      logger.warn("Caught exception during HTTP server start.", e);

      throw new InternalHttpServerException("Unable to start HTTP server", e);
    }
  }

  /**
   * Stop the running HTTP server. If {@link #start()} has never been called,
   * this is a no-op. This call blocks until the internal Jetty instance is
   * stopped (to the extent the Jetty {@link Server#stop()} call blocks).
   *
   * @throws InternalHttpServerException
   */
  public void stop() {
    if (server == null) {
      return;
    }

    logger.info("Stopping internal HTTP server");

    try {
      server.stop();
    } catch (Exception e) {
      logger.warn("Caught exception during HTTP server stop.", e);

      throw new InternalHttpServerException("Unable to stop HTTP server", e);
    }
  }

  @Override
  public String toString() {
    return "{ bindAddress:" + bindAddress + " webappDir:" + webappDir
        + " port:" + port + " scanForApps:" + scanForApps + " server:" + server
        + " }";
  }

  public Server getServer() {
    return server;
  }

  public void setServer(Server server) {
    this.server = server;
  }

  public File getWebappDir() {
    return webappDir;
  }

  public void setWebappDir(File webappDir) {
    this.webappDir = webappDir;
  }

  public int getPort() {
    return port;
  }

  public void setPort(int port) {
    this.port = port;
  }

  public String getBindAddress() {
    return bindAddress;
  }

  public void setBindAddress(String bindAddress) {
    this.bindAddress = bindAddress;
  }

  public boolean getScanForApps() {
    return scanForApps;
  }

  public void setScanForApps(boolean scanForApps) {
    this.scanForApps = scanForApps;
  }

  public static class InternalHttpServerException extends RuntimeException {

    private static final long serialVersionUID = -4936285404574873547L;

    public InternalHttpServerException() {
      super();
    }

    public InternalHttpServerException(String msg) {
      super(msg);
    }

    public InternalHttpServerException(String msg, Throwable t) {
      super(msg, t);
    }

    public InternalHttpServerException(Throwable t) {
      super(t);
    }

  }

  public void addHandler(Context ctx) {
    if (ctx == null) {
      logger.warn("Attempting to add null webapp context");
      return;
    }
    handlers.addHandler(ctx);
  }

  public static Context createLogAppContext() {
    Context ctx = new Context();
    // logs applet
    String logDir = System.getProperty("flume.log.dir");
    if (logDir != null) {
      ctx.setContextPath("/logs");
      ctx.setResourceBase(logDir);
      ctx.addServlet(DefaultServlet.class, "/*");
      ctx.setDisplayName("logs");
    }
    return ctx;
  }

  public static Context createServletContext(Class<?> sltClz, String contextPath,
      String pathSpec, String name) {
    Context ctx = new Context();
    ServletHolder holder = new ServletHolder(StackServlet.class);
    ctx.setContextPath("/stacks");
    ctx.addServlet(holder, "/*");
    ctx.setDisplayName("stacks");

    return ctx;
  }

}


text:
using Marazt.ConfigTransformation.Helpers;

namespace Marazt.ConfigTransformation.Options
{
    /// <summary>
    /// Class with options properties
    /// </summary>
    internal static class Options
    {
        #region Properties

        /// <summary>
        /// Gets the transfomation file name regexp.
        /// </summary>
        /// <value>
        /// The transfomation file name regexp.
        /// </value>
        public static string TransfomationFileNameRegexp => DTEHelper.GetPropertyValue<string>(AppConstants.ConfigTransformation,
            AppConstants.General,
            OptionsPage.TransfomationFileNameRegexpPropertyName);

        /// <summary>
        /// Gets the index of the source file regexp match.
        /// </summary>
        /// <value>
        /// The index of the source file regexp match.
        /// </value>
        public static int SourceFileRegexpMatchIndex => DTEHelper.GetPropertyValue<int>(AppConstants.ConfigTransformation, AppConstants.General,
            OptionsPage.SourceFileRegexpMatchIndexPropertyName);

        /// <summary>
        /// Gets a value indicating whether [nest transformation files].
        /// </summary>
        /// <value>
        /// <c>true</c> if [nest transformation files]; otherwise, <c>false</c>.
        /// </value>
        public static bool NestTransformationFiles => DTEHelper.GetPropertyValue<bool>(AppConstants.ConfigTransformation, AppConstants.General,
            OptionsPage.NestTransformationFilesPropertyName);

        /// <summary>
        /// Gets a value indicating whether [write attributes on a separate line].
        /// </summary>
        /// <value>
        /// <c>true</c> if [write attributes on a separate line]; otherwise, <c>false</c>.
        /// </value>
        public static bool WriteAttributesOnASeparateLine => DTEHelper.GetPropertyValue<bool>(AppConstants.ConfigTransformation, AppConstants.General, OptionsPage.WriteAttributesOnASeparateLinePropertyName);

        #endregion Properties
    }
}


text:
from django.contrib import admin
from core.models import *

# Register your models here.
admin.site.register(Category)
admin.site.register(Size)
admin.site.register(Colour)
admin.site.register(Seller)
admin.site.register(Item)
admin.site.register(Price)
admin.site.register(Feedback)
admin.site.register(Itemimage)
admin.site.register(Pincode)


text:
from flask import render_template_string, request
from sqlalchemy import or_, and_
from sqlalchemy.orm import with_polymorphic

import quoted_forsooth.plugins.report_plugin as report_plugin
from quoted_forsooth import db
from quoted_forsooth.db import session_scope
from quoted_forsooth.source import source_types

class ReportUnread(report_plugin.ReportPlugin):
    url_name = 'source_maintenance'

    template = """
{% extends "base.html" %}
{% block title %}Source Maintenance - Quoted Forsooth{% endblock %}
{% block pageContent %}

Sources missing page count

                Source
                Type

            {% for s in missing_pages %}

                {{s.link}}
                {{s.type}}

            {% endfor %}

{% endblock %}
"""

    def view(self):
        with session_scope() as session:
            if request.args.get('type', 'all') == 'all':
                papers = with_polymorphic(db.Source, [db.Book, db.ShortStory, db.Periodical, db.Comic], flat=True)
                missing_pages = session.query(papers).\
                    filter(or_(
                        and_(papers.type == 'book', papers.Book.pages == None),
                        and_(papers.type == 'story', papers.ShortStory.pages == None),
                        and_(papers.type == 'periodical', papers.Periodical.pages == None),
                        and_(papers.type == 'comic', papers.Comic.pages == None),
                    )).\
                    order_by(papers.id.asc())
            else:
                t = source_types.get(request.args.get('type'))
                if not t:
                    abort(400)
                missing_pages = session.query(t).\
                    filter(t.pages == None).\
                    order_by(t.id.asc())
                if request.args.get('strict') == 'true':
                    missing_pages = missing_pages.filter(t.type == request.args.get('type'))

            return render_template_string(self.template, missing_pages=missing_pages)


text:
import { ExpectedConditions as until, ElementFinder } from 'protractor';
import { BaseElement } from './base.element';

export class ModalDialog extends BaseElement {
  content = new BaseElement(this.$('.modal-content'));
  // optional
  footer = new BaseElement(this.content.$('.modal-footer'));

  constructor(element: ElementFinder, name?: string) {
    super(element, name);
  }

  async ready() {
    await super.ready();
    await this.content.ready();
  }

  async open() {
    await this.ready();
    this.log('Opened');
    return this;
  }
}


text:
namespace snn { namespace python {

    namespace p = boost::python;
    namespace np = boost::numpy;

    class network: public snn::network
    {
    private:
        // must be initialized before numpy objects
        p::object m_numpy_memory_owner;

    public:
        np::ndarray m_a;
        np::ndarray m_b;
        np::ndarray m_c;
        np::ndarray m_d;
        np::ndarray m_s;
        np::ndarray m_v;
        np::ndarray m_u;
        np::ndarray m_I;

    public:
        np::ndarray get_fired();

    public:
        network(int N, int D);
    };

}} // namespace snn::python

#endif // __SNN_PYTHON_NETWORK_H__


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AttachableItem : MonoBehaviour {

    Transform FollowPoint = null;
    SpriteRenderer SpriteRenderer;
    List<Collider2D> AllColliders;
    protected string SortingLayerWhenAttached = "character_item_front";

    protected virtual void Awake () {
        SpriteRenderer = GetComponent<SpriteRenderer>();
        if (SpriteRenderer == null) {
            SpriteRenderer = transform.GetComponentInChildren<SpriteRenderer>();
        }
        AllColliders = FindAllColliders();
    }

    protected void Update () {
        if (FollowPoint != null) {
            transform.position = FollowPoint.position;
            transform.rotation = FollowPoint.rotation;
        }
    }

    public void AttachTo (Transform followPoint) {
        Debug.Log( "Attaching " + name );
        FollowPoint = followPoint;
        SpriteRenderer.sortingLayerName = SortingLayerWhenAttached;
        GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Kinematic;
        GetComponent<PointOfInterest>().enabled = false;
        DisableColliders();
    }

    public void Detach () {
        Debug.Log( "Detaching " + name );
        FollowPoint = null;
        SpriteRenderer.sortingLayerName = "waves_items";
        GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;
        gameObject.layer = LayerMask.NameToLayer( "ItemInWater" );
        EnableColliders();
    }

    List<Collider2D> FindAllColliders() {
        var result = new List<Collider2D>();
        result.AddRange( GetComponents<BoxCollider2D>() );
        result.AddRange( GetComponents<CircleCollider2D>() );
        result.AddRange( GetComponents<PolygonCollider2D>() );
        result.AddRange( transform.GetComponentsInChildren<BoxCollider2D>() );
        result.AddRange( transform.GetComponentsInChildren<CircleCollider2D>() );
        result.AddRange( transform.GetComponentsInChildren<PolygonCollider2D>() );
        return result;
    }

    void DisableColliders() {
        AllColliders.ForEach( x => { x.enabled = false; } );
    }

    void EnableColliders() {
        AllColliders.ForEach( x => { x.enabled = true; } );
    }
}


text:
#include <boost/locale/config.hpp>
#ifdef BOOST_MSVC
#  pragma warning(push)
#  pragma warning(disable : 4275 4251 4231 4660)
#endif
#include <locale>

namespace boost {
namespace locale {

    class info;

    ///
    /// \defgroup collation Collation
    ///
    /// This module introduces collation related classes
    ///
    /// @{

    ///
    /// \brief a base class that includes collation level flags
    ///

    class collator_base {
    public:
        ///
        /// Unicode collation level types
        ///
        typedef enum {
            primary     = 0, ///< 1st collation level: base letters
            secondary   = 1, ///< 2nd collation level: letters and accents
            tertiary    = 2, ///< 3rd collation level: letters, accents and case
            quaternary  = 3, ///< 4th collation level: letters, accents, case and punctuation
            identical   = 4  ///< identical collation level: include code-point comparison
        } level_type;
    };

    ///
    /// \brief Collation facet.
    ///
    /// It reimplements standard C++ std::collate,
    /// allowing usage of std::locale for direct string comparison
    ///
    template<typename CharType>
    class collator :
        public std::collate<CharType>,
        public collator_base
    {
    public:
        ///
        /// Type of the underlying character
        ///
        typedef CharType char_type;
        ///
        /// Type of string used with this facet
        ///
        typedef std::basic_string<CharType> string_type;

        ///
        /// Compare two strings in rage [b1,e1),  [b2,e2) according using a collation level \a level. Calls do_compare
        ///
        /// Returns -1 if the first of the two strings sorts before the seconds, returns 1 if sorts after and 0 if
        /// they considered equal.
        ///
        int compare(level_type level,
                    char_type const *b1,char_type const *e1,
                    char_type const *b2,char_type const *e2) const
        {
            return do_compare(level,b1,e1,b2,e2);
        }
        ///
        /// Create a binary string that can be compared to other in order to get collation order. The string is created
        /// for text in range [b,e). It is useful for collation of multiple strings for text.
        ///
        /// The transformation follows these rules:
        /// \code
        ///   compare(level,b1,e1,b2,e2) == sign( transform(level,b1,e1).compare(transform(level,b2,e2)) );
        /// \endcode
        ///
        /// Calls do_transform
        ///
        string_type transform(level_type level,char_type const *b,char_type const *e) const
        {
            return do_transform(level,b,e);
        }

        ///
        /// Calculate a hash of a text in range [b,e). The value can be used for collation sensitive string comparison.
        ///
        /// If compare(level,b1,e1,b2,e2) == 0 then hash(level,b1,e1) == hash(level,b2,e2)
        ///
        /// Calls do_hash
        ///
        long hash(level_type level,char_type const *b,char_type const *e) const
        {
            return do_hash(level,b,e);
        }

        ///
        /// Compare two strings \a l and \a r using collation level \a level
        ///
        /// Returns -1 if the first of the two strings sorts before the seconds, returns 1 if sorts after and 0 if
        /// they considered equal.
        ///
        ///
        int compare(level_type level,string_type const &l,string_type const &r) const
        {
            return do_compare(level,l.data(),l.data()+l.size(),r.data(),r.data()+r.size());
        }

        ///
        /// Calculate a hash that can be used for collation sensitive string comparison of a string \a s
        ///
        /// If compare(level,s1,s2) == 0 then hash(level,s1) == hash(level,s2)
        ///

        long hash(level_type level,string_type const &s) const
        {
            return do_hash(level,s.data(),s.data()+s.size());
        }
        ///
        /// Create a binary string from string \a s, that can be compared to other, useful for collation of multiple
        /// strings.
        ///
        /// The transformation follows these rules:
        /// \code
        ///   compare(level,s1,s2) == sign( transform(level,s1).compare(transform(level,s2)) );
        /// \endcode
        ///
        string_type transform(level_type level,string_type const &s) const
        {
            return do_transform(level,s.data(),s.data()+s.size());
        }

    protected:

        ///
        /// constructor of the collator object
        ///
        collator(size_t refs = 0) : std::collate<CharType>(refs)
        {
        }

        virtual ~collator()
        {
        }

        ///
        /// This function is used to override default collation function that does not take in account collation level.
        /// Uses primary level
        ///
        virtual int do_compare( char_type const *b1,char_type const *e1,
                                char_type const *b2,char_type const *e2) const
        {
            return do_compare(identical,b1,e1,b2,e2);
        }
        ///
        /// This function is used to override default collation function that does not take in account collation level.
        /// Uses primary level
        ///
        virtual string_type do_transform(char_type const *b,char_type const *e) const
        {
            return do_transform(identical,b,e);
        }
        ///
        /// This function is used to override default collation function that does not take in account collation level.
        /// Uses primary level
        ///
        virtual long do_hash(char_type const *b,char_type const *e) const
        {
            return do_hash(identical,b,e);
        }

        ///
        /// Actual function that performs comparison between the strings. For details see compare member function. Can be overridden.
        ///
        virtual int do_compare( level_type level,
                                char_type const *b1,char_type const *e1,
                                char_type const *b2,char_type const *e2) const = 0;
        ///
        /// Actual function that performs transformation. For details see transform member function. Can be overridden.
        ///
        virtual string_type do_transform(level_type level,char_type const *b,char_type const *e) const = 0;
        ///
        /// Actual function that calculates hash. For details see hash member function. Can be overridden.
        ///
        virtual long do_hash(level_type level,char_type const *b,char_type const *e) const = 0;

    };

    ///
    /// \brief This class can be used in STL algorithms and containers for comparison of strings
    /// with a level other than primary
    ///
    /// For example:
    ///
    /// \code
    ///  std::map<std::string,std::string,comparator<char,collator_base::secondary> > data;
    /// \endcode
    ///
    /// Would create a map the keys of which are sorted using secondary collation level
    ///
    template<typename CharType,collator_base::level_type default_level = collator_base::identical>
    struct comparator
    {
    public:
        ///
        /// Create a comparator class for locale \a l and with collation leval \a level
        ///
        /// \note throws std::bad_cast if l does not have \ref collator facet installed
        ///
        comparator(std::locale const &l=std::locale(),collator_base::level_type level=default_level) :
            locale_(l),
            level_(level)
        {
        }

        ///
        /// Compare two strings -- equivalent to return left < right according to collation rules
        ///
        bool operator()(std::basic_string<CharType> const &left,std::basic_string<CharType> const &right) const
        {
            return std::use_facet<collator<CharType> >(locale_).compare(level_,left,right) < 0;
        }
    private:
        std::locale locale_;
        collator_base::level_type level_;
    };

    ///
    ///@}
    ///

    } // locale
} // boost

#ifdef BOOST_MSVC
#pragma warning(pop)
#endif

#endif
///
/// \example collate.cpp
/// Example of using collation functions
///
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4


text:
<?php

namespace App\Tests;

use WTW\CodeGeneration\QualityAssuranceBundle\Test\WebTestCase;

abstract class StatusConsumptionTestCase extends WebTestCase
{
    /**
     * @var $accessor \WeavingTheWeb\Bundle\TwitterBundle\Api\Accessor
     */
    protected $accessor;

    public static function setUpBeforeClass()
    {
        self::setOption('environment', 'test');

        parent::setUpBeforeClass();
    }

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

        $this->client = $this->getClient();
        $this->accessor = $this->get('weaving_the_web_twitter.api_accessor');
    }
}


text:
(function () {
  'use strict';

  angular
    .module('youtube')
    .factory('youtubeSrv', youtubeSrv);

  youtubeSrv.$inject = ['$rootScope', 'YT_event'];

  /* @ngInject */
  function youtubeSrv($rootScope, YT_event) {
    var service = {
      resizePlayer: resizePlayer,
      onYouTubeIframeAPIReady: onYouTubeIframeAPIReady
    };

    return service;

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

    /*
     Function to grab the current size of .video-container and set size of youtube player accordingly.
     */
    function resizePlayer() {
      var width = angular.element(".video-container").width();
      var height = angular.element(".video-container").height();
      if ($rootScope.player) {
        $rootScope.player.setSize(width, height);
      }
    }

    function onYouTubeIframeAPIReady(scope, element) {
      $rootScope.player = new YT.Player(element.children()[0], {
        playerVars: {
          autoplay: 0,
          html5: 1,
          theme: "light",
          modesbranding: 0,
          color: "white",
          iv_load_policy: 3,
          showinfo: 0,
          controls: 1
        },

        height: scope.yt.height,
        width: scope.yt.width,
        videoId: scope.yt.videoid,

        events: {
          'onReady': function (event) {
            scope.isPlayerReady = true;
          },

          'onStateChange': function (event) {

            var message = {
              event: YT_event.STATUS_CHANGE,
              data: ""
            };

            switch (event.data) {
              case YT.PlayerState.PLAYING:
                message.data = "PLAYING";
                break;
              case YT.PlayerState.ENDED:
                console.log("In ended");
                message.data = "ENDED";
                break;
              case YT.PlayerState.UNSTARTED:
                message.data = "NOT PLAYING";
                break;
              case YT.PlayerState.PAUSED:
                message.data = "PAUSED";
                break;
            }

            scope.$apply(function () {
              scope.$emit(message.event, message.data);
            });
          }
        }
      });

      /* Resize player right after creation if a queue is loaded from sessionStorage,
       has to be put here to make sure both $rootScope.player and $rootScope.playingQueue have been created
       */
      resizePlayer();
    };
  }
})
();


text:
#import <OfficeImport/OABReaderState.h>

@class PBPresentationReaderState;

// Not exported
@interface PBOfficeArtReaderState : OABReaderState
{
    PBPresentationReaderState *mPresentationState;
}

- (id)presentationState;
- (id)initWithPresentationState:(id)arg1;

@end


text:
<?php

namespace Monospice\SpicyUrlMatcher\Interfaces;

/**
 * Compares URIs and URI Components against strings
 *
 * @author Cy Rossignol <cy.rossignol@yahoo.com>
 */
interface Matcher
{

    /**
     * Set the subject that will be compared
     *
     * @api
     *
     * @param mixed $subject The subject that will be compared
     *
     * @return Matcher The Matcher object for chaining
     */
    public function setSubject($subject);

    /**
     * Gets the string representation of the subject that is compared against
     *
     * @api
     *
     * @return string The string representation of the subject that is
     * compared against
     */
    public function getSubjectString();

    /**
     * Get the array of matched results from a regular expression comparison
     *
     * @api
     *
     * @param int $key The key of the result to fetch
     *
     * @return mixed The array of matched results or the value of a matched
     * result element if getting by key
     *
     * @throws \RuntimeException If the method is called before performing a
     * regular expression comparison with ::matches()
     * @throws \OutOfBoundsException If the given $key is not contained in the
     * regular expression results array
     */
    public function getResult($key = null);

    /**
     * Check if matched results exist from a regular expression comparison
     *
     * @api
     *
     * @param int $key The key of the result to check
     *
     * @return bool True if the regex match result exists
     */
    public function hasResult($key = null);

    /**
     * Match a URL or URL component exactly.
     *
     * @api
     *
     * @param string $string The string to match against
     *
     * @return bool True if the subject matches the given string exactly
     */
    public function is($string);

    /**
     * An alias for is()
     *
     * @api
     *
     * @param string $string The string to match against
     *
     * @return bool True if the subject matches the given string exactly
     */
    public function equals($string);

    /**
     * Match a URL or URL component that contains the given pattern.
     *
     * @api
     *
     * @param string $string The string to match against
     *
     * @return bool True if the subject contains the given string
     */
    public function has($string);

    /**
     * An alias for has()
     *
     * @api
     *
     * @param string $string The string to match against
     *
     * @return bool True if the subject contains the given string
     */
    public function contains($string);

    /**
     * Match the beginning of the URL or URL component against the given
     * string.
     *
     * @api
     *
     * @param string $string The string to match agaist
     *
     * @return bool True of the subject starts with the given string
     */
    public function startsWith($string);

    /**
     * Match the end of the URL or URL component against the given string.
     *
     * @api
     *
     * @param string $string The string to match agaist
     *
     * @return bool True of the subject ends with the given string
     */
    public function endsWith($string);

    /**
     * Match against the given regular expression. Remember to escape path
     * delimeter slashes and use the "/u" modifier when working with IDN
     * (Unicode-containing) URLs.
     *
     * @api
     * @see preg_match
     * @link http://php.net/manual/en/function.preg-match.php
     *
     * @param string $pattern The regular expression to match against
     * @param int $flags Any flags to pass to preg_match()
     * @param int $offset The offset to pass to preg_match()
     *
     * @return bool True if the subject matches the given regular expression
     */
    public function matches($pattern, $flags = 0, $offset = 0);

    /**
     * Assert that the URI or URI component is equal to an empty string.
     *
     * @api
     *
     * @return bool True of the subject is empty
     */
    public function isEmpty();

    /**
     * Handles dynamic comparison method calls from other classes
     *
     * @internal
     *
     * @param string $methodName The name of the comparison method to call
     * @param array $arguments The arguments to pass to the method
     *
     * @return bool The results of the comparison
     *
     * @throws \BadMethodCallException If the dynamic method name does not
     * match a valid method
     */
    public function callMethod($methodName, array $arguments);

    /**
     * Handles dynamic method calls to the underlying Uri Component object
     *
     * @internal
     *
     * @param string $methodCalled The name of the method to call on the Uri
     * Component object
     * @param array $arguments The array of arguments to pass to the called
     * method
     *
     * @return bool The results of the dynamic method call on the Uri
     * component object
     */
    public function __call($methodCalled, array $arguments);
}


text:
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Usuario_model extends CI_Model{
	# Constructor del modelo
	public function __construct(){
		$this->load->database('db1');
	}

	public function obtenerUsuario($email, $contrasenia){
		$query = $this->db->get_where('conectividadUsers', array('email' => $email, 'contrasenia' => $contrasenia));
		return $query->row_array();
	}

	public function saveUsuario($data){
		$this->db->insert('conectividadUsers', $data);
	    return $this->db->insert_id();
	}

	public function obtenerUsuarioId($idUsuario){
		$query = $this->db->get_where('conectividadUsers', array('idUsuario' => $idUsuario));
		return $query->row_array();
	}

	public function verificarUsuario($email){
		$query = $this->db->get_where('conectividadUsers', array('email' => $email));
		return $query->row_array();
	}

	public function editarUsuario($dataUsuario, $idUsuario){
			$this->db->where('idUsuario', $idUsuario);
			$this->db->update('conectividadUsers', $dataUsuario);
			return $this->db->affected_rows();
		}

}


text:
/**
 * Distributed queueing primitive interfaces.
 */
package io.atomix.core.profile;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Speech.Synthesis;
using System.Threading.Tasks;
using ClownCrew.GitBitch.Client.Interfaces;
using ClownCrew.GitBitch.Client.Model;

namespace ClownCrew.GitBitch.Client.Agents
{
    public class TalkAgent : ITalkAgent
    {
        private readonly ISettingAgent _settingAgent;
        private readonly IEventHub _eventHub;

        public TalkAgent(ISettingAgent settingAgent, IEventHub eventHub)
        {
            _settingAgent = settingAgent;
            _eventHub = eventHub;
        }

        public async Task<string> SayAsync(string phrase)
        {
            var actualPhrase = phrase;
            await DoSay(actualPhrase);
            return actualPhrase;
        }

        private async Task DoSay(string actualPhrase)
        {
            var bitchName = _settingAgent.GetSetting("BitchName", Constants.DefaultBitchName);
            var newGuid = Guid.NewGuid();
            _eventHub.InvokeStartTalkingEvent(newGuid, bitchName, actualPhrase);

            var task = new Task(() =>
            {
                var builder = new PromptBuilder();
                builder.StartSentence();
                builder.AppendText(actualPhrase);
                builder.EndSentence();

                using (var synthesizer = new SpeechSynthesizer())
                {
                    var voices = synthesizer.GetInstalledVoices();
                    var voice = voices.LastOrDefault(x => x.VoiceInfo.Gender == VoiceGender.Female);
                    if (voice == null) voice = voices.FirstOrDefault();
                    if (voice == null) throw new InvalidOperationException("Cannot find any installed voices.");

                    //synthesizer.SelectVoice("Microsoft David Desktop");
                    //synthesizer.SelectVoice("Microsoft Hazel Desktop");
                    //synthesizer.SelectVoice("Microsoft Zira Desktop");

                    synthesizer.SelectVoice(voice.VoiceInfo.Name);
                    synthesizer.Speak(builder);
                }
            });

            task.Start();
            await task;
            _eventHub.InvokeDoneTalkingEvent(newGuid);
        }

        public async Task<Answer<T>> AskAsync<T>(string question, List<QuestionAnswerAlternative<T>> alternatives, int millisecondsTimeout = 3000)
        {
            var qa = new QuestionAgent(this, _settingAgent, _eventHub);
            return await qa.AskAsync(question, alternatives, millisecondsTimeout);
        }
    }
}


text:
package smbModel.entities;

import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;

import smbModel.Entity;

public abstract class MovingEntity extends Entity {
	public static final double ACCELERATION = 0.25;
	public static final double MAX_SPEED = 8;

	protected double horizontalSpeed;
	protected double verticalSpeed;
	protected double horizontalAcceleration;
	protected double verticalAcceleration;

	protected boolean canGoDown = false;
	protected boolean jumping = false;
	protected boolean idle = true;

	protected boolean continueHorizontally = false;
	protected boolean horizontallyCollidedWithTile = false;

	public HorizontalDirection horizontalDirection;

	protected int count = 0;
	protected Point prevLocation = new Point(0, 0);

	public MovingEntity(int row, int column, String imagePath) {
		super(row, column, imagePath);
		horizontalDirection = HorizontalDirection.Idle;
	}

	public void move() {
		checkCollision();
		checkDown();
		normalizeHorizontalSpeed();
		normalizeVerticalSpeed();
		changeX(horizontalSpeed + level.getPlayerOffset());
		changeY(verticalSpeed);
	}

	public void checkCollision() {
		ArrayList<MovingEntity> entities = level.getEntities();
		for (MovingEntity movingEntity : entities) {
			if (movingEntity.intersects(bounds)
					&& movingEntity.bounds != bounds) {
				movingEntity.collide().execute(this);
			}

		}

		ArrayList<Tile> tiles = level.getRespectiveTiles(getLocation());

		for (Tile tile : tiles) {
			if (tile.intersects(bounds)) {
				tile.collide().execute(this);
			}
		}
	}

	protected void checkDown() {
		Rectangle stepDownRectangle = new Rectangle(bounds.x, bounds.y
				+ bounds.height, bounds.width, (int) MAX_SPEED / 2);
		ArrayList<Tile> tiles = level.getRespectiveTiles(stepDownRectangle
				.getLocation());
		boolean intersects = false;
		for (Tile tile : tiles) {
			intersects = intersects || tile.intersects(stepDownRectangle);
		}
		canGoDown = !intersects;
		jumping = !intersects;
		System.out.println(bounds + " " + tiles.size());
	}

	public void normalizeVerticalSpeed() {
		if (canGoDown) {
			verticalSpeed += ACCELERATION;
		} else if (verticalSpeed > 0) {
			verticalSpeed = 0;
		}

		if (verticalSpeed > MAX_SPEED) {
			verticalSpeed = MAX_SPEED;
		}

		if (verticalSpeed < -MAX_SPEED) {
			verticalSpeed = -MAX_SPEED;
		}

	}

	public void normalizeHorizontalSpeed() {
		if (horizontalSpeed >= -MAX_SPEED && horizontalSpeed <= MAX_SPEED) {
			horizontalSpeed += horizontalAcceleration;
		} else if (horizontalSpeed > 0) {
			horizontalSpeed = MAX_SPEED;
		} else {
			horizontalSpeed = -MAX_SPEED;
		}

		if (!continueHorizontally
				&& horizontalDirection == HorizontalDirection.Idle
				&& (horizontalSpeed < ACCELERATION && horizontalSpeed > -ACCELERATION)) {
			horizontalSpeed = 0;
			horizontalAcceleration = 0;
		}
	}

	public void goUp() {
		verticalSpeed = -MAX_SPEED;
	}

	public void goDown() {
		verticalAcceleration = ACCELERATION;
	}

	public void goLeft() {
		horizontalAcceleration = -ACCELERATION;
		horizontalDirection = HorizontalDirection.Left;
	}

	public void goRight() {
		horizontalAcceleration = ACCELERATION;
		horizontalDirection = HorizontalDirection.Right;
	}

	public void decelerateHorizontally() {
		if (Math.abs(horizontalSpeed + horizontalAcceleration) > Math
				.abs(horizontalSpeed)) {
			horizontalAcceleration *= -1;
		}
		horizontalDirection = HorizontalDirection.Idle;
	}

	public void decelerateVertically() {
		if (Math.abs(verticalSpeed + verticalAcceleration) > Math
				.abs(verticalSpeed)) {
			verticalAcceleration *= -1;
		}

		if (verticalAcceleration < 0) {
			jumping = false;
		}
	}

	public void stopHorizontally() {
		horizontalSpeed = 0;
		horizontalAcceleration = 0;
		horizontallyCollidedWithTile = true;
		horizontalDirection = HorizontalDirection.Idle;
	}

	public void stopVertically() {
		if (verticalSpeed > 0) {
			jumping = false;
		}
		verticalSpeed = 0;
		verticalAcceleration = 0;
	}

	public double getX() {
		return super.getX();
	}

	public double getY() {
		return super.getY();
	}

	public String toString() {
		String str = "Position x: " + getX() + "\n" + "Position y: " + getY()
				+ "\n";
		return str;
	}

	public void setCanGoDown(boolean cannotGoDown) {
		this.canGoDown = cannotGoDown;
	}

	public boolean getCanGoDown() {
		return canGoDown;
	}

	public boolean isHorizontallyCollidedWithTile() {
		return horizontallyCollidedWithTile;
	}

	public void setHorizontallyCollidedWithTile(boolean collidedWithTile) {
		this.horizontallyCollidedWithTile = collidedWithTile;
	}

	public boolean isIdle() {
		return idle;
	}

	public boolean isJumping() {
		return jumping;
	}
}


text:
using System.ComponentModel;

namespace abbSolutions.Communication.Interfaces
{
   [Browsable(true), TypeConverter(typeof(ExpandableObjectConverter))]
   public interface IControlReceiver
   {
      IControlResponse HandleIncomingControlCommand(IControlCommand controlCommand);
   }
}


text:
<?xml version="1.0"?>
<!DOCTYPE markables SYSTEM "markables.dtd">
        <markables xmlns="www.eml.org/NameSpaces/secmark">
    <markable  id="markable_46" span="word_103,word_104" phrase_type="np" complex_np="no" np_form="indefnp" referentiality="discourse-new" grammatical_role="dir-obj" ambiguity="not_ambig" dir_speech="text_level"/>
    <markable  id="markable_6" span="word_19..word_22" phrase_type="pp" complex_np="yes" np_form="indefnp" referentiality="discourse-new" grammatical_role="other" ambiguity="not_ambig" dir_speech="text_level"/>
</markables>


text:
process.stdin.on('data', (chunk) => {
    const line = chunk.toString().trim();
    console.log(line);

    if (line === 'stop') {
        process.exit(0);
    }
});

console.log('READING');


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="vertical"
    android:paddingBottom="30dp"
    android:paddingTop="40dp">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="sorry,服务器出错" />

    <TextView
        android:id="@+id/retry"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:background="#000"
        android:padding="10dp"
        android:text="点击重试"
        android:textColor="#fff" />

</LinearLayout>


text:
package fuzion24.device.vulnerability.vulnerabilities.framework.jar;

import android.content.Context;
import fuzion24.device.vulnerability.vulnerabilities.VulnerabilityTest;

import java.io.File;

// https://android.googlesource.com/platform/libcore/+/cb11b9fff2a1af8bb4fcad18986003a7f59189c6 //Tests
// https://android.googlesource.com/platform/libcore/+/2bc5e811a817a8c667bca4318ae98582b0ee6dc6 //Fix
// http://bluebox.com/technical/android-fake-id-vulnerability/
// https://bluebox.com/wp-content/uploads/2014/08/us-14-Forristal-Android_FakeID_FINAL.compressed.pdf

public class JarBug13678484 implements VulnerabilityTest {

    @Override
    public String getName() {
        return "JarBug13678484";
    }

    @Override
    public boolean isVulnerable(Context context) throws Exception {
        // Check for the existence of this constructor:
        // public JarFile(File file, boolean verify, int mode, boolean chainCheck)
        try {
            java.util.jar.JarFile.class.getConstructor(File.class, boolean.class, int.class, boolean.class);
            return false;
        } catch(NoSuchMethodException e) {
            return true;
        }
    }
}