text:
using Lucene.Net.Support;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Xml;

namespace Lucene.Net.Analysis.Compound.Hyphenation
{

    /// <summary>
    /// A XMLReader document handler to read and parse hyphenation patterns from a XML
    /// file.
    /// <para/>
    /// LUCENENET: This class has been refactored from its Java counterpart to use XmlReader rather
    /// than a SAX parser.
    /// </summary>
    public class PatternParser
    {
        internal int currElement;

        internal IPatternConsumer consumer;

        internal StringBuilder token;

        internal IList<object> exception;

        internal char hyphenChar;

        internal const int ELEM_CLASSES = 1;

        internal const int ELEM_EXCEPTIONS = 2;

        internal const int ELEM_PATTERNS = 3;

        internal const int ELEM_HYPHEN = 4;

        public PatternParser()
        {
            token = new StringBuilder();
            hyphenChar = '-'; // default
        }

        public PatternParser(IPatternConsumer consumer)
            : this()
        {
            this.consumer = consumer;
        }

        public virtual IPatternConsumer Consumer
        {
            get // LUCENENET NOTE: Added getter per MSDN guidelines
            {
                return this.consumer;
            }
            set
            {
                this.consumer = value;
            }
        }

        /// <summary>
        /// Parses a hyphenation pattern file.
        /// </summary>
        /// <param name="path">The complete file path to be read.</param>
        /// <exception cref="IOException"> In case of an exception while parsing </exception>
        public virtual void Parse(string path)
        {
            // LUCENENET TODO: Create overloads that allow XmlReaderSettings to be passed in.
            Parse(path, Encoding.UTF8);
        }

        /// <summary>
        /// Parses a hyphenation pattern file.
        /// </summary>
        /// <param name="path">The complete file path to be read.</param>
        /// <param name="encoding">The character encoding to use</param>
        /// <exception cref="IOException"> In case of an exception while parsing </exception>
        public virtual void Parse(string path, Encoding encoding)
        {
            var xmlReaderSettings = GetXmlReaderSettings();

            // LUCENENET TODO: Create overloads that allow XmlReaderSettings to be passed in.
            using (var src = XmlReader.Create(new StreamReader(new FileStream(path, FileMode.Open), encoding), xmlReaderSettings))
            {
                Parse(src);
            }
        }

        /// <summary>
        /// Parses a hyphenation pattern file.
        /// </summary>
        /// <param name="file">  a <see cref="FileInfo"/> object representing the file  </param>
        /// <exception cref="IOException"> In case of an exception while parsing </exception>
        public virtual void Parse(FileInfo file)
        {
            Parse(file, Encoding.UTF8);
        }

        /// <summary>
        /// Parses a hyphenation pattern file.
        /// </summary>
        /// <param name="file">  a <see cref="FileInfo"/> object representing the file </param>
        /// <param name="encoding">The character encoding to use</param>
        /// <exception cref="IOException"> In case of an exception while parsing </exception>
        public virtual void Parse(FileInfo file, Encoding encoding)
        {
            var xmlReaderSettings = GetXmlReaderSettings();

            using (var src = XmlReader.Create(new StreamReader(file.OpenRead(), encoding), xmlReaderSettings))
            {
                Parse(src);
            }
        }

        /// <summary>
        /// Parses a hyphenation pattern file.
        /// </summary>
        /// <param name="xmlStream">
        /// The stream containing the XML data.
        /// <para/>
        /// The <see cref="PatternParser"/> scans the first bytes of the stream looking for a byte order mark
        /// or other sign of encoding. When encoding is determined, the encoding is used to continue reading
        /// the stream, and processing continues parsing the input as a stream of (Unicode) characters.
        /// </param>
        /// <exception cref="IOException"> In case of an exception while parsing </exception>
        public virtual void Parse(Stream xmlStream)
        {
            var xmlReaderSettings = GetXmlReaderSettings();

            using (var src = XmlReader.Create(xmlStream, xmlReaderSettings))
            {
                Parse(src);
            }
        }

        /// <summary>
        /// Parses a hyphenation pattern file.
        /// </summary>
        /// <param name="source"> <see cref="XmlReader"/> input source for the file </param>
        /// <exception cref="IOException"> In case of an exception while parsing </exception>
        public virtual void Parse(XmlReader source)
        {
            source.MoveToContent();
            while (source.Read())
            {
                ParseNode(source);
            }
        }

        private void ParseNode(XmlReader node)
        {
            string uri, name, raw;
            switch (node.NodeType)
            {
                case XmlNodeType.Element:

                    // Element start
                    uri = node.NamespaceURI;
                    name = node.Name;
                    bool isEmptyElement = node.IsEmptyElement;
                    var attributes = GetAttributes(node);
                    raw = string.Empty; // node.ReadOuterXml(); - not used, but was messing with the node pointer

                    this.StartElement(uri, name, raw, attributes);
                    if (isEmptyElement)
                    {
                        this.EndElement(uri, name, raw);
                    }
                    break;

                case XmlNodeType.Text:

                    this.Characters(node.Value.ToCharArray(), 0, node.Value.Length);
                    break;

                case XmlNodeType.EndElement:
                    uri = node.NamespaceURI;
                    name = node.Name;
                    raw = string.Empty; // node.ReadOuterXml(); - not used, but was messing with the node pointer

                    // Element end
                    this.EndElement(uri, name, raw);
                    break;
            }
        }

        private XmlReaderSettings GetXmlReaderSettings()
        {
            return

                new XmlReaderSettings
                {
                    // DTD Processing currently is
                    // not supported in .NET Standard but will come back in .NET Standard 2.0.
                    // https://github.com/dotnet/corefx/issues/4376.
#if FEATURE_DTD_PROCESSING
                    DtdProcessing = DtdProcessing.Parse,
                    XmlResolver = new DtdResolver()
#else
                    DtdProcessing = DtdProcessing.Ignore
#endif
                };
        }

        private IDictionary<string, string> GetAttributes(XmlReader node)
        {
            var result = new Dictionary<string, string>();
            if (node.HasAttributes)
            {
                for (int i = 0; i < node.AttributeCount; i++)
                {
                    node.MoveToAttribute(i);
                    result.Add(node.Name, node.Value);
                }
            }

            return result;
        }

        protected virtual string ReadToken(StringBuilder chars)
        {
            string word;
            bool space = false;
            int i;
            for (i = 0; i < chars.Length; i++)
            {
                if (char.IsWhiteSpace(chars[i]))
                {
                    space = true;
                }
                else
                {
                    break;
                }
            }
            if (space)
            {
                // chars.delete(0,i);
                for (int countr = i; countr < chars.Length; countr++)
                {
                    chars[countr - i] = chars[countr];
                }
                chars.Length = chars.Length - i;
                if (token.Length > 0)
                {
                    word = token.ToString();
                    token.Length = 0;
                    return word;
                }
            }
            space = false;
            for (i = 0; i < chars.Length; i++)
            {
                if (char.IsWhiteSpace(chars[i]))
                {
                    space = true;
                    break;
                }
            }
            token.Append(chars.ToString(0, i - 0));
            // chars.delete(0,i);
            for (int countr = i; countr < chars.Length; countr++)
            {
                chars[countr - i] = chars[countr];
            }
            chars.Length = chars.Length - i;
            if (space)
            {
                word = token.ToString();
                token.Length = 0;
                return word;
            }
            token.Append(chars.ToString());
            return null;
        }

        protected static string GetPattern(string word)
        {
            StringBuilder pat = new StringBuilder();
            int len = word.Length;
            for (int i = 0; i < len; i++)
            {
                if (!char.IsDigit(word[i]))
                {
                    pat.Append(word[i]);
                }
            }
            return pat.ToString();
        }

        protected virtual IList<object> NormalizeException<T1>(IList<T1> ex)
        {
            List<object> res = new List<object>();
            for (int i = 0; i < ex.Count; i++)
            {
                object item = ex[i];
                if (item is string)
                {
                    string str = (string)item;
                    StringBuilder buf = new StringBuilder();
                    for (int j = 0; j < str.Length; j++)
                    {
                        char c = str[j];
                        if (c != hyphenChar)
                        {
                            buf.Append(c);
                        }
                        else
                        {
                            res.Add(buf.ToString());
                            buf.Length = 0;
                            char[] h = new char[1];
                            h[0] = hyphenChar;
                            // we use here hyphenChar which is not necessarily
                            // the one to be printed
                            res.Add(new Hyphen(new string(h), null, null));
                        }
                    }
                    if (buf.Length > 0)
                    {
                        res.Add(buf.ToString());
                    }
                }
                else
                {
                    res.Add(item);
                }
            }
            return res;
        }

        protected virtual string GetExceptionWord<T1>(IList<T1> ex)
        {
            StringBuilder res = new StringBuilder();
            for (int i = 0; i < ex.Count; i++)
            {
                object item = ex[i];
                if (item is string)
                {
                    res.Append((string)item);
                }
                else
                {
                    if (((Hyphen)item).NoBreak != null)
                    {
                        res.Append(((Hyphen)item).NoBreak);
                    }
                }
            }
            return res.ToString();
        }

        protected static string GetInterletterValues(string pat)
        {
            StringBuilder il = new StringBuilder();
            string word = pat + "a"; // add dummy letter to serve as sentinel
            int len = word.Length;
            for (int i = 0; i < len; i++)
            {
                char c = word[i];
                if (char.IsDigit(c))
                {
                    il.Append(c);
                    i++;
                }
                else
                {
                    il.Append('0');
                }
            }
            return il.ToString();
        }

#if FEATURE_DTD_PROCESSING
        /// <summary>
        /// LUCENENET specific helper class to force the DTD file to be read from the embedded resource
        /// rather than from the file system.
        /// </summary>
        internal class DtdResolver : XmlUrlResolver
        {
            public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn)
            {
                string dtdFilename = "hyphenation.dtd";
                if (dtdFilename.Equals(absoluteUri.Segments.LastOrDefault()))
                {
                    return GetType().Assembly.FindAndGetManifestResourceStream(typeof(PatternParser), dtdFilename);
                }

                return base.GetEntity(absoluteUri, role, ofObjectToReturn);
            }
        }
#endif

        //
        // ContentHandler methods
        //

