text:
// Copyright (c) 2009-2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <addrdb.h>
#include <addrman.h>
#include <blockencodings.h>
#include <blockfilter.h>
#include <chain.h>
#include <coins.h>
#include <compressor.h>
#include <consensus/merkle.h>
#include <key.h>
#include <merkleblock.h>
#include <net.h>
#include <netbase.h>
#include <node/utxo_snapshot.h>
#include <primitives/block.h>
#include <protocol.h>
#include <psbt.h>
#include <pubkey.h>
#include <script/keyorigin.h>
#include <streams.h>
#include <undo.h>
#include <version.h>

#include <exception>
#include <optional>
#include <stdexcept>
#include <stdint.h>
#include <unistd.h>

#include <test/fuzz/fuzz.h>

void initialize_deserialize()
{
    // Fuzzers using pubkey must hold an ECCVerifyHandle.
    static const ECCVerifyHandle verify_handle;
}

#define FUZZ_TARGET_DESERIALIZE(name, code)                \
    FUZZ_TARGET_INIT(name, initialize_deserialize)         \
    {                                                      \
        try {                                              \
            code                                           \
        } catch (const invalid_fuzzing_input_exception&) { \
        }                                                  \
    }

namespace {

struct invalid_fuzzing_input_exception : public std::exception {
};

template <typename T>
CDataStream Serialize(const T& obj, const int version = INIT_PROTO_VERSION, const int ser_type = SER_NETWORK)
{
    CDataStream ds(ser_type, version);
    ds << obj;
    return ds;
}

template <typename T>
T Deserialize(CDataStream ds)
{
    T obj;
    ds >> obj;
    return obj;
}

template <typename T>
void DeserializeFromFuzzingInput(FuzzBufferType buffer, T& obj, const std::optional<int> protocol_version = std::nullopt, const int ser_type = SER_NETWORK)
{
    CDataStream ds(buffer, ser_type, INIT_PROTO_VERSION);
    if (protocol_version) {
        ds.SetVersion(*protocol_version);
    } else {
        try {
            int version;
            ds >> version;
            ds.SetVersion(version);
        } catch (const std::ios_base::failure&) {
            throw invalid_fuzzing_input_exception();
        }
    }
    try {
        ds >> obj;
    } catch (const std::ios_base::failure&) {
        throw invalid_fuzzing_input_exception();
    }
    assert(buffer.empty() || !Serialize(obj).empty());
}

template <typename T>
void AssertEqualAfterSerializeDeserialize(const T& obj, const int version = INIT_PROTO_VERSION, const int ser_type = SER_NETWORK)
{
    assert(Deserialize<T>(Serialize(obj, version, ser_type)) == obj);
}

} // namespace

FUZZ_TARGET_DESERIALIZE(block_filter_deserialize, {
    BlockFilter block_filter;
    DeserializeFromFuzzingInput(buffer, block_filter);
})
FUZZ_TARGET_DESERIALIZE(addr_info_deserialize, {
    CAddrInfo addr_info;
    DeserializeFromFuzzingInput(buffer, addr_info);
})
FUZZ_TARGET_DESERIALIZE(block_file_info_deserialize, {
    CBlockFileInfo block_file_info;
    DeserializeFromFuzzingInput(buffer, block_file_info);
})
FUZZ_TARGET_DESERIALIZE(block_header_and_short_txids_deserialize, {
    CBlockHeaderAndShortTxIDs block_header_and_short_txids;
    DeserializeFromFuzzingInput(buffer, block_header_and_short_txids);
})
FUZZ_TARGET_DESERIALIZE(fee_rate_deserialize, {
    CFeeRate fee_rate;
    DeserializeFromFuzzingInput(buffer, fee_rate);
    AssertEqualAfterSerializeDeserialize(fee_rate);
})
FUZZ_TARGET_DESERIALIZE(merkle_block_deserialize, {
    CMerkleBlock merkle_block;
    DeserializeFromFuzzingInput(buffer, merkle_block);
})
FUZZ_TARGET_DESERIALIZE(out_point_deserialize, {
    COutPoint out_point;
    DeserializeFromFuzzingInput(buffer, out_point);
    AssertEqualAfterSerializeDeserialize(out_point);
})
FUZZ_TARGET_DESERIALIZE(partial_merkle_tree_deserialize, {
    CPartialMerkleTree partial_merkle_tree;
    DeserializeFromFuzzingInput(buffer, partial_merkle_tree);
})
FUZZ_TARGET_DESERIALIZE(pub_key_deserialize, {
    CPubKey pub_key;
    DeserializeFromFuzzingInput(buffer, pub_key);
    AssertEqualAfterSerializeDeserialize(pub_key);
})
FUZZ_TARGET_DESERIALIZE(script_deserialize, {
    CScript script;
    DeserializeFromFuzzingInput(buffer, script);
})
FUZZ_TARGET_DESERIALIZE(tx_in_deserialize, {
    CTxIn tx_in;
    DeserializeFromFuzzingInput(buffer, tx_in);
    AssertEqualAfterSerializeDeserialize(tx_in);
})
FUZZ_TARGET_DESERIALIZE(flat_file_pos_deserialize, {
    FlatFilePos flat_file_pos;
    DeserializeFromFuzzingInput(buffer, flat_file_pos);
    AssertEqualAfterSerializeDeserialize(flat_file_pos);
})
FUZZ_TARGET_DESERIALIZE(key_origin_info_deserialize, {
    KeyOriginInfo key_origin_info;
    DeserializeFromFuzzingInput(buffer, key_origin_info);
    AssertEqualAfterSerializeDeserialize(key_origin_info);
})
FUZZ_TARGET_DESERIALIZE(partially_signed_transaction_deserialize, {
    PartiallySignedTransaction partially_signed_transaction;
    DeserializeFromFuzzingInput(buffer, partially_signed_transaction);
})
FUZZ_TARGET_DESERIALIZE(prefilled_transaction_deserialize, {
    PrefilledTransaction prefilled_transaction;
    DeserializeFromFuzzingInput(buffer, prefilled_transaction);
})
FUZZ_TARGET_DESERIALIZE(psbt_input_deserialize, {
    PSBTInput psbt_input;
    DeserializeFromFuzzingInput(buffer, psbt_input);
})
FUZZ_TARGET_DESERIALIZE(psbt_output_deserialize, {
    PSBTOutput psbt_output;
    DeserializeFromFuzzingInput(buffer, psbt_output);
})
FUZZ_TARGET_DESERIALIZE(block_deserialize, {
    CBlock block;
    DeserializeFromFuzzingInput(buffer, block);
})
FUZZ_TARGET_DESERIALIZE(blocklocator_deserialize, {
    CBlockLocator bl;
    DeserializeFromFuzzingInput(buffer, bl);
})
FUZZ_TARGET_DESERIALIZE(blockmerkleroot, {
    CBlock block;
    DeserializeFromFuzzingInput(buffer, block);
    bool mutated;
    BlockMerkleRoot(block, &mutated);
})
FUZZ_TARGET_DESERIALIZE(addrman_deserialize, {
    CAddrMan am(/* deterministic */ false, /* consistency_check_ratio */ 0);
    DeserializeFromFuzzingInput(buffer, am);
})
FUZZ_TARGET_DESERIALIZE(blockheader_deserialize, {
    CBlockHeader bh;
    DeserializeFromFuzzingInput(buffer, bh);
})
FUZZ_TARGET_DESERIALIZE(txundo_deserialize, {
    CTxUndo tu;
    DeserializeFromFuzzingInput(buffer, tu);
})
FUZZ_TARGET_DESERIALIZE(blockundo_deserialize, {
    CBlockUndo bu;
    DeserializeFromFuzzingInput(buffer, bu);
})
FUZZ_TARGET_DESERIALIZE(coins_deserialize, {
    Coin coin;
    DeserializeFromFuzzingInput(buffer, coin);
})
FUZZ_TARGET_DESERIALIZE(netaddr_deserialize, {
    CNetAddr na;
    DeserializeFromFuzzingInput(buffer, na);
    if (na.IsAddrV1Compatible()) {
        AssertEqualAfterSerializeDeserialize(na);
    }
    AssertEqualAfterSerializeDeserialize(na, INIT_PROTO_VERSION | ADDRV2_FORMAT);
})
FUZZ_TARGET_DESERIALIZE(service_deserialize, {
    CService s;
    DeserializeFromFuzzingInput(buffer, s);
    if (s.IsAddrV1Compatible()) {
        AssertEqualAfterSerializeDeserialize(s);
    }
    AssertEqualAfterSerializeDeserialize(s, INIT_PROTO_VERSION | ADDRV2_FORMAT);
    CService s1;
    DeserializeFromFuzzingInput(buffer, s1, INIT_PROTO_VERSION);
    AssertEqualAfterSerializeDeserialize(s1, INIT_PROTO_VERSION);
    assert(s1.IsAddrV1Compatible());
    CService s2;
    DeserializeFromFuzzingInput(buffer, s2, INIT_PROTO_VERSION | ADDRV2_FORMAT);
    AssertEqualAfterSerializeDeserialize(s2, INIT_PROTO_VERSION | ADDRV2_FORMAT);
})
FUZZ_TARGET_DESERIALIZE(messageheader_deserialize, {
    CMessageHeader mh;
    DeserializeFromFuzzingInput(buffer, mh);
    (void)mh.IsCommandValid();
})
FUZZ_TARGET_DESERIALIZE(address_deserialize_v1_notime, {
    CAddress a;
    DeserializeFromFuzzingInput(buffer, a, INIT_PROTO_VERSION);
    // A CAddress without nTime (as is expected under INIT_PROTO_VERSION) will roundtrip
    // in all 5 formats (with/without nTime, v1/v2, network/disk)
    AssertEqualAfterSerializeDeserialize(a, INIT_PROTO_VERSION);
    AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION);
    AssertEqualAfterSerializeDeserialize(a, 0, SER_DISK);
    AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION | ADDRV2_FORMAT);
    AssertEqualAfterSerializeDeserialize(a, ADDRV2_FORMAT, SER_DISK);
})
FUZZ_TARGET_DESERIALIZE(address_deserialize_v1_withtime, {
    CAddress a;
    DeserializeFromFuzzingInput(buffer, a, PROTOCOL_VERSION);
    // A CAddress in V1 mode will roundtrip in all 4 formats that have nTime.
    AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION);
    AssertEqualAfterSerializeDeserialize(a, 0, SER_DISK);
    AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION | ADDRV2_FORMAT);
    AssertEqualAfterSerializeDeserialize(a, ADDRV2_FORMAT, SER_DISK);
})
FUZZ_TARGET_DESERIALIZE(address_deserialize_v2, {
    CAddress a;
    DeserializeFromFuzzingInput(buffer, a, PROTOCOL_VERSION | ADDRV2_FORMAT);
    // A CAddress in V2 mode will roundtrip in both V2 formats, and also in the V1 formats
    // with time if it's V1 compatible.
    if (a.IsAddrV1Compatible()) {
        AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION);
        AssertEqualAfterSerializeDeserialize(a, 0, SER_DISK);
    }
    AssertEqualAfterSerializeDeserialize(a, PROTOCOL_VERSION | ADDRV2_FORMAT);
    AssertEqualAfterSerializeDeserialize(a, ADDRV2_FORMAT, SER_DISK);
})
FUZZ_TARGET_DESERIALIZE(inv_deserialize, {
    CInv i;
    DeserializeFromFuzzingInput(buffer, i);
})
FUZZ_TARGET_DESERIALIZE(bloomfilter_deserialize, {
    CBloomFilter bf;
    DeserializeFromFuzzingInput(buffer, bf);
})
FUZZ_TARGET_DESERIALIZE(diskblockindex_deserialize, {
    CDiskBlockIndex dbi;
    DeserializeFromFuzzingInput(buffer, dbi);
})
FUZZ_TARGET_DESERIALIZE(txoutcompressor_deserialize, {
    CTxOut to;
    auto toc = Using<TxOutCompression>(to);
    DeserializeFromFuzzingInput(buffer, toc);
})
FUZZ_TARGET_DESERIALIZE(blocktransactions_deserialize, {
    BlockTransactions bt;
    DeserializeFromFuzzingInput(buffer, bt);
})
FUZZ_TARGET_DESERIALIZE(blocktransactionsrequest_deserialize, {
    BlockTransactionsRequest btr;
    DeserializeFromFuzzingInput(buffer, btr);
})
FUZZ_TARGET_DESERIALIZE(snapshotmetadata_deserialize, {
    SnapshotMetadata snapshot_metadata;
    DeserializeFromFuzzingInput(buffer, snapshot_metadata);
})
FUZZ_TARGET_DESERIALIZE(uint160_deserialize, {
    uint160 u160;
    DeserializeFromFuzzingInput(buffer, u160);
    AssertEqualAfterSerializeDeserialize(u160);
})
FUZZ_TARGET_DESERIALIZE(uint256_deserialize, {
    uint256 u256;
    DeserializeFromFuzzingInput(buffer, u256);
    AssertEqualAfterSerializeDeserialize(u256);
})
// Classes intentionally not covered in this file since their deserialization code is
// fuzzed elsewhere:
// * Deserialization of CTxOut is fuzzed in test/fuzz/tx_out.cpp
// * Deserialization of CMutableTransaction is fuzzed in src/test/fuzz/transaction.cpp


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class com.github.rvesse.airline.Accessor (Airline - Library 2.1.1-SNAPSHOT API)</title>
<meta name="date" content="2016-01-19">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
com.github.rvesse.airline.Accessor

