text:
#ifndef CAR_ADAPTOR_H_1264773009
#define CAR_ADAPTOR_H_1264773009

#include <QtCore/QObject>
#include <QtDBus/QtDBus>

QT_BEGIN_NAMESPACE
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;
QT_END_NAMESPACE

/*
 * Adaptor class for interface com.trolltech.Examples.CarInterface
 */
class CarInterfaceAdaptor: public QDBusAbstractAdaptor
{
    Q_OBJECT
    Q_CLASSINFO("D-Bus Interface", "com.trolltech.Examples.CarInterface")
    Q_CLASSINFO("D-Bus Introspection", ""
"  <interface name=\"com.trolltech.Examples.CarInterface\">\n"
"    <method name=\"accelerate\"/>\n"
"    <method name=\"decelerate\"/>\n"
"    <method name=\"turnLeft\"/>\n"
"    <method name=\"turnRight\"/>\n"
"    <signal name=\"crashed\"/>\n"
"  </interface>\n"
        "")
public:
    CarInterfaceAdaptor(QObject *parent);
    virtual ~CarInterfaceAdaptor();

public: // PROPERTIES
public Q_SLOTS: // METHODS
    void accelerate();
    void decelerate();
    void turnLeft();
    void turnRight();
Q_SIGNALS: // SIGNALS
    void crashed();
};

#endif


text:
Zeit
Website
Standard
Standort
Zeit
Website
Straße
Straße
Industrieregion
Hotellerie
Telefon
Zeit
Website
Technologie
Qualitätsmanagement
Zufriedenheit
Auswahl
Industrie
Software
E-Mail
Uhr
Medizintechnik
Software
Dokumentation
Zeit
Website
Website
Zeit
Website
Unternehmen
Medizintechnik
Entwicklung
Produktion
Produktion
Medizintechnik
Industrie
Software
Zeit
Website
Papier
Dokumentation
Zeit
Website
Dokumentation
Technologie
Medizin
Software
Zeit
Website
Software
Zeit
Website
Arztpraxis
Software
\xc4rzte
Daten
Patienten
Patienten
Videogerät
Datenbank
Daten
Zeit
Website
Medizintechnik
Unternehmen
Auswahl
Zeit
Website
Medizintechnik
Unternehmen
Auswahl
Zeit
Website
Zeit
Website
Standard
Zeit
Website
E-Mail
Netzwerk
Netzwerk
E-Mail
Software
Computer
Netzwerk
Zeit
Website
Videogerät
Datenspeicher
Zoll
Zoll
Zeit
Website
Datenbank
Zeit
Website
Medizintechnik
Drucker
Technologie
Drucker
Papier
Papier
Papier
Drucker
Drucker
Papier
Produktinformation
Zeit
Website
Wahl
Auswahl
Wahl
Flexibilität
Druckerzeugnis
Maßeinheit
Instandhaltung
Meinung
Drucker
Computer
Zeit
Website
Wahl
Zeit
Website
Wahl
Zeit
Website
Ergonomie
Zeit
Website
Bildschirm
Bildschirm
Panel
Zeit
Website
Licht
Lampe
Unternehmen
Welt
Zeit
Website
Export
Technologie
Zeit
Website
Tunnel
Technologie
Zeit
Website
Nachfrage
Kunststoff
Softwareentwicklung
Softwareentwicklung
Versorgung
Unternehmen
Planung
Zeit
Website
Kunststoff
Technologie
Kunststoff
Softwareentwicklung
Softwareentwicklung
Zeit
Website
Kunststoff
Softwareentwicklung
Softwareentwicklung
Zeit
Website
Nachfrage
Preis

redpajama_set_name: RedPajamaGithub


text:
package org.apache.rocketmq.common.sysflag;

/**
 * 拉取消息系统标志
 */
public class PullSysFlag {

    /**
     * 标志 - 提交消费进度
     */
    private final static int FLAG_COMMIT_OFFSET = 0x1 << 0;
    /**
     * 标志 - 是否挂起请求,当无消息时
     */
    private final static int FLAG_SUSPEND = 0x1 << 1;
    /**
     * 标记 - 是否过滤订阅表达式(subscription)
     */
    private final static int FLAG_SUBSCRIPTION = 0x1 << 2;
    /**
     *
     */
    private final static int FLAG_CLASS_FILTER = 0x1 << 3;

    public static int buildSysFlag(final boolean commitOffset, final boolean suspend,
        final boolean subscription, final boolean classFilter) {
        int flag = 0;

        if (commitOffset) {
            flag |= FLAG_COMMIT_OFFSET;
        }

        if (suspend) {
            flag |= FLAG_SUSPEND;
        }

        if (subscription) {
            flag |= FLAG_SUBSCRIPTION;
        }

        if (classFilter) {
            flag |= FLAG_CLASS_FILTER;
        }

        return flag;
    }

    public static int clearCommitOffsetFlag(final int sysFlag) {
        return sysFlag & (~FLAG_COMMIT_OFFSET);
    }

    public static boolean hasCommitOffsetFlag(final int sysFlag) {
        return (sysFlag & FLAG_COMMIT_OFFSET) == FLAG_COMMIT_OFFSET;
    }

    public static boolean hasSuspendFlag(final int sysFlag) {
        return (sysFlag & FLAG_SUSPEND) == FLAG_SUSPEND;
    }

    public static boolean hasSubscriptionFlag(final int sysFlag) {
        return (sysFlag & FLAG_SUBSCRIPTION) == FLAG_SUBSCRIPTION;
    }

    public static boolean hasClassFilterFlag(final int sysFlag) {
        return (sysFlag & FLAG_CLASS_FILTER) == FLAG_CLASS_FILTER;
    }
}


text:
package org.elasticsearch.xpack.sql.optimizer;

import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.ql.expression.Expression;
import org.elasticsearch.xpack.ql.expression.FieldAttribute;
import org.elasticsearch.xpack.ql.expression.Literal;
import org.elasticsearch.xpack.ql.expression.UnresolvedAttribute;
import org.elasticsearch.xpack.ql.expression.function.FunctionRegistry;
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.BinaryComparison;
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.Equals;
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.GreaterThan;
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.GreaterThanOrEqual;
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.LessThan;
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.LessThanOrEqual;
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.NotEquals;
import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.NullEquals;
import org.elasticsearch.xpack.ql.index.EsIndex;
import org.elasticsearch.xpack.ql.index.IndexResolution;
import org.elasticsearch.xpack.ql.optimizer.OptimizerRules.LiteralsOnTheRight;
import org.elasticsearch.xpack.ql.plan.logical.Filter;
import org.elasticsearch.xpack.ql.plan.logical.LogicalPlan;
import org.elasticsearch.xpack.ql.plan.logical.UnaryPlan;
import org.elasticsearch.xpack.ql.type.EsField;
import org.elasticsearch.xpack.sql.SqlTestUtils;
import org.elasticsearch.xpack.sql.analysis.analyzer.Analyzer;
import org.elasticsearch.xpack.sql.analysis.analyzer.Verifier;
import org.elasticsearch.xpack.sql.parser.SqlParser;
import org.elasticsearch.xpack.sql.stats.Metrics;
import org.elasticsearch.xpack.sql.types.SqlTypesTests;

import java.time.ZonedDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.BinaryComparisonProcessor.BinaryComparisonOperation.EQ;
import static org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.BinaryComparisonProcessor.BinaryComparisonOperation.GT;
import static org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.BinaryComparisonProcessor.BinaryComparisonOperation.GTE;
import static org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.BinaryComparisonProcessor.BinaryComparisonOperation.LT;
import static org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.BinaryComparisonProcessor.BinaryComparisonOperation.LTE;
import static org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.BinaryComparisonProcessor.BinaryComparisonOperation.NEQ;
import static org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.BinaryComparisonProcessor.BinaryComparisonOperation.NULLEQ;

public class OptimizerRunTests extends ESTestCase {

    private final SqlParser parser;
    private final IndexResolution getIndexResult;
    private final FunctionRegistry functionRegistry;
    private final Analyzer analyzer;
    private final Optimizer optimizer;
    private static final Map<String, Class<? extends BinaryComparison>> COMPARISONS = new HashMap<>() {
        {
            put(EQ.symbol(), Equals.class);
            put(NULLEQ.symbol(), NullEquals.class);
            put(NEQ.symbol(), NotEquals.class);
            put(GT.symbol(), GreaterThan.class);
            put(GTE.symbol(), GreaterThanOrEqual.class);
            put(LT.symbol(), LessThan.class);
            put(LTE.symbol(), LessThanOrEqual.class);
        }
    };
    private static final LiteralsOnTheRight LITERALS_ON_THE_RIGHT = new LiteralsOnTheRight();

    public OptimizerRunTests() {
        parser = new SqlParser();
        functionRegistry = new FunctionRegistry();

        Map<String, EsField> mapping = SqlTypesTests.loadMapping("mapping-multi-field-variation.json");

        EsIndex test = new EsIndex("test", mapping);
        getIndexResult = IndexResolution.valid(test);
        analyzer = new Analyzer(SqlTestUtils.TEST_CFG, functionRegistry, getIndexResult, new Verifier(new Metrics()));
        optimizer = new Optimizer();
    }

    private LogicalPlan plan(String sql) {
        return optimizer.optimize(analyzer.analyze(parser.createStatement(sql)));
    }

    public void testWhereClause() {
        LogicalPlan p = plan("SELECT some.string l FROM test WHERE int IS NOT NULL AND int < 10005 ORDER BY int");
        assertNotNull(p);
    }

    public void testSimplifyComparisonArithmeticCommutativeVsNonCommutativeOps() {
        doTestSimplifyComparisonArithmetics("int + 2 > 3", "int", ">", 1);
        doTestSimplifyComparisonArithmetics("2 + int > 3", "int", ">", 1);
        doTestSimplifyComparisonArithmetics("int - 2 > 3", "int", ">", 5);
        doTestSimplifyComparisonArithmetics("2 - int > 3", "int", "<", -1);
        doTestSimplifyComparisonArithmetics("int * 2 > 4", "int", ">", 2);
        doTestSimplifyComparisonArithmetics("2 * int > 4", "int", ">", 2);
        doTestSimplifyComparisonArithmetics("float / 2 > 4", "float", ">", 8d);
        doTestSimplifyComparisonArithmetics("2 / float < 4", "float", ">", .5);
    }

    public void testSimplifyComparisonArithmeticWithMultipleOps() {
        // i >= 3
        doTestSimplifyComparisonArithmetics("((int + 1) * 2 - 4) * 4 >= 16", "int", ">=", 3);
    }

    public void testSimplifyComparisonArithmeticWithFieldNegation() {
        doTestSimplifyComparisonArithmetics("12 * (-int - 5) >= -120", "int", "<=", 5);
    }

    public void testSimplifyComparisonArithmeticWithFieldDoubleNegation() {
        doTestSimplifyComparisonArithmetics("12 * -(-int - 5) <= 120", "int", "<=", 5);
    }

    public void testSimplifyComparisonArithmeticWithConjunction() {
        doTestSimplifyComparisonArithmetics("12 * (-int - 5) = -120 AND int < 6 ", "int", "==", 5);
    }

    public void testSimplifyComparisonArithmeticWithDisjunction() {
        doTestSimplifyComparisonArithmetics("12 * (-int - 5) >= -120 OR int < 5", "int", "<=", 5);
    }

