text:
#include <stdio.h>
#include <sstream>

#include "webrtc/base/format_macros.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
#include "webrtc/test/rtp_file_reader.h"

int main(int argc, char** argv) {
  webrtc::test::RtpFileReader* reader;
  webrtc::RtpHeaderParser* parser;
  if (!ParseArgsAndSetupEstimator(argc, argv, NULL, NULL, &reader, &parser,
                                  NULL, NULL)) {
    return -1;
  }
  bool arrival_time_only = (argc >= 5 && strncmp(argv[4], "-t", 2) == 0);
  rtc::scoped_ptr<webrtc::test::RtpFileReader> rtp_reader(reader);
  rtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_parser(parser);
  fprintf(stdout, "seqnum timestamp ts_offset abs_sendtime recvtime "
          "markerbit ssrc size original_size\n");
  int packet_counter = 0;
  int non_zero_abs_send_time = 0;
  int non_zero_ts_offsets = 0;
  webrtc::test::RtpPacket packet;
  while (rtp_reader->NextPacket(&packet)) {
    webrtc::RTPHeader header;
    parser->Parse(packet.data, packet.length, &header);
    if (header.extension.absoluteSendTime != 0)
      ++non_zero_abs_send_time;
    if (header.extension.transmissionTimeOffset != 0)
      ++non_zero_ts_offsets;
    if (arrival_time_only) {
      std::stringstream ss;
      ss << static_cast<int64_t>(packet.time_ms) * 1000000;
      fprintf(stdout, "%s\n", ss.str().c_str());
    } else {
      fprintf(stdout,
              "%u %u %d %u %u %d %u %" PRIuS " %" PRIuS "\n",
              header.sequenceNumber,
              header.timestamp,
              header.extension.transmissionTimeOffset,
              header.extension.absoluteSendTime,
              packet.time_ms,
              header.markerBit,
              header.ssrc,
              packet.length,
              packet.original_length);
    }
    ++packet_counter;
  }
  fprintf(stderr, "Parsed %d packets\n", packet_counter);
  fprintf(stderr, "Packets with non-zero absolute send time: %d\n",
         non_zero_abs_send_time);
  fprintf(stderr, "Packets with non-zero timestamp offset: %d\n",
         non_zero_ts_offsets);
  return 0;
}


text:
/**
 * Some utility functions
 */

import {readFile, existsSync, mkdirSync, mkdir} from "fs";
import * as path from "path";
import * as winston from "winston";

const REGEX_KEYWORDS = /([\$\^\-\*\(\)\[\]\\\?\+\{\}\|\.\/])/g;

let logger = new winston.Logger({
    transports: [
        new winston.transports.Console({
            colorize: true
        }),
        new winston.transports.File({filename: __dirname + '/../../log/clc.log'})
    ]
})

createDirectory( __dirname + '/../../log/clc.log');

/**
 * Create a new logger
 * @param level - Maximum level of the message to be displayed in the console
 * @param fileLevel - Maximum level of the message to be logged in the file
 */
export function createLogger(level: string, fileLevel: string) {
    logger = new winston.Logger({
        transports: [
            new winston.transports.Console({level: level, colorize: true}),
            new winston.transports.File({filename: __dirname + '/../../log/clc.log', level: fileLevel})
        ],
    })
}

/**
 * Log a message
 * @param message - Message to be displayed
 * @param level - Level of the message, default 'info'
 */
export function log(message: string, level = "info") {
    logger.log(level, message);
}

const ESCAPE_PATTERN = /(\\|")/g;
/**
 * Escape a string according to minecraft NBT rules
 * @param str - String to be escaped
 * @param level - Level for the escape, default 1 for escaping the string once, 2 for twice...
 */
export function escape(str: string, level = 1) {
    for (let i = 0; i < level; i++) {
        str = str.replace(ESCAPE_PATTERN, "\\$1");
    }
    return str;
}

/**
 * Get the parameters of the string
 * @param str - The content of the line containing the parameter
 * @param offset - The start of the parameter, which is the index of the starting '('
 */
export function getParams(str: string, offset: number) {
    if (str[offset] !== '(')
        return [];
    let params = [""];
    let inString = false;
    let escape = false;
    while (str.length > ++offset) {
        if (inString) {
            if (escape) {
                escape = false;
                params[params.length -1] += str[offset];
                continue;
            }
            switch (str[offset]) {
                case '\\':
                    escape = true;
                    break;
                case '"':
                    inString = false;
                    break;
                default:
                    params[params.length -1] += str[offset];
            }

        } else {
            switch (str[offset]) {
                case '"':
                    inString = true;
                    break;
                case ',':
                    params.push("");
                    break;
                case ')':
                    return params;
                case ' ':
                    //neglect spaces
                    break;
                default:
                    params[params.length -1] += str[offset];
            }
        }
    }
    throw new Error("Not terminated paramter");
}

/**
 * Generator generating names
 */
export function *generateName() {
    let char = [97];
    function add1(index = 0) {
        if (index === char.length) {
            char.push(97);
        } else {
            char[index]++;
        }
        if (char[index] > 122) {
            char[index] = 97;
            add1(index+1);
        }
    }
    while (true) {
        yield char.map(n=>String.fromCharCode(n)).reverse().join("");
        add1();
    }
}

/**
 * Escape regex keywords
 * @param str - String to be escaped
 * @return - Escaped string
 */
export function regexEscape(str: string) {
    return str.replace(REGEX_KEYWORDS, "\\$1");
}

/**
 * Match input against a list of regex pattern, and run the respective function if matched.
 * @param input - String to be matched
 * @param matchPairs - Array of [a, b], where a is the regex to match the input, while b is the function to be run if a is matched
 * @param rest - The function to be run if nothing matched
 */
export function regexMatcher(input: string, matchPairs: Array<[RegExp, (x: RegExpExecArray)=>void]>, rest: ()=>void = ()=>{}) {
    for (let [a, b] of matchPairs) {
        let m = a.exec(input);
        if (m) {
            b(m);
            return;
        }
    }
    rest();
}

/**
 * Match input against a list of match function, and run the respective function if matched.
 * @param input - object to be matched
 * @param matchPairs - Array of [a, b], where a is the function to match the input, while b is the function to be run if a is matched
 * @param rest - The function to be run if nothing matched
 */
export function matcher<T>(input: T, matchPairs: Array<[(x:T)=>boolean, ()=>void]>, rest: ()=>void = ()=>{}) {
    for (let [a, b] of matchPairs) {
        if (a(input)) {
            b();
            return;
        }
    }
    rest();
}

/**
 * Returns a promise of the file data
 * @param path - Path of the text file (encoding: utf-8)
 */
export function readFilePromise(path: string): Promise<string> {
    return new Promise(function(resolve, reject){
        readFile(path, "utf8", (err, data) => {
            if (err) { reject(err); }
            resolve(data);
        })
    })
}

/**
 * Creates a directory recursively if it does not exist
 * @param dirpath - Path of the directory
 */
export function createDirectory(dirpath: string) {
    //Get the parent directory
    let dirname = path.dirname(dirpath);
    if (existsSync(dirname)) {
        return;
    }
    createDirectory(dirname);
    mkdirSync(dirname);
}

redpajama_set_name: RedPajamaGithub


text:
import { Dialog, DialogType } from "../ui/dialog";

export function debugDialog(): void {
    new Dialog("HEADER TITLE", "Body text lol", {
        type: DialogType.CONFIRM,
        cancel: () => {
            console.debug("Cancel");
        },
        ok: () => {
            console.debug("OK");
        },
    });
}


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.example.weardemo.StoriesActivity" >

    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:showAsAction="never"
        android:title="@string/action_settings"/>

</menu>


text:
import compiler
import imp
import os.path
import sys

def is_localized(node):
    """ Check message wrapped by _() """
    if isinstance(node.parent, compiler.ast.CallFunc):
        if isinstance(node.parent.node, compiler.ast.Name):
            if node.parent.node.name == '_':
                return True
    return False

class ASTWalker(compiler.visitor.ASTVisitor):

    def default(self, node, *args):
        for child in node.getChildNodes():
            child.parent = node
        compiler.visitor.ASTVisitor.default(self, node, *args)

class Visitor(object):

    def __init__(self, filename, i18n_msg_predicates,
                 msg_format_checkers, debug):
        self.filename = filename
        self.debug = debug
        self.error = 0
        self.i18n_msg_predicates = i18n_msg_predicates
        self.msg_format_checkers = msg_format_checkers
        with open(filename) as f:
            self.lines = f.readlines()

    def visitConst(self, node):
        if not isinstance(node.value, str):
            return

        if is_localized(node):
            for (checker, msg) in self.msg_format_checkers:
                if checker(node):
                    print >> sys.stderr, (
                        '%s:%d %s: %s' %
                        (self.filename, node.lineno,
                         self.lines[node.lineno - 1][:-1],
                         "Error: %s" % msg))
                    self.error = 1
                    return
            if debug:
                print ('%s:%d %s: %s' %
                       (self.filename, node.lineno,
                        self.lines[node.lineno - 1][:-1],
                        "Pass"))
        else:
            for (predicate, action, msg) in self.i18n_msg_predicates:
                if predicate(node):
                    if action == 'skip':
                        if debug:
                            print ('%s:%d %s: %s' %
                                   (self.filename, node.lineno,
                                    self.lines[node.lineno - 1][:-1],
                                    "Pass"))
                        return
                    elif action == 'error':
                        print >> sys.stderr, (
                            '%s:%d %s: %s' %
                            (self.filename, node.lineno,
                             self.lines[node.lineno - 1][:-1],
                             "Error: %s" % msg))
                        self.error = 1
                        return
                    elif action == 'warn':
                        print ('%s:%d %s: %s' %
                               (self.filename, node.lineno,
                                self.lines[node.lineno - 1][:-1],
                                "Warn: %s" % msg))
                        return
                    print >> sys.stderr, 'Predicate with wrong action!'

def is_file_in_black_list(black_list, f):
    for f in black_list:
        if os.path.abspath(input_file).startswith(
            os.path.abspath(f)):
            return True
    return False

def check_i18n(input_file, i18n_msg_predicates, msg_format_checkers, debug):
    input_mod = compiler.parseFile(input_file)
    v = compiler.visitor.walk(input_mod,
                              Visitor(input_file,
                                      i18n_msg_predicates,
                                      msg_format_checkers,
                                      debug),
                              ASTWalker())
    return v.error

if __name__ == '__main__':
    input_path = sys.argv[1]
    cfg_path = sys.argv[2]
    try:
        cfg_mod = imp.load_source('', cfg_path)
    except:
        print >> sys.stderr, "Load cfg module failed"
        sys.exit(1)

    i18n_msg_predicates = cfg_mod.i18n_msg_predicates
    msg_format_checkers = cfg_mod.msg_format_checkers
    black_list = cfg_mod.file_black_list

    debug = False
    if len(sys.argv) > 3:
        if sys.argv[3] == '-d':
            debug = True

    if os.path.isfile(input_path):
        sys.exit(check_i18n(input_path,
                            i18n_msg_predicates,
                            msg_format_checkers,
                            debug))

    error = 0
    for dirpath, dirs, files in os.walk(input_path):
        for f in files:
            if not f.endswith('.py'):
                continue
            input_file = os.path.join(dirpath, f)
            if is_file_in_black_list(black_list, input_file):
                continue
            if check_i18n(input_file,
                          i18n_msg_predicates,
                          msg_format_checkers,
                          debug):
                error = 1
    sys.exit(error)


text:
/*  Back Top Button  */
#back-top {
  position: fixed;
  bottom: 30px;
  margin-left: 1040px;
}
#back-top a {
  width: 54px;
  height: 54px;
  display: block;
  background: #ddd url(/blog_demo/img/Back-Top_Arrow.png) no-repeat center center;
  background-color: #aaa;
  -webkit-border-radius: 7px;
  -moz-border-radius: 7px;
  border-radius: 7px;
  -webkit-transition: 1s;
  -moz-transition: 1s;
  transition: 1s;
}
#back-top a:hover {
  background-color: #777;
}
/*  Back Top Button  End */


