text:
#ifndef QWT_SCALE_MAP_H
#define QWT_SCALE_MAP_H

#include "qwt_global.h"
#include "qwt_math.h"
#ifndef QT_NO_DEBUG_STREAM
#include <qdebug.h>
#endif

class QRectF;

/*!
   \brief A transformation between coordinate systems

   QwtScaleTransformation offers transformations from the coordinate system
   of a scale into the linear coordinate system of a paint device
   and vice versa.
*/
class QWT_EXPORT QwtScaleTransformation
{
public:
    //! Transformation type
    enum Type
    {
        //! Transformation between 2 linear scales
        Linear,

        //! Transformation between a linear and a logarithmic ( base 10 ) scale
        Log10,

        //! Any other type of transformation
        Other
    };

    QwtScaleTransformation( Type type );
    virtual ~QwtScaleTransformation();

    virtual double xForm( double s, double s1, double s2,
        double p1, double p2 ) const;
    virtual double invXForm( double p, double p1, double p2,
        double s1, double s2 ) const;

    Type type() const;

    virtual QwtScaleTransformation *copy() const;

private:
    QwtScaleTransformation();
    QwtScaleTransformation &operator=( const QwtScaleTransformation );

    const Type d_type;
};

//! \return Transformation type
inline QwtScaleTransformation::Type QwtScaleTransformation::type() const
{
    return d_type;
}

/*!
   \brief A scale map

   QwtScaleMap offers transformations from the coordinate system
   of a scale into the linear coordinate system of a paint device
   and vice versa.
*/
class QWT_EXPORT QwtScaleMap
{
public:
    QwtScaleMap();
    QwtScaleMap( const QwtScaleMap& );

    ~QwtScaleMap();

    QwtScaleMap &operator=( const QwtScaleMap & );

    void setTransformation( QwtScaleTransformation * );
    const QwtScaleTransformation *transformation() const;

    void setPaintInterval( double p1, double p2 );
    void setScaleInterval( double s1, double s2 );

    double transform( double s ) const;
    double invTransform( double p ) const;

    double p1() const;
    double p2() const;

    double s1() const;
    double s2() const;

    double pDist() const;
    double sDist() const;

    QT_STATIC_CONST double LogMin;
    QT_STATIC_CONST double LogMax;

    static QRectF transform( const QwtScaleMap &,
        const QwtScaleMap &, const QRectF & );
    static QRectF invTransform( const QwtScaleMap &,
        const QwtScaleMap &, const QRectF & );

    static QPointF transform( const QwtScaleMap &,
        const QwtScaleMap &, const QPointF & );
    static QPointF invTransform( const QwtScaleMap &,
        const QwtScaleMap &, const QPointF & );

    bool isInverting() const;

private:
    void newFactor();

    double d_s1, d_s2;     // scale interval boundaries
    double d_p1, d_p2;     // paint device interval boundaries

    double d_cnv;       // conversion factor

    QwtScaleTransformation *d_transformation;
};

/*!
    \return First border of the scale interval
*/
inline double QwtScaleMap::s1() const
{
    return d_s1;
}

/*!
    \return Second border of the scale interval
*/
inline double QwtScaleMap::s2() const
{
    return d_s2;
}

/*!
    \return First border of the paint interval
*/
inline double QwtScaleMap::p1() const
{
    return d_p1;
}

/*!
    \return Second border of the paint interval
*/
inline double QwtScaleMap::p2() const
{
    return d_p2;
}

/*!
    \return qwtAbs(p2() - p1())
*/
inline double QwtScaleMap::pDist() const
{
    return qAbs( d_p2 - d_p1 );
}

/*!
    \return qwtAbs(s2() - s1())
*/
inline double QwtScaleMap::sDist() const
{
    return qAbs( d_s2 - d_s1 );
}

/*!
  Transform a point related to the scale interval into an point
  related to the interval of the paint device

  \param s Value relative to the coordinates of the scale
*/
inline double QwtScaleMap::transform( double s ) const
{
    // try to inline code from QwtScaleTransformation

    if ( d_transformation->type() == QwtScaleTransformation::Linear )
        return d_p1 + ( s - d_s1 ) * d_cnv;

    if ( d_transformation->type() == QwtScaleTransformation::Log10 )
        return d_p1 + log( s / d_s1 ) * d_cnv;

    return d_transformation->xForm( s, d_s1, d_s2, d_p1, d_p2 );
}

/*!
  Transform an paint device value into a value in the
  interval of the scale.

  \param p Value relative to the coordinates of the paint device
  \sa transform()
*/
inline double QwtScaleMap::invTransform( double p ) const
{
    return d_transformation->invXForm( p, d_p1, d_p2, d_s1, d_s2 );
}

//! \return True, when ( p1() < p2() ) != ( s1() < s2() )
inline bool QwtScaleMap::isInverting() const
{
    return ( ( d_p1 < d_p2 ) != ( d_s1 < d_s2 ) );
}

#ifndef QT_NO_DEBUG_STREAM
QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleMap & );
#endif

#endif


text:
package org.metaborg.core.processing.analyze;

import org.metaborg.core.analysis.IAnalyzeUnit;
import org.metaborg.core.syntax.IInputUnit;
import org.metaborg.core.syntax.IParseUnit;

/**
 * Typedef interface for combining {@link IAnalysisResultRequester} and {@link IAnalysisResultUpdater}.
 */
public interface IAnalysisResultProcessor<I extends IInputUnit, P extends IParseUnit, A extends IAnalyzeUnit>
    extends IAnalysisResultRequester<I, A>, IAnalysisResultUpdater<P, A> {

}

redpajama_set_name: RedPajamaGithub


text:
package de.hshannover.f4.trust.visitmeta.dataservice.xml;

import java.util.Map;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import static org.junit.Assert.*;

public class AbstractXMLDataExtractorTest {

	class AbstractXMLDataExtractorStub extends AbstractXMLDataExtractor {

		@Override
		public Map<String, String> extractToKeyValuePairs(Document document) {
			throw new UnsupportedOperationException();
		}
	}

	private DocumentBuilder mBuilder;
	private AbstractXMLDataExtractor mExtractor;

	@Before
	public void setup() throws Exception {
		DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
		f.setNamespaceAware(true);
		mBuilder = f.newDocumentBuilder();
		mExtractor = new AbstractXMLDataExtractorStub();
	}

	// TODO test for malformed XML

	@Test
	public void extractCorrectUnixTimestampFromDocument() {
		String xsdTimestamp = "2012-11-26T12:01:22Z"; /*==*/ long timestamp = 1353931282000L;
		Document role = createRoleDocument(xsdTimestamp);
		assertEquals(timestamp, mExtractor.extractIfmapMetadataTimestamp(role));
	}

	@Test
	public void extractMultiValueIfmapCardinalityFromDocument() {
		Document role = createRoleDocument();
		assertFalse(mExtractor.isSingleValueMetadata(role));
	}

	@Test
	public void extractTypenameFromDocument() {
		Document role = createRoleDocument();
		assertEquals("role", mExtractor.extractTypename(role));
	}

	private Document createRoleDocument(String xsdTimestamp) {
		final String NAMESPACE = "http://www.trustedcomputinggroup.org/2010/IFMAP-METADATA/2";
		final String NAMESPACE_PRFIX = "meta";
		Document doc = mBuilder.newDocument();

		Element role = doc.createElementNS(NAMESPACE, NAMESPACE_PRFIX + ":role");
		role.setAttributeNS(null, "ifmap-cardinality", "multiValue");
		role.setAttributeNS(null, "ifmap-publisher-id", "publisher-42");
		role.setAttributeNS(null, "ifmap-timestamp", xsdTimestamp);
		doc.appendChild(role);

		Element name = doc.createElement("name");
		name.setTextContent("admin");
		role.appendChild(name);

		return doc;
	}

	private Document createRoleDocument() {
		return createRoleDocument("2012-11-26T12:01:22Z");
	}
}


text:
import re

import memcache
import six

from stackalytics.openstack.common import log as logging
from stackalytics.processor import utils

LOG = logging.getLogger(__name__)

BULK_READ_SIZE = 64
BULK_DELETE_SIZE = 4096
RECORD_ID_PREFIX = 'record:'
UPDATE_ID_PREFIX = 'update:'
MEMCACHED_URI_PREFIX = r'^memcached:\/\/'

class RuntimeStorage(object):
    def __init__(self, uri):
        pass

    def set_records(self, records_iterator):
        pass

    def apply_corrections(self, corrections_iterator):
        pass

    def get_by_key(self, key):
        pass

    def set_by_key(self, key, value):
        pass

    def get_update(self, pid):
        pass

    def active_pids(self, pids):
        pass

    def get_all_records(self):
        pass