Packages that use Accessor

Package
Description

com.github.rvesse.airline.model

com.github.rvesse.airline.parser

Uses of Accessor in com.github.rvesse.airline.model

Methods in com.github.rvesse.airline.model that return types with arguments of type Accessor

Modifier and Type
Method and Description

Set<Accessor>
OptionMetadata.getAccessors()

Set<Accessor>
ArgumentsMetadata.getAccessors()

List<Accessor>
SuggesterMetadata.getMetadataInjections()

List<Accessor>
CommandMetadata.getMetadataInjections()

Constructor parameters in com.github.rvesse.airline.model with type arguments of type Accessor

Constructor and Description

CommandMetadata(String name,
               String description,
               boolean hidden,
               Iterable<OptionMetadata> globalOptions,
               Iterable<OptionMetadata> groupOptions,
               Iterable<OptionMetadata> commandOptions,
               OptionMetadata defaultOption,
               ArgumentsMetadata arguments,
               Iterable<Accessor> metadataInjections,
               Class<?> type,
               List<String> groupNames,
               List<Group> groups,
               List<HelpSection> sections)

SuggesterMetadata(Class<? extends Suggester> suggesterClass,
                 List<Accessor> metadataInjections)

Uses of Accessor in com.github.rvesse.airline.parser

Method parameters in com.github.rvesse.airline.parser with type arguments of type Accessor

Modifier and Type
Method and Description

static <T> T
ParserUtil.createInstance(Class<?> type,
              Iterable<OptionMetadata> options,
              List<org.apache.commons.lang3.tuple.Pair<OptionMetadata,Object>> parsedOptions,
              ArgumentsMetadata arguments,
              Iterable<Object> parsedArguments,
              Iterable<Accessor> metadataInjection,
              Map<Class<?>,Object> bindings)

static <T> T
ParserUtil.createInstance(Class<?> type,
              Iterable<OptionMetadata> options,
              List<org.apache.commons.lang3.tuple.Pair<OptionMetadata,Object>> parsedOptions,
              ArgumentsMetadata arguments,
              Iterable<Object> parsedArguments,
              Iterable<Accessor> metadataInjection,
              Map<Class<?>,Object> bindings,
              CommandFactory<T> commandFactory)

static <T> T
ParserUtil.injectOptions(T commandInstance,
             Iterable<OptionMetadata> options,
             List<org.apache.commons.lang3.tuple.Pair<OptionMetadata,Object>> parsedOptions,
             ArgumentsMetadata arguments,
             Iterable<Object> parsedArguments,
             Iterable<Accessor> metadataInjection,
             Map<Class<?>,Object> bindings)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2012–2016. All rights reserved.

redpajama_set_name: RedPajamaGithub


text:
import requests
import json
import ConfigParser

class LabelManager:

    def __init__(self, config):
        """
        :param ConfigParser.RawConfigParser config: read config file
        """
        self.nextcloudBaseUrl = 'https://api.github.com/repos/nextcloud/'
        config.read('github.cfg')
        self.authToken = config.get('auth', 'token')
        self.headers = {'Authorization': 'token ' + self.authToken}

    def get_all_labels(self, repo='server'):
        """
        get all labels from the Nextcloud server repository
        :return: list of all server labels
        """
        url = self.nextcloudBaseUrl + repo + '/labels?per_page=100'
        response = requests.get(url)
        data = json.loads(response.content)
        return data

    def create_labels(self, repo, labels):
        """
        create labels on the given Nextcloud repository
        :param string repo:
        :param string labels:
        """
        url = self.nextcloudBaseUrl + repo + '/labels'

        for label in labels:
            # skip the feature: labels because they are server specific
            if not label['name'].startswith('feature:'):
                payload = {
                    'name': label['name'],
                    'color': label['color'],
                }
                response = requests.get(url + '/' + label['name'], headers=self.headers)
                if response.status_code == 403:
                    print '[' + repo + '] Rate limit reached'
                    return

                # if the label already exists we update it, otherwise we create a new one
                if response.status_code == 200:
                    checkLabel = json.loads(response.content)
                    if not label['color'] == label['color']:
                        print '[' + repo + '] Update label: "' + label['name'] + '" (Color: #' + label['color'] + ')'
                        requests.patch(url + '/' + label['name'], data=json.dumps(payload), headers=self.headers)
                    else:
                        print '[' + repo + '] Skip unchanged label: "' + label['name'] + '"'

                else:
                    print '[' + repo + '] Create label: "' + label['name'] + '" (Color: #' + label['color'] + ')'
                    requests.post(url, data=json.dumps(payload), headers=self.headers)
            else:
                print '[' + repo + '] Skip feature label: "' + label['name'] + '"'

    def delete_all_labels(self, repo):
        """
        delete all labels from a give repository
        :param repo:
        :return:
        """
        if repo == 'server':
            return

        url = self.nextcloudBaseUrl + repo + '/labels/'
        labels = self.get_all_labels(repo)

        for label in labels:
            print 'Delete label: "' + label['name']
            requests.delete(url + label['name'], headers=self.headers)


text:
package org.pac4j.saml.logout.impl;

import org.opensaml.saml.saml2.core.StatusResponseType;
import org.opensaml.saml.saml2.metadata.Endpoint;
import org.pac4j.core.context.WebContextHelper;
import org.pac4j.core.context.WebContext;
import org.pac4j.saml.config.SAML2Configuration;
import org.pac4j.saml.context.SAML2MessageContext;
import org.pac4j.saml.exceptions.SAMLException;
import org.pac4j.saml.profile.api.SAML2ResponseValidator;
import org.pac4j.saml.profile.impl.AbstractSAML2MessageReceiver;
import org.pac4j.saml.transport.AbstractPac4jDecoder;
import org.pac4j.saml.transport.Pac4jHTTPPostDecoder;
import org.pac4j.saml.transport.Pac4jHTTPRedirectDeflateDecoder;
import org.pac4j.saml.util.Configuration;

import java.util.Optional;

/**
 * Receives the SAML2 logout messages.
 *
 * @author Jerome Leleu
 * @since 3.4.0
 */
public class SAML2LogoutMessageReceiver extends AbstractSAML2MessageReceiver {

    private static final String SAML2_SLO_PROFILE_URI = "urn:oasis:names:tc:SAML:2.0:profiles:SSO:logout";

    public SAML2LogoutMessageReceiver(final SAML2ResponseValidator validator,
                                      final SAML2Configuration saml2Configuration) {
        super(validator, saml2Configuration);
    }

    @Override
    protected AbstractPac4jDecoder getDecoder(final WebContext webContext) {
        final AbstractPac4jDecoder decoder;
        if (WebContextHelper.isPost(webContext)) {
            decoder = new Pac4jHTTPPostDecoder(webContext);
            try {
                decoder.setParserPool(Configuration.getParserPool());
                decoder.initialize();
                decoder.decode();

            } catch (final Exception e) {
                throw new SAMLException("Error decoding POST SAML message", e);
            }
        } else if (WebContextHelper.isGet(webContext)) {
            decoder = new Pac4jHTTPRedirectDeflateDecoder(webContext);

            try {
                decoder.setParserPool(Configuration.getParserPool());
                decoder.initialize();
                decoder.decode();

            } catch (final Exception e) {
                throw new SAMLException("Error decoding HTTP-Redirect SAML message", e);
            }
        } else {
            throw new SAMLException("Only GET or POST requests are accepted");
        }
        return decoder;
    }

    @Override
    protected Optional<Endpoint> getEndpoint(final SAML2MessageContext context, final StatusResponseType response) {
        return Optional.empty();
    }

    @Override
    protected String getProfileUri() {
        return SAML2_SLO_PROFILE_URI;
    }
}


text:
/*
 * SubSonic - http://subsonicproject.com
 *
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an
 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
*/

using System;
using System.Data;
using MbUnit.Framework;
using NorthwindAccess;

// Removed 'ROLLBACK' attribute from this class as it was causing:
//   System.Data.OleDb.OleDbException: No error message available, result code: E_NOINTERFACE(0x80004002).
// which appears to be related to either multi-threading or DTE.
// Access is a simple system, we'll confine transactions to the specific tests for it.
// A fresh DB can be copied at the start of each test run.

namespace SubSonic.Tests.MsAccess
{
    /// <summary>
    /// Summary for the ActiveRecordTest class
    /// </summary>
    [TestFixture]
    public class ActiveRecordTest
    {
        /// <summary>
        /// Setups this instance.
        /// </summary>
        [SetUp]
        public void Setup()
        {
            Query qry = new Query(Product.Schema);
            qry.QueryType = QueryType.Delete;
            qry.AddWhere("productName", Comparison.Like, "Unit Test%");
            qry.Execute();

            Query qry2 = new Query(Supplier.Schema);
            qry2.QueryType = QueryType.Delete;
            qry2.AddWhere("CompanyName", Comparison.Like, "Unit Test%");
            qry2.Execute();
        }

		[TearDown]
		public void TearDown() {
			DeleteTestProduct();
		}

        /// <summary>
        /// Products_s the crud.
        /// </summary>
        [Test]
        public void Acc_Products_Crud()
        {
            //add a new product
            Product product = CreateTestProduct();
            product.Save("");

            //get the new id
            int newID = product.ProductID;

            product = new Product(newID);
            product.ReorderLevel = 100;
            product.Save("unit test");

            //pull it out to confirm
            product = new Product(newID);
            Assert.IsTrue(product.ReorderLevel == 100, "Bad Save");

			DeleteTestProduct();
        }

        /// <summary>
        /// Products_s the null crud.
        /// </summary>
        [Test]
        public void Acc_Products_NullCrud()
        {
            //add a new product
            Product product = new Product();
            product.CategoryID = 1;
            product.Discontinued = false;
            product.ProductName = "Unit Test Product";
            product.QuantityPerUnit = null;
            product.ReorderLevel = null;
            product.SupplierID = null;
            product.UnitPrice = null;
            product.UnitsInStock = null;
            product.UnitsOnOrder = null;

            product.Save("");

            //get the new id
            int newID = product.ProductID;

            product = new Product(newID);
            product.ReorderLevel = 100;
            product.Save("unit test");

            //pull it out to confirm
            product = new Product(newID);
            Assert.IsTrue(product.ReorderLevel == 100, "Bad Save");
            Assert.IsTrue(product.SupplierID == null, "Bad Save, Null not inserted");

            //delete it
            ActiveRecord<Product>.Delete(newID);
        }

        /// <summary>
        /// Products_s the collection load.
        /// </summary>
        [Test]
        public void Acc_Products_CollectionLoad()
        {
            ProductCollection coll = new ProductCollection();
            using(IDataReader rdr = ReadOnlyRecord<Product>.FetchAll())
            {
                coll.Load(rdr);
                rdr.Close();
            }
            Assert.IsTrue(coll.Count > 0);
        }

        /// <summary>
        /// Gets the new command.
        /// </summary>
        [Test]
        public void Acc_GetNewCommand()
        {
            Product p = CreateTestProduct();
            Assert.IsTrue(p.IsNew, "Should be New");
            Assert.IsTrue(p.GetSaveCommand().CommandSql.Contains("INSERT INTO"), "Should be INSERT Statement");
            Assert.AreEqual("NorthwindAccess", p.GetSaveCommand().ProviderName, "Provider Name not set");
        }

        /// <summary>
        /// Gets the update command.
        /// </summary>
        [Test]
        public void Acc_GetUpdateCommand()
        {
            Product p = CreateTestProduct();
            p.Discontinued = true;
            p.IsNew = false;
            Assert.IsFalse(p.IsNew, "Should not be New");
            Assert.IsTrue(p.IsDirty, "Should be Dirty");
            Assert.IsTrue(p.GetSaveCommand().CommandSql.Contains("UPDATE"), "Should be UPDATE Statement");
            Assert.AreEqual("NorthwindAccess", p.GetSaveCommand().ProviderName, "Provider Name not set");
        }

