text:
!
!=====NOTES=============================================================
!
!	program for testing FORTCONT subroutines on some vector fields
!	defined in the module VECFIELDS
!
!	At the time, FORTCONT can be used only for 1 parameter
!	continuation. More specificly, it is a set of predictor-corrector
!	(PC) methods.
!
!	The PC methods availible are corrector using the pseudo-arclength,
!	correctorAL and corrector based on finding the nearest point on
!	the solution curve, using the Moore-Penrose matrix pseudoinverse,
!	correctorPM
!
!	Author:	Martin Isoz
!	Date  :	01/11/2013
!	System:	Linux 3.2.0-54-generic
!	Lic.  :	FreeBSD (viz. LICENSE)
!
!-----------------------------------------------------------------------
!
!	in the following text:
!	nVar	... number of state variables
!	nParC	... number of continued parameters
!	nEqs	... number of vector field elements (number of equations)
!	nParF	... number of vector field fixed parameters
!
!-----------------------------------------------------------------------
!
!	vector field in VECFIELDS must be a subroutine callable with:
!	call VECFIELDS (xVec, RSVec, pars), where
!	xVec	... state variable, vector of points for which I am
!		    calculating the return values of vecfield
!		... double precision, dimension(nVar+nParC),intent(in)
!	RSVec	... vector of vector field right hand sides on output
!		... double precision, dimension(nEqs),intent(out)
!	pars	... fixed parameters of the subroutine
!		... double precision, dimension(nParF),intent(in)
!
!-----------------------------------------------------------------------
!
!
!     continuation itself is done by calling the subroutine SOLVER by:
!
!          call solver (VECFIELD,PREDICTOR,CORRECTOR,xVec,ip,&
!    & BMin,BMax,BTrg,pars,(/nDim,nVar/),nParF,g,h,rstep,nprstep,eps,&
!    & maxiter,wrtunt,retcode)
!
!     and input parameters have the following meaning
!
!     subroutines
!     VECFIELD    ... name of the subroutine from VECFIELDS module (or
!                     any other vector field with requierred structure)
!     PREDICTOR   ... the predictor used for solution continuation
!     CORRECTOR   ... corrector used for the predicted solution refining
!                 ... correctorAL or correctorPM
!
!     problem variables
!     xVec  ...   initial solution point, state variables + continued
!                 parameters (state variables in the next)
!           ...   double precision, dimension(nVar+nParC),intent(in)
!     ip    ...   index (position) of continued parameters in xVec
!           ...   integer(kind=4),dimension(nParC),intent(in)
!     BMin  ...   minimal admissible values of state variables
!           ...   double precision, dimension(nVar+nParC),intent(in)
!     BMax  ...   maximal admissible values of state variables
!           ...   double precision, dimension(nVar+nParC),intent(in)
!     BTrg  ...   target values of state variables on input, actually
!                 obtained values on the output
!           ...   double precision, dimension(nVar+nParC),intent(inou)
!     pars  ...   fixed parameters of the solved problem (parameters for
!                 the called VECFIELD)
!           ...   double precision,dimension(nParF),intent(in)
!     n     ...   dimension of the solved problem,
!           ...   n(1)=nEqs, n(2)=nVar+nParC
!           ...   integer(kind=4),dimension(2),intent(in)
!     m     ...   number of fixed parameters of the solved problem
!           ...   m = nParF
!           ...   integer(kind=4),dimension(1),intent(in)
!
!     auxiliary variables of the FORTCONT subroutines
!     g     ...   step for the numerical differentiation. it is not
!                 adaptable. At the time, the symmetric forward/bacwards
!                 formula of second order is used, but due to its cost
!                 (number of operations needed for its evaluation),
!                 it may be changed to first order forwards formula in
!                 the following versions
!     h     ...   vector with steps for the predictor jump length
!           ...   (/h0,hMin,hMax/) - initial, minimal and maximal step
!                 the step length of predictor is adaptively changed in
!                 dependence of the speed of convergence of corrector
!                 methods
!     maxstep..   maximal number of steps of the main algorithm on input
!                 actual number of steps on output
!                 integer(kind=4),dimension(1),intent(inout)
!     nprstep..   for the predictor, there is a possibility to use
!                 higher order explicit numerical integration formula.
!                 if some multiple step method is used, nprstep is a
!                 number of steps needed to initiate the method. for
!                 example in case of Adams-Bashforts integration of 3rd
!                 order, nprstep = 3
!           ...   integer(kind=4),dimension(1),intent(in)
!     eps   ...   desired accuracy of corrector methods
!           ...   double precision,dimension(1),intent(in)
!     maxiter..   maximal number of iterations for the corrector method
!                 integer(kind=4),dimension(1),intent(in)
!
!     program runtime and IO variables
!     wrtunt...   unit to which the solution will be written.
!                 in accordance with fortran write statement, 6 is
!                 reserved for the terminal output.
!           ...   the unit must be openned and prepared for writing
!                 before the call to SOLVER subroutine
!           ...   integer(kind=4),dimension(1),intent(in)
!     retcode..   return code of the solver subroutine, basic
!                 diagnostics of the program runtime behavior
!                 -1- premature ending, probably due to a bug
!                 0 - some of the target values of state variables was
!                     reached, x(i) = BTrg(i)
!                 1 - algorithm stepped outside of region of interest,
!                     maximal(minimal) allowed value of state variable
!                     was exceeded
!                 2 - current step size is lower than minimal allowed
!                     step, hAct < hMin
!                 3 - corrector did not converge, the number of
!                     iterations in corrector method in current step
!                     exceeded maxiter parameter
!                 4 - maxstep was exceeded
!
!     the solution is written to wrtunt and is of the following form:
!
!-----------------------------------------------------------------------
!
!     before call to SOLVER subroutine, it is mandatory to prepare all
!     the needed variables as listed above as well as the unit for
!     writing the result in.
!
!     the results are plotted throught the GNUFOR2 interface between
!     FORTRAN and GNUPLOT written by Alexey Kuznetsov. For displaying
!     the graphics, one has to have GNUPlot installed and obey the rules
!     for GNUFOR2 use.
!
!=====TESTING=PROGRAM=ITSELF============================================
!
      program testfortcont
!
!=====HEAD==============================================================
!
!     Author:      Martin Isoz
!     Date  :      01/11/2013
!     System:      Linux 3.2.0-54-generic
!     Lic.  :      FreeBSD (viz. LICENSE)
!
!     Program for testing the FORTCONT subroutines
!
!     compilation: make/make run/make clean
!     NOTE: the makefile is set up for my computer, so if you will wish
!           to compile the code for yourself, you will need to modify it
!     NOTE: as the LAPACK and BLAS subroutines are used in FORTCONT
!           module, one has to have them installed and properly linked
!           before the compilation
!
!=======================================================================
      use Vecfields                                                     !load the module vecfields
      use FORTCONT                                                      !load the FORTCONT module
      use gnufor2                                                       !load GNUFOR2 for graphics
!
      implicit none
!
!=====INTERFACE=DEFINITION=AND=MODULES=LOADING==========================
!
!
!=====VARIABLES=DECLARATION=============================================
!
!     state variables and parameters
      double precision,dimension(2):: uu1,uu2,La                        !state variables - initial points
      double precision            :: MM,CC,De                           !used solution parameters
      integer(kind=4),parameter   :: nDim=2,nParF=3,nVar=3              !number of equations, fixed pars and state vars (all)
      integer(kind=4),parameter   :: ip(nVar-nDim)=(/3/)                !position of the parameter in state variables vector
!     SOLVER subroutines variables
      double precision            :: xVec(nVar),pars(nVar)              !vectors of state variables and parameters
      double precision,parameter  :: g=1.0d-4,eps=1.0d-10               !numerical derivation step and desired sol. accuracy
      double precision,parameter  :: h(3)=(/1.0d-4,1.0d-9,3.0d-2/)      !steps for the predictor
      double precision            :: BMin(nVar),BMax(nVar),BTrg(nVar)   !boundaries of the region of interest
      integer(kind=4)             :: retcode,maxstep=1000               !return code, maximal/acual number of steps of the alg.
      integer(kind=4),parameter   :: maxiter=15                         !maximal number of iterations in corrector methods
      integer(kind=4),parameter   :: nprstep=5                          !number of kept tangent vectors
      integer(kind=4),parameter   :: wrtunt=6                           !write unit
!     MAIN program variables
      integer(kind=4)             :: cyccount,rstep                     !cycles counter, resulting number of steps
!     junk variables
      double precision            :: tVec(1,nVar)
!     strings
!
!
!=====EXECUTABLE=PART===================================================
!
!-----solution-initiation-----------------------------------------------
!     fixed parameters values
      MM          = 1.0d0                                               !1.0e0
      CC          = 1.0d0                                               !1.0e0
      De          = 5.0d-2                                              !0.05d0
!
!     starting points for different runs of the algorithm
      uu1(2)         = -1.883798570d0                                   !-1.883798570d0
      uu2(2)         = 0.0d0                                            !0.0d0
      La(2)          = 0.999d0                                          !0.990d0
      uu1(1)         = 0.0d0
      uu2(1)         = 0.0d0
      La(1)          = 0.0d0
!
!     preparation of the SOLVER variables
      pars = (/MM,CC,De/)                                               !fixed parameters of elastica1D1P
!      xVec = (/uu1,uu2,La/)                                             !state variables - call without cycle
      BMin  = (/-1.0d3, -1.0d3, -1.0d3/)
      BMax  = (/1.0d3, 1.0d3, 1.0d0/)
!     openning of the writing unit
!      open(1, file='dataES.dat', status='new')                          !open the file for writing

      tVec(1,:)  = (/1.0d0,1.0d0,1.0d0/)                                !initial tanget vector
!
!-----call-to-SOLVER-subroutine-----------------------------------------
!
      do cyccount=1,2,1
!     variables restart
      xVec = (/uu1(cyccount),uu2(cyccount),La(cyccount)/)               !state variables - call throught cycle
      BTrg  = BMax
      rstep = maxstep
!     call to SOLVER
      call solver (elastica1D1P,predictorPT,correctorPM,xVec,ip,&
     & BMin,BMax,BTrg,pars,(/nDim,nVar/),nParF,g,h,rstep,nprstep,eps,&
     & maxiter,wrtunt,retcode)
!
!     write retcode to terminal
      write(unit=*,fmt=*) 'Return code: ',retcode

!
      end do
!
!-----graphical-outputs-------------------------------------------------
!
!      call run_gnuplot('commands1.txt')                                 !Eq. points continuation
!
!     delete the file with results
!      close(1, status='delete')
!
!=======================================================================
!
      end program testfortcont


text:
using ReMi.Contracts.Enums;

namespace ReMi.BusinessEntities.DeploymentTool
{
    public enum JobStage
    {
        [EnumDescription("Before release")]
        BeforeRelease,
        [EnumDescription("Before offline")]
        BeforeOffline,
        [EnumDescription("During offline")]
        DuringOffline,
        [EnumDescription("After offline")]
        AfterOffline,
        [EnumDescription("After release")]
        AfterRelease
    }
}

redpajama_set_name: RedPajamaGithub