    public void testSimplifyComparisonArithmeticWithFloatsAndDirectionChange() {
        doTestSimplifyComparisonArithmetics("float / -2 < 4", "float", ">", -8d);
        doTestSimplifyComparisonArithmetics("float * -2 < 4", "float", ">", -2d);
    }

    public void testSimplyComparisonArithmeticWithUnfoldedProd() {
        assertSemanticMatching("int * int >= 3", "((int * int + 1) * 2 - 4) * 4 >= 16");
    }

    public void testSimplifyComparisonArithmeticSkippedOnIntegerArithmeticalOverflow() {
        assertNotSimplified("int - 1 " + randomBinaryComparison() + " " + Long.MAX_VALUE);
        assertNotSimplified("1 - int " + randomBinaryComparison() + " " + Long.MIN_VALUE);
        assertNotSimplified("int - 1 " + randomBinaryComparison() + " " + Integer.MAX_VALUE);
        assertNotSimplified("1 - int " + randomBinaryComparison() + " " + Integer.MIN_VALUE);
    }

    public void testSimplifyComparisonArithmeticSkippedOnIntegerArithmeticalOverflowOnNegation() {
        assertNotSimplified("-int " + randomBinaryComparison() + " " + Long.MIN_VALUE);
        assertNotSimplified("-int " + randomBinaryComparison() + " " + Integer.MIN_VALUE);
    }

    public void testSimplifyComparisonArithmeticSkippedOnFloatingPointArithmeticalOverflow() {
        assertNotSimplified("float / 10 " + randomBinaryComparison() + " " + Float.MAX_VALUE);
        assertNotSimplified("float / " + Float.MAX_VALUE +" " + randomBinaryComparison() + " 10");
        assertNotSimplified("float / 10 " + randomBinaryComparison() + " " + Double.MAX_VALUE);
        assertNotSimplified("float / " + Double.MAX_VALUE + " " + randomBinaryComparison() + " 10");
        // note: the "reversed" test (i.e.: MAX_VALUE / float < literal) would require a floating literal, which is skipped for other
        // reason (see testSimplifyComparisonArithmeticSkippedOnFloats())
    }

    public void testSimplifyComparisonArithmeticSkippedOnNegatingOverflow() {
        assertNotSimplified("-int " + randomBinaryComparison() + " " + Long.MIN_VALUE);
        assertNotSimplified("-int " + randomBinaryComparison() + " " + Integer.MIN_VALUE);
    }

    public void testSimplifyComparisonArithmeticSkippedOnDateOverflow() {
        assertNotSimplified("date - INTERVAL 999999999 YEAR > '2010-01-01T01:01:01'::DATETIME");
        assertNotSimplified("date + INTERVAL -999999999 YEAR > '2010-01-01T01:01:01'::DATETIME");
    }

    public void testSimplifyComparisonArithmeticSkippedOnMulDivByZero() {
        assertNotSimplified("float / 0 " + randomBinaryComparison() + " 1");
        assertNotSimplified("float * 0 " + randomBinaryComparison() + " 1");
        assertNotSimplified("int / 0 " + randomBinaryComparison() + " 1");
        assertNotSimplified("int * 0 " + randomBinaryComparison() + " 1");
    }

    public void testSimplifyComparisonArithmeticSkippedOnDiv() {
        assertNotSimplified("int / 4 " + randomBinaryComparison() + " 1");
        assertNotSimplified("4 / int " + randomBinaryComparison() + " 1");
    }

    public void testSimplifyComparisonArithmeticSkippedOnResultingFloatLiteral() {
        assertNotSimplified("int * 2 " + randomBinaryComparison() + " 3");
    }

    public void testSimplifyComparisonArithmeticSkippedOnFloatFieldWithPlusMinus() {
        assertNotSimplified("float + 4 " + randomBinaryComparison() + " 1");
        assertNotSimplified("4 + float " + randomBinaryComparison() + " 1");
        assertNotSimplified("float - 4 " + randomBinaryComparison() + " 1");
        assertNotSimplified("4 - float " + randomBinaryComparison() + " 1");
    }

    public void testSimplifyComparisonArithmeticSkippedOnFloats() {
        for (String field : List.of("int", "float")) {
            for (Tuple<? extends Number, ? extends Number> nr : List.of(new Tuple<>(.4, 1), new Tuple<>(1, .4))) {
                assertNotSimplified(field + " + " + nr.v1() + " " + randomBinaryComparison() + " " + nr.v2());
                assertNotSimplified(field + " - " + nr.v1() + " " + randomBinaryComparison() + " " + nr.v2());
                assertNotSimplified(nr.v1()+ " + " + field  + " " + randomBinaryComparison() + " " + nr.v2());
                assertNotSimplified(nr.v1()+ " - " + field  + " " + randomBinaryComparison() + " " + nr.v2());
            }
        }
    }

    public void testSimplifyComparisonArithmeticWithDateTime() {
        doTestSimplifyComparisonArithmetics("date - INTERVAL 1 MONTH > '2010-01-01T01:01:01'::DATETIME", "date", ">",
            ZonedDateTime.parse("2010-02-01T01:01:01Z"));
    }

    public void testSimplifyComparisonArithmeticWithDate() {
        doTestSimplifyComparisonArithmetics("date + INTERVAL 1 YEAR <= '2011-01-01T00:00:00'::DATE", "date", "<=",
            ZonedDateTime.parse("2010-01-01T00:00:00Z"));
    }

    public void testSimplifyComparisonArithmeticWithDateAndMultiplication() {
        // the multiplication should be folded, but check
        doTestSimplifyComparisonArithmetics("date + 2 * INTERVAL 1 YEAR <= '2012-01-01T00:00:00'::DATE", "date", "<=",
            ZonedDateTime.parse("2010-01-01T00:00:00Z"));
    }

    private void doTestSimplifyComparisonArithmetics(String expression, String fieldName, String compSymbol, Object bound) {
        BinaryComparison bc = extractPlannedBinaryComparison(expression);
        assertEquals(compSymbol, bc.symbol());
        assertTrue(COMPARISONS.get(compSymbol).isInstance(bc));

        assertTrue(bc.left() instanceof FieldAttribute);
        FieldAttribute attribute = (FieldAttribute) bc.left();
        assertEquals(fieldName, attribute.name());

        assertTrue(bc.right() instanceof Literal);
        Literal literal = (Literal) bc.right();
        assertEquals(bound, literal.value());
    }

    private void assertNotSimplified(String condition) {
        assertSemanticMatching(extractPlannedBinaryComparison(condition), parser.createExpression(condition));
    }

    private void assertSemanticMatching(String expected, String provided) {
        BinaryComparison bc = extractPlannedBinaryComparison(provided);
        Expression exp = parser.createExpression(expected);
        assertSemanticMatching(bc, exp);
    }

    private BinaryComparison extractPlannedBinaryComparison(String expression) {
        LogicalPlan plan = planWithArithmeticCondition(expression);

        assertTrue(plan instanceof UnaryPlan);
        UnaryPlan unaryPlan = (UnaryPlan) plan;
        assertTrue(unaryPlan.child() instanceof Filter);
        Filter filter = (Filter) unaryPlan.child();
        assertTrue(filter.condition() instanceof BinaryComparison);
        return (BinaryComparison) filter.condition();
    }

    private LogicalPlan planWithArithmeticCondition(String condition) {
        return plan("SELECT some.string FROM test WHERE " + condition);
    }

    private static void assertSemanticMatching(Expression fieldAttributeExp, Expression unresolvedAttributeExp) {
        Expression unresolvedUpdated = unresolvedAttributeExp
            .transformUp(LITERALS_ON_THE_RIGHT.expressionToken(), LITERALS_ON_THE_RIGHT::rule)
            .transformUp(x -> x.foldable() ? new Literal(x.source(), x.fold(), x.dataType()) : x);

        List<Expression> resolvedFields = fieldAttributeExp.collectFirstChildren(x -> x instanceof FieldAttribute);
        for (Expression field : resolvedFields) {
            FieldAttribute fa = (FieldAttribute) field;
            unresolvedUpdated = unresolvedUpdated.transformDown(UnresolvedAttribute.class, x -> x.name().equals(fa.name()) ? fa : x);
        }

        assertTrue(unresolvedUpdated.semanticEquals(fieldAttributeExp));
    }

    private static String randomBinaryComparison() {
        return randomFrom(COMPARISONS.keySet().stream().map(x -> EQ.symbol().equals(x) ? "=" : x).collect(Collectors.toSet()));
    }
}


text:
'use strict';

/* jshint -W098 */
// The Package is past automatically as first parameter
module.exports = function(SbAdmin, app, auth, database) {

  app.get('/api/sbAdmin/example/anyone', function(req, res, next) {
    res.send('Anyone can access this');
  });

  app.get('/api/sbAdmin/example/auth', auth.requiresLogin, function(req, res, next) {
    res.send('Only authenticated users can access this');
  });

  app.get('/api/sbAdmin/example/admin', auth.requiresAdmin, function(req, res, next) {
    res.send('Only users with Admin role can access this');
  });

  app.get('/api/sbAdmin/example/render', function(req, res, next) {
    SbAdmin.render('index', {
      package: 'sb-admin'
    }, function(err, html) {
      //Rendering a view from the Package server/views
      res.send(html);
    });
  });
};


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Copley Motion Library: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Copley Motion Library

Main Page

Classes

Files

Class List

Class Index

Class Hierarchy

Class Members

Semaphore Member List

This is the complete list of members for Semaphore, including all inherited members.

Get(Timeout timeout=-1)	Semaphore

Put(void)	Semaphore

Semaphore(int32 count=0)	Semaphore

~Semaphore()	Semaphore	virtual

<address style="align: right;">
Copley Motion Library, Copyright (c) 2002-2003

</address>


text:
package main

import (
	"archive/tar"
	"compress/gzip"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/url"
	"os"
	"path"
	"path/filepath"
	"strconv"
	"strings"

	"github.com/appc/spec/aci"
	"github.com/appc/spec/schema"
	"github.com/appc/spec/schema/types"
)

var (
	inputFile  string
	outputFile string

	patchNocompress        bool
	patchOverwrite         bool
	patchReplace           bool
	patchManifestFile      string
	patchName              string
	patchExec              string
	patchUser              string
	patchGroup             string
	patchSupplementaryGIDs string
	patchCaps              string
	patchMounts            string
	patchPorts             string
	patchIsolators         string

	catPrettyPrint bool

	cmdPatchManifest = &Command{
		Name:        "patch-manifest",
		Description: `Copy an ACI and patch its manifest.`,
		Summary:     "Copy an ACI and patch its manifest (experimental)",
		Usage: `
		  [--manifest=MANIFEST_FILE]
		  [--name=example.com/app]
		  [--exec="/app --debug"]
		  [--user=uid] [--group=gid]
		  [--capability=CAP_SYS_ADMIN,CAP_NET_ADMIN]
		  [--mounts=work,path=/opt,readOnly=true[:work2,...]]
		  [--ports=query,protocol=tcp,port=8080[:query2,...]]
		  [--supplementary-groups=gid1,gid2,...]
		  [--isolators=resource/cpu,request=50m,limit=100m[:resource/memory,...]]
		  [--replace]
		  INPUT_ACI_FILE
		  [OUTPUT_ACI_FILE]`,
		Run: runPatchManifest,
	}
	cmdCatManifest = &Command{
		Name:        "cat-manifest",
		Description: `Print the manifest from an ACI.`,
		Summary:     "Print the manifest from an ACI",
		Usage:       ` [--pretty-print] ACI_FILE`,
		Run:         runCatManifest,
	}
)

