text:
<?php

namespace Symfony\Bundle\SecurityBundle\Command;

use Psr\Container\ContainerInterface;
use Symfony\Bundle\SecurityBundle\Security\FirewallContext;
use Symfony\Bundle\SecurityBundle\Security\LazyFirewallContext;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;

/**
 * @author Timo Bakx <timobakx@gmail.com>
 */
final class DebugFirewallCommand extends Command
{
    protected static $defaultName = 'debug:firewall';
    protected static $defaultDescription = 'Display information about your security firewall(s)';

    private $firewallNames;
    private $contexts;
    private $eventDispatchers;
    private $authenticators;
    private $authenticatorManagerEnabled;

    /**
     * @param string[]                   $firewallNames
     * @param AuthenticatorInterface[][] $authenticators
     */
    public function __construct(array $firewallNames, ContainerInterface $contexts, ContainerInterface $eventDispatchers, array $authenticators, bool $authenticatorManagerEnabled)
    {
        if (!$authenticatorManagerEnabled) {
            trigger_deprecation('symfony/security-bundle', '5.4', 'Setting the $authenticatorManagerEnabled argument of "%s" to "false" is deprecated, use the new authenticator system instead.', __METHOD__);
        }

        $this->firewallNames = $firewallNames;
        $this->contexts = $contexts;
        $this->eventDispatchers = $eventDispatchers;
        $this->authenticators = $authenticators;
        $this->authenticatorManagerEnabled = $authenticatorManagerEnabled;

        parent::__construct();
    }

    protected function configure(): void
    {
        $exampleName = $this->getExampleName();

        $this
            ->setDescription(self::$defaultDescription)
            ->setHelp(<<<EOF
The <info>%command.name%</info> command displays the firewalls that are configured
in your application:

  <info>php %command.full_name%</info>

You can pass a firewall name to display more detailed information about
a specific firewall:

  <info>php %command.full_name% $exampleName</info>

To include all events and event listeners for a specific firewall, use the
<info>events</info> option:

  <info>php %command.full_name% --events $exampleName</info>

EOF
            )
            ->setDefinition([
                new InputArgument('name', InputArgument::OPTIONAL, sprintf('A firewall name (for example "%s")', $exampleName)),
                new InputOption('events', null, InputOption::VALUE_NONE, 'Include a list of event listeners (only available in combination with the "name" argument)'),
            ]);
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new SymfonyStyle($input, $output);

        $name = $input->getArgument('name');

        if (null === $name) {
            $this->displayFirewallList($io);

            return 0;
        }

        $serviceId = sprintf('security.firewall.map.context.%s', $name);

        if (!$this->contexts->has($serviceId)) {
            $io->error(sprintf('Firewall %s was not found. Available firewalls are: %s', $name, implode(', ', $this->firewallNames)));

            return 1;
        }

        /** @var FirewallContext $context */
        $context = $this->contexts->get($serviceId);

        $io->title(sprintf('Firewall "%s"', $name));

        $this->displayFirewallSummary($name, $context, $io);

        $this->displaySwitchUser($context, $io);

        if ($input->getOption('events')) {
            $this->displayEventListeners($name, $context, $io);
        }

        if ($this->authenticatorManagerEnabled) {
            $this->displayAuthenticators($name, $io);
        }

        return 0;
    }

    protected function displayFirewallList(SymfonyStyle $io): void
    {
        $io->title('Firewalls');
        $io->text('The following firewalls are defined:');

        $io->listing($this->firewallNames);

        $io->comment(sprintf('To view details of a specific firewall, re-run this command with a firewall name. (e.g. <comment>debug:firewall %s</comment>)', $this->getExampleName()));
    }

    protected function displayFirewallSummary(string $name, FirewallContext $context, SymfonyStyle $io): void
    {
        if (null === $context->getConfig()) {
            return;
        }

        $rows = [
            ['Name', $name],
            ['Context', $context->getConfig()->getContext()],
            ['Lazy', $context instanceof LazyFirewallContext ? 'Yes' : 'No'],
            ['Stateless', $context->getConfig()->isStateless() ? 'Yes' : 'No'],
            ['User Checker', $context->getConfig()->getUserChecker()],
            ['Provider', $context->getConfig()->getProvider()],
            ['Entry Point', $context->getConfig()->getEntryPoint()],
            ['Access Denied URL', $context->getConfig()->getAccessDeniedUrl()],
            ['Access Denied Handler', $context->getConfig()->getAccessDeniedHandler()],
        ];

        $io->table(
            ['Option', 'Value'],
            $rows
        );
    }

    private function displaySwitchUser(FirewallContext $context, SymfonyStyle $io)
    {
        if ((null === $config = $context->getConfig()) || (null === $switchUser = $config->getSwitchUser())) {
            return;
        }

        $io->section('User switching');

        $io->table(['Option', 'Value'], [
            ['Parameter', $switchUser['parameter'] ?? ''],
            ['Provider', $switchUser['provider'] ?? $config->getProvider()],
            ['User Role', $switchUser['role'] ?? ''],
        ]);
    }

    protected function displayEventListeners(string $name, FirewallContext $context, SymfonyStyle $io): void
    {
        $io->title(sprintf('Event listeners for firewall "%s"', $name));

        $dispatcherId = sprintf('security.event_dispatcher.%s', $name);

        if (!$this->eventDispatchers->has($dispatcherId)) {
            $io->text('No event dispatcher has been registered for this firewall.');

            return;
        }

        /** @var EventDispatcherInterface $dispatcher */
        $dispatcher = $this->eventDispatchers->get($dispatcherId);

        foreach ($dispatcher->getListeners() as $event => $listeners) {
            $io->section(sprintf('"%s" event', $event));

            $rows = [];
            foreach ($listeners as $order => $listener) {
                $rows[] = [
                    sprintf('#%d', $order + 1),
                    $this->formatCallable($listener),
                    $dispatcher->getListenerPriority($event, $listener),
                ];
            }

            $io->table(
                ['Order', 'Callable', 'Priority'],
                $rows
            );
        }
    }

    private function displayAuthenticators(string $name, SymfonyStyle $io): void
    {
        $io->title(sprintf('Authenticators for firewall "%s"', $name));

        $authenticators = $this->authenticators[$name] ?? [];

        if (0 === \count($authenticators)) {
            $io->text('No authenticators have been registered for this firewall.');

            return;
        }

        $io->table(
            ['Classname'],
            array_map(
                static function ($authenticator) {
                    return [
                        \get_class($authenticator),
                    ];
                },
                $authenticators
            )
        );
    }

    private function formatCallable($callable): string
    {
        if (\is_array($callable)) {
            if (\is_object($callable[0])) {
                return sprintf('%s::%s()', \get_class($callable[0]), $callable[1]);
            }

            return sprintf('%s::%s()', $callable[0], $callable[1]);
        }

        if (\is_string($callable)) {
            return sprintf('%s()', $callable);
        }

        if ($callable instanceof \Closure) {
            $r = new \ReflectionFunction($callable);
            if (false !== strpos($r->name, '{closure}')) {
                return 'Closure()';
            }
            if ($class = $r->getClosureScopeClass()) {
                return sprintf('%s::%s()', $class->name, $r->name);
            }

            return $r->name.'()';
        }

        if (method_exists($callable, '__invoke')) {
            return sprintf('%s::__invoke()', \get_class($callable));
        }

        throw new \InvalidArgumentException('Callable is not describable.');
    }

    private function getExampleName(): string
    {
        $name = 'main';

        if (!\in_array($name, $this->firewallNames, true)) {
            $name = reset($this->firewallNames);
        }

        return $name;
    }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef itkMahalanobisDistanceThresholdImageFunction_h
#define itkMahalanobisDistanceThresholdImageFunction_h

#include "itkImageFunction.h"
#include "itkMahalanobisDistanceMembershipFunction.h"

namespace itk
{
/** \class MahalanobisDistanceThresholdImageFunction
 * \brief Returns true if the pixel value of a vector image has a
 * Mahalanobis distance below the value specified by the threshold.
 *
 * This ImageFunction returns true if the pixel value of a vector image has a
 * Mahalanobis distance below the value specided by the threshold. The
 * Mahalanobis distance is computed with the
 * MahalanobisDistanceMembershipFunction class which has to be initialized with
 * a mean and covariance. This class is intended to be used only
 * with images whose pixel type is a vector (array).
 *
 * The input image is set via method SetInputImage().
 *
 * Methods Evaluate, EvaluateAtIndex and EvaluateAtContinuousIndex respectively
 * evaluate the function at an geometric point, image index and continuous
 * image index.
 *
 * \ingroup ImageFunctions
 *
 *
 * \ingroup ITKImageFunction
 */
template< typename TInputImage, typename TCoordRep = float >
class ITK_TEMPLATE_EXPORT MahalanobisDistanceThresholdImageFunction:
  public ImageFunction< TInputImage, bool, TCoordRep >
{
public:
  ITK_DISALLOW_COPY_AND_ASSIGN(MahalanobisDistanceThresholdImageFunction);

  /** Standard class type aliases. */
  using Self = MahalanobisDistanceThresholdImageFunction;
  using Superclass = ImageFunction< TInputImage, bool, TCoordRep >;
  using Pointer = SmartPointer< Self >;
  using ConstPointer = SmartPointer< const Self >;

  /** Run-time type information (and related methods). */
  itkTypeMacro(MahalanobisDistanceThresholdImageFunction, ImageFunction);

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** InputImageType type alias support */
  using InputImageType = typename Superclass::InputImageType;

  /** Typedef to describe the type of pixel. */
  using PixelType = typename TInputImage::PixelType;

  /** Dimension underlying input image. */
  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;

  /** Point type alias support */
  using PointType = typename Superclass::PointType;

  /** Index type alias support */
  using IndexType = typename Superclass::IndexType;

  /** ContinuousIndex type alias support */
  using ContinuousIndexType = typename Superclass::ContinuousIndexType;

  /** Type used to represent the Covariance matrix of the vector population. */
  using CovarianceMatrixType = vnl_matrix< double >;

  /** Type used to represent the Mean Vector of the vector population. */
  using MeanVectorType = vnl_vector< double >;

  /** BinaryThreshold the image at a point position
   *
   * Returns true if the image intensity at the specified point position
   * satisfies the threshold criteria. The point is assumed to lie within
   * the image buffer.
   *
   * ImageFunction::IsInsideBuffer() can be used to check bounds before
   * calling the method. */
  bool Evaluate(const PointType & point) const override;

  /** BinaryThreshold the image at a continuous index position
   *
   * Returns true if the image intensity at the specified point position
   * satisfies the threshold criteria. The point is assumed to lie within
   * the image buffer.
   *
   * ImageFunction::IsInsideBuffer() can be used to check bounds before
   * calling the method. */
  bool EvaluateAtContinuousIndex(
    const ContinuousIndexType & index) const override;

  /** BinaryThreshold the image at an index position.
   *
   * Returns true if the image intensity at the specified point position
   * satisfies the threshold criteria.  The point is assumed to lie within
   * the image buffer.
   *
   * ImageFunction::IsInsideBuffer() can be used to check bounds before
   * calling the method. */
  bool EvaluateAtIndex(const IndexType & index) const override;

  /** Returns the actual value of the MahalanobisDistance at that point.
   * The point is assumed to lie within the image buffer.
   * ImageFunction::IsInsideBuffer() can be used to check bounds before
   * calling the method. */
  virtual double EvaluateDistance(const PointType & point) const;

  /** Returns the actual value of the MahalanobisDistance at that index.
   * The point is assumed to lie within the image buffer.
   * ImageFunction::IsInsideBuffer() can be used to check bounds before
   * calling the method. */
  virtual double EvaluateDistanceAtIndex(const IndexType & index) const;

  /** Get the lower threshold value. */
  itkGetConstReferenceMacro(Threshold, double);
  itkSetMacro(Threshold, double);

  /** Set the mean.
   * Set this mean value to the membership function. */
  void SetMean(const MeanVectorType & mean);

  /** Get the mean.
   * The mean set on the membership function matches this value. */
  itkGetConstReferenceMacro(Mean, MeanVectorType);

  /** Set the covariance matrix.
   * Set this covariance matrix to the membership function. */
  void SetCovariance(const CovarianceMatrixType & cov);

  /** Get the covariance matrix.
   * The covariance matrix set on the membership function matches this value. */
  itkGetConstReferenceMacro(Covariance, CovarianceMatrixType);

protected:
  MahalanobisDistanceThresholdImageFunction();
  ~MahalanobisDistanceThresholdImageFunction() override = default;
  void PrintSelf(std::ostream & os, Indent indent) const override;

private:
  double m_Threshold;

  // This is intended only for Image of Vector pixel type.
  using MahalanobisDistanceFunctionType = Statistics::MahalanobisDistanceMembershipFunction<PixelType>;

  using MahalanobisDistanceFunctionPointer = typename MahalanobisDistanceFunctionType::Pointer;
  MahalanobisDistanceFunctionPointer m_MahalanobisDistanceMembershipFunction;

  // Cached versions of the mean and covariance to manage the
  // difference in vector/matrix types between this class and the
  // membership function used internally.
  MeanVectorType       m_Mean;
  CovarianceMatrixType m_Covariance;
};
} // end namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkMahalanobisDistanceThresholdImageFunction.hxx"
#endif

#endif


text:
from django.test import TestCase
from eventex.core.models import Speaker
from django.shortcuts import resolve_url as r

class SpeakerModelTest(TestCase):
    def setUp(self):
        self.speaker = Speaker.objects.create(
            name='Grace Hopper',
            slug='grace-hopper',
            website='http://hbn.link/hopper-site',
            photo='http://hbn.link/hopper-pic',
            description='Programadora e almirante.',
        )