text:
#/** \ingroup utils
* \{
*
* \file utils/ranges.hpp
* \brief This file defines template functions
*        that manipulate iterator ranges.
*/

#ifndef H_utils_ranges
#define H_utils_ranges

#include <algorithm>
#include <type_traits>
#include <memory>

namespace UtopiaOS
{
    namespace utils
    {
        /** \brief Given a boost range object and a location,
         *         create a boost range object with one given
         *         element inserted at that location.
         * \tparam Range The boost range type
         * \tparam RangeIterator The boost range iterator type
         * \tparam T The reference type
         * \param[in] range The boost range object
         * \param[in] location The location at which to insert
         *                     the reference
         * \param[in] ref The reference to be inserted
         *
         * \returns A range object with the reference inserted
         *          at the given position.
         */
        template<class Range, class RangeIterator, class T>
        auto range_by_inserting_reference( const Range &range,
                                          RangeIterator location,
                                          T &&ref )
        {
            auto lower_range = boost::make_iterator_range( boost::begin( range ),
                                                           location );
            auto ref_range = boost::make_iterator_range( std::addressof( ref ),
                                                        std::addressof( ref ) + 1 );
            auto upper_range = boost::make_iterator_range( location,
                                                           boost::end( range ) );

            return  boost::join( boost::join( lower_range, ref_range ), upper_range );
        }

        /** \brief Given a sorted boost range object, create a
         *         boost range object with one more element that
         *         is still sorted.
         * \tparam Range The boost range type
         * \tparam T The reference type
         * \param[in] range The boost range object
         * \param[in] ref The reference to be inserted
         *
         * \returns A range object with one more element that is
         *         still sorted.
         *
         * \note The input range has to be sorted, otherwise the
         *       behaviour is undefined.
         */
        template<class Range, class T>
        auto sorted_range_insert_reference( const Range &range, T &&ref )
        {
            debug_assert( std::is_sorted( boost::begin( range ), boost::end( range ) ),
                         "The input range has to be sorted." );

            auto larger = std::find_if( boost::begin( range ),
                                       boost::end( range ),
                                       [&ref] ( const auto &compare ) {
                return !(compare < ref);
            } );

            return range_by_inserting_reference( range, larger, std::forward<T>( ref ) );
        }
    }
}

#endif

/** \} */


text:
package Perl::Critic::Policy::Documentation::RequirePodAtEnd;

use 5.006001;
use strict;
use warnings;
use Readonly;

use List::Util qw(first);

use Perl::Critic::Utils qw{ :severities };
use base 'Perl::Critic::Policy';

our $VERSION = '1.118';

#-----------------------------------------------------------------------------

Readonly::Scalar my $POD_RX => qr{\A = (?: for|begin|end ) }xms;
Readonly::Scalar my $DESC => q{POD before __END__};
Readonly::Scalar my $EXPL => [139, 140];

#-----------------------------------------------------------------------------

sub supported_parameters { return ()                      }
sub default_severity     { return $SEVERITY_LOWEST        }
sub default_themes       { return qw( core cosmetic pbp ) }
sub applies_to           { return 'PPI::Document'         }

#-----------------------------------------------------------------------------

sub violates {
    my ( $self, $elem, $doc ) = @_;

    # No POD means no violation
    my $pods_ref = $doc->find('PPI::Token::Pod');
    return if !$pods_ref;

    # Look for first POD tag that isn't =for, =begin, or =end
    my $pod = first { $_ !~ $POD_RX} @{ $pods_ref };
    return if !$pod;

    my $end = $doc->find_first('PPI::Statement::End');
    if ($end) {  # No __END__ means definite violation
        my $pod_loc = $pod->location();
        my $end_loc = $end->location();
        if ( $pod_loc->[0] > $end_loc->[0] ) {
            # POD is after __END__, or relative position couldn't be determined
            return;
        }
    }

    return $self->violation( $DESC, $EXPL, $pod );
}

1;

__END__

#-----------------------------------------------------------------------------

=pod

=head1 NAME

Perl::Critic::Policy::Documentation::RequirePodAtEnd - All POD should be after C<__END__>.

=head1 AFFILIATION

This Policy is part of the core L<Perl::Critic|Perl::Critic>
distribution.

=head1 DESCRIPTION

Perl stops processing code when it sees an C<__END__> statement.  So,
to save processing time, it's faster to put documentation after the
C<__END__>.  Also, writing all the POD in one place usually leads to a
more cohesive document, rather than being forced to follow the layout
of your code.  This policy issues violations if any POD is found
before an C<__END__>.

=head1 CONFIGURATION

This Policy is not configurable except for the standard options.

=head1 NOTES

Some folks like to use C<=for>, and C<=begin>, and C<=end> tags to
create block comments in-line with their code.  Since those tags
aren't usually part of the documentation, this Policy does allows them
to appear before the C<__END__> statement.

    =begin comments

    frobulate()
    Accepts:  A list of things to frobulate
    Returns:  True if successful

    =end comments

    sub frobulate { ... }

=head1 AUTHOR

Chris Dolan <cdolan@cpan.org>

=head1 COPYRIGHT

Copyright (c) 2006-2011 Chris Dolan.

This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.  The full text of this license
can be found in the LICENSE file included with this module

=cut

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 78
#   indent-tabs-mode: nil
#   c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :


text:
//-----------------------------------------------
//
//	This file is part of the Siv3D Engine.
//
//	Copyright (c) 2008-2019 Ryo Suzuki
//	Copyright (c) 2016-2019 OpenSiv3D Project
//
//	Licensed under the MIT License.
//
//-----------------------------------------------

# pragma once
# include <memory>
# include <Graphics/IGraphics.hpp>
# include "D3D11Device.hpp"
# include "D3D11SwapChain.hpp"
# include "D3D11RenderTarget.hpp"
# include "D3D11BlendState.hpp"
# include "D3D11RasterizerState.hpp"
# include "D3D11DepthStencilState.hpp"
# include "D3D11SamplerState.hpp"
# include "D3D11ScreenCapture.hpp"

namespace s3d
{
	class CGraphics_D3D11 : public ISiv3DGraphics
	{
	private:

		std::unique_ptr<D3D11Device> m_device;

		std::unique_ptr<D3D11SwapChain> m_swapChain;

		std::unique_ptr<D3D11RenderTarget> m_renderTarget;

		std::unique_ptr<D3D11BlendState> m_pBlendState;

		std::unique_ptr<D3D11RasterizerState> m_pRasterizerState;

		std::unique_ptr<D3D11DepthStencilState> m_pDepthStencilState;

		std::unique_ptr<D3D11SamplerState> m_pSamplerState;

		std::unique_ptr<D3D11ScreenCapture> m_pScreenCapture;

	public:

		CGraphics_D3D11();

		~CGraphics_D3D11() override;

		void init() override;

		bool present() override;

		void clear() override;

		void flush() override;

		void setSceneTextureFilter(TextureFilter textureFilter) override;

		TextureFilter getSceneTextureFilter() const override;

		void setBackgroundColor(const ColorF& color) override;

		void setLetterboxColor(const ColorF& color) override;

		void setTargetFrameRateHz(const Optional<double>& targetFrameRateHz) override;

		Optional<double> getTargetFrameRateHz() const override;

		double getDPIScaling() const override;

		double getDisplayRefreshRateHz() const override;

		void skipClearScreen() override;

		const Size& getBackBufferSize() const override;

		const Size& getSceneSize() const override;

		void setSceneSize(const Size& sceneSize) override;

		void resizeBuffers(const Size& backBufferSize, const Size& sceneSize) override;

		Optional<Rect> getFullscreenRect() override;

		void requestScreenCapture() override;

		const Image& getScreenCapture() const override;

		ID3D11Device* getDevice() const { return m_device->getDevice(); }

		ID3D11DeviceContext* getContext() const { return m_device->getContext(); }

		D3D11RenderTarget* getRenderTarget() const { return m_renderTarget.get(); }

		D3D11BlendState* getBlendState() const { return m_pBlendState.get(); }

		D3D11RasterizerState* getRasterizerState() const { return m_pRasterizerState.get(); }

		D3D11SamplerState* getSamplerState() const { return m_pSamplerState.get(); }

		void updateDisplayInfo();
	};
}


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NChainer;
using NConstrictor;

namespace KelpNet.Tests
{
    [TestClass]
    public class TestSGD
    {
        [TestMethod]
        public void SGDRandomTest()
        {
            Python.Initialize();
            Chainer.Initialize();

            int inputCount = Mother.Dice.Next(2, 50);
            int outputCount = Mother.Dice.Next(2, 50);
            int batchCount = Mother.Dice.Next(1, 5);

            Real[,] input = (Real[,])Initializer.GetRealNdArray(new[] { batchCount, inputCount });

            Real[,] dummyGy = (Real[,])Initializer.GetRealNdArray(new[] { batchCount, outputCount });
            Real[,] w = (Real[,])Initializer.GetRealNdArray(new[] { outputCount, inputCount });

            Real[] b = Initializer.GetRealArray(outputCount);

            //Chainer
            NChainer.Linear<Real> cLinear = new NChainer.Linear<Real>(inputCount, outputCount, false, Real.ToBaseNdArray(w), Real.ToBaseArray(b));
            NChainer.SGD<Real> cSgd = new NChainer.SGD<Real>();
            cSgd.Setup(cLinear);

            Variable<Real> cX = new Variable<Real>(Real.ToBaseNdArray(input));

            Variable<Real> cY = cLinear.Forward(cX);
            cY.Grad = Real.ToBaseNdArray(dummyGy);

            cY.Backward();

            cSgd.Update();

            //KelpNet
            KelpNet.CL.Linear linear = new KelpNet.CL.Linear(inputCount, outputCount, false, w, b);
            KelpNet.SGD sgd = new SGD();
            sgd.SetUp(linear);

            NdArray x = new NdArray(Real.ToRealArray(input), new[] { inputCount }, batchCount);

            NdArray y = linear.Forward(x)[0];
            y.Grad = Real.ToRealArray(dummyGy);

            y.Backward();

            sgd.Update();

            Real[] cW = Real.ToRealArray((Real[,])cLinear.W.Data);
            Real[] cb = (Real[])cLinear.b.Data;

            //許容範囲を算出
            double delta = 0.00001;

            //W.grad
            Assert.AreEqual(cW.Length, linear.Weight.Data.Length);
            for (int i = 0; i < linear.Weight.Data.Length; i++)
            {
                Assert.AreEqual(cW[i], linear.Weight.Data[i], delta);
            }

            //b.grad
            Assert.AreEqual(cb.Length, linear.Bias.Data.Length);
            for (int i = 0; i < linear.Bias.Data.Length; i++)
            {
                Assert.AreEqual(cb[i], linear.Bias.Data[i], delta);
            }
        }
    }
}


text:
/**
 * Created by robotic4 on 28/9/15.
 */

var homeModule = angular.module('myApp.home',['ngRoute','firebase']);

homeModule.config(['$routeProvider',function($routeProvider)
{
    $routeProvider

    .when('/home',
    {
        templateUrl:'home/home.html',
        controller: 'homeController'

    });

}]);

homeModule.controller('homeController',['$scope','$firebaseAuth','$location','UserCommonProperties',function($scope,$firebaseAuth,$location,UserCommonProperties)
{
   console.log('hello');

    var firebaseObj = new Firebase("https://glaring-heat-1216.firebaseio.com");

    var loginObj = $firebaseAuth(firebaseObj);

    console.log('loginObj created');

    $scope.SignIn = function(event)
    {
        var userName = $scope.user.email;

        var password =   $scope.user.password;

        loginObj.$authWithPassword(
            {
                email : userName,

                password : password
            })

            .then(function(user) {
                //Success callback
                console.log('Authentication successful');

                UserCommonProperties.setUser(user.password.email);

                $location.path('/welcome');
            }, function(error) {
                //Failure callback
                console.log('Authentication failure');
                console.log('error');
            });
    }

}]);

homeModule.service('UserCommonProperties',function()
{
    var user = '';

    return {

        getUser:function()
        {
            return user;
        },

        setUser:function(value)
        {
            user = value;
        }
    };
});


text:
from __future__ import unicode_literals

from django.db import migrations

class Migration(migrations.Migration):

    dependencies = [
        ('pdfapp', '0027_programa_solicitud'),
        ('pdfapp', '0029_auto_20170316_0313'),
    ]

    operations = [
    ]


text:
using Foundation;
using System;
using HiPMobile.iOS;
using UIKit;
using MapKit;

namespace HiPMobile.iOS
{
    public partial class OsmMapView : MKMapView
    {
        ///I think there will be a need of delegade to implement some methods depending on where the map is placed
        /// check how is TableViewSource used in the HomeScreenViewController and MainViewController
        /// In this case you'll need
        //public WeakReference<OsmMapViewDelegate> OsmDelegate { get; set; } // weak reference in order to avoid memory leaks (retain cycles)
        //helpful https://www.youtube.com/watch?v=xP7YvdlnHfA
        public OsmMapView (IntPtr handle) : base (handle)
        {

        }
    }
}


text:
#include <algorithm>
#include <cmath>
#include <cstdio>

namespace ofxPixelPusher {

	struct ColorHSB {
		float mHue; // hue from 0 - 360
		float mSaturation; // 0 - 1
		float mBrightness; // 0 - 1
	};

	struct ColorRGB {
		unsigned char mRed;
		unsigned char mGreen;
		unsigned char mBlue;
	};

	static ColorHSB rgb2hsb(ColorRGB inputColor)
	{
		ColorHSB outputColor;
		double min, max, delta;

		min = inputColor.mRed < inputColor.mGreen ? inputColor.mRed : inputColor.mGreen;
		min = min  < inputColor.mBlue ? min : inputColor.mBlue;

		max = inputColor.mRed > inputColor.mGreen ? inputColor.mRed : inputColor.mGreen;
		max = max > inputColor.mBlue ? max : inputColor.mBlue;

		outputColor.mBrightness = max;
		delta = max - min;
		if (delta < 0.00001)
		{
			outputColor.mSaturation = 0;
			outputColor.mHue = 0;
			return outputColor;
		}
		if (max > 0.0) {
			outputColor.mSaturation = (delta / max);
		}
		else {
			outputColor.mSaturation = 0.0;
			outputColor.mHue = NAN;
			return outputColor;
		}
		if (inputColor.mRed >= max)
			outputColor.mHue = (inputColor.mGreen - inputColor.mBlue) / delta;
		else
			if (inputColor.mGreen >= max)
				outputColor.mHue = 2.0 + (inputColor.mBlue - inputColor.mRed) / delta;
			else
				outputColor.mHue = 4.0 + (inputColor.mRed - inputColor.mGreen) / delta;

		outputColor.mHue *= 60.0;

		if (outputColor.mHue < 0.0)
			outputColor.mHue += 360.0;

		return outputColor;
	}

	static ColorHSB rgb2hsb(unsigned char red, unsigned char green, unsigned char blue) {
		ColorRGB inputColor;
		inputColor.mRed = red;
		inputColor.mGreen = green;
		inputColor.mBlue = blue;

		return rgb2hsb(inputColor);
	}

	static ColorRGB hsb2rgb(ColorHSB inputColor)
	{
		double hh, p, q, t, ff;
		long i;
		ColorRGB outputColor;

		if (inputColor.mSaturation <= 0.0) {
			outputColor.mRed = 255.0*inputColor.mBrightness;
			outputColor.mGreen = 255.0*inputColor.mBrightness;
			outputColor.mBlue = 255.0*inputColor.mBrightness;
			return outputColor;
		}

		hh = inputColor.mHue;
		if (hh >= 360.0) hh = 0.0;
		hh /= 60.0;
		i = (long)hh;
		ff = hh - i;
		p = 255.0*inputColor.mBrightness * (1.0 - inputColor.mSaturation);
		q = 255.0*inputColor.mBrightness * (1.0 - (inputColor.mSaturation * ff));
		t = 255.0*inputColor.mBrightness * (1.0 - (inputColor.mSaturation * (1.0 - ff)));

		switch (i) {
		case 0:
			outputColor.mRed = 255.0*inputColor.mBrightness;
			outputColor.mGreen = t;
			outputColor.mBlue = p;
			break;
		case 1:
			outputColor.mRed = q;
			outputColor.mGreen = 255.0*inputColor.mBrightness;
			outputColor.mBlue = p;
			break;
		case 2:
			outputColor.mRed = p;
			outputColor.mGreen = 255.0*inputColor.mBrightness;
			outputColor.mBlue = t;
			break;

		case 3:
			outputColor.mRed = p;
			outputColor.mGreen = q;
			outputColor.mBlue = 255.0*inputColor.mBrightness;
			break;
		case 4:
			outputColor.mRed = t;
			outputColor.mGreen = p;
			outputColor.mBlue = 255.0*inputColor.mBrightness;
			break;
		case 5:
		default:
			outputColor.mRed = 255.0*inputColor.mBrightness;
			outputColor.mGreen = p;
			outputColor.mBlue = q;
			break;
		}

		return outputColor;
	}

	static ColorRGB hsb2rgb(float hue, float saturation, float brightness) {
		ColorHSB inputColor;
		inputColor.mHue = hue;
		inputColor.mSaturation = saturation;
		inputColor.mBrightness = brightness;

		return hsb2rgb(inputColor);
	}

	static float clamp(float n, float lower, float upper) {
		return std::max(lower, std::min(n, upper));
	}
}


text:
package och.comp.web.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import och.api.model.user.UserRole;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface RoleSecured {

	UserRole[] value() default {};

}


text:
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>SVG Test</title>

		<style>
			#source-svg {
				border: 1px solid black;
			}
		</style>
	</head>
	<body>
		<svg id="source-svg" width="550" height="800"></svg>

		<script>
			var svg;

			svg = document.getElementById('source-svg');
			svgNS = 'http://www.w3.org/2000/svg';

			function hexPoints(x, y, radius) {
		      var points = [];
		      for (var theta = 0; theta < Math.PI * 2; theta += Math.PI / 3) {
		        var pointX, pointY;
		        pointX = x + radius * Math.sin(theta);
		        pointY = y + radius * Math.cos(theta);
		        points.push(pointX + ',' + pointY);
		      }
		      console.log(points);
		      return points.join(' ');
    		}

    		//letter "M" and circle:
    		var m, circleM, leftLeafHalf, rightLeafHalf, innerCircleM;

    		//the letter "M"
    		m = document.createElementNS(svgNS, 'path');
    		m.setAttribute('d', 'M 80 117.5 V 187.5 H 95 V 147.5 L 110 187.5 L 125 147.5 V 187.5 H 140 V 117.5 H 120 L 110 157.5 L 100 117.5 H 80');
    		m.setAttribute('fill', '#3E3F37');
    		svg.appendChild(m);

    		//the circle next to letter "M"
    		circleM = document.createElementNS(svgNS, 'circle');
    		circleM.setAttribute('cx', 330);
    		circleM.setAttribute('cy', 165);
    		circleM.setAttribute('r', 130);
    		circleM.setAttribute('fill', '#3E3F37');
    		svg.appendChild(circleM);

    		//the letter "M" inside the circle:
    		innerCircleM = document.createElementNS(svgNS, 'path');
    		innerCircleM.setAttribute('d', 'M 300 165 V 235 H 315 V 195 L 330 235 L 345 195 V 235 H 360 V 165 H 340 L 330 205 L 320 165 H 300');
    		innerCircleM.setAttribute('fill', '#ffffff');
    		svg.appendChild(innerCircleM);

    		//drawing the leaf:
    		rightLeafHalf = document.createElementNS(svgNS, 'path');
    		rightLeafHalf.setAttribute('d', 'M 293 165 Q 293 115 330 85 L 330 205 L 320 165 Z');
    		rightLeafHalf.setAttribute('fill', '#5EB14A')
    		svg.appendChild(rightLeafHalf);

    		leftLeafHalf = document.createElementNS(svgNS, 'path');
    		leftLeafHalf.setAttribute('d', 'M 369 165 Q 370 115 330 85 L330 205 L 340 165 H 355');
    		leftLeafHalf.setAttribute('fill', '#449644');
    		svg.appendChild(leftLeafHalf);

    		var e, circleE, message, innerCircleText;
    		//Letter "E":
    		e = document.createElementNS(svgNS, 'path');
    		e.setAttribute('d', 'M 85 255 V 325 H 135 V 311 H 100 V 297 H 135 V 283 H 100 V 269 H 135 V 255 Z');
            svg.appendChild(e);

            //Circle next to letter "E":
            circleE = document.createElementNS(svgNS, 'circle');
            circleE.setAttribute('cx', 330);
            circleE.setAttribute('cy', 290);
            circleE.setAttribute('r', 130);
            svg.appendChild(circleE);

            //The text inside circle:
            message = document.createTextNode('express');
            text = document.createElementNS(svgNS, 'text');
            text.setAttribute('x', 223);
            text.setAttribute('y', 305);
            text.setAttribute('font-family', 'calibri');
            text.setAttribute('font-size', 70);
            text.setAttribute('fill', '#ffffff');
            text.appendChild(message);
            svg.appendChild(text);

            //Letter "A" and circle:
            var a, letterHole, circleA, outerBG, innerBG, innerA, innerAHole, darkArea;

            a = document.createElementNS(svgNS, 'path');
            a.setAttribute('d', 'M 80 462.5 L 100 392.5 H 120 L 140 462.5 H 125 L 122 452.5 H 98 L 95 462.5 Z');
            a.setAttribute('fill', '#E23337');
            svg.appendChild(a);

            letterHole = document.createElementNS(svgNS, 'path');
            letterHole.setAttribute('d', 'M 118 437.5 H 102 L 110 407.5 Z');
            letterHole.setAttribute('fill', '#ffffff');
            svg.appendChild(letterHole);

            //Circle next to letter "A":
            circleA = document.createElementNS(svgNS, 'circle');
            circleA.setAttribute('cx', 330);
            circleA.setAttribute('cy', 435);
            circleA.setAttribute('r', 130);
            circleA.setAttribute('fill', '#E23337');
            svg.appendChild(circleA);

            //Inner circle figure:
            outerBG = document.createElementNS(svgNS, 'path');
            outerBG.setAttribute('d', 'M 330 355 L 255 385 L 265 495 H 395 L 405 385 Z');
            outerBG.setAttribute('fill', '#B6A8A6');
            svg.appendChild(outerBG);

            innerBG = document.createElementNS(svgNS, 'path');
            innerBG.setAttribute('d', 'M 330 365 L 265 390 L 275 485 H 385 L 395 390 Z');
            innerBG.setAttribute('fill', '#E23337');
            svg.appendChild(innerBG);

            innerA = document.createElementNS(svgNS, 'path');
            innerA.setAttribute('d', 'M 330 370 L 278 480 H 298 L 308 460 H 352 L 362 480 H 382 Z');
            innerA.setAttribute('fill', '#ffffff');
            svg.appendChild(innerA);

            innerAHole = document.createElementNS(svgNS, 'path');
            innerAHole.setAttribute('d', 'M 315 440 H 345 L 330 405 Z');
            innerAHole.setAttribute('fill', '#E23337');
            svg.appendChild(innerAHole);

            darkArea = document.createElementNS(svgNS, 'path');
            darkArea.setAttribute('d', 'M 330 365 L 395 390 L 385 485 H 330 Z');
            darkArea.setAttribute('fill', 'rgba(0, 0, 0, 0.3');
            svg.appendChild(darkArea);

            //Letter "N" and Circle:
            var n, circleN, innerO, innerN, innerNHole, innerD, innerDHole, innerDPart, innerE, innerEHole;

            n = document.createElementNS(svgNS, 'path');
            n.setAttribute('d', 'M 80 600 V 530 H 95 L 125 570 V 530 H 140 V 600 H 125 L 95 560 V 600 Z');
            n.setAttribute('fill', '#8EC74E');
            svg.appendChild(n);

            circleN = document.createElementNS(svgNS, 'circle');
            circleN.setAttribute('cx', 330);
            circleN.setAttribute('cy', 565);
            circleN.setAttribute('r', 130);
            circleN.setAttribute('fill', '#8EC74E');
            svg.appendChild(circleN);

            //inner letter "o":
            innerO = document.createElementNS(svgNS, 'polygon');
            innerO.setAttribute('points', hexPoints(301.3, 565, 25));
            innerO.setAttribute('fill', '#ffffff');
            svg.appendChild(innerO);

            //inner letter "n":
            innerN = document.createElementNS(svgNS, 'path');
            innerN.setAttribute('d', 'M 223 590 V 553 L 245 540 L 265.5 553 V 590 L 252 578 V 560 L 245 555 L 236 560 V 578 Z');
            svg.appendChild(innerN);

            //inner letter "d":
            innerD = document.createElementNS(svgNS, 'polygon');
            innerD.setAttribute('points', hexPoints(358.6, 565, 25));
            svg.appendChild(innerD);

            innerDHole = document.createElementNS(svgNS, 'polygon');
            innerDHole.setAttribute('points', hexPoints(358.6, 565, 10));
            innerDHole.setAttribute('fill', '#ffffff');
            svg.appendChild(innerDHole);

            innerDPart = document.createElementNS(svgNS, 'path');
            innerDPart.setAttribute('d', 'M 367.2 570 L 380.2 577.5 V 517.5 L 367.2 510.5 Z');
            svg.appendChild(innerDPart);

            //inner letter "e":
            innerE = document.createElementNS(svgNS, 'path');
            innerE.setAttribute('d', 'M 416 540 L 394.3 552.5 V 577.5 L 416 590 L 429 582.5 L 407.3 570 V 560 L 416 555 L 424.6 560 V 568 L 437.6 560.5 V 552.5 Z');
            svg.appendChild(innerE);

            innerEHole = document.createElementNS(svgNS, 'polygon');
            innerEHole.setAttribute('points', hexPoints(416, 565, 6));
            innerEHole.setAttribute('fill', '#ffffff');
            svg.appendChild(innerEHole);
		</script>

	</body>
