text:
import collections
import logging
import os
import subprocess
import tempfile

class TrackCompositor(object):
    def __init__(self, dataHub, title=None):
    # def __init__(self, width, title=None):
        self.dataHub = dataHub
        self.sections = collections.OrderedDict()
        self.width = 1200
        self.title = title
        self.descriptions = []

        self.marginTopBottom = 20
        self.sectionLabelHeight = 32
        self.betweenSectionHeight = 30
        self.trackLabelHeight = 20

        self._fromDataHub()

    def _fromDataHub(self):
        if self.title is None:
            self.title = str(self.dataHub.variant)

        for longAlleleName in ["Alternate Allele", "Reference Allele"]:
            allele = longAlleleName[:3].lower()

            sampleNames = self.dataHub.samples.keys()
            tracks = [sample.tracks[allele] for sample in self.dataHub]

            self.addTracks(longAlleleName, sampleNames, tracks, allele)

    def getBounds(self, tracks, allele):
        """ calculate left and right bounds for the allele; this is based on the variant segments
        as well as the positions of the reads (we want to be able to see all the breakpoints as
        well as all the reads) """

        scale = tracks[0].scale

        # bail if there are multiple sections; could do this more nicely
        if len(self.dataHub.variant.chromParts(allele).parts) > 1:
            return 0, scale.pixelWidth

        segments = list(self.dataHub.variant.chromParts(allele))[0].segments
        alleleLength = len(list(self.dataHub.variant.chromParts(allele))[0])

        if self.dataHub.args.context>0:
            begin = scale.topixels(len(segments[0])-self.dataHub.args.context)
            width = scale.topixels(sum(len(s) for s in segments[:-1])+self.dataHub.args.context) - begin
            return begin, width

        axisMin = max(0, scale.topixels(len(segments[0])-100))
        axisMax = scale.topixels(min(alleleLength-len(segments[-1])+100, alleleLength))

        for track in tracks:
            track.render()
        xmin = [track.xmin for track in tracks if track.xmin is not None]
        xmin = min(xmin) if len(xmin) > 0 else 0
        xmin = min(axisMin, xmin)

        xmax = [track.xmax for track in tracks if track.xmax is not None]
        xmax = max(xmax) if len(xmax) > 0 else 500
        xmax = max(axisMax, xmax)

        width = 500
        if xmin is not None:
            width = xmax - xmin
            xmin -= width * 0.05
            xmin = max(0, xmin)
            width *= 1.1
            width = min(width, xmin+scale.topixels(alleleLength))
        return xmin, width

    def addTracks(self, section, names, tracks, allele):
        alleleTracks = self.dataHub.alleleTracks[allele]

        for track in tracks:
            track.render()
        xmin, width = self.getBounds(tracks, allele)

        hasTrackWithReads = False

        for track, name in zip(tracks, names):
            if len(track.alignmentSets) == 0:
                height = 20
                viewbox = '0 0 {width} {height}" preserveAspectRatio="xMinYMin'.format(width=track.width, height=track.height)
            else:
                hasTrackWithReads = True
                # this is for proportional scaling
                # height = float(track.height+40) * self.width / width
                # preserveAspectRatio="xMinYMin"
                height = float(track.height+40)/2.0
                preserveAspectRatio="none"

                viewbox = '{xmin} -20 {width} {height}" preserveAspectRatio="{par}'.format(xmin=xmin,
                    width=width, height=track.height+40, par=preserveAspectRatio)

            self.addTrackSVG(section, name, track.svg.asString("export"), height=height, viewbox=viewbox)

        # if hasTrackWithReads:
        if True:
            scaleFactor = float(width) / self.width
            size = 1.0
            if self.dataHub.args.thicker_lines:
                size *= 2.0

            for name, track in alleleTracks.iteritems():
                # this is awkward: baseHeight() and imageHeight are used
                # for Axis tracks but not Annotation tracks
                imageHeight = width * (track.baseHeight()/float(self.width))
                track.render(scaleFactor=scaleFactor, height=imageHeight,
                    thickerLines=self.dataHub.args.thicker_lines)
                height = track.height/scaleFactor

                viewbox = '{xmin} 0 {width} {height}" preserveAspectRatio="{par}'.format(xmin=xmin,
                    width=width, height=track.height,
                    par="none")
                svg = track.svg.asString("export")

                self.addTrackSVG(section, name, svg, height=track.baseHeight(),#height,
                    viewbox=viewbox)

    def addTrackSVG(self, section, name, tracksvg, viewbox=None, height=100):
        if not section in self.sections:
            self.sections[section] = collections.OrderedDict()
        self.sections[section][name] = {"svg":tracksvg,
                                        "viewbox":viewbox,
                                        "height": height
                                       }

    def _svgText(self, x, y, text, height, bold=False, anchor=None):
        extras = ""
        if bold:
            extras += ' font-weight="bold"'
        if anchor:
            extras += ' anchor="{}"'.format(anchor)
        svg = '<svg x="{x}" y="{y}"><text x="0" y="{padded}" font-size="{textHeight}" font-family="Helvetica" {extras}>{text}</text></svg>'.format(x=x, y=y,
            padded=height, textHeight=(height-2), text=text, extras=extras)
        return svg

    def renderCountsTable(self, modTracks, ystart, fontsize=18):
        charWidth = fontsize/2
        ystart += 5
        counts = self.dataHub.getCounts()
        columns = ["Sample", "Alt", "Ref", "Amb"]

        columnWidths = []
        longestRowHeader = max(max(counts, key=lambda x: len(x)), len(columns[0]))
        columnWidths.append(len(longestRowHeader)*charWidth)
        columnWidths.extend([7*charWidth]*3)

        rows = [columns]
        for sample, curcounts in counts.iteritems():
            rows.append([sample, curcounts["alt"], curcounts["ref"], curcounts["amb"]])

        for i, row in enumerate(rows):
            xstart = 10
            for j, value in enumerate(row):
                width = columnWidths[j]
                if j == 0:
                    # row header
                    modTracks.append(self._svgText(xstart, ystart, value, fontsize, bold=True, anchor="start"))
                    xstart += width
                else:
                    xstart += width
                    modTracks.append(self._svgText(xstart, ystart, value, fontsize, bold=i==0, anchor="end"))
            ystart += fontsize * 1.25

        return ystart + 10
            # self.descriptions.append("{}: {} {} {}".format(name, curcounts["alt"], curcounts["ref"], curcounts["amb"]))

    def render(self):
        modTracks = []
        curX = 0
        curY = self.marginTopBottom

        if self.title is not None:
            header = self._svgText(curX+10, curY, self.title, self.sectionLabelHeight+5, bold=True)
            modTracks.append(header)
            curY += self.sectionLabelHeight+10

        curY = self.renderCountsTable(modTracks, curY)

        # for description in self.descriptions:
        #     header = self._svgText(curX+20, curY, description, self.trackLabelHeight)
        #     modTracks.append(header)
        #     curY += self.trackLabelHeight+5

        for i, sectionName in enumerate(self.sections):
            section = self.sections[sectionName]

            if i > 0:
                curY += self.betweenSectionHeight

            label = self._svgText(curX+10, curY, sectionName, self.sectionLabelHeight)
            modTracks.append(label)
            curY += self.sectionLabelHeight

            for trackName in section:
                trackInfo = section[trackName]

                if trackName != "axis":
                    label = self._svgText(curX+10, curY, trackName, self.trackLabelHeight)
                    modTracks.append(label)
                    curY += self.sectionLabelHeight

                extra = 'svg x="{}" y="{}" width="{}" height="{}"'.format(curX, curY, self.width, trackInfo["height"])
                if trackInfo["viewbox"] is not None:
                    extra += ' viewBox="{}"'.format(trackInfo["viewbox"])
                mod = trackInfo["svg"].replace("svg", extra, 1)
                modTracks.append(mod)

                curY += trackInfo["height"]

        curY += self.marginTopBottom

        composite = ['<?xml version="1.0" encoding="utf-8" ?><svg  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{}" height="{}">'.format(self.width, curY)] \
                    + modTracks + ["</svg>"]
        return "\n".join(composite)

def canConvertSVGToPDF():
    try:
        subprocess.check_call("webkitToPDF", stderr=subprocess.PIPE, shell=True)
        return True
    except subprocess.CalledProcessError:
        try:
            subprocess.check_call("rsvg-convert -v", stdout=subprocess.PIPE, shell=True)
        except subprocess.CalledProcessError:
            return False
        else:
            return True

def convertSVG(insvg, outformat="pdf"):
    if not canConvertSVGToPDF():
        logging.error("Can't find rsvg-convert; make sure you have librsvg installed")
        return None

    outdir = tempfile.mkdtemp()
    inpath = "{}/original.svg".format(outdir)
    infile = open(inpath, "w")
    infile.write(insvg)
    infile.flush()
    infile.close()

    outpath = "{}/converted.{}".format(outdir, outformat)

    exportData = _convertSVG_webkitToPDF(inpath, outpath, outformat)
    if exportData is not None:
        print "used webkitToPDF to export to PDF"
        return exportData
    else:
        exportData = _convertSVG_rsvg_convert(inpath, outpath, outformat)
        print "used rsvg-convert to export to PDF"
        return exportData

def _convertSVG_webkitToPDF(inpath, outpath, outformat):
    if outformat.lower() != "pdf":
        return None

    try:
        cmd = "webkitToPDF {} {}".format(inpath, outpath)
        subprocess.check_call(cmd, shell=True)#, stderr=subprocess.PIPE)
    except subprocess.CalledProcessError:
        return None

    return open(outpath).read()

def _convertSVG_rsvg_convert(inpath, outpath, outformat):
    options = ""
    outformat = outformat.lower()
    if outformat == "png":
        options = "-a -w 5000 --background-color white"

    try:
        subprocess.check_call("rsvg-convert -f {} {} -o {} {}".format(outformat, options, outpath, inpath), shell=True)
    except subprocess.CalledProcessError, e:
        print "EXPORT ERROR:", str(e)

    return open(outpath).read()

def test():
    base = """  <svg><rect x="10" y="10" height="100" width="100" style="stroke:#ffff00; stroke-width:3; fill: #0000ff"/><text x="25" y="25" fill="blue">{}</text></svg>"""
    svgs = [base.format("track {}".format(i)) for i in range(5)]

    tc = TrackCompositor(200, 600)
    for i, svg in enumerate(svgs):
        tc.addTrack(svg, i, viewbox="0 0 110 110")

    outf = open("temp.svg", "w")
    outf.write(tc.render())
    outf.flush()
    outf.close()

    pdfPath = convertSVGToPDF("temp.svg")
    subprocess.check_call("open {}".format(pdfPath), shell=True)

if __name__ == '__main__':
    test()

    import sys
    print >>sys.stderr, canConvertSVGToPDF()


text:
module.exports = function(req, res, next) {
    if (!req.token) {
        return res.badRequest({error: 'token not found'});
    }
    if (req.token.grupo !== 'admins') {
        return res.forbidden({error: 'resource not allowed'});
    }
    return next();
};

redpajama_set_name: RedPajamaGithub


text:
package fr.insee.rmes.modeles.operations;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;

import fr.insee.rmes.modeles.StringWithLang;
import fr.insee.rmes.utils.Lang;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(name = "ObjetSimpleAvecSims", description = "Objet simple avec documentation SIMS")
public class ObjectWithSimsId extends SimpleObject {