func init() {
	cmdPatchManifest.Flags.BoolVar(&patchOverwrite, "overwrite", false, "Overwrite target file if it already exists")
	cmdPatchManifest.Flags.BoolVar(&patchNocompress, "no-compression", false, "Do not gzip-compress the produced ACI")
	cmdPatchManifest.Flags.BoolVar(&patchReplace, "replace", false, "Replace the input file")

	cmdPatchManifest.Flags.StringVar(&patchManifestFile, "manifest", "", "Replace image manifest with this file. Incompatible with other replace options.")
	cmdPatchManifest.Flags.StringVar(&patchName, "name", "", "Replace name")
	cmdPatchManifest.Flags.StringVar(&patchExec, "exec", "", "Replace the command line to launch the executable")
	cmdPatchManifest.Flags.StringVar(&patchUser, "user", "", "Replace user")
	cmdPatchManifest.Flags.StringVar(&patchGroup, "group", "", "Replace group")
	cmdPatchManifest.Flags.StringVar(&patchSupplementaryGIDs, "supplementary-groups", "", "Replace supplementary groups, expects a comma-separated list.")
	cmdPatchManifest.Flags.StringVar(&patchCaps, "capability", "", "Replace capability")
	cmdPatchManifest.Flags.StringVar(&patchMounts, "mounts", "", "Replace mount points")
	cmdPatchManifest.Flags.StringVar(&patchPorts, "ports", "", "Replace ports")
	cmdPatchManifest.Flags.StringVar(&patchIsolators, "isolators", "", "Replace isolators")

	cmdCatManifest.Flags.BoolVar(&catPrettyPrint, "pretty-print", false, "Print with better style")
}

func getIsolatorStr(name, value string) string {
	return fmt.Sprintf(`
                {
                    "name": "%s",
                    "value": { %s }
                }`, name, value)
}

func isolatorStrFromString(is string) (types.ACIdentifier, string, error) {
	is = "name=" + is
	v, err := url.ParseQuery(strings.Replace(is, ",", "&", -1))
	if err != nil {
		return "", "", err
	}

	var name string
	var values []string
	var acn *types.ACIdentifier

	for key, val := range v {
		if len(val) > 1 {
			return "", "", fmt.Errorf("label %s with multiple values %q", key, val)
		}

		switch key {
		case "name":
			acn, err = types.NewACIdentifier(val[0])
			if err != nil {
				return "", "", err
			}
			name = val[0]
		default:
			// (TODO)yifan: Not support the default boolean yet.
			values = append(values, fmt.Sprintf(`"%s": "%s"`, key, val[0]))
		}
	}
	return *acn, getIsolatorStr(name, strings.Join(values, ", ")), nil
}

func patchManifest(im *schema.ImageManifest) error {

	if patchName != "" {
		name, err := types.NewACIdentifier(patchName)
		if err != nil {
			return err
		}
		im.Name = *name
	}

	var app *types.App = im.App
	if patchExec != "" {
		if app == nil {
			// if the original manifest was missing an app and
			// patchExec is set let's assume the user is trying to
			// inject one...
			im.App = &types.App{}
			app = im.App
		}
		app.Exec = strings.Split(patchExec, " ")
	}

	if patchUser != "" || patchGroup != "" || patchSupplementaryGIDs != "" || patchCaps != "" || patchMounts != "" || patchPorts != "" || patchIsolators != "" {
		// ...but if we still don't have an app and the user is trying
		// to patch one of its other parameters, it's an error
		if app == nil {
			return fmt.Errorf("no app in the supplied manifest and no exec command provided")
		}
	}

	if patchUser != "" {
		app.User = patchUser
	}

	if patchGroup != "" {
		app.Group = patchGroup
	}

	if patchSupplementaryGIDs != "" {
		app.SupplementaryGIDs = []int{}
		gids := strings.Split(patchSupplementaryGIDs, ",")
		for _, g := range gids {
			gid, err := strconv.Atoi(g)
			if err != nil {
				return fmt.Errorf("invalid supplementary group %q: %v", g, err)
			}
			app.SupplementaryGIDs = append(app.SupplementaryGIDs, gid)
		}
	}

	if patchCaps != "" {
		isolator := app.Isolators.GetByName(types.LinuxCapabilitiesRetainSetName)
		if isolator != nil {
			return fmt.Errorf("isolator already exists")
		}

		// Instantiate a Isolator with the content specified by the --capability
		// parameter.
		caps, err := types.NewLinuxCapabilitiesRetainSet(strings.Split(patchCaps, ",")...)
		if err != nil {
			return fmt.Errorf("cannot parse capability %q: %v", patchCaps, err)
		}
		app.Isolators = append(app.Isolators, caps.AsIsolator())
	}

	if patchMounts != "" {
		mounts := strings.Split(patchMounts, ":")
		for _, m := range mounts {
			mountPoint, err := types.MountPointFromString(m)
			if err != nil {
				return fmt.Errorf("cannot parse mount point %q: %v", m, err)
			}
			app.MountPoints = append(app.MountPoints, *mountPoint)
		}
	}

	if patchPorts != "" {
		ports := strings.Split(patchPorts, ":")
		for _, p := range ports {
			port, err := types.PortFromString(p)
			if err != nil {
				return fmt.Errorf("cannot parse port %q: %v", p, err)
			}
			app.Ports = append(app.Ports, *port)
		}
	}

	if patchIsolators != "" {
		isolators := strings.Split(patchIsolators, ":")
		for _, is := range isolators {
			name, isolatorStr, err := isolatorStrFromString(is)
			if err != nil {
				return fmt.Errorf("cannot parse isolator %q: %v", is, err)
			}

			if _, ok := types.ResourceIsolatorNames[name]; !ok {
				return fmt.Errorf("isolator %s is not supported for patching", name)
			}

			isolator := &types.Isolator{}
			if err := isolator.UnmarshalJSON([]byte(isolatorStr)); err != nil {
				return fmt.Errorf("cannot unmarshal isolator %v: %v", isolatorStr, err)
			}
			app.Isolators = append(app.Isolators, *isolator)
		}
	}
	return nil
}

// extractManifest iterates over the tar reader and locate the manifest. Once
// located, the manifest can be printed, replaced or patched.
func extractManifest(tr *tar.Reader, tw *tar.Writer, printManifest bool, newManifest []byte) error {
Tar:
	for {
		hdr, err := tr.Next()
		switch err {
		case io.EOF:
			break Tar
		case nil:
			if filepath.Clean(hdr.Name) == aci.ManifestFile {
				var new_bytes []byte

				bytes, err := ioutil.ReadAll(tr)
				if err != nil {
					return err
				}

				if printManifest && !catPrettyPrint {
					fmt.Println(string(bytes))
				}

				im := &schema.ImageManifest{}
				err = im.UnmarshalJSON(bytes)
				if err != nil {
					return err
				}

				if printManifest && catPrettyPrint {
					output, err := json.MarshalIndent(im, "", "    ")
					if err != nil {
						return err
					}
					fmt.Println(string(output))
				}

				if tw == nil {
					return nil
				}

				if len(newManifest) == 0 {
					err = patchManifest(im)
					if err != nil {
						return err
					}

					new_bytes, err = im.MarshalJSON()
					if err != nil {
						return err
					}
				} else {
					new_bytes = newManifest
				}

				hdr.Size = int64(len(new_bytes))
				err = tw.WriteHeader(hdr)
				if err != nil {
					return err
				}

				_, err = tw.Write(new_bytes)
				if err != nil {
					return err
				}
			} else if tw != nil {
				err := tw.WriteHeader(hdr)
				if err != nil {
					return err
				}
				_, err = io.Copy(tw, tr)
				if err != nil {
					return err
				}
			}
		default:
			return fmt.Errorf("error reading tarball: %v", err)
		}
	}

	return nil
}

func runPatchManifest(args []string) (exit int) {
	var fh *os.File
	var err error

	if patchReplace && patchOverwrite {
		stderr("patch-manifest: Cannot use both --replace and --overwrite")
		return 1
	}
	if !patchReplace && len(args) != 2 {
		stderr("patch-manifest: Must provide input and output files (or use --replace)")
		return 1
	}
	if patchReplace && len(args) != 1 {
		stderr("patch-manifest: Must provide one file")
		return 1
	}
	if patchManifestFile != "" && (patchName != "" || patchExec != "" || patchUser != "" || patchGroup != "" || patchCaps != "" || patchMounts != "") {
		stderr("patch-manifest: --manifest is incompatible with other manifest editing options")
		return 1
	}

	inputFile = args[0]

	// Prepare output writer

	if patchReplace {
		fh, err = ioutil.TempFile(path.Dir(inputFile), ".actool-tmp."+path.Base(inputFile)+"-")
		if err != nil {
			stderr("patch-manifest: Cannot create temporary file: %v", err)
			return 1
		}
	} else {
		outputFile = args[1]

		ext := filepath.Ext(outputFile)
		if ext != schema.ACIExtension {
			stderr("patch-manifest: Extension must be %s (given %s)", schema.ACIExtension, ext)
			return 1
		}

		mode := os.O_CREATE | os.O_WRONLY
		if patchOverwrite {
			mode |= os.O_TRUNC
		} else {
			mode |= os.O_EXCL
		}

		fh, err = os.OpenFile(outputFile, mode, 0644)
		if err != nil {
			if os.IsExist(err) {
				stderr("patch-manifest: Output file exists (try --overwrite)")
			} else {
				stderr("patch-manifest: Unable to open output %s: %v", outputFile, err)
			}
			return 1
		}
	}

	var gw *gzip.Writer
	var w io.WriteCloser = fh
	if !patchNocompress {
		gw = gzip.NewWriter(fh)
		w = gw
	}
	tw := tar.NewWriter(w)

	defer func() {
		tw.Close()
		if !patchNocompress {
			gw.Close()
		}
		fh.Close()
		if exit != 0 && !patchOverwrite {
			os.Remove(fh.Name())
		}
	}()

	// Prepare input reader

	input, err := os.Open(inputFile)
	if err != nil {
		stderr("patch-manifest: Cannot open %s: %v", inputFile, err)
		return 1
	}
	defer input.Close()

	tr, err := aci.NewCompressedTarReader(input)
	if err != nil {
		stderr("patch-manifest: Cannot extract %s: %v", inputFile, err)
		return 1
	}
	defer tr.Close()

	var newManifest []byte

	if patchManifestFile != "" {
		mr, err := os.Open(patchManifestFile)
		if err != nil {
			stderr("patch-manifest: Cannot open %s: %v", patchManifestFile, err)
			return 1
		}
		defer input.Close()

		newManifest, err = ioutil.ReadAll(mr)
		if err != nil {
			stderr("patch-manifest: Cannot read %s: %v", patchManifestFile, err)
			return 1
		}
	}

	err = extractManifest(tr.Reader, tw, false, newManifest)
	if err != nil {
		stderr("patch-manifest: Unable to read %s: %v", inputFile, err)
		return 1
	}

	if patchReplace {
		err = os.Rename(fh.Name(), inputFile)
		if err != nil {
			stderr("patch-manifest: Cannot rename %q to %q: %v", fh.Name, inputFile, err)
			return 1
		}
	}

	return
}

