text:
#include "rfx_colorbox.h"

const QString RfxColorBox::_BASE_RGB_BOX_STYLE = QString("margin-left: 25px;border-top-left-radius: 5px;border-bottom-left-radius: 5px;border-left: 1px solid black;border-top: 1px solid black;border-bottom: 1px solid black;padding: 2px;");
const QString RfxColorBox::_BASE_RGBA_BOX_STYLE = QString("margin-left: 25px;margin-right: 25px;border: 1px solid black;border-radius: 5px;padding: 2px;");

/* Constructor
   @param w the width of the widget.
   @param h the height of the widget.
   @param first the start color of the box.
   @param parent the parent widget. Default to 0.
*/
RfxColorBox::RfxColorBox(const int& w, const int& h, const QColor& first, QWidget* parent)
: QWidget(parent)
{
     int r,g,b,a;
     r = first.red();
     g = first.green();
     b = first.blue();
     a = first.alpha();

     this->_rgbaBox = new QPushButton(this);
     this->_rgbaBox->setObjectName("rgbaBox");
     this->_rgbaBox->setFixedSize (w, h);
     this->_rgbaBox->setStyleSheet(RfxColorBox::_BASE_RGBA_BOX_STYLE + QString("background-color: rgba(%1,%2,%3,%4);").arg(r).arg(g).arg(b).arg(a));

     this->_rgbBox = new QFrame(this);
     this->_rgbBox->setObjectName("rgbBox");
     this->_rgbBox->setFixedSize ((w/2), h);
     this->_rgbBox->setStyleSheet(RfxColorBox::_BASE_RGB_BOX_STYLE + QString("background-color: rgb(%1,%2,%3);").arg(r).arg(g).arg(b));

     this->_scacchiera = new QFrame(this);
     this->_scacchiera->setObjectName("scacchiera");
     this->_scacchiera->setStyleSheet(RfxColorBox::_BASE_RGBA_BOX_STYLE + QString("background-image: url(:/images/scacchiera.png);"));
     this->_scacchiera->setFixedSize (w, h);

     this->_rgbBox->raise();
     this->_rgbaBox->raise();

	 QVBoxLayout *verticalLayout = new QVBoxLayout();

	/* the sliders and text boxes */
	this->_redS = new QSlider();
	initSlider(_redS, r);
	this->_redT = new QLineEdit(QString().setNum(r));
	initTextBox(this->_redT);
	connect(this->_redT, SIGNAL(editingFinished()), this, SLOT(setR()));

	this->_greenS = new QSlider();
	initSlider(_greenS, g);
	this->_greenT = new QLineEdit(QString().setNum(g));
	initTextBox(this->_greenT);
	connect(this->_greenT, SIGNAL(editingFinished()), this, SLOT(setG()));

	this->_blueS = new QSlider();
	initSlider(_blueS, b);
	this->_blueT = new QLineEdit(QString().setNum(b));
	initTextBox(this->_blueT);
	connect(this->_blueT, SIGNAL(editingFinished()), this, SLOT(setB()));

	this->_alphaS = new QSlider();
	initSlider(_alphaS, a);
	this->_alphaT = new QLineEdit(QString().setNum(a));
	initTextBox(this->_alphaT);
	connect(this->_alphaT, SIGNAL(editingFinished()), this, SLOT(setA()));

	connectSliders();

	QHBoxLayout *redLayout = new QHBoxLayout();
	QWidget* redBox = new QWidget();
	redBox->setFixedSize (10, 10);
	redBox->setStyleSheet("background-color: rgb(255,0,0);");
	redLayout->addWidget(redBox);
	redLayout->addWidget(this->_redS);
	redLayout->addWidget(this->_redT);
	redLayout->setSpacing(3);

	QHBoxLayout *greenLayout = new QHBoxLayout();
	QWidget* greenBox = new QWidget();
	greenBox->setFixedSize (10, 10);
	greenBox->setStyleSheet("background-color: rgb(0,255,0);");
	greenLayout->addWidget(greenBox);
	greenLayout->addWidget(this->_greenS);
	greenLayout->addWidget(this->_greenT);
	greenLayout->setSpacing(3);

	QHBoxLayout *blueLayout = new QHBoxLayout();
	QWidget* blueBox = new QWidget();
	blueBox->setFixedSize (10, 10);
	blueBox->setStyleSheet("background-color: rgb(0,0,255);");
	blueLayout->addWidget(blueBox);
	blueLayout->addWidget(this->_blueS);
	blueLayout->addWidget(this->_blueT);
	blueLayout->setSpacing(3);

	QHBoxLayout *alphaLayout = new QHBoxLayout();
	QWidget* alphaBox = new QWidget();
	alphaBox->setFixedSize (10, 10);
	alphaBox->setStyleSheet("background-color: rgb(100,100,100);");
	alphaLayout->addWidget(alphaBox);
	alphaLayout->addWidget(this->_alphaS);
	alphaLayout->addWidget(this->_alphaT);
	alphaLayout->setSpacing(3);

	QGridLayout *colorDialogLayout = new QGridLayout();
	colorDialogLayout->setVerticalSpacing(0);
	colorDialogLayout->setHorizontalSpacing(0);
	colorDialogLayout->setMargin(0);
	colorDialogLayout->setSpacing(0);

	verticalLayout->addLayout(redLayout);
	verticalLayout->addLayout(greenLayout);
	verticalLayout->addLayout(blueLayout);
	verticalLayout->addLayout(alphaLayout);

	connect(this->_rgbaBox, SIGNAL(clicked()), this, SLOT(setBoxColorFromDialog()));

     QGridLayout *layout = new QGridLayout();
     layout->addWidget(_scacchiera, 0, 0);
     layout->addWidget(_rgbBox, 0, 0);
     layout->addWidget(_rgbaBox, 0, 0);
     this->_rgbBox->raise();
     this->_rgbaBox->raise();

	 colorDialogLayout->addLayout(verticalLayout, 0,0);
	 colorDialogLayout->addLayout(layout, 0,1);

	setLayout(colorDialogLayout);
}

RfxColorBox::~RfxColorBox()
{
	if(this->_rgbaBox)
		delete _rgbaBox;
	if(this->_rgbBox)
		delete _rgbBox;
	if(this->_scacchiera)
		delete _scacchiera;

	if(this->_redS)
		delete _redS;
	if(this->_greenS)
		delete _greenS;
	if(this->_blueS)
		delete _blueS;
	if(this->_alphaS)
		delete _alphaS;

	if(this->_redT)
		delete _redT;
	if(this->_greenT)
		delete _greenT;
	if(this->_blueT)
		delete _blueT;
	if(this->_alphaT)
		delete _alphaT;
}

/* Receives button click and shows a default system dialog for color selection.
Once the color has been selected sets it as the color of the widget and emits the color changes signals.
*/
void RfxColorBox::setBoxColorFromDialog(){

	QColor c = QColorDialog::getColor(QColor(_redS->value(), _greenS->value(), _blueS->value()));//(*(this->_color));
     if(c.isValid()){
		disconnectSliders();
		this->_redS->setValue(c.red());
		this->_redS->setToolTip(QString().setNum(c.red()));
		this->_redT->setText(QString().setNum(c.red()));

		this->_greenS->setValue(c.green());
		this->_greenS->setToolTip(QString().setNum(c.green()));
		this->_greenT->setText(QString().setNum(c.green()));

		this->_blueS->setValue(c.blue());
		this->_blueS->setToolTip(QString().setNum(c.blue()));
		this->_blueT->setText(QString().setNum(c.blue()));

		emit colorChanged();
		int r, g, b, a;
		r = c.red();
		g = c.green();
		b = c.blue();
		a = this->_alphaS->value();

		int* vals[4] = {&r, &g, &b, &a};
		this->_rgbaBox->setStyleSheet(getNewRGBAStylesheet(this->_rgbaBox->styleSheet(), CHANNEL_ALL, vals));
		this->_rgbBox->setStyleSheet(getNewRGBStylesheet(this->_rgbBox->styleSheet(), CHANNEL_ALL, vals));
		connectSliders();
     }
}

/* Sets just the red channel.
   @param r The new red value.
*/
void RfxColorBox::setR(int r){
	this->_redS->setToolTip(QString().setNum(r));
	this->_redT->setText(QString().setNum(r));
	emit colorChanged();
     int* vals[1] = {&r};
     this->_rgbaBox->setStyleSheet(getNewRGBAStylesheet(this->_rgbaBox->styleSheet(), CHANNEL_R, vals));
     this->_rgbBox->setStyleSheet(getNewRGBStylesheet(this->_rgbBox->styleSheet(), CHANNEL_R, vals));
}

/* Sets just the green channel.
   @param g The new green value.
*/
void RfxColorBox::setG(int g){
	this->_greenS->setToolTip(QString().setNum(g));
	this->_greenT->setText(QString().setNum(g));
	emit colorChanged();
     int* vals[1] = {&g};
     this->_rgbaBox->setStyleSheet(getNewRGBAStylesheet(this->_rgbaBox->styleSheet(), CHANNEL_G, vals));
     this->_rgbBox->setStyleSheet(getNewRGBStylesheet(this->_rgbBox->styleSheet(), CHANNEL_G, vals));
}

/* Sets just the blue channel.
   @param b The new blue value.
*/
void RfxColorBox::setB(int b){
this->_blueS->setToolTip(QString().setNum(b));
this->_blueT->setText(QString().setNum(b));
emit colorChanged();
     int* vals[1] = {&b};
	 this->_rgbaBox->setStyleSheet(getNewRGBAStylesheet(this->_rgbaBox->styleSheet(), CHANNEL_B, vals));
     this->_rgbBox->setStyleSheet(getNewRGBStylesheet(this->_rgbBox->styleSheet(), CHANNEL_B, vals));
}

/* Sets just the alpha channel.
   @param a The new alpha value.
*/
void RfxColorBox::setA(int a){
	this->_alphaS->setToolTip(QString().setNum(a));
	this->_alphaT->setText(QString().setNum(a));
	emit colorChanged();
     int* vals[1] = {&a};
     this->_rgbaBox->setStyleSheet(getNewRGBAStylesheet(this->_rgbaBox->styleSheet(), CHANNEL_A, vals));
}

/* Sets just the red channel.*/
void RfxColorBox::setR(){
	bool res = false;
	int val = this->_redT->text().toInt(&res);
	if (!res){
		this->_redT->setText(QString().setNum(this->_redS->value()));
		return;
	}

	if (val > 255)
		this->_redS->setValue(255);
	else if (val < 0)
		this->_redS->setValue(0);
	else
		this->_redS->setValue(val);
}

/* Sets just the green channel.*/
void RfxColorBox::setG(){
	bool res = false;
	int val = this->_greenT->text().toInt(&res);
	if (!res){
		this->_redT->setText(QString().setNum(this->_greenS->value()));
		return;
	}

	if (val > 255)
		this->_greenS->setValue(255);
	else if (val < 0)
		this->_greenS->setValue(0);
	else
		this->_greenS->setValue(val);
}

/* Sets just the blue channel.*/
void RfxColorBox::setB(){
	bool res = false;
	int val = this->_blueT->text().toInt(&res);
	if (!res){
		this->_blueT->setText(QString().setNum(this->_blueS->value()));
		return;
	}

	if (val > 255)
		this->_blueS->setValue(255);
	else if (val < 0)
		this->_blueS->setValue(0);
	else
		this->_blueS->setValue(val);
}

/* Sets just the alpha channel.*/
void RfxColorBox::setA(){
	bool res = false;
	int val = this->_alphaT->text().toInt(&res);
	if (!res){
		this->_alphaT->setText(QString().setNum(this->_alphaS->value()));
		return;
	}

	if (val > 255)
		this->_alphaS->setValue(255);
	else if (val < 0)
		this->_alphaS->setValue(0);
	else
		this->_alphaS->setValue(val);
}