    private String simsId = null;

    public ObjectWithSimsId(String id, String uri, String labelFr, String labelEn, String simsId) {
        this.id = id;
        this.uri = uri;
        if (StringUtils.isNotEmpty(labelFr)) {
            label.add(new StringWithLang(labelFr, Lang.FR));
        }
        if (StringUtils.isNotEmpty(labelEn)) {
            label.add(new StringWithLang(labelEn, Lang.EN));
        }
        this.simsId=simsId;
    }

	public ObjectWithSimsId() {
		super();
	}

    @JsonInclude(Include.NON_EMPTY)
    @JsonProperty(value = "idRapportQualite")
    @JacksonXmlProperty(localName = "IdRapportQualite")
	public String getSimsId() {
		return simsId;
	}

    @JsonProperty(value="simsId")
	public void setSimsId(String simsId) {
		this.simsId = simsId;
	}

}


text:
package com.streamsets.pipeline.kafka.impl;

import org.apache.kafka.clients.producer.StreamsPartitioner;

import java.util.Map;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;

public class RoundRobinPartitioner implements StreamsPartitioner {

  private final AtomicInteger counter = new AtomicInteger((new Random()).nextInt(Integer.MAX_VALUE));

  @Override
  public int partition(
      String topic,
      Object key,
      byte[] keyBytes,
      Object value,
      byte[] valueBytes,
      int numPartitions
  ) {
    int partition = counter.getAndIncrement() % numPartitions;
    if(counter.get() == Integer.MAX_VALUE) {
      counter.set(0);
    }
    return partition;
  }

  @Override
  public void close() {

  }

  @Override
  public void configure(Map<String, ?> map) {

  }
}


text:
package com.stratio.crossdata.common.statements.structures;

import java.io.Serializable;

/**
 * The root interface for all structures in which a sql statement can be decomposed.
 */
public interface ISqlExpression extends Serializable{

    /**
     * Returns the string representation in sql syntax.
     * @param withAlias Whether the expression must use alias or qualified names.
     * @return          The sql string.
     */
    String toSQLString(boolean withAlias);
}


text:
package software.amazon.awssdk.release;

import static java.nio.charset.StandardCharsets.UTF_8;

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import software.amazon.awssdk.utils.Validate;
import software.amazon.awssdk.utils.internal.CodegenNamingUtils;

/**
 * A command line application to create a new, empty service.
 *
 * Example usage:
 * <pre>
 * mvn exec:java -pl :release-scripts \
 *     -Dexec.mainClass="software.amazon.awssdk.release.NewServiceMain" \
 *     -Dexec.args="--maven-project-root /path/to/root
 *                  --maven-project-version 2.1.4-SNAPSHOT
 *                  --service-id 'Service Id'
 *                  --service-module-name service-module-name
 *                  --service-protocol json"
 * </pre>
 */
public class NewServiceMain extends Cli {
    private NewServiceMain() {
        super(requiredOption("service-module-name", "The name of the service module to be created."),
              requiredOption("service-id", "The service ID of the service module to be created."),
              requiredOption("service-protocol", "The protocol of the service module to be created."),
              requiredOption("maven-project-root", "The root directory for the maven project."),
              requiredOption("maven-project-version", "The maven version of the service module to be created."));
    }

    public static void main(String[] args) {
        new NewServiceMain().run(args);
    }

    @Override
    protected void run(CommandLine commandLine) throws Exception {
        new NewServiceCreator(commandLine).run();
    }

    private static class NewServiceCreator {
        private final Path mavenProjectRoot;
        private final String mavenProjectVersion;
        private final String serviceModuleName;
        private final String serviceId;
        private final String serviceProtocol;

        private NewServiceCreator(CommandLine commandLine) {
            this.mavenProjectRoot = Paths.get(commandLine.getOptionValue("maven-project-root").trim());
            this.mavenProjectVersion = commandLine.getOptionValue("maven-project-version").trim();
            this.serviceModuleName = commandLine.getOptionValue("service-module-name").trim();
            this.serviceId = commandLine.getOptionValue("service-id").trim();
            this.serviceProtocol = transformSpecialProtocols(commandLine.getOptionValue("service-protocol").trim());

            Validate.isTrue(Files.exists(mavenProjectRoot), "Project root does not exist: " + mavenProjectRoot);
        }

        private String transformSpecialProtocols(String protocol) {
            switch (protocol) {
                case "ec2": return "query";
                case "rest-xml": return "xml";
                case "rest-json": return "json";
                default: return protocol;
            }
        }

        public void run() throws Exception {
            Path servicesRoot = mavenProjectRoot.resolve("services");
            Path templateModulePath = servicesRoot.resolve("new-service-template");
            Path newServiceModulePath = servicesRoot.resolve(serviceModuleName);

            createNewModuleFromTemplate(templateModulePath, newServiceModulePath);
            replaceTemplatePlaceholders(newServiceModulePath);

            Path servicesPomPath = mavenProjectRoot.resolve("services").resolve("pom.xml");
            Path aggregatePomPath = mavenProjectRoot.resolve("aws-sdk-java").resolve("pom.xml");
            Path bomPomPath = mavenProjectRoot.resolve("bom").resolve("pom.xml");

            new AddSubmoduleTransformer().transform(servicesPomPath);
            new AddDependencyTransformer().transform(aggregatePomPath);
            new AddDependencyManagementDependencyTransformer().transform(bomPomPath);
        }

        private void createNewModuleFromTemplate(Path templateModulePath, Path newServiceModule) throws IOException {
            FileUtils.copyDirectory(templateModulePath.toFile(), newServiceModule.toFile());
        }

        private void replaceTemplatePlaceholders(Path newServiceModule) throws IOException {
            Files.walkFileTree(newServiceModule, new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                    replacePlaceholdersInFile(file);
                    return FileVisitResult.CONTINUE;
                }
            });
        }

        private void replacePlaceholdersInFile(Path file) throws IOException {
            String fileContents = new String(Files.readAllBytes(file), UTF_8);
            String newFileContents = replacePlaceholders(fileContents);
            Files.write(file, newFileContents.getBytes(UTF_8));
        }

        private String replacePlaceholders(String line) {
            String[] searchList = {
                    "{{MVN_ARTIFACT_ID}}",
                    "{{MVN_NAME}}",
                    "{{MVN_VERSION}}",
                    "{{PROTOCOL}}"
            };
            String[] replaceList = {
                serviceModuleName,
                mavenName(serviceId),
                mavenProjectVersion,
                serviceProtocol
            };
            return StringUtils.replaceEach(line, searchList, replaceList);
        }

        private String mavenName(String serviceId) {
            return Stream.of(CodegenNamingUtils.splitOnWordBoundaries(serviceId))
                         .map(StringUtils::capitalize)
                         .collect(Collectors.joining(" "));
        }

        private class AddSubmoduleTransformer extends PomTransformer {
            @Override
            protected void updateDocument(Document doc) {
                Node project = findChild(doc, "project");
                Node modules = findChild(project, "modules");

                modules.appendChild(textElement(doc, "module", serviceModuleName));
            }
        }

        private class AddDependencyTransformer extends PomTransformer {
            @Override
            protected void updateDocument(Document doc) {
                Node project = findChild(doc, "project");
                Node dependencies = findChild(project, "dependencies");

                dependencies.appendChild(sdkDependencyElement(doc, serviceModuleName));
            }
        }

        private class AddDependencyManagementDependencyTransformer extends PomTransformer {
            @Override
            protected void updateDocument(Document doc) {
                Node project = findChild(doc, "project");
                Node dependencyManagement = findChild(project, "dependencyManagement");
                Node dependencies = findChild(dependencyManagement, "dependencies");

                dependencies.appendChild(sdkDependencyElement(doc, serviceModuleName));
            }
        }
    }
}


text:
#ifndef QOPENGLVERTEXARRAYOBJECT_P_H
#define QOPENGLVERTEXARRAYOBJECT_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists for the convenience
// of the Qt OpenGL classes.  This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
//

#include <QtCore/qglobal.h>

#ifndef QT_NO_OPENGL

#include <QtGui/qopengl.h>

QT_BEGIN_NAMESPACE

class QOpenGLVertexArrayObjectHelper;
class QOpenGLContext;

void Q_GUI_EXPORT qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, QOpenGLContext *context);

class QOpenGLVertexArrayObjectHelper
{
    Q_DISABLE_COPY(QOpenGLVertexArrayObjectHelper)

public:
    explicit inline QOpenGLVertexArrayObjectHelper(QOpenGLContext *context)
        : GenVertexArrays(Q_NULLPTR)
        , DeleteVertexArrays(Q_NULLPTR)
        , BindVertexArray(Q_NULLPTR)
        , IsVertexArray(Q_NULLPTR)
    {
        qtInitializeVertexArrayObjectHelper(this, context);
    }

    inline bool isValid() const
    {
        return GenVertexArrays && DeleteVertexArrays && BindVertexArray && IsVertexArray;
    }

    inline void glGenVertexArrays(GLsizei n, GLuint *arrays) const
    {
        GenVertexArrays(n, arrays);
    }

    inline void glDeleteVertexArrays(GLsizei n, const GLuint *arrays) const
    {
        DeleteVertexArrays(n, arrays);
    }

    inline void glBindVertexArray(GLuint array) const
    {
        BindVertexArray(array);
    }

    inline GLboolean glIsVertexArray(GLuint array) const
    {
        return IsVertexArray(array);
    }

private:
    friend void Q_GUI_EXPORT qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, QOpenGLContext *context);

    // Function signatures are equivalent between desktop core, ARB, APPLE, ES 3 and ES 2 extensions
    typedef void (QOPENGLF_APIENTRYP qt_GenVertexArrays_t)(GLsizei n, GLuint *arrays);
    typedef void (QOPENGLF_APIENTRYP qt_DeleteVertexArrays_t)(GLsizei n, const GLuint *arrays);
    typedef void (QOPENGLF_APIENTRYP qt_BindVertexArray_t)(GLuint array);
    typedef GLboolean (QOPENGLF_APIENTRYP qt_IsVertexArray_t)(GLuint array);

    qt_GenVertexArrays_t GenVertexArrays;
    qt_DeleteVertexArrays_t DeleteVertexArrays;
    qt_BindVertexArray_t BindVertexArray;
    qt_IsVertexArray_t IsVertexArray;
};

QT_END_NAMESPACE

#endif // QT_NO_OPENGL

#endif // QOPENGLVERTEXARRAYOBJECT_P_H


text:
#ifndef RENDERBUFFER_HPP
#define RENDERBUFFER_HPP

////////////////////////
// GLEW
////////////////////////
#include <GL/glew.h>

////////////////////////
// STL
////////////////////////
#include <iostream>

