text:
from scipy.optimize import minimize
from numpy import dot,array,zeros,ones,tile,transpose,multiply,inner,concatenate
from Utils import MatLoad

def f(theta,C,XROWS):
    aux_theta,tolerances  = theta[:XROWS],theta[XROWS:]
    return ((1.0/2.0)*dot(theta,theta))+(C*tolerances.sum())

def r1(theta,X,Y,XROWS):
    aux_theta,tolerances  = theta[:XROWS],theta[XROWS:]
    return (multiply(Y,aux_theta*X)-1+tolerances).A1

def r2(theta,X,Y,XROWS): return theta[XROWS:]

def fit(theta,X,Y,C):
    XROWS,XCOLS,YROWS = X.shape[0],X.shape[1],Y.shape[0]
    return minimize(fun=f,args=(C,XROWS),x0=theta,constraints=({"type":"ineq","fun":r1,"args":[X,Y,XROWS]},
							       {"type":"ineq","fun":r2,"args":[X,Y,XROWS]}))

def generate_theta(XROWS): return array([1 for i in xrange(XROWS)])
def generate_tolerances(XCOLS): return array([0 for i in xrange(XCOLS)])
def generate_initial_guess(XROWS,XCOLS): return concatenate((generate_theta(XROWS),generate_tolerances(XCOLS)))

def classify(theta,X): return 1 if inner(theta,X)>=+0 else -1
def predict(theta,X): return inner(theta,X)

if __name__ == "__main__":
    X = MatLoad("X.np");
    Y = MatLoad("Y.np");
    XROWS,XCOLS,YROWS,C = X.shape[0],X.shape[1],Y.shape[0],0.3
    theta = generate_initial_guess(XROWS,XCOLS)
    res = fit(theta,X,Y,C)
    print "\n Detalles de convergencia \n"
    print res
    theta = res.x
    theta,tolerances = res.x[0:XROWS],res.x[XROWS:]
    print classify(theta,array([1,0,5]))
    print predict(theta,array([1,0,5]))
    print classify(theta,array([1,2,1]))
    print predict(theta,array([1,2,1]))


text:
#!/usr/bin/env node
;(function() {
  'use strict';

  /** The Node filesystem module */
  var fs = require('fs');

  /** Used to minify variables embedded in compiled strings */
  var compiledVars = [
    'callback',
    'collection',
    'concat',
    'ctor',
    'hasOwnProperty',
    'identity',
    'index',
    'iteratee',
    'iteratorBind',
    'length',
    'nativeKeys',
    'object',
    'ownIndex',
    'ownProps',
    'prop',
    'propertyIsEnumerable',
    'propIndex',
    'props',
    'result',
    'skipProto',
    'slice',
    'stringClass',
    'thisArg',
    'toString',
    'value',

    // lesser used variables
    'accumulator',
    'args',
    'argsIndex',
    'argsLength',
    'arrayLikeClasses',
    'ArrayProto',
    'bind',
    'callee',
    'className',
    'compareAscending',
    'destValue',
    'forIn',
    'found',
    'funcs',
    'indexOf',
    'indicator',
    'isArguments',
    'isArr',
    'isArray',
    'isFunc',
    'isFunction',
    'isPlainObject',
    'methodName',
    'noaccum',
    'objectClass',
    'objectTypes',
    'pass',
    'properties',
    'property',
    'propsLength',
    'recursive',
    'source',
    'stack',
    'stackLength',
    'target',
    'valueProp'
  ];

  /** Used to minify `compileIterator` option properties */
  var iteratorOptions = [
    'args',
    'array',
    'arrayBranch',
    'beforeLoop',
    'bottom',
    'exit',
    'firstArg',
    'hasDontEnumBug',
    'inLoop',
    'init',
    'isKeysFast',
    'object',
    'objectBranch',
    'noArgsEnum',
    'noCharByIndex',
    'shadowed',
    'top',
    'useHas',
    'useStrict'
  ];

  /** Used to minify variables and string values to a single character */
  var minNames = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
  minNames.push.apply(minNames, minNames.map(function(value) {
    return value + value;
  }));

  /** Used to protect the specified properties from getting minified */
  var propWhitelist = [
    '_',
    '_chain',
    '_wrapped',
    'after',
    'all',
    'amd',
    'any',
    'attachEvent',
    'bind',
    'bindAll',
    'chain',
    'clearTimeout',
    'clone',
    'collect',
    'compact',
    'compose',
    'contains',
    'countBy',
    'criteria',
    'debounce',
    'defaults',
    'defer',
    'delay',
    'detect',
    'difference',
    'drop',
    'each',
    'environment',
    'escape',
    'escape',
    'evaluate',
    'every',
    'extend',
    'filter',
    'find',
    'first',
    'flatten',
    'foldl',
    'foldr',
    'forEach',
    'forIn',
    'forOwn',
    'functions',
    'groupBy',
    'has',
    'head',
    'identity',
    'include',
    'index',
    'indexOf',
    'initial',
    'inject',
    'interpolate',
    'intersection',
    'invoke',
    'isArguments',
    'isArray',
    'isBoolean',
    'isDate',
    'isElement',
    'isEmpty',
    'isEqual',
    'isEqual',
    'isFinite',
    'isFinite',
    'isFunction',
    'isNaN',
    'isNull',
    'isNumber',
    'isObject',
    'isRegExp',
    'isString',
    'isUndefined',
    'keys',
    'last',
    'lastIndexOf',
    'map',
    'max',
    'memoize',
    'merge',
    'methods',
    'min',
    'mixin',
    'noConflict',
    'once',
    'opera',
    'partial',
    'pick',
    'pluck',
    'range',
    'reduce',
    'reduceRight',
    'reject',
    'rest',
    'result',
    'select',
    'setTimeout',
    'shuffle',
    'size',
    'some',
    'sortBy',
    'sortedIndex',
    'source',
    'tail',
    'take',
    'tap',
    'template',
    'templateSettings',
    'throttle',
    'times',
    'toArray',
    'union',
    'uniq',
    'unique',
    'uniqueId',
    'value',
    'values',
    'variable',
    'VERSION',
    'where',
    'without',
    'wrap',
    'zip',
    'zipObject'
  ];

  /*--------------------------------------------------------------------------*/

  /**
   * Pre-process a given Lo-Dash `source`, preparing it for minification.
   *
   * @param {String} source The source to process.
   * @returns {String} Returns the processed source.
   */
  function preprocess(source) {
    // remove copyright to add later in post-compile.js
    source = source.replace(/\/\*![\s\S]+?\*\//, '');

    // remove unrecognized JSDoc tags so Closure Compiler won't complain
    source = source.replace(/@(?:alias|category)\b.*/g, '');

    // manually convert `arrayLikeClasses` property assignments because
    // Closure Compiler errors trying to minify them
    source = source.replace(/(arrayLikeClasses =)[\s\S]+?= *true/,
      "$1{'[object Arguments]': true, '[object Array]': true, '[object Boolean]': false, " +
      "'[object Date]': false, '[object Function]': false, '[object Number]': false, " +
      "'[object Object]': false, '[object RegExp]': false, '[object String]': true }"
    );

    // manually convert `cloneableClasses` property assignments because
    // Closure Compiler errors trying to minify them
    source = source.replace(/(cloneableClasses =)[\s\S]+?= *true/,
      "$1{'[object Arguments]': false, '[object Array]': true, '[object Boolean]': true, " +
      "'[object Date]': true, '[object Function]': false, '[object Number]': true, " +
      "'[object Object]': true, '[object RegExp]': true, '[object String]': true }"
    );

    // add brackets to whitelisted properties so Closure Compiler won't mung them
    // http://code.google.com/closure/compiler/docs/api-tutorial3.html#export
    source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), "['$1']");

    // remove brackets from `_.escape()` in `_.template`
    source = source.replace(/__e *= *_\['escape']/g, '__e=_.escape');

    // remove brackets from `collection.indexOf` in `_.contains`
    source = source.replace("collection['indexOf'](target)", 'collection.indexOf(target)');

    // remove brackets from `result[length].value` in `_.sortBy`
    source = source.replace("result[length]['value']", 'result[length].value');

    // remove whitespace from string literals
    source = source.replace(/'(?:(?=(\\?))\1.)*?'/g, function(string) {
      // avoids removing the '\n' of the `stringEscapes` object
      return string.replace(/\[object |else if|function | in |return\s+[\w']|throw |typeof |use strict|var |@ |'\\n'|\\\\n|\\n|\s+/g, function(match) {
        return match == false || match == '\\n' ? '' : match;
      });
    });

    // remove whitespace from `_.template` related regexes
    source = source.replace(/(?:reDelimiterCode\w+|reEmptyString\w+|reInsertVariable) *=.+/g, function(match) {
      return match.replace(/ |\\n/g, '');
    });

    // remove newline from double-quoted strings in `_.template`
    source = source
      .replace('"\';\\n__with ("', '"\';__with("')
      .replace('"\\n}__\\n__p += \'"', '"}____p+=\'"')
      .replace('"__p = \'"', '"__p=\'"')
      .replace('"\';\\n"', '"\';"')
      .replace("') {\\n'", "'){'")

    // remove `useSourceURL` variable
    source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *try *\{(?:\s*\/\/.*)*\n *var useSourceURL[\s\S]+?catch[^}]+}\n/, '');

    // remove debug sourceURL use in `_.template`
    source = source.replace(/(?:\s*\/\/.*\n)* *if *\(useSourceURL[^}]+}/, '');

    // minify internal properties used by 'compareAscending', `_.clone`, `_.merge`, and `_.sortBy`
    (function() {
      var properties = ['criteria', 'index', 'source', 'value'],
          snippets = source.match(/( +)(?:function clone|function compareAscending|var merge|var sortBy)\b[\s\S]+?\n\1}/g);

      if (!snippets) {
        return;
      }
      snippets.forEach(function(snippet) {
        var modified = snippet,
            isCompilable = /(?:var merge|var sortBy)\b/.test(modified),
            isInlined = !/\bcreateIterator\b/.test(modified);

        // minify properties
        properties.forEach(function(property, index) {
          var reBracketProp = RegExp("\\['(" + property + ")'\\]", 'g'),
              reDotProp = RegExp('\\.' + property + '\\b', 'g'),
              rePropColon = RegExp("(')?\\b" + property + "\\1 *:", 'g');

          if (isCompilable) {
            // add quotes around properties in the inlined `_.merge` and `_.sortBy`
            // of the mobile build so Closure Compiler won't mung them
            if (isInlined) {
              modified = modified
                .replace(reBracketProp, "['" + minNames[index] + "']")
                .replace(reDotProp, "['" + minNames[index] + "']")
                .replace(rePropColon, "'" + minNames[index] + "':");
            }
            else {
              modified = modified
                .replace(reBracketProp, '.' + minNames[index])
                .replace(reDotProp, '.' + minNames[index])
                .replace(rePropColon, minNames[index] + ':');
            }
          }
          else {
            modified = modified
              .replace(reBracketProp, "['" + minNames[index] + "']")
              .replace(reDotProp, '.' + minNames[index])
              .replace(rePropColon, "'" + minNames[index] + "':")

            // correct `value.source` in regexp branch of `_.clone`
            if (property == 'source') {
              modified = modified.replace("value['" + minNames[index] + "']", "value['source']");
            }
          }
        });

        // replace with modified snippet
        source = source.replace(snippet, modified);
      });
    }());

    // minify all compilable snippets
    var snippets = source.match(
      RegExp([
        // match the `iteratorTemplate`
        '( +)var iteratorTemplate\\b[\\s\\S]+?\\n\\1}',
        // match methods created by `createIterator` calls
        'createIterator\\((?:{|[a-zA-Z]+)[\\s\\S]+?\\);\\n',
        // match variables storing `createIterator` options
        '( +)var [a-zA-Z]+IteratorOptions\\b[\\s\\S]+?\\n\\2}',
        // match the the `createIterator` function
        '( +)function createIterator\\b[\\s\\S]+?\\n\\3}'
      ].join('|'), 'g')
    );

    // exit early if no compilable snippets
    if (!snippets) {
      return source;
    }

    snippets.forEach(function(snippet, index) {
      var isCreateIterator = /function createIterator\b/.test(snippet),
          isIteratorTemplate = /var iteratorTemplate\b/.test(snippet),
          modified = snippet;

      // add brackets to whitelisted properties so Closure Compiler won't mung them
      modified = modified.replace(RegExp('\\.(' + iteratorOptions.join('|') + ')\\b', 'g'), "['$1']");

      if (isCreateIterator) {
        // replace with modified snippet early and clip snippet to the `factory`
        // call so other arguments aren't minified
        source = source.replace(snippet, modified);
        snippet = modified = modified.replace(/factory\([\s\S]+$/, '');
      }

      // minify snippet variables / arguments
      compiledVars.forEach(function(variable, index) {
        // ensure properties in compiled strings aren't minified
        modified = modified.replace(RegExp('([^.]\\b)' + variable + '\\b(?!\' *[\\]:])', 'g'), '$1' + minNames[index]);

        // correct `typeof x == 'object'`
        if (variable == 'object') {
          modified = modified.replace(RegExp("(typeof [^']+')" + minNames[index] + "'", 'g'), "$1object'");
        }
      });

      // minify `createIterator` option property names
      iteratorOptions.forEach(function(property, index) {
        if (isIteratorTemplate) {
          // minify property names as interpolated template variables
          modified = modified.replace(RegExp('\\b' + property + '\\b', 'g'), minNames[index]);
        }
        else {
          if (property == 'array' || property == 'object') {
            // minify "array" and "object" sub property names
            modified = modified.replace(RegExp("'" + property + "'( *[\\]:])", 'g'), "'" + minNames[index] + "'$1");
          }
          else {
            // minify property name strings
            modified = modified.replace(RegExp("'" + property + "'", 'g'), "'" + minNames[index] + "'");
            // minify property names in regexes and accessors
            if (isCreateIterator) {
              modified = modified.replace(RegExp('([\\.|/])' + property + '\\b' , 'g'), '$1' + minNames[index]);
            }
          }
        }
      });

      // replace with modified snippet
      source = source.replace(snippet, modified);
    });

    return source;
  }

  /*--------------------------------------------------------------------------*/

  // expose `preprocess`
  if (module != require.main) {
    module.exports = preprocess;
  }
  else {
    // read the Lo-Dash source file from the first argument if the script
    // was invoked directly (e.g. `node pre-compile.js source.js`) and write to
    // the same file
    (function() {
      var source = fs.readFileSync(process.argv[2], 'utf8');
      fs.writeFileSync(process.argv[2], preprocess(source), 'utf8');
    }());
  }
}());