text:
/**
 * Autogenerated by Thrift Compiler (0.10.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */

#include <iosfwd>

#include <thrift/Thrift.h>
#include <thrift/TApplicationException.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/transport/TTransport.h>

#include <thrift/cxxfunctional.h>
#include "snappydata_struct_StatementResult.h"

#include <algorithm>
#include <ostream>

#include <thrift/TToString.h>

namespace io { namespace snappydata { namespace thrift {

StatementResult::~StatementResult() noexcept {
}

void StatementResult::__set_resultSet(const RowSet& val) {
  this->resultSet = val;
__isset.resultSet = true;
}

void StatementResult::__set_updateCount(const int32_t val) {
  this->updateCount = val;
__isset.updateCount = true;
}

void StatementResult::__set_batchUpdateCounts(const std::vector<int32_t> & val) {
  this->batchUpdateCounts = val;
__isset.batchUpdateCounts = true;
}

void StatementResult::__set_procedureOutParams(const std::map<int32_t, ColumnValue> & val) {
  this->procedureOutParams = val;
__isset.procedureOutParams = true;
}

void StatementResult::__set_generatedKeys(const RowSet& val) {
  this->generatedKeys = val;
__isset.generatedKeys = true;
}

void StatementResult::__set_newDefaultSchema(const std::string& val) {
  this->newDefaultSchema = val;
__isset.newDefaultSchema = true;
}

void StatementResult::__set_warnings(const SnappyExceptionData& val) {
  this->warnings = val;
__isset.warnings = true;
}

void StatementResult::__set_preparedResult(const PrepareResult& val) {
  this->preparedResult = val;
__isset.preparedResult = true;
}

uint32_t StatementResult::read(::apache::thrift::protocol::TProtocol* iprot) {

  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->resultSet.read(iprot);
          this->__isset.resultSet = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->updateCount);
          this->__isset.updateCount = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->batchUpdateCounts.clear();
            uint32_t _size284;
            ::apache::thrift::protocol::TType _etype287;
            xfer += iprot->readListBegin(_etype287, _size284);
            this->batchUpdateCounts.resize(_size284);
            uint32_t _i288;
            for (_i288 = 0; _i288 < _size284; ++_i288)
            {
              xfer += iprot->readI32(this->batchUpdateCounts[_i288]);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.batchUpdateCounts = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_MAP) {
          {
            this->procedureOutParams.clear();
            uint32_t _size289;
            ::apache::thrift::protocol::TType _ktype290;
            ::apache::thrift::protocol::TType _vtype291;
            xfer += iprot->readMapBegin(_ktype290, _vtype291, _size289);
            uint32_t _i293;
            for (_i293 = 0; _i293 < _size289; ++_i293)
            {
              int32_t _key294;
              xfer += iprot->readI32(_key294);
              ColumnValue& _val295 = this->procedureOutParams[_key294];
              xfer += _val295.read(iprot);
            }
            xfer += iprot->readMapEnd();
          }
          this->__isset.procedureOutParams = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 5:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->generatedKeys.read(iprot);
          this->__isset.generatedKeys = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 6:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->newDefaultSchema);
          this->__isset.newDefaultSchema = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 7:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->warnings.read(iprot);
          this->__isset.warnings = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 8:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->preparedResult.read(iprot);
          this->__isset.preparedResult = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

uint32_t StatementResult::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("StatementResult");