/*
     Returns a string rapresenting a new stylesheet(with alpha channel)
	 @param stykeSheet the old stylesheet.
	 @param channels The channel that have to be modified.
	 @param vals the new values
	 @return the new stylesheet

*/
QString RfxColorBox::getNewRGBAStylesheet(const QString& styleSheet, RfxColorBox::Channels channels, int* vals[]){
     int openBracket = styleSheet.indexOf("(");
     int closedBracket = styleSheet.indexOf(")");
     QStringList list = styleSheet.mid(openBracket + 1, closedBracket - openBracket).split(",");
     QString newStyleSheet = RfxColorBox::_BASE_RGBA_BOX_STYLE + QString("background-color: rgba(");

	 switch(channels){
		 case CHANNEL_R :
          newStyleSheet = newStyleSheet+QString("%1,").arg(*vals[0])+list[1]+','+list[2]+','+list[3]+';';
		  break;

		 case CHANNEL_G:
          newStyleSheet = newStyleSheet+list[0]+','+QString("%1,").arg(*vals[0])+list[2]+','+list[3]+';';
		  break;

		 case CHANNEL_B:
		  newStyleSheet = newStyleSheet+list[0]+','+list[1]+','+QString("%1,").arg(*vals[0])+list[3]+';';
		  break;

		 case CHANNEL_A:
		  newStyleSheet = newStyleSheet+list[0]+','+list[1]+','+list[2]+','+QString("%1);").arg(*vals[0]);
		  break;

		 case CHANNEL_ALL:
			newStyleSheet = newStyleSheet+QString("%1,").arg(*vals[0])+QString("%1,").arg(*vals[1])+QString("%1,").arg(*vals[2])+QString("%1);").arg(*vals[3]);
			break;
     }

     return newStyleSheet;
}

/*
	 Returns a string rapresenting a new stylesheet(without alpha channel)
	 @param stykeSheet the old stylesheet.
	 @param channels The channel that have to be modified.
	 @param vals the new values
	 @return the new stylesheet

*/
QString RfxColorBox::getNewRGBStylesheet(const QString& styleSheet, RfxColorBox::Channels channels, int* vals[]){
     int openBracket = styleSheet.indexOf("(");
     int closedBracket = styleSheet.indexOf(")");
     QStringList list = styleSheet.mid(openBracket + 1, closedBracket - openBracket).split(",");
     QString newStyleSheet = RfxColorBox::_BASE_RGB_BOX_STYLE + QString("background-color: rgb(");

	 switch(channels){
		 case CHANNEL_R :
          newStyleSheet = newStyleSheet+QString("%1,").arg(*vals[0])+list[1]+','+list[2]+';';
		  break;

		 case CHANNEL_G:
          newStyleSheet = newStyleSheet+list[0]+','+QString("%1,").arg(*vals[0])+list[2]+';';
		  break;

		 case CHANNEL_B:
		  newStyleSheet = newStyleSheet+list[0]+','+list[1]+','+QString("%1);").arg(*vals[0]);
		  break;

		 case CHANNEL_A:
		  break;

		 case CHANNEL_ALL:
			newStyleSheet = newStyleSheet+QString("%1,").arg(*vals[0])+QString("%1,").arg(*vals[1])+QString("%1);").arg(*vals[2]);
			break;
     }
     return newStyleSheet;
}

/* Initialize a slider
@param slider the slider to initialize
@param value the initial value
*/
void RfxColorBox::initSlider(QSlider* slider, int value){
	slider->setTickPosition(QSlider::NoTicks);
	slider->setOrientation(Qt::Horizontal);
	slider->setMaximumSize(100, 15);

	slider->setTickInterval(1);
	slider->setRange(0,255);
	slider->setValue(value);
	slider->setToolTip(QString().setNum(value));
}

/* Initialize a text box.
@param box the text box to initialize
*/
void RfxColorBox::initTextBox(QLineEdit* box){
	box->setAlignment(Qt::AlignRight);
	box->setMaximumWidth(75);
	box->setMaximumHeight(15);
	box->setFont(QFont("verdana", 7));
}

/* Connects all the slider to the color box. */
void RfxColorBox::connectSliders(){
	connect(this->_redS, SIGNAL(valueChanged(int)), this, SLOT(setR(int)));
	 connect(this->_greenS, SIGNAL(valueChanged(int)), this, SLOT(setG(int)));
	 connect(this->_blueS, SIGNAL(valueChanged(int)), this, SLOT(setB(int)));
	 connect(this->_alphaS, SIGNAL(valueChanged(int)), this, SLOT(setA(int)));
}

/* Disconnects all the slider to the color box. */
void RfxColorBox::disconnectSliders(){
	disconnect(this->_redS, SIGNAL(valueChanged(int)), this, SLOT(setR(int)));
	 disconnect(this->_greenS, SIGNAL(valueChanged(int)), this, SLOT(setG(int)));
	 disconnect(this->_blueS, SIGNAL(valueChanged(int)), this, SLOT(setB(int)));
	 disconnect(this->_alphaS, SIGNAL(valueChanged(int)), this, SLOT(setA(int)));
}


text:
package org.atdl4j.ui.swt.test;

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Control;

public class SWTDebugMouseTrackListener implements MouseTrackListener {

	private Color defaultColor;

	private Color remarkColor;

	private Control control;

	public SWTDebugMouseTrackListener(Control control) {
		this.control = control;
		defaultColor = control.getParent().getBackground();
		remarkColor = new Color(control.getDisplay(), 255, 0, 0);
	}

	public void mouseEnter(MouseEvent ev) {
		control.getParent().setBackground(remarkColor);
	}

	public void mouseExit(MouseEvent ev) {
		control.getParent().setBackground(defaultColor);
	}

	public void mouseHover(MouseEvent ev) {
	}
}

redpajama_set_name: RedPajamaGithub


text:
  <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    `Saved Filters`
  </button>

    `Save as New Filter`
    <~userfilter_selected if="f[userfilters_id]" inline>
      <a class="dropdown-item on-save-userfilter" data-id="<~f[userfilters_id]>" href="#">`Save to` "<~f[userfilter][iname]>"
      <a class="dropdown-item on-del-userfilter" data-id="<~f[userfilters_id]>" href="#">`Delete` "<~f[userfilter][iname]>"
    </~userfilter_selected>

    <~select_userfilters repeat inline>
        <a class="dropdown-item" href="?dofilter=1&userfilters_id=<~id>"><~iname>
    </~select_userfilters>


text:
/* */
var baseHas = require('./_baseHas'),
    keys = require('./keys');
var PARTIAL_COMPARE_FLAG = 2;
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
  var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
      objProps = keys(object),
      objLength = objProps.length,
      othProps = keys(other),
      othLength = othProps.length;
  if (objLength != othLength && !isPartial) {
    return false;
  }
  var index = objLength;
  while (index--) {
    var key = objProps[index];
    if (!(isPartial ? key in other : baseHas(other, key))) {
      return false;
    }
  }
  var stacked = stack.get(object);
  if (stacked) {
    return stacked == other;
  }
  var result = true;
  stack.set(object, other);
  var skipCtor = isPartial;
  while (++index < objLength) {
    key = objProps[index];
    var objValue = object[key],
        othValue = other[key];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
    }
    if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) : compared)) {
      result = false;
      break;
    }
    skipCtor || (skipCtor = key == 'constructor');
  }
  if (result && !skipCtor) {
    var objCtor = object.constructor,
        othCtor = other.constructor;
    if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
      result = false;
    }
  }
  stack['delete'](object);
  return result;
}
module.exports = equalObjects;


text:
"""Utilities for tests"""

import functools as ft

import factory
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.test import TestCase
from factory.django import DjangoModelFactory
from rest_framework.test import APIClient

from powerdns.models import (
    DeleteRequest,
    Domain,
    DomainOwner,
    DomainTemplate,
    Record,
    RecordRequest,
    RecordTemplate,
    Service,
    ServiceOwner,
)
from powerdns.utils import AutoPtrOptions

class UserFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = get_user_model()
        django_get_or_create = ('username',)

    username = factory.Sequence(lambda n: "user_%d" % n)

    @classmethod
    def _generate(cls, create, attrs):
        user = super(UserFactory, cls)._generate(create, attrs)
        user.set_password('password')
        user.save()
        return user

class DomainTemplateFactory(DjangoModelFactory):
    class Meta:
        model = DomainTemplate

    name = factory.Sequence(lambda n: 'name%d' % n)

class RecordTemplateFactory(DjangoModelFactory):
    class Meta:
        model = RecordTemplate

class ServiceFactory(DjangoModelFactory):
    class Meta:
        model = Service
    name = factory.Sequence(lambda n: 'service%d' % n)
    uid = factory.Sequence(lambda n: 'uid%d' % n)

class ServiceOwnerFactory(DjangoModelFactory):
    class Meta:
        model = ServiceOwner
    service = factory.SubFactory(ServiceFactory)
    owner = factory.SubFactory(UserFactory)

class DomainFactory(DjangoModelFactory):
    class Meta:
        model = Domain

    name = factory.Sequence(lambda n: 'name%d.com' % n)
    service = factory.SubFactory(ServiceFactory)
    auto_ptr = AutoPtrOptions.NEVER

class DomainOwnerFactory(DjangoModelFactory):
    class Meta:
        model = DomainOwner
    domain = factory.SubFactory(DomainFactory)
    owner = factory.SubFactory(UserFactory)

class RecordFactory(DjangoModelFactory):
    class Meta:
        model = Record

    domain = factory.SubFactory(DomainFactory)
    owner = factory.SubFactory(UserFactory)
    service = factory.SubFactory(ServiceFactory)

class RecordRequestFactory(DjangoModelFactory):
    class Meta:
        model = RecordRequest

    record = factory.SubFactory(RecordFactory)
    domain = factory.SubFactory(DomainFactory)
    owner = factory.SubFactory(UserFactory)
    target_service = factory.SubFactory(ServiceFactory)

class RecordDeleteRequestFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = DeleteRequest

    target = factory.SubFactory(RecordFactory)
    owner = factory.SubFactory(UserFactory)

    @property
    def content_type(self):
        return ContentType.objects.get_for_model(Record)

class RecordTestCase(TestCase):
    """Base class for tests on records."""

    def setUp(self):
        self.domain = DomainFactory(
            name='example.com',
            template=None,
            reverse_template=DomainTemplateFactory(name='reverse'),
            auto_ptr=AutoPtrOptions.NEVER,
        )

    def validate(self, **values):
        """
        Perform a full clean of a record with given values"""
        values.setdefault('domain', self.domain)
        values.setdefault('change_date', '20150305')
        Record(**values).full_clean()

    def check_invalid(self, **values):
        """
        Perform a full clean of a record with given values expecting it to fail
        """
        with self.assertRaises(ValidationError):
            self.validate(**values)

def user_client(user):
    """Returns client for a given user"""
    client = APIClient()
    client.force_authenticate(user=user)
    return client

def assert_exists(exists, Model, **kwargs):
    """Check if given object exists or doesn't exist"""
    if Model.objects.filter(**kwargs).exists() != exists:
        raise AssertionError("Object with arguments {} {}!".format(
            kwargs,
            "doesn't exist" if exists else "exists"
        ))

assert_does_exist = ft.partial(assert_exists, True)
assert_not_exists = ft.partial(assert_exists, False)


text:
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/complex/arg', __FILE__)

ruby_version_is ""..."1.9" do
  describe "Complex#arg" do
    it_behaves_like(:complex_arg, :arg)
  end
end


text:
$(document).ready(function(){
    $("table").tablesorter();

    $.ajax({
        type: "GET",
        dataType: "json",
        url: "/phones/rest/app/directory/web",
        success: function( resp ){
            for(var i = 0; i < resp.directoryEntries.length; i++)
            {
                var tableRow =
                    "
" +
                      "" + resp.directoryEntries[i].name + "	" +
                      "" + resp.directoryEntries[i].telephoneNumber + "	" +
                    "
";
                $('#directory-table tbody').append(tableRow);
            }

            $("table").trigger("update");
        }
    });
});


text:
package apple.avfoundation;

import java.io.*;
import java.nio.*;
import java.util.*;
import com.google.j2objc.annotations.*;
import com.google.j2objc.runtime.*;
import com.google.j2objc.runtime.block.*;
import apple.audiotoolbox.*;
import apple.corefoundation.*;
import apple.coregraphics.*;
import apple.coreservices.*;
import apple.foundation.*;
import apple.dispatch.*;
import apple.coreanimation.*;
import apple.coreaudio.*;
import apple.coremedia.*;
import apple.corevideo.*;
import apple.mediatoolbox.*;

/**
 * @since Available in iOS 8.0 and later.
 */
