text:
#include <QPointer>
#include <QObject>
#include <QtCore/qmath.h>
#ifdef Q_WS_WIN
#  include <QLibrary>
#endif

#include "qscrollerproperties.h"
#include "private/qscrollerproperties_p.h"

QT_BEGIN_NAMESPACE

static QScrollerPropertiesPrivate *userDefaults = 0;
static QScrollerPropertiesPrivate *systemDefaults = 0;

QScrollerPropertiesPrivate *QScrollerPropertiesPrivate::defaults()
{
    if (!systemDefaults) {
        QScrollerPropertiesPrivate spp;
        spp.mousePressEventDelay = qreal(0.25);
        spp.dragStartDistance = qreal(5.0 / 1000);
        spp.dragVelocitySmoothingFactor = qreal(0.8);
        spp.axisLockThreshold = qreal(0);
        spp.scrollingCurve.setType(QEasingCurve::OutQuad);
        spp.decelerationFactor = qreal(0.125);
        spp.minimumVelocity = qreal(50.0 / 1000);
        spp.maximumVelocity = qreal(500.0 / 1000);
        spp.maximumClickThroughVelocity = qreal(66.5 / 1000);
        spp.acceleratingFlickMaximumTime = qreal(1.25);
        spp.acceleratingFlickSpeedupFactor = qreal(3.0);
        spp.snapPositionRatio = qreal(0.5);
        spp.snapTime = qreal(0.3);
        spp.overshootDragResistanceFactor = qreal(0.5);
        spp.overshootDragDistanceFactor = qreal(1);
        spp.overshootScrollDistanceFactor = qreal(0.5);
        spp.overshootScrollTime = qreal(0.7);
#  ifdef Q_WS_WIN
        if (QLibrary::resolve(QLatin1String("UxTheme"), "BeginPanningFeedback"))
            spp.overshootScrollTime = qreal(0.35);
#  endif
        spp.hOvershootPolicy = QScrollerProperties::OvershootWhenScrollable;
        spp.vOvershootPolicy = QScrollerProperties::OvershootWhenScrollable;
        spp.frameRate = QScrollerProperties::Standard;

        systemDefaults = new QScrollerPropertiesPrivate(spp);
    }
    return new QScrollerPropertiesPrivate(userDefaults ? *userDefaults : *systemDefaults);
}

/*!
    \class QScrollerProperties
    \brief The QScrollerProperties class stores the settings for a QScroller.
    \since 4.8

    \inmodule QtWidgets

    The QScrollerProperties class stores the parameters used by QScroller.

    The default settings are platform dependent so that Qt emulates the
    platform behaviour for kinetic scrolling.

    As a convention the QScrollerProperties are in physical units (meter,
    seconds) and are converted by QScroller using the current DPI.

    \sa QScroller
*/

/*!
    Constructs new scroller properties.
*/
QScrollerProperties::QScrollerProperties()
    : d(QScrollerPropertiesPrivate::defaults())
{
}

/*!
    Constructs a copy of \a sp.
*/
QScrollerProperties::QScrollerProperties(const QScrollerProperties &sp)
    : d(new QScrollerPropertiesPrivate(*sp.d))
{
}

/*!
    Assigns \a sp to these scroller properties and returns a reference to these scroller properties.
*/
QScrollerProperties &QScrollerProperties::operator=(const QScrollerProperties &sp)
{
    *d.data() = *sp.d.data();
    return *this;
}

/*!
    Destroys the scroller properties.
*/
QScrollerProperties::~QScrollerProperties()
{
}

/*!
    Returns \c true if these scroller properties are equal to \a sp; otherwise returns \c false.
*/
bool QScrollerProperties::operator==(const QScrollerProperties &sp) const
{
    return *d.data() == *sp.d.data();
}

/*!
    Returns \c true if these scroller properties are different from \a sp; otherwise returns \c false.
*/
bool QScrollerProperties::operator!=(const QScrollerProperties &sp) const
{
    return !(*d.data() == *sp.d.data());
}

bool QScrollerPropertiesPrivate::operator==(const QScrollerPropertiesPrivate &p) const
{
    bool same = true;
    same &= (mousePressEventDelay == p.mousePressEventDelay);
    same &= (dragStartDistance == p.dragStartDistance);
    same &= (dragVelocitySmoothingFactor == p.dragVelocitySmoothingFactor);
    same &= (axisLockThreshold == p.axisLockThreshold);
    same &= (scrollingCurve == p.scrollingCurve);
    same &= (decelerationFactor == p.decelerationFactor);
    same &= (minimumVelocity == p.minimumVelocity);
    same &= (maximumVelocity == p.maximumVelocity);
    same &= (maximumClickThroughVelocity == p.maximumClickThroughVelocity);
    same &= (acceleratingFlickMaximumTime == p.acceleratingFlickMaximumTime);
    same &= (acceleratingFlickSpeedupFactor == p.acceleratingFlickSpeedupFactor);
    same &= (snapPositionRatio == p.snapPositionRatio);
    same &= (snapTime == p.snapTime);
    same &= (overshootDragResistanceFactor == p.overshootDragResistanceFactor);
    same &= (overshootDragDistanceFactor == p.overshootDragDistanceFactor);
    same &= (overshootScrollDistanceFactor == p.overshootScrollDistanceFactor);
    same &= (overshootScrollTime == p.overshootScrollTime);
    same &= (hOvershootPolicy == p.hOvershootPolicy);
    same &= (vOvershootPolicy == p.vOvershootPolicy);
    same &= (frameRate == p.frameRate);
    return same;
}

/*!
     Sets the scroller properties for all new QScrollerProperties objects to \a sp.

     Use this function to override the platform default properties returned by the default
     constructor. If you only want to change the scroller properties of a single scroller, use
     QScroller::setScrollerProperties()

     \note Calling this function will not change the content of already existing
     QScrollerProperties objects.

     \sa unsetDefaultScrollerProperties()
*/
void QScrollerProperties::setDefaultScrollerProperties(const QScrollerProperties &sp)
{
    if (!userDefaults)
        userDefaults = new QScrollerPropertiesPrivate(*sp.d);
    else
        *userDefaults = *sp.d;
}

/*!
     Sets the scroller properties returned by the default constructor back to the platform default
     properties.

     \sa setDefaultScrollerProperties()
*/
void QScrollerProperties::unsetDefaultScrollerProperties()
{
    delete userDefaults;
    userDefaults = 0;
}

/*!
    Query the \a metric value of the scroller properties.

    \sa setScrollMetric(), ScrollMetric
*/
QVariant QScrollerProperties::scrollMetric(ScrollMetric metric) const
{
    switch (metric) {
    case MousePressEventDelay:          return d->mousePressEventDelay;
    case DragStartDistance:             return d->dragStartDistance;
    case DragVelocitySmoothingFactor:   return d->dragVelocitySmoothingFactor;
    case AxisLockThreshold:             return d->axisLockThreshold;
    case ScrollingCurve:                return d->scrollingCurve;
    case DecelerationFactor:            return d->decelerationFactor;
    case MinimumVelocity:               return d->minimumVelocity;
    case MaximumVelocity:               return d->maximumVelocity;
    case MaximumClickThroughVelocity:   return d->maximumClickThroughVelocity;
    case AcceleratingFlickMaximumTime:  return d->acceleratingFlickMaximumTime;
    case AcceleratingFlickSpeedupFactor:return d->acceleratingFlickSpeedupFactor;
    case SnapPositionRatio:             return d->snapPositionRatio;
    case SnapTime:                      return d->snapTime;
    case OvershootDragResistanceFactor: return d->overshootDragResistanceFactor;
    case OvershootDragDistanceFactor:   return d->overshootDragDistanceFactor;
    case OvershootScrollDistanceFactor: return d->overshootScrollDistanceFactor;
    case OvershootScrollTime:           return d->overshootScrollTime;
    case HorizontalOvershootPolicy:     return QVariant::fromValue(d->hOvershootPolicy);
    case VerticalOvershootPolicy:       return QVariant::fromValue(d->vOvershootPolicy);
    case FrameRate:                     return QVariant::fromValue(d->frameRate);
    case ScrollMetricCount:             break;
    }
    return QVariant();
}

/*!
    Set a specific value of the \a metric ScrollerMetric to \a value.

    \sa scrollMetric(), ScrollMetric
*/
void QScrollerProperties::setScrollMetric(ScrollMetric metric, const QVariant &value)
{
    switch (metric) {
    case MousePressEventDelay:          d->mousePressEventDelay = value.toReal(); break;
    case DragStartDistance:             d->dragStartDistance = value.toReal(); break;
    case DragVelocitySmoothingFactor:   d->dragVelocitySmoothingFactor = qBound(qreal(0), value.toReal(), qreal(1)); break;
    case AxisLockThreshold:             d->axisLockThreshold = qBound(qreal(0), value.toReal(), qreal(1)); break;
    case ScrollingCurve:                d->scrollingCurve = value.toEasingCurve(); break;
    case DecelerationFactor:            d->decelerationFactor = value.toReal(); break;
    case MinimumVelocity:               d->minimumVelocity = value.toReal(); break;
    case MaximumVelocity:               d->maximumVelocity = value.toReal(); break;
    case MaximumClickThroughVelocity:   d->maximumClickThroughVelocity = value.toReal(); break;
    case AcceleratingFlickMaximumTime:  d->acceleratingFlickMaximumTime = value.toReal(); break;
    case AcceleratingFlickSpeedupFactor:d->acceleratingFlickSpeedupFactor = value.toReal(); break;
    case SnapPositionRatio:             d->snapPositionRatio = qBound(qreal(0), value.toReal(), qreal(1)); break;
    case SnapTime:                      d->snapTime = value.toReal(); break;
    case OvershootDragResistanceFactor: d->overshootDragResistanceFactor = value.toReal(); break;
    case OvershootDragDistanceFactor:   d->overshootDragDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break;
    case OvershootScrollDistanceFactor: d->overshootScrollDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break;
    case OvershootScrollTime:           d->overshootScrollTime = value.toReal(); break;
    case HorizontalOvershootPolicy:     d->hOvershootPolicy = value.value<QScrollerProperties::OvershootPolicy>(); break;
    case VerticalOvershootPolicy:       d->vOvershootPolicy = value.value<QScrollerProperties::OvershootPolicy>(); break;
    case FrameRate:                     d->frameRate = value.value<QScrollerProperties::FrameRates>(); break;
    case ScrollMetricCount:             break;
    }
}

/*!
    \enum QScrollerProperties::FrameRates

    This enum describes the available frame rates used while dragging or scrolling.

    \value Fps60 60 frames per second
    \value Fps30 30 frames per second
    \value Fps20 20 frames per second
    \value Standard the default value is 60 frames per second (which corresponds to QAbstractAnimation).
*/

/*!
    \enum QScrollerProperties::OvershootPolicy

    This enum describes the various modes of overshooting.

    \value OvershootWhenScrollable Overshooting is possible when the content is scrollable. This is the
                                   default.

    \value OvershootAlwaysOff Overshooting is never enabled, even when the content is scrollable.

    \value OvershootAlwaysOn Overshooting is always enabled, even when the content is not
                             scrollable.
*/