func runCatManifest(args []string) (exit int) {
	if len(args) != 1 {
		stderr("cat-manifest: Must provide one file")
		return 1
	}

	inputFile = args[0]

	input, err := os.Open(inputFile)
	if err != nil {
		stderr("cat-manifest: Cannot open %s: %v", inputFile, err)
		return 1
	}
	defer input.Close()

	tr, err := aci.NewCompressedTarReader(input)
	if err != nil {
		stderr("cat-manifest: Cannot extract %s: %v", inputFile, err)
		return 1
	}
	defer tr.Close()

	err = extractManifest(tr.Reader, nil, true, nil)
	if err != nil {
		stderr("cat-manifest: Unable to read %s: %v", inputFile, err)
		return 1
	}

	return
}


text:
import {Component, ComponentFactoryResolver, Injector, NgModule, TemplateRef, ViewChild, ViewContainerRef} from '@angular/core';
import {TestBed} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers';

describe('TemplateRef', () => {
  describe('rootNodes', () => {
    @Component({template: `<ng-template #templateRef></ng-template>`})
    class App {
      @ViewChild('templateRef', {static: true}) templateRef!: TemplateRef<any>;
      minutes = 0;
    }

    function getRootNodes(template: string): any[] {
      TestBed.configureTestingModule({
        declarations: [App],
      });
      TestBed.overrideTemplate(App, template);
      const fixture = TestBed.createComponent(App);
      fixture.detectChanges();

      const embeddedView = fixture.componentInstance.templateRef.createEmbeddedView({});
      embeddedView.detectChanges();

      return embeddedView.rootNodes;
    }

    it('should return root render nodes for an embedded view instance', () => {
      const rootNodes =
          getRootNodes(`<ng-template #templateRef><div></div>some text<span></span></ng-template>`);
      expect(rootNodes.length).toBe(3);
    });

    it('should return an empty array for embedded view with no nodes', () => {
      const rootNodes = getRootNodes('<ng-template #templateRef></ng-template>');
      expect(rootNodes.length).toBe(0);
    });

    it('should include projected nodes and their children', () => {
      @Component({
        selector: 'menu-content',
        template: `
              <ng-template>
                Header
                <ng-content></ng-content>
              </ng-template>
            `,
        exportAs: 'menuContent'
      })
      class MenuContent {
        @ViewChild(TemplateRef, {static: true}) template!: TemplateRef<any>;
      }

      @Component({
        template: `
              <menu-content #menu="menuContent">
                <button>Item one</button>
                <button>Item two</button>
                <ng-template [ngIf]="true"><button>Item three</button></ng-template>
              </menu-content>
            `
      })
      class App {
        @ViewChild(MenuContent) content!: MenuContent;

        constructor(public viewContainerRef: ViewContainerRef) {}
      }

      TestBed.configureTestingModule({declarations: [MenuContent, App]});
      const fixture = TestBed.createComponent(App);
      fixture.detectChanges();

      const instance = fixture.componentInstance;
      const viewRef = instance.viewContainerRef.createEmbeddedView(instance.content.template);
      const rootNodeTextContent =
          viewRef.rootNodes.map(node => node && node.textContent.trim())
              .filter(text => text !== '' && text.indexOf('ng-reflect-ng-if') === -1);

      expect(rootNodeTextContent).toEqual(['Header', 'Item one', 'Item two', 'Item three']);
    });

    it('should descend into view containers on ng-template', () => {
      /**
       * NOTE: In VE, if `SUFFIX` text node below is _not_ present, VE will add an
       * additional `<!---->` comment, thus being slightly different than Ivy.
       * (resulting in 1 root node in Ivy and 2 in VE).
       */
      const rootNodes = getRootNodes(`
      <ng-template #templateRef>
        <ng-template [ngIf]="true">text|</ng-template>SUFFIX
      </ng-template>`);

      expect(rootNodes.length).toBe(3);
      expect(rootNodes[0].nodeType).toBe(Node.COMMENT_NODE);
      expect(rootNodes[1].nodeType).toBe(Node.TEXT_NODE);
      expect(rootNodes[2].nodeType).toBe(Node.TEXT_NODE);
    });

    it('should descend into view containers on an element', () => {
      /**
       * NOTE: In VE, if `SUFFIX` text node below is _not_ present, VE will add an
       * additional `<!---->` comment, thus being slightly different than Ivy.
       * (resulting in 1 root node in Ivy and 2 in VE).
       */
      const rootNodes = getRootNodes(`
      <ng-template #dynamicTpl>text</ng-template>
      <ng-template #templateRef>
        <div [ngTemplateOutlet]="dynamicTpl"></div>SUFFIX
      </ng-template>
    `);

      expect(rootNodes.length).toBe(3);
      expect(rootNodes[0].nodeType).toBe(Node.ELEMENT_NODE);
      expect(rootNodes[1].nodeType).toBe(Node.TEXT_NODE);
      expect(rootNodes[2].nodeType).toBe(Node.TEXT_NODE);
    });

    it('should descend into view containers on ng-container', () => {
      /**
       * NOTE: In VE, if `SUFFIX` text node below is _not_ present, VE will add an
       * additional `<!---->` comment, thus being slightly different than Ivy.
       * (resulting in 1 root node in Ivy and 2 in VE).
       */
      const rootNodes = getRootNodes(`
          <ng-template #dynamicTpl>text</ng-template>
          <ng-template #templateRef><ng-container [ngTemplateOutlet]="dynamicTpl"></ng-container>SUFFIX</ng-template>
        `);

      expect(rootNodes.length).toBe(3);
      expect(rootNodes[0].nodeType).toBe(Node.COMMENT_NODE);
      expect(rootNodes[1].nodeType).toBe(Node.TEXT_NODE);
      expect(rootNodes[2].nodeType).toBe(Node.TEXT_NODE);
    });

    it('should descend into element containers', () => {
      const rootNodes = getRootNodes(`
          <ng-template #templateRef>
            <ng-container>text</ng-container>
          </ng-template>
        `);

      expect(rootNodes.length).toBe(2);
      expect(rootNodes[0].nodeType).toBe(Node.COMMENT_NODE);
      expect(rootNodes[1].nodeType).toBe(Node.TEXT_NODE);
    });

    it('should descend into ICU containers', () => {
      const rootNodes = getRootNodes(`
          <ng-template #templateRef>
            <ng-container i18n>Updated {minutes, select, =0 {just now} other {some time ago}}</ng-container>
          </ng-template>
        `);

      expect(rootNodes.length).toBe(4);
      expect(rootNodes[0].nodeType).toBe(Node.COMMENT_NODE);  // ng-container
      expect(rootNodes[1].nodeType).toBe(Node.TEXT_NODE);     // "Updated " text
      expect(rootNodes[2].nodeType).toBe(Node.COMMENT_NODE);  // ICU container
      expect(rootNodes[3].nodeType).toBe(Node.TEXT_NODE);     // "one minute ago" text
    });

    it('should return an empty array for an embedded view with projection and no projectable nodes',
       () => {
         const rootNodes =
             getRootNodes(`<ng-template #templateRef><ng-content></ng-content></ng-template>`);
         expect(rootNodes.length).toBe(0);
       });

    it('should return an empty array for an embedded view with multiple projections and no projectable nodes',
       () => {
         const rootNodes = getRootNodes(
             `<ng-template #templateRef><ng-content></ng-content><ng-content select="foo"></ng-content></ng-template>`);
         expect(rootNodes.length).toBe(0);
       });

    describe('projectable nodes provided to a dynamically created component', () => {
      @Component({selector: 'dynamic', template: ''})
      class DynamicCmp {
        @ViewChild('templateRef', {static: true}) templateRef!: TemplateRef<any>;
      }

      @Component({selector: 'test', template: ''})
      class TestCmp {
        constructor(public cfr: ComponentFactoryResolver) {}
      }

      beforeEach(() => {
        TestBed.configureTestingModule({declarations: [TestCmp, DynamicCmp]});
      });

      it('should return projectable nodes when provided', () => {
        TestBed.overrideTemplate(
            DynamicCmp, `<ng-template #templateRef><ng-content></ng-content></ng-template>`);

        const fixture = TestBed.createComponent(TestCmp);
        const dynamicCmptFactory =
            fixture.componentInstance.cfr.resolveComponentFactory(DynamicCmp);

        // Number of projectable nodes matches the number of slots - all nodes should be returned
        const projectableNodes = [[document.createTextNode('textNode')]];
        const cmptRef = dynamicCmptFactory.create(Injector.NULL, projectableNodes);
        const viewRef = cmptRef.instance.templateRef.createEmbeddedView({});
        expect(viewRef.rootNodes.length).toBe(1);
      });

      it('should return an empty collection when no projectable nodes were provided', () => {
        TestBed.overrideTemplate(
            DynamicCmp, `<ng-template #templateRef><ng-content></ng-content></ng-template>`);

        const fixture = TestBed.createComponent(TestCmp);
        const dynamicCmptFactory =
            fixture.componentInstance.cfr.resolveComponentFactory(DynamicCmp);

        // There are slots but projectable nodes were not provided - nothing should be returned
        const cmptRef = dynamicCmptFactory.create(Injector.NULL, []);
        const viewRef = cmptRef.instance.templateRef.createEmbeddedView({});
        expect(viewRef.rootNodes.length).toBe(0);
      });

      it('should return an empty collection when projectable nodes were provided but there are no slots',
         () => {
           TestBed.overrideTemplate(DynamicCmp, `<ng-template #templateRef></ng-template>`);

           const fixture = TestBed.createComponent(TestCmp);
           const dynamicCmptFactory =
               fixture.componentInstance.cfr.resolveComponentFactory(DynamicCmp);

           // There are no slots but projectable were provided - nothing should be returned
           const projectableNodes = [[document.createTextNode('textNode')]];
           const cmptRef = dynamicCmptFactory.create(Injector.NULL, projectableNodes);
           const viewRef = cmptRef.instance.templateRef.createEmbeddedView({});
           expect(viewRef.rootNodes.length).toBe(0);
         });
    });
  });

  describe('context', () => {
    @Component({
      template: `
      <ng-template #templateRef let-name="name">{{name}}</ng-template>
      <ng-container #containerRef></ng-container>
    `
    })
    class App {
      @ViewChild('templateRef') templateRef!: TemplateRef<any>;
      @ViewChild('containerRef', {read: ViewContainerRef}) containerRef!: ViewContainerRef;
    }

    it('should update if the context of a view ref is mutated', () => {
      TestBed.configureTestingModule({declarations: [App]});
      const fixture = TestBed.createComponent(App);
      fixture.detectChanges();
      const context = {name: 'Frodo'};
      const viewRef = fixture.componentInstance.templateRef.createEmbeddedView(context);
      fixture.componentInstance.containerRef.insert(viewRef);
      fixture.detectChanges();

      expect(fixture.nativeElement.textContent).toBe('Frodo');

      context.name = 'Bilbo';
      fixture.detectChanges();

      expect(fixture.nativeElement.textContent).toBe('Bilbo');
    });

    it('should update if the context of a view ref is replaced', () => {
      TestBed.configureTestingModule({declarations: [App]});
      const fixture = TestBed.createComponent(App);
      fixture.detectChanges();
      const viewRef = fixture.componentInstance.templateRef.createEmbeddedView({name: 'Frodo'});
      fixture.componentInstance.containerRef.insert(viewRef);
      fixture.detectChanges();

      expect(fixture.nativeElement.textContent).toBe('Frodo');

      viewRef.context = {name: 'Bilbo'};
      fixture.detectChanges();

      expect(fixture.nativeElement.textContent).toBe('Bilbo');
    });

    it('should use the latest context information inside template listeners', () => {
      const events: string[] = [];

      @Component({
        template: `
          <ng-template #templateRef let-name="name">
            <button (click)="log(name)"></button>
          </ng-template>
          <ng-container #containerRef></ng-container>
        `
      })
      class ListenerTest {
        @ViewChild('templateRef') templateRef!: TemplateRef<any>;
        @ViewChild('containerRef', {read: ViewContainerRef}) containerRef!: ViewContainerRef;

        log(name: string) {
          events.push(name);
        }
      }

      TestBed.configureTestingModule({declarations: [ListenerTest]});
      const fixture = TestBed.createComponent(ListenerTest);
      fixture.detectChanges();
      const viewRef = fixture.componentInstance.templateRef.createEmbeddedView({name: 'Frodo'});
      fixture.componentInstance.containerRef.insert(viewRef);
      fixture.detectChanges();

      const button = fixture.nativeElement.querySelector('button');
      button.click();
      expect(events).toEqual(['Frodo']);

      viewRef.context = {name: 'Bilbo'};
      fixture.detectChanges();
      button.click();
      expect(events).toEqual(['Frodo', 'Bilbo']);
    });
  });
});