        /// <summary>
        /// Receive notification of the beginning of an element.
        /// <para/>
        /// The Parser will invoke this method at the beginning of every element in the XML document;
        /// there will be a corresponding <see cref="EndElement"/> event for every <see cref="StartElement"/> event
        /// (even when the element is empty). All of the element's content will be reported,
        /// in order, before the corresponding endElement event.
        /// </summary>
        /// <param name="uri">the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed</param>
        /// <param name="local">the local name (without prefix), or the empty string if Namespace processing is not being performed</param>
        /// <param name="raw"></param>
        /// <param name="attrs"> the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. The value of this object after startElement returns is undefined</param>
        public virtual void StartElement(string uri, string local, string raw, IDictionary<string, string> attrs)
        {
            if (local.Equals("hyphen-char"))
            {
                string h = attrs.ContainsKey("value") ? attrs["value"] : null;
                if (h != null && h.Length == 1)
                {
                    hyphenChar = h[0];
                }
            }
            else if (local.Equals("classes"))
            {
                currElement = ELEM_CLASSES;
            }
            else if (local.Equals("patterns"))
            {
                currElement = ELEM_PATTERNS;
            }
            else if (local.Equals("exceptions"))
            {
                currElement = ELEM_EXCEPTIONS;
                exception = new List<object>();
            }
            else if (local.Equals("hyphen"))
            {
                if (token.Length > 0)
                {
                    exception.Add(token.ToString());
                }
                exception.Add(new Hyphen(attrs["pre"], attrs["no"], attrs["post"]));
                currElement = ELEM_HYPHEN;
            }
            token.Length = 0;
        }

        /// <summary>
        /// Receive notification of the end of an element.
        /// <para/>
        /// The parser will invoke this method at the end of every element in the XML document;
        /// there will be a corresponding <see cref="StartElement"/> event for every
        /// <see cref="EndElement"/> event (even when the element is empty).
        /// </summary>
        /// <param name="uri">the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed</param>
        /// <param name="local">the local name (without prefix), or the empty string if Namespace processing is not being performed</param>
        /// <param name="raw"></param>
        public virtual void EndElement(string uri, string local, string raw)
        {
            if (token.Length > 0)
            {
                string word = token.ToString();
                switch (currElement)
                {
                    case ELEM_CLASSES:
                        consumer.AddClass(word);
                        break;
                    case ELEM_EXCEPTIONS:
                        exception.Add(word);
                        exception = NormalizeException(exception);
                        consumer.AddException(GetExceptionWord(exception), new List<object>(exception));
                        break;
                    case ELEM_PATTERNS:
                        consumer.AddPattern(GetPattern(word), GetInterletterValues(word));
                        break;
                    case ELEM_HYPHEN:
                        // nothing to do
                        break;
                }
                if (currElement != ELEM_HYPHEN)
                {
                    token.Length = 0;
                }
            }
            if (currElement == ELEM_HYPHEN)
            {
                currElement = ELEM_EXCEPTIONS;
            }
            else
            {
                currElement = 0;
            }
        }

        /// <summary>
        /// Receive notification of character data.
        /// <para/>
        /// The Parser will call this method to report each chunk of character data. Parsers may
        /// return all contiguous character data in a single chunk, or they may split it into
        /// several chunks; however, all of the characters in any single event must come from
        /// the same external entity so that the Locator provides useful information.
        /// <para/>
        /// The application must not attempt to read from the array outside of the specified range.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="start"></param>
        /// <param name="length"></param>
        public virtual void Characters(char[] ch, int start, int length)
        {
            StringBuilder chars = new StringBuilder(length);
            chars.Append(ch, start, length);
            string word = ReadToken(chars);
            while (word != null)
            {
                // System.out.println("\"" + word + "\"");
                switch (currElement)
                {
                    case ELEM_CLASSES:
                        consumer.AddClass(word);
                        break;
                    case ELEM_EXCEPTIONS:
                        exception.Add(word);
                        exception = NormalizeException(exception);
                        consumer.AddException(GetExceptionWord(exception), new List<object>(exception));
                        exception.Clear();
                        break;
                    case ELEM_PATTERNS:
                        consumer.AddPattern(GetPattern(word), GetInterletterValues(word));
                        break;
                }
                word = ReadToken(chars);
            }
        }
    }
}


text:
// Copyright (c) André N. Klingsheim. See License.txt in the project root for license information.

using NWebsec.Mvc.Common.Helpers;
using NWebsec.Mvc.HttpHeaders.Csp.Internals;

namespace NWebsec.Mvc.HttpHeaders.Csp
{
    /// <summary>
    /// When applied to a controller or action method, enables the frame-ancestors directive for the CSP header (CSP 2).
    /// </summary>
    public class CspFrameAncestorsAttribute : CspDirectiveAttributeBase
    {
        protected override CspDirectives Directive => CspDirectives.FrameAncestors;

        protected override bool ReportOnly => false;
    }
}

redpajama_set_name: RedPajamaGithub


text:
using Test

include("hamming.jl")

@testset "identical strands" begin
    @test distance("A", "A") == 0
    @test distance("GGACTGA", "GGACTGA") == 0
end

@testset "complete distance" begin
    @test distance("A", "G") == 1
    @test distance("AG", "CT") == 2
end

@testset "small distance" begin
    @test distance("AT", "CT") == 1
    @test distance("GGACG", "GGTCG") == 1
    @test distance("ACCAGGG", "ACTATGG") == 2
end

@testset "non-unique characters" begin
    @test distance("AGA", "AGG") == 1
    @test distance("AGG", "AGA") == 1
end

@testset "same nucleotides in different positions" begin
    @test distance("TAG", "GAT") == 2
end

@testset "large distance" begin
    @test distance("GATACA", "GCATAA") == 4
    @test distance("GGACGGATTCTG", "AGGACGGATTCT") == 9
end

@testset "empty strands" begin
    @test distance("", "") == 0
end

@testset "different strand lengths" begin
    @test_throws ArgumentError distance("AATG", "AAA")
    @test_throws ArgumentError distance("ATA", "AGTG")
    @test_throws ArgumentError distance("", "G")
    @test_throws ArgumentError distance("G", "")
end


text:
A set of C++ classes for working with the libmp3lame and portaudio libraries.

Example player at bin/simple_mp3

# Build Instructions

(portaudio & LAME installed in third_party directory)

Build portaudio
---------------

cd portaudio

mkdir build_

cd build_

cmake .. -DCMAKE_INSTALL_PREFIX:PATH=${SIMPLE_MP3_SOURCE_PATH}/third_party && make all install

Build LAME
----------

cd lame

./configure --prefix=${SIMPLE_MP3_SOURCE_PATH}/third_party/ && make all install

Building zapAudio
-----------------

mkdir build

cd build

cmake .. -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLATION_PATH} && make install


text:
FROM java:8-jdk

ENV KEYCLOAK_VERSION 1.8.0.CR3

RUN curl -L http://downloads.jboss.org/keycloak/$KEYCLOAK_VERSION/keycloak-$KEYCLOAK_VERSION.tar.gz | tar zx

ADD files/shop.json /tmp/shop.json

WORKDIR /keycloak-$KEYCLOAK_VERSION/bin

RUN ./add-user.sh -r master -u admin -p admin

#CMD ["./standalone.sh", "-c", "standalone.xml",  "-b", "0.0.0.0", "-bmanagement", "0.0.0.0", "-Djboss.socket.binding.port-offset=1010", "-Dkeycloak.migration.action=import", "-Dkeycloak.migration.provider=singleFile", "-Dkeycloak.migration.file=/tmp/shop.json", "-Dkeycloak.migration.strategy=OVERWRITE_EXISTING"]

CMD ["./standalone.sh", "-c", "standalone.xml",  "-b", "0.0.0.0", "-bmanagement", "0.0.0.0", "-Dkeycloak.migration.action=import", "-Dkeycloak.migration.provider=singleFile", "-Dkeycloak.migration.file=/tmp/shop.json", "-Dkeycloak.migration.strategy=OVERWRITE_EXISTING"]


text:
namespace Sloader.Config.Crawler
{
    /// <summary>
    /// Base of all crawler configs
    /// </summary>
    public abstract class BaseCrawlerConfig
    {
        /// <summary>
        /// Each crawler can be used n-times, but each key must be unique to store the result set.
        /// </summary>
        public string Key { get; set; }

        /// <summary>
        /// Each crawler can embed the actual raw result in their result type. Set to true if you want to parse the data yourself.
        /// <para>Warning: This will create pretty large result-sets.</para>
        /// </summary>
        public bool IncludeRawContent { get; set; }
    }
}


text:
using Amido.NAuto.Builders;
using Amido.NAuto.Builders.Services;
using NUnit.Framework;
using Should;

namespace Amido.NAuto.UnitTests.Builders.Services
{
    [TestFixture]
    public class PopulateByteServiceTests
    {
        private PopulateByteService populateByteService;
        private AutoBuilderConfiguration autoBuilderConfiguration;

        [SetUp]
        public void SetUp()
        {
            autoBuilderConfiguration = new AutoBuilderConfiguration();
            populateByteService = new PopulateByteService();
            populateByteService.SetAutoBuilderConfiguration(autoBuilderConfiguration);
        }

        public class Populate : PopulateByteServiceTests
        {
            [Test]
            public void Should_Return_Passed_In_Value_If_Not_Default()
            {
                // Arrange
                const string propertyName = "testname";
                const byte currentValue = 1;

                // Act
                var result = populateByteService.Populate(propertyName, currentValue);

                // Assert
                result.ShouldEqual(currentValue);
            }

            [Test]
            public void Should_Return_Convention_Result_If_Convention_Exists()
            {
                // Arrange
                const byte testConventionResult = 2;
                autoBuilderConfiguration.Conventions.Add(new ConventionMap(ConventionFilterType.Contains, "test", typeof(byte), config => testConventionResult));
                const string propertyName = "testname";

                // Act
                var result = populateByteService.Populate(propertyName, default(byte));

                // Assert
                result.ShouldEqual(testConventionResult);
            }