</html>


text:
<?php

namespace ZendTest\Paginator;

use PHPUnit\Framework\TestCase;
use Zend\Paginator\Adapter\ArrayAdapter;
use Zend\Paginator\Paginator;
use Zend\Paginator\PaginatorIterator;

class PaginatorIteratorTest extends TestCase
{
    public function testIteratorFlattensPaginator()
    {
        $paginator = new Paginator(
            new ArrayAdapter(['foo', 'bar', 'fiz'])
        );

        $paginator->setItemCountPerPage(2);

        $iterator = new PaginatorIterator($paginator);

        $iterator->rewind();
        $this->assertTrue($iterator->valid());
        $this->assertEquals('foo', $iterator->current());
        $this->assertEquals(0, $iterator->key());
        $iterator->next();
        $this->assertTrue($iterator->valid());
        $this->assertEquals('bar', $iterator->current());
        $this->assertEquals(1, $iterator->key());
        $iterator->next();
        $this->assertTrue($iterator->valid());
        $this->assertEquals('fiz', $iterator->current());
        $this->assertEquals(2, $iterator->key());
        $iterator->next();
        $this->assertFalse($iterator->valid());
    }

    public function testIteratorReturnsInvalidOnEmptyIterator()
    {
        $paginator = new Paginator(
            new ArrayAdapter([])
        );

        $iterator = new PaginatorIterator($paginator);

        $iterator->rewind();
        $this->assertFalse($iterator->valid());
    }
}


