text:
package org.apache.hyracks.storage.am.lsm.btree.impl;

public interface IVirtualBufferCacheCallback {
    void isFullChanged(boolean newValue);
}

redpajama_set_name: RedPajamaGithub


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W28587_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">13


text:
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
	http://www.springframework.org/schema/context
	http://www.springframework.org/schema/context/spring-context-3.1.xsd">

	<import resource="classpath:camel-context.xml" />
	<context:component-scan base-package="com.rhc.services" />

	<bean id="foo" class="com.rhc.services.Foo">
		<property name="name" value="hi this is cool thank you!" />
	</bean>

	<bean id="url" class="java.net.URL">
		<constructor-arg value="http://localhost:8080/services-endpoints-war/SOAPService?wsdl" />
	</bean>

	<bean id="soapService" class="org.apache.hello_world_soap_http.SOAPService">
		<constructor-arg ref="url" />
	</bean>

</beans>


text:
/**
 * @constant
 * @type Number
 */
cc.TGA_OK = 0;

/**
 * @constant
 * @type Number
 */
cc.TGA_ERROR_FILE_OPEN = 1;

/**
 * @constant
 * @type Number
 */
cc.TGA_ERROR_READING_FILE = 2;

/**
 * @constant
 * @type Number
 */
cc.TGA_ERROR_INDEXED_COLOR = 3;

/**
 * @constant
 * @type Number
 */
cc.TGA_ERROR_MEMORY = 4;

/**
 * @constant
 * @type Number
 */
cc.TGA_ERROR_COMPRESSED_FILE = 5;

/**
 * TGA format
 * @param {Number} status
 * @param {Number} type
 * @param {Number} pixelDepth
 * @param {Number} width map width
 * @param {Number} height map height
 * @param {Array} imageData raw data
 * @param {Number} flipped
 * @constructor
 */
cc.ImageTGA = function (status, type, pixelDepth, width, height, imageData, flipped) {
    this.status = status || 0;
    this.type = type || 0;
    this.pixelDepth = pixelDepth || 0;
    this.width = width || 0;
    this.height = height || 0;
    this.imageData = imageData || [];
    this.flipped = flipped || 0;
};

/**
 * load the image header field from stream. We only keep those that matter!
 * @param {Array} buffer
 * @param {Number} bufSize
 * @param {cc.ImageTGA} psInfo
 * @return {Boolean}
 */
cc.tgaLoadHeader = function (buffer, bufSize, psInfo) {
    var step = 2;
    if (step + 1 > bufSize)
        return false;

    var binaryReader = new cc.BinaryStreamReader(buffer);

    binaryReader.setOffset(step);
    psInfo.type = binaryReader.readByte();
    step += 10;       // . step += sizeof(unsigned char) * 2; step += sizeof(signed short) * 4;

    if (step + 4 + 1 > bufSize)
        return false;
    binaryReader.setOffset(step);
    psInfo.width = binaryReader.readUnsignedShort();
    psInfo.height = binaryReader.readUnsignedInteger();
    psInfo.pixelDepth = binaryReader.readByte();

    step += 5;      // .  step += sizeof(unsigned char);  step += sizeof(signed short) * 2;
    if (step + 1 > bufSize)
        return false;

    var garbage = binaryReader.readByte();
    psInfo.flipped = 0;
    if (garbage & 0x20)
        psInfo.flipped = 1;
    return true;
};

/**
 * loads the image pixels. You shouldn't call this function directly.
 * @param {Array} buffer
 * @param {Number} bufSize
 * @param {cc.ImageTGA} psInfo
 * @return {Boolean}
 */
cc.tgaLoadImageData = function (buffer, bufSize, psInfo) {
    var mode, total, i, aux;
    var step = 18;              // .size_t step = (sizeof(unsigned char) + sizeof(signed short)) * 6;

    // mode equal the number of components for each pixel
    mode = 0 | (psInfo.pixelDepth / 2);
    // total is the number of unsigned chars we'll have to read
    total = psInfo.height * psInfo.width * mode;

    if (step + total > bufSize)
        return false;

    psInfo.imageData = cc.__getSubArray(buffer, step, step + total);

    // mode=3 or 4 implies that the image is RGB(A). However TGA
    // stores it as BGR(A) so we'll have to swap R and B.
    if (mode >= 3) {
        for (i = 0; i < total; i += mode) {
            aux = psInfo.imageData[i];
            psInfo.imageData[i] = psInfo.imageData[i + 2];
            psInfo.imageData[i + 2] = aux;
        }
    }
    return true;
};

/**
 * converts RGB to grayscale
 * @param {cc.ImageTGA} psInfo
 */
cc.tgaRGBtogreyscale = function (psInfo) {
    var i, j;

    // if the image is already grayscale do nothing
    if (psInfo.pixelDepth === 8)
        return;

    // compute the number of actual components
    var mode = psInfo.pixelDepth / 8;

    // allocate an array for the new image data
    var newImageData = new Uint8Array(psInfo.height * psInfo.width);
    if (newImageData === null)
        return;

    // convert pixels: grayscale = o.30 * R + 0.59 * G + 0.11 * B
    for (i = 0, j = 0; j < psInfo.width * psInfo.height; i += mode, j++)
        newImageData[j] = (0.30 * psInfo.imageData[i] + 0.59 * psInfo.imageData[i + 1] + 0.11 * psInfo.imageData[i + 2]);

    // reassign pixelDepth and type according to the new image type
    psInfo.pixelDepth = 8;
    psInfo.type = 3;
    // reassigning imageData to the new array.
    psInfo.imageData = newImageData;
};

/**
 * releases the memory used for the image
 * @param {cc.ImageTGA} psInfo
 */
cc.tgaDestroy = function (psInfo) {
    if (!psInfo)
        return;

    psInfo.imageData = null;
    psInfo = null;
};

/**
 * Load RLE image data
 * @param buffer
 * @param bufSize
 * @param psInfo
 * @returns {boolean}
 */
cc.tgaLoadRLEImageData = function (buffer, bufSize, psInfo) {
    var mode, total, i, index = 0, skip = 0, flag = 0;
    var aux = [], runlength = 0;

    var step = 18;                          // . size_t step = (sizeof(unsigned char) + sizeof(signed short)) * 6;

    // mode equal the number of components for each pixel
    mode = psInfo.pixelDepth / 8;
    // total is the number of unsigned chars we'll have to read
    total = psInfo.height * psInfo.width;

    for (i = 0; i < total; i++) {
        // if we have a run length pending, run it
        if (runlength !== 0) {
            // we do, update the run length count
            runlength--;
            skip = (flag !== 0);
        } else {
            // otherwise, read in the run length token
            if (step + 1 > bufSize)
                break;
            runlength = buffer[step];
            step += 1;

            // see if it's a RLE encoded sequence
            flag = runlength & 0x80;
            if (flag)
                runlength -= 128;
            skip = 0;
        }

        // do we need to skip reading this pixel?
        if (!skip) {
            // no, read in the pixel data
            if (step + mode > bufSize)
                break;
            aux = cc.__getSubArray(buffer, step, step + mode);
            step += mode;

            // mode=3 or 4 implies that the image is RGB(A). However TGA
            // stores it as BGR(A) so we'll have to swap R and B.
            if (mode >= 3) {
                var tmp = aux[0];
                aux[0] = aux[2];
                aux[2] = tmp;
            }
        }

        // add the pixel to our image
        for (var j = 0; j < mode; j++)
            psInfo.imageData[index + j] = aux[j];

        index += mode;
    }

    return true;
};

/**
 * ImageTGA Flip
 * @param {cc.ImageTGA} psInfo
 */
cc.tgaFlipImage = function (psInfo) {
    // mode equal the number of components for each pixel
    var mode = psInfo.pixelDepth / 8;
    var rowbytes = psInfo.width * mode;

    for (var y = 0; y < (psInfo.height / 2); y++) {
        var row = cc.__getSubArray(psInfo.imageData, y * rowbytes, y * rowbytes + rowbytes);
        cc.__setDataToArray(cc.__getSubArray(psInfo.imageData, (psInfo.height - (y + 1)) * rowbytes, rowbytes), psInfo.imageData, y * rowbytes);
        cc.__setDataToArray(row, psInfo.imageData, (psInfo.height - (y + 1)) * rowbytes);
    }
    psInfo.flipped = 0;
};

cc.__getSubArray = function (array, start, end) {
    if (array instanceof  Array)
        return array.slice(start, end);
    else
        return array.subarray(start, end);
};

cc.__setDataToArray = function (sourceData, destArray, startIndex) {
    for (var i = 0; i < sourceData.length; i++)
        destArray[startIndex + i] = sourceData[i];
};

/**
 * Binary Stream Reader
 *
 * @class
 * @param binaryData
 */
cc.BinaryStreamReader = cc.Class.extend({
    _binaryData: null,
    _offset: 0,

    /**
     *
The cc.BinaryStreamReader's constructor.

     * This function will automatically be invoked when you create a node using new construction: "var node = new cc.BinaryStreamReader()".

     * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.

     * @param binaryData
     */
    ctor: function (binaryData) {
        this._binaryData = binaryData;
    },

    /**
     * Set the binaryData.
     * @param binaryData
     */
    setBinaryData: function (binaryData) {
        this._binaryData = binaryData;
        this._offset = 0;
    },

    /**
     * Gets the binaryData.
     * @returns {Object}
     */
    getBinaryData: function () {
        return this._binaryData;
    },

    _checkSize: function (neededBits) {
        if (!(this._offset + Math.ceil(neededBits / 8) < this._data.length))
            throw new Error("Index out of bound");
    },

    _decodeFloat: function (precisionBits, exponentBits) {
        var length = precisionBits + exponentBits + 1;
        var size = length >> 3;
        this._checkSize(length);

        var bias = Math.pow(2, exponentBits - 1) - 1;
        var signal = this._readBits(precisionBits + exponentBits, 1, size);
        var exponent = this._readBits(precisionBits, exponentBits, size);
        var significand = 0;
        var divisor = 2;
        var curByte = 0; //length + (-precisionBits >> 3) - 1;
        do {
            var byteValue = this._readByte(++curByte, size);
            var startBit = precisionBits % 8 || 8;
            var mask = 1 << startBit;
            while (mask >>= 1) {
                if (byteValue & mask)
                    significand += 1 / divisor;
                divisor *= 2;
            }
        } while (precisionBits -= startBit);

        this._offset += size;

        return exponent === (bias << 1) + 1 ? significand ? NaN : signal ? -Infinity : +Infinity
            : (1 + signal * -2) * (exponent || significand ? !exponent ? Math.pow(2, -bias + 1) * significand
            : Math.pow(2, exponent - bias) * (1 + significand) : 0);
    },

    _readByte: function (i, size) {
        return this._data[this._offset + size - i - 1];
    },

    _decodeInt: function (bits, signed) {
        var x = this._readBits(0, bits, bits / 8), max = Math.pow(2, bits);
        var result = signed && x >= max / 2 ? x - max : x;

        this._offset += bits / 8;
        return result;
    },

    _shl: function (a, b) {
        for (++b; --b; a = ((a %= 0x7fffffff + 1) & 0x40000000) === 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1) {
        }
        return a;
    },

    _readBits: function (start, length, size) {
        var offsetLeft = (start + length) % 8;
        var offsetRight = start % 8;
        var curByte = size - (start >> 3) - 1;
        var lastByte = size + (-(start + length) >> 3);
        var diff = curByte - lastByte;

        var sum = (this._readByte(curByte, size) >> offsetRight) & ((1 << (diff ? 8 - offsetRight : length)) - 1);

        if (diff && offsetLeft)
            sum += (this._readByte(lastByte++, size) & ((1 << offsetLeft) - 1)) << (diff-- << 3) - offsetRight;

        while (diff)
            sum += this._shl(this._readByte(lastByte++, size), (diff-- << 3) - offsetRight);

        return sum;
    },

    readInteger: function () {
        return this._decodeInt(32, true);
    },

    readUnsignedInteger: function () {
        return this._decodeInt(32, false);
    },

    readSingle: function () {
        return this._decodeFloat(23, 8);
    },

    readShort: function () {
        return this._decodeInt(16, true);
    },

    readUnsignedShort: function () {
        return this._decodeInt(16, false);
    },

    readByte: function () {
        var readByte = this._data[this._offset];
        this._offset += 1;
        return readByte;
    },

    readData: function (start, end) {
        if (this._binaryData instanceof Array) {
            return this._binaryData.slice(start, end);
        } else {
            //typed array
            return this._binaryData.subarray(start, end);
        }
    },

    setOffset: function (offset) {
        this._offset = offset;
    },

    getOffset: function () {
        return this._offset;
    }
});