        /// <summary>
        /// Gets the no changes command.
        /// </summary>
        [Test]
        public void Acc_GetNoChangesCommand()
        {
            Product p = CreateTestProduct();
            p.Save();
            p.IsNew = false;
            Assert.IsFalse(p.IsNew, "Should not be New");
            Assert.IsFalse(p.IsDirty, "Should not be Dirty");
            Assert.IsNull(p.GetSaveCommand(), "Should be NULL");
        }

        /// <summary>
        /// Saves the when not dirty.
        /// </summary>
        [Test]
        public void Acc_SaveWhenNotDirty()
        {
            Product p = CreateTestProduct();
            p.Save();
            int id = p.ProductID;

            p.Discontinued = true;
            p.ReorderLevel = 2112;
            p.MarkClean();
            Assert.IsFalse(p.IsDirty, "Should NOT be dirty");

            p.Save();

            p = new Product(id);

            Assert.AreEqual(false, p.Discontinued, "Should not be false");
            Assert.AreEqual(Int16.Parse("3"), p.ReorderLevel, "Should not be set");
        }

        //[Test]
        //public void Acc_TestNewRecordDeepSave()
        //{
        //    Supplier s = new Supplier();
        //    s.CompanyName = "Unit Test Supplier";

        //    Product p1 = CreateTestProduct();
        //    Product p2 = CreateTestProduct();

        //    s.Products().Add(p1);
        //    s.Products().Add(p2);

        //    s.DeepSave();

        //    Assert.IsNotNull(s.SupplierID, "SupplierID is null");
        //    Assert.AreEqual(s.SupplierID, p1.SupplierID, "SupplierID not set.");
        //    Assert.AreEqual(s.SupplierID, p2.SupplierID, "SupplierID not set.");
        //}

        //[Test]
        //public void Acc_TestExistingRecordDeepSave()
        //{
        //    Supplier s = new Supplier();
        //    s.CompanyName = "Unit Test Supplier";
        //    s.Save();
        //    Assert.IsNotNull(s.SupplierID, "SupplierID is null");

        //    Product p1 = CreateTestProduct();
        //    Product p2 = CreateTestProduct();

        //    s.Products.Add(p1);
        //    s.Products.Add(p2);

        //    s.DeepSave();

        //    Assert.AreEqual(s.SupplierID, p1.SupplierID, "SupplierID not set.");
        //    Assert.AreEqual(s.SupplierID, p2.SupplierID, "SupplierID not set.");
        //}

        /// <summary>
        /// Creates the test product.
        /// </summary>
        /// <returns></returns>
        private static Product CreateTestProduct()
        {
            Product product = new Product();
            product.CategoryID = 1;
            product.Discontinued = false;
            product.ProductName = "Unit Test Product";
            product.QuantityPerUnit = "Qty";
            product.ReorderLevel = 3;
            product.SupplierID = 1;
            product.UnitPrice = 99;
            product.UnitsInStock = 20;
            product.UnitsOnOrder = 9;
            return product;
        }

		private static void DeleteTestProduct() {
			//delete all unit tests
			Query qry = new Query(Product.Schema);
			qry.QueryType = QueryType.Delete;
			qry.AddWhere("productName", "Unit Test Product");
			qry.Execute();
		}

        /// <summary>
        /// Tests to make sure that our DirtyColumns change is tracking dirty columns properly
        /// </summary>
        [Test]
        public void Acc_DirtyColumnsExist()
        {
            Product p = new Product(1);

            //make sure no dirties
            Assert.IsTrue(p.DirtyColumns.Count == 0);

            //set the product name to something different
            p.ProductName = DateTime.Now.ToString();

            //see if the dirty col is set right
            Assert.IsTrue(p.DirtyColumns.Count == 1 && p.DirtyColumns[0].ColumnName == "ProductName");
            //p.Save("bbep");
        }
    }
}


text:
package main

import (
	"flag"
	"fmt"
	"os"

	"github.com/giagiannis/data-profiler/core"
)

type partitionerParams struct {
	input         *string
	output        *string
	splits        *int
	partitionType *core.PartitionerType
}

func partitionerParseParams() *partitionerParams {
	params := new(partitionerParams)
	params.input = flag.String("i", "", "Input file to partition")
	params.output = flag.String("o", "", "Input file to partition")
	params.splits = flag.Int("c", 0, "Number of splits to create")
	part := flag.String("t", "UNIFORM", "Type of partitioning")
	if *part == "UNIFORM" {
		params.partitionType = new(core.PartitionerType)
		*params.partitionType = core.PartitionerUniform
	}
	flag.Parse()
	if *params.input == "" || *params.output == "" || *params.splits == 0 || *part == "" {
		fmt.Println("Options:")
		flag.PrintDefaults()
		os.Exit(1)
	}
	return params
}

func partitionerRun() {
	params := partitionerParseParams()
	partitioner := core.NewDatasetPartitioner(
		*params.input,
		*params.output,
		*params.splits,
		*params.partitionType)
	partitioner.Partition()
	fmt.Println("Partitioning finished")
}


text:
@implementation LZConnectItem

+ (instancetype)connectItemWithName:(NSString *)name phone:(NSString *)phone
{
    LZConnectItem *item = [[LZConnectItem alloc] init];
    item.name = name;
    item.phone = phone;
    return item;
}

@end


text:
// node-xml
// An xml parser for node.js
// (C) Rob Righter (@robrighter) 2009 - 2010, Licensed under the MIT-LICENSE
// Contributions from David Joham