text:
from twisted.internet import protocol
from BTL.decorate import decorate_func

## someday twisted might do this for me
class SmartReconnectingClientFactory(protocol.ReconnectingClientFactory):

    def buildProtocol(self, addr):
        prot = protocol.ReconnectingClientFactory.buildProtocol(self, addr)

        # decorate the protocol with a delay reset
        prot.connectionMade = decorate_func(self.resetDelay,
                                            prot.connectionMade)

        return prot


text:
'''
@author: sheng
@license:
'''

import unittest
from meridian.acupoints import yinlingquan122

class TestYinlingquan122Functions(unittest.TestCase):
    def setUp(self):
        pass

    def test_xxx(self):
        pass

if __name__ == '__main__':
    unittest.main()


text:
{% extends '../layout/layout.html' %}

{% block script %}
{% parent %}

{% endblock %}

{% block content %}

Demo App

{% endblock %}


text:
package com.neeve.tick2trade.domain;

import com.neeve.lang.XString;
import com.neeve.tick2trade.messages.HandlingInstructions;
import com.neeve.tick2trade.messages.OrdStatus;
import com.neeve.tick2trade.messages.OrdType;
import com.neeve.tick2trade.messages.OrderCapacity;
import com.neeve.tick2trade.messages.SecurityIDSource;
import com.neeve.tick2trade.messages.Side;
import com.neeve.tick2trade.messages.TimeInForce;
import com.neeve.util.UtlPool;
import com.neeve.util.UtlPool.Item;

final public class Order implements Item<Order> {

    final private static class OrderFactory implements UtlPool.Factory<Order> {
        final public Order createItem(final Object context) {
            return Order.create();
        }

        final public Order[] createItemArray(final int size) {
            return new Order[size];
        }
    }

    // order pool
    private UtlPool<Order> pool;

    // poc fields
    long orderTs;

    // domain fields
    final private XString orderId = XString.create(32, false, true);
    final private XString complianceId = XString.create(32, false, true);
    final private XString securityId = XString.create(4, false, true);
    final private XString securityAltId = XString.create(4, false, true);
    final private XString positionAccount = XString.create(13, false, true);
    final private XString symbol = XString.create(4, false, true);
    final private XString routeId = XString.create(3, false, true);
    final private XString clientAcronym = XString.create(4, false, true);
    final private XString targetStategy = XString.create(4, false, true);
    final private XString targetStrategyParameters = XString.create(10, false, true);
    final private XString outboundSystem = XString.create(13, false, true);
    final private XString lastText = XString.create(10, false, true);
    final private XString executingTrader = XString.create(1, false, true);

    private SecurityIDSource securityIdSource;
    private OrdStatus ordStatus;
    private OrderCapacity orderCapacity;
    private OrdType ordType;
    private double price;
    private Side side;
    private TimeInForce timeInForce;
    private HandlingInstructions handlInst;
    private double orderQty;
    private double maxFloor;
    private long transactTime;
    private double leavesQty;
    private double cumQuantity;

    // other fields (specific to POC for w2w measurement)
    private long nosPostWireTs;

    /**
     * Creates a new order pool with the provided number of preallocated orders.
     *
     * @param orderPreallocateCount
     *            The number of orders to preallocate in the pool.
     *
     * @return A new order pool.
     */
    public static UtlPool<Order> createPool(int orderPreallocateCount) {
        final UtlPool<Order> orderPool = UtlPool.create("order", "order", new OrderFactory(), UtlPool.Params.create().setThreaded(false).setInitialCapacity(orderPreallocateCount));
        System.out.println("Seeding order state pool with " + (orderPreallocateCount - orderPool.size()) + " entries");
        while (orderPool.size() < orderPreallocateCount) {
            final Order state = Order.create();
            state.setPool(orderPool);
            orderPool.put(state);
        }
        System.out.println("order state pool seeded size=" + orderPool.size() + " entries");
        return orderPool;
    }

    final public static Order create() {
        return new Order();
    }

    final public Order extract(com.neeve.tick2trade.messages.EMSNewOrderSingle nos) {
        nos.getClOrdIDTo(orderId);
        nos.getComplianceIDTo(complianceId);
        nos.getPositionAccountTo(positionAccount);
        securityIdSource = nos.getSecurityIDSource();
        nos.getSecurityIDTo(securityId);
        nos.getSecurityAltIDTo(securityAltId);
        nos.getSymbolTo(symbol);
        ordType = nos.getOrdType();
        price = nos.getPrice();
        orderQty = nos.getOrderQty();
        maxFloor = nos.getMaxFloor();
        side = nos.getSide();
        orderTs = nos.getOrderTs();
        nos.getClientAcronymTo(clientAcronym);
        transactTime = nos.getTransactTimeAsTimestamp();
        timeInForce = nos.getTimeInForce();
        nos.getTargetStrategyTo(targetStategy);
        nos.getTargetStrategyParametersTo(targetStrategyParameters);
        ordStatus = OrdStatus.NEW;
        orderCapacity = nos.getOrderCapacity();
        nos.getTextTo(lastText);
        leavesQty = 0.0;
        nos.getExecutingTraderTo(executingTrader);
        cumQuantity = nos.getOrderQty();
        handlInst = nos.getHandlInst();
        return this;
    }

    final public void setNosPostWireTs(final long ts) {
        nosPostWireTs = ts;
    }

    final public long getNosPostWireTs() {
        return nosPostWireTs;
    }

    final public XString getComplianceId() {
        return complianceId;
    }

    final public XString getOrderId() {
        return orderId;
    }

    final public XString getClOrdId() {
        return orderId;
    }

    final public XString getPositionAccount() {
        return positionAccount;
    }

    final public XString getSecurityId() {
        return securityId;
    }

    final public XString getSecurityAldID() {
        return securityAltId;
    }

    final public XString getSymbol() {
        return symbol;
    }

    final public XString getRouteId() {
        return routeId;
    }

    final public XString getClientAcronym() {
        return clientAcronym;
    }

    final public XString getTargetStrategy() {
        return targetStategy;
    }

    final public XString getTargetStrategyParameters() {
        return targetStrategyParameters;
    }

    final public XString getOutboundSystem() {
        return outboundSystem;
    }

    final public XString getExecutingTrader() {
        return executingTrader;
    }

    final public XString getLastText() {
        return lastText;
    }

    final public SecurityIDSource getSecurityIDSource() {
        return securityIdSource;
    }

    final public OrdType getOrderType() {
        return ordType;
    }

    final public double getPrice() {
        return price;
    }

    final public TimeInForce getTimeInForce() {
        return timeInForce;
    }

    final public OrdStatus getOrderStatus() {
        return ordStatus;
    }

    final public OrderCapacity getOrderCapacity() {
        return orderCapacity;
    }

    final public Side getSide() {
        return side;
    }

    final public HandlingInstructions getHandlInst() {
        return handlInst;
    }

    final public double getOrderQty() {
        return orderQty;
    }

    final public double getMaxFloor() {
        return maxFloor;
    }

    final public long getOriginTs() {
        return orderTs;
    }

    final public long getTransactTime() {
        return transactTime;
    }

    final public double getLeavesQty() {
        return leavesQty;
    }

    final public double getCumQuantity() {
        return cumQuantity;
    }

    /*
     * Implementation of {@link Item#init()}
     */
    @Override
    final public Order init() {
        return this;
    }

    /*
     * Implementation of {@link Item#setPool}
     */
    @Override
    final public Order setPool(UtlPool<Order> pool) {
        this.pool = pool;
        return this;
    }

    /*
     * Implementation of {@link Item#getPool}
     */
    @Override
    final public UtlPool<Order> getPool() {
        return pool;
    }

}


text:
Configuration
=============

Configuration of Crud is done through the Crud ``component`` - either on the fly
anywhere in you application, or by providing the configuration in the
``Controller::$components`` property.

Assuming you have followed the :doc:`installation guide<installation>` we will
now begin the actual configuration of Crud.

Crud is loaded like any other ``Component`` in CakePHP - simply by adding it to
the ``$components`` variable in the controller

.. code-block:: phpinline

  class AppController extends \Cake\Controller\Controller {

    public $components = ['Crud.Crud'];

  }

At this time, the Crud Component is loaded and ready for usage.

However, Crud has not been configured to handle any controller actions yet.

Actions
-------

Configuring Crud to handle actions is simple.

The list of actions is provided either as ``Component`` configuration, or on the
fly.

An example of ``Component`` configuration:

.. code-block:: phpinline

  class AppController extends \Cake\Controller\Controller {

    public $components = [
      'Crud.Crud' => [
        'actions' => ['Crud.Index']
      ]
    ];

  }

An example of on the fly enabling an Crud action:

.. code-block:: phpinline

  class AppController extends \Cake\Controller\Controller {

    public function beforeFilter(\Cake\Event\Event $event) {
      $this->Crud->mapAction('index', 'Crud.Index');
    }

  }

The examples above are functionally identical, and instructs Crud to handle the
``index`` action in controllers using ``Crud.Index`` action class.

.. note::

  If you do not wish for Crud to be enabled across all controllers, or even use
  all ``actions`` provided by Crud
  you can pick and chose which to use. Crud will not force take-over any
  application logic, and you can enable/disable
  them as you see fit.

Action configuration
--------------------

.. note::

  Each :doc:`Crud Action<actions>` have a different set of configuration
  settings, please see their individual documentation page for more information.

Passing in configuration for an action is simple.