    def test_create(self):
        self.assertTrue(Speaker.objects.exists())

    def test_description_can_be_blank(self):
        field = Speaker._meta.get_field('description')
        self.assertTrue(field.blank)

    def test_website_can_be_blank(self):
        field = Speaker._meta.get_field('website')
        self.assertTrue(field.blank)

    def test_str(self):
        self.assertEqual('Grace Hopper', str(self.speaker))

    def test_get_absolute_url(self):
        url = r('speaker_detail', slug=self.speaker.slug)
        self.assertEqual(url, self.speaker.get_absolute_url())


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESolutions.Web.UI;

namespace ESolutions.Web.Tests
{
	[ESolutions.Web.UI.PageUrl("~/TestWebPage4.aspx")]
	public class TestWebPage4 : System.Web.UI.Page
	{
		public class Query : ActiveQueryBase<Query>
		{
			#region Id
			[UrlParameter]
			public Int32 Id
			{
				get;
				set;
			}
			#endregion

			#region Text
			[UrlParameter]
			public String Text
			{
				get;
				set;
			}
			#endregion
		}
	}
}


text:
'use strict';

// MODULES //

var PACKAGE_DATA_CACHE = require( 'pkg-data-cache' );

// MAIN //

/**
* Retrieves the list of namespace packages for a specified version.
*
* @private
* @param {string} version - version
* @returns {(StringArray|null)} namespace list
*/
function namespaceList( version ) {
	var o = PACKAGE_DATA_CACHE[ version ];
	if ( o ) {
		if ( o.namespaces ) {
			return o.namespaces;
		}
	}
	return null;
}

// EXPORTS //

module.exports = namespaceList;


text:
/*=================================\
* PlotterControl\Curve_ArchimedeanSpiral.cs
*
* The Coestaris licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*
* Created: 17.06.2017 21:04
* Last Edited: 18.08.2017 20:26:46
*=================================*/

using CnC_WFA;
using CWA.Vectors;
using System;
using System.Drawing;
using System.Reflection;
using System.Runtime.InteropServices;

/*ASSEMBLY INFO*/
namespace Plugins
{
    static class CurvePlugin
    {
        static private CurveInfo _info;

        public static void Init()
        {
            _info = new CurveInfo();
            _info.LearnMore = "https://ru.wikipedia.org/wiki/%D0%90%D1%80%D1%85%D0%B8%D0%BC%D0%B5%D0%B4%D0%BE%D0%B2%D0%B0_%D1%81%D0%BF%D0%B8%D1%80%D0%B0%D0%BB%D1%8C";
            _info.Name = "Спираль Архимеда";
            _info.Discription =
@"   Архимедова спираль — спираль, плоская кривая, траектория точки M, которая
равномерно движется вдоль луча OV сначалом в O, в то время как сам луч
OV равномерно вращается вокруг O. Другими словами, расстояние ρ = OM
пропорционально углу поворота φ луча OV. Повороту луча OV на один и тот же
угол соответствует одно и то же приращение ρ.";
            _info.Creator =
@"   Архимедова спираль была открыта Архимедом. Это произошло в III веке до н.э.,
когда он экспериментировал с компасом.Он тянул стрелку компаса с постоянной
скоростью, вращая сам компас по часовой стрелке. Получившаяся кривая была c
пиралью, которая сдвигались на ту же величину, на которую поворачивался компас,
и между витками спирали сохранялось одно и то же расстояние.";
            _info.Usage =
@"   В III веке да нашей эры Архимед на основе своей спирали изобрёл винт, который
успешно применяли для передачи воды в оросительные каналы из водоёмов,
расположенных ниже. Позже на основе винта Архимеда создали шнек («улитку»). Его
очень известная разновидность – винтовой ротор в мясорубке. Шнек используют
в механизмах для перемешивания материалов различной консистенции. В технике
нашли применение антенны в виде спирали Архимеда.Самоцентрирующийся патрон
выполнен по спирали Архимеда. Звуковые дорожки на CD и DVD дисках также имеют
форму спирали Архимеда. Спираль Архимеда нашла практическое применение в математике,
технике, архитектуре, машиностроении.";
            _info.MathematicalBasis = "p = k * phi";
        }

        public static CurveExample Exmpl1()
        {
            return new CurveExample() { Discr = "Спираль Архимеда при k = 1", image = PreviewImage(new Size(300, 300), 1, null, 25) };
        }

        public static CurveExample Exmpl2()
        {
            return new CurveExample() { Discr = "Спираль Архимеда при k = 3,\nесли phi > 0 и k = -4, если phi < 0", image = PreviewImage_(new Size(300, 300), 3, -4, true, null, 7) };
        }

        public static Image PreviewImage(Size size, double k, object ob, double CountOfCls)
        {
            var a = new Bitmap(size.Height, size.Width);
            using (Graphics gr = Graphics.FromImage(a))
            {
                DrawCurve(gr, size, k, k, false, ob, CountOfCls);
            }
            return a;
        }

        public static Image PreviewImage_(Size size, double k1, double k2, bool useneg, object ob, double CountOfCls)
        {
            var a = new Bitmap(size.Height, size.Width);
            using (Graphics gr = Graphics.FromImage(a))
            {
                DrawCurve(gr, size, k1, k2, useneg, ob, CountOfCls);
            }
            return a;
        }

        public static GifImage PreviewImageGif()
        {
            return null;
        }

        public static Vector GetVector(ToVectorParams param)
        {
            return null;
        }

        public static CurveInfo GetInfo()
        {
            return _info;
        }

        private static void DrawCurve(Graphics graphics, Size size, double kpositive, double knegative, bool usenegative, object ob, double CountOfCls)
        {
            double TwoPi = 2 * Math.PI;
            double Step = TwoPi / 360;
            int Scale = 10;
            var pen = new Pen(Color.Black);
            int centerX = size.Width / 2, centerY = size.Height / 2;
            graphics.Clear(Color.White);
            graphics.DrawLine(pen, 0, centerY, centerX * 2, centerY);
            graphics.DrawLine(pen, centerX, 0, centerX, centerY * 2);
            pen = new Pen(Color.Green);
            int oldX = centerX, oldY = centerY;
            for (double i = usenegative ? -(CountOfCls * TwoPi) : 0; i < CountOfCls * TwoPi; i += Step)
            {
                double p = 0;
                double alpha = Scale * i / TwoPi;

                if (i < 0) p = knegative * alpha;
                else p = kpositive * alpha;

                var x = (int)(p * Math.Cos(i)) + centerX;
                var y = (int)(p * Math.Sin(i)) + centerY;
                graphics.DrawLine(pen, oldX, oldY, x, y);
                oldX = x;
                oldY = y;
            }
        }
    }
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * RobotHealth.java
 *
 * Created on 22.02.2012, 19:12:12
 */
package de.naoth.rc.dialogs;

import com.google.protobuf.InvalidProtocolBufferException;
import de.naoth.rc.RobotControl;
import de.naoth.rc.core.dialog.AbstractDialog;
import de.naoth.rc.core.dialog.DialogPlugin;
import de.naoth.rc.core.dialog.RCDialog;
import de.naoth.rc.core.manager.ObjectListener;
import de.naoth.rc.drawings.Drawable;
import de.naoth.rc.manager.GenericManagerFactory;
import de.naoth.rc.core.messages.FrameworkRepresentations;
import de.naoth.rc.core.server.Command;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;
import net.xeoh.plugins.base.annotations.PluginImplementation;
import net.xeoh.plugins.base.annotations.injections.InjectPlugin;

/**
 *
 * @author admin
 */
public class RobotHealth extends AbstractDialog
{

  @RCDialog(category = RCDialog.Category.Status, name = "RobotHealth")
  @PluginImplementation
  public static class Plugin extends DialogPlugin<RobotHealth>
  {
      @InjectPlugin
      public static RobotControl parent;
      @InjectPlugin
      public static GenericManagerFactory genericManagerFactory;
  }//end Plugin

  private final Command getFSRDataCommand = new Command("Cognition:representation:get").addArg("FSRData");
  private final Command getSensorJointDataCommand = new Command("Cognition:representation:get").addArg("SensorJointData");

  private final DecimalFormat fsr_df = new DecimalFormat  ( "##0.00" );

  private final DecimalFormat heat_df = new DecimalFormat  ( "##0" );
  private final DecimalFormat current_df = new DecimalFormat  ( "0000" );

  private final FSRDataListener fSRDataListener = new FSRDataListener();
  private final SensorJointDataListener sensorJointDataListener = new SensorJointDataListener();

  private BufferedImage nao_body;
  private BufferedImage nao_feet;

  private final int nao_feet_offset_x = 300;
  private final int nao_feet_offset_y = 0;

  private final String jointNames[] = {
      "HeadPitch",
      "HeadYaw",

      "RShoulderRoll",
      "LShoulderRoll",
      "RShoulderPitch",
      "LShoulderPitch",
      "RElbowRoll",
      "LElbowRoll",
      "RElbowYaw",
      "LElbowYaw",

      "(L/R)HipYawPitch",
      "",

      "RHipPitch",
      "LHipPitch",
      "RHipRoll",
      "LHipRoll",
      "RKneePitch",
      "LKneePitch",
      "RAnklePitch",
      "LAnklePitch",
      "RAnkleRoll",
      "LAnkleRoll",

      "LWristYaw",
      "RWristYaw",
      "LHand",
      "RHand"
  };

  private final int joints[] = { // order equals "JointData.h"
                     0,  1080, // HeadPitch
                     0,  920, // HeadYaw

                   340,  760, // RShoulderRoll
                  -340,  760, // LShoulderRoll
                   420,  600, // RShoulderPitch
                  -420,  600, // LShoulderPitch

                   600,  200, // RElbowRoll
                  -600,  200, // LElbowRoll
                   600,  360, // RElbowYaw
                  -600,  360, // LElbowYaw

                     0,  110, // RHipYawPitch
                   - 0,  110, // LHipYawPitch

                   260, -100, // RHipPitch
                  -260, -100, // LHipPitch
                   260, -260, // RHipRoll
                  -260, -260, // LHipRoll

                   260, -500, // RKneePitch
                  -260, -500, // LKneePitch

                   260, -850, // RAnklePitch
                  -260, -850, // LAnklePitch
                   260, -1010, // RAnkleRoll
                  -260, -1010, // LAnkleRoll

                  -600,  0, // LWristYaw
                   600,  0, // RWristYaw
                  -600, -150, // LHand
                   600, -150, // RHand
      };