redpajama_set_name: RedPajamaGithub


text:
/*
Template Name: Color Admin - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.2.0
Version: 1.3.0
Author: Sean Ngu
Website: http://www.seantheme.com/color-admin-v1.3/
*/var handleSuperboxGallery=function(){"use strict";$(window).load(function(){$(".superbox").SuperBox()})};var Gallery=function(){"use strict";return{init:function(){handleSuperboxGallery()}}}()


text:
/*	$NetBSD: plist.c,v 1.1.1.5 2009/08/06 16:55:28 joerg Exp $	*/

#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <nbcompat.h>
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: plist.c,v 1.1.1.5 2009/08/06 16:55:28 joerg Exp $");

/*
 * FreeBSD install - a package for the installation and maintainance
 * of non-core utilities.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * Jordan K. Hubbard
 * 18 July 1993
 *
 * General packing list routines.
 *
 */

/*-
 * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include "lib.h"
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_ERR_H
#include <err.h>
#endif
#ifndef NETBSD
#include <nbcompat/md5.h>
#else
#include <md5.h>
#endif

static int     delete_with_parents(const char *, Boolean, Boolean);

/* This struct defines a plist command type */
typedef struct cmd_t {
	const char   *c_s;		/* string to recognise */
	pl_ent_t c_type;	/* type of command */
	int     c_argc;		/* # of arguments */
	int     c_subst;	/* can substitute real prefix */
}       cmd_t;

/* Commands to recognise */
static const cmd_t cmdv[] = {
	{"cwd", PLIST_CWD, 1, 1},
	{"src", PLIST_SRC, 1, 1},
	{"exec", PLIST_CMD, 1, 0},
	{"unexec", PLIST_UNEXEC, 1, 0},
	{"mode", PLIST_CHMOD, 1, 0},
	{"owner", PLIST_CHOWN, 1, 0},
	{"group", PLIST_CHGRP, 1, 0},
	{"comment", PLIST_COMMENT, 1, 0},
	{"ignore", PLIST_IGNORE, 0, 0},
	{"name", PLIST_NAME, 1, 0},
	{"display", PLIST_DISPLAY, 1, 0},
	{"pkgdep", PLIST_PKGDEP, 1, 0},
	{"pkgcfl", PLIST_PKGCFL, 1, 0},
	{"pkgdir", PLIST_PKGDIR, 1, 0},
	{"dirrm", PLIST_DIR_RM, 1, 0},
	{"option", PLIST_OPTION, 1, 0},
	{"blddep", PLIST_BLDDEP, 1, 0},
	{NULL, FAIL, 0, 0}
};

/*
 * Add an item to the end of a packing list
 */
void
add_plist(package_t *p, pl_ent_t type, const char *arg)
{
	plist_t *tmp;

	tmp = new_plist_entry();
	tmp->name = (arg == NULL) ? NULL : xstrdup(arg);
	tmp->type = type;
	if (!p->head) {
		p->head = p->tail = tmp;
	} else {
		tmp->prev = p->tail;
		p->tail->next = tmp;
		p->tail = tmp;
	}
}

/*
 * Add an item to the start of a packing list
 */
void
add_plist_top(package_t *p, pl_ent_t type, const char *arg)
{
	plist_t *tmp;

	tmp = new_plist_entry();
	tmp->name = (arg == NULL) ? NULL : xstrdup(arg);
	tmp->type = type;
	if (!p->head) {
		p->head = p->tail = tmp;
	} else {
		tmp->next = p->head;
		p->head->prev = tmp;
		p->head = tmp;
	}
}

/*
 * Return the last (most recent) entry in a packing list
 */
plist_t *
last_plist(package_t *p)
{
	return p->tail;
}

/*
 * Mark all items in a packing list to prevent iteration over them
 */
void
mark_plist(package_t *pkg)
{
	plist_t *pp;

	for (pp = pkg->head; pp; pp = pp->next) {
		pp->marked = TRUE;
	}
}

/*
 * Find a given item in a packing list and, if so, return it (else NULL)
 */
plist_t *
find_plist(package_t *pkg, pl_ent_t type)
{
	plist_t *pp;

	for (pp = pkg->head; pp && pp->type != type; pp = pp->next) {
	}
	return pp;
}

/*
 * Look for a specific boolean option argument in the list
 */
char   *
find_plist_option(package_t *pkg, const char *name)
{
	plist_t *p;

	for (p = pkg->head; p; p = p->next) {
		if (p->type == PLIST_OPTION
		    && strcmp(p->name, name) == 0) {
			return p->name;
		}
	}

	return (char *) NULL;
}

/*
 * Delete plist item 'type' in the list (if 'name' is non-null, match it
 * too.)  If 'all' is set, delete all items, not just the first occurance.
 */
void
delete_plist(package_t *pkg, Boolean all, pl_ent_t type, char *name)
{
	plist_t *p = pkg->head;

	while (p) {
		plist_t *pnext = p->next;

		if (p->type == type && (!name || !strcmp(name, p->name))) {
			free(p->name);
			if (p->prev)
				p->prev->next = pnext;
			else
				pkg->head = pnext;
			if (pnext)
				pnext->prev = p->prev;
			else
				pkg->tail = p->prev;
			free(p);
			if (!all)
				return;
			p = pnext;
		} else
			p = p->next;
	}
}

/*
 * Allocate a new packing list entry, and return a pointer to it.
 */
plist_t *
new_plist_entry(void)
{
	return xcalloc(1, sizeof(plist_t));
}