namespace OpenGLEngine
{

/**
* \file renderBuffer.hpp
* \author Alexandre Ribard
* \date Feb 2016
*/

/** @addtogroup BUFFER_OBJECTS */
/*@{*/

/*!
*  \brief OpenGL Render Buffer Object Wrapper: \n
*		An RBO has a OpenGL ID \n
*		Similar to a Texture object but optimized for use as render targets \n
*
*	This wrapper takes care of the OpenGL directives to create an RBO
*
*/

class RBO {
public:
	///////////////////////////////////////////
	//	CONSTUCTOR & DESTRUCTOR
	///////////////////////////////////////////
	//! Constructor.
	/*!
	*	Generate + bind to current FBO
	*
	* \param size_t width : RBO width
	* \param size_t height : RBO height
	*/
	RBO(size_t width, size_t height)
	{
		// Create a renderbuffer object for depth and stencil attachment (we won't be sampling these)
		glGenRenderbuffers(1, &ID);
		glBindRenderbuffer(GL_RENDERBUFFER, ID);
		glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height); // Use a single renderbuffer object for both a depth AND stencil buffer.
		glBindRenderbuffer(GL_RENDERBUFFER, 0);
		glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, ID); // Now actually attach it
		// Now that we actually created the framebuffer and added all attachments we want to check if it is actually complete now
		if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
			std::cout << "ERROR::FRAMEBUFFER:: Framebuffer is not complete!" << std::endl;

		glBindFramebuffer(GL_FRAMEBUFFER, 0);
	}
	/*!
	*  \brief Copy constructor: \n
	*
	* \param const RBO &rboSource : reference to a RBO
	*/
	RBO(RBO &rboSource)
	{
		this->ID = rboSource.ID;
	}

private:
	////////////////////
	//  RBO Data
	////////////////////
	//! OpenGL RBO ID
	/*! ID of the current RBO
	*/
	GLuint ID;

};

/*@}*/

}

#endif


text:
cask "universal-media-server" do
  version "10.4.1"
  sha256 "aa0752bda99d5dd1c3a43bd87682fafa8a25933bb25f4f162115a4cf1bf7b67f"

  url "https://github.com/UniversalMediaServer/UniversalMediaServer/releases/download/#{version}/UMS-#{version}.dmg",
      verified: "github.com/UniversalMediaServer/UniversalMediaServer/"
  name "Universal Media Server"
  desc "Media server supporting DLNA, UPnP and HTTP(S)"
  homepage "https://www.universalmediaserver.com/"

  app "Universal Media Server.app"

  zap trash: "~/Library/Application Support/UMS/"
end


text:
"use strict";

var assert = require("assert");
var Nodalion = require("../nodalion.js");

var $S = require('suspend'), $R = $S.resume, $T = function(gen) { return function(done) { $S.run(gen, done); } };

var impred = Nodalion.namespace('/impred', ['pred', 'someException', 'greet']);
var builtin = Nodalion.namespace('builtin', ['succ', 'throw']);
var bootstrap = Nodalion.namespace('/bootstrap', ['listMember']);

describe('Nodalion', function(){
    var nodalion;
    nodalion = new Nodalion(__dirname + '/../../prolog/cedalion.pl', '/tmp/ced.log');

    describe('.namespace(name, concepts)', function(){
        it('should create a namespace object with the given name and concepts', function(){
            var foo = Nodalion.namespace('foo', ['bar']);
            assert.equal(foo.bar(1, 2, 3).toString(), "'foo#bar'(1,2,3)");
        });
    });

    describe('.findAll(res, impred, cb(err, results))', function(){
        it('should call the callback with all results', $T(function*(){
            var X = {var:'X'};
            var T = {var:'T'};
            var res = yield nodalion.findAll(X, impred.pred(bootstrap.listMember(X, T, [1, 2, 3])), $R());
            assert.deepEqual(res, [1, 2, 3]);
        }));
        it('should call the callback only once', function(done){
            var X = {var:'X'};
            nodalion.findAll(X, impred.pred(builtin.throw(impred.someException())), function() {
                done();
            });
        });
        it('should propagate exceptions properly', $T(function*(){
            var X = {var:'X'};
            try {
                yield nodalion.findAll(X, impred.pred(builtin.throw(impred.someException())), $R());
                assert(false, 'previous statement should have failed');
            } catch(e) {
                assert.equal(e.message, impred.someException().toString());
            }
        }));
        it('should follow continuations', $T(function*(){
            impred._register('userInput', function() {
                return function(nodalion, cb) {
                    return cb(undefined, 'nodalion');
                };
            });
            var X = {var:'X'};
            var res = yield nodalion.findAll(X, impred.greet(X), $R());
            assert.deepEqual(res, ["Hello, nodalion"]);
        }));
        it('should pass the ndalion instance to the task', $T(function*(){
            impred._register('userInput', function() {
                return function(nod, cb) {
                    assert(nod instanceof Nodalion, nod + " instanceof Nodalion");
                    return cb(undefined, 'nodalion');
                };
            });
            var X = {var:'X'};
            var res = yield nodalion.findAll(X, impred.greet(X), $R());
        }));
    });
});


text:
<catalog>
    <widget>
        <name><%= widget_name %></name>
        <contextItemName>[BBHOST]</contextItemName>
        <properties>
            <property label="Title" name="title" viewHint="text-input,admin">
                <value type="string"><%= widget_title %></value>
            </property>
            <property name="TemplateName">
                <value type="string">Standard_Widget</value>
            </property>
            <property name="src">
                <value type="string">$(itemRoot)/index.html</value>
            </property>
            <property name="version">
                <value type="string"><%= widget_version %></value>
            </property>
            <property name="thumbnailUrl">
                <value type="string">$(itemRoot)/icon.png</value>
            </property>
            <property name="order">
                <value type="double">0</value>
            </property>
            <property name="area">
                <value type="string">0</value>
            </property>
        </properties>
    </widget>
</catalog>


text:
Slides and examples for a scientific c++ workshop using c++11 and c++14 features.

## Outline
- Basic introduction to types, functions and classes
- Leveraging the standard template library (stl)
- Using numerical algebra libraries
- Compiler flags and optimization

## Schedule

### Hour 1
- Compilers and tools
- Type system crash course
- Value, reference, pointer and const semantics
- Functions

### Hour 2
- Standard algorithms (stl)
- The future ranges

### Hour 3
- Linear algebra (dense and sparse matrices)
- Go fast time!  Compiler optimizations

## Preparation

You will need to install some variant of linux in a virtual machine (VM).  These instructions are written assuming you are using Fedora Workstation Edition.  If you are familiar with other variants please use that and find the equivalent packages on your system.

*Only if you are don't have a Linux system handy:*
Firstly, download the live operating system image (.iso) from https://getfedora.org/en/workstation/ (approximately 1.3GiB) and install the OS as a virtual machine.  Make sure you set yourself as the administrator for the virtual OS.

Once you are logged into Fedora on the VM, open up a terminal from the top left hand side (Activities->Terminal) and type:
```
<machine_name>$ sudo dnf install -y clang gcc-c++ cmake git
```
Or in a Ubuntu OS
```
<machine_name>$ sudo apt-get install clang git cmake
```
and provide your user password when prompted to install git, cmake and the clang compiler.  Once we have this working we need to pull down the slides and examples codes.  In the terminal type
```
<machine_name>$ cd
```
to get back to the user home directory and pull down the sources from github
```
<machine_name>$ git clone --depth=1 https://github.com/dbeurle/scientific-cpp.git
```
Now go to the ```slides/``` folder and open the slides.htm file in your favourite web browser.  The code examples are under ```examples/``` folder.

Let's download Eigen3 by
```
wget http://bitbucket.org/eigen/eigen/get/3.3.4.zip
```
Unzip and open the folder.  Create a new folder inside the eigen3 directory called ```build``` and go into this newly created folder.  Then in the terminal type
```
<machine_name>$ cmake ..
<machine_name>$ sudo make install
```
To install the header only library.


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trailingSlashRedirect = void 0;
var debug_ = require("debug");
var debug = debug_("r2:streamer#http/server-trailing-slash-redirect");
function trailingSlashRedirect(req, res, next) {
    var i = req.originalUrl.indexOf("?");
    var pathWithoutQuery = req.originalUrl;
    if (i >= 0) {
        pathWithoutQuery = pathWithoutQuery.substr(0, i);
    }
    if (pathWithoutQuery.substr(-1) === "/"
        || pathWithoutQuery.indexOf(".") >= 0) {
        return next();
    }
    var redirect = pathWithoutQuery + "/";
    if (i >= 0) {
        redirect += req.originalUrl.substr(i);
    }
    debug("REDIRECT: ".concat(req.originalUrl, " ==> ").concat(redirect));
    res.redirect(301, redirect);
}
exports.trailingSlashRedirect = trailingSlashRedirect;
//# sourceMappingURL=server-trailing-slash-redirect.js.map


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="net.arcfusion.gemini"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="17" />

    <uses-feature android:glEsVersion="0x00020000" android:required="true"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >

        <activity android:name="android.app.NativeActivity"
                android:label="@string/app_name"
                android:configChanges="orientation|keyboardHidden|screenSize">
            <!-- Tell NativeActivity the name of our .so -->
            <meta-data android:name="android.app.lib_name"
                    android:value="native-activity" />
            <!-- <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
             -->
        </activity>

        <activity
            android:name="net.arcfusion.gemini.gemini_activity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
           	android:launchMode="singleTask"
           	android:configChanges="orientation|keyboardHidden|screenSize" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>


text:
<api xmlns="http://ws.apache.org/ns/synapse" name="CustomerServiceAPI" context="/customerService">
    <resource methods="POST" url-mapping="/customer">
        <inSequence>
            <property name="uri.var.port" value="8480"/>
            <property name="uri.var.servicePath" value="customers"/>
            <log level="custom">
                <property name="Creating new customer..." value="true"/>
            </log>
            <send>
                <endpoint name="AddCustomerEP">
                    <http method="POST" uri-template="http://localhost:{uri.var.port}/{uri.var.servicePath}"/>
                </endpoint>
            </send>
        </inSequence>
    </resource>
    <resource methods="GET" uri-template="/customer/{id}">
        <inSequence>
            <property name="uri.var.port" value="8480"/>
            <property name="uri.var.servicePath" value="customers"/>
            <log level="custom">
                <property name="Get customer for given customer Id...." value="true"/>
            </log>
            <send>
                <endpoint name="GetCustomerEP">
                    <http method="GET" uri-template="http://localhost:{uri.var.port}/{uri.var.servicePath}/{uri.var.id}"/>
                </endpoint>
            </send>
        </inSequence>
    </resource>
    <resource methods="GET" uri-template="/customer/encoded/{id}">
        <inSequence>
            <property name="uri.var.port" value="8480"/>
            <property name="uri.var.servicePath" value="customers"/>
            <property name="uri.var.servicePath" value="http://localhost:8480/customers%2F8fa3fc1b-f63c-4b21-8aff-3ac684c74d97"/>
            <log level="custom">
                <property name="Get customer for given customer Id encoded...." value="true"/>
            </log>
            <send>
                <endpoint name="GetCustomerEP">
                    <http method="GET" uri-template="legacy-encoding:{uri.var.servicePath}"/>
                </endpoint>
            </send>
        </inSequence>
    </resource>
    <resource methods="DELETE" uri-template="/customer/{id}">
        <inSequence>
            <property name="uri.var.port" value="8480"/>
            <property name="uri.var.servicePath" value="customers"/>
            <log level="custom">
                <property name="Remove customer for given customer Id..." value="true"/>
            </log>
            <send>
                <endpoint name="DeleteCustomerEP">
                    <http method="DELETE" uri-template="http://localhost:{uri.var.port}/{uri.var.servicePath}/{uri.var.id}"/>
                </endpoint>
            </send>
        </inSequence>
    </resource>
    <resource methods="PUT" url-mapping="/customer">
        <inSequence>
            <property name="uri.var.port" value="8480"/>
            <property name="uri.var.servicePath" value="customers"/>
            <log level="custom">
                <property name="Update customer name for customer Id..." value="true"/>
            </log>
            <send>
                <endpoint name="UpdateCustomerEP">
                    <http method="PUT" uri-template="http://localhost:{uri.var.port}/{uri.var.servicePath}"/>
                </endpoint>
            </send>
        </inSequence>
    </resource>