  private final MicroPlot[] jointPlots = new MicroPlot[jointNames.length];
  private final JointState[] jointStates = new JointState[jointNames.length];

  // ATTENTION: the order is the same as the in the NaoTH-2011
  private final FSRState[] theFSRStates = new FSRState[]{
      new FSRState(45, 84, 10), // theLFsrFL
      new FSRState(139, 85, 10), // theLFsrFR
      new FSRState(45, 262, 10), // theLFsrBL
      new FSRState(133, 262, 10), // theLFsrBR

      new FSRState(262, 84, 10), // theRFsrFL
      new FSRState(356, 85, 10), // theRFsrFR
      new FSRState(270, 262, 10), // theRFsrBL
      new FSRState(356, 262, 10) // theRFsrBR
   };

    /** Creates new form RobotHealth */
    public RobotHealth() {
        initComponents();

        try {
            nao_body = ImageIO.read(getClass().getResource("/de/naoth/rc/res/nao_body_bw.png"));
            nao_feet = ImageIO.read(getClass().getResource("/de/naoth/rc/res/nao_feet_bw.png"));

            /*
            Color fade_color = new Color(255,255,255,200);
            Graphics2D g2d = nao_body.createGraphics();
            g2d.setColor(fade_color);
            g2d.fillRect(0, 0, nao_body.getWidth(), nao_body.getHeight());
            g2d = nao_feet.createGraphics();
            g2d.setColor(fade_color);
            g2d.fillRect(0, 0, nao_feet.getWidth(), nao_feet.getHeight());
            */
        } catch (IOException e) {
        }

        for(int i = 0; i < jointNames.length; i++) {
            jointPlots[i] = new MicroPlot(-30, 30);
            jointStates[i] = new JointState(jointNames[i], 10);
        }

        this.drawingPanel.setBackground(Color.white);
    }

    @Override
    public void dispose()
    {
        Plugin.genericManagerFactory.getManager(getFSRDataCommand).removeListener(fSRDataListener);
        Plugin.genericManagerFactory.getManager(getSensorJointDataCommand).removeListener(sensorJointDataListener);
    }

    // this is called by the drawingPanel.paintComponent(...)
    // see: (NetBeans) Properties: "Custom Creation Code" for drawingPanel
      public void paintDrawingComponent(Graphics g)
      {
        Graphics2D g2d = (Graphics2D) g;

        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

        g2d.drawImage(nao_body, null, 0, 0);
        g2d.drawImage(nao_feet, null, nao_feet_offset_x, nao_feet_offset_y);

        Color fade_color = new Color(255,255,255,200);
        g2d.setColor(fade_color);
        g2d.fillRect(0, 0, this.getWidth(), this.getHeight());

        /*
        g2d.setColor(new Color(200,230,255,180));
        g2d.fillRect(0, 0, 1000, 1000);
        g2d.setColor(Color.black);
        */
        g2d.translate(nao_feet_offset_x, nao_feet_offset_y);
        for(FSRState fsr: theFSRStates) {
            fsr.draw(g2d);
        }
        g2d.translate(-nao_feet_offset_x, -nao_feet_offset_y);

        g2d.translate(150, 40);
        int numberOfJoints = jointStates.length;
        for(int i = 0; i < numberOfJoints; i++)
        {
            int x = (joints[0] - joints[i*2])/5;// mirror horizontal
            int y = (joints[1] - joints[i*2+1])/5; // mirror vertical
            g2d.translate(x, y);
            jointStates[i].draw(g2d);
            jointPlots[i].draw(g2d);
            g2d.translate(-x,-y);
        }
        g2d.translate(-150, -40);
      }//end paintComponent

    class FSRDataListener implements ObjectListener<byte[]>
    {
        @Override
        public void errorOccured(String cause) {
            Plugin.genericManagerFactory.getManager(getFSRDataCommand).removeListener(this);
            Logger.getLogger(RobotHealth.class.getName()).log(Level.SEVERE, null, cause);
        }

        @Override
        public void newObjectReceived(byte[] object)
        {
          try
          {
            FrameworkRepresentations.FSRData fsrData =
                    FrameworkRepresentations.FSRData.parseFrom(object);

            for(int i = 0; i < theFSRStates.length; i++) {
                theFSRStates[i].setValue(fsrData.getData(i));
            }
            RobotHealth.this.repaint();
          }
          catch (InvalidProtocolBufferException ex)
          {
            //ex.printStackTrace();
            Logger.getLogger(RobotHealth.class.getName()).log(Level.SEVERE, null, ex);
            errorOccured(ex.getMessage());
            String msg = new String(object);
            JOptionPane.showMessageDialog(null,msg, "Error", JOptionPane.ERROR_MESSAGE);
          }
        }//end newObjectReceived
    }//end class FSRDataListener

    class SensorJointDataListener implements ObjectListener<byte[]>
    {
        @Override
        public void errorOccured(String cause) {
            Plugin.genericManagerFactory.getManager(getSensorJointDataCommand).removeListener(this);
            Logger.getLogger(RobotHealth.class.getName()).log(Level.SEVERE, null, cause);
        }

        @Override
        public void newObjectReceived(byte[] object)
        {
          try
          {
            FrameworkRepresentations.SensorJointData sensorJointData =
                    FrameworkRepresentations.SensorJointData.parseFrom(object);

            for(int i = 0; i < sensorJointData.getTemperatureCount(); i++)
            {
                //double v = sensorJointData.getJointData().getPosition(i)*10;
                double v = sensorJointData.getElectricCurrent(i)*10;
                jointPlots[i].setValue(v);
                jointStates[i].setTemperature((int)sensorJointData.getTemperature(i));
                jointStates[i].setCurrent(sensorJointData.getElectricCurrent(i));
            }

            RobotHealth.this.repaint();
          }
          catch (InvalidProtocolBufferException ex)
          {
            //ex.printStackTrace();
            Logger.getLogger(RobotHealth.class.getName()).log(Level.SEVERE, null, ex);
            errorOccured(ex.getMessage());
            String msg = new String(object);
            JOptionPane.showMessageDialog(null,msg, "Error", JOptionPane.ERROR_MESSAGE);
          }
        }//end newObjectReceived
    }//end class SensorJointDataListener

    class FSRState implements Drawable
    {
        private final int x;
        private final int y;
        private final int radius;
        private double value;

        public FSRState(int x, int y, int radius) {
            this.x = x;
            this.y = y;
            this.radius = radius;
        }

        public void setValue(double value){ this.value = value; }

        @Override
        public void draw(Graphics2D g2d)
        {
            g2d.setColor(getColor(0, 1.27f, (float)value));
            g2d.fillOval(x-radius, y-radius, radius*2, radius*2);

            g2d.setColor(Color.black);
            g2d.drawOval(x-radius, y-radius, radius*2, radius*2);

            g2d.drawString("["+fsr_df.format(value)+"]", x+radius+3, y);
        }
    }

    class JointState implements Drawable
    {
        //private final int x;
        //private final int y;
        private final int radius;
        private final String name;
        private int temperature;
        private double current;

        public JointState(String name, int radius) {
            //this.x = x;
            //this.y = y;
            this.radius = radius;
            this.name = name;
        }

        public void setTemperature(int value)
        {
            this.temperature = value;
        }

        public void setCurrent(double value)
        {
            this.current = value;
        }

        @Override
        public void draw(Graphics2D g2d)
        {
            //double value = sensorJointData.getJointData().getPosition(i);
            g2d.setColor(getColorMix(0, 85f, (float)temperature));
            g2d.fillOval(-radius, -radius, radius*2, radius*2);
            g2d.setColor(Color.black);
            g2d.drawString(heat_df.format(temperature)+"("+current_df.format(current*1000)+")", 10, 12);
            g2d.drawString(name, 10, -3);
        }
    }

    private Color getColor(float min, float max, float v)
    {
        //float min = 0;
        //float max = 12.5f;

        if(v > max) {
            return Color.black;
        }

        float t = Math.max(Math.min(v,max),min);
        float d = (t-min)/(max - min);

        return new Color(1.0f,0,0.0f, d);
    }//end getColor

    private Color getColorMix(float min, float max, float v)
    {
        //float min = 0;
        //float max = 12.5f;

        if(v > max) {
            return Color.black;
        }

        float t = Math.max(Math.min(v,max),min);
        float d = (t-min)/(max - min);

        return new Color(d,1.0f-d,0.0f);
    }//end getColor

    class MicroPlot implements Drawable
    {
        private final int min;
        private final int max;
        private final int samples = 20;
        private final int step = 3;
        //private final int height = 30;

        private final List<Double> values = Collections.synchronizedList(new ArrayList<Double>());

        public MicroPlot(int min, int max) {
            this.min = min;
            this.max = max;
        }

        public void setValue(double value)
        {
            values.add(value);
            if(values.size() > samples) {
                values.remove(0);
            }
        }

        @Override
        public void draw(Graphics2D g2d)
        {
            //g2d.setColor(Color.white);
            //g2d.fillRect(0, 0, samples, height);

            if(values.isEmpty()) {
                return;
            }

            double last = values.get(0);
            int lastX = 0;

            synchronized(values) {
                for(Double d: values)
                {
                    // HACK: invert because of coordinate system
                    double value = -d.doubleValue();
                    g2d.setColor(getColorMix(min, max, (float)value));
                    g2d.drawLine(lastX, (int)last, lastX+step, (int)value);

                    last = value;
                    lastX += step+1;
                }
            }
        }
    }//end class MicroPlot

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jToolBar1 = new javax.swing.JToolBar();
        btReceiveDrawings = new javax.swing.JToggleButton();
        drawingPanel = new javax.swing.JPanel()
        {
            public synchronized void paintComponent(Graphics g)
            {
                super.paintComponent(g);
                // call the parent painter method
                paintDrawingComponent(g);
            }
        };

        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);