/*!
    \enum QScrollerProperties::ScrollMetric

    This enum contains the different scroll metric types. When not indicated otherwise the
    setScrollMetric function expects a QVariant of type qreal.

    See the QScroller documentation for further details of the concepts behind the different
    values.

    \value MousePressEventDelay This is the time a mouse press event is delayed when starting
    a flick gesture in \c{[s]}. If the gesture is triggered within that time, no mouse press or
    release is sent to the scrolled object. If it triggers after that delay the delayed
    mouse press plus a faked release event at global position \c{QPoint(-QWIDGETSIZE_MAX,
    -QWIDGETSIZE_MAX)} is sent. If the gesture is canceled, then both the delayed mouse
    press plus the real release event are delivered.

    \value DragStartDistance This is the minimum distance the touch or mouse point needs to be
    moved before the flick gesture is triggered in \c m.

    \value DragVelocitySmoothingFactor A value that describes to which extent new drag velocities are
    included in the final scrolling velocity.  This value should be in the range between \c 0 and
    \c 1.  The lower the value, the more smoothing is applied to the dragging velocity.

    \value AxisLockThreshold Restricts the movement to one axis if the movement is inside an angle
    around the axis. The threshold must be in the range \c 0 to \c 1.

    \value ScrollingCurve The QEasingCurve used when decelerating the scrolling velocity after an
    user initiated flick. Please note that this is the easing curve for the positions, \b{not}
    the velocity: the default is QEasingCurve::OutQuad, which results in a linear decrease in
    velocity (1st derivative) and a constant deceleration (2nd derivative).

    \value DecelerationFactor This factor influences how long it takes the scroller to decelerate
    to 0 velocity. The actual value depends on the chosen ScrollingCurve. For most
    types the value should be in the range from \c 0.1 to \c 2.0

    \value MinimumVelocity The minimum velocity that is needed after ending the touch or releasing
    the mouse to start scrolling in \c{m/s}.

    \value MaximumVelocity This is the maximum velocity that can be reached in \c{m/s}.

    \value MaximumClickThroughVelocity This is the maximum allowed scroll speed for a click-through
    in \c{m/s}. This means that a click on a currently (slowly) scrolling object will not only stop
    the scrolling but the click event will also be delivered to the UI control. This is
    useful when using exponential-type scrolling curves.

    \value AcceleratingFlickMaximumTime This is the maximum time in \c seconds that a flick gesture
    can take to be recognized as an accelerating flick. If set to zero no such gesture is
    detected. An "accelerating flick" is a flick gesture executed on an already scrolling object.
    In such cases the scrolling speed is multiplied by AcceleratingFlickSpeedupFactor in order to
    accelerate it.

    \value AcceleratingFlickSpeedupFactor The current speed is multiplied by this number if an
    accelerating flick is detected. Should be \c{>= 1}.

    \value SnapPositionRatio This is the distance that the user must drag the area beween two snap
    points in order to snap it to the next position. \c{0.33} means that the scroll must only
    reach one third of the distance between two snap points to snap to the next one. The ratio must
    be between \c 0 and \c 1.

    \value SnapTime This is the time factor for the scrolling curve. A lower value means that the
    scrolling will take longer. The scrolling distance is independet of this value.

    \value OvershootDragResistanceFactor This value is the factor between the mouse dragging and
    the actual scroll area movement (during overshoot). The factor must be between \c 0 and \c 1.

    \value OvershootDragDistanceFactor This is the maximum distance for overshoot movements while
    dragging. The actual overshoot distance is calculated by multiplying this value with the
    viewport size of the scrolled object. The factor must be between \c 0 and \c 1.

    \value OvershootScrollDistanceFactor This is the maximum distance for overshoot movements while
    scrolling. The actual overshoot distance is calculated by multiplying this value with the
    viewport size of the scrolled object. The factor must be between \c 0 and \c 1.

    \value OvershootScrollTime This is the time in \c seconds that is used to play the
    complete overshoot animation.

    \value HorizontalOvershootPolicy This is the horizontal overshooting policy (see OvershootPolicy).

    \value VerticalOvershootPolicy This is the horizontal overshooting policy (see OvershootPolicy).

    \value FrameRate This is the frame rate which should be used while dragging or scrolling.
    QScroller uses a QAbstractAnimation timer internally to sync all scrolling operations to other
    animations that might be active at the same time.  If the standard value of 60 frames per
    second is too fast, it can be lowered with this setting,
    while still being in-sync with QAbstractAnimation. Please note that only the values of the
    FrameRates enum are allowed here.

    \value ScrollMetricCount This is always the last entry.
*/

QT_END_NAMESPACE


text:
/* 3.5 Implement a MyQueue class which implements a queue using two stacks.
 * */

import java.util.Stack;

public class P0305 {
   public class Queue<T> {
      private Stack<T> in, out;
      private int capacity;
      private int size;
      private int inCapacity;
      private int outCapacity;

      public Queue() {
         this(4);
      }

      public Queue(int capacity) {
         this.capacity = capacity;
         // we could randomly allocate the capacity to the two stacks,
         // for convenience, we constrict the capacity of each stack as
         // half of the queue.
         if (capacity % 2 == 0)
            inCapacity = outCapacity = capacity / 2;
         else {
            // it is the best to keep the capacity even, otherwise, we cannot
            // use the full capacity when pushing elements continuously.
            // Moreover, we cannot set the outCapacity < inCapacity, since the
            // first element will be printed out lastly after pushing
            // continuously.
            outCapacity = capacity / 2 + 1;
            inCapacity = capacity / 2;
         }
         in = new Stack<T>();
         out = new Stack<T>();
         size = 0;
      }

      public void enqueue(T value) {
         if (isInStackFull()) {
            if (isStackEmpty(out))
               transport();
            else
               throw new IllegalStateException("The queue is full!");
         }

         in.push(value);
         size++;
      }

      public T dequeue() {
         if (isStackEmpty(out)) {
            if (!isStackEmpty(in))
               transport();
            else throw new IllegalStateException("The queue is empty");
         }

         size--;
         return out.pop();
      }

      public int getSize() {
         return size;
      }

      public int getCapacity() {
         return capacity;
      }

      public boolean isFull() {
         return size == capacity;
      }

      public boolean isEmpty() {
         return size == 0;
      }

      // transport elements from the in stack to the out stack
      private void transport() {
         if (!isStackEmpty(out))
            throw new IllegalStateException("The out stack is not empty, " +
               "CANNOT tranport!");

         while (!isOutStackFull() && !isStackEmpty(in)) {
            out.push(in.pop());
         }
      }

      private boolean isInStackFull() {
         return in.size() == inCapacity;
      }

      private boolean isOutStackFull() {
         return out.size() == outCapacity;
      }

      private boolean isStackEmpty(Stack<T> stack) {
         return stack.size() == 0;
      }
   }