            [Test]
            public void Should_Return_New_Random_Byte_Based_On_Auto_Builder_Configuration_When_No_Convention_Exists()
            {
                // Arrange
                autoBuilderConfiguration.Conventions.Clear();
                const string propertyName = "testname";

                // Act
                var result = populateByteService.Populate(propertyName, default(byte));

                // Assert
                result.ShouldBeGreaterThanOrEqualTo((byte)0);
            }
        }
    }
}


text:
package org.apache.arrow.vector.types.pojo;

import java.util.Objects;

import org.apache.arrow.vector.types.pojo.ArrowType.Int;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * A POJO representation of Arrow Dictionary metadata.
 */
public class DictionaryEncoding {

  private final long id;
  private final boolean ordered;
  private final Int indexType;

  /**
   * Constructs a new instance.
   *
   * @param id The ID of the dictionary to use for encoding.
   * @param ordered Whether the keys in values in the dictionary are ordered.
   * @param indexType (nullable). The integer type to use for indexing in the dictionary. Defaults to a signed
   *     32 bit integer.
   */
  @JsonCreator
  public DictionaryEncoding(
      @JsonProperty("id") long id,
      @JsonProperty("isOrdered") boolean ordered,
      @JsonProperty("indexType") Int indexType) {
    this.id = id;
    this.ordered = ordered;
    this.indexType = indexType == null ? new Int(32, true) : indexType;
  }

  public long getId() {
    return id;
  }

  @JsonGetter("isOrdered")
  public boolean isOrdered() {
    return ordered;
  }

  public Int getIndexType() {
    return indexType;
  }

  @Override
  public String toString() {
    return "DictionaryEncoding[id=" + id + ",ordered=" + ordered + ",indexType=" + indexType + "]";
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    } else if (o == null || getClass() != o.getClass()) {
      return false;
    }
    DictionaryEncoding that = (DictionaryEncoding) o;
    return id == that.id && ordered == that.ordered && Objects.equals(indexType, that.indexType);
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, ordered, indexType);
  }
}


text:
package ajitsingh.com.expensemanager.presenter;

import com.echo.holographlibrary.Bar;

import org.joda.time.DateTime;
import org.joda.time.DateTimeUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;

import java.util.List;

import ajitsingh.com.expensemanager.database.ExpenseDatabaseHelper;
import ajitsingh.com.expensemanager.model.Expense;
import ajitsingh.com.expensemanager.view.CurrentMonthExpenseView;

import static java.util.Arrays.asList;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class CurrentMonthExpensePresenterTest {

  private CurrentMonthExpenseView view;
  private ExpenseDatabaseHelper database;

  @Before
  public void setUp() throws Exception {
    view = mock(CurrentMonthExpenseView.class);
    database = mock(ExpenseDatabaseHelper.class);
    DateTimeUtils.setCurrentMillisFixed(new DateTime("2015-10-01").getMillis());
  }

  @After
  public void tearDown() throws Exception {
    DateTimeUtils.setCurrentMillisSystem();
  }

  @Test
  public void shouldRenderTotalExpenses() throws Exception {
    Expense food = new Expense(100l, "Food", "01-10-2015");
    Expense travel = new Expense(150l, "Travel", "02-10-2015");
    when(database.getExpensesForCurrentMonthGroupByCategory()).thenReturn(asList(food, travel));

    CurrentMonthExpensePresenter presenter = new CurrentMonthExpensePresenter(view, database);

    presenter.showTotalExpense();
    verify(view).displayTotalExpense(250l);
  }

  @Test
  public void shouldRenderTheGraphWithRightPoints() throws Exception {
    Expense food = new Expense(100l, "Food", "01-10-2015");
    when(database.getExpensesForCurrentMonthGroupByCategory()).thenReturn(asList(food));

    CurrentMonthExpensePresenter presenter = new CurrentMonthExpensePresenter(view, database);
    ArgumentCaptor<List> pointsCaptor = ArgumentCaptor.forClass(List.class);

    presenter.plotGraph();
    verify(view).getGraphColor();
    verify(view).displayGraph(pointsCaptor.capture());

    List points = pointsCaptor.getValue();
    assertThat(points.size(), is(1));
    assertThat(((Bar)points.get(0)).getName(), is(food.getType()));
    assertThat(((Bar)points.get(0)).getValue(), is(food.getAmount().floatValue()));
  }
}


text:
package net.sourceforge.marathon.javafx.tests;

import java.util.Arrays;

import ensemble.Sample;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.control.cell.ComboBoxTreeCell;

public class ComboBoxTreeViewSample extends Sample {

    private final ObservableList items = FXCollections.observableArrayList("Option 1", "Option 2", "Option 3", "Option 4",
            "Option 5", "Option 6");

    public ComboBoxTreeViewSample() {
        final TreeItem<String> treeRoot = new TreeItem<String>("Root node");
        treeRoot.getChildren().addAll(Arrays.asList(new TreeItem<String>("Option 1"), new TreeItem<String>("Option 2"),
                new TreeItem<String>("Option 3")));

        treeRoot.getChildren().get(2).getChildren().addAll(Arrays.asList(new TreeItem<String>("Option 4"),
                new TreeItem<String>("Option 5"), new TreeItem<String>("Option 6")));

        final TreeView treeView = new TreeView();
        treeView.setShowRoot(true);
        treeView.setRoot(treeRoot);
        treeRoot.setExpanded(true);
        treeView.setEditable(true);
        treeView.setCellFactory(ComboBoxTreeCell.forTreeView(items));

        getChildren().add(treeView);
    }
}


text:
package css
// package main

import (
  "fmt"
	"strings"
	"github.com/moovweb/rubex"
)

type Lexeme int

const (
  SPACES = iota
  COMMA
  UNIVERSAL
  TYPE
  ELEMENT
  CLASS
  ID
  LBRACKET
  RBRACKET
  ATTR_NAME
  ATTR_VALUE
  EQUALS
  CONTAINS_CLASS
  DASH_PREFIXED
  STARTS_WITH
  ENDS_WITH
  CONTAINS
  MATCH_OP
  PSEUDO_CLASS
  FIRST_CHILD
  FIRST_OF_TYPE
  NTH_CHILD
  NTH_OF_TYPE
  ONLY_CHILD
  ONLY_OF_TYPE
  LAST_CHILD
  LAST_OF_TYPE
  NOT
  LPAREN
  RPAREN
  COEFFICIENT
  SIGNED
  UNSIGNED
  ODD
  EVEN
  N
  OPERATOR
  PLUS
  MINUS
  BINOMIAL
  ADJACENT_TO
  PRECEDES
  PARENT_OF
  ANCESTOR_OF
  // and a counter ... I can't believe I didn't think of this sooner
  NUM_LEXEMES
)

var pattern [NUM_LEXEMES]string
var matcher [NUM_LEXEMES]*rubex.Regexp

func init() {
  // some overlap in here, but it'll make the parsing functions clearer
  pattern[SPACES] = `\s+`
  pattern[COMMA] = `\s*,`
  pattern[UNIVERSAL] = `\*`
  pattern[TYPE] = `[_a-zA-Z]\w*`
  pattern[ELEMENT] = `(\*|[_a-zA-Z]\w*)`
  pattern[CLASS] = `\.[-\w]+`
  pattern[ID] = `\#[-\w]+`
  pattern[LBRACKET] = `\[`
  pattern[RBRACKET] = `\]`
  pattern[ATTR_NAME] = `[-_:a-zA-Z][-\w:.]*`
  pattern[ATTR_VALUE] = `("(\\.|[^"\\])*"|'(\\.|[^'\\])*')`
  pattern[EQUALS] = `=`
  pattern[CONTAINS_CLASS] = `~=`
  pattern[DASH_PREFIXED] = `\|=`
  pattern[STARTS_WITH] = `\^=`
  pattern[ENDS_WITH] = `\$=`
  pattern[CONTAINS] = `\*=`
  pattern[MATCH_OP] = "(" + strings.Join([]string{pattern[EQUALS], pattern[CONTAINS_CLASS], pattern[DASH_PREFIXED], pattern[STARTS_WITH], pattern[ENDS_WITH], pattern[CONTAINS]}, "|") + ")"
  pattern[PSEUDO_CLASS] = `:[-a-z]+`
  pattern[FIRST_CHILD] = `:first-child`
  pattern[FIRST_OF_TYPE] = `:first-of-type`
  pattern[NTH_CHILD] = `:nth-child`
  pattern[NTH_OF_TYPE] = `:nth-of-type`
  pattern[ONLY_CHILD] = `:only-child`
  pattern[ONLY_OF_TYPE] = `:only-of-type`
  pattern[LAST_CHILD] = `:last-child`
  pattern[LAST_OF_TYPE] = `:last-of-type`
  pattern[NOT] = `:not`
  pattern[LPAREN] = `\s*\(`
  pattern[RPAREN] = `\s*\)`
  pattern[COEFFICIENT] = `[-+]?(\d+)?`
  pattern[SIGNED] = `[-+]?\d+`
  pattern[UNSIGNED] = `\d+`
  pattern[ODD] = `odd`
  pattern[EVEN] = `even`
  pattern[N] = `[nN]`
  pattern[OPERATOR] = `[-+]`
  pattern[PLUS] = `\+`
  pattern[MINUS] = `-`
  pattern[BINOMIAL] = strings.Join([]string{pattern[COEFFICIENT], pattern[N], `\s*`, pattern[OPERATOR], `\s*`, pattern[UNSIGNED]}, "")
  pattern[ADJACENT_TO] = `\s*\+`
  pattern[PRECEDES] = `\s*~`
  pattern[PARENT_OF] = `\s*>`
  pattern[ANCESTOR_OF] = `\s+`
  for i, p := range pattern {
    matcher[i] = rubex.MustCompile(`\A` + p)
  }
}

type Scope int

const (
  GLOBAL = iota
  LOCAL
)

func Convert(css string, scope Scope) string {
  xpath, _ := selectors([]byte(css), scope)
  return xpath
}

func selectors(input []byte, scope Scope) (string, []byte) {
  x, input := selector(input, scope)
  xs := []string{x}
  for peek(COMMA, input) {
    _, input = token(COMMA, input)
    x, input = selector(input, scope)
    xs = append(xs, x)
  }
  return strings.Join(xs, " | "), input
}