(function () {

// CONSTANTS
var whitespace = "\n\r\t ";

//XMLP is a pull-based parser. The calling application passes in a XML string
//to the constructor, then repeatedly calls .next() to parse the next segment.
//.next() returns a flag indicating what type of segment was found, and stores
//data temporarily in couple member variables (name, content, array of
//attributes), which can be accessed by several .get____() methods.
//
//Basically, XMLP is the lowest common denominator parser - an very simple
//API which other wrappers can be built against.

var XMLP = function(strXML) {
    // Normalize line breaks
    strXML = SAXStrings.replace(strXML, null, null, "\r\n", "\n");
    strXML = SAXStrings.replace(strXML, null, null, "\r", "\n");

    this.m_xml = strXML;
    this.m_iP = 0;
    this.m_iState = XMLP._STATE_PROLOG;
    this.m_stack = new Stack();
    this._clearAttributes();
    this.m_pause = false;
    this.m_preInterruptIState = XMLP._STATE_PROLOG;
    this.m_namespaceList = new Array();
    this.m_chunkTransitionContinuation = null;

}

// CONSTANTS    (these must be below the constructor)
XMLP._NONE    = 0;
XMLP._ELM_B   = 1;
XMLP._ELM_E   = 2;
XMLP._ELM_EMP = 3;
XMLP._ATT     = 4;
XMLP._TEXT    = 5;
XMLP._ENTITY  = 6;
XMLP._PI      = 7;
XMLP._CDATA   = 8;
XMLP._COMMENT = 9;
XMLP._DTD     = 10;
XMLP._ERROR   = 11;
XMLP._INTERRUPT = 12;

XMLP._CONT_XML = 0;
XMLP._CONT_ALT = 1;

XMLP._ATT_NAME = 0;
XMLP._ATT_VAL  = 1;

XMLP._STATE_PROLOG = 1;
XMLP._STATE_DOCUMENT = 2;
XMLP._STATE_MISC = 3;

XMLP._errs = new Array();
XMLP._errs[XMLP.ERR_CLOSE_PI       = 0 ] = "PI: missing closing sequence";
XMLP._errs[XMLP.ERR_CLOSE_DTD      = 1 ] = "DTD: missing closing sequence";
XMLP._errs[XMLP.ERR_CLOSE_COMMENT  = 2 ] = "Comment: missing closing sequence";
XMLP._errs[XMLP.ERR_CLOSE_CDATA    = 3 ] = "CDATA: missing closing sequence";
XMLP._errs[XMLP.ERR_CLOSE_ELM      = 4 ] = "Element: missing closing sequence";
XMLP._errs[XMLP.ERR_CLOSE_ENTITY   = 5 ] = "Entity: missing closing sequence";
XMLP._errs[XMLP.ERR_PI_TARGET      = 6 ] = "PI: target is required";
XMLP._errs[XMLP.ERR_ELM_EMPTY      = 7 ] = "Element: cannot be both empty and closing";
XMLP._errs[XMLP.ERR_ELM_NAME       = 8 ] = "Element: name must immediatly follow \"<\"";
XMLP._errs[XMLP.ERR_ELM_LT_NAME    = 9 ] = "Element: \"<\" not allowed in element names";
XMLP._errs[XMLP.ERR_ATT_VALUES     = 10] = "Attribute: values are required and must be in quotes";
XMLP._errs[XMLP.ERR_ATT_LT_NAME    = 11] = "Element: \"<\" not allowed in attribute names";
XMLP._errs[XMLP.ERR_ATT_LT_VALUE   = 12] = "Attribute: \"<\" not allowed in attribute values";
XMLP._errs[XMLP.ERR_ATT_DUP        = 13] = "Attribute: duplicate attributes not allowed";
XMLP._errs[XMLP.ERR_ENTITY_UNKNOWN = 14] = "Entity: unknown entity";
XMLP._errs[XMLP.ERR_INFINITELOOP   = 15] = "Infininte loop";
XMLP._errs[XMLP.ERR_DOC_STRUCTURE  = 16] = "Document: only comments, processing instructions, or whitespace allowed outside of document element";
XMLP._errs[XMLP.ERR_ELM_NESTING    = 17] = "Element: must be nested correctly";

XMLP.prototype.continueParsing = function(strXML) {

    if(this.m_chunkTransitionContinuation){
        strXML = this.m_chunkTransitionContinuation + strXML;
    }
    // Normalize line breaks
    strXML = SAXStrings.replace(strXML, null, null, "\r\n", "\n");
    strXML = SAXStrings.replace(strXML, null, null, "\r", "\n");

    this.m_xml = strXML;
    this.m_iP = 0;
    this.m_iState = XMLP._STATE_DOCUMENT;
    //this.m_stack = new Stack();
    //this._clearAttributes();
    this.m_pause = false;
    this.m_preInterruptIState = XMLP._STATE_PROLOG;
    this.m_chunkTransitionContinuation = null;

}

XMLP.prototype._addAttribute = function(name, value) {
    this.m_atts[this.m_atts.length] = new Array(name, value);
}

XMLP.prototype._checkStructure = function(iEvent) {
	if(XMLP._STATE_PROLOG == this.m_iState) {
		if((XMLP._TEXT == iEvent) || (XMLP._ENTITY == iEvent)) {
            if(SAXStrings.indexOfNonWhitespace(this.getContent(), this.getContentBegin(), this.getContentEnd()) != -1) {
				return this._setErr(XMLP.ERR_DOC_STRUCTURE);
            }
        }

        if((XMLP._ELM_B == iEvent) || (XMLP._ELM_EMP == iEvent)) {
            this.m_iState = XMLP._STATE_DOCUMENT;
            // Don't return - fall through to next state
        }
    }
    if(XMLP._STATE_DOCUMENT == this.m_iState) {
        if((XMLP._ELM_B == iEvent) || (XMLP._ELM_EMP == iEvent)) {
            this.m_stack.push(this.getName());
        }

        if((XMLP._ELM_E == iEvent) || (XMLP._ELM_EMP == iEvent)) {
            var strTop = this.m_stack.pop();
            if((strTop == null) || (strTop != this.getName())) {
                return this._setErr(XMLP.ERR_ELM_NESTING);
            }
        }

        if(this.m_stack.count() == 0) {
            this.m_iState = XMLP._STATE_MISC;
            return iEvent;
        }
    }
    if(XMLP._STATE_MISC == this.m_iState) {
		if((XMLP._ELM_B == iEvent) || (XMLP._ELM_E == iEvent) || (XMLP._ELM_EMP == iEvent) || (XMLP.EVT_DTD == iEvent)) {
			return this._setErr(XMLP.ERR_DOC_STRUCTURE);
        }

        if((XMLP._TEXT == iEvent) || (XMLP._ENTITY == iEvent)) {
			if(SAXStrings.indexOfNonWhitespace(this.getContent(), this.getContentBegin(), this.getContentEnd()) != -1) {
				return this._setErr(XMLP.ERR_DOC_STRUCTURE);
            }
        }
    }

    return iEvent;

}

XMLP.prototype._clearAttributes = function() {
    this.m_atts = new Array();
}

XMLP.prototype._findAttributeIndex = function(name) {
    for(var i = 0; i < this.m_atts.length; i++) {
        if(this.m_atts[i][XMLP._ATT_NAME] == name) {
            return i;
        }
    }
    return -1;

}

XMLP.prototype.getAttributeCount = function() {
    return this.m_atts ? this.m_atts.length : 0;
}

XMLP.prototype.getAttributeName = function(index) {
    return ((index < 0) || (index >= this.m_atts.length)) ? null : this.m_atts[index][XMLP._ATT_NAME];
}

XMLP.prototype.getAttributeValue = function(index) {
    return ((index < 0) || (index >= this.m_atts.length)) ? null : __unescapeString(this.m_atts[index][XMLP._ATT_VAL]);
}

XMLP.prototype.getAttributeValueByName = function(name) {
    return this.getAttributeValue(this._findAttributeIndex(name));
}

XMLP.prototype.getColumnNumber = function() {
    return SAXStrings.getColumnNumber(this.m_xml, this.m_iP);
}

XMLP.prototype.getContent = function() {
    return (this.m_cSrc == XMLP._CONT_XML) ? this.m_xml : this.m_cAlt;
}

XMLP.prototype.getContentBegin = function() {
    return this.m_cB;
}

XMLP.prototype.getContentEnd = function() {
    return this.m_cE;
}

XMLP.prototype.getLineNumber = function() {
    return SAXStrings.getLineNumber(this.m_xml, this.m_iP);
}

XMLP.prototype.getName = function() {
    return this.m_name;
}

XMLP.prototype.pause = function(){
    this.m_pause = true;
}

XMLP.prototype.resume = function(){
    this.m_pause = false;
    this.m_iState = this.m_preInterruptIState;
}

XMLP.prototype.next = function() {
    if(!this.m_pause){
        return this._checkStructure(this._parse());
    }
    else{
        //save off the current event loop state and set the state to interrupt
        this.m_preInterruptIState = this.m_iState;
        return XMLP._INTERRUPT;
    }
}

XMLP.prototype._parse = function() {
    if(this.m_iP == this.m_xml.length) {
        return XMLP._NONE;
    }

    var fc = this.m_xml.charAt(this.m_iP);
    if (fc !== '<' && fc !== '&') {
        return this._parseText   (this.m_iP);
    }
    else if(this.m_iP == this.m_xml.indexOf("<?",        this.m_iP)) {
        return this._parsePI     (this.m_iP + 2);
    }
    else if(this.m_iP == this.m_xml.indexOf("<!DOCTYPE", this.m_iP)) {
        return this._parseDTD    (this.m_iP + 9);
    }
    else if(this.m_iP == this.m_xml.indexOf("<!--",      this.m_iP)) {
        return this._parseComment(this.m_iP + 4);
    }
    else if(this.m_iP == this.m_xml.indexOf("<![CDATA[", this.m_iP)) {
        return this._parseCDATA  (this.m_iP + 9);
    }
    else if(this.m_iP == this.m_xml.indexOf("<",         this.m_iP)) {
        return this._parseElement(this.m_iP + 1);
    }
    else if(this.m_iP == this.m_xml.indexOf("&",         this.m_iP)) {
        return this._parseEntity (this.m_iP + 1);
    }
    else{
        return this._parseText   (this.m_iP);
    }

}

////////// NAMESPACE SUPPORT //////////////////////////////////////////
XMLP.prototype._parsePrefixAndElementName = function (elementlabel){
    splits = elementlabel.split(':',2);
    return { prefix : ((splits.length === 1) ? '' : splits[0]), name : ((splits.length === 1) ? elementlabel : splits[1]), };
}

XMLP.prototype._parseNamespacesAndAtts = function (atts){
   //translate namespaces into objects with "prefix","uri", "scopetag" Add them to: this.m_namespaceList
   //The function should return a new list of tag attributes with the namespaces filtered
    that = this;
    var newnamespaces = [];
    var filteredatts = [];
    atts.map(function (item){
        if(item[0].slice(0,5) === "xmlns"){
            newnamespaces.push({
                                   prefix : item[0].slice(6),
                                   uri : item[1],
                                   scopetag : that.m_name,
                                });
        }
        else{
            filteredatts.push(item);
        }
        return "not used";
    });
    this.m_namespaceList = this.m_namespaceList.concat(newnamespaces);
    return [ filteredatts, newnamespaces.map(function(item){return [item.prefix,item.uri];}) ];
}

XMLP.prototype._getContextualNamespace = function (prefix){
    if(prefix !== ''){
        for(item in this.m_namespaceList){
            item = this.m_namespaceList[item];
            if(item.prefix === prefix){
                return item.uri;
            }
        }
    }

    //no match was found for the prefix so pop off the first non-prefix namespace
    for(var i = (this.m_namespaceList.length-1); i>= 0; i--){
        var item = this.m_namespaceList[i];
        if(item.prefix === ''){
            return item.uri;
        }
    }

    //still nothing, lets just return an empty string
    return '';
}

XMLP.prototype._removeExpiredNamesapces = function (closingtagname) {
    //remove the expiring namespaces from the list (you can id them by scopetag)
    var keeps = [];
    this.m_namespaceList.map(function (item){
        if(item.scopetag !== closingtagname){
            keeps.push(item);
        }
    });

    this.m_namespaceList = keeps;

}

////////////////////////////////////////////////////////////////////////

XMLP.prototype._parseAttribute = function(iB, iE) {
    var iNB, iNE, iEq, iVB, iVE;
    var cQuote, strN, strV;

	this.m_cAlt = ""; //resets the value so we don't use an old one by accident (see testAttribute7 in the test suite)

	iNB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
    if((iNB == -1) ||(iNB >= iE)) {
        return iNB;
    }

    iEq = this.m_xml.indexOf("=", iNB);
    if((iEq == -1) || (iEq > iE)) {
        return this._setErr(XMLP.ERR_ATT_VALUES);
    }

    iNE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iNB, iEq);

    iVB = SAXStrings.indexOfNonWhitespace(this.m_xml, iEq + 1, iE);
    if((iVB == -1) ||(iVB > iE)) {
        return this._setErr(XMLP.ERR_ATT_VALUES);
    }

    cQuote = this.m_xml.charAt(iVB);
    if(SAXStrings.QUOTES.indexOf(cQuote) == -1) {
        return this._setErr(XMLP.ERR_ATT_VALUES);
    }

    iVE = this.m_xml.indexOf(cQuote, iVB + 1);
    if((iVE == -1) ||(iVE > iE)) {
        return this._setErr(XMLP.ERR_ATT_VALUES);
    }

    strN = this.m_xml.substring(iNB, iNE + 1);
    strV = this.m_xml.substring(iVB + 1, iVE);

    if(strN.indexOf("<") != -1) {
        return this._setErr(XMLP.ERR_ATT_LT_NAME);
    }

    if(strV.indexOf("<") != -1) {
        return this._setErr(XMLP.ERR_ATT_LT_VALUE);
    }

    strV = SAXStrings.replace(strV, null, null, "\n", " ");
    strV = SAXStrings.replace(strV, null, null, "\t", " ");
	iRet = this._replaceEntities(strV);
    if(iRet == XMLP._ERROR) {
        return iRet;
    }

    strV = this.m_cAlt;

    if(this._findAttributeIndex(strN) == -1) {
        this._addAttribute(strN, strV);
    }
    else {
        return this._setErr(XMLP.ERR_ATT_DUP);
    }

    this.m_iP = iVE + 2;

    return XMLP._ATT;

}

XMLP.prototype._parseCDATA = function(iB) {
    var iE = this.m_xml.indexOf("]]>", iB);
    if (iE == -1) {
        //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
        this.m_chunkTransitionContinuation = this.m_xml.slice(iB-9);//the '-<![CDATA[ adds the '<!DOCTYPE' back into the string
        return XMLP._INTERRUPT;
        //return this._setErr(XMLP.ERR_CLOSE_CDATA);
    }

    this._setContent(XMLP._CONT_XML, iB, iE);

    this.m_iP = iE + 3;

    return XMLP._CDATA;

}

XMLP.prototype._parseComment = function(iB) {
    var iE = this.m_xml.indexOf("-" + "->", iB);
    if (iE == -1) {
        //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
        this.m_chunkTransitionContinuation = this.m_xml.slice(iB-4);//the '-4' adds the '<!--' back into the string
        return XMLP._INTERRUPT;
        //return this._setErr(XMLP.ERR_CLOSE_COMMENT);
    }

    this._setContent(XMLP._CONT_XML, iB, iE);

    this.m_iP = iE + 3;

    return XMLP._COMMENT;

}

XMLP.prototype._parseDTD = function(iB) {
    // Eat DTD
    var iE, strClose, iInt, iLast;

    iE = this.m_xml.indexOf(">", iB);
    if(iE == -1) {
        //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
        this.m_chunkTransitionContinuation = this.m_xml.slice(iB-9);//the '-9' adds the '<!DOCTYPE' back into the string
        return XMLP._INTERRUPT;
        //return this._setErr(XMLP.ERR_CLOSE_DTD);
    }

    iInt = this.m_xml.indexOf("[", iB);
    strClose = ((iInt != -1) && (iInt < iE)) ? "]>" : ">";

    while(true) {
        // DEBUG: Remove
        if(iE == iLast) {
            return this._setErr(XMLP.ERR_INFINITELOOP);
        }

        iLast = iE;
        // DEBUG: Remove End

        iE = this.m_xml.indexOf(strClose, iB);
        if(iE == -1) {
            return this._setErr(XMLP.ERR_CLOSE_DTD);
        }

        // Make sure it is not the end of a CDATA section
        if (this.m_xml.substring(iE - 1, iE + 2) != "]]>") {
            break;
        }
    }

    this.m_iP = iE + strClose.length;

    return XMLP._DTD;

}

XMLP.prototype._parseElement = function(iB) {
    sys = require('sys');
    var iE, iDE, iNE, iRet;
    var iType, strN, iLast;

    iDE = iE = this.m_xml.indexOf(">", iB);
    if(iE == -1) {
        //This element never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
        this.m_chunkTransitionContinuation = this.m_xml.slice(iB-1);//the '-1' adds the '<' back into the string
        return XMLP._INTERRUPT;
        //return this._setErr(XMLP.ERR_CLOSE_ELM);
    }

    if(this.m_xml.charAt(iB) == "/") {
        iType = XMLP._ELM_E;
        iB++;
    } else {
        iType = XMLP._ELM_B;
    }

    if(this.m_xml.charAt(iE - 1) == "/") {
        if(iType == XMLP._ELM_E) {
            return this._setErr(XMLP.ERR_ELM_EMPTY);
        }
        iType = XMLP._ELM_EMP;
        iDE--;
    }

    iDE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iB, iDE);

    //djohack
    //hack to allow for elements with single character names to be recognized

    if (iE - iB != 1 ) {
        if(SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iDE) != iB) {
            return this._setErr(XMLP.ERR_ELM_NAME);
        }
    }
    // end hack -- original code below

    /*
    if(SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iDE) != iB)
        return this._setErr(XMLP.ERR_ELM_NAME);
    */
    this._clearAttributes();

    iNE = SAXStrings.indexOfWhitespace(this.m_xml, iB, iDE);
    if(iNE == -1) {
        iNE = iDE + 1;
    }
    else {
        this.m_iP = iNE;
        while(this.m_iP < iDE) {
            // DEBUG: Remove
            if(this.m_iP == iLast) return this._setErr(XMLP.ERR_INFINITELOOP);
            iLast = this.m_iP;
            // DEBUG: Remove End

            iRet = this._parseAttribute(this.m_iP, iDE);
            if(iRet == XMLP._ERROR) return iRet;
        }
    }

    strN = this.m_xml.substring(iB, iNE);

    if(strN.indexOf("<") != -1) {
        return this._setErr(XMLP.ERR_ELM_LT_NAME);
    }

    this.m_name = strN;
    this.m_iP = iE + 1;

    return iType;

}

XMLP.prototype._parseEntity = function(iB) {
    var iE = this.m_xml.indexOf(";", iB);
    if(iE == -1) {
        //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
        this.m_chunkTransitionContinuation = this.m_xml.slice(iB-1);//the '-1' adds the '&' back into the string
        return XMLP._INTERRUPT;
        //return this._setErr(XMLP.ERR_CLOSE_ENTITY);
    }

    this.m_iP = iE + 1;

    return this._replaceEntity(this.m_xml, iB, iE);

}

