text:
<?php

/**
 * photoAdmin admin form
 *
 * @package    opp-saint-brieuc
 * @subpackage photoAdmin
 * @author     Your name here
 */
class PhotoAdminForm extends BasePhotoForm
{
  protected
  $elements,
  $interets;

  public function configure()
  {
    parent::configure();

    $this->validatorSchema['focale']->setOption('min', 1);
    $this->validatorSchema['focale']->setOption('max', 100);

    $this->validatorSchema['hauteur']->setOption('min', 1);
    $this->validatorSchema['hauteur']->setOption('max', 1000);

    $this->validatorSchema['orientation']->setOption('min', 0);
    $this->validatorSchema['orientation']->setOption('max', 359);

    $this->validatorSchema['inclinaison']->setOption('min', -90);
    $this->validatorSchema['inclinaison']->setOption('max', +90);

    $this->validatorSchema['latitude']->setOption('min', -180);
    $this->validatorSchema['latitude']->setOption('max', +180);

    $this->validatorSchema['longitude']->setOption('min', -180);
    $this->validatorSchema['longitude']->setOption('max', +180);

    $this->validatorSchema['position_precision']->setOption('min', 0);
    $this->validatorSchema['position_precision']->setOption('max', 10000);

    $this->widgetSchema['site_id']->setOption('order_by', array('nom', 'ASC'));

    foreach($this->getElements() as $elementSlug => $element)
    {
      $this->embedForm('interet_'.$elementSlug, $this->getInteretFormForElement($element));
    }
  }

  protected function createMediaFormForEmplacementId()
  {
    $form = parent::createMediaFormForEmplacementId();

    unset($form['author'], $form['license']);

    $form->setMimeTypeWhiteList(array(
      'image/jpeg',
      'image/png'
    ));

    return $form;
  }

  protected function createMediaFormForImageId()
  {
    $form = parent::createMediaFormForImageId();

    unset($form['legend']);

    $form->setMimeTypeWhiteList(array(
      'image/jpeg',
      'image/png'
    ));

    return $form;
  }

  public function bind(array $taintedValues = null, array $taintedFiles = null)
  {
    $return = parent::bind($taintedValues, $taintedFiles);

    foreach($this->getValues() as $key => $value)
    {
      if (strncmp($key, 'interet_', 8) === 0)
      {
        if (!$value['valeur'])
        {
          if ($value['id'])
          {
            Doctrine_Query::create()
            ->delete('Interet t')
            ->where('t.id = ?', $value['id'])
            ->execute();
          }

          unset($taintedValues[$key]);
          unset($this[$key]);
        }
      }
    }

    return $return;
  }

  public function saveEmbeddedForms($con = null, $forms = null)
  {
    if (is_null($forms))
    {
      $forms = $this->embeddedForms;
    }

    foreach ($forms as $formKey => $form)
    {
      if ($form instanceof simpleInteretForm)
      {
        if (!$form->getObject()->get('photo_id'))
        {
          $form->getObject()->set('photo_id', $this->object->get('id'));
        }
      }
    }

    return parent::saveEmbeddedForms($con, $forms);
  }

  public function getElements()
  {
    if (null === $this->elements)
    {
      $this->elements = dmDb::query('Element e INDEXBY e.slug')
      ->leftJoin('e.Categs c')
      ->orderBy('e.nom ASC')
      ->fetchRecords();
    }

    return $this->elements;
  }

  protected function getInteretByElementSlug($elementSlug)
  {
    if (is_null($this->interets))
    {
      if ($this->getObject()->exists())
      {
        $this->interets = dmDb::query('Interet t, t.Element e INDEXBY e.slug')
        ->select('t.*, e.slug, e.slug as element_slug')
        ->where('t.photo_id = ?', $this->getObject()->get('id'))
        ->fetchRecords();
      }
      else
      {
        $this->interets = array();
      }
    }

    foreach($this->interets as $interet)
    {
      if ($interet->get('element_slug') === $elementSlug)
      {
        return $interet;
      }
    }

    return null;
  }

  protected function getInteretFormForElement(Element $element)
  {
    if (!$interet = $this->getInteretByElementSlug($element->get('slug')))
    {
      $interet = new Interet();

      if($this->getObject()->exists())
      {
        $interet->set('Photo', $this->getObject());
      }

      $interet->set('Element', $element);
    }

    return new simpleInteretForm($interet);
  }
}


text:
<?php

namespace Cms\Orm\QueryHelper;

/**
 * @method \Cms\Orm\CmsAclQuery equals($value)
 * @method \Cms\Orm\CmsAclQuery notEquals($value)
 * @method \Cms\Orm\CmsAclQuery greater($value)
 * @method \Cms\Orm\CmsAclQuery less($value)
 * @method \Cms\Orm\CmsAclQuery greaterOrEquals($value)
 * @method \Cms\Orm\CmsAclQuery lessOrEquals($value)
 * @method \Cms\Orm\CmsAclQuery like($value)
 * @method \Cms\Orm\CmsAclQuery notLike($value)
 * @method \Cms\Orm\CmsAclQuery between($from, $to)
 * @method \Cms\Orm\CmsAclQuery equalsColumnId()
 * @method \Cms\Orm\CmsAclQuery notEqualsColumnId()
 * @method \Cms\Orm\CmsAclQuery greaterThanColumnId()
 * @method \Cms\Orm\CmsAclQuery lessThanColumnId()
 * @method \Cms\Orm\CmsAclQuery greaterOrEqualsColumnId()
 * @method \Cms\Orm\CmsAclQuery lessOrEqualsColumnId()
 * @method \Cms\Orm\CmsAclQuery equalsColumnCmsRoleId()
 * @method \Cms\Orm\CmsAclQuery notEqualsColumnCmsRoleId()
 * @method \Cms\Orm\CmsAclQuery greaterThanColumnCmsRoleId()
 * @method \Cms\Orm\CmsAclQuery lessThanColumnCmsRoleId()
 * @method \Cms\Orm\CmsAclQuery greaterOrEqualsColumnCmsRoleId()
 * @method \Cms\Orm\CmsAclQuery lessOrEqualsColumnCmsRoleId()
 * @method \Cms\Orm\CmsAclQuery equalsColumnModule()
 * @method \Cms\Orm\CmsAclQuery notEqualsColumnModule()
 * @method \Cms\Orm\CmsAclQuery greaterThanColumnModule()
 * @method \Cms\Orm\CmsAclQuery lessThanColumnModule()
 * @method \Cms\Orm\CmsAclQuery greaterOrEqualsColumnModule()
 * @method \Cms\Orm\CmsAclQuery lessOrEqualsColumnModule()
 * @method \Cms\Orm\CmsAclQuery equalsColumnController()
 * @method \Cms\Orm\CmsAclQuery notEqualsColumnController()
 * @method \Cms\Orm\CmsAclQuery greaterThanColumnController()
 * @method \Cms\Orm\CmsAclQuery lessThanColumnController()
 * @method \Cms\Orm\CmsAclQuery greaterOrEqualsColumnController()
 * @method \Cms\Orm\CmsAclQuery lessOrEqualsColumnController()
 * @method \Cms\Orm\CmsAclQuery equalsColumnAction()
 * @method \Cms\Orm\CmsAclQuery notEqualsColumnAction()
 * @method \Cms\Orm\CmsAclQuery greaterThanColumnAction()
 * @method \Cms\Orm\CmsAclQuery lessThanColumnAction()
 * @method \Cms\Orm\CmsAclQuery greaterOrEqualsColumnAction()
 * @method \Cms\Orm\CmsAclQuery lessOrEqualsColumnAction()
 * @method \Cms\Orm\CmsAclQuery equalsColumnAccess()
 * @method \Cms\Orm\CmsAclQuery notEqualsColumnAccess()
 * @method \Cms\Orm\CmsAclQuery greaterThanColumnAccess()
 * @method \Cms\Orm\CmsAclQuery lessThanColumnAccess()
 * @method \Cms\Orm\CmsAclQuery greaterOrEqualsColumnAccess()
 * @method \Cms\Orm\CmsAclQuery lessOrEqualsColumnAccess()
 */
class CmsAclQueryField extends \Mmi\Orm\QueryHelper\QueryField
{
}

redpajama_set_name: RedPajamaGithub


text:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"

var should = require('should'),
    request = require('supertest'),
    conf = require('./config.js')(),
    baseurl = '/smf/' + conf.zone + '/';

describe('wrong password', function() {

  it('should return a 403', function(done) {

    request(conf.url)
      .get(baseurl + 'svcs')
      .auth('manager', 'wrongpass')
      .expect('Content-Type', 'application/json')
      .expect({ code: "NotAuthorized", message: "Invalid credentials"})
      .expect(403, done)
    });

});

describe('missing credentials', function() {

  it('should return a 403', function(done) {

    request(conf.url)
      .get(baseurl + 'svcs')
      .expect('Content-Type', 'application/json')
      .expect({"code": "NotAuthorized", "message": "Invalid credentials"})
      .expect(403, done)

    });

});