</api>


text:
using namespace dsa;

bool check_static_headers(InvokeRequestMessage& message,
                          uint8_t* expected_values, size_t size) {
  uint8_t buf[1024];
  message.write(buf);

  return (memcmp(expected_values, buf, size) == 0);
}

TEST(MessageTest, InvokeRequestConstructor01) {
  // public methods
  // InvokeRequestMessage();

  InvokeRequestMessage request;

  EXPECT_EQ(15, request.size());
  EXPECT_EQ(0, request.get_sequence_id());
  EXPECT_EQ(0, request.get_page_id());
  EXPECT_EQ(MessageType::INVOKE_REQUEST, request.type());
  EXPECT_TRUE(request.is_request());
  EXPECT_EQ(0, request.get_rid());

  EXPECT_FALSE(request.get_priority());
  EXPECT_EQ("", request.get_target_path().full_str());
  EXPECT_EQ("", request.get_permission_token());
  EXPECT_FALSE(request.get_no_stream());
  EXPECT_EQ(0, request.get_alias_count());
}

TEST(MessageTest, InvokeRequestConstructor02) {
  //   InvokeRequestMessage(const InvokeRequestMessage&);

  const InvokeRequestMessage src__request;
  InvokeRequestMessage target__request(src__request);

  EXPECT_EQ(15, target__request.size());
  EXPECT_EQ(0, target__request.get_sequence_id());
  EXPECT_EQ(0, target__request.get_page_id());
  EXPECT_EQ(MessageType::INVOKE_REQUEST, target__request.type());
  EXPECT_TRUE(target__request.is_request());
  EXPECT_EQ(0, target__request.get_rid());

  EXPECT_FALSE(target__request.get_priority());
  EXPECT_EQ("", target__request.get_target_path().full_str());
  EXPECT_EQ("", target__request.get_permission_token());
  EXPECT_FALSE(target__request.get_no_stream());
  EXPECT_EQ(0, target__request.get_alias_count());

  string_ target_path("path/to/abc");
  target__request.set_target_path(target_path);

  EXPECT_EQ("", src__request.get_target_path().full_str());
  EXPECT_EQ(target_path, target__request.get_target_path().full_str());
}