/*
 * Free an entire packing list
 */
void
free_plist(package_t *pkg)
{
	plist_t *p = pkg->head;

	while (p) {
		plist_t *p1 = p->next;

		free(p->name);
		free(p);
		p = p1;
	}
	pkg->head = pkg->tail = NULL;
}

/*
 * For an ASCII string denoting a plist command, return its code and
 * optionally its argument(s)
 */
static int
plist_cmd(const char *s, char **arg)
{
	const cmd_t *cmdp;
	const char *cp, *sp;
	char *sp2;

	sp = NULL; /* Older GCC can't detect that the loop is executed */

	for (cmdp = cmdv; cmdp->c_s; ++cmdp) {
		for (sp = s, cp = cmdp->c_s; *sp && *cp; ++cp, ++sp)
			if (*sp != *cp)
				break;
		if (*cp == '\0')
			break;
	}

	if (cmdp->c_s == NULL || arg == NULL)
		return cmdp->c_type;

	while (isspace((unsigned char)*sp))
		++sp;
	*arg = xstrdup(sp);
	if (*sp) {
		sp2 = *arg + strlen(*arg) - 1;
		/*
		 * The earlier loop ensured that at least one non-whitespace
		 * is in the string.
		 */
		while (isspace((unsigned char)*sp2))
			--sp2;
		sp2[1] = '\0';
	}
	return cmdp->c_type;
}

/*
 * Parse a packaging list from a memory buffer.
 */
void
parse_plist(package_t *pkg, const char *buf)
{
	int cmd;
	char *line, *cp;
	const char *eol, *next;
	size_t len;

	pkg->head = NULL;
	pkg->tail = NULL;

	for (; *buf; buf = next) {
		/* Until add_plist can deal with trailing whitespace. */
		if ((eol = strchr(buf, '\n')) != NULL) {
			next = eol + 1;
			len = eol - buf;
		} else {
			len = strlen(buf);
			next = buf + len;
		}

		while (len && isspace((unsigned char)buf[len - 1]))
			--len;

		if (len == 0)
			continue;

		line = xmalloc(len + 1);
		memcpy(line, buf, len);
		line[len] = '\0';

		if (*(cp = line) == CMD_CHAR) {
			if ((cmd = plist_cmd(line + 1, &cp)) == FAIL) {
				warnx("Unrecognised PLIST command `%s'", line);
				continue;
			}
			if (*cp == '\0') {
				free(cp);
				cp = NULL;
			}
		} else {
			cmd = PLIST_FILE;
		}
		add_plist(pkg, cmd, cp);
		free(cp);
	}
}

/*
 * Read a packing list from a file
 */
void
append_plist(package_t *pkg, FILE * fp)
{
	char    pline[MaxPathSize];
	char   *cp;
	int     cmd;
	int     len;
	int	free_cp;

	while (fgets(pline, MaxPathSize, fp) != (char *) NULL) {
		for (len = strlen(pline); len &&
		    isspace((unsigned char) pline[len - 1]);) {
			pline[--len] = '\0';
		}
		if (len == 0) {
			continue;
		}
		free_cp = 0;
		if (*(cp = pline) == CMD_CHAR) {
			if ((cmd = plist_cmd(pline + 1, &cp)) == FAIL) {
				warnx("Unrecognised PLIST command `%s'", pline);
				continue;
			}
			if (*cp == '\0') {
				free(cp);
				cp = NULL;
			}
			free_cp = 1;
		} else {
			cmd = PLIST_FILE;
		}
		add_plist(pkg, cmd, cp);
		if (free_cp)
			free(cp);
	}
}

void
read_plist(package_t *pkg, FILE * fp)
{
	pkg->head = NULL;
	pkg->tail = NULL;

	append_plist(pkg, fp);
}

/*
 * Write a packing list to a file, converting commands to ASCII equivs
 */
void
write_plist(package_t *pkg, FILE * fp, char *realprefix)
{
	plist_t *p;
	const cmd_t *cmdp;

	for (p = pkg->head; p; p = p->next) {
		if (p->type == PLIST_FILE) {
			/* Fast-track files - these are the most common */
			(void) fprintf(fp, "%s\n", p->name);
			continue;
		}
		for (cmdp = cmdv; cmdp->c_type != FAIL && cmdp->c_type != p->type; cmdp++) {
		}
		if (cmdp->c_type == FAIL) {
			warnx("Unknown PLIST command type %d (%s)", p->type, p->name);
		} else if (cmdp->c_argc == 0) {
			(void) fprintf(fp, "%c%s\n", CMD_CHAR, cmdp->c_s);
		} else if (cmdp->c_subst && realprefix) {
			(void) fprintf(fp, "%c%s %s\n", CMD_CHAR, cmdp->c_s, realprefix);
		} else {
			(void) fprintf(fp, "%c%s %s\n", CMD_CHAR, cmdp->c_s,
			    (p->name) ? p->name : "");
		}
	}
}

/*
 * Like write_plist, but compute memory string.
 */
void
stringify_plist(package_t *pkg, char **real_buf, size_t *real_len,
    const char *realprefix)
{
	plist_t *p;
	const cmd_t *cmdp;
	char *buf;
	size_t len;
	int item_len;

	/* Pass One: compute output size only. */
	len = 0;

	for (p = pkg->head; p; p = p->next) {
		if (p->type == PLIST_FILE) {
			len += strlen(p->name) + 1;
			continue;
		}
		for (cmdp = cmdv; cmdp->c_type != FAIL && cmdp->c_type != p->type; cmdp++) {
		}
		if (cmdp->c_type == FAIL)
			continue;
		if (cmdp->c_argc == 0)
			len += 1 + strlen(cmdp->c_s) + 1;
		else if (cmdp->c_subst && realprefix)
			len += 1 + strlen(cmdp->c_s) + 1 + strlen(realprefix) + 1;
		else
			len += 1 + strlen(cmdp->c_s) + 1 + strlen(p->name ? p->name : "") + 1;
	}

	/* Pass Two: build actual string. */
	buf = xmalloc(len + 1);
	*real_buf = buf;
	*real_len = len;
	++len;

#define	UPDATE_LEN							\
do {									\
	if (item_len < 0 || (size_t)item_len > len)			\
		errx(2, "Size computation failed, aborted.");		\
	buf += item_len;						\
	len -= item_len;						\
} while (/* CONSTCOND */0)

	for (p = pkg->head; p; p = p->next) {
		if (p->type == PLIST_FILE) {
			/* Fast-track files - these are the most common */
			item_len = snprintf(buf, len, "%s\n", p->name);
			UPDATE_LEN;
			continue;
		}
		for (cmdp = cmdv; cmdp->c_type != FAIL && cmdp->c_type != p->type; cmdp++) {
		}
		if (cmdp->c_type == FAIL) {
			warnx("Unknown PLIST command type %d (%s)", p->type, p->name);
		} else if (cmdp->c_argc == 0) {
			item_len = snprintf(buf, len, "%c%s\n", CMD_CHAR, cmdp->c_s);
			UPDATE_LEN;
		} else if (cmdp->c_subst && realprefix) {
			item_len = snprintf(buf, len, "%c%s %s\n", CMD_CHAR, cmdp->c_s, realprefix);
			UPDATE_LEN;
		} else {
			item_len = snprintf(buf, len, "%c%s %s\n", CMD_CHAR, cmdp->c_s,
			    (p->name) ? p->name : "");
			UPDATE_LEN;
		}
	}

	if (len != 1)
		errx(2, "Size computation failed, aborted.");
}

/*
 * Delete the results of a package installation.
 *
 * This is here rather than in the pkg_delete code because pkg_add needs to
 * run it too in cases of failure.
 */