text:
var Coordinator = require("../models/coordinator");
var debug=require("debug")("controllers/coordinator.js");
var utils = require("../utils");
exports.CoordinatorList = function (req, res, next) {
  Coordinator.find({}, function (err, listCoordinators) {
    if (err) {
      debug(err);
      return next(err);
    }
		// Successful, so render
    res.send(listCoordinators);
  });
};
exports.CoordinatorListForDeployment = function (req, res, next) {
  Coordinator.find({
    deployment: req.params.deployment
  }, function (err, listCoordinators) {
    if (err) {
      debug(err);
      return next(err);
    }
		// Successful, so render
    res.send(listCoordinators);
  });
};
exports.coordinatorDetail = function (req, res, next) {
  Coordinator.find({
    _id: req.params._id
  }, function (err, coordinator) {
    if (err) {
      debug(err);
      return next(err);
    }
		// Successful, so render
    res.send(coordinator);
  });
};
exports.coordinatorCreate = function (req, res, next) {
  req.checkBody("description", "Each coordinator needs a description").notEmpty();
  req.checkBody("deployment", "A coordinator needs to belong to a deployment").notEmpty();
  req.sanitize("description").escape();
  req.sanitize("description").trim();
  var errors = req.validationErrors();
  var coordinator = new Coordinator({
    description: req.body.description,
    added: req.body.added,
    deployment: {
      _id: req.body.deployment
    },
    active: req.body.active
  });
  utils.goSave(coordinator,res);
};
exports.coordinatorDelete = function (req, res) {
  Coordinator.findOneAndUpdate({
    _id: req.body.id
  }, {
    active: false
  }, {
    upsert: false
  }, function (err, doc) {
    if (err) {
      debug(err);
      return res.send(500, {
        error: err
      })
    }
    return res.send("Coordinator Deleted");
  });
};
exports.coordinatorUpdate = function (req, res) {
  Coordinator.findOneAndUpdate({
    _id: req.body.id
  }, {
    "deployment": req.body.deployment,
    "description": req.body.description,
    "active": req.body.active,
    "added": req.body.added,
    "device": req.body.device
  }, {
    upsert: false
  },
		function (err, doc) {
  if (err) {
    debug(err);
    return res.send(500, {
      error: err
    });
  }
  if (doc != null) {
    res.redirect(303, doc.url);
  } else {
    res.send(500, "coordinator not found");
  }
});
};


text:
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from apps.blog.models import *

class LoggedInMixin(object):

	@method_decorator(login_required)
	def dispatch(self, *args, **kwargs):
		return super(LoggedInMixin, self).dispatch(*args, **kwargs)

class Sidebar(object):

  def get_context_data(self,**kwargs):
    context = super(Sidebar, self).get_context_data(**kwargs)
    context['categories'] = Category.objects
    context['tags'] = Tag.objects
    return context

class SendRequest(object):

	def get_context_data(self,**kwargs):
		context = super(SendRequest, self).get_context_data(**kwargs)
		context['request'] = self.request
		return context


text:
#ifndef CPPDEVTK_BASE_STDEXCEPT_HPP_INCLUDED_
#define CPPDEVTK_BASE_STDEXCEPT_HPP_INCLUDED_

#include "config.hpp"
#include "exception.hpp"

#include <stdexcept>

namespace cppdevtk {
namespace base {

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \addtogroup std_exceptions
/// @{

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// LogicException

#define CPPDEVTK_LOGIC_EXCEPTION(whatArg)	\
	::cppdevtk::base::LogicException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_LOGIC_EXCEPTION_W_CAUSE(whatArg, cause)	\
	::cppdevtk::base::LogicException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

#define CPPDEVTK_MAKE_LOGIC_EXCEPTION(excName, whatArg)	\
	::cppdevtk::base::LogicException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_MAKE_LOGIC_EXCEPTION_W_CAUSE(excName, whatArg, cause)	\
	::cppdevtk::base::LogicException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \sa C++ 03, 19.1.1 Class logic_error
class CPPDEVTK_BASE_API LogicException: public virtual Exception {
public:
	LogicException(const SourceCodeInfo& throwPoint, const QString& whatArg);
	LogicException(const SourceCodeInfo& throwPoint, const QString& whatArg, const Exception& cause);
	LogicException(const LogicException& other) CPPDEVTK_NOEXCEPT;

	virtual ~LogicException() CPPDEVTK_NOEXCEPT;

	LogicException& operator=(const LogicException& other) CPPDEVTK_NOEXCEPT;

	::std::auto_ptr<LogicException> Clone() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual QtException* clone() const;
#	else
	virtual LogicException* clone() const;
#	endif

	void Swap(LogicException& other) CPPDEVTK_NOEXCEPT;
protected:
	virtual void DoThrow() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual Cloneable* DoClone() const;
#	else
	virtual LogicException* DoClone() const;
#	endif

	virtual QString DoOwnWhat() const;

	void SwapOwnData(LogicException& other) CPPDEVTK_NOEXCEPT;

	QString whatArg_;
};

CPPDEVTK_BASE_API void swap(LogicException& x, LogicException& y) CPPDEVTK_NOEXCEPT;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// DomainException

#define CPPDEVTK_DOMAIN_EXCEPTION(whatArg)	\
	::cppdevtk::base::DomainException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_DOMAIN_EXCEPTION_W_CAUSE(whatArg, cause)	\
	::cppdevtk::base::DomainException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

#define CPPDEVTK_MAKE_DOMAIN_EXCEPTION(excName, whatArg)	\
	::cppdevtk::base::DomainException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_MAKE_DOMAIN_EXCEPTION_W_CAUSE(excName, whatArg, cause)	\
	::cppdevtk::base::DomainException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \sa C++ 03, 19.1.2 Class domain_error
class CPPDEVTK_BASE_API DomainException: public virtual LogicException {
public:
	DomainException(const SourceCodeInfo& throwPoint, const QString& whatArg);
	DomainException(const SourceCodeInfo& throwPoint, const QString& whatArg, const Exception& cause);

	virtual ~DomainException() CPPDEVTK_NOEXCEPT;

	::std::auto_ptr<DomainException> Clone() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual QtException* clone() const;
#	else
	virtual DomainException* clone() const;
#	endif

	void Swap(DomainException& other) CPPDEVTK_NOEXCEPT;
protected:
	virtual void DoThrow() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual Cloneable* DoClone() const;
#	else
	virtual DomainException* DoClone() const;
#	endif

	void SwapOwnData(DomainException& other) CPPDEVTK_NOEXCEPT;
};

CPPDEVTK_BASE_API void swap(DomainException& x, DomainException& y) CPPDEVTK_NOEXCEPT;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// InvalidArgumentException

#define CPPDEVTK_INVALID_ARGUMENT_EXCEPTION(whatArg)	\
	::cppdevtk::base::InvalidArgumentException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_INVALID_ARGUMENT_EXCEPTION_W_CAUSE(whatArg, cause)	\
	::cppdevtk::base::InvalidArgumentException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

#define CPPDEVTK_MAKE_INVALID_ARGUMENT_EXCEPTION(excName, whatArg)	\
	::cppdevtk::base::InvalidArgumentException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_MAKE_INVALID_ARGUMENT_EXCEPTION_W_CAUSE(excName, whatArg, cause)	\
	::cppdevtk::base::InvalidArgumentException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \sa C++ 03, 19.1.3 Class invalid_argument
class CPPDEVTK_BASE_API InvalidArgumentException: public virtual LogicException {
public:
	InvalidArgumentException(const SourceCodeInfo& throwPoint, const QString& whatArg);
	InvalidArgumentException(const SourceCodeInfo& throwPoint, const QString& whatArg, const Exception& cause);

	virtual ~InvalidArgumentException() CPPDEVTK_NOEXCEPT;

	::std::auto_ptr<InvalidArgumentException> Clone() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual QtException* clone() const;
#	else
	virtual InvalidArgumentException* clone() const;
#	endif

	void Swap(InvalidArgumentException& other) CPPDEVTK_NOEXCEPT;
protected:
	virtual void DoThrow() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual Cloneable* DoClone() const;
#	else
	virtual InvalidArgumentException* DoClone() const;
#	endif

	void SwapOwnData(InvalidArgumentException& other) CPPDEVTK_NOEXCEPT;
};

CPPDEVTK_BASE_API void swap(InvalidArgumentException& x, InvalidArgumentException& y) CPPDEVTK_NOEXCEPT;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// LengthException

#define CPPDEVTK_LENGTH_EXCEPTION(whatArg)	\
	::cppdevtk::base::LengthException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_LENGTH_EXCEPTION_W_CAUSE(whatArg, cause)	\
	::cppdevtk::base::LengthException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

#define CPPDEVTK_MAKE_LENGTH_EXCEPTION(excName, whatArg)	\
	::cppdevtk::base::LengthException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_MAKE_LENGTH_EXCEPTION_W_CAUSE(excName, whatArg, cause)	\
	::cppdevtk::base::LengthException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \sa C++ 03, 19.1.4 Class length_error
class CPPDEVTK_BASE_API LengthException: public virtual LogicException {
public:
	LengthException(const SourceCodeInfo& throwPoint, const QString& whatArg);
	LengthException(const SourceCodeInfo& throwPoint, const QString& whatArg, const Exception& cause);

	virtual ~LengthException() CPPDEVTK_NOEXCEPT;

	::std::auto_ptr<LengthException> Clone() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual QtException* clone() const;
#	else
	virtual LengthException* clone() const;
#	endif

	void Swap(LengthException& other) CPPDEVTK_NOEXCEPT;
protected:
	virtual void DoThrow() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual Cloneable* DoClone() const;
#	else
	virtual LengthException* DoClone() const;
#	endif