func selector(input []byte, scope Scope) (string, []byte) {
  var combinator Lexeme
  var xs []string
  if scope == LOCAL {
    xs = []string{"."}
  }
  if matched, remainder := token(PARENT_OF, input); matched != nil {
    combinator, input = PARENT_OF, remainder
  } else {
    combinator = ANCESTOR_OF
  }
  x, input := sequence(input, combinator)
  xs = append(xs, x)
  for {
    if matched, remainder := token(ADJACENT_TO, input); matched != nil {
      combinator, input = ADJACENT_TO, remainder
    } else if matched, remainder := token(PRECEDES, input); matched != nil {
      combinator, input = PRECEDES, remainder
    } else if matched, remainder := token(PARENT_OF, input); matched != nil {
      combinator, input = PARENT_OF, remainder
    } else if matched, remainder := token(ANCESTOR_OF, input); matched != nil {
      combinator, input = ANCESTOR_OF, remainder
    } else {
      break
    }
    x, input = sequence(input, combinator)
    xs = append(xs, x)
  }
  return strings.Join(xs, ""), input
}

func sequence(input []byte, combinator Lexeme) (string, []byte) {
  _, input = token(SPACES, input)
  x, ps := "", []string{}

  switch combinator {
  case ANCESTOR_OF:
    x = "/descendant-or-self::*/*"
  case PARENT_OF:
    x = "/child::*"
  case PRECEDES:
    x = "/following-sibling::*"
  case ADJACENT_TO:
    x = "/following-sibling::*"
    ps = append(ps, "position()=1")
  }

  if e, remainder := token(ELEMENT, input); e != nil {
    input = remainder
    if len(ps) > 0 {
      ps = append(ps, " and ")
    }
    ps = append(ps, "self::"+string(e))
    if !(peek(ID, input) || peek(CLASS, input) || peek(PSEUDO_CLASS, input) || peek(LBRACKET, input)) {
      pstr := strings.Join(ps, "")
      if pstr != "" {
        pstr = fmt.Sprintf("[%s]", pstr)
      }
      return x + pstr, input
    }
  }
  q, input, connective := qualifier(input)
  if q == "" {
    panic("Invalid CSS selector")
  }
  if len(ps) > 0 {
    ps = append(ps, connective)
  }
  ps = append(ps, q)
  for q, r, c := qualifier(input); q != ""; q, r, c = qualifier(input) {
    ps, input = append(ps, c, q), r
  }
  pstr := strings.Join(ps, "")
  if combinator != NOT {
    pstr = fmt.Sprintf("[%s]", pstr)
  }
  return x + pstr, input
}

func qualifier(input []byte) (string, []byte, string) {
  p, connective := "", ""
  if t, remainder := token(CLASS, input); t != nil {
    p = fmt.Sprintf(`contains(concat(" ", @class, " "), " %s ")`, string(t[1:]))
    input = remainder
    connective = " and "
  } else if t, remainder := token(ID, input); t != nil {
    p, input, connective = fmt.Sprintf(`@id="%s"`, string(t[1:])), remainder, " and "
  } else if peek(PSEUDO_CLASS, input) {
    p, input, connective = pseudoClass(input)
  } else if peek(LBRACKET, input) {
    p, input = attribute(input)
    connective = " and "
  }
  return p, input, connective
}

func pseudoClass(input []byte) (string, []byte, string) {
  class, input := token(PSEUDO_CLASS, input)
  var p, connective string
  switch string(class) {
  case ":first-child":
    p, connective = "position()=1", " and "
  case ":first-of-type":
    p, connective = "position()=1", "]["
  case ":last-child":
    p, connective = "position()=last()", " and "
  case ":last-of-type":
    p, connective = "position()=last()", "]["
  case ":only-child":
    p, connective = "position() = 1 and position() = last()", " and "
  case ":only-of-type":
    p, connective = "position() = 1 and position() = last()", "]["
  case ":nth-child":
    p, input = nth(input)
    connective = " and "
  case ":nth-of-type":
    p, input = nth(input)
    connective = "]["
  case ":not":
    p, input = negate(input)
    connective = " and "
  default:
    panic(`Cannot convert CSS pseudo-class "` + string(class) + `" to XPath.`)
  }
  return p, input, connective
}

func nth(input []byte) (string, []byte) {
  lparen, input := token(LPAREN, input)
  if lparen == nil {
    panic(":nth-child and :nth-of-type require an parenthesized argument")
  }
  _, input = token(SPACES, input)
  var expr string
  if e, rem := token(EVEN, input); e != nil {
    expr, input = "position() mod 2 = 0", rem
  } else if e, rem := token(ODD, input); e != nil {
    expr, input = "position() mod 2 = 1", rem
  } else if e, _ := token(BINOMIAL, input); e != nil {
    var coefficient, operator, constant []byte
    coefficient, input = token(COEFFICIENT, input)
    switch string(coefficient) {
    case "", "+":
      coefficient = []byte("1")
    case "-":
      coefficient = []byte("-1")
    }
    _, input = token(N, input)
    _, input = token(SPACES, input)
    operator, input = token(OPERATOR, input)
    _, input = token(SPACES, input)
    constant, input = token(UNSIGNED, input)
    expr = fmt.Sprintf("(position() %s %s) mod %s = 0", invert(string(operator)), string(constant), string(coefficient))
  } else if e, rem := token(SIGNED, input); e != nil {
    expr, input = "position() = "+string(e), rem
  } else {
    panic("Invalid argument to :nth-child or :nth-of-type.")
  }
  fmt.Println(string(input))
  _, input = token(SPACES, input)
  rparen, input := token(RPAREN, input)
  if rparen == nil {
    panic("Unterminated argument to :nth-child or :nth-of-type.")
  }
  return expr, input
}

func invert(op string) string {
  op = strings.TrimSpace(op)
  if op == "+" {
    op = "-"
  } else {
    op = "+"
  }
  return op
}

func negate(input []byte) (string, []byte) {
  _, input = token(SPACES, input)
  lparen, input := token(LPAREN, input)
  if lparen == nil {
    panic(":not requires a parenthesized argument.")
  }
  _, input = token(SPACES, input)
  p, input := sequence(input, NOT)
  _, input = token(SPACES, input)
  rparen, input := token(RPAREN, input)
  if rparen == nil {
    panic("Unterminated argument to :not.")
  }
  return fmt.Sprintf("not(%s)", p), input
}

func attribute(input []byte) (string, []byte) {
  _, input = token(LBRACKET, input)
  _, input = token(SPACES, input)
  name, input := token(ATTR_NAME, input)
  if name == nil {
    panic("Attribute selector requires an attribute name.")
  }
  _, input = token(SPACES, input)
  if rbracket, remainder := token(RBRACKET, input); rbracket != nil {
    return "@" + string(name), remainder
  }
  op, input := token(MATCH_OP, input)
  if op == nil {
    panic("Missing operator in attribute selector.")
  }
  _, input = token(SPACES, input)
  val, input := token(ATTR_VALUE, input)
  if val == nil {
    panic("Missing value in attribute selector.")
  }
  _, input = token(SPACES, input)
  rbracket, input := token(RBRACKET, input)
  if rbracket == nil {
    panic("Unterminated attribute selector.")
  }
  var expr string
  n, v := string(name), string(val)
  switch string(op) {
  case "=":
    expr = fmt.Sprintf("@%s=%s", n, v)
  case "~=":
    expr = fmt.Sprintf(`contains(concat(" ", @%s, " "), concat(" ", %s, " "))`, n, v)
  case "|=":
    expr = fmt.Sprintf(`(@%s=%s or starts-with(@%s, concat(%s, "-")))`, n, v, n, v)
  case "^=":
    expr = fmt.Sprintf("starts-with(@%s, %s)", n, v)
  case "$=":
    // oy, libxml doesn't support ends-with
    // generate something like: div[substring(@class, string-length(@class) - string-length('foo') + 1) = 'foo']
    expr = fmt.Sprintf("substring(@%s, string-length(@%s) - string-length(%s) + 1) = %s", n, n, v, v)
  case "*=":
    expr = fmt.Sprintf("contains(@%s, %s)", n, v)
  }
  return expr, input
}

func token(lexeme Lexeme, input []byte) ([]byte, []byte) {
  matched := matcher[lexeme].Find(input)
  length := len(matched)
  if length == 0 {
    matched = nil
  }
  return matched, input[length:]
}

func peek(lexeme Lexeme, input []byte) bool {
  matched, _ := token(lexeme, input)
  return matched != nil
}


text:
package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation;

import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyCollection;
import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import java.util.List;

class PolicyCollectionImpl extends WrapperImpl<PolicyCollectionInner> implements PolicyCollection {
    private final ApiManagementManager manager;
    PolicyCollectionImpl(PolicyCollectionInner inner, ApiManagementManager manager) {
        super(inner);
        this.manager = manager;
    }

    @Override
    public ApiManagementManager manager() {
        return this.manager;
    }

    @Override
    public String nextLink() {
        return this.inner().nextLink();
    }

    @Override
    public List<PolicyContractInner> value() {
        return this.inner().value();
    }

}


text:
package com.android.sdklib.internal.repository.packages;

import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.sources.SdkSource;
import com.android.sdklib.repository.FullRevision;
import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.descriptors.IPkgDesc;
import com.android.sdklib.repository.descriptors.PkgDesc;

import java.io.File;
import java.util.Properties;

public class MinToolsPackageTest extends PackageTest {

    /** Local class used to test the abstract MinToolsPackage class */
    protected static class MockMinToolsPackage extends MinToolsPackage {
        public MockMinToolsPackage(
                SdkSource source,
                Properties props,
                int revision,
                String license,
                String description,
                String descUrl,
                String archiveOsPath) {
            super(source,
                    props,
                    revision,
                    license,
                    description,
                    descUrl,
                    archiveOsPath);
        }

        @Override
        public File getInstallFolder(String osSdkRoot, SdkManager sdkManager) {
            throw new UnsupportedOperationException("abstract method not used in test"); //$NON-NLS-1$
        }

        @Override
        public String getListDescription() {
            throw new UnsupportedOperationException("abstract method not used in test"); //$NON-NLS-1$
        }

        @Override
        public String getShortDescription() {
            throw new UnsupportedOperationException("abstract method not used in test"); //$NON-NLS-1$
        }