        btReceiveDrawings.setText("Receive");
        btReceiveDrawings.setFocusable(false);
        btReceiveDrawings.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btReceiveDrawings.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btReceiveDrawings.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btReceiveDrawingsActionPerformed(evt);
            }
        });
        jToolBar1.add(btReceiveDrawings);

        javax.swing.GroupLayout drawingPanelLayout = new javax.swing.GroupLayout(drawingPanel);
        drawingPanel.setLayout(drawingPanelLayout);
        drawingPanelLayout.setHorizontalGroup(
            drawingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        drawingPanelLayout.setVerticalGroup(
            drawingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 275, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
            .addComponent(drawingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(drawingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void btReceiveDrawingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btReceiveDrawingsActionPerformed
        if(btReceiveDrawings.isSelected()) {
            if(Plugin.parent.checkConnected()) {
                Plugin.genericManagerFactory.getManager(getFSRDataCommand).addListener(fSRDataListener);
                Plugin.genericManagerFactory.getManager(getSensorJointDataCommand).addListener(sensorJointDataListener);
            } else {
                btReceiveDrawings.setSelected(false);
            }
        } else {
            Plugin.genericManagerFactory.getManager(getFSRDataCommand).removeListener(fSRDataListener);
            Plugin.genericManagerFactory.getManager(getSensorJointDataCommand).removeListener(sensorJointDataListener);
        }
}//GEN-LAST:event_btReceiveDrawingsActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToggleButton btReceiveDrawings;
    private javax.swing.JPanel drawingPanel;
    private javax.swing.JToolBar jToolBar1;
    // End of variables declaration//GEN-END:variables
}


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">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Hotel Positiv</title>

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

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

    <link href="../font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href='http://fonts.googleapis.com/css?family=Roboto:400,500,700' rel='stylesheet' type='text/css'>

Welkom terug!

Lobby

Lounge

Mijn kamer

Receptie

Bar

Welkom Tania Miller!

Drankje doen?

                        <input type="search" class="zoekchat" placeholder="Of zoek je iemand?">

Chats

                            Yvonne

Ja is goed afgesproken!

Bekijk
<span class="glyphicon glyphicon-chevron-right"

                            Jack

Nee is goed joh! Dan zie ik je daar om 17:00.

Bekijk
<span class="glyphicon glyphicon-chevron-right"

                            Oliver

Bedankt voor jou positief bericht :)

Bekijk
<span class="glyphicon glyphicon-chevron-right"


text:
require File.expand_path('../volume', __FILE__)

module Fog
  module Compute
    class ProfitBricks
      class Volumes < Fog::Collection
        model Fog::Compute::ProfitBricks::Volume

        def all
          load(service.get_all_storages.body["getAllStoragesResponse"])
        end

        def get(id)
          volume = service.get_storage(id).body["getStorageResponse"]
          Excon::Errors
          new(volume)
        rescue Excon::Errors::NotFound
          nil
        end
      end
    end
  end
end


text:
using Tins::Dot11ControlTA;

inline void test_equals(const Dot11ControlTA& b1, const Dot11ControlTA& b2) {
    EXPECT_EQ(b1.target_addr(), b2.target_addr());
    test_equals(static_cast<const Dot11&>(b1), static_cast<const Dot11&>(b2));
}

inline void test_equals_expected(const Dot11ControlTA& dot11) {
    EXPECT_EQ(dot11.target_addr(), "01:02:03:04:05:06");
    EXPECT_EQ(dot11.addr1(), "00:01:02:03:04:05");
}

inline void test_equals_empty(const Dot11ControlTA& dot11) {
    Dot11::address_type empty_addr;

    EXPECT_EQ(dot11.target_addr(), empty_addr);
    EXPECT_EQ(dot11.addr1(), empty_addr);
}

#endif // TINS_TEST_DOT11_CONTROL_H


text: Website for Space and Time Studios in Santa Ana, CA


text:
import { Component } from '@angular/core';

/**
 * Specifies content to display inside a padded section of a SkyTileContentComponent.
 */
@Component({
  selector: 'sky-tile-content-section',
  styleUrls: ['./tile-content-section.component.scss'],
  templateUrl: './tile-content-section.component.html',
})
export class SkyTileContentSectionComponent {}


text:
@implementation HCIsTypeOf

+ (instancetype)isTypeOf:(Class)type
{
    return [[self alloc] initWithType:type];
}

- (BOOL)matches:(id)item
{
    return [item isMemberOfClass:theClass];
}

- (NSString *)expectation
{
    return @"an exact instance of ";
}

@end

id HC_isA(Class aClass)
{
    return [HCIsTypeOf isTypeOf:aClass];
}


text:
$exceptionHandler
(service in module ng
)

Improve this doc
Description

Any uncaught exception in angular expressions is delegated to this service.
The default implementation simply delegates to $log.error which logs it into
the browser console.

In unit tests, if angular-mocks.js is loaded, this service is overridden by
mock $exceptionHandler which aids in testing.

Dependencies

$log

Usage

$exceptionHandler(exception[, cause]);

Parameters

exception – {Error} –

Exception associated with the error.

cause(optional) – {string=} –

optional information about the context in which
the error was thrown.


text:
var sinon = require('sinon'),
  expect = require('chai').expect,
  path = require('path'),
  UserInfo = require('../../../../lib/daemon/common/UserInfo')

describe('UserInfo', function () {
  var userInfo

  beforeEach(function () {
    userInfo = new UserInfo()
    userInfo._posix = {
      getgrnam: sinon.stub(),
      getpwnam: sinon.stub()
    }
  })

  it('find uid/gid', function () {
    var groupName = 'foo'
    var gid = 10

    var userName = 'bar'
    var uid = 11

    userInfo._posix.getgrnam.withArgs(groupName).returns({
      gid: gid,
      name: groupName
    })
    userInfo._posix.getpwnam.withArgs(userName).returns({
      uid: uid,
      name: userName
    })

    process.env.GUVNOR_RUN_AS_GROUP = groupName
    process.env.GUVNOR_RUN_AS_USER = userName

    userInfo.afterPropertiesSet()

    expect(userInfo.getGid()).to.equal(gid)
    expect(userInfo.getGroupName()).to.equal(groupName)
    expect(userInfo.getUid()).to.equal(uid)
    expect(userInfo.getUserName()).to.equal(userName)
  })
})


text:
title: "Good Types Reduce Bugs"
summary: "The advantages of working in a type-safe language extend beyond the compiler complaining that it received an Double but expected an Int. Developers can use the Swift type system to enforce complex invariants rather than relying on mere conventions or other fragile means, but reaping the benefits requires some forethought and of bit careful design. I use an example modeling a network connection to illustrate this idea."
tags: [Swift, Type Safety]
toc:
  - title: A Naive Approach
    link: /#a-naive-approach
  - title: A Better Solution
    link: /#a-better-solution
  - title: Summary
    link: /#summary
---
It is largely accepted in the Swift community that the type system reduces bugs. There are trivial examples of the compiler catching mistakes such as passing the wrong numeric type to function. This class of bug is found with no help needed from developer. True enough. But when the developer does make the effort to carefully design types, then the more profound benefits of strong, static typing become available.

{% include toc.html %}

## A Naive Approach

Here's one way to represent the state of a network connection.

{% highlight swift %}
enum ConnectionState {
    case connecting
    case connected
    case disconnected
}
struct ConnectionInfo {
    let state: ConnectionState
    let server: IPAddress
    let lastPingTime: Date?
    let lastPingId: Int?
    let sessionId: String?
    let initiated: Date?
    let disconnected: Date?
}
{% endhighlight %}

The `ConnectionState` is a simple enum with three possible cases. The `ConnectionInfo` struct provides information about different aspects of a connection. The `state` and the `server` fields are required, the rest are optional. The optional fields are not populated willy-nilly: they operate under strict invariants:

  -  `lastPingTime` and `lastPingId` are used to keep the connection alive. They are optional because **they should only be present when `state` is `connected`, and in that case both must be present.**
  - `sessionId` is a unique identifier for each new connection and **it should only be present when `state` is `connected`.**
  - `initiated` is a timestamp used to determine whether the attempt to connect should continue. **It should only be present when `state` is `connecting`.**
  - Similarly, `disconnected` is a timestamp but is used to record when the connect disconnected. **It should only be present when `state` is `disconnected`.**

There are numerous ways this code can break. Preventing that requires precise documentation. Each client must be subjected to complex tests to confirm it is using this code correctly. Therefore, it requires *continuous vigilance* on the part of developers to maintain these invariants.

## A Better Solution

What we want is to be able to write the code once and forget it, confident that it works and cannot be abused. That's the dream anyway, and we can get close if we think carefully about our types. As it turns out, these invariants can be baked directly into the code. Then, you don't need to document how the code works, that would be like explaining how Swift itself works. It doesn't need complex tests, because you don't need to test Swift.

{% highlight swift %}

struct Ping {
    let time: Date
    let id: Int
}
enum ConnectionState {
    case connecting(initiated: Date)
    case connected(lastPing: Ping?, sessionId: String)
    case disconnected(disconnected: Date)
}
struct ConnectionInfo {
    let state: ConnectionState
    let server: IPAddress
}

{% endhighlight %}

`ConnectionInfo` has simplified down to its bare requirements: it must have a `state` and an `server` address. The previous optional fields have been moved to associated types on their appropriate cases.

  - When the `state` is `connecting`, there **must** be a date stored right there in the case.
  - When the `state` is `connected`, there **must** be a `sessionId` instance available just the to `connected` instance. There **may** be an instance of `Ping` as well, only if any pings were sent. But you know that `lastPing`, if it is not nil, will have both a `time` and an `id`.
  - When `state` is `disconnected`, you can depend on the `disconnected` timestamp to be available.

## Summary

Now that the invariants are part of the types themselves, the compiler can detect and reject code that violates these invariants. This is less work and more reliable than trying to maintain these invariants by hand. Both examples are valid Swift, but the second is superior because it shifts more overhead from the developer to the language.

## Further Reading

  - [Enumerations](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Enumerations.html#//apple_ref/doc/uid/TP40014097-CH12-ID145) See the part especially about Associated Values.
  - [OCaml for the Masses](https://cacm.acm.org/magazines/2011/11/138203-ocaml-for-the-masses/fulltext) (...where I stole my example. There is much other insightful information here too. It is about OCaml but is nevertheless relevant to Swift.)
  - [Serializing Enums with Associated Values](http://proxpero.com/2017/07/11/encoding-and-decoding-custom-enums-with-associated-values-in-swift-4/) (Shameless!)


text:
protoc.exe --plugin=protoc-gen-cs.exe --cs_out="-generated_code_attributes=true :." .\ChromeCastAudioStream.proto

pause


text:
namespace chrome {

using ChromeContentBrowserClientTest = testing::Test;

TEST_F(ChromeContentBrowserClientTest, ShouldAssignSiteForURL) {
  ChromeContentBrowserClient client;
  EXPECT_FALSE(client.ShouldAssignSiteForURL(GURL("chrome-native://test")));
  EXPECT_TRUE(client.ShouldAssignSiteForURL(GURL("http://www.google.com")));
  EXPECT_TRUE(client.ShouldAssignSiteForURL(GURL("https://www.google.com")));
}

// BrowserWithTestWindowTest doesn't work on iOS and Android.
#if !defined(OS_ANDROID) && !defined(OS_IOS)

using ChromeContentBrowserClientWindowTest = BrowserWithTestWindowTest;

static void DidOpenURLForWindowTest(content::WebContents** target_contents,
                                    content::WebContents* opened_contents) {
  DCHECK(target_contents);

  *target_contents = opened_contents;
}

// This test opens two URLs using ContentBrowserClient::OpenURL. It expects the
// URLs to be opened in new tabs and activated, changing the active tabs after
// each call and increasing the tab count by 2.
TEST_F(ChromeContentBrowserClientWindowTest, OpenURL) {
  ChromeContentBrowserClient client;

  int previous_count = browser()->tab_strip_model()->count();

  GURL urls[] = { GURL("https://www.google.com"),
                  GURL("https://www.chromium.org") };

  for (const GURL& url : urls) {
    content::OpenURLParams params(url,
                                  content::Referrer(),
                                  NEW_FOREGROUND_TAB,
                                  ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
                                  false);
    // TODO(peter): We should have more in-depth browser tests for the window
    // opening functionality, which also covers Android. This test can currently
    // only be ran on platforms where OpenURL is implemented synchronously.
    // See https://crbug.com/457667.
    content::WebContents* web_contents = nullptr;
    client.OpenURL(browser()->profile(),
                   params,
                   base::Bind(&DidOpenURLForWindowTest, &web_contents));

    EXPECT_TRUE(web_contents);

    content::WebContents* active_contents = browser()->tab_strip_model()->
        GetActiveWebContents();
    EXPECT_EQ(web_contents, active_contents);
    EXPECT_EQ(url, active_contents->GetVisibleURL());
  }

  EXPECT_EQ(previous_count + 2, browser()->tab_strip_model()->count());
}

#endif // !defined(OS_ANDROID) && !defined(OS_IOS)

#if defined(ENABLE_WEBRTC)

// NOTE: Any updates to the expectations in these tests should also be done in
// the browser test WebRtcDisableEncryptionFlagBrowserTest.
class DisableWebRtcEncryptionFlagTest : public testing::Test {
 public:
  DisableWebRtcEncryptionFlagTest()
      : from_command_line_(base::CommandLine::NO_PROGRAM),
        to_command_line_(base::CommandLine::NO_PROGRAM) {}

 protected:
  void SetUp() override {
    from_command_line_.AppendSwitch(switches::kDisableWebRtcEncryption);
  }

  void MaybeCopyDisableWebRtcEncryptionSwitch(version_info::Channel channel) {
    ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch(
        &to_command_line_,
        from_command_line_,
        channel);
  }

  base::CommandLine from_command_line_;
  base::CommandLine to_command_line_;

  DISALLOW_COPY_AND_ASSIGN(DisableWebRtcEncryptionFlagTest);
};

TEST_F(DisableWebRtcEncryptionFlagTest, UnknownChannel) {
  MaybeCopyDisableWebRtcEncryptionSwitch(version_info::Channel::UNKNOWN);
  EXPECT_TRUE(to_command_line_.HasSwitch(switches::kDisableWebRtcEncryption));
}

TEST_F(DisableWebRtcEncryptionFlagTest, CanaryChannel) {
  MaybeCopyDisableWebRtcEncryptionSwitch(version_info::Channel::CANARY);
  EXPECT_TRUE(to_command_line_.HasSwitch(switches::kDisableWebRtcEncryption));
}

TEST_F(DisableWebRtcEncryptionFlagTest, DevChannel) {
  MaybeCopyDisableWebRtcEncryptionSwitch(version_info::Channel::DEV);
  EXPECT_TRUE(to_command_line_.HasSwitch(switches::kDisableWebRtcEncryption));
}

TEST_F(DisableWebRtcEncryptionFlagTest, BetaChannel) {
  MaybeCopyDisableWebRtcEncryptionSwitch(version_info::Channel::BETA);
#if defined(OS_ANDROID)
  EXPECT_TRUE(to_command_line_.HasSwitch(switches::kDisableWebRtcEncryption));
#else
  EXPECT_FALSE(to_command_line_.HasSwitch(switches::kDisableWebRtcEncryption));
#endif
}

TEST_F(DisableWebRtcEncryptionFlagTest, StableChannel) {
  MaybeCopyDisableWebRtcEncryptionSwitch(version_info::Channel::STABLE);
  EXPECT_FALSE(to_command_line_.HasSwitch(switches::kDisableWebRtcEncryption));
}

#endif  // ENABLE_WEBRTC

class BlinkSettingsFieldTrialTest : public testing::Test {
 public:
  static const char kParserFieldTrialName[];
  static const char kIFrameFieldTrialName[];

  BlinkSettingsFieldTrialTest()
      : trial_list_(NULL),
        command_line_(base::CommandLine::NO_PROGRAM) {}

  void SetUp() override {
    command_line_.AppendSwitchASCII(
        switches::kProcessType, switches::kRendererProcess);
  }

  void TearDown() override {
    variations::testing::ClearAllVariationParams();
  }

  void CreateFieldTrial(const char* trial_name) {
    base::FieldTrialList::CreateFieldTrial(trial_name, kGroupName);
  }

  void CreateFieldTrialWithParams(
      const char* trial_name,
      const char* key1, const char* value1,
      const char* key2, const char* value2) {
    std::map<std::string, std::string> params;
    params.insert(std::make_pair(key1, value1));
    params.insert(std::make_pair(key2, value2));
    CreateFieldTrial(trial_name);
    variations::AssociateVariationParams(trial_name, kGroupName, params);
  }

  void AppendContentBrowserClientSwitches() {
    client_.AppendExtraCommandLineSwitches(&command_line_, kFakeChildProcessId);
  }

  const base::CommandLine& command_line() const {
    return command_line_;
  }

  void AppendBlinkSettingsSwitch(const char* value) {
    command_line_.AppendSwitchASCII(switches::kBlinkSettings, value);
  }

 private:
  static const int kFakeChildProcessId = 1;
  static const char kGroupName[];

  ChromeContentBrowserClient client_;
  base::FieldTrialList trial_list_;
  base::CommandLine command_line_;

  content::TestBrowserThreadBundle thread_bundle_;
};

const char BlinkSettingsFieldTrialTest::kParserFieldTrialName[] =
    "BackgroundHtmlParserTokenLimits";
const char BlinkSettingsFieldTrialTest::kIFrameFieldTrialName[] =
    "LowPriorityIFrames";
const char BlinkSettingsFieldTrialTest::kGroupName[] = "FakeGroup";

TEST_F(BlinkSettingsFieldTrialTest, NoFieldTrial) {
  AppendContentBrowserClientSwitches();
  EXPECT_FALSE(command_line().HasSwitch(switches::kBlinkSettings));
}

TEST_F(BlinkSettingsFieldTrialTest, FieldTrialWithoutParams) {
  CreateFieldTrial(kParserFieldTrialName);
  AppendContentBrowserClientSwitches();
  EXPECT_FALSE(command_line().HasSwitch(switches::kBlinkSettings));
}

TEST_F(BlinkSettingsFieldTrialTest, BlinkSettingsSwitchAlreadySpecified) {
  AppendBlinkSettingsSwitch("foo");
  CreateFieldTrialWithParams(kParserFieldTrialName,
                             "key1", "value1", "key2", "value2");
  AppendContentBrowserClientSwitches();
  EXPECT_TRUE(command_line().HasSwitch(switches::kBlinkSettings));
  EXPECT_EQ("foo",
            command_line().GetSwitchValueASCII(switches::kBlinkSettings));
}

TEST_F(BlinkSettingsFieldTrialTest, FieldTrialEnabled) {
  CreateFieldTrialWithParams(kParserFieldTrialName,
                             "key1", "value1", "key2", "value2");
  AppendContentBrowserClientSwitches();
  EXPECT_TRUE(command_line().HasSwitch(switches::kBlinkSettings));
  EXPECT_EQ("key1=value1,key2=value2",
            command_line().GetSwitchValueASCII(switches::kBlinkSettings));
}

TEST_F(BlinkSettingsFieldTrialTest, MultipleFieldTrialsEnabled) {
  CreateFieldTrialWithParams(kParserFieldTrialName,
                             "key1", "value1", "key2", "value2");
  CreateFieldTrialWithParams(kIFrameFieldTrialName,
                             "keyA", "valueA", "keyB", "valueB");
  AppendContentBrowserClientSwitches();
  EXPECT_TRUE(command_line().HasSwitch(switches::kBlinkSettings));
  EXPECT_EQ("key1=value1,key2=value2,keyA=valueA,keyB=valueB",
            command_line().GetSwitchValueASCII(switches::kBlinkSettings));
}

TEST_F(BlinkSettingsFieldTrialTest, MultipleFieldTrialsDuplicateKeys) {
  CreateFieldTrialWithParams(kParserFieldTrialName,
                             "key1", "value1", "key2", "value2");
  CreateFieldTrialWithParams(kIFrameFieldTrialName,
                             "key2", "duplicate", "key3", "value3");
  AppendContentBrowserClientSwitches();
  EXPECT_TRUE(command_line().HasSwitch(switches::kBlinkSettings));
  EXPECT_EQ("key1=value1,key2=value2,key2=duplicate,key3=value3",
            command_line().GetSwitchValueASCII(switches::kBlinkSettings));
}

}  // namespace chrome

#if !defined(OS_IOS) && !defined(OS_ANDROID)
namespace content {

class InstantNTPURLRewriteTest : public BrowserWithTestWindowTest {
 protected:
  void SetUp() override {
    BrowserWithTestWindowTest::SetUp();
    field_trial_list_.reset(new base::FieldTrialList(
        new metrics::SHA1EntropyProvider("42")));
  }

  void InstallTemplateURLWithNewTabPage(GURL new_tab_page_url) {
    TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
        profile(), &TemplateURLServiceFactory::BuildInstanceFor);
    TemplateURLService* template_url_service =
        TemplateURLServiceFactory::GetForProfile(browser()->profile());
    ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service);

    TemplateURLData data;
    data.SetShortName(base::ASCIIToUTF16("foo.com"));
    data.SetURL("http://foo.com/url?bar={searchTerms}");
    data.new_tab_url = new_tab_page_url.spec();
    TemplateURL* template_url = new TemplateURL(data);
    // Takes ownership.
    template_url_service->Add(template_url);
    template_url_service->SetUserSelectedDefaultSearchProvider(template_url);
  }

  scoped_ptr<base::FieldTrialList> field_trial_list_;
};

TEST_F(InstantNTPURLRewriteTest, UberURLHandler_InstantExtendedNewTabPage) {
  const GURL url_original("chrome://newtab");
  const GURL url_rewritten("https://www.example.com/newtab");
  InstallTemplateURLWithNewTabPage(url_rewritten);
  ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended",
      "Group1 use_cacheable_ntp:1"));

  AddTab(browser(), GURL("chrome://blank"));
  NavigateAndCommitActiveTab(url_original);

  NavigationEntry* entry = browser()->tab_strip_model()->
      GetActiveWebContents()->GetController().GetLastCommittedEntry();
  ASSERT_TRUE(entry != NULL);
  EXPECT_EQ(url_rewritten, entry->GetURL());
  EXPECT_EQ(url_original, entry->GetVirtualURL());
}

}  // namespace content
#endif  // !defined(OS_IOS) && !defined(OS_ANDROID)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Reflection;
using Effekseer.Utl;
using System.Threading;
using System.Threading.Tasks;