	void SwapOwnData(LengthException& other) CPPDEVTK_NOEXCEPT;
};

CPPDEVTK_BASE_API void swap(LengthException& x, LengthException& y) CPPDEVTK_NOEXCEPT;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OutOfRangeException

#define CPPDEVTK_OUT_OF_RANGE_EXCEPTION(whatArg)	\
	::cppdevtk::base::OutOfRangeException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_OUT_OF_RANGE_EXCEPTION_W_CAUSE(whatArg, cause)	\
	::cppdevtk::base::OutOfRangeException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

#define CPPDEVTK_MAKE_OUT_OF_RANGE_EXCEPTION(excName, whatArg)	\
	::cppdevtk::base::OutOfRangeException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_MAKE_OUT_OF_RANGE_EXCEPTION_W_CAUSE(excName, whatArg, cause)	\
	::cppdevtk::base::OutOfRangeException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \sa C++ 03, 19.1.5 Class out_of_range
class CPPDEVTK_BASE_API OutOfRangeException: public virtual LogicException {
public:
	OutOfRangeException(const SourceCodeInfo& throwPoint, const QString& whatArg);
	OutOfRangeException(const SourceCodeInfo& throwPoint, const QString& whatArg, const Exception& cause);

	virtual ~OutOfRangeException() CPPDEVTK_NOEXCEPT;

	::std::auto_ptr<OutOfRangeException> Clone() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual QtException* clone() const;
#	else
	virtual OutOfRangeException* clone() const;
#	endif

	void Swap(OutOfRangeException& other) CPPDEVTK_NOEXCEPT;
protected:
	virtual void DoThrow() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual Cloneable* DoClone() const;
#	else
	virtual OutOfRangeException* DoClone() const;
#	endif

	void SwapOwnData(OutOfRangeException& other) CPPDEVTK_NOEXCEPT;
};

CPPDEVTK_BASE_API void swap(OutOfRangeException& x, OutOfRangeException& y) CPPDEVTK_NOEXCEPT;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// RuntimeException

#define CPPDEVTK_RUNTIME_EXCEPTION(whatArg)	\
	::cppdevtk::base::RuntimeException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_RUNTIME_EXCEPTION_W_CAUSE(whatArg, cause)	\
	::cppdevtk::base::RuntimeException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

#define CPPDEVTK_MAKE_RUNTIME_EXCEPTION(excName, whatArg)	\
	::cppdevtk::base::RuntimeException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_MAKE_RUNTIME_EXCEPTION_W_CAUSE(excName, whatArg, cause)	\
	::cppdevtk::base::RuntimeException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \sa C++ 03, 19.1.6 Class runtime_error
class CPPDEVTK_BASE_API RuntimeException: public virtual Exception {
public:
	RuntimeException(const SourceCodeInfo& throwPoint, const QString& whatArg);
	RuntimeException(const SourceCodeInfo& throwPoint, const QString& whatArg, const Exception& cause);
	RuntimeException(const RuntimeException& other) CPPDEVTK_NOEXCEPT;

	virtual ~RuntimeException() CPPDEVTK_NOEXCEPT;

	RuntimeException& operator=(const RuntimeException& other) CPPDEVTK_NOEXCEPT;

	::std::auto_ptr<RuntimeException> Clone() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual QtException* clone() const;
#	else
	virtual RuntimeException* clone() const;
#	endif

	void Swap(RuntimeException& other) CPPDEVTK_NOEXCEPT;
protected:
	virtual void DoThrow() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual Cloneable* DoClone() const;
#	else
	virtual RuntimeException* DoClone() const;
#	endif

	virtual QString DoOwnWhat() const;

	void SwapOwnData(RuntimeException& other) CPPDEVTK_NOEXCEPT;

	QString whatArg_;
};

CPPDEVTK_BASE_API void swap(RuntimeException& x, RuntimeException& y) CPPDEVTK_NOEXCEPT;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// RangeException

#define CPPDEVTK_RANGE_EXCEPTION(whatArg)	\
	::cppdevtk::base::RangeException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_RANGE_EXCEPTION_W_CAUSE(whatArg, cause)	\
	::cppdevtk::base::RangeException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

#define CPPDEVTK_MAKE_RANGE_EXCEPTION(excName, whatArg)	\
	::cppdevtk::base::RangeException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_MAKE_RANGE_EXCEPTION_W_CAUSE(excName, whatArg, cause)	\
	::cppdevtk::base::RangeException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \sa C++ 03, 19.1.7 Class range_error
class CPPDEVTK_BASE_API RangeException: public virtual RuntimeException {
public:
	RangeException(const SourceCodeInfo& throwPoint, const QString& whatArg);
	RangeException(const SourceCodeInfo& throwPoint, const QString& whatArg, const Exception& cause);

	virtual ~RangeException() CPPDEVTK_NOEXCEPT;

	::std::auto_ptr<RangeException> Clone() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual QtException* clone() const;
#	else
	virtual RangeException* clone() const;
#	endif

	void Swap(RangeException& other) CPPDEVTK_NOEXCEPT;
protected:
	virtual void DoThrow() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual Cloneable* DoClone() const;
#	else
	virtual RangeException* DoClone() const;
#	endif

	void SwapOwnData(RangeException& other) CPPDEVTK_NOEXCEPT;
};

CPPDEVTK_BASE_API void swap(RangeException& x, RangeException& y) CPPDEVTK_NOEXCEPT;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OverflowException

#define CPPDEVTK_OVERFLOW_EXCEPTION(whatArg)	\
	::cppdevtk::base::OverflowException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_OVERFLOW_EXCEPTION_W_CAUSE(whatArg, cause)	\
	::cppdevtk::base::OverflowException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

#define CPPDEVTK_MAKE_OVERFLOW_EXCEPTION(excName, whatArg)	\
	::cppdevtk::base::OverflowException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_MAKE_OVERFLOW_EXCEPTION_W_CAUSE(excName, whatArg, cause)	\
	::cppdevtk::base::OverflowException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \sa C++ 03, 19.1.8 Class overflow_error
class CPPDEVTK_BASE_API OverflowException: public virtual RuntimeException {
public:
	OverflowException(const SourceCodeInfo& throwPoint, const QString& whatArg);
	OverflowException(const SourceCodeInfo& throwPoint, const QString& whatArg, const Exception& cause);

	virtual ~OverflowException() CPPDEVTK_NOEXCEPT;

	::std::auto_ptr<OverflowException> Clone() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual QtException* clone() const;
#	else
	virtual OverflowException* clone() const;
#	endif

	void Swap(OverflowException& other) CPPDEVTK_NOEXCEPT;
protected:
	virtual void DoThrow() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual Cloneable* DoClone() const;
#	else
	virtual OverflowException* DoClone() const;
#	endif

	void SwapOwnData(OverflowException& other) CPPDEVTK_NOEXCEPT;
};

CPPDEVTK_BASE_API void swap(OverflowException& x, OverflowException& y) CPPDEVTK_NOEXCEPT;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// UnderflowException

#define CPPDEVTK_UNDERFLOW_EXCEPTION(whatArg)	\
	::cppdevtk::base::UnderflowException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_UNDERFLOW_EXCEPTION_W_CAUSE(whatArg, cause)	\
	::cppdevtk::base::UnderflowException(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

#define CPPDEVTK_MAKE_UNDERFLOW_EXCEPTION(excName, whatArg)	\
	::cppdevtk::base::UnderflowException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg))

#define CPPDEVTK_MAKE_UNDERFLOW_EXCEPTION_W_CAUSE(excName, whatArg, cause)	\
	::cppdevtk::base::UnderflowException excName(CPPDEVTK_SOURCE_CODE_INFO(), (whatArg), (cause))

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \sa C++ 03, 19.1.9 Class underflow_error
class CPPDEVTK_BASE_API UnderflowException: public virtual RuntimeException {
public:
	UnderflowException(const SourceCodeInfo& throwPoint, const QString& whatArg);
	UnderflowException(const SourceCodeInfo& throwPoint, const QString& whatArg, const Exception& cause);

	virtual ~UnderflowException() CPPDEVTK_NOEXCEPT;

	::std::auto_ptr<UnderflowException> Clone() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual QtException* clone() const;
#	else
	virtual UnderflowException* clone() const;
#	endif

	void Swap(UnderflowException& other) CPPDEVTK_NOEXCEPT;
protected:
	virtual void DoThrow() const;

#	if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
	virtual Cloneable* DoClone() const;
#	else
	virtual UnderflowException* DoClone() const;
#	endif