int
delete_package(Boolean ign_err, package_t *pkg, Boolean NoDeleteFiles,
    const char *destdir)
{
	plist_t *p;
	const char *last_file = "";
	int     fail = SUCCESS;
	Boolean preserve;
	char    tmp[MaxPathSize];
	const char *prefix = NULL, *name = NULL;

	if (!pkgdb_open(ReadWrite)) {
		err(EXIT_FAILURE, "cannot open pkgdb");
	}

	preserve = find_plist_option(pkg, "preserve") ? TRUE : FALSE;

	for (p = pkg->head; p; p = p->next) {
		switch (p->type) {
		case PLIST_NAME:
			name = p->name;
			break;
		case PLIST_CWD:
			if (prefix == NULL)
				prefix = p->name;
			break;
		default:
			break;
		}
	}

	if (name == NULL || prefix == NULL)
		errx(EXIT_FAILURE, "broken PLIST");

	/*
	 * Remove database entries first, directory removal is done
	 * in the main loop below.
	 */
	for (p = pkg->head; p; p = p->next) {
		if (p->type == PLIST_PKGDIR)
			delete_pkgdir(name, prefix, p->name);
	}

	for (p = pkg->head; p; p = p->next) {
		switch (p->type) {
		case PLIST_NAME:
			/* Handled already */
			break;

		case PLIST_PKGDIR:
		case PLIST_DIR_RM:
			(void) snprintf(tmp, sizeof(tmp), "%s/%s",
			    prefix, p->name);
			if (has_pkgdir(tmp))
				continue;
			(void) snprintf(tmp, sizeof(tmp), "%s%s%s/%s",
			    destdir ? destdir : "", destdir ? "/" : "",
			    prefix, p->name);
			if (!fexists(tmp)) {
				if (p->type == PLIST_PKGDIR)
					warnx("Directory `%s' disappeared, skipping", tmp);
			} else if (!isdir(tmp)) {
				warnx("attempting to delete a file `%s' as a directory\n"
				    "this packing list is incorrect - ignoring delete request", tmp);
			} else if (delete_with_parents(tmp, ign_err, TRUE))
				fail = FAIL;
			break;

		case PLIST_IGNORE:
			p = p->next;
			break;

		case PLIST_UNEXEC:
			if (NoDeleteFiles)
				break;
			format_cmd(tmp, sizeof(tmp), p->name, prefix, last_file);
			printf("Executing `%s'\n", tmp);
			if (!Fake && system(tmp)) {
				warnx("unexec command for `%s' failed", tmp);
				fail = FAIL;
			}
			break;

		case PLIST_FILE:
			last_file = p->name;
			(void) snprintf(tmp, sizeof(tmp), "%s%s%s/%s",
			    destdir ? destdir : "", destdir ? "/" : "",
			    prefix, p->name);
			if (isdir(tmp)) {
				warnx("attempting to delete directory `%s' as a file\n"
				    "this packing list is incorrect - ignoring delete request", tmp);
			} else {
				int     restored = 0;	/* restored from preserve? */

				if (p->next && p->next->type == PLIST_COMMENT) {
					if (strncmp(p->next->name, CHECKSUM_HEADER, ChecksumHeaderLen) == 0) {
						char   *cp, buf[LegibleChecksumLen];

						if ((cp = MD5File(tmp, buf)) != NULL) {
							/* Mismatch? */
							if (strcmp(cp, p->next->name + ChecksumHeaderLen) != 0) {
								printf("original MD5 checksum failed, %s: %s\n",
								    Force ? "deleting anyway" : "not deleting", tmp);
								if (!Force) {
									fail = FAIL;
									goto pkgdb_cleanup;
								}
							}
						}
					} else if (strncmp(p->next->name, SYMLINK_HEADER, SymlinkHeaderLen) == 0) {
						char	buf[MaxPathSize + SymlinkHeaderLen];
						int	cc;

						(void) strlcpy(buf, SYMLINK_HEADER,
						    sizeof(buf));
						if ((cc = readlink(tmp, &buf[SymlinkHeaderLen],
							  sizeof(buf) - SymlinkHeaderLen - 1)) < 0) {
							warn("can't readlink `%s'", tmp);
							goto pkgdb_cleanup;
						}
						buf[SymlinkHeaderLen + cc] = 0x0;
						if (strcmp(buf, p->next->name) != 0) {
							if ((cc = readlink(&buf[SymlinkHeaderLen], &buf[SymlinkHeaderLen],
								  sizeof(buf) - SymlinkHeaderLen)) < 0) {
								printf("symlink %s is not same as recorded value, %s: %s\n",
								    buf, Force ? "deleting anyway" : "not deleting", tmp);
								if (!Force) {
									fail = FAIL;
									goto pkgdb_cleanup;
								}
							}
							buf[SymlinkHeaderLen + cc] = 0x0;
							if (strcmp(buf, p->next->name) != 0) {
								printf("symlink %s is not same as recorded value, %s: %s\n",
								    buf, Force ? "deleting anyway" : "not deleting", tmp);
								if (!Force) {
									fail = FAIL;
									goto pkgdb_cleanup;
								}
							}
						}
					}
				}
				if (Verbose && !NoDeleteFiles)
					printf("Delete file %s\n", tmp);
				if (!Fake && !NoDeleteFiles) {
					if (delete_with_parents(tmp, ign_err, FALSE))
						fail = FAIL;
					if (preserve && name) {
						char    tmp2[MaxPathSize];

						if (make_preserve_name(tmp2, MaxPathSize, name, tmp)) {
							if (fexists(tmp2)) {
								if (rename(tmp2, tmp))
									warn("preserve: unable to restore %s as %s",
									    tmp2, tmp);
								else
									restored = 1;
							}
						}
					}
				}

pkgdb_cleanup:
				if (!Fake) {
					if (!restored) {
						errno = 0;
						if (pkgdb_remove(tmp) && errno)
							perror("pkgdb_remove");
					}
				}
			}
			break;
		default:
			break;
		}
	}
	pkgdb_close();
	return fail;
}

/*
 * Selectively delete a hierarchy
 * Returns 1 on error, 0 else.
 */
static int
delete_with_parents(const char *fname, Boolean ign_err, Boolean ign_nonempty)
{
	char   *cp, *cp2;

	if (remove(fname)) {
		if (!ign_err && (!ign_nonempty || errno != ENOTEMPTY))
			warnx("Couldn't remove %s", fname);
		return 0;
	}
	cp = xstrdup(fname);
	while (*cp) {
		if ((cp2 = strrchr(cp, '/')) != NULL)
			*cp2 = '\0';
		if (!isemptydir(cp))
			break;
		if (has_pkgdir(cp))
			break;
		if (rmdir(cp))
			break;
	}
	free(cp);

	return 0;
}

void
add_pkgdir(const char *pkg, const char *prefix, const char *path)
{
	char *fullpath, *oldvalue, *newvalue;

	fullpath = xasprintf("%s/%s", prefix, path);
	oldvalue = pkgdb_retrieve(fullpath);
	if (oldvalue) {
		if (strncmp(oldvalue, "@pkgdir ", 8) != 0)
			errx(EXIT_FAILURE, "Internal error while processing pkgdb, run pkg_admin rebuild");
		newvalue = xasprintf("%s %s", oldvalue, pkg);
		pkgdb_remove(fullpath);
	} else {
		newvalue = xasprintf("@pkgdir %s", pkg);
	}
	pkgdb_store(fullpath, newvalue);

	free(fullpath);
	free(newvalue);
}

void
delete_pkgdir(const char *pkg, const char *prefix, const char *path)
{
	size_t pkg_len, len;
	char *fullpath, *oldvalue, *newvalue, *iter;

	fullpath = xasprintf("%s/%s", prefix, path);
	oldvalue = pkgdb_retrieve(fullpath);
	if (oldvalue && strncmp(oldvalue, "@pkgdir ", 8) == 0) {
		newvalue = xstrdup(oldvalue);
		iter = newvalue + 8;
		pkg_len = strlen(pkg);
		while (*iter) {
			if (strncmp(iter, pkg, pkg_len) == 0 &&
			    (iter[pkg_len] == ' ' || iter[pkg_len] == '\0')) {
				len = strlen(iter + pkg_len);
				memmove(iter, iter + pkg_len + 1, len);
				if (len == 0)
					*iter = '\0';
			} else {
				iter += strcspn(iter, " ");
				iter += strspn(iter, " ");
			}
		}
		pkgdb_remove(fullpath);
		if (iter != newvalue + 8)
			pkgdb_store(fullpath, newvalue);
		free(newvalue);
	}
	free(fullpath);
}

int
has_pkgdir(const char *path)
{
	const char *value;

	value = pkgdb_retrieve(path);

	if (value && strncmp(value, "@pkgdir ", 8) == 0)
		return 1;
	else
		return 0;
}


text:
<package>
  <description brief="ipa_canopen_tutorials">

     ipa_canopen_tutorials

  </description>
  <author>tys</author>
  <license>BSD</license>
  <review status="unreviewed" notes=""/>
  <url>http://ros.org/wiki/ipa_canopen_tutorials</url>
  <depend package="ipa_canopen_ros"/>
  <depend package="std_msgs"/>
  <depend package="control_msgs"/>
  <depend package="kinematics_msgs"/>
  <depend package="pr2_controllers_msgs"/>
  <depend package="brics_actuator"/>
  <depend package="rospy"/>
  <depend package="roscpp"/>
  <depend package="cob_srvs"/>
  <rosdep name="lboost_system"/>
  <rosdep name="lboost_filesystem"/>
  <rosdep name="lpthread"/>
  <rosdep name="lcanopen"/>
  <rosdep name="lpcan"/>

</package>


text:
package org.apereo.cas.oidc.jwks;

import org.apereo.cas.services.OidcRegisteredService;

import com.github.benmanes.caffeine.cache.CacheLoader;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.jose4j.jwk.JsonWebKeySet;
import org.springframework.context.ApplicationContext;

import java.util.Optional;

/**
 * This is {@link OidcRegisteredServiceJsonWebKeystoreCacheLoader}.
 *
 * @author Misagh Moayyed
 * @since 5.1.0
 */
@RequiredArgsConstructor
@Slf4j
public class OidcRegisteredServiceJsonWebKeystoreCacheLoader
    implements CacheLoader<OidcJsonWebKeyCacheKey, Optional<JsonWebKeySet>> {
    private final ApplicationContext applicationContext;

    @Override
    public Optional<JsonWebKeySet> load(final OidcJsonWebKeyCacheKey cacheKey) {
        val service = cacheKey.getRegisteredService();
        if (service instanceof OidcRegisteredService oidcService) {
            val jwks = OidcJsonWebKeyStoreUtils.getJsonWebKeySet(oidcService,
                applicationContext, Optional.of(cacheKey.getUsage()));
            if (jwks.isEmpty() || jwks.get().getJsonWebKeys().isEmpty()) {
                LOGGER.info("Could not determine JSON web keys for service [{}]", oidcService);
                return Optional.empty();
            }
            val requestedKid = Optional.ofNullable(oidcService.getJwksKeyId());
            LOGGER.debug("Locating requested key [{}] for service [{}]", requestedKid, oidcService);
            val keyset = OidcJsonWebKeyStoreUtils.getJsonWebKeyFromJsonWebKeySet(jwks.get(),
                requestedKid, Optional.of(cacheKey.getUsage()));
            keyset.ifPresent(k -> LOGGER.debug("Located requested key [{}] for service [{}]", k, oidcService));
            return keyset;
        }
        return Optional.empty();
    }
}


text:
#ifndef _IGNITE_NETWORK_LINUX_ASYNC_WORKER_THREAD
#define _IGNITE_NETWORK_LINUX_ASYNC_WORKER_THREAD

#include <time.h>

#include <stdint.h>
#include <memory>

#include <ignite/common/concurrent.h>
#include <ignite/impl/interop/interop_memory.h>

#include <ignite/network/async_handler.h>
#include <ignite/network/end_point.h>
#include <ignite/network/tcp_range.h>

#include "network/linux_async_client.h"
#include "network/connecting_context.h"

namespace ignite
{
    namespace network
    {
        class LinuxAsyncClientPool;

        /**
         * Async pool working thread.
         */
        class LinuxAsyncWorkerThread : protected common::concurrent::Thread
        {
        public:
            /**
             * Default constructor.
             */
            LinuxAsyncWorkerThread(LinuxAsyncClientPool& clientPool);

