text:
package Collection;

import java.util.*;

/**
 * Created by Defias on 2020/07.
 * Description: Collection与迭代器Iterator: 所有序列容器的共性
 */

public class TestCollectionVsIterator {

    //Iterator版本
    public static void display(Iterator<String> it) {
        while(it.hasNext()) {
            String p = it.next();
            System.out.print(p + " ");
        }
        System.out.println();
    }

    //Collection版本
    public static void display(Collection<String> pets) {
        for(String p : pets)
            System.out.print(p + " ");
        System.out.println();
    }

    public static void main(String[] args) {
        List<String> petList =  new ArrayList<String>(Arrays.asList("zhangsan", "lisi", "wangwu","zhangdan","liuhu","yemin","dawei","xiaoh"));
        Set<String> petSet = new HashSet<String>(petList);
        Map<String,String> petMap = new LinkedHashMap<String,String>();
        String[] names = ("Ralph, Eric, Robin, Lacey, Britney, Sam, Spot, Fluffy").split(", ");
        for(int i = 0; i < names.length; i++)
            petMap.put(names[i], petList.get(i));

        display(petList);
        display(petSet);
        System.out.println("------------");

        display(petList.iterator());
        display(petSet.iterator());
        System.out.println("------------");

        System.out.println(petMap);
        System.out.println(petMap.keySet());
        System.out.println("------------");

        display(petMap.values());
        display(petMap.values().iterator());
    }
}


text:
namespace TravelJournal.Domain.Media
{
    public interface IMediaItem
    {
        MediaType Type { get; }

        string Url { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
class Project < ActiveRecord::Base
  has_many :tasks, -> { order "project_order ASC" }

  validates :name, presence: true

  def total_size
    tasks.to_a.sum(&:size)
  end

  def size
    total_size
  end

  def remaining_size
    incomplete_tasks.to_a.sum(&:size)
  end

  def completed_velocity
    tasks.to_a.sum(&:points_toward_velocity)
  end

  def self.velocity_length_in_days
    21
  end

  def incomplete_tasks
    tasks.reject(&:complete?)
  end

  def done?
    incomplete_tasks.empty?
  end

  def current_rate
    completed_velocity * 1.0 / Project.velocity_length_in_days
  end

  def projected_days_remaining
    remaining_size / current_rate
  end

  def undefined_rate?
    current_rate == 0
  end

  def on_schedule?
    return false if undefined_rate?
    (Date.today + projected_days_remaining) <= due_date
  end
end


text:
#include "ctkXnatReconstruction.h"

#include "ctkXnatDefaultSchemaTypes.h"
#include "ctkXnatFile.h"
#include "ctkXnatObjectPrivate.h"
#include "ctkXnatReconstructionFolder.h"
#include "ctkXnatSession.h"

#include <QDebug>

//----------------------------------------------------------------------------
class ctkXnatReconstructionPrivate : public ctkXnatObjectPrivate
{
public:

  ctkXnatReconstructionPrivate()
  : ctkXnatObjectPrivate()
  {
  }

  void reset()
  {
    uri.clear();
  }

  QString uri;
};

//----------------------------------------------------------------------------
ctkXnatReconstruction::ctkXnatReconstruction(ctkXnatObject* parent, const QString& schemaType)
: ctkXnatObject(*new ctkXnatReconstructionPrivate(), parent, schemaType)
{
}

//----------------------------------------------------------------------------
ctkXnatReconstruction::~ctkXnatReconstruction()
{
}

//----------------------------------------------------------------------------
QString ctkXnatReconstruction::resourceUri() const
{
  return QString("%1/%2").arg(parent()->resourceUri(), this->id());
}

//----------------------------------------------------------------------------
void ctkXnatReconstruction::reset()
{
  ctkXnatObject::reset();
}

//----------------------------------------------------------------------------
void ctkXnatReconstruction::fetchImpl()
{
  QString reconstructionResourcesUri = this->resourceUri() + "/files";
  ctkXnatSession* const session = this->session();
  QUuid queryId = session->httpGet(reconstructionResourcesUri);

  QList<ctkXnatObject*> reconstructionResources = session->httpResults(queryId,
                                                                       ctkXnatDefaultSchemaTypes::XSI_FILE);

  foreach (ctkXnatObject* reconstructionResource, reconstructionResources)
  {
    QString label = reconstructionResource->name();
    if (!label.isEmpty())
    {
      reconstructionResource->setName(label);
    }

    this->add(reconstructionResource);
  }
}

//----------------------------------------------------------------------------
void ctkXnatReconstruction::downloadImpl(const QString& filename)
{
  qDebug() << "ctkXnatReconstruction::downloadImpl(const QString& filename) not yet tested";
  QString query = this->resourceUri() + "/files";
  ctkXnatSession::UrlParameters parameters;
  parameters["format"] = "zip";
  this->session()->download(filename, query, parameters);
}


text:
// <copyright file="LogisticTests.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>

using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;

namespace MathNet.Numerics.Tests.DistributionTests.Continuous
{
    using Random = System.Random;

    /// <summary>
    /// Logistic distribution tests.
    /// </summary>
    [TestFixture, Category("Distributions")]
    public class LogisticTests
    {
        /// <summary>
        /// Can create standard logistic.
        /// </summary>
        [Test]
        public void CanCreateStandardLogistic()
        {
            var l = new Logistic();
            Assert.AreEqual(0.0, l.Mean);
            Assert.AreEqual(1.0, l.Scale);
        }

        /// <summary>
        /// Can create logistic.
        /// </summary>
        /// <param name="mean">Mean value.</param>
        /// <param name="scale">Scale parameter value.</param>
        [TestCase(10.0, 0.1)]
        [TestCase(-5.0, 1.0)]
        [TestCase(0.0, 10.0)]
        [TestCase(10.0, 100.0)]
        [TestCase(-5.0, double.PositiveInfinity)]
        public void CanCreateLogistic(double mean, double scale)
        {
            var n = new Logistic(mean, scale);
            Assert.AreEqual(mean, n.Mean);
            Assert.AreEqual(scale, n.Scale);
        }

        /// <summary>
        /// Logistic create fails with bad parameters.
        /// </summary>
        /// <param name="mean">Mean value.</param>
        /// <param name="scale">Scale parameter value.</param>
        [TestCase(double.NaN, 1.0)]
        [TestCase(1.0, double.NaN)]
        [TestCase(double.NaN, double.NaN)]
        [TestCase(1.0, -1.0)]
        public void LogisticCreateFailsWithBadParameters(double mean, double scale)
        {
            Assert.That(() => new Logistic(mean, scale), Throws.ArgumentException);
        }

            /// <summary>
        /// Can create logistic from mean and scale parameter value.
        /// </summary>
        /// <param name="mean">Mean value.</param>
        /// <param name="scale">Scale parameter value.</param>
        [TestCase(10.0, 0.1)]
        [TestCase(-5.0, 1.0)]
        [TestCase(0.0, 10.0)]
        [TestCase(10.0, 100.0)]
        [TestCase(-5.0, double.PositiveInfinity)]
        public void CanCreateLogisticFromMeanAndScale(double mean, double scale)
        {
            var n = Logistic.WithMeanScale(mean, scale);
            Assert.AreEqual(mean, n.Mean);
            Assert.AreEqual(scale, n.Scale);
        }

        /// <summary>
        /// Can create logistic from mean and standard deviation.
        /// </summary>
        /// <param name="mean">Mean value.</param>
        /// <param name="sdev">Standard deviation value.</param>
        [TestCase(10.0, 0.1)]
        [TestCase(-5.0, 1.0)]
        [TestCase(0.0, 10.0)]
        [TestCase(10.0, 100.0)]
        [TestCase(-5.0, double.PositiveInfinity)]
        public void CanCreateLogisticFromMeanAndStdDev(double mean, double sdev)
        {
            var n = Logistic.WithMeanStdDev(mean, sdev);
            Assert.AreEqual(mean, n.Mean);
            Assert.AreEqual(sdev, n.StdDev);
        }

        /// <summary>
        /// Can create logistic from mean and variance.
        /// </summary>
        /// <param name="mean">Mean value.</param>
        /// <param name="var">Variance value.</param>
        [TestCase(10.0, 0.1)]
        [TestCase(-5.0, 1.0)]
        [TestCase(0.0, 10.0)]
        [TestCase(10.0, 100.0)]
        [TestCase(-5.0, double.PositiveInfinity)]
        public void CanCreateLogisticFromMeanAndVariance(double mean, double var)
        {
            var n = Logistic.WithMeanVariance(mean, var);
            AssertHelpers.AlmostEqualRelative(mean, n.Mean, 15);
            AssertHelpers.AlmostEqualRelative(var, n.Variance, 15);
        }

        /// <summary>
        /// Can create logistic from mean and precision.
        /// </summary>
        /// <param name="mean">Mean value.</param>
        /// <param name="prec">Precision value.</param>
        [TestCase(10.0, 0.1)]
        [TestCase(-5.0, 1.0)]
        [TestCase(0.0, 10.0)]
        [TestCase(10.0, 100.0)]
        public void CanCreateLogisticFromMeanAndPrecision(double mean, double prec)
        {
            var n = Logistic.WithMeanPrecision(mean, prec);
            AssertHelpers.AlmostEqualRelative(mean, n.Mean, 15);
            AssertHelpers.AlmostEqualRelative(prec, n.Precision, 15);
        }

        /// <summary>
        /// Validate ToString.
        /// </summary>
        [Test]
        public void ValidateToString()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            var n = new Logistic(1d, 2d);
            Assert.AreEqual("Logistic(μ = 1, s = 2)", n.ToString());
        }

        /// <summary>
        /// Validate entropy.
        /// </summary>
        /// <param name="scale">Scale parameter value.</param>
        [TestCase(0.1)]
        [TestCase(1.0)]
        [TestCase(10.0)]
        [TestCase(double.PositiveInfinity)]
        public void ValidateEntropy(double scale)
        {
            var n = new Logistic(1.0, scale);
            Assert.AreEqual(Math.Log(scale) + 2, n.Entropy);
        }

        /// <summary>
        /// Validate skewness.
        /// </summary>
        /// <param name="scale">Scale parameter value.</param>
        [TestCase(0.1)]
        [TestCase(1.0)]
        [TestCase(10.0)]
        [TestCase(double.PositiveInfinity)]
        public void ValidateSkewness(double scale)
        {
            var n = new Logistic(1.0, scale);
            Assert.AreEqual(0.0, n.Skewness);
        }

        /// <summary>
        /// Validate mean.
        /// </summary>
        /// <param name="mean">Mean value.</param>
        [TestCase(double.NegativeInfinity)]
        [TestCase(-0.0)]
        [TestCase(0.0)]
        [TestCase(0.1)]
        [TestCase(1.0)]
        [TestCase(10.0)]
        [TestCase(double.PositiveInfinity)]
        public void ValidateMode(double mean)
        {
            var n = new Logistic(mean, 1.0);
            Assert.AreEqual(mean, n.Mode);
        }

        /// <summary>
        /// Validate median.
        /// </summary>
        /// <param name="mean">Mean value.</param>
        [TestCase(double.NegativeInfinity)]
        [TestCase(-0.0)]
        [TestCase(0.0)]
        [TestCase(0.1)]
        [TestCase(1.0)]
        [TestCase(10.0)]
        [TestCase(double.PositiveInfinity)]
        public void ValidateMedian(double mean)
        {
            var n = new Logistic(mean, 1.0);
            Assert.AreEqual(mean, n.Median);
        }

        /// <summary>
        /// Validate minimum.
        /// </summary>
        [Test]
        public void ValidateMinimum()
        {
            var n = new Logistic();
            Assert.AreEqual(double.NegativeInfinity, n.Minimum);
        }

        /// <summary>
        /// Validate maximum.
        /// </summary>
        [Test]
        public void ValidateMaximum()
        {
            var n = new Logistic();
            Assert.AreEqual(double.PositiveInfinity, n.Maximum);
        }

        /// <summary>
        /// Can sample static.
        /// </summary>
        [Test]
        public void CanSampleStatic()
        {
            Logistic.Sample(new Random(0), 0.0, 1.0);
        }

        /// <summary>
        /// Can sample sequence static.
        /// </summary>
        [Test]
        public void CanSampleSequenceStatic()
        {
            var ied = Logistic.Samples(new Random(0), 0.0, 1.0);
            GC.KeepAlive(ied.Take(5).ToArray());
        }

        /// <summary>
        /// Fail sample static with bad parameters.
        /// </summary>
        [Test]
        public void FailSampleStatic()
        {
            Assert.That(() => { var d = Logistic.Sample(new Random(0), 0.0, -1.0); }, Throws.ArgumentException);
        }

        /// <summary>
        /// Fail sample sequence static with bad parameters.
        /// </summary>
        [Test]
        public void FailSampleSequenceStatic()
        {
            Assert.That(() => { var ied = Logistic.Samples(new Random(0), 0.0, -1.0).First(); }, Throws.ArgumentException);
        }

        /// <summary>
        /// Can sample.
        /// </summary>
        [Test]
        public void CanSample()
        {
            var n = new Logistic();
            n.Sample();
        }

        /// <summary>
        /// Can sample sequence.
        /// </summary>
        [Test]
        public void CanSampleSequence()
        {
            var n = new Logistic();
            var ied = n.Samples();
            GC.KeepAlive(ied.Take(5).ToArray());
        }

        /// <summary>
        /// Validate density.
        /// </summary>
        /// <param name="x">Input X value.</param>
        /// <param name="d">Expected value.</param>
        [TestCase(double.NegativeInfinity, double.NaN)]
        [TestCase(-5.0, 0.00332402833539508)]
        [TestCase(-2.0, 0.01422651193986778)]
        [TestCase(0.0, 0.03505185827255409)]
        [TestCase(4.0, 0.11750185610079725)]
        [TestCase(5.0, 0.12500000000000000)]
        [TestCase(6.0, 0.11750185610079725)]
        [TestCase(10.0, 0.03505185827255409)]
        [TestCase(double.PositiveInfinity, 0)]
        public void ValidateDensity(double x, double d)
        {
            var n = Logistic.WithMeanScale(5.0, 2.0);
            AssertHelpers.AlmostEqualRelative(d, n.Density(x), 9);
            AssertHelpers.AlmostEqualRelative(d, Logistic.PDF(5.0, 2.0, x), 9);
        }

                /// <summary>
        /// Validate density.
        /// </summary>
        /// <param name="x">Input X value.</param>
        /// <param name="d">Expected value.</param>
        [TestCase(double.NegativeInfinity, double.NaN)]
        [TestCase(-5.0, -5.70657787753818)]
        [TestCase(-2.0, -4.25264801710519)]
        [TestCase(0.0, -3.35092664914504)]
        [TestCase(4.0, -2.14130114892016)]
        [TestCase(5.0, -2.07944154167984)]
        [TestCase(6.0, -2.14130114892016)]
        [TestCase(10.0, -3.35092664914504)]
        [TestCase(double.PositiveInfinity, double.NegativeInfinity)]
        public void ValidateLogDensity(double x, double d)
        {
            var n = Logistic.WithMeanScale(5.0, 2.0);
            AssertHelpers.AlmostEqualRelative(d, n.DensityLn(x), 9);
            AssertHelpers.AlmostEqualRelative(d, Logistic.PDFLn(5.0, 2.0, x), 9);
        }

        /// <summary>
        /// Validate cumulative distribution.
        /// </summary>
        /// <param name="x">Input X value.</param>
        /// <param name="p">Expected value.</param>
        [TestCase(double.NegativeInfinity, 0.0)]
        [TestCase(-5.0, 0.00669285092428486)]
        [TestCase(-2.0, 0.0293122307513563)]
        [TestCase(0.0, 0.0758581800212435)]
        [TestCase(4.0, 0.377540668798145)]
        [TestCase(5.0, 0.5)]
        [TestCase(6.0, 0.622459331201855)]
        [TestCase(10.0, 0.924141819978757)]
        [TestCase(double.PositiveInfinity, 1.0)]
        public void ValidateCumulativeDistribution(double x, double p)
        {
            var n = Logistic.WithMeanScale(5.0, 2.0);
            AssertHelpers.AlmostEqualRelative(p, n.CumulativeDistribution(x), 9);
            AssertHelpers.AlmostEqualRelative(p, Logistic.CDF(5.0, 2.0, x), 9);
        }

        /// <summary>
        /// Validate inverse cumulative distribution.
        /// </summary>
        /// <param name="x">Input X value.</param>
        /// <param name="p">Expected value.</param>
        [TestCase(double.NegativeInfinity, 0.0)]
        [TestCase(-5.0, 0.00669285092428486)]
        [TestCase(-2.0, 0.0293122307513563)]
        [TestCase(0.0, 0.0758581800212435)]
        [TestCase(4.0, 0.377540668798145)]
        [TestCase(5.0, 0.5)]
        [TestCase(6.0, 0.622459331201855)]
        [TestCase(10.0, 0.924141819978757)]
        [TestCase(double.PositiveInfinity, 1.0)]
        public void ValidateInverseCumulativeDistribution(double x, double p)
        {
            var n = Logistic.WithMeanScale(5.0, 2.0);
            AssertHelpers.AlmostEqualRelative(x, n.InverseCumulativeDistribution(p), 14);
            AssertHelpers.AlmostEqualRelative(x, Logistic.InvCDF(5.0, 2.0, p), 14);
        }

    }
}


text:
import React from 'react';

import Standard from '../__fixtures__/Standard';

jest.mock('exenv', () => ({
  canUseDOM: false,
}));

console.warn = jest.fn();

const mockCallback = jest.fn();
const props = {
  callback: mockCallback,
};

describe('Joyride > NO-DOM', () => {
  let wrapper;
  let joyride;

  beforeAll(() => {
    wrapper = mount(<Standard {...props} />, { attachTo: document.getElementById('react') });
    joyride = wrapper.find('Joyride').instance();
  });

  it('should have initiated the Joyride', () => {
    expect(joyride.state).toMatchSnapshot();
  });

  it('should not be able to start the tour', () => {
    wrapper.find('.hero__start').simulate('click');

    expect(wrapper.find('Joyride > div')).not.toExist();
  });
});


text:
title: royriojas/eslint-friendly-formatter
author: azu
layout: post
itemUrl: 'https://github.com/royriojas/eslint-friendly-formatter'
editJSONPath: 'https://github.com/jser/jser.info/edit/gh-pages/data/2015/03/index.json'
date: '2015-03-04T02:26:32+00:00'
tags:
  - JavaScript
  - Tools
---
ESLintのLint結果を該当コードの行と合わせて表示できるESLintのformatter


text:
{% extends 'base.html' %}

{% block content %}