text:
package br.codigo;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Leitor {
	private File arquivo;
	private BufferedReader reader;

	public Leitor(String nomeArquivo) throws FileNotFoundException {
		arquivo = new File(nomeArquivo);
		if(arquivo.exists())
			reader = new BufferedReader(new FileReader(arquivo));
		else
			throw new FileNotFoundException();
	}

	public String leProximaLinha() throws IOException {
		return reader.readLine();
	}

	public void fechaArquivo() throws IOException {
		reader.close();
	}
}


text:
using System.IO;
using System.Threading.Tasks;

namespace Restup.Webserver.File
{
    public interface IFile
    {
        string ContentType { get; }
        string Extension { get; }
        Task<Stream> OpenStreamForReadAsync();
    }
}


text:
layout: page
title: About
permalink: /about/
feature-img: "assets/img/pexels/circuit.jpeg"
tags: [About, Archive]
---

Type on Strap is based on Type Theme, a free and open-source theme for [Jekyll](http://jekyllrb.com/), licensed under the MIT License.

Head over to the [theme's documentation](https://github.io/sylhare/Type-on-Strap) for much more information about Type on Strap or to install this theme on your own Jekyll site.

This file is an example of a page in Jekyll, that automatically shows up in the header navigation, you can delete or modify this file freely.


text:
const ENV = require('dotenv').config();
if (ENV.error) {
    throw 'Cannot load the environment file at: /.env. You can create one by using the included .env.dist file.';
}

// Check if our source path is defined
if (!process.env.TOTEM_SRC) {
    throw 'The src path from our .env file is not defined, please check again.';
}

// Check if our source path is defined
if (!process.env.TOTEM_DEST) {
    throw 'The desination path from our .env file is not defined, please check again.';
}

// Load Gulp
const GULP = require('gulp');

// Load all Gulp plugins dynamicly
const PLUGINS = require('gulp-load-plugins')();

// Define the required node modules we use for our Gulp workflow
const NODE_MODULES = {
    babelify: require('babelify'),
    browserify: require('browserify'),
    buffer: require('vinyl-buffer'),
    camelCase: require('camelcase'),
    del: require('del'),
    fse: require('fs-extra'),
    merge: require('merge-stream'),
    path: require('path'),
    runSequence: require('run-sequence').use(GULP)
}

// Revision timestamp of the current date in seconds
const REVISION = new Date().getTime();

// Helper function for defining tasks
function getGulpTask(file)
{
    return require('./gulp_tasks/' + file)(GULP, PLUGINS, NODE_MODULES, REVISION);
}

// Prepare tasks
GULP.task('clean', getGulpTask('clean'));
GULP.task('sync', getGulpTask('sync'));

// Styling tasks
GULP.task('spritesmith', getGulpTask('spritesmith'));
GULP.task('sass', getGulpTask('sass'));
GULP.task('svgstore', getGulpTask('svgstore'));

// Scripting tasks
GULP.task('browserify', getGulpTask('browserify'));
GULP.task('concat', getGulpTask('concat'));

// Content tasks
GULP.task('twig', getGulpTask('twig'));

// Development tasks
GULP.task('connect', getGulpTask('connect'));
GULP.task('watch', getGulpTask('watch'));

// Production tasks
GULP.task('minify', getGulpTask('minify'));

GULP.task('stylesheets', function(callback) {
    NODE_MODULES.runSequence(
        'spritesmith',
        [
            'sass',
            'svgstore'
        ],
        callback
    );
});

GULP.task('javascripts', function(callback) {
    NODE_MODULES.runSequence(
        'browserify',
        'concat',
        callback
    );
});

GULP.task('default', function (callback) {
    NODE_MODULES.runSequence(
        'clean',
        'sync',
        [
            'stylesheets',
            'javascripts',
        ],
        [
            'twig'
        ],
        callback
    );
});

GULP.task('build', function (callback) {
    NODE_MODULES.runSequence(
        'default',
        [
            'minify'
        ],
        callback
    );
});

GULP.task('serve', function (callback) {
    NODE_MODULES.runSequence(
        'default',
        [
            'connect',
            'watch'
        ],
        callback
    );
});


text:
#ifndef ASLAM_DURATION_H
#define ASLAM_DURATION_H

/*********************************************************************
 ** Pragmas
 *********************************************************************/

#ifdef _MSC_VER
// Aslamtime has some magic interface that doesn't directly include
// its implementation, this just disbales those warnings.
#pragma warning(disable: 4244)
#pragma warning(disable: 4661)
#endif

#include <iostream>
#include <math.h>
#include <stdexcept>
#include <climits>
#include <stdint.h>
#include <boost/serialization/nvp.hpp>
//#include "rostime_decl.h"

namespace boost {
namespace posix_time {
class time_duration;
}
}

namespace aslam {
void normalizeSecNSecSigned(int64_t& sec, int64_t& nsec);
void normalizeSecNSecSigned(int32_t& sec, int32_t& nsec);

/**
 * \brief Base class for Duration implementations.  Provides storage, common functions and operator overloads.
 * This should not need to be used directly.
 */
template<class T>
class DurationBase {
 public:
  int32_t sec, nsec;
  DurationBase()
      : sec(0),
        nsec(0) {
  }
  DurationBase(int32_t _sec, int32_t _nsec);
  explicit DurationBase(double t) {
    fromSec(t);
  }
  ;
  ~DurationBase() {
  }
  T operator+(const T &rhs) const;
  T operator-(const T &rhs) const;
  T operator-() const;
  T operator*(double scale) const;
  T& operator+=(const T &rhs);
  T& operator-=(const T &rhs);
  T& operator*=(double scale);
  bool operator==(const T &rhs) const;
  inline bool operator!=(const T &rhs) const {
    return !(*static_cast<const T*>(this) == rhs);
  }
  bool operator>(const T &rhs) const;
  bool operator<(const T &rhs) const;
  bool operator>=(const T &rhs) const;
  bool operator<=(const T &rhs) const;
  double toSec() const {
    return (double) sec + 1e-9 * (double) nsec;
  }
  ;
  int64_t toNSec() const {
    return (int64_t) sec * 1000000000ll + (int64_t) nsec;
  }
  ;
  T& fromSec(double t);
  T& fromNSec(int64_t t);
  bool isZero();
  boost::posix_time::time_duration toBoost() const;
};

class Rate;

/**
 * \brief Duration representation for use with the Time class.
 *
 * aslam::DurationBase provides most of its functionality.
 */
class Duration : public DurationBase<Duration> {
 public:
  Duration()
      : DurationBase<Duration>() {
  }

  Duration(int32_t _sec, int32_t _nsec)
      : DurationBase<Duration>(_sec, _nsec) {
  }

  explicit Duration(double t) {
    fromSec(t);
  }
  explicit Duration(const Rate&);
  /**
   * \brief sleep for the amount of time specified by this Duration.  If a signal interrupts the sleep, resleeps for the time remaining.
   */
  bool sleep() const;
};

extern const Duration DURATION_MAX;
extern const Duration DURATION_MIN;

/**
 * \brief Duration representation for use with the WallTime class.
 *
 * aslam::DurationBase provides most of its functionality.
 */
class WallDuration : public DurationBase<WallDuration> {
 public:
  WallDuration()
      : DurationBase<WallDuration>() {
  }

  WallDuration(int32_t _sec, int32_t _nsec)
      : DurationBase<WallDuration>(_sec, _nsec) {
  }

  explicit WallDuration(double t) {
    fromSec(t);
  }
  explicit WallDuration(const Rate&);
  /**
   * \brief sleep for the amount of time specified by this Duration.  If a signal interrupts the sleep, resleeps for the time remaining.
   */
  bool sleep() const;
};

std::ostream &operator <<(std::ostream &os, const Duration &rhs);
std::ostream &operator <<(std::ostream &os, const WallDuration &rhs);

}

namespace boost {
namespace serialization {

template<class Archive>
void serialize(Archive & ar, aslam::Duration & d, const unsigned int /* version */) {
  ar & BOOST_SERIALIZATION_NVP(d.sec);
  ar & BOOST_SERIALIZATION_NVP(d.nsec);
}

}  // namespace serialization
}  // namespace boost

#endif // ASLAM_DURATION_H


text:
@interface KPBNSManagedObjectModelBuilder ()

@property (nonatomic, copy) NSArray *aspectBuilders;

@end

@implementation KPBNSManagedObjectModelBuilder

- (NSManagedObjectModel *)buildModel
{
    NSManagedObjectModel *managedObjectModel = [NSManagedObjectModel new];

    for (KPBNSManagedObjectModelAspectBuilder *aspectBuilder in _aspectBuilders) {

        [aspectBuilder buildAspectForModel:managedObjectModel];

    }

    return managedObjectModel;
}

@end

NSManagedObjectModel *buildCoreDataModel(KPBNSManagedObjectModelAspectBuilder *builders, ...)
{
    KPBNSManagedObjectModelBuilder *builder = [KPBNSManagedObjectModelBuilder new];

    va_list arguments;
    va_start(arguments, builders);

    KPBNSManagedObjectModelAspectBuilder *aspectBuilder = builders;

    NSMutableArray *aspectBuilders = [NSMutableArray array];

    while (aspectBuilder) {
        aspectBuilder.managedObjectModelBuilder = builder;
        [aspectBuilders addObject:aspectBuilder];

        aspectBuilder = va_arg(arguments, KPBNSManagedObjectModelAspectBuilder *);
    }

    va_end(arguments);

    builder.aspectBuilders = aspectBuilders;

    return [builder buildModel];
}

KPBNSManagedObjectModelEntitiesBuilder *withEntities(KPBEntityBuilder *entities, ...)
{
    KPBNSManagedObjectModelEntitiesBuilder *builder = [KPBNSManagedObjectModelEntitiesBuilder new];

    va_list arguments;
    va_start(arguments, entities);

    KPBEntityBuilder *entityBuilder = entities;

    NSMutableArray *entityBuilders = [NSMutableArray array];

    while (entityBuilder) {
        [entityBuilders addObject:entityBuilder];
        entityBuilder = va_arg(arguments, KPBEntityBuilder *);
    }

    va_end(arguments);

    builder.entityBuilders = entityBuilders;

    return builder;
}

KPBNSManagedObjectModelRelationShipsBuilder *withRelationShips(KPBRelationShipBuilder *relationShips, ...)
{
    KPBNSManagedObjectModelRelationShipsBuilder *builder = [KPBNSManagedObjectModelRelationShipsBuilder new];

    va_list arguments;
    va_start(arguments, relationShips);

    KPBRelationShipBuilder *relationShipBuilder = relationShips;

    NSMutableArray *relationShipBuilders = [NSMutableArray array];

    while (relationShipBuilder) {
        [relationShipBuilders addObject:relationShipBuilder];
        relationShipBuilder = va_arg(arguments, KPBRelationShipBuilder *);
    }

    va_end(arguments);

    builder.relationShipBuilders = relationShipBuilders;

    return builder;
}


text:
<TITLE>Review for Donnie Brasco (1997)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Donnie Brasco (1997)

reviewed by
Andrew Hicks

                              DONNIE BRASCO
                       A film review by Andrew Hicks
                Copyright 1997 Andrew Hicks / Fatboy Productions

*** (out of four)

     More than 20 years ago, Al Pacino gained his fame by starring in
the first two GODFATHER films. Now he's returned to those roots by
playing a thoroughly exhausted, much less successful Mafia man. Donnie
BRASCO, though, follows in the feet of Pacino's 1996 role in CITY HALL by
giving the lead to a younger, less experienced man in the field. In CITY
HALL it was John Cusack; here, it's Johnny Depp, who works his way
into Pacino's existence by telling Pacino the $8,000 diamond ring he just
bought is a fake.

     Depp slowly earns Pacino's confidence as we learn he's really an
undercover FBI agent out to break up the Mafia ring. It would seem
contrived if they didn't tell us at the beginning that it's based on a
true story. From here, the movie can only go in three directions -- either
Depp sticks to his mission and all works out, the mobsters find out he's
an FBI agent and some other agent has to come in and rescue him, or
Depp gets Patti Hearst syndrome and begins to fraternize with the enemy
for real.

     We get a mixture of options one and three. Depp starts to use the
f-word more than usual and say "Forget about it!" in different tones to
mean different things. One subplot focuses on this transformation as it
relates to Depp and his family. His wife is sick of never seeing him or
knowing what assignment he's working on and has several non-productive
fights with him. This plotline falls by the wayside toward the last reel,
though.

     The main appeal of the film are the Mafia men themselves. Pacino
is great as a tired, washed-up gangster who's been in the business 30
years and still hasn't gotten anywhere. Bruno Kirby and Michael
Madsen, as the leader, aren't given much to do here, but exemplify the
fact that this crime ring is pretty small time. These underachievers are
so unlucky at their game that, when they finally get a successful gambling
party going, I was actually upset that the cops broke it up.

     Because the criminals evoke this strange kind of sympathy, there
are no real antagonists in DONNIE BRASCO, only conflicts. Depp grows
attached to Pacino and realizes that if the other guys find out he's an
FBI man, Pacino will get whacked before he can say "Forget about it!" At
the same time, Depp is torn between his job and his wife and, on the same
token, his job and his attachment to the Mafia game. None of these are
resolved in a cinematic way, probably because nothing ever is in real
life. We never have soundtracks in our heads either.

--

Visit the Movie Critic at LARGE website at
http://www.missouri.edu/~c667778/movies.html
Over 750 detailed reviews with a comedic flair.

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
package net.vicp.milim.ScheduledTask.zaixianwanjia.service;

import net.vicp.milim.ScheduledTask.zaixianwanjia.bean.domain.OrderPay;
import net.vicp.milim.ScheduledTask.zaixianwanjia.bean.param.OrderPayParam;
import net.vicp.milim.ScheduledTask.zaixianwanjia.common.FdServiceException;
import net.vicp.milim.ScheduledTask.zaixianwanjia.common.IPage;

/**
 * 类说明:交易订单支付表管理接口
 * @author 聂枫
 * @date 2016年12月24日 17时04分55秒
 */
public interface IOrderPayService {

    /**
     * 方法说明:添加交易订单支付表
     * @author 聂枫
     * @date 2016年12月24日 17时04分55秒
     * @param OrderPay orderPay
     * @return
     * @throws 异常
     */
    public Integer addOrderPay(OrderPay orderPay) throws FdServiceException;

    /**
     * 删除交易订单支付表
     * @author 聂枫
     * @date 2016年12月24日 17时04分55秒
     * @param String orderPayNo
     * @return
     * @throws 异常
     */
    public Integer delOrderPay(String orderPayNo) throws FdServiceException;

    /**
     * 修改交易订单支付表
     * @author 聂枫
     * @date 2016年12月24日 17时04分55秒
     * @param OrderPay orderPay
     * @return
     * @throws 异常
     */
    public Integer updateOrderPay(OrderPay orderPay) throws FdServiceException;

    /**
     * 通过编号查询交易订单支付表
     * @author 聂枫
     * @date 2016年12月24日 17时04分55秒
     * @param String orderPayNo
     * @return Long
     * @throws 异常
     */
    public OrderPay queryOrderPayByOrderPayNo(String orderPayNo) throws FdServiceException;

    /**
     * 统计查询交易订单支付表
     * @author 聂枫
     * @date 2016年12月24日 17时04分55秒
     * @param OrderPayParam orderPayParam
     * @return Long
     * @throws 异常
     */
    public Long queryOrderPayCountByCondition(OrderPayParam orderPayParam) throws FdServiceException;

    /**
     * 分页查询交易订单支付表
     * @author 聂枫
     * @date 2016年12月24日 17时04分55秒
     * @param OrderPayParam orderPayParam
     * @return List<OrderPay>
     * @throws 异常
     */
    public IPage<OrderPay> queryOrderPayByCondition(OrderPayParam orderPayParam) throws FdServiceException;

}


text:
package org.syntax.jedit.tokenmarker;

/**
 * XML token marker.
 *
 * @author Slava Pestov
 * @version $Id: XMLTokenMarker.java,v 1.2 1999/12/13 03:40:30 sp Exp $
 */
public class XMLTokenMarker extends HTMLTokenMarker
{
	public XMLTokenMarker()
	{
		super(false);
	}
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>org.springframework.android</groupId>
	<artifactId>spring-android-test</artifactId>
	<version>0.0.1</version>
	<packaging>pom</packaging>
	<name>spring-android-test</name>
	<description>Spring for Android Tests</description>
	<url>https://github.com/spring-project/spring-android</url>
	<inceptionYear>2010</inceptionYear>

	<organization>
		<name>Pivotal Software, Inc.</name>
		<url>http://www.spring.io</url>
	</organization>

	<modules>
		<module>/spring-android-core-test</module>
		<module>/spring-android-rest-template-test</module>
		<module>/spring-android-auth-test</module>
	</modules>

	<properties>
		<!-- use UTF-8 for everything -->
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<android-platform>19</android-platform>
		<android-maven-plugin-version>3.9.0-rc.2</android-maven-plugin-version>
		<maven-compiler-plugin-version>3.1</maven-compiler-plugin-version>
		<java-version>1.6</java-version>
		<android-version>4.4.2_r3</android-version>
		<org.springframework.android-version>2.0.0.BUILD-SNAPSHOT</org.springframework.android-version>
		<org.easymock-version>3.2</org.easymock-version>
		<org.hamcrest-version>1.3</org.hamcrest-version>
		<org.mockito-version>1.9.5</org.mockito-version>
		<com.google.dexmaker-version>1.1</com.google.dexmaker-version>
		<maven-surefire-plugin-version>2.17</maven-surefire-plugin-version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>android</groupId>
			<artifactId>android</artifactId>
			<version>${android-version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.easymock</groupId>
			<artifactId>easymock</artifactId>
			<version>${org.easymock-version}</version>
			<exclusions>
				<exclusion>
					<artifactId>cglib-nodep</artifactId>
					<groupId>cglib</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest-core</artifactId>
			<version>${org.hamcrest-version}</version>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<version>${org.mockito-version}</version>
		</dependency>
		<dependency>
			<groupId>com.google.dexmaker</groupId>
			<artifactId>dexmaker-mockito</artifactId>
			<version>${com.google.dexmaker-version}</version>
		</dependency>
		<dependency>
			<groupId>com.google.dexmaker</groupId>
			<artifactId>dexmaker</artifactId>
			<version>${com.google.dexmaker-version}</version>
		</dependency>
	</dependencies>

	<repositories>
		<repository>
			<id>spring-snapshot</id>
			<name>Spring Snapshot Repository</name>
			<url>http://repo.spring.io/libs-snapshot</url>
		</repository>
	</repositories>

	<build>
		<finalName>${project.artifactId}</finalName>
		<plugins>
			<plugin>
				<groupId>com.jayway.maven.plugins.android.generation2</groupId>
				<artifactId>android-maven-plugin</artifactId>
				<version>${android-maven-plugin-version}</version>
				<configuration>
					<sdk>
						<platform>${android-platform}</platform>
					</sdk>
					<deleteConflictingFiles>true</deleteConflictingFiles>
					<undeployBeforeDeploy>true</undeployBeforeDeploy>
					<deviceThreads>4</deviceThreads>
				</configuration>
				<extensions>true</extensions>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${maven-compiler-plugin-version}</version>
				<configuration>
					<source>${java-version}</source>
					<target>${java-version}</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>${maven-surefire-plugin-version}</version>
				<configuration>
					<testFailureIgnore>true</testFailureIgnore>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-report-plugin</artifactId>
				<version>${maven-surefire-plugin-version}</version>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jxr-plugin</artifactId>
				<version>2.4</version>
			</plugin>
		</plugins>
	</reporting>

</project>


text:
<?php
/**
 * User: Danilo G. Zutin
 * Date: 04.08.15
 * Time: 20:26
 */

namespace DispatcherBundle\Security;
use Doctrine\ORM\EntityManager;

class IsaRlmsAuthenticator
{

    public function __construct(EntityManager $em)
    {
        $this->em = $em;
    }

    //Authenticate credentials of type AuthHeader
    public function authenticateBatchedMethod($sbGuid, $lsPaskey, $labserverId)
    {
        $labServer = $this
            ->em
            ->getRepository('DispatcherBundle:LabServer')
            ->findOneBy(array('passKey' => $lsPaskey, 'id' => $labserverId));

        if ($labServer != null){ //if LabServer exists and passkey is correct, authenticate broker
            $broker = $this
                ->em
                ->getRepository('DispatcherBundle:Rlms')
                ->findOneBy(array('Guid' => $sbGuid, 'owner_id' => $labServer->getOwnerId()));

            if ($broker != null){
                $mapping = $this
                    ->em
                    ->getRepository('DispatcherBundle:LsToRlmsMapping')
                    ->findOneBy(array('labServerId' => $labServer->getId(), 'rlmsId' => $broker->getId()));

                if ($mapping != null){
                    return array('authenticated' => true, 'fault' => '');
                }
                return array('authenticated' => false, 'fault' => 'Broker and Lab Server  were found, but they are not mapped to each other. Contact your Experiment Dispatcher administrator');
            }
            return array('authenticated' => false, 'fault' => 'Service Broker GUID is not registered');
        }
        return array('authenticated' => false, 'fault' => 'Provided Lab Server passkey is incorrect');
    }

    //Authenticate credentials of type InitAuthHeader
    public function authenticateInstallDomainCredentialsMethod($initPasskey, $labserverId)
    {
        $labServer = $this
            ->em
            ->getRepository('DispatcherBundle:LabServer')
            ->findOneBy(array('initialPassKey' => $initPasskey, 'id' => $labserverId, 'type' => 'ILS'));

        if ($labServer != null)
        {
            $mapping = $this
                ->em
                ->getRepository('DispatcherBundle:LsToRlmsMapping')
                ->findOneBy(array('labServerId' => $labServer->getId()));

            if ($mapping == null)
            {
                return array('authenticated' => true, 'fault' => '');
            }
            return array('authenticated' => false, 'fault' => 'Lab Server already associated with a domain Service Broker');
        }
        return array('authenticated' => false, 'fault' => 'Provided initial passkey is incorrect');

    }

    //AgentAuthHeader - Authenticate all other methods for interactive services
    public function authenticateAgent($sbGuid, $labserverId)
    {
        $labServer = $this
            ->em
            ->getRepository('DispatcherBundle:LabServer')
            ->findOneBy(array('id' => $labserverId));

        if ($labServer != null){ //if Lab Server exists, authenticate Broker

            $broker = $this
                ->em
                ->getRepository('DispatcherBundle:Rlms')
                ->findOneBy(array('Guid' => $sbGuid, 'owner_id' => $labServer->getOwnerId()));

            if ($broker != null){
                $mapping = $this
                    ->em
                    ->getRepository('DispatcherBundle:LsToRlmsMapping')
                    ->findOneBy(array('labServerId' => $labServer->getId(), 'rlmsId' => $broker->getId()));

                if ($mapping != null){
                    return array('authenticated' => true, 'fault' => '');
                }
                return array('authenticated' => false, 'fault' => 'Broker and Lab Server  were found, but they are not mapped to each other. Contact your Experiment Dispatcher administrator');
            }
            return array('authenticated' => false, 'fault' => 'Provided Service Broker GUID is not registered');
        }
        return array('authenticated' => false, 'fault' => 'Lab server was not found. Contact your Experiment Dispatcher administrator');
    }

    public function authenticateMethodUqBroker($jsonRequest, $token, $sbGuid, $labserverId)
    {
        //remove token to apply hmac algorithm
        $jsonRequest->token = '';
        $data = json_encode($jsonRequest);

        $labServer = $this
            ->em
            ->getRepository('DispatcherBundle:LabServer')
            ->findOneBy(array('id' => $labserverId));

        if ($labServer != null){ //if Lab Server exists, authenticate Broker
            $broker = $this
                ->em
                ->getRepository('DispatcherBundle:Rlms')
                ->findOneBy(array('Guid' => $sbGuid, 'owner_id' => $labServer->getOwnerId()));

            if ($broker != null){
                if ($token == base64_encode(hash_hmac('sha1', $sbGuid.$data,$labServer->getPassKey(),true))){
                    $mapping = $this
                        ->em
                        ->getRepository('DispatcherBundle:LsToRlmsMapping')
                        ->findOneBy(array('labServerId' => $labServer->getId(), 'rlmsId' => $broker->getId()));

                    if ($mapping != null){
                        return array('authenticated' => true,
                                     'fault' => '');
                    }
                    return array('authenticated' => false,
                                 'fault' => 'Token is correct, but Broker and Lab Server are not mapped to each other. Contact your Experiment Dispatcher administrator');
                }
                return array('authenticated' => false,
                             'fault' => 'Unauthorized, token ('.$token.') is not valid.');
            }
            return array('authenticated' => false,
                         'fault' => 'Provided Service Broker GUID is not registered');
        }
        return array('authenticated' => false,
                     'fault' => 'Provided Lab Server Id does not exit');
    }

    public function calculateToken($jsonRequest, $token, $sbGuid, $labserverId)
    {
        //remove token to apply hmac algorithm
        $jsonRequest->token = '';
        $data = json_encode($jsonRequest);

        $labServer = $this
            ->em
            ->getRepository('DispatcherBundle:LabServer')
            ->findOneBy(array('id' => $labserverId));

        if ($labServer != null){ //if Lab Server exists, calculate token

                $token = base64_encode(hash_hmac('sha1', $sbGuid.$data,$labServer->getPassKey(),true));

                    return $token;
             }
        return 'Provided Lab Server Id does not exit. Cannot calculate token';

    }
}


text:
#include <stdlib.h>

#include "c_list.h"

/**
 * A list is an ordered set of entries.  We have the following primitives:
 * * list_create() - Create an empty list.  The return is the list pointer.
 * * list_delete() - Delete the list and optionally free all its entries.
 * * list_first() - Return the first item in the list.
 * * list_insert() - Add an item to the end of the list.
 * * list_insert_after() - Add an item to the list after a given entry.
 * * list_insert_before() - Add an item to the list before a given entry.
 * * list_next() - Get the next item in the list.
 * * list_remove() - Remove a specific item from the list.
 * * list_removeByValue() - Find the first element in the list with a matching value and remove it.
 */

/**
 * Create a new list.
 */
list_t *list_createList() {
	list_t *pList = malloc(sizeof(list_t));
	pList->next = NULL;
	pList->prev = NULL;
	pList->value = NULL;
	return pList;
} // list_createList

/**
 * Delete a list.
 */
void list_deleteList(list_t *pList, int withFree) {
	list_t *pNext;
	while(pList != NULL) {
		pNext = pList->next;
		if (withFree) {
			free(pList->value);
		}
		free(pList);
		pList = pNext;
	}
} // list_deleteList

/**
 * Insert a new item at the end of the list.
 *[A] -> [endOLD]    ------>   [A] -> [endOLD] -> [X]
 *
 */
void list_insert(list_t *pList, void *value) {
	while(pList->next != NULL) {
		pList = pList->next;
	}
	list_insert_after(pList, value);
} // list_insert

/**
 * [pEntry] -> [B]    ------>   [pEntry] -> [X] -> [B]
 *
 */
void list_insert_after(list_t *pEntry, void *value) {
	list_t *pNew = malloc(sizeof(list_t));
	pNew->next = pEntry->next;
	pNew->prev = pEntry;
	pNew->value = value;

	// Order IS important here.
	if (pEntry->next != NULL) {
		pEntry->next->prev = pNew;
	}
	pEntry->next = pNew;
} // list_insert_after

/**
 * [A] -> [pEntry]   ------>   [A] -> [X] -> [pEntry]
 *
 */
void list_insert_before(list_t *pEntry, void *value) {
	// Can't insert before the list itself.
	if (pEntry->prev == NULL) {
		return;
	}
	list_t *pNew = malloc(sizeof(list_t));
	pNew->next = pEntry;
	pNew->prev = pEntry->prev;
	pNew->value = value;

	// Order IS important here.
	pEntry->prev->next = pNew;
	pEntry->prev = pNew;
} // list_insert_before

/**
 * Remove an item from the list.
 */
void list_remove(list_t *pList, list_t *pEntry, int withFree) {
	while(pList != NULL && pList->next != pEntry) {
		pList = pList->next;
	}
	if (pList == NULL) {
		return;
	}
	pList->next = pEntry->next;
	if (pEntry->next != NULL) {
		pEntry->next->prev = pList;
	}
	if (withFree) {
		free(pEntry->value);
	}
	free(pEntry);
} // list_delete

/**
 * Delete a list entry by value.
 */
void list_removeByValue(list_t *pList, void *value, int withFree) {
	list_t *pNext = pList->next;
	while(pNext != NULL) {
		if (pNext->value == value) {
			list_delete(pList, pNext, withFree);
			return;
		}
	} // End while
} // list_deleteByValue

/**
 * Get the next item in a list.
 */
list_t *list_next(list_t *pList) {
	if (pList == NULL) {
		return NULL;
	}
	return (pList->next);
} // list_next

list_t *list_first(list_t *pList) {
	return pList->next;
} // list_first

void *list_get_value(list_t *pList) {
	return pList->value;
}


text:
import * as marked from 'marked';

export class Marked {
  marked = marked;
  constructor() {
    this.marked.setOptions({
      gfm: true,
      breaks: true
    });
  }

  transform(str: string) {
    return this.marked(str);
  }
}


text:
package com.wingjay.jianshi.util;

import android.support.annotation.NonNull;

import java.util.Random;

/**
 * Created by Jay on 11/9/16.
 */

public class RequestUtils {

  private static String getRandomHexString(int length) {
    Random r = new Random();
    StringBuilder sb = new StringBuilder();
    while (sb.length() < length) {
      sb.append(Integer.toHexString(r.nextInt()));
    }

    return sb.toString().substring(0, length);
  }

  @NonNull
  public static String generateRequestId() {
    return String.format(
        "%s-%s", getRandomHexString(16), Long.toString(System.currentTimeMillis()));
  }

}


text:
from Tagger import Tagger

data = open("gene.counts")
training = open("gene.train")
taggerData = Tagger(data)

for line in training:
    if line == "\n":
        print
    else:
        word = line.split(" ")[0]
        tag = line.split(" ")[1]
        word = taggerData.hmm.replace_word(word)
        print word+" "+tag.strip()


text:
namespace Swan.Threading;

/// <summary>
/// A threading <see cref="_backingTimer"/> implementation that executes at most one cycle at a time
/// in a <see cref="ThreadPool"/> thread. Callback execution is NOT guaranteed to be carried out
/// on the same <see cref="ThreadPool"/> thread every time the timer fires.
/// </summary>
public sealed class ExclusiveTimer : IDisposable
{
    private readonly object _syncLock = new();
    private readonly ManualResetEventSlim _cycleDoneEvent = new(true);
    private readonly Timer _backingTimer;
    private readonly TimerCallback _userCallback;
    private readonly AtomicBoolean _isDisposing = new();
    private readonly AtomicBoolean _isDisposed = new();
    private int _period;

    /// <summary>
    /// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
    /// </summary>
    /// <param name="timerCallback">The timer callback.</param>
    /// <param name="state">The state.</param>
    /// <param name="dueTime">The due time.</param>
    /// <param name="period">The period.</param>
    public ExclusiveTimer(TimerCallback timerCallback, object? state, int dueTime, int period)
    {
        _period = period;
        _userCallback = timerCallback;
        _backingTimer = new(InternalCallback, state ?? this, dueTime, Timeout.Infinite);
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
    /// </summary>
    /// <param name="timerCallback">The timer callback.</param>
    /// <param name="state">The state.</param>
    /// <param name="dueTime">The due time.</param>
    /// <param name="period">The period.</param>
    public ExclusiveTimer(TimerCallback timerCallback, object? state, TimeSpan dueTime, TimeSpan period)
        : this(timerCallback, state, Convert.ToInt32(dueTime.TotalMilliseconds), Convert.ToInt32(period.TotalMilliseconds))
    {
        // placeholder
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
    /// </summary>
    /// <param name="timerCallback">The timer callback.</param>
    public ExclusiveTimer(TimerCallback timerCallback)
        : this(timerCallback, null, Timeout.Infinite, Timeout.Infinite)
    {
        // placeholder
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
    /// </summary>
    /// <param name="timerCallback">The timer callback.</param>
    /// <param name="dueTime">The due time.</param>
    /// <param name="period">The period.</param>
    public ExclusiveTimer(Action timerCallback, int dueTime, int period)
        : this(_ => { timerCallback.Invoke(); }, null, dueTime, period)
    {
        // placeholder
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
    /// </summary>
    /// <param name="timerCallback">The timer callback.</param>
    /// <param name="dueTime">The due time.</param>
    /// <param name="period">The period.</param>
    public ExclusiveTimer(Action timerCallback, TimeSpan dueTime, TimeSpan period)
        : this(_ => { timerCallback.Invoke(); }, null, dueTime, period)
    {
        // placeholder
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
    /// </summary>
    /// <param name="timerCallback">The timer callback.</param>
    public ExclusiveTimer(Action timerCallback)
        : this(timerCallback, Timeout.Infinite, Timeout.Infinite)
    {
        // placeholder
    }

    /// <summary>
    /// Gets a value indicating whether this instance is disposing.
    /// </summary>
    /// <value>
    ///   <c>true</c> if this instance is disposing; otherwise, <c>false</c>.
    /// </value>
    public bool IsDisposing => _isDisposing.Value;

    /// <summary>
    /// Gets a value indicating whether this instance is disposed.
    /// </summary>
    /// <value>
    ///   <c>true</c> if this instance is disposed; otherwise, <c>false</c>.
    /// </value>
    public bool IsDisposed => _isDisposed.Value;

    /// <summary>
    /// Waits until the time is elapsed.
    /// </summary>
    /// <param name="untilDate">The until date.</param>
    /// <param name="cancellationToken">The cancellation token.</param>
    public static void WaitUntil(DateTime untilDate, CancellationToken cancellationToken = default)
    {
        static void Callback(IWaitEvent waitEvent)
        {
            try
            {
                waitEvent.Complete();
                waitEvent.Begin();
            }
            catch
            {
                // ignore
            }
        }

        using var delayLock = WaitEventFactory.Create(true);
        using var timer = new ExclusiveTimer(() => Callback(delayLock), 0, 15);
        while (!cancellationToken.IsCancellationRequested && DateTime.UtcNow < untilDate)
            delayLock.Wait();
    }

    /// <summary>
    /// Waits the specified wait time.
    /// </summary>
    /// <param name="waitTime">The wait time.</param>
    /// <param name="cancellationToken">The cancellation token.</param>
    public static void Wait(TimeSpan waitTime, CancellationToken cancellationToken = default) =>
        WaitUntil(DateTime.UtcNow.Add(waitTime), cancellationToken);

    /// <summary>
    /// Changes the start time and the interval between method invocations for the internal timer.
    /// </summary>
    /// <param name="dueTime">The due time.</param>
    /// <param name="period">The period.</param>
    public void Change(int dueTime, int period)
    {
        _period = period;

        _backingTimer.Change(dueTime, Timeout.Infinite);
    }

    /// <summary>
    /// Changes the start time and the interval between method invocations for the internal timer.
    /// </summary>
    /// <param name="dueTime">The due time.</param>
    /// <param name="period">The period.</param>
    public void Change(TimeSpan dueTime, TimeSpan period)
        => Change(Convert.ToInt32(dueTime.TotalMilliseconds), Convert.ToInt32(period.TotalMilliseconds));

    /// <summary>
    /// Changes the interval between method invocations for the internal timer.
    /// </summary>
    /// <param name="period">The period.</param>
    public void Resume(int period) => Change(0, period);

    /// <summary>
    /// Changes the interval between method invocations for the internal timer.
    /// </summary>
    /// <param name="period">The period.</param>
    public void Resume(TimeSpan period) => Change(TimeSpan.Zero, period);

    /// <summary>
    /// Pauses this instance.
    /// </summary>
    public void Pause() => Change(Timeout.Infinite, Timeout.Infinite);

    /// <inheritdoc />
    public void Dispose()
    {
        lock (_syncLock)
        {
            if (_isDisposed == true || _isDisposing == true)
                return;

            _isDisposing.Value = true;
        }

        try
        {
            _cycleDoneEvent.Wait();
            _cycleDoneEvent.Dispose();
            Pause();
            _backingTimer.Dispose();
        }
        finally
        {
            _isDisposed.Value = true;
            _isDisposing.Value = false;
        }
    }

    /// <summary>
    /// Logic that runs every time the timer hits the due time.
    /// </summary>
    /// <param name="state">The state.</param>
    private void InternalCallback(object? state)
    {
        lock (_syncLock)
        {
            if (IsDisposed || IsDisposing)
                return;
        }

        if (!_cycleDoneEvent.IsSet)
            return;

        _cycleDoneEvent.Reset();

        try
        {
            _userCallback(state);
        }
        finally
        {
            _cycleDoneEvent?.Set();
            _backingTimer?.Change(_period, Timeout.Infinite);
        }
    }
}


text:
var Ractive = require('ractive/ractive.runtime');
var lunarCalendar = require('lunar-calendar');

var Clock = Ractive.extend({
  template: require('../templates/clock.html'),
  data: {
    date: new Date(),
    days: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
    months: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],

    // add suffix to numbers, e.g. 2 -> '2nd', 14 -> '14th'
    addSuffix: function ( num ) {
      // special case - any number ending with 10-19 is suffixed with 'th'
      if ( num % 100 >= 10 && num % 100 <= 19 ) {
        return num + 'th';
      }

      switch ( num % 10 ) {
        case 1: return num + 'st';
        case 2: return num + 'nd';
        case 3: return num + 'rd';
      }

      return num + 'th';
    },

    // ensure all numbers have two digits
    pad: function ( num ) {
      return ( num < 10 ? '0' + num : num );
    },

    // clock face markers - major (every 5 minutes) and minor (every minute)
    major: new Array( 12 ),
    minor: new Array( 60 ),
    lunar: {}
  },
  oninit: function() {
    var that = this;
    setInterval( function () {
      var date = new Date();
      var lunar = lunarCalendar.solarToLunar(
      date.getFullYear(), date.getMonth() + 1, date.getUTCDate());
      that.set( 'date', date );
      that.set( 'lunar',  lunar);
    }, 1000 );
  }
});

// ...then update it once a second

var Log = Ractive.extend({
  template: require('../templates/log.html'),
  data: {
    txts: []
  },
  oninit: function() {
    var that = this;
    var socket = io();
    socket.on('logs', function(log) {
      that.push('txts', log);
    });
  }
});

var Todoist = Ractive.extend({
  template: require('../templates/todoist.html')
});

var ractive = new Ractive({
  el: main,
  template: require('../templates/main.html'),
  components: {
    clock: Clock,
    log: Log,
    todoist: Todoist
  }
});


text:
    <div class="sidebar" data-color="green" data-image="<?= base_url() . 'assets/media/admin/sidebar.jpg'; ?>">

                <a href="<?= base_url() . 'admin'; ?>" class="simple-text">
                    <img width="25%" height="25%" src="<?= base_url() . 'assets/media/admin/logo.png'; ?>" />
Welcome, <?= $admin['AdminFullName']; ?>

                    <a href="<?php echo base_url(); ?>admin/profile">

School Profile

                    <a href="<?php echo base_url(); ?>admin/establishment">

School Establishments

                    <a href="<?php echo base_url(); ?>admin/announcements">

Announcements

                    <a href="<?php echo base_url(); ?>admin/settings">

Administrator Settings

                    <a href="<?php echo base_url(); ?>admin/webmaster">

Contact Webmaster

                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigation-example-2">
                        Toggle navigation

                    </button>
                    <?php echo $title; ?>

My Account

<a href="<?php echo base_url(); ?>admin/webmaster">Contact Webmaster

<a href="<?php echo base_url(); ?>admin/logout">Logout

<a href="<?= site_url('admin/announcements'); ?>">Upcoming

<a href="<?= site_url('admin/past_announcements'); ?>">Past

<a href="<?= site_url('admin/announcements/type'); ?>">Announcement Type

            <?php if($this->session->flashdata('type_added')): ?>
            <?php echo '
'.$this->session->flashdata('type_added').'
'; ?>
            <?php endif; ?>

            <?php if($this->session->flashdata('type_updated')): ?>
            <?php echo '
'.$this->session->flashdata('type_updated').'
'; ?>
            <?php endif; ?>

            <?php if($this->session->flashdata('type_deleted')): ?>
            <?php echo '
'.$this->session->flashdata('type_deleted').'
'; ?>
            <?php endif; ?>

            <a href="<?= site_url('admin/announcements/types/add'); ?>" style="background-color:#5cb85c ;color:white; margin-right: 2%" class="btn btn-success pull-right">Add Type

                        Type Name
                        Action

                    <?php foreach($typos as $types) : ?>

                            <?= $types['TypeName']; ?>

                                <a href="<?= site_url('admin/announcements/types/edit/' . $types['TypeID']); ?>">
                                    <button  style="background-color:#428bca;color:white;" type="button" class="btn btn-primary">
                                         Edit
                                    </button>

                                <a href="<?= site_url('admin/announcements/types/delete/' . $types['TypeID']); ?>">
                                    <button  style="background-color:#d9534f;color:white;" type="button" class="btn btn-danger" onClick="return confirm('Are you sure you want to delete this type? This action cannot be undone.')">
                                         Delete
                                    </button>

                    <?php endforeach; ?>

            <?php echo $this->pagination->create_links(); ?>


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

                «

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

    <p class="styleSans24.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">V. ' Continengal
RESOURCE

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">10/23/2014

    <p class="styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Industn'al Commission of North Dakota Oil & Gas Division
600 East Boulevard, Dept 405 Bismarck, North Dakota 58505

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Re: Holstein Federal 10-25H

    <p class="styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Please charge the Continental Resources, Inc. credit card that is on file with your agency for the application fee of this well.
Please Note: A request for a legal street address has been sent to Aaron Chisholm from McKenzie County on 10/23/2014 at aclrisholm®co.mckenzie.nd.us for this well location.
Thank you for your prompt attention to this matter. If you have any questions, you may contact me at
(405) 234—9000 or by email at beclgbamesébclncom.

    <p class="styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Sincerely,
Wm Mae: CONTINE AJJRESOURCES, INC.
Becky Barnes Regulatory Compliance Specialist

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">405—234—9000

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">www.clr.com

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
void ShownSectionsHandler::RegisterMessages() {
  dom_ui_->RegisterMessageCallback("getShownSections",
      NewCallback(this, &ShownSectionsHandler::HandleGetShownSections));
  dom_ui_->RegisterMessageCallback("setShownSections",
      NewCallback(this, &ShownSectionsHandler::HandleSetShownSections));
}

void ShownSectionsHandler::HandleGetShownSections(const Value* value) {
  const int mode = dom_ui_->GetProfile()->GetPrefs()->
      GetInteger(prefs::kNTPShownSections);
  FundamentalValue* mode_value = new FundamentalValue(mode);
  dom_ui_->CallJavascriptFunction(L"onShownSections", *mode_value);
}

void ShownSectionsHandler::HandleSetShownSections(const Value* value) {
  if (!value->IsType(Value::TYPE_LIST)) {
    NOTREACHED();
    return;
  }

  const ListValue* list = static_cast<const ListValue*>(value);
  std::string mode_string;

  if (list->GetSize() < 1) {
    NOTREACHED() << "setShownSections called with too few arguments";
    return;
  }

  bool r = list->GetString(0, &mode_string);
  DCHECK(r) << "Missing value in setShownSections from the NTP Most Visited.";

  dom_ui_->GetProfile()->GetPrefs()->SetInteger(
      prefs::kNTPShownSections, StringToInt(mode_string));
}

// static
void ShownSectionsHandler::RegisterUserPrefs(PrefService* prefs) {
  prefs->RegisterIntegerPref(prefs::kNTPShownSections,
      THUMB | RECENT | TIPS);
}


text: export { SkipForward20 as default } from "../../";


text:
Deamon for godash
-----------------