            /**
             * Destructor.
             */
            virtual ~LinuxAsyncWorkerThread();

            /**
             * Start worker thread.
             *
             * @param limit Connection limit.
             * @param addrs Addresses to connect to.
             */
            void Start0(size_t limit, const std::vector<TcpRange>& addrs);

            /**
             * Stop thread.
             */
            void Stop();

        private:
            /**
             * Run thread.
             */
            virtual void Run();

            /**
             * Initiate new connection process if needed.
             */
            void HandleNewConnections();

            /**
             * Handle epoll events.
             */
            void HandleConnectionEvents();

            /**
             * Handle network error during connection establishment.
             *
             * @param addr End point.
             * @param msg Error message.
             */
            void ReportConnectionError(const EndPoint& addr, const std::string& msg);

            /**
             * Handle failed connection.
             *
             * @param msg Error message.
             */
            void HandleConnectionFailed(const std::string& msg);

            /**
             * Handle network error on established connection.
             *
             * @param client Client instance.
             */
            void HandleConnectionClosed(LinuxAsyncClient* client);

            /**
             * Handle successfully established connection.
             *
             * @param client Client instance.
             */
            void HandleConnectionSuccess(LinuxAsyncClient* client);

            /**
             * Calculate connection timeout.
             *
             * @return Connection timeout.
             */
            int CalculateConnectionTimeout() const;

            /**
             * Check whether new connection should be initiated.
             *
             * @return @c true if new connection should be initiated.
             */
            bool ShouldInitiateNewConnection() const;

            /** Client pool. */
            LinuxAsyncClientPool& clientPool;

            /** Flag indicating that thread is stopping. */
            bool stopping;

            /** Client epoll file descriptor. */
            int epoll;

            /** Stop event file descriptor. */
            int stopEvent;

            /** Addresses to use for connection establishment. */
            std::vector<TcpRange> nonConnected;

            /** Connection which is currently in connecting process. */
            std::auto_ptr<ConnectingContext> currentConnection;

            /** Currently connected client. */
            SP_LinuxAsyncClient currentClient;

            /** Failed connection attempts. */
            size_t failedAttempts;

            /** Last connection time. */
            timespec lastConnectionTime;

            /** Minimal number of addresses. */
            size_t minAddrs;
        };
    }
}

#endif //_IGNITE_NETWORK_LINUX_ASYNC_WORKER_THREAD


text:
package hudson.plugins.repo;

import hudson.model.Run;
import hudson.scm.AbstractScmTagAction;

import org.kohsuke.stapler.export.ExportedBean;

/**
 * A Tag Action allows a user to tag a build. Repo doesn't support a solid tag
 * method, so right now we just display the static manifest information needed
 * to recreate the exact state of the repository when the build was ran.
 */
@ExportedBean(defaultVisibility = 999)
public class TagAction extends AbstractScmTagAction {

	/**
	 * Constructs the tag action object. Just call the superclass.
	 *
	 * @param build
	 *            Build which we are interested in tagging
	 */
	TagAction(final Run<?, ?> build) {
		super(build);
	}

	/**
	 * Returns the filename to use as the badge. Called by the default badge
	 * jelly file.
	 */
	public String getIconFileName() {
		// TODO: return null if we don't want to show a link (no permissions?)
		// TODO: if we later support actual tagging, we can use star-gold.gif
		// for already tagged builds
		return "star.gif";
	}

	/**
	 * Returns the display name to use for the tag action. Called by the default
	 * badge jelly file.
	 */
	public String getDisplayName() {
		// TODO: adjust name based on build state (tagged already or not)?
		return "Repo Manifest";
	}

	@Override
	public String getTooltip() {
		// TODO: Do we want a custom tool tip?
		return super.getTooltip();
	}

	@Override
	public boolean isTagged() {
		// TODO Support some form of tagging in the future?
		return false;
	}

	/**
	 * Gets a String representation of the static manifest for this repo
	 * snapshot.
	 */
    public String getManifest() {
        final RevisionState revisionState =
            getRun().getAction(RevisionState.class);
		return revisionState.getManifest();
	}
}


text:
<?php

namespace Ibw\JobeetBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class JobType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('type')
            ->add('company')
            ->add('logo')
            ->add('url')
            ->add('position')
            ->add('location')
            ->add('description')
            ->add('how_to_apply')
            ->add('token')
            ->add('is_public')
            ->add('is_activated')
            ->add('email')
            ->add('expires_at')
            ->add('created_at')
            ->add('updated_at')
            ->add('category')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Ibw\JobeetBundle\Entity\Job'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'ibw_jobeetbundle_job';
    }
}


text:
FOUNDATION_EXPORT double Pods_FlatironGoTestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_FlatironGoTestsVersionString[];


text:
Internet Button Code

        #include <LiquidCrystal.h>
#include <OneWire.h>
#include <DallasTemperature.h>

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

int tempPin = 3;
int lightPin = 2;
int upPin = 4;
int downPin = 5;

int upState = HIGH;      // the current state of the output pin
int upReading;           // the current reading from the input pin
int upPrevious = LOW;    // the previous reading from the input pin

int downState = HIGH;      // the current state of the output pin
int downReading;           // the current reading from the input pin
int downPrevious = LOW;    // the previous reading from the input pin

long upTime = 0;         // the last time the output pin was toggled
long downTime = 0;         // the last time the output pin was toggled
long debounce = 50;  // the debounce time, increase if the output flickers

float targetTemp = 200.00; // F taget temp
float threshold = 3.00;
float increment = 5.00;
float highThreshold;
float lowThreshold;

// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 3

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature tempSensors(&oneWire);

void setup()
{
	Serial.begin(9600);

	// Setup LCD
	lcd.begin(16, 2);

	// Set light/heat to output
	pinMode(lightPin, OUTPUT);
	pinMode(upPin, INPUT_PULLUP);
	pinMode(downPin, INPUT_PULLUP);

	// Turn on Heatsource on to start
	digitalWrite(lightPin, LOW);

	// Set thresholds
	setThresholds();

	displayTargetMessage();

	// Start up the library
	tempSensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement

}

void loop()
{
	readButton(upPin, "UP");

	readButton(downPin, "DOWN");

	float reading = readTempSensor();

	reportTemp(reading);

	toggleHeat(reading);
}

void readButton(int buttonPin, String button)
{
	int reading = digitalRead(buttonPin);

	// if the input just went from LOW and HIGH and we've waited long enough
	// to ignore any noise on the circuit, toggle the output pin and remember
	// the time
	if (button == "UP")
	{
		if (reading == LOW && upPrevious == HIGH && millis() - upTime > debounce) {
			if (upState == LOW)
				upState = HIGH;
			else
				upState = LOW;

			upTime = millis();
			Serial.println("Up button pushed");
			targetTemp += increment;
			setThresholds();
			displayTargetMessage();
		}

		upPrevious = reading;
	}

	if (button == "DOWN")
	{
		if (reading == LOW && downPrevious == HIGH && millis() - downTime > debounce) {
			if (downState == LOW)
				downState = HIGH;
			else
				downState = LOW;

			downTime = millis();
			Serial.println("Down button pushed");
			targetTemp -= increment;
			setThresholds();
			displayTargetMessage();
		}

		downPrevious = reading;
	}
}

void setThresholds()
{
	highThreshold = targetTemp + threshold;
	lowThreshold = targetTemp - threshold;
}

void toggleHeat(float temp)
{
	if (temp >= highThreshold)
	{
		// turn off
		digitalWrite(lightPin, HIGH);
	}
	else if (temp <= lowThreshold)
	{
		// turn on
		digitalWrite(lightPin, LOW);
	}
}

void reportTemp(float temp)
{
	Serial.print(temp);
	Serial.println(" F");

	lcd.setCursor(0, 1);
	String message = "Current: ";
	message += temp;
	message += " F";
	lcd.print(message);
}

float readTempSensor()
{
	float temp = 0;
	tempSensors.requestTemperatures();
	temp = tempSensors.getTempFByIndex(0);

	return temp;
}