@Library("AVFoundation/AVFoundation.h") @Mapping("AVAudioChannelLayout")
public class AVAudioChannelLayout
    extends NSObject
     {

    @Mapping("initWithLayoutTag:")
    public AVAudioChannelLayout(@Representing("AudioChannelLayoutTag") long layoutTag) { }
    @Mapping("initWithLayout:")
    public AVAudioChannelLayout(AudioChannelLayout layout) { }
    @Mapping("init")
    public AVAudioChannelLayout() { }

    @Mapping("layoutTag")
    public native @Representing("AudioChannelLayoutTag") long getLayoutTag();
    @Mapping("layout")
    public native AudioChannelLayout getLayout();
    @Mapping("channelCount")
    public native int getChannelCount();

    @Mapping("isEqual:")
    public native boolean equalsTo(Object object);
    @Mapping("layoutWithLayoutTag:")
    public static native AVAudioChannelLayout create(@Representing("AudioChannelLayoutTag") long layoutTag);
    @Mapping("layoutWithLayout:")
    public static native AVAudioChannelLayout create(AudioChannelLayout layout);

}


text:
package org.apereo.cas.configuration.model.support.mongo;

import org.apereo.cas.configuration.model.core.authentication.PasswordEncoderProperties;
import org.apereo.cas.configuration.model.core.authentication.PrincipalTransformationProperties;
import org.apereo.cas.configuration.support.RequiresModule;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

/**
 * This is {@link MongoAuthenticationProperties}.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
@RequiresModule(name = "cas-server-support-mongo")
@Getter
@Setter
public class MongoAuthenticationProperties extends SingleCollectionMongoDbProperties {

    private static final long serialVersionUID = -7304734732383722585L;

    /**
     * Attributes to fetch from Mongo.
     */
    private String attributes;

    /**
     * Attributes that holds the username.
     */
    private String usernameAttribute = "username";

    /**
     * Attribute that holds the password.
     */
    private String passwordAttribute = "password";

    /**
     * Attribute that would be used to establish the authenticated profile.
     */
    private String principalIdAttribute;

    /**
     * Password encoder settings for the authentication handler.
     */
    @NestedConfigurationProperty
    private PasswordEncoderProperties passwordEncoder = new PasswordEncoderProperties();

    /**
     * This is principal transformation properties.
     */
    @NestedConfigurationProperty
    private PrincipalTransformationProperties principalTransformation = new PrincipalTransformationProperties();

    /**
     * Name of the authentication handler.
     */
    private String name;

    public MongoAuthenticationProperties() {
        setCollection("users");
    }
}


text:
How to run LayerProx with systemd, aka run it as a service in linux

set the directory
vim layerprox
scp layerprox /etc/init.d/layerprox
echo ' ' > /run/layerprox.pid
scp layerprox.service /lib/systemd/system/layerprox.service
service layerprox start


text:
{% if link %}{% endif %}

{% if link %}{% endif %}


text:
import utils

# actual tests code
import re
import random
import xml.etree.ElementTree as ET

def test_tdl_structure_validation():
  template = open(random.choice(utils.TEMPLATE_FILES), 'r').read()
  template = re.sub('<install', '<intall', template)
  imagejson = utils.build_base(template)
  imageid = imagejson['id']
  assert utils.wait_until_base_completes(imageid) == 'FAILED'

def test_tdl_content_validation():
  tree = ET.parse(random.choice(utils.TEMPLATE_FILES))
  roottag = tree.getroot()
  ostag = roottag.find('./os')
  rootpwtag = ostag.find('./rootpw')
  ostag.remove(rootpwtag)
  imagejson = utils.build_base(ET.tostring(roottag))
  imageid = imagejson['id']
  assert utils.wait_until_base_completes(imageid) == 'FAILED'


text:
set -ex

CONFIG=${CONFIG:-opt}

NUNIT_CONSOLE="mono packages/NUnit.Runners.2.6.4/tools/nunit-console.exe"

if [ "$CONFIG" = "dbg" ]
then
  MSBUILD_CONFIG="Debug"
else
  MSBUILD_CONFIG="Release"
fi

# change to gRPC repo root
cd $(dirname $0)/../..

root=`pwd`
cd src/csharp

export LD_LIBRARY_PATH=$root/libs/$CONFIG

$NUNIT_CONSOLE -labels "$1/bin/$MSBUILD_CONFIG/$1.dll"


text:
package org.ovirt.engine.api.resource;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;

import org.ovirt.engine.api.model.Network;
import org.ovirt.engine.api.model.Networks;

@Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML})
public interface AssignedNetworksResource {
    @GET
    Networks list();

    @POST
    @Consumes({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML})
    Response add(Network network);

    @Path("{id}")
    AssignedNetworkResource getAssignedNetworkSubResource(@PathParam("id") String id);
}


text:
class TestScene : public XE::Scene
{

public:

	TestScene( XE::XEngine& engine)
		: XE::Scene(engine, engine.getDAL(), engine.getGraphicsManager())
		, m_engine(engine)
	{

	}

	void create(XE::Uint16 sceneID, char* fbData = nullptr)
	{
		XE::Scene::create(sceneID, fbData);

	}

	void update(float deltaTime)
	{
		XE::Scene::update(deltaTime);
		//Scene::getSystems().update<XE::ControllerSystem>(deltaTime);
		//Scene::getSystems().update<XE::PhysicsSystem>(deltaTime);
	}

private :
	XE::XEngine& m_engine;

};


text:
<!DOCTYPE html>

  <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Select nodes in the graph based on their degree values — select_nodes_by_degree • DiagrammeR</title>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">

<link href="../pkgdown.css" rel="stylesheet">

<meta property="og:title" content="Select nodes in the graph based on their degree values — select_nodes_by_degree" />

<meta property="og:description" content="Using a graph object of class dgr_graph, create a selection of nodes
  that have certain degree values." />
<meta name="twitter:card" content="summary" />

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">

      </button>

        DiagrammeR
        1.0.0

  Reference

    Articles

      Graphviz and mermaid in DiagrammeR

      Node and Edge Data Frames

      Creating Simple Graphs from NDFs/EDFs

  Changelog

Select nodes in the graph based on their degree values

    Source: R/select_nodes_by_degree.R

select_nodes_by_degree.Rd

Using a graph object of class dgr_graph, create a selection of nodes
  that have certain degree values.

select_nodes_by_degree(graph, expressions, set_op = "union")

Arguments

    <colgroup><col class="name" /><col class="desc" /></colgroup>

      graph

a graph object of class dgr_graph.

      expressions

one or more expressions for filtering nodes by degree
values. Use a combination of degree type (deg for total degree,
indeg for in-degree, and outdeg for out-degree) with a
comparison operator and values for comparison (e.g., use "deg >= 2"
to select nodes with a degree greater than or equal to 2).

      set_op

the set operation to perform upon consecutive selections of
graph nodes. This can either be as a union (the default), as an
intersection of selections with intersect, or, as a
difference on the previous selection, if it exists.

Value

a graph object of class dgr_graph.

Examples

# Create a random graph using
# the `add_gnm_graph()` function
graph <-
  create_graph() %>%
  add_gnm_graph(
    n = 35, m = 125,
    set_seed = 23)

# Report which nodes have a
# total degree (in-degree +
# out-degree) of exactly 9
graph %>%
  select_nodes_by_degree(
    expressions = "deg == 9") %>%
  get_selection()

#> `select_nodes_by_degree()` INFO: created a new selection of 4 nodes

#> `get_selection()` INFO: there is an active selection of 4 nodes

#> [1]  5 10 26 31

# Report which nodes have a
# total degree greater than or
# equal to 9
graph %>%
  select_nodes_by_degree(
    expressions = "deg >= 9") %>%
  get_selection()

#> `select_nodes_by_degree()` INFO: created a new selection of 10 nodes

#> `get_selection()` INFO: there is an active selection of 10 nodes

#>  [1]  1  2  4  5 10 12 18 25 26 31

# Combine two calls of
# `select_nodes_by_degree()` to
# get those nodes with total
# degree less than 3 and total
# degree greater than 10 (by
# default, those `select...()`
# functions will `union` the
# sets of nodes selected)
graph %>%
  select_nodes_by_degree(
    expressions = "deg < 3") %>%
  select_nodes_by_degree(
    expressions = "deg > 10") %>%
  get_selection()

#> `select_nodes_by_degree()` INFO: created a new selection of 2 nodes

#> `get_selection()` INFO: there is an active selection of 2 nodes

#> [1] 1 2

# Combine two calls of
# `select_nodes_by_degree()` to
# get those nodes with total
# degree greater than or equal
# to 3 and less than or equal
# to 10 (the key here is to
# `intersect` the sets of nodes
# selected in the second call)
graph %>%
  select_nodes_by_degree(
    expressions = "deg >= 3") %>%
  select_nodes_by_degree(
    expressions = "deg <= 10",
    set_op = "intersect") %>%
  get_selection()

#> `select_nodes_by_degree()` INFO: created a new selection of 35 nodes

#> `select_nodes_by_degree()` INFO: created a new selection of33 nodes:
#> * this replaces35 nodesin the prior selection

#> `get_selection()` INFO: there is an active selection of 33 nodes

#>  [1]  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#> [26] 28 29 30 31 32 33 34 35

# Select all nodes with an
# in-degree greater than 5, then,
# apply a node attribute to those
# selected nodes (coloring the
# selected nodes red)
graph_2 <-
  graph %>%
  select_nodes_by_degree(
    expressions = "indeg > 5") %>%
  set_node_attrs_ws(
    node_attr = color,
    value = "red")

#> `select_nodes_by_degree()` INFO: created a new selection of 5 nodes

# Get the selection of nodes
graph_2 %>% get_selection()

#> `get_selection()` INFO: there is an active selection of 5 nodes

#> [1]  1  4 13 25 35

Contents

Arguments

Value

Examples

Developed by Richard Iannone.

Site built with pkgdown.


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

<TITLE>
Uses of Interface org.springframework.beans.factory.BeanFactoryAware (Spring Framework API 2.5)
</TITLE>

<META NAME="date" CONTENT="2007-11-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

The Spring Framework

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
org.springframework.beans.factory.BeanFactoryAware

Packages that use BeanFactoryAware

org.springframework.aop.aspectj.annotation
Classes enabling AspectJ 5 @Annotated classes to be used in Spring AOP.

org.springframework.aop.aspectj.autoproxy
Base classes enabling auto-proxying based on AspectJ.

org.springframework.aop.config
Support package for declarative AOP configuration,
with XML schema being the primary configuration format.

org.springframework.aop.framework
Package containing Spring's basic AOP infrastructure, compliant with the
AOP Alliance interfaces.

org.springframework.aop.framework.autoproxy
Bean post-processors for use in ApplicationContexts to simplify AOP usage
by automatically creating AOP proxies without the need to use a ProxyFactoryBean.

org.springframework.aop.framework.autoproxy.target
Generic support classes for target source creation.

org.springframework.aop.scope
Support for AOP-based scoping of target objects, with configurable backend.

org.springframework.aop.support
Convenience classes for using Spring's AOP API.

org.springframework.aop.target
This package contains implementations of the org.springframework.aop.TargetSource interface.

org.springframework.beans.factory.annotation
Support package for annotation-driven bean configuration.

org.springframework.beans.factory.config
SPI interfaces and configuration-related convenience classes for bean factories.

org.springframework.beans.factory.serviceloader
Support package for the JDK 1.6 ServiceLoader facility.

org.springframework.beans.factory.wiring
Mechanism to determine bean wiring metadata from a bean instance.

org.springframework.context.annotation
Annotation support for context configuration,
including classpath scanning for autowire candidates.

org.springframework.context.weaving
Load-time weaving support for a Spring application context, building on Spring's
LoadTimeWeaver abstraction.

org.springframework.dao.annotation
Annotation support for DAOs.

org.springframework.dao.support
Support classes for DAO implementations,
providing miscellaneous utility methods.

org.springframework.jdbc.datasource.lookup
Provides a strategy for looking up JDBC DataSources by name.

org.springframework.jms.support.destination
Support classes for Spring's JMS framework.

org.springframework.jmx.export
This package provides declarative creation and registration of
Spring-managed beans as JMX MBeans.

org.springframework.jmx.export.annotation
JDK 1.5+ annotations for MBean exposure.

org.springframework.orm.hibernate3
Package providing integration of
Hibernate3
with Spring concepts.

org.springframework.orm.hibernate3.support
Classes supporting the org.springframework.orm.hibernate3 package.

org.springframework.orm.jpa.support
Classes supporting the org.springframework.orm.jpa package.

org.springframework.remoting.jaxws
Remoting classes for Web Services via JAX-WS (the successor of JAX-RPC),
as included in Java 6 and Java EE 5.