.. note::

  In the examples below, we reconfigure the `Index Action` to render
  ``my_index.ctp`` instead of ``index.ctp``

An example of ``Component`` configuration

.. code-block:: phpinline

  class AppController extends \Cake\Controller\Controller {

    public $components = [
      'Crud.Crud' => [
        'actions' => [
          'index' => ['className' => 'Crud.Index', 'view' => 'my_index']
        ]
      ]
    ];

  }

An example of on the fly enabling an Crud action with configuration

.. code-block:: phpinline

  class AppController extends \Cake\Controller\Controller {

    public function beforeFilter(\Cake\Event\Event $event) {
      $this->Crud->mapAction('index', [
        'className' => 'Crud.Index',
        'view' => 'my_index'
      ]);
    }

  }

Disabling loaded actions
------------------------
If you've loaded an action in eg. your ``AppController`` - but don't want it included in a specific controller, it can be disabled with the ``$this->Crud->disable(['action_name'])``.

Example of disable a loaded action:

.. code-block:: phpinline

  class AppController extends \Cake\Controller\Controller {

    public $components = [
      'Crud.Crud' => [
        'actions' => ['Crud.Index', 'Crud.View', 'Crud.Delete', 'Crud.Edit']
      ]
    ];

  }

.. code-block:: phpinline

  class PostsController extends AppController {

    public function beforeFilter(\Cake\Event\Event $event) {
      parent::beforeFilter($event);

      $this->Crud->disable(['Edit', 'Delete']);
    }

  }

Built-in actions
----------------

Crud provides the default ``CRUD`` actions out of the box.

* :doc:`Index Action<actions/index>`
* :doc:`View Action<actions/view>`
* :doc:`Add Action<actions/add>`
* :doc:`Edit Action<actions/edit>`
* :doc:`Delete Action<actions/delete>`
* :doc:`Lookup Action<actions/lookup>`
* :doc:`Bulk Delete Action<actions/bulk-delete>`
* :doc:`Bulk Set Value Action<actions/bulk-set-value>`
* :doc:`Bulk Field Toggle Action<actions/bulk-toggle>`

It's possible to create your own ``Crud Action`` as well, or overwrite the
built-in ones.

Simply provide the ``className`` configuration key for an action, and Crud will
use that one instead.

Listeners
---------

.. note::

  Each :doc:`Crud Listener<listeners>` have a different set of configuration
  settings, please see their individual documentation page for more information.


text:
// Time:  O(n * 4^n / n^(3/2)) ~= Catalan numbers
// Space: O(n)

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 * };
 */
class Solution {
public:
    vector<TreeNode*> generateTrees(int n) {
        if (n == 0) {
            return {};
        }
        return generateTreesHelper(1, n);
    }

private:
    vector<TreeNode *> generateTreesHelper(int start, int end) {
        vector<TreeNode *> result;
        if (start > end) {
            result.emplace_back(nullptr);
            return result;
        }

        for (int i = start; i <= end; ++i) {
            vector<TreeNode *> leftSubTrees = generateTreesHelper(start, i - 1);
            vector<TreeNode *> rightSubTrees = generateTreesHelper(i + 1, end);
            for (const auto& left : leftSubTrees) {
                for (const auto& right : rightSubTrees) {
                    TreeNode *root = new TreeNode(i);
                    root->left = clone(left);
                    root->right = clone(right);
                    result.emplace_back(root);
                }
            }

        }
        return result;
    }

    TreeNode *clone(TreeNode *root) {
        TreeNode *newRoot = nullptr;

        if (root) {
            newRoot = new TreeNode(root->val);
            newRoot->left = clone(root->left);
            newRoot->right = clone(root->right);
        }

        return newRoot;
    }
};

// -----JF-----

/**
 * Definition for binary tree
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 * };
 */
class Solution {
  public:
    vector<TreeNode *> dfs(int l, int r) {
      if (l > r) return vector<TreeNode *>({nullptr});
      vector<TreeNode *> res;
      for (int i = l; i <= r; ++ i) {
        vector<TreeNode *> left = dfs(l, i - 1), right = dfs(i + 1, r);
        for (const auto &l : left) {
          for (const auto &r : right) {
            TreeNode *current = new TreeNode(i);
            current->left = l;
            current->right = r;
            res.push_back(current);
          }
        }
      }
      return res;
    }
    vector<TreeNode *> generateTrees(int n) {
      return dfs(1, n);
    }
};


text:
[![node](https://img.shields.io/badge/node-%3E6.2.1-green.svg)](http://node.green/)

### Installation
You will need:
* Node.js above version 6.2.1
* A live Mongo installation with a database
* Your database URI

Clone this repository into its host directory, enter the main directory, and then install dependencies.

`yourProjectsDirectory$ git clone git@github.com:pretentiousgit/item-ratings-api.git`

`yourProjectsDirectory$ cd item-ratings-api`

`yourProjectsDirectory$ npm install`

to install package dependencies.

#### Likely Problems

* Node is out of date
  - Check your version with `node -v`. If it is less than 6.2.1, try to update.
  - install `http://brew.sh`, or update brew using `brew update`, and run `brew upgrade node`

* Your NPM isn't installing all dependencies with a single go-round
  - Remove node-modules and reinstall all your node-modules.
  - hot tip: `npm install && say i am done hal`

* Mongo is not presently running on your system
  - Is mongoDB installed? If not, install it using `brew install mongo`
  - If it is, try typing `mongod` at terminal

#### A Secrets.js file is required at root.
* In `database_info:`, enter your database connection string - something like `mongodb://127.0.0.1/ObjectDB`
* Rename `secretStub.js` to `secrets.js`, and generate an app secret for your application. Ideally, your secret will be something like 64 to 128 characters that are really, really random. This is basically a password so that if you later do some sort of authentication, which is not present in this demo, you can encode it with reasonable confidence it is mostly secure.

### Running App
Run the app from the main directory using `node server.js`

### Tests
Tests can be found in the `/test` directory

Test the app using the command `npm test`

Completed and successful tests will generate their own documentation.

### API Documentation
If your tests pass, this app will generate its own documentation automatically. You can find those docs with the server running. They will be located at:
`http://yourURL/docs/`

For a demo on a local machine, this means you'll find your docs at
`http://127.0.0.1:8081/docs/`

### 404
This API has a 404 message defined, which can be replaced by a JSON message or static HTML page.


text:
<?php

namespace Bread\ApiBundle\Form;

class FeedbackType extends BaseFormType
{
    /**
     * @param FormBuilder $builder
     * @return void
     */
    public function createForm(FormBuilder $builder)
    {
        parent::createForm($builder);

        $data = $builder->createForm();
        $data->add('Comment');

        $builder->add('Data', $data);
    }
}


text:
/**
 * Created by KuceraJan on 21.5.2017.
 */
import {Injectable} from "@angular/core";
import {ActivatedRouteSnapshot, CanActivate, CanActivateChild, RouterStateSnapshot} from "@angular/router";
import {LoggerFactory} from "../components/logger/loggerFactory.component";

@Injectable()
export class LoggingGuardService implements CanActivateChild, CanActivate {
    private logger = LoggerFactory.getLogger('services:country:guard');

    canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
        console.error("Can activate " + state.url);
        this.logger.debug("Can activate {0}", state.url);
        return true;
    }

    canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
        console.error("Can activate child " + state.url);
        this.logger.debug("Can activate child {0}", state.url);
        return true;
    }
}


text:
namespace MassTransit
{
    public interface IAmazonSqsMessageConsumeTopology<TMessage> :
        IMessageConsumeTopology<TMessage>
        where TMessage : class
    {
    }
}


text:
#ifndef _IPC_LOGGING_PRIVATE_H
#define _IPC_LOGGING_PRIVATE_H

#include <linux/ipc_logging.h>

#define IPC_LOG_VERSION 0x0001
#define IPC_LOG_MAX_CONTEXT_NAME_LEN 20

/**
 * struct ipc_log_page_header - Individual log page header
 *
 * @magic: Magic number (used for log extraction)
 * @nmagic: Inverse of magic number (used for log extraction)
 * @page_num: Index of page (0.. N - 1) (note top bit is always set)
 * @read_offset:  Read offset in page
 * @write_offset: Write offset in page (or 0xFFFF if full)
 * @log_id: ID of logging context that owns this page
 * @start_time:  Scheduler clock for first write time in page
 * @end_time:  Scheduler clock for last write time in page
 * @ctx_offset:  Signed offset from page to the logging context.  Used to
 *               optimize ram-dump extraction.
 *
 * @list:  Linked list of pages that make up a log
 * @nd_read_offset:  Non-destructive read offset used for debugfs
 *
 * The first part of the structure defines data that is used to extract the
 * logs from a memory dump and elements in this section should not be changed
 * or re-ordered.  New local data structures can be added to the end of the
 * structure since they will be ignored by the extraction tool.
 */
struct ipc_log_page_header {
	uint32_t magic;
	uint32_t nmagic;
	uint32_t page_num;
	uint16_t read_offset;
	uint16_t write_offset;
	uint64_t log_id;
	uint64_t start_time;
	uint64_t end_time;
	int64_t ctx_offset;

	/* add local data structures after this point */
	struct list_head list;
	uint16_t nd_read_offset;
};

/**
 * struct ipc_log_page - Individual log page
 *
 * @hdr: Log page header
 * @data: Log data
 *
 * Each log consists of 1 to N log pages.  Data size is adjusted to always fit
 * the structure into a single kernel page.
 */
struct ipc_log_page {
	struct ipc_log_page_header hdr;
	char data[PAGE_SIZE - sizeof(struct ipc_log_page_header)];
};

/**
 * struct ipc_log_context - main logging context
 *
 * @magic:  Magic number (used for log extraction)
 * @nmagic:  Inverse of magic number (used for log extraction)
 * @version:  IPC Logging version of log format
 * @user_version:  Version number for user-defined messages
 * @header_size:  Size of the log header which is used to determine the offset
 *                of ipc_log_page::data
 * @log_id:  Log ID (assigned when log is created)
 * @name:  Name of the log used to uniquely identify the log during extraction
 *
 * @list:  List of log contexts (struct ipc_log_context)
 * @page_list:  List of log pages (struct ipc_log_page)
 * @first_page:  First page in list of logging pages
 * @last_page:  Last page in list of logging pages
 * @write_page:  Current write page
 * @read_page:  Current read page (for internal reads)
 * @nd_read_page:  Current debugfs extraction page (non-destructive)
 *
 * @write_avail:  Number of bytes available to write in all pages
 * @dent:  Debugfs node for run-time log extraction
 * @dfunc_info_list:  List of deserialization functions
 * @context_lock_lhb1:  Lock for entire structure
 * @read_avail:  Completed when new data is added to the log
 */
struct ipc_log_context {
	uint32_t magic;
	uint32_t nmagic;
	uint32_t version;
	uint16_t user_version;
	uint16_t header_size;
	uint64_t log_id;
	char name[IPC_LOG_MAX_CONTEXT_NAME_LEN];

	/* add local data structures after this point */
	struct list_head list;
	struct list_head page_list;
	struct ipc_log_page *first_page;
	struct ipc_log_page *last_page;
	struct ipc_log_page *write_page;
	struct ipc_log_page *read_page;
	struct ipc_log_page *nd_read_page;

	uint32_t write_avail;
	struct dentry *dent;
	struct list_head dfunc_info_list;
	spinlock_t context_lock_lhb1;
	struct completion read_avail;
};

struct dfunc_info {
	struct list_head list;
	int type;
	void (*dfunc) (struct encode_context *, struct decode_context *);
};

enum {
	TSV_TYPE_INVALID,
	TSV_TYPE_TIMESTAMP,
	TSV_TYPE_POINTER,
	TSV_TYPE_INT32,
	TSV_TYPE_BYTE_ARRAY,
};

enum {
	OUTPUT_DEBUGFS,
};

#define IPC_LOG_CONTEXT_MAGIC_NUM 0x25874452
#define IPC_LOGGING_MAGIC_NUM 0x52784425
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define IS_MSG_TYPE(x) (((x) > TSV_TYPE_MSG_START) && \
			((x) < TSV_TYPE_MSG_END))