        @Override
        public boolean sameItemAs(Package pkg) {
            throw new UnsupportedOperationException("abstract method not used in test"); //$NON-NLS-1$
        }

        @Override
        public String installId() {
            return "";  //$NON-NLS-1$
        }

        @Override
        public IPkgDesc getPkgDesc() {
            return PkgDesc.Builder.newTool(
                    new FullRevision(1, 2, 3, 4),
                    FullRevision.NOT_SPECIFIED).create();
        }
    }

    @Override
    public void testCreate() {
        Properties props = createExpectedProps();

        MockMinToolsPackage p = new MockMinToolsPackage(
                null, //source
                props,
                -1, //revision
                null, //license
                null, //description
                null, //descUrl
                LOCAL_ARCHIVE_PATH
                );

        testCreatedPackage(p);
    }

    @Override
    public void testSaveProperties() {
        Properties expected = createExpectedProps();

        MockMinToolsPackage p = new MockMinToolsPackage(
                null, //source
                expected,
                -1, //revision
                null, //license
                null, //description
                null, //descUrl
                LOCAL_ARCHIVE_PATH
                );

        Properties actual = new Properties();
        p.saveProperties(actual);

        assertEquals(expected, actual);
    }

    @Override
    protected Properties createExpectedProps() {
        Properties props = super.createExpectedProps();

        // MinToolsPackage properties
        props.setProperty(PkgProps.MIN_TOOLS_REV, "3.0.1");

        return props;
    }

    protected void testCreatedMinToolsPackage(MockMinToolsPackage p) {
        super.testCreatedPackage(p);

        // MinToolsPackage properties
        assertEquals("3.0.1", p.getMinToolsRevision().toShortString());
    }
}


text:
<#PSScriptInfo
.VERSION 1.0.0
.GUID bd77b4d0-f97f-47c9-890f-b75abded7bcb
.AUTHOR DSC Community
.COMPANYNAME DSC Community
.COPYRIGHT Copyright the DSC Community contributors. All rights reserved.
.TAGS DSCConfiguration
.LICENSEURI https://github.com/dsccommunity/NetworkingDsc/blob/master/LICENSE
.PROJECTURI https://github.com/dsccommunity/NetworkingDsc
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES First version.
.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core
#>

#Requires -module NetworkingDsc

<#
    .DESCRIPTION
    This configuration disables the network adapter named Ethernet.
#>
Configuration NetAdapterState_Disable_Config
{
    Import-DSCResource -ModuleName NetworkingDsc

    Node localhost
    {
        NetAdapterState EnableEthernet
        {
            Name     = 'Ethernet'
            State    = 'Disabled'
        }
    }
}


text:
using System;
using Custom.Algebra.QrCode.Encoding.ReedSolomon;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Custom.Algebra.QrCode.Encoding.Tests.ReedSolomon
{
    using Assert = NUnit.Framework.Assert;
    using CollectionAssert = NUnit.Framework.CollectionAssert;
    using TestAttribute = NUnit.Framework.TestAttribute;
    using TestCaseAttribute = NUnit.Framework.TestCaseAttribute;
    using TestCaseSourceAttribute = NUnit.Framework.TestCaseSourceAttribute;
    using TestFixtureAttribute = NUnit.Framework.TestFixtureAttribute;

	[TestClass, TestFixture]
	public class PolyDivideTest
	{
		[Test, TestMethod]
        [TestCaseSource(typeof(PolyDivideTestCaseFactory), "TestCasesFromReferenceImplementation")]
        public void Test_against_reference_implementation(int[] aCoeff, int[] bCoeff, int[] expQuotient, int[] expRemainder)
        {

        	TestOneCase(aCoeff, bCoeff, expQuotient, expRemainder);
        }

        [Test, TestMethod]
        [TestCaseSource(typeof(PolyDivideTestCaseFactory), "TestCaseFromTxtFile")]
        public void Test_against_TXT_Dataset(int[] aCoeff, int[] bCoeff, int[] expQuotient, int[] expRemainder)
        {
        	TestOneCase(aCoeff, bCoeff, expQuotient, expRemainder);
        }

        private void TestOneCase(int[] aCoeff, int[] bCoeff, int[] expQuotient, int[] expRemainder)
        {
        	GaloisField256 gfield = GaloisField256.QRCodeGaloisField;
        	Polynomial apoly = new Polynomial(gfield, aCoeff);
        	Polynomial bpoly = new Polynomial(gfield, bCoeff);

        	PolyDivideStruct pds = apoly.Divide(bpoly);
        	int[] quotient = pds.Quotient.Coefficients;
        	int[] remainder = pds.Remainder.Coefficients;

        	if(!PolynomialExtensions.isEqual(quotient, expQuotient))
        		Assert.Fail("Quotient not equal. Result {0}, Expect {1}", aCoeff.Length, bCoeff.Length);
        	if(!PolynomialExtensions.isEqual(remainder, expRemainder))
        		Assert.Fail("Remainder not equal. Result {0}, Expect {1}", remainder.Length, aCoeff.Length);
        }

        //[Test, TestMethod]
        public void Generate()
        {
        	new PolyDivideTestCaseFactory().GenerateTestDataSet();
        }
	}
}


text:
/**
 * @file
 *
 * Unfortunately, we need this because we can not change the Duration.hpp and Time.hpp
 * and we don't want this piece of code repeated in every function within their
 * implementation files.
 */

#ifndef ORG_OPENSPLICE_CORE_TIME_HELPER_HPP_
#define ORG_OPENSPLICE_CORE_TIME_HELPER_HPP_

#include <org/opensplice/core/ReportUtils.hpp>

#define MS 1000
#define MiS 1000000
#define NS 1000000000

namespace org
{
namespace opensplice
{
namespace core
{
namespace timehelper
{

/**
* Check if the TIMEISH value supplied is at all suitable for arithmetic jiggery
* pokery. Invalidity encompasses (but is not restricted to) a -1 seconds part
* an 'infinity' Duration, an 'invalid' Time (or Duration).
* @param t the TIMEISH thing to check
* @return true if the argument is not suitable for doing sums with.
*/
template <typename TIMEISH>
bool is_valid_for_arithmetic(const TIMEISH& t)
{
    return (t.sec() != -1 // Invalid
            && t.sec() != 0x7FFFFFFF // Infinity
            && t.nanosec() < 1000000000);  // Invalid & infinity are > 10^9
}

/**
* Check a TIMEISH is valid for doing sums with.
* @param t the TIMEISH thing to check
* @param context Some sort of clue to the receiver about what was
* called or what you were trying to do. Must be a literal or c_str.
* Defaults to "".
* @param function String to be concateneated onto context.
* Must be a literal or c_str. Defaults to "".
* @throws a dds::core::InvalidDataError if not valid.
* @see OSPL_CONTEXT_LITERAL
* @see is_valid_for_arithmetic
*/
template <typename TIMEISH>
void validate(const TIMEISH& t, const char* context = "timehelper", const char* function = "validate")
{
    if(! is_valid_for_arithmetic<TIMEISH>(t))
    {
        std::stringstream message("dds::core::InvalidDataError");
        message << "Value invalid for arithmetic operations" << context << function
                << " seconds=" << t.sec() << " (" << std::hex << t.sec()
                << ") nanoseconds=" << t.nanosec() << " (" << std::hex << t.nanosec() << ")";
        std::string s = message.str();
        ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, s.c_str());
    }
}

}
}
}
}

#endif /* ORG_OPENSPLICE_CORE_TIME_HELPER_HPP_ */


text:
package net.joelinn.asana.test.tasks;

import com.sun.jersey.api.client.ClientResponse;
import junit.framework.TestCase;
import net.joelinn.asana.ApiException;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.tasks.Task;
import net.joelinn.asana.tasks.TaskRequestBuilder;
import net.joelinn.asana.tasks.TasksClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test;

/**
 * Joe Linn
 * 11/17/13
 */
public class TasksClientTest extends BaseTest{
    protected TasksClient client;

    @Before
    public void setUp(){
        client = new TasksClient(getApiKey());
    }

    @Test
    public void testTasks(){
        if(getApiKey().equals("")){
            // skip the test if no api key has been provided
            return;
        }
        Task newTask = client.createTask(new TaskRequestBuilder(4440299545542L, "Test task!").addFollower(4858211767376L)
            .addFollower(4440682739786L).notes("Here be notes.").assignee(4440682739795L).addProject(4440682259461L)
            .assigneeStatus(TaskRequestBuilder.ASSIGNEE_STATUS_LATER).dueOn(2020, 1, 1));

        Task retrievedTask = client.getTask(newTask.id);

        TestCase.assertEquals(newTask.name, retrievedTask.name);

        String newName = "Modified task name.";
        client.updateTask(retrievedTask.id, new TaskRequestBuilder().name(newName));

        TestCase.assertEquals(newName, client.getTask(retrievedTask.id).name);

        Tags tags = client.getTags(retrievedTask.id);
        TestCase.assertEquals(0, tags.size());

        client.deleteTask(retrievedTask.id);

        boolean exceptionThrown = false;
        try{
            client.getTask(retrievedTask.id);
        }
        catch (ApiException e){
            exceptionThrown = true;
            TestCase.assertEquals(ClientResponse.Status.NOT_FOUND.getStatusCode(), e.getStatus().getStatusCode());
        }

        TestCase.assertTrue(exceptionThrown);
    }
}


text:
<link href="http://gmpg.org/xfn/11" rel="profile">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">

{% include opengraph.html %}

<!-- Enable responsiveness on mobile devices-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

<title>
  {% if page.title == "Home" %}
    {{ site.title }} · {{ site.tagline }}
  {% else %}
    {{ page.title }} · {{ site.title }}
  {% endif %}
</title>

<!-- CSS -->
<link rel="stylesheet" href="{{ site.baseurl }}public/css/archeo_poole.css">
<link rel="stylesheet" href="{{ site.baseurl }}public/css/syntax.css">
<link rel="stylesheet" href="{{ site.baseurl }}public/css/archeo_hyde.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
<link href='https://fonts.googleapis.com/css?family=Quattrocento:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=EB+Garamond' rel='stylesheet' type='text/css'>