org.springframework.scheduling.quartz
Support classes for the open source scheduler
Quartz,
allowing to set up Quartz Schedulers, JobDetails and
Triggers as beans in a Spring context.

org.springframework.scripting.groovy
Package providing integration of
Groovy
into Spring's scripting infrastructure.

org.springframework.scripting.support
Support classes for Spring's scripting package.

org.springframework.transaction.interceptor
AOP-based solution for declarative transaction demarcation.

org.springframework.web.context.support
Classes supporting the org.springframework.web.context package,
such as WebApplicationContext implementations and various utility classes.

Uses of BeanFactoryAware in org.springframework.aop.aspectj.annotation

Classes in org.springframework.aop.aspectj.annotation that implement BeanFactoryAware

 class
AnnotationAwareAspectJAutoProxyCreator

          AspectJAwareAdvisorAutoProxyCreator subclass that processes all AspectJ
 annotation aspects in the current application context, as well as Spring Advisors.

Uses of BeanFactoryAware in org.springframework.aop.aspectj.autoproxy

Classes in org.springframework.aop.aspectj.autoproxy that implement BeanFactoryAware

 class
AspectJAwareAdvisorAutoProxyCreator

          AbstractAdvisorAutoProxyCreator
 subclass that exposes AspectJ's invocation context and understands AspectJ's rules
 for advice precedence when multiple pieces of advice come from the same aspect.

Uses of BeanFactoryAware in org.springframework.aop.config

Classes in org.springframework.aop.config that implement BeanFactoryAware

 class
MethodLocatingFactoryBean

          FactoryBean implementation that locates a Method on a specified bean.

 class
SimpleBeanFactoryAwareAspectInstanceFactory

          Implementation of AspectInstanceFactory that locates the aspect from the
 BeanFactory using a configured bean name.

Uses of BeanFactoryAware in org.springframework.aop.framework

Classes in org.springframework.aop.framework that implement BeanFactoryAware

 class
ProxyFactoryBean

          FactoryBean implementation that builds an
 AOP proxy based on beans in Spring BeanFactory.

Uses of BeanFactoryAware in org.springframework.aop.framework.autoproxy

Classes in org.springframework.aop.framework.autoproxy that implement BeanFactoryAware

 class
AbstractAdvisorAutoProxyCreator

          Generic auto proxy creator that builds AOP proxies for specific beans
 based on detected Advisors for each bean.

 class
AbstractAutoProxyCreator

          BeanPostProcessor implementation
 that wraps each eligible bean with an AOP proxy, delegating to specified interceptors
 before invoking the bean itself.

 class
BeanNameAutoProxyCreator

          Auto proxy creator that identifies beans to proxy via a list of names.

 class
DefaultAdvisorAutoProxyCreator

          BeanPostProcessor implementation that creates AOP proxies based on all candidate
 Advisors in the current BeanFactory.

 class
InfrastructureAdvisorAutoProxyCreator

          Auto-proxy creator that considers infrastructure Advisor beans only,
 ignoring any application-defined Advisors.

Uses of BeanFactoryAware in org.springframework.aop.framework.autoproxy.target

Classes in org.springframework.aop.framework.autoproxy.target that implement BeanFactoryAware

 class
AbstractBeanFactoryBasedTargetSourceCreator

          Convenient superclass for
 TargetSourceCreator
 implementations that require creating multiple instances of a prototype bean.

 class
LazyInitTargetSourceCreator

          TargetSourceCreator that enforces a LazyInitTargetSource for each bean
 that is defined as "lazy-init".

 class
QuickTargetSourceCreator

          Convenient TargetSourceCreator using bean name prefixes to create one of three
 well-known TargetSource types:
 : CommonsPoolTargetSource
 % ThreadLocalTargetSource
 !

Uses of BeanFactoryAware in org.springframework.aop.scope

Classes in org.springframework.aop.scope that implement BeanFactoryAware

 class
ScopedProxyFactoryBean

          Convenient proxy factory bean for scoped objects.

Uses of BeanFactoryAware in org.springframework.aop.support

Classes in org.springframework.aop.support that implement BeanFactoryAware

 class
AbstractBeanFactoryPointcutAdvisor

          Abstract BeanFactory-based PointcutAdvisor that allows for any Advice
 to be configured as reference to an Advice bean in a BeanFactory.

 class
DefaultBeanFactoryPointcutAdvisor

          Concrete BeanFactory-based PointcutAdvisor that allows for any Advice
 to be configured as reference to an Advice bean in the BeanFactory,
 as well as the Pointcut to be configured through a bean property.

Uses of BeanFactoryAware in org.springframework.aop.target

Classes in org.springframework.aop.target that implement BeanFactoryAware

 class
AbstractBeanFactoryBasedTargetSource

          Base class for TargetSource implementations
 that are based on a Spring BeanFactory,
 delegating to Spring-managed bean instances.

 class
AbstractPoolingTargetSource

          Abstract base class for pooling TargetSource
 implementations which maintain a pool of target instances, acquiring and
 releasing a target object from the pool for each method invocation.

 class
AbstractPrototypeBasedTargetSource

          Base class for dynamic TargetSources that can create new prototype bean
 instances to support a pooling or new-instance-per-invocation strategy.

 class
CommonsPoolTargetSource

          TargetSource implementation that holds objects in a configurable
 Jakarta Commons Pool.

 class
LazyInitTargetSource

          TargetSource that lazily accesses a
 singleton bean from a BeanFactory.

 class
PrototypeTargetSource

          TargetSource that creates a new instance of the target bean for each
 request, destroying each instance on release (after each request).

 class
SimpleBeanTargetSource

          Simple TargetSource implementation,
 freshly obtaining the specified target bean from its containing
 Spring BeanFactory.

 class
ThreadLocalTargetSource

          Alternative to an object pool.

Uses of BeanFactoryAware in org.springframework.beans.factory.annotation

Classes in org.springframework.beans.factory.annotation that implement BeanFactoryAware

 class
AutowiredAnnotationBeanPostProcessor

          BeanPostProcessor implementation
 that autowires annotated fields, setter methods and arbitrary config methods.

Uses of BeanFactoryAware in org.springframework.beans.factory.config

Classes in org.springframework.beans.factory.config that implement BeanFactoryAware

 class
AbstractFactoryBean

          Simple template superclass for FactoryBean implementations that
 creates a singleton or a prototype object, depending on a flag.

 class
BeanReferenceFactoryBean

          FactoryBean that exposes an arbitrary target bean under a different name.

 class
ListFactoryBean

          Simple factory for shared List instances.

 class
MapFactoryBean

          Simple factory for shared Map instances.

 class
MethodInvokingFactoryBean

          FactoryBean which returns a value which is the result of a static or instance
 method invocation.

 class
ObjectFactoryCreatingFactoryBean

          A FactoryBean implementation that
 returns a value which is an ObjectFactory
 that in turn returns a bean sourced from a BeanFactory.

 class
PreferencesPlaceholderConfigurer

          Subclass of PropertyPlaceholderConfigurer that supports JDK 1.4's
 Preferences API (java.util.prefs).

 class
PropertyPathFactoryBean

          FactoryBean that evaluates a property path on a given target object.

 class
PropertyPlaceholderConfigurer

          A property resource configurer that resolves placeholders in bean property values of
 context definitions.

 class
ServiceLocatorFactoryBean

          A FactoryBean implementation that
 takes an interface which must have one or more methods with
 the signatures MyType xxx() or MyType xxx(MyIdType id)
 (typically, MyService getService() or MyService getService(String id))
 and creates a dynamic proxy which implements that interface, delegating to an
 underlying BeanFactory.

 class
SetFactoryBean

          Simple factory for shared Set instances.

Uses of BeanFactoryAware in org.springframework.beans.factory.serviceloader

Classes in org.springframework.beans.factory.serviceloader that implement BeanFactoryAware

 class
AbstractServiceLoaderBasedFactoryBean

          Abstract base class for FactoryBeans operating on the
 JDK 1.6 ServiceLoader facility.

 class
ServiceFactoryBean

          FactoryBean that exposes the
 'primary' service for the configured service class, obtained through
 the JDK 1.6 ServiceLoader facility.

 class
ServiceListFactoryBean

          FactoryBean that exposes all
 services for the configured service class, represented as a List of service objects,
 obtained through the JDK 1.6 ServiceLoader facility.

 class
ServiceLoaderFactoryBean

          FactoryBean that exposes the
 JDK 1.6 ServiceLoader for the configured service class.

Uses of BeanFactoryAware in org.springframework.beans.factory.wiring

Classes in org.springframework.beans.factory.wiring that implement BeanFactoryAware

 class
BeanConfigurerSupport

          Convenient superclass for configurers that can perform Dependency Injection
 on objects (however they may be created).

Uses of BeanFactoryAware in org.springframework.context.annotation

Classes in org.springframework.context.annotation that implement BeanFactoryAware

 class
CommonAnnotationBeanPostProcessor

          BeanPostProcessor implementation
 that supports common JSR-250 annotations out of the box.

Uses of BeanFactoryAware in org.springframework.context.weaving

Classes in org.springframework.context.weaving that implement BeanFactoryAware

 class
LoadTimeWeaverAwareProcessor

          BeanPostProcessor
 implementation that passes the context's default LoadTimeWeaver
 to beans that implement the LoadTimeWeaverAware interface.

Uses of BeanFactoryAware in org.springframework.dao.annotation

Classes in org.springframework.dao.annotation that implement BeanFactoryAware

 class