namespace Effekseer.Data
{
	public class IO
	{
		public static XmlElement SaveObjectToElement(XmlDocument doc, string element_name, object o, bool isClip)
		{
			XmlElement e_o = doc.CreateElement(element_name);

			var properties = o.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);

			foreach (var property in properties)
			{
				var io_attribute = property.GetCustomAttributes(typeof(IOAttribute), false).FirstOrDefault() as IOAttribute;
				if (io_attribute != null && !io_attribute.Export) continue;

				var method = typeof(IO).GetMethod("SaveToElement", new Type[] { typeof(XmlDocument), typeof(string), property.PropertyType, typeof(bool) });
				if (method != null)
				{
					var property_value = property.GetValue(o, null);
					var element = method.Invoke(null, new object[] { doc, property.Name, property_value, isClip });

					if (element != null)
					{
						e_o.AppendChild(element as XmlNode);
					}
				}
				else
				{
					if (io_attribute != null && io_attribute.Export)
					{
						var property_value = property.GetValue(o, null);
						var element = SaveObjectToElement(doc, property.Name, property_value, isClip);

						if (element != null && element.ChildNodes.Count > 0)
						{
							e_o.AppendChild(element as XmlNode);
						}
					}
				}
			}

			if(e_o.ChildNodes.Count > 0) return e_o;
			return null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, NodeBase node, bool isClip)
		{
			return SaveObjectToElement(doc, element_name, node, isClip);
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, NodeBase.ChildrenCollection children, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			for (int i = 0; i < children.Count; i++)
			{
				var e_node = SaveToElement(doc, children[i].GetType().Name, children[i], isClip);
				e.AppendChild(e_node);
			}

			return e;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.String value, bool isClip)
		{
			if (value.DefaultValue == value.Value) return null;
			var text = value.GetValue().ToString();
			return doc.CreateTextElement(element_name, text);
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.Boolean value, bool isClip)
		{
			if (value.DefaultValue == value.Value) return null;
			var text = value.GetValue().ToString();
			return doc.CreateTextElement(element_name, text);
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.Int value, bool isClip)
		{
			if (value.Value == value.DefaultValue) return null;
			var text = value.GetValue().ToString();
			return doc.CreateTextElement(element_name, text);
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.Float value, bool isClip)
		{
			if (value.Value == value.DefaultValue) return null;
			var text = value.GetValue().ToString();
			return doc.CreateTextElement(element_name, text);
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.IntWithInifinite value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var v = SaveToElement(doc, "Value", value.Value, isClip);
			var i = SaveToElement(doc, "Infinite", value.Infinite, isClip);

			if (v != null) e.AppendChild(v);
			if (i != null) e.AppendChild(i);

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.Vector2D value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var x = SaveToElement(doc, "X", value.X, isClip);
			var y = SaveToElement(doc, "Y", value.Y, isClip);

			if (x != null) e.AppendChild(x);
			if (y != null) e.AppendChild(y);

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.Vector3D value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var x = SaveToElement(doc, "X", value.X, isClip);
			var y = SaveToElement(doc, "Y", value.Y, isClip);
			var z = SaveToElement(doc, "Z", value.Z, isClip);

			if (x != null) e.AppendChild(x);
			if (y != null) e.AppendChild(y);
			if (z != null) e.AppendChild(z);

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.Color value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var r = SaveToElement(doc, "R", value.R, isClip);
			var g = SaveToElement(doc, "G", value.G, isClip);
			var b = SaveToElement(doc, "B", value.B, isClip);
			var a = SaveToElement(doc, "A", value.A, isClip);

			if (r != null) e.AppendChild(r);
			if (g != null) e.AppendChild(g);
			if (b != null) e.AppendChild(b);
			if (a != null) e.AppendChild(a);

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.IntWithRandom value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			if (value.DefaultValueCenter != value.Center) e.AppendChild(doc.CreateTextElement("Center", value.Center.ToString()));
			if (value.DefaultValueMax != value.Max) e.AppendChild(doc.CreateTextElement("Max", value.Max.ToString()));
			if (value.DefaultValueMin != value.Min) e.AppendChild(doc.CreateTextElement("Min", value.Min.ToString()));
			if (value.DefaultDrawnAs != value.DrawnAs) e.AppendChild(doc.CreateTextElement("DrawnAs", (int)value.DrawnAs));

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.FloatWithRandom value, bool isClip)
		{
			var e = doc.CreateElement(element_name);

			if(value.DefaultValueCenter != value.Center) e.AppendChild(doc.CreateTextElement("Center", value.Center.ToString()));
			if(value.DefaultValueMax != value.Max) e.AppendChild(doc.CreateTextElement("Max", value.Max.ToString()));
			if(value.DefaultValueMin != value.Min) e.AppendChild(doc.CreateTextElement("Min", value.Min.ToString()));
			if(value.DefaultDrawnAs != value.DrawnAs) e.AppendChild(doc.CreateTextElement("DrawnAs", (int)value.DrawnAs));

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.Vector2DWithRandom value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var x = SaveToElement(doc, "X", value.X, isClip);
			var y = SaveToElement(doc, "Y", value.Y, isClip);
			var da = value.DefaultDrawnAs != value.DrawnAs ? doc.CreateTextElement("DrawnAs", (int)value.DrawnAs) : null;

			if (x != null) e.AppendChild(x);
			if (y != null) e.AppendChild(y);
			if (da != null) e.AppendChild(da);

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.Vector3DWithRandom value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var x = SaveToElement(doc, "X", value.X, isClip);
			var y = SaveToElement(doc, "Y", value.Y, isClip);
			var z = SaveToElement(doc, "Z", value.Z, isClip);
			var da = value.DefaultDrawnAs != value.DrawnAs ? doc.CreateTextElement("DrawnAs", (int)value.DrawnAs) : null;

			if (x != null) e.AppendChild(x);
			if (y != null) e.AppendChild(y);
			if (z != null) e.AppendChild(z);
			if (da != null) e.AppendChild(da);

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.ColorWithRandom value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var r = SaveToElement(doc, "R", value.R, isClip);
			var g = SaveToElement(doc, "G", value.G, isClip);
			var b = SaveToElement(doc, "B", value.B, isClip);
			var a = SaveToElement(doc, "A", value.A, isClip);
			var da = value.DefaultDrawnAs != value.DrawnAs ? doc.CreateTextElement("DrawnAs", (int)value.DrawnAs) : null;
			var cs = value.DefaultColorSpace != value.ColorSpace ? doc.CreateTextElement("ColorSpace", (int)value.ColorSpace) : null;

			if (r != null) e.AppendChild(r);
			if (g != null) e.AppendChild(g);
			if (b != null) e.AppendChild(b);
			if (a != null) e.AppendChild(a);
			if (da != null) e.AppendChild(da);
			if (cs != null) e.AppendChild(cs);
			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.EnumBase value, bool isClip)
		{
			if (value.GetValueAsInt() == value.GetDefaultValueAsInt()) return null;

			var text = value.GetValueAsInt().ToString();
			return doc.CreateTextElement(element_name, text);
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.Path value, bool isClip)
		{
			if (value.DefaultValue == value.GetAbsolutePath()) return null;

			var text = "";
			if(!isClip && value.IsRelativeSaved)
				text = value.GetRelativePath();
			else
				text = value.GetAbsolutePath();

			return doc.CreateTextElement(element_name, text);
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.FCurveVector2D value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var keys = doc.CreateElement("Keys");
			var x = doc.CreateElement("X");
			var y = doc.CreateElement("Y");

			int index = 0;

			Action<Value.FCurve<float>, XmlElement> setValues = (v, xml) =>
				{
					index = 0;

					var st = SaveToElement(doc, "StartType", v.StartType, isClip);
					var et = SaveToElement(doc, "EndType", v.EndType, isClip);
					var omax = SaveToElement(doc, "OffsetMax", v.OffsetMax, isClip);
					var omin = SaveToElement(doc, "OffsetMin", v.OffsetMin, isClip);
					var s = SaveToElement(doc, "Sampling", v.Sampling, isClip);

					if (st != null) xml.AppendChild(st);
					if (et != null) xml.AppendChild(et);
					if (omax != null) xml.AppendChild(omax);
					if (omin != null) xml.AppendChild(omin);
					if (s != null) xml.AppendChild(s);

					foreach (var k_ in v.Keys)
					{
						var k = doc.CreateElement("Key" + index.ToString());
						k.AppendChild(doc.CreateTextElement("Frame", k_.Frame.ToString()));
						k.AppendChild(doc.CreateTextElement("Value", k_.ValueAsFloat.ToString()));
						k.AppendChild(doc.CreateTextElement("LeftX", k_.LeftX.ToString()));
						k.AppendChild(doc.CreateTextElement("LeftY", k_.LeftY.ToString()));
						k.AppendChild(doc.CreateTextElement("RightX", k_.RightX.ToString()));
						k.AppendChild(doc.CreateTextElement("RightY", k_.RightY.ToString()));

						k.AppendChild(doc.CreateTextElement("InterpolationType", k_.InterpolationType.GetValueAsInt()));

						xml.AppendChild(k);
						index++;
					}
				};

			setValues(value.X, x);
			setValues(value.Y, y);

			if (x.ChildNodes.Count > 0) keys.AppendChild(x);
			if (y.ChildNodes.Count > 0) keys.AppendChild(y);
			if (keys.ChildNodes.Count > 0) e.AppendChild(keys);

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.FCurveVector3D value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var keys = doc.CreateElement("Keys");
			var x = doc.CreateElement("X");
			var y = doc.CreateElement("Y");
			var z = doc.CreateElement("Z");

			int index = 0;

			Action<Value.FCurve<float>, XmlElement> setValues = (v, xml) =>
			{
				index = 0;

				var st = SaveToElement(doc, "StartType", v.StartType, isClip);
				var et = SaveToElement(doc, "EndType", v.EndType, isClip);
				var omax = SaveToElement(doc, "OffsetMax", v.OffsetMax, isClip);
				var omin = SaveToElement(doc, "OffsetMin", v.OffsetMin, isClip);
				var s = SaveToElement(doc, "Sampling", v.Sampling, isClip);

				if (st != null) xml.AppendChild(st);
				if (et != null) xml.AppendChild(et);
				if (omax != null) xml.AppendChild(omax);
				if (omin != null) xml.AppendChild(omin);
				if (s != null) xml.AppendChild(s);

				foreach (var k_ in v.Keys)
				{
					var k = doc.CreateElement("Key" + index.ToString());
					k.AppendChild(doc.CreateTextElement("Frame", k_.Frame.ToString()));
					k.AppendChild(doc.CreateTextElement("Value", k_.ValueAsFloat.ToString()));
					k.AppendChild(doc.CreateTextElement("LeftX", k_.LeftX.ToString()));
					k.AppendChild(doc.CreateTextElement("LeftY", k_.LeftY.ToString()));
					k.AppendChild(doc.CreateTextElement("RightX", k_.RightX.ToString()));
					k.AppendChild(doc.CreateTextElement("RightY", k_.RightY.ToString()));

					k.AppendChild(doc.CreateTextElement("InterpolationType", k_.InterpolationType.GetValueAsInt()));

					xml.AppendChild(k);
					index++;
				}
			};

			setValues(value.X, x);
			setValues(value.Y, y);
			setValues(value.Z, z);

			if (x.ChildNodes.Count > 0) keys.AppendChild(x);
			if (y.ChildNodes.Count > 0) keys.AppendChild(y);
			if (z.ChildNodes.Count > 0) keys.AppendChild(z);
			if (keys.ChildNodes.Count > 0) e.AppendChild(keys);

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static XmlElement SaveToElement(XmlDocument doc, string element_name, Value.FCurveColorRGBA value, bool isClip)
		{
			var e = doc.CreateElement(element_name);
			var keys = doc.CreateElement("Keys");
			var r = doc.CreateElement("R");
			var g = doc.CreateElement("G");
			var b = doc.CreateElement("B");
			var a = doc.CreateElement("A");

			int index = 0;

			Action<Value.FCurve<byte>, XmlElement> setValues = (v, xml) =>
			{
				index = 0;

				var st = SaveToElement(doc, "StartType", v.StartType, isClip);
				var et = SaveToElement(doc, "EndType", v.EndType, isClip);
				var omax = SaveToElement(doc, "OffsetMax", v.OffsetMax, isClip);
				var omin = SaveToElement(doc, "OffsetMin", v.OffsetMin, isClip);
				var s = SaveToElement(doc, "Sampling", v.Sampling, isClip);

				if (st != null) xml.AppendChild(st);
				if (et != null) xml.AppendChild(et);
				if (omax != null) xml.AppendChild(omax);
				if (omin != null) xml.AppendChild(omin);
				if (s != null) xml.AppendChild(s);

				foreach (var k_ in v.Keys)
				{
					var k = doc.CreateElement("Key" + index.ToString());
					k.AppendChild(doc.CreateTextElement("Frame", k_.Frame.ToString()));
					k.AppendChild(doc.CreateTextElement("Value", k_.ValueAsFloat.ToString()));
					k.AppendChild(doc.CreateTextElement("LeftX", k_.LeftX.ToString()));
					k.AppendChild(doc.CreateTextElement("LeftY", k_.LeftY.ToString()));
					k.AppendChild(doc.CreateTextElement("RightX", k_.RightX.ToString()));
					k.AppendChild(doc.CreateTextElement("RightY", k_.RightY.ToString()));

					k.AppendChild(doc.CreateTextElement("InterpolationType", k_.InterpolationType.GetValueAsInt()));

					xml.AppendChild(k);
					index++;
				}
			};

			setValues(value.R, r);
			setValues(value.G, g);
			setValues(value.B, b);
			setValues(value.A, a);

			if (r.ChildNodes.Count > 0) keys.AppendChild(r);
			if (g.ChildNodes.Count > 0) keys.AppendChild(g);
			if (b.ChildNodes.Count > 0) keys.AppendChild(b);
			if (a.ChildNodes.Count > 0) keys.AppendChild(a);

			if (keys.ChildNodes.Count > 0) e.AppendChild(keys);

			return e.ChildNodes.Count > 0 ? e : null;
		}

		public static void LoadObjectFromElement(XmlElement e, ref object o, bool isClip)
		{
			var o_type = o.GetType();

			foreach (var _ch_node in e.ChildNodes)
			{
				var ch_node = _ch_node as XmlElement;
				var local_name = ch_node.LocalName;

				var property = o_type.GetProperty(local_name);
				if (property == null) continue;

				var io_attribute = property.GetCustomAttributes(typeof(IOAttribute), false).FirstOrDefault() as IOAttribute;
				if (io_attribute != null && !io_attribute.Import) continue;

				var method = typeof(IO).GetMethod("LoadFromElement", new Type[] { typeof(XmlElement), property.PropertyType, typeof(bool) });
				if (method != null)
				{
					var property_value = property.GetValue(o, null);
					method.Invoke(null, new object[] { ch_node, property_value, isClip });
				}
				else
				{
					if (io_attribute != null && io_attribute.Import)
					{
						var property_value = property.GetValue(o, null);
						LoadObjectFromElement(ch_node, ref property_value, isClip);
					}
				}
			}
		}

		public static void LoadFromElement(XmlElement e, NodeBase node, bool isClip)
		{
			var o = node as object;
			LoadObjectFromElement(e, ref o, isClip);
		}

		public static void LoadFromElement(XmlElement e, NodeBase.ChildrenCollection children, bool isClip)
		{
			children.Node.ClearChildren();

			for (var i = 0; i < e.ChildNodes.Count; i++)
			{
				var e_child = e.ChildNodes[i] as XmlElement;
				if (e_child.LocalName != "Node") continue;

				var node = children.Node.AddChild();
				LoadFromElement(e_child, node, isClip);
			}
		}

		public static void LoadFromElement(XmlElement e, Value.String value, bool isClip)
		{
			var text = e.GetText();
			value.SetValue(text);
		}

		public static void LoadFromElement(XmlElement e, Value.Boolean value, bool isClip)
		{
			var text = e.GetText();
			var parsed = false;
			if (bool.TryParse(text, out parsed))
			{
				value.SetValue(parsed);
			}
		}

		public static void LoadFromElement(XmlElement e, Value.Int value, bool isClip)
		{
			var text = e.GetText();
			var parsed = 0;
			if (int.TryParse(text, System.Globalization.NumberStyles.Integer, Setting.NFI, out parsed))
			{
				value.SetValue(parsed);
			}
		}

		public static void LoadFromElement(XmlElement e, Value.Float value, bool isClip)
		{
			var text = e.GetText();
			var parsed = 0.0f;
			if (float.TryParse(text, System.Globalization.NumberStyles.Float, Setting.NFI, out parsed))
			{
				value.SetValue(parsed);
			}
		}

		public static void LoadFromElement(XmlElement e, Value.IntWithInifinite value, bool isClip)
		{
			var e_value = e["Value"] as XmlElement;
			var e_infinite = e["Infinite"] as XmlElement;

			if (e_value != null) LoadFromElement(e_value, value.Value, isClip);
			if (e_infinite != null) LoadFromElement(e_infinite, value.Infinite, isClip);
		}

		public static void LoadFromElement(XmlElement e, Value.Vector2D value, bool isClip)
		{
			var e_x = e["X"] as XmlElement;
			var e_y = e["Y"] as XmlElement;

			if (e_x != null) LoadFromElement(e_x, value.X, isClip);
			if (e_y != null) LoadFromElement(e_y, value.Y, isClip);
		}

		public static void LoadFromElement(XmlElement e, Value.Vector3D value, bool isClip)
		{
			var e_x = e["X"] as XmlElement;
			var e_y = e["Y"] as XmlElement;
			var e_z = e["Z"] as XmlElement;

			if (e_x != null) LoadFromElement(e_x, value.X, isClip);
			if (e_y != null) LoadFromElement(e_y, value.Y, isClip);
			if (e_z != null) LoadFromElement(e_z, value.Z, isClip);
		}

		public static void LoadFromElement(XmlElement e, Value.Color value, bool isClip)
		{
			var e_r = e["R"] as XmlElement;
			var e_g = e["G"] as XmlElement;
			var e_b = e["B"] as XmlElement;
			var e_a = e["A"] as XmlElement;

			if (e_r != null) LoadFromElement(e_r, value.R, isClip);
			if (e_g != null) LoadFromElement(e_g, value.G, isClip);
			if (e_b != null) LoadFromElement(e_b, value.B, isClip);
			if (e_a != null) LoadFromElement(e_a, value.A, isClip);
		}

		public static void LoadFromElement(XmlElement e, Value.IntWithRandom value, bool isClip)
		{
			var e_c = e["Center"];
			var e_max = e["Max"];
			var e_min = e["Min"];
			var e_da = e["DrawnAs"];

			if (e_c != null)
			{
				var center = e_c.GetTextAsInt();
				value.SetCenter(center);
			}

			if (e_max != null)
			{
				var max = e_max.GetTextAsInt();
				value.SetMax(max);
			}
			else
			{
				value.SetMax(value.DefaultValueMax);
			}

			if (e_min != null)
			{
				var min = e_min.GetTextAsInt();
				value.SetMin(min);
			}
			else
			{
				value.SetMin(value.DefaultValueMin);
			}

			if (e_da != null)
			{
				value.DrawnAs = (DrawnAs)e_da.GetTextAsInt();
			}
		}

		public static void LoadFromElement(XmlElement e, Value.FloatWithRandom value, bool isClip)
		{
			var e_c = e["Center"];
			var e_max = e["Max"];
			var e_min = e["Min"];
			var e_da = e["DrawnAs"];

			if (e_c != null)
			{
				var center = e_c.GetTextAsFloat();
				value.SetCenter(center);
			}

			if (e_max != null)
			{
				var max = e_max.GetTextAsFloat();
				value.SetMax(max);
			}
			else
			{
				value.SetMax(value.DefaultValueMax);
			}

			if (e_min != null)
			{
				var min = e_min.GetTextAsFloat();
				value.SetMin(min);
			}
			else
			{
				value.SetMin(value.DefaultValueMin);
			}

			if (e_da != null)
			{
				value.DrawnAs = (DrawnAs)e_da.GetTextAsInt();
			}
		}

		public static void LoadFromElement(XmlElement e, Value.Vector2DWithRandom value, bool isClip)
		{
			var e_x = e["X"] as XmlElement;
			var e_y = e["Y"] as XmlElement;
			var e_da = e["DrawnAs"];

			if (e_x != null) LoadFromElement(e_x, value.X, isClip);
			if (e_y != null) LoadFromElement(e_y, value.Y, isClip);

			if (e_da != null)
			{
				value.DrawnAs = (DrawnAs)e_da.GetTextAsInt();
			}
		}

		public static void LoadFromElement(XmlElement e, Value.Vector3DWithRandom value, bool isClip)
		{
			var e_x = e["X"] as XmlElement;
			var e_y = e["Y"] as XmlElement;
			var e_z = e["Z"] as XmlElement;
			var e_da = e["DrawnAs"];

			if (e_x != null) LoadFromElement(e_x, value.X, isClip);
			if (e_y != null) LoadFromElement(e_y, value.Y, isClip);
			if (e_z != null) LoadFromElement(e_z, value.Z, isClip);

			if (e_da != null)
			{
				value.DrawnAs = (DrawnAs)e_da.GetTextAsInt();
			}
		}

		public static void LoadFromElement(XmlElement e, Value.ColorWithRandom value, bool isClip)
		{
			var e_r = e["R"] as XmlElement;
			var e_g = e["G"] as XmlElement;
			var e_b = e["B"] as XmlElement;
			var e_a = e["A"] as XmlElement;
			var e_da = e["DrawnAs"];
			var e_cs = e["ColorSpace"];

			if (e_r != null) LoadFromElement(e_r, value.R, isClip);
			if (e_g != null) LoadFromElement(e_g, value.G, isClip);
			if (e_b != null) LoadFromElement(e_b, value.B, isClip);
			if (e_a != null) LoadFromElement(e_a, value.A, isClip);

			if (e_da != null)
			{
				value.DrawnAs = (DrawnAs)e_da.GetTextAsInt();
			}

			if (e_cs != null)
			{
				value.ColorSpace = (ColorSpace)e_cs.GetTextAsInt();
			}
		}

		public static void LoadFromElement(XmlElement e, Value.Path value, bool isClip)
		{
			var text = e.GetText();

			if (!isClip)
				value.SetRelativePath(text);
			else
				value.SetAbsolutePath(text);
		}

		public static void LoadFromElement(XmlElement e, Value.EnumBase value, bool isClip)
		{
			var text = e.GetText();
			var parsed = 0;
			if (int.TryParse(text, out parsed))
			{
				value.SetValue(parsed);
			}
		}

		public static void LoadFromElement(XmlElement e, Value.FCurveVector2D value, bool isClip)
		{
			var e_keys = e["Keys"] as XmlElement;
			if (e_keys == null) return;

			var e_x = e_keys["X"] as XmlElement;
			var e_y = e_keys["Y"] as XmlElement;

			Action<Data.Value.FCurve<float>, XmlElement> import = (v_, e_) =>
			{
				foreach (XmlElement r in e_.ChildNodes)
				{
					if (r.Name.StartsWith("Key"))
					{
						var f = r.GetTextAsInt("Frame");
						var v = r.GetTextAsFloat("Value");
						var lx = r.GetTextAsFloat("LeftX");
						var ly = r.GetTextAsFloat("LeftY");
						var rx = r.GetTextAsFloat("RightX");
						var ry = r.GetTextAsFloat("RightY");
						var i = r.GetTextAsInt("InterpolationType");
						var s = r.GetTextAsInt("Sampling");

						var t = new Value.FCurveKey<float>(f, v);
						t.SetLeftDirectly(lx, ly);
						t.SetRightDirectly(rx, ry);
						t.InterpolationType.SetValue(i);

						v_.AddKeyDirectly(t);
					}
					else if (r.Name.StartsWith("StartType"))
					{
						var v = r.GetTextAsInt();
						v_.StartType.SetValue(v);
					}
					else if (r.Name.StartsWith("EndType"))
					{
						var v = r.GetTextAsInt();
						v_.EndType.SetValue(v);
					}
					else if (r.Name.StartsWith("OffsetMax"))
					{
						var v = r.GetTextAsFloat();
						v_.OffsetMax.SetValueDirectly(v);
					}
					else if (r.Name.StartsWith("OffsetMin"))
					{
						var v = r.GetTextAsFloat();
						v_.OffsetMin.SetValueDirectly(v);
					}
					else if (r.Name.StartsWith("Sampling"))
					{
						var v = r.GetTextAsInt();
						v_.Sampling.SetValueDirectly(v);
					}
				}
			};

			if (e_x != null) import(value.X, e_x);
			if (e_y != null) import(value.Y, e_y);
		}

		public static void LoadFromElement(XmlElement e, Value.FCurveVector3D value, bool isClip)
		{
			var e_keys = e["Keys"] as XmlElement;
			if (e_keys == null) return;

			var e_x = e_keys["X"] as XmlElement;
			var e_y = e_keys["Y"] as XmlElement;
			var e_z = e_keys["Z"] as XmlElement;

			Action<Data.Value.FCurve<float>, XmlElement> import = (v_, e_) =>
			{
				foreach (XmlElement r in e_.ChildNodes)
				{
					if (r.Name.StartsWith("Key"))
					{
						var f = r.GetTextAsInt("Frame");
						var v = r.GetTextAsFloat("Value");
						var lx = r.GetTextAsFloat("LeftX");
						var ly = r.GetTextAsFloat("LeftY");
						var rx = r.GetTextAsFloat("RightX");
						var ry = r.GetTextAsFloat("RightY");
						var i = r.GetTextAsInt("InterpolationType");

						var t = new Value.FCurveKey<float>(f, v);
						t.SetLeftDirectly(lx, ly);
						t.SetRightDirectly(rx, ry);
						t.InterpolationType.SetValue(i);

						v_.AddKeyDirectly(t);
					}
					else if (r.Name.StartsWith("StartType"))
					{
						var v = r.GetTextAsInt();
						v_.StartType.SetValue(v);
					}
					else if (r.Name.StartsWith("EndType"))
					{
						var v = r.GetTextAsInt();
						v_.EndType.SetValue(v);
					}
					else if (r.Name.StartsWith("OffsetMax"))
					{
						var v = r.GetTextAsFloat();
						v_.OffsetMax.SetValueDirectly(v);
					}
					else if (r.Name.StartsWith("OffsetMin"))
					{
						var v = r.GetTextAsFloat();
						v_.OffsetMin.SetValueDirectly(v);
					}
					else if (r.Name.StartsWith("Sampling"))
					{
						var v = r.GetTextAsInt();
						v_.Sampling.SetValueDirectly(v);
					}
				}
			};

			if (e_x != null) import(value.X, e_x);
			if (e_y != null) import(value.Y, e_y);
			if (e_z != null) import(value.Z, e_z);
		}

		public static void LoadFromElement(XmlElement e, Value.FCurveColorRGBA value, bool isClip)
		{
			Action<Data.Value.FCurve<byte>, XmlElement> import = (v_, e_) =>
				{
					foreach (XmlElement r in e_.ChildNodes)
					{
						if (r.Name.StartsWith("Key"))
						{
							var f = r.GetTextAsInt("Frame");
							var v = r.GetTextAsFloat("Value");
							var lx = r.GetTextAsFloat("LeftX");
							var ly = r.GetTextAsFloat("LeftY");
							var rx = r.GetTextAsFloat("RightX");
							var ry = r.GetTextAsFloat("RightY");
							var i = r.GetTextAsInt("InterpolationType");

							var t = new Value.FCurveKey<byte>(f, (byte)v);
							t.SetLeftDirectly(lx, ly);
							t.SetRightDirectly(rx, ry);
							t.InterpolationType.SetValue(i);

							v_.AddKeyDirectly(t);
						}
						else if (r.Name.StartsWith("StartType"))
						{
							var v = r.GetTextAsInt();
							v_.StartType.SetValue(v);
						}
						else if (r.Name.StartsWith("EndType"))
						{
							var v = r.GetTextAsInt();
							v_.EndType.SetValue(v);
						}
						else if (r.Name.StartsWith("OffsetMax"))
						{
							var v = r.GetTextAsFloat();
							v_.OffsetMax.SetValueDirectly(v);
						}
						else if (r.Name.StartsWith("OffsetMin"))
						{
							var v = r.GetTextAsFloat();
							v_.OffsetMin.SetValueDirectly(v);
						}
						else if (r.Name.StartsWith("Sampling"))
						{
							var v = r.GetTextAsInt();
							v_.Sampling.SetValueDirectly(v);
						}
					}
				};

			var e_keys = e["Keys"] as XmlElement;
			if (e_keys == null) return;

			var e_r = e_keys["R"] as XmlElement;
			var e_g = e_keys["G"] as XmlElement;
			var e_b = e_keys["B"] as XmlElement;
			var e_a = e_keys["A"] as XmlElement;

			if (e_r != null) import(value.R, e_r);
			if (e_g != null) import(value.G, e_g);
			if (e_b != null) import(value.B, e_b);
			if (e_a != null) import(value.A, e_a);
		}
	}
}