TEST(MessageTest, InvokeRequestConstructor03) {
  //   InvokeRequestMessage(const uint8_t* data, size_t size);

  const uint8_t data[] = {0xf, 0x0, 0x0, 0x0, 0xf, 0x0, 0x3, 0x0,
                          0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
  size_t data_size = sizeof(data) / sizeof(uint8_t);

  InvokeRequestMessage request(data, data_size);

  EXPECT_EQ(15, request.size());
  EXPECT_EQ(0, request.get_sequence_id());
  EXPECT_EQ(0, request.get_page_id());
  EXPECT_EQ(MessageType::INVOKE_REQUEST, request.type());
  EXPECT_TRUE(request.is_request());
  EXPECT_EQ(0, request.get_rid());

  EXPECT_FALSE(request.get_priority());
  EXPECT_EQ("", request.get_target_path().full_str());
  EXPECT_EQ("", request.get_permission_token());
  EXPECT_FALSE(request.get_no_stream());
  EXPECT_EQ(0, request.get_alias_count());

  uint8_t buf[1024];
  request.size();
  request.write(buf);
}

TEST(MessageTest, InvokeRequestConstructor04) {
  //   InvokeRequestMessage(const uint8_t* data, size_t size);

  InvokeRequestMessage request;
  request.set_target_path("/request");
  InvokeRequestMessage other = request;
  EXPECT_EQ("/request", other.get_target_path().full_str());
  other.set_target_path("/other");
  EXPECT_EQ("/request", request.get_target_path().full_str());
  EXPECT_EQ("/other", other.get_target_path().full_str());

  EXPECT_EQ(24, other.size());
  EXPECT_EQ(0, other.get_sequence_id());
  EXPECT_EQ(0, other.get_page_id());
  EXPECT_EQ(MessageType::INVOKE_REQUEST, other.type());
  EXPECT_TRUE(other.is_request());
  EXPECT_EQ(0, other.get_rid());

  EXPECT_FALSE(other.get_priority());
  EXPECT_EQ("/other", other.get_target_path().full_str());
  EXPECT_EQ("", other.get_permission_token());
  EXPECT_FALSE(other.get_no_stream());
  EXPECT_EQ(0, other.get_alias_count());
}

TEST(MessageTest, InvokeRequestConstructor05) {
  InvokeRequestMessage source_request;

  source_request.set_sequence_id(1234);
  source_request.set_page_id(4321);
  source_request.set_alias_count(11);
  source_request.set_priority(true);
  source_request.set_no_stream(true);
  //  request.set_max_permission(); // TODO : TBI
  source_request.set_permission_token("ptoken");
  source_request.set_target_path("/target/path");

  source_request.size();

  InvokeRequestMessage dup_request(source_request);

  uint8_t src_buf[1024];
  dup_request.write(src_buf);

  //
  size_t buf_size = 53;
  InvokeRequestMessage request(src_buf, buf_size);

  request.size();

  uint8_t buf[1024];
  request.write(buf);

  EXPECT_EQ(0, memcmp(src_buf, buf, buf_size));
}

TEST(MessageTest, InvokeRequestUpdateStaticHeader) {
  // void update_static_header();
  InvokeRequestMessage request;
  request.size();

  uint8_t expect_values[] = {0xf, 0x0, 0x0, 0x0, 0xf, 0x0};
  EXPECT_TRUE(check_static_headers(request, expect_values,
                                   sizeof(expect_values) / sizeof(uint8_t)));
}

TEST(MessageTest, InvokeRequestPriority) {
  InvokeRequestMessage request;

  EXPECT_FALSE(request.get_priority());
  request.set_priority(true);
  EXPECT_TRUE(request.get_priority());
}

TEST(MessageTest, InvokeRequestTargetPath) {
  InvokeRequestMessage request;

  EXPECT_EQ("", request.get_target_path().full_str());
  request.set_target_path("path/to/node");
  EXPECT_EQ("path/to/node", request.get_target_path().full_str());
}

TEST(MessageTest, InvokeRequestPermissionToken) {
  // TODO: to be implemented
  InvokeRequestMessage request;

  EXPECT_EQ("", request.get_permission_token());
  request.set_permission_token("permission-token");
  EXPECT_EQ("permission-token", request.get_permission_token());
}

TEST(MessageTest, InvokeRequestNoStream) {
  InvokeRequestMessage request;

  EXPECT_FALSE(request.get_no_stream());
  request.set_no_stream(true);
  EXPECT_TRUE(request.get_no_stream());
}

TEST(MessageTest, InvokeRequestWrite) {
  InvokeRequestMessage request;

  request.set_target_path("path/to/dsa");
  request.set_no_stream(true);

  request.size();

  uint8_t buf[1024];
  request.write(buf);

  uint8_t expected_values[] = {0x1e, 0x0,  0x0,  0x0,  0x1e, 0x0,  0x3,  0x0,
                               0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0x80,
                               0x0b, 0x0,  0x70, 0x61, 0x74, 0x68, 0x2f, 0x74,
                               0x6f, 0x2f, 0x64, 0x73, 0x61, 0x11};

  EXPECT_EQ(0, memcmp(expected_values, buf,
                      sizeof(expected_values) / sizeof(uint8_t)));
}

TEST(MessageTest, InvokeRequestDynamicStructure) {
  InvokeRequestMessage request;

  request.set_sequence_id(1234);
  request.set_page_id(4321);
  request.set_alias_count(11);
  request.set_priority(true);
  request.set_no_stream(true);
  //  request.set_max_permission(); // TODO : TBI
  request.set_permission_token("ptoken");
  request.set_target_path("/target/path");

  request.size();

  uint8_t buf[1024];
  request.write(buf);

  uint8_t expected_values[] = {
      0x35, 0x0,  0x0,  0x0,  0x35, 0x0,  0x03, 0x0,  0x0,  0x0,  0x0,
      0x0,  0x0,  0x0,  0x0,  0x10, 0x1,  0xd2, 0x04, 0x0,  0x0,  0x02,
      0xe1, 0x10, 0x0,  0x0,  0x08, 0x0b, 0x80, 0x0c, 0x0,  0x2f, 0x74,
      0x61, 0x72, 0x67, 0x65, 0x74, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x60,
      0x06, 0x0,  0x70, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x11};

  EXPECT_EQ(0, memcmp(expected_values, buf,
                      sizeof(expected_values) / sizeof(uint8_t)));
}

TEST(MessageTest, InvokeResponseConstructor01) {
  InvokeResponseMessage response;

  EXPECT_EQ(15, response.size());
  EXPECT_EQ(0, response.get_sequence_id());
  EXPECT_EQ(0, response.get_page_id());
  EXPECT_EQ(MessageType::INVOKE_RESPONSE, response.type());
  EXPECT_FALSE(response.is_request());
  EXPECT_EQ(0, response.get_rid());
  EXPECT_EQ(MessageType::INVOKE_RESPONSE,
            response.get_response_type(MessageType::INVOKE_REQUEST));
}

TEST(MessageTest, InvokeResponseConstructor02) {
  InvokeResponseMessage source_response;

  source_response.set_source_path("/source/path");
  source_response.set_sequence_id(1234);
  source_response.set_page_id(4321);
  source_response.set_status(Status::BUSY);

  source_response.size();

  uint8_t src_buf[1024];
  source_response.write(src_buf);

  //
  size_t buf_size = 27;
  InvokeResponseMessage response(src_buf, buf_size);

  response.size();

  uint8_t buf[1024];
  response.write(buf);

  EXPECT_EQ(0, memcmp(src_buf, buf, buf_size));
}

TEST(MessageTest, InvokeResponseSourcePath) {
  InvokeResponseMessage response;

  EXPECT_EQ("", response.get_source_path());
  response.set_source_path("/source/path");
  EXPECT_EQ("/source/path", response.get_source_path());
}

TEST(MessageTest, InvokeResponseStatus) {
  InvokeResponseMessage response;

  static const Status message_status_all[]{
      Status::OK,
      Status::INITIALIZING,
      Status::REFRESHED,
      Status::NOT_AVAILABLE,
      Status::DONE,
      Status::DISCONNECTED,
      Status::PERMISSION_DENIED,
      Status::INVALID_MESSAGE,
      Status::INVALID_PARAMETER,
      Status::BUSY,
      Status::ALIAS_LOOP,
      Status::CONNECTION_ERROR,
  };
  for (const auto status : message_status_all) {
    response.set_status(status);
    EXPECT_EQ(status, response.get_status());
  }
}

TEST(MessageTest, InvokeResponseWrite) {
  InvokeResponseMessage response;

  response.set_source_path("source/path");  // no effect
  response.set_status(Status::BUSY);

  response.size();

  uint8_t buf[1024];
  response.write(buf);

  uint8_t expected_values[] = {0x11, 0x0, 0x0, 0x0, 0x11, 0x0, 0x83, 0x0, 0x0,
                               0x0,  0x0, 0x0, 0x0, 0x0,  0x0, 0x0,  0x48};

  EXPECT_EQ(0, memcmp(expected_values, buf,
                      sizeof(expected_values) / sizeof(uint8_t)));
}

TEST(MessageTest, InvokeResponseDynamicStructure) {
  InvokeResponseMessage response;

  response.set_status(Status::DONE);
  response.set_sequence_id(1234);
  response.set_page_id(4321);
  //  response.skippable(true); // TODO: TBI
  response.set_source_path("/source/path");  // no effect

  response.size();

  uint8_t buf[1024];
  response.write(buf);

  uint8_t expected_values[] = {0x1b, 0x0,  0x0,  0x0,  0x1b, 0x0,  0x83,
                               0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0x0,
                               0x0,  0x0,  0x20, 0x01, 0xd2, 0x04, 0x0,
                               0x0,  0x02, 0xe1, 0x10, 0x0,  0x0};

  EXPECT_EQ(0, memcmp(expected_values, buf,
                      sizeof(expected_values) / sizeof(uint8_t)));
}

TEST(MessageTest, InvokeResponseCopy) {
  InvokeResponseMessage response;

  response.set_source_path("source/path");  // no effect
  response.set_sequence_id(1234);
  response.set_page_id(4321);
  response.set_status(Status::BUSY);

  response.size();

  InvokeResponseMessage dup_response(response);

  uint8_t buf[1024];
  dup_response.write(buf);

  uint8_t expected_values[] = {0x1b, 0x0, 0x0, 0x0, 0x1b, 0x0, 0x83, 0x0, 0x0,
                               0x0,  0x0, 0x0, 0x0, 0x0,  0x0, 0x0,  0x48};

  EXPECT_EQ(0, memcmp(expected_values, buf,
                      sizeof(expected_values) / sizeof(uint8_t)));
}


text:
package com.gmail.thelimeglass.Scoreboards;

import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Scoreboard;
import org.eclipse.jdt.annotation.Nullable;

import ch.njol.skript.lang.Effect;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.util.Kleenean;

public class EffScoreboardClearSlot extends Effect {

	//clear (score[ ][board]|board) [display] slot %string% [[(in|from)] (score[ ][board]|[skellett[ ]]board) [%-scoreboard%]]

	private Expression<String> obj;
	private Expression<Scoreboard> scoreboard;
	@SuppressWarnings("unchecked")
	@Override
	public boolean init(Expression<?>[] e, int arg1, Kleenean arg2, ParseResult arg3) {
		obj = (Expression<String>) e[0];
		scoreboard = (Expression<Scoreboard>) e[1];
		return true;
	}
	@Override
	public String toString(@Nullable Event paramEvent, boolean paramBoolean) {
		return "clear (score[ ][board]|board) [display] slot %string% [[(in|from)] (score[ ][board]|[skellett[ ]]board) [%-scoreboard%]]";
	}
	@Override
	protected void execute(Event e) {
		Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
		if (scoreboard != null) {
			board = scoreboard.getSingle(e);
		}
		if (obj.getSingle(e).equals("BELOW_NAME")||obj.getSingle(e).equals("PLAYER_LIST")||obj.getSingle(e).equals("SIDEBAR")) {
			DisplaySlot slot = DisplaySlot.valueOf(obj.getSingle(e).replace("\"", "").trim().replace(" ", "_").toUpperCase());
			try {
				slot = DisplaySlot.valueOf(slot.toString().replace("\"", "").trim().replace(" ", "_").toUpperCase());
			} catch (IllegalArgumentException t) {
				return;
			}
			board.clearSlot(slot);
		} else {
			return;
		}
	}
}


text:
<?php

namespace App\Http\Middleware;

use Auth;
use Closure;

final class RedirectIfCannotEditSig
{

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = null)
    {
        $sigId = isset($request->route()->parameters()['id'])
                 ? $request->route()->parameters()['id']
                 : (isset($request->sig_id) ? $request->sig_id : null);
        $isAdmin = (Auth::guest() || $sigId === null)
                   ? false
                   : (Auth::user()->canEditSig($sigId));

        if (!$isAdmin) {
            if ($request->ajax() || $request->wantsJson()) {
                return response('Unauthorized.', 401);
            } else {
                return redirect()->guest('login');
            }
        }

        return $next($request);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

    <PreferenceCategory android:title="@string/unit_system" >

</PreferenceCategory>

       <ListPreference
            android:key="@string/unit_system"
            android:entries="@array/unit_system_array"
            android:entryValues="@array/unit_system_array"
            android:defaultValue="@string/international"
            android:title="@string/unit_system" />

<!--               <ListPreference -->
<!--             android:key="@string/unit_system" -->
<!--             android:entries="@array/unit_system_array"            -->
<!--             android:entryValues="@array/unit_system_array" -->
<!--             android:defaultValue="@string/international" -->
<!--             android:title="@string/unit_system" /> -->

</PreferenceScreen>


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

namespace NBi.UI.Genbi.Stateful
{
    public class TestListGenerationResult
    {
        public static TestListGenerationResult Success (int count)
        {
            var res = new TestListGenerationResult();
            res.IsSuccess = true;
            res.Message = string.Format("{0} tests generated successfully.", count);
            return res;
        }

        public static TestListGenerationResult Failure(string message)
        {
            var res = new TestListGenerationResult();
            res.IsSuccess = false;
            res.Message = message;
            return res;
        }

        public string Message {  get; private set; }
        public bool IsSuccess {  get; private set; }
    }
}


text:
/*
 *
 *  Portions, Copyright © 1991-2005 Unicode, Inc. The following applies to Unicode.
 *
 *  COPYRIGHT AND PERMISSION NOTICE
 *
 *  Copyright © 1991-2005 Unicode, Inc. All rights reserved. Distributed under
 *  the Terms of Use in http://www.unicode.org/copyright.html. Permission is
 *  hereby granted, free of charge, to any person obtaining a copy of the
 *  Unicode data files and any associated documentation (the "Data Files")
 *  or Unicode software and any associated documentation (the "Software")
 *  to deal in the Data Files or Software without restriction, including without
 *  limitation the rights to use, copy, modify, merge, publish, distribute,
 *  and/or sell copies of the Data Files or Software, and to permit persons
 *  to whom the Data Files or Software are furnished to do so, provided that
 *  (a) the above copyright notice(s) and this permission notice appear with
 *  all copies of the Data Files or Software, (b) both the above copyright
 *  notice(s) and this permission notice appear in associated documentation,
 *  and (c) there is clear notice in each modified Data File or in the Software
 *  as well as in the documentation associated with the Data File(s) or Software
 *  that the data or software has been modified.

 *  THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
 *  KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
 *  OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
 *  INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
 *  OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 *  OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 *  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 *  PERFORMANCE OF THE DATA FILES OR SOFTWARE.
 *
 *  Except as contained in this notice, the name of a copyright holder shall
 *  not be used in advertising or otherwise to promote the sale, use or other
 *  dealings in these Data Files or Software without prior written
 *  authorization of the copyright holder.
 *
 *  2. Additional terms from the Database:
 *
 *  Copyright © 1995-1999 Unicode, Inc. All Rights reserved.
 *
 *  Disclaimer
 *
 *  The Unicode Character Database is provided as is by Unicode, Inc.
 *  No claims are made as to fitness for any particular purpose. No warranties
 *  of any kind are expressed or implied. The recipient agrees to determine
 *  applicability of information provided. If this file has been purchased
 *  on magnetic or optical media from Unicode, Inc., the sole remedy for any claim
 *  will be exchange of defective media within 90 days of receipt. This disclaimer
 *  is applicable for all other data files accompanying the Unicode Character Database,
 *  some of which have been compiled by the Unicode Consortium, and some of which
 *  have been supplied by other sources.
 *
 *  Limitations on Rights to Redistribute This Data
 *
 *  Recipient is granted the right to make copies in any form for internal
 *  distribution and to freely use the information supplied in the creation of
 *  products supporting the UnicodeTM Standard. The files in
 *  the Unicode Character Database can be redistributed to third parties or other
 *  organizations (whether for profit or not) as long as this notice and the disclaimer
 *  notice are retained. Information can be extracted from these files and used
 *  in documentation or programs, as long as there is an accompanying notice
 *  indicating the source.
 */

package java.util.regex;

/**
 * This class represents high surrogate character.
 */
class HighSurrogateCharSet extends JointSet{

    /*
     * Note that we can use high and low surrogate characters
     * that don't combine into supplementary code point.
     * See http://www.unicode.org/reports/tr18/#Supplementary_Characters
     */

    private char high;

    public HighSurrogateCharSet(char high) {
        this.high = high;
    }

    /**
     * Returns the next.
     */
    public AbstractSet getNext() {
        return this.next;
    }

    /**
     * Sets next abstract set.
     * @param next
     *            The next to set.
     */
    public void setNext(AbstractSet next) {
        this.next = next;
    }

    public int matches(int stringIndex, CharSequence testString,
            MatchResultImpl matchResult) {
        int strLength = matchResult.getRightBound();

        if (stringIndex + 1 > strLength) {
            matchResult.hitEnd = true;
            return -1;
        }

        char high = testString.charAt(stringIndex);

        if (stringIndex + 1 < strLength) {
            char low = testString.charAt(stringIndex + 1);

            /*
             * we consider high surrogate followed by
             * low surrogate as a codepoint
             */
            if (Character.isLowSurrogate(low)) {
                return -1;
            }
        }

        if (this.high == high) {
            return next.matches(stringIndex + 1, testString,
                    matchResult);
        }

        return -1;
    }

    public int find(int strIndex, CharSequence testString,
            MatchResultImpl matchResult) {
        if (testString instanceof String) {
            String testStr = (String) testString;
            int strLength = matchResult.getRightBound();

            while (strIndex < strLength) {

                strIndex = testStr.indexOf(high, strIndex);
                if (strIndex < 0)
                    return -1;

                if (strIndex + 1 < strLength ) {

                    /*
                     * we consider high surrogate followed by
                     * low surrogate as a codepoint
                     */
                    if (Character.isLowSurrogate(testStr.charAt(strIndex + 1))) {
                        strIndex += 2;
                        continue;
                    }
                }

                if (next.matches(strIndex + 1, testString, matchResult) >= 0) {
                    return strIndex;
                }
                strIndex++;
            }

            return -1;
        }

        return super.find(strIndex, testString, matchResult);
    }

    public int findBack(int strIndex, int lastIndex, CharSequence testString,
            MatchResultImpl matchResult) {
        if (testString instanceof String) {
            String testStr = (String) testString;
            int strLength = matchResult.getRightBound();

            while (lastIndex >= strIndex) {
                lastIndex = testStr.lastIndexOf(high, lastIndex);
                if (lastIndex < 0 || lastIndex < strIndex) {
                    return -1;
                }

                if (lastIndex + 1 < strLength) {

                    /*
                     * we consider high surrogate followed by
                     * low surrogate as a codepoint
                     */
                    if (Character.isLowSurrogate(testStr.charAt(lastIndex + 1))) {
                        lastIndex--;
                        continue;
                    }
                }

                if (next.matches(lastIndex + 1, testString, matchResult) >= 0) {
                    return lastIndex;
                }

                lastIndex--;
            }

            return -1;
        }

        return super.findBack(strIndex, lastIndex, testString, matchResult);
    }

    protected String getName() {
        return "" + high;
    }

    protected int getChar() {
        return high;
    }

    public boolean first(AbstractSet set) {
        if (set instanceof CharSet) {
            return false;
        } else if (set instanceof RangeSet) {
            return false;
        } else if (set instanceof SupplRangeSet) {
            return false;
        } else if (set instanceof SupplCharSet) {
            return false;
        } else if (set instanceof LowSurrogateCharSet) {
            return false;
        } else if (set instanceof HighSurrogateCharSet) {
            return ((HighSurrogateCharSet) set).high == this.high;
        }

        return true;
    }

    public boolean hasConsumed(MatchResultImpl matchResult) {
        return true;
    }
}


text:
import path from 'path'
import {
  coreUtils,
  cmsTemplates,
  cmsOperations,
  abeExtend,
  cmsData
} from '../../'

var create = function(template, pathCreate, name, req, forceJson = {}, duplicate = false) {
  var p = new Promise((resolve) => {
    abeExtend.hooks.instance.trigger('beforeCreate', template, pathCreate, name, req, forceJson)

    var postUrl = path.join('/', pathCreate, name)
    postUrl = coreUtils.slug.clean(postUrl)

    var json = (forceJson) ? forceJson : {}

    json = cmsData.metas.create(json, template, postUrl)

    if (duplicate) {
      if(json.abe_meta.publish != null) {
        delete json.abe_meta.publish
      }
      var templateText = cmsTemplates.template.getTemplate(template)
      json = cmsData.values.removeDuplicate(templateText, json)
    }

    var resHook = abeExtend.hooks.instance.trigger('beforeFirstSave', postUrl, req.body, json)
    postUrl = resHook.postUrl
    json = resHook.json

    var p2 = cmsOperations.post.draft(
      postUrl,
      json,
      'draft'
    )
    p2.then((result) => {
      abeExtend.hooks.instance.trigger('afterCreate', result)
      resolve(result.json)
    }).catch(function(e) {
      console.error('[ERROR] create.js', e)
    })
  }).catch(function(e) {
    console.error(e)
  })

  return p
}

export default create


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

Not found!


text:
class X {
  static method() -/> await a
}


text:
<?php

namespace App\Http\Controllers;

use App\Logic\CategoryLogic;
use App\Models\Storage;
use Auth;
use Hash;
use Illuminate\Http\Request;
use MessageAlert;
use UserLog;

class StorageController extends Controller
{
    public function __construct()
    {
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        $query = $request->input('q', '');
        $query = trim($query);
        $cateId = $request->input('cateId', 0);
        if (strlen($query) > 0 || $cateId > 0) {
            $query = urldecode($query);
            $conditions = [];
            if ($query) {
                $conditions[] = ['material_name', 'like', '%' . $query . '%'];
            }
            if ($cateId > 0) {
                $conditions[] = ['category_id', $cateId];
            }
            $count = Storage::where($conditions)->count();
            $this->setDefaultPage($request, $count);
            $pageList = Storage::where($conditions)->paginate(parent::PAGE_NUM);
        } else {
            $count = Storage::count();
            $this->setDefaultPage($request, $count);
            $pageList = Storage::paginate(parent::PAGE_NUM);
        }
        $categorys = CategoryLogic::getCategorys();
        $storages = [];
        foreach ($pageList as $v) {
            $v->category_name = isset($categorys[$v->category_id]) ? $categorys[$v->category_id]->name : '';
            $storages[] = $v;
        }
        foreach ($storages as $storage) {
            $storage->baojing = $storage->xianding_num > 0 && $storage->storage_num < $storage->xianding_num ? 1 : 0;
            $storage->storage_num = $this->transferDanwei($storage->storage_num, $storage->danwei);
            $storage->xianding_num = $this->transferDanwei($storage->xianding_num, $storage->danwei);
        }
        $pageList->appends(['q' => $query, 'cateId' => $cateId])->links();
        $data = array('page_title' => '库存管理',
            'page_description' => '',
            'pageList' => $pageList,
            'storages' => $storages,
            'query' => $query,
            'cateId' => $cateId,
            'categorys' => CategoryLogic::formatCanNoneCategorySelect()
        );
        return view('storage.list', $data);
    }
}


text:
const Table = require('../orm/schema');

const User = new Table('User', user => {
  user.bigInt('facebook_id', 64, 'UNSIGNED').primaryKey();
  user.varChar('first_name', 255);
  user.varChar('last_name', 255);
  user.varChar('display_name', 255);
  user.varChar('gender', 255);
  user.varChar('photo_url', 255);
  user.timestamp();
});

const Follow = new Table('Follow', follow => {
  follow.bigInt('follower', 64, 'UNSIGNED');
  follow.bigInt('followed', 64, 'UNSIGNED');

  follow.primaryKey(null, 'follower', 'followed');
  follow.foreignKey('Follow_fk_follower', 'follower', 'User', 'facebook_id');
  follow.foreignKey('Follow_fk_followed', 'followed', 'User', 'facebook_id');
});

const Product = new Table('Product', product => {
  product.bigInt('upc', 64, 'UNSIGNED').primaryKey();
  product.varChar('name', 255);
  product.varChar('brand', 255);
  product.int('energy', 64, 'UNSIGNED');
  product.int('fat', 64, 'UNSIGNED');
  product.int('saturatedfat', 64, 'UNSIGNED');
  product.int('monounsaturatedfat', 64, 'UNSIGNED');
  product.int('polyunsaturatedfat', 64, 'UNSIGNED');
  product.int('omega3fat', 64, 'UNSIGNED');
  product.int('transfat', 64, 'UNSIGNED');
  product.int('cholesterol', 64, 'UNSIGNED');
  product.int('carbohydrates', 64, 'UNSIGNED');
  product.int('sugar', 64, 'UNSIGNED');
  product.int('starch', 64, 'UNSIGNED');
  product.int('polyols', 64, 'UNSIGNED');
  product.int('fiber', 64, 'UNSIGNED');
  product.int('protein', 64, 'UNSIGNED');
  product.int('salt', 64, 'UNSIGNED');
  product.int('sodium', 64, 'UNSIGNED');
  product.int('alcohol', 64, 'UNSIGNED');
  product.int('vitamina', 64, 'UNSIGNED');
  product.int('vitaminc', 64, 'UNSIGNED');
  product.int('vitamind', 64, 'UNSIGNED');
  product.int('vitamine', 64, 'UNSIGNED');
  product.int('vitamink', 64, 'UNSIGNED');
  product.int('vitaminb1', 64, 'UNSIGNED');
  product.int('vitaminb2', 64, 'UNSIGNED');
  product.int('vitaminpp', 64, 'UNSIGNED');
  product.int('vitaminb6', 64, 'UNSIGNED');
  product.int('vitaminb9', 64, 'UNSIGNED');
  product.int('vitaminb12', 64, 'UNSIGNED');
  product.int('biotin', 64, 'UNSIGNED');
  product.int('pantothenicacid', 64, 'UNSIGNED');
  product.int('calcium', 64, 'UNSIGNED');
  product.int('phosphorus', 64, 'UNSIGNED');
  product.int('iron', 64, 'UNSIGNED');
  product.int('magnesium', 64, 'UNSIGNED');
  product.int('zinc', 64, 'UNSIGNED');
  product.int('copper', 64, 'UNSIGNED');
  product.int('manganese', 64, 'UNSIGNED');
  product.int('selenium', 64, 'UNSIGNED');
  product.int('chromium', 64, 'UNSIGNED');
  product.int('molybdenum', 64, 'UNSIGNED');
  product.int('iodine', 64, 'UNSIGNED');
  product.int('caffeine', 64, 'UNSIGNED');
  product.int('taurine', 64, 'UNSIGNED');
  product.int('potassium', 64, 'UNSIGNED');
  product.timestamp();
});

const Category = new Table('Category', category => {
  category
    .int('id', 64, 'UNSIGNED')
    .notNull()
    .autoIncrement()
    .primaryKey();
  category.varChar('name', 255);
  category.timestamp();
});

const ProductCategory = new Table('Product_Category', join => {
  join.bigInt('Product_upc', 64, 'UNSIGNED');
  join.int('Category_id', 64, 'UNSIGNED');

  join.primaryKey(null, 'Product_upc', 'Category_id');
  join.foreignKey('Product_Category_fk_Product_upc', 'Product_upc', 'Product', 'upc');
  join.foreignKey('Product_Category_fk_Category_id', 'Category_id', 'Category', 'id');

  join.timestamp();
});

const Ingredient = new Table('Ingredient', ingredient => {
  ingredient
    .int('id', 64, 'UNSIGNED')
    .notNull()
    .autoIncrement()
    .primaryKey();
  ingredient.varChar('name', 255);
  ingredient.timestamp();
});

const ProductIngredient = new Table('Product_Ingredient', join => {
  join.bigInt('Product_upc', 64, 'UNSIGNED');
  join.int('Ingredient_id', 64, 'UNSIGNED');

  join.primaryKey(null, 'Product_upc', 'Ingredient_id');
  join.foreignKey('Product_Ingredient_fk_Product_upc', 'Product_upc', 'Product', 'upc');
  join.foreignKey('Product_Ingredient_fk_Ingredient_id', 'Ingredient_id', 'Ingredient', 'id');

  join.timestamp();
});

const Tag = new Table('Tag', tag => {
  tag
    .int('id', 64, 'UNSIGNED')
    .notNull()
    .autoIncrement()
    .primaryKey();
  tag.varChar('name', 255);
  tag.timestamp();
});

const ProductTag = new Table('Product_Tag', join => {
  join.bigInt('Product_upc', 64, 'UNSIGNED');
  join.int('Tag_id', 64, 'UNSIGNED');

  join.primaryKey(null, 'Product_upc', 'Tag_id');
  join.foreignKey('Product_Tag_fk_Product_upc', 'Product_upc', 'Product', 'upc');
  join.foreignKey('Product_Tag_fk_Tag_id', 'Tag_id', 'Tag', 'id');
  join.timestamp();
});

const Post = new Table('Post', post => {
  post.int('postId', 64, 'UNSIGNED').autoIncrement().primaryKey();
  post.bigInt('User_facebook_id', 64, 'UNSIGNED');
  post.bigInt('Product_upc', 64, 'UNSIGNED');
  post.int('likesCache', 64, 'UNSIGNED').default(0);
  post.text('comment');
  post.int('rating');
  post.int('parentId', 64, 'UNSIGNED');

  post.foreignKey('Post_fk_User_facebook_id', 'User_facebook_id', 'User', 'facebook_id');
  post.foreignKey('Post_fk_Product_upc', 'Product_upc', 'Product', 'upc');

  post.timestamp();
});

const Like = new Table('Likes', like => {
  // like.int('postId', 64, 'UNSIGNED').autoIncrement().primaryKey();
  like.bigInt('facebook_id', 64, 'UNSIGNED').primaryKey();
  like.int('Post_id', 64, 'UNSIGNED');

  like.foreignKey('Like_fk_facebook_id', 'facebook_id', 'User', 'facebook_id');
  like.foreignKey('Like_fk_Post_id', 'Post_id', 'Post', 'postId');

  like.timestamp();
});

const Media = new Table('Media', media => {
  media.int('id', 64, 'UNSIGNED').autoIncrement().primaryKey();
  media.int('Post_id', 64, 'UNSIGNED');
  media.varChar('url', 255);
  media.varChar('urlCompressed', 255);
  media.varChar('urlCompressedS3', 255);
  media.int('views', 64, 'UNSIGNED');
  media.bigInt('Product_upc', 64, 'UNSIGNED');
  media.bigInt('User_facebook_id', 64, 'UNSIGNED');
  media.int('view', 64, 'UNSIGNED').default(0);

  media.foreignKey('Image_fk_Product_upc', 'Product_upc', 'Product', 'upc');
  media.foreignKey('Image_fk_User_facebook_id', 'User_facebook_id', 'User', 'facebook_id');
  media.foreignKey('Image_fk_Post_id', 'Post_id', 'Post', 'id');

  media.timestamp();
});

const Live = new Table('Live', live => {
  live.varChar('peer_id', 255).primaryKey();
  live.bigInt('User_facebook_id', 64, 'UNSIGNED');
  live.int('active', 64, 'UNSIGNED');
  live.int('views', 64, 'UNSIGNED');
  live.text('description');

  live.foreignKey('Live_fk_User_facebook_id', 'User_facebook_id', 'User', 'facebook_id');

  live.timestamp();
});

module.exports = { User, Product, Category, ProductCategory, Ingredient, Tag, ProductTag, Media, Post, ProductIngredient, Follow, Like, Live };


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="differ">
        <note>
            Frames file for 'differ' based on sentences in financial subcorpus and
            automatic expansion via verbnet.
        </note>

        <roleset id="differ.01" name="disagree, argue" vncls="36.1">
            <roles>
                <role descr="first arguer" n="0">
                    <vnrole vncls="36.1" vntheta="Actor1"/>
                </role>
                <role descr="second arguer" n="1">
                    <vnrole vncls="36.1" vntheta="Actor2"/>
                </role>
                <role descr="topic" n="2">
                    <vnrole vncls="36.1" vntheta="Topic"/>
                </role>
            </roles>

            <example name="with prize" src="compete.01">
                <text>
                    John differed with Mary over who deserved the last piece of cake.
                </text>
                <arg n="0">John</arg>
                <rel>differed</rel>
                <arg n="1">with Mary</arg>
                <arg n="2">over who deserved the last piece of cake</arg>
            </example>

            <example name="more usual usage">
                <inflection aspect="ns" form="infinitive" person="ns" tense="ns" voice="ns"/>
                <text>
                    John-1 begs *trace*-1 to differ.
                </text>
                <arg n="0">*trace*</arg>
                <rel>differ</rel>
            </example>

            <note>
            </note>

        </roleset>

        <roleset id="differ.02" name="be different" vncls="45.6">
            <roles>
                <role descr="things that are different" n="1">

                    <vnrole vncls="45.6" vntheta="Patient"/>
                </role>

                <role descr="EXT or MNR, how different" n="2">

                    <vnrole vncls="45.6" vntheta="Extent"/>
                </role>

            </roles>

            <example name="separated arg1s">
                <inflection aspect="ns" form="full" person="ns" tense="present" voice="active"/>
                <text>
                    Digital, Maynard, Mass., insisted yesterday that its marketing
                    focus would differ sharply from IBM's.
                </text>
                <arg n="1">its marketing focus</arg>
                <arg f="MOD" n="M">would</arg>
                <rel>differ</rel>
                <arg n="2">sharply</arg>
                <arg n="1">from IBM 's</arg>
            </example>

            <example name="merged differers, EXT">
                <inflection aspect="ns" form="full" person="ns" tense="present" voice="active"/>
                <text>
                    John and Mary's IQs differ by almost 50 points.
                </text>
                <arg n="1">John and Mary's IQs</arg>
                <rel>differ</rel>
                <arg n="2">by almost 50 points</arg>
            </example>

            <note>
                Note that I am not saying if John's or Mary's is higher.
            </note>

        </roleset>
    </predicate>
</frameset>


text:
<?php

namespace M6Web\Bundle\AmqpBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\NodeBuilder;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
 * This is the class that validates and merges configuration from your app/config files
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritDoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode    = $treeBuilder->root('m6_web_amqp');
        $rootNode
            ->children()
                ->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
                ->booleanNode('event_dispatcher')->defaultTrue()->end()
                ->booleanNode('prototype')->defaultFalse()->end()
            ->end();

        $this->addConnections($rootNode);
        $this->addProducers($rootNode);
        $this->addConsumers($rootNode);

        return $treeBuilder;
    }

    protected function addConnections(ArrayNodeDefinition $node)
    {
        $node
            ->children()
                ->arrayNode('connections')
                    ->useAttributeAsKey('key')
                    ->canBeUnset()
                    ->prototype('array')
                        ->children()
                            ->scalarNode('class')->defaultValue('%m6_web_amqp.connection.class%')->end()
                            ->scalarNode('host')->defaultValue('localhost')->end()
                            ->scalarNode('port')->defaultValue(5672)->end()
                            ->scalarNode('timeout')->defaultValue(10)->end()
                            ->scalarNode('heartbeat')
                                ->defaultValue(5)
                                ->info('Send heartbeat every N seconds. RabbitMQ recommend to use timeout / 2. Supported from 1.6.0beta4 version of amqp extension')
                            ->end()
                            ->scalarNode('login')->defaultValue('guest')->end()
                            ->scalarNode('password')->defaultValue('guest')->end()
                            ->scalarNode('vhost')->defaultValue('/')->end()
                            ->booleanNode('lazy')->defaultFalse()->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }

    protected function addProducers(ArrayNodeDefinition $node)
    {
        $node
            ->children()
                ->arrayNode('producers')
                    ->canBeUnset()
                    ->useAttributeAsKey('key')
                    ->prototype('array')
                        ->children()
                            ->scalarNode('class')->defaultValue('%m6_web_amqp.producer.class%')->end()
                            ->scalarNode('connection')->defaultValue('default')->end()
                            ->append($this->exchangeOptions())
                            ->arrayNode('queue_options')
                                ->addDefaultsIfNotSet()
                                ->children()
                                    // base info
                                    ->scalarNode('name')->end()

                                    // flags
                                    ->booleanNode('passive')->defaultFalse()->end()
                                    ->booleanNode('durable')->defaultTrue()->end()
                                    ->booleanNode('auto_delete')->defaultFalse()->end()

                                    // args
                                    ->arrayNode('arguments')
                                        ->prototype('scalar')->end()
                                        ->defaultValue(array())
                                        ->normalizeKeys(false)
                                    ->end()

                                    // binding
                                    ->arrayNode('routing_keys')
                                        ->prototype('scalar')->end()
                                        ->defaultValue(array())
                                    ->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }

    protected function addConsumers(ArrayNodeDefinition $node)
    {
        $node
            ->children()
                ->arrayNode('consumers')
                    ->canBeUnset()
                    ->useAttributeAsKey('key')
                    ->prototype('array')
                        ->children()
                            ->scalarNode('class')->defaultValue('%m6_web_amqp.consumer.class%')->end()
                            ->scalarNode('connection')->defaultValue('default')->end()
                            ->append($this->exchangeOptions())
                            ->arrayNode('queue_options')
                                ->children()
                                    // base
                                    ->scalarNode('name')->isRequired()->end()

                                    // flags
                                    ->booleanNode('passive')->defaultFalse()->end()
                                    ->booleanNode('durable')->defaultTrue()->end()
                                    ->booleanNode('exclusive')->defaultFalse()->end()
                                    ->booleanNode('auto_delete')->defaultFalse()->end()

                                    // args
                                    ->arrayNode('arguments')
                                        ->prototype('scalar')->end()
                                        ->defaultValue(array())
                                        ->normalizeKeys(false)
                                    ->end()

                                    // binding
                                    ->arrayNode('routing_keys')
                                        ->prototype('scalar')->end()
                                        ->defaultValue(array())
                                    ->end()
                                ->end()
                            ->end()

                            ->arrayNode('qos_options')
                                ->addDefaultsIfNotSet()
                                ->children()
                                    ->integerNode('prefetch_size')->defaultValue(0)->end()
                                    ->integerNode('prefetch_count')->defaultValue(0)->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }

    /**
     * Exchange options for both consumer and producer
     *
     * @return NodeDefinition
     */
    private function exchangeOptions()
    {
        $builder = new NodeBuilder();

        return $builder
            ->arrayNode('exchange_options')
                ->children()
                    // base info
                    ->scalarNode('name')->isRequired()->end()
                    ->scalarNode('type')
                        ->info('Set the type of the exchange. If exchange already exist - you can skip it. Otherwise behavior is unpredictable')
                    ->end()

                    // flags
                    ->booleanNode('passive')->defaultFalse()->end()
                    ->booleanNode('durable')->defaultTrue()->end()
                    ->booleanNode('auto_delete')->defaultFalse()->end()

                    // args
                    ->arrayNode('arguments')
                        ->prototype('scalar')->end()
                        ->defaultValue(array())
                        ->normalizeKeys(false)
                    ->end()

                    // binding
                    ->arrayNode('routing_keys')
                        ->prototype('scalar')->end()
                        ->defaultValue(array())
                    ->end()

                    // default message attributes
                    ->arrayNode('publish_attributes')
                        ->prototype('scalar')->end()
                        ->defaultValue(array())
                    ->end()
                ->end();
            //last end is missed here intentionally because arrayNode doesn't have an actual parent
    }
}