	void SwapOwnData(UnderflowException& other) CPPDEVTK_NOEXCEPT;
};

CPPDEVTK_BASE_API void swap(UnderflowException& x, UnderflowException& y) CPPDEVTK_NOEXCEPT;

/// @}	// std_exceptions
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Inline functions

inline LogicException::LogicException(const SourceCodeInfo& throwPoint, const QString& whatArg):
		Exception(throwPoint), whatArg_(whatArg) {}

inline LogicException::LogicException(const SourceCodeInfo& throwPoint, const QString& whatArg,
		const Exception& cause): Exception(throwPoint, cause), whatArg_(whatArg) {}

inline LogicException::LogicException(const LogicException& other) CPPDEVTK_NOEXCEPT: Exception(other), whatArg_(other.whatArg_) {}

inline LogicException::~LogicException() CPPDEVTK_NOEXCEPT {}

inline LogicException& LogicException::operator=(const LogicException& other) CPPDEVTK_NOEXCEPT {
	LogicException tmp(other);
	Swap(tmp);
	return *this;
}

inline ::std::auto_ptr<LogicException> LogicException::Clone() const {
	return ::std::auto_ptr<LogicException>(dynamic_cast<LogicException*>(Cloneable::Clone().release()));
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline QtException* LogicException::clone() const {
#else
inline LogicException* LogicException::clone() const {
#endif
	return Clone().release();
}

inline void LogicException::Swap(LogicException& other) CPPDEVTK_NOEXCEPT {
	if (this != &other) {
		Exception::Swap(other);
		SwapOwnData(other);
	}
}

inline void LogicException::DoThrow() const {
	throw *this;
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline Cloneable* LogicException::DoClone() const {
#else
inline LogicException* LogicException::DoClone() const {
#endif
	return new LogicException(*this);
}

inline QString LogicException::DoOwnWhat() const {
	return whatArg_;
}

inline void LogicException::SwapOwnData(LogicException& other) CPPDEVTK_NOEXCEPT {
	using ::std::swap;

	swap(whatArg_, other.whatArg_);
}

inline CPPDEVTK_BASE_API void swap(LogicException& x, LogicException& y) CPPDEVTK_NOEXCEPT {
	x.Swap(y);
}

inline DomainException::DomainException(const SourceCodeInfo& throwPoint, const QString& whatArg):
		Exception(throwPoint), LogicException(throwPoint, whatArg) {}

inline DomainException::DomainException(const SourceCodeInfo& throwPoint, const QString& whatArg,
		const Exception& cause): Exception(throwPoint, cause), LogicException(throwPoint, whatArg, cause) {}

inline DomainException::~DomainException() CPPDEVTK_NOEXCEPT {}

inline ::std::auto_ptr<DomainException> DomainException::Clone() const {
	return ::std::auto_ptr<DomainException>(dynamic_cast<DomainException*>(Cloneable::Clone().release()));
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline QtException* DomainException::clone() const {
#else
inline DomainException* DomainException::clone() const {
#endif
	return Clone().release();
}

inline void DomainException::Swap(DomainException& other) CPPDEVTK_NOEXCEPT {
	if (this != &other) {
		LogicException::Swap(other);
		SwapOwnData(other);
	}
}

inline void DomainException::DoThrow() const {
	throw *this;
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline Cloneable* DomainException::DoClone() const {
#else
inline DomainException* DomainException::DoClone() const {
#endif
	return new DomainException(*this);
}

inline void DomainException::SwapOwnData(DomainException& other) CPPDEVTK_NOEXCEPT {
	SuppressUnusedWarning(other);
}

inline CPPDEVTK_BASE_API void swap(DomainException& x, DomainException& y) CPPDEVTK_NOEXCEPT {
	x.Swap(y);
}

inline InvalidArgumentException::InvalidArgumentException(const SourceCodeInfo& throwPoint, const QString& whatArg):
		Exception(throwPoint), LogicException(throwPoint, whatArg) {}

inline InvalidArgumentException::InvalidArgumentException(const SourceCodeInfo& throwPoint, const QString& whatArg,
		const Exception& cause): Exception(throwPoint, cause), LogicException(throwPoint, whatArg, cause) {}

inline InvalidArgumentException::~InvalidArgumentException() CPPDEVTK_NOEXCEPT {}

inline ::std::auto_ptr<InvalidArgumentException> InvalidArgumentException::Clone() const {
	return ::std::auto_ptr<InvalidArgumentException>(dynamic_cast<InvalidArgumentException*>(Cloneable::Clone().release()));
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline QtException* InvalidArgumentException::clone() const {
#else
inline InvalidArgumentException* InvalidArgumentException::clone() const {
#endif
	return Clone().release();
}

inline void InvalidArgumentException::Swap(InvalidArgumentException& other) CPPDEVTK_NOEXCEPT {
	if (this != &other) {
		LogicException::Swap(other);
		SwapOwnData(other);
	}
}

inline void InvalidArgumentException::DoThrow() const {
	throw *this;
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline Cloneable* InvalidArgumentException::DoClone() const {
#else
inline InvalidArgumentException* InvalidArgumentException::DoClone() const {
#endif
	return new InvalidArgumentException(*this);
}

inline void InvalidArgumentException::SwapOwnData(InvalidArgumentException& other) CPPDEVTK_NOEXCEPT {
	SuppressUnusedWarning(other);
}

inline CPPDEVTK_BASE_API void swap(InvalidArgumentException& x, InvalidArgumentException& y) CPPDEVTK_NOEXCEPT {
	x.Swap(y);
}

inline LengthException::LengthException(const SourceCodeInfo& throwPoint, const QString& whatArg):
		Exception(throwPoint), LogicException(throwPoint, whatArg) {}

inline LengthException::LengthException(const SourceCodeInfo& throwPoint, const QString& whatArg,
		const Exception& cause): Exception(throwPoint, cause), LogicException(throwPoint, whatArg, cause) {}

inline LengthException::~LengthException() CPPDEVTK_NOEXCEPT {}

inline ::std::auto_ptr<LengthException> LengthException::Clone() const {
	return ::std::auto_ptr<LengthException>(dynamic_cast<LengthException*>(Cloneable::Clone().release()));
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline QtException* LengthException::clone() const {
#else
inline LengthException* LengthException::clone() const {
#endif
	return Clone().release();
}

inline void LengthException::Swap(LengthException& other) CPPDEVTK_NOEXCEPT {
	if (this != &other) {
		LogicException::Swap(other);
		SwapOwnData(other);
	}
}

inline void LengthException::DoThrow() const {
	throw *this;
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline Cloneable* LengthException::DoClone() const {
#else
inline LengthException* LengthException::DoClone() const {
#endif
	return new LengthException(*this);
}

inline void LengthException::SwapOwnData(LengthException& other) CPPDEVTK_NOEXCEPT {
	SuppressUnusedWarning(other);
}

inline CPPDEVTK_BASE_API void swap(LengthException& x, LengthException& y) CPPDEVTK_NOEXCEPT {
	x.Swap(y);
}

inline OutOfRangeException::OutOfRangeException(const SourceCodeInfo& throwPoint, const QString& whatArg):
		Exception(throwPoint), LogicException(throwPoint, whatArg) {}

inline OutOfRangeException::OutOfRangeException(const SourceCodeInfo& throwPoint, const QString& whatArg,
		const Exception& cause): Exception(throwPoint, cause), LogicException(throwPoint, whatArg, cause) {}

inline OutOfRangeException::~OutOfRangeException() CPPDEVTK_NOEXCEPT {}

inline ::std::auto_ptr<OutOfRangeException> OutOfRangeException::Clone() const {
	return ::std::auto_ptr<OutOfRangeException>(dynamic_cast<OutOfRangeException*>(Cloneable::Clone().release()));
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline QtException* OutOfRangeException::clone() const {
#else
inline OutOfRangeException* OutOfRangeException::clone() const {
#endif
	return Clone().release();
}

inline void OutOfRangeException::Swap(OutOfRangeException& other) CPPDEVTK_NOEXCEPT {
	if (this != &other) {
		LogicException::Swap(other);
		SwapOwnData(other);
	}
}

inline void OutOfRangeException::DoThrow() const {
	throw *this;
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline Cloneable* OutOfRangeException::DoClone() const {
#else
inline OutOfRangeException* OutOfRangeException::DoClone() const {
#endif
	return new OutOfRangeException(*this);
}

inline void OutOfRangeException::SwapOwnData(OutOfRangeException& other) CPPDEVTK_NOEXCEPT {
	SuppressUnusedWarning(other);
}

inline CPPDEVTK_BASE_API void swap(OutOfRangeException& x, OutOfRangeException& y) CPPDEVTK_NOEXCEPT {
	x.Swap(y);
}

inline RuntimeException::RuntimeException(const SourceCodeInfo& throwPoint, const QString& whatArg):
		Exception(throwPoint), whatArg_(whatArg) {}

inline RuntimeException::RuntimeException(const SourceCodeInfo& throwPoint, const QString& whatArg,
		const Exception& cause): Exception(throwPoint, cause), whatArg_(whatArg) {}

inline RuntimeException::RuntimeException(const RuntimeException& other) CPPDEVTK_NOEXCEPT: Exception(other), whatArg_(other.whatArg_) {}

inline RuntimeException::~RuntimeException() CPPDEVTK_NOEXCEPT {}

inline RuntimeException& RuntimeException::operator=(const RuntimeException& other) CPPDEVTK_NOEXCEPT {
	RuntimeException tmp(other);
	Swap(tmp);
	return *this;
}

inline ::std::auto_ptr<RuntimeException> RuntimeException::Clone() const {
	return ::std::auto_ptr<RuntimeException>(dynamic_cast<RuntimeException*>(Cloneable::Clone().release()));
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline QtException* RuntimeException::clone() const {
#else
inline RuntimeException* RuntimeException::clone() const {
#endif
	return Clone().release();
}

inline void RuntimeException::Swap(RuntimeException& other) CPPDEVTK_NOEXCEPT {
	if (this != &other) {
		Exception::Swap(other);
		SwapOwnData(other);
	}
}

inline void RuntimeException::DoThrow() const {
	throw *this;
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline Cloneable* RuntimeException::DoClone() const {
#else
inline RuntimeException* RuntimeException::DoClone() const {
#endif
	return new RuntimeException(*this);
}

inline QString RuntimeException::DoOwnWhat() const {
	return whatArg_;
}

inline void RuntimeException::SwapOwnData(RuntimeException& other) CPPDEVTK_NOEXCEPT {
	using ::std::swap;

	swap(whatArg_, other.whatArg_);
}

inline CPPDEVTK_BASE_API void swap(RuntimeException& x, RuntimeException& y) CPPDEVTK_NOEXCEPT {
	x.Swap(y);
}

inline RangeException::RangeException(const SourceCodeInfo& throwPoint, const QString& whatArg):
		Exception(throwPoint), RuntimeException(throwPoint, whatArg) {}

inline RangeException::RangeException(const SourceCodeInfo& throwPoint, const QString& whatArg,
		const Exception& cause): Exception(throwPoint, cause), RuntimeException(throwPoint, whatArg, cause) {}

inline RangeException::~RangeException() CPPDEVTK_NOEXCEPT {}

inline ::std::auto_ptr<RangeException> RangeException::Clone() const {
	return ::std::auto_ptr<RangeException>(dynamic_cast<RangeException*>(Cloneable::Clone().release()));
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline QtException* RangeException::clone() const {
#else
inline RangeException* RangeException::clone() const {
#endif
	return Clone().release();
}

inline void RangeException::Swap(RangeException& other) CPPDEVTK_NOEXCEPT {
	if (this != &other) {
		RuntimeException::Swap(other);
		SwapOwnData(other);
	}
}

inline void RangeException::DoThrow() const {
	throw *this;
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline Cloneable* RangeException::DoClone() const {
#else
inline RangeException* RangeException::DoClone() const {
#endif
	return new RangeException(*this);
}

inline void RangeException::SwapOwnData(RangeException& other) CPPDEVTK_NOEXCEPT {
	SuppressUnusedWarning(other);
}

inline CPPDEVTK_BASE_API void swap(RangeException& x, RangeException& y) CPPDEVTK_NOEXCEPT {
	x.Swap(y);
}

inline OverflowException::OverflowException(const SourceCodeInfo& throwPoint, const QString& whatArg):
		Exception(throwPoint), RuntimeException(throwPoint, whatArg) {}

inline OverflowException::OverflowException(const SourceCodeInfo& throwPoint, const QString& whatArg,
		const Exception& cause): Exception(throwPoint, cause), RuntimeException(throwPoint, whatArg, cause) {}

inline OverflowException::~OverflowException() CPPDEVTK_NOEXCEPT {}

inline ::std::auto_ptr<OverflowException> OverflowException::Clone() const {
	return ::std::auto_ptr<OverflowException>(dynamic_cast<OverflowException*>(Cloneable::Clone().release()));
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline QtException* OverflowException::clone() const {
#else
inline OverflowException* OverflowException::clone() const {
#endif
	return Clone().release();
}

inline void OverflowException::Swap(OverflowException& other) CPPDEVTK_NOEXCEPT {
	if (this != &other) {
		RuntimeException::Swap(other);
		SwapOwnData(other);
	}
}

inline void OverflowException::DoThrow() const {
	throw *this;
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline Cloneable* OverflowException::DoClone() const {
#else
inline OverflowException* OverflowException::DoClone() const {
#endif
	return new OverflowException(*this);
}

inline void OverflowException::SwapOwnData(OverflowException& other) CPPDEVTK_NOEXCEPT {
	SuppressUnusedWarning(other);
}

inline CPPDEVTK_BASE_API void swap(OverflowException& x, OverflowException& y) CPPDEVTK_NOEXCEPT {
	x.Swap(y);
}

inline UnderflowException::UnderflowException(const SourceCodeInfo& throwPoint, const QString& whatArg):
		Exception(throwPoint), RuntimeException(throwPoint, whatArg) {}

inline UnderflowException::UnderflowException(const SourceCodeInfo& throwPoint, const QString& whatArg,
		const Exception& cause): Exception(throwPoint, cause), RuntimeException(throwPoint, whatArg, cause) {}

inline UnderflowException::~UnderflowException() CPPDEVTK_NOEXCEPT {}

inline ::std::auto_ptr<UnderflowException> UnderflowException::Clone() const {
	return ::std::auto_ptr<UnderflowException>(dynamic_cast<UnderflowException*>(Cloneable::Clone().release()));
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline QtException* UnderflowException::clone() const {
#else
inline UnderflowException* UnderflowException::clone() const {
#endif
	return Clone().release();
}

inline void UnderflowException::Swap(UnderflowException& other) CPPDEVTK_NOEXCEPT {
	if (this != &other) {
		RuntimeException::Swap(other);
		SwapOwnData(other);
	}
}

inline void UnderflowException::DoThrow() const {
	throw *this;
}

#if (CPPDEVTK_COMPILER_HAVE_MVI_CRT_BUG)
inline Cloneable* UnderflowException::DoClone() const {
#else
inline UnderflowException* UnderflowException::DoClone() const {
#endif
	return new UnderflowException(*this);
}

inline void UnderflowException::SwapOwnData(UnderflowException& other) CPPDEVTK_NOEXCEPT {
	SuppressUnusedWarning(other);
}

inline CPPDEVTK_BASE_API void swap(UnderflowException& x, UnderflowException& y) CPPDEVTK_NOEXCEPT {
	x.Swap(y);
}

}	// namespace base
}	// namespace cppdevtk

#endif	// CPPDEVTK_BASE_STDEXCEPT_HPP_INCLUDED_


text:
package com.sproutigy.commons.serialization.api;

public class SerializationException extends RuntimeException {
    public SerializationException(String message) {
        super(message);
    }

    public SerializationException(Throwable cause) {
        super(cause);
    }
}


text:
package kiwi.dashboard.service;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.Query;

import kiwi.dashboard.cfg.DashboardConfiguration;
import kiwi.model.dashboard.DashboardModelEntity;
import kiwi.model.user.User;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.primefaces.model.DashboardColumn;
import org.primefaces.model.DefaultDashboardColumn;
import org.primefaces.model.DefaultDashboardModel;

@Name("dashboardService")
@Scope(ScopeType.STATELESS)
@AutoCreate
public class DashboardService {

	@In
	EntityManager entityManager;

	public DefaultDashboardModel getModel(User user) {
		DashboardModelEntity model = this.getUserSpecificModel(user);
		if( model != null ) return model.getModel();
		else return getDefaultModel();
	}

	/**
	 * returns a new model which contains all registered portlets
	 * @return
	 */
	private DefaultDashboardModel getDefaultModel() {
		DefaultDashboardModel model = new DefaultDashboardModel();
		DashboardColumn col1 = new DefaultDashboardColumn();
		DashboardColumn col2 = new DefaultDashboardColumn();
		DashboardColumn col3 = new DefaultDashboardColumn();

		//add all portlets to the dashboard
//		int i = 1;
//		for( String s : DashboardConfiguration.PORTLETS ) {
//			switch(i) {
//			case 1:
//				col1.addWidget(s);
//				i = 2;
//				break;
//			case 2:
//				col2.addWidget(s);
//				i = 3;
//				break;
//			case 3:
//				col3.addWidget(s);
//				i = 1;
//				break;
//			}
//		}

		//add welcome portlet
		col1.addWidget("welcome");

		model.addColumn(col1);
		model.addColumn(col2);
		model.addColumn(col3);

		return model;
	}

	public void saveModel(DefaultDashboardModel model, User user) {
		DashboardModelEntity m = getUserSpecificModel(user);
		if( m == null ) {
			m = new DashboardModelEntity();
			m.setUserlogin(user.getLogin());
		}
		m.setModel(model);
		entityManager.persist(m);
	}

	private DashboardModelEntity getUserSpecificModel(User user) {
		final Query query = entityManager.createNamedQuery("select.dashboardModelFromDatabase");
		query.setParameter("userlogin", user.getLogin());
		try {
			final DashboardModelEntity model =
                (DashboardModelEntity) query.getSingleResult();
			return model;
		} catch (NoResultException noResultException) {
			return null;
		}
	}

	public List<String> getPortlets(User user) {
		//TODO personalize
		return DashboardConfiguration.PORTLETS;
	}

}


text:
'use strict';

/* jshint ignore:start */
/**
 * This code was generated by
 * \ / _    _  _|   _  _
 *  | (_)\/(_)(_|\/| |(/_  v1.0.0
 *       /       /
 */
/* jshint ignore:end */

var Holodeck = require('../../../holodeck');  /* jshint ignore:line */
var Request = require(
    '../../../../../lib/http/request');  /* jshint ignore:line */
var Response = require(
    '../../../../../lib/http/response');  /* jshint ignore:line */
var RestException = require(
    '../../../../../lib/base/RestException');  /* jshint ignore:line */
var Twilio = require('../../../../../lib');  /* jshint ignore:line */

var client;
var holodeck;

describe('Sim', function() {
  beforeEach(function() {
    holodeck = new Holodeck();
    client = new Twilio('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'AUTHTOKEN', {
      httpClient: holodeck
    });
  });
  it('should generate valid create request',
    function(done) {
      holodeck.mock(new Response(500, {}));

      var opts = {'iccid': 'iccid', 'registrationCode': 'registration_code'};
      var promise = client.supersim.v1.sims.create(opts);
      promise.then(function() {
        throw new Error('failed');
      }, function(error) {
        expect(error.constructor).toBe(RestException.prototype.constructor);
        done();
      }).done();

      var url = 'https://supersim.twilio.com/v1/Sims';

      var values = {'Iccid': 'iccid', 'RegistrationCode': 'registration_code', };
      holodeck.assertHasRequest(new Request({
          method: 'POST',
          url: url,
          data: values
      }));
    }
  );
  it('should generate valid create response',
    function(done) {
      var body = {
          'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'unique_name': '',
          'status': 'new',
          'fleet_sid': null,
          'iccid': '89883070000123456789',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
              'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
          }
      };

      holodeck.mock(new Response(201, body));

      var opts = {'iccid': 'iccid', 'registrationCode': 'registration_code'};
      var promise = client.supersim.v1.sims.create(opts);
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid fetch request',
    function(done) {
      holodeck.mock(new Response(500, {}));

      var promise = client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch();
      promise.then(function() {
        throw new Error('failed');
      }, function(error) {
        expect(error.constructor).toBe(RestException.prototype.constructor);
        done();
      }).done();

      var sid = 'HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
      var url = `https://supersim.twilio.com/v1/Sims/${sid}`;

      holodeck.assertHasRequest(new Request({
        method: 'GET',
        url: url
      }));
    }
  );
  it('should generate valid fetch response',
    function(done) {
      var body = {
          'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'unique_name': 'My SIM',
          'status': 'new',
          'fleet_sid': null,
          'iccid': '89883070000123456789',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
              'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
          }
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid update request',
    function(done) {
      holodeck.mock(new Response(500, {}));

      var promise = client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update();
      promise.then(function() {
        throw new Error('failed');
      }, function(error) {
        expect(error.constructor).toBe(RestException.prototype.constructor);
        done();
      }).done();

      var sid = 'HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
      var url = `https://supersim.twilio.com/v1/Sims/${sid}`;

      holodeck.assertHasRequest(new Request({
        method: 'POST',
        url: url
      }));
    }
  );
  it('should generate valid update_unique_name response',
    function(done) {
      var body = {
          'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'unique_name': 'MySIM',
          'status': 'new',
          'fleet_sid': null,
          'iccid': '89883070000123456789',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
              'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
          }
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid update_status response',
    function(done) {
      var body = {
          'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'unique_name': null,
          'status': 'scheduled',
          'fleet_sid': null,
          'iccid': '89883070000123456789',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
              'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
          }
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid update_fleet_with_sid response',
    function(done) {
      var body = {
          'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'unique_name': null,
          'status': 'new',
          'fleet_sid': 'HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'iccid': '89883070000123456789',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
              'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
          }
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid update_fleet_with_unique_name response',
    function(done) {
      var body = {
          'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'unique_name': null,
          'status': 'new',
          'fleet_sid': 'HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'iccid': '89883070000123456789',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
              'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
          }
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid transfer_sim_to_another_account response',
    function(done) {
      var body = {
          'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'account_sid': 'ACbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
          'unique_name': null,
          'status': 'new',
          'fleet_sid': 'HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'iccid': '89883070000123456789',
          'date_created': '2015-07-30T20:00:00Z',
          'date_updated': '2015-07-30T20:00:00Z',
          'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
          'links': {
              'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
              'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
          }
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims('HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should treat the first each arg as a callback',
    function(done) {
      var body = {
          'meta': {
              'first_page_url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0',
              'key': 'sims',
              'next_page_url': null,
              'page': 0,
              'page_size': 50,
              'previous_page_url': null,
              'url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0'
          },
          'sims': [
              {
                  'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'unique_name': 'My SIM',
                  'status': 'new',
                  'fleet_sid': 'HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'iccid': '89883070000123456789',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
                      'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
                  }
              }
          ]
      };
      holodeck.mock(new Response(200, body));
      client.supersim.v1.sims.each(() => done());
    }
  );
  it('should treat the second arg as a callback',
    function(done) {
      var body = {
          'meta': {
              'first_page_url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0',
              'key': 'sims',
              'next_page_url': null,
              'page': 0,
              'page_size': 50,
              'previous_page_url': null,
              'url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0'
          },
          'sims': [
              {
                  'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'unique_name': 'My SIM',
                  'status': 'new',
                  'fleet_sid': 'HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'iccid': '89883070000123456789',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
                      'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
                  }
              }
          ]
      };
      holodeck.mock(new Response(200, body));
      client.supersim.v1.sims.each({pageSize: 20}, () => done());
      holodeck.assertHasRequest(new Request({
          method: 'GET',
          url: 'https://supersim.twilio.com/v1/Sims',
          params: {PageSize: 20},
      }));
    }
  );
  it('should find the callback in the opts object',
    function(done) {
      var body = {
          'meta': {
              'first_page_url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0',
              'key': 'sims',
              'next_page_url': null,
              'page': 0,
              'page_size': 50,
              'previous_page_url': null,
              'url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0'
          },
          'sims': [
              {
                  'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'unique_name': 'My SIM',
                  'status': 'new',
                  'fleet_sid': 'HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'iccid': '89883070000123456789',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
                      'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
                  }
              }
          ]
      };
      holodeck.mock(new Response(200, body));
      client.supersim.v1.sims.each({callback: () => done()}, () => fail('wrong callback!'));
    }
  );
  it('should generate valid list request',
    function(done) {
      holodeck.mock(new Response(500, {}));

      var promise = client.supersim.v1.sims.list();
      promise.then(function() {
        throw new Error('failed');
      }, function(error) {
        expect(error.constructor).toBe(RestException.prototype.constructor);
        done();
      }).done();

      var url = 'https://supersim.twilio.com/v1/Sims';

      holodeck.assertHasRequest(new Request({
        method: 'GET',
        url: url
      }));
    }
  );
  it('should generate valid read_empty response',
    function(done) {
      var body = {
          'sims': [],
          'meta': {
              'first_page_url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0',
              'key': 'sims',
              'next_page_url': null,
              'page': 0,
              'page_size': 50,
              'previous_page_url': null,
              'url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0'
          }
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims.list();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid read_full_by_fleet_sid response',
    function(done) {
      var body = {
          'meta': {
              'first_page_url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0',
              'key': 'sims',
              'next_page_url': null,
              'page': 0,
              'page_size': 50,
              'previous_page_url': null,
              'url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&PageSize=50&Page=0'
          },
          'sims': [
              {
                  'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'unique_name': 'My SIM',
                  'status': 'new',
                  'fleet_sid': 'HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'iccid': '89883070000123456789',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
                      'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
                  }
              }
          ]
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims.list();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid read_full_by_fleet_name response',
    function(done) {
      var body = {
          'meta': {
              'first_page_url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=MyFleet&PageSize=50&Page=0',
              'key': 'sims',
              'next_page_url': null,
              'page': 0,
              'page_size': 50,
              'previous_page_url': null,
              'url': 'https://supersim.twilio.com/v1/Sims?Status=new&Fleet=MyFleet&PageSize=50&Page=0'
          },
          'sims': [
              {
                  'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'unique_name': 'My SIM',
                  'status': 'new',
                  'fleet_sid': 'HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'iccid': '89883070000123456789',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
                      'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
                  }
              }
          ]
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims.list();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
  it('should generate valid read_by_iccid response',
    function(done) {
      var body = {
          'meta': {
              'first_page_url': 'https://supersim.twilio.com/v1/Sims?Iccid=89883070000123456789&PageSize=50&Page=0',
              'key': 'sims',
              'next_page_url': null,
              'page': 0,
              'page_size': 50,
              'previous_page_url': null,
              'url': 'https://supersim.twilio.com/v1/Sims?Iccid=89883070000123456789&PageSize=50&Page=0'
          },
          'sims': [
              {
                  'sid': 'HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'unique_name': 'My SIM',
                  'status': 'new',
                  'fleet_sid': null,
                  'iccid': '89883070000123456789',
                  'date_created': '2015-07-30T20:00:00Z',
                  'date_updated': '2015-07-30T20:00:00Z',
                  'url': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                  'links': {
                      'billing_periods': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods',
                      'sim_ip_addresses': 'https://supersim.twilio.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAddresses'
                  }
              }
          ]
      };

      holodeck.mock(new Response(200, body));

      var promise = client.supersim.v1.sims.list();
      promise.then(function(response) {
        expect(response).toBeDefined();
        done();
      }, function() {
        throw new Error('failed');
      }).done();
    }
  );
});


text:
<?php

namespace spec\Sylius\Component\Shipping\Calculator;

use PhpSpec\ObjectBehavior;

/**
 * @author Paweł Jędrzejewski <pawel@sylius.org>
 */
class UndefinedShippingMethodExceptionSpec extends ObjectBehavior
{
    public function it_is_initializable()
    {
        $this->shouldHaveType('Sylius\Component\Shipping\Calculator\UndefinedShippingMethodException');
    }

    public function it_is_an_exception()
    {
        $this->shouldHaveType('Exception');
    }

    public function it_is_a_invalid_argument_exception()
    {
        $this->shouldHaveType('InvalidArgumentException');
    }
}


text:
[Describe bug here]

### Steps to Reproduce:

```
[Provide a small snippet of code where the incorrect behavior can be seen]
```

### Expected:

[What was the expected behavior]

### Actual:

[What actually happened]


text:
package com.github.windsekirun.big5personalitydiagnostic.util;

import java.io.Serializable;

/**
 * Big5 Personality Diagnostic
 * class: QuestionPair
 * Created by WindSekirun on 2015. 11. 10..
 */
public class QuestionPair implements Serializable {
    public String first;
    public int second;

    public QuestionPair(String text, int selectNum) {
        first = text;
        second = selectNum;
    }
}


text:
You need yarn (for build consistency): https://yarnpkg.com/en/docs/install

```sh
npm run build
```


text:
<?php
declare(strict_types=1);
namespace MyPlot\events;

use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\event\Event;

class MyPlotGenerationEvent extends Event implements Cancellable {
	use CancellableTrait;

	private string $levelName;
	private string $generator;
	/** @var string[] $settings */
	private array $settings;

	/**
	 * MyPlotGenerationEvent constructor.
	 *
	 * @param string $levelName
	 * @param string $generator
	 * @param string[] $settings
	 */
	public function __construct(string $levelName, string $generator = "myplot", array $settings = []) {
		$this->levelName = $levelName;
		$this->generator = $generator;
		$this->settings = $settings;
	}

	public function getLevelName() : string {
		return $this->levelName;
	}

	public function setLevelName(string $levelName) : self {
		$this->levelName = $levelName;
		return $this;
	}

	public function getGenerator() : string {
		return $this->generator;
	}

	public function setGenerator(string $generator) : self {
		$this->generator = $generator;
		return $this;
	}

	/**
	 * @return string[]
	 */
	public function getSettings() : array {
		return $this->settings;
	}

	/**
	 * @param string[] $settings
	 *
	 * @return self
	 * @throws \JsonException
	 */
	public function setSettings(array $settings) : self {
		$this->settings = $settings;
		$this->settings["preset"] = json_encode($settings, JSON_THROW_ON_ERROR);
		return $this;
	}
}


text:
. ./appveyor_helpers.ps1

####################### Local run (Debug) configuration ###################################

# Set these input variable that would normally come from AppVeyor yml
if ($LOCAL_DEBUG_RUN)
{
    $env:SQ_Version = "5.2"
    $env:MSBuild_Version = "14.0"
    $env:APPVEYOR_BUILD_FOLDER = "C:\Users\bgavril\source\repos\sonar-msbuild-runner"
    $env:configuration = "Debug"

    # This script does not build the C# plugin (unlike appveyor) - please provide the path to it for the debug run
    $localCSharpPluginPath = $env:APPVEYOR_BUILD_FOLDER + "\DeploymentArtifacts\sonar-csharp-plugin-4.2.Debug.bgavril.jar";
}

####################### Settings ###################################

# URL prefix from where to download SonarQube (nb: building SQ takes too long)
$sonarQubeDownloadUrlPrefix = "https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-";
# Where the SonarQube zip files are downloaded (easy to cache)
$sonarQubeDownloadPath = "c:\sonarqube\downloads";
# Path to the SonarQube server - can be cached but then server would not be clean
$sonarQubeInstallPath = "c:\sonarqube";
# By default the server can be reached at localhost:9000. Using localhost. is for Fiddler to be able to capture traffic.
$sonarQubeBaseUrl = "http://localhost.:9000";
# Key for the project under test
$sqProjectKey = "ProjectUnderTest";
# Name of the quality profile used for analysis
$testQualityProfileName = "ProfileForTest";

#
# True for versions 5+
#
function IsVersion5OrGreater
{
    $majorVersion = $env:SQ_Version.Split('.')[0]
    return $majorVersion -cge 5
}

#
# Download and unzip SonarSqube to a well-known directory.
#
# Remark: when performing a local run, do nothing if the directory exists
#
function FetchAndUnzipSonarQube
{
    $sqVersion = $env:SQ_Version;
    $sqUrl = $sonarQubeDownloadUrlPrefix + $sqVersion + ".zip";
    $sqInstallPath = [System.IO.Path]::Combine($sonarQubeInstallPath, "sonarqube-" + $sqVersion)

    if ($LOCAL_DEBUG_RUN -and [System.IO.Directory]::Exists($sqInstallPath))
    {
        LogAppveyorMessage -Message "SonarQube $version is already present in $sqInstallPath"

    }
    else
    {
        if ([System.IO.Directory]::Exists($sqInstallPath))
        {
            throw "Not expecting the directory $sqInstallPath to exist"
        }

        LogAppveyorMessage -Message "Downloading SonarQube from $sqUrl"

        $file = [System.IO.Path]::Combine($sonarQubeDownloadPath, "sonarqube-" + $sqVersion + ".zip")
        FetchAndUnzip $sqUrl $sonarQubeInstallPath $file $false
    }

    return $sqInstallPath;
}

#
# Adds the C# plugin to the list of Appveyor artifacts
#
function PublishPatchedCsharpPlugin
{
    if ($LOCAL_DEBUG_RUN)
    {
        return $localCSharpPluginPath;
    }

    $pluginPath = FindSingleFile ([System.IO.Path]::Combine($env:APPVEYOR_BUILD_FOLDER, "DeploymentArtifacts")) "*.jar"
    Push-AppveyorArtifact $pluginPath

    return $pluginPath;
}

#
# Copy the C# plugin to the SQ plugins directory
#
function InstallCsPlugin
{
    param ([Parameter(Mandatory=$true)][string]$sqServerPath, [Parameter(Mandatory=$true)][string]$csPluginPath)

    if (![System.IO.File]::Exists($csPluginPath))
    {
        throw "Could not find the C# plugin at $csPluginPath"
    }

    $destination = [System.IO.Path]::Combine($sqServerPath, "extensions", "plugins", [System.IO.Path]::GetFileName($csPluginPath));
    [System.IO.File]::Copy($csPluginPath, $destination, $true);
}

function WaitForSonarQubeToHaveStarted
{
    $command = { InvokeGetRestMethod "/api/projects/index?search=projectundertest"}
    Retry $command -maxRetries 30 -retryDelay 1 -Verbose
}

function InvokeGetRestMethod
{
    param ([Parameter(Mandatory=$true)][string]$query,  [bool]$asAdmin=$false)

    $request = $sonarQubeBaseUrl + $query;

    if ($asAdmin)
    {
       $authHeader = GetSonarQubeAdminAuthHeader
       $allheaders = @{Authorization = $authHeader}
    }

    $response = Invoke-RestMethod $request -Method Get -TimeoutSec 30 -Headers $allheaders

    return $response
}

function InvokePostRestMethod
{
    param ([Parameter(Mandatory=$true)][string]$query, [bool]$asAdmin=$false)

    $requestUrl = $sonarQubeBaseUrl +  $query;
    Write-Host "POST $requestUrl"

    if ($asAdmin)
    {
       $authHeader = GetSonarQubeAdminAuthHeader
       $allheaders = @{Authorization = $authHeader}
    }

    $response = Invoke-RestMethod $requestUrl -Method Post -TimeoutSec 30 -Headers $allheaders

    return $response
}

#
# Upload a file
#
# Remark: Multipart upload is not supported out of the box by powershell's Invoke-RestMethod, but System.Net.Http can do it
#
function InvokeUpload {
     param ([Parameter(Mandatory=$true)][string]$query, [Parameter(Mandatory=$true)][string]$formFieldName, [Parameter(Mandatory=$true)][String]$fileToUpload)

    [System.Reflection.Assembly]::LoadWithPartialName('System.Net.Http') | Out-Null

    $requestUrl = $sonarQubeBaseUrl + $query;

    try
    {
        $fileContent = [System.IO.File]::ReadAllText($fileToUpload);
        $client = (New-Object System.Net.Http.HttpClient)
        $stringContent = New-Object System.Net.Http.StringContent @(,$fileContent)

        $basicAuthValue = GetSonarQubeAdminAuthHeader
        $client.DefaultRequestHeaders.Add("Authorization", $basicAuthValue)

        $formData = New-Object System.Net.Http.MultipartFormDataContent
        $formData.Add($stringContent, $formFieldName, "UNUSED");

        return $client.PostAsync($requestUrl, $formData).Result
    }
    finally
    {
        $client.Dispose()
        $formData.Dispose()
    }
}

#
# Gets the default admin:admin basic auth header that can be used in APIs that require elevation
#
function GetSonarQubeAdminAuthHeader
{
        $user = "admin"
        $pass= "admin"

        $pair = "$($user):$($pass)"

        $encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
        $basicAuthValue = "Basic $encodedCreds"

        return $basicAuthValue
}

function UploadTestQualityProfile
{
    echo "Finding the quality profile on disk"
    $qualityProfile = FindSingleFile ([System.IO.Path]::Combine($env:APPVEYOR_BUILD_FOLDER, "Tests", "IntegrationTestProject")) "TestQualityProfile.xml"

    $response = InvokeUpload "/api/profiles/restore" "backup" $qualityProfile
}

function SetTestQualityProfileAsDefault
{
    if (IsVersion5OrGreater)
    {
        $response = InvokePostRestMethod "/api/qualityprofiles/set_default?language=cs&profileName=$testQualityProfileName" $true
    }
    else
    {
        $response = InvokePostRestMethod "/api/profiles/set_as_default?language=cs&name=$testQualityProfileName" $true
    }
}

function VerifyAnalysisResults
{
    WaitForAllBackgroundTasksToComplete

    $response = InvokeGetRestMethod "/api/issues/search?hideRules=true"

<# SONARMBRU-212: re-enable once the C# profile exporter returns information for SonarLint.
   Currently it doesn't, which means we get different results when building in MSBuild 12 and 14.
   In MSBuild 12, the SonarLint rules are still run post-process by the SonarLint.Runner,
   but in MSBuild 14 they are not.

    # Check only the expected rules were broken
    $expectedRuleViolations = @("fxcop:DoNotPassLiteralsAsLocalizedParameters", "fxcop:DoNotRaiseReservedExceptionTypes", "csharpsquid:S2228", "csharpsquid:S1134")

    $brokenRules = $response.issues.rule
    $ruleDiff = Compare-Object $response.issues.rule $expectedRuleViolations

    Assert ($ruleDiff.Length -eq 0) "Expected 4 rules to be broken. Rules found: $brokenRules. Expected: $expectedRuleViolations"
    Assert ($response.total -eq 4) ("There should only be 4 issues. Actual: " + $response.total)
#>

    foreach ($issue in $issues)
    {
        Assert ($issue.project -eq $sqProjectKey) "An issue was found not belonging to the project under test. Instead, it belongs to " + $issue.project
    }
}

function WaitForAllBackgroundTasksToComplete
{
    # Async execution happens on SQ 5+ only
    if (IsVersion5OrGreater)
    {
        $tasksInQueue = $true
        while ($tasksInQueue)
        {
            $response = InvokeGetRestMethod "/api/ce/queue" $true
            $validResponse = $response.PSobject.Properties.name -match "tasks"

            if (!$validResponse)
            {
                throw "The internal API /api/ce/queue did not produce the expected response"
            }

            if ($response.tasks)
            {
                Start-Sleep -s 1
            }
            else
            {
                $tasksInQueue = $false
            }
        }
    }
}

function BuildAndAnalyzeProjectUnderTest
{
    echo "Step 5.1: Finding msbuild"
    $msbuildPath = FindLatestMsBuildPath
    echo "Using the latest msbuild found from $msbuildPath"

    echo "Step 5.2: Locating the MSBuild.SonarQube.Runner.exe"
    $bootstrapperPath = FindSingleFile ([System.IO.Path]::Combine($env:APPVEYOR_BUILD_FOLDER, "DeploymentArtifacts", "BuildAgentPayload", $env:configuration)) "MSBuild.SonarQube.Runner.exe"

    echo "Step 5.3: Locating the project under test"
    $projectUnderTestPath = FindSingleFile ([System.IO.Path]::Combine($env:APPVEYOR_BUILD_FOLDER, "Tests", "IntegrationTestProject")) "ProjectUnderTest.sln"

    echo "Step 5.4: Waiting for SQ to have started"
    WaitForSonarQubeToHaveStarted

    echo "Step 5.5: Upload the test quality profile and make it default"
    UploadTestQualityProfile
    SetTestQualityProfileAsDefault

    echo "Step 5.6: Begining analysis"
    RunProcessAndWaitForFinish $bootstrapperPath @("begin", "/k:$sqProjectKey", "/n:$sqProjectKey", "/v:1")

    echo "Step 5.7: Building the project under test"
    RunProcessAndWaitForFinish $msbuildPath @($projectUnderTestPath, "/v:n", "/p:DoNotExcludeProjectsFromAnalysis=true")

    echo "Step 5.8: Ending analysis"
    RunProcessAndWaitForFinish $bootstrapperPath "end"

}

function RunContinousIntegrationTest
{
    echo "Step 1: Publishing the CS plugin as a build artifact"
    $csPluginPath = PublishPatchedCsharpPlugin

    echo "Step 2: Installing SonarQube"
    $sqInstallPath = FetchAndUnzipSonarQube

    echo "Step 3: Installing the CS plugin"
    InstallCsPlugin $sqInstallPath $csPluginPath

    echo "Step 4: Starting the SonarQube server"
    StartSonarQubeServer $sqInstallPath

    echo "Step 5: Building and analyzing the project under test"
    BuildAndAnalyzeProjectUnderTest

    echo "Step 6: Verifing analysis results"
    VerifyAnalysisResults

    echo "Validation Complete!"
    #StopSonarQubeServer
}

if (IsPRCABuild)
{
    MSBuild.SonarQube.Runner.exe end
}
else
{
    RunContinousIntegrationTest
}


text:
        <form name="demoForm" novalidate ng-submit="">

            <fieldset class="objectSettings">
                <legend>Animation Factor</legend>

                        <slider config="animation.config" element-id="animationSlider"
                                output="animation.factor"></slider>

            </fieldset>

            <fieldset class="objectSettings">
                <legend>Inner Object</legend>

                <input class="orbitStatusCheck" type="checkbox" ng-model="data.inner.status">

                                Advanced

                                <input type="checkbox" ng-model="data.inner.advanced">

                                Color

                                <spectrum ng-model="data.inner.color" options="spectrum"></spectrum>

                        Diameter

                                <slider config="inner.diameterConfig" element-id="innerDiameterId"
                                        output="data.inner.diameter"></slider>

                <fieldset class="rotation">
                    <legend>Rotation</legend>

                                    Degree

                                    <input type="number" ng-model="data.inner.rotation.degree">

                            Speed

                                    <slider config="inner.speedConfig" element-id="innerRotationSpeedId"
                                            output="data.inner.rotation.timeout"></slider>

                </fieldset>
            </fieldset>

            <button class="btn expand" ng-click="addOrbit();">+ Add Orbit</button>

            <fieldset ng-repeat="obj in data.orbits" class="objectSettings">
                <legend ng-click="obj.visible=!obj.visible">
                     -
                     +
                    Orbit Object #{{$index + 1}} -
                </legend>

                <input class="orbitStatusCheck" type="checkbox" ng-model="obj.status">

                <button class="delBtn" ng-click="deleteObject($index);">DEL</button>

                                    Advanced

                                    <input type="checkbox" ng-model="obj.advanced">

                                    Color

                                    <spectrum ng-model="obj.color" options="spectrum"></spectrum>

                            Diameter

                                    <slider config="obj.configs.diameterConfig" element-id="orbitObject_{{$index}}"
                                            output="obj.diameter"></slider>

                    <fieldset class="rotation">
                        <legend>Rotation</legend>

                                        Degree

                                        <input type="number" ng-model="obj.rotation.degree">

                                Speed

                                        <slider config="obj.configs.speedConfig"
                                                element-id="orbitObjectRotationSpeed_{{$index}}"
                                                output="obj.rotation.timeout"></slider>

                    </fieldset>

                    <fieldset class="rotation">
                        <legend>Orbit</legend>

                                        Degree

                                        <input type="number" ng-model="obj.orbit.degree">

                                Speed

                                        <slider config="obj.configs.orbitConfig"
                                                element-id="orbitObjectOrbitSpeed_{{$index}}"
                                                output="obj.orbit.timeout"></slider>

                    </fieldset>

            </fieldset>

        </form>

        <inner data="data.inner"></inner>
        <orbit data="obj" idx="{{$index}}" ng-repeat="obj in data.orbits"></orbit>

{{item.dateObj | date:"medium"}}{{item.text}}


text:
Routerer
===================

```
This is how I route.
- Mims ?
```

Slim, testable router.

Install
---------

#### bower

```
bower install --save will-ob/routerer
```

#### npm
```
npm install --save git+ssh://git@github.com:will-ob/routerer.git
```

Use
----------

The easiest way to define a route:

```
var routerer = require('routerer'),
    MyRouter = routerer.createRouter(_, Backbone),
    addRoute = routerer.addRoute;

addRoute(MyRouter, "",  IndexPage);

```

Add some more:

```
//       Router    Path                  Initializing Function

addRoute(MyRouter, "login",                      loginPageInit);
addRoute(MyRouter, "sign-up",                   signUpPageInit);
addRoute(MyRouter, "account",                  accountPageInit);
addRoute(MyRouter, "user/:id/images/:page", userImagesPageInit);
```

Routes can also be added as you might expect if you were subclassing the `Backbone.Router`. Buhhhht, dooooon't - that will take us right back to where we started. (see '[Ok, but why](#ok-but-why)')

When you've got everything configured,

```
var myRouter = new MyRouter();
Backbone.history.start();
```

Ok, but why
---------------

Well, testing - and we'll get to that. But first, uniformity:

Every view gets an `el`, a map of url params, and a reference to the `router`.

```
// navigating to 'user/:id/images/:page', as is
// declared above, is the same as calling:

userImagesPageInit({
  el: $('page-el-owned-by-router'),
  router: myRouter,
  args: {id: "24", page: "742"}
});
```
Views can then set themselves up with any configuration required.

```
userImagesPageInit = function(opts) {
  if(opts == null){ opts = {}; };

  if( opts.router.logged_in ){
    opts.router.navigate('', true);
  } else {
    opts.el.html(signUpForm);
  }

  // Always return a teardown / close method
  return function(){

    // free all the memory!
    $(opts.el).html("");

  }
}
```

The router will always call the close method before navigating to a new page.

Without some enforced consistency, your `router` slips into tragedy. With this set-up, the router is _just_ your routes. You couldn't write a `routeHandler` if you tried. _figure of speech, I'm sure you're quite capable._

At the end of the day, the complexity of your router stays pretty constant. There's no chance developers will have to load an exponentially increasing amout of complexity into their heads each time they want to add _a_ route.

Testing your pages
------------------

When you test your views, you don't have to pass them a real router.

```
context("user is signed in", function(){
  beforeEach(function(){
    this.router = {
      navigate: function(){}
    }
  });

  it("routes to index", function(){
    var spy = sinon.spy(this.router, 'navigate'),
        page = new LoginPage({router: router});

    expect(spy.calledOnce).to.be.true;
    expect(spy.firstCall.args[0]).to.eql('');
    expect(spy.firstCall.args[1]).to.eql(true);
  });
});
```

License
--------

The MIT License (MIT)

Copyright (c) 2014 Will O'Brien


text:
<?php

namespace Icybee\Modules\Sites\Operation;

use ICanBoogie\ErrorCollection;
use ICanBoogie\Operation;

use Icybee\Modules\Sites\Module;
use Icybee\Modules\Sites\Site;

/**
 * Updates the status of a website.
 *
 * @property Site $record
 */
class StatusOperation extends Operation
{
	protected function get_controls()
	{
		return [

			self::CONTROL_PERMISSION => Module::PERMISSION_ADMINISTER

		] + parent::get_controls();
	}

	/**
	 * @inheritdoc
	 */
	protected function validate(ErrorCollection $errors)
	{
		if ($this->request->is_put)
		{
			$status = $this->request['status'];

			if ($status === null || !in_array($status, [ Site::STATUS_OK, Site::STATUS_UNAVAILABLE, Site::STATUS_UNAUTHORIZED, Site::STATUS_NOT_FOUND ]))
			{
				$errors->add('status', "Invalid status value.");
			}
		}

		return $errors;
	}

	protected function process()
	{
		static $status_names = [

			Site::STATUS_OK => 'ok (online)',
			Site::STATUS_UNAVAILABLE => 'unavailable',
			Site::STATUS_UNAUTHORIZED => 'unauthorized',
			Site::STATUS_NOT_FOUND => 'not found (offline)'

		];

		if ($this->request->is_put)
		{
			$status = $this->request['status'];

			$record = $this->record;
			$record->status = $status;
			$record->save();

			$this->response->message = $this->format('The site %title is now ' . $status_names[$status] . '.', [

				'title' => $record->title

			]);
		}

		return $this->record->status;
	}
}