  if (this->__isset.resultSet) {
    xfer += oprot->writeFieldBegin("resultSet", ::apache::thrift::protocol::T_STRUCT, 1);
    xfer += this->resultSet.write(oprot);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.updateCount) {
    xfer += oprot->writeFieldBegin("updateCount", ::apache::thrift::protocol::T_I32, 2);
    xfer += oprot->writeI32(this->updateCount);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.batchUpdateCounts) {
    xfer += oprot->writeFieldBegin("batchUpdateCounts", ::apache::thrift::protocol::T_LIST, 3);
    {
      xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->batchUpdateCounts.size()));
      std::vector<int32_t> ::const_iterator _iter296;
      for (_iter296 = this->batchUpdateCounts.begin(); _iter296 != this->batchUpdateCounts.end(); ++_iter296)
      {
        xfer += oprot->writeI32((*_iter296));
      }
      xfer += oprot->writeListEnd();
    }
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.procedureOutParams) {
    xfer += oprot->writeFieldBegin("procedureOutParams", ::apache::thrift::protocol::T_MAP, 4);
    {
      xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->procedureOutParams.size()));
      std::map<int32_t, ColumnValue> ::const_iterator _iter297;
      for (_iter297 = this->procedureOutParams.begin(); _iter297 != this->procedureOutParams.end(); ++_iter297)
      {
        xfer += oprot->writeI32(_iter297->first);
        xfer += _iter297->second.write(oprot);
      }
      xfer += oprot->writeMapEnd();
    }
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.generatedKeys) {
    xfer += oprot->writeFieldBegin("generatedKeys", ::apache::thrift::protocol::T_STRUCT, 5);
    xfer += this->generatedKeys.write(oprot);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.newDefaultSchema) {
    xfer += oprot->writeFieldBegin("newDefaultSchema", ::apache::thrift::protocol::T_STRING, 6);
    xfer += oprot->writeString(this->newDefaultSchema);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.warnings) {
    xfer += oprot->writeFieldBegin("warnings", ::apache::thrift::protocol::T_STRUCT, 7);
    xfer += this->warnings.write(oprot);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.preparedResult) {
    xfer += oprot->writeFieldBegin("preparedResult", ::apache::thrift::protocol::T_STRUCT, 8);
    xfer += this->preparedResult.write(oprot);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(StatementResult &a, StatementResult &b) {
  using ::std::swap;
  swap(a.resultSet, b.resultSet);
  swap(a.updateCount, b.updateCount);
  swap(a.batchUpdateCounts, b.batchUpdateCounts);
  swap(a.procedureOutParams, b.procedureOutParams);
  swap(a.generatedKeys, b.generatedKeys);
  swap(a.newDefaultSchema, b.newDefaultSchema);
  swap(a.warnings, b.warnings);
  swap(a.preparedResult, b.preparedResult);
  swap(a.__isset, b.__isset);
}

StatementResult::StatementResult(const StatementResult& other298) {
  resultSet = other298.resultSet;
  updateCount = other298.updateCount;
  batchUpdateCounts = other298.batchUpdateCounts;
  procedureOutParams = other298.procedureOutParams;
  generatedKeys = other298.generatedKeys;
  newDefaultSchema = other298.newDefaultSchema;
  warnings = other298.warnings;
  preparedResult = other298.preparedResult;
  __isset = other298.__isset;
}
StatementResult::StatementResult( StatementResult&& other299) noexcept {
  resultSet = std::move(other299.resultSet);
  updateCount = std::move(other299.updateCount);
  batchUpdateCounts = std::move(other299.batchUpdateCounts);
  procedureOutParams = std::move(other299.procedureOutParams);
  generatedKeys = std::move(other299.generatedKeys);
  newDefaultSchema = std::move(other299.newDefaultSchema);
  warnings = std::move(other299.warnings);
  preparedResult = std::move(other299.preparedResult);
  __isset = std::move(other299.__isset);
}
StatementResult& StatementResult::operator=(const StatementResult& other300) {
  resultSet = other300.resultSet;
  updateCount = other300.updateCount;
  batchUpdateCounts = other300.batchUpdateCounts;
  procedureOutParams = other300.procedureOutParams;
  generatedKeys = other300.generatedKeys;
  newDefaultSchema = other300.newDefaultSchema;
  warnings = other300.warnings;
  preparedResult = other300.preparedResult;
  __isset = other300.__isset;
  return *this;
}
StatementResult& StatementResult::operator=(StatementResult&& other301) noexcept {
  resultSet = std::move(other301.resultSet);
  updateCount = std::move(other301.updateCount);
  batchUpdateCounts = std::move(other301.batchUpdateCounts);
  procedureOutParams = std::move(other301.procedureOutParams);
  generatedKeys = std::move(other301.generatedKeys);
  newDefaultSchema = std::move(other301.newDefaultSchema);
  warnings = std::move(other301.warnings);
  preparedResult = std::move(other301.preparedResult);
  __isset = std::move(other301.__isset);
  return *this;
}
void StatementResult::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "StatementResult(";
  out << "resultSet="; (__isset.resultSet ? (out << to_string(resultSet)) : (out << "<null>"));
  out << ", " << "updateCount="; (__isset.updateCount ? (out << to_string(updateCount)) : (out << "<null>"));
  out << ", " << "batchUpdateCounts="; (__isset.batchUpdateCounts ? (out << to_string(batchUpdateCounts)) : (out << "<null>"));
  out << ", " << "procedureOutParams="; (__isset.procedureOutParams ? (out << to_string(procedureOutParams)) : (out << "<null>"));
  out << ", " << "generatedKeys="; (__isset.generatedKeys ? (out << to_string(generatedKeys)) : (out << "<null>"));
  out << ", " << "newDefaultSchema="; (__isset.newDefaultSchema ? (out << to_string(newDefaultSchema)) : (out << "<null>"));
  out << ", " << "warnings="; (__isset.warnings ? (out << to_string(warnings)) : (out << "<null>"));
  out << ", " << "preparedResult="; (__isset.preparedResult ? (out << to_string(preparedResult)) : (out << "<null>"));
  out << ")";
}

}}} // namespace


text:
namespace Halley
{
	class DevConClient;

	namespace DevCon {
		class UpdateInterestMsg;
		class UnregisterInterestMsg;
		class RegisterInterestMsg;
	}

	class NetworkService;
	class HalleyAPI;
	class IConnection;
	class MessageQueue;
	class Resources;

	class DevConInterest {
	public:
		DevConInterest(DevConClient& parent);

		void registerInterest(String id, ConfigNode config, uint32_t handle);
		void updateInterest(uint32_t handle, ConfigNode config);
		void unregisterInterest(uint32_t handle);

		bool hasInterest(const String& id) const;
		gsl::span<const ConfigNode> getInterestConfigs(const String& id) const;
		void notifyInterest(const String& id, size_t configIdx, ConfigNode data);

	private:
		DevConClient& parent;

		struct InterestGroup {
			Vector<ConfigNode> configs;
			Vector<uint32_t> handles;
			Vector<ConfigNode> lastResults;
		};

		HashMap<String, InterestGroup> interests;
	};

	class DevConClient : private ILoggerSink
	{
		friend class DevConClientonnection;
		friend class DevConInterest;

	public:
		DevConClient(const HalleyAPI& api, Resources& resources, std::unique_ptr<NetworkService> service, String address, int port = DevCon::devConPort);
		~DevConClient();

		void update(Time t);

		DevConInterest& getInterest() const;

	protected:
		void onReceiveReloadAssets(const DevCon::ReloadAssetsMsg& msg);
		void onReceiveRegisterInterest(DevCon::RegisterInterestMsg& msg);
		void onReceiveUpdateInterest(DevCon::UpdateInterestMsg& msg);
		void onReceiveUnregisterInterest(const DevCon::UnregisterInterestMsg& msg);
		void notifyInterest(uint32_t handle, ConfigNode data);

	private:
		const HalleyAPI& api;
		Resources& resources;
		std::unique_ptr<NetworkService> service;
		String address;
		int port;

		std::shared_ptr<MessageQueue> queue;

		std::unique_ptr<DevConInterest> interest;

		void connect();
		void log(LoggerLevel level, const String& msg) override;
	};
}


text:
<?php namespace Todaymade\Daux\ContentTypes\Markdown;

use League\CommonMark\Block\Parser\AbstractBlockParser;
use League\CommonMark\ContextInterface;
use League\CommonMark\Cursor;

class TableOfContentsParser extends AbstractBlockParser
{
    /**
     * @param ContextInterface $context
     * @param Cursor $cursor
     *
     * @return bool
     */
    public function parse(ContextInterface $context, Cursor $cursor)
    {
        if ($cursor->isIndented()) {
            return false;
        }

        $previousState = $cursor->saveState();
        $cursor->advanceToFirstNonSpace();
        $fence = $cursor->match('/^\[TOC\]/');
        if (is_null($fence)) {
            $cursor->restoreState($previousState);

            return false;
        }

        $context->addBlock(new TableOfContents());

        return true;
    }
}


text:
{% extends "admin/change_list.html" %}
{% load i18n %}
{% load render_bundle from webpack_loader %}

{% block extrastyle %}
  {{ block.super }}
  {% render_bundle 'common' 'css' %}
  {% render_bundle 'grappelli' 'css' %}
{% endblock %}

{% block javascripts %}
  {{ block.super }}
  {% render_bundle 'common' 'js' %}
  {% render_bundle 'grappelli' 'js' %}
{% endblock %}