XMLP.prototype._parsePI = function(iB) {
    var iE, iTB, iTE, iCB, iCE;

    iE = this.m_xml.indexOf("?>", iB);
    if(iE   == -1) {
        //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
        this.m_chunkTransitionContinuation = this.m_xml.slice(iB-2);//the '-2' adds the '?>' back into the string
        return XMLP._INTERRUPT;
        return this._setErr(XMLP.ERR_CLOSE_PI);
    }

    iTB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
    if(iTB == -1) {
        return this._setErr(XMLP.ERR_PI_TARGET);
    }

    iTE = SAXStrings.indexOfWhitespace(this.m_xml, iTB, iE);
    if(iTE  == -1) {
        iTE = iE;
    }

    iCB = SAXStrings.indexOfNonWhitespace(this.m_xml, iTE, iE);
    if(iCB == -1) {
        iCB = iE;
    }

    iCE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iCB, iE);
    if(iCE  == -1) {
        iCE = iE - 1;
    }

    this.m_name = this.m_xml.substring(iTB, iTE);
    this._setContent(XMLP._CONT_XML, iCB, iCE + 1);
    this.m_iP = iE + 2;

    return XMLP._PI;

}

XMLP.prototype._parseText = function(iB) {
    var iE, ch;

    for (iE=iB; iE<this.m_xml.length; ++iE) {
        ch = this.m_xml.charAt(iE);
        if (ch === '<' || ch === '&') {
            break;
        }
    }

    this._setContent(XMLP._CONT_XML, iB, iE);

    this.m_iP = iE;

    return XMLP._TEXT;

}

XMLP.prototype._replaceEntities = function(strD, iB, iE) {
    if(SAXStrings.isEmpty(strD)) return "";
    iB = iB || 0;
    iE = iE || strD.length;

    var iEB, iEE, strRet = "";

    iEB = strD.indexOf("&", iB);
    iEE = iB;

    while((iEB > 0) && (iEB < iE)) {
        strRet += strD.substring(iEE, iEB);

        iEE = strD.indexOf(";", iEB) + 1;

        if((iEE == 0) || (iEE > iE)) {
            return this._setErr(XMLP.ERR_CLOSE_ENTITY);
        }

        iRet = this._replaceEntity(strD, iEB + 1, iEE - 1);
        if(iRet == XMLP._ERROR) {
            return iRet;
        }

        strRet += this.m_cAlt;

        iEB = strD.indexOf("&", iEE);
    }

    if(iEE != iE) {
        strRet += strD.substring(iEE, iE);
    }

    this._setContent(XMLP._CONT_ALT, strRet);

    return XMLP._ENTITY;

}

XMLP.prototype._replaceEntity = function(strD, iB, iE) {
    if(SAXStrings.isEmpty(strD)) return -1;
    iB = iB || 0;
    iE = iE || strD.length;

    /*
    switch(strD.substring(iB, iE)) {
        case "amp":  strEnt = "&";  break;
        case "lt":   strEnt = "<";  break;
        case "gt":   strEnt = ">";  break;
        case "apos": strEnt = "'";  break;
        case "quot": strEnt = "\""; break;
        case "nbsp":strEnt = ''; break;
        case "lt":strEnt = '<'; break;
        case "gt":strEnt = '>'; break;
        case "amp":strEnt = '&'; break;
        case "cent":strEnt = "¢"; break;
        case "pound":strEnt = '£'; break;
        case "yen":strEnt = '¥'; break;
        case "euro":strEnt = '€'; break;
        case "sect":strEnt = '§'; break;
        case "copy":strEnt = '©'; break;
        case "reg":strEnt = '®'; break;
        default:
            if(strD.charAt(iB) == "#") {
                strEnt = String.fromCharCode(parseInt(strD.substring(iB + 1, iE)));
            } else {
                strEnt = ' ';
                //return this._setErr(XMLP.ERR_ENTITY_UNKNOWN);
            }
        break;
    }
    */
    strEnt = '&' + strD.substring(iB, iE) + ';'

    this._setContent(XMLP._CONT_ALT, strEnt);

    return XMLP._ENTITY;
}

XMLP.prototype._setContent = function(iSrc) {
    var args = arguments;

    if(XMLP._CONT_XML == iSrc) {
        this.m_cAlt = null;
        this.m_cB = args[1];
        this.m_cE = args[2];
    } else {
        this.m_cAlt = args[1];
        this.m_cB = 0;
        this.m_cE = args[1].length;
    }
    this.m_cSrc = iSrc;

}

XMLP.prototype._setErr = function(iErr) {
    var strErr = XMLP._errs[iErr];

    this.m_cAlt = strErr;
    this.m_cB = 0;
    this.m_cE = strErr.length;
    this.m_cSrc = XMLP._CONT_ALT;

    return XMLP._ERROR;

}  // end function _setErr

//SaxParser is an object that basically wraps an XMLP instance, and provides an
//event-based interface for parsing. This is the object users interact with when coding
//with XML for <SCRIPT>
var SaxParser = function(eventhandlerfactory) {

    var eventhandler = new function(){

    }

    var thehandler = function() {};
    thehandler.prototype.onStartDocument = function (funct){
      eventhandler.onStartDocument = funct;
    }
    thehandler.prototype.onEndDocument = function (funct){
      eventhandler.onEndDocument = funct;
    }
    thehandler.prototype.onStartElementNS = function (funct){
      eventhandler.onStartElementNS = funct;
    }
    thehandler.prototype.onEndElementNS = function (funct){
      eventhandler.onEndElementNS = funct;
    }
    thehandler.prototype.onCharacters = function(funct) {
      eventhandler.onCharacters = funct;
    }
    thehandler.prototype.onCdata = function(funct) {
      eventhandler.onCdata = funct;
    }
    thehandler.prototype.onComment = function(funct) {
      eventhandler.onComment = funct;
    }
    thehandler.prototype.onWarning = function(funct) {
      eventhandler.onWarning = funct;
    }

    thehandler.prototype.onError = function(funct) {
      eventhandler.onError = funct;
    }

    eventhandlerfactory(new thehandler());
    //eventhandler = eventhandler(eventhandler);
    this.m_hndDoc = eventhandler;
    this.m_hndErr = eventhandler;
    this.m_hndLex = eventhandler;
    this.m_interrupted = false;
}

// CONSTANTS    (these must be below the constructor)
SaxParser.DOC_B = 1;
SaxParser.DOC_E = 2;
SaxParser.ELM_B = 3;
SaxParser.ELM_E = 4;
SaxParser.CHARS = 5;
SaxParser.PI    = 6;
SaxParser.CD_B  = 7;
SaxParser.CD_E  = 8;
SaxParser.CMNT  = 9;
SaxParser.DTD_B = 10;
SaxParser.DTD_E = 11;

SaxParser.prototype.parseFile = function(filename) { //This function will only work in the node.js environment.
    var fs = require('fs');
    var that = this;
    fs.readFile(filename, function (err, data) {
      that.parseString(data);
    });
}

SaxParser.prototype.parseString = function(strD) {
    sys = require('sys');
    var that = this;

    setTimeout(function(){
            var startnew = true;
            if(!that.m_parser){
                that.m_parser = new XMLP(strD);
                startnew = false;
            }
            else{
                that.m_parser.continueParsing(strD);
                startnew = true;
            }

            //if(that.m_hndDoc && that.m_hndDoc.setDocumentLocator) {
            //    that.m_hndDoc.setDocumentLocator(that);
            //}

            that.m_bErr = false;

            if(!that.m_bErr && !startnew) {
                that._fireEvent(SaxParser.DOC_B);
            }
            that._parseLoop();
            if(!that.m_bErr && !that.m_interrupted) {
                that._fireEvent(SaxParser.DOC_E);
            }

            that.m_xml = null;
            that.m_iP = 0;
            that.m_interrupted = false;
    }, 0);

}

SaxParser.prototype.pause = function() {
    this.m_parser.pause();
}

SaxParser.prototype.resume = function() {
    //reset the state
    this.m_parser.resume();
    //now start up the parse loop
    var that = this;
    setTimeout(function(){
            that._parseLoop();
    }, 0);
}

SaxParser.prototype.setDocumentHandler = function(hnd) {
    this.m_hndDoc = hnd;
}

SaxParser.prototype.setErrorHandler = function(hnd) {
    this.m_hndErr = hnd;
}

SaxParser.prototype.setLexicalHandler = function(hnd) {
    this.m_hndLex = hnd;
}

SaxParser.prototype.getColumnNumber = function() {
    return this.m_parser.getColumnNumber();
}

SaxParser.prototype.getLineNumber = function() {
    return this.m_parser.getLineNumber();
}

SaxParser.prototype.getMessage = function() {
    return this.m_strErrMsg;
}

SaxParser.prototype.getPublicId = function() {
    return null;
}

SaxParser.prototype.getSystemId = function() {
    return null;
}

SaxParser.prototype.getLength = function() {
    return this.m_parser.getAttributeCount();
}

SaxParser.prototype.getName = function(index) {
    return this.m_parser.getAttributeName(index);
}

SaxParser.prototype.getValue = function(index) {
    return this.m_parser.getAttributeValue(index);
}

SaxParser.prototype.getValueByName = function(name) {
    return this.m_parser.getAttributeValueByName(name);
}

SaxParser.prototype._fireError = function(strMsg) {
    this.m_strErrMsg = strMsg;
    this.m_bErr = true;

    if(this.m_hndErr && this.m_hndErr.onError) {
        this.m_hndErr.onError(this.m_strErrMsg);
    }
}

SaxParser.prototype._fireEvent = function(iEvt) {
    var hnd, func, args = arguments, iLen = args.length - 1;

    if(this.m_bErr) return;

    if(SaxParser.DOC_B == iEvt) {
        func = "onStartDocument";         hnd = this.m_hndDoc;
    }
    else if (SaxParser.DOC_E == iEvt) {
        func = "onEndDocument";           hnd = this.m_hndDoc;
    }
    else if (SaxParser.ELM_B == iEvt) {
        func = "onStartElementNS";          hnd = this.m_hndDoc;
    }
    else if (SaxParser.ELM_E == iEvt) {
        func = "onEndElementNS";            hnd = this.m_hndDoc;
    }
    else if (SaxParser.CHARS == iEvt) {
        func = "onCharacters";            hnd = this.m_hndDoc;
    }
    else if (SaxParser.PI    == iEvt) {
        func = "processingInstruction"; hnd = this.m_hndDoc;
    }
    else if (SaxParser.CD_B  == iEvt) {
        func = "onCdata";            hnd = this.m_hndLex;
    }
    else if (SaxParser.CD_E  == iEvt) {
        func = "onEndCDATA";              hnd = this.m_hndLex;
    }
    else if (SaxParser.CMNT  == iEvt) {
        func = "onComment";               hnd = this.m_hndLex;
    }

    if(hnd && hnd[func]) {
        if(0 == iLen) {
            hnd[func]();
        }
        else if (1 == iLen) {
            hnd[func](args[1]);
        }
        else if (2 == iLen) {
            hnd[func](args[1], args[2]);
        }
        else if (3 == iLen) {
            hnd[func](args[1], args[2], args[3]);
        }
        else if (4 == iLen) {
            hnd[func](args[1], args[2], args[3], args[4]);
        }
        else if (5 == iLen) {
            hnd[func](args[1], args[2], args[3], args[4], args[5]);
        }
    }

}