text:
package independentHouse.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class linkController {

	@RequestMapping("about")
	public String about(String user, Model model){
		model.addAttribute("user", user);
		return "about";
	}
	@RequestMapping("start")
	public String start(String user, Model model){
		model.addAttribute("user", user);
		return "start";
	}

	@RequestMapping("signup")
	public String signup(String user, Model model){
		model.addAttribute("user", user);
		return "signup";
	}
	@RequestMapping("next")
	public String next(String user, Model model){
		model.addAttribute("user", user);
		return "next";
	}
}


text:
using Esiur.Data;
using Esiur.Core;
using Esiur.Net;
using Esiur.Resource;
using Esiur.Resource.Template;
using Esiur.Security.Authority;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Esiur.Security.Permissions;

public interface IPermissionsManager
{
    /// <summary>
    /// Check for permission.
    /// </summary>
    /// <param name="resource">IResource.</param>
    /// <param name="session">Caller sessions.</param>
    /// <param name="action">Action type</param>
    /// <param name="member">Function, property or event to check for permission.</param>
    /// <param name="inquirer">Permission inquirer object.</param>
    /// <returns>Allowed or denined.</returns>
    Ruling Applicable(IResource resource, Session session, ActionType action, MemberTemplate member, object inquirer = null);

    bool Initialize(Map<string, object> settings, IResource resource);