class MemcachedStorage(RuntimeStorage):
    def __init__(self, uri):
        super(MemcachedStorage, self).__init__(uri)

        stripped = re.sub(MEMCACHED_URI_PREFIX, '', uri)
        if stripped:
            storage_uri = stripped.split(',')
            self.memcached = memcache.Client(storage_uri)
            self._init_user_count()
            self.record_index = {}
        else:
            raise Exception('Invalid storage uri %s' % uri)

    def _build_index_lazily(self):
        if self.record_index:
            return
        for record in self.get_all_records():
            self.record_index[record['primary_key']] = record['record_id']

    def set_records(self, records_iterator, merge_handler=None):
        self._build_index_lazily()
        for record in records_iterator:
            if record['primary_key'] in self.record_index:
                # update
                record_id = self.record_index[record['primary_key']]
                if not merge_handler:
                    record['record_id'] = record_id
                    LOG.debug('Update record %s', record)
                    self.set_by_key(self._get_record_name(record_id), record)
                else:
                    original = self.get_by_key(self._get_record_name(
                        record_id))
                    if merge_handler(original, record):
                        LOG.debug('Update record with merge %s', record)
                        self.set_by_key(self._get_record_name(record_id),
                                        original)
            else:
                # insert record
                record_id = self._get_record_count()
                record['record_id'] = record_id
                self.record_index[record['primary_key']] = record_id
                LOG.debug('Insert new record %s', record)
                self.set_by_key(self._get_record_name(record_id), record)
                self._set_record_count(record_id + 1)

            self._commit_update(record_id)

    def apply_corrections(self, corrections_iterator):
        self._build_index_lazily()
        for correction in corrections_iterator:
            if correction['primary_key'] not in self.record_index:
                continue

            record_id = self.record_index[correction['primary_key']]
            original = self.get_by_key(self._get_record_name(record_id))
            need_update = False

            for field, value in six.iteritems(correction):
                if (field not in original) or (original[field] != value):
                    need_update = True
                    original[field] = value

            if need_update:
                self.set_by_key(self._get_record_name(record_id), original)
                self._commit_update(record_id)

    def inc_user_count(self):
        return self.memcached.incr('user:count')

    def get_all_users(self):
        for n in six.moves.range(0, self.get_by_key('user:count') + 1):
            user = self.get_by_key('user:%s' % n)
            if user:
                yield user

    def get_by_key(self, key):
        if six.PY2:
            key = key.encode('utf8')
        return self.memcached.get(key)

    def set_by_key(self, key, value):
        if six.PY2:
            key = key.encode('utf8')
        if not self.memcached.set(key, value):
            LOG.critical('Failed to store data in memcached: '
                         'key %(key)s, value %(value)s',
                         {'key': key, 'value': value})
            raise Exception('Memcached set failed')

    def delete_by_key(self, key):
        if six.PY2:
            key = key.encode('utf8')
        if not self.memcached.delete(key):
            LOG.critical('Failed to delete data from memcached: key %s', key)
            raise Exception('Memcached delete failed')

    def get_update(self, pid):
        last_update = self.get_by_key('pid:%s' % pid)
        update_count = self._get_update_count()

        self.set_by_key('pid:%s' % pid, update_count)
        self._set_pids(pid)

        if not last_update:
            for i in self.get_all_records():
                yield i
        else:
            for update_id_set in utils.make_range(last_update, update_count,
                                                  BULK_READ_SIZE):
                update_set = self.memcached.get_multi(
                    update_id_set, UPDATE_ID_PREFIX).values()
                for i in self.memcached.get_multi(
                        update_set, RECORD_ID_PREFIX).values():
                    yield i

    def active_pids(self, pids):
        stored_pids = self.get_by_key('pids') or set()
        for pid in stored_pids:
            if pid not in pids:
                LOG.debug('Purge dead uwsgi pid %s from pids list', pid)
                self.delete_by_key('pid:%s' % pid)

        self.set_by_key('pids', pids)

        # remove unneeded updates
        min_update = self._get_update_count()
        for pid in pids:
            n = self.get_by_key('pid:%s' % pid)
            if n:
                if n < min_update:
                    min_update = n

        first_valid_update = self.get_by_key('first_valid_update') or 0
        LOG.debug('Purge polled updates from %(first)s to %(min)s',
                  {'first': first_valid_update, 'min': min_update})

        for delete_id_set in utils.make_range(first_valid_update, min_update,
                                              BULK_DELETE_SIZE):
            if not self.memcached.delete_multi(delete_id_set,
                                               key_prefix=UPDATE_ID_PREFIX):
                LOG.critical('Failed to delete_multi from memcached')
                raise Exception('Failed to delete_multi from memcached')

        self.set_by_key('first_valid_update', min_update)

    def _get_update_count(self):
        return self.get_by_key('update:count') or 0

    def _set_pids(self, pid):
        pids = self.get_by_key('pids') or set()
        if pid in pids:
            return
        pids.add(pid)
        self.set_by_key('pids', pids)

    def _get_record_name(self, record_id):
        return RECORD_ID_PREFIX + str(record_id)

    def _get_record_count(self):
        return self.get_by_key('record:count') or 0

    def _set_record_count(self, count):
        self.set_by_key('record:count', count)

    def get_all_records(self):
        for record_id_set in utils.make_range(0, self._get_record_count(),
                                              BULK_READ_SIZE):
            for i in self.memcached.get_multi(
                    record_id_set, RECORD_ID_PREFIX).values():
                yield i

    def _commit_update(self, record_id):
        count = self._get_update_count()
        self.set_by_key(UPDATE_ID_PREFIX + str(count), record_id)
        self.set_by_key('update:count', count + 1)

    def _init_user_count(self):
        if not self.get_by_key('user:count'):
            self.set_by_key('user:count', 1)

def get_runtime_storage(uri):
    LOG.debug('Runtime storage is requested for uri %s', uri)
    match = re.search(MEMCACHED_URI_PREFIX, uri)
    if match:
        return MemcachedStorage(uri)
    else:
        raise Exception('Unknown runtime storage uri %s' % uri)


text:
using EPiServer.Commerce.Order;
using EPiServer.Reference.Commerce.Site.Features.Global.AddressBook.Pages;
using EPiServer.Reference.Commerce.Site.Features.Global.AddressBook.Services;
using EPiServer.Reference.Commerce.Site.Features.Global.Shared.Models;
using EPiServer.Reference.Commerce.Site.Tests.TestSupport.Fakes;
using Mediachase.BusinessFoundation.Data;
using Mediachase.Commerce.Customers;
using Moq;
using System;
using System.Linq;
using Xunit;

namespace EPiServer.Reference.Commerce.Site.Tests.Features.AddressBook
{
    public class AddressBookServiceTests
    {
        [Fact]
        public void CanSave_WhenAddressWithSameNameExists_ShouldReturnFalse()
        {
            var model = new AddressModel
            {
                AddressId = Guid.NewGuid().ToString(),
                Name = _address1.Name
            };

            Assert.False(_subject.CanSave(model));
        }

        [Fact]
        public void CanSave_WhenAddressWithSameNameDoesNotExist_ShouldReturnTrue()
        {
            var guid = Guid.NewGuid();
            var model = new AddressModel
            {
                AddressId = guid.ToString(),
                Name = guid.ToString()
            };

            Assert.True(_subject.CanSave(model));
        }

        [Fact]
        public void Save_WhenSavingNewAddress_ShouldAddAddressToCurrentContact()
        {
            var guid = Guid.NewGuid();
            var model = new AddressModel
            {
                Name = guid.ToString()
            };

            _subject.Save(model);

            Assert.NotNull(_currentContact.ContactAddresses.SingleOrDefault(x => x.AddressId == Guid.Parse(model.AddressId)));
        }

        [Fact]
        public void Save_WhenSavingExistingAddress_ShouldUpdateAddressInCurrentContact()
        {
            var model = new AddressModel
            {
                AddressId = ((Guid)_address1.AddressId).ToString(),
                Name = _address1.AddressId.ToString()
            };

            _subject.Save(model);

            Assert.NotNull(_currentContact.ContactAddresses.SingleOrDefault(x => x.Name == model.AddressId.ToString()));
        }

        [Fact]
        public void Save_WhenSavingNewAddress_ShouldUpdatePreferredBillingAddress()
        {
            var guid = Guid.NewGuid().ToString();
            var model = new AddressModel
            {
                AddressId = guid,
                Name = guid.ToString(),
                BillingDefault = true,
            };

            _subject.Save(model);

            Assert.Equal<Guid?>(Guid.Parse(model.AddressId), _currentContact.PreferredBillingAddress.AddressId);
        }

        [Fact]
        public void Save_WhenSavingNewAddress_ShouldUpdatePreferredShippingAddress()
        {
            var guid = Guid.NewGuid().ToString();
            var model = new AddressModel
            {
                AddressId = guid,
                Name = guid,
                ShippingDefault = true
            };

            _subject.Save(model);

            Assert.Equal<Guid?>(Guid.Parse(model.AddressId), _currentContact.PreferredShippingAddress.AddressId);
        }

        [Fact]
        public void Save_WhenSavingExistingAddress_ShouldUpdatePreferredBillingAddress()
        {
            var model = new AddressModel
            {
                AddressId = _address1.AddressId.ToString(),
                Name = _address1.AddressId.ToString(),
                BillingDefault = true,
            };

            _subject.Save(model);

            Assert.Equal<Guid?>(Guid.Parse(model.AddressId), _currentContact.PreferredBillingAddress.AddressId);
        }

        [Fact]
        public void Save_WhenSavingExistingAddress_ShouldUpdatePreferredShippingAddress()
        {
            var model = new AddressModel
            {
                AddressId = _address1.AddressId.ToString(),
                Name = _address1.AddressId.ToString(),
                ShippingDefault = true
            };

            _subject.Save(model);

            Assert.Equal<Guid?>(Guid.Parse(model.AddressId), _currentContact.PreferredShippingAddress.AddressId);
        }

        [InlineData(_address1Id)]
        [InlineData(_address2Id)]
        [Theory]
        public void List_ShouldReturnExistingAddresses(string addressId)
        {
            var id = new Guid(addressId);
            var result = _subject.List();

            Assert.Equal<int>(2, result.Count());
            Assert.NotNull(result.Single(x => x.AddressId == id.ToString()));
        }

        [Fact]
        public void SetPreferredBillingAddress_WhenAddressIsInvalid_ShouldNotUpdatePreferredBillingAddress()
        {
            _currentContact.PreferredBillingAddress = null;

            _subject.SetPreferredBillingAddress(Guid.Empty.ToString());

            Assert.Null(_currentContact.PreferredBillingAddress);
        }

        [Fact]
        public void SetPreferredBillingAddress_WhenAddressExists_ShouldUpdatePreferredBillingAddress()
        {
            _subject.SetPreferredBillingAddress(_address1.AddressId.ToString());

            Assert.Equal<Guid?>(_address1.AddressId, _currentContact.PreferredBillingAddress.AddressId);
        }

        [Fact]
        public void SetPreferredShippingAddress_WhenAddressIsInvalid_ShouldNotUpdatePreferredShippingAddress()
        {
            _currentContact.PreferredShippingAddress = null;

            _subject.SetPreferredShippingAddress(Guid.Empty.ToString());

            Assert.Null(_currentContact.PreferredShippingAddress);
        }

        [Fact]
        public void SetPreferredShippingAddress_WhenAddressExists_ShouldUpdatePreferredShippingAddress()
        {
            _subject.SetPreferredShippingAddress(_address1.AddressId.ToString());

            Assert.Equal<Guid?>(_address1.AddressId, _currentContact.PreferredShippingAddress.AddressId);
        }

        [Fact]
        public void Delete_WhenAddressDoesNotExist_ShouldNotDeleteAddress()
        {
            _subject.Delete(Guid.Empty.ToString());

            Assert.Equal<int>(2, _currentContact.ContactAddresses.Count());
        }

        [Fact]
        public void Delete_WhenAddressExists_ShouldDeleteAddress()
        {
            _subject.Delete(_address1.AddressId.ToString());

            Assert.Equal<int>(1, _currentContact.ContactAddresses.Count());
        }

        [Fact]
        public void Delete_WhenAddressExistsAndIsSetAsPreferredBillingAddress_ShouldDeleteAddressAndUpdatePreferredBillingAddress()
        {
            _subject.SetPreferredBillingAddress(_address1.AddressId.ToString());

            _subject.Delete(_address1.AddressId.ToString());

            Assert.Null(_currentContact.PreferredBillingAddressId);
        }

        [Fact]
        public void Delete_WhenAddressExistsAndIsSetAsPreferredShippingAddress_ShouldDeleteAddressAndUpdatePreferredShippingAddress()
        {
            _subject.SetPreferredShippingAddress(_address1.AddressId.ToString());

            _subject.Delete(_address1.AddressId.ToString());

            Assert.Null(_currentContact.PreferredShippingAddressId);
        }

        [Fact]
        public void GetAddressBookViewModel_WhenPassingPage_ShouldReturnModel()
        {
            var page = new AddressBookPage();
            var result = _subject.GetAddressBookViewModel(page);

            Assert.Equal<AddressBookPage>(page, result.CurrentPage);
        }

        [Fact]
        public void LoadAddress_WhenModelHasNoAddressId_ShouldReturnEmptyModel()
        {
            var model = new AddressModel();
            _subject.LoadAddress(model);

            Assert.Null(model.AddressId);
        }

        [Fact]
        public void ConvertToModel_WhenOrderAddressIsNull_ShouldNotSetAddressIdOnModel()
        {
            var model = _subject.ConvertToModel(null);
            Assert.Null(model.AddressId);
        }