SaxParser.prototype._parseLoop = function(parser) {
    var iEvent, parser;

    parser = this.m_parser;
    while(!this.m_bErr) {
        iEvent = parser.next();

        if(iEvent == XMLP._ELM_B) {
            theatts = this.m_parser.m_atts;
            nameobject = parser._parsePrefixAndElementName(parser.getName());
            theattsandnamespace = parser._parseNamespacesAndAtts(theatts);
            var theuri = parser._getContextualNamespace(nameobject.prefix);
            this._fireEvent(SaxParser.ELM_B, nameobject.name, theattsandnamespace[0], (nameobject.prefix === '')? null : nameobject.prefix, (theuri === '')? null : theuri ,theattsandnamespace[1] );
        }
        else if(iEvent == XMLP._ELM_E) {
            nameobject = parser._parsePrefixAndElementName(parser.getName());
            var theuri = parser._getContextualNamespace(nameobject.prefix);
            parser._removeExpiredNamesapces(parser.getName());
            this._fireEvent(SaxParser.ELM_E, nameobject.name, (nameobject.prefix === '')? null : nameobject.prefix, (theuri === '')? null : theuri);
        }
        else if(iEvent == XMLP._ELM_EMP) {
            //this is both a begin and end element
            theatts = this.m_parser.m_atts;
            nameobject = parser._parsePrefixAndElementName(parser.getName());
            theattsandnamespace = parser._parseNamespacesAndAtts(theatts);
            var theuri = parser._getContextualNamespace(nameobject.prefix);
            this._fireEvent(SaxParser.ELM_B, nameobject.name, theattsandnamespace[0], (nameobject.prefix === '')? null : nameobject.prefix, (theuri === '')? null : theuri ,theattsandnamespace[1] );

            parser._removeExpiredNamesapces(parser.getName());
            this._fireEvent(SaxParser.ELM_E, nameobject.name, (nameobject.prefix === '')? null : nameobject.prefix, (theuri === '')? null : theuri);
            //this._fireEvent(SaxParser.ELM_B, parser.getName(), this.m_parser.m_atts.map(function(item){return { name : item[0], value : item[1], };}) );
            //this._fireEvent(SaxParser.ELM_E, parser.getName());
        }
        else if(iEvent == XMLP._TEXT) {
            this._fireEvent(SaxParser.CHARS, parser.getContent().slice(parser.getContentBegin(),parser.getContentEnd()));
        }
        else if(iEvent == XMLP._ENTITY) {
            this._fireEvent(SaxParser.CHARS, parser.getContent(), parser.getContentBegin(), parser.getContentEnd() - parser.getContentBegin());
        }
        else if(iEvent == XMLP._PI) {
            this._fireEvent(SaxParser.PI, parser.getName(), parser.getContent().substring(parser.getContentBegin(), parser.getContentEnd()));
        }
        else if(iEvent == XMLP._CDATA) {
            this._fireEvent(SaxParser.CD_B, parser.getContent().slice(parser.getContentBegin(),parser.getContentEnd()));
            //this._fireEvent(SaxParser.CHARS, parser.getContent(), parser.getContentBegin(), parser.getContentEnd() - parser.getContentBegin());
            //this._fireEvent(SaxParser.CD_E);
        }
        else if(iEvent == XMLP._COMMENT) {
            this._fireEvent(SaxParser.CMNT, parser.getContent().slice(parser.getContentBegin(),parser.getContentEnd()));
        }
        else if(iEvent == XMLP._DTD) {
        }
        else if(iEvent == XMLP._ERROR) {
            this._fireError(parser.getContent());
        }
        else if(iEvent == XMLP._INTERRUPT){
            this.m_interrupted = true;
            return;//just return and wait to be restarted
        }
        else if(iEvent == XMLP._NONE) {
            return;
        }
    }

}

//SAXStrings: a useful object containing string manipulation functions
var SAXStrings = function() {
//This is the constructor of the SAXStrings object
}

// CONSTANTS    (these must be below the constructor)
SAXStrings.WHITESPACE = " \t\n\r";
SAXStrings.QUOTES = "\"'";

SAXStrings.getColumnNumber = function(strD, iP) {
    if(SAXStrings.isEmpty(strD)) {
        return -1;
    }
    iP = iP || strD.length;

    var arrD = strD.substring(0, iP).split("\n");
    var strLine = arrD[arrD.length - 1];
    arrD.length--;
    var iLinePos = arrD.join("\n").length;

    return iP - iLinePos;

}

SAXStrings.getLineNumber = function(strD, iP) {
    if(SAXStrings.isEmpty(strD)) {
        return -1;
    }
    iP = iP || strD.length;

    return strD.substring(0, iP).split("\n").length
}

SAXStrings.indexOfNonWhitespace = function(strD, iB, iE) {
    if(SAXStrings.isEmpty(strD)) {
        return -1;
    }
    iB = iB || 0;
    iE = iE || strD.length;

    for(var i = iB; i < iE; i++){
        if(SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
            return i;
        }
    }
    return -1;
}

SAXStrings.indexOfWhitespace = function(strD, iB, iE) {
    if(SAXStrings.isEmpty(strD)) {
        return -1;
    }
    iB = iB || 0;
    iE = iE || strD.length;

    for(var i = iB; i < iE; i++) {
        if(SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) != -1) {
            return i;
        }
    }
    return -1;
}

SAXStrings.isEmpty = function(strD) {
    return (strD == null) || (strD.length == 0);
}

SAXStrings.lastIndexOfNonWhitespace = function(strD, iB, iE) {
    if(SAXStrings.isEmpty(strD)) {
        return -1;
    }
    iB = iB || 0;
    iE = iE || strD.length;

    for(var i = iE - 1; i >= iB; i--){
        if(SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1){
            return i;
        }
    }
    return -1;
}

SAXStrings.replace = function(strD, iB, iE, strF, strR) {
    if(SAXStrings.isEmpty(strD)) {
        return "";
    }
    iB = iB || 0;
    iE = iE || strD.length;

    return strD.toString().substring(iB, iE).split(strF).join(strR);

}

var Stack = function() {
    this.m_arr = new Array();
}

Stack.prototype.clear = function() {
    this.m_arr = new Array();
}

Stack.prototype.count = function() {
    return this.m_arr.length;
}

Stack.prototype.destroy = function() {
    this.m_arr = null;
}

Stack.prototype.peek = function() {
    if(this.m_arr.length == 0) {
        return null;
    }

    return this.m_arr[this.m_arr.length - 1];

}

Stack.prototype.pop = function() {
    if(this.m_arr.length == 0) {
        return null;
    }

    var o = this.m_arr[this.m_arr.length - 1];
    this.m_arr.length--;
    return o;

}

Stack.prototype.push = function(o) {
    this.m_arr[this.m_arr.length] = o;
}

// CONVENIENCE FUNCTIONS
function isEmpty(str) {
     return (str==null) || (str.length==0);
}

function trim(trimString, leftTrim, rightTrim) {
    if (isEmpty(trimString)) {
        return "";
    }

    // the general focus here is on minimal method calls - hence only one
    // substring is done to complete the trim.

    if (leftTrim == null) {
        leftTrim = true;
    }

    if (rightTrim == null) {
        rightTrim = true;
    }

    var left=0;
    var right=0;
    var i=0;
    var k=0;

    // modified to properly handle strings that are all whitespace
    if (leftTrim == true) {
        while ((i<trimString.length) && (whitespace.indexOf(trimString.charAt(i++))!=-1)) {
            left++;
        }
    }
    if (rightTrim == true) {
        k=trimString.length-1;
        while((k>=left) && (whitespace.indexOf(trimString.charAt(k--))!=-1)) {
            right++;
        }
    }
    return trimString.substring(left, trimString.length - right);
}