<!-- Icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{{ site.baseurl }}public/images/apple-touch-icon-144-precomposed.png">
<link rel="shortcut icon" href="{{ site.baseurl }}public/images/favicon.ico">

<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!-- Icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{{ site.baseurl }}public/apple-touch-icon-144-precomposed.png">
                               <link rel="shortcut icon" href="{{ site.baseurl }}public/favicon.ico">

<!-- RSS -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">


text:
package ru.axialshift.programs;

import java.util.Iterator;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL20;
import org.lwjgl.util.vector.Quaternion;
import org.lwjgl.util.vector.Vector3f;

import ru.axialshift.display.RenderingManager;
import ru.axialshift.scene.Camera;
import ru.axialshift.scene.Entity;
import ru.axialshift.scene.SimpleGraphicalEntity;
import ru.axialshift.scene.SimpleSceneManager;
import ru.axialshift.utils.QuaternionHelper;
import ru.axialshift.vram.gl.Program;

public class SceneRenderingPass extends BasePass {

	private SimpleSceneManager manager;

	public SceneRenderingPass(SimpleSceneManager manager){
		this.manager=manager;
	}

	@Override
	public void execute(RenderingManager renderingManager) {

		Camera cam = manager.getCamera();

		GL11.glDepthRange(cam.getNear(), cam.getFar());
		GL11.glEnable(GL11.GL_DEPTH_TEST);

		Iterator<Entity> i = manager.getActiveIterator();
		while(i.hasNext()){
			Entity e = i.next();
			render(renderingManager,e,cam);
		}
	}

	private void render(RenderingManager renderingManager, Entity e, Camera cam) {
		if(e instanceof SimpleGraphicalEntity){
			SimpleGraphicalEntity sge = (SimpleGraphicalEntity)e;

			Program current = renderingManager.getCurrentProgram();
			if(current!=null){
				GL20.glUniformMatrix4(current.getMPointer(), false, sge.getTransformationFeed());
				GL20.glUniformMatrix4(current.getVPPointer(), false, cam.getTransformationFeed());
			}

			sge.getVAOIncapsulator().drawDirectly();
		}
	}

}


text:
```
title: "FlxSave"
apiPath: util/FlxSave.html
```

```haxe
import flixel.util.FlxSave;
```

HaxeFlixel gives you the `FlxSave` class to manage saving and loading your game's data. You might use it to save and load a high score table, or the position and status of the player and enemies, or custom settings the player has selected. Like most of HaxeFlixel, `FlxSave` is cross-platform in functionality.

To use `FlxSave` you need a variable typed to that class. You can create your own variable (perhaps in your registry class, in your gameplay `FlxState`, or as a local variable in your save/load functions). You may also use the one that HaxeFlixel itself uses (`FlxG.save`).