    Map<string, object> Settings { get; }
}


text:
/**
 * Module dependencies.
 */

var visit = require('rework-visit');

/**
 * Module export.
 */

module.exports = function(jsmap) {

  return function vars(style){
    var map = jsmap || {};

    // define variables
    style.rules.forEach(function (rule) {
      var i;
      var name;
      var varNameIndices = [];

      if (rule.type === 'rule') {
        // only variables declared for `:root` are supported
        if (rule.selectors.length === 1 && rule.selectors[0] === ':root') {
          rule.declarations.forEach(function(decl, idx){
            if (decl.property && /\bvar\-/.test(decl.property)) {
              name = decl.property.replace('var-', '');
              map[name] = decl.value;
              varNameIndices.push(idx);
            }
          });

          // remove `var-*` properties from the rule
          for (i = varNameIndices.length - 1; i >= 0; i -= 1) {
            rule.declarations.splice(varNameIndices[i], 1);
          }
        }
      }
    });

    visit(style, function(declarations, node){
      // resolve variables
      declarations.forEach(function(decl, idx){
        if (decl.value && /\bvar\(/.test(decl.value)) {
          decl.value = replaceValue(decl.value, map);
        }
      });
    });
  };
};

/**
 * Resolve CSS variables in a value
 *
 * The second argument to a CSS variable function, if provided, is a fallback
 * value, which is used as the substitution value when the referenced variable
 * is invalid.
 *
 * var(name[, fallback])
 *
 * Since the fallback can be *any* value, the value needs to be parsed
 * character-by-character to deduce the contents of a variable function.
 *
 * @param {String} value A property value known to contain CSS variable functions
 * @param {Object} map A map of variable names and values
 * @return {String} A property value with all CSS variables substituted.
 */

function replaceValue(value, map){
  // matches `var(name[, fallback])`, captures 'name' and 'fallback'
  var RE_VAR = /\bvar\(([\w-]+)(?:\s*,\s*)?(.*)?\)/;
  // matches `var()`
  var RE_EMPTY_VAR = /\bvar\(\s*\)/;

  var valueLen = value.length;
  var beginSlice = value.indexOf('var(');
  var endSlice = beginSlice + 'var('.length;
  var depth = 1;
  var currentChar;
  var cssVariable;

  // find the closing `)` of the CSS variable function,
  // accounting for nested functions
  while (endSlice < valueLen && depth > 0) {
    currentChar = value.charAt(endSlice);
    if (currentChar == '(') depth += 1;
    if (currentChar == ')') depth -= 1;
    endSlice += 1;
  }

  if (depth > 0) throw new Error('rework-vars: missing closing ")" in the value "' + value + '"');

  cssVariable = value.slice(beginSlice, endSlice);

  if (RE_EMPTY_VAR.test(cssVariable)) throw new Error('rework-vars: var() must contain a non-whitespace string');

  cssReplacement = cssVariable.replace(RE_VAR, function(_, name, fallback){
    var replacement = map[name];
    if (!replacement && !fallback) throw new Error('rework-vars: variable "' + name + '" is undefined');
    if (!replacement && fallback) return fallback;
    return replacement;
  });

  // resolve the variable
  value = value.split(cssVariable).join(cssReplacement);

  // recursively resolve any remaining variables
  if (/\bvar\(/.test(value)) {
    value = replaceValue(value, map);
  }

  return value;
}


text:
[full changelog](https://github.com/Mange/roadie/compare/v2.3.4...master)

* Enhancements:
  * Support Rails 4 master (with the help of [Ryunosuke SATO (tricknotes)](https://github.com/tricknotes))
  * Keep `!important` when outputting styles to help combat web mail styles being `!important`
  * Support `:nth-child`, `:last-child`, etc.
    * To make this work, Roadie have to catch errors from Nokogiri and ignore them. A warning will be printed when this happens so users can open issues with the project and tests can be expanded.
* Other:
  * Be more specific on which versions are required; require newer `css_parser`
  * Officially support MRI 2.0.0
  * Add experimental support for JRuby

### 2.3.4

[full changelog](https://github.com/Mange/roadie/compare/v2.3.3...v2.3.4)

* Enhancements:
  * Add `config.roadie.enabled` that can be set to `false` to disable Roadie completely.
* Bug fixes:
  * Proc objects to the `:css` option is now run in the context of the mailer instance, mirroring similar options from ActionMailer.
  * Fix some tests that would always pass
  * Improve JRuby compatibility
  * Update Gemfile.lock and fix issues with newer gem versions

### 2.3.3

[full changelog](https://github.com/Mange/roadie/compare/v2.3.2...v2.3.3)

* Enhancements:
  * Allow proc objects to the `:css` option
* Bug fixes:
  * Ignore HTML comments and CDATA sections in CSS (support TinyMCE)

### 2.3.2

[full changelog](https://github.com/Mange/roadie/compare/v2.3.1...v2.3.2)

* Bug fixes:
  * Don't fail on selectors which start with @ (#28) – [Roman Shterenzon (romanbsd)](https://github.com/romanbsd)

### 2.3.1

[full changelog](https://github.com/Mange/roadie/compare/v2.3.0...v2.3.1)

* Bug fixes:
  * Does not work with Rails 3.0 unless provider set specifically (#23)

### 2.3.0

[full changelog](https://github.com/Mange/roadie/compare/v2.3.0.pre1...v2.3.0)

* Nothing, really

### 2.3.0.pre1

[full changelog](https://github.com/Mange/roadie/compare/v2.2.0...v2.3.0.pre1)

* Enhancements:
  * Support Rails 3.2.pre1 - [Morton Jonuschat (yabawock)](https://github.com/yabawock)
  * Sped up the Travis builds
  * Official support for Rails 3.0 again
    * Dependencies allow 3.0
    * Travis builds 3.0 among the others

### 2.2.0

[full changelog](https://github.com/Mange/roadie/compare/v2.1.0...v2.2.0)

* Enhancements:
  * Support for the `url_options` method inside mailer instances
    * You can now dynamically alter the URL options on a per-email basis

### 2.1.0

[full changelog](https://github.com/Mange/roadie/compare/v2.1.0.pre2...v2.1.0)

* Full release!

### 2.1.0.pre2

[full changelog](https://github.com/Mange/roadie/compare/v2.1.0.pre1...v2.1.0.pre2)

* Bug: Roadie broke `url_for` inside mailer views

### 2.1.0.pre1

[full changelog](https://github.com/Mange/roadie/compare/v2.0.0...v2.1.0.pre1)

* Enhancements:
  * Support normal filesystem instead of only Asset pipeline
  * Enable users to create their own way of fetching CSS
  * Improve test coverage a bit
  * Use a railtie to hook into Rails
  * Use real Rails for testing integration

### 2.0.0

[full changelog](https://github.com/Mange/roadie/compare/v1.1.3...v2.0.0)

* Enhancements:
  * Support the Asset pipeline - [Arttu Tervo (arttu)](https://github.com/arttu)
* Dependencies:
  * Requires Rails 3.1 to work. You can keep on using the 1.x series in Rails 3.0

### 1.1.3

[full changelog](https://github.com/Mange/roadie/compare/v1.1.2...v1.1.3)

* Do not add another ".css" to filenames if already present - [Aliaxandr (saks)](https://github.com/saks)

### 1.1.2

[full changelog](https://github.com/Mange/roadie/compare/v1.1.1...v1.1.2)

* Support for Rails 3.1.0 and later inside gemspec

### 1.1.1

[full changelog](https://github.com/Mange/roadie/compare/v1.1.0...v1.1.1)

* Support for Rails 3.1.x (up to and including RC4)
  * Rails 3.0.x is still supported
* Added CI via [Travis CI](http://travis-ci.org)

### 1.1.0

[full changelog](https://github.com/Mange/roadie/compare/v1.0.1...v1.1.0)

* Enhancements:
  * Support for inlining `<link>` elements (thanks to [aliix](https://github.com/aliix))

### 1.0.1

[full changelog](https://github.com/Mange/roadie/compare/v1.0.0...v1.0.1)

* Enhancements:
  * Full, official support for Ruby 1.9.2 (in addition to 1.8.7)
* Dependencies:
  * Explicilty depend on nokogiri >= 1.4.4

### 1.0.0

[full changelog](https://github.com/Mange/roadie/compare/legacy...v1.0.0)

Roadie fork!

* Enhancements:
  * Support for Rails 3.0
  * Code cleanup
  * Support `!important`
  * Tests
  * + some other enhancements
* Deprecations:
  * Removed support for Rails 2.x