    <form action="{{ request.build_absolute_uri }}" method="POST">
        {% csrf_token %}
        {{ form }}
        <input type="submit" value="Save"/>
    </form>

{% endblock %}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Kain Katun Aisha</title>
    <meta name="description" content="Free Bootstrap Theme by BootstrapMade.com">
    <meta name="keywords" content="free website templates, free bootstrap themes, free template, free bootstrap, free website template">

    <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Fira+Sans|Roboto:300,400|Questrial|Satisfy">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/animate.css">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/style.css">

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

              </button>
              Kain Katun Aisha

Home

Produk

Tentang

Masuk

Create The Style By Yours

Realize Your Imagination With High Quality Textile

Kategori Kain

            <?php foreach($kategori as $k){ ?>

                    <a href="<?= base_url().'index.php/web/detail/'.$k->id?>">
                        <img width='200px' height='250px' class="thumbnail img-responsive" alt="Bootstrap template"
                        src="<?php echo base_url()?><?=$k->foto?>"/>

            <?php } ?>

Tentang Kain Katun Aisha

                  © Copyright Laura Theme. All Rights Reserved

                        Made by Fia Afina Yusviana

Contact Us


text:
<ion-modal-view>
    <ion-header-bar class="bar bar-header bar-positive">

Edit Task

        <button class="button button-clear button-primary" ng-click="editTaskModal.hide()">Cancel</button>
    </ion-header-bar>
    <ion-content class="padding">

                Task Name
                <input ng-model="taskItem.taskName" type="text" value="taskItem.taskName">

                Task Description
                <input ng-model="taskItem.taskDescription" type="text" value="taskItem.taskDescription">

            <button class="button button-full button-positive" ng-click="updateTaskItem(taskItem)">Update Task</button>

    </ion-content>
</ion-modal-view>


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using Xunit;
using VerifyCS = Test.Utilities.CSharpCodeFixVerifier<
    Microsoft.NetCore.Analyzers.Runtime.SerializationRulesDiagnosticAnalyzer,
    Microsoft.NetCore.Analyzers.Runtime.MarkTypesWithSerializableFixer>;
using VerifyVB = Test.Utilities.VisualBasicCodeFixVerifier<
    Microsoft.NetCore.Analyzers.Runtime.SerializationRulesDiagnosticAnalyzer,
    Microsoft.NetCore.Analyzers.Runtime.MarkTypesWithSerializableFixer>;

namespace Microsoft.NetCore.Analyzers.Runtime.UnitTests
{
    public partial class MarkISerializableTypesWithSerializableTests
    {
        [Fact]
        public async Task CA2237SerializableMissingAttr()
        {
            await VerifyCS.VerifyAnalyzerAsync(@"
                using System;
                using System.Runtime.Serialization;
                public class CA2237SerializableMissingAttr : ISerializable
                {
                    public void GetObjectData(SerializationInfo info, StreamingContext context)
                    {
                        throw new NotImplementedException();
                    }
                }",
                GetCA2237CSharpResultAt(4, 30, "CA2237SerializableMissingAttr"));

            await VerifyVB.VerifyAnalyzerAsync(@"
                Imports System
                Imports System.Runtime.Serialization
                Public Class CA2237SerializableMissingAttr
                    Implements ISerializable

                    Protected Sub New(context As StreamingContext, info As SerializationInfo)
                    End Sub

                    Public Sub GetObjectData(info as SerializationInfo, context as StreamingContext) Implements ISerializable.GetObjectData
                        throw new NotImplementedException()
                    End Sub
                End Class",
                GetCA2237BasicResultAt(4, 30, "CA2237SerializableMissingAttr"));
        }