{# grappelli does not provide model name class, so we force it here #}
{% block bodyclass %}{{block.super}} model-{{model_name}}{% endblock %}

{% block page-tools %}
  {{ block.super }}
  {% if not is_popup %}

      {% trans 'Server time' %} ({{ server_time|date:"e" }}):
      {{ server_time|date:"Y-m-d H:i" }}

  {% endif %}
{% endblock %}

{% block user-tools %}
  {% block dz-top-nav %}

  {% for model in dz_models %}

{{ model.name }}

  {% endfor %}

  {% endblock %}

  {{ block.super }}
{% endblock %}

{% block userlinks %}
  {{ block.super }}

  {% block lang-selector %}
    {% get_current_language as cur_lang %}
    {% get_available_languages as all_langs %}

      {{cur_lang}}

        {% for lang in all_langs %}
        {% if lang.0 != cur_lang %}

          {{lang.0}}
          <form name="setlang-{{lang.0}}" action="{% url 'set_language' %}" method="post">
            {% csrf_token %}
            <input name="next" type="hidden" value="{{redirect_to}}" />
            <input name="language" type="hidden" value="{{lang.0}}" />
          </form>

        {% endif %}
        {% endfor %}

  {% endblock %}
{% endblock %}

{% block object-tools-items %}
  {{ block.super }}

  {% if can_crawl %}
    {% blocktrans asvar crawl_text with target=cl.opts.verbose_name_plural %}Crawl {{target}}{% endblocktrans %}

      {{ crawl_text }}

  {% endif %}

  {% if can_export %}

      {% trans "Export" %}

  {% endif %}
{% endblock %}


text:
package com.app.gpo.model;

import java.util.List;

/**
 *
 * @author Artur Czartoryski <artur at czartoryski.wroclaw.pl>
 */
public class FieldOnMainScreenForm {
    private List<Field> fieldList;

    public List<Field> getfieldList() {
	return fieldList;
    }

    public void setfieldList(List<Field> fieldList) {
	this.fieldList = fieldList;
    }
}


text:
package org.jbpm.designer.taskforms;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

import org.stringtemplate.v4.ST;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.bpmn2.*;
import org.eclipse.bpmn2.Process;
import org.jbpm.designer.repository.Asset;
import org.jbpm.designer.web.profile.IDiagramProfile;
import org.jbpm.formModeler.designer.integration.BPMNFormBuilderService;
import org.stringtemplate.v4.STRawGroupDir;
import org.uberfire.backend.vfs.Path;

/**
 * Manager for task form templates.
 *
 * @author Tihomir Surdilovic
 */
public class TaskFormTemplateManager {
    private static final Logger _logger = LoggerFactory.getLogger(TaskFormTemplateManager.class);
    private static final String[] validStructureRefs = new String[] {"Float", "Integer", "String", "Object", "Boolean", "Undefined"};
    public final static String TASKFORMS_PATH = "stencilsets";

    private IDiagramProfile profile;
    private String packageName;
    private String assetName;
    private Asset processAsset;
    private String templatesPath;
    private Definitions def;
    private String taskId;
    private List<TaskFormInfo> taskFormInformationList = new ArrayList<TaskFormInfo>();
    private Path myPath;
    private BPMNFormBuilderService formModelerService;

    public TaskFormTemplateManager(Path myPath, BPMNFormBuilderService formModelerService, IDiagramProfile profile, Asset processAsset, String templatesPath, Definitions def, String taskId) {
        this.myPath = myPath;
        this.formModelerService = formModelerService;
        this.profile = profile;
        this.packageName = processAsset.getAssetLocation();
        this.assetName = processAsset.getName();
        this.processAsset = processAsset;
        this.templatesPath = templatesPath;
        this.def = def;
        this.taskId = taskId;
    }

    public void processTemplates() {
        List<RootElement> rootElements = def.getRootElements();
        for(RootElement re : rootElements) {
            if(re instanceof Process) {
                Process process = (Process) re;
                if(process != null && process.getId() != null && process.getId().length() > 0) {

                    // get the list of process properties
                    List<Property> processProperties = process.getProperties();

                    if (taskId == null) {
                        TaskFormInfo tfi = new TaskFormInfo();
                        tfi.setId(process.getId() + "-taskform");
                        if(process.getName() != null && process.getName().length() > 0 ) {
                            tfi.setProcessName(process.getName());
                        } else {
                            tfi.setProcessName(process.getId());
                        }
                        tfi.setProcessId(process.getId());
                        //String packageName1 = "";
    //                    FeatureMap attrs = process.getAnyAttribute();
    //                    for (Object attr : attrs) {
    //                        EStructuralFeatureImpl.SimpleFeatureMapEntry a = (EStructuralFeatureImpl.SimpleFeatureMapEntry) attr;
    //                        if("packageName".equals(a.getEStructuralFeature().getName())) {
    //                            packageName1 = (String)a.getValue();
    //                        }
    //                    }
                        tfi.setPkgName(packageName);
                        for(Property prop : processProperties) {
                            if(isValidStructureRef(prop.getItemSubjectRef().getStructureRef())) {
                                TaskFormInput input = new TaskFormInput();
                                input.setName(prop.getId());
                                input.setRefType(prop.getItemSubjectRef().getStructureRef());
                                tfi.getTaskInputs().add(input);
                            }
                        }
                        tfi.setProcessForm(true);
                        tfi.setUserTaskForm(false);
                        taskFormInformationList.add(tfi);
                    }

                    for(FlowElement fe : process.getFlowElements()) {
                        if(fe instanceof UserTask) {
                            getTaskInfoForUserTask((UserTask) fe, process, processProperties, taskId);
                        } else if(fe instanceof FlowElementsContainer) {
                            getTaskInfoForContainers((FlowElementsContainer) fe, process, processProperties, taskId);
                        }
                    }
                    generateTemplates();
                } else {
                    _logger.info("Invalid process. Not templates are generated");
                }
            }
        }

    }

    private void getTaskInfoForContainers(FlowElementsContainer container, Process process, List<Property> processProperties, String taskId) {
        List<FlowElement> flowElements = container.getFlowElements();
        for(FlowElement fe : flowElements) {
            if(fe instanceof UserTask) {
                getTaskInfoForUserTask((UserTask) fe, process, processProperties, taskId);
            } else if(fe instanceof FlowElementsContainer) {
                getTaskInfoForContainers((FlowElementsContainer) fe, process, processProperties, taskId);
            }
        }
    }

    public void generateUserTaskForm(UserTask utask, Process process, List<Property> processProperties) {
        TaskFormInfo usertfi = new TaskFormInfo();
        if(process.getName() != null && process.getName().length() > 0 ) {
            usertfi.setProcessName(process.getName());
        } else {
            usertfi.setProcessName(process.getId());
        }
        usertfi.setProcessId(process.getId());
        usertfi.setTaskId(utask.getId());
        usertfi.setPkgName(packageName);
        // make sure we have a valid task name
        boolean validTaskName = false;
        List<DataInput> dataInputs = Collections.emptyList();
        List<DataOutput> dataOutputs = Collections.emptyList();
        List<DataInputAssociation> dataInputAssociations = Collections.emptyList();
        List<DataOutputAssociation> dataOutputAssociations = Collections.emptyList();
        if (utask.getIoSpecification() != null) {
            dataInputs = utask.getIoSpecification().getDataInputs();
            dataOutputs = utask.getIoSpecification().getDataOutputs();
            dataInputAssociations = utask.getDataInputAssociations();
            dataOutputAssociations = utask.getDataOutputAssociations();
            for(DataInput din : dataInputs) {
                if(din.getName().equals("TaskName")) {
                    // make sure we have a data input association to the task name value
                    for(DataInputAssociation inputAssociation : dataInputAssociations) {
                        List<Assignment> assignments = inputAssociation.getAssignment();
                        for(Assignment assignment : assignments) {
                            if( ((FormalExpression)assignment.getTo()).getBody().equals(din.getId())) {
                                String taskName = ((FormalExpression)assignment.getFrom()).getBody();
                                if(taskName != null && taskName.length() > 0) {
                                    usertfi.setId(taskName + "-taskform");
                                    usertfi.setTaskName(taskName);
                                    validTaskName = true;
                                }
                            }
                        }
                    }
                }
                if(din.getName().equals("ActorId")) {
                    for(DataInputAssociation inputAssociation : dataInputAssociations) {
                        List<Assignment> assignments = inputAssociation.getAssignment();
                        for(Assignment assignment : assignments) {
                            if( ((FormalExpression)assignment.getTo()).getBody().equals(din.getId())) {
                                String actorid = ((FormalExpression)assignment.getFrom()).getBody();
                                if(actorid != null && actorid.length() > 0) {
                                    usertfi.setActorId(replaceInterpolations(actorid));
                                }
                            }
                        }
                    }
                }
                if(din.getName().equals("GroupId")) {
                    for(DataInputAssociation inputAssociation : dataInputAssociations) {
                        List<Assignment> assignments = inputAssociation.getAssignment();
                        for(Assignment assignment : assignments) {
                            if( ((FormalExpression)assignment.getTo()).getBody().equals(din.getId())) {
                                String groupid = ((FormalExpression)assignment.getFrom()).getBody();
                                if(groupid != null && groupid.length() > 0) {
                                    usertfi.setGroupId(replaceInterpolations(groupid));
                                }
                            }
                        }
                    }
                }
                if(din.getName().equals("Skippable")) {
                    for(DataInputAssociation inputAssociation : dataInputAssociations) {
                        List<Assignment> assignments = inputAssociation.getAssignment();
                        for(Assignment assignment : assignments) {
                            if( ((FormalExpression)assignment.getTo()).getBody().equals(din.getId())) {
                                String skippable = ((FormalExpression)assignment.getFrom()).getBody();
                                if(skippable != null && skippable.length() > 0) {
                                    usertfi.setSkippable(replaceInterpolations(skippable));
                                }
                            }
                        }
                    }
                }
                if(din.getName().equals("Priority")) {
                    for(DataInputAssociation inputAssociation : dataInputAssociations) {
                        List<Assignment> assignments = inputAssociation.getAssignment();
                        for(Assignment assignment : assignments) {
                            if( ((FormalExpression)assignment.getTo()).getBody().equals(din.getId())) {
                                String priority = ((FormalExpression)assignment.getFrom()).getBody();
                                if(priority != null && priority.length() > 0) {
                                    usertfi.setPriority(replaceInterpolations(priority));
                                }
                            }
                        }
                    }
                }
                if(din.getName().equals("Comment")) {
                    for(DataInputAssociation inputAssociation : dataInputAssociations) {
                        List<Assignment> assignments = inputAssociation.getAssignment();
                        for(Assignment assignment : assignments) {
                            if( ((FormalExpression)assignment.getTo()).getBody().equals(din.getId())) {
                                String comment = ((FormalExpression)assignment.getFrom()).getBody();
                                if(comment != null && comment.length() > 0) {
                                    usertfi.setComment(replaceInterpolations(comment));
                                }
                            }
                        }
                    }
                }
            }
        }
        if(validTaskName) {
            // get list of potential owners
            List<ResourceRole> utaskroles = utask.getResources();
            for(ResourceRole role : utaskroles) {
                if(role instanceof PotentialOwner) {
                    FormalExpression ownerexp = (FormalExpression) ( (PotentialOwner)role).getResourceAssignmentExpression().getExpression();
                    if(ownerexp.getBody() != null && ownerexp.getBody().length() > 0) {
                        usertfi.getTaskOwners().add(replaceInterpolations(ownerexp.getBody()));
                    }
                }
            }
            // get all inputs and outputs of the user task
            for(DataInput dinput : dataInputs) {
                // we already handled TaskName, ActorId , GroupId, Skippable, Priority, Comment
                if(!(dinput.getName().equals("TaskName") || dinput.getName().equals("ActorId") || dinput.getName().equals("GroupId")
                        || dinput.getName().equals("Skippable") || dinput.getName().equals("Priority") || dinput.getName().equals("Comment"))) {
                    TaskFormInput input = new TaskFormInput();
                    input.setName(dinput.getName());
                    // we need to see if the value of the input references a process var
                    // or we have an assignment defined
                    for(DataInputAssociation inputAssociation : dataInputAssociations) {
                        List<Assignment> assignments = inputAssociation.getAssignment();
                        if(assignments != null && assignments.size() > 0) {
                            // get the assignment value
                            for(Assignment assignment : assignments) {
                                if( ((FormalExpression)assignment.getTo()).getBody().equals(dinput.getId())) {
                                    input.setValue( ((FormalExpression)assignment.getFrom()).getBody() );
                                }
                            }
                        } else {
                            // mapping to process var
                            if(inputAssociation.getTargetRef().getId().equals(dinput.getId())) {
                                for(Property prop : processProperties) {
                                    if(prop.getId().equals(inputAssociation.getSourceRef().get(0).getId())) {
                                        input.setRefType( prop.getItemSubjectRef().getStructureRef() );
                                    }
                                }
                                if(input.getRefType() != null && input.getRefType().equals("Date")) {
                                    //input.setValue("${"+ inputAssociation.getSourceRef().get(0).getId() + "?date} ${"+ inputAssociation.getSourceRef().get(0).getId() + "?time}");
                                    input.setValue("${"+ ((DataInput)inputAssociation.getTargetRef()).getName() + "?date} ${"+ ((DataInput)inputAssociation.getTargetRef()).getName() + "?time}");
                                } else {
                                    //input.setValue("${"+ inputAssociation.getSourceRef().get(0).getId() + "}");
                                    input.setValue("${"+ ((DataInput)inputAssociation.getTargetRef()).getName() + "}");
                                }
                            }
                        }
                    }

                    usertfi.getTaskInputs().add(input);
                }
            }
            for(DataOutput dout : dataOutputs) {
                TaskFormOutput out = new TaskFormOutput();
                out.setName(dout.getName());
                out.setValue("${" + dout.getName() + "}");
                for(DataOutputAssociation outputAssociation : dataOutputAssociations) {
                    List<ItemAwareElement> sources = outputAssociation.getSourceRef();
                    for(ItemAwareElement iae : sources) {
                        if(iae.getId().equals(dout.getId())) {
                            for(Property prop : processProperties) {
                                if(prop.getId().equals(outputAssociation.getTargetRef().getId())) {
                                    out.setRefType( prop.getItemSubjectRef().getStructureRef() );
                                }
                            }
                        }
                    }
                }
                usertfi.getTaskOutputs().add(out);
            }
            usertfi.setUserTaskForm(true);
            usertfi.setProcessForm(false);
            // check if this usertfi already exists..if so, merge their inputs/outputs to create a single form
            boolean merged = false;
            for(TaskFormInfo existingForm : taskFormInformationList) {
                if(existingForm.getId().equals(usertfi.getId())) {
                    mergeUserTaskForms(usertfi, existingForm);
                    merged = true;
                    break;
                }
            }
            if(!merged) {
                taskFormInformationList.add(usertfi);
            }
        } else {
            _logger.info("Could not generate task form for usertask id: " + utask.getId() + ". No task name specified.");
        }
    }

    private void getTaskInfoForUserTask(UserTask utask, Process process, List<Property> processProperties, String taskId) {
        if(taskId != null && taskId.length() > 0) {
            if(utask.getId().equals(taskId)) {
                generateUserTaskForm(utask, process, processProperties);
            } else {
                _logger.info("Generating for specific task id: " + taskId + ". Omitting task id: " + utask.getId());
            }
        } else {
            generateUserTaskForm(utask, process, processProperties);
        }
    }

    private void mergeUserTaskForms(TaskFormInfo sourceForm, TaskFormInfo targetForm) {
        List<TaskFormInput> toMergeTaskInputs = new ArrayList<TaskFormInput>();
        List<TaskFormOutput> toMergeTaskOutputs = new ArrayList<TaskFormOutput>();

        for(String sourceOwner : sourceForm.getTaskOwners()) {
            if(!targetForm.getTaskOwners().contains(sourceOwner)) {
                targetForm.getTaskOwners().add(sourceOwner);
            }
        }

        for(TaskFormInput sourceInput : sourceForm.getTaskInputs()) {
            boolean foundInput = false;
            for(TaskFormInput targetInput : targetForm.getTaskInputs()) {
                if(targetInput.getName().equals(sourceInput.getName())) {
                    foundInput = true;
                }
            }
            if(!foundInput) {
                toMergeTaskInputs.add(sourceInput);
            }
        }

        for(TaskFormOutput sourceOutput : sourceForm.getTaskOutputs()) {
            boolean foundOutput = false;
            for(TaskFormOutput targetOutput : targetForm.getTaskOutputs()) {
                if(targetOutput.getName().equals(sourceOutput.getName())) {
                    foundOutput = true;
                }
            }
            if(!foundOutput) {
                toMergeTaskOutputs.add(sourceOutput);
            }
        }

        for(TaskFormInput input : toMergeTaskInputs) {
            targetForm.getTaskInputs().add(input);
        }
        for(TaskFormOutput output : toMergeTaskOutputs) {
            targetForm.getTaskOutputs().add(output);
        }
    }

    private boolean isValidStructureRef(String structureRef) {
        // supported types are Float Integer String Object Boolean and Underfined
        if(structureRef != null && structureRef.length() > 0) {
            return Arrays.asList(validStructureRefs).contains(structureRef);
        } else {
            // null or empty is default Object type
            return true;
        }
    }

    public void generateTemplates() {
        for(TaskFormInfo tfi : taskFormInformationList) {
            if(tfi.isProcessForm()) {
                generateProcessTemplate(tfi);
            } else {
                generateUserTaskTemplate(tfi);
            }
        }
    }

    private void generateProcessTemplate(TaskFormInfo tfi) {
        STRawGroupDir templates = new STRawGroupDir(templatesPath, '$', '$');
        ST processFormTemplate = templates.getInstanceOf("processtaskform");
        processFormTemplate.add("tfi", tfi);
        processFormTemplate.add("bopen", "{");
        processFormTemplate.add("bclose", "}");
        processFormTemplate.add("dollar", "$");
        tfi.setMetaOutput(processFormTemplate.render());

        String modelerFileName = tfi.getId() + ".form";
        String modelerURI = myPath.toURI();
        modelerURI = modelerURI.substring(0, modelerURI.lastIndexOf("/"));
        modelerURI = modelerURI + "/" + modelerFileName;

        try {
            tfi.setModelerOutput(formModelerService.buildFormXML(myPath, modelerFileName, modelerURI, def, tfi.getTaskId()));
        } catch(Exception e) {
            _logger.error(e.getMessage());
            e.printStackTrace();
        }
    }

    private void generateUserTaskTemplate(TaskFormInfo tfi) {
        STRawGroupDir templates = new STRawGroupDir(templatesPath, '$', '$');
        ST usertaskFormTemplate = templates.getInstanceOf("usertaskform");
        usertaskFormTemplate.add("tfi", tfi);
        usertaskFormTemplate.add("bopen", "{");
        usertaskFormTemplate.add("bclose", "}");
        usertaskFormTemplate.add("dollar", "$");
        tfi.setMetaOutput(usertaskFormTemplate.render());

        String modelerFileName = tfi.getId() + ".form";
        String modelerURI = myPath.toURI();
        modelerURI = modelerURI.substring(0, modelerURI.lastIndexOf("/"));
        modelerURI = modelerURI + "/" + modelerFileName;

        try {
            tfi.setModelerOutput(formModelerService.buildFormXML(myPath, modelerFileName, modelerURI, def, tfi.getTaskId()));
        } catch(Exception e) {
            _logger.error(e.getMessage());
            e.printStackTrace();
        }

    }

    public String readFile(String pathname) throws IOException {
        StringBuilder fileContents = new StringBuilder();
        Scanner scanner = new Scanner(new File(pathname));
        String lineSeparator = System.getProperty("line.separator");
        try {
            while(scanner.hasNextLine()) {
                fileContents.append(scanner.nextLine() + lineSeparator);
            }
            return fileContents.toString();
        } finally {
            scanner.close();
        }
    }

    private String replaceInterpolations(String base) {
    	return base.replaceAll("\\#\\{", "\\$\\{");
    }

    public List<TaskFormInfo> getTaskFormInformationList() {
        return taskFormInformationList;
    }

    public String getTemplatesPath() {
        return templatesPath;
    }

    public void setTemplatesPath(String templatesPath) {
        this.templatesPath = templatesPath;
    }

    public String getAssetName() {
        return assetName;
    }

    public void setAssetName(String assetName) {
        this.assetName = assetName;
    }

    public void setTaskFormInformationList(
            List<TaskFormInfo> taskFormInformationList) {
        this.taskFormInformationList = taskFormInformationList;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

}


text:
"use strict";

var errors = {
	"400": "Unable to add the environment record",
	"401": "Unable to update the environment record",
	"402": "Unable to get the environment records",
	"403": "Environment already exists",
	"404": "Unable to remove environment record",
	"405": "Invalid environment id provided",
	"406": "Unable to update tenant key security information",
	"407": "Invalid or no Platform Driver configuration provided!",
	"408": "You have requested to use the SOAJS Framework in this environment. Make sure that cookie secret, session name and session secret are provided.",
	"409": "Invalid product id provided",
	"410": "Unable to add the product record",

	"411": "Unable to update the product record",
	"412": "Unable to get the product record",
	"413": "Product already exists",
	"414": "Unable to remove product record",
	"415": "Unable to add the product package",
	"416": "Unable to update the product package",
	"417": "Unable to get the product packages",
	"418": "Product package already exists",
	"419": "Unable to remove product package",
	"420": "Unable to add the tenant record",

	"421": "Unable to update the tenant record",
	"422": "Unable to get the tenant records",
	"423": "Tenant already exists",
	"424": "Unable to remove tenant record",
	"425": "Unable to add the tenant OAuth",
	"426": "Unable to update the tenant OAuth",
	"427": "Unable to get the tenant OAuth",
	"428": "Unable to remove tenant OAuth",
	"429": "Unable to add the tenant application",
	"430": "Unable to update the tenant application",

	"431": "Unable to get the tenant application",
	"432": "Unable to remove tenant application",
	"433": "Tenant application already exist",
	"434": "Invalid product code or package code provided",
	"435": "Unable to get the tenant application keys",
	"436": "Unable to add a new key to the tenant application",
	"437": "Unable to remove key from the tenant application",
	"438": "Invalid tenant Id provided",
	"439": "Invalid tenant oauth user Id provided",
	"440": "Unable to add the tenant application ext Key",

	"441": "Unable to update the tenant application ext Key",
	"442": "Unable to get the tenant application ext Keys",
	"443": "Unable to remove tenant application ext Key",
	"444": "Unable to get the tenant application configuration",
	"445": "Unable to update the tenant application configuration",
	"446": "Invalid environment provided",
	"447": "Unable to get tenant oAuth Users",
	"448": "tenant oAuth User already exists",
	"449": "Unable to add tenant oAuth User",
	"450": "Unable to remove tenant oAuth User",

	"451": "Unable to updated tenant oAuth User",
	"452": "Invalid Tenant Code",
	"453": "Invalid Tenant External Key",
	"454": "Tenant does not exist",
	"455": "Tenant Key already exists",
	"456": "Error adding Tenant Key",
	"457": "You are not allowed to create an environment named PORTAL or DASHBOARD",
	"458": "Failed to Create User Account, try adding the user manually!",
	"459": "Unable to update the tenant OAuth, Server to server authentication is only supported with Oauth 2.0",
	"460": "Unable to find product",

	"461": "Unable to find package",
	"462": "You are not allowed to remove the tenant you are currently logged in with",
	"463": "You are not allowed to remove the application you are currently logged in with",
	"464": "You are not allowed to remove the key you are currently logged in with",
	"465": "You are not allowed to remove the external key you are currently logged in with",
	"466": "You are not allowed to remove the product you are currently logged in with",
	"467": "You are not allowed to remove the package you are currently logged in with",
	"468": "Invalid product code provided",
	"470": "Missing required field: either id or code",

	"480": "A template with the same name already exists",
	"481": "Select at least one CI or Deployment Recipe or one endpoint to generate and export a template.",
	"482": "Requested template does not exist!",
	"483": "Error exporting endpoints. Some of the resources associated with your endpoints were not found!",

	"490": "Invalid Infra Provider Id Provided",
	"491": "This provider still has registered deployments. Remove them first before you deactivate the account.",
	"492": "This provider does not support storing infra as code templates locally",
	"493": "Unable to update template content, this template is not stored locally",
	"494": "This provider does not support storing infra as code templates externally",
	"495": "No Template state provided for this layer",
	"496": "Infra Provider Id is required when deploying a resource of type virtual machine",
	"497": "No Deployments found for this Infra Provider",
	"498": "Unable to parse template input",
	"499": "Virtual Machine Layer already exists!",

	"500": "This record is locked. You cannot delete it",
	"501": "This record is locked. You cannot modify or delete it",
	"502": "Invalid resource name/id provided",
	"503": "Error adding new environment database",
	"504": "A resource with the same name, type, and category already exists",
	"505": "Modifying a resource is only allowed in the environment where it was created",
	"506": "You are not allowed to modify this resource",
	"507": "Invalid db Information provided for session database",
	"508": "Resource not found",
	"509": "environment database already exist",
	"510": "environment session database already exist",

	"511": "environment session database does not exist",
	"512": "environment database does not exist",
	"513": "Error updating environment database",
	"514": "Error removing environment database",
	"515": "This environment is not associated with any Cloud Provider!",
	"516": "This environment is using a container cluster provisioned at the cloud provider, you need to remove the cluster first.",
	"517": "This environment has virtual machines at the cloud provider associated to it, you need to remove these virtual machines first.",

	"520": "Error Invalid environment restriction",
	"521": "Unable to onBoard your VM layer",

	"522": "The Service Host is already running in this environment",
	"523": "The Service Host is not running in this environment",
	"524": "The requested service is not found!",
	"525": "Unable to compare different acl environment types",

	"600": "Database error",
	"601": "No Logged in User found.",
	"602": "Invalid maintenance operation requested.",
	"603": "Error executing maintenance operation.",
	"604": "Service not found.",
	"605": "Service Host not found.",
	"606": "Error adding an administrator user for tenant",
	"607": "Error adding an administrator group for tenant",
	"608": "Permissions denied to access this section",
	"609": "Dashboard service is not accessible at the time being Come back later.",
	"610": "Invalid or profile not found.",

	"611": "Invalid Service Image Name provided",
	"612": "Invalid Operation! you can either deploy a service by providing its image or if it is a GC service but not both.",
	"613": "Invalid Operation! either deploy a service by providing its image or its GC information.",
	"614": "Service exists!",
	"615": "Error adding service host!",
	"616": "Error Uploading File.",
	"617": "Error Registering Service.",
	"618": "The Deployer of this environment is configured to be manual. Deploy and Start the services then refresh this section.",
	"619": "The Deployer of this environment is configured to be manual. Unable to perform requested maintenance operation.",
	"620": "Make sure upload directory exists :",

	"621": "The requested service is not deployed in any environment",
	"622": "We are unable to onBoard your VM instance because we detected a mismatch between the Operating Systems of the Virtual Machine Instance.",

	"630": "Unable to get latest console version",
	"700": "This Content Schema already Exist",
	"701": "Invalid Id provided",
	"702": "Content Schema doesn't exists",
	"703": "Invalid or no Content Service with this name and version",
	"704": "Another Service with the same name or port exists. Change the name of this schema or its service port.",
	"705": "Tenant already has a key to use the dashboard",
	"706": "Please create a session database for this environment",

	"710": "A Daemon with the same name and/or port already exists",
	"711": "Group has daemons deployed, please remove them first.",

	"714": "A Group Configuration with the same name already exists",
	"715": "Unable to update group configuration",
	"716": "Unable to delete group configuration",
	"717": "Unable to add group configuration",
	"718": "Unable to retrieve list of daemons",
	"719": "Unable to retrieve list of group configurations",

	"720": "Unable to update job's service configuration",
	"721": "Unable to retrieve job's service configuration",
	"722": "Unable to update job's tenant external keys",
	"723": "Unable to list job's tenant external keys",
	"724": "Job not found",
	"725": "Group Configuration not found",
	"726": "Daemon not found",
	"727": "Unable to add certificate(s)",
	"728": "Unable to get certificate(s)",
	"729": "Unable to remove certificate",
	"730": "One or more certificates do not exist",

	"732": "Unable to list drivers",
	"733": "Unable to add driver",
	"734": "Unable to update driver",
	"735": "Unable to change selected driver",
	"736": "Unable to delete driver",
	"737": "You are not allowed to delete a driver that is currently selected",
	"738": "Unable to change deployer type",
	"739": "Missing required param(s). Make sure you specify certificate filename, type, and environment code. If type is docker, specify driver name and if type is nginx, specify certificate label",
	"740": "This application does not have access to specified environment. Either update its package's ACL or choose a different environment",

	"741": "No platform certificates found for this environment. Please upload them in the Platforms section",
	"742": "Unable to list static content sources",
	"743": "Missing environment deployer settings. Please specify deployment type, selected driver, and driver settings in the Platforms section",
	"744": "Certificate type must be one of [ca, cert, key]",

	"750": "Invalid Request.",
	"751": "Unable to login",
	"752": "User account already exists",
	"753": "Unable to logout",
	"754": "Active repositories exist for this user. Please deactivate them to be able to logout",
	"755": "Authentication failed",
	"756": "Unable to list accounts",
	"757": "Unable to get git user account",
	"758": "Unable to get repositories. Please try again.",
	"759": "Unable to get branches",

	"760": "Missing source information",
	"761": "Failed to activate repository, make sure config.js file is available in your repository and it has the right schema.",
	"762": "A module with the same name and/or port already exists",
	"763": "Unable to reach the GitHub API. Please try again.",
	"764": "Static Content already exists",
	"765": "Failed to deactivate repository",
	"766": "Repository has running hosts. Please stop them to be able to deactivate repository",
	"767": "Invalid Git information provided",
	"768": "Failed to sync repository",
	"769": "Missing config.js data",
	"770": "Missing config.js source data",

	"771": "Invalid or no type provided in config.js",
	"772": "Unable to list zombie containers",
	"773": "Unable to delete container",
	"774": "Unable to get container logs",
	"775": "Missing account provider param",
	"776": "GitHub API returned an error: API rate limit exceeded for this IP. It is advised to use an authenticated account to proceed or try again later",
	"777": "You are not allowed to delete this container. At least one instance of nginx must be available",
	"778": "The git account provider is missing or not supported",
	"779": "Unable to complete Reload Registry operation for controllers",
	"780": "Unable to redeploy service",

	"781": "You are not the owner of this application. You cannot perform this operation.",
	"783": "Missing folders paths multi repository",
	"784": "Error in multi repository folders array",
	"785": "Folders array is empty",
	"786": "Validation Error",
	"787": "Missing field name in config.js",
	"788": "Invalid or no type provided in config.js",
	"789": "Unable to get content from git provider",
	"790": "Error while pushing code to remote repository",

	"791": "One of the inputs under configuration repository is missing.",
	"792": "Selected type does not support extra custom repositories",
	"793": "One of the inputs under custom repository is missing.",
	"795": "Invalid Operation, service/daemon record not found in Database.",

	"800": "Unable to get manager nodes, make sure you have at least one manager node in the cluster",
 	"801": "Unable to add node, make sure the new node is configured properly",
 	"802": "Unable to save new node record. However, the new node was added to the cluster",
 	"803": "Unable to get node record",
 	"804": "Unable to remove node, make sure the node is healthy and reachable within the cluster",
 	"805": "Unable to remove node record. However, the node is currently being removed from the cluster",
 	"806": "Unable to update node, make sure the node is reachable and properly configured",
 	"807": "Unable to update the node record. However, the node state was updated within the cluster",
 	"808": "Unable to retrieve service containers list",
 	"809": "The new and current scale counts are identical",
 	"810": "Unable to scale service, make sure the deployer is configured properly",

	"811": "Unable to inspect service containers",
 	"812": "Unable to update container records. However, the service was scaled successfully",
 	"813": "Unable to delete service, make sure the deployer is configured properly",
 	"814": "Unable to remove container records. However, the service was deleted successfully",
 	"815": "Unable to remove host records. However, the service was deleted successfully",
 	"817": "Unable to list nodes",
 	"818": "This operation is only permitted in the dashboard environment",
 	"819": "Unable to update environments' deployer. However, the node was added successfully",
 	"820": "Unable to update environments' deployer. However, the node was removed successfully",

	"821": "You are not allowed you remove a manager node. You need to demote it to worker first",
 	"822": "Unable to update environments' deployer. However, the node was updated successfully",
 	"823": "Update operations are not permitted for clusters that that composed of a single node",
	"824": "The port chosen is outside the range of valid exposed ports (0 , 2767)",
	"825": "Invalid or no environment deployer settings detected. Make sure you are running in container mode",
	"826": "Invalid port schema provided!",
	"827": "Invalid volume schema provided!",
	"828": "Container mode is required!",
	"829": "Replication type is required!",

	"840": "Missing Virtual Machine parameters.",
	"841": "No Admin Authentication method was provided.",

	"850": "The simulator returned an error",
	"851": "Invalid YAML code provided",
	"852": "Error Cleaning up generated Service Code",
	"853": "Error Generating Folders for Service",
	"854": "Error Generating Files for Service",
	"855": "Error Returning Generated service Code",

	"901": "Error Logging out from environments",
	"902": "Error Logging in to environments",
	"903": "You do not have access to this environment %envCode%",
	"904": "Check your internet connection",

	"905": "Static content not found",

	"906": "Running hosts exist for this environment, remove them before deleting this environment",
	"907": "Running hosts exist for this environment, remove them before updating its namespace configuration",
	"908": "Updating deployer configuration is only supported for kubernetes deployments",
	"909": "Namespace operations are only supported in kubernetes container deployment mode",

	"910": "Specified memory limit is less than minimum memory prerequisite for this service",
	"911": "Missing value for environment variable %ENV_NAME% of type %ENV_TYPE% set in catalog recipe",

	"920": "Failed. A service with the same port/name is already created!",
	"921": "No endpoint found",
	"922": "Please provide either a schema or a swagger object",
	"923": "Warning! Publish failed. You don't have any api.",
	"924": "Failed. Missing passThrough configuration.",

    "948": "Detected old Schema for volumes, please upgrade",
    "949": "Specify the type for docker volume(s)",

	"950": "Catalog recipe not found",
	"951": "You are not allowed to edit or delete a locked recipe",
	"952": "Unable to update catalog recipe",
	"953": "Unable to delete catalog recipe",
	"954": "Unable to get catalog ID for specified service/deployment",
	"955": "No CI configuration found",
	"956": "Authentication failed. The deploy token provided is not valid.",

	"966": "The chosen Continuous Integration configuration is not valid.",
	"967": "Continuous Integration recipe name already exists for this provider.",
	"968": "This Account already has a Continuous Integration configured with the selected provider.",
    "969": "The chosen Continuous Integration Service does not exist",
    "970": "The chosen driver does not support the selected function",

    "971": "Unable to submit your request to the service.",
    "972": "Please provide a valid Github token.",
    "973": "The provided Github token does not have sufficient oauth permissions.",
    "974": "Please provide a valid Travis access token.",
    "975": "Please provide the name of the repositories owner.",
    "976": "Could not find any repository for the requested owner.",
    "977": "Could not find the requested repository.",
	"978": "Please provide a valid environment variable ID.",
	"979": "Could not find the desired environment variable. Ensure the repo ID and the environment variable ID are correct.",
    "980": "Error while updating hook. Ensure the hook ID and the access token are correct.",

	"981": "Unable to get repository settings",
	"982": "Unable to update repository settings",
	"983": "soa.js file does not exist or is not a valid soajs configuration file",
	"984": "Unable to parse yml file",
	"985": "swagger.yml file validation failed",
	"986": "Validation for output config.js file failed",
	"987": "Autoscaling is only supported in kubernetes mode",
	"988": "Unable to detect Heapster componenets",
	"989": "The dashboard cluster is a sensitive resource that cannot be added or deleted. Only it's driver configuration can be updated.",

	"990": "Invalid custom registry entry name/id provided",
	"991": "Custom registry entry not found",
	"992": "A plugged custom registry entry with the same name exists in this environment or is shared with other environments",
	"993": "Custom registry entry not found",
	"994": "You are not allowed to modify or delete this custom registry entry",
	"995": "Modifying a custom registry entry is only allowed in the environment where it was created",
	"996": "At least one of the deployment's exposed ports conflicts with existing deployments",
	"997": "Unable to get repository build or job logs",
	"998": "An error occured while updating port configuration of vm layer",
	"999": "Limit Exceed, please upgrade your account",
};

module.exports = errors;


text:
@interface STPBINRange(Testing)

@property(nonatomic)NSUInteger length;
@property(nonatomic)NSString *qRangeLow;
@property(nonatomic)NSString *qRangeHigh;
@property(nonatomic)STPCardBrand brand;

- (BOOL)matchesNumber:(NSString *)number;

@end

@interface STPBinRangeTest : XCTestCase
@end

@implementation STPBinRangeTest

- (void)testAllRanges {
    for (STPBINRange *binRange in [STPBINRange allRanges]) {
        XCTAssertEqual(binRange.qRangeLow.length, binRange.qRangeHigh.length);
    }
}

- (void)testMatchesNumber {
    STPBINRange *binRange = [STPBINRange new];
    binRange.qRangeLow = @"134";
    binRange.qRangeHigh = @"167";

    XCTAssertFalse([binRange matchesNumber:@"0"]);
    XCTAssertFalse([binRange matchesNumber:@"1"]);
    XCTAssertFalse([binRange matchesNumber:@"2"]);

    XCTAssertFalse([binRange matchesNumber:@"133"]);
    XCTAssert([binRange matchesNumber:@"134"]);
    XCTAssert([binRange matchesNumber:@"135"]);
    XCTAssert([binRange matchesNumber:@"167"]);
    XCTAssertFalse([binRange matchesNumber:@"168"]);

    XCTAssertFalse([binRange matchesNumber:@"1244"]);
    XCTAssert([binRange matchesNumber:@"1340"]);
    XCTAssert([binRange matchesNumber:@"1344"]);
    XCTAssert([binRange matchesNumber:@"1444"]);
    XCTAssert([binRange matchesNumber:@"1670"]);
    XCTAssert([binRange matchesNumber:@"1679"]);
    XCTAssertFalse([binRange matchesNumber:@"1680"]);

    binRange.qRangeLow = @"";
    binRange.qRangeHigh = @"";
    XCTAssert([binRange matchesNumber:@""]);
    XCTAssert([binRange matchesNumber:@"1"]);
}

- (void)testBinRangesForNumber {
    NSArray<STPBINRange *> *binRanges;

    binRanges = [STPBINRange binRangesForNumber:@"4136000000008"];
    XCTAssertEqual(binRanges.count, 3U);

    binRanges = [STPBINRange binRangesForNumber:@"4242424242424242"];
    XCTAssertEqual(binRanges.count, 2U);

    binRanges = [STPBINRange binRangesForNumber:@"5555555555554444"];
    XCTAssertEqual(binRanges.count, 2U);

    binRanges = [STPBINRange binRangesForNumber:@""];
    XCTAssertEqual(binRanges.count, 1U);

    binRanges = [STPBINRange binRangesForNumber:@"123"];
    XCTAssertEqual(binRanges.count, 1U);
}

- (void)testBinRangesForBrand {
    NSArray *allBrands = @[@(STPCardBrandVisa),
                           @(STPCardBrandAmex),
                           @(STPCardBrandMasterCard),
                           @(STPCardBrandDiscover),
                           @(STPCardBrandJCB),
                           @(STPCardBrandDinersClub),
                           @(STPCardBrandUnknown)];
    for (NSNumber *brand in allBrands) {
        NSArray<STPBINRange *> *binRanges = [STPBINRange binRangesForBrand:brand.integerValue];
        for (STPBINRange *binRange in binRanges) {
            XCTAssertEqual(binRange.brand, brand.integerValue);
        }
    }
}

- (void)testMostSpecifiBinRangeForNumber {
    STPBINRange *binRange;

    binRange = [STPBINRange mostSpecificBINRangeForNumber:@""];
    XCTAssertEqual(binRange.brand, STPCardBrandUnknown);

    binRange = [STPBINRange mostSpecificBINRangeForNumber:@"4242424242422"];
    XCTAssertEqual(binRange.brand, STPCardBrandVisa);
    XCTAssertEqual(binRange.length, 16U);

    binRange = [STPBINRange mostSpecificBINRangeForNumber:@"4136000000008"];
    XCTAssertEqual(binRange.brand, STPCardBrandVisa);
    XCTAssertEqual(binRange.length, 13U);

    binRange = [STPBINRange mostSpecificBINRangeForNumber:@"4242424242424242"];
    XCTAssertEqual(binRange.brand, STPCardBrandVisa);
    XCTAssertEqual(binRange.length, 16U);
}

@end


text:
<?php

namespace Core;

use Exception;
use Swift_Attachment;
use Swift_Mailer;
use Swift_Message;
use Swift_SmtpTransport;

/**
 * Class Email
 *
 * @package Core
 */
class Email
{

    /**
     * Data for Email
     *
     * @var string $to
     * @var array $from [email => name]
     */
    private $to, $from, $subject, $content_text, $content_html, $attachment;

    /**
     * Construct
     *
     * @param $to
     * @param array $from
     * @param $subject
     * @param $content_html
     * @param null $content_txt
     * @param null $attachment
     */
    function __construct($to, array $from, $subject, $content_html, $content_txt = null, $attachment = null)
    {
        $this->to = $to;
        $this->from = $from;
        $this->subject = $subject;
        $this->content_html = $content_html;
        $this->content_txt = $content_txt;
        $this->attachment = $attachment;
    }

    /**
     * Send
     *
     * @return bool
     * @throws Exception
     */
    function send()
    {
        $app = Dispatcher::getAppFile();
        $transport = Swift_SmtpTransport::newInstance($app['mail_smtp'], $app['mail_port'])
            ->setUsername($app['mail_username'])
            ->setPassword($app['mail_password']);
        $mailer = Swift_Mailer::newInstance($transport);
        $message = Swift_Message::newInstance();
    	$message
            ->setSubject($this->subject)
            ->setFrom($this->from)
            ->setBody($this->content_html)
            ->addPart($this->content_html, 'text/html');

    	$message->setTo([$this->to]);

        if (!is_null($this->attachment) && !empty($this->attachment)) {
            foreach($this->attachment as $attachment){
        		$message->attach(Swift_Attachment::fromPath($attachment));
            }
    	}

    	$headers = $message->getHeaders();

        if ($mailer->send($message)) {
            return true;
        } else {
            return false;
        }
    }
}