        [Fact]
        public void ConvertToModel_WhenOrderAddressIsNotNull_ShouldReturnModelWithSameValueAsOrderAddress()
        {
            var orderAddress = new FakeOrderAddress()
            {
                Id = "SampleId",
                FirstName = "first",
                LastName = "last"
            };
            var model = _subject.ConvertToModel(orderAddress);
            Assert.Equal(model.AddressId, orderAddress.Id);
            Assert.Equal(model.FirstName, orderAddress.FirstName);
            Assert.Equal(model.LastName, orderAddress.LastName);
        }

        private readonly AddressBookService _subject;
        private readonly CustomerAddress _address1;
        private const string _address1Id = "6BB9294A-F25F-4145-A225-F8F4D675377B";
        private const string _address2Id = "B374E959-B221-4B3C-ACC6-CE0B837C5765";
        private readonly FakeCurrentContact _currentContact;

        public AddressBookServiceTests()
        {
            _address1 = CustomerAddress.CreateInstance();
            _address1.AddressId = new PrimaryKeyId(new Guid(_address1Id));
            _address1.Name = _address1.AddressId.ToString();

            var address2 = CustomerAddress.CreateInstance();
            address2.AddressId = new PrimaryKeyId(new Guid(_address2Id));
            address2.Name = address2.AddressId.ToString();

            _currentContact = new FakeCurrentContact(new[] { _address1, address2 })
            {
                PreferredBillingAddress = _address1,
                PreferredShippingAddress = _address1
            };
            var customerContext = new FakeCustomerContext(_currentContact);
            var countryManager = new FakeCountryManager();
            var fakeOrderGroupFactory = new FakeOrderGroupFactory();

            _subject = new AddressBookService(customerContext, countryManager, fakeOrderGroupFactory);
        }
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Biatora carniolica Arnold

### Remarks
null


text:
layout: toc-frame
package: ALS Library
reference: false
---


text:
// load dependencies
var express = require('express');
var router = express.Router();
var articleHelpers = require('./helpers/article');
var clusterHelpers = require('./helpers/cluster');
var Promise = require('node-promise').Promise;

// middleware for requests
router.use(function(req, res, next) {
    // TODO API authentication for a POST would go here
    next();
});

// test page
router.get('/', function(req, res) {
    res.json({ message: 'api test' });
});

// routes for articles
router.route('/articles')
    /*
    // create article (for a seperate RSS/aggregator application)
    .post(function(req, res) {
        var promise = new Promise();
        articleHelpers.postArticle(req.body, promise);
        promise.then(function(res) {
            console.log("callback: ", res);
            res.send(response);
        }, function(err) {
            console.log("callback: ", err);
            res.send(err);
        });
    }) */

    // get most recent articles
    // TODO: accept search, sort, and limit criteria
    .get(function(req, res) {
        var promise = new Promise();
        articleHelpers.getArticles(promise);
        promise.then(function(articles) {
            // console.log("callback: ", articles);
            res.send(articles)
        }, function(err) {
            // console.log("callback: ", err);
            res.send(err);
        });
    });

// routes for articles by id
router.route('/articles/:article_id')
    .get(function(req, res) {
        var promise = new Promise();
        articleHelpers.getArticle(req.params.article_id, promise)
        promise.then(function(article) {
            // console.log("callback: ", article);
            res.send(article);
        }, function(err) {
            // console.log("callback: ", err);
            res.send(err);
        });
    });

// routes for clusters
router.route('/clusters/:cluster_id')

    // get cluster by the cluster id
    .get(function(req, res) {
        var promise = new Promise();
        clusterHelpers.getCluster(req.params.cluster_id, promise);
        promise.then(function(cluster) {
            // console.log("callback: ", cluster);
            res.send(cluster);
        }, function(err) {
            // console.log("callback: ", err);
            res.send(err);
        });
    });

// handle any error responses
function handleError(res, err) {
    res.send(err);
}

module.exports = router;


text:
package com.example1.service.foo.internal.bar;

import com.example1.service.foo.Foo;

public class BarHelper {
	public Bar getSomeBar() {
		return new Bar("baz");
	}

	public Foo transformToFoo(Bar bar) {
		return new Foo(bar.getName());
	}
}


text:
class RankingRepository
  pattr_initialize :users_repository, :props_repository

  def hero_of_the_week
    time_range = (Time.zone.now.beginning_of_week..Time.zone.now)
    top_propser = top_propser_within time_range
    {
      user: top_propser.name,
      props_count: top_propser.props_count,
    }
  end

  private

  def top_propser_within(time_range)
    UserWithPropsCount.from_array(
      users_repository,
      props_repository.count_per_user(time_range).max_by { |_k, v| v })
  end

  class UserWithPropsCount
    vattr_initialize :props_count, :name

    def self.from_array(users_repository, arr)
      new arr[1], users_repository.find_by_id(arr[0]).name
    end
  end
end


text:
package cruise.umple.compiler;

import org.junit.*;

public class RuleInstanceTest
{

  Parser parser;

  @Before
  public void setUp()
  {
    parser = new Parser("p");
  }

  @Test
  public void emptyConstructor()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("");
    Assert.assertEquals(0,instance.numberOfRuleParts());
  }

  @Test
  public void staticConstructor()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("blah");
    Assert.assertEquals(1,instance.numberOfRuleParts());

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("blah",part.getName());
    Assert.assertEquals("blah",part.getDisplayName());
    Assert.assertEquals("1",part.getMultiplicity());
    Assert.assertEquals(RulePart.Type.Static,part.getType());
  }

  @Test
  public void multiplicityMany()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("blah*");