text:
import argparse
import multiprocessing
import shutil
import subprocess
import sys
from os import makedirs, uname
from settings import *

BUILD_DIR = path.join(PROJECT_DIR, 'build')
DEFAULT_PORT_DIR = path.join(PROJECT_DIR, 'targets/default')

PROFILE_DIR = path.join(PROJECT_DIR, 'jerry-core/profiles')
DEFAULT_PROFILE = 'es5.1'

def default_toolchain():
    (sysname, _, _, _, machine) = uname()
    toolchain = path.join(PROJECT_DIR, 'cmake', 'toolchain_%s_%s.cmake' % (sysname.lower(), machine.lower()))
    return toolchain if path.isfile(toolchain) else None

def get_arguments():
    devhelp_preparser = argparse.ArgumentParser(add_help=False)
    devhelp_preparser.add_argument('--devhelp', action='store_true', default=False, help='show help with all options (including those, which are useful for developers only)')

    devhelp_arguments, args = devhelp_preparser.parse_known_args()
    if devhelp_arguments.devhelp:
        args.append('--devhelp')

    def devhelp(help):
        return help if devhelp_arguments.devhelp else argparse.SUPPRESS

    parser = argparse.ArgumentParser(parents=[devhelp_preparser])
    parser.add_argument('--all-in-one', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='all-in-one build (%(choices)s; default: %(default)s)')
    parser.add_argument('--builddir', metavar='DIR', action='store', default=BUILD_DIR, help='specify output directory (default: %(default)s)')
    parser.add_argument('--clean', action='store_true', default=False, help='clean build')
    parser.add_argument('--cmake-param', metavar='OPT', action='append', default=[], help='add custom argument to CMake')
    parser.add_argument('--compile-flag', metavar='OPT', action='append', default=[], help='add custom compile flag')
    parser.add_argument('--cpointer-32bit', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='enable 32 bit compressed pointers (%(choices)s; default: %(default)s)')
    parser.add_argument('--debug', action='store_const', const='Debug', default='MinSizeRel', dest='build_type', help='debug build')
    parser.add_argument('--error-messages', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='enable error messages (%(choices)s; default: %(default)s)')
    parser.add_argument('-j', '--jobs', metavar='N', action='store', type=int, default=multiprocessing.cpu_count() + 1, help='Allowed N build jobs at once (default: %(default)s)')
    parser.add_argument('--jerry-cmdline', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='build jerry command line tool (%(choices)s; default: %(default)s)')
    parser.add_argument('--jerry-cmdline-minimal', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='build minimal version of the jerry command line tool (%(choices)s; default: %(default)s)')
    parser.add_argument('--jerry-debugger', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='enable the jerry debugger (%(choices)s; default: %(default)s)')
    parser.add_argument('--jerry-libc', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='build and use jerry-libc (%(choices)s; default: %(default)s)')
    parser.add_argument('--jerry-libm', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='build and use jerry-libm (%(choices)s; default: %(default)s)')
    parser.add_argument('--js-parser', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='enable js-parser (%(choices)s; default: %(default)s)')
    parser.add_argument('--link-lib', metavar='OPT', action='append', default=[], help='add custom library to be linked')
    parser.add_argument('--linker-flag', metavar='OPT', action='append', default=[], help='add custom linker flag')
    parser.add_argument('--lto', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='enable link-time optimizations (%(choices)s; default: %(default)s)')
    parser.add_argument('--mem-heap', metavar='SIZE', action='store', type=int, default=512, help='size of memory heap, in kilobytes (default: %(default)s)')
    parser.add_argument('--port-dir', metavar='DIR', action='store', default=DEFAULT_PORT_DIR, help='add port directory (default: %(default)s)')
    parser.add_argument('--profile', metavar='FILE', action='store', default=DEFAULT_PROFILE, help='specify profile file (default: %(default)s)')
    parser.add_argument('--snapshot-exec', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='enable executing snapshot files (%(choices)s; default: %(default)s)')
    parser.add_argument('--snapshot-save', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='enable saving snapshot files (%(choices)s; default: %(default)s)')
    parser.add_argument('--system-allocator', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='enable system allocator (%(choices)s; default: %(default)s)')
    parser.add_argument('--static-link', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='enable static linking of binaries (%(choices)s; default: %(default)s)')
    parser.add_argument('--strip', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='strip release binaries (%(choices)s; default: %(default)s)')
    parser.add_argument('--toolchain', metavar='FILE', action='store', default=default_toolchain(), help='add toolchain file (default: %(default)s)')
    parser.add_argument('--unittests', action='store_const', const='ON', default='OFF', help='build unittests')
    parser.add_argument('-v', '--verbose', action='store_const', const='ON', default='OFF', help='increase verbosity')

    devgroup = parser.add_argument_group('developer options')
    devgroup.add_argument('--link-map', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help=devhelp('enable the generation of a link map file for jerry command line tool (%(choices)s; default: %(default)s)'))
    devgroup.add_argument('--mem-stats', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help=devhelp('enable memory statistics (%(choices)s; default: %(default)s)'))
    devgroup.add_argument('--mem-stress-test', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help=devhelp('enable mem-stress test (%(choices)s; default: %(default)s)'))
    devgroup.add_argument('--show-opcodes', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help=devhelp('enable parser byte-code dumps (%(choices)s; default: %(default)s)'))
    devgroup.add_argument('--show-regexp-opcodes', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help=devhelp('enable regexp byte-code dumps (%(choices)s; default: %(default)s)'))
    devgroup.add_argument('--valgrind', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help=devhelp('enable Valgrind support (%(choices)s; default: %(default)s)'))
    devgroup.add_argument('--valgrind-freya', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help=devhelp('enable Valgrind-Freya support (%(choices)s; default: %(default)s)'))

    arguments = parser.parse_args(args)
    if arguments.devhelp:
        parser.print_help()
        sys.exit(0)

    return arguments