PersistenceExceptionTranslationPostProcessor

          Bean post-processor that automatically applies persistence exception
 translation to any bean that carries the
 Repository annotation,
 adding a corresponding PersistenceExceptionTranslationAdvisor
 to the exposed proxy (either an existing AOP proxy or a newly generated
 proxy that implements all of the target's interfaces).

Uses of BeanFactoryAware in org.springframework.dao.support

Classes in org.springframework.dao.support that implement BeanFactoryAware

 class
PersistenceExceptionTranslationInterceptor

          AOP Alliance MethodInterceptor that provides persistence exception translation
 based on a given PersistenceExceptionTranslator.

Uses of BeanFactoryAware in org.springframework.jdbc.datasource.lookup

Classes in org.springframework.jdbc.datasource.lookup that implement BeanFactoryAware

 class
BeanFactoryDataSourceLookup

          DataSourceLookup implementation based on a Spring BeanFactory.

Uses of BeanFactoryAware in org.springframework.jms.support.destination

Classes in org.springframework.jms.support.destination that implement BeanFactoryAware

 class
BeanFactoryDestinationResolver

          DestinationResolver implementation based on a Spring BeanFactory.

Uses of BeanFactoryAware in org.springframework.jmx.export

Classes in org.springframework.jmx.export that implement BeanFactoryAware

 class
MBeanExporter

          JMX exporter that allows for exposing any Spring-managed bean
 to a JMX MBeanServer, without the need to define any
 JMX-specific information in the bean classes.

Uses of BeanFactoryAware in org.springframework.jmx.export.annotation

Classes in org.springframework.jmx.export.annotation that implement BeanFactoryAware

 class
AnnotationMBeanExporter

          Convenient subclass of Spring's standard MBeanExporter,
 activating Java 5 annotation usage for JMX exposure of Spring beans:
 ManagedResource, ManagedAttribute, ManagedOperation, etc.

Uses of BeanFactoryAware in org.springframework.orm.hibernate3

Classes in org.springframework.orm.hibernate3 that implement BeanFactoryAware

 class
HibernateAccessor

          Base class for HibernateTemplate and HibernateInterceptor,
 defining common properties such as SessionFactory and flushing behavior.

 class
HibernateInterceptor

          This interceptor binds a new Hibernate Session to the thread before a method
 call, closing and removing it afterwards in case of any method outcome.

 class
HibernateTemplate

          Helper class that simplifies Hibernate data access code.

 class
HibernateTransactionManager

          PlatformTransactionManager
 implementation for a single Hibernate SessionFactory.

Uses of BeanFactoryAware in org.springframework.orm.hibernate3.support

Classes in org.springframework.orm.hibernate3.support that implement BeanFactoryAware

 class
OpenSessionInViewInterceptor

          Spring web request interceptor that binds a Hibernate Session to the
 thread for the entire processing of the request.

Uses of BeanFactoryAware in org.springframework.orm.jpa.support

Classes in org.springframework.orm.jpa.support that implement BeanFactoryAware

 class
PersistenceAnnotationBeanPostProcessor

          BeanPostProcessor that processes PersistenceUnit
 and PersistenceContext annotations, for injection of
 the corresponding JPA resources EntityManagerFactory
 and EntityManager.

Uses of BeanFactoryAware in org.springframework.remoting.jaxws

Classes in org.springframework.remoting.jaxws that implement BeanFactoryAware

 class
SimpleJaxWsServiceExporter

          Simple exporter for JAX-WS services, autodetecting annotation service beans
 (through the JAX-WS WebService annotation) and exporting
 them with a configured base address (by default "http://localhost:8080/").

Uses of BeanFactoryAware in org.springframework.scheduling.quartz

Classes in org.springframework.scheduling.quartz that implement BeanFactoryAware

 class
MethodInvokingJobDetailFactoryBean

          FactoryBean that exposes a
 JobDetail object which delegates job execution to a
 specified (static or non-static) method.

Uses of BeanFactoryAware in org.springframework.scripting.groovy

Classes in org.springframework.scripting.groovy that implement BeanFactoryAware

 class
GroovyScriptFactory

          ScriptFactory implementation
 for a Groovy script.

Uses of BeanFactoryAware in org.springframework.scripting.support

Classes in org.springframework.scripting.support that implement BeanFactoryAware

 class
ScriptFactoryPostProcessor

          BeanPostProcessor that
 handles ScriptFactory definitions,
 replacing each factory with the actual scripted Java object generated by it.

Uses of BeanFactoryAware in org.springframework.transaction.interceptor

Classes in org.springframework.transaction.interceptor that implement BeanFactoryAware

 class
TransactionProxyFactoryBean

          Proxy factory bean for simplified declarative transaction handling.

Uses of BeanFactoryAware in org.springframework.web.context.support

Classes in org.springframework.web.context.support that implement BeanFactoryAware

 class
ServletContextPropertyPlaceholderConfigurer

          Subclass of PropertyPlaceholderConfigurer that resolves placeholders as
 ServletContext init parameters (that is, web.xml context-param
 entries).

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

The Spring Framework

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2002-2007 The Spring Framework.


text:
#include "postgres_fe.h"

#include <ctype.h>
#include <time.h>
#include "dumputils.h"
#include "postgres.h"
#include "catalog/pg_class.h"

#include "pg_backup_archiver.h"

/*
 * Variables for mapping DumpId to DumpableObject
 */
static DumpableObject **dumpIdMap = NULL;
static int	allocedDumpIds = 0;
static DumpId lastDumpId = 0;

/*
 * Variables for mapping CatalogId to DumpableObject
 */
static bool catalogIdMapValid = false;
static DumpableObject **catalogIdMap = NULL;
static int	numCatalogIds = 0;

/*
 * These variables are static to avoid the notational cruft of having to pass
 * them into findTableByOid() and friends.	For each of these arrays, we
 * build a sorted-by-OID index array immediately after it's built, and then
 * we use binary search in findTableByOid() and friends.  (qsort'ing the base
 * arrays themselves would be simpler, but it doesn't work because pg_dump.c
 * may have already established pointers between items.)
 */
static DumpableObject **tblinfoindex;
static DumpableObject **typinfoindex;
static DumpableObject **funinfoindex;
static DumpableObject **oprinfoindex;
static DumpableObject **nspinfoindex;
static DumpableObject **extinfoindex;
static int	numTables;
static int	numTypes;
static int	numFuncs;
static int	numOperators;
static int	numNamespaces;
static int	numExtensions;
static int  numTypeStorageOptions;

/* This is an array of object identities, not actual DumpableObjects */
static ExtensionMemberId *extmembers;
static int	numextmembers;

bool is_gpdump = false; /* determines whether to print extra logging messages in getSchemaData */

static void flagInhTables(TableInfo *tbinfo, int numTables,
			  InhInfo *inhinfo, int numInherits);
static void flagInhAttrs(TableInfo *tbinfo, int numTables,
			 InhInfo *inhinfo, int numInherits);
static int	DOCatalogIdCompare(const void *p1, const void *p2);
static int	ExtensionMemberIdCompare(const void *p1, const void *p2);
static void findParentsByOid(TableInfo *self,
				 InhInfo *inhinfo, int numInherits);
static int	strInArray(const char *pattern, char **arr, int arr_size);

void status_log_msg(const char *loglevel, const char *prog, const char *fmt,...);

void		reset(void);
/*
 * getSchemaData
 *	  Collect information about all potentially dumpable objects
 */
TableInfo *
getSchemaData(int *numTablesPtr, int g_role)
{
	TableInfo  *tblinfo;
	TypeInfo   *typinfo;
	FuncInfo   *funinfo;
	OprInfo    *oprinfo;
	NamespaceInfo *nspinfo;
	ExtensionInfo *extinfo;
	InhInfo    *inhinfo;
	int			numAggregates;
	int			numInherits;
	int			numRules;
	int			numProcLangs;
	int			numCasts;
	int			numOpclasses;
	int			numOpfamilies;
	int			numConversions;
	int			numExtProtocols;
	int			numTSParsers;
	int			numTSTemplates;
	int			numTSDicts;
	int			numTSConfigs;
	const char *LOGGER_INFO = "INFO";

	/*
	 * We must read extensions and extension membership info first, because
	 * extension membership needs to be consultable during decisions about
	 * whether other objects are to be dumped.
	 */
	if (g_verbose)
		write_msg(NULL, "reading extensions\n");
	extinfo = getExtensions(&numExtensions);
	extinfoindex = buildIndexArray(extinfo, numExtensions, sizeof(ExtensionInfo));

	if (g_verbose)
		write_msg(NULL, "identifying extension members\n");
	getExtensionMembership(extinfo, numExtensions);

	if (is_gpdump || g_verbose)
		status_log_msg(LOGGER_INFO, progname, "reading schemas\n");
	nspinfo = getNamespaces(&numNamespaces);
	nspinfoindex = buildIndexArray(nspinfo, numNamespaces, sizeof(NamespaceInfo));

	/*
	 * getTables should be done as soon as possible, so as to minimize the
	 * window between starting our transaction and acquiring per-table locks.
	 * However, we have to do getNamespaces first because the tables get
	 * linked to their containing namespaces during getTables.
	 */
	if (g_verbose)
		write_msg(NULL, "reading user-defined tables\n");
	tblinfo = getTables(&numTables);
	tblinfoindex = buildIndexArray(tblinfo, numTables, sizeof(TableInfo));

	/*
	 * ROLE_MASTER
	 */
	if (g_role == 1)
	{
		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading user-defined functions\n");
		funinfo = getFuncs(&numFuncs);
		funinfoindex = buildIndexArray(funinfo, numFuncs, sizeof(FuncInfo));

		/* this must be after getFuncs */
		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading user-defined types\n");
		typinfo = getTypes(&numTypes);
		typinfoindex = buildIndexArray(typinfo, numTypes, sizeof(TypeInfo));

		/* this must be after getFuncs */
		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading type storage options\n");
		getTypeStorageOptions(&numTypeStorageOptions);

		/* this must be after getFuncs, too */
		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading procedural languages\n");
		getProcLangs(&numProcLangs);

		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading user-defined aggregate functions\n");
		getAggregates(&numAggregates);

		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading user-defined operators\n");
		oprinfo = getOperators(&numOperators);
		oprinfoindex = buildIndexArray(oprinfo, numOperators, sizeof(OprInfo));

		if (testExtProtocolSupport())
		{
			if (is_gpdump || g_verbose)
				status_log_msg(LOGGER_INFO, progname, "reading user-defined external protocols\n");
			getExtProtocols(&numExtProtocols);
		}

		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading user-defined operator classes\n");
		getOpclasses(&numOpclasses);

		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading user-defined operator families\n");
		getOpfamilies(&numOpfamilies);

		if (is_gpdump || g_verbose)
			write_msg(NULL, "reading user-defined text search parsers\n");
		getTSParsers(&numTSParsers);

		if (is_gpdump || g_verbose)
			write_msg(NULL, "reading user-defined text search templates\n");
		getTSTemplates(&numTSTemplates);

		if (is_gpdump || g_verbose)
			write_msg(NULL, "reading user-defined text search dictionaries\n");
		getTSDictionaries(&numTSDicts);

		if (is_gpdump || g_verbose)
			write_msg(NULL, "reading user-defined text search configurations\n");
		getTSConfigurations(&numTSConfigs);

		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading user-defined conversions\n");
		getConversions(&numConversions);
	}

	if (is_gpdump || g_verbose)
		status_log_msg(LOGGER_INFO, progname, "reading type casts\n");
	getCasts(&numCasts);

	if (is_gpdump || g_verbose)
		status_log_msg(LOGGER_INFO, progname, "reading table inheritance information\n");
	inhinfo = getInherits(&numInherits);

	/* Identify extension configuration tables that should be dumped */
	if (g_verbose)
		write_msg(NULL, "finding extension tables\n");
	processExtensionTables(extinfo, numExtensions);

	if (is_gpdump || g_verbose)
		status_log_msg(LOGGER_INFO, progname, "reading rewrite rules\n");
	getRules(&numRules);

	/* Link tables to parents, mark parents of target tables interesting */
	if (is_gpdump || g_verbose)
		status_log_msg(LOGGER_INFO, progname, "finding inheritance relationships\n");
	flagInhTables(tblinfo, numTables, inhinfo, numInherits);

	if (is_gpdump || g_verbose)
		status_log_msg(LOGGER_INFO, progname, "reading column info for interesting tables\n");
	getTableAttrs(tblinfo, numTables);

	if (is_gpdump || g_verbose)
		status_log_msg(LOGGER_INFO, progname, "flagging inherited columns in subtables\n");
	flagInhAttrs(tblinfo, numTables, inhinfo, numInherits);

	/*
	 * ROLE_MASTER
	 */
	if (g_role == 1)
	{
		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading indexes\n");
		getIndexes(tblinfo, numTables);

		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading constraints\n");
		getConstraints(tblinfo, numTables);

		if (is_gpdump || g_verbose)
			status_log_msg(LOGGER_INFO, progname, "reading triggers\n");
		getTriggers(tblinfo, numTables);
	}

	*numTablesPtr = numTables;
	return tblinfo;
}

/* flagInhTables -
 *	 Fill in parent link fields of every target table, and mark
 *	 parents of target tables as interesting
 *
 * Note that only direct ancestors of targets are marked interesting.
 * This is sufficient; we don't much care whether they inherited their
 * attributes or not.
 *
 * modifies tblinfo
 */
static void
flagInhTables(TableInfo *tblinfo, int numTables,
			  InhInfo *inhinfo, int numInherits)
{
	int			i,
				j;
	int			numParents;
	TableInfo **parents;

	for (i = 0; i < numTables; i++)
	{
		/* Sequences, views and external tables never have parents */
		if (tblinfo[i].relkind == RELKIND_SEQUENCE ||
			tblinfo[i].relkind == RELKIND_VIEW ||
			tblinfo[i].relstorage == RELSTORAGE_EXTERNAL ||
			tblinfo[i].relstorage == RELSTORAGE_FOREIGN)
			continue;

		/* Don't bother computing anything for non-target tables, either */
		if (!tblinfo[i].dobj.dump)
			continue;

		/* Find all the immediate parent tables */
		findParentsByOid(&tblinfo[i], inhinfo, numInherits);

		/* Mark the parents as interesting for getTableAttrs */
		numParents = tblinfo[i].numParents;
		parents = tblinfo[i].parents;
		for (j = 0; j < numParents; j++)
			parents[j]->interesting = true;
	}
}

/* flagInhAttrs -
 *	 for each dumpable table in tblinfo, flag its inherited attributes
 *
 * What we need to do here is detect child columns that inherit NOT NULL
 * bits from their parents (so that we needn't specify that again for the
 * child) and child columns that have DEFAULT NULL when their parents had
 * some non-null default.  In the latter case, we make up a dummy AttrDefInfo
 * object so that we'll correctly emit the necessary DEFAULT NULL clause;
 * otherwise the backend will apply an inherited default to the column.
 *
 * modifies tblinfo
 */
static void
flagInhAttrs(TableInfo *tblinfo, int numTables,
			 InhInfo *inhinfo, int numInherits)
{
	int			i,
				j,
				k;

	for (i = 0; i < numTables; i++)
	{
		TableInfo  *tbinfo = &(tblinfo[i]);
		int			numParents;
		TableInfo **parents;

		/* Sequences, views and external tables never have parents */
		if (tbinfo->relkind == RELKIND_SEQUENCE ||
			tbinfo->relkind == RELKIND_VIEW ||
			tbinfo->relstorage == RELSTORAGE_EXTERNAL ||
			tbinfo->relstorage == RELSTORAGE_FOREIGN)
			continue;

		/* Don't bother computing anything for non-target tables, either */
		if (!tbinfo->dobj.dump)
			continue;

		numParents = tbinfo->numParents;
		parents = tbinfo->parents;

		if (numParents == 0)
			continue;			/* nothing to see here, move along */

		/* For each column, search for matching column names in parent(s) */
		for (j = 0; j < tbinfo->numatts; j++)
		{
			bool		foundNotNull;	/* Attr was NOT NULL in a parent */
			bool		foundDefault;	/* Found a default in a parent */

			/* no point in examining dropped columns */
			if (tbinfo->attisdropped[j])
				continue;

			foundNotNull = false;
			foundDefault = false;
			for (k = 0; k < numParents; k++)
			{
				TableInfo  *parent = parents[k];
				int			inhAttrInd;

				inhAttrInd = strInArray(tbinfo->attnames[j],
										parent->attnames,
										parent->numatts);
				if (inhAttrInd >= 0)
				{
					foundNotNull |= parent->notnull[inhAttrInd];
					foundDefault |= (parent->attrdefs[inhAttrInd] != NULL);
				}
			}

			/* Remember if we found inherited NOT NULL */
			tbinfo->inhNotNull[j] = foundNotNull;

			/* Manufacture a DEFAULT NULL clause if necessary */
			if (foundDefault && tbinfo->attrdefs[j] == NULL)
			{
				AttrDefInfo *attrDef;

				attrDef = (AttrDefInfo *) malloc(sizeof(AttrDefInfo));
				attrDef->dobj.objType = DO_ATTRDEF;
				attrDef->dobj.catId.tableoid = 0;
				attrDef->dobj.catId.oid = 0;
				AssignDumpId(&attrDef->dobj);
				attrDef->dobj.name = strdup(tbinfo->dobj.name);
				attrDef->dobj.namespace = tbinfo->dobj.namespace;
				attrDef->dobj.dump = tbinfo->dobj.dump;

				attrDef->adtable = tbinfo;
				attrDef->adnum = j + 1;
				attrDef->adef_expr = strdup("NULL");

				/* Will column be dumped explicitly? */
				if (shouldPrintColumn(tbinfo, j))
				{
					attrDef->separate = false;
					/* No dependency needed: NULL cannot have dependencies */
				}
				else
				{
					/* column will be suppressed, print default separately */
					attrDef->separate = true;
					/* ensure it comes out after the table */
					addObjectDependency(&attrDef->dobj,
										tbinfo->dobj.dumpId);
				}

				tbinfo->attrdefs[j] = attrDef;
			}
		}

		/*
		 * Check for inherited CHECK constraints.  We assume a constraint is
		 * inherited if its name matches the name of any constraint in the
		 * parent.	Originally this code tried to compare the expression
		 * texts, but that can fail if the parent and child tables are in
		 * different schemas, because reverse-listing of function calls may
		 * produce different text (schema-qualified or not) depending on
		 * search path.  We really need a more bulletproof way of detecting
		 * inherited constraints --- pg_constraint should record this
		 * explicitly!
		 */
		for (j = 0; j < tbinfo->ncheck; j++)
		{
			ConstraintInfo *constr;

			constr = &(tbinfo->checkexprs[j]);

			for (k = 0; k < numParents; k++)
			{
				TableInfo  *parent = parents[k];
				int			l;

				for (l = 0; l < parent->ncheck; l++)
				{
					ConstraintInfo *pconstr = &(parent->checkexprs[l]);

					if (strcmp(pconstr->dobj.name, constr->dobj.name) == 0)
					{
						constr->coninherited = true;
						break;
					}
				}
				if (constr->coninherited)
					break;
			}
		}
	}
}

/*
 * MPP-1890
 *
 * If the user explicitly DROP'ed a CHECK constraint on a child but it
 * still exists on the parent when they dump and restore that constraint
 * will exist on the child since it will again inherit it from the
 * parent. Therefore we look here for constraints that exist on the
 * parent but not on the child and mark them to be dropped from the
 * child after the child table is defined.
 *
 * Loop through each parent and for each parent constraint see if it
 * exists on the child as well. If it doesn't it means that the child
 * dropped it. Mark it.
 */
void
DetectChildConstraintDropped(TableInfo *tbinfo, PQExpBuffer q)
{
	TableInfo  *parent;
	TableInfo **parents = tbinfo->parents;
	int			j,
				k,
				l;
	int			numParents = tbinfo->numParents;

	for (k = 0; k < numParents; k++)
	{
		parent = parents[k];

		/* for each CHECK constraint of this parent */
		for (l = 0; l < parent->ncheck; l++)
		{
			ConstraintInfo *pconstr = &(parent->checkexprs[l]);
			ConstraintInfo *cconstr;
			bool		constr_on_child = false;

			/* for each child CHECK constraint */
			for (j = 0; j < tbinfo->ncheck; j++)
			{
				cconstr = &(tbinfo->checkexprs[j]);

				if (strcmp(pconstr->dobj.name, cconstr->dobj.name) == 0)
				{
					/* parent constr exists on child. hence wasn't dropped */
					constr_on_child = true;
					break;
				}

			}

			/* this parent constr is not on child, issue a DROP for it */
			if (!constr_on_child)
			{
				appendPQExpBuffer(q, "ALTER TABLE %s.",
								  fmtId(tbinfo->dobj.namespace->dobj.name));
				appendPQExpBuffer(q, "%s ",
								  fmtId(tbinfo->dobj.name));
				appendPQExpBuffer(q, "DROP CONSTRAINT %s;\n",
								  fmtId(pconstr->dobj.name));

				constr_on_child = false;
			}
		}
	}

}

/*
 * AssignDumpId
 *		Given a newly-created dumpable object, assign a dump ID,
 *		and enter the object into the lookup table.
 *
 * The caller is expected to have filled in objType and catId,
 * but not any of the other standard fields of a DumpableObject.
 */
void
AssignDumpId(DumpableObject *dobj)
{
	dobj->dumpId = ++lastDumpId;
	dobj->name = NULL;			/* must be set later */
	dobj->namespace = NULL;		/* may be set later */
	dobj->dump = true;			/* default assumption */
	dobj->dependencies = NULL;
	dobj->nDeps = 0;
	dobj->allocDeps = 0;

	while (dobj->dumpId >= allocedDumpIds)
	{
		int			newAlloc;

		if (allocedDumpIds <= 0)
		{
			newAlloc = 256;
			dumpIdMap = (DumpableObject **)
				pg_malloc(newAlloc * sizeof(DumpableObject *));
		}
		else
		{
			newAlloc = allocedDumpIds * 2;
			dumpIdMap = (DumpableObject **)
				pg_realloc(dumpIdMap, newAlloc * sizeof(DumpableObject *));
		}
		memset(dumpIdMap + allocedDumpIds, 0,
			   (newAlloc - allocedDumpIds) * sizeof(DumpableObject *));
		allocedDumpIds = newAlloc;
	}
	dumpIdMap[dobj->dumpId] = dobj;

	/* mark catalogIdMap invalid, but don't rebuild it yet */
	catalogIdMapValid = false;
}

/*
 * Assign a DumpId that's not tied to a DumpableObject.
 *
 * This is used when creating a "fixed" ArchiveEntry that doesn't need to
 * participate in the sorting logic.
 */
DumpId
createDumpId(void)
{
	return ++lastDumpId;
}

/*
 * Return the largest DumpId so far assigned
 */
DumpId
getMaxDumpId(void)
{
	return lastDumpId;
}

/*
 * Find a DumpableObject by dump ID
 *
 * Returns NULL for invalid ID
 */
DumpableObject *
findObjectByDumpId(DumpId dumpId)
{
	if (dumpId <= 0 || dumpId >= allocedDumpIds)
		return NULL;			/* out of range? */
	return dumpIdMap[dumpId];
}

/*
 * Find a DumpableObject by catalog ID
 *
 * Returns NULL for unknown ID
 *
 * We use binary search in a sorted list that is built on first call.
 * If AssignDumpId() and findObjectByCatalogId() calls were intermixed,
 * the code would work, but possibly be very slow.	In the current usage
 * pattern that does not happen, indeed we only need to build the list once.
 */
DumpableObject *
findObjectByCatalogId(CatalogId catalogId)
{
	DumpableObject **low;
	DumpableObject **high;

	if (!catalogIdMapValid)
	{
		if (catalogIdMap)
			free(catalogIdMap);
		getDumpableObjects(&catalogIdMap, &numCatalogIds);
		if (numCatalogIds > 1)
			qsort((void *) catalogIdMap, numCatalogIds,
				  sizeof(DumpableObject *), DOCatalogIdCompare);
		catalogIdMapValid = true;
	}

	/*
	 * We could use bsearch() here, but the notational cruft of calling
	 * bsearch is nearly as bad as doing it ourselves; and the generalized
	 * bsearch function is noticeably slower as well.
	 */
	if (numCatalogIds <= 0)
		return NULL;
	low = catalogIdMap;
	high = catalogIdMap + (numCatalogIds - 1);
	while (low <= high)
	{
		DumpableObject **middle;
		int			difference;

		middle = low + (high - low) / 2;
		/* comparison must match DOCatalogIdCompare, below */
		difference = oidcmp((*middle)->catId.oid, catalogId.oid);
		if (difference == 0)
			difference = oidcmp((*middle)->catId.tableoid, catalogId.tableoid);
		if (difference == 0)
			return *middle;
		else if (difference < 0)
			low = middle + 1;
		else
			high = middle - 1;
	}
	return NULL;
}

/*
 * Find a DumpableObject by OID, in a pre-sorted array of one type of object
 *
 * Returns NULL for unknown OID
 */
DumpableObject *
findObjectByOid(Oid oid, DumpableObject **indexArray, int numObjs)
{
	DumpableObject **low;
	DumpableObject **high;

	/*
	 * This is the same as findObjectByCatalogId except we assume we need not
	 * look at table OID because the objects are all the same type.
	 *
	 * We could use bsearch() here, but the notational cruft of calling
	 * bsearch is nearly as bad as doing it ourselves; and the generalized
	 * bsearch function is noticeably slower as well.
	 */
	if (numObjs <= 0)
		return NULL;
	low = indexArray;
	high = indexArray + (numObjs - 1);
	while (low <= high)
	{
		DumpableObject **middle;
		int			difference;

		middle = low + (high - low) / 2;
		difference = oidcmp((*middle)->catId.oid, oid);
		if (difference == 0)
			return *middle;
		else if (difference < 0)
			low = middle + 1;
		else
			high = middle - 1;
	}
	return NULL;
}

/*
 * Build an index array of DumpableObject pointers, sorted by OID
 */
DumpableObject **
buildIndexArray(void *objArray, int numObjs, Size objSize)
{
	DumpableObject **ptrs;
	int			i;

	ptrs = (DumpableObject **) malloc(numObjs * sizeof(DumpableObject *));
	for (i = 0; i < numObjs; i++)
		ptrs[i] = (DumpableObject *) ((char *) objArray + i * objSize);

	/* We can use DOCatalogIdCompare to sort since its first key is OID */
	if (numObjs > 1)
		qsort((void *) ptrs, numObjs, sizeof(DumpableObject *),
			  DOCatalogIdCompare);

	return ptrs;
}

/*
 * qsort comparator for pointers to DumpableObjects
 */
static int
DOCatalogIdCompare(const void *p1, const void *p2)
{
	DumpableObject *obj1 = *(DumpableObject **) p1;
	DumpableObject *obj2 = *(DumpableObject **) p2;
	int			cmpval;

	/*
	 * Compare OID first since it's usually unique, whereas there will only be
	 * a few distinct values of tableoid.
	 */
	cmpval = oidcmp(obj1->catId.oid, obj2->catId.oid);
	if (cmpval == 0)
		cmpval = oidcmp(obj1->catId.tableoid, obj2->catId.tableoid);
	return cmpval;
}

/*
 * Build an array of pointers to all known dumpable objects
 *
 * This simply creates a modifiable copy of the internal map.
 */
void
getDumpableObjects(DumpableObject ***objs, int *numObjs)
{
	int			i,
				j;

	*objs = (DumpableObject **)
		pg_malloc(allocedDumpIds * sizeof(DumpableObject *));
	j = 0;
	for (i = 1; i < allocedDumpIds; i++)
	{
		if (dumpIdMap[i])
			(*objs)[j++] = dumpIdMap[i];
	}
	*numObjs = j;
}

/*
 * Add a dependency link to a DumpableObject
 *
 * Note: duplicate dependencies are currently not eliminated
 */
void
addObjectDependency(DumpableObject *dobj, DumpId refId)
{
	if (dobj->nDeps >= dobj->allocDeps)
	{
		if (dobj->allocDeps <= 0)
		{
			dobj->allocDeps = 16;
			dobj->dependencies = (DumpId *)
				pg_malloc(dobj->allocDeps * sizeof(DumpId));
		}
		else
		{
			dobj->allocDeps *= 2;
			dobj->dependencies = (DumpId *)
				pg_realloc(dobj->dependencies,
						   dobj->allocDeps * sizeof(DumpId));
		}
	}
	dobj->dependencies[dobj->nDeps++] = refId;
}

/*
 * Remove a dependency link from a DumpableObject
 *
 * If there are multiple links, all are removed
 */
void
removeObjectDependency(DumpableObject *dobj, DumpId refId)
{
	int			i;
	int			j = 0;

	for (i = 0; i < dobj->nDeps; i++)
	{
		if (dobj->dependencies[i] != refId)
			dobj->dependencies[j++] = dobj->dependencies[i];
	}
	dobj->nDeps = j;
}

/*
 * findTableByOid
 *	  finds the entry (in tblinfo) of the table with the given oid
 *	  returns NULL if not found
 */
TableInfo *
findTableByOid(Oid oid)
{
	return (TableInfo *) findObjectByOid(oid, tblinfoindex, numTables);
}

/*
 * findTypeByOid
 *	  finds the entry (in typinfo) of the type with the given oid
 *	  returns NULL if not found
 */
TypeInfo *
findTypeByOid(Oid oid)
{
	return (TypeInfo *) findObjectByOid(oid, typinfoindex, numTypes);
}

/*
 * findFuncByOid
 *	  finds the entry (in funinfo) of the function with the given oid
 *	  returns NULL if not found
 */
FuncInfo *
findFuncByOid(Oid oid)
{
	return (FuncInfo *) findObjectByOid(oid, funinfoindex, numFuncs);
}

/*
 * findOprByOid
 *	  finds the entry (in oprinfo) of the operator with the given oid
 *	  returns NULL if not found
 */
OprInfo *
findOprByOid(Oid oid)
{
	return (OprInfo *) findObjectByOid(oid, oprinfoindex, numOperators);
}

/*
 * findNamespaceByOid
 *	  finds the entry (in nspinfo) of the namespace with the given oid
 *	  returns NULL if not found
 */
NamespaceInfo *
findNamespaceByOid(Oid oid)
{
	return (NamespaceInfo *) findObjectByOid(oid, nspinfoindex, numNamespaces);
}

/*
 * findExtensionByOid
 *	  finds the entry (in extinfo) of the extension with the given oid
 *	  returns NULL if not found
 */
ExtensionInfo *
findExtensionByOid(Oid oid)
{
	return (ExtensionInfo *) findObjectByOid(oid, extinfoindex, numExtensions);
}

/*
 * setExtensionMembership
 *	  accept and save data about which objects belong to extensions
 */
void
setExtensionMembership(ExtensionMemberId *extmems, int nextmems)
{
	/* Sort array in preparation for binary searches */
	if (nextmems > 1)
		qsort((void *) extmems, nextmems, sizeof(ExtensionMemberId),
			  ExtensionMemberIdCompare);
	/* And save */
	extmembers = extmems;
	numextmembers = nextmems;
}

/*
 * findOwningExtension
 *	  return owning extension for specified catalog ID, or NULL if none
 */
ExtensionInfo *
findOwningExtension(CatalogId catalogId)
{
	ExtensionMemberId *low;
	ExtensionMemberId *high;

	/*
	 * We could use bsearch() here, but the notational cruft of calling
	 * bsearch is nearly as bad as doing it ourselves; and the generalized
	 * bsearch function is noticeably slower as well.
	 */
	if (numextmembers <= 0)
		return NULL;
	low = extmembers;
	high = extmembers + (numextmembers - 1);
	while (low <= high)
	{
		ExtensionMemberId *middle;
		int			difference;

		middle = low + (high - low) / 2;
		/* comparison must match ExtensionMemberIdCompare, below */
		difference = oidcmp(middle->catId.oid, catalogId.oid);
		if (difference == 0)
			difference = oidcmp(middle->catId.tableoid, catalogId.tableoid);
		if (difference == 0)
			return middle->ext;
		else if (difference < 0)
			low = middle + 1;
		else
			high = middle - 1;
	}
	return NULL;
}

/*
 * qsort comparator for ExtensionMemberIds
 */
static int
ExtensionMemberIdCompare(const void *p1, const void *p2)
{
	const ExtensionMemberId *obj1 = (const ExtensionMemberId *) p1;
	const ExtensionMemberId *obj2 = (const ExtensionMemberId *) p2;
	int			cmpval;

	/*
	 * Compare OID first since it's usually unique, whereas there will only be
	 * a few distinct values of tableoid.
	 */
	cmpval = oidcmp(obj1->catId.oid, obj2->catId.oid);
	if (cmpval == 0)
		cmpval = oidcmp(obj1->catId.tableoid, obj2->catId.tableoid);
	return cmpval;
}

/*
 * findParentsByOid
 *	  find a table's parents in tblinfo[]
 */
static void
findParentsByOid(TableInfo *self,
				 InhInfo *inhinfo, int numInherits)
{
	Oid			oid = self->dobj.catId.oid;
	int			i,
				j;
	int			numParents;

	numParents = 0;
	for (i = 0; i < numInherits; i++)
	{
		if (inhinfo[i].inhrelid == oid)
			numParents++;
	}

	self->numParents = numParents;

	if (numParents > 0)
	{
		self->parents = (TableInfo **)
			pg_malloc(sizeof(TableInfo *) * numParents);
		j = 0;
		for (i = 0; i < numInherits; i++)
		{
			if (inhinfo[i].inhrelid == oid)
			{
				TableInfo  *parent;

				parent = findTableByOid(inhinfo[i].inhparent);
				if (parent == NULL)
				{
					write_msg(NULL, "failed sanity check, parent OID %u of table \"%s\" (OID %u) not found\n",
							  inhinfo[i].inhparent,
							  self->dobj.name,
							  oid);
					exit_nicely();
				}
				self->parents[j++] = parent;
			}
		}
	}
	else
		self->parents = NULL;
}

/*
 * parseOidArray
 *	  parse a string of numbers delimited by spaces into a character array
 *
 * Note: actually this is used for both Oids and potentially-signed
 * attribute numbers.  This should cause no trouble, but we could split
 * the function into two functions with different argument types if it does.
 */

void
parseOidArray(const char *str, Oid *array, int arraysize)
{
	int			j,
				argNum;
	char		temp[100];
	char		s;

	argNum = 0;
	j = 0;
	for (;;)
	{
		s = *str++;
		if (s == ' ' || s == '\0')
		{
			if (j > 0)
			{
				if (argNum >= arraysize)
				{
					write_msg(NULL, "could not parse numeric array \"%s\": too many numbers\n", str);
					exit_nicely();
				}
				temp[j] = '\0';
				array[argNum++] = atooid(temp);
				j = 0;
			}
			if (s == '\0')
				break;
		}
		else
		{
			if (!(isdigit((unsigned char) s) || s == '-') ||
				j >= sizeof(temp) - 1)
			{
				write_msg(NULL, "could not parse numeric array \"%s\": invalid character in number\n", str);
				exit_nicely();
			}
			temp[j++] = s;
		}
	}

	while (argNum < arraysize)
		array[argNum++] = InvalidOid;
}

/*
 * strInArray:
 *	  takes in a string and a string array and the number of elements in the
 * string array.
 *	  returns the index if the string is somewhere in the array, -1 otherwise
 */

static int
strInArray(const char *pattern, char **arr, int arr_size)
{
	int			i;

	for (i = 0; i < arr_size; i++)
	{
		if (strcmp(pattern, arr[i]) == 0)
			return i;
	}
	return -1;
}

/* cdb addition */
void
reset(void)
{
	free(dumpIdMap);
	dumpIdMap = NULL;
	allocedDumpIds = 0;
	lastDumpId = 0;

/*
 * Variables for mapping CatalogId to DumpableObject
 */
	catalogIdMapValid = false;
	free(catalogIdMap);
	catalogIdMap = NULL;
	numCatalogIds = 0;

	numTables = 0;
	numTypes = 0;
	numFuncs = 0;
	numOperators = 0;
}

/* end cdb_addition */

/*
 * Support for simple list operations
 */

void
simple_oid_list_append(SimpleOidList *list, Oid val)
{
	SimpleOidListCell *cell;

	cell = (SimpleOidListCell *) pg_malloc(sizeof(SimpleOidListCell));
	cell->next = NULL;
	cell->val = val;

	if (list->tail)
		list->tail->next = cell;
	else
		list->head = cell;
	list->tail = cell;
}

void
simple_string_list_append(SimpleStringList *list, const char *val)
{
	SimpleStringListCell *cell;

	/* this calculation correctly accounts for the null trailing byte */
	cell = (SimpleStringListCell *)
		pg_malloc(sizeof(SimpleStringListCell) + strlen(val));
	cell->next = NULL;
	strcpy(cell->val, val);

	if (list->tail)
		list->tail->next = cell;
	else
		list->head = cell;
	list->tail = cell;
}

bool
simple_oid_list_member(SimpleOidList *list, Oid val)
{
	SimpleOidListCell *cell;

	for (cell = list->head; cell; cell = cell->next)
	{
		if (cell->val == val)
			return true;
	}
	return false;
}

bool
simple_string_list_member(SimpleStringList *list, const char *val)
{
	SimpleStringListCell *cell;

	for (cell = list->head; cell; cell = cell->next)
	{
		if (strcmp(cell->val, val) == 0)
			return true;
	}
	return false;
}

/*
 * openFileAndAppendToList: Read parameters from file
 * and append values to given list.
 * (Used to read multiple include/exclude tables.)
 *
 * reason - list name, to be logged.
 *
 * File format: one value per line.
 */
bool
open_file_and_append_to_list(const char *fileName, SimpleStringList *list, const char *reason)
{

	char buf[1024];

	write_msg(NULL, "Opening file %s for %s\n", fileName, reason);

	FILE* file = fopen(fileName, "r");

	if (file == NULL)
		return false;

	int lineNum = 0;
	while (fgets(buf, sizeof(buf), file) != NULL)
	{
		int size = strlen(buf);
		if (buf[size-1] == '\n')
			buf[size-1] = '\0'; /* remove new line */

		write_msg(NULL, "Line #%d, value: %s\n", ++lineNum, buf);
		simple_string_list_append(list, buf);
	}
	write_msg(NULL, "Got %d lines from file %s\n", lineNum, fileName);
	if (fclose(file) != 0)
		return false;

	write_msg(NULL, "Finished reading file %s successfully\n", fileName);

	return true;

}

/*
 * Safer versions of some standard C library functions. If an
 * out-of-memory condition occurs, these functions will bail out
 * safely; therefore, their return value is guaranteed to be non-NULL.
 *
 * XXX need to refactor things so that these can be in a file that can be
 * shared by pg_dumpall and pg_restore as well as pg_dump.
 */

char *
pg_strdup(const char *string)
{
	char	   *tmp;

	if (!string)
		exit_horribly(NULL, NULL, "cannot duplicate null pointer\n");
	tmp = strdup(string);
	if (!tmp)
		exit_horribly(NULL, NULL, "out of memory\n");
	return tmp;
}

void *
pg_malloc(size_t size)
{
	void	   *tmp;

	tmp = malloc(size);
	if (!tmp)
		exit_horribly(NULL, NULL, "out of memory\n");
	return tmp;
}

void *
pg_calloc(size_t nmemb, size_t size)
{
	void	   *tmp;

	tmp = calloc(nmemb, size);
	if (!tmp)
		exit_horribly(NULL, NULL, "out of memory\n");
	return tmp;
}

void *
pg_realloc(void *ptr, size_t size)
{
	void	   *tmp;

	tmp = realloc(ptr, size);
	if (!tmp)
		exit_horribly(NULL, NULL, "out of memory\n");
	return tmp;
}

void
status_log_msg(const char *loglevel, const char *prog, const char *fmt,...)
{
    va_list     ap;
    char        szTimeNow[18];
    struct tm   pNow;
    time_t      tNow = time(NULL);
    char       *format = "%Y%m%d:%H:%M:%S";

    localtime_r(&tNow, &pNow);
    strftime(szTimeNow, 18, format, &pNow);

    va_start(ap, fmt);
    fprintf(stderr, "%s|%s-[%s]:-", szTimeNow, prog, loglevel);
    vfprintf(stderr, gettext(fmt), ap);
    va_end(ap);
}


text:
package fr.paris.lutece.portal.web.includes;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import fr.paris.lutece.portal.service.plugin.PluginDefaultImplementation;

public final class LinksIncludeTestPlugin extends PluginDefaultImplementation
{

    private Map<Integer, List<String>> _listCssStyleSheets = new HashMap<>( );
    private Map<Integer, List<String>> _listJavascriptFiles = new HashMap<>( );
    private boolean _cssStyleSheetsScopePortal;
    private boolean _cssStylesheetsScopeXPage;
    private boolean _javascriptFilesScopePortal;
    private boolean _javascriptFilesScopeXPage;

    @Override
    public List<String> getCssStyleSheets( )
    {
        List<String> res = _listCssStyleSheets.get( null );

        if ( res == null )
        {
            return Collections.emptyList( );
        }

        return res;
    }

    @Override
    public List<String> getCssStyleSheets( int mode )
    {
        List<String> res = _listCssStyleSheets.get( mode );

        if ( res == null )
        {
            return Collections.emptyList( );
        }

        return res;
    }

    @Override
    public List<String> getJavascriptFiles( )
    {
        List<String> res = _listJavascriptFiles.get( null );

        if ( res == null )
        {
            return Collections.emptyList( );
        }

        return res;
    }

    @Override
    public List<String> getJavascriptFiles( int mode )
    {
        List<String> res = _listJavascriptFiles.get( mode );

        if ( res == null )
        {
            return Collections.emptyList( );
        }

        return res;
    }

    public void setCssStyleSheetsScopePortal( boolean bScope )
    {
        _cssStyleSheetsScopePortal = bScope;
    }

    @Override
    public boolean isCssStylesheetsScopePortal( )
    {
        return _cssStyleSheetsScopePortal;
    }

    public void setCssStylesheetsScopeXPage( boolean bScope )
    {
        _cssStylesheetsScopeXPage = bScope;
    }

    @Override
    public boolean isCssStylesheetsScopeXPage( )
    {
        return _cssStylesheetsScopeXPage;
    }

    public void setJavascriptFilesScopePortal( boolean bScope )
    {
        _javascriptFilesScopePortal = bScope;
    }

    @Override
    public boolean isJavascriptFilesScopePortal( )
    {
        return _javascriptFilesScopePortal;
    }

    public void setJavascriptFilesScopeXPage( boolean bScope )
    {
        _javascriptFilesScopeXPage = bScope;
    }

    @Override
    public boolean isJavascriptFilesScopeXPage( )
    {
        return _javascriptFilesScopeXPage;
    }

    public void setCssStyleSheets( int mode, List<String> styleSheets )
    {
        _listCssStyleSheets.put( mode, styleSheets );
    }

    public void setCssStyleSheets( List<String> styleSheets )
    {
        _listCssStyleSheets.put( null, styleSheets );
    }

    public void setJavascriptFiles( int mode, List<String> javascriptFiles )
    {
        _listJavascriptFiles.put( mode, javascriptFiles );
    }

    public void setJavascriptFiles( List<String> javascriptFiles )
    {
        _listJavascriptFiles.put( null, javascriptFiles );
    }

}


text:
imanager_build_loc=node['imanager']['imanager_build_loc']
imanager_nmps_build_loc=node['imanager']['imanager_nmps_build_loc']
imanager_webapps=node['imanager']['imanager_webapps']
imanager_work_catalina=node['imanager']['imanager_work_catalina']
imanager_iman_npm=node['imanager']['imanager_iman_npm']
imanager_idm_npm=node['imanager']['imanager_idm_npm']
imanager_edir_npm=node['imanager']['imanager_edir_npm']
imanager_pwd_npm=node['imanager']['imanager_pwd_npm']
imanager_nmas_npm=node['imanager']['imanager_nmas_npm']
jre_loc=node['imanager']['jre_loc']

template "/tmp/iManager_install.properties" do
  source "iManager_install.properties.erb"
  owner "root"
  mode "0644"
end

execute "Install iManager" do
 user "root"
 cwd "/tmp"
 command " \"#{imanager_build_loc}\" -DIA_USER_JRE_HOME=\"#{jre_loc}\" -i silent -f \"/tmp/iManager_install.properties\"; > /var/opt/novell/log/imanager_install.log "
 creates "/var/opt/novell/log/imanager_install.log"
 action :run
end

execute "Install iManager Base plugin" do
 user "root"
 cwd "/tmp"
 command " \"#{jre_loc}/bin/java\" -jar \"#{imanager_nmps_build_loc}\" install #{imanager_webapps} #{imanager_work_catalina} \"#{imanager_iman_npm}\" > /var/opt/novell/log/imanager_base_plugin.log;"
 creates "/var/opt/novell/log/imanager_base_plugin.log"
 action :run
end

execute "Install iManager eDir plugin" do
 user "root"
 cwd "/tmp"
 command " \"#{jre_loc}/bin/java\" -jar \"#{imanager_nmps_build_loc}\" install #{imanager_webapps} #{imanager_work_catalina} \"#{imanager_edir_npm}\" > /var/opt/novell/log/imanager_edir_plugin.log;"
 creates "/var/opt/novell/log/imanager_edir_plugin.log"
 action :run
end

execute "Install iManager Pwd Mgmt plugin" do
 user "root"
 cwd "/tmp"
 command " \"#{jre_loc}/bin/java\" -jar \"#{imanager_nmps_build_loc}\" install #{imanager_webapps} #{imanager_work_catalina} \"#{imanager_pwd_npm}\" > /var/opt/novell/log/imanager_pwd_plugin.log;"
 creates "/var/opt/novell/log/imanager_pwd_plugin.log"
 action :run
end

execute "Install iManager NMAS plugin" do
 user "root"
 cwd "/tmp"
 command " \"#{jre_loc}/bin/java\" -jar \"#{imanager_nmps_build_loc}\" install #{imanager_webapps} #{imanager_work_catalina} \"#{imanager_nmas_npm}\" > /var/opt/novell/log/imanager_nmas_plugin.log ;"
 creates "/var/opt/novell/log/imanager_nmas_plugin.log"
  not_if { ::File.exists?("/var/opt/novell/log/imanager_nmas_plugin.log")}
 action :run
end

execute "Install IDM plugins" do
 user "root"
 cwd "/tmp"
 command " \"#{jre_loc}/bin/java\" -jar \"#{imanager_nmps_build_loc}\" install #{imanager_webapps} #{imanager_work_catalina} \"#{imanager_idm_npm}\" > /var/opt/novell/log/imanager_idm_plugin.log;"
 creates "/var/opt/novell/log/imanager_idm_plugin.log"
  not_if { ::File.exists?("/var/opt/novell/log/imanager_idm_plugin.log")}
 action :run
end


text:
namespace NorthwindWindowsStore.DAL
{
    using NorthwindWindowsStore.DAL.Model;

    public class EmployeeRepository : BaseRepository<Employee>
    {
        public EmployeeRepository(string path)
            : base(path)
        {
        }
    }
}


text:
module Azure::ARM::DevTestLabs
  module Models
    #
    # Defines values for SubscriptionNotificationState
    #
    module SubscriptionNotificationState
      NotDefined = "NotDefined"
      Registered = "Registered"
      Unregistered = "Unregistered"
      Warned = "Warned"
      Suspended = "Suspended"
      Deleted = "Deleted"
    end
  end
end


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

namespace DevAudit.CommandLine
{
    //Modified from http://stackoverflow.com/a/33685254
    public class Spinner : IDisposable
    {
        //private const string Sequence = @"/-\|";
        #region Private fields
        private const string sequence = @"|/-\|/-\";
        private int counter = 0;
        private readonly int left;
        private readonly int top;
        private readonly int delay;
        private bool active;
        private readonly Thread thread;
        #endregion

        #region Public fields
        public readonly EventWaitHandle wh = new AutoResetEvent(true);
        #endregion

        public Spinner(int left, int top, int delay = 100)
        {
            this.left = left;
            this.top = top;
            this.delay = delay;
            thread = new Thread(Spin);
        }

        public Spinner(int delay = 100)
        {
            this.delay = delay;
            thread = new Thread(Spin);
        }

        public void Start()
        {
            active = true;
            if (!thread.IsAlive)
            {
                thread.Start();
            }
        }

        public void Pause(bool break_line = true)
        {
            Draw(' ');
            if (Console.CursorLeft > 0 && break_line)
            {
                Draw('\n');
            }
            wh.Reset();
        }

        public void UnPause()
        {
            wh.Set();
        }

        public void Stop()
        {
            active = false;
            Draw(' ');
            if (Console.CursorLeft > 0)
            {
                Draw('\n');
            }
        }

        private void Spin()
        {
            wh.WaitOne();
            while (active)
            {
                Turn();
                Thread.Sleep(delay);
            }
            wh.Dispose(); //Dispose of the wait handle right before the thread exits.
        }

        private void Draw(char c)
        {
            Console.Write(c);
            try
            {
                Console.SetCursorPosition(Console.CursorLeft > 0 ? Console.CursorLeft - 1 : 0, Console.CursorTop);
            }
            catch (ArgumentOutOfRangeException)
            {
                return;
            }
        }

        private void Turn()
        {

            Draw(sequence[++counter % sequence.Length]);
        }

        public void Dispose()
        {
            if (active)
            {
                Stop();
            }
        }
    }
}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace eidss.ram.web {

    public partial class Map {

        /// <summary>
        /// cbControl control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::DevExpress.Web.ASPxCallback.ASPxCallback cbControl;

        /// <summary>
        /// MapHiddenField control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.HiddenField MapHiddenField;

        /// <summary>
        /// PivotGridPageIndex control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.HiddenField PivotGridPageIndex;

        /// <summary>
        /// MainPanel control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Panel MainPanel;

        /// <summary>
        /// buttonSaveAs control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::DevExpress.Web.ASPxEditors.ASPxButton buttonSaveAs;

        /// <summary>
        /// buttonOpen control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::DevExpress.Web.ASPxEditors.ASPxButton buttonOpen;

        /// <summary>
        /// shp_export control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::DevExpress.Web.ASPxEditors.ASPxButton shp_export;

        /// <summary>
        /// CaptionTextBox control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::DevExpress.Web.ASPxEditors.ASPxTextBox CaptionTextBox;

        /// <summary>
        /// FilterCaption control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::DevExpress.Web.ASPxEditors.ASPxTextBox FilterCaption;

        /// <summary>
        /// AdministrativeUnit control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::DevExpress.Web.ASPxEditors.ASPxComboBox AdministrativeUnit;

        /// <summary>
        /// DataField control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::DevExpress.Web.ASPxEditors.ASPxComboBox DataField;

        /// <summary>
        /// buttonApply control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::DevExpress.Web.ASPxEditors.ASPxButton buttonApply;

        /// <summary>
        /// PivotGrid control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::eidss.ram.web.Components.WebPivotGrid PivotGrid;
    }
}


text:
'use strict';

/* set .env / logger
..................................... */
require('dotenv').load();

var params = require('./_params');
var vhx = require('../lib/vhx')(process.env.TEST_API_KEY, true);

// Require test suite dependencies
var chai = require('chai');
var expect = chai.expect;

describe('Watching', function() {

  describe('List all videos', function() {
    it('it should GET all videos being watched', function(done) {
      vhx.watching.items(params.customer(), { 'VHX-X-Header': 'foo' }, function(err, videos) {
        expect(videos).to.be.a('object');
        expect(videos).to.be.property('_links');
        expect(videos).to.be.property('_embedded');
        expect(videos).to.be.property('count');
        expect(videos._embedded).to.be.property('items');
        done();
      });
    });
  });

});