    Assert.assertEquals(1,instance.numberOfRuleParts());

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("blah*",part.getName());
    Assert.assertEquals("blah*",part.getDisplayName());
    Assert.assertEquals("*",part.getMultiplicity());
    Assert.assertEquals(RulePart.Type.Static,part.getType());
  }

  @Test
  public void multiplicityOptional()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("blah?");

    Assert.assertEquals(1,instance.numberOfRuleParts());

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("blah?",part.getName());
    Assert.assertEquals("blah?",part.getDisplayName());
    Assert.assertEquals("?",part.getMultiplicity());
    Assert.assertEquals(RulePart.Type.Static,part.getType());
  }

  @Test
  public void variableConstructor()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[blah]");

    Assert.assertEquals(1,instance.numberOfRuleParts());

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("blah",part.getName());
    Assert.assertEquals("blah",part.getDisplayName());
    Assert.assertEquals("1",part.getMultiplicity());
    Assert.assertEquals(RulePart.Type.Variable,part.getType());

  }

  @Test
  public void ruleConstructor()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[[lookupBlah]]");

    Assert.assertEquals(1,instance.numberOfRuleParts());

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("lookupBlah",part.getName());
    Assert.assertEquals("lookupBlah",part.getDisplayName());
    Assert.assertEquals("1",part.getMultiplicity());
    Assert.assertEquals(RulePart.Type.Rule,part.getType());
  }

  @Test
  public void multipleRules()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("blah [moreBlah]*");
    Assert.assertEquals(2,instance.numberOfRuleParts());

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("blah",part.getName());
    Assert.assertEquals("blah",part.getDisplayName());
    Assert.assertEquals("1",part.getMultiplicity());
    Assert.assertEquals(RulePart.Type.Static,part.getType());

    part = instance.getRulePart(1);
    Assert.assertEquals("moreBlah",part.getName());
    Assert.assertEquals("moreBlah",part.getDisplayName());
    Assert.assertEquals("*",part.getMultiplicity());
    Assert.assertEquals(RulePart.Type.Variable,part.getType());
  }

  @Test
  public void constant()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[=unique]");
    Assert.assertEquals(1,instance.numberOfRuleParts());

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("=unique",part.getName());
    Assert.assertEquals("unique",part.getDisplayName());
    Assert.assertEquals("1",part.getMultiplicity());
    Assert.assertEquals(RulePart.Type.Variable,part.getType());
  }

  @Test(expected=IndexOutOfBoundsException.class)
  public void getRulePart_invalid_tooLow()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[unique]");
    Assert.assertEquals(1,instance.numberOfRuleParts());

    instance.getRulePart(-1);
  }

  @Test(expected=IndexOutOfBoundsException.class)
  public void getRulePart_invalid_tooHigh()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[unique]");
    Assert.assertEquals(1,instance.numberOfRuleParts());

    instance.getRulePart(1);
  }

  @Test
  public void getRulePart_valid()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[a] [b]");
    Assert.assertEquals(2,instance.numberOfRuleParts());

    RulePart atLow = instance.getRulePart(0);
    RulePart atHigh = instance.getRulePart(1);

    Assert.assertEquals("a",atLow.getName());
    Assert.assertEquals("b",atHigh.getName());
  }

  @Test
  public void populateNextIdentifier_staticAndEnum()
  {
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[name] : [=value:a|b] ;");
    Assert.assertEquals(1,instance.getRulePart(0).getNextIdentifiers().length);
    Assert.assertEquals(":",instance.getRulePart(0).getNextIdentifiers()[0]);
    Assert.assertEquals(2,instance.getRulePart(1).getNextIdentifiers().length);
    Assert.assertEquals("a",instance.getRulePart(1).getNextIdentifiers()[0]);
    Assert.assertEquals("b",instance.getRulePart(1).getNextIdentifiers()[1]);
  }

  @Test
  public void populateNextIdentifier_optional()
  {
    parser.addRule("json : { [[name_value]] ( , [[name_value]] )* }");
    parser.addRule("name_value : [name] : [value] | [name] : [[json]] ");

    RuleInstance instance;

    instance = new RuleInstance(parser);
    instance.configureDefinition("[name] : [[json]]");

    Assert.assertEquals(3,instance.numberOfRuleParts());
    Assert.assertEquals(1,instance.getRulePart(0).getNextIdentifiers().length);
    Assert.assertEquals(":",instance.getRulePart(0).getNextIdentifiers()[0]);
    Assert.assertEquals(1,instance.getRulePart(1).getNextIdentifiers().length);
    Assert.assertEquals("{",instance.getRulePart(1).getNextIdentifiers()[0]);
    Assert.assertEquals(0,instance.getRulePart(2).getNextIdentifiers().length);

    instance = new RuleInstance(parser);
    instance.configureDefinition("{ [[name_value]] [[anonymous::json::1]]* }");

    Assert.assertEquals(4,instance.numberOfRuleParts());
    Assert.assertEquals(0,instance.getRulePart(0).getNextIdentifiers().length);
    Assert.assertEquals(2,instance.getRulePart(1).getNextIdentifiers().length);
    Assert.assertEquals(",",instance.getRulePart(1).getNextIdentifiers()[0]);
    Assert.assertEquals("}",instance.getRulePart(1).getNextIdentifiers()[1]);
    Assert.assertEquals(2,instance.getRulePart(2).getNextIdentifiers().length);
    Assert.assertEquals(",",instance.getRulePart(2).getNextIdentifiers()[0]);
    Assert.assertEquals("}",instance.getRulePart(2).getNextIdentifiers()[1]);

  }

  @Test
  public void optional_getNextIdentifiers()
  {
    parser.addRule("name : [type,name] (= [value])? ;");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[type,name] [[anonymous::name::1]]? ;");
    Assert.assertEquals(2,instance.getRulePart(0).getNextIdentifiers().length);
    Assert.assertEquals("=",instance.getRulePart(0).getNextIdentifiers()[0]);
    Assert.assertEquals(";",instance.getRulePart(0).getNextIdentifiers()[1]);
  }

  @Test
  public void populateNextIdentifier_variableLookup()
  {
    parser.addRule("program : [[name]] [[value]] ;");
    parser.addRule("name : [first] . [second]");
    parser.addRule("value : = [value]");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[[name]] [[value]] ;");

    Assert.assertEquals(1,instance.getRulePart(0).getNextIdentifiers().length);
    Assert.assertEquals("=",instance.getRulePart(0).getNextIdentifiers()[0]);
    Assert.assertEquals(1,instance.getRulePart(1).getNextIdentifiers().length);
    Assert.assertEquals(";",instance.getRulePart(1).getNextIdentifiers()[0]);
    Assert.assertEquals(0,instance.getRulePart(2).getNextIdentifiers().length);
  }

  @Test
  public void populateNextIdentifier_multipleVariableLookup()
  {
    parser.addRule("program : [[name]] [[value]] ;");
    parser.addRule("name : [first] . [second]");
    parser.addRule("value : = [value] | != [value]");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[[name]] [[value]] ;");

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals(2,part.getNextIdentifiers().length);
    Assert.assertEquals("=",part.getNextIdentifiers()[0]);
    Assert.assertEquals("!=",part.getNextIdentifiers()[1]);

    Assert.assertEquals(1,instance.getRulePart(1).getNextIdentifiers().length);
    Assert.assertEquals(";",instance.getRulePart(1).getNextIdentifiers()[0]);
  }

  @Test
  public void removeRulePart()
  {
    parser.addRule("program : [[name]] [[value]] ;");
    parser.addRule("name : [first] . [second]");
    parser.addRule("value : = [value] | != [value]");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[[name]] [[value]] ;");

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("name",part.getName());
    instance.removeRulePart(part);
    part = instance.getRulePart(0);
    Assert.assertEquals("value",part.getName());
  }

  @Test
  public void removeOptionalPart()
  {
    parser.addRule("program : [name]? [type]? [value] ;");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[name]? [type]? [value] ;");

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("name",part.getName());

    RulePart part2 = instance.getRulePart(1);
    Assert.assertEquals("type",part2.getName());

    RulePart part3 = instance.getRulePart(2);
    Assert.assertEquals("value",part3.getName());

    RulePart part4 = instance.getRulePart(3);
    Assert.assertEquals(";",part4.getName());

    Assert.assertEquals(true,instance.removeOptionalPart());
    Assert.assertEquals("type",instance.getRulePart(0).getName());

    Assert.assertEquals(true,instance.removeOptionalPart());
    Assert.assertEquals("value",instance.getRulePart(0).getName());

    Assert.assertEquals(false,instance.removeOptionalPart());
    Assert.assertEquals("value",instance.getRulePart(0).getName());

  }

  @Test
  public void removeOptionalPart_removeOnlyVariables()
  {
    parser.addRule("program : [name]? [[last]]? [type]? [value] ;");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[name]? [[last]]? [type]? [value] ;");

    Assert.assertEquals(true,instance.removeOptionalPart());
    Assert.assertEquals(true,instance.removeOptionalPart());
    Assert.assertEquals("last",instance.getRulePart(0).getName());

    Assert.assertEquals(false,instance.removeOptionalPart());
  }

  @Test
  public void removeOptionalPart_ignoreMany()
  {
    parser.addRule("program : [[name]]* [value] ;");
    parser.addRule("name : [one] = [two] ;");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[[name]]* [value] ;");

    instance.getRulePart(0).setMaximumPartsFound(2);
    Assert.assertEquals(false,instance.removeOptionalPart());
  }

  @Test
  public void removeRuleUpdateIdentifiers()
  {
    parser.addRule("program : [name] = + [value]");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[name] = + [value]");

    RulePart part = instance.getRulePart(0);
    RulePart nextPart = instance.getRulePart(1);
    Assert.assertEquals(1,part.getNextIdentifiers().length);
    Assert.assertEquals("=",part.getNextIdentifiers()[0]);

    instance.removeRulePart(nextPart);
    Assert.assertEquals(1,nextPart.getNextIdentifiers().length);
    Assert.assertEquals("+",nextPart.getNextIdentifiers()[0]);
  }

  @Test
  public void hasMoreRuleParts()
  {
    parser.addRule("program : [[name]] [[value]] ;");
    parser.addRule("name : [first] . [second]");
    parser.addRule("value : = [value] | != [value]");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[[name]] [[value]] ;");

    Assert.assertEquals(true,instance.hasMoreRuleParts());
    instance.nextRulePart();
    Assert.assertEquals(true,instance.hasMoreRuleParts());
    instance.nextRulePart();
    Assert.assertEquals(true,instance.hasMoreRuleParts());
    instance.nextRulePart();
    Assert.assertEquals(false,instance.hasMoreRuleParts());

    instance.resetRulePart();
    Assert.assertEquals(true,instance.hasMoreRuleParts());

  }

  @Test
  public void nextRulePart()
  {
    parser.addRule("program : [[name]] [[value]] ;");
    parser.addRule("name : [first] . [second]");
    parser.addRule("value : = [value] | != [value]");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[[name]] [[value]] ;");

    Assert.assertEquals(true,instance.hasMoreRuleParts());
    Assert.assertEquals("name",instance.nextRulePart().getName());
    Assert.assertEquals("value",instance.nextRulePart().getName());
    Assert.assertEquals(";",instance.nextRulePart().getName());
    Assert.assertEquals(null,instance.nextRulePart().getName());
    instance.resetRulePart();
    Assert.assertEquals("name",instance.nextRulePart().getName());
  }

  @Test
  public void addStopAtToLastNextIdentifier()
  {
    parser.addRule("program : [name] [value]");
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[name] [value]",";");
    Assert.assertEquals(1,instance.getRulePart(1).getNextIdentifiers().length);
    Assert.assertEquals(";",instance.getRulePart(1).getNextIdentifiers()[0]);
  }

  @Test
  public void addManyStopAtToLastNextIdentifier()
  {
    parser.addRule("program : [name] [value]");
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[name]] [value]",";",":");
    Assert.assertEquals(2,instance.getRulePart(1).getNextIdentifiers().length);
    Assert.assertEquals(";",instance.getRulePart(1).getNextIdentifiers()[0]);
    Assert.assertEquals(":",instance.getRulePart(1).getNextIdentifiers()[1]);
  }

  @Test
  public void updateNextIdentifier()
  {
    parser.addRule("program : [name] [value]");
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[name]] [value]");
    instance.addRulePart(new RulePart(";","1"));
    Assert.assertEquals(0,instance.getRulePart(1).getNextIdentifiers().length);

    instance.updateNextIdentifier();
    Assert.assertEquals(1,instance.getRulePart(1).getNextIdentifiers().length);
    Assert.assertEquals(";",instance.getRulePart(1).getNextIdentifiers()[0]);
  }

  @Test
  public void getNextIdentifier_Complex()
  {
    parser.addRule("attribute : [=unique]? [=modifier:immutable|settable|internal|defaulted|const]? [type,name>1,0] (= [value])? ;");
    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[=unique]? [=modifier:immutable|settable|internal|defaulted|const]? [type,name>1,0] [[anonymous::attribute::1]]? ;");

    RulePart part = instance.getRulePart(2);
    Assert.assertEquals("type,name>1,0",part.getName());
    Assert.assertEquals(2, part.getNextIdentifiers().length);
    Assert.assertEquals("=", part.getNextIdentifiers()[0]);
    Assert.assertEquals(";", part.getNextIdentifiers()[1]);
  }

  @Test
  public void getNextIdentifier_EOLs()
  {
    parser.addRule("program- : [[comment]]* [[useStatement]]? [[comment]]*");
    parser.addRule("comment- : [[inlineComment]] | [[multilineComment]]");
    parser.addRule("useStatement- : use [useStatement] ;");
    parser.addRule("inlineComment- : // [*inlineComment]");
    parser.addRule("multilineComment- : /* [**multilineComment] */");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("[[comment]]* [[useStatement]]? [[comment]]*");

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("comment",part.getName());
    Assert.assertEquals(1, part.getNextIdentifiers().length);
    Assert.assertEquals("use", part.getNextIdentifiers()[0]);
  }

  @Test
  public void getNextIdentifier_Nested()
  {
    parser.addRule("attribute : name [[value]] ;");
    parser.addRule("value : [[start]] . [end]");
    parser.addRule("start : xyz [front]");

    RuleInstance instance = new RuleInstance(parser);
    instance.configureDefinition("name [[value]] ;");

    RulePart part = instance.getRulePart(0);
    Assert.assertEquals("name",part.getName());
    Assert.assertEquals(1,part.getNextIdentifiers().length);
    Assert.assertEquals("xyz",part.getNextIdentifiers()[0]);
  }

}


text:
You fling open the door of the oven, yummy yet ultra hot pie fumes blasting out at you. Fortunately you're wearing
your trusty purple flame retardant suit. You grab the pies, all eight of them, and slam the door shut again. You
won't be able to get far with all these pies in your arms.

Do you:


text:
ByteScout tutorials are designed to explain the code for both C# beginners and advanced programmers. What is ByteScout Spreadsheet SDK? It is the library (SDK) that is capable of writing, reading, modifying and calculating Excel and CSV spreadsheets. Most popular formulas can be calculated and reculculated with Excel installed. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays. It can help you to export to 2d array in your C# application.

This rich sample source code in C# for ByteScout Spreadsheet SDK includes the number of functions and options you should do calling the API to export to 2d array. In your C# project or application you may simply copy & paste the code and then run your app! Enjoy writing a code with ready-to-use sample codes in C#.

Free trial version of ByteScout Spreadsheet SDK is available on our website. Documentation and source code samples are included.

## REQUEST FREE TECH SUPPORT