#define MAX_MSG_DECODED_SIZE (MAX_MSG_SIZE*4)

#if (defined(CONFIG_DEBUG_FS))
void check_and_create_debugfs(void);

void create_ctx_debugfs(struct ipc_log_context *ctxt,
			const char *mod_name);
#else
void check_and_create_debugfs(void)
{
}

void create_ctx_debugfs(struct ipc_log_context *ctxt, const char *mod_name)
{
}
#endif

#endif


text:
echo "------ifly build start ----------------"

IFLY_FRAMEWORKER_PATH="./framework"
if [ ! -d "$IFLY_FRAMEWORKER_PATH" ]; then
    mkdir -p "$IFLY_FRAMEWORKER_PATH"
fi

#copy imlib
IMLIB_PATH="../imlib/bin"
if [ -d "$IMLIB_PATH" ]; then
    echo "ifly build: copy imlib"
    cp -af ${IMLIB_PATH}/* ${IFLY_FRAMEWORKER_PATH}/
fi

#copy imkit

IMKIT_PATH="../imkit/bin"
if [ -d "$IMKIT_PATH" ]; then
    echo "ifly build: copy imkit"
    cp -af ${IMKIT_PATH}/* ${IFLY_FRAMEWORKER_PATH}/
fi

#copy imlibcore
IMLIBCORE_PATH="../imlibcore"
if [ -d ${IMLIBCORE_PATH}/ ]; then
   echo "ifly build: copy imlibcore"
   cp -af ${IMLIBCORE_PATH}/bin/* ${IFLY_FRAMEWORKER_PATH}/
fi

#copy chatroom
CHATROOM_PATH="../chatroom"
if [ -d ${CHATROOM_PATH}/bin ]; then
   echo "ifly build: copy chatroom"
   cp -af ${CHATROOM_PATH}/bin/* ${IFLY_FRAMEWORKER_PATH}/
fi

#copy discussion
DISCUSSION_PATH="../discussion"
if [ -d ${DISCUSSION_PATH}/bin ]; then
   echo "ifly build: copy discussion"
   cp -af ${DISCUSSION_PATH}/bin/* ${IFLY_FRAMEWORKER_PATH}/
fi

#copy publicservice
PUBLICSERVICE_PATH="../publicservice"
if [ -d ${PUBLICSERVICE_PATH}/bin ]; then
   echo "ifly build: copy publicservice"
   cp -af ${PUBLICSERVICE_PATH}/bin/* ${IFLY_FRAMEWORKER_PATH}/
fi

#copy customerservice
CUSTOMERSERVICE_PATH="../customerservice"
if [ -d ${CUSTOMERSERVICE_PATH}/bin ]; then
   echo "ifly build: copy customerservice"
   cp -af ${CUSTOMERSERVICE_PATH}/bin/* ${IFLY_FRAMEWORKER_PATH}/
fi

#copy location
REALTIMELOCATION_PATH="../location"
if [ -d ${REALTIMELOCATION_PATH}/bin ]; then
   echo "ifly build: copy location"
   cp -af ${REALTIMELOCATION_PATH}/bin/* ${IFLY_FRAMEWORKER_PATH}/
fi


text:
import React, { Component } from 'react';
import { Container } from 'flux/utils';
import classnames from 'classnames';

import MessageActions from './dropdown/MessageActions.react';
import RecentContextMenu from './dropdown/RecentContextMenu.react'

import DropdownStore from '../../stores/DropdownStore';
import DialogStore from '../../stores/DialogStore';
import ProfileStore from '../../stores/ProfileStore';

class MenuOverlay extends Component {
  static getStores() {
    return [DropdownStore, DialogStore, ProfileStore];
  }

  static calculateState() {
    const message = DropdownStore.getMessage();

    return {
      isMessageDropdownOpen: DropdownStore.isMessageDropdownOpen(message.rid),
      isRecentContextOpen: DropdownStore.isRecentContextOpen(),
      targetRect: DropdownStore.getTargetRect(),
      contextPos: DropdownStore.getContextPos(),
      contextPeer: DropdownStore.getPeer(),
      profile: ProfileStore.getProfile(),
      message
    };
  }

  constructor(props) {
    super(props);
  }

  render() {
    const { isMessageDropdownOpen, isRecentContextOpen, message, targetRect, contextPeer, contextPos, profile } = this.state;
    const currentPeer = DialogStore.getCurrentPeer();

    const menuOverlayClassName = classnames('menu-overlay', {
      'menu-overlay--opened': isMessageDropdownOpen || isRecentContextOpen
    });

    return (
      <div className={menuOverlayClassName}>
        {
          isMessageDropdownOpen
            ? <MessageActions message={message}
                              targetRect={targetRect}
                              peer={currentPeer}
                              profile={profile}
                              hideOnScroll/>
            : null
        }
        {
          isRecentContextOpen
            ? <RecentContextMenu peer={contextPeer}
                                 contextPos={contextPos}
                                 hideOnScroll/>
            : null
        }
      </div>
    );
  }
}

export default Container.create(MenuOverlay, { pure: false });


text:
/* Setup */
body {
    background: -webkit-linear-gradient(left, #84CFA6 0%, #65AEA9 100%);
    background: -moz-linear-gradient(right, #84CFA6 0%, #65AEA9 100%);
    background: linear-gradient(to right, #84CFA6 0%, #65AEA9 100%);
    color:#555;
    font:normal 15px "Roboto",arial,sans-serif;
    font-weight:300;
    overflow-x:hidden;
}

p {
    line-height: 1.8em;
    margin: 0 0 20px;
}

em {
    font-style: italic;
}

strong {
    font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
    font-style: normal;
    font-weight: 100;
    line-height: 1.17em;
    margin: 0 0 20px;
}

h1 {
    font-size: 3.5em;
    margin-top: 80px;
}

h2 {
    font-size: 2.5em;
}

h3 {
    font-size: 1.4666666666666667em;
    font-weight: 300;
}

h4 {
    font-size: 1em;
    font-weight: 400;
}

h5 {
    font-size: 1em;
    font-weight: 300;
}

h6 {
    font-size: 0.8em;
    text-transform: uppercase;
    font-weight: 300;
}

a {
color: #808691;
text-decoration: none;
transition: .5s ease;
}

a:hover {
color: #45caa7;
transition: .3s ease;
}

a.button {
    display: inline-block;
    font-size: 1.4666666666666667em;
}

a.button i {
    display: inline-block;
    margin-left: 10px;
    width: 30px;
    height: 30px;
    margin-bottom: -8px;
}

a.button.small {
    font-size: 12px;
    font-weight: 400;
}

a.button.small i {
    margin-left: 5px;
    width: 15px;
    height: 15px;
    margin-bottom: -4px;
}

a.button:hover i, a.button.small:hover i {
    background-position: bottom;
}

.small-border{display:block;width:150px;margin:0 auto;height:1px;background:#ececec;}
::selection{background:#b2daeb;color:#fff;}::-moz-selection{background:#b2daeb;color:#fff;}

.sub-heading{margin-bottom:40px;}

html.ie header{border-bottom:1px solid #aeaeea;}

.overview{text-align:center;padding-top:40px;padding-bottom:40px;}
.content-box img{margin-bottom:20px;}
.static{position:relative;overflow:hidden;padding-top:140px;height:455px;}
.sidephone-big,.sidephone-small{position:absolute;bottom:0;left:185px;}
.static-list li{float:left;margin-right:15px;}
.static-list li:last-of-type{margin-right:0px;}
.static-phone{position:absolute;bottom:-293px;right:230px;}
.static-tablet{position:absolute;bottom:0;right:0;}
.detail{text-align:center;padding-top:40px;position:relative;min-height:623px;overflow:hidden;border-bottom:1px solid #ececec;}
.detail .sub-heading{margin-bottom:0px;}
html.ie {display:none;}

/* Navigation */
header {
    width: 100%;
    background: #4A5362;
    min-height: 80px;
    line-height: 80px;
    box-shadow: 0 0 4px rgba(0, 0, 0, .2);
}

#logo-name {
    display: inline-block;
    color: #fff;
}

nav ul {
    float: right;
}

nav ul li {
    float: left;
    margin-right: 40px;
}

nav ul li:last-of-type {
    margin-right: 0px;
}

nav ul li a {
    color: #aeaeae;
}

nav ul li a:hover, nav ul li a.current {
    color: #45caa7;
}

/* Mobile Nav */

#mobile-nav {
    display: none;
    width: 100%;
    background: rgba(198, 198, 198, .9);
    position: absolute;
    z-index: 999;
    top: 0;
}

#mobile-nav .navigationButton img {
    margin: 15px 0px;
}

#mobile-nav .navigationButton img:hover {
    cursor: pointer;
}

#mobile-nav .navigationContent a {
    display: block;
    color: #fff;
    padding: 15px 0px;
    border-bottom: 1px solid #bebebe;
}

#mobile-nav .navigationContent li:last-child a {
    border-bottom: 1px solid transparent;
}

#mobile-nav .navigationContent a:hover {
    color: #a1a1a1;
}

/* Hero */

.hero {
    margin-top: 35px;
    /*background: url('../images/hero-hardware.jpg') no-repeat top right;*/
    background: #4A5362;
}

.hero.container h3{
    margin-top: 80px;
    text-align: center;
    margin-bottom: 100px;
}

.device-container {
    text-align: center;
}

.device-container img {
    vertical-align: bottom;
}

.action {
    /*background: -webkit-linear-gradient(left, #84CFA6 0%, #65AEA9 100%);*/
    /*background: -moz-linear-gradient(right, #84CFA6 0%, #65AEA9 100%);*/
    /*background: linear-gradient(to right, #84CFA6 0%, #65AEA9 100%);*/
    margin-top: 100px;
    padding-top: 40px;
    padding-bottom: 40px;
    text-align: center;
}

.action li {
    display: inline-block;
    margin-right: 50px;
}

.action li:last-of-type {
    margin-right: 0px;
}

/* Section 1 */

#section1 {
    background: #4A5362;
    color: #fff;
}

#section1 h2 {
    text-align: center;
    margin: 100px 0px 120px 0px;
}

#section1 a {
    display: table-cell;
    vertical-align: middle;
    width: 280px;
    height: 50px;
    background: #3E424B;
    color: #8694A1;
}

/* Section 2 */

#section2 {
    background-image: linear-gradient(90deg, #7A57A1, #6D57AC);
    box-shadow: inset 0px 10px rgba(69, 82, 99, 0.5);
    color: #FFF;
}

/* Section 3 */

#section3 {
    background-image: linear-gradient(90deg, #49cca6, #1fb4a9);
    box-shadow: inset 0px 10px rgba(69, 82, 99, 0.2);
}

.static > span {
    font-size: 36px;
}

#section3 div {

}

/* Section 4 */

#section4 {
    background:#4A5362;
    color: white;
    box-shadow: inset 0px 10px rgba(0, 0, 0, 0.1);
}

#section4 .text{
	background: #3A404A;
	border: 1px solid #FA984F;
	color: #FA984F;
}

/* =Subscribe
-------------------------------------------------------------- */

.subscribe {
    text-align: center;
    padding-top: 20px;
    padding-bottom: 40px;
}

.subscribe .sub-heading {
    margin-bottom: 20px;
}

.subscribe input.text {
    display: inline-block;
    outline: none;
    -webkit-appearance: none;
    width: 340px;
    padding: 15px 0px 15px 15px;
    background: white;
    border: 1px solid #d4d4d4;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    font: 12px "Roboto";
    color: #3498d9;
    margin-bottom: 20px;
}

.subscribe input.submit {
    border: none;
    display: inline-block;
    outline: none;
    cursor: pointer;
    background: transparent url(../images/icons/more.png) no-repeat top right;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    text-decoration: none;
    -webkit-appearance: none;
    font: 22px "Roboto";
    font-weight: 300;
    color: #3498d9;
    margin-left: 10px;
    padding-right: 40px;
    -moz-transition:color .2s;
    -o-transition:color .2s;
    -webkit-transition:color .2s;
    transition:color .2s;
}