   public static void main(String[] args) {
      int capacity = Integer.parseInt(args[0]);
      P0305 p0305 = new P0305();
      Queue<Integer> queue = p0305.new Queue<Integer>(capacity);
      //queue.dequeue();
      for (int i = 0; i < capacity; i++)
         queue.enqueue(i);
      for (int i = 0; i < capacity; i++)
         System.out.println(queue.dequeue());
   }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

use Hubzero\Content\Migration\Base;

// No direct access
defined('_HZEXEC_') or die();

/**
 * Migration script for adding indexes to Newsletter tables
 **/
class Migration20160129154900ComNewsletter extends Base
{
	/**
	 * Up
	 **/
	public function up()
	{
		if ($this->db->tableExists('#__newsletter_mailing_recipient_actions'))
		{
			if (!$this->db->tableHasKey('#__newsletter_mailing_recipient_actions', 'idx_mailingid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailing_recipient_actions` ADD INDEX `idx_mailingid` (`mailingid`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletter_mailing_recipient_actions', 'idx_action'))
			{
				$query = "ALTER TABLE `#__newsletter_mailing_recipient_actions` ADD INDEX `idx_action` (`action`);";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailing_recipients'))
		{
			if (!$this->db->tableHasKey('#__newsletter_mailing_recipients', 'idx_mid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailing_recipients` ADD INDEX `idx_mid` (`mid`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletter_mailing_recipients', 'idx_status'))
			{
				$query = "ALTER TABLE `#__newsletter_mailing_recipients` ADD INDEX `idx_status` (`status`);";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailinglist_emails'))
		{
			if (!$this->db->tableHasKey('#__newsletter_mailinglist_emails', 'idx_mid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglist_emails` ADD INDEX `idx_mid` (`mid`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletter_mailinglist_emails', 'idx_status'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglist_emails` ADD INDEX `idx_status` (`status`);";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailinglist_unsubscribes'))
		{
			if (!$this->db->tableHasKey('#__newsletter_mailinglist_unsubscribes', 'idx_mid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglist_unsubscribes` ADD INDEX `idx_mid` (`mid`);";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailinglists'))
		{
			if (!$this->db->tableHasKey('#__newsletter_mailinglists', 'idx_private'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglists` ADD INDEX `idx_private` (`private`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletter_mailinglists', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglists` ADD INDEX `idx_deleted` (`deleted`);";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailings'))
		{
			if (!$this->db->tableHasKey('#__newsletter_mailings', 'idx_nid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailings` ADD INDEX `idx_nid` (`nid`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletter_mailings', 'idx_lid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailings` ADD INDEX `idx_lid` (`lid`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletter_mailings', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletter_mailings` ADD INDEX `idx_deleted` (`deleted`);";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_primary_story'))
		{
			if (!$this->db->tableHasKey('#__newsletter_primary_story', 'idx_nid'))
			{
				$query = "ALTER TABLE `#__newsletter_primary_story` ADD INDEX `idx_nid` (`nid`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletter_primary_story', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletter_primary_story` ADD INDEX `idx_deleted` (`deleted`);";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_secondary_story'))
		{
			if (!$this->db->tableHasKey('#__newsletter_secondary_story', 'idx_nid'))
			{
				$query = "ALTER TABLE `#__newsletter_secondary_story` ADD INDEX `idx_nid` (`nid`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletter_secondary_story', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletter_secondary_story` ADD INDEX `idx_deleted` (`deleted`);";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletters'))
		{
			if (!$this->db->tableHasKey('#__newsletters', 'idx_published'))
			{
				$query = "ALTER TABLE `#__newsletters` ADD INDEX `idx_published` (`published`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletters', 'idx_sent'))
			{
				$query = "ALTER TABLE `#__newsletters` ADD INDEX `idx_sent` (`sent`);";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if (!$this->db->tableHasKey('#__newsletters', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletters` ADD INDEX `idx_deleted` (`deleted`);";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}
	}

	/**
	 * Down
	 **/
	public function down()
	{
		if ($this->db->tableExists('#__newsletter_mailing_recipient_actions'))
		{
			if ($this->db->tableHasKey('#__newsletter_mailing_recipient_actions', 'idx_mailingid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailing_recipient_actions` DROP INDEX `idx_mailingid`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletter_mailing_recipient_actions', 'idx_action'))
			{
				$query = "ALTER TABLE `#__newsletter_mailing_recipient_actions` DROP INDEX `idx_action`;";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailing_recipients'))
		{
			if ($this->db->tableHasKey('#__newsletter_mailing_recipients', 'idx_mid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailing_recipients` DROP INDEX `idx_mid`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletter_mailing_recipients', 'idx_status'))
			{
				$query = "ALTER TABLE `#__newsletter_mailing_recipients` DROP INDEX `idx_status`;";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailinglist_emails'))
		{
			if ($this->db->tableHasKey('#__newsletter_mailinglist_emails', 'idx_mid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglist_emails` DROP INDEX `idx_mid`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletter_mailinglist_emails', 'idx_status'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglist_emails` DROP INDEX `idx_status`;";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailinglist_unsubscribes'))
		{
			if ($this->db->tableHasKey('#__newsletter_mailinglist_unsubscribes', 'idx_mid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglist_unsubscribes` DROP INDEX `idx_mid`;";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailinglists'))
		{
			if ($this->db->tableHasKey('#__newsletter_mailinglists', 'idx_private'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglists` DROP INDEX `idx_private`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletter_mailinglists', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletter_mailinglists` DROP INDEX `idx_deleted`;";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_mailings'))
		{
			if ($this->db->tableHasKey('#__newsletter_mailings', 'idx_nid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailings` DROP INDEX `idx_nid`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletter_mailings', 'idx_lid'))
			{
				$query = "ALTER TABLE `#__newsletter_mailings` DROP INDEX `idx_lid`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletter_mailings', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletter_mailings` DROP INDEX `idx_deleted`;";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_primary_story'))
		{
			if ($this->db->tableHasKey('#__newsletter_primary_story', 'idx_nid'))
			{
				$query = "ALTER TABLE `#__newsletter_primary_story` DROP INDEX `idx_nid`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletter_primary_story', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletter_primary_story` DROP INDEX `idx_deleted`;";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletter_secondary_story'))
		{
			if ($this->db->tableHasKey('#__newsletter_secondary_story', 'idx_nid'))
			{
				$query = "ALTER TABLE `#__newsletter_secondary_story` DROP INDEX `idx_nid`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletter_secondary_story', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletter_secondary_story` DROP INDEX `idx_deleted`;";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}

		if ($this->db->tableExists('#__newsletters'))
		{
			if ($this->db->tableHasKey('#__newsletters', 'idx_published'))
			{
				$query = "ALTER TABLE `#__newsletters` DROP INDEX `idx_published`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletters', 'idx_sent'))
			{
				$query = "ALTER TABLE `#__newsletters` DROP INDEX `idx_sent`;";
				$this->db->setQuery($query);
				$this->db->query();
			}

			if ($this->db->tableHasKey('#__newsletters', 'idx_deleted'))
			{
				$query = "ALTER TABLE `#__newsletters` DROP INDEX `idx_deleted`;";
				$this->db->setQuery($query);
				$this->db->query();
			}
		}
	}
}


text:
<!DOCTYPE html>

    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Javascript API Samples</title>


text:
module Tenon
  class FormBuilder < ActionView::Helpers::FormBuilder
    include ActionView::Helpers::TagHelper
    attr_accessor :output_buffer
    alias_method :super_label, :label

    def tenon_content(method_name)
      @template.render 'tenon/tenon_content/tenon_content',
        f: self,
        field: method_name
    end

    def asset(method_name, opts = {})
      defaults = {
        label: nil,
        wrapper_class: 'panel',
        # Remove button triggers cocoon's remove child event?
        remove_association: false
      }
      opts = defaults.merge(opts)
      @template.render 'tenon/fields/asset',
        f: self,
        label_tag: label(method_name, opts[:label]),
        method_name: method_name,
        proxy_attachment: object.send(method_name),
        opts: opts
    end

    def rich_text(method_name, opts = {})
      defaults = {
        placeholder: '--'
      }
      opts = defaults.merge(opts)

      @template.render 'tenon/fields/rich_text',
        f: self,
        method_name: method_name,
        label_tag: label(method_name, opts[:label]),
        opts: opts
    end
    alias_method :me_text, :rich_text

    alias_method :super_text_field, :text_field
    def text_field(method_name, opts = {})
      defaults = {
        placeholder: '--'
      }
      opts = defaults.merge(opts)

      @template.render 'tenon/fields/text_field',
        f: self,
        method_name: method_name,
        opts: opts
    end

    def title_text_field(method_name, opts = {})
      defaults = {
        placeholder: '--'
      }
      opts = defaults.merge(opts)

      @template.render 'tenon/fields/title_text_field',
        f: self,
        method_name: method_name,
        opts: opts
    end

    alias_method :super_email_field, :email_field
    def email_field(method_name, opts = {})
      defaults = {
        placeholder: '--'
      }
      opts = defaults.merge(opts)

      @template.render 'tenon/fields/email_field',
        f: self,
        method_name: method_name,
        opts: opts
    end

    alias_method :super_password_field, :password_field
    def password_field(method_name, opts = {})
      defaults = {
        placeholder: '--'
      }
      opts = defaults.merge(opts)

      @template.render 'tenon/fields/password_field',
        f: self,
        method_name: method_name,
        opts: opts
    end

    alias_method :super_number_field, :number_field
    def number_field(method_name, opts = {})
      defaults = {
        placeholder: '--'
      }
      opts = defaults.merge(opts)

      @template.render 'tenon/fields/number_field',
        f: self,
        method_name: method_name,
        opts: opts
    end

    alias_method :super_phone_field, :phone_field
    def phone_field(method_name, opts = {})
      defaults = {
        placeholder: '--'
      }
      opts = defaults.merge(opts)

      @template.render 'tenon/fields/phone_field',
        f: self,
        method_name: method_name,
        opts: opts
    end

    alias_method :super_url_field, :url_field
    def url_field(method_name, opts = {})
      defaults = {
        placeholder: '--'
      }
      opts = defaults.merge(opts)

      @template.render 'tenon/fields/url_field',
        f: self,
        method_name: method_name,
        opts: opts
    end

    alias_method :super_color_field, :color_field
    def color_field(method_name, opts = {})
      defaults = {
        placeholder: '--'
      }
      opts = defaults.merge(opts)

      @template.render 'tenon/fields/color_field',
        f: self,
        method_name: method_name,
        opts: opts
    end

    alias_method :super_text_area, :text_area
    def text_area(method_name, opts = {})
      @template.render 'tenon/fields/text_area',
        f: self,
        method_name: method_name,
        opts: opts
    end

    alias_method :super_select, :select
    def select(method_name, choices, opts = {}, html_opts = {})
      @template.render 'tenon/fields/select',
        f: self,
        method_name: method_name,
        choices: choices,
        opts: opts,
        html_opts: html_opts
    end

    alias_method :super_check_box, :check_box
    def check_box(method_name, opts = {})
      @template.render 'tenon/fields/check_box',
        f: self,
        method_name: method_name,
        opts: opts
    end

    def inline_check_box(method_name, opts = {})
      @template.render 'tenon/fields/inline_check_box',
        f: self,
        method_name: method_name,
        opts: opts
    end

    alias_method :super_radio_button, :radio_button
    def radio_button(method_name, value, opts = {})
      @template.render 'tenon/fields/radio_button',
        f: self,
        method_name: method_name,
        value: value,
        opts: opts
    end

    def inline_radio_button(method_name, value, opts = {})
      @template.render 'tenon/fields/inline_radio_button',
      f: self,
      method_name: method_name,
      value: value,
      opts: opts
    end

    alias_method :super_collection_select, :collection_select
    def collection_select(method_name, collection, value_method, text_method, opts = {}, html_opts = {})
      @template.render 'tenon/fields/collection_select',
        f: self,
        method_name: method_name,
        collection: collection,
        value_method: value_method,
        text_method: text_method,
        opts: opts,
        html_opts: html_opts
    end

    def date_picker(method_name, opts = {})
      @template.render 'tenon/fields/date_picker',
        f: self,
        method_name: method_name,
        opts: opts
    end

    def date_time_picker(method_name, opts = {})
      @template.render 'tenon/fields/date_time_picker',
        f: self,
        method_name: method_name,
        opts: opts
    end

    def text_area_content(method_name, options = {}, language = nil, language_title = nil)
      label = label(method_name, options[:label], language, language_title)
      explanation = explanation(options[:explanation])
      label + explanation + super_text_area(get_method(method_name, language), options)
    end

    def datetime_widget(method_name, options = {})
      label = label(method_name, options[:label], nil, nil)
      explanation = explanation(options[:explanation])

      on = content_tag(:tr) do
        [
          content_tag(:td, 'On: '),
          content_tag(:td, super_text_field("#{method_name}_date", class: 'datepicker', size: 12, value: @object.send(method_name) ? @object.send(method_name).strftime('%Y-%m-%d') : (options[:default_date] || Time.now.strftime('%Y-%m-%d'))))
        ].join('\n').html_safe
      end
      at = content_tag(:tr) do
        [
          content_tag(:td, 'At: '),
          content_tag(:td, super_text_field("#{method_name}_time", value: @object.send(method_name) ? @object.send(method_name).strftime('%l:%M%p').strip : (options[:default_time] || Time.now.strftime('%l:%M%p').strip), size: 7))
        ].join('\n').html_safe
      end
      table = content_tag(:table, on + at, class: 'datetime_select')

      content = label(method_name, options[:label], nil, nil)
      content += explanation(options[:explanation])
      content += content_tag(:div, table, class: 'inset datetime-widget')
    end

    def nested_fields(object, params = {})
      fields_for object.to_s.pluralize do |nf|
        @template.render "#{object}_fields", { f: nf }.merge(params)
      end
    end

    def label(method_name, label, required = false, inline = false, language = nil, language_title = nil)
      if label == false
        ''.html_safe
      else
        label ||= method_name.to_s.titleize
        label = language_title ? label + " (#{language_title.to_s.titleize})" : label
        label_class = ['input-block__label']
        label_class = ['input-block__label--inline'] if inline
        if required
          label += content_tag(:span, 'Required', class: 'input-block__required-msg')
        end
        super(get_method(method_name, language), label.html_safe, class: label_class.join(' '))
      end
    end

    private

    def build_content(generator, method_name, options)
      content = send(generator, method_name, options)
      if Tenon::I18nLookup.new(@object.class).fields.include? method_name.to_s
        content = internationalize_content(generator, method_name, content, options)
      end
      content_tag(:div, content, class: 'form-field')
    end

    def internationalize_content(generator, method_name, content, options = {})
      if Tenon.config.languages
        content = content_tag(:div, content, class: 'i18n en active')
        Tenon.config.languages.each do |lang_title, lang|
          content += content_tag(:div, send(generator, method_name, options, lang, lang_title), class: "i18n #{lang}")
        end
        content = framed_content(content, options)
      else
        content
      end
    end

    def explanation(explanation)
      explanation ? content_tag(:div, explanation.html_safe, class: 'explanation') : ''
    end

    def get_method(method, language = nil)
      language ? "#{method}_#{language}" : method
    end

    def framed_content(content, options = {})
      content_tag :div, class: 'i18n-holder', style: ('display: inline-block;' if options[:inline]) do
        content_tag :div, content, class: 'i18n-frame'
      end
    end
  end
end


text:
geth=${GETH:-geth}

echo "***** Using geth at: $geth"

echo "***** Import all pre-funded private keys"

for key in `find ./private_keys -name '*.key'`
do
  ./private_keys/import.sh $key $geth
done

echo "***** Done."


text:
package jp.gr.java_conf.daisy.ajax_mutator.util;

import org.mozilla.javascript.ast.AstNode;

import java.util.Set;

public class AstUtil {
    private AstUtil () {}

    public static boolean isContained(
            AstNode mayAncestor, AstNode filial) {
        AstNode node = filial;
        while (node != null) {
            if (node.equals(mayAncestor))
                return true;
            node = node.getParent();
        }

        return false;
    }

    /**
     * return nearest parent whose type is type. if such node is not exist,
     *           return null.
     */
    public static <T extends AstNode> T parentOfType(
            AstNode node, Class<T> type) {
        while (node != null) {
            if (type.isInstance(node)) {
                // This cast always success since I check type.isInstance(node)
                @SuppressWarnings("unchecked")
                T ret = (T) node;
                return ret;
            }
            node = node.getParent();
        }
        return null;
    }

    /**
     * return nearest parent node whose type is one of specified ones.
     * @param isStrict if true, raise exception when no element is found. Otherwise just return null.
     */
    public static AstNode parentOfAnyTypes(AstNode node, Set<Class> types, boolean isStrict) {
        AstNode originalCopy = node;
        while (node != null) {
            for (Class type: types) {
                if (type.isInstance(node)) {
                    return node;

                }
            }
            node = node.getParent();
        }
        if (isStrict) {
            throw new IllegalArgumentException("Cannot find parent of type " + types + " from "
                    + originalCopy.toSource() + "(" + originalCopy.getClass().getSimpleName() + ")");
        }
        return null;
    }
}


text:
package bosphorus;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.List;

import com.dyuproject.protostuff.GraphIOUtil;
import com.dyuproject.protostuff.Input;
import com.dyuproject.protostuff.Message;
import com.dyuproject.protostuff.Output;
import com.dyuproject.protostuff.Schema;
import com.dyuproject.protostuff.UninitializedMessageException;

public final class REVISIONHISTORYITEM implements Externalizable, Message<REVISIONHISTORYITEM>, Schema<REVISIONHISTORYITEM>
{

    public static Schema<REVISIONHISTORYITEM> getSchema()
    {
        return DEFAULT_INSTANCE;
    }

    public static REVISIONHISTORYITEM getDefaultInstance()
    {
        return DEFAULT_INSTANCE;
    }

    static final REVISIONHISTORYITEM DEFAULT_INSTANCE = new REVISIONHISTORYITEM();

    private OBJECTVERSIONID versionid;
    private List<AUDITDETAILS> audits;

    public REVISIONHISTORYITEM()
    {

    }

    public REVISIONHISTORYITEM(
        OBJECTVERSIONID versionid
    )
    {
        this.versionid = versionid;
    }

    // getters and setters

    // versionid

    public OBJECTVERSIONID getVersionid()
    {
        return versionid;
    }

    public void setVersionid(OBJECTVERSIONID versionid)
    {
        this.versionid = versionid;
    }

    // audits

    public List<AUDITDETAILS> getAuditsList()
    {
        return audits;
    }

    public void setAuditsList(List<AUDITDETAILS> audits)
    {
        this.audits = audits;
    }

    // java serialization

    public void readExternal(ObjectInput in) throws IOException
    {
        GraphIOUtil.mergeDelimitedFrom(in, this, this);
    }

    public void writeExternal(ObjectOutput out) throws IOException
    {
        GraphIOUtil.writeDelimitedTo(out, this, this);
    }

    // message method

    public Schema<REVISIONHISTORYITEM> cachedSchema()
    {
        return this;
    }

    // schema methods

    public REVISIONHISTORYITEM newMessage()
    {
        return new REVISIONHISTORYITEM();
    }

    public Class<REVISIONHISTORYITEM> typeClass()
    {
        return REVISIONHISTORYITEM.class;
    }

    public String messageName()
    {
        return REVISIONHISTORYITEM.class.getSimpleName();
    }

    public String messageFullName()
    {
        return REVISIONHISTORYITEM.class.getName();
    }

    public boolean isInitialized(REVISIONHISTORYITEM message)
    {
        return
            message.versionid != null;
    }

    public void mergeFrom(Input input, REVISIONHISTORYITEM message) throws IOException
    {
        for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
        {
            switch(number)
            {
                case 0:
                    return;
                case 1:
                    message.versionid = input.mergeObject(message.versionid, OBJECTVERSIONID.getSchema());
                    break;

                case 2:
                    if(message.audits == null)
                        message.audits = new ArrayList<AUDITDETAILS>();
                    message.audits.add(input.mergeObject(null, AUDITDETAILS.getSchema()));
                    break;

                default:
                    input.handleUnknownField(number, this);
            }
        }
    }

    public void writeTo(Output output, REVISIONHISTORYITEM message) throws IOException
    {
        if(message.versionid == null)
            throw new UninitializedMessageException(message);
        output.writeObject(1, message.versionid, OBJECTVERSIONID.getSchema(), false);

        if(message.audits != null)
        {
            for(AUDITDETAILS audits : message.audits)
            {
                if(audits != null)
                    output.writeObject(2, audits, AUDITDETAILS.getSchema(), true);
            }
        }

    }

    public String getFieldName(int number)
    {
        return Integer.toString(number);
    }

    public int getFieldNumber(String name)
    {
        return Integer.parseInt(name);
    }

}


text:
package at.magiun.core.config

import com.softwaremill.tagging._
import openllet.core.OpenlletOptions
import openllet.jena.PelletReasonerFactory
import org.apache.jena.ontology.OntModel
import org.apache.jena.rdf.model.ModelFactory
import org.apache.jena.util.FileUtils

object AlgorithmOntologyConfig {

  private val fileName = "model_selection.owl"
  val NS = "http://www.magiun.io/ontologies/model-selection#"

  def create(): OntModel @@ AlgorithmSelectionOntology = {
    OpenlletOptions.FREEZE_BUILTIN_NAMESPACES = false

    val model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC)
    val inputStream = this.getClass.getClassLoader.getResourceAsStream(fileName)
    model.read(inputStream, null, FileUtils.langXML)
    model.taggedWith[AlgorithmSelectionOntology]
  }

}

trait AlgorithmSelectionOntology


text:
class ProjectsController < ApplicationController
  def companies
    @companies = Company.all.order(score: :desc).paginate(:page => params[:page])
  end

  def company
    @company = Company.includes(:projects).find_by(id: params[:id])
    @projects = @company.projects
    @inspections = Inspection.where(project_id: @projects.pluck(:simec_id), status: ['answered', 'accepted','sent'])
  end

  def home

  end

  def company_projects
    projects = Project.where(company_id: params[:id]).group(:status).count
    render json: {projects: projects, labels: projects.keys, values: projects.values}
  end
end


text:
/***************************************************//**
 * @file    NonlinearityEEPROMSlotFeature.cpp
 * @date    February 2012
 * @author  Ocean Optics, Inc.
 *
 * LICENSE:
 *
 * SeaBreeze Copyright (C) 2014, Ocean Optics Inc
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject
 * to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *******************************************************/

#include "common/globals.h"
#include "vendors/OceanOptics/features/eeprom_slots/NonlinearityEEPROMSlotFeature.h"
#include "api/seabreezeapi/FeatureFamilies.h"
#include "common/Log.h"

#define __NONLINEARITY_SLOT_ORDER_ZERO  6
#define __NONLINEARITY_ORDER_SLOT       14

using namespace seabreeze;
using namespace seabreeze::api;
using namespace std;

NonlinearityEEPROMSlotFeature::NonlinearityEEPROMSlotFeature() {

}

NonlinearityEEPROMSlotFeature::~NonlinearityEEPROMSlotFeature() {

}

#ifdef _WINDOWS
#pragma warning (disable: 4101) // unreferenced local variable
#endif
vector<double> *NonlinearityEEPROMSlotFeature::readNonlinearityCoefficients(
        const Protocol &protocol, const Bus &bus) {
    LOG(__FUNCTION__)

    int i;
    int order;
    int numberCoeffs;
    vector<double> *retval;

    try {
        /* Order of the polynomial is stored in slot 14 */
        order = (int)readLong(protocol, bus, __NONLINEARITY_ORDER_SLOT);
    } catch (NumberFormatException &nfe) {
        logger.error("Could not parse NLC order");
        throw FeatureException("Could not get nonlinearity polynomial order.");
    }

    /* Must add one to the order to include the 0th order coefficient */
    numberCoeffs = order + 1;
    retval = new vector<double>(numberCoeffs);

    for(i = 0; i < numberCoeffs; i++) {
        /* Nonlinearity coefficients are stored starting with intercept at slot 6 */
        try {
            /* This may throw a FeatureException or NumberFormatException */
            (*retval)[i] = readDouble(protocol, bus, i + __NONLINEARITY_SLOT_ORDER_ZERO);
        } catch (NumberFormatException &nfe) {
            logger.error("Could not parse NLC coeff");
            for(i = 0; i < numberCoeffs; i++) {
                /* Set the polynomial such that the correction is negated.
                 */
                if(0 == i) {
                    (*retval)[i] = 1.0;
                } else {
                    (*retval)[i] = 0.0;
                }
            }
            break;
        } catch (const exception &ex) {
            logger.error("Caught unknown exception reading NLC coeff");
            (*retval)[i] = 0;
        }
    }

    return retval;
}

FeatureFamily NonlinearityEEPROMSlotFeature::getFeatureFamily() {
    FeatureFamilies families;

    return families.NONLINEARITY_COEFFS;
}


text:
namespace Xamarin.Cognitive.Face.Model
{
	/// <summary>
	/// Represents all facial attributes of a given Face.
	/// </summary>
	public class FaceAttributes
	{
		/// <summary>
		/// Gets or sets the age.  An age number in years.
		/// </summary>
		/// <value>The age.</value>
		public float Age { get; set; }

		/// <summary>
		/// Gets or sets the smile intensity.  Smile intensity, a number between [0,1].
		/// </summary>
		/// <value>The smile intensity.</value>
		public float SmileIntensity { get; set; }

		/// <summary>
		/// Gets or sets the gender.  Male or female.
		/// </summary>
		/// <value>The gender.</value>
		public string Gender { get; set; }

		/// <summary>
		/// Gets or sets the glasses.  Glasses type: Possible values are 'NoGlasses', 'ReadingGlasses', 'Sunglasses', 'SwimmingGoggles'.
		/// </summary>
		/// <value>The glasses.</value>
		public Glasses? Glasses { get; set; }

		/// <summary>
		/// Gets or sets the facial hair.  Consists of lengths of three facial hair areas: moustache, beard and sideburns.
		/// </summary>
		/// <value>The facial hair.</value>
		public FacialHair FacialHair { get; set; }

		/// <summary>
		/// Gets or sets the head pose.  3-D roll/yew/pitch angles for face direction.  Pitch value is a reserved field and will always return 0.
		/// </summary>
		/// <value>The head pose.</value>
		public FaceHeadPose HeadPose { get; set; }

		/// <summary>
		/// Gets or sets the emotion.  Emotions intensity expressed by the face, including anger, contempt, disgust, fear, happiness, neutral, sadness and surprise.
		/// </summary>
		/// <value>The emotion.</value>
		public FaceEmotion Emotion { get; set; }

		/// <summary>
		/// Gets or sets the hair.  Return face features indicating whether the hair is visible, bald or not also including hair color if available.
		/// </summary>
		/// <value>The hair.</value>
		public Hair Hair { get; set; }

		/// <summary>
		/// Gets or sets the makeup.  Whether face area (eye, lip) is made-up or not.
		/// </summary>
		/// <value>The makeup.</value>
		public Makeup Makeup { get; set; }

		/// <summary>
		/// Gets or sets the occlusion.  Whether face area (forehead, eye, mouth) is occluded or not.
		/// </summary>
		/// <value>The occlusion.</value>
		public Occlusion Occlusion { get; set; }

		/// <summary>
		/// Gets or sets the accessories.  Accessory types on face or around face area, including headwear, glasses and mask.
		/// </summary>
		/// <value>The accessories.</value>
		public Accessories Accessories { get; set; }

		/// <summary>
		/// Gets or sets the blur.  Blur level of the face. The level include `Low`, `Medium` and `High`. Larger value means more blury the face is.
		/// </summary>
		/// <value>The blur.</value>
		public Blur Blur { get; set; }

		/// <summary>
		/// Gets or sets the exposure.  Exposure level of the face. The level include `GoodExposure`, `OverExposure` and `UnderExposure`.
		/// </summary>
		/// <value>The exposure.</value>
		public Exposure Exposure { get; set; }

		/// <summary>
		/// Gets or sets the noise.  Noise level of the face. The level include `Low`, `Medium` and `High`. Larger value means more noisy the face is.
		/// </summary>
		/// <value>The noise.</value>
		public Noise Noise { get; set; }
	}
}


text:
var SelectionSort = require('./lib/sort/SelectionSort')
  , QuickSort = require('./lib/sort/QuickSort')
  , BubbleSort = require('./lib/sort/BubbleSort');

exports.Sort = {
  selectionSort: SelectionSort,
  quickSort: QuickSort,
  bubbleSort: BubbleSort
}

// Search Algorithms
var BinarySearch = require('./lib/search/BinarySearch');

exports.Search = {
  binarySearch: BinarySearch
}

// Control Flow Algorithms
var ForEachParallel = require('./lib/controlflow/ForEachParallel')
  , ForEachSeries = require('./lib/controlflow/ForEachSeries')
  , ForEachLimit = require('./lib/controlflow/ForEachLimit')
  , Series = require('./lib/controlflow/Series')
  , Parallel = require('./lib/controlflow/Parallel')
  , Logic = require('./lib/controlflow/Logic');

exports.ControlFlow = {
  forEachParallel: ForEachParallel,
  forEachSeries: ForEachSeries
  forEachLimit: ForEachLimit
  series: Series,
  parallel: Parallel,
  logic: Logic,
  auto: Logic
}


text:
<?php

namespace IMIContrunTest;

class AlternativeConfigModel extends \Mage_Core_Model_Config
{

}


text:
package org.opentosca.toscana.cli.commands.platform;

import org.opentosca.toscana.cli.ApiController;
import org.opentosca.toscana.cli.commands.AbstractCommand;

import picocli.CommandLine.Command;

@Command(name = "list",
    description = {"Show all available Platforms for Transformation"},
    customSynopsis = "@|bold toscana platform list|@ [@|yellow -mv|@]%n")
public class PlatformList extends AbstractCommand {

    /**
     shows the available platforms, that are ready to start a transformation
     */
    public PlatformList() {

    }

    @Override
    protected String performCall(ApiController ap) {
        return api.listPlatform();
    }
}


text:
package edu.avans.hartigehap.service;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import edu.avans.hartigehap.domain.Restaurant;

public interface RestaurantService {
    List<Restaurant> findAll();

    Restaurant findById(String name);

    Restaurant save(Restaurant restaurant);

    void delete(String name);

    Page<Restaurant> findAllByPage(Pageable pageable);

    Restaurant fetchWarmedUp(String restaurantName);
}


text:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;

import javax.imageio.ImageIO;
import javax.swing.*;

public class StartPage extends JFrame {

	private static final long serialVersionUID = 1L;
	private int difficulty = 0;
	boolean normalTimer = true;
	private String choice = "default.png";

	public StartPage() throws IOException{

		InputStream stream = getClass().getResourceAsStream("startPage.png");
		BufferedImage image = ImageIO.read(stream); //background image of the page
		JLabel background = new JLabel(new ImageIcon(image));
		setTitle("Sudoku Master");

		stream = getClass().getResourceAsStream("pause.png");
		ImageIcon pauseTemp = new ImageIcon(ImageIO.read(stream));
		stream = getClass().getResourceAsStream("play.jpg");
		ImageIcon playTemp = new ImageIcon(ImageIO.read(stream));

		final ImageIcon playIcon = playTemp;
		final ImageIcon pauseIcon = pauseTemp;

		setSize(568,568);
		background.setSize(image.getWidth(),image.getHeight());
		setResizable(false);
		setLocationRelativeTo(null);
		setLayout(null);

		JButton newGame = new JButton();
		newGame.setBounds(189, 180, 189, 50);
		newGame.setText("New Game");
		newGame.setFocusPainted(false);
		newGame.setBackground(Color.WHITE);
		newGame.addActionListener(e -> gameOption(pauseIcon, playIcon));
		JButton loadGame = new JButton();
		loadGame.setBounds(189, 360, 189, 50);
		loadGame.setText("Load Game");
		loadGame.setFocusPainted(false);
		loadGame.setBackground(Color.WHITE);
		loadGame.addActionListener(new loadListener());

		add(newGame);
		add(loadGame);
		add(background);
		setVisible(true);
		setDefaultCloseOperation(EXIT_ON_CLOSE);

	}

	class loadListener implements ActionListener
	{
		public void actionPerformed(ActionEvent e)
		{
			InputStream stream = getClass().getResourceAsStream("pause.png");
			ImageIcon pause = null;

			try
			{
				pause = new ImageIcon(ImageIO.read(stream));
			}
			catch(Exception a)
			{
				System.out.println("Could not load image");
			}

			Game game = new Game(1, normalTimer);
			game.load(pause);
		}
	}

	private void gameOption(ImageIcon pauseIcon, ImageIcon playIcon) {
		JFrame newGame = new JFrame();
		newGame.setTitle("Select New Game Options");
		newGame.setSize(500, 300);
		newGame.setResizable(false);
		newGame.setLayout(new GridLayout(0,1));
		newGame.setLocationRelativeTo(this);

		JPanel difficultyPanel = new JPanel();
		JPanel timerPanel = new JPanel();
		JPanel backgroundPanel = new JPanel();
		JPanel playPanel = new JPanel();

		JToggleButton easy = new JToggleButton("Easy");
		JToggleButton medium = new JToggleButton("Medium");
		JToggleButton hard = new JToggleButton("Hard");
		JToggleButton veryHard = new JToggleButton("Very Hard");

		ButtonGroup difficultyGroup = new ButtonGroup();
		ButtonGroup timerGroup = new ButtonGroup();

		JRadioButton normalTimer = new JRadioButton("Normal Timer");
		JRadioButton countdown = new JRadioButton("Countdown Timer");

		new JTextField();

		JButton play = new JButton("Play");
		play.setFocusPainted(false);
		play.setBackground(Color.WHITE);

		String[] backgrounds = {"Default", "Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Pink", "Disco", "Etown"};
		JComboBox<Object> options = new JComboBox<Object>(backgrounds);
		options.setSelectedIndex(0);

		options.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				choice = ((String)options.getSelectedItem() + ".png").toLowerCase();
				setChoice(choice);
			}
		});

		easy.setFocusPainted(false);
		easy.setBackground(Color.WHITE);
		medium.setFocusPainted(false);
		medium.setBackground(Color.WHITE);
		hard.setFocusPainted(false);
		hard.setBackground(Color.WHITE);
		veryHard.setFocusPainted(false);
		veryHard.setBackground(Color.WHITE);

		difficultyGroup.add(easy);
		difficultyGroup.add(medium);
		difficultyGroup.add(hard);
		difficultyGroup.add(veryHard);

		timerGroup.add(normalTimer);
		timerGroup.add(countdown);

		easy.addActionListener(e -> setDifficulty(1));
		medium.addActionListener(e -> setDifficulty(2));
		hard.addActionListener(e -> setDifficulty(3));
		veryHard.addActionListener(e -> setDifficulty(4));

		normalTimer.addActionListener(e -> setTimer(true));
		countdown.addActionListener(e -> setTimer(false));

		play.addActionListener(e -> newGame(newGame,pauseIcon,playIcon));

		difficultyPanel.add(easy);
		difficultyPanel.add(medium);
		difficultyPanel.add(hard);
		difficultyPanel.add(veryHard);

		timerPanel.add(normalTimer);
		timerPanel.add(countdown);

		backgroundPanel.add(options);

		playPanel.add(play);

		newGame.add(difficultyPanel);
		newGame.add(timerPanel);
		newGame.add(backgroundPanel);
		newGame.add(playPanel);

		newGame.setVisible(true);

	}

	private void newGame(JFrame newGame, ImageIcon pause, ImageIcon play) {
		if(difficulty == 0){
			return;
		}
		Game game = new Game(difficulty, normalTimer);
		Board.setImage(choice);

		if(!normalTimer)
			game.setTimerFrame(pause, play);

		newGame.dispose();
		dispose();
	}

	private void setDifficulty(int difficulty){
		this.difficulty = difficulty;
	}

	public void setChoice(String choice) {
		this.choice = choice;
	}

	private boolean setTimer(boolean normalTimer) {
		this.normalTimer = normalTimer;
		return normalTimer;
	}

	public void load() { //needs polish

		ImageIcon pauseTemp = null;
		try {
			InputStream stream = getClass().getResourceAsStream("pause.png");
			pauseTemp = new ImageIcon(ImageIO.read(stream));
		} catch (IOException e1) {
			System.err.println("could not load pause and play icons");
		}
		final ImageIcon pause = pauseTemp;

		Game oldGame = new Game(4,true);
		oldGame.setVisible(false);
		oldGame.load(pause);

		//dispose();

	}

}


text:
export MYHOST="$NODE_PREFIX"node$(echo $MYSQL_NAME | awk -F"/dockercluster[^0-9]*|\/mysql" '{print  $2 }');
echo "MYHOST is $MYHOST. MYSQL_NAME is $MYSQL_NAME";

function prepareHost
{
  if [ -d /keycloak-docker-shared/keycloak-$JBOSS_TYPE-$MYHOST ]; then
    echo "Node $MYHOST already prepared. Skiping";
    return;
  fi

  echo "Creating keycloak-$JBOSS_TYPE-$MYHOST";

  /keycloak-docker-cluster/shared-files/keycloak-base-prepare.sh

  echo "Base prepare finished";

  # Deploy to volume
  rm -rf /keycloak-docker-shared/keycloak-$JBOSS_TYPE-$MYHOST
  cp -r $JBOSS_HOME /keycloak-docker-shared/keycloak-$JBOSS_TYPE-$MYHOST
  chmod -R 777 /keycloak-docker-shared/keycloak-$JBOSS_TYPE-$MYHOST
  echo "keycloak-$JBOSS_TYPE-$MYHOST prepared and copyied to volume";
}

function waitForPreviousNodeStart
{
  myHostNumber=$(echo $MYHOST | awk -F"node" '{ print $2 }');
  if [ $myHostNumber -eq 1 ]; then
    echo "Our host is $MYHOST. No need to wait for previous server";
  else
    previous="$NODE_PREFIX"node$(($myHostNumber-1));
    echo "Waiting for host $previous to start";

    for I in $(seq 1 10); do
      cat /keycloak-docker-shared/keycloak-$JBOSS_TYPE-$previous/standalone/log/server.log | grep "\(INFO\|ERROR\).*\(WildFly\|JBoss AS\|JBoss EAP\).*started";
      if [ 0 -eq $? ]; then
        echo "Host $previous started. Going to start $MYHOST";
        return;
      fi;

      echo "Host $previous not started yet. Still waiting...";
      sleep 5;
    done;

    echo "Host $previous not started yet within timeout.";
  fi;
}

function waitForMySQLStart
{
  for I in $(seq 1 10); do
    nc $MYSQL_PORT_3306_TCP_ADDR 3306 < /dev/null;
    mysqlRunning=$(echo $?);
    if [ $mysqlRunning -eq 0 ]; then
      echo "MySQL is running. Starting our server";
      return;
    else
      echo "MySQL not yet available. Still waiting...";
      sleep 5;
    fi;
  done;
}

prepareHost;

waitForPreviousNodeStart;
waitForMySQLStart;

echo "Running keycloak node $MYHOST. Additional arguments: $@";
cd /keycloak-docker-shared
export JBOSS_HOME=/keycloak-docker-shared/keycloak-$JBOSS_TYPE-$MYHOST;

cd $JBOSS_HOME/bin/

./standalone.sh -c standalone-keycloak-ha.xml -Djboss.node.name=$MYHOST -b `hostname -i` -Djboss.mod_cluster.jvmRoute=$MYHOST \
-Dmysql.host=$MYSQL_PORT_3306_TCP_ADDR -Dhttpd.proxyHost=$HTTPD_1_PORT_10001_TCP_ADDR -Dhttpd.proxyPort=$HTTPD_PORT_10001_TCP_PORT \
-Dkeycloak.import=/keycloak-docker-cluster/examples/testrealm.json "$@"


text:
=========================
VPN IPsec Site Connection
=========================

Creates a site-to-site **IPsec Site Connection** for a VPN service.

Network v2

.. autoprogram-cliff:: openstack.neutronclient.v2
   :command: vpn ipsec site connection *


text:
namespace AsyncLogging.Loggers.Imp
{
    using System;
    using System.Web;

    using AsyncLogging.Filters;
    using AsyncLogging.Helpers;
    using AsyncLogging.Properties;
    using AsyncLogging.SqlCommands;

    public class SqlServerLogger : ILogger
    {
        private InsertServerRequestLogCommand command;

        public void Dispose()
        {

        }

        public void InitializeRequestHandler(object source, EventArgs e)
        {
            command = new InsertServerRequestLogCommand();
        }

        public IAsyncResult BeginRequestAsyncEventHandler(object source, EventArgs e, AsyncCallback cb, object state, OutputFilterStream filter)
        {
            var app = source as HttpApplication;
            var logData = LoggerHelper.InitializeServerRequestLog(app, filter);
            return this.command.BeginExecuteNonQuery(cb, state, logData);
        }

        public void EndRequestAsyncEventHandler(IAsyncResult ar)
        {
            this.command.EndExecuteNonQuery(ar);
        }
    }
}


text:
include(Compiler/Intel)
__compiler_intel(CXX)

string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")

set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
    AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
  # dependencies are computed by the compiler itself
  set(CMAKE_CXX_DEPFILE_FORMAT gcc)
  set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
endif()

if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")

  set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl")
  set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE_DRIVER_MODE "cl")

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0)
    set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-Qstd=c++20")
    set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-Qstd=c++20")
  endif()

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
    set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Qstd=c++17")
    set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-Qstd=c++17")
  endif()

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
    set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Qstd=c++14")
    set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-Qstd=c++14")
  endif()

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
    set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++11")
    set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++11")
  elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
    set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++0x")
    set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++0x")
  endif()

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
    set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
    set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
    set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
  endif()

else()

  set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0)
    set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
    set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
  endif()

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
    set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
    set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
  endif()

  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0)
    set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
  endif()

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2)
    set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
  elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0)
    set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
  endif()

  # Intel 15.0.2 accepts c++14 instead of c++1y, but not gnu++14
  # instead of gnu++1y.  Intel 17.0.0 accepts gnu++14 too.
  if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0)
    set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
  elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0)
    set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
  endif()

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
    set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
  endif()

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
    set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
    set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
  elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
    set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
    set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
  endif()

  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
    set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
    set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
    set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
  endif()

endif()

__compiler_check_default_language_standard(CXX 12.1 98)

set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")


text:
/*
 * Emits strings that correspond to key presses. Requires root to be useful
 * Dangerous. Use with caution.
 *
 * Jonathan Foote
 * jmfoote@loyola.edu
 *
 * see LICENSE.md for license info
 */

// Compile with:
// gcc -framework ApplicationServices -o osx osx.c
//
// Start with:
// ./osx
//
// Terminate by hitting CTRL+C

#include <ApplicationServices/ApplicationServices.h>
#include <sys/time.h>
#include <Carbon/Carbon.h>

/*
 * The table used in the function below was adapted from:
 *
 * https://github.com/mosca1337/OSX-Keylogger/blob/master/Keylogger/Keylogger.m
 *
 * and is thereby subject to the following MIT license
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2013 Patrick Mosca
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
char* convertKeyCode(int keyCode) {

    switch (keyCode) {
        case kVK_ANSI_A:                return "a"; break;
        case kVK_ANSI_S:                return "s"; break;
        case kVK_ANSI_D:                return "d"; break;
        case kVK_ANSI_F:                return "f"; break;
        case kVK_ANSI_H:                return "h"; break;
        case kVK_ANSI_G:                return "g"; break;
        case kVK_ANSI_Z:                return "z"; break;
        case kVK_ANSI_X:                return "x"; break;
        case kVK_ANSI_C:                return "c"; break;
        case kVK_ANSI_V:                return "v"; break;
        case kVK_ANSI_B:                return "b"; break;
        case kVK_ANSI_Q:                return "q"; break;
        case kVK_ANSI_W:                return "w"; break;
        case kVK_ANSI_E:                return "e"; break;
        case kVK_ANSI_R:                return "r"; break;
        case kVK_ANSI_T:                return "t"; break;
        case kVK_ANSI_Y:                return "y"; break;
        case kVK_ANSI_1:                return "1"; break;
        case kVK_ANSI_2:                return "2"; break;
        case kVK_ANSI_3:                return "3"; break;
        case kVK_ANSI_4:                return "4"; break;
        case kVK_ANSI_6:                return "6"; break;
        case kVK_ANSI_5:                return "5"; break;
        case kVK_ANSI_Equal:            return "="; break;
        case kVK_ANSI_9:                return "9"; break;
        case kVK_ANSI_7:                return "7"; break;
        case kVK_ANSI_Minus:            return "-"; break;
        case kVK_ANSI_8:                return "8"; break;
        case kVK_ANSI_0:                return "0"; break;
        case kVK_ANSI_RightBracket:     return "]"; break;
        case kVK_ANSI_O:                return "o"; break;
        case kVK_ANSI_U:                return "u"; break;
        case kVK_ANSI_LeftBracket:      return "["; break;
        case kVK_ANSI_I:                return "i"; break;
        case kVK_ANSI_P:                return "p"; break;
        case kVK_ANSI_L:                return "l"; break;
        case kVK_ANSI_J:                return "j"; break;
        case kVK_ANSI_Quote:            return "'"; break;
        case kVK_ANSI_K:                return "k"; break;
        case kVK_ANSI_Semicolon:        return "a"; break;
        case kVK_ANSI_Backslash:        return "\\"; break;
        case kVK_ANSI_Comma:            return ","; break;
        case kVK_ANSI_Slash:            return "/"; break;
        case kVK_ANSI_N:                return "n"; break;
        case kVK_ANSI_M:                return "m"; break;
        case kVK_ANSI_Period:           return "."; break;
        case kVK_ANSI_Grave:            return "`"; break;
        case kVK_ANSI_KeypadDecimal:    return "."; break;
        case kVK_ANSI_KeypadMultiply:   return "*"; break;
        case kVK_ANSI_KeypadPlus:       return "+"; break;
        case kVK_ANSI_KeypadClear:      return "<Clear>"; break;
        case kVK_ANSI_KeypadDivide:     return "/"; break;
        case kVK_ANSI_KeypadEnter:      return "<Enter>"; break;
        case kVK_ANSI_KeypadMinus:      return "-"; break;
        case kVK_ANSI_KeypadEquals:     return "="; break;
        case kVK_ANSI_Keypad0:          return "0"; break;
        case kVK_ANSI_Keypad1:          return "1"; break;
        case kVK_ANSI_Keypad2:          return "2"; break;
        case kVK_ANSI_Keypad3:          return "3"; break;
        case kVK_ANSI_Keypad4:          return "4"; break;
        case kVK_ANSI_Keypad5:          return "5"; break;
        case kVK_ANSI_Keypad6:          return "6"; break;
        case kVK_ANSI_Keypad7:          return "7"; break;
        case kVK_ANSI_Keypad8:          return "8"; break;
        case kVK_ANSI_Keypad9:          return "9"; break;

        case kVK_Return:                return "<Return>"; break;
        case kVK_Tab:                   return "<Tab>"; break;
        case kVK_Space:                 return "<Space>"; break;
        case kVK_Delete:                return "<Delete>"; break;
        case kVK_Escape:                return "<Escape>"; break;
        case kVK_F1:                    return "F1"; break;
        case kVK_F2:                    return "F2"; break;
        case kVK_F3:                    return "F3"; break;
        case kVK_F4:                    return "F4"; break;
        case kVK_F5:                    return "F5"; break;
        case kVK_F6:                    return "F6"; break;
        case kVK_F7:                    return "F7"; break;
        case kVK_F8:                    return "F8"; break;
        case kVK_F9:                    return "F9"; break;
        case kVK_F10:                   return "F10"; break;
        case kVK_F11:                   return "F11"; break;
        case kVK_F12:                   return "F12"; break;
        case kVK_F13:                   return "F13"; break;
        case kVK_F14:                   return "F14"; break;
        case kVK_F15:                   return "F15"; break;
        case kVK_F16:                   return "F16"; break;
        case kVK_F17:                   return "F17"; break;
        case kVK_F18:                   return "F18"; break;
        case kVK_F19:                   return "F19"; break;
        case kVK_F20:                   return "F20"; break;
        case kVK_ForwardDelete:         return "<Delete>"; break;
        case kVK_LeftArrow:             return "<Left Arrow>"; break;
        case kVK_RightArrow:            return "<Right Arrow>"; break;
        case kVK_DownArrow:             return "<Down Arrow>"; break;
        case kVK_UpArrow:               return "<Up Arrow>"; break;

        default:
            return "<Unknown>";
            break;
    }
}

CFMachPortRef myEventTap;

static CGEventRef myEventTapCallback (
    CGEventTapProxy proxy,
    CGEventType type,
    CGEventRef event,
    void * refcon
) {
    int key;

    // https://github.com/edvakf/macbooklog/blob/master/macbooklog.m
    // http://stackoverflow.com/questions/4727149/application-randomly-stops-receiving-key-presses-cgeventtaps
    if (type == kCGEventTapDisabledByTimeout) {
        CGEventTapEnable(myEventTap, true);
        return event;
    } else if (type == kCGEventKeyDown) {
        key = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode);
        printf("%s\n", convertKeyCode(key));
    }

    fflush(stdout);
    return event;
}

int main (
    int argc,
    char ** argv
) {
    CGEventMask emask;
    CFRunLoopSourceRef eventTapRLSrc;

    emask = CGEventMaskBit(kCGEventKeyDown);

    // Create the Tap
    myEventTap = CGEventTapCreate (
        kCGSessionEventTap, // Catch all events for current user session
        kCGTailAppendEventTap, // Append to end of EventTap list
        kCGEventTapOptionListenOnly, // We only listen, we don't modify
        emask,
        &myEventTapCallback,
        NULL // We need no extra data in the callback
    );

    // Create a RunLoop Source for it
    eventTapRLSrc = CFMachPortCreateRunLoopSource(
        kCFAllocatorDefault,
        myEventTap,
        0
    );

    // Add the source to the current RunLoop
    CFRunLoopAddSource(
        CFRunLoopGetCurrent(),
        eventTapRLSrc,
        kCFRunLoopDefaultMode
    );

    // Keep the RunLoop running forever
    CFRunLoopRun();

    // Not reached (RunLoop above never stops running)
    return 0;
}


text:
FROM java:8-jdk
MAINTAINER Roy Meissner, https://rmeissn.github.io

# Mamute VERSION --> Tested for v1.3 and 1.4
# On change rember to edit the variables also in ../docker-compose.yml
ENV VERSION=1.4.0 USER=mamute PASSWORD=Shei6cea DB=db/mamute_db

RUN mkdir /mamute
WORKDIR /mamute

RUN wget -nv https://github.com/caelum/mamute/releases/download/v${VERSION}/mamute-${VERSION}.war && \
    unzip mamute-${VERSION}.war && \
    rm mamute-${VERSION}.war

ADD ./production.properties /mamute/WEB-INF/classes/production.properties

RUN if [ "$VERSION" = "1.3.0" ]; then mv /mamute/WEB-INF/classes/production/hibernate.cfg.xml.example /mamute/WEB-INF/classes/production/hibernate.cfg.xml; fi

RUN sed -i -e "s?>root<?>$USER<?g" /mamute/WEB-INF/classes/production/hibernate.cfg.xml && \
    sed -i -e "s?><?>$PASSWORD<?g" WEB-INF/classes/production/hibernate.cfg.xml && \
    sed -i -e "s?localhost/mamute_production?$DB?g" WEB-INF/classes/production/hibernate.cfg.xml

RUN chmod +x run.sh

EXPOSE 8080

# Wait for intial Database init --> TODO: Find a better way to wait for the DB
CMD sleep 15 && VRAPTOR_ENV=production ./run.sh


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Eleni Anastasiadou | My bits</title>
    <link>http://lpantano.github.io/author/eleni-anastasiadou/</link>
      <atom:link href="http://lpantano.github.io/author/eleni-anastasiadou/index.xml" rel="self" type="application/rss+xml" />
    <description>Eleni Anastasiadou</description>
    <generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Tue, 01 Jan 2019 00:00:00 +0000</lastBuildDate>
    <image>
      <url>http://lpantano.github.io/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_512x512_fill_lanczos_center_3.png</url>
      <title>Eleni Anastasiadou</title>
      <link>http://lpantano.github.io/author/eleni-anastasiadou/</link>
    </image>

    <item>
      <title>Sex-dependent changes in miRNA expression in the bed nucleus of the stria terminalis following stress</title>
      <link>http://lpantano.github.io/publication/mavrikaki-2019-sex/</link>
      <pubDate>Tue, 01 Jan 2019 00:00:00 +0000</pubDate>
      <guid>http://lpantano.github.io/publication/mavrikaki-2019-sex/</guid>
      <description></description>
    </item>

  </channel>
</rss>


text:
<!DOCTYPE html>

		<meta charset="UTF-8">
		<title>Demo</title>
		<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"/>
		<link rel="stylesheet" href="stylesheets/style.css"/>

Cassandra, Node.js, and Angular.js Demo

Hi, this silly little web app was written by Mitchell Kyle as simplistic demo of Apache Cassandra, Node.js and Angular.js. It is under the Apache License 2.0 so it is free to explore. The main function of this application is to maintain comments; so please, leave a comment.

			<message-list></message-list>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ASPPatterns.Chap8.MVP.Presentation;
using ASPPatterns.Chap8.MVP.StubRepository;
using ASPPatterns.Chap8.MVP.Model;
using ASPPatterns.Chap8.MVP.Presentation.Basket;
using ASPPatterns.Chap8.MVP.UI.Web.Views.Shared;
using StructureMap;

namespace ASPPatterns.Chap8.MVP.UI.Web.Views.Basket
{
    public partial class Basket : System.Web.UI.Page, IBasketView
    {
        private IBasketPresenter _presenter;

        protected void Page_Init(object sender, EventArgs e)
        {
            _presenter = new BasketPresenter(this, ObjectFactory.GetInstance<ProductService>(), ObjectFactory.GetInstance<IBasket>());
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            _presenter.Display();
        }

        public IEnumerable<Category> CategoryList
        {
            set
            {
                Shop shopMasterPage = (Shop)Page.Master;
                shopMasterPage.CategoryListControl.SetCategoriesToDisplay(value);
            }
        }

        public IEnumerable<Model.Product> BasketItems
        {
            set {
                rptBasket.DataSource = value;
                rptBasket.DataBind();
            }
        }
    }
}


text:
class XPathSection < SitePrism::Section
  element :inner_element_one, :xpath, '//*[@class="one"]'
  element :inner_element_two, :xpath, '//*[@class="two"]'
  iframe :iframe, XPathIFrame, :xpath, '//*[@class="iframe"]'
end


text:
namespace Incoding.UnitTest.MvcContribGroup
{
    #region << Using >>

    using Incoding.MvcContrib;
    using Machine.Specifications;

    #endregion

    [Subject(typeof(TemplateHandlebarsSyntax<>))]
    public class When_template_handlebars_syntax_foreach : Context_template
    {
        #region Establish value

        static ITemplateSyntax<FakeModel> newEach;

        #endregion

        Because of = () =>
                         {
                             var syntax = new TemplateHandlebarsSyntax<FakeModel>(htmlHelper.Original, "Data", HandlebarsType.Each, string.Empty);
                             newEach = syntax.ForEach(r => r.Items);
                             newEach.Dispose();
                         };

        It should_be_writer_start_not = () => htmlHelper.ShouldBeWriter("{{#each Items}}");

        It should_be_writer_end_not = () => htmlHelper.ShouldBeWriter("{{/each}}");

        It should_be_new_each_for = () => newEach.For(r => r.Name).ShouldEqual("{{Name}}");
    }
}


text:
$(document).ready(function() {
	new ProviderMain().init();
});

function ProviderMain(){

	var parent =  window.parent;

	this.init = function(){

		if( ! parent) return;

		initParentListener();
		sendInitedToParent();
	};

	function initParentListener(){
		//messages from parent
		window.addEventListener('message', function(e){

			var origin = e.origin;
			//TODO check access;

			var msg = e.data;
			if(BrowserUtil.isIE_8_9()){
				msg = JSON.parse(msg);
			}

			if(Util.isEmpty(msg)) return;

			var data = msg.data;
			if(Util.isEmpty(data)) return;

			if(msg.type === "ajaxReq"){
				ajaxReq(data);
			}
		});
	}

	function ajaxReq(data){

		var ajaxOpt = data.req;
		var reqRef = data.reqRef;

		if(reqRef && ajaxOpt.data){
			ajaxOpt.data.origRef = reqRef;
		}

		var resp = {};
		resp.id = ajaxOpt.id;

		ajaxOpt.success = function(serverResp){
			resp.data = serverResp;
		};
		ajaxOpt.error = function(req, status, msg){
			resp.error = {status:status, msg:msg};
		};
		ajaxOpt.complete = function(req, status){
			resp.status = status;
			sendAjaxResp(resp);
		};
		$.ajax(ajaxOpt);
	}

	function sendInitedToParent(){
		postMessge({
			type: "inited"
		});
	}

	function sendAjaxResp(resp){
		postMessge({
			type: "ajaxResp",
			data: resp
		});
	}

	function postMessge(msg){
		if(BrowserUtil.isIE_8_9()){
			msg = JSON.stringify(msg);
		}
		parent.postMessage(msg, '*');
	}

}


text:
require 'test_helper'

class OpencagedataTest < GeocoderTestCase

  def setup
    Geocoder.configure(lookup: :opencagedata)
    set_api_key!(:opencagedata)
  end

  def test_result_components
    result = Geocoder.search("Madison Square Garden, New York, NY").first
    assert_equal "West 31st Street", result.street
    assert_match(/46, West 31st Street, Koreatown, New York County, 10011, New York City, New York, United States of America/, result.address)

  end

  def test_opencagedata_viewport
    result = Geocoder.search("Madison Square Garden, New York, NY").first
    assert_equal [40.7498531, -73.9944444, 40.751161, -73.9925922],
      result.viewport
  end

  def test_opencagedata_query_url_contains_bounds
    lookup = Geocoder::Lookup::Opencagedata.new
    url = lookup.query_url(Geocoder::Query.new(
      "Some street",
      :bounds => [[40.0, -120.0], [39.0, -121.0]]
    ))
    assert_match(/bounds=40.0+%2C-120.0+%2C39.0+%2C-121.0+/, url)
  end

  def test_opencagedata_query_url_contains_optional_params
    lookup = Geocoder::Lookup::Opencagedata.new
    url = lookup.query_url(Geocoder::Query.new(
      "Some street",
      :countrycode => 'fr',
      :min_confidence => 5,
      :no_dedupe => 1,
      :no_annotations => 1,
      :no_record => 1,
      :limit => 2
    ))
    assert_match(/countrycode=fr/, url)
    assert_match(/min_confidence=5/, url)
    assert_match(/no_dedupe=1/, url)
    assert_match(/no_annotations=1/, url)
    assert_match(/no_record=1/, url)
    assert_match(/limit=2/, url)
  end

  def test_no_results
    results = Geocoder.search("no results")
    assert_equal 0, results.length
  end

  def test_opencagedata_reverse_url
    query = Geocoder::Query.new([45.423733, -75.676333])
    assert_match(/\bq=45.423733%2C-75.676333\b/, query.url)
  end

  def test_opencagedata_time_zone
    result = Geocoder.search("Madison Square Garden, New York, NY").first
    assert_equal "America/New_York", result.time_zone
  end

  def test_raises_exception_when_invalid_request
    Geocoder.configure(always_raise: [Geocoder::InvalidRequest])
    assert_raises Geocoder::InvalidRequest do
      Geocoder.search("invalid request")
    end
  end

  def test_raises_exception_when_invalid_api_key
    Geocoder.configure(always_raise: [Geocoder::InvalidApiKey])
    assert_raises Geocoder::InvalidApiKey do
      Geocoder.search("invalid api key")
    end
  end

  def test_raises_exception_when_over_query_limit
    Geocoder.configure(:always_raise => [Geocoder::OverQueryLimitError])
    l = Geocoder::Lookup.get(:opencagedata)
    assert_raises Geocoder::OverQueryLimitError do
      l.send(:results, Geocoder::Query.new("over limit"))
    end
  end
end


text:
package com.tectonica.copy.util;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;

import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.JsonGenerator;
import com.tectonica.copy.model.Credentials;

public class CredentialsStore
{
	private final String fileName = System.getProperty("user.home") + "/.copy-credentials";
	private final JsonFactory factory;

	public CredentialsStore(JsonFactory factory)
	{
		this.factory = factory;
	}

	public Credentials readCredentials() throws IOException
	{
		try (final FileReader fr = new FileReader(fileName))
		{
			return factory.createJsonParser(fr).parseAndClose(Credentials.class);
		}
		catch (FileNotFoundException e)
		{
			return null;
		}
	}

	public void saveCredentials(Credentials creds) throws IOException
	{
		try (PrintWriter pw = new PrintWriter(fileName))
		{
			final JsonGenerator gen = factory.createJsonGenerator(pw);
			gen.serialize(creds);
			gen.flush();
		}
	}
}


text:
@protocol LFAssetVideoProtocol <NSObject>

@property (nonatomic, copy) NSString *name;

@property (nonatomic, strong) NSURL *videoUrl;

@property (nonatomic, strong) UIImage *thumbnailImage;

@end


text:
FROM node:0.12.1

MAINTAINER Francois-Guillaume Ribreau <fg@iadvize.com>

RUN npm install check-build -g

VOLUME /app
WORKDIR /app

CMD ["check-build"]


text:
using System;
namespace VGMenu.Screens.Menu
{
    public interface IShapeMenuItem
    {
        void Create(BaseMenuControl controller, int i, System.Drawing.RectangleF rect, bool highlighted);
        void Update(BaseMenuControl controller, int i, MenuItem itm, bool highlighted);
        bool Visible { get; set; }

        void Dispose();
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Verrucaria versipellis Nyl.

### Remarks
null


text:
date: 2017-11-02
title: "Virtualization"
speaker: "Andrew `smacz` Cziryak"
type: "Meeting"
time: '19:30'
location: 'Caldwell 120'
---

The week one of our own will be giving a talk on virtualization! This will be a good chance to get some knowledge if you are interested, or to find out if you are interested. As always, free pizza will be provided!


text:
from Orange.data import Table, Domain, ContinuousVariable, StringVariable

from scipy.sparse import *

import numpy as np
import warnings

def preprocess(data):
    """ Preprocess the raw data read by Orange3 into something that can be used
    in this module.

    'data.X' is casted to integers (since it contains the indices of the
    data), 'order' is a tuple with the indices of the columns users and items
    in the original file, as well as in 'data.X' matrix.

    Note:
        I talk about 'Users' and 'Items' but this can be whatever pair of
        elements you want like trusters-trustees, team1-team2,...

        Clarification:
             - order: (idx_users; idx_items)
             - shape: (total users; total items).

    Args:
        data: Orange.data.Table

    Returns:
        data: Orange.data.Table
        order: (int, int)
        shape: (int, int)

    """

    if not check_data(data):
        raise TypeError('Input data not valid. See documentation.')

    errors = {'e.col': False, 'e.row': False}
    idx_users, idx_items = (0, 1)

    try:
        # [USERS] Get index of column with the 'row' attribute set to 1 (row=1)
        row_attributes = [a for a in data.domain.attributes + data.domain.metas
                          if a.attributes.get("row")]

        # Get indices of the users column
        if len(row_attributes) == 1:
            row_attribute = row_attributes[0]
            idx_users = data.domain.variables.index(row_attribute)
        else:
            errors['e.row'] = True

        # [ITEMS] Get index of column with the 'col' attribute set to 1 (col=1)
        col_attributes = [a for a in data.domain.attributes + data.domain.metas
                          if a.attributes.get("col")]

        # Get indices of the items column
        if len(col_attributes) == 1:
            col_attribute = col_attributes[0]
            idx_items = data.domain.variables.index(col_attribute)
        else:
            errors['e.col'] = True

        # Check for errors
        if any(errors.values()):
            raise AttributeError('Meta attributes not found')

    except (AttributeError, ValueError):
        if errors['e.row']:
            text_warning = 'Row meta attribute not found. ' \
                       'Applying heuristics {users: col=' + str(idx_users) + '}'
            warnings.warn(text_warning)

        if errors['e.col']:
            text_warning = 'Column meta attribute not found. ' \
                       'Applying heuristics {items: row=' + str(idx_items) + '}'
            warnings.warn(text_warning)

    # Find the highest value on each column
    users = int(np.max(data.X[:, idx_users]) + 1)
    items = int(np.max(data.X[:, idx_items]) + 1)

    # Construct tuples
    order = (idx_users, idx_items)
    shape = (users, items)

    # Cast indices to integer
    data.X = data.X.astype(int)

    return data, order, shape

def check_data(data):

    try:
        conditions = [data.X.ndim == 2, data.Y.ndim == 1, len(data.X) > 0,
                      len(data.Y) > 0, data.X.shape[1] >= 2
                      ]
        return all(conditions)
    except AttributeError:
        return False

def table2sparse(data, shape, order, m_type=lil_matrix):
    """Constructs a 2D sparse matrix from an Orange.data.Table

        Note:
            This methods sort the columns (=> [rows, cols])

        Args:
            data: Orange.data.Table

            shape: (int, int)
               Tuple of integers with the shape of the matrix

            order: (int, int)
               Tuple of integers with the index of the base columns

            m_type: scipy.sparse.*
               Type of matrix to return (csr_matrix, lil_matrix,...)

        Returns:
            matrix: scipy.sparse

        """

    return sparse_matrix_2d(row=data.X[:, order[0]], col=data.X[:, order[1]],
                            data=data.Y, shape=shape, m_type=m_type)

def sparse_matrix_2d(row, col, data, shape, m_type=lil_matrix):
    """Constructs a 2D sparse matrix.

    Given the indices of the rows, columns and value
    this constructs a sparse matrix of size 'shape'

    Args:
        row: Array of integers
           Row indices

        col: Array of integers
           Column indices

        data: Array
           Array with the values mapped to the pair (row, col)

        shape: (int, int)
           Tuple of integers with the shape of the matrix

        m_type: scipy.sparse.*
           Type of matrix to return (csr_matrix, lil_matrix,...)

    Returns:
        matrix: scipy.sparse

    """

    # Construct sparse matrix
    matrix = coo_matrix((data, (row, col)), shape=shape)

    # Set sparse matrix type
    if m_type == csc.csc_matrix:
        matrix = matrix.tocsc()
    elif m_type == csr.csr_matrix:
        matrix = matrix.tocsr()
    elif m_type == bsr.bsr_matrix:
        matrix = matrix.tobsr()
    elif m_type == lil.lil_matrix:
        matrix = matrix.tolil()
    elif m_type == dok.dok_matrix:
        matrix = matrix.todok()
    elif m_type == coo.coo_matrix:
        pass
    elif m_type == dia.dia_matrix:
        matrix = matrix.todia()
    else:
        raise TypeError('Unknown sparse matrix format')

    return matrix

def feature_matrix(variable, matrix, domain_name=None):
    factors_name = [ContinuousVariable('K' + str(i + 1))
                     for i in range(len(matrix[0, :]))]

    if domain_name is None:
        dname = variable.name
    else:
        dname = domain_name

    if isinstance(variable, ContinuousVariable):
        domain_val = ContinuousVariable(dname)
        values = np.atleast_2d(np.arange(0, len(matrix))).T
    else:
        domain_val = StringVariable(dname)
        values = np.column_stack((variable.values,))

    tDomain = Domain(factors_name, None, [domain_val])
    return Table(tDomain, matrix, None, values)


text:
int crypto_auth_hmacsha512_verify(const unsigned char *h, const unsigned char *in,
                                  unsigned long long inlen, const unsigned char *k)
{
  unsigned char correct[64];
  crypto_auth_hmacsha512(correct,in,inlen,k);
  return crypto_verify_64(h,correct) | (-(h == correct)) |
         sodium_memcmp(correct,h,64);
}


text:
This repository contains the source files used by the Wilson lab for manufacturing implantable hyperdrives.
We hope other peope/labs will find these files useful, although they are provided AS IS and without any type of warrany.

These contents of this repository were designed using [SolidWorks](http://www.solidworks.com/). You'll need a copy of
SolidWorks if you want to make any changes to the `.sldprt` files.  However, if you only want to print our drives then
the `.stl` files are all you need.

###Files in this repository include:
#### Look at the [File Index](https://github.com/wilsonlab/CAD-Files/wiki/File-Index) for renderings of each model

* [Rat microdrives](https://github.com/wilsonlab/CAD-Files/tree/master/solidworks/rat-drives) assemblies
* [Mouse microdrives](https://github.com/wilsonlab/CAD-Files/tree/master/solidworks/mouse-drives) assemblies
* [The files referenced](https://github.com/wilsonlab/CAD-Files/tree/master/solidworks/rat-drives/jove) in our [Jove Publications](http://www.jove.com/search?authors=Matthew+Wilson%2C+Massachusetts+Institute+of+Technology)
* [Other](https://github.com/wilsonlab/CAD-Files/tree/master/solidworks/other) files such as top-piece molds and parts used for building assemblies in SolidWorks

### File Locations
 * Editable source files are found in [solidworks/](https://github.com/wilsonlab/CAD-Files/tree/master/solidworks)
 * Ready to print files are found in [stl/](https://github.com/wilsonlab/CAD-Files/tree/master/stl)
 * Machine drawings used to manufacture our top-piece screws can be found in [drawings/](https://github.com/wilsonlab/CAD-Files/tree/master/drawing)

##### Example Hyperdrive
![Example Drive Assembly](http://i.imgur.com/LdmMT.png)


text:
import React, { Component } from 'react';
import './styles/index.scss';

export default class extends Component {

  render() {
    return (

Coming Soon

    );
  }

}