The example code used below is largely taken from the [HaxeFlixel save demo](http://haxeflixel.com/demos/FlxSave/). If you have already installed HaxeFlixel, then to install the demo project just open a command line utility, navigate to the folder you would like to install into, and enter the command flixel create Save, or download the source via GitHub using the link on the demo web page.

#### Saving

So how can you save some of your game data? Once you have your variable, you will need to initialize, then bind it:

``` haxe
_gameSave = new FlxSave(); // initialize
_gameSave.bind("SaveDemo"); // bind to the named save slot
```

Note the string "SaveDemo". This is how HaxeFlixel tracks what save slot you are binding to in local storage. If you want to have multiple saves, you will probably want to define a series of strings to identify each slot, eg. "SaveSlot1", "SaveSlot2", etc. and bind to the appropriate one. For more information on using multiple save slots, take a look at [Wolfgang's article](http://www.funstormgames.com/blog/2012/01/flixel-advanced-saving-tips-tricks/) on the subject for AS3 Flixel, but keep in mind that [the AS3 syntax is a little different from Haxe](http://haxeflixel.com/documentation/as3-and-haxe-comparison/).

Note: If you plan to use `FlxG.save` you can skip the initializing and binding steps, as HaxeFlixel has done it for you.

Once bound, the save is essentially "live". To write to it you use the .data property of variable, treating it as an [object](http://haxe.org/ref/dynamic):

``` haxe
_gameSave.data.boxPositions = new Array();
_gameSave.data.boxPositions.push(new FlxPoint(box.x, box.y));

_gameSave.data.enemy = myEnemy;

// save data
_gameSave.flush();
```

##### flush()
Writes the local shared object to disk immediately.
**Required on non-Flash targets.**

##### Serialization
In certain cases you may need to [serialize and unserialize](http://haxe.org/manual/serialization) your data (fancy words for "take my data and turn it into a specially formatted string, or back into data") to avoid errors, but you may want to try it without serialization unless you experience problems.

#### Loading

In order to retrieve your saved data, you simply make sure you have a correctly bound `FlxSave` variable and read each value from the `.data` property.

``` haxe
box.x = _gameSave.data.boxPositions[tempCount].x;
box.y = _gameSave.data.boxPositions[tempCount].y;

```

This means that, depending on your save needs, when loading a save slot you may need to loop through a long list of data to assign each of the values back to it's correct home.

#### Existing save data

When you save data to a given `FlxSave` save slot there is, of course, the possibility that data already exists in that slot (hopefully your saved data from an earlier save). One way to test for this is to check if one of your variables is null. If save data does already exist and you plan to save an entire fresh set of new data, then to avoid carrying over values from an earlier save you may wish to either go through and initialize or reset each of the potentially saved variables to some default value (or null) before saving your new set, or you may wish to erase the save data entirely (probably not a good idea if you're using `FlxG.save`).

`FlxSave` provides an `.erase()` method to help with this process, but keep in mind that calling it on a bound `FlxSave` variable will: immediately erase all the data in .data, save the slot in the erased state (any earlier data is now completely gone), and also destroy the binding to the save slot. This last point is important to note, as after the binding has been broken `FlxSave` may still let you assign to .data and even call other methods without errors to indicate that the data is not actually being stored at all. So if you do use the `.erase()` method, don't forget to call `.bind()` again before you save or load any further data.

#### Other methods

In the Save demo the application creates and binds a `FlxSave` variable when the demo state initializes (see `PlayState.create()` ), and then leaves this variable accessible for loading and saving from that point on. This allows you to continually update the save object when necessary, but it's equally valid to create, initialize, and bind a FlxSave variable only when loading and saving. In that case you should familiarize yourself with `.close()` and `.destroy()`for safe and efficient handling of your `FlxSave`.

To review these additional methods and check out any other `FlxSave` functionality in more detail, take a look at the [API documentation](http://api.haxeflixel.com/flixel/util/FlxSave.html) or look at the class definition itself (currently under the util package in the flixel library).


text:
#ifndef XTENSOR_AXIS_ITERATOR_HPP
#define XTENSOR_AXIS_ITERATOR_HPP

#include "xstrided_view.hpp"

namespace xt
{

    /******************
     * xaxis_iterator *
     ******************/

    /**
     * @class xaxis_iterator
     * @brief Class for iteration over (N-1)-dimensional slices, where
     * N is the dimension of the underlying expression
     *
     * If N is the number of dimensions of an expression, the xaxis_iterator
     * iterates over (N-1)-dimensional slices oriented along the specified axis.
     *
     * @tparam CT the closure type of the \ref xexpression
     */
    template <class CT>
    class xaxis_iterator
    {
    public:

        using self_type = xaxis_iterator<CT>;

        using xexpression_type = std::decay_t<CT>;
        using size_type = typename xexpression_type::size_type;
        using difference_type = typename xexpression_type::difference_type;
        using shape_type = typename xexpression_type::shape_type;
        using value_type = xstrided_view<CT, shape_type>;
        using reference = std::remove_reference_t<apply_cv_t<CT, value_type>>;
        using pointer = xtl::xclosure_pointer<std::remove_reference_t<apply_cv_t<CT, value_type>>>;

        using iterator_category = std::forward_iterator_tag;

        template <class CTA>
        xaxis_iterator(CTA&& e, size_type axis);
        template <class CTA>
        xaxis_iterator(CTA&& e, size_type axis, size_type index, size_type offset);

        self_type& operator++();
        self_type operator++(int);

        reference operator*() const;
        pointer operator->() const;

        bool equal(const self_type& rhs) const;

    private:

        using storing_type = xtl::ptr_closure_type_t<CT>;
        mutable storing_type p_expression;
        size_type m_index;
        size_type m_add_offset;
        value_type m_sv;

        template <class T, class CTA>
        std::enable_if_t<std::is_pointer<T>::value, T>
        get_storage_init(CTA&& e) const;

        template <class T, class CTA>
        std::enable_if_t<!std::is_pointer<T>::value, T>
        get_storage_init(CTA&& e) const;
    };

    template <class CT>
    bool operator==(const xaxis_iterator<CT>& lhs, const xaxis_iterator<CT>& rhs);

    template <class CT>
    bool operator!=(const xaxis_iterator<CT>& lhs, const xaxis_iterator<CT>& rhs);

    template <class E>
    auto axis_begin(E&& e);

    template <class E>
    auto axis_begin(E&& e, typename std::decay_t<E>::size_type axis);

    template <class E>
    auto axis_end(E&& e);

    template <class E>
    auto axis_end(E&& e, typename std::decay_t<E>::size_type axis);

    /*********************************
     * xaxis_iterator implementation *
     *********************************/

    namespace detail
    {
        template <class CT>
        auto derive_xstrided_view(CT&& e, typename std::decay_t<CT>::size_type axis, typename std::decay_t<CT>::size_type offset)
        {
            using xexpression_type = std::decay_t<CT>;
            using shape_type = typename xexpression_type::shape_type;
            using strides_type = typename xexpression_type::strides_type;

            const auto& e_shape = e.shape();
            shape_type shape(e_shape.size() - 1);
            auto nxt = std::copy(e_shape.cbegin(), e_shape.cbegin() + axis, shape.begin());
            std::copy(e_shape.cbegin() + axis + 1, e_shape.end(), nxt);

            const auto& e_strides = e.strides();
            strides_type strides(e_strides.size() - 1);
            auto nxt_strides = std::copy(e_strides.cbegin(), e_strides.cbegin() + axis, strides.begin());
            std::copy(e_strides.cbegin() + axis + 1, e_strides.end(), nxt_strides);

            return strided_view(std::forward<CT>(e), std::move(shape),
                std::move(strides), offset, e.layout());
        }
    }

    template <class CT>
    template <class T, class CTA>
    inline std::enable_if_t<std::is_pointer<T>::value, T>
    xaxis_iterator<CT>::get_storage_init(CTA&& e) const
    {
        return &e;
    }

    template <class CT>
    template <class T, class CTA>
    inline std::enable_if_t<!std::is_pointer<T>::value, T>
    xaxis_iterator<CT>::get_storage_init(CTA&& e) const
    {
        return e;
    }

    /**
     * @name Constructors
     */
     //@{
    /**
     * Constructs an xaxis_iterator
     *
     * @param e the expression to iterate over
     * @param axis the axis to iterate over taking N-1 dimensional slices
     */
    template <class CT>
    template <class CTA>
    inline xaxis_iterator<CT>::xaxis_iterator(CTA&& e, size_type axis)
        : xaxis_iterator(std::forward<CTA>(e), axis, 0, e.data_offset())
    {
    }

    /**
     * Constructs an xaxis_iterator starting at specified index and offset
     *
     * @param e the expression to iterate over
     * @param axis the axis to iterate over taking N-1 dimensional slices
     * @param index the starting index for the iterator
     * @param offset the starting offset for the iterator
     */
    template <class CT>
    template <class CTA>
    inline xaxis_iterator<CT>::xaxis_iterator(CTA&& e, size_type axis, size_type index, size_type offset)
        : p_expression(get_storage_init<storing_type>(std::forward<CTA>(e)))
        , m_index(index)
        , m_add_offset(static_cast<size_type>(e.strides()[axis]))
        , m_sv(detail::derive_xstrided_view<CTA>(std::forward<CTA>(e), axis, offset))
    {
    }
    //@}

    /**
     * @name Increment
     */
     //@{
    /**
     * Increments the iterator to the next position and returns it.
     */
    template <class CT>
    inline auto xaxis_iterator<CT>::operator++() -> self_type&
    {
        m_sv.set_offset(m_sv.data_offset() + m_add_offset);
        ++m_index;
        return *this;
    }

    /**
     * Makes a copy of the iterator, increments it to the next
     * position, and returns the copy.
     */
    template <class CT>
    inline auto xaxis_iterator<CT>::operator++(int) -> self_type
    {
        self_type tmp(*this);
        ++(*this);
        return tmp;
    }
    //@}

    /**
     * @name Reference
     */
    //@{
    /**
     * Returns the strided view at the current iteration position
     *
     * @return a strided_view
     */
    template <class CT>
    inline auto xaxis_iterator<CT>::operator*() const -> reference
    {
        return m_sv;
    }

    /**
     * Returns a pointer to the strided view at the current iteration position
     *
     * @return a pointer to a strided_view
     */
    template <class CT>
    inline auto xaxis_iterator<CT>::operator->() const -> pointer
    {
        return xtl::closure_pointer(operator*());
    }
    //@}

    /*
     * @name Comparisons
     */
    //@{
    /**
     * Checks equality of the xaxis_slice_iterator and \c rhs.
     *
     * @param
     * @return true if the iterators are equivalent, false otherwise
     */
    template <class CT>
    inline bool xaxis_iterator<CT>::equal(const self_type& rhs) const
    {
        return p_expression == rhs.p_expression && m_index == rhs.m_index && m_sv.data_offset() == rhs.m_sv.data_offset();
    }

    /**
     * Checks equality of the iterators.
     *
     * @return true if the iterators are equivalent, false otherwise
     */
    template <class CT>
    inline bool operator==(const xaxis_iterator<CT>& lhs, const xaxis_iterator<CT>& rhs)
    {
        return lhs.equal(rhs);
    }

    /**
     * Checks inequality of the iterators
     * @return true if the iterators are different, true otherwise
     */
    template <class CT>
    inline bool operator!=(const xaxis_iterator<CT>& lhs, const xaxis_iterator<CT>& rhs)
    {
        return !(lhs == rhs);
    }
    //@}

    /**
     * @name Iterators
     */
    //@{
    /**
     * Returns an iterator to the first element of the expression for axis 0
     *
     * @param e the expession to iterate over
     * @return an instance of xaxis_iterator
     */
    template <class E>
    inline auto axis_begin(E&& e)
    {
        using return_type = xaxis_iterator<xtl::closure_type_t<E>>;
        return return_type(std::forward<E>(e), 0);
    }

    /**
     * Returns an iterator to the first element of the expression for the specified axis
     *
     * @param e the expession to iterate over
     * @param axis the axis to iterate over
     * @return an instance of xaxis_iterator
     */
    template <class E>
    inline auto axis_begin(E&& e, typename std::decay_t<E>::size_type axis)
    {
        using return_type = xaxis_iterator<xtl::closure_type_t<E>>;
        return return_type(std::forward<E>(e), axis);
    }

    /**
     * Returns an iterator to the element following the last element of
     * the expression for axis 0
     *
     * @param e the expession to iterate over
     * @return an instance of xaxis_iterator
     */
    template <class E>
    inline auto axis_end(E&& e)
    {
        using size_type = typename std::decay_t<E>::size_type;
        using return_type = xaxis_iterator<xtl::closure_type_t<E>>;
        return return_type(std::forward<E>(e), 0, e.shape()[0], static_cast<size_type>(e.strides()[0])*e.shape()[0]);
    }

    /**
     * Returns an iterator to the element following the last element of
     * the expression for the specified axis
     *
     * @param e the expession to iterate over
     * @param axis the axis to iterate over
     * @return an instance of xaxis_iterator
     */
    template <class E>
    inline auto axis_end(E&& e, typename std::decay_t<E>::size_type axis)
    {
        using size_type = typename std::decay_t<E>::size_type;
        using return_type = xaxis_iterator<xtl::closure_type_t<E>>;
        return return_type(std::forward<E>(e), axis, e.shape()[axis], static_cast<size_type>(e.strides()[axis])*e.shape()[axis]);
    }
    //@}
}

#endif


text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/eval/eval/tensor_function.h>

namespace vespalib::eval {

/**
 * Tensor function optimizer for converting join expressions on the
 * form 'join(tensor,<small integer constant>,f(x,y)(pow(x,y))' to
 * expressions on the form 'map(tensor,f(x)(x*x...))'.
 **/
struct PowAsMapOptimizer {
    static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};

} // namespace vespalib::eval


text:
@implementation UIWindow (extent)
- (void)switchViewController{

    NSString *key = @"CFBundleVersion";
    //取沙盒判断是否为第一次登陆
    NSString *lastVersion = [[NSUserDefaults standardUserDefaults] objectForKey:key];
    //从plist文件中获取当前的版本号
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[key];

    //判断版本号
    if ([lastVersion isEqualToString:currentVersion]) {//版本一样直接进入
        WBMainTabBarController *tabBarVc = [[WBMainTabBarController alloc] init];
        self.rootViewController = tabBarVc;
    }else{
        WBNewFeatureController *newFeatureVc = [[WBNewFeatureController alloc] init];
        self.rootViewController = newFeatureVc;

        //存沙盒
        [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:key];
        [[NSUserDefaults standardUserDefaults] synchronize];//同步
    }
}
@end


text:
layout: article
title: "Sublime Text 3 Hotkeys and Tips"
categories: articles
tags: [sublime, hotkeys, tutorial]
comments: false
excerpt: "Mastering Sublime Text editor features and time-saving stuff."
image:
  teaser: post-thumbnails/sublime3-hotkeys.jpg
  feature: post-features/sublime3-hotkeys.jpg
  credit: Abigail Keenan
  creditlink: https://unsplash.com/@akeenster?photo=QdEn9s5Q_4w

---


text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.components.media_router;

/**
 * An interface providing callbacks for {@link BaseMediaRouteDialogManager}.
 */
public interface MediaRouteDialogDelegate {
    /**
     * Notifies the delegate if the user has chosen a {@link MediaSink} to connect to.
     * onDialogDismissed() is not called in this case.
     * @param sourceUrn The source the sink was selected for.
     * @param sink The sink selected by the user.
     */
    void onSinkSelected(String sourceUrn, MediaSink sink);

    /**
     * Notifies the delegate if the user has closed the existing route.
     * @param mediaRouteId id of the media route that was closed.
     */
    void onRouteClosed(String mediaRouteId);

    /**
     * Notifies the delegate if the dialog was dismissed without any user action.
     */
    void onDialogCancelled();
}


text:
<?xml version='1.0' encoding='UTF-8'?>
<Info location="FistaSystemTestCase.m" type="File" />


text:
using System;

namespace NobelLaureates.HydraVM
{
    public class MetaDataKey
    {
        public MetaDataKey(string name)
        {
            if (string.IsNullOrEmpty(name)) throw new ArgumentException(nameof(name));

            Name = name;
        }

        public string Name
        {
            get; private set;
        }
    }

    public sealed class MetaDataKey<T> : MetaDataKey
    {
        public MetaDataKey(string name)
            : base(name)
        {
        }
    }
}


text:
require 'spec_helper'

module Stattleship
  module Models
    RSpec.describe Season do
      it 'constructs a season from json' do
        expect(season).to be_a Season
      end

      it 'sets the season identifiers' do
        expect(season.id).to eq('07f6794a-5312-4ce9-b5b0-2010c5975ff2')
        expect(season.slug).to eq('nfl-2015-2016')
        expect(season.league_id).to eq('ebb52980-4b25-4384-bb32-26d354568f0c')
      end

      it 'sets the season names' do
        expect(season.name).to eq('2015-2016')
      end

      it 'sets the season dates' do
        expect(season.starts_on).to eq(Date.parse('2015-08-01'))
        expect(season.ends_on).to eq(Date.parse('2016-02-14'))
      end

      def season
        json = File.read('spec/fixtures/nfl/season.json')
        season = Season.new
        season.extend(SeasonRepresenter)
        season.from_json(json)
      end
    end
  end
end


text:
TEST(SimpleSubroutine, SimpleSubroutine)
{
  f2h_test::run_program_and_compare_files("resources/simple_subroutine/in.f90", "resources/simple_subroutine/out.h");
}

TEST(SimpleSubroutine, TwoSimpleSubroutines)
{
  f2h_test::run_program_and_compare_files("resources/simple_subroutine/in2.f90", "resources/simple_subroutine/out2.h");
}


text:
package function.external.exac;

import function.AnalysisBase;
import function.variant.base.Region;
import function.variant.base.RegionManager;
import function.variant.base.VariantManager;
import utils.CommonCommand;
import utils.ErrorManager;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 *
 * @author nick
 */
public class ListExAC extends AnalysisBase {

    BufferedWriter bwExac = null;
    final String exacFilePath = CommonCommand.outputPath + "exac.csv";

    @Override
    public void initOutput() {
        try {
            bwExac = new BufferedWriter(new FileWriter(exacFilePath));
            bwExac.write(ExACOutput.getHeader());
            bwExac.newLine();
        } catch (Exception ex) {
            ErrorManager.send(ex);
        }
    }

    @Override
    public void closeOutput() {
        try {
            bwExac.flush();
            bwExac.close();
        } catch (Exception ex) {
            ErrorManager.send(ex);
        }
    }

    @Override
    public void doAfterCloseOutput() {
    }

    @Override
    public void beforeProcessDatabaseData() {
    }

    @Override
    public void afterProcessDatabaseData() {
    }

    @Override
    public void processDatabaseData() throws Exception {
        for (int r = 0; r < RegionManager.getRegionSize(); r++) {
            Region region = RegionManager.getRegion(r);
            PreparedStatement preparedStatement = ExACManager.getPreparedStatement4Region();
            preparedStatement.setString(1, region.getChrStr());
            preparedStatement.setInt(2, region.getStartPosition());
            preparedStatement.setInt(3, region.getEndPosition());
            ResultSet rs = preparedStatement.executeQuery();
            while (rs.next()) {
                ExACOutput output = new ExACOutput(rs);

                if (VariantManager.isVariantIdIncluded(output.exac.getVariantId())
                        && output.isValid()) {
                    bwExac.write(output.exac.getVariantId() + ",");
                    bwExac.write(output.toString());
                    bwExac.newLine();
                }
            }

            rs.close();
        }
    }

    @Override
    public String toString() {
        return "Start running list exac function";
    }
}


text:
const DataType = require("./DataType");
const codeGenMixin = require("../CodeGenMixins/PrimitiveType");

class PrimitiveType extends codeGenMixin(DataType) {

	constructor() {

		super();

	}

}//end PrimitiveType

 module.exports = PrimitiveType;


text:
/*
 * Changes:
 * 2001/01/27 removed debugging and testing code, fixed fb_ops
 *            initialization which had caused a crash before,
 *            general cleanup, first official release (KM)
 *
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/fb.h>
#include <video/maxinefb.h>

/* bootinfo.h defines the machine type values, needed when checking */
/* whether are really running on a maxine, KM                       */
#include <asm/bootinfo.h>

static struct fb_info fb_info;

static struct fb_var_screeninfo maxinefb_defined = {
	.xres =		1024,
	.yres =		768,
	.xres_virtual =	1024,
	.yres_virtual =	768,
	.bits_per_pixel =8,
	.activate =	FB_ACTIVATE_NOW,
	.height =	-1,
	.width =	-1,
	.vmode =	FB_VMODE_NONINTERLACED,
};

static struct fb_fix_screeninfo maxinefb_fix = {
	.id =		"Maxine onboard graphics 1024x768x8",
	.smem_len =	(1024*768),
	.type =		FB_TYPE_PACKED_PIXELS,
	.visual =	FB_VISUAL_PSEUDOCOLOR,
	.line_length =	1024,
};

/* Handle the funny Inmos RamDAC/video controller ... */

void maxinefb_ims332_write_register(int regno, register unsigned int val)
{
	register unsigned char *regs = (char *) MAXINEFB_IMS332_ADDRESS;
	unsigned char *wptr;

	wptr = regs + 0xa0000 + (regno << 4);
	*((volatile unsigned int *) (regs)) = (val >> 8) & 0xff00;
	*((volatile unsigned short *) (wptr)) = val;
}

unsigned int maxinefb_ims332_read_register(int regno)
{
	register unsigned char *regs = (char *) MAXINEFB_IMS332_ADDRESS;
	unsigned char *rptr;
	register unsigned int j, k;

	rptr = regs + 0x80000 + (regno << 4);
	j = *((volatile unsigned short *) rptr);
	k = *((volatile unsigned short *) regs);

	return (j & 0xffff) | ((k & 0xff00) << 8);
}

/* Set the palette */
static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green,
			      unsigned blue, unsigned transp, struct fb_info *info)
{
	/* value to be written into the palette reg. */
	unsigned long hw_colorvalue = 0;

	red   >>= 8;    /* The cmap fields are 16 bits    */
	green >>= 8;    /* wide, but the harware colormap */
	blue  >>= 8;    /* registers are only 8 bits wide */

	hw_colorvalue = (blue << 16) + (green << 8) + (red);

	maxinefb_ims332_write_register(IMS332_REG_COLOR_PALETTE + regno,
				       hw_colorvalue);
	return 0;
}

static struct fb_ops maxinefb_ops = {
	.owner		= THIS_MODULE,
	.fb_get_fix	= gen_get_fix,
	.fb_get_var	= gen_get_var,
	.fb_setcolreg	= maxinefb_setcolreg,
	.fb_fillrect	= cfb_fillrect,
	.fb_copyarea	= cfb_copyarea,
	.fb_imageblit	= cfb_imageblit,
};

int __init maxinefb_init(void)
{
	unsigned long fboff;
	unsigned long fb_start;
	int i;

	if (fb_get_options("maxinefb", NULL))
		return -ENODEV;

	/* Validate we're on the proper machine type */
	if (mips_machtype != MACH_DS5000_XX) {
		return -EINVAL;
	}

	printk(KERN_INFO "Maxinefb: Personal DECstation detected\n");
	printk(KERN_INFO "Maxinefb: initializing onboard framebuffer\n");

	/* Framebuffer display memory base address */
	fb_start = DS5000_xx_ONBOARD_FBMEM_START;

	/* Clear screen */
	for (fboff = fb_start; fboff < fb_start + 0x1ffff; fboff++)
		*(volatile unsigned char *)fboff = 0x0;

	maxinefb_fix.smem_start = fb_start;

	/* erase hardware cursor */
	for (i = 0; i < 512; i++) {
		maxinefb_ims332_write_register(IMS332_REG_CURSOR_RAM + i,
					       0);
		/*
		   if (i&0x8 == 0)
		   maxinefb_ims332_write_register (IMS332_REG_CURSOR_RAM + i, 0x0f);
		   else
		   maxinefb_ims332_write_register (IMS332_REG_CURSOR_RAM + i, 0xf0);
		 */
	}

	fb_info.fbops = &maxinefb_ops;
	fb_info.screen_base = (char *)maxinefb_fix.smem_start;
	fb_info.var = maxinefb_defined;
	fb_info.fix = maxinefb_fix;
	fb_info.flags = FBINFO_DEFAULT;

	fb_alloc_cmap(&fb_info.cmap, 256, 0);

	if (register_framebuffer(&fb_info) < 0)
		return 1;
	return 0;
}

static void __exit maxinefb_exit(void)
{
	unregister_framebuffer(&fb_info);
}

#ifdef MODULE
MODULE_LICENSE("GPL");
#endif
module_init(maxinefb_init);
module_exit(maxinefb_exit);


text:
import unittest

from openstack.tests.functional import base

@unittest.skipUnless(base.service_exists(service_type='object-store'),
                     'Object Storage service does not exist')
class TestAccount(base.BaseFunctionalTest):

    @classmethod
    def tearDownClass(cls):
        super(TestAccount, cls).tearDownClass()
        account = cls.conn.object_store.get_account_metadata()
        cls.conn.object_store.delete_account_metadata(account.metadata.keys())

    def test_system_metadata(self):
        account = self.conn.object_store.get_account_metadata()
        self.assertGreaterEqual(account.account_bytes_used, 0)
        self.assertGreaterEqual(account.account_container_count, 0)
        self.assertGreaterEqual(account.account_object_count, 0)

    def test_custom_metadata(self):
        # get custom metadata
        account = self.conn.object_store.get_account_metadata()
        self.assertFalse(account.metadata)

        # set no custom metadata
        self.conn.object_store.set_account_metadata()
        account = self.conn.object_store.get_account_metadata()
        self.assertFalse(account.metadata)

        # set empty custom metadata
        self.conn.object_store.set_account_metadata(k0='')
        account = self.conn.object_store.get_account_metadata()
        self.assertFalse(account.metadata)

        # set custom metadata
        self.conn.object_store.set_account_metadata(k1='v1')
        account = self.conn.object_store.get_account_metadata()
        self.assertTrue(account.metadata)
        self.assertEqual(1, len(account.metadata))
        self.assertIn('k1', account.metadata)
        self.assertEqual('v1', account.metadata['k1'])

        # set more custom metadata
        self.conn.object_store.set_account_metadata(k2='v2')
        account = self.conn.object_store.get_account_metadata()
        self.assertTrue(account.metadata)
        self.assertEqual(2, len(account.metadata))
        self.assertIn('k1', account.metadata)
        self.assertEqual('v1', account.metadata['k1'])
        self.assertIn('k2', account.metadata)
        self.assertEqual('v2', account.metadata['k2'])

        # update custom metadata
        self.conn.object_store.set_account_metadata(k1='v1.1')
        account = self.conn.object_store.get_account_metadata()
        self.assertTrue(account.metadata)
        self.assertEqual(2, len(account.metadata))
        self.assertIn('k1', account.metadata)
        self.assertEqual('v1.1', account.metadata['k1'])
        self.assertIn('k2', account.metadata)
        self.assertEqual('v2', account.metadata['k2'])

        # unset custom metadata
        self.conn.object_store.delete_account_metadata(['k1'])
        account = self.conn.object_store.get_account_metadata()
        self.assertTrue(account.metadata)
        self.assertEqual(1, len(account.metadata))
        self.assertIn('k2', account.metadata)
        self.assertEqual('v2', account.metadata['k2'])