[Click here to get in touch](https://bytescout.zendesk.com/hc/en-us/requests/new?subject=ByteScout%20Spreadsheet%20SDK%20Question)

or just send email to [support@bytescout.com](mailto:support@bytescout.com?subject=ByteScout%20Spreadsheet%20SDK%20Question)

## ON-PREMISE OFFLINE SDK

[Get Your 60 Day Free Trial](https://bytescout.com/download/web-installer?utm_source=github-readme)
[Explore SDK Docs](https://bytescout.com/documentation/index.html?utm_source=github-readme)
[Sign Up For Online Training](https://academy.bytescout.com/)

## ON-DEMAND REST WEB API

[Get your API key](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Documentation](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Samples](https://github.com/bytescout/ByteScout-SDK-SourceCode/tree/master/PDF.co%20Web%20API)

## VIDEO REVIEW

[https://www.youtube.com/watch?v=nm_7I0PN1TY](https://www.youtube.com/watch?v=nm_7I0PN1TY)

<!-- code block begin -->

##### ****ExportTo2DArray.VS2005.csproj:**

```
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{5E4683AA-4992-4259-8FF7-E081586F16A7}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray</RootNamespace>
    <AssemblyName>Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray</AssemblyName>
    <TargetFrameworkProfile>
    </TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Spreadsheet, Version=2.3.0.750, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\lib\Bytescout.Spreadsheet.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="StockPricesSpreadsheet.xls">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****ExportTo2DArray.VS2008.csproj:**

```
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{5E4683AA-4992-4259-8FF7-E081586F16A7}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray</RootNamespace>
    <AssemblyName>Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray</AssemblyName>
    <TargetFrameworkProfile>
    </TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
    <OldToolsVersion>2.0</OldToolsVersion>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Spreadsheet, Version=2.3.0.750, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\lib\Bytescout.Spreadsheet.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="StockPricesSpreadsheet.xls">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****ExportTo2DArray.VS2010.csproj:**

```
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>
    </ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{5E4683AA-4992-4259-8FF7-E081586F16A7}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray</RootNamespace>
    <AssemblyName>Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray</AssemblyName>
    <TargetFrameworkProfile>
    </TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Spreadsheet, Version=2.3.0.750, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\lib\Bytescout.Spreadsheet.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="StockPricesSpreadsheet.xls">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****Program.cs:**

```
using System;

namespace Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray
{
    class Program
    {
        static void Main(string[] args)
        {
            const string inputFile = @"StockPricesSpreadsheet.xls";

            // Open and load spreadsheet
            Spreadsheet spreadsheet = new Spreadsheet();
            spreadsheet.LoadFromFile(inputFile);

            // Get the data from the spreadsheet
            string[,] stockPrices = spreadsheet.ExportTo2DArray();

            // Close spreadsheet
            spreadsheet.Close();

            // Display data in data table
            for(int i = 0; i < stockPrices.GetLength(0); i++)
            {
                for(int j = 0; j < stockPrices.GetLength(1); j++)
                {
                    Console.Write(stockPrices[i,j] + " ");
                }
                Console.WriteLine();
            }

            // Pause
            Console.ReadLine();
        }
    }
}

```

<!-- code block end -->


text:
using System;
using nRoute.Components.Composition;
using nRoute.Components.Messaging;
using nRoute.Services;
using OGDC.Silverlight.Toolkit.Services.Services;

namespace OGDC.Silverlight.Toolkit.Services.Implementations.Services
{
    /// <summary>
    /// Classe de gestion des messages
    /// </summary>
    [MapService(typeof(IMessenging), InitializationMode = InitializationMode.OnDemand, Lifetime = InstanceLifetime.Singleton)]
    public class Messenging : IMessenging
    {
        /// <summary>
        /// Methode de création de l'Observer pour un type de message
        /// </summary>
        /// <typeparam name="T">Type du message</typeparam>
        /// <param name="action">Action executée lors de la récéption du message</param>
        /// <returns>Retourne un ChannelObserver du type du message"/></returns>
        public ChannelObserver<T> CreateObserver<T>(Action<T> action)
        {
            return new ChannelObserver<T>(action);
        }

        /// <summary>
        /// Methode de publication pour un type de message
        /// </summary>
        /// <typeparam name="T">Type du message</typeparam>
        /// <param name="msg">Message à transmettre</param>
        /// <param name="async">Definit si l'execution est asynchrone</param>
        public void Publish<T>(T msg, bool async = true)
        {
            Channel.Publish(msg, async);
        }
    }
}


text:
/*
 * Developed by the TrustedBSD Project.
 * Generic mandatory access module that does nothing.
 */

#include <sys/types.h>
#include <sys/param.h>
#include <sys/acl.h>
#include <sys/conf.h>
#include <sys/extattr.h>
#include <sys/kernel.h>
#include <sys/mac.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
#include <sys/sysent.h>
#include <sys/vnode.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/pipe.h>
#include <sys/sysctl.h>

#include <fs/devfs/devfs.h>

#include <net/bpfdesc.h>
#include <net/if.h>
#include <net/if_types.h>
#include <net/if_var.h>

#include <netinet/in.h>
#include <netinet/ip_var.h>

#include <vm/vm.h>

#include <sys/mac_policy.h>

SYSCTL_DECL(_security_mac);

SYSCTL_NODE(_security_mac, OID_AUTO, none, CTLFLAG_RW, 0,
    "TrustedBSD mac_none policy controls");

static int	mac_none_enabled = 1;
SYSCTL_INT(_security_mac_none, OID_AUTO, enabled, CTLFLAG_RW,
    &mac_none_enabled, 0, "Enforce none policy");

/*
 * Policy module operations.
 */
static void
mac_none_destroy(struct mac_policy_conf *conf)
{

}

static void
mac_none_init(struct mac_policy_conf *conf)
{

}

static int
mac_none_syscall(struct thread *td, int call, void *arg)
{

	return (0);
}

/*
 * Label operations.
 */
static void
mac_none_init_label(struct label *label)
{

}

static int
mac_none_init_label_waitcheck(struct label *label, int flag)
{

	return (0);
}

static void
mac_none_destroy_label(struct label *label)
{

}

static int
mac_none_externalize_label(struct label *label, char *element_name,
    char *element_data, size_t size, size_t *len, int *claimed)
{

	return (0);
}

static int
mac_none_internalize_label(struct label *label, char *element_name,
    char *element_data, int *claimed)
{

	return (0);
}

/*
 * Labeling event operations: file system objects, and things that look
 * a lot like file system objects.
 */
static void
mac_none_associate_vnode_devfs(struct mount *mp, struct label *fslabel,
    struct devfs_dirent *de, struct label *delabel, struct vnode *vp,
    struct label *vlabel)
{

}

static int
mac_none_associate_vnode_extattr(struct mount *mp, struct label *fslabel,
    struct vnode *vp, struct label *vlabel)
{

	return (0);
}

static void
mac_none_associate_vnode_singlelabel(struct mount *mp,
    struct label *fslabel, struct vnode *vp, struct label *vlabel)
{

}

static void
mac_none_create_devfs_device(struct mount *mp, dev_t dev,
    struct devfs_dirent *devfs_dirent, struct label *label)
{

}

static void
mac_none_create_devfs_directory(struct mount *mp, char *dirname,
    int dirnamelen, struct devfs_dirent *devfs_dirent, struct label *label)
{

}

static void
mac_none_create_devfs_symlink(struct ucred *cred, struct mount *mp,
    struct devfs_dirent *dd, struct label *ddlabel, struct devfs_dirent *de,
    struct label *delabel)
{

}

static int
mac_none_create_vnode_extattr(struct ucred *cred, struct mount *mp,
    struct label *fslabel, struct vnode *dvp, struct label *dlabel,
    struct vnode *vp, struct label *vlabel, struct componentname *cnp)
{

	return (0);
}

static void
mac_none_create_mount(struct ucred *cred, struct mount *mp,
    struct label *mntlabel, struct label *fslabel)
{

}

static void
mac_none_create_root_mount(struct ucred *cred, struct mount *mp,
    struct label *mntlabel, struct label *fslabel)
{

}

static void
mac_none_relabel_vnode(struct ucred *cred, struct vnode *vp,
    struct label *vnodelabel, struct label *label)
{

}

static int
mac_none_setlabel_vnode_extattr(struct ucred *cred, struct vnode *vp,
    struct label *vlabel, struct label *intlabel)
{

	return (0);
}

static void
mac_none_update_devfsdirent(struct mount *mp,
    struct devfs_dirent *devfs_dirent, struct label *direntlabel,
    struct vnode *vp, struct label *vnodelabel)
{

}

/*
 * Labeling event operations: IPC object.
 */
static void
mac_none_create_mbuf_from_socket(struct socket *so, struct label *socketlabel,
    struct mbuf *m, struct label *mbuflabel)
{

}

static void
mac_none_create_socket(struct ucred *cred, struct socket *socket,
    struct label *socketlabel)
{

}

static void
mac_none_create_pipe(struct ucred *cred, struct pipe *pipe,
    struct label *pipelabel)
{

}

static void
mac_none_create_socket_from_socket(struct socket *oldsocket,
    struct label *oldsocketlabel, struct socket *newsocket,
    struct label *newsocketlabel)
{

}

static void
mac_none_relabel_socket(struct ucred *cred, struct socket *socket,
    struct label *socketlabel, struct label *newlabel)
{

}

static void
mac_none_relabel_pipe(struct ucred *cred, struct pipe *pipe,
    struct label *pipelabel, struct label *newlabel)
{

}

static void
mac_none_set_socket_peer_from_mbuf(struct mbuf *mbuf, struct label *mbuflabel,
    struct socket *socket, struct label *socketpeerlabel)
{

}

static void
mac_none_set_socket_peer_from_socket(struct socket *oldsocket,
    struct label *oldsocketlabel, struct socket *newsocket,
    struct label *newsocketpeerlabel)
{

}

/*
 * Labeling event operations: network objects.
 */
static void
mac_none_create_bpfdesc(struct ucred *cred, struct bpf_d *bpf_d,
    struct label *bpflabel)
{

}

static void
mac_none_create_datagram_from_ipq(struct ipq *ipq, struct label *ipqlabel,
    struct mbuf *datagram, struct label *datagramlabel)
{

}

static void
mac_none_create_fragment(struct mbuf *datagram, struct label *datagramlabel,
    struct mbuf *fragment, struct label *fragmentlabel)
{

}

static void
mac_none_create_ifnet(struct ifnet *ifnet, struct label *ifnetlabel)
{

}

static void
mac_none_create_ipq(struct mbuf *fragment, struct label *fragmentlabel,
    struct ipq *ipq, struct label *ipqlabel)
{

}

static void
mac_none_create_mbuf_from_mbuf(struct mbuf *oldmbuf,
    struct label *oldmbuflabel, struct mbuf *newmbuf,
    struct label *newmbuflabel)
{

}

static void
mac_none_create_mbuf_linklayer(struct ifnet *ifnet, struct label *ifnetlabel,
    struct mbuf *mbuf, struct label *mbuflabel)
{

}

static void
mac_none_create_mbuf_from_bpfdesc(struct bpf_d *bpf_d, struct label *bpflabel,
    struct mbuf *mbuf, struct label *mbuflabel)
{

}

static void
mac_none_create_mbuf_from_ifnet(struct ifnet *ifnet, struct label *ifnetlabel,
    struct mbuf *m, struct label *mbuflabel)
{

}

static void
mac_none_create_mbuf_multicast_encap(struct mbuf *oldmbuf,
    struct label *oldmbuflabel, struct ifnet *ifnet, struct label *ifnetlabel,
    struct mbuf *newmbuf, struct label *newmbuflabel)
{

}

static void
mac_none_create_mbuf_netlayer(struct mbuf *oldmbuf,
    struct label *oldmbuflabel, struct mbuf *newmbuf, struct label *newmbuflabel)
{

}

static int
mac_none_fragment_match(struct mbuf *fragment, struct label *fragmentlabel,
    struct ipq *ipq, struct label *ipqlabel)
{

	return (1);
}

static void
mac_none_relabel_ifnet(struct ucred *cred, struct ifnet *ifnet,
    struct label *ifnetlabel, struct label *newlabel)
{

}

static void
mac_none_update_ipq(struct mbuf *fragment, struct label *fragmentlabel,
    struct ipq *ipq, struct label *ipqlabel)
{

}

/*
 * Labeling event operations: processes.
 */
static void
mac_none_create_cred(struct ucred *cred_parent, struct ucred *cred_child)
{

}

static void
mac_none_execve_transition(struct ucred *old, struct ucred *new,
    struct vnode *vp, struct label *vnodelabel,
    struct label *interpvnodelabel, struct image_params *imgp,
    struct label *execlabel)
{

}

static int
mac_none_execve_will_transition(struct ucred *old, struct vnode *vp,
    struct label *vnodelabel, struct label *interpvnodelabel,
    struct image_params *imgp, struct label *execlabel)
{

	return (0);
}

static void
mac_none_create_proc0(struct ucred *cred)
{

}

static void
mac_none_create_proc1(struct ucred *cred)
{

}

static void
mac_none_relabel_cred(struct ucred *cred, struct label *newlabel)
{

}

/*
 * Access control checks.
 */
static int
mac_none_check_bpfdesc_receive(struct bpf_d *bpf_d, struct label *bpflabel,
    struct ifnet *ifnet, struct label *ifnet_label)
{

        return (0);
}

static int
mac_none_check_cred_relabel(struct ucred *cred, struct label *newlabel)
{

	return (0);
}

static int
mac_none_check_cred_visible(struct ucred *u1, struct ucred *u2)
{

	return (0);
}

static int
mac_none_check_ifnet_relabel(struct ucred *cred, struct ifnet *ifnet,
    struct label *ifnetlabel, struct label *newlabel)
{

	return (0);
}

static int
mac_none_check_ifnet_transmit(struct ifnet *ifnet, struct label *ifnetlabel,
    struct mbuf *m, struct label *mbuflabel)
{

	return (0);
}

static int
mac_none_check_mount_stat(struct ucred *cred, struct mount *mp,
    struct label *mntlabel)
{

	return (0);
}

static int
mac_none_check_pipe_ioctl(struct ucred *cred, struct pipe *pipe,
    struct label *pipelabel, unsigned long cmd, void /* caddr_t */ *data)
{

	return (0);
}

static int
mac_none_check_pipe_poll(struct ucred *cred, struct pipe *pipe,
    struct label *pipelabel)
{

	return (0);
}

static int
mac_none_check_pipe_read(struct ucred *cred, struct pipe *pipe,
    struct label *pipelabel)
{

	return (0);
}

static int
mac_none_check_pipe_relabel(struct ucred *cred, struct pipe *pipe,
    struct label *pipelabel, struct label *newlabel)
{

	return (0);
}

static int
mac_none_check_pipe_stat(struct ucred *cred, struct pipe *pipe,
    struct label *pipelabel)
{

	return (0);
}

static int
mac_none_check_pipe_write(struct ucred *cred, struct pipe *pipe,
    struct label *pipelabel)
{

	return (0);
}

static int
mac_none_check_proc_debug(struct ucred *cred, struct proc *proc)
{

	return (0);
}

static int
mac_none_check_proc_sched(struct ucred *cred, struct proc *proc)
{

	return (0);
}

static int
mac_none_check_proc_signal(struct ucred *cred, struct proc *proc, int signum)
{

	return (0);
}

static int
mac_none_check_socket_bind(struct ucred *cred, struct socket *socket,
    struct label *socketlabel, struct sockaddr *sockaddr)
{

	return (0);
}

static int
mac_none_check_socket_connect(struct ucred *cred, struct socket *socket,
    struct label *socketlabel, struct sockaddr *sockaddr)
{

	return (0);
}

static int
mac_none_check_socket_deliver(struct socket *so, struct label *socketlabel,
    struct mbuf *m, struct label *mbuflabel)
{

	return (0);
}

static int
mac_none_check_socket_listen(struct ucred *cred, struct socket *so,
    struct label *socketlabel)
{

	return (0);
}

static int
mac_none_check_socket_relabel(struct ucred *cred, struct socket *socket,
    struct label *socketlabel, struct label *newlabel)
{

	return (0);
}

static int
mac_none_check_socket_visible(struct ucred *cred, struct socket *socket,
   struct label *socketlabel)
{

	return (0);
}

static int
mac_none_check_system_reboot(struct ucred *cred, int how)
{

	return (0);
}

static int
mac_none_check_system_swapon(struct ucred *cred, struct vnode *vp,
    struct label *label)
{

	return (0);
}

static int
mac_none_check_system_sysctl(struct ucred *cred, int *name, u_int namelen,
    void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen)
{

	return (0);
}

static int
mac_none_check_vnode_access(struct ucred *cred, struct vnode *vp,
    struct label *label, int acc_mode)
{

	return (0);
}

static int
mac_none_check_vnode_chdir(struct ucred *cred, struct vnode *dvp,
    struct label *dlabel)
{

	return (0);
}

static int
mac_none_check_vnode_chroot(struct ucred *cred, struct vnode *dvp,
    struct label *dlabel)
{

	return (0);
}

static int
mac_none_check_vnode_create(struct ucred *cred, struct vnode *dvp,
    struct label *dlabel, struct componentname *cnp, struct vattr *vap)
{

	return (0);
}

static int
mac_none_check_vnode_delete(struct ucred *cred, struct vnode *dvp,
    struct label *dlabel, struct vnode *vp, struct label *label,
    struct componentname *cnp)
{

	return (0);
}

static int
mac_none_check_vnode_deleteacl(struct ucred *cred, struct vnode *vp,
    struct label *label, acl_type_t type)
{

	return (0);
}

static int
mac_none_check_vnode_exec(struct ucred *cred, struct vnode *vp,
    struct label *label, struct image_params *imgp,
    struct label *execlabel)
{

	return (0);
}

static int
mac_none_check_vnode_getacl(struct ucred *cred, struct vnode *vp,
    struct label *label, acl_type_t type)
{

	return (0);
}

static int
mac_none_check_vnode_getextattr(struct ucred *cred, struct vnode *vp,
    struct label *label, int attrnamespace, const char *name, struct uio *uio)
{

	return (0);
}

static int
mac_none_check_vnode_link(struct ucred *cred, struct vnode *dvp,
    struct label *dlabel, struct vnode *vp, struct label *label,
    struct componentname *cnp)
{

	return (0);
}

static int
mac_none_check_vnode_lookup(struct ucred *cred, struct vnode *dvp,
    struct label *dlabel, struct componentname *cnp)
{

	return (0);
}

static int
mac_none_check_vnode_mmap(struct ucred *cred, struct vnode *vp,
    struct label *label, int prot)
{

	return (0);
}

static int
mac_none_check_vnode_mprotect(struct ucred *cred, struct vnode *vp,
    struct label *label, int prot)
{

	return (0);
}

static int
mac_none_check_vnode_open(struct ucred *cred, struct vnode *vp,
    struct label *filelabel, int acc_mode)
{

	return (0);
}

static int
mac_none_check_vnode_poll(struct ucred *active_cred, struct ucred *file_cred,
    struct vnode *vp, struct label *label)
{

	return (0);
}

static int
mac_none_check_vnode_read(struct ucred *active_cred, struct ucred *file_cred,
    struct vnode *vp, struct label *label)
{

	return (0);
}

static int
mac_none_check_vnode_readdir(struct ucred *cred, struct vnode *vp,
    struct label *dlabel)
{

	return (0);
}

static int
mac_none_check_vnode_readlink(struct ucred *cred, struct vnode *vp,
    struct label *vnodelabel)
{

	return (0);
}

static int
mac_none_check_vnode_relabel(struct ucred *cred, struct vnode *vp,
    struct label *vnodelabel, struct label *newlabel)
{

	return (0);
}

static int
mac_none_check_vnode_rename_from(struct ucred *cred, struct vnode *dvp,
    struct label *dlabel, struct vnode *vp, struct label *label,
    struct componentname *cnp)
{

	return (0);
}

static int
mac_none_check_vnode_rename_to(struct ucred *cred, struct vnode *dvp,
    struct label *dlabel, struct vnode *vp, struct label *label, int samedir,
    struct componentname *cnp)
{

	return (0);
}

static int
mac_none_check_vnode_revoke(struct ucred *cred, struct vnode *vp,
    struct label *label)
{

	return (0);
}

static int
mac_none_check_vnode_setacl(struct ucred *cred, struct vnode *vp,
    struct label *label, acl_type_t type, struct acl *acl)
{

	return (0);
}

static int
mac_none_check_vnode_setextattr(struct ucred *cred, struct vnode *vp,
    struct label *label, int attrnamespace, const char *name, struct uio *uio)
{

	return (0);
}

static int
mac_none_check_vnode_setflags(struct ucred *cred, struct vnode *vp,
    struct label *label, u_long flags)
{

	return (0);
}

static int
mac_none_check_vnode_setmode(struct ucred *cred, struct vnode *vp,
    struct label *label, mode_t mode)
{

	return (0);
}

static int
mac_none_check_vnode_setowner(struct ucred *cred, struct vnode *vp,
    struct label *label, uid_t uid, gid_t gid)
{

	return (0);
}

static int
mac_none_check_vnode_setutimes(struct ucred *cred, struct vnode *vp,
    struct label *label, struct timespec atime, struct timespec mtime)
{

	return (0);
}

static int
mac_none_check_vnode_stat(struct ucred *active_cred, struct ucred *file_cred,
    struct vnode *vp, struct label *label)
{

	return (0);
}

static int
mac_none_check_vnode_write(struct ucred *active_cred,
    struct ucred *file_cred, struct vnode *vp, struct label *label)
{

	return (0);
}

static struct mac_policy_ops mac_none_ops =
{
	.mpo_destroy = mac_none_destroy,
	.mpo_init = mac_none_init,
	.mpo_syscall = mac_none_syscall,
	.mpo_init_bpfdesc_label = mac_none_init_label,
	.mpo_init_cred_label = mac_none_init_label,
	.mpo_init_devfsdirent_label = mac_none_init_label,
	.mpo_init_ifnet_label = mac_none_init_label,
	.mpo_init_ipq_label = mac_none_init_label,
	.mpo_init_mbuf_label = mac_none_init_label_waitcheck,
	.mpo_init_mount_label = mac_none_init_label,
	.mpo_init_mount_fs_label = mac_none_init_label,
	.mpo_init_pipe_label = mac_none_init_label,
	.mpo_init_socket_label = mac_none_init_label_waitcheck,
	.mpo_init_socket_peer_label = mac_none_init_label_waitcheck,
	.mpo_init_vnode_label = mac_none_init_label,
	.mpo_destroy_bpfdesc_label = mac_none_destroy_label,
	.mpo_destroy_cred_label = mac_none_destroy_label,
	.mpo_destroy_devfsdirent_label = mac_none_destroy_label,
	.mpo_destroy_ifnet_label = mac_none_destroy_label,
	.mpo_destroy_ipq_label = mac_none_destroy_label,
	.mpo_destroy_mbuf_label = mac_none_destroy_label,
	.mpo_destroy_mount_label = mac_none_destroy_label,
	.mpo_destroy_mount_fs_label = mac_none_destroy_label,
	.mpo_destroy_pipe_label = mac_none_destroy_label,
	.mpo_destroy_socket_label = mac_none_destroy_label,
	.mpo_destroy_socket_peer_label = mac_none_destroy_label,
	.mpo_destroy_vnode_label = mac_none_destroy_label,
	.mpo_externalize_cred_label = mac_none_externalize_label,
	.mpo_externalize_ifnet_label = mac_none_externalize_label,
	.mpo_externalize_pipe_label = mac_none_externalize_label,
	.mpo_externalize_socket_label = mac_none_externalize_label,
	.mpo_externalize_socket_peer_label = mac_none_externalize_label,
	.mpo_externalize_vnode_label = mac_none_externalize_label,
	.mpo_internalize_cred_label = mac_none_internalize_label,
	.mpo_internalize_ifnet_label = mac_none_internalize_label,
	.mpo_internalize_pipe_label = mac_none_internalize_label,
	.mpo_internalize_socket_label = mac_none_internalize_label,
	.mpo_internalize_vnode_label = mac_none_internalize_label,
	.mpo_associate_vnode_devfs = mac_none_associate_vnode_devfs,
	.mpo_associate_vnode_extattr = mac_none_associate_vnode_extattr,
	.mpo_associate_vnode_singlelabel = mac_none_associate_vnode_singlelabel,
	.mpo_create_devfs_device = mac_none_create_devfs_device,
	.mpo_create_devfs_directory = mac_none_create_devfs_directory,
	.mpo_create_devfs_symlink = mac_none_create_devfs_symlink,
	.mpo_create_vnode_extattr = mac_none_create_vnode_extattr,
	.mpo_create_mount = mac_none_create_mount,
	.mpo_create_root_mount = mac_none_create_root_mount,
	.mpo_relabel_vnode = mac_none_relabel_vnode,
	.mpo_setlabel_vnode_extattr = mac_none_setlabel_vnode_extattr,
	.mpo_update_devfsdirent = mac_none_update_devfsdirent,
	.mpo_create_mbuf_from_socket = mac_none_create_mbuf_from_socket,
	.mpo_create_pipe = mac_none_create_pipe,
	.mpo_create_socket = mac_none_create_socket,
	.mpo_create_socket_from_socket = mac_none_create_socket_from_socket,
	.mpo_relabel_pipe = mac_none_relabel_pipe,
	.mpo_relabel_socket = mac_none_relabel_socket,
	.mpo_set_socket_peer_from_mbuf = mac_none_set_socket_peer_from_mbuf,
	.mpo_set_socket_peer_from_socket = mac_none_set_socket_peer_from_socket,
	.mpo_create_bpfdesc = mac_none_create_bpfdesc,
	.mpo_create_ifnet = mac_none_create_ifnet,
	.mpo_create_ipq = mac_none_create_ipq,
	.mpo_create_datagram_from_ipq = mac_none_create_datagram_from_ipq,
	.mpo_create_fragment = mac_none_create_fragment,
	.mpo_create_ipq = mac_none_create_ipq,
	.mpo_create_mbuf_from_mbuf = mac_none_create_mbuf_from_mbuf,
	.mpo_create_mbuf_linklayer = mac_none_create_mbuf_linklayer,
	.mpo_create_mbuf_from_bpfdesc = mac_none_create_mbuf_from_bpfdesc,
	.mpo_create_mbuf_from_ifnet = mac_none_create_mbuf_from_ifnet,
	.mpo_create_mbuf_multicast_encap = mac_none_create_mbuf_multicast_encap,
	.mpo_create_mbuf_netlayer = mac_none_create_mbuf_netlayer,
	.mpo_fragment_match = mac_none_fragment_match,
	.mpo_relabel_ifnet = mac_none_relabel_ifnet,
	.mpo_update_ipq = mac_none_update_ipq,
	.mpo_create_cred = mac_none_create_cred,
	.mpo_execve_transition = mac_none_execve_transition,
	.mpo_execve_will_transition = mac_none_execve_will_transition,
	.mpo_create_proc0 = mac_none_create_proc0,
	.mpo_create_proc1 = mac_none_create_proc1,
	.mpo_relabel_cred = mac_none_relabel_cred,
	.mpo_check_bpfdesc_receive = mac_none_check_bpfdesc_receive,
	.mpo_check_cred_relabel = mac_none_check_cred_relabel,
	.mpo_check_cred_visible = mac_none_check_cred_visible,
	.mpo_check_ifnet_relabel = mac_none_check_ifnet_relabel,
	.mpo_check_ifnet_transmit = mac_none_check_ifnet_transmit,
	.mpo_check_mount_stat = mac_none_check_mount_stat,
	.mpo_check_pipe_ioctl = mac_none_check_pipe_ioctl,
	.mpo_check_pipe_poll = mac_none_check_pipe_poll,
	.mpo_check_pipe_read = mac_none_check_pipe_read,
	.mpo_check_pipe_relabel = mac_none_check_pipe_relabel,
	.mpo_check_pipe_stat = mac_none_check_pipe_stat,
	.mpo_check_pipe_write = mac_none_check_pipe_write,
	.mpo_check_proc_debug = mac_none_check_proc_debug,
	.mpo_check_proc_sched = mac_none_check_proc_sched,
	.mpo_check_proc_signal = mac_none_check_proc_signal,
	.mpo_check_socket_bind = mac_none_check_socket_bind,
	.mpo_check_socket_connect = mac_none_check_socket_connect,
	.mpo_check_socket_deliver = mac_none_check_socket_deliver,
	.mpo_check_socket_listen = mac_none_check_socket_listen,
	.mpo_check_socket_relabel = mac_none_check_socket_relabel,
	.mpo_check_socket_visible = mac_none_check_socket_visible,
	.mpo_check_system_reboot = mac_none_check_system_reboot,
	.mpo_check_system_swapon = mac_none_check_system_swapon,
	.mpo_check_system_sysctl = mac_none_check_system_sysctl,
	.mpo_check_vnode_access = mac_none_check_vnode_access,
	.mpo_check_vnode_chdir = mac_none_check_vnode_chdir,
	.mpo_check_vnode_chroot = mac_none_check_vnode_chroot,
	.mpo_check_vnode_create = mac_none_check_vnode_create,
	.mpo_check_vnode_delete = mac_none_check_vnode_delete,
	.mpo_check_vnode_deleteacl = mac_none_check_vnode_deleteacl,
	.mpo_check_vnode_exec = mac_none_check_vnode_exec,
	.mpo_check_vnode_getacl = mac_none_check_vnode_getacl,
	.mpo_check_vnode_getextattr = mac_none_check_vnode_getextattr,
	.mpo_check_vnode_link = mac_none_check_vnode_link,
	.mpo_check_vnode_lookup = mac_none_check_vnode_lookup,
	.mpo_check_vnode_mmap = mac_none_check_vnode_mmap,
	.mpo_check_vnode_mprotect = mac_none_check_vnode_mprotect,
	.mpo_check_vnode_open = mac_none_check_vnode_open,
	.mpo_check_vnode_poll = mac_none_check_vnode_poll,
	.mpo_check_vnode_read = mac_none_check_vnode_read,
	.mpo_check_vnode_readdir = mac_none_check_vnode_readdir,
	.mpo_check_vnode_readlink = mac_none_check_vnode_readlink,
	.mpo_check_vnode_relabel = mac_none_check_vnode_relabel,
	.mpo_check_vnode_rename_from = mac_none_check_vnode_rename_from,
	.mpo_check_vnode_rename_to = mac_none_check_vnode_rename_to,
	.mpo_check_vnode_revoke = mac_none_check_vnode_revoke,
	.mpo_check_vnode_setacl = mac_none_check_vnode_setacl,
	.mpo_check_vnode_setextattr = mac_none_check_vnode_setextattr,
	.mpo_check_vnode_setflags = mac_none_check_vnode_setflags,
	.mpo_check_vnode_setmode = mac_none_check_vnode_setmode,
	.mpo_check_vnode_setowner = mac_none_check_vnode_setowner,
	.mpo_check_vnode_setutimes = mac_none_check_vnode_setutimes,
	.mpo_check_vnode_stat = mac_none_check_vnode_stat,
	.mpo_check_vnode_write = mac_none_check_vnode_write,
};

MAC_POLICY_SET(&mac_none_ops, trustedbsd_mac_none, "TrustedBSD MAC/None",
    MPC_LOADTIME_FLAG_UNLOADOK, NULL);


text:
package org.opengroup.osdu.ingest.provider.interfaces;

import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.ingest.model.SubmitRequest;
import org.opengroup.osdu.ingest.model.SubmitResponse;

public interface ISubmitService {

  /**
   * Main method of ingest service. Performs request validation and integration with File service
   * and Workflow service.
   *
   * @param payload Information about the file to ingest
   * @param headers headers
   * @return response
   */
  SubmitResponse submit(SubmitRequest payload, DpsHeaders headers);
}


text:
import Ember from 'ember';
import { moduleForComponent } from 'ember-qunit';
import test from '../../ember-sinon-qunit/test';
import GMapComponent from 'ember-g-map/components/g-map';
import sinon from 'sinon';

const { run } = Ember;

let fakePlacesService;
let component;

moduleForComponent('g-map-address-marker', 'Unit | Component | g map address marker', {
  // Specify the other units that are required for this test
  // needs: ['component:foo', 'helper:bar'],
  unit: true,

  beforeEach() {
    fakePlacesService = {
      textSearch: sinon.stub()
    };
    sinon.stub(google.maps.places, 'PlacesService').returns(fakePlacesService);
    component = this.subject({
      mapContext: new GMapComponent()
    });
  },

  afterEach() {
    google.maps.places.PlacesService.restore();
  }
});

test('it calls `initPlacesService` on `didInsertElement`', function() {
  component.initPlacesService = sinon.stub();
  component.trigger('didInsertElement');
  sinon.assert.calledOnce(component.initPlacesService);
});

test('it constructs new `PlacesService` on `initPlacesService` call', function(assert) {
  run(() => component.set('map', {}));
  run(() => component.initPlacesService());

  sinon.assert.calledOnce(google.maps.places.PlacesService);
  assert.equal(component.get('placesService'), fakePlacesService);
});

test('new `PlacesService` isn\'t being constructed if it\'s already present in component', function() {
  run(() => component.setProperties({
    placesService: fakePlacesService,
    map: {}
  }));
  run(() => component.initPlacesService());

  sinon.assert.notCalled(google.maps.places.PlacesService);
});

test('it triggers `initPlacesService` on `mapContext.map` change', function() {
  run(() => component.set('mapContext', { map: '' }));
  component.initPlacesService = sinon.spy();
  run(() => component.set('mapContext.map', {}));
  sinon.assert.calledOnce(component.initPlacesService);
});

test('it triggers `searchLocation` on `initPlacesService` call', function() {
  component.searchLocation = sinon.stub();

  run(() => component.set('map', {}));
  run(() => component.initPlacesService());

  sinon.assert.calledOnce(component.searchLocation);
});

test('it triggers `searchLocation` on `address` change', function() {
  component.searchLocation = sinon.stub();
  run(() => component.set('address', 'query string'));
  sinon.assert.calledOnce(component.searchLocation);
});

test('it calls `textSearch` of placesService on `searchLocation`', function() {
  run(() => component.set('address', 'query string'));
  run(() => component.set('placesService', fakePlacesService));

  fakePlacesService.textSearch = sinon.stub();
  run(() => component.searchLocation());

  const correctRequest = { query: 'query string' };

  sinon.assert.calledOnce(fakePlacesService.textSearch);
  sinon.assert.calledWith(fakePlacesService.textSearch, correctRequest);
});

test('it calls `updateLocation` after successful textSearch on `searchLocation`', function() {
  const results = [{ a: 1 }, { b: 2 }];
  const status = google.maps.places.PlacesServiceStatus.OK;

  run(() => component.set('address', 'query string'));
  run(() => component.set('placesService', fakePlacesService));

  fakePlacesService.textSearch.callsArgWith(1, results, status);
  component.updateLocation = sinon.stub();
  run(() => component.searchLocation());

  sinon.assert.calledOnce(component.updateLocation);
  sinon.assert.calledWith(component.updateLocation, results);
});

test('it sets `lat` & `lng` of the first provided result on `updateLocation`', function(assert) {
  const results = [{
    geometry: {
      location: {
        lat: () => 12,
        lng: () => -20
      }
    }
  }, {
    geometry: {
      location: {
        lat: () => 24,
        lng: () => 100
      }
    }
  }];

  run(() => component.set('attrs', {}));
  run(() => component.updateLocation(results));

  assert.equal(component.get('lat'), 12);
  assert.equal(component.get('lng'), -20);
});

test('it calls `sendOnLocationChange` on `updateLocation`', function() {
  const results = [{
    geometry: {
      location: {
        lat: () => 12,
        lng: () => -20
      }
    }
  }, {
    geometry: {
      location: {
        lat: () => 24,
        lng: () => 100
      }
    }
  }];

  component.sendOnLocationChange = sinon.stub();
  run(() => component.set('attrs', {}));
  run(() => component.updateLocation(results));

  sinon.assert.calledOnce(component.sendOnLocationChange);
  sinon.assert.calledWith(component.sendOnLocationChange, 12, -20, results);
});

test('it sends action `onLocationChange` on `sendOnLocationChange`', function() {
  const results = [{ a: 1 }, { b: 2 }];
  component.sendAction = sinon.stub();

  run(() => component.set('attrs', { onLocationChange: 'action' }));
  run(() => component.sendOnLocationChange(12, 30, results));

  sinon.assert.calledOnce(component.sendAction);
  sinon.assert.calledWith(component.sendAction, 'onLocationChange', 12, 30, results);
});

test('it runs closure action `attrs.onLocationChange` directly on `updateLocation`', function() {
  const results = [{ a: 1 }, { b: 2 }];
  run(() => component.set('attrs', { onLocationChange: sinon.stub() }));
  run(() => component.sendOnLocationChange(12, 30, results));

  sinon.assert.calledOnce(component.attrs.onLocationChange);
  sinon.assert.calledWith(component.attrs.onLocationChange, 12, 30, results);
});


text:
package com.milaboratory.core.io.util;

import org.apache.commons.math3.random.RandomGenerator;
import org.apache.commons.math3.random.Well1024a;
import org.junit.Assert;
import org.junit.Test;

import java.io.File;

import static com.milaboratory.core.io.util.IOTestUtil.*;

public class AbstractRandomAccessReaderTest {
    @Test
    public void test1() throws Exception {
        File tempFile = createRandomFile(System.currentTimeMillis());
        String[] allLines = getAllLines(tempFile);
        FileIndex index = buildIndex(tempFile, 5, 0);
        StringReader reader = new StringReader(index, tempFile);
        for (int i = 0; i < allLines.length; ++i)
            Assert.assertEquals(allLines[i], reader.take(i));
        tempFile.delete();
    }

    @Test
    public void test2() throws Exception {
        File tempFile = createRandomFile(System.currentTimeMillis());
        String[] allLines = getAllLines(tempFile);
        for (int step = 5; step < 10; step += 2) {
            for (int start = 1; start <= step; ++start) {
                FileIndex index = buildIndex(tempFile, step, start);
                StringReader reader = new StringReader(index, tempFile);
                for (int i = 0; i < allLines.length; ++i)
                    Assert.assertEquals(allLines[i], reader.take(i));
            }
        }
        tempFile.delete();
    }

    @Test
    public void test3() throws Exception {
        RandomGenerator rnd = new Well1024a();
        File tempFile = createRandomFile(rnd.nextLong());
        String[] allLines = getAllLines(tempFile);
        for (int step = 5; step < 10; step += 2) {
            for (int start = 1; start <= step; ++start) {
                FileIndex index = buildIndex(tempFile, step, start);
                StringReader reader = new StringReader(index, tempFile);
                for (int i = 0; i < allLines.length; ++i) {
                    int p = rnd.nextInt(allLines.length);
                    Assert.assertEquals(allLines[p], reader.take(p));
                }
            }
        }
        tempFile.delete();
    }
}


text:
package May2021GoogLeetcode;

public class _0938RangeSumOfBST {

	static public class TreeNode {
		int val;
		TreeNode left;
		TreeNode right;

		TreeNode() {
		}

		TreeNode(int val) {
			this.val = val;
		}

		TreeNode(int val, TreeNode left, TreeNode right) {
			this.val = val;
			this.left = left;
			this.right = right;
		}
	}

	public static void main(String[] args) {
		TreeNode tn = new TreeNode(10);
		tn.left = new TreeNode(5);
		tn.right = new TreeNode(15);
		tn.left.left = new TreeNode(3);
		tn.left.right = new TreeNode(7);
		tn.right.right = new TreeNode(18);
		System.out.println(rangeSumBST(tn, 7, 15));

		tn = new TreeNode(10);
		tn.left = new TreeNode(5);
		tn.right = new TreeNode(15);

		tn.left.left = new TreeNode(3);
		tn.left.right = new TreeNode(7);
		tn.left.left.left = new TreeNode(1);
		tn.left.right.left = new TreeNode(6);

		tn.right.left = new TreeNode(13);
		tn.right.right = new TreeNode(18);
		System.out.println(rangeSumBST(tn, 6, 10));

	}

	public static int rangeSumBST(TreeNode root, int low, int high) {

	}
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Year to Full-stack</title>
    <meta name="description" content="" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="https://ashelle.github.io/favicon.ico">

    <link rel="stylesheet" type="text/css" href="//ashelle.github.io/themes/casper/assets/css/screen.css?v=1502920754553" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />

    <link rel="canonical" href="https://ashelle.github.io/" />
    <meta name="referrer" content="origin" />

    <meta property="og:site_name" content="Year to Full-stack" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Year to Full-stack" />
    <meta property="og:url" content="https://ashelle.github.io/" />
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:title" content="Year to Full-stack" />
    <meta name="twitter:url" content="https://ashelle.github.io/" />

    <meta name="generator" content="HubPress" />
    <link rel="alternate" type="application/rss+xml" title="Year to Full-stack" href="https://ashelle.github.io/rss/" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.10.0/styles/atom-one-dark.min.css">

Year to Full-stack

Hi, I'm Ashley. I'm teaching myself to code, one day at a time. Let's go!

    Scroll Down

        Page 1 of 1

My Issue with this Project and How I Plan on Fixing It

I’m restructuring everything because this is an absolute mess. Well, maybe less than absolute. A few nights ago I had the opportunity to attend »

            Ashley Ward
             on ytfs, structure, milestone, meta
            <time class="post-date" datetime="2017-08-16">16 August 2017</time>

Finals Week

Did you know finals were a thing during Summer college courses? I feel like everyone knows it’s a thing but if you’re »

            Ashley Ward
             on personal, update
            <time class="post-date" datetime="2017-08-12">12 August 2017</time>

In Praise of Galvanize

I think I can, I think I can, I think I can. (Or, not drowning in JavaScript as much as I was before.) I went to »

            Ashley Ward
             on Galvanize, JavaScript, HTML, CSS
            <time class="post-date" datetime="2017-08-09">09 August 2017</time>

Drowning in JavaScript

Well, at least I tried. I’m still on the same code from yesterday. I decided to completely scrape all of the jQuery involved because »

            Ashley Ward
             on JavaScript, August 2017
            <time class="post-date" datetime="2017-08-07">07 August 2017</time>

WWJQD: What Would jQuery Do?

Apparently not work without being downloaded first. I know. jQuery isn’t a framework like BootStrap, it’s a library. Still, the news that »

            Ashley Ward
             on jQuery, August 2017
            <time class="post-date" datetime="2017-08-06">06 August 2017</time>

        Page 1 of 1

Year to Full-stack © 2017

Proudly published with HubPress


text:
ITEM.Name = "Gut Knife" .. " | " .. "Damascus Steel"
ITEM.Price = 20000
ITEM.Model = "models/weapons/w_csgo_gut.mdl"
ITEM.Skin = 4
ITEM.WeaponClass = "csgo_gut_damascus"

function ITEM:OnEquip(ply)
	ply:Give(self.WeaponClass)
end

function ITEM:OnBuy(ply)
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnSell(ply)
	ply:StripWeapon(self.WeaponClass)
end

function ITEM:OnHolster(ply)
	ply:StripWeapon(self.WeaponClass)
end


text:
package io.probedock.maven.plugin.glassfish;

import io.probedock.maven.plugin.glassfish.macro.AbstractMacro;
import io.probedock.maven.plugin.glassfish.model.Configuration;
import io.probedock.maven.plugin.glassfish.model.DeployConfiguration;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

import io.probedock.maven.plugin.glassfish.macro.DeployMacro;

/**
 * Deploy an application on a Glassfish domain
 *
 * @author Laurent Prevost laurent.prevost@probedock.io
 */
@Mojo(name = "deploy", defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST, requiresProject = true)
public class DeployGlassfishMojo extends GlassfishMojo {
	@Parameter(required = true)
	private DeployConfiguration deployConfig;

	@Override
	protected AbstractMacro getMacro() {
		return new DeployMacro(configuration);
	}

	@Override
	protected Configuration buildConfiguration() {
		return new Configuration(getLog(), glassfish, domain, deployConfig);
	}
}


text:
import java.util.ArrayList;
import java.util.Set;

public interface Node {

  // NOTE: Node is an interface and does not have a constructor.
  // However, your CompliantNode.java class requires a 4 argument
  // constructor as defined in Simulation.java

  /** {@code followees[i]} is true if and only if this node follows node {@code i} */
  void setFollowees(boolean[] followees);

  /** initialize proposal list of transactions */
  void setPendingTransaction(Set<Transaction> pendingTransactions);

  /**
   * @return proposals to send to my followers. REMEMBER: After final round, behavior of
   *         {@code sendToFollowers} changes and it should return the transactions upon which
   *         consensus has been reached.
   */
  Set<Transaction> sendToFollowers();

  /** receive candidates from other nodes. */
  void receiveFromFollowees(Set<Candidate> candidates);
}


text:
'''
A program to find th sum of 11 truncatable primes
'''

import math
from sieve import sieve

def truncate_num(num):
    truncated=[]
    str_num=str(num)
    num_rev=str_num[::-1]
    for i in range(len(str_num)):
        truncated.append(str_num[i:])
    for i in  range(len(num_rev)):
        truncated.append(num_rev[i:][::-1])
    return list(set([int(i) for i in truncated]))

def checkPrime_brute(num):
    factors=[]
    if num==1 or num==0:
        return False
    for i in range(2,math.floor(math.sqrt(num))+1):
        if num%i==0:
            factors.append(i)
    if  len(factors)==0:
        return True
    else:
        return False

def checkPrime(num,sieve_list):
    if num in sieve_list: return True
    else: return False

def isTruncatableprime(num,sieve_list):
    if checkPrime(num,sieve_list):
        truncs=truncate_num(num)
        for i in truncs:
            if not checkPrime(i,sieve_list):
                return False
        return True
    else:
        return False

def main(n=1000000):
    sieve_list=sieve(n)
    count=11
    primes=[]
    start=10
    while count!=0 or start>n:
        if isTruncatableprime(start,sieve_list):
            primes.append(start)
            count-=1
        start+=1
    return primes

if __name__=='__main__':
    from sys import argv
    a=main(int(argv[-1]))
    print(a,sum(a))