.subscribe input.text::-ms-clear {
    display: none;
}

.subscribe input.submit:hover {
    color: #555;
    background-position: bottom right;
}

#subscribe {
    cursor: pointer;
    text-rendering: geometricprecision;
    text-decoration: none;
    color: white !important;
    background:#FA984F !important;
}

.social-list { padding-top: 20px; }
.social-list li {
    display: inline-block;
    margin-right: 10px;
}
.social-list li:last-of-type {
    margin-right: 0px;
}

.social-list a {
    -webkit-transition: all 0.33s;
    -moz-transition: all 0.33s;
    -o-transition: all 0.33s;
    -ms-transition: all 0.33s;
    transition: all 0.33s;
}

.social-list a:hover {
    opacity: 0.4;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)"; /* IE 8 */
    filter: alpha(opacity=40);
    -webkit-transition: all 0.33s;
    -moz-transition: all 0.33s;
    -o-transition: all 0.33s;
    -ms-transition: all 0.33s;
    transition: all 0.33s;
}

.notification.columns{display:none;position:relative;width:100%;margin-bottom:20px;padding:10px 18px;text-align:left;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
.notification p{float:left;padding:0;margin:0;}
.notification.success{border:1px solid #b3dc82;}
.notification.success p{color:#5f9025;}
.notification.error{border:1px solid #fbc4c4;}
.notification.error p{color:#de5959;}
.notification .close{float:right;text-indent:-999em;width:9px;height:9px;margin-top:10px;}
.notification.success .close{background:url(../images/icons/close-success.png) no-repeat;}
.notification.error .close{background:url(../images/icons/close-error.png) no-repeat;}

/* =Footer
-------------------------------------------------------------- */

footer {
    width: 100%;
    background: #3E424B;
    padding: 40px 0px 20px;
    text-align: center;
    margin-bottom:10px;
    color: #607387;
}

.footer-author {
    float: left;
    text-align: left;
    width: 50%;
}

.footer-author img{
	float: left;
}
.footer-author p {
    margin: 0px 0px -7px;
}

.footer-copyright {
    float:right;
    text-align: right;
    margin-top: 6px;
    }

.footer-copyright p{
	    margin: 0px 0px -7px;
}

.footer-action { padding-bottom: 15px; }
.footer-action li { display: inline-block; margin-right: 15px; }
.footer-action li:last-of-type { margin-right: 0px; }

.copyright { font-size: .9em;  color: #607387; }

/* =Responsive
-------------------------------------------------------------- */

/* Tablet Landscape */
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) {
    body { margin: 0; padding: 0!important; }
    .bx-prev, .bx-next { display: none!important; }
}

/* Smaller than 960px */
@media only screen and (max-width: 959px) {
    h1 { margin-top: 0px; font-size: 3em; }
    h2 { font-size: 2.5em; }
    #mobile-nav { display: block; }
    header { position: static; margin-top: 47px; }
    #navigation {  display: none; }
    #logo {  width: 100%; text-align: center; }
    .bx-prev, .bx-next { display: none!important; }

    #style-switch { display: none; }
}

/* Tablet Portrait size to standard 960 (devices and browsers) */
@media only screen and (min-width: 768px) and (max-width: 959px) {
    .hero { background-size: 100%; }
    .static { padding-top: 70px; height: 400px; }
    .sidephone-small { width: 200px; left: 12px; }
    .sidephone-big { width: 200px; left: 130px; }
    .static-phone { width: 150px; bottom: 0px; right: 200px; }
    .static-tablet { width: 300px; }
    .detail { min-height: 542px; }
    .loupe { display: none; }
    .loupe-gallery { margin-left: 100px; }
    .gallery-content { width: 80%; height: auto; }
    .loupe-still { width: 120%; height: auto; top: -20px; margin-left: -330px;}
    .screenshot img { width: 186px; }
    .gallery-bxslider li .screenshot:first-of-type img { float: left; margin-left: 20px; }
    .gallery-bxslider li .screenshot:last-of-type img { float: left; margin-left: 30px; }
    .bx-wrapper { background-size: 100%; background-position: bottom center; }
}

/* All Mobile Sizes (devices and browser) */
@media only screen and (max-width: 767px) {
    .bx-wrapper {
        background: url(../images/gallery/hardware-mobile.jpg) no-repeat top center;
        padding-top: 85px;
        border-bottom: 1px solid #ececec;
    }
    .screenshot { margin-bottom: 120px; }
    .screenshot:last-child { margin-bottom: 0px; }
}

/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
@media only screen and (min-width: 480px) and (max-width: 767px) {
    .hero { background-size: 100%; background-position: center 70px; }
    .action li { margin-right: 15px; }
    .static { min-height: 730px; padding-top: 40px; }
    .sidephone-small { left: 12px; }
    .static-phone { bottom: 0px; }
    .detail { min-height: 480px; }
    .loupe { display: none; }
    .loupe-gallery { margin-left: 70px; margin-top: 50px; }
    .gallery-content { width: 300px; height: auto; }
    .loupe-still { width: 490px; height: auto; top: -15px; margin-left: -249px; }

    .footer-author {
    text-align: left;
    width: 100%;

}

/* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
@media only screen and (max-width: 479px) {
    .hero { background-size: 110%; background-position: center 100px; }
    .action { margin-top: 140px; }
    .action li { margin-right: 0px; margin-bottom: 20px; }
    .action li:last-of-type { margin-bottom: 0px; }
    .static { min-height: 660px; padding-top: 40px; }
    .sidephone-small { width: 170px; left: 12px; }
    .sidephone-big { width: 170px; left: 130px; }
    .static-phone { width: 130px; bottom: 0px; right: 150px; }
    .static-tablet { width: 260px; }
    .detail { min-height: 496px; }
    .loupe { display: none; }
    .loupe-gallery { margin-left: 40px; margin-top: 50px; }
    .gallery-content { width: 220px; height: auto; }
    .loupe-still { width: 360px; height: auto; top: -10px; margin-left: -179px; }
    .subscribe input.text { width: 300px; }

}


text:
Input:: {
 "watchOptions": {}
}
Result: WatchOptions::

Result: Errors::


text:
<resources>
    <string name="app_name">GBase</string>
</resources>


text:
typedef std::map<std::string, std::string> Request;
typedef std::unordered_map<std::string, std::forward_list<std::string>> Requirements;

class Parser {
	private:
		static Requirements required;
	public:
		static void init ();
		static std::pair<Request, std::forward_list<std::string>> parse (const std::string&);
		static std::string check (const Request&);
};


text:
package org.apache.hadoop.hive.ql.udf.generic;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;

import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
import org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.BinaryObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.PrimitiveGrouping;

@Description(name = "decode",
    value = "_FUNC_(bin, str) - Decode the first argument using the second argument character set",
    extended = "Possible options for the character set are 'US_ASCII', 'ISO-8859-1',\n" +
        "'UTF-8', 'UTF-16BE', 'UTF-16LE', and 'UTF-16'. If either argument\n" +
        "is null, the result will also be null")
public class GenericUDFDecode extends GenericUDF {
  private transient CharsetDecoder decoder;
  private transient BinaryObjectInspector bytesOI;
  private transient PrimitiveObjectInspector charsetOI;

  @Override
  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
    if (arguments.length != 2) {
      throw new UDFArgumentLengthException("Decode() requires exactly two arguments");
    }

    if (arguments[0].getCategory() != Category.PRIMITIVE ||
        ((PrimitiveObjectInspector)arguments[0]).getPrimitiveCategory() != PrimitiveCategory.BINARY){
      throw new UDFArgumentTypeException(0, "The first argument to Decode() must be a binary");
    }

    bytesOI = (BinaryObjectInspector) arguments[0];

    if (arguments[1].getCategory() != Category.PRIMITIVE) {
      throw new UDFArgumentTypeException(1, "The second argument to Decode() must be primitive");
    }

    charsetOI = (PrimitiveObjectInspector) arguments[1];

    if (PrimitiveGrouping.STRING_GROUP != PrimitiveObjectInspectorUtils
        .getPrimitiveGrouping(charsetOI.getPrimitiveCategory())) {
      throw new UDFArgumentTypeException(1,
          "The second argument to Decode() must be from string group");
    }

    // If the character set for decoding is constant, we can optimize that
    if (arguments[1] instanceof ConstantObjectInspector) {
      String charSetName = ((ConstantObjectInspector) arguments[1]).getWritableConstantValue()
          .toString();
      decoder = Charset.forName(charSetName).newDecoder()
          .onMalformedInput(CodingErrorAction.REPORT)
          .onUnmappableCharacter(CodingErrorAction.REPORT);
    }

    return (ObjectInspector) PrimitiveObjectInspectorFactory.javaStringObjectInspector;
  }

  @Override
  public Object evaluate(DeferredObject[] arguments) throws HiveException {
    byte[] value = bytesOI.getPrimitiveJavaObject(arguments[0].get());
    if (value == null) {
      return null;
    }

    ByteBuffer wrappedBytes = ByteBuffer.wrap(value);
    CharBuffer decoded;
    if (decoder != null){
      try {
        decoded = decoder.decode(wrappedBytes);
      } catch (CharacterCodingException e) {
        throw new HiveException(e);
      }
    } else {
      String charSetName = PrimitiveObjectInspectorUtils.getString(arguments[1].get(), charsetOI);
      decoded = Charset.forName(charSetName).decode(wrappedBytes);
    }
    return decoded.toString();
  }

  @Override
  public String getDisplayString(String[] children) {
    assert (children.length == 2);
    StringBuilder sb = new StringBuilder();
    sb.append("decode(");
    sb.append(children[0]).append(",");
    sb.append(children[1]).append(")");
    return sb.toString();
  }
}


text:
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Tests cue line position from settings.

        <video>
            <track src="captions-webvtt/tc017-line-position.vtt" onload="trackLoaded()">
            <track src="captions-webvtt/tc017-line-position-bad.vtt" onload="trackLoaded()">
        </video>


text:
import hashlib
import json
import logging
import os
import shutil
import subprocess
import sys
import tempfile
import unittest

ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, ROOT_DIR)

VERBOSE = False

class CalledProcessError(subprocess.CalledProcessError):
  """Makes 2.6 version act like 2.7"""
  def __init__(self, returncode, cmd, output, stderr, cwd):
    super(CalledProcessError, self).__init__(returncode, cmd)
    self.output = output
    self.stderr = stderr
    self.cwd = cwd

  def __str__(self):
    return super(CalledProcessError, self).__str__() + (
        '\n'
        'cwd=%s\n%s\n%s\n%s') % (
            self.cwd,
            self.output,
            self.stderr,
            ' '.join(self.cmd))

def list_files_tree(directory):
  """Returns the list of all the files in a tree."""
  actual = []
  for root, _dirs, files in os.walk(directory):
    actual.extend(os.path.join(root, f)[len(directory)+1:] for f in files)
  return sorted(actual)

def calc_sha1(filepath):
  """Calculates the SHA-1 hash for a file."""
  return hashlib.sha1(open(filepath, 'rb').read()).hexdigest()

def write_content(filepath, content):
  with open(filepath, 'wb') as f:
    f.write(content)

def write_json(filepath, data):
  with open(filepath, 'wb') as f:
    json.dump(data, f, sort_keys=True, indent=2)

class RunSwarmStep(unittest.TestCase):
  def setUp(self):
    self.tempdir = tempfile.mkdtemp(prefix='run_isolated_smoke_test')
    logging.debug(self.tempdir)
    # The "source" hash table.
    self.table = os.path.join(self.tempdir, 'table')
    os.mkdir(self.table)
    # The slave-side cache.
    self.cache = os.path.join(self.tempdir, 'cache')

    self.data_dir = os.path.join(ROOT_DIR, 'tests', 'run_isolated')

  def tearDown(self):
    shutil.rmtree(self.tempdir)

  def _result_tree(self):
    return list_files_tree(self.tempdir)

  @staticmethod
  def _run(args):
    cmd = [sys.executable, os.path.join(ROOT_DIR, 'run_isolated.py')]
    cmd.extend(args)
    if VERBOSE:
      cmd.extend(['-v'] * 2)
      pipe = None
    else:
      pipe = subprocess.PIPE
    logging.debug(' '.join(cmd))
    proc = subprocess.Popen(
        cmd, stdout=pipe, stderr=pipe, universal_newlines=True)
    out, err = proc.communicate()
    return out, err, proc.returncode

  def _store_result(self, result_data):
    """Stores a .isolated file in the hash table."""
    result_text = json.dumps(result_data, sort_keys=True, indent=2)
    result_sha1 = hashlib.sha1(result_text).hexdigest()
    write_content(os.path.join(self.table, result_sha1), result_text)
    return result_sha1

  def _store(self, filename):
    """Stores a test data file in the table.

    Returns its sha-1 hash.
    """
    filepath = os.path.join(self.data_dir, filename)
    h = calc_sha1(filepath)
    shutil.copyfile(filepath, os.path.join(self.table, h))
    return h

  def _generate_args_with_isolated(self, isolated):
    """Generates the standard arguments used with isolated as the isolated file.

    Returns a list of the required arguments.
    """
    return [
      '--isolated', isolated,
      '--cache', self.cache,
      '--remote', self.table,
    ]

  def _generate_args_with_sha1(self, sha1_hash):
    """Generates the standard arguments used with sha1_hash as the hash.

    Returns a list of the required arguments.
    """
    return [
      '--hash', sha1_hash,
      '--cache', self.cache,
      '--remote', self.table,
    ]

  def test_result(self):
    # Loads an arbitrary .isolated on the file system.
    isolated = os.path.join(self.data_dir, 'gtest_fake.isolated')
    expected = [
      'state.json',
      self._store('gtest_fake.py'),
      calc_sha1(isolated),
    ]
    out, err, returncode = self._run(
        self._generate_args_with_isolated(isolated))
    if not VERBOSE:
      self.assertEquals('', err)
      self.assertEquals(1070, len(out), out)
    self.assertEquals(6, returncode)
    actual = list_files_tree(self.cache)
    self.assertEquals(sorted(expected), actual)

  def test_hash(self):
    # Loads the .isolated from the store as a hash.
    result_sha1 = self._store('gtest_fake.isolated')
    expected = [
      'state.json',
      self._store('gtest_fake.py'),
      result_sha1,
    ]

    out, err, returncode = self._run(self._generate_args_with_sha1(result_sha1))
    if not VERBOSE:
      self.assertEquals('', err)
      self.assertEquals(1070, len(out), out)
    self.assertEquals(6, returncode)
    actual = list_files_tree(self.cache)
    self.assertEquals(sorted(expected), actual)

  def test_fail_empty_isolated(self):
    result_sha1 = self._store_result({})
    expected = [
      'state.json',
      result_sha1,
    ]
    out, err, returncode = self._run(self._generate_args_with_sha1(result_sha1))
    if not VERBOSE:
      self.assertEquals('', out)
      self.assertEquals('No command to run\n', err)
    self.assertEquals(1, returncode)
    actual = list_files_tree(self.cache)
    self.assertEquals(sorted(expected), actual)

  def test_includes(self):
    # Loads an .isolated that includes another one.

    # References manifest1.isolated and gtest_fake.isolated. Maps file3.txt as
    # file2.txt.
    result_sha1 = self._store('check_files.isolated')
    expected = [
      'state.json',
      self._store('check_files.py'),
      self._store('gtest_fake.py'),
      self._store('gtest_fake.isolated'),
      self._store('file1.txt'),
      self._store('file3.txt'),
      # Maps file1.txt.
      self._store('manifest1.isolated'),
      # References manifest1.isolated. Maps file2.txt but it is overriden.
      self._store('manifest2.isolated'),
      result_sha1,
    ]
    out, err, returncode = self._run(self._generate_args_with_sha1(result_sha1))
    if not VERBOSE:
      self.assertEquals('', err)
      self.assertEquals('Success\n', out)
    self.assertEquals(0, returncode)
    actual = list_files_tree(self.cache)
    self.assertEquals(sorted(expected), actual)

  def test_link_all_hash_instances(self):
    # Load an isolated file with the same file (same sha-1 hash), listed under
    # two different names and ensure both are created.
    result_sha1 = self._store('repeated_files.isolated')
    expected = [
        'state.json',
        result_sha1,
        self._store('file1.txt'),
        self._store('repeated_files.py')
    ]

    out, err, returncode = self._run(self._generate_args_with_sha1(result_sha1))
    if not VERBOSE:
      self.assertEquals('', err)
      self.assertEquals('Success\n', out)
    self.assertEquals(0, returncode)
    actual = list_files_tree(self.cache)
    self.assertEquals(sorted(expected), actual)

  def test_delete_invald_cache_entry(self):
    isolated_file = os.path.join(self.data_dir, 'file_with_size.isolated')
    file1_sha1 = self._store('file1.txt')

    # Run the test once to generate the cache.
    out, err, returncode = self._run(self._generate_args_with_isolated(
        isolated_file))
    if VERBOSE:
      print out
      print err
    self.assertEqual(0, returncode)

    # Modify one of the files in the cache to be invalid.
    cached_file_path = os.path.join(self.cache, file1_sha1)
    with open(cached_file_path, 'w') as f:
      f.write('invalid size')

    # Ensure that the cache has an invalid file.
    self.assertNotEqual(
        os.stat(os.path.join(self.data_dir, 'file1.txt')).st_size,
        os.stat(cached_file_path).st_size)

    # Rerun the test and make sure the cache contains the right file afterwards.
    out, err, returncode = self._run(self._generate_args_with_isolated(
        isolated_file))
    if VERBOSE:
      print out
      print err
    self.assertEqual(0, returncode)

    self.assertEqual(os.stat(os.path.join(self.data_dir, 'file1.txt')).st_size,
                     os.stat(cached_file_path).st_size)

if __name__ == '__main__':
  VERBOSE = '-v' in sys.argv
  logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
  unittest.main()


text:
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using JetBrains.Application.Progress;
using JetBrains.Diagnostics;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.Bulbs;
using JetBrains.ReSharper.Feature.Services.Intentions;
using JetBrains.ReSharper.Feature.Services.QuickFixes;
using JetBrains.ReSharper.Feature.Services.Resources;
using JetBrains.ReSharper.Plugins.Unity.Utils;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.CSharp.Util;
using JetBrains.ReSharper.Psi.Naming.Extentions;
using JetBrains.ReSharper.Psi.Naming.Settings;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.TextControl;
using JetBrains.Util;
using Strings = JetBrains.ReSharper.Plugins.Unity.Resources.Strings;

namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.QuickFixes.MoveQuickFixes
{
    public abstract class AbstractMoveQuickFix : IQuickFix
    {
        [CanBeNull] protected readonly IClassDeclaration MonoBehaviourScript;
        [CanBeNull] protected readonly ICSharpExpression ToMove;
        [CanBeNull] protected readonly string FieldName;

        protected AbstractMoveQuickFix([CanBeNull] IClassDeclaration monoBehaviourScript,
                                       [CanBeNull] ICSharpExpression toMove, [CanBeNull] string fieldName = null)
        {
            MonoBehaviourScript = monoBehaviourScript;
            ToMove = toMove;
            FieldName = fieldName;
        }

        public virtual IEnumerable<IntentionAction> CreateBulbItems()
        {
            Assertion.Assert(ToMove != null, "ToMove != null");
            Assertion.Assert(MonoBehaviourScript != null, "MonoBehaviourScript != null");

            var result = new List<IntentionAction>();
            if (MonoBehaviourMoveUtil.IsExpressionAccessibleInMethod(ToMove, "Start"))
            {
                result.Add(new IntentionAction(new MoveAction(MonoBehaviourScript, ToMove, "Start", FieldName),
                    BulbThemedIcons.ContextAction.Id, IntentionsAnchors.ContextActionsAnchor));
            }

            if (MonoBehaviourMoveUtil.IsExpressionAccessibleInMethod(ToMove, "Awake"))
            {
                result.Add(new IntentionAction(new MoveAction(MonoBehaviourScript, ToMove, "Awake", FieldName),
                    BulbThemedIcons.ContextAction.Id, IntentionsAnchors.ContextActionsAnchor));
            }

            var loopAction = TryCreateMoveFromLoopAction(ToMove);
            if (loopAction != null)
                result.Add(loopAction);

            return result;
        }

        private IntentionAction TryCreateMoveFromLoopAction([NotNull] ICSharpExpression toMove)
        {
            ILoopStatement previousLoop = null;

            foreach (var node in toMove.ContainingNodes())
            {
                if (node is ICSharpClosure) break;
                if (node is ILoopStatement loop)
                {
                    if (MonoBehaviourMoveUtil.IsAvailableToMoveFromLoop(toMove, loop))
                        previousLoop = loop;
                    else
                        break;
                }
            }

            if (previousLoop != null)
                return new IntentionAction(new MoveFromLoopAction(toMove, previousLoop, FieldName),
                    BulbThemedIcons.ContextAction.Id, IntentionsAnchors.ContextActionsAnchor);

            return null;
        }

        public virtual bool IsAvailable(IUserDataHolder cache)
        {
            if (MonoBehaviourScript == null || ToMove == null)
                return false;
            if (!MonoBehaviourScript.IsValid() || !ToMove.IsValid())
                return false;
            return true;
        }

        public class MoveAction : BulbActionBase
        {
            [NotNull] private readonly IClassDeclaration myClassDeclaration;
            [NotNull] private readonly ICSharpExpression myExpression;
            [NotNull] private readonly string myMethodName;
            [CanBeNull] private readonly string myFieldName;

            public MoveAction([NotNull] IClassDeclaration classDeclaration, [NotNull] ICSharpExpression expression,
                              [NotNull] string methodName, [CanBeNull] string fieldName = null)
            {
                myClassDeclaration = classDeclaration;
                myExpression = expression;
                myMethodName = methodName;
                myFieldName = fieldName;
            }

            protected override Action<ITextControl> ExecutePsiTransaction(
                ISolution solution, IProgressIndicator progress)
            {
                MonoBehaviourMoveUtil.MoveToMethodWithFieldIntroduction(myClassDeclaration, myExpression, myMethodName,
                    myFieldName);
                return null;
            }

            public override string Text => string.Format(Strings.MoveAction_Text_Introduce_field_and_initialise_in___0__, myMethodName);
        }

        public class MoveFromLoopAction : BulbActionBase
        {
            private readonly ICSharpExpression myToMove;
            private readonly ILoopStatement myLoopStatement;
            [CanBeNull] private readonly string myVariableName;

            public MoveFromLoopAction([NotNull] ICSharpExpression toMove, [NotNull] ILoopStatement loopStatement, [CanBeNull] string variableName = null)
            {
                myToMove = toMove;
                myLoopStatement = loopStatement;
                myVariableName = variableName;
            }

            protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
            {
                var anchor = myLoopStatement as ICSharpStatement;

                var declaredElement = MonoBehaviourMoveUtil.GetDeclaredElementFromParentDeclaration(myToMove);
                var baseName = myVariableName ?? MonoBehaviourMoveUtil.CreateBaseName(myToMove, declaredElement);
                var name = NamingUtil.GetUniqueName(myToMove, baseName, NamedElementKinds.Locals,
                    collection => collection.Add(myToMove.Type(), new EntryOptions()),
                    de => !de.Equals(declaredElement));

                var factory = CSharpElementFactory.GetInstance(myToMove);
                var originMyToMove = myToMove.CopyWithResolve();
                MonoBehaviourMoveUtil.RenameOldUsages(myToMove, declaredElement, name, factory);

                ICSharpStatement declaration = factory.CreateStatement("var $0 = $1;", name, originMyToMove);
                StatementUtil.InsertStatement(declaration, ref anchor, true);
                return null;
            }

            public override string Text => Strings.MoveFromLoopAction_Text_Move_outside_of_loop;
        }
    }
}