def generate_build_options(arguments):
    build_options = []

    build_options.append('-DENABLE_ALL_IN_ONE=%s' % arguments.all_in_one)
    build_options.append('-DCMAKE_BUILD_TYPE=%s' % arguments.build_type)
    build_options.extend(arguments.cmake_param)
    build_options.append('-DEXTERNAL_COMPILE_FLAGS=' + ' '.join(arguments.compile_flag))
    build_options.append('-DFEATURE_CPOINTER_32_BIT=%s' % arguments.cpointer_32bit)
    build_options.append('-DFEATURE_ERROR_MESSAGES=%s' % arguments.error_messages)
    build_options.append('-DJERRY_CMDLINE=%s' % arguments.jerry_cmdline)
    build_options.append('-DJERRY_CMDLINE_MINIMAL=%s' % arguments.jerry_cmdline_minimal)
    build_options.append('-DJERRY_LIBC=%s' % arguments.jerry_libc)
    build_options.append('-DJERRY_LIBM=%s' % arguments.jerry_libm)
    build_options.append('-DFEATURE_JS_PARSER=%s' % arguments.js_parser)
    build_options.append('-DEXTERNAL_LINK_LIBS=' + ' '.join(arguments.link_lib))
    build_options.append('-DEXTERNAL_LINKER_FLAGS=' + ' '.join(arguments.linker_flag))
    build_options.append('-DENABLE_LTO=%s' % arguments.lto)
    build_options.append('-DMEM_HEAP_SIZE_KB=%d' % arguments.mem_heap)
    build_options.append('-DPORT_DIR=%s' % arguments.port_dir)

    if path.isabs(arguments.profile):
        PROFILE = arguments.profile
    else:
        PROFILE = path.join(PROFILE_DIR, arguments.profile + '.profile')

    build_options.append('-DFEATURE_PROFILE=%s' % PROFILE)

    build_options.append('-DFEATURE_DEBUGGER=%s' % arguments.jerry_debugger)
    build_options.append('-DFEATURE_SNAPSHOT_EXEC=%s' % arguments.snapshot_exec)
    build_options.append('-DFEATURE_SNAPSHOT_SAVE=%s' % arguments.snapshot_save)
    build_options.append('-DFEATURE_SYSTEM_ALLOCATOR=%s' % arguments.system_allocator)
    build_options.append('-DENABLE_STATIC_LINK=%s' % arguments.static_link)
    build_options.append('-DENABLE_STRIP=%s' % arguments.strip)

    if arguments.toolchain:
      build_options.append('-DCMAKE_TOOLCHAIN_FILE=%s' % arguments.toolchain)

    build_options.append('-DUNITTESTS=%s' % arguments.unittests)
    build_options.append('-DCMAKE_VERBOSE_MAKEFILE=%s' % arguments.verbose)

    # developer options
    build_options.append('-DENABLE_LINK_MAP=%s' % arguments.link_map)
    build_options.append('-DFEATURE_MEM_STATS=%s' % arguments.mem_stats)
    build_options.append('-DFEATURE_MEM_STRESS_TEST=%s' % arguments.mem_stress_test)
    build_options.append('-DFEATURE_PARSER_DUMP=%s' % arguments.show_opcodes)
    build_options.append('-DFEATURE_REGEXP_DUMP=%s' % arguments.show_regexp_opcodes)
    build_options.append('-DFEATURE_VALGRIND=%s' % arguments.valgrind)
    build_options.append('-DFEATURE_VALGRIND_FREYA=%s' % arguments.valgrind_freya)

    return build_options