        [Fact]
        public async Task CA2237SerializableInternal()
        {
            await VerifyCS.VerifyAnalyzerAsync(@"
                using System;
                using System.Runtime.Serialization;
                class CA2237SerializableInternal : ISerializable
                {
                    public void GetObjectData(SerializationInfo info, StreamingContext context)
                    {
                        throw new NotImplementedException();
                    }
                }");

            await VerifyVB.VerifyAnalyzerAsync(@"
                Imports System
                Imports System.Runtime.Serialization
                Friend Class CA2237SerializableInternal
                    Implements ISerializable

                    Protected Sub New(context As StreamingContext, info As SerializationInfo)
                    End Sub

                    Public Sub GetObjectData(info as SerializationInfo, context as StreamingContext) Implements ISerializable.GetObjectData
                        throw new NotImplementedException()
                    End Sub
                End Class");
        }

        [Fact]
        public async Task CA2237SerializableProperWithScope()
        {
            await VerifyCS.VerifyAnalyzerAsync(@"
                using System;
                using System.Runtime.Serialization;

                class CA2237SerializableInternal : ISerializable
                {
                    public void GetObjectData(SerializationInfo info, StreamingContext context)
                    {
                        throw new NotImplementedException();
                    }
                }

                [Serializable]
                public class CA2237SerializableProper : ISerializable
                {
                    public void GetObjectData(SerializationInfo info, StreamingContext context)
                    {
                        throw new NotImplementedException();
                    }
                }",
                GetCA2229DefaultCSharpResultAt(14, 30, "CA2237SerializableProper"));

            await VerifyVB.VerifyAnalyzerAsync(@"
                Imports System
                Imports System.Runtime.Serialization

                Friend Class CA2237SerializableInternal
                    Implements ISerializable

                    Protected Sub New(context As StreamingContext, info As SerializationInfo)
                    End Sub

                    Public Sub GetObjectData(info as SerializationInfo, context as StreamingContext) Implements ISerializable.GetObjectData
                        throw new NotImplementedException()
                    End Sub
                End Class

                <Serializable>
                Public Class CA2237SerializableProper
                    Implements ISerializable

                    Public Sub GetObjectData(info as SerializationInfo, context as StreamingContext) Implements ISerializable.GetObjectData
                        throw new NotImplementedException()
                    End Sub
                End Class",
                GetCA2229DefaultBasicResultAt(17, 30, "CA2237SerializableProper"));
        }

        [Fact]
        public async Task CA2237SerializableWithBase()
        {
            await VerifyCS.VerifyAnalyzerAsync(@"
                using System;
                using System.Runtime.Serialization;
                public class CA2237SerializableWithBase : Base, ISerializable
                {
                    public void GetObjectData(SerializationInfo info, StreamingContext context)
                    {
                        throw new NotImplementedException();
                    }
                }
                public class Base { }");

            await VerifyVB.VerifyAnalyzerAsync(@"
                Imports System
                Imports System.Runtime.Serialization
                Public Class CA2237SerializableWithBase
                    Inherits Base
                    Implements ISerializable

                    Protected Sub New(context As StreamingContext, info As SerializationInfo)
                    End Sub

                    Public Sub GetObjectData(info as SerializationInfo, context as StreamingContext) Implements ISerializable.GetObjectData
                        throw new NotImplementedException()
                    End Sub
                End Class
                Public Class Base
                End Class");
        }

        [Fact]
        public async Task CA2237SerializableWithBaseAttr()
        {
            await VerifyCS.VerifyAnalyzerAsync(@"
                using System;
                using System.Runtime.Serialization;
                public class CA2237SerializableWithBaseAttr : BaseAttr, ISerializable
                {
                    public void GetObjectData(SerializationInfo info, StreamingContext context)
                    {
                        throw new NotImplementedException();
                    }
                }
                [Serializable]
                public class BaseAttr { }",
                GetCA2237CSharpResultAt(4, 30, "CA2237SerializableWithBaseAttr"));

            await VerifyVB.VerifyAnalyzerAsync(@"
                Imports System
                Imports System.Runtime.Serialization
                Public Class CA2237SerializableWithBaseAttr
                    Inherits BaseWithAttr
                    Implements ISerializable

                    Protected Sub New(context As StreamingContext, info As SerializationInfo)
                    End Sub

                    Public Sub GetObjectData(info as SerializationInfo, context as StreamingContext) Implements ISerializable.GetObjectData
                        throw new NotImplementedException()
                    End Sub
                End Class
                <Serializable>
                Public Class BaseWithAttr
                End Class",
                GetCA2237BasicResultAt(4, 30, "CA2237SerializableWithBaseAttr"));
        }

        [Fact]
        public async Task CA2237_CA2229_NoDiagnosticForInterfaceAndDelegate()
        {
            await VerifyCS.VerifyAnalyzerAsync(@"
using System;
using System.Runtime.Serialization;

class A
{
    [Serializable]
    public delegate void B();
}

public interface I : ISerializable
{
    string Name { get; }
}");

            await VerifyVB.VerifyAnalyzerAsync(@"
Imports System
Imports System.Runtime.Serialization

Class A
    <Serializable> _
    Public Delegate Sub B()
End Class

Public Interface I
    Inherits ISerializable
    ReadOnly Property Name() As String
End Interface");
        }

        private static DiagnosticResult GetCA2237CSharpResultAt(int line, int column, string objectName) =>
#pragma warning disable RS0030 // Do not used banned APIs
            VerifyCS.Diagnostic(SerializationRulesDiagnosticAnalyzer.RuleCA2237)
                .WithLocation(line, column)
#pragma warning restore RS0030 // Do not used banned APIs
                .WithArguments(objectName);

        private static DiagnosticResult GetCA2237BasicResultAt(int line, int column, string objectName) =>
#pragma warning disable RS0030 // Do not used banned APIs
            VerifyVB.Diagnostic(SerializationRulesDiagnosticAnalyzer.RuleCA2237)
                .WithLocation(line, column)
#pragma warning restore RS0030 // Do not used banned APIs
                .WithArguments(objectName);

        private static DiagnosticResult GetCA2229DefaultCSharpResultAt(int line, int column, string objectName) =>
#pragma warning disable RS0030 // Do not used banned APIs
            VerifyCS.Diagnostic(SerializationRulesDiagnosticAnalyzer.RuleCA2229Default)
                .WithLocation(line, column)
#pragma warning restore RS0030 // Do not used banned APIs
                .WithArguments(objectName);

        private static DiagnosticResult GetCA2229DefaultBasicResultAt(int line, int column, string objectName) =>
#pragma warning disable RS0030 // Do not used banned APIs
            VerifyVB.Diagnostic(SerializationRulesDiagnosticAnalyzer.RuleCA2229Default)
                .WithLocation(line, column)
#pragma warning restore RS0030 // Do not used banned APIs
                .WithArguments(objectName);
    }
}


text:
#include <string.h>
#include <stdlib.h>
#include <pthread.h>

#include <module.h>

#define LOG_TAG "module"
#include <log.h>

static struct module *g_module_head;
static char *g_module_err;

static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;

#define for_each_module(__module, __head)               \
    for ((__module) = (__head); (__module) != NULL;     \
         (__module) = (__module)->next)

#define find_last_module(__head)                \
    ({                                          \
        struct module *m;                       \
                                                \
        for_each_module(m, (__head)) {          \
            if (!m->next)                       \
                break;                          \
        }                                       \
        m;                                      \
    })

static struct module *module_find_with_name(struct module *head,
                                            const char *filename)
{
    struct module *module;

    for_each_module(module, head) {
        if (!strcmp(module->name, filename))
            return module;
    }

    return NULL;
}

static struct module *module_find_with_handle(struct module *head,
                                              const void *handle)
{
    struct module *module;

    for_each_module(module, head) {
        if (module->handle == handle)
            return module;
    }

    return NULL;
}

static struct module *module_add_list(struct module *head,
                                      struct module *add)
{
    struct module *last;

    last = find_last_module(head);
    if (last)
        last->next = add;
    else
        head = add;

    return head;
}

static struct module *module_del_list(struct module *head,
                                      struct module *del)
{
    struct module *prev = NULL;

    for_each_module(prev, head) {
        if (prev->next == del)
            break;
    }

    if (!prev)
        head = del->next;
    else
        prev->next = del->next;

    return head;
}

static inline void module_set_error(const char *dlerr)
{
    if (g_module_err)
        free(g_module_err);

    if (dlerr)
        g_module_err = strdup(dlerr);
    else
        g_module_err = NULL;
}

const char *module_error(void)
{
    return g_module_err;
}

struct module *module_open(const char *file, int flag)
{
    struct module *new, *existing;
    void *handle;
    const char *dlerr;
    int init_ret = 0;

    pthread_mutex_lock(&g_lock);

    existing = module_find_with_name(g_module_head, file);
    if (existing) {
        ALOGE("found opened module %s with name\n", existing->name);
        existing->ref_count++;
        pthread_mutex_unlock(&g_lock);
        return existing;
    }

    new = malloc(sizeof(*new));
    if (!new) {
        pthread_mutex_unlock(&g_lock);
        return NULL;
    }

    new->ref_count = 1;
    new->priv = NULL;
    new->next = NULL;
    new->handle = NULL;

    new->handle = dlopen(file, flag);
    if (!(new->handle)) {
        ALOGE("dlopen failed (%s)\n", file);
        dlerr = dlerror();
        module_set_error(dlerr);
        goto free_new;
    }

    existing = module_find_with_handle(g_module_head, new->handle);
    if (existing) {
        ALOGE("found opened module %s with handle\n", existing->name);
        existing->ref_count++;

        free(new);
        pthread_mutex_unlock(&g_lock);
        return existing;
    }

    new->name = strdup(file);
    if (!new->name) {
        goto free_handle;
    }

    dlerror();
    new->init = dlsym(new->handle, "module_init");
    dlerr = dlerror();
    if (!dlerr && new->init) {
        ALOGE("module %s has init(), call the symbol\n", new->name);
        init_ret = new->init(new);
    }

    if (init_ret) {
        ALOGE("module %s init() failed (%d)\n", new->name, init_ret);
        goto free_handle;
    }

    dlerror();
    new->exit = dlsym(new->handle, "module_exit");
    dlerr = dlerror();
    if (dlerr)
        new->exit = NULL;

    g_module_head = module_add_list(g_module_head, new);

    pthread_mutex_unlock(&g_lock);
    return new;

free_handle:
    dlclose(new->handle);

free_new:
    free(new);

    pthread_mutex_unlock(&g_lock);
    return NULL;
}

int module_close(struct module *module)
{
    const char *dlerr;
    int ret = 0;

    if (!module || !module->handle)
        return 0;

    pthread_mutex_lock(&g_lock);

    module->ref_count--;
    ret = module->ref_count;

    ALOGV("module %s decrease refcont (%d)\n", module->name, module->ref_count);

    if (!module->ref_count) {
        if (module->exit)
            module->exit(module);

        if (dlclose(module->handle)) {
            ALOGE("module %s dlclose failed",module->name);
        }

        g_module_head = module_del_list(g_module_head, module);

        ALOGV("module %s closed\n", module->name);

        free(module->name);
        free(module);
    }

    pthread_mutex_unlock(&g_lock);
    return ret;
}

void *module_symbol(struct module *module, const char *string)
{
    void *symbol = NULL;
    const char *dlerr;

    if (!module || !module->handle || !string)
        return NULL;

    pthread_mutex_lock(&g_lock);

    symbol = dlsym(module->handle, string);
    if (!symbol) {
        dlerr = dlerror();
        ALOGE("not founded symbol %s in module %s (%s)\n",
             string, module->name, dlerr);
        module_set_error(dlerr);
        symbol = NULL;
    }
    else
        ALOGV("found symbol %s in module %s\n", string, module->name);

    pthread_mutex_unlock(&g_lock);
    return symbol;
}


text:
update `settings` set `value`='2017-08-04' where `key`='last_mysql_update';

ALTER TABLE clients ADD data longtext NULL ;
ALTER TABLE leads ADD data longtext NULL ;

ALTER TABLE leads ADD isQuoted int(1) NOT NULL default 0;

update `settings` set `value`='2017-08-04.sql' where `key`='last_mysql_update';
update `settings` set `value`='00.01.02.0000' where `key`='version';


text:
/* @flow */
'use strict';

import React from 'react';
import {Image} from 'react-native';
import NativeBaseComponent from '../Base/NativeBaseComponent';
import computeProps from '../../Utils/computeProps';
import _ from 'lodash';

export default class ThumbnailNB extends NativeBaseComponent {

    getInitialStyle() {
        return {
            thumbnail: {
                borderRadius: 15,
                width: 30,
                height: 30,
                resizeMode: this.props.contain ? 'contain' : undefined
            }
        }
    }

    prepareRootProps() {
        var thumbnailStyle = {};
        if(this.props.circular) {
            thumbnailStyle.width = this.props.size;
            thumbnailStyle.height = this.props.size;
            thumbnailStyle.borderRadius = this.props.size/2;
        }
        else if(this.props.square) {
            thumbnailStyle.width = this.props.size;
            thumbnailStyle.height = this.props.size;
            thumbnailStyle.borderRadius = 0;
        }

        var defaultProps = {
            style: _.merge(this.getInitialStyle().thumbnail, thumbnailStyle)
        };

        return computeProps(this.props, defaultProps);
    }

    render() {
        return(
            <Image {...this.prepareRootProps()}/>
        );
    }
}


text:
<!doctype html>
<!--
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
  <head>
    <title>core-drawer-panel</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">

    <script src="../platform/platform.js"></script>

    <link rel="import" href="core-drawer-panel.html">

    <style>

      html, body {
        height: 100%;
      }

      body {
        font-family: sans-serif;
        color: #FFF;
        margin: 0;
      }

      [drawer] {
        background-color: #B99588;
        border-right: 1px solid #ccc;
      }

      [main] {
        height: 100%;
        background-color: #4F7DC9;
      }

      button {
        display: none;
        width: 160px;
        height: 40px;
        font-size: 16px;
        margin: 8px;
      }

      core-drawer-panel[narrow] button {
        display: inline-block
      }

    </style>

  </head>

  <body unresolved touch-action="auto">

    <core-drawer-panel>

      <div drawer></div>

      <div main>
        <button onclick="document.querySelector('core-drawer-panel').togglePanel();">toggle drawer</button>
      </div>

    </core-drawer-panel>

  </body>
</html>


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Pereira Lima</logradouro><bairro>Piedade</bairro><cidade>Itaúna</cidade><uf>MG</uf><cep>35680260</cep></feed>


text:
(function() {
    'use strict';

    angular
        .module('gatewayApp')
        .controller('PersonalBankAccountDialogController', PersonalBankAccountDialogController);

    PersonalBankAccountDialogController.$inject = ['$timeout', '$scope', '$stateParams', '$uibModalInstance', 'entity', 'PersonalBankAccount', 'Transfer'];

    function PersonalBankAccountDialogController ($timeout, $scope, $stateParams, $uibModalInstance, entity, PersonalBankAccount, Transfer) {
        var vm = this;

        vm.personalBankAccount = entity;
        vm.clear = clear;
        vm.save = save;
        vm.transfers = Transfer.query();

        $timeout(function (){
            angular.element('.form-group:eq(1)>input').focus();
        });

        function clear () {
            $uibModalInstance.dismiss('cancel');
        }

        function save () {
            vm.isSaving = true;
            if (vm.personalBankAccount.id !== null) {
                PersonalBankAccount.update(vm.personalBankAccount, onSaveSuccess, onSaveError);
            } else {
                PersonalBankAccount.save(vm.personalBankAccount, onSaveSuccess, onSaveError);
            }
        }

        function onSaveSuccess (result) {
            $scope.$emit('gatewayApp:personalBankAccountUpdate', result);
            $uibModalInstance.close(result);
            vm.isSaving = false;
        }

        function onSaveError () {
            vm.isSaving = false;
        }

    }
})();


text:
//
//  UIControl+JLYFixMultiClick.h
//  Pods
//
//  Created by mac on 16/9/14.
//
//

#import <UIKit/UIKit.h>
/*!
 *  @brief 防止连点,1秒间隔
 */

NS_ASSUME_NONNULL_BEGIN
@interface UIControl (JLYFixMultiClick)

@property (nonatomic, assign) NSTimeInterval jly_acceptEventTime;

@end
NS_ASSUME_NONNULL_END


text:
package com.almoturg.sprog.util;

import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.text.Html;
import android.text.Spanned;
import android.util.TypedValue;

import com.almoturg.sprog.R;

public final class Util {
    public static <T> T last(T[] array) {
        return array[array.length - 1];
    }

    @SuppressWarnings("deprecation")
    public static Spanned fromHtml(String source) {
        // This converts html to Spanned.
        // fromHtml(String) is deprecated in Nougat so we need to check the version.
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            return Html.fromHtml(source, Html.FROM_HTML_MODE_LEGACY);
        } else {
            return Html.fromHtml(source);
        }
    }

    public static int getDisplayWidthDp(Context context) {
        Configuration configuration = context.getResources().getConfiguration();
        return configuration.screenWidthDp;
    }

    public static Spanned linkToSpan(String link) {
        return fromHtml(String.format("%s", link, link));
    }

    public static int getThemeColor(Context context, int attrId) {
        final TypedValue value = new TypedValue();
        context.getTheme().resolveAttribute(attrId, value, true);
        return value.data;
    }

    public static int getThemeReference(Context context, int attrId) {
        final TypedValue value = new TypedValue();
        context.getTheme().resolveAttribute(attrId, value, false);
        return value.data;
    }

    public static boolean isDarkTheme(Context context) {
        final TypedValue value = new TypedValue();
        context.getTheme().resolveAttribute(R.attr.themeName, value, true);
        return value.string.equals("dark");
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>R: when</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="R.css">

when {SparkR}	R Documentation

when

Description

Evaluates a list of conditions and returns one of multiple possible result expressions.
For unmatched expressions null is returned.

Usage

## S4 method for signature 'Column'
when(condition, value)

when(condition, value)

Arguments

condition

the condition to test on. Must be a Column expression.

value

result expression.

Note

when since 1.5.0

See Also

ifelse

Other normal_funcs: Column-class,
column, column,
column,
column,character-method,
column,jobj-method; abs,
abs,Column-method;
bitwiseNOT, bitwiseNOT,
bitwiseNOT,Column-method;
expr, expr,
expr,character-method;
greatest, greatest,
greatest,Column-method;
ifelse, ifelse,Column-method;
is.nan, is.nan,Column-method,
isnan, isnan,
isnan,Column-method; least,
least, least,Column-method;
lit, lit,
lit,ANY-method; nanvl,
nanvl, nanvl,Column-method;
negate, negate,
negate,Column-method; randn,
randn, randn,
randn,missing-method,
randn,numeric-method; rand,
rand, rand,
rand,missing-method,
rand,numeric-method; struct,
struct,
struct,characterOrColumn-method

Examples

## Not run: when(df$age == 2, df$age + 1)

[Package SparkR version 2.1.0 Index]


text:
/* Custom Stylesheet */
/**
 * Use this file to override Materialize files so you can update
 * the core Materialize files in the future
 *
 * Made By MaterializeCSS.com
 */

.icon-block {
  padding: 0 15px;
}
.icon-block .material-icons {
	font-size: inherit;
}

pre, .email-body {
    margin: 10px 15px;
    font-size: 0.8em;
}

body {
    position: relative;
    padding-bottom: 150px;
    min-height: 100vh;
}

.sticky-footer {
    position: absolute;
    width: 100%;
    bottom: 0;
}


text:
package eu.ydp.empiria.player.client.controller.report.table.extraction;

import com.google.gwt.xml.client.Element;
import eu.ydp.empiria.player.client.style.StyleSocket;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.HashMap;
import java.util.Map;

import static eu.ydp.empiria.player.client.resources.EmpiriaStyleNameConstants.EMPIRIA_REPORT_SHOW_NON_ACTIVITES;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class ShowNonActivitiesExtractorTest {

    @InjectMocks
    private ShowNonActivitiesExtractor testobj;

    @Mock
    private StyleSocket styleSocket;
    @Mock
    private Element element;

    @Test
    public void shouldExtractTrue() {
        // given
        Map<String, String> styles = new HashMap<String, String>();
        styles.put(EMPIRIA_REPORT_SHOW_NON_ACTIVITES, "true");

        when(styleSocket.getStyles(element)).thenReturn(styles);

        // when
        boolean isShowNonActivities = testobj.extract(element);

        // then
        assertThat(isShowNonActivities).isTrue();
    }

    @Test
    public void shouldExtractFalse() {
        // given
        Map<String, String> styles = new HashMap<String, String>();
        styles.put(EMPIRIA_REPORT_SHOW_NON_ACTIVITES, "false");

        when(styleSocket.getStyles(element)).thenReturn(styles);

        // when
        boolean isShowNonActivities = testobj.extract(element);

        // then
        assertThat(isShowNonActivities).isFalse();
    }
}


text:
"""This module provides tools for simulating rank deficient operators."""

import itertools
import numpy

from openfermion.config import EQ_TOLERANCE
import openfermion.utils as utils

def get_chemist_two_body_coefficients(two_body_coefficients, spin_basis=True):
    r"""Convert two-body operator coefficients to low rank tensor.

    The input is a two-body fermionic Hamiltonian expressed as
    $\sum_{pqrs} h_{pqrs} a^\dagger_p a^\dagger_q a_r a_s$

    We will convert this to the chemistry convention expressing it as
    $\sum_{pqrs} g_{pqrs} a^\dagger_p a_q a^\dagger_r a_s$
    but without the spin degree of freedom.

    In the process of performing this conversion, constants and one-body
    terms come out, which will be returned as well.

    Args:
        two_body_coefficients (ndarray): an N x N x N x N
            numpy array giving the $h_{pqrs}$ tensor.
        spin_basis (bool): True if the two-body terms are passed in spin
            orbital basis. False if already in spatial orbital basis.

    Returns:
        one_body_correction (ndarray): an N x N array of floats giving
            coefficients of the $a^\dagger_p a_q$ terms that come out.
        chemist_two_body_coefficients (ndarray): an N x N x N x N numpy array
            giving the $g_{pqrs}$ tensor in chemist notation.

    Raises:
        TypeError: Input must be two-body number conserving
            FermionOperator or InteractionOperator.
    """
    # Initialize.
    n_orbitals = two_body_coefficients.shape[0]
    chemist_two_body_coefficients = numpy.transpose(two_body_coefficients,
                                                    [0, 3, 1, 2])

    # If the specification was in spin-orbitals, chop down to spatial orbitals
    # assuming a spin-symmetric interaction.
    if spin_basis:
        n_orbitals = n_orbitals // 2
        alpha_indices = list(range(0, n_orbitals * 2, 2))
        beta_indices = list(range(1, n_orbitals * 2, 2))
        chemist_two_body_coefficients = chemist_two_body_coefficients[numpy.ix_(
            alpha_indices, alpha_indices, beta_indices, beta_indices)]

    # Determine a one body correction in the spin basis from spatial basis.
    one_body_correction = numpy.zeros((2 * n_orbitals, 2 * n_orbitals), complex)
    for p, q, r, s in itertools.product(range(n_orbitals), repeat=4):
        for sigma, tau in itertools.product(range(2), repeat=2):
            if (q == r) and (sigma == tau):
                one_body_correction[2 * p + sigma, 2 * s + tau] -= (
                    chemist_two_body_coefficients[p, q, r, s])

    # Return.
    return one_body_correction, chemist_two_body_coefficients

def low_rank_two_body_decomposition(two_body_coefficients,
                                    truncation_threshold=1e-8,
                                    final_rank=None,
                                    spin_basis=True):
    r"""Convert two-body operator into sum of squared one-body operators.

    As in arXiv:1808.02625, this function decomposes
    $\sum_{pqrs} h_{pqrs} a^\dagger_p a^\dagger_q a_r a_s$ as
    $\sum_{l} \lambda_l (\sum_{pq} g_{lpq} a^\dagger_p a_q)^2$
    l is truncated to take max value L so that
    $\sum_{l=0}^{L-1} (\sum_{pq} |g_{lpq}|)^2 |\lambda_l| < x$

    Args:
        two_body_coefficients (ndarray): an N x N x N x N
            numpy array giving the $h_{pqrs}$ tensor.
            This tensor must be 8-fold symmetric (real integrals).
        truncation_threshold (optional Float): the value of x, above.
        final_rank (optional int): if provided, this specifies the value of
            L at which to truncate. This overrides truncation_threshold.
        spin_basis (bool): True if the two-body terms are passed in spin
            orbital basis.  False if already in spatial orbital basis.

    Returns:
        eigenvalues (ndarray of floats): length L array
            giving the $\lambda_l$.
        one_body_squares (ndarray of floats): L x N x N array of floats
            corresponding to the value of $g_{pql}$.
        one_body_correction (ndarray): One-body correction terms that result
            from reordering to chemist ordering, in spin-orbital basis.
        truncation_value (float): after truncation, this is the value
            $\sum_{l=0}^{L-1} (\sum_{pq} |g_{lpq}|)^2 |\lambda_l| < x$

    Raises:
        TypeError: Invalid two-body coefficient tensor specification.
    """
    # Initialize N^2 by N^2 interaction array.
    one_body_correction, chemist_two_body_coefficients = (
        get_chemist_two_body_coefficients(two_body_coefficients, spin_basis))
    n_orbitals = chemist_two_body_coefficients.shape[0]
    full_rank = n_orbitals**2
    interaction_array = numpy.reshape(chemist_two_body_coefficients,
                                      (full_rank, full_rank))

    # Make sure interaction array is symmetric and real.
    asymmetry = numpy.sum(
        numpy.absolute(interaction_array - interaction_array.transpose()))
    imaginary_norm = numpy.sum(numpy.absolute(interaction_array.imag))
    if asymmetry > EQ_TOLERANCE or imaginary_norm > EQ_TOLERANCE:
        raise TypeError('Invalid two-body coefficient tensor specification.')

    # Decompose with exact diagonalization.
    eigenvalues, eigenvectors = numpy.linalg.eigh(interaction_array)

    # Get one-body squares and compute weights.
    term_weights = numpy.zeros(full_rank)
    one_body_squares = numpy.zeros((full_rank, 2 * n_orbitals, 2 * n_orbitals),
                                   complex)

    # Reshape and add spin back in.
    for l in range(full_rank):
        one_body_squares[l] = numpy.kron(
            numpy.reshape(eigenvectors[:, l], (n_orbitals, n_orbitals)),
            numpy.eye(2))
        term_weights[l] = abs(eigenvalues[l]) * numpy.sum(
            numpy.absolute(one_body_squares[l]))**2

    # Sort by weight.
    indices = numpy.argsort(term_weights)[::-1]
    eigenvalues = eigenvalues[indices]
    term_weights = term_weights[indices]
    one_body_squares = one_body_squares[indices]

    # Determine upper-bound on truncation errors that would occur.
    cumulative_error_sum = numpy.cumsum(term_weights)
    truncation_errors = cumulative_error_sum[-1] - cumulative_error_sum

    # Optionally truncate rank and return.
    if final_rank is None:
        max_rank = 1 + numpy.argmax(truncation_errors <= truncation_threshold)
    else:
        max_rank = final_rank
    truncation_value = truncation_errors[max_rank - 1]
    return (eigenvalues[:max_rank], one_body_squares[:max_rank],
            one_body_correction, truncation_value)

def prepare_one_body_squared_evolution(one_body_matrix, spin_basis=True):
    r"""Get Givens angles and DiagonalHamiltonian to simulate squared one-body.

    The goal here will be to prepare to simulate evolution under
    $(\sum_{pq} h_{pq} a^\dagger_p a_q)^2$ by decomposing as
    $R e^{-i \sum_{pq} V_{pq} n_p n_q} R^\dagger$ where
    $R$ is a basis transformation matrix.

    TODO: Add option for truncation based on one-body eigenvalues.

    Args:
        one_body_matrix (ndarray of floats): an N by N array storing the
            coefficients of a one-body operator to be squared. For instance,
            in the above the elements of this matrix are $h_{pq}$.
        spin_basis (bool): Whether the matrix is passed in the
            spin orbital basis.

    Returns:
        density_density_matrix(ndarray of floats) an N by N array storing
            the diagonal two-body coefficeints $V_{pq}$ above.
        basis_transformation_matrix (ndarray of floats) an N by N array
            storing the values of the basis transformation.

    Raises:
        ValueError: one_body_matrix is not Hermitian.
    """
    # If the specification was in spin-orbitals, chop back down to spatial orbs
    # assuming a spin-symmetric interaction
    if spin_basis:
        n_modes = one_body_matrix.shape[0]
        alpha_indices = list(range(0, n_modes, 2))
        one_body_matrix = one_body_matrix[numpy.ix_(alpha_indices,
                                                    alpha_indices)]

    # Diagonalize the one-body matrix.
    if utils.is_hermitian(one_body_matrix):
        eigenvalues, eigenvectors = numpy.linalg.eigh(one_body_matrix)
    else:
        raise ValueError('one_body_matrix is not Hermitian.')
    basis_transformation_matrix = numpy.conjugate(eigenvectors.transpose())

    # If the specification was in spin-orbitals, expand back
    if spin_basis:
        basis_transformation_matrix = numpy.kron(basis_transformation_matrix,
                                                 numpy.eye(2))
        eigenvalues = numpy.kron(eigenvalues, numpy.ones(2))

    # Obtain the diagonal two-body matrix.
    density_density_matrix = numpy.outer(eigenvalues, eigenvalues)

    # Return.
    return density_density_matrix, basis_transformation_matrix


text:
package krati.core.array.entry;

/**
 * EntryFactory.
 *
 * @author jwu
 *
 * @param <T> Generic type for the basic values contained by an Entry
 */
public interface EntryFactory<T extends EntryValue> {

    public Entry<T> newEntry(int initialCapacity);

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace CuvooApi.Models
{
    public class Device
    {
        public int Id { get; set; }
        [Required]
        public string Nombre { get; set; }
        public DateTime FechaAlta { get; set; }
        public DateTime FechaValidez { get; set; }
        public int Bateria { get; set; }
        public string Genre { get; set; }

        // Foreign Key
        public int UsuarioId { get; set; }
        // Navigation property
        public virtual  Usuario Usuario { get; set; }

        public Estado Estado { get; set; }
        //Collection navigation property
        public virtual  IList<Sensor> Sensors { get; set; }

    }
}


text:
from py2neo import *
import csv

gr=Graph(host="localhost",password="XXXyour passXXX",user="neo4j")

"""gr=Graph(password="XXXyour passXXXX")"""                                             #will also do as only authentication is required

gr.run("merge (someone:masterchef{name:'someone',city:'chandigarh',age:22})")           #your query here

"""listofdict=gr.data("matCh (n:masterchef) return n.name, n.age")"""                  # display data from database, returns list of dictionaries
                                                                                # n.age, n.name restricts the data to be displayed
             #------------OR------------
listofdict=gr.run("matCh (n:masterchef) return n.name, n.age").data()

for i in listofdict:
	print(i)

gr.run("match (k:masterchef{age:22}) detach delete k")

                                                                                #get data from csv file to neo4j database
with open('C:\\Users\\R6000670\\Documents\\Neo4j\\pracneo\\import\\dataset.csv') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        tt=row['Ticket_Type']
        sv=row['Severity']
        rqid=row['Requester_ID']
        rs=row['Requester_Seniority']
        fa=row["Filed_Against"]
        pr=row["Priority"]
        ito=row["IT_Owner_ID"]
        do=row["Days_Open"]
        sat=row["Satisfaction"]
        tx = gr.begin()
        a = Node("data",ticket_type=tt, severity=sv, request_id=rqid, requester_seniority=rs, filed_against=fa, priority=pr, it_owner_id=ito, days_open=do,satisfaction=sat)
        tx.merge(a)
        tx.commit()


text:
title: PETERFIELD
is_name: true

---

PETERFIELD


text:
var gulp = require("gulp");
var CFG = require("./utils/config.js");
var $ = require("gulp-load-plugins")();
var path = require("path");
var pkg = require(path.join("..", CFG.FILE.config.pkg));

/**
 * script:minify
 * @see www.npmjs.org/package/gulp-uglify
 * @see github.com/mishoo/UglifyJS
 */
gulp.task("script:minify", ["script:optimize", "script:minify:json", "source"], function() {
  // TODO Use gulp-header to add version info.

  return gulp.src([
      path.join(CFG.DIR.dist, "/**/*." + CFG.FILE.extension.script.js)
    ])
    .pipe($.uglify({
      outSourceMap: false, // Disable sourcemaps until github.com/gulpjs/gulp/issues/356
      // See github.com/terinjokes/gulp-uglify/issues/67
      mangle: {
        except: [
          "require",
          "define"
        ]
      },
      preserveComments: "some",
      compress: {
        drop_console: true,
        dead_code: true,
        drop_debugger: true,
        join_vars: true,
        warnings: false,
        pure_funcs: [/* "console.log" */]
      }
    }))
    .pipe(gulp.dest(CFG.DIR.dist));
});


text:
<?php

namespace Controller;

Class MainController extends \MVC\MvcController{

    public function index(){

        echo $this->data->message;
    }

    public function test(){

        echo "Test Page";
    }

    public function testVariable( $variable ){

        echo $variable;
    }
}


text:
package com.quollwriter.achievements.rules;

import java.util.*;

import org.jdom.*;

import com.gentlyweb.xml.*;

import com.quollwriter.*;
import com.quollwriter.ui.*;

public abstract class AbstractAchievementRule implements AchievementRule
{

    public class XMLConstants
    {

        public static final String id = "id";
        public static final String category = "category";
        //public static final String name = "name";
        public static final String icon = "icon";
        //public static final String description = "description";
        public static final String event = "event";
        public static final String hidden = "hidden";

    }

    private String id = null;
    private String desc = null;
    private String name = null;
    private String icon = null;
    private String cat = null;
    private boolean hidden = false;

    protected Set<String> eventIds = new HashSet ();

    public String toString ()
    {

        return this.id + "[" + this.name + ", event ids: " + this.eventIds + ", hidden: " + this.hidden + "]";

    }

    public AbstractAchievementRule (Element root)
                                    throws  JDOMException
    {

        this.id = JDOMUtils.getAttributeValue (root,
                                               XMLConstants.id,
                                               true);
        this.cat = JDOMUtils.getAttributeValue (root,
                                                XMLConstants.category,
                                                true);
        this.hidden = JDOMUtils.getAttributeValueAsBoolean (root,
                                                            XMLConstants.hidden,
                                                            false);

        // Get the name from the language string.
        this.name = Environment.getUIString (LanguageStrings.achievements,
                                             this.id,
                                             LanguageStrings.name);

        if (this.name == null)
        {

            throw new JDOMException ("Unable to find name string for achievement: " +
                                     this.id);

        }

        this.desc = Environment.getUIString (LanguageStrings.achievements,
                                             this.id,
                                             LanguageStrings.description);

        if (this.desc == null)
        {

            throw new JDOMException ("Unable to find description string for achievement: " +
                                     this.id);

        }

        this.icon = JDOMUtils.getAttributeValue (root,
                                                 XMLConstants.icon,
                                                 false);

        if (this.icon.equals (""))
        {

            this.icon = null;

        }

        String ev = JDOMUtils.getAttributeValue (root,
                                                 XMLConstants.event,
                                                 false);

        if (!ev.equals (""))
        {

            StringTokenizer t = new StringTokenizer (ev,
                                                     ":;");

            while (t.hasMoreTokens ())
            {

                String part = t.nextToken ();

                // Split on .
                StringTokenizer tt = new StringTokenizer (part,
                                                          ".");

                String type = tt.nextToken ();

                if (tt.hasMoreTokens ())
                {

                    StringTokenizer ttt = new StringTokenizer (tt.nextToken (),
                                                               ",");

                    while (ttt.hasMoreTokens ())
                    {

                        this.eventIds.add (type + "." + ttt.nextToken ().toLowerCase ());

                    }

                } else {

                    this.eventIds.add (type + "." + ProjectEvent.ANY);

                }

            }

        }

    }

    public boolean isHidden ()
    {

        return this.hidden;

    }

    public Set<String> getEventIds ()
    {

        return this.eventIds;

    }

    public boolean isEventTrigger ()
    {

        return this.eventIds.size () > 0;

    }

    public String getCategory ()
    {

        return this.cat;

    }

    public String getDescription ()
    {

        return this.desc;

    }

    public String getName ()
    {

        return this.name;

    }

    public String getIcon ()
    {

        return this.icon;

    }

    public String getId ()
    {

        return this.id;

    }

    public boolean achieved (AbstractProjectViewer viewer,
                             ProjectEvent          ev)
                             throws                Exception
    {

        return false;

    }

    public boolean achieved (ProjectEvent ev)
                             throws       Exception
    {

        return false;

    }

    public boolean achieved (AbstractProjectViewer viewer)
                             throws                Exception
    {

        return false;

    }

}


text:
package com.pragmaticobjects.oo.atom.codegen.bytebuddy.matchers.atomspec;

import com.pragmaticobjects.oo.atom.codegen.bytebuddy.matchers.AssertThatTypeDoesNotMatch;
import com.pragmaticobjects.oo.atom.codegen.bytebuddy.matchers.AssertThatTypeMatches;
import com.pragmaticobjects.oo.atom.tests.TestCase;
import com.pragmaticobjects.oo.atom.tests.TestsSuite;
import net.bytebuddy.description.type.TypeDescription;

/**
 * Tests suite for {@link IsNotAbstract}
 *
 * @author Kapralov Sergey
 */
public class IsNotAbstractTest extends TestsSuite {
    /**
     * Ctor.
     */
    public IsNotAbstractTest() {
        super(
            new TestCase(
                "match non-abstract classes",
                new AssertThatTypeMatches(
                    new TypeDescription.ForLoadedType(Foo.class),
                    new IsNotAbstract()
                )
            ),
            new TestCase(
                "mismatch abstract classes",
                new AssertThatTypeDoesNotMatch(
                    new TypeDescription.ForLoadedType(Bar.class),
                    new IsNotAbstract()
                )
            ),
            new TestCase(
                "match enumeration types",
                new AssertThatTypeMatches(
                    new TypeDescription.ForLoadedType(Faz.class),
                    new IsNotAbstract()
                )
            )
        );
    }

    //CHECKSTYLE:OFF
    private static class Foo {
    }

    private abstract static class Bar {
    }

    private static enum Faz {
        ONE(1), TWO(2), THREE(3);

        private final int origin;

        private Faz(int origin) {
            this.origin = origin;
        }

        public final int getOrigin() {
            return origin;
        }
    }
}


text:
/*!
 *  Font Awesome 3.0.2
 *  the iconic font designed for use with Twitter Bootstrap
 *  -------------------------------------------------------
 *  The full suite of pictographic icons, examples, and documentation
 *  can be found at: http://fortawesome.github.com/Font-Awesome/
 *
 *  License
 *  -------------------------------------------------------
 *  - The Font Awesome font is licensed under the SIL Open Font License - http://scripts.sil.org/OFL
 *  - Font Awesome CSS, LESS, and SASS files are licensed under the MIT License -
 *    http://opensource.org/licenses/mit-license.html
 *  - The Font Awesome pictograms are licensed under the CC BY 3.0 License - http://creativecommons.org/licenses/by/3.0/
 *  - Attribution is no longer required in Font Awesome 3.0, but much appreciated:
 *    "Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome"

 *  Contact
 *  -------------------------------------------------------
 *  Email: dave@davegandy.com
 *  Twitter: http://twitter.com/fortaweso_me
 *  Work: Lead Product Designer @ http://kyruus.com
 *
 *  Modified by
 *  -------------------------------------------------------
 *  Email: kyle@plainmade.com
 *  Twitter: http://twitter.com/kyleruane
 *  Twitter: http://twitter.com/plainmade
 *  Work: Co-founder, Plain: http://plainmade.com
 */
@font-face {
  font-family: 'Barlicons';
  src: url(../fonts/barlicons.eot?v=3.0.1);
  src: url(../fonts/barlicons.eot?#iefix&v=3.0.1) format('embedded-opentype'),
    url(../fonts/barlicons.woff?v=3.0.1) format('woff'),
    url(../fonts/barlicons.ttf?v=3.0.1) format('truetype');
  font-weight: normal;
  font-style: normal;
}
/*  Font Awesome styles
    ------------------------------------------------------- */
[class^="barley-icon-"],
[class*=" barley-icon-"] {
  font-family: Barlicons;
  font-weight: normal;
  font-style: normal;
  text-decoration: inherit;
  -webkit-font-smoothing: antialiased;

  /* sprites.less reset */
  display: inline;
  width: auto;
  height: auto;
  line-height: normal;
  vertical-align: baseline;
  background-image: none;
  background-position: 0% 0%;
  background-repeat: repeat;
  margin-top: 0;
}
/* more sprites.less reset */
.barley-icon-white,
.nav-pills > .active > a > [class^="barley-icon-"],
.nav-pills > .active > a > [class*=" barley-icon-"],
.nav-list > .active > a > [class^="barley-icon-"],
.nav-list > .active > a > [class*=" barley-icon-"],
.navbar-inverse .nav > .active > a > [class^="barley-icon-"],
.navbar-inverse .nav > .active > a > [class*=" barley-icon-"],
.dropdown-menu > li > a:hover > [class^="barley-icon-"],
.dropdown-menu > li > a:hover > [class*=" barley-icon-"],
.dropdown-menu > .active > a > [class^="barley-icon-"],
.dropdown-menu > .active > a > [class*=" barley-icon-"],
.dropdown-submenu:hover > a > [class^="barley-icon-"],
.dropdown-submenu:hover > a > [class*=" barley-icon-"] {
  background-image: none;
}
[class^="barley-icon-"]:before,
[class*=" barley-icon-"]:before {
  text-decoration: inherit;
  display: inline-block;
  speak: none;
}
/* makes sure icons active on rollover in links */
a [class^="barley-icon-"],
a [class*=" barley-icon-"] {
  display: inline-block;
}
/* makes the font 33% larger relative to the icon container */
.barley-icon-large:before {
  vertical-align: -10%;
  font-size: 1.3333333333333333em;
}
.btn [class^="barley-icon-"],
.nav [class^="barley-icon-"],
.btn [class*=" barley-icon-"],
.nav [class*=" barley-icon-"] {
  display: inline;
  /* keeps button heights with and without icons the same */

}
.btn [class^="barley-icon-"].barley-icon-large,
.nav [class^="barley-icon-"].barley-icon-large,
.btn [class*=" barley-icon-"].barley-icon-large,
.nav [class*=" barley-icon-"].barley-icon-large {
  line-height: .9em;
}
.btn [class^="barley-icon-"].barley-icon-spin,
.nav [class^="barley-icon-"].barley-icon-spin,
.btn [class*=" barley-icon-"].barley-icon-spin,
.nav [class*=" barley-icon-"].barley-icon-spin {
  display: inline-block;
}
.nav-tabs [class^="barley-icon-"],
.nav-pills [class^="barley-icon-"],
.nav-tabs [class*=" barley-icon-"],
.nav-pills [class*=" barley-icon-"] {
  /* keeps button heights with and without icons the same */

}
.nav-tabs [class^="barley-icon-"],
.nav-pills [class^="barley-icon-"],
.nav-tabs [class*=" barley-icon-"],
.nav-pills [class*=" barley-icon-"],
.nav-tabs [class^="barley-icon-"].barley-icon-large,
.nav-pills [class^="barley-icon-"].barley-icon-large,
.nav-tabs [class*=" barley-icon-"].barley-icon-large,
.nav-pills [class*=" barley-icon-"].barley-icon-large {
  line-height: .9em;
}
li [class^="barley-icon-"],
.nav li [class^="barley-icon-"],
li [class*=" barley-icon-"],
.nav li [class*=" barley-icon-"] {
  display: inline-block;
  width: 1.25em;
  text-align: center;
}
li [class^="barley-icon-"].barley-icon-large,
.nav li [class^="barley-icon-"].barley-icon-large,
li [class*=" barley-icon-"].barley-icon-large,
.nav li [class*=" barley-icon-"].barley-icon-large {
  /* increased font size for icon-large */

  width: 1.5625em;
}
ul.icons {
  list-style-type: none;
  text-indent: -0.75em;
}
ul.icons li [class^="barley-icon-"],
ul.icons li [class*=" barley-icon-"] {
  width: .75em;
}
.barley-icon-muted {
  color: #eeeeee;
}
.barley-icon-border {
  border: solid 1px #eeeeee;
  padding: .2em .25em .15em;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
}
.barley-icon-2x {
  font-size: 2em;
}
.barley-icon-2x.barley-icon-border {
  border-width: 2px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
}
.barley-icon-3x {
  font-size: 3em;
}
.barley-icon-3x.barley-icon-border {
  border-width: 3px;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  border-radius: 5px;
}
.barley-icon-4x {
  font-size: 4em;
}
.barley-icon-4x.barley-icon-border {
  border-width: 4px;
  -webkit-border-radius: 6px;
  -moz-border-radius: 6px;
  border-radius: 6px;
}
.pull-right {
  float: right;
}
.pull-left {
  float: left;
}
[class^="barley-icon-"].pull-left,
[class*=" barley-icon-"].pull-left {
  margin-right: .3em;
}
[class^="barley-icon-"].pull-right,
[class*=" barley-icon-"].pull-right {
  margin-left: .3em;
}
.btn [class^="barley-icon-"].pull-left.barley-icon-2x,
.btn [class*=" barley-icon-"].pull-left.barley-icon-2x,
.btn [class^="barley-icon-"].pull-right.barley-icon-2x,
.btn [class*=" barley-icon-"].pull-right.barley-icon-2x {
  margin-top: .18em;
}
.btn [class^="barley-icon-"].barley-icon-spin.barley-icon-large,
.btn [class*=" barley-icon-"].barley-icon-spin.barley-icon-large {
  line-height: .8em;
}
.btn.btn-small [class^="barley-icon-"].pull-left.barley-icon-2x,
.btn.btn-small [class*=" barley-icon-"].pull-left.barley-icon-2x,
.btn.btn-small [class^="barley-icon-"].pull-right.barley-icon-2x,
.btn.btn-small [class*=" barley-icon-"].pull-right.barley-icon-2x {
  margin-top: .25em;
}
.btn.btn-large [class^="barley-icon-"],
.btn.btn-large [class*=" barley-icon-"] {
  margin-top: 0;
}
.btn.btn-large [class^="barley-icon-"].pull-left.barley-icon-2x,
.btn.btn-large [class*=" barley-icon-"].pull-left.barley-icon-2x,
.btn.btn-large [class^="barley-icon-"].pull-right.barley-icon-2x,
.btn.btn-large [class*=" barley-icon-"].pull-right.barley-icon-2x {
  margin-top: .05em;
}
.btn.btn-large [class^="barley-icon-"].pull-left.barley-icon-2x,
.btn.btn-large [class*=" barley-icon-"].pull-left.barley-icon-2x {
  margin-right: .2em;
}
.btn.btn-large [class^="barley-icon-"].pull-right.barley-icon-2x,
.btn.btn-large [class*=" barley-icon-"].pull-right.barley-icon-2x {
  margin-left: .2em;
}
.barley-icon-spin {
  display: inline-block;
  -moz-animation: spin 2s infinite linear;
  -o-animation: spin 2s infinite linear;
  -webkit-animation: spin 2s infinite linear;
  animation: spin 2s infinite linear;
}
@-moz-keyframes spin {
  0% { -moz-transform: rotate(0deg); }
  100% { -moz-transform: rotate(359deg); }
}
@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(359deg); }
}
@-o-keyframes spin {
  0% { -o-transform: rotate(0deg); }
  100% { -o-transform: rotate(359deg); }
}
@-ms-keyframes spin {
  0% { -ms-transform: rotate(0deg); }
  100% { -ms-transform: rotate(359deg); }
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(359deg); }
}
@-moz-document url-prefix() {
  .barley-icon-spin {
    height: .9em;
  }
  .btn .barley-icon-spin {
    height: auto;
  }
  .barley-icon-spin.barley-icon-large {
    height: 1.25em;
  }
  .btn .barley-icon-spin.barley-icon-large {
    height: .75em;
  }
}
/*  Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen
    readers do not read off random characters that represent icons */
.barley-icon-glass:before                { content: "\f000"; }
.barley-icon-music:before                { content: "\f001"; }
.barley-icon-search:before               { content: "\f002"; }
.barley-icon-envelope:before             { content: "\2709"; }
.barley-icon-heart:before                { content: "\f004"; }
.barley-icon-star:before                 { content: "\f005"; }
.barley-icon-star-empty:before           { content: "\f006"; }
.barley-icon-user:before                 { content: "\f007"; }
.barley-icon-film:before                 { content: "\f008"; }
.barley-icon-th-large:before             { content: "\f009"; }
.barley-icon-th:before                   { content: "\f00a"; }
.barley-icon-th-list:before              { content: "\f00b"; }
.barley-icon-ok:before                   { content: "\f00c"; }
.barley-icon-remove:before               { content: "\f00d"; }
.barley-icon-zoom-in:before              { content: "\f00e"; }

.barley-icon-zoom-out:before             { content: "\f010"; }
.barley-icon-off:before                  { content: "\f011"; }
.barley-icon-signal:before               { content: "\f012"; }
.barley-icon-cog:before                  { content: "\f013"; }
.barley-icon-trash:before                { content: "\f014"; }
.barley-icon-home:before                 { content: "\f015"; }
.barley-icon-file:before                 { content: "\f016"; }
.barley-icon-time:before                 { content: "\f017"; }
.barley-icon-road:before                 { content: "\f018"; }
.barley-icon-download-alt:before         { content: "\f019"; }
.barley-icon-download:before             { content: "\f01a"; }
.barley-icon-upload:before               { content: "\f01b"; }
.barley-icon-inbox:before                { content: "\f01c"; }
.barley-icon-play-circle:before          { content: "\f01d"; }
.barley-icon-repeat:before               { content: "\f01e"; }

/* \f020 doesn't work in Safari. all shifted one down */
.barley-icon-refresh:before              { content: "\f021"; }
.barley-icon-list-alt:before             { content: "\f022"; }
.barley-icon-lock:before                 { content: "\f023"; }
.barley-icon-paragraph:before            { content: "\00B6"; }
.barley-icon-headphones:before           { content: "\f025"; }
.barley-icon-volume-off:before           { content: "\f026"; }
.barley-icon-volume-down:before          { content: "\f027"; }
.barley-icon-volume-up:before            { content: "\f028"; }
.barley-icon-qrcode:before               { content: "\f029"; }
.barley-icon-barcode:before              { content: "\f02a"; }
.barley-icon-tag:before                  { content: "\f02b"; }
.barley-icon-tags:before                 { content: "\f02c"; }
.barley-icon-book:before                 { content: "\f02d"; }
.barley-icon-bookmark:before             { content: "\f02e"; }
.barley-icon-print:before                { content: "\f02f"; }

.barley-icon-camera:before               { content: "\f030"; }
.barley-icon-font:before                 { content: "\f031"; }
.barley-icon-bold:before                 { content: "\f032"; }
.barley-icon-italic:before               { content: "\f033"; }
.barley-icon-text-height:before          { content: "\f034"; }
.barley-icon-text-width:before           { content: "\f035"; }
.barley-icon-align-left:before           { content: "\f036"; }
.barley-icon-align-center:before         { content: "\f037"; }
.barley-icon-align-right:before          { content: "\f038"; }
.barley-icon-align-justify:before        { content: "\f039"; }
.barley-icon-list:before                 { content: "\f03a"; }
.barley-icon-indent-left:before          { content: "\f03b"; }
.barley-icon-indent-right:before         { content: "\f03c"; }
.barley-icon-facetime-video:before       { content: "\f03d"; }
.barley-icon-picture:before              { content: "\f03e"; }

.barley-icon-pencil:before               { content: "\270F"; }
.barley-icon-map-marker:before           { content: "\f041"; }
.barley-icon-adjust:before               { content: "\f042"; }
.barley-icon-tint:before                 { content: "\f043"; }
.barley-icon-edit:before                 { content: "\f044"; }
.barley-icon-share:before                { content: "\f045"; }
.barley-icon-check:before                { content: "\f046"; }
.barley-icon-move:before                 { content: "\f047"; }
.barley-icon-step-backward:before        { content: "\f048"; }
.barley-icon-fast-backward:before        { content: "\f049"; }
.barley-icon-backward:before             { content: "\f04a"; }
.barley-icon-play:before                 { content: "\f04b"; }
.barley-icon-pause:before                { content: "\f04c"; }
.barley-icon-stop:before                 { content: "\f04d"; }
.barley-icon-forward:before              { content: "\f04e"; }

.barley-icon-fast-forward:before         { content: "\f050"; }
.barley-icon-step-forward:before         { content: "\f051"; }
.barley-icon-eject:before                { content: "\f052"; }
.barley-icon-chevron-left:before         { content: "\f053"; }
.barley-icon-chevron-right:before        { content: "\f054"; }
.barley-icon-plus-sign:before            { content: "\f055"; }
.barley-icon-minus-sign:before           { content: "\f056"; }
.barley-icon-remove-sign:before          { content: "\f057"; }
.barley-icon-ok-sign:before              { content: "\f058"; }
.barley-icon-question-sign:before        { content: "\f059"; }
.barley-icon-info-sign:before            { content: "\f05a"; }
.barley-icon-screenshot:before           { content: "\f05b"; }
.barley-icon-remove-circle:before        { content: "\f05c"; }
.barley-icon-ok-circle:before            { content: "\f05d"; }
.barley-icon-ban-circle:before           { content: "\f05e"; }

.barley-icon-arrow-left:before           { content: "\f060"; }
.barley-icon-arrow-right:before          { content: "\f061"; }
.barley-icon-arrow-up:before             { content: "\f062"; }
.barley-icon-arrow-down:before           { content: "\f063"; }
.barley-icon-share-alt:before            { content: "\f064"; }
.barley-icon-resize-full:before          { content: "\f065"; }
.barley-icon-resize-small:before         { content: "\f066"; }
.barley-icon-plus:before                 { content: "\002B"; }
.barley-icon-minus:before                { content: "\2212"; }
.barley-icon-asterisk:before             { content: "\002A"; }
.barley-icon-exclamation-sign:before     { content: "\f06a"; }
.barley-icon-gift:before                 { content: "\f06b"; }
.barley-icon-leaf:before                 { content: "\f06c"; }
.barley-icon-fire:before                 { content: "\f06d"; }
.barley-icon-eye-open:before             { content: "\f06e"; }

.barley-icon-eye-close:before            { content: "\f070"; }
.barley-icon-warning-sign:before         { content: "\f071"; }
.barley-icon-plane:before                { content: "\f072"; }
.barley-icon-calendar:before             { content: "\f073"; }
.barley-icon-random:before               { content: "\f074"; }
.barley-icon-comment:before              { content: "\f075"; }
.barley-icon-magnet:before               { content: "\f076"; }
.barley-icon-chevron-up:before           { content: "\f077"; }
.barley-icon-chevron-down:before         { content: "\f078"; }
.barley-icon-retweet:before              { content: "\f079"; }
.barley-icon-shopping-cart:before        { content: "\f07a"; }
.barley-icon-folder-close:before         { content: "\f07b"; }
.barley-icon-folder-open:before          { content: "\f07c"; }
.barley-icon-resize-vertical:before      { content: "\f07d"; }
.barley-icon-resize-horizontal:before    { content: "\f07e"; }

.barley-icon-bar-chart:before            { content: "\f080"; }
.barley-icon-twitter-sign:before         { content: "\f081"; }
.barley-icon-facebook-sign:before        { content: "\f082"; }
.barley-icon-camera-retro:before         { content: "\f083"; }
.barley-icon-key:before                  { content: "\f084"; }
.barley-icon-cogs:before                 { content: "\f085"; }
.barley-icon-comments:before             { content: "\f086"; }
.barley-icon-thumbs-up:before            { content: "\f087"; }
.barley-icon-thumbs-down:before          { content: "\f088"; }
.barley-icon-star-half:before            { content: "\f089"; }
.barley-icon-heart-empty:before          { content: "\f08a"; }
.barley-icon-signout:before              { content: "\f08b"; }
.barley-icon-linkedin-sign:before        { content: "\f08c"; }
.barley-icon-pushpin:before              { content: "\f08d"; }
.barley-icon-external-link:before        { content: "\f08e"; }

.barley-icon-signin:before               { content: "\f090"; }
.barley-icon-trophy:before               { content: "\f091"; }
.barley-icon-github-sign:before          { content: "\f092"; }
.barley-icon-upload-alt:before           { content: "\f093"; }
.barley-icon-barley:before               { content: "\f094"; }
.barley-icon-phone:before                { content: "\f095"; }
.barley-icon-check-empty:before          { content: "\f096"; }
.barley-icon-bookmark-empty:before       { content: "\f097"; }
.barley-icon-phone-sign:before           { content: "\f098"; }
.barley-icon-twitter:before              { content: "\f099"; }
.barley-icon-facebook:before             { content: "\f09a"; }
.barley-icon-github:before               { content: "\f09b"; }
.barley-icon-unlock:before               { content: "\f09c"; }
.barley-icon-credit-card:before          { content: "\f09d"; }
.barley-icon-rss:before                  { content: "\f09e"; }

.barley-icon-hdd:before                  { content: "\f0a0"; }
.barley-icon-bullhorn:before             { content: "\f0a1"; }
.barley-icon-bell:before                 { content: "\f0a2"; }
.barley-icon-certificate:before          { content: "\f0a3"; }
.barley-icon-hand-right:before           { content: "\f0a4"; }
.barley-icon-hand-left:before            { content: "\f0a5"; }
.barley-icon-hand-up:before              { content: "\f0a6"; }
.barley-icon-hand-down:before            { content: "\f0a7"; }
.barley-icon-circle-arrow-left:before    { content: "\f0a8"; }
.barley-icon-circle-arrow-right:before   { content: "\f0a9"; }
.barley-icon-circle-arrow-up:before      { content: "\f0aa"; }
.barley-icon-circle-arrow-down:before    { content: "\f0ab"; }
.barley-icon-globe:before                { content: "\f0ac"; }
.barley-icon-wrench:before               { content: "\f0ad"; }
.barley-icon-tasks:before                { content: "\f0ae"; }

.barley-icon-filter:before               { content: "\f0b0"; }
.barley-icon-briefcase:before            { content: "\f0b1"; }
.barley-icon-fullscreen:before           { content: "\f0b2"; }

.barley-icon-group:before                { content: "\f0c0"; }
.barley-icon-link:before                 { content: "\f0c1"; }
.barley-icon-cloud:before                { content: "\2601"; }
.barley-icon-beaker:before               { content: "\f0c3"; }
.barley-icon-cut:before                  { content: "\f0c4"; }
.barley-icon-copy:before                 { content: "\f0c5"; }
.barley-icon-paper-clip:before           { content: "\f0c6"; }
.barley-icon-save:before                 { content: "\f0c7"; }
.barley-icon-sign-blank:before           { content: "\f0c8"; }
.barley-icon-reorder:before              { content: "\f0c9"; }
.barley-icon-list-ul:before              { content: "\f0ca"; }
.barley-icon-list-ol:before              { content: "\f0cb"; }
.barley-icon-strikethrough:before        { content: "\f0cc"; }
.barley-icon-underline:before            { content: "\f0cd"; }
.barley-icon-table:before                { content: "\f0ce"; }

.barley-icon-magic:before                { content: "\f0d0"; }
.barley-icon-truck:before                { content: "\f0d1"; }
.barley-icon-pinterest:before            { content: "\f0d2"; }
.barley-icon-pinterest-sign:before       { content: "\f0d3"; }
.barley-icon-google-plus-sign:before     { content: "\f0d4"; }
.barley-icon-google-plus:before          { content: "\f0d5"; }
.barley-icon-money:before                { content: "\f0d6"; }
.barley-icon-caret-down:before           { content: "\f0d7"; }
.barley-icon-caret-up:before             { content: "\f0d8"; }
.barley-icon-caret-left:before           { content: "\F0D9"; }
.barley-icon-caret-right:before          { content: "\f0da"; }
.barley-icon-columns:before              { content: "\f0db"; }
.barley-icon-sort:before                 { content: "\f0dc"; }
.barley-icon-sort-down:before            { content: "\f0dd"; }
.barley-icon-sort-up:before              { content: "\f0de"; }

.barley-icon-envelope-alt:before         { content: "\f0e0"; }
.barley-icon-linkedin:before             { content: "\f0e1"; }
.barley-icon-undo:before                 { content: "\f0e2"; }
.barley-icon-legal:before                { content: "\f0e3"; }
.barley-icon-dashboard:before            { content: "\f0e4"; }
.barley-icon-comment-alt:before          { content: "\f0e5"; }
.barley-icon-comments-alt:before         { content: "\f0e6"; }
.barley-icon-bolt:before                 { content: "\f0e7"; }
.barley-icon-sitemap:before              { content: "\f0e8"; }
.barley-icon-umbrella:before             { content: "\2602"; }
.barley-icon-paste:before                { content: "\f0ea"; }
.barley-icon-lightbulb:before            { content: "\f0eb"; }
.barley-icon-exchange:before             { content: "\f0ec"; }
.barley-icon-cloud-download:before       { content: "\f0ed"; }
.barley-icon-cloud-upload:before         { content: "\f0ee"; }

.barley-icon-embed:before                { content: "\f0f0"; }
.barley-icon-stethoscope:before          { content: "\f0f1"; }
.barley-icon-suitcase:before             { content: "\f0f2"; }
.barley-icon-bell-alt:before             { content: "\f0f3"; }
.barley-icon-coffee:before               { content: "\f0f4"; }
.barley-icon-smiley:before               { content: "\f0f5"; }
.barley-icon-file-alt:before             { content: "\f0f6"; }
.barley-icon-anchor-tag:before           { content: "\f0f7"; }
.barley-icon-crop:before  	             { content: "\f0f8"; }
.barley-icon-elipsis:before              { content: "\f1b4"; }
.barley-icon-presentation:before         { content: "\f0fa"; }
.barley-icon-code:before          		   { content: "\f0fb"; }
.barley-icon-beer:before                 { content: "\f0fc"; }
.barley-icon-h-sign:before               { content: "\f0fd"; }
.barley-icon-plus-sign-alt:before        { content: "\f0fe"; }

.barley-icon-double-angle-left:before    { content: "\f100"; }
.barley-icon-double-angle-right:before   { content: "\f101"; }
.barley-icon-double-angle-up:before      { content: "\f102"; }
.barley-icon-double-angle-down:before    { content: "\f103"; }
.barley-icon-angle-left:before           { content: "\f104"; }
.barley-icon-angle-right:before          { content: "\f105"; }
.barley-icon-angle-up:before             { content: "\f106"; }
.barley-icon-angle-down:before           { content: "\f107"; }
.barley-icon-desktop:before              { content: "\f108"; }
.barley-icon-laptop:before               { content: "\f109"; }
.barley-icon-tablet:before               { content: "\f10a"; }
.barley-icon-mobile-phone:before         { content: "\f10b"; }
.barley-icon-circle-blank:before         { content: "\f10c"; }
.barley-icon-quote-left:before           { content: "\f10d"; }
.barley-icon-quote-right:before          { content: "\f10e"; }

.barley-icon-spinner:before              { content: "\f110"; }
.barley-icon-circle:before               { content: "\f111"; }
.barley-icon-reply:before                { content: "\f112"; }
.barley-icon-github-alt:before           { content: "\f113"; }
.barley-icon-code-block:before   		     { content: "\f114"; }
.barley-icon-folder-open-alt:before      { content: "\f115"; }

.barley-icon-h1:before     			       { content: "\f1a1"; }
.barley-icon-h2:before     			       { content: "\f1a2"; }
.barley-icon-h3:before     			       { content: "\f1a3"; }
.barley-icon-h4:before     			       { content: "\f1a4"; }
.barley-icon-h5:before     			       { content: "\f1a5"; }
.barley-icon-h6:before     			       { content: "\f1a6"; }
.barley-icon-super:before     			   { content: "\f1a7"; }
.barley-icon-sub:before     			     { content: "\f1a8"; }
.barley-icon-font-increase:before      { content: "\f1a9"; }
.barley-icon-font-decrease:before      { content: "\f1a0"; }
.barley-icon-barley-alt:before     	   { content: "\f1b1"; }
.barley-icon-plain-mark:before     	   { content: "\f1b2"; }
.barley-icon-plain:before 		    	   { content: "\f1b3"; }


text:
	Version 0.0.0

	 Source

Browse DocTypes by Module

Contents

{index}


text:
package com.creditease.agent.spi;

import java.util.HashMap;
import java.util.Map;

import com.creditease.agent.helpers.StringHelper;

public class ActionEngine extends AbstractComponent implements IActionEngine {

    private volatile boolean stopFlag = false;
    private Map<String, AbstractBaseAction> actionMap = new HashMap<String, AbstractBaseAction>();

    public ActionEngine(String name, String feature) {
        super(name, feature);
    }

    @Override
    public ActionContext execute(String actionId, ActionContext context) {

        AbstractBaseAction action = getAction(actionId);
        if (action == null) {
            return context;
        }

        String nextActionId = null;

        while (action != null) {

            if (stopFlag) {
                if (log.isTraceEnable()) {
                    log.info(this, "Received stop command, so stop executing actions");
                }

                break;
            }

            try {
                context.setSucessful(false);

                action.doAction(context);

                String jumpTargetActionId = context.getJumpTargetActionId();

                if (!StringHelper.isEmpty(jumpTargetActionId)) {
                    nextActionId = jumpTargetActionId;
                }
                else {
                    if (context.isSucessful()) {
                        nextActionId = action.getSuccessNextActionId();
                    }
                    else {
                        nextActionId = action.getFailureNextActionId();
                    }
                }

                context.setJumpTargetActionId(null);
                context.setE(null);
            }
            catch (Exception e) {
                if (log.isTraceEnable()) {
                    log.err(this, "Exception occured " + e.getMessage(), e);
                }
                context.setE(e);
                context.setJumpTargetActionId(null);
                nextActionId = action.getExceptionNextActionId();
            }

            action = getAction(nextActionId);
        }

        return context;
    }

    @Override
    public void registerAction(AbstractBaseAction action) {

        actionMap.put(action.getName(), action);
    }

    @Override
    public AbstractBaseAction unregisterAction(String actionId) {

        return actionMap.remove(actionId);
    }

    @Override
    public AbstractBaseAction getAction(String actionId) {

        return actionMap.get(actionId);
    }

    @Override
    public void stop() {

        this.stopFlag = true;
    }

    @Override
    public void jump(String actionId, ActionContext context) {

        context.setJumpTargetActionId(actionId);
    }

    @Override
    public void clean() {

        stop();

        for (AbstractBaseAction action : actionMap.values()) {
            try {
                action.destroy();
            }
            catch (Exception e) {
                log.err(this, "Action[" + action.cName + "] Destroy FAIL.", e);
            }
        }

        actionMap.clear();
    }

}


text:
OpenVPN Daemon Docker Image
====================

This repository contains `Dockerfile` definitions for [OpenVPN][openvpn] Docker images.

## Supported tags

* [`latest` _(Dockerfile)_](Dockerfile)

Getting started for this docker container at the [Docker Hub][registry].

[openvpn]: en.wikipedia.org/wiki/OpenVPN
[registry]: https://registry.hub.docker.com/u/zealic/openvpn