void displayTargetMessage()
{
	lcd.setCursor(0, 0);
	String message = "Target: ";
	message += targetTemp;
	message += " F";
	lcd.print(message);
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>gameanalysis.merge module — Game Analysis 5.3.0 documentation</title>
    <link rel="stylesheet" href="_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="gameanalysis.nash module" href="gameanalysis.nash.html" />
    <link rel="prev" title="gameanalysis.matgame module" href="gameanalysis.matgame.html" />

Navigation

          index

          modules |

          next |

          previous |

Game Analysis 5.3.0 documentation »

gameanalysis package »

gameanalysis.merge module¶

class gameanalysis.merge.MergeGame(game1, game2, t)[source]¶

Bases: gameanalysis.rsgame.RsGame

A Game representing the t merger between two other games

Payoffs in this game are simply the weighted fraction of payoffs from game1
and game2 such that the interpolation is smooth.

deviation_payoffs(mix, *, jacobian=False)[source]¶

get_payoffs(profile)[source]¶

max_strat_payoffs()[source]¶

min_strat_payoffs()[source]¶

normalize()[source]¶

num_complete_profiles¶

num_profiles¶

payoffs[source]¶

profiles[source]¶

restrict(rest)[source]¶

to_json()[source]¶

gameanalysis.merge.merge(game1, game2, t)[source]¶

Merge two games by a t fraction

<col class="field-name" />
<col class="field-body" />

Parameters:

game1 (RsGame) – The first game to merge.

game2 (RsGame) – The second game to merge.

t (float) – The fraction to merge the games. 0 corresponds to a copy of game1, 1
corresponds to game2, and somewhere between corresponds to the linear
interpolation between them.

gameanalysis.merge.merge_json(jgame)[source]¶

Read a merged game from json

gameanalysis.merge.trace_equilibria(game1, game2, t, eqm, *, regret_thresh=0.0001, singular=1e-07)[source]¶

Trace an equilibrium between games

Takes two games, a fraction that they're merged, and an equilibrium of the
merged game, and traces the equilibrium out to nearby merged games.

<col class="field-name" />
<col class="field-body" />

Parameters:

game1 (RsGame) – The first game that's merged. Represents the payoffs when t is 0.

game1 – The second game that's merged. Represents the payoffs when t is 1.

t (float) – The amount that the two games are merged such that eqm is an
equilibrium. Must be in [0, 1].

eqm (ndarray) – An equilibrium when game1 and game2 are merged a t fraction.

regret_thresh (float, optional) – The amount of gain from deviating to a strategy outside support can
have before it's considered a beneficial deviation and the tracing
stops. This should be larger than zero as most equilibria are
approximate due to floating point precision.

singular (float, optional) – An absolute determinant below this value is considered singular.
Occasionally the derivative doesn't exist, and this is one way in which
that manifests. This values regulate when ODE solving terminates due to
a singular matrix.

Previous topic

gameanalysis.matgame module

Next topic

gameanalysis.nash module

This Page

Show Source

Quick search

    <form class="search" action="search.html" method="get">

<input type="text" name="q" />

<input type="submit" value="Go" />

      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

Navigation

          index

          modules |

          next |

          previous |

Game Analysis 5.3.0 documentation »

gameanalysis package »

        © Copyright 2018, Strategic Reasoning Group.
      Created using Sphinx 1.6.5.


text:
// Copyright (C) 2013 Peter Magnusson
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MoJ
{
    static class Current
    {
        public static MoJ.Config Config = MoJ.Config.LoadConfig();
    }
}


text:
import numpy as np
import tensorflow as tf

from absl.testing import absltest

from datadrivenpdes.advection import equations as advection_equations
from datadrivenpdes.core import grids
from datadrivenpdes.core import integrate
from datadrivenpdes.core import models

tf.enable_eager_execution()

class IntegrateTest(absltest.TestCase):

  def setUp(self):
    grid_size = 200
    self.grid = grids.Grid(grid_size, grid_size, 2 * np.pi / grid_size)
    self.finite_vol_eq = (
        advection_equations.FiniteVolumeAdvectionDiffusion(0.05))
    self.finite_diff_eq = (
        advection_equations.FiniteDifferenceAdvectionDiffusion(0.05))
    self.upwind_eq = (
        advection_equations.UpwindAdvectionDiffusion(0.05))
    self.base_vol_model = models.FiniteDifferenceModel(
        self.finite_vol_eq, self.grid)
    self.base_diff_model = models.FiniteDifferenceModel(
        self.finite_diff_eq, self.grid)
    self.base_upwind_model = models.FiniteDifferenceModel(
        self.upwind_eq, self.grid)

  def _integrate(self, equation, model, grid, times, xla_compile=False):
    params = dict(
        concentration=dict(method='sum_of_gaussians', gaussian_width=0.5),
    )
    init_state = equation.random_state(seed=1, grid=grid, params=params)
    return integrate.integrate_times(model, init_state, times,
                                     xla_compile=xla_compile)

  def _test_sample_run(self, equation, model, grid):
    times = np.linspace(0, 50 * equation.get_time_step(grid), 11)
    evolved_states = self._integrate(equation, model, grid, times)
    self.assertEqual(equation.base_keys, set(evolved_states))
    self.assertEqual(evolved_states['concentration'].shape,
                     (11,) + self.grid.shape)

  def test_sample_run_finite_volume_equation(self):
    self._test_sample_run(self.finite_vol_eq, self.base_vol_model, self.grid)

  def test_sample_run_finite_difference_equation(self):
    self._test_sample_run(self.finite_diff_eq, self.base_diff_model, self.grid)

  def test_sample_run_upwind_equation(self):
    self._test_sample_run(self.upwind_eq, self.base_upwind_model, self.grid)

  def test_all_close(self):
    times = np.arange(10) * self.finite_diff_eq.get_time_step(self.grid)
    solution_diff = self._integrate(
        self.finite_diff_eq, self.base_diff_model, self.grid, times)
    solution_vol = self._integrate(
        self.finite_vol_eq, self.base_vol_model, self.grid, times)
    solution_upwind = self._integrate(
        self.upwind_eq, self.base_upwind_model, self.grid, times)
    np.testing.assert_allclose(
        solution_diff['concentration'][-1], solution_vol['concentration'][-1],
        atol=0.001, rtol=0.01,
    )
    np.testing.assert_allclose(
        solution_upwind['concentration'][-1], solution_vol['concentration'][-1],
        atol=0.001, rtol=0.01,
    )

  def test_xla(self):
    eq = self.finite_diff_eq
    model = self.base_diff_model
    times = np.arange(10) * eq.get_time_step(self.grid)
    solution_no_xla = self._integrate(eq, model, self.grid, times,
                                      xla_compile=False)
    solution_with_xla = self._integrate(eq, model, self.grid, times,
                                        xla_compile=True)
    np.testing.assert_allclose(
        solution_no_xla['concentration'][-1],
        solution_with_xla['concentration'][-1],
        atol=1e-7
    )

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


text:
package io.fouad.jtb.core.beans;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Upon receiving a message with this object, Telegram
 * clients will hide the current custom keyboard and
 * display the default letter-keyboard. By default,
 * custom keyboards are displayed until a new keyboard
 * is sent by a bot. An exception is made for one-time
 * keyboards that are hidden immediately after the user
 * presses a button.
 */
public class ReplyKeyboardHide extends ReplyMarkup
{
	/**
	 * Requests clients to hide the custom keyboard.
	 */
	@JsonProperty("hide_keyboard")
	private final boolean hideKeyboard = true;

	/**
	 * Optional. Use this parameter if you want to hide
	 * keyboard for specific users only. Targets: 1) users
	 * that are @mentioned in the text of the Message
	 * object; 2) if the bot's message is a reply (has
	 * reply_to_message_id), sender of the original message.
	 *
	 * Example: A user votes in a poll, bot returns confirmation
	 * message in reply to the vote and hides keyboard for that
	 * user, while still showing the keyboard with poll options
	 * to users who haven't voted yet.
	 */
	@JsonProperty("selective")
	private Boolean selective;

	public ReplyKeyboardHide()
	{
		this(null);
	}

	public ReplyKeyboardHide(Boolean selective)
	{
		this.selective = selective;
	}

	public boolean isHideKeyboard(){return hideKeyboard;}

	public Boolean getSelective(){return selective;}
	public void setSelective(Boolean selective){this.selective = selective;}

	@Override
	public boolean equals(Object o)
	{
		if(this == o) return true;
		if(o == null || getClass() != o.getClass()) return false;

		ReplyKeyboardHide that = (ReplyKeyboardHide) o;

		return selective != null ? selective.equals(that.selective) : that.selective == null;
	}

	@Override
	public int hashCode()
	{
		return 31 * (selective != null ? selective.hashCode() : 0);
	}

	@Override
	public String toString()
	{
		return "ReplyKeyboardHide{" +
				"hideKeyboard=" + hideKeyboard +
				", selective=" + selective +
				'}';
	}
}


text:
namespace Harness.SourceMapRecorder {

    interface SourceMapSpanWithDecodeErrors {
        sourceMapSpan: ts.SourceMapSpan;
        decodeErrors: string[] | undefined;
    }

    namespace SourceMapDecoder {
        let sourceMapMappings: string;
        let decodingIndex: number;
        let mappings: ts.sourcemaps.MappingsDecoder | undefined;

        export interface DecodedMapping {
            sourceMapSpan: ts.SourceMapSpan;
            error?: string;
        }

        export function initializeSourceMapDecoding(sourceMapData: ts.SourceMapData) {
            decodingIndex = 0;
            sourceMapMappings = sourceMapData.sourceMapMappings;
            mappings = ts.sourcemaps.decodeMappings({
                version: 3,
                file: sourceMapData.sourceMapFile,
                sources: sourceMapData.sourceMapSources,
                sourceRoot: sourceMapData.sourceMapSourceRoot,
                sourcesContent: sourceMapData.sourceMapSourcesContent,
                mappings: sourceMapData.sourceMapMappings,
                names: sourceMapData.sourceMapNames
            });
        }

        export function decodeNextEncodedSourceMapSpan(): DecodedMapping {
            if (!mappings) return ts.Debug.fail("not initialized");
            const result = mappings.next();
            if (result.done) return { error: mappings.error || "No encoded entry found", sourceMapSpan: mappings.lastSpan };
            return { sourceMapSpan: result.value };
        }

        export function hasCompletedDecoding() {
            if (!mappings) return ts.Debug.fail("not initialized");
            return mappings.decodingIndex === sourceMapMappings.length;
        }

        export function getRemainingDecodeString() {
            return sourceMapMappings.substr(decodingIndex);
        }
    }

    namespace SourceMapSpanWriter {
        let sourceMapRecorder: Compiler.WriterAggregator;
        let sourceMapSources: string[];
        let sourceMapNames: string[] | undefined;

        let jsFile: documents.TextDocument;
        let jsLineMap: ReadonlyArray<number>;
        let tsCode: string;
        let tsLineMap: number[];

        let spansOnSingleLine: SourceMapSpanWithDecodeErrors[];
        let prevWrittenSourcePos: number;
        let nextJsLineToWrite: number;
        let spanMarkerContinues: boolean;

        export function initializeSourceMapSpanWriter(sourceMapRecordWriter: Compiler.WriterAggregator, sourceMapData: ts.SourceMapData, currentJsFile: documents.TextDocument) {
            sourceMapRecorder = sourceMapRecordWriter;
            sourceMapSources = sourceMapData.sourceMapSources;
            sourceMapNames = sourceMapData.sourceMapNames;

            jsFile = currentJsFile;
            jsLineMap = jsFile.lineStarts;

            spansOnSingleLine = [];
            prevWrittenSourcePos = 0;
            nextJsLineToWrite = 0;
            spanMarkerContinues = false;

            SourceMapDecoder.initializeSourceMapDecoding(sourceMapData);

            sourceMapRecorder.WriteLine("===================================================================");
            sourceMapRecorder.WriteLine("JsFile: " + sourceMapData.sourceMapFile);
            sourceMapRecorder.WriteLine("mapUrl: " + sourceMapData.jsSourceMappingURL);
            sourceMapRecorder.WriteLine("sourceRoot: " + sourceMapData.sourceMapSourceRoot);
            sourceMapRecorder.WriteLine("sources: " + sourceMapData.sourceMapSources);
            if (sourceMapData.sourceMapSourcesContent) {
                sourceMapRecorder.WriteLine("sourcesContent: " + JSON.stringify(sourceMapData.sourceMapSourcesContent));
            }
            sourceMapRecorder.WriteLine("===================================================================");
        }

        function getSourceMapSpanString(mapEntry: ts.SourceMapSpan, getAbsentNameIndex?: boolean) {
            let mapString = "Emitted(" + (mapEntry.emittedLine + 1) + ", " + (mapEntry.emittedColumn + 1) + ") Source(" + (mapEntry.sourceLine + 1) + ", " + (mapEntry.sourceColumn + 1) + ") + SourceIndex(" + mapEntry.sourceIndex + ")";
            if (mapEntry.nameIndex! >= 0 && mapEntry.nameIndex! < sourceMapNames!.length) {
                mapString += " name (" + sourceMapNames![mapEntry.nameIndex!] + ")";
            }
            else {
                if ((mapEntry.nameIndex && mapEntry.nameIndex !== -1) || getAbsentNameIndex) {
                    mapString += " nameIndex (" + mapEntry.nameIndex + ")";
                }
            }

            return mapString;
        }

        export function recordSourceMapSpan(sourceMapSpan: ts.SourceMapSpan) {
            // verify the decoded span is same as the new span
            const decodeResult = SourceMapDecoder.decodeNextEncodedSourceMapSpan();
            let decodeErrors: string[] | undefined;
            if (typeof decodeResult.error === "string"
                || decodeResult.sourceMapSpan.emittedLine   !== sourceMapSpan.emittedLine
                || decodeResult.sourceMapSpan.emittedColumn !== sourceMapSpan.emittedColumn
                || decodeResult.sourceMapSpan.sourceLine    !== sourceMapSpan.sourceLine
                || decodeResult.sourceMapSpan.sourceColumn  !== sourceMapSpan.sourceColumn
                || decodeResult.sourceMapSpan.sourceIndex   !== sourceMapSpan.sourceIndex
                || decodeResult.sourceMapSpan.nameIndex     !== sourceMapSpan.nameIndex) {
                if (decodeResult.error) {
                    decodeErrors = ["!!^^ !!^^ There was decoding error in the sourcemap at this location: " + decodeResult.error];
                }
                else {
                    decodeErrors = ["!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:"];
                }
                decodeErrors.push("!!^^ !!^^ Decoded span from sourcemap's mappings entry: " + getSourceMapSpanString(decodeResult.sourceMapSpan, /*getAbsentNameIndex*/ true) + " Span encoded by the emitter:" + getSourceMapSpanString(sourceMapSpan, /*getAbsentNameIndex*/ true));
            }

            if (spansOnSingleLine.length && spansOnSingleLine[0].sourceMapSpan.emittedLine !== sourceMapSpan.emittedLine) {
                // On different line from the one that we have been recording till now,
                writeRecordedSpans();
                spansOnSingleLine = [];
            }
            spansOnSingleLine.push({ sourceMapSpan, decodeErrors });
        }

        export function recordNewSourceFileSpan(sourceMapSpan: ts.SourceMapSpan, newSourceFileCode: string) {
            assert.isTrue(spansOnSingleLine.length === 0 || spansOnSingleLine[0].sourceMapSpan.emittedLine !== sourceMapSpan.emittedLine, "new file source map span should be on new line. We currently handle only that scenario");
            recordSourceMapSpan(sourceMapSpan);

            assert.isTrue(spansOnSingleLine.length === 1);
            sourceMapRecorder.WriteLine("-------------------------------------------------------------------");
            sourceMapRecorder.WriteLine("emittedFile:" + jsFile.file);
            sourceMapRecorder.WriteLine("sourceFile:" + sourceMapSources[spansOnSingleLine[0].sourceMapSpan.sourceIndex]);
            sourceMapRecorder.WriteLine("-------------------------------------------------------------------");

            tsLineMap = ts.computeLineStarts(newSourceFileCode);
            tsCode = newSourceFileCode;
            prevWrittenSourcePos = 0;
        }

        export function close() {
            // Write the lines pending on the single line
            writeRecordedSpans();

            if (!SourceMapDecoder.hasCompletedDecoding()) {
                sourceMapRecorder.WriteLine("!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded");
                sourceMapRecorder.WriteLine("!!!! **** Remaining decoded string: " + SourceMapDecoder.getRemainingDecodeString());

            }

            // write remaining js lines
            writeJsFileLines(jsLineMap.length);
        }

        function getTextOfLine(line: number, lineMap: ReadonlyArray<number>, code: string) {
            const startPos = lineMap[line];
            const endPos = lineMap[line + 1];
            const text = code.substring(startPos, endPos);
            return line === 0 ? utils.removeByteOrderMark(text) : text;
        }

        function writeJsFileLines(endJsLine: number) {
            for (; nextJsLineToWrite < endJsLine; nextJsLineToWrite++) {
                sourceMapRecorder.Write(">>>" + getTextOfLine(nextJsLineToWrite, jsLineMap, jsFile.text));
            }
        }

        function writeRecordedSpans() {
            const markerIds: string[] = [];

            function getMarkerId(markerIndex: number) {
                let markerId = "";
                if (spanMarkerContinues) {
                    assert.isTrue(markerIndex === 0);
                    markerId = "1->";
                }
                else {
                    markerId = "" + (markerIndex + 1);
                    if (markerId.length < 2) {
                        markerId = markerId + " ";
                    }
                    markerId += ">";
                }
                return markerId;
            }

            let prevEmittedCol!: number;
            function iterateSpans(fn: (currentSpan: SourceMapSpanWithDecodeErrors, index: number) => void) {
                prevEmittedCol = 0;
                for (let i = 0; i < spansOnSingleLine.length; i++) {
                    fn(spansOnSingleLine[i], i);
                    prevEmittedCol = spansOnSingleLine[i].sourceMapSpan.emittedColumn;
                }
            }

            function writeSourceMapIndent(indentLength: number, indentPrefix: string) {
                sourceMapRecorder.Write(indentPrefix);
                for (let i = 0; i < indentLength; i++) {
                    sourceMapRecorder.Write(" ");
                }
            }

            function writeSourceMapMarker(currentSpan: SourceMapSpanWithDecodeErrors, index: number, endColumn = currentSpan.sourceMapSpan.emittedColumn, endContinues = false) {
                const markerId = getMarkerId(index);
                markerIds.push(markerId);

                writeSourceMapIndent(prevEmittedCol, markerId);

                for (let i = prevEmittedCol; i < endColumn; i++) {
                    sourceMapRecorder.Write("^");
                }
                if (endContinues) {
                    sourceMapRecorder.Write("->");
                }
                sourceMapRecorder.WriteLine("");
                spanMarkerContinues = endContinues;
            }

            function writeSourceMapSourceText(currentSpan: SourceMapSpanWithDecodeErrors, index: number) {
                const sourcePos = tsLineMap[currentSpan.sourceMapSpan.sourceLine] + (currentSpan.sourceMapSpan.sourceColumn);
                let sourceText = "";
                if (prevWrittenSourcePos < sourcePos) {
                    // Position that goes forward, get text
                    sourceText = tsCode.substring(prevWrittenSourcePos, sourcePos);
                }

                if (currentSpan.decodeErrors) {
                    // If there are decode errors, write
                    for (const decodeError of currentSpan.decodeErrors) {
                        writeSourceMapIndent(prevEmittedCol, markerIds[index]);
                        sourceMapRecorder.WriteLine(decodeError);
                    }
                }

                const tsCodeLineMap = ts.computeLineStarts(sourceText);
                for (let i = 0; i < tsCodeLineMap.length; i++) {
                    writeSourceMapIndent(prevEmittedCol, i === 0 ? markerIds[index] : "  >");
                    sourceMapRecorder.Write(getTextOfLine(i, tsCodeLineMap, sourceText));
                    if (i === tsCodeLineMap.length - 1) {
                        sourceMapRecorder.WriteLine("");
                    }
                }

                prevWrittenSourcePos = sourcePos;
            }

            function writeSpanDetails(currentSpan: SourceMapSpanWithDecodeErrors, index: number) {
                sourceMapRecorder.WriteLine(markerIds[index] + getSourceMapSpanString(currentSpan.sourceMapSpan));
            }

            if (spansOnSingleLine.length) {
                const currentJsLine = spansOnSingleLine[0].sourceMapSpan.emittedLine;

                // Write js line
                writeJsFileLines(currentJsLine + 1);

                // Emit markers
                iterateSpans(writeSourceMapMarker);

                const jsFileText = getTextOfLine(currentJsLine + 1, jsLineMap, jsFile.text);
                if (prevEmittedCol < jsFileText.length - 1) {
                    // There is remaining text on this line that will be part of next source span so write marker that continues
                    writeSourceMapMarker(/*currentSpan*/ undefined!, spansOnSingleLine.length, /*endColumn*/ jsFileText.length - 1, /*endContinues*/ true); // TODO: GH#18217
                }

                // Emit Source text
                iterateSpans(writeSourceMapSourceText);

                // Emit column number etc
                iterateSpans(writeSpanDetails);

                sourceMapRecorder.WriteLine("---");
            }
        }
    }

    export function getSourceMapRecord(sourceMapDataList: ReadonlyArray<ts.SourceMapData>, program: ts.Program, jsFiles: ReadonlyArray<documents.TextDocument>, declarationFiles: ReadonlyArray<documents.TextDocument>) {
        const sourceMapRecorder = new Compiler.WriterAggregator();

        for (let i = 0; i < sourceMapDataList.length; i++) {
            const sourceMapData = sourceMapDataList[i];
            let prevSourceFile: ts.SourceFile | undefined;
            let currentFile: documents.TextDocument;
            if (ts.endsWith(sourceMapData.sourceMapFile, ts.Extension.Dts)) {
                if (sourceMapDataList.length > jsFiles.length) {
                    currentFile = declarationFiles[Math.floor(i / 2)]; // When both kinds of source map are present, they alternate js/dts
                }
                else {
                    currentFile = declarationFiles[i];
                }
            }
            else {
                if (sourceMapDataList.length > jsFiles.length) {
                    currentFile = jsFiles[Math.floor(i / 2)];
                }
                else {
                    currentFile = jsFiles[i];
                }
            }

            SourceMapSpanWriter.initializeSourceMapSpanWriter(sourceMapRecorder, sourceMapData, currentFile);
            const mapper = ts.sourcemaps.decodeMappings({ mappings: sourceMapData.sourceMapMappings, sources: sourceMapData.sourceMapSources });
            for (let { value: decodedSourceMapping, done } = mapper.next(); !done; { value: decodedSourceMapping, done } = mapper.next()) {
                const currentSourceFile = program.getSourceFile(sourceMapData.inputSourceFileNames[decodedSourceMapping.sourceIndex])!;
                if (currentSourceFile !== prevSourceFile) {
                    SourceMapSpanWriter.recordNewSourceFileSpan(decodedSourceMapping, currentSourceFile.text);
                    prevSourceFile = currentSourceFile;
                }
                else {
                    SourceMapSpanWriter.recordSourceMapSpan(decodedSourceMapping);
                }
            }
            SourceMapSpanWriter.close(); // If the last spans werent emitted, emit them
        }
        sourceMapRecorder.Close();
        return sourceMapRecorder.lines.join("\r\n");
    }
}


text:
.Body {
    color: #463c3c;
    font-family: 'ArialMT', 'Arial', sans-serif;
    font-size: 15px;
    font-style: normal;
    font-variant: normal;
    font-weight: normal;
    letter-spacing: 0;
    line-height: 20px;
    margin-bottom: 0px;
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 0px;
    opacity: 1.00;
    padding-bottom: 0px;
    padding-top: 0px;
    text-align: left;
    text-decoration: none;
    text-indent: 0px;
    text-transform: none;
}
.Free_Form {
    color: #463c3c;
    font-family: 'ArialMT', 'Arial', sans-serif;
    font-size: 15px;
    font-style: normal;
    font-variant: normal;
    font-weight: normal;
    letter-spacing: 0;
    line-height: 20px;
    margin-bottom: 0px;
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 0px;
    opacity: 1.00;
    padding-bottom: 0px;
    padding-top: 0px;
    text-align: left;
    text-decoration: none;
    text-indent: 0px;
    text-transform: none;
}
.style_SkipStrokeSkipFillSkipOpacity {
}
.style_SkipStroke {
    background: transparent;
    opacity: 1.00;
}
.paragraph_style {
    color: #463c3c;
    font-family: 'ArialMT', 'Arial', sans-serif;
    font-size: 15px;
    font-style: normal;
    font-variant: normal;
    font-weight: normal;
    letter-spacing: 0;
    line-height: 17px;
    margin-bottom: 0px;
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 0px;
    opacity: 1.00;
    padding-bottom: 0px;
    padding-top: 0px;
    text-align: left;
    text-decoration: none;
    text-indent: 0px;
    text-transform: none;
}
.style_SkipStroke_1 {
    background: transparent;
    opacity: 1.00;
}
.style {
    font-family: 'LucidaGrande', 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
    font-size: 12px;
    line-height: 18px;
}
.graphic_generic_title_textbox_style_default_SkipStrokeSkipFillSkipOpacity {
}
.graphic_image_style_default_SkipStroke {
    background: transparent;
    opacity: 1.00;
}
.graphic_textbox_layout_style_default {
    padding: 4px;
}
.graphic_textbox_layout_style_default_External_630_221 {
    position: relative;
}
.graphic_textbox_style_default_SkipStroke {
    background: transparent;
    opacity: 1.00;
}
a {
    color: #463c3c;
    text-decoration: underline;
}
a:visited {
    color: #666666;
    text-decoration: underline;
}
a:hover {
    color: #000000;
    text-decoration: underline;
}
.bumper {
    font-size: 1px;
    line-height: 1px;
}
.spacer {
    font-size: 1px;
    line-height: 1px;
}
body {
    -webkit-text-size-adjust: none;
}
div {
    overflow: visible;
}
img {
    border: none;
}
.InlineBlock {
    display: inline;
}
.InlineBlock {
    display: inline-block;
}
.inline-block {
    display: inline-block;
    vertical-align: baseline;
    margin-bottom:0.3em;
}
.vertical-align-middle-middlebox {
    display: table;
}
.vertical-align-middle-innerbox {
    display: table-cell;
    vertical-align: middle;
}
div.paragraph {
    position: relative;
}
li.full-width {
    width: 100;
}


text:
'use strict';

const models = require('./index');

/**
 * Target devices based on an integer tag value.
 *
 * @extends models['Criterion']
 */
class IntegerTagCriterion extends models['Criterion'] {
  /**
   * Create a IntegerTagCriterion.
   * @member {string} [name] The name of the custom tag.
   * @member {number} [value] A custom integer value to match.
   * @member {string} [op] comparison operator: `EQ` (equal to), `LT` (less
   * than), `GT` (greater than), `LE` (less than or equal to) or `GE` (greater
   * than or equal to). Possible values include: 'EQ', 'LT', 'GT', 'LE', 'GE'
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of IntegerTagCriterion
   *
   * @returns {object} metadata of IntegerTagCriterion
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'integer-tag',
      type: {
        name: 'Composite',
        className: 'IntegerTagCriterion',
        modelProperties: {
          type: {
            required: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          value: {
            required: false,
            serializedName: 'value',
            type: {
              name: 'Number'
            }
          },
          op: {
            required: false,
            serializedName: 'op',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = IntegerTagCriterion;


text:
using System.Web.Mvc;

namespace Platibus.SampleWebApp.Controllers
{
    public class LogsController : Controller
    {
        [HttpGet]
        public ActionResult Index()
        {
            return View(DiagnosticEventLog.SingletonInstance.EmittedEvents);
        }
    }
}


text:
.class synthetic Landroid/webkit/CallbackProxy$1;
.super Ljava/lang/Object;
.source "CallbackProxy.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/webkit/CallbackProxy;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1008
    name = null
.end annotation

# static fields
.field static final synthetic $SwitchMap$android$webkit$ConsoleMessage$MessageLevel:[I

# direct methods
.method static constructor <clinit>()V
    .locals 3

    .prologue
    .line 676
    invoke-static {}, Landroid/webkit/ConsoleMessage$MessageLevel;->values()[Landroid/webkit/ConsoleMessage$MessageLevel;

    move-result-object v0

    array-length v0, v0

    new-array v0, v0, [I

    sput-object v0, Landroid/webkit/CallbackProxy$1;->$SwitchMap$android$webkit$ConsoleMessage$MessageLevel:[I

    :try_start_0
    sget-object v0, Landroid/webkit/CallbackProxy$1;->$SwitchMap$android$webkit$ConsoleMessage$MessageLevel:[I

    sget-object v1, Landroid/webkit/ConsoleMessage$MessageLevel;->TIP:Landroid/webkit/ConsoleMessage$MessageLevel;

    invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I

    move-result v1

    const/4 v2, 0x1

    aput v2, v0, v1
    :try_end_0
    .catch Ljava/lang/NoSuchFieldError; {:try_start_0 .. :try_end_0} :catch_4

    :goto_0
    :try_start_1
    sget-object v0, Landroid/webkit/CallbackProxy$1;->$SwitchMap$android$webkit$ConsoleMessage$MessageLevel:[I

    sget-object v1, Landroid/webkit/ConsoleMessage$MessageLevel;->LOG:Landroid/webkit/ConsoleMessage$MessageLevel;

    invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I

    move-result v1

    const/4 v2, 0x2

    aput v2, v0, v1
    :try_end_1
    .catch Ljava/lang/NoSuchFieldError; {:try_start_1 .. :try_end_1} :catch_3

    :goto_1
    :try_start_2
    sget-object v0, Landroid/webkit/CallbackProxy$1;->$SwitchMap$android$webkit$ConsoleMessage$MessageLevel:[I

    sget-object v1, Landroid/webkit/ConsoleMessage$MessageLevel;->WARNING:Landroid/webkit/ConsoleMessage$MessageLevel;

    invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I

    move-result v1

    const/4 v2, 0x3

    aput v2, v0, v1
    :try_end_2
    .catch Ljava/lang/NoSuchFieldError; {:try_start_2 .. :try_end_2} :catch_2

    :goto_2
    :try_start_3
    sget-object v0, Landroid/webkit/CallbackProxy$1;->$SwitchMap$android$webkit$ConsoleMessage$MessageLevel:[I

    sget-object v1, Landroid/webkit/ConsoleMessage$MessageLevel;->ERROR:Landroid/webkit/ConsoleMessage$MessageLevel;

    invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I

    move-result v1

    const/4 v2, 0x4

    aput v2, v0, v1
    :try_end_3
    .catch Ljava/lang/NoSuchFieldError; {:try_start_3 .. :try_end_3} :catch_1

    :goto_3
    :try_start_4
    sget-object v0, Landroid/webkit/CallbackProxy$1;->$SwitchMap$android$webkit$ConsoleMessage$MessageLevel:[I

    sget-object v1, Landroid/webkit/ConsoleMessage$MessageLevel;->DEBUG:Landroid/webkit/ConsoleMessage$MessageLevel;

    invoke-virtual {v1}, Ljava/lang/Enum;->ordinal()I

    move-result v1

    const/4 v2, 0x5

    aput v2, v0, v1
    :try_end_4
    .catch Ljava/lang/NoSuchFieldError; {:try_start_4 .. :try_end_4} :catch_0

    :goto_4
    return-void

    :catch_0
    move-exception v0

    goto :goto_4

    :catch_1
    move-exception v0

    goto :goto_3

    :catch_2
    move-exception v0

    goto :goto_2

    :catch_3
    move-exception v0

    goto :goto_1

    :catch_4
    move-exception v0

    goto :goto_0
.end method