def configure_output_dir(arguments):
    global BUILD_DIR

    if path.isabs(arguments.builddir):
        BUILD_DIR = arguments.builddir
    else:
        BUILD_DIR = path.join(PROJECT_DIR, arguments.builddir)

    if arguments.clean and path.exists(BUILD_DIR):
        shutil.rmtree(BUILD_DIR)

    if not path.exists(BUILD_DIR):
        makedirs(BUILD_DIR)

def configure_build(arguments):
    configure_output_dir(arguments)

    build_options = generate_build_options(arguments)

    cmake_cmd = ['cmake', '-B' + BUILD_DIR, '-H' + PROJECT_DIR]
    cmake_cmd.extend(build_options)

    return subprocess.call(cmake_cmd)

def build_jerry(arguments):
    return subprocess.call(['make', '--no-print-directory','-j', str(arguments.jobs), '-C', BUILD_DIR])

def print_result(ret):
    print('=' * 30)
    if ret:
        print('Build failed with exit code: %s' % (ret))
    else:
        print('Build succeeded!')
    print('=' * 30)

def main():
    arguments = get_arguments()
    ret = configure_build(arguments)

    if not ret:
        ret = build_jerry(arguments)

    print_result(ret)
    sys.exit(ret)

if __name__ == "__main__":
    main()


text:
package de.verygame.surface.resource;

/**
 * @author Rico Schrage
 *
 * Describes what an abstract resource-unit have to provide for the resource-handler. The difference between resource units and resources is that
 * resource units are not real resources, mostly they are part of a resource or were created with their help.
 * <br>
 * In general this interface will be implemented by enums.
 */
public interface ResourceUnit extends ResourceDescriptor {

    /**
     * @return name of the file
     */
    String getIdentifier();

    /**
     * @return type of the unit
     */
    ResourceUnitType getUnitType();

    /**
     * @return parent
     */
    Resource getParent();
}


text:
/* -*- mode: java; c-basic-offset: 8; indent-tabs-mode: t; tab-width: 8 -*- */

package util;

public class Penalty {

	/* When adding a penalty for extreme values while optimising
	   some function, we often want to have a smooth ramp up to
	   the maximum penalty over some range to avoid sudden jumps
	   in the function whose parameters are being optimized.

	   This function will return a penalty of zero when 'value' is
	   less than 'minPenaltyAt', a penalty of 'maxPenalty' when
	   'value' is greater than 'maxPenaltyAt' and use a scaled
	   logistic function to provide a smooth increase in the
	   penalty when value is in the range
	   [ 'minPenaltyAt', 'maxPenaltyAt' ]

	   See: http://en.wikipedia.org/wiki/Logistic_function
	*/

	public static double logisticPenalty( double value,
					      double minPenaltyAt,
					      double maxPenaltyAt,
					      double maxPenalty ) {

		if( value < minPenaltyAt )
			return 0;
		if( value > maxPenaltyAt )
			return maxPenalty;

		double midPoint = (minPenaltyAt + maxPenaltyAt) / 2;

		double minAtMinus6 = 0.00247262315663477;
		double maxAtPlus6 = 0.997527376843365;

		double logisticRange = maxAtPlus6 - minAtMinus6;

		double scaleUpT = 6.0 / (maxPenaltyAt - midPoint);

		double t = ( value - midPoint ) * scaleUpT;

		double rawValue = 1 / (1 + Math.exp( -t ) );

		// Make this piecewise continuous:
		double adjustedValue = (rawValue - minAtMinus6) / (maxAtPlus6 - minAtMinus6);

		return maxPenalty * adjustedValue;
	}
}