function __escapeString(str) {

    var escAmpRegEx = /&/g;
    var escLtRegEx = /</g;
    var escGtRegEx = />/g;
    var quotRegEx = /"/g;
    var aposRegEx = /'/g;

    str = str.replace(escAmpRegEx, "&");
    str = str.replace(escLtRegEx, "<");
    str = str.replace(escGtRegEx, ">");
    str = str.replace(quotRegEx, """);
    str = str.replace(aposRegEx, "'");

  return str;
}

function __unescapeString(str) {

    var escAmpRegEx = /&/g;
    var escLtRegEx = /</g;
    var escGtRegEx = />/g;
    var quotRegEx = /"/g;
    var aposRegEx = /'/g;

    str = str.replace(escAmpRegEx, "&");
    str = str.replace(escLtRegEx, "<");
    str = str.replace(escGtRegEx, ">");
    str = str.replace(quotRegEx, "\"");
    str = str.replace(aposRegEx, "'");

  return str;
}

exports.SaxParser = SaxParser;

})()


text:
using UnityEngine;
using System.Collections;

public class BuildingManager : MonoBehaviour {

    public GameObject selectedTower;
	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {

	}

    public void SelectTowerType(GameObject prefab)
    {
        selectedTower = prefab;
        CoreBehaviour.upgradeOn = false;
        CoreBehaviour.buildOn = true;
    }
    public void UpgradeTower(GameObject prefab)
    {
        CoreBehaviour.upgradeOn = true;
        CoreBehaviour.buildOn = false;

    }
}


text:
import React from 'react';

export default class ChatTabMessageEmote extends React.Component {
	getStyle() {
		return {
			width: '2em',
			padding: '2px',
			verticalAlign: 'middle'
		};
	}

	render() {
		return (
			<img style={this.getStyle()} src={'https://static-cdn.jtvnw.net/emoticons/v1/' + this.props.id + '/2.0'}/>
		);
	}
}


text:
This sample demonstrates one way you can integrate the `@azure/msal-browser` package into your Vue 3 application using the [composition API](https://v3.vuejs.org/api/composition-api.html). It is not exhaustive and there may be simpler or more complex solutions depending on your specific use case.

⚠ This sample is currently for demonstration purposes only. Support will be limited.

## How to run the sample

### Pre-requisites

- Ensure [all pre-requisites](../../../lib/msal-browser/README.md#prerequisites) have been completed to run `@azure/msal-browser`.
- Install node.js if needed (<https://nodejs.org/en/>).

### Configure the application

- Open `./src/authConfig.js` in an editor.
- Replace client id with the Application (client) ID from the portal registration, or use the currently configured lab registration.
  - Optionally, you may replace any of the other parameters, or you can remove them and use the default values.

### Install npm dependencies for sample

```bash
npm install
```

### Running the sample

```bash
npm start
```

1. Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

- In the web page, hover over the "Sign In" button and select either `Sign in using Popup` or `Sign in using Redirect` to begin the auth flow.
- Navigate directly to one of the example pages (/profile or /profilenoguard) to invoke a login on page load and see your profile information using the Microsoft Graph API

## How this sample works

This sample demonstrates how you can integrate `@azure/msal-browser` into your Vue application. It is best if you familiarize yourself with the `@azure/msal-browser` package first, as this sample will build on many of the concepts defined there. You'll find the `msal-browser` package [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser) and you'll find a variety of docs you may find useful [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser/docs). The following sections will walk you through each part of this sample and explain a little bit about how it works.

### Configuration

You'll find the MSAL configuration and `PublicClientApplication` instantiation in `authConfig.ts`. It's very important that `PublicClientApplication` is initialized only once per pageload and as such should not be initialized inside any Vue components, but rather outside the context of Vue and passed in.

- The `clientId` is the most important, and only required parameter, as it maps to your app registration in the Azure Portal.
- The `authority` represents the Azure AD instance and tenant that MSAL.js will use the sign users in. This parameter controls the audience of your app.
    > :information_source: If you need to sign users in with Azure AD B2C, this parameter should be set to the [B2C tenanted authority](../../../lib/msal-common/docs/authority.md#azure-ad-b2c) with the default user-flow/custom policy that will be used for sign-ins and token acquisitions. To learn more about how to handle B2C user-flows and/or custom policies with MSAL.js, please refer to [react-b2c-sample](../../msal-react-samples/b2c-sample/) and/or [angular-b2c-sample](../../msal-angular-v2-samples/angular-b2c-sample-app/).
- The `redirectUri` and `postLogoutRedirectUri` represent where AAD will redirect you back to after logging in and must be registered on your app registration as type "SPA". If you do not provide these, MSAL.js will use the current page by default.

The `cacheLocation` configures where you want your tokens to be stored. SessionStorage is the default, if this option is not provided.

```javascript
const msalConfig = {
  auth: {
    clientId: 'ENTER_YOUR_CLIENT_ID_HERE',
    authority: 'https://login.microsoftonline.com/ENTER_YOUR_TENANT_ID_HERE',
    redirectUri: '/', // Must be registered as a SPA redirectURI on your app registration
    postLogoutRedirectUri: '/' // Must be registered as a SPA redirectURI on your app registrationregistration
  },
  cache: {
    cacheLocation: 'localStorage' // Options are localStorage, sessionStorage, memoryStorage
  },
};

export const msalInstance = new PublicClientApplication(msalConfig);
```

You can read more about configuring MSAL.js and the complete set of options [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md)

### MsalPlugin

MSAL.js integration with Vue all starts with the `msalPlugin` defined in `src/plugins/msalPlugin.ts`. When installed in your Vue app this plugin registers an event listener that manages some global state, such as any interaction currently in progress and the accounts signed in.

In `main.ts` you'll find the instantiation of the Vue app and installation of plugins. The most important part, with regards to MSAL.js, is to instruct Vue to "use" the `msalPlugin`.

```javascript
import { createApp } from 'vue';
import App from './App.vue'; // Your root component
import { msalPlugin } from "./plugins/msalPlugin";
import { msalInstance } from "./authConfig";

const app = createApp(App);
app.use(msalPlugin, msalInstance);
app.mount('#app');
```

### Composition APIs

This sample demonstrates how you can write a couple different composition APIs which can be called from the `setup` function of any of your Vue components that need to do something authentication related.

#### useMsal

This API will call `handleRedirectPromise` if it has not yet been called. This is very important if your application uses redirects instead of popups because this is what actually processes the response from your Identity Provider. It should be called at least once per page load before you do anything else related to authentication. If you are using popups as your interaction type, this is not needed.

This API also returns:

- The `PublicClientApplication` instance which you can use to call any of the [MSAL APIs](https://azuread.github.io/microsoft-authentication-library-for-js/ref/interfaces/_azure_msal_browser.ipublicclientapplication.html)
- A `ref` indicating what type of interaction is currently in progress.
- A `ref` of the array of accounts currently signed in

Basic examples of how this can be used can be found in each of the vue components located in `src/components`

#### useIsAuthenticated

Returns a `ref` indicating if a user is signed-in or not. The implementation in this sample says that a user is signed in if at least 1 account is present in the account array. More complex use cases may require a different implementation.

One example of how this could be used can be found in `src/components/NavBar.vue`. It is used as the condition for the `v-if` directive to conditionally render a Sign In or Sign Out button depending on the sign-in state of the user. This is reactive and will update as soon as the user signs in or out.

```vue
<template>
    <SignOutButton v-if="isAuthenticated"/>
    <SignInButton v-else />
</template>

<script setup lang="ts">
import { useIsAuthenticated } from '../composition-api/useIsAuthenticated';
import SignInButton from "./SignInButton.vue";
import SignOutButton from "./SignOutButton.vue";

const isAuthenticated = useIsAuthenticated();
</script>
```

#### useMsalAuthentication

Will attempt to silently acquire a token and fallback to interaction if no user is signed in or silent acquisition fails. This can be used instead of a route guard to protect components.

You must provide:

- Your preferred interaction type (Popup or Redirect) to be used in case the request cannot be completed silently
- The auth request that will be used to acquire the token. You can find the request/response types [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/request-response-object.md)

Returns:

- A `ref` of the `AuthenticationResult` object containing the accessToken and idToken, among other things. The full response object can be found [here](https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#authenticationresult)
- An `acquireToken` function that can be called from your Vue component when a new token is needed or to recover from an error. The other return values will be updated when this function is invoked.
- A `ref` of the error object if the token request failed for any reason
- An `ref` indicating if this instance of `useMsalAuthentication` is currently acquiring a token. (Note this is different from the inProgress value returned by `useMsal` which represents only interaction and is global)

Usage of this is demonstrated on the `/profilenoguard` route located in `src/views/ProfileNoGuard.vue`. A generic example can be seen below:

```vue
<template>
  <span>{{data}}</span>
</template>

<script setup lang="ts">
import { useMsalAuthentication } from "../composition-api/useMsalAuthentication";
import { InteractionType } from "@azure/msal-browser";
import { reactive, watch } from 'vue'
import { loginRequest } from "../authConfig";

const { result, acquireToken } = useMsalAuthentication(InteractionType.Redirect, loginRequest);

const data = ref(null);

async function updateData() {
    if (result.value.accessToken) {
        const apiResult = await callAPI(result.value.accessToken).catch(() => acquireToken());
        data.value = apiResult;
    }
}

updateData();

watch(result, () => {
    // Fetch new data from the API each time the result changes (i.e. a new access token was acquired)
    updateData();
});
</script>
```

### Integrating with vue-router

This sample demonstrates integration with the official router for vue: `vue-router`. The concepts here may also be relevant to other 3rd party routers, but the implementations may differ.

#### Configuring MSAL to use the router for route changes

When MSAL.js needs to change routes, such as when returning the user to the page they were trying to get to from the `redirectUri`, it will by default reassign `window.location`. This can be a problem when using routers because it will trigger a full page refresh, rerendering the entire page, which is not always desired. To take advantage of the benefits routers provide MSAL.js exposes an API called `setNavigationClient` which allows you to override the methods used to perform navigation.

An example navigation client for `vue-router` can be found in `src/router/NavigationClient.ts`. You'll also find the following 2 lines in `main.ts` which provides this custom navigation client to MSAL.js:

```javascript
const navigationClient = new CustomNavigationClient(router);
msalInstance.setNavigationClient(navigationClient);
```

#### Guarding routes

This sample also demonstrates how to write a global route guard if your application uses the `vue-router` package to handle routing.

In the router configuration, located in `src/router/router.ts`, we register the route we want to protect with a `meta.requiresAuth` property, like so:

```javascript
const routes = [
  {
    path: '/profile',
    name: 'Profile',
    component: Profile,
    meta: {
        requiresAuth: true
    }
  }
];
```

Then we register a global route guard, as shown in `src/router/Guard.ts`. A similar approach can be taken for [per route guards](https://router.vuejs.org/guide/advanced/navigation-guards.html#per-route-guard) instead, if desired.


text:
package com.yuntongxun.ecdemo.ui.chatting.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;

import com.patr.radix.R;
import com.yuntongxun.ecdemo.common.utils.DensityUtil;
import com.yuntongxun.ecdemo.ui.chatting.Capability;

import java.util.List;

/**
 * @author Jorstin Chan@容联•云通讯
 * @date 2014-12-10
 * @version 4.0
 */
public class AppGrid extends GridView implements
		AdapterView.OnItemClickListener {

	/**
	 *
	 */
	private Context mContext;

	private List<Capability> mCapabilities;

	/**
	 *
	 */
	private AppGirdApapter mGirdApapter;

	/**
	 *
	 */
	private OnCapabilityItemClickListener mOnCapabilityItemClickListener;

	/**
	 * The current panel tag No.
	 */
	private int mPanelIndex;

	/**
	 * The total count of Panel members
	 */
	private int mItems;

	/**
	 * The count of single Panel members
	 */
	private int mPageItems;

	/**
	 * The count of Panel index.
	 */
	private int mPanelPageCount;

	/**
	 * ccp capability items that reserve.
	 */
	private int mReserveItems;

	public AppGrid(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		mContext = context;
	}

	public AppGrid(Context context, AttributeSet attrs) {
		super(context, attrs);
		mContext = context;
	}

	public AppGrid(Context context) {
		super(context);
		mContext = context;
	}

	/**
	 *
	 * @param position
	 * @param items
	 * @param pageItems
	 * @param pageCount
	 * @param column
	 * @param reserve
	 */
	public void setAppPanelBase (int position , int items , int pageItems , int pageCount , int column , int reserve) {
		mPanelIndex = position;
		mItems = items;
		mPageItems = pageItems;
		mPanelPageCount = pageCount;
		mReserveItems = reserve;
		setNumColumns(column);
	}

	/**
	 *
	 * @param capabilities
	 */
	public void setAppPanelItems(List<Capability> capabilities) {

		mGirdApapter = new AppGirdApapter(getContext(), capabilities);
		setBackgroundResource(0);
		setAdapter(mGirdApapter);
		setOnItemClickListener(this);

		int left = DensityUtil.getMetricsDensity(mContext, 10.0F);
		int top = DensityUtil.getMetricsDensity(mContext, 6.0F);
		setPadding(left, top, left, 0);
	}

	public int getCount() {
		return this.mGirdApapter.getCount() - 1;
	}

	/**
	 *
	 * @param verticalSpacing
	 */
	public final void setPanelVerticalSpacing(int verticalSpacing) {
		if(verticalSpacing <= 0) {
			return;
		}
		int padding = DensityUtil.getMetricsDensity(mContext, 10.0F);
		setPadding(padding, verticalSpacing, padding, 0);
		setVerticalSpacing(verticalSpacing / 2);
	}

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {

		if(mGirdApapter != null && position <= mGirdApapter.getCount() - 1){
			Capability capability = (Capability) mGirdApapter.getItem(position);
			if(mOnCapabilityItemClickListener != null) {
				mOnCapabilityItemClickListener.onPanleItemClick(position, capability.getId() , capability.getCapabilityName());
			}
		}
	}

    /**
     * Register a callback to be invoked when an item in this {@link com.yuntongxun.ecdemo.ui.chatting.view.AppGrid} View has
     * been clicked.
     *
     * @param listener The callback that will be invoked.
     */
    public void setOnCapabilityItemClickListener(OnCapabilityItemClickListener listener) {
    	mOnCapabilityItemClickListener = listener;
    }

	 /**
     * Interface definition for a callback to be invoked when an item in this
     * AdapterView has been clicked.
     */
    public interface OnCapabilityItemClickListener {

       /**
        * Callback method to be invoked when an item in this EmojiGird View has
        * been clicked.
        *
        * @param index
        * @param capabilityName
        */
        void onPanleItemClick(int index, int capabilityId, String capabilityName);

    }

     private class AppGirdApapter extends BaseAdapter {

    	private List<Capability> mLists;
    	private int width;
    	private int height;

    	private LayoutInflater mLayoutInflater;

    	public AppGirdApapter(Context context , List<Capability> lists) {

    		mLists = lists;
    		width = DensityUtil.getMetricsDensity(context, 64.0F);
    		height = DensityUtil.getMetricsDensity(context, 53.299999F);
    		mLayoutInflater = LayoutInflater.from(context);
    	}

		@Override
		public int getCount() {

			return mItems;
		}

		@Override
		public Object getItem(int position) {

			return mLists.get(position);
		}

		@Override
		public long getItemId(int position) {

			return 0L;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {

			View view = null;
			ViewHolder mViewHolder = null;
			if(convertView == null || convertView.getTag() == null) {
				view = mLayoutInflater.inflate(R.layout.app_grid_item, parent, false);

				mViewHolder = new ViewHolder();
				mViewHolder.mCapabilityName = (TextView) view.findViewById(R.id.app_grid_item_name);
				mViewHolder.mCapabilityIcon = (ImageView) view.findViewById(R.id.app_grid_item_icon);
				mViewHolder.mCapabilityMask = (ImageView) view.findViewById(R.id.app_grid_item_icon_mask);
				view.setTag(mViewHolder);
			} else {
				view = convertView;
				mViewHolder = (ViewHolder) view.getTag();
			}

			Capability item = (Capability) getItem(position);
			if(item != null) {

				mViewHolder.mCapabilityName.setText(item.getCapabilityName());

				if(item.getIcon() > 0) {
					mViewHolder.mCapabilityIcon.setImageResource(item.getIcon());
				}
				mViewHolder.mCapabilityMask.setVisibility(View.VISIBLE);
			}

			return view;
		}

		class ViewHolder {
			TextView mCapabilityName;
			ImageView mCapabilityIcon;
			ImageView mCapabilityMask;
		}
    }
}


text:
package org.springframework.cloud.contract.verifier.messaging.kafka;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
import org.assertj.core.api.BDDAssertions;
import org.junit.jupiter.api.Test;

class KafkaMetadataTests {

	YAMLMapper mapper = new YAMLMapper();

	@Test
	void should_parse_the_metadata_entry() throws JsonProcessingException {
		// @formatter:off
		String yamlEntry = "kafka:\n"
				+ "  input:\n"
				+ "      connectToBroker:\n"
				+ "        additionalOptions: foo\n"
				+ "  outputMessage:\n"
				+ "      connectToBroker:\n"
				+ "        additionalOptions: bar";
		// @formatter:on

		KafkaMetadata metadata = KafkaMetadata
				.fromMetadata(this.mapper.readerForMapOf(Object.class).readValue(yamlEntry));

		String serialized = this.mapper.writer().forType(KafkaMetadata.class).writeValueAsString(metadata);
		BDDAssertions.then(serialized).isEqualToNormalizingPunctuationAndWhitespace(yamlEntry.replace("kafka:\n", ""));
	}

}


text:
Consul is used for service discovery of nodes and services in the cluster.

It has a number of key features -

- Key / value storage
- HTTP REST API
- DNS API
- Highly available / fault tolerant out of the box
- Health checks
- Multi-datacenter support out of the box

For a comparison of Consul against other service discovery backends see [https://www.consul.io/intro/vs/zookeeper.html](https://www.consul.io/intro/vs/zookeeper.html)

The main reasons for selecting Consul over the others are -

- DNS API providing lightweight integration with other tools / services
- Easy integration with Docker via the mesos-consul container. See [https://github.com/CiscoCloud/mesos-consul](https://github.com/CiscoCloud/mesos-consul)
- Easy integration with Weave. For more info about weave see [weave](weave.md)
- Rich key/value storage for use with Docker containers / services

For more information on how service discovery via DNS works in Apollo see [DNS](../../docs/dns.md).

For more information on Consul see [http://www.consul.io](http://www.consul.io)
or [https://github.com/hashicorp/consul](https://github.com/hashicorp/consul).


text:
Graphics::Graphics() {

}

Graphics::~Graphics() {

}

bool Graphics::Initialize(int width, int height) {
    // Used for the linux OS
#if !defined(__APPLE__) && !defined(MACOSX)
    // cout << glewGetString(GLEW_VERSION) << endl;
    glewExperimental = GL_TRUE;

    auto status = glewInit();

    // This is here to grab the error that comes from glew init.
    // This error is an GL_INVALID_ENUM that has no effects on the performance
    glGetError();

    //Check for error
    if (status != GLEW_OK) {
      std::cerr << "GLEW Error: " << glewGetErrorString(status) << "\n";
      return false;
    }
#endif

    // For OpenGL 3
    GLuint vao;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    // Init Camera
    m_camera = new Camera();
    if (!m_camera->Initialize(width, height)) {
        printf("Camera Failed to Initialize\n");
        return false;
    }

    // Create the object
    m_cube = new Object();
    m_floor = new Object();
    m_quad = new Object();
    if (!m_cube->Init("../meshes/Torus Knot.obj")) {
        printf("Object failed to init\n");
        return false;
    }
    if (!m_floor->Init("../meshes/plane.obj")) {
        printf("floor failed to init\n");
        return false;
    }
    if (!m_quad->Init("../meshes/quad.obj")) {
        printf("single quad failed to int\n");
        return false;
    }
    m_cube->setModel(glm::translate(glm::vec3(0, 2.5f, 0)));

    // Set up the shaders
    m_shader = new LightingShader();
    if (!m_shader->Initialize()) {
        printf("Shader Failed to Initialize\n");
        return false;
    }
    // Add the vertex shader
    if (!m_shader->LoadShader(GL_VERTEX_SHADER, "../shaders/simple_lighting_vertex.glsl")) {
        printf("Vertex Shader failed to Initialize\n");
        return false;
    }
    // Add the fragment shader
    if (!m_shader->LoadShader(GL_FRAGMENT_SHADER, "../shaders/simple_lighting_fragment.glsl")) {
        printf("Fragment Shader failed to Initialize\n");
        return false;
    }
    // Connect the program
    if (!m_shader->Finalize()) {
        printf("Program to Finalize\n");
        return false;
    }
    if (!m_shader->LinkShaderProps()) {
        printf("Lighting shader didn't find some shaders\n");
        return false;
    }

    // declare that skybox object and init it
    skybox = new Skybox(m_camera);
    if (!skybox->Init("../textures/SkyboxSet1/CloudyLightRays/",
                      "CLRLeft.png", "CLRRight.png",
                      "CLRUp.png", "CLRDown.png",
                      "CLRFront.png", "CLRBack.png")) {
        printf("skybox object failed to init in graphics object\n");
        return false;
    }

    m_shadowMapShader = new ShadowMapShader();
    if (!m_shadowMapShader->Initialize()) {
        printf("shadow map shader failed to init\n");
        return false;
    }
    if (!m_shadowMapShader->LoadShader(GL_VERTEX_SHADER, "../shaders/shadow_map_vertex.glsl")) {
        printf("shadow map vertex failed to init\n");
        return false;
    }
    if (!m_shadowMapShader->LoadShader(GL_FRAGMENT_SHADER, "../shaders/shadow_map_fragment.glsl")) {
        printf("shadow map vertex shader failed to init\n");
        return false;
    }
    if (!m_shadowMapShader->Finalize()) {
        printf("shader failed to finalize\n");
        return false;
    }
    if (!m_shadowMapShader->LinkShaderProps()) {
        printf("Shadow shader didn't find some variables\n");
        return false;
    }

    // create the frame buffer
    m_shadowMapFBO = new ShadowMapFBO();
    if (!m_shadowMapFBO->Init(width, height)) {
        printf("error with init fbo\n");
        return false;
    }

    // Locate the light information
    m_spotlight.position = glm::vec4(5, 2, 0, 1);
    m_spotlight.diffuse = glm::vec4(1, 1, 1, 0);
    m_spotlight.direction = glm::normalize(m_spotlight.position);

    // load all the textures for the people
    if (!TMInstance->initHandler(m_shader)) {
        printf("unable to init texture manager handler\n");
        return false;
    }
    if (!TMInstance->addTexture("stone", "../textures/stone_floor.jpg")) {
        printf("stone didn't load\n");
        return false;
    }
    if (!TMInstance->addTexture("chrome", "../textures/chrome_mercury.jpg")) {
        printf("chrome didn't load\n");
        return false;
    }
    if (!TMInstance->addTexture("bricks", "../textures/brickwork.jpg") ||
        !TMInstance->addTexture("bricks_normal", "../textures/brickwork-normal.jpg") ||
        !TMInstance->addTexture("basic_normal", "../textures/normal_up.jpg")) {
        printf("bricks/bricks normal didn't load\n");
        return false;
    }

    m_cube->SetTextureID("chrome");
    m_floor->SetTextureID("bricks");

    // Set up the billboard with a new texture
    m_bblist.Init("../textures/brickwork.jpg");

    //enable depth testing
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);

    return true;
}

void Graphics::Keyboard(SDL_Keycode keycode, bool shiftKeyPressed, bool ctrlKeyPressed) {
    switch (keycode) {
        case SDLK_UP:
            m_camera->tiltUpward();
//            m_camera->moveForward_relative();
            break;

        case SDLK_DOWN:
            m_camera->tiltDownward();
//            m_camera->moveBackward_relative();
            break;

        case SDLK_LEFT:
            if (shiftKeyPressed) {              // SHIFT + left, pivot left
                m_spotlight.position.x += 0.25f;
            } else if (ctrlKeyPressed) {        // CTRL + left, move light left
                m_camera->moveLeft_relative();
            } else {                            // left, move left
                m_camera->pivotLeft_aroundFocus();
            }
            break;

        case SDLK_RIGHT:
            if (shiftKeyPressed) {
                m_spotlight.position.x -= 0.25f;
            } else if (ctrlKeyPressed) {
                m_camera->moveRight_relative();
            } else {
                m_camera->pivotRight_aroundFocus();
            }
            break;

        case SDLK_KP_2:
            m_spotlight.direction.z += 0.25;
            break;
        case SDLK_KP_8:
            m_spotlight.direction.z -= 0.25;
            break;

        default:
            break;
    }
}

void Graphics::Update(unsigned int dt) {
    // Update the object
    m_cube->Update(dt);
    // update the location of the light
    static float angle = 0.01;
    static glm::mat4 rotation = glm::translate(glm::vec3(10, 5, 0));
    rotation = glm::rotate(glm::mat4(1.0f), angle, glm::vec3(0, 1, 0)) *rotation;
    m_spotlight.position = rotation[3];
}

void Graphics::Render() {
    ShadowRenderPass();
    LightingRenderPass();
    SkyboxRenderPass();
    GeometryRenderPass();
}

void Graphics::SkyboxRenderPass() {
    skybox->Render();
}

void Graphics::ShadowRenderPass() {
    // clear the buffer
    m_shadowMapFBO->BindForWriting();
    glClear(GL_DEPTH_BUFFER_BIT);

    // set it up for writing
    m_shadowMapShader->Enable();

    // make the view from the light
    glm::mat4 viewFromLight = glm::lookAt(glm::vec3(m_spotlight.position), glm::vec3(m_spotlight.direction), glm::vec3(0, 1, 0));

    // send in light
    glUniformMatrix4fv(m_shadowMapShader->projectionMatrix, 1, GL_FALSE, glm::value_ptr(m_camera->GetProjection()));
    glUniformMatrix4fv(m_shadowMapShader->viewMatrix, 1, GL_FALSE, glm::value_ptr(viewFromLight));
    glUniformMatrix4fv(m_shadowMapShader->modelMatrix, 1, GL_FALSE, glm::value_ptr(m_cube->GetModel()));
    glm::mat4 matrix = viewFromLight * m_cube->GetModel();
    glUniformMatrix4fv(m_shadowMapShader->mvMatrix, 1, GL_FALSE, glm::value_ptr(matrix));
    matrix = m_camera->GetProjection() * matrix;
    glUniformMatrix4fv(m_shadowMapShader->mvpMatrix, 1, GL_FALSE, glm::value_ptr(matrix));
    m_cube->Render();

    glBindFramebuffer(GL_FRAMEBUFFER, 0);
}

void Graphics::LightingRenderPass() {
    glm::mat4 matrix;
    m_shadowMapFBO->BindForReading(GL_TEXTURE1);
    //clear the screen
    glClearColor(0.0, 0.0, 0.2, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Start the correct program
    m_shader->Enable();

    // set the texture unit
    glUniform1i(m_shader->gSampler, 0);
    glUniform1i(m_shader->gShadowMap, 1);
    glUniform1i(m_shader->gNormalMap, 2);

    // set the default normal map for everyone
    TextureManager::getInstance()->setTextureUnit(2);
    TextureManager::getInstance()->enableTexture("basic_normal", GL_TEXTURE2);

    // send in the light information to the shader
    glUniform4fv(m_shader->light, 1, glm::value_ptr(m_spotlight.position));
    glm::mat4 viewFromLight = glm::lookAt(glm::vec3(m_spotlight.position), glm::vec3(m_spotlight.direction), glm::vec3(0, 1, 0));

    // Send in the projection aned view to the shader
    glUniformMatrix4fv(m_shader->projectionMatrix, 1, GL_FALSE, glm::value_ptr(m_camera->GetProjection()));
    glUniformMatrix4fv(m_shader->viewMatrix, 1, GL_FALSE, glm::value_ptr(m_camera->GetView()));
    glUniformMatrix4fv(m_shader->lightViewMatrix, 1, GL_FALSE, glm::value_ptr(viewFromLight));

    // Render the cube object
    matrix = m_camera->GetView() * m_cube->GetModel();
    glUniformMatrix4fv(m_shader->modelMatrix, 1, GL_FALSE, glm::value_ptr(m_cube->GetModel()));
    glUniformMatrix4fv(m_shader->mvMatrix, 1, GL_FALSE, glm::value_ptr(matrix));
    matrix = m_camera->GetProjection() * matrix;
    glUniformMatrix4fv(m_shader->mvpMatrix, 1, GL_FALSE, glm::value_ptr(matrix));
    m_cube->Render();

    // Render the floor object
    matrix = m_camera->GetView() * m_floor->GetModel();
    glUniformMatrix4fv(m_shader->modelMatrix, 1, GL_FALSE, glm::value_ptr(m_floor->GetModel()));
    glUniformMatrix4fv(m_shader->mvMatrix, 1, GL_FALSE, glm::value_ptr(matrix));
    matrix = m_camera->GetProjection() * matrix;
    glUniformMatrix4fv(m_shader->mvpMatrix, 1, GL_FALSE, glm::value_ptr(matrix));
    TextureManager::getInstance()->setTextureUnit(0);
    TextureManager::getInstance()->enableTexture("bricks_normal", GL_TEXTURE2);
    m_floor->Render();

    // Get any errors from OpenGL
    auto error = glGetError();
    if (error != GL_NO_ERROR) {
        string val = ErrorString(error);
//        std::cout << "Error initializing OpenGL! " << error << ", " << val << std::endl;
    }
}

void Graphics::GeometryRenderPass() {
    m_bblist.Render(m_camera->GetVP(), m_camera->GetPositionOfCamera());
}

std::string Graphics::ErrorString(GLenum error) {
    if (error == GL_INVALID_ENUM) {
        return "GL_INVALID_ENUM: An unacceptable value is specified for an enumerated argument.";
    } else if (error == GL_INVALID_VALUE) {
        return "GL_INVALID_VALUE: A numeric argument is out of range.";
    } else if (error == GL_INVALID_OPERATION) {
        return "GL_INVALID_OPERATION: The specified operation is not allowed in the current state.";
    } else if (error == GL_INVALID_FRAMEBUFFER_OPERATION) {
        return "GL_INVALID_FRAMEBUFFER_OPERATION: The framebuffer object is not complete.";
    } else if (error == GL_OUT_OF_MEMORY) {
        return "GL_OUT_OF_MEMORY: There is not enough memory left to execute the command.";
    } else {
        return "None";
    }
}


text:
package ro.ase.cts.lab7.composite;

public class BadGuy extends AbstractComponent{

	@Override
	public void move() {
		System.out.println(
				"The bad guys moves on the screen");
	}

	@Override
	public void fight() {
		System.out.println("The bad guy is attacking the hero");
	}

}