text:
npm install express

npm install --save-dev babel-plugin-react-html-attrs

# 서버시작
node app.js


text:
'use strict';

const pkg = require('../package.json');

/**
 * Parameters for handlebars templates
 */
module.exports = () => {
  var production = (process.env.NODE_ENV === 'production');
  var domain = process.env.ENDPOINT;

  return function *(next) {
    this.production = production;
    this.domain = domain;

    this.bootstrap = JSON.stringify({
      version: pkg.version,
      domain: domain,
      user: this.user || null
    });
    yield next;
  };
};


text:
require File.dirname(__FILE__) + '/spec_helper'

describe EMRPC::BlankSlate do
  it "should have only __id__ and __send__ instance methods" do
    EMRPC::BlankSlate.instance_methods.sort.should == %w[__id__ __send__]
  end
end


text:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>"Sick of him" special mission</title>
		<link>http://bvs.wikidot.com/forum/t-76198/sick-of-him-special-mission</link>
		<description>Posts in the discussion thread ""Sick of him" special mission"</description>
				<copyright></copyright>
		<lastBuildDate>Sun, 10 Jul 2022 05:49:26 +0000</lastBuildDate>

					<item>
				<guid>http://bvs.wikidot.com/forum/t-76198#post-226141</guid>
				<title>Re: "Sick of him" special mission</title>
				<link>http://bvs.wikidot.com/forum/t-76198/sick-of-him-special-mission#post-226141</link>
				<description></description>
				<pubDate>Wed, 23 Jul 2008 20:24:05 +0000</pubDate>
				<wikidot:authorName>Ryuenjin</wikidot:authorName>				<wikidot:authorUserId>91357</wikidot:authorUserId>				<content:encoded>
					<![CDATA[

thank you

				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://bvs.wikidot.com/forum/t-76198#post-226124</guid>
				<title>Re: "Sick of him" special mission</title>
				<link>http://bvs.wikidot.com/forum/t-76198/sick-of-him-special-mission#post-226124</link>
				<description></description>
				<pubDate>Wed, 23 Jul 2008 20:06:48 +0000</pubDate>
				<wikidot:authorName>Ren Po Ken</wikidot:authorName>				<wikidot:authorUserId>103468</wikidot:authorUserId>				<content:encoded>
					<![CDATA[

Sick of Right. This will cause Right to eat cookies, thereby killing him and leveling Anonymous.

				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://bvs.wikidot.com/forum/t-76198#post-226035</guid>
				<title>"Sick of him" special mission</title>
				<link>http://bvs.wikidot.com/forum/t-76198/sick-of-him-special-mission#post-226035</link>
				<description></description>
				<pubDate>Wed, 23 Jul 2008 17:31:35 +0000</pubDate>
				<wikidot:authorName>Ryuenjin</wikidot:authorName>				<wikidot:authorUserId>91357</wikidot:authorUserId>				<content:encoded>
					<![CDATA[

which one am i suppose to get to lvl anonymous to lvl 2? the one that mentions his name? because by the name of the mission it got me to think that maybe the mission is to rid of anonymous.

				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>


text:
<!doctype html>

  <meta charset="utf-8">
  <title>Chosen: A jQuery Plugin by Harvest to Tame Unwieldy Select Boxes</title>
  <link rel="stylesheet" href="docsupport/style.css">
  <link rel="stylesheet" href="docsupport/prism.css">
  <link rel="stylesheet" href="chosen.css">

  <form>

          Multiple Select
          <select data-placeholder="Type 'C' to view" style="width:350px;" multiple class="chosen-select-no-results" tabindex="11">
            <option value=""></option>
            <option>American Black Bear</option>
            <option>Asiatic Black Bear</option>
            <option>Brown Bear</option>
            <option>Giant Panda</option>
            <option>Sloth Bear</option>
            <option>Sun Bear</option>
            <option>Polar Bear</option>
            <option>Spectacled Bear</option>
          </select>

  </form>


text:
package org.keycloak.testsuite.utils.undertow;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.Servlet;

import io.undertow.servlet.api.DeploymentInfo;
import io.undertow.servlet.api.ErrorPage;
import io.undertow.servlet.api.FilterInfo;
import io.undertow.servlet.api.LoginConfig;
import io.undertow.servlet.api.SecurityConstraint;
import io.undertow.servlet.api.SecurityInfo;
import io.undertow.servlet.api.ServletInfo;
import io.undertow.servlet.api.ServletSessionConfig;
import io.undertow.servlet.api.WebResourceCollection;
import org.jboss.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/**
 * Simple web.xml parser just to handle our test deployments
 *
 * @author Marek Posolda
 */
class SimpleWebXmlParser {

    private static final Logger log = Logger.getLogger(SimpleWebXmlParser.class);

    void parseWebXml(Document webXml, DeploymentInfo di) {
        try {
            DocumentWrapper document = new DocumentWrapper(webXml);

            if (di.getServlets().get("ResteasyServlet") == null) {

                // SERVLETS
                Map<String, String> servletMappings = new HashMap<>();
                List<ElementWrapper> sm = document.getElementsByTagName("servlet-mapping");
                for (ElementWrapper mapping : sm) {
                    String servletName = mapping.getElementByTagName("servlet-name").getText();
                    String path = mapping.getElementByTagName("url-pattern").getText();
                    servletMappings.put(servletName, path);
                }

                List<ElementWrapper> servlets = document.getElementsByTagName("servlet");
                for (ElementWrapper servlet : servlets) {
                    String servletName = servlet.getElementByTagName("servlet-name").getText();
                    ElementWrapper servletClassEw = servlet.getElementByTagName("servlet-class");
                    String servletClass = servletClassEw == null ? servletName : servletClassEw.getText();
                    ElementWrapper loadOnStartupEw = servlet.getElementByTagName("load-on-startup");
                    Integer loadOnStartup = loadOnStartupEw == null ? null : Integer.valueOf(loadOnStartupEw.getText());

                    Class<? extends Servlet> servletClazz = (Class<? extends Servlet>) Class.forName(servletClass);
                    ServletInfo undertowServlet = new ServletInfo(servletName, servletClazz);

                    if (servletMappings.containsKey(servletName)) {
                        undertowServlet.addMapping(servletMappings.get(servletName));
                        undertowServlet.setLoadOnStartup(loadOnStartup);
                        di.addServlet(undertowServlet);
                    } else {
                        log.warnf("Missing servlet-mapping for '%s'", servletName);
                    }
                }
            }

            // FILTERS
            Map<String, String> filterMappings = new HashMap<>();
            List<ElementWrapper> fm = document.getElementsByTagName("filter-mapping");
            for (ElementWrapper mapping : fm) {
                String filterName = mapping.getElementByTagName("filter-name").getText();
                String path = mapping.getElementByTagName("url-pattern").getText();
                filterMappings.put(filterName, path);
            }

            List<ElementWrapper> filters = document.getElementsByTagName("filter");
            for (ElementWrapper filter : filters) {
                String filterName = filter.getElementByTagName("filter-name").getText();
                String filterClass = filter.getElementByTagName("filter-class").getText();

                Class<? extends Filter> filterClazz = (Class<? extends Filter>) Class.forName(filterClass);
                FilterInfo undertowFilter = new FilterInfo(filterName, filterClazz);

                List<ElementWrapper> initParams = filter.getElementsByTagName("init-param");
                for (ElementWrapper initParam : initParams) {
                    String paramName = initParam.getElementByTagName("param-name").getText();
                    String paramValue = initParam.getElementByTagName("param-value").getText();
                    undertowFilter.addInitParam(paramName, paramValue);
                }

                di.addFilter(undertowFilter);

                if (filterMappings.containsKey(filterName)) {
                    di.addFilterUrlMapping(filterName, filterMappings.get(filterName), DispatcherType.REQUEST);
                } else {
                    log.warnf("Missing filter-mapping for '%s'", filterName);
                }
            }

            // CONTEXT PARAMS
            List<ElementWrapper> contextParams = document.getElementsByTagName("context-param");
            for (ElementWrapper param : contextParams) {
                String paramName = param.getElementByTagName("param-name").getText();
                String paramValue = param.getElementByTagName("param-value").getText();
                di.addInitParameter(paramName, paramValue);
            }

            // ROLES
            List<ElementWrapper> securityRoles = document.getElementsByTagName("security-role");
            for (ElementWrapper sr : securityRoles) {
                String roleName = sr.getElementByTagName("role-name").getText();
                di.addSecurityRole(roleName);
            }

            // SECURITY CONSTRAINTS
            List<ElementWrapper> secConstraints = document.getElementsByTagName("security-constraint");
            for (ElementWrapper constraint : secConstraints) {
                String urlPattern = constraint.getElementByTagName("web-resource-collection")
                        .getElementByTagName("url-pattern")
                        .getText();

                ElementWrapper authCsnt = constraint.getElementByTagName("auth-constraint");
                String roleName = authCsnt==null ? null : authCsnt
                        .getElementByTagName("role-name")
                        .getText();

                SecurityConstraint undertowConstraint = new SecurityConstraint();
                WebResourceCollection collection = new WebResourceCollection();
                collection.addUrlPattern(urlPattern);
                undertowConstraint.addWebResourceCollection(collection);

                if (roleName != null) {
                    undertowConstraint.addRoleAllowed(roleName);
                } else {
                    undertowConstraint.setEmptyRoleSemantic(SecurityInfo.EmptyRoleSemantic.PERMIT);
                }
                di.addSecurityConstraint(undertowConstraint);
            }

            // LOGIN CONFIG
            ElementWrapper loginCfg = document.getElementByTagName("login-config");
            if (loginCfg != null) {
                String mech = loginCfg.getElementByTagName("auth-method").getText();
                String realmName = loginCfg.getElementByTagName("realm-name").getText();

                ElementWrapper form = loginCfg.getElementByTagName("form-login-config");
                if (form != null) {
                    String loginPage = form.getElementByTagName("form-login-page").getText();
                    String errorPage = form.getElementByTagName("form-error-page").getText();
                    di.setLoginConfig(new LoginConfig(mech, realmName, loginPage, errorPage));
                } else {
                    di.setLoginConfig(new LoginConfig(realmName).addFirstAuthMethod(mech));
                }
            }

            // COOKIE CONFIG
            ElementWrapper sessionCfg = document.getElementByTagName("session-config");
            if (sessionCfg != null) {
                ElementWrapper cookieConfig = sessionCfg.getElementByTagName("cookie-config");
                String cookieName = cookieConfig.getElementByTagName("name").getText();

                ServletSessionConfig cfg = new ServletSessionConfig();
                if (cookieConfig.getElementByTagName("http-only") != null) {
                    cfg.setHttpOnly(Boolean.parseBoolean(cookieConfig.getElementByTagName("http-only").getText()));
                }
                cfg.setName(cookieName);
                di.setServletSessionConfig(cfg);
            }

            // ERROR PAGES
            List<ElementWrapper> errorPages = document.getElementsByTagName("error-page");
            for (ElementWrapper errorPageWrapper : errorPages) {
                String location = errorPageWrapper.getElementByTagName("location").getText();

                ErrorPage errorPage;
                if (errorPageWrapper.getElementByTagName("error-code") != null) {
                    errorPage = new ErrorPage(location, Integer.parseInt(errorPageWrapper.getElementByTagName("error-code").getText()));
                } else {
                    errorPage = new ErrorPage(location);
                }

                di.addErrorPage(errorPage);
            }

        } catch (ClassNotFoundException cnfe) {
            throw new RuntimeException(cnfe);
        } catch (NullPointerException npe) {
            throw new RuntimeException("Error parsing web.xml of " + di.getDeploymentName(), npe);
        }
    }

    private static abstract class XmlWrapper {

        abstract List<ElementWrapper> getElementsByTagName(String tagName);

        abstract ElementWrapper getElementByTagName(String tagName);

        List<ElementWrapper> getElementsFromNodeList(NodeList nl) {
            List<ElementWrapper> result = new LinkedList<>();

            for (int i=0; i<nl.getLength() ; i++) {
                Node node = nl.item(i);
                if (node instanceof Element) {
                    result.add(new ElementWrapper((Element) node));
                }
            }

            return result;
        }

        ElementWrapper getElementFromNodeList(NodeList nl) {
            if (nl.getLength() > 0) {
                return new ElementWrapper((Element) nl.item(0));
            } else {
                return null;
            }
        }

    }

    private static class ElementWrapper extends XmlWrapper {

        private final Element element;

        public ElementWrapper(Element element) {
            this.element = element;
        }

        @Override
        public List<ElementWrapper> getElementsByTagName(String tagName) {
            NodeList nl = element.getElementsByTagName(tagName);
            return getElementsFromNodeList(nl);
        }

        @Override
        public ElementWrapper getElementByTagName(String tagName) {
            NodeList nl = element.getElementsByTagName(tagName);
            return getElementFromNodeList(nl);
        }

        public String getText() {
            return this.element.getTextContent();
        }
    }

    private static class DocumentWrapper extends XmlWrapper {

        private final Document document;

        public DocumentWrapper(Document document) {
            this.document = document;
        }

        @Override
        List<ElementWrapper> getElementsByTagName(String tagName) {
            NodeList nl = document.getElementsByTagName(tagName);
            return getElementsFromNodeList(nl);
        }

        @Override
        ElementWrapper getElementByTagName(String tagName) {
            NodeList nl = document.getElementsByTagName(tagName);
            return getElementFromNodeList(nl);
        }
    }

}


text:
title: Windows Container Requirements
description: Windows Container Requirements.
keywords: metadata, containers
author: enderb-ms
ms.date: 09/26/2016
ms.topic: deployment-article
ms.prod: windows-containers
ms.assetid: 3c3d4c69-503d-40e8-973b-ecc4e1f523ed
---

# Windows container requirements

This guides list the requirements for a Windows container Host.

## OS Requirements

- The Windows container feature is only available on Windows Server build 1709, Windows Server 2016 (Core and with Desktop Experience) and Windows 10 Professional and Enterprise (Anniversary Edition).
- The Hyper-V role must be installed before running Hyper-V Containers
- Windows Server Container hosts must have Windows installed to c:\. This restriction does not apply if only Hyper-V Containers will be deployed.

## Virtualized Container Hosts

If a Windows container host will be run from a Hyper-V virtual machine, and will also be hosting Hyper-V Containers, nested virtualization will need to be enabled. Nested virtualization has the following requirements:

- At least 4 GB RAM available for the virtualized Hyper-V host.
- Windows Server build 1709, Windows Server 2016, or Windows 10 on the host system, and Windows Server (Full, Core) in the virtual machine.
- A processor with Intel VT-x (this feature is currently only available for Intel processors).
- The container host VM will also need at least 2 virtual processors.

## Supported Base Images

Windows Containers are offered with two container base images, Windows Server Core and Nano Server. Not all configurations support both OS images. This table details the supported configurations.

Host Operating System
Windows Server Container
Hyper-V Container

Windows Server 2016 (Standard or Datacenter)
Server Core / Nano Server
Server Core / Nano Server

Nano Server*
 Nano Server
Server Core / Nano Server

Windows 10 Pro / Enterprise
Not Available
Server Core / Nano Server

* Starting with Windows Server version 1709 Nano Server is no long avilable as a container host.

### Memory requirments
Restrictions on available memory to containers can be configured though [resource controls](https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/resource-controls) or by overloading a container host.  The minimum amount of memory required to launch a container and run basic commands (ipconfig, dir, etc...) are listed below.  Please note that these values do not take into account resource sharing between containers or requirments from the application running in the container.

#### Windows Server 2016
| Base Image  | Windows Server Container | Hyper-V Isolation    |
| ----------- | ------------------------ | -------------------- |
| Nano Server | 40MB                     | 130MB + 1GB Pagefile |
| Server Core | 50MB                     | 325MB + 1GB Pagefile |

#### Windows Server version 1709
| Base Image  | Windows Server Container | Hyper-V Isolation    |
| ----------- | ------------------------ | -------------------- |
| Nano Server | 30MB                     | 110MB + 1GB Pagefile |
| Server Core | 45MB                     | 360MB + 1GB Pagefile |

### Nano Server vs. Windows Server Core

How does one choose between Windows Server Core and Nano Server? While you are free to build with whatever you wish, if you find that your application needs full compatibility with the .NET Framework, then you should use [Windows Server Core](https://hub.docker.com/r/microsoft/windowsservercore/). On the other side of the coin, if your application is built for the cloud and uses .NET Core, then you should use [Nano Server](https://hub.docker.com/r/microsoft/nanoserver/). This is because Nano Server was built with the intention of having as small a footprint as possible therefore several nonessential libraries were removed. This is good to keep in mind as you think about building on top of Nano Server:

- The servicing stack was removed
- .NET Core is not included (though you can use the [.NET Core Nano Server image](https://hub.docker.com/r/microsoft/dotnet/))
- PowerShell was removed
- WMI was removed

These are the biggest differences and not an exhaustive list. There are other components not called out which are absent as well. Keep in mind that you can always add layers on top of Nano Server as you see fit. For an example of this check out the [.NET Core Nano Server Dockerfile](https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/nanoserver/amd64/Dockerfile).

## Matching Container Host Version with Container Image Versions
### Windows Server Containers
Because Windows Server Containers and the underlying host share a single kernel, the container's base image must match that of the host.  If the versions are different the container may start, but full functionally cannot be guaranteed. The Windows operating system has 4 levels of versioning, Major, Minor, Build and Revision – for example 10.0.14393.103. The build number (i.e. 14393) only changes when new versions of the OS are published, such as version 1709, 1803, fall creators update etc... The revision number (i.e. 103) is updated as Windows updates are applied.
#### Build Number (new release of Windows)
Windows Server Containers are blocked from starting when the build number between the container host and the container image are different - for example 10.0.14393.* (Windows Server 2016) and 10.0.16299.* (Windows Server version 1709).
#### Revision Number (patching)
Windows Server Containers are _not_ blocked from starting when the revision number between the container host and the container image are different for example 10.0.14393.1914 (Windows Server 2016 with KB4051033 applied) and 10.0.14393.1944 (Windows Server 2016 with KB4053579 applied).
For Windows Server 2016 based hosts/images – the container image's revision must match the host to be in a supported configuration.  Starting with Windows Server version 1709, this is no longer applicable, and the host and container image need not have matching revisions.  It is as always recommended to keep your systems up-to-date with the latest patches and updates.
#### Practical Application
Example 1:  Container host is running Windows Server 2016 with KB4041691 applied.  Any Windows Server container deployed to this host must be based on the 10.0.14393.1770 container base images.  If KB4053579 is applied to the host the container images must be updated at the same time to remain supported.
Example 2:  Container host is running Windows Server version 1709 with KB4043961 applied.  Any Windows Server container deployed to this host must be based on a Windows Server version 1709 (10.0.16299) container base image but need not match the host KB.  If KB4054517 is applied to the host the container images do not need to be updated, though should be in order to fully address any security issues.
#### Querying version
Method 1:
Introduced in version 1709 the cmd prompt and ver command now return the revision details.
```
Microsoft Windows [Version 10.0.16299.125]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\>ver

Microsoft Windows [Version 10.0.16299.125]
```
Method 2:
Query the following registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion
For example:
```
C:\>reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion" /v BuildLabEx
```
Or
```
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator> (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\').BuildLabEx
14393.321.amd64fre.rs1_release_inmarket.161004-2338
```

To check what version your base image is using you can review the tags on the Docker hub or the image hash table provided in the image description.  The [Windows 10 Update History](https://support.microsoft.com/en-us/help/12387/windows-10-update-history) page lists when each build and revision was released.

### Hyper-V Isolation for Containers
Windows containers can be run with or without Hyper-V isolation.  Hyper-V isolation creates a secure boundary around the container with an optimized VM.  Unlike standard Windows containers, which share the kernel between containers and the host, each Hyper-V isolated container has its own instance of the Windows kernel.  Because of this you can have different OS versions in the container host and image (see compatibility matrix below).

To run a container with Hyper-V isolation, simply add the tag "--isolation=hyperv" to your docker run command.

### Compatibility Matrix
Windows Server builds after 2016 GA (10.0.14393.206) can run the Windows Server 2016 GA images of both Windows Server Core or Nano Server in a supported configuration regardless of the revision number.
A Windows Server version 1709 host can also run Windows Server 2016 based containers, however the inverse is not supported.

It is important to understand that in order to have the full functionality, reliability and security assurances provided with Windows updates you should maintain the latest versions on all systems.


text:
package com.oocode;

public class ColumnClues {
    private final int[] numberOfShips;

    public ColumnClues(int... numberOfShips) {
        this.numberOfShips = numberOfShips;
    }

    public int length() {
        return numberOfShips.length;
    }

    public int get(int col) {
        return numberOfShips[col];
    }
}


text:
package xadrezSuico;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Map;

public class DBConnection {
	protected static Connection openConnection() throws SQLException {

		SoftwareProperties p = new SoftwareProperties();
		Map<String, String> DBsettings = p.getPropr();

		// Open the connection
		String url = "jdbc:h2:" + DBsettings.get("ip").toString() + "/" + DBsettings.get("nomeBanco").toString();
		String user = DBsettings.get("usuario").toString();
		String pass = DBsettings.get("password").toString();
		Connection c = DriverManager.getConnection(url, user, pass);
		return c;

	}
}


text:
using NUnit.Framework;
namespace PovertyIndex.DomainModel.UnitTests
{
    [TestFixture]
    public class PovertyPersistenceRatioTests
    {
        PovertyPersistenceRatio ratio;
        string country = "denmark";
        int lowYear = 1994;
        int highYear = 2000;
        int lowYearCount = 600;
        int highYearCount = 200;

        [SetUp]
        public void SetUp()
        {
            ratio = new PovertyPersistenceRatio(country, lowYear, highYear, lowYearCount, highYearCount);
        }

        [Test]
        public void WhenCreatedCountryPropertyIsEqualToCountryArgument()
        {
            Assert.AreEqual(country, ratio.Country);
        }

        [Test]
        public void WhenCreatedLowYearPropertyIsEqualToLowYearArgument()
        {
            Assert.AreEqual(lowYear, ratio.LowYear);
        }

        [Test]
        public void WhenCreatedHighYearPropertyIsEqualToHighYearArgument()
        {
            Assert.AreEqual(highYear, ratio.HighYear);
        }

        [Test]
        public void WhenCreatedLowYearPoorCountIsEqualToLowYearPoorCountArgument()
        {
            Assert.AreEqual(lowYearCount, ratio.PopulationSize);
        }

        [Test]
        public void WhenCreatedHighYearStillPoorCountIsEqualToHighYearStillPoorCountArgument()
        {
            Assert.AreEqual(highYearCount, ratio.PoorInBothYears);
        }

        [Test]
        public void WhenLowYearPoorCountIsZeroValueIsZero()
        {
            var ratio = new PovertyPersistenceRatio("XXX", 1999, 2000, 0, 0);
            Assert.AreEqual(0d, ratio.PermanenceProbability, double.Epsilon);
        }

        [Test]
        public void WhenCreatedValuePropertyIsEqualToRatioBetweenHighYearStillPoorCountAndLowYearPoorCount()
        {
            double expected = ((double)highYearCount)/((double)lowYearCount);
            Assert.AreEqual(expected, ratio.PermanenceProbability, double.Epsilon);
        }

        [Test, ExpectedException(typeof(BusinessException))]
        public void WhenLowYearIsNotLessThanHighYearABusinessExceptionIsThrown()
        {
            var ratio = new PovertyPersistenceRatio(country, 2000, 2000, lowYearCount, highYearCount);
        }

        [Test, ExpectedException(typeof(BusinessException))]
        public void WhenHighYearStillPoorCountIsGreaterThanLowYearPoorCountABusinessExceptionIsThrown()
        {
            var ratio = new PovertyPersistenceRatio(country, 1999, 2000, 1000, 1001);
        }

        [Test, ExpectedException(typeof(BusinessException))]
        public void WhenLowYearCountIsNegativeABusinessExceptionIsThrown()
        {
            var ratio = new PovertyPersistenceRatio(country, lowYear, highYear, -1, -1);
        }

        [Test, ExpectedException(typeof(BusinessException))]
        public void WhenHighYearCountIsNegativeABusinessExceptionIsThrown()
        {
            var ratio = new PovertyPersistenceRatio(country, lowYear, highYear, lowYearCount, -1);
        }
    }
}


text:
import Resource from './Resource'

export default class Bookings extends Resource {
  async month (date, venueId) {
    return await this.request({
      method: 'GET',
      path: `/booking/month`,
      params: {
        date,
        venueId
      }
    })
  }
}


text:
package br.com.swconsultoria.cte.dom.enuns;

/**
 * @author Samuel Oliveira - samuk.exe@hotmail.com
 * Data: 02/03/2019 - 19:55
 */
public enum AssinaturaEnum {

    CTE("CTe","infCte"),
    CTE_OS ("CTeOS","infCte"),
    INUTILIZACAO("infInut","infInut"),
    EVENTO("eventoCTe","infEvento");

    private final String tipo;
    private final String tag;

    AssinaturaEnum(String tipo,String tag) {
        this.tipo = tipo;
        this.tag = tag;
    }

    public String getTipo() {
        return tipo;
    }
    public String getTag() {
        return tag;
    }
}


text:
"""The configs waiters delete command."""

from googlecloudsdk.api_lib.runtime_config import util
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.runtime_config import flags
from googlecloudsdk.core import log

class Delete(base.DeleteCommand):
  """Delete waiter resources.

  This command deletes the waiter resource with the specified name.
  """

  detailed_help = {
      'DESCRIPTION': '{description}',
      'EXAMPLES': """\
          To delete a waiter named "my-waiter" within a configuration named
          "my-config", run:

            $ {command} my-waiter --config-name my-config
          """,
  }

  @staticmethod
  def Args(parser):
    """Args is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    """
    flags.AddConfigFlag(parser)
    parser.add_argument('name', help='The waiter name.')

  def Collection(self):
    """Returns the default collection path string.

    Returns:
      The default collection path string.
    """
    return 'runtimeconfig.waiters'

  def Run(self, args):
    """Run 'runtime-configs waiters delete'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
    waiter_client = util.WaiterClient()
    messages = util.Messages()

    waiter_resource = util.ParseWaiterName(args.name, args)

    waiter_client.Delete(
        messages.RuntimeconfigProjectsConfigsWaitersDeleteRequest(
            name=waiter_resource.RelativeName(),
        )
    )

    log.DeletedResource(waiter_resource)


text:
class GenericObject < ApplicationRecord
  acts_as_miq_taggable

  virtual_has_one :custom_actions
  virtual_has_one :custom_action_buttons

  belongs_to :generic_object_definition
  has_one :picture, :through => :generic_object_definition

  validates :name, :presence => true

  delegate :property_attribute_defined?,
           :property_defined?,
           :type_cast,
           :property_association_defined?,
           :property_methods, :property_method_defined?,
           :custom_actions, :custom_action_buttons,
           :to => :generic_object_definition, :allow_nil => true

  delegate :name, :to => :generic_object_definition, :prefix => true, :allow_nil => false
  virtual_column :generic_object_definition_name, :type => :string

  def initialize(attributes = {})
    # generic_object_definition will be set first since hash iteration is based on the order of key insertion
    attributes = (attributes || {}).symbolize_keys
    attributes = attributes.slice(:generic_object_definition).merge(attributes.except(:generic_object_definition))
    super
  end

  def property_attributes=(options)
    raise "generic_object_definition is nil" unless generic_object_definition
    options.keys.each do |k|
      unless property_attribute_defined?(k)
        raise ActiveModel::UnknownAttributeError.new(self, k)
      end
    end
    options.each { |k, v| _property_setter(k, v) }
  end

  def property_attributes
    properties.select { |k, _| property_attribute_defined?(k) }.each_with_object({}) do |(k, _), h|
      h[k] = _property_getter(k)
    end
  end

  def property_associations
    properties.select { |k, _| property_association_defined?(k) }.each_with_object({}) do |(k, _), h|
      h[k] = _property_getter(k)
    end
  end

  def delete_property(name)
    if !property_attribute_defined?(name) && !property_association_defined?(name)
      valid_property_names = generic_object_definition.property_attributes.keys + generic_object_definition.property_associations.keys
      raise "Invalid property [#{name}]: must be one of #{valid_property_names.join(", ")}"
    end

    _property_getter(name).tap do
      properties.delete(name.to_s)
      save!
    end
  end

  def add_to_property_association(name, objs)
    objs = [objs] unless objs.kind_of?(Array)
    name = name.to_s
    properties[name] ||= []

    klass = generic_object_definition.property_associations[name].constantize
    selected = objs.select { |obj| obj.kind_of?(klass) }
    properties[name] = (properties[name] + selected.pluck(:id)).uniq if selected
    save!
  end

  def delete_from_property_association(name, objs)
    objs = [objs] unless objs.kind_of?(Array)
    name = name.to_s
    properties[name] ||= []

    klass = generic_object_definition.property_associations[name].constantize
    selected = objs.select { |obj| obj.kind_of?(klass) }
    common_ids = properties[name] & selected.pluck(:id)
    properties[name] = properties[name] - common_ids
    return unless properties_changed?

    save!
    klass.where(:id => common_ids).to_a
  end

  def add_to_service(service)
    service.add_resource!(self)
  end

  def remove_from_service(service)
    service.remove_resource(self)
  end

  def inspect
    attributes_as_string = (self.class.column_names - ["properties"]).collect do |name|
      "#{name}: #{attribute_for_inspect(name)}"
    end

    attributes_as_string += ["attributes: #{property_attributes}"]
    attributes_as_string += ["associations: #{generic_object_definition.property_associations.keys}"]
    attributes_as_string += ["methods: #{property_methods}"]

    prefix = Kernel.instance_method(:inspect).bind(self).call.split(' ', 2).first
    "#{prefix} #{attributes_as_string.join(", ")}>"
  end

  def ae_user_identity(*args)
    @user, @group, @tenant = *args
    raise "A user is required to send calls to automate." unless @user

    @group  ||= @user.current_group
    @tenant ||= @user.current_tenant
  end

  private

  # The properties column contains raw data that are converted during read/write.
  # Don't want the user access it directly.
  #
  def properties
    super
  end

  def properties=(options)
    super
  end

  def method_missing(method_name, *args)
    m = method_name.to_s.chomp("=")

    return _call_automate(m, *args) if property_method_defined?(m)

    if property_attribute_defined?(m) || property_association_defined?(m)
      return method_name.to_s.end_with?('=') ? _property_setter(m, args.first) : _property_getter(m)
    end

    super
  end

  def respond_to_missing?(method_name, _include_private = false)
    return true if property_defined?(method_name.to_s.chomp('='))
    super
  end

  def _property_getter(name)
    generic_object_definition.property_getter(name.to_s, properties[name.to_s])
  end

  def _property_setter(name, value)
    name = name.to_s

    val =
      if property_attribute_defined?(name)
        # property attribute is of single value, for now
        type_cast(name, value)
      elsif property_association_defined?(name)
        # property association is of multiple values
        value.select { |v| v.kind_of?(generic_object_definition.property_associations[name].constantize) }.uniq.map(&:id)
      end

    self.properties = properties.merge(name => val)
  end

  # the method parameters are passed into automate as a hash:
  # {:param_1 => 12, :param_1_type => "Vm", :param_2 => 14, :param_2_type => "Integer"}
  # the return value from automate is in $evm.root['method_result']
  def _call_automate(method_name, *args)
    @user ||= User.current_user
    @group ||= User.current_user.current_group
    @tenant ||= User.current_user.current_tenant
    raise "A user is required to send [#{method_name}] to automate." unless @user

    attrs = { :method_name => method_name }
    args.each_with_index do |item, idx|
      attrs["param_#{idx + 1}".to_sym] = item
      attrs["param_#{idx + 1}_type".to_sym] = item.class.name
    end

    options = {
      :object_type   => self.class.name,
      :object_id     => id,
      :instance_name => 'GenericObject',
      :user_id       => @user.id,
      :miq_group_id  => @group.id,
      :tenant_id     => @tenant.id,
      :attrs         => attrs
    }

    ws = MiqAeEngine.deliver(options)
    ws.root['method_result']
  end
end


text:
require 'spec_helper'

describe Gitlab::CrossProjectAccess::ClassMethods do
  let(:dummy_class) do
    Class.new do
      extend Gitlab::CrossProjectAccess::ClassMethods
    end
  end
  let(:dummy_proc) { lambda { false } }

  describe '#requires_cross_project_access' do
    it 'creates a correct check when a hash is passed' do
      expect(Gitlab::CrossProjectAccess)
        .to receive(:add_check).with(dummy_class,
                                     actions: { hello: true, world: false },
                                     positive_condition: dummy_proc,
                                     negative_condition: dummy_proc)

      dummy_class.requires_cross_project_access(
        hello: true, world: false, if: dummy_proc, unless: dummy_proc
      )
    end

    it 'creates a correct check when an array is passed' do
      expect(Gitlab::CrossProjectAccess)
        .to receive(:add_check).with(dummy_class,
                                     actions: { hello: true, world: true },
                                     positive_condition: nil,
                                     negative_condition: nil)

      dummy_class.requires_cross_project_access(:hello, :world)
    end

    it 'creates a correct check when an array and a hash is passed' do
      expect(Gitlab::CrossProjectAccess)
        .to receive(:add_check).with(dummy_class,
                                     actions: { hello: true, world: true },
                                     positive_condition: dummy_proc,
                                     negative_condition: dummy_proc)

      dummy_class.requires_cross_project_access(
        :hello, :world, if: dummy_proc, unless: dummy_proc
      )
    end
  end
end


text:
/**
 * Created by pal on 2015-02-26.
 */
var keystone = require('keystone');
var operation = keystone.list('Operation');
var process = keystone.list('Processteg');
var content = keystone.list('Processinnehall');
var article = keystone.list('Artikel');

exports = module.exports = function(req, res) {
  var view = new keystone.View(req, res),
    locals = res.locals;
  locals.section = 'info';
  locals.scripts = [
    'info.js',
    'checklist.js',
    'checkEffect.js',
    'lib/featherlight/featherlight.min.js',
    'lib/jquery.zoom.min.js',
    'lightbox.js',
    'removePreparation.js',
    'lib/__jquery.tablesorter/jquery.tablesorter.js'
  ];

  locals.css = [
    'lib/featherlight.min.css',
    'site/info.css'
  ];

  view.on('get', {operation: 'create'}, function(){
    console.log("AAAA: " + req.params.slug);
    operation.model.fromTemplate(req.params.slug, function(newOperation){
      console.log(newOperation);

      operation.model.findOne({slug: newOperation.slug }, function (err, data){
        if(err){
          console.log('Operationen kunde inte ändras.');
          return;
        }
        data.linda_id = req.query.linda;
        data.save();
        keystone.io.emit('updateOverview')
      });

      res.redirect("/info/" + newOperation.slug);
    });
  });

  view.on('init', function(next) {
    operation.model.find({
      slug: req.params.slug
    }).populate('specialty')
      .exec(function (err, data) {
        if (err) {
          console.log('DB error');
          console.log(err);
          return;
        } else if (data.length === 0) {
          locals.data = {title: "Sidan finns ej"}
          //view.render('info');
        } else {
          locals.data = data[0];
        }
        next(err);
      });
  });

  view.on('init', function(next) {
    article.model.find({
      operation: locals.data._id
    })
      .sort('name')
      .populate('kartotek')
      .exec(function (err, articleData) {

        if (err) {
          console.log('DB error');
          console.log(err);
          return;
        }

        locals.articles = articleData;
        next(err);
      });
  });

  view.on('init', function(next) {
    process.model.find({
      operation: locals.data._id
    })
      .sort('order')
      .exec(function (err, processData) {
        if (err) {
          console.log('DB error');
          console.log(err);
          return;
        }
        locals.processes = processData;
        next(err);
      });
  });

  view.on('init', function(next) {
    locals.processes.forEach(function (e, i) {
      view.on('init', function(next) {
        content.model.find({
          process: e._id
        })
          .sort('order')
          .exec(function (err, contentData) {
            if (err) {
              console.log('DB error');
              console.log(err);
              return;
            }
            e.contents = contentData;
            next(err);
          });
      });
    });
    next(null);
  });

  view.render('info');

};


text:
module Fastlane
  class PluginInfo
    attr_reader :plugin_name
    attr_reader :author
    attr_reader :gem_name
    attr_reader :email
    attr_reader :summary

    def initialize(plugin_name, author, email, summary)
      @plugin_name = plugin_name
      @author = author
      @email = email
      @summary = summary
    end

    def gem_name
      "#{Fastlane::PluginManager::FASTLANE_PLUGIN_PREFIX}#{plugin_name}"
    end

    def require_path
      gem_name.tr('-', '/')
    end

    def actions_path
      File.join(require_path, 'actions')
    end

    def helper_path
      File.join(require_path, 'helper')
    end

    # Used to expose a local binding for use in ERB templating
    #
    # rubocop:disable Style/AccessorMethodName
    def get_binding
      binding
    end
    # rubocop:enable Style/AccessorMethodName

    def ==(other)
      @plugin_name == other.plugin_name &&
        @author == other.author &&
        @email == other.email &&
        @summary == other.summary
    end
  end
end


text:
<?php

namespace Tests\Mock\WindowsAzure\Common\Internal\Filters;
use Tests\Framework\TestResources;

/**
 * Alters request headers and response to mock real filter
 *
 * @category  Microsoft
 * @package   Tests\Mock\WindowsAzure\Common\Internal\Filters
 * @author    Azure PHP SDK <azurephpsdk@microsoft.com>
 * @copyright 2012 Microsoft Corporation
 * @license   http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 * @version   Release: 0.4.0_2014-01
 * @link      https://github.com/windowsazure/azure-sdk-for-php
 */
class SimpleFilterMock implements \WindowsAzure\Common\Internal\IServiceFilter
{
    private $_headerName;
    private $_data;

    public function __construct($headerName, $data)
    {
        $this->_data       = $data;
        $this->_headerName = $headerName;
    }

    public function handleRequest($request)
    {
        $request->setHeader($this->_headerName, $this->_data);
        $request->setHeader('Accept-Encoding', 'identity', true);
        return $request;
    }

    public function handleResponse($request, $response)
    {
        $response->appendBody($this->_data);
        return $response;
    }
}


text:
/* The following code was generated by JFlex 1.4.1 on 3/4/08 9:58 AM */

package edu.stanford.nlp.trees.international.negra;
import edu.stanford.nlp.io.*;

/** A lexer for the Penn Treebank-style context-free version of the
 * NEGRA corpus.  Inherits ACCEPT and IGNORE fields from
 * edu.stanford.nlp.trees.international.Lexer.
 *
 * @author Roger Levy
 */

class NegraPennLexer implements Lexer {

  /** This character denotes the end of file */
  public static final int YYEOF = -1;

  /** initial size of the lookahead buffer */
  private static final int ZZ_BUFFERSIZE = 16384;

  /** lexical states */
  public static final int SENTENCE = 1;
  public static final int YYINITIAL = 0;

  /**
   * Translates characters to character classes
   */
  private static final String ZZ_CMAP_PACKED =
    "\11\0\1\11\1\13\1\11\1\11\1\12\22\0\1\2\4\14\1\1"+
    "\2\14\2\10\6\14\12\7\31\14\1\3\12\14\1\0\6\14\1\4"+
    "\10\14\1\5\5\14\1\6\6\14\12\0\1\11\41\0\1\14\17\0"+
    "\1\14\10\0\100\14\u1f28\0\1\11\1\11\udfd6\0";

  /**
   * Translates characters to character classes
   */
  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);

  /**
   * Translates DFA states to action switch labels.
   */
  private static final int [] ZZ_ACTION = zzUnpackAction();

  private static final String ZZ_ACTION_PACKED_0 =
    "\2\0\1\1\1\2\1\3\2\2\1\3\1\4\1\2"+
    "\6\0\1\3";

  private static int [] zzUnpackAction() {
    int [] result = new int[17];
    int offset = 0;
    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackAction(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }

  /**
   * Translates a state to a row index in the transition table
   */
  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();

  private static final String ZZ_ROWMAP_PACKED_0 =
    "\0\0\0\15\0\32\0\47\0\32\0\64\0\32\0\101"+
    "\0\32\0\116\0\133\0\150\0\165\0\202\0\217\0\234"+
    "\0\234";

  private static int [] zzUnpackRowMap() {
    int [] result = new int[17];
    int offset = 0;
    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
    int i = 0;  /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int high = packed.charAt(i++) << 16;
      result[j++] = high | packed.charAt(i++);
    }
    return j;
  }

  /**
   * The transition table of the DFA
   */
  private static final int [] ZZ_TRANS = zzUnpackTrans();

  private static final String ZZ_TRANS_PACKED_0 =
    "\1\3\1\4\1\5\5\6\1\7\1\5\1\10\1\5"+
    "\1\6\15\11\16\0\1\12\1\0\5\6\4\0\1\6"+
    "\1\0\1\6\1\0\5\6\4\0\1\6\13\0\1\5"+
    "\2\0\1\6\1\13\5\6\4\0\1\6\3\0\1\14"+
    "\15\0\1\15\15\0\1\16\15\0\1\17\10\0\1\20"+
    "\21\0\1\21\5\0";

  private static int [] zzUnpackTrans() {
    int [] result = new int[169];
    int offset = 0;
    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackTrans(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      value--;
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }

  /* error codes */
  private static final int ZZ_UNKNOWN_ERROR = 0;
  private static final int ZZ_NO_MATCH = 1;
  private static final int ZZ_PUSHBACK_2BIG = 2;

  /* error messages for the codes above */
  private static final String ZZ_ERROR_MSG[] = {
    "Unkown internal scanner error",
    "Error: could not match input",
    "Error: pushback value was too large"
  };

  /**
   * ZZ_ATTRIBUTE[aState] contains the attributes of state aState
   */
  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();

  private static final String ZZ_ATTRIBUTE_PACKED_0 =
    "\2\0\1\11\1\1\1\11\1\1\1\11\1\1\1\11"+
    "\1\1\6\0\1\1";

  private static int [] zzUnpackAttribute() {
    int [] result = new int[17];
    int offset = 0;
    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }

  /** the input device */
  private java.io.Reader zzReader;

  /** the current state of the DFA */
  private int zzState;

  /** the current lexical state */
  private int zzLexicalState = YYINITIAL;

  /** this buffer contains the current text to be matched and is
      the source of the yytext() string */
  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];

  /** the textposition at the last accepting state */
  private int zzMarkedPos;

  /** the textposition at the last state to be included in yytext */
  private int zzPushbackPos;

  /** the current text position in the buffer */
  private int zzCurrentPos;

  /** startRead marks the beginning of the yytext() string in the buffer */
  private int zzStartRead;

  /** endRead marks the last character in the buffer, that has been read
      from input */
  private int zzEndRead;

  /** number of newlines encountered up to the start of the matched text */
  private int yyline;

  /** the number of characters up to the start of the matched text */
  private int yychar;

  /**
   * the number of characters from the last newline up to the start of the
   * matched text
   */
  private int yycolumn;

  /**
   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
   */
  private boolean zzAtBOL = true;

  /** zzAtEOF == true <=> the scanner is at the EOF */
  private boolean zzAtEOF;

  /* user code: */
  public void pushBack(int n) {
    yypushback(n);
  }

  public int getYYEOF() {
    return YYEOF;
  }

  /**
   * Creates a new scanner
   * There is also a java.io.InputStream version of this constructor.
   *
   * @param   in  the java.io.Reader to read input from.
   */
  NegraPennLexer(java.io.Reader in) {
    this.zzReader = in;
  }

  /**
   * Creates a new scanner.
   * There is also java.io.Reader version of this constructor.
   *
   * @param   in  the java.io.Inputstream to read input from.
   */
  NegraPennLexer(java.io.InputStream in) {
    this(new java.io.InputStreamReader(in));
  }

  /**
   * Unpacks the compressed character translation table.
   *
   * @param packed   the packed character translation table
   * @return         the unpacked character translation table
   */
  private static char [] zzUnpackCMap(String packed) {
    char [] map = new char[0x10000];
    int i = 0;  /* index in packed string  */
    int j = 0;  /* index in unpacked array */
    while (i < 74) {
      int  count = packed.charAt(i++);
      char value = packed.charAt(i++);
      do map[j++] = value; while (--count > 0);
    }
    return map;
  }

  /**
   * Refills the input buffer.
   *
   * @return      false, iff there was new input.
   *
   * @exception   java.io.IOException  if any I/O-Error occurs
   */
  private boolean zzRefill() throws java.io.IOException {

    /* first: make room (if you can) */
    if (zzStartRead > 0) {
      System.arraycopy(zzBuffer, zzStartRead,
                       zzBuffer, 0,
                       zzEndRead-zzStartRead);

      /* translate stored positions */
      zzEndRead-= zzStartRead;
      zzCurrentPos-= zzStartRead;
      zzMarkedPos-= zzStartRead;
      zzPushbackPos-= zzStartRead;
      zzStartRead = 0;
    }

    /* is the buffer big enough? */
    if (zzCurrentPos >= zzBuffer.length) {
      /* if not: blow it up */
      char newBuffer[] = new char[zzCurrentPos*2];
      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
      zzBuffer = newBuffer;
    }

    /* finally: fill the buffer with new input */
    int numRead = zzReader.read(zzBuffer, zzEndRead,
                                            zzBuffer.length-zzEndRead);

    if (numRead < 0) {
      return true;
    }
    else {
      zzEndRead+= numRead;
      return false;
    }
  }

  /**
   * Closes the input stream.
   */
  public final void yyclose() throws java.io.IOException {
    zzAtEOF = true;            /* indicate end of file */
    zzEndRead = zzStartRead;  /* invalidate buffer    */

    if (zzReader != null)
      zzReader.close();
  }

  /**
   * Resets the scanner to read from a new input stream.
   * Does not close the old reader.
   *
   * All internal variables are reset, the old input stream
   * cannot be reused (internal buffer is discarded and lost).
   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
   *
   * @param reader   the new input stream
   */
  public final void yyreset(java.io.Reader reader) {
    zzReader = reader;
    zzAtBOL  = true;
    zzAtEOF  = false;
    zzEndRead = zzStartRead = 0;
    zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
    yyline = yychar = yycolumn = 0;
    zzLexicalState = YYINITIAL;
  }

  /**
   * Returns the current lexical state.
   */
  public final int yystate() {
    return zzLexicalState;
  }

  /**
   * Enters a new lexical state
   *
   * @param newState the new lexical state
   */
  public final void yybegin(int newState) {
    zzLexicalState = newState;
  }

  /**
   * Returns the text matched by the current regular expression.
   */
  public final String yytext() {
    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
  }

  /**
   * Returns the character at position <tt>pos</tt> from the
   * matched text.
   *
   * It is equivalent to yytext().charAt(pos), but faster
   *
   * @param pos the position of the character to fetch.
   *            A value from 0 to yylength()-1.
   *
   * @return the character at position pos
   */
  public final char yycharat(int pos) {
    return zzBuffer[zzStartRead+pos];
  }

  /**
   * Returns the length of the matched text region.
   */
  public final int yylength() {
    return zzMarkedPos-zzStartRead;
  }

  /**
   * Reports an error that occured while scanning.
   *
   * In a wellformed scanner (no or only correct usage of
   * yypushback(int) and a match-all fallback rule) this method
   * will only be called with things that "Can't Possibly Happen".
   * If this method is called, something is seriously wrong
   * (e.g. a JFlex bug producing a faulty scanner etc.).
   *
   * Usual syntax/scanner level error handling should be done
   * in error fallback rules.
   *
   * @param   errorCode  the code of the errormessage to display
   */
  private void zzScanError(int errorCode) {
    String message;
    try {
      message = ZZ_ERROR_MSG[errorCode];
    }
    catch (ArrayIndexOutOfBoundsException e) {
      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
    }

    throw new Error(message);
  }

  /**
   * Pushes the specified amount of characters back into the input stream.
   *
   * They will be read again by then next call of the scanning method
   *
   * @param number  the number of characters to be read again.
   *                This number must not be greater than yylength()!
   */
  public void yypushback(int number)  {
    if ( number > yylength() )
      zzScanError(ZZ_PUSHBACK_2BIG);

    zzMarkedPos -= number;
  }

  /**
   * Resumes scanning until the next regular expression is matched,
   * the end of input is encountered or an I/O-Error occurs.
   *
   * @return      the next token
   * @exception   java.io.IOException  if any I/O-Error occurs
   */
  public int yylex() throws java.io.IOException {
    int zzInput;
    int zzAction;

    // cached fields:
    int zzCurrentPosL;
    int zzMarkedPosL;
    int zzEndReadL = zzEndRead;
    char [] zzBufferL = zzBuffer;
    char [] zzCMapL = ZZ_CMAP;

    int [] zzTransL = ZZ_TRANS;
    int [] zzRowMapL = ZZ_ROWMAP;
    int [] zzAttrL = ZZ_ATTRIBUTE;

    while (true) {
      zzMarkedPosL = zzMarkedPos;

      zzAction = -1;

      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;

      zzState = zzLexicalState;

      zzForAction: {
        while (true) {

          if (zzCurrentPosL < zzEndReadL)
            zzInput = zzBufferL[zzCurrentPosL++];
          else if (zzAtEOF) {
            zzInput = YYEOF;
            break zzForAction;
          }
          else {
            // store back cached positions
            zzCurrentPos  = zzCurrentPosL;
            zzMarkedPos   = zzMarkedPosL;
            boolean eof = zzRefill();
            // get translated positions and possibly new buffer
            zzCurrentPosL  = zzCurrentPos;
            zzMarkedPosL   = zzMarkedPos;
            zzBufferL      = zzBuffer;
            zzEndReadL     = zzEndRead;
            if (eof) {
              zzInput = YYEOF;
              break zzForAction;
            }
            else {
              zzInput = zzBufferL[zzCurrentPosL++];
            }
          }
          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
          if (zzNext == -1) break zzForAction;
          zzState = zzNext;

          int zzAttributes = zzAttrL[zzState];
          if ( (zzAttributes & 1) == 1 ) {
            zzAction = zzState;
            zzMarkedPosL = zzCurrentPosL;
            if ( (zzAttributes & 8) == 8 ) break zzForAction;
          }

        }
      }

      // store back cached position
      zzMarkedPos = zzMarkedPosL;

      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
        case 2:
          { return ACCEPT;
          }
        case 5: break;
        case 1:
          { System.err.println("Error: " + yytext());
                            return IGNORE;
          }
        case 6: break;
        case 4:
          { System.out.print(yytext());
          }
        case 7: break;
        case 3:
          { return IGNORE;
          }
        case 8: break;
        default:
          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
            zzAtEOF = true;
            return YYEOF;
          }
          else {
            zzScanError(ZZ_NO_MATCH);
          }
      }
    }
  }

  /**
   * Runs the scanner on input files.
   *
   * This is a standalone scanner, it will print any unmatched
   * text to System.out unchanged.
   *
   * @param argv   the command line, contains the filenames to run
   *               the scanner on.
   */
  public static void main(String argv[]) {
    if (argv.length == 0) {
      System.out.println("Usage : java NegraPennLexer <inputfile>");
    }
    else {
      for (int i = 0; i < argv.length; i++) {
        NegraPennLexer scanner = null;
        try {
          scanner = new NegraPennLexer( new java.io.FileReader(argv[i]) );
          while ( !scanner.zzAtEOF ) scanner.yylex();
        }
        catch (java.io.FileNotFoundException e) {
          System.out.println("File not found : \""+argv[i]+"\"");
        }
        catch (java.io.IOException e) {
          System.out.println("IO error scanning file \""+argv[i]+"\"");
          System.out.println(e);
        }
        catch (Exception e) {
          System.out.println("Unexpected exception:");
          e.printStackTrace();
        }
      }
    }
  }

}


text:
package org.eclipse.winery.repository;

import java.util.Calendar;
import java.util.Date;

public class Constants {

	/** repository specific **/
	public static final String DEFAULT_REPO_NAME = "winery-repository";
	// this directory is checked for existence. If it does not exist
	// $HOME/DEFAULT_REPO_NAME is used
	public static final String GLOBAL_REPO_PATH_WINDOWS = "C:\\" + Constants.DEFAULT_REPO_NAME;

	/** file-system in general **/
	public static final String newline = System.getProperty("line.separator");

	// Path to images for extensions
	// Currently, we require the format <filenamextension>.png
	public static final String PATH_MIMETYPEIMAGES = "/images/mime-types/";

	// suffix for BPMN4TOSCA
	public static final String SUFFIX_BPMN4TOSCA = ".bpmn4tosca";

	// suffix for CSAR files
	public static final String SUFFIX_CSAR = ".csar";

	// suffix for files in the directory PATH_MIMETYPEIMAGES, including "."
	public static final String SUFFIX_MIMETYPEIMAGES = ".png";

	// suffix for files storing the mimetype of the belonging files
	// used in implementors if IRepository of no appropriate implementation for storing a mimetype is available
	public static final String SUFFIX_MIMETYPE = ".mimetype";

	// suffix for all property files
	public static final String SUFFIX_PROPERTIES = ".properties";

	// suffix for all files storing Definitions
	// following  line 2935 of TOSCA cos01
	public static final String SUFFIX_TOSCA_DEFINITIONS = ".tosca";

	// at each new start of the application, the modified date changes
	// reason: the default values of the properties or the JSP could have
	// changed
	public static final Date LASTMODIFIEDDATE_FOR_404 = Calendar.getInstance().getTime();

	public static final String TOSCA_PLANTYPE_BUILD_PLAN = "http://docs.oasis-open.org/tosca/ns/2011/12/PlanTypes/BuildPlan";
	public static final String TOSCA_PLANTYPE_TERMINATION_PLAN = "http://docs.oasis-open.org/tosca/ns/2011/12/PlanTypes/TerminationPlan";

	public static final String DIRNAME_SELF_SERVICE_METADATA = "SELFSERVICE-Metadata";

	/* used for IA generation */
	//public static final String NAMESPACE_ARTIFACTTYPE_WAR = "http://www.opentosca.org/types";
	public static final String NAMESPACE_ARTIFACTTYPE_WAR = "http://www.example.com/ToscaTypes";
	public static final String LOCALNAME_ARTIFACTTYPE_WAR = "WAR";

}


text: Show Order Pending


text:
<?php

namespace App\Models;

use App\Http\Request;
use PDO;

class Navigation extends Model {
  public function getNavigations($applicationId) {
    $connection = $this->getDb()->getConnection();
    $statement = $connection->prepare('SELECT pgapex.f_navigation_get_navigations(:applicationId)');
    $statement->bindValue(':applicationId', $applicationId, PDO::PARAM_INT);
    $statement->execute();
    return $statement->fetchColumn();
  }

  public function saveNavigation(Request $request) {
    $connection = $this->getDb()->getConnection();
    $statement = $connection->prepare('SELECT pgapex.f_navigation_save_navigation(:navigationId, :applicationId, :name)');
    $statement->bindValue(':navigationId',  $request->getApiAttribute('navigationId'),  PDO::PARAM_INT);
    $statement->bindValue(':applicationId', $request->getApiAttribute('applicationId'), PDO::PARAM_INT);
    $statement->bindValue(':name',          $request->getApiAttribute('name'),         PDO::PARAM_STR);
    $statement->execute();
    return $statement->fetchColumn() === true;
  }

  public function getNavigation($navigationId) {
    $connection = $this->getDb()->getConnection();
    $statement = $connection->prepare('SELECT pgapex.f_navigation_get_navigation(:navigationId)');
    $statement->bindValue(':navigationId', $navigationId, PDO::PARAM_INT);
    $statement->execute();
    return $statement->fetchColumn();
  }

  public function deleteNavigation($navigationId) {
    $connection = $this->getDb()->getConnection();
    $statement = $connection->prepare('SELECT pgapex.f_navigation_delete_navigation(:navigationId)');
    $statement->bindValue(':navigationId', $navigationId, PDO::PARAM_INT);
    $statement->execute();
    return $statement->fetchColumn() === true;
  }

  public function getNavigationItems($navigationId) {
    $connection = $this->getDb()->getConnection();
    $statement = $connection->prepare('SELECT pgapex.f_navigation_get_navigation_items(:navigationId)');
    $statement->bindValue(':navigationId', $navigationId, PDO::PARAM_INT);
    $statement->execute();
    return $statement->fetchColumn();
  }

  public function deleteNavigationItem($navigationItemId) {
    $connection = $this->getDb()->getConnection();
    $statement = $connection->prepare('SELECT pgapex.f_navigation_delete_navigation_item(:navigationItemId)');
    $statement->bindValue(':navigationItemId', $navigationItemId, PDO::PARAM_INT);
    $statement->execute();
    return $statement->fetchColumn() === true;
  }

  public function getNavigationItem($navigationItemId) {
    $connection = $this->getDb()->getConnection();
    $statement = $connection->prepare('SELECT pgapex.f_navigation_get_navigation_item(:navigationItemId)');
    $statement->bindValue(':navigationItemId', $navigationItemId, PDO::PARAM_INT);
    $statement->execute();
    return $statement->fetchColumn();
  }

  public function saveNavigationItem(Request $request) {
    $connection = $this->getDb()->getConnection();
    $statement = $connection->prepare('SELECT pgapex.f_navigation_save_navigation_item(:navigationItemId, :parentNavigationItem, :navigationId, :name, :sequence, :page, :url)');
    $statement->bindValue(':navigationItemId',     $request->getApiAttribute('navigationItemId'),     PDO::PARAM_INT);
    $statement->bindValue(':parentNavigationItem', $request->getApiAttribute('parentNavigationItem'), PDO::PARAM_INT);
    $statement->bindValue(':navigationId',         $request->getApiAttribute('navigationId'),         PDO::PARAM_INT);
    $statement->bindValue(':name',                 $request->getApiAttribute('name'),                 PDO::PARAM_STR);
    $statement->bindValue(':sequence',             $request->getApiAttribute('sequence'),             PDO::PARAM_INT);
    $statement->bindValue(':page',                 $request->getApiAttribute('page'),                 PDO::PARAM_INT);
    $statement->bindValue(':url',                  $request->getApiAttribute('url'),                  PDO::PARAM_STR);
    $statement->execute();
    return $statement->fetchColumn() === true;
  }
}


text:
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */

#include <sstream>
#include <limits>
#include <map>
#include "ifcpp/reader/ReaderUtil.h"
#include "ifcpp/writer/WriterUtil.h"
#include "ifcpp/model/BasicTypes.h"
#include "ifcpp/model/BuildingException.h"
#include "ifcpp/IFC4/include/IfcDerivedMeasureValue.h"
#include "ifcpp/IFC4/include/IfcPHMeasure.h"

// TYPE IfcPHMeasure = REAL;
IfcPHMeasure::IfcPHMeasure( double value ) { m_value = value; }
shared_ptr<BuildingObject> IfcPHMeasure::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcPHMeasure> copy_self( new IfcPHMeasure() );
	copy_self->m_value = m_value;
	return copy_self;
}
void IfcPHMeasure::getStepParameter( std::stringstream& stream, bool is_select_type ) const
{
	if( is_select_type ) { stream << "IFCPHMEASURE("; }
	appendRealWithoutTrailingZeros( stream, m_value );
	if( is_select_type ) { stream << ")"; }
}
const std::wstring IfcPHMeasure::toString() const
{
	std::wstringstream strs;
	strs << m_value;
	return strs.str();
}
shared_ptr<IfcPHMeasure> IfcPHMeasure::createObjectFromSTEP( const std::wstring& arg, const std::map<int,shared_ptr<BuildingEntity> >& map )
{
	if( arg.compare( L"$" ) == 0 ) { return shared_ptr<IfcPHMeasure>(); }
	if( arg.compare( L"*" ) == 0 ) { return shared_ptr<IfcPHMeasure>(); }
	shared_ptr<IfcPHMeasure> type_object( new IfcPHMeasure() );
	readReal( arg, type_object->m_value );
	return type_object;
}


text:
package fink

import fink.data._
import fink.support.Config

import org.scalatra.test.specs2.MutableScalatraSpec

import org.json4s._
import org.json4s.jackson._
import org.json4s.jackson.JsonMethods._
import org.json4s.jackson.Serialization.{write => jswrite}

import scala.slick.driver.H2Driver.simple._
import Database.threadLocalSession

class RestTests extends MutableScalatraSpec {

  sequential

  // TODO use test database

  Repositories.init
  Repositories.db withSession {
    Query(SettingsTable).firstOption.foreach(Config.init)
  }

  addServlet(classOf[fink.web.Admin], "/*")

  implicit val jsonFormats = Serialization.formats(ShortTypeHints(List(classOf[Post], classOf[Page], classOf[Category], classOf[Tag]))) + FieldSerializer[Post]()  + FieldSerializer[Gallery]() + FieldSerializer[Image]()

  val dummyPost = {
    val p = Post(0, 0, 0, "title", "author", "shortlink", "text")
    p.tags = List(Tag(0, "foo"), Tag(0, "bar"))
    p.category = Some(Category(0, "cat"))
    p
  }

  "posts" should {
    "should create post" in {
      post("/api/posts", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(dummyPost)) {
        status must beEqualTo(200)

        val p2 = parse(body).extract[Post]
        (p2.title, p2.author, p2.text) must beEqualTo((dummyPost.title, dummyPost.author, dummyPost.text))
        p2.tags.map(_.name) must containAllOf(dummyPost.tags.map(_.name))
        p2.category.map(_.name) must beEqualTo(dummyPost.category.map(_.name))

        get(f"/api/posts/${p2.id}") {
          status must beEqualTo(200)
        }
      }
    }

     "should create, retrieve and delete post" in {
       post("/api/posts", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(dummyPost)) {
         status must beEqualTo(200)
         val p2 = parse(body).extract[Post]

         get(f"/api/posts/${p2.id}") {
           status must beEqualTo(200)
         }

         submit("DELETE", f"/api/posts/${p2.id}") {
           status must beEqualTo(204)
         }

//         submit("DELETE", f"/api/posts/${p2.id}") {
//           status must beEqualTo(404)
//         }

//         get(f"/api/posts/${p2.id}") {
//           status must beEqualTo(404)
//         }
       }

       true
     }

     "should retrieve all posts" in {
       get("/api/posts") {
         status must beEqualTo(200)
         parse(body).extract[List[Post]] must have size(1)
       }
     }

//     "should update post" in {
//       val p = Post(1, 0, 1, "title", "author", "shortlink", "text")
//
//       post("/api/posts", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(p)) {
//         status must beEqualTo(200)
//       }
//
//       val p2 = p.copy(title = "foo bla", author = "foo author", text = "foo text")
//
//       put("/api/posts/%s".format(1), headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(p2)) {
//         status must beEqualTo(204)
//       }
//
//       get("/api/posts/%s".format(1)) {
//         status must beEqualTo(200)
//         jsread[Post](body) must beEqualTo(p2)
//       }
//     }

     "should find tags for post" in {
       get("/api/posts/%s/tags".format(1)) {
         status must beEqualTo(200)
         val tags = parse(body).extract[List[Tag]]
         tags must have size(2)
       }
     }
   }

//   "should create new relation from post to tag" in {
//     post("/api/posts/%s/tags/%s".format(1, "fnord")) {
//       status must beEqualTo(204)
//     }
//
//     post("/api/posts/%s/tags/%s".format(1, "fnord")) {
//       status must beEqualTo(204)
//     }
//
//     get("/api/posts/%s/tags".format(1)) {
//       status must beEqualTo(200)
//       val tags = jsread[List[Tag]](body)
//       tags must have size(3)
//     }
//   }
//
//   "should delete tag from post" in {
//     submit("DELETE", "/api/posts/%s/tags/%s".format(1, "blubbb")) {
//       status must beEqualTo(204)
//     }
//
//     get("/api/posts/%s/tags".format(1)) {
//       status must beEqualTo(200)
//       val tags = jsread[List[Tag]](body)
//       tags must have size(3)
//     }
//
//     // delete("/api/posts/%s/tags/%s".format(1, "fnord")) {
//     submit("DELETE", "/api/posts/%s/tags/%s".format(1, "fnord")) {
//       status must beEqualTo(204)
//     }
//
//     get("/api/posts/%s/tags".format(1)) {
//       status must beEqualTo(200)
//       val tags = jsread[List[Tag]](body)
//       tags must have size(2)
//     }
//   }
//
//   "should create category" in {
//     val rbody = jswrite(Category(0, "foo"))
//     post("/api/categories", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = rbody) {
//       status must beEqualTo(200)
//     }
//   }
//
//   "should retrieve post category" in {
//     get("/api/posts/%s/category".format(1)) {
//       status must beEqualTo(200)
//       val category = jsread[Category](body)
//       category must beEqualTo(Category(1, "cat"))
//     }
//   }
//
//   "should be able to modify post category" in {
//     put("/api/posts/%s/category/%s".format(1, "foo")) {
//       status must beEqualTo(204)
//     }
//
//
//     get("/api/posts/%s".format(1)) {
//       status must beEqualTo(200)
//       val post = jsread[Post](body)
//       post.category must beSome.which(_.name must beEqualTo("foo"))
//     }
//   }
//
//   "should do crud on tags" in {
//     get("/api/tags") {
//       status must beEqualTo(200)
//       val tags = jsread[List[Tag]](body)
//       val tag = Tag(0, "baz")
//
//       // create tag
//       post("/api/tags", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(tag)) {
//         status must beEqualTo(200)
//         val tag = jsread[Tag](body)
//         tag.name must beEqualTo("baz")
//
//         val tag2 = tag.copy(name = "blubbb")
//
//         // modify tag
//         put("/api/tags/%s".format(tag2.id), headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(tag2)) {
//           status must beEqualTo(204)
//         }
//
//         get("/api/tags/%s".format(tag2.id)) {
//           status must beEqualTo(200)
//           val tag3 = jsread[Tag](body)
//           tag3.name must beEqualTo("blubbb")
//         }
//
//         get("/api/tags") {
//           status must beEqualTo(200)
//           val tags2 = jsread[List[Tag]](body)
//           tags2 must have size(tags.size+1)
//         }
//
//         // delete tag
//         submit("DELETE", "/api/tags/%s".format(tag2.id)) {
//           status must beEqualTo(204)
//         }
//
//         submit("DELETE", "/api/tags/%s".format(tag2.id)) {
//           status must beEqualTo(404)
//         }
//
//         get("/api/tags") {
//           status must beEqualTo(200)
//           val tags2 = jsread[List[Tag]](body)
//           tags2 must have size(tags.size)
//         }
//       }
//     }
//   }
//
//   "should do crud on categories" in {
//     get("/api/categories") {
//       status must beEqualTo(200)
//       val categories = jsread[List[Category]](body)
//       val category = Category(0, "baz")
//
//       // create category
//       post("/api/categories", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(category)) {
//         status must beEqualTo(200)
//         val category = jsread[Category](body)
//         category.name must beEqualTo("baz")
//
//         val category2 = category.copy(name = "blubbb")
//
//         // modify category
//         put("/api/categories/%s".format(category2.id), headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(category2)) {
//           status must beEqualTo(204)
//         }
//
//         get("/api/categories/%s".format(category2.id)) {
//           status must beEqualTo(200)
//           val category3 = jsread[Category](body)
//           category3.name must beEqualTo("blubbb")
//         }
//
//         get("/api/categories") {
//           status must beEqualTo(200)
//           val categories2 = jsread[List[Category]](body)
//           categories2 must have size(categories.size+1)
//         }
//
//         // delete category
//         submit("DELETE", "/api/categories/%s".format(category2.id)) {
//           status must beEqualTo(204)
//         }
//
//         submit("DELETE", "/api/categories/%s".format(category2.id)) {
//           status must beEqualTo(404)
//         }
//
//         get("/api/categories") {
//           status must beEqualTo(200)
//           val category2 = jsread[List[Category]](body)
//           category2 must have size(categories.size)
//         }
//       }
//     }
//   }
//
//   "should do crud on galleries" in {
//     get("/api/galleries") {
//       status must beEqualTo(200)
//       val galleries = jsread[List[Gallery]](body)
//       val gallery = Gallery(0, 0, 0, "foo gallery", "blubbb", "shortlink", "text")
//
//       // create gallery
//       post("/api/galleries", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(gallery)) {
//         status must beEqualTo(200)
//         val gallery = jsread[Gallery](body)
//         gallery.title must beEqualTo("foo gallery")
//
//         val gallery2 = gallery.copy(title = "blubbb gallery")
//
//         // modify gallery
//         put("/api/galleries/%s".format(gallery2.id), headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(gallery2)) {
//           status must beEqualTo(204)
//         }
//
//         get("/api/galleries/%s".format(gallery2.id)) {
//           status must beEqualTo(200)
//           val gallery3 = jsread[Gallery](body)
//           gallery3.title must beEqualTo("blubbb gallery")
//         }
//
//         get("/api/galleries") {
//           status must beEqualTo(200)
//           val galleries2 = jsread[List[Gallery]](body)
//           galleries2 must have size(galleries.size+1)
//         }
//
//         // delete gallery
//         submit("DELETE", "/api/galleries/%s".format(gallery2.id)) {
//           status must beEqualTo(204)
//         }
//
//         submit("DELETE", "/api/galleries/%s".format(gallery2.id)) {
//           status must beEqualTo(404)
//         }
//
//         get("/api/galleries") {
//           status must beEqualTo(200)
//           val gallery2 = jsread[List[Gallery]](body)
//           gallery2 must have size(galleries.size)
//         }
//       }
//     }
//   }
//
//   "should do crud on images" in {
//     get("/api/images") {
//       status must beEqualTo(200)
//       val images = jsread[List[Image]](body)
//       val image = Image(0, 0, "foo image", "author", "blubbb", "text", "fake.txt")
//
//       // create image
//       post("/api/images", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(image)) {
//         status must beEqualTo(200)
//         val image = jsread[Image](body)
//         image.title must beEqualTo("foo image")
//
//         val image2 = image.copy(title = "blubbb image")
//
//         // modify image
//         put("/api/images/%s".format(image2.id), headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(image2)) {
//           status must beEqualTo(204)
//         }
//
//         get("/api/images/%s".format(image2.id)) {
//           status must beEqualTo(200)
//           jsread[Image](body).title must beEqualTo("blubbb image")
//         }
//
//         get("/api/images") {
//           status must beEqualTo(200)
//           jsread[List[Image]](body) must have size(images.size+1)
//         }
//
//         // delete image
//         submit("DELETE", "/api/images/%s".format(image2.id)) {
//           status must beEqualTo(204)
//         }
//
//         submit("DELETE", "/api/images/%s".format(image2.id)) {
//           status must beEqualTo(404)
//         }
//
//         get("/api/images") {
//           status must beEqualTo(200)
//           val image2 = jsread[List[Image]](body)
//           image2 must have size(images.size)
//         }
//       }
//     }
//   }
//
//   "images can be added and removed to/from galleries" in {
//       val gallery = Gallery(0, 0, 0, "foo gallery", "blubbb", "shortlink", "text")
//       val image = Image(0, 0, "foo image", "author", "blubbb", "text", "text.txt")
//
//       post("/api/galleries", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(gallery)) {
//         status must beEqualTo(200)
//         val gallery = jsread[Gallery](body)
//
//         post("/api/images", headers = Map("Accept" -> "application/json", "Content-Type" -> "application/json"), body = jswrite(image)) {
//           status must beEqualTo(200)
//           val image = jsread[Image](body)
//
//           get("/api/galleries/%s/images".format(gallery.id)) {
//             status must beEqualTo(200)
//             jsread[List[Image]](body) must have size(0)
//           }
//
//           post("/api/galleries/%s/images/%s".format(gallery.id, image.id)) {
//             status must beEqualTo(204)
//           }
//
//           get("/api/galleries/%s/images".format(gallery.id)) {
//             status must beEqualTo(200)
//             jsread[List[Image]](body) must have size(1)
//           }
//
//           submit("DELETE", "/api/galleries/%s/images/%s".format(gallery.id, image.id)) {
//             status must beEqualTo(204)
//           }
//
//           submit("DELETE", "/api/galleries/%s/images/%s".format(gallery.id, image.id)) {
//             status must beEqualTo(404)
//           }
//
//           get("/api/galleries/%s/images".format(gallery.id)) {
//             status must beEqualTo(200)
//             jsread[List[Image]](body) must have size(0)
//           }
//         }
//       }
//  }
}


text:
package org.apache.asterix.translator;

import org.apache.asterix.common.api.IClientRequest;
import org.apache.asterix.common.api.IRequestReference;
import org.apache.asterix.common.api.RequestReference;
import org.apache.asterix.common.dataflow.ICcApplicationContext;
import org.apache.asterix.om.base.ADateTime;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.util.JSONUtil;

import com.fasterxml.jackson.databind.node.ObjectNode;

public abstract class BaseClientRequest implements IClientRequest {

    private boolean complete;
    private final IRequestReference requestReference;
    private boolean cancellable = false;
    private volatile long completionTime = -1;
    protected volatile State state = State.RECEIVED;

    public BaseClientRequest(IRequestReference requestReference) {
        this.requestReference = requestReference;
    }

    @Override
    public synchronized void complete() {
        if (complete) {
            return;
        }
        complete = true;
        state = State.COMPLETED;
        completionTime = System.currentTimeMillis();
    }

    @Override
    public synchronized void cancel(ICcApplicationContext appCtx) throws HyracksDataException {
        if (complete) {
            return;
        }
        complete();
        state = State.CANCELLED;
        if (cancellable) {
            doCancel(appCtx);
        }
    }

    @Override
    public synchronized void markCancellable() {
        cancellable = true;
    }

    @Override
    public synchronized boolean isCancelled() {
        return state == State.CANCELLED;
    }

    @Override
    public String getId() {
        // the uuid is generated by the node which received the request
        // so there is a chance this might not be unique now
        return requestReference.getUuid();
    }

    @Override
    public synchronized boolean isCancellable() {
        return cancellable;
    }

    public void setRunning() {
        state = State.RUNNING;
    }

    @Override
    public String toJson() {
        return JSONUtil.convertNodeOrThrow(asJson());
    }

    protected ObjectNode asJson() {
        ObjectNode json = JSONUtil.createObject();
        json.put("uuid", requestReference.getUuid());
        json.put("requestTime", new ADateTime(requestReference.getTime()).toSimpleString());
        json.put("elapsedTime", getElapsedTimeInSecs());
        json.put("node", requestReference.getNode());
        json.put("state", state.getLabel());
        json.put("userAgent", ((RequestReference) requestReference).getUserAgent());
        json.put("remoteAddr", ((RequestReference) requestReference).getRemoteAddr());
        json.put("cancellable", cancellable);
        return json;
    }

    private double getElapsedTimeInSecs() {
        // this is just an estimation as the request might have been received on a node with a different system time
        long runningTime = completionTime > 0 ? completionTime : System.currentTimeMillis();
        return (runningTime - requestReference.getTime()) / 1000d;
    }

    protected abstract void doCancel(ICcApplicationContext appCtx) throws HyracksDataException;
}


text:
package hudson;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class PluginWrapperTest {

    @Test
    public void dependencyTest() {
        String version = "plugin:0.0.2";
        PluginWrapper.Dependency dependency = new PluginWrapper.Dependency(version);
        assertEquals("plugin", dependency.shortName);
        assertEquals("0.0.2", dependency.version);
        assertEquals(false, dependency.optional);
    }

    @Test
    public void optionalDependencyTest() {
        String version = "plugin:0.0.2;resolution:=optional";
        PluginWrapper.Dependency dependency = new PluginWrapper.Dependency(version);
        assertEquals("plugin", dependency.shortName);
        assertEquals("0.0.2", dependency.version);
        assertEquals(true, dependency.optional);
    }
}