text:
package com.liangmayong.base.support.adapter.interfaces;

import com.liangmayong.base.support.adapter.SuperItemView;

import java.util.List;

/**
 * Created by LiangMaYong on 2017/3/1.
 */

public interface ISuperAdapter {

    /**
     * getItem
     *
     * @param position position
     * @return item
     */
    SuperItemView<?> getItem(int position);

    /**
     * add
     *
     * @param item item
     */
    void add(SuperItemView<?> item);

    /**
     * add
     *
     * @param position position
     * @param item     item
     */
    void add(int position, SuperItemView<?> item);

    /**
     * remove
     *
     * @param position position
     */
    void remove(int position);

    /**
     * addAll
     *
     * @param items items
     */
    void addAll(List<SuperItemView<?>> items);

    /**
     * remove
     *
     * @param item item
     */
    void remove(SuperItemView<?> item);

    /**
     * clear
     */
    void removeAll();

    /**
     * replaceDatas
     *
     * @param items items
     */
    void replaceItems(List<SuperItemView<?>> items);

    /**
     * getItems
     *
     * @return get items
     */
    List<SuperItemView<?>> getItems();

    /**
     * contains
     *
     * @param item item
     * @return contains
     */
    boolean contains(SuperItemView<?> item);

    /**
     * notifyItemChanged
     *
     * @param position position
     */
    void notifyItemChanged(int position);

    /**
     * notifyItemChanged
     *
     * @param firstPosition firstPosition
     * @param lastPosition  lastPosition
     */
    void notifyItemChanged(int firstPosition, int lastPosition);

    /**
     * notifyDataSetChanged
     */
    void notifyDataSetChanged();
}


text:
Version 0.3.14 is now available
http://sourceforge.net/projects/drivercoin/files/Drivercoin/drivercoin-0.3.14/

Changes:
* Key pool feature for safer wallet backup
Gavin Andresen:
* TEST network mode with switch -testnet
* Option to use SSL for JSON-RPC connections on unix/osx
* validateaddress RPC command
eurekafag:
* Russian translation

redpajama_set_name: RedPajamaGithub


text:
#include "WordValue.h"
#include "DistanceValue.h"

class AbstractTextDistance
{
public:
    virtual DistanceValue *calculateDistance(WordValue &word1, WordValue &word2) = 0;
	virtual const char* code() = 0;

    virtual ~AbstractTextDistance() {;}
};

#endif // INCLUDED_ABSTRACTTEXTDISTANCE_H_


text:
require 'spec_helper'

describe User, :type => :model do

  describe "factories" do
    it "has a name" do
      expect(build(:user).name).to be_present
    end
  end

  describe 'validations' do
    it { is_expected.to validate_presence_of(:login) }
    it { is_expected.to validate_presence_of(:email) }
    it { is_expected.to validate_uniqueness_of(:email) }
    it { is_expected.to ensure_length_of(:name).is_at_most(100) }
  end

  describe ".find_first_by_auth_conditions" do
    let!(:user) { create(:user, login: "foo", email: 'foo@example.com') }

    context 'when a condition is specified' do
      ['foo', 'FOO', 'foo@example.com', 'FOO@EXAMPLE.COM'].each do |condition|
        subject { User.find_first_by_auth_conditions(login: condition) }
        it { is_expected.to eq(user) }
      end
    end

    context 'when no condition is specified' do
      subject { User.find_first_by_auth_conditions({}) }

      it "returns the first user" do
        expect(User).to receive(:where).with({}).and_return(double(first: user))
        expect(subject).to eq(user)
      end
    end
  end

  describe '.find_for_google_oauth2' do
    let(:access_token) { double(:access_token, info: {"email" => 'foo@example.com', "name" => 'foo'}) }
    subject { User.find_for_google_oauth2(access_token) }

    context "when the user exists" do
      let!(:user) { create(:user, login: "foo", email: 'foo@example.com') }
      it { is_expected.to eq(user) }
    end

    context "when the user does not exist" do
      it "should create a user" do
        user = nil
        expect { user = subject }.to change { User.count }.by(1)

        expect(user.name).to eq('foo')
        expect(user.email).to eq('foo@example.com')
        expect(user.login).to eq('foo')
      end
    end
  end

end


text:
<?php
namespace Hyphper\Test;

class ContinuationFrameTest extends FrameTest
{
    public function testContinuationFrameFlags()
    {
        $f = new \Hyphper\Frame\ContinuationFrame(['stream_id' => 1]);
        $flags = $f->parseFlags(0xFF);
        $this->assertEquals(
            [\Hyphper\Frame\Flag::END_HEADERS => \Hyphper\Frame\Flag::END_HEADERS],
            $flags->getIterator()
        );
    }

    public function testContinuationFrameSerializes()
    {
        $f = new \Hyphper\Frame\ContinuationFrame(['stream_id' => 1]);
        $f->parseFlags(0x04);
        $f->setData('hello world');

        $s = $f->serialize();
        $this->assertEquals("\x00\x00\x0B\x09\x04\x00\x00\x00\x01hello world", $s);
    }

    public function testContinuationFrameParsesProperly()
    {
        $s = "\x00\x00\x0B\x09\x04\x00\x00\x00\x01hello world";
        $f = $this->decodeFrame($s);

        $this->assertInstanceOf(\Hyphper\Frame\ContinuationFrame::class, $f);
        $this->assertEquals(
            [\Hyphper\Frame\Flag::END_HEADERS => \Hyphper\Frame\Flag::END_HEADERS],
            $f->getFlags()->getIterator()
        );
        $this->assertEquals('hello world', $f->getData());
        $this->assertEquals(11, $f->getBodyLen());
    }
}


text:
package io.druid.segment;

import com.metamx.common.guava.ResourceClosingYielder;
import com.metamx.common.guava.Sequence;
import com.metamx.common.guava.Yielder;
import com.metamx.common.guava.YieldingAccumulator;
import com.metamx.common.guava.YieldingSequenceBase;

import java.io.Closeable;

/**
 */
public class ReferenceCountingSequence<T> extends YieldingSequenceBase<T>
{
  private final Sequence<T> baseSequence;
  private final ReferenceCountingSegment segment;

  public ReferenceCountingSequence(Sequence<T> baseSequence, ReferenceCountingSegment segment)
  {
    this.baseSequence = baseSequence;
    this.segment = segment;
  }

  @Override
  public <OutType> Yielder<OutType> toYielder(
      OutType initValue, YieldingAccumulator<OutType, T> accumulator
  )
  {
    final Closeable closeable = segment.increment();
    return new ResourceClosingYielder<OutType>(baseSequence.toYielder(initValue, accumulator), closeable);
  }
}


text:
layout: page
title: About
---

Hey there!

I am a full stack developer with a passion for all things tech.

'Have Thunk' is a sort of throwback to my early university years combined with that time of day where
many a programmer at some point has found themselves 'in the zone...'

  This site was extended from the great Lanyon Jekyll theme by @mdo.
  Be sure to check out Lanyon

Thanks for reading!


text:
package uk.ac.ebi.spot.goci.curation.model.errors;

import java.util.Map;

/**
 * Created by cinzia on 24/10/2016.
 * This Class can be used to generate Json Error.
 */
public class ErrorJson {

    public Integer status;
    public String error;
    public String message;
    public String timeStamp;
    public String trace;

    public ErrorJson(int status, Map<String, Object> errorAttributes) {
        this.status = status;
        this.error = (String) errorAttributes.get("error");
        this.message = (String) errorAttributes.get("message");
        this.timeStamp = errorAttributes.get("timestamp").toString();
        this.trace = (String) errorAttributes.get("trace");
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>ProjectConnection (Gradle API 2.1)</title>
<meta name="date" content="2014-09-08">
<link rel="stylesheet" type="text/css" href="../../../javadoc.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.gradle.tooling

Interface ProjectConnection

public interface ProjectConnection

Represents a long-lived connection to a Gradle project. You obtain an instance of a ProjectConnection by using GradleConnector.connect().

 ProjectConnection connection = GradleConnector.newConnector()
    .forProjectDirectory(new File("someFolder"))
    .connect();

 try {
    //obtain some information from the build
    BuildEnvironment environment = connection.model(BuildEnvironment.class)
      .get();

    //run some tasks
    connection.newBuild()
      .forTasks("tasks")
      .setStandardOutput(System.out)
      .run();

 } finally {
    connection.close();
 }

Thread safety information

All implementations of ProjectConnection are thread-safe, and may be shared by any number of threads.

All notifications from a given ProjectConnection instance are delivered by a single thread at a time. Note, however, that the delivery thread may change over time.

Since:

1.0-milestone-3

Method Summary

Methods

Modifier and Type
Method and Description

<T> BuildActionExecuter<T>
action(BuildAction<T> buildAction)

Creates an executer which can be used to run the given action.

void
close()

Closes this connection.

<T> T
getModel(Class<T> modelType)

Fetches a snapshot of the model of the given type for this project.

<T> void
getModel(Class<T> modelType,
        ResultHandler<? super T> handler)

Starts fetching a snapshot of the given model, passing the result to the given handler when complete.

<T> ModelBuilder<T>
model(Class<T> modelType)

Creates a builder which can be used to query the model of the given type.

BuildLauncher
newBuild()

Creates a launcher which can be used to execute a build.

Method Detail

getModel

<T> T getModel(Class<T> modelType)
           throws GradleConnectionException,
                  IllegalStateException

Fetches a snapshot of the model of the given type for this project. This method blocks until the model is available.

This method is simply a convenience for calling model(modelType).get()

Type Parameters:

T - The model type.

Parameters:

modelType - The model type.

Returns:

The model.

Throws:

UnsupportedVersionException - When the target Gradle version does not support the given model.

UnknownModelException - When the target Gradle version or build does not support the requested model.

BuildException - On some failure executing the Gradle build, in order to build the model.

GradleConnectionException - On some other failure using the connection.

IllegalStateException - When this connection has been closed or is closing.

Since:

1.0-milestone-3

getModel

<T> void getModel(Class<T> modelType,
                ResultHandler<? super T> handler)
              throws IllegalStateException

Starts fetching a snapshot of the given model, passing the result to the given handler when complete. This method returns immediately, and the result is later
 passed to the given handler's ResultHandler.onComplete(Object) method.

If the operation fails, the handler's ResultHandler.onFailure(GradleConnectionException) method is called with the appropriate exception.
 See getModel(Class) for a description of the various exceptions that the operation may fail with.

This method is simply a convenience for calling model(modelType).get(handler)

Type Parameters:

T - The model type.

Parameters:

modelType - The model type.

handler - The handler to pass the result to.

Throws:

IllegalStateException - When this connection has been closed or is closing.

Since:

1.0-milestone-3

newBuild

BuildLauncher newBuild()

Creates a launcher which can be used to execute a build.

Returns:

The launcher.

Since:

1.0-milestone-3

model

<T> ModelBuilder<T> model(Class<T> modelType)

Creates a builder which can be used to query the model of the given type.

Any of following models types may be available, depending on the version of Gradle being used by the target
 build:

GradleBuild

BuildEnvironment

GradleProject

BuildInvocations

ProjectPublications

IdeaProject

BasicIdeaProject

EclipseProject

HierarchicalEclipseProject

A build may also expose additional custom tooling models. You can use this method to query these models.

Type Parameters:

T - The model type.

Parameters:

modelType - The model type

Returns:

The builder.

Since:

1.0-milestone-3

action

@Incubating
<T> BuildActionExecuter<T> action(BuildAction<T> buildAction)

Creates an executer which can be used to run the given action. The action is serialized into the build
 process and executed, then its result is serialized back to the caller.

Type Parameters:

T - The result type.

Parameters:

buildAction - The action to run.

Returns:

The builder.

Since:

1.8

close

void close()

Closes this connection. Blocks until any pending operations are complete. Once this method has returned, no more notifications will be delivered by any threads.

Since:

1.0-milestone-3

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.vsthost.rnd</groupId>
    <artifactId>jribinding</artifactId>
    <version>0.0.1</version>
    <packaging>jar</packaging>

    <name>jribinding</name>
    <description>Provides a Java/R binding based on rJava's JRI Engine</description>
    <url>https://github.com/vst/jribinding</url>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Vehbi Sinan Tunalioglu</name>
            <email>vst@vsthost.com</email>
            <organization>The Negation</organization>
            <organizationUrl>http://www.thenegation.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:vst/jribinding.git</connection>
        <developerConnection>scm:git:git@github.com:vst/jribinding.git</developerConnection>
        <url>git@github.com:vst/jribinding.git</url>
    </scm>

    <properties>
        <!-- Define the source encoding for the build -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Define Maven plugin versions -->
        <version.maven-gpg-plugin>1.6</version.maven-gpg-plugin>
        <version.nexus-staging-maven-plugin>1.6.3</version.nexus-staging-maven-plugin>
        <version.maven-javadoc-plugin>2.10.3</version.maven-javadoc-plugin>
        <version.maven-source-plugin>2.4</version.maven-source-plugin>

        <!-- Define dependency versions -->
        <version.junit>4.12</version.junit>
        <version.rosuda.rengine>2.1.0</version.rosuda.rengine>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.rosuda.REngine</groupId>
            <artifactId>REngine</artifactId>
            <version>${version.rosuda.rengine}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${version.junit}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${version.maven-source-plugin}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${version.maven-javadoc-plugin}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${version.maven-gpg-plugin}</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${version.nexus-staging-maven-plugin}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
package fakeclock_test

import (
	"time"

	. "github.com/cloudfoundry/bosh-utils/internal/github.com/onsi/ginkgo"
	. "github.com/cloudfoundry/bosh-utils/internal/github.com/onsi/gomega"
	"github.com/cloudfoundry/bosh-utils/internal/github.com/pivotal-golang/clock/fakeclock"
)

var _ = Describe("FakeClock", func() {
	const Δ time.Duration = 10 * time.Millisecond

	var (
		fakeClock   *fakeclock.FakeClock
		initialTime time.Time
	)

	BeforeEach(func() {
		initialTime = time.Date(2014, 1, 1, 3, 0, 30, 0, time.UTC)
		fakeClock = fakeclock.NewFakeClock(initialTime)
	})

	Describe("Now", func() {
		It("returns the current time, w/o race conditions", func() {
			go fakeClock.Increment(time.Minute)
			Eventually(fakeClock.Now).Should(Equal(initialTime.Add(time.Minute)))
		})
	})

	Describe("Sleep", func() {
		It("blocks until the given interval elapses", func() {
			doneSleeping := make(chan struct{})
			go func() {
				fakeClock.Sleep(10 * time.Second)
				close(doneSleeping)
			}()

			Consistently(doneSleeping, Δ).ShouldNot(BeClosed())

			fakeClock.Increment(5 * time.Second)
			Consistently(doneSleeping, Δ).ShouldNot(BeClosed())

			fakeClock.Increment(4 * time.Second)
			Consistently(doneSleeping, Δ).ShouldNot(BeClosed())

			fakeClock.Increment(1 * time.Second)
			Eventually(doneSleeping).Should(BeClosed())
		})
	})

	Describe("WatcherCount", func() {
		Context("when a timer is created", func() {
			It("increments the watcher count", func() {
				fakeClock.NewTimer(time.Second)
				Expect(fakeClock.WatcherCount()).To(Equal(1))

				fakeClock.NewTimer(2 * time.Second)
				Expect(fakeClock.WatcherCount()).To(Equal(2))
			})
		})

		Context("when a timer fires", func() {
			It("increments the watcher count", func() {
				fakeClock.NewTimer(time.Second)
				Expect(fakeClock.WatcherCount()).To(Equal(1))

				fakeClock.Increment(time.Second)
				Expect(fakeClock.WatcherCount()).To(Equal(0))
			})
		})
	})
})


text:
require 'foo'

describe Foo::Food do
  it "broccoli is gross" do
    Foo::Food.portray("Broccoli").should eql("Gross!")
  end

  it "anything else is delicious" do
    Foo::Food.portray("Not Broccoli").should eql("Delicious!")
  end

  it "pluralizes a word" do
    Foo::Food.pluralize("Tomato").should eql("Tomatoes")
  end
end


text:
{2}

    {8}
    {10}
    {9}

        {3}

    {4}
    {5}


text:
namespace Samples_and_tests {
    partial class Controls {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose( bool disposing ) {
            if ( disposing && (components != null) ) {
                components.Dispose();
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent() {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Controls));
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.listContainer1 = new winforms_collection.containers.ListContainer();
            this.button1 = new System.Windows.Forms.Button();
            this.label9 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.simpleList1 = new winforms_collection.SimpleList();
            this.label7 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.listContainer1.SuspendLayout();
            this.SuspendLayout();
            //
            // splitContainer1
            //
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(0, 0);
            this.splitContainer1.Name = "splitContainer1";
            //
            // splitContainer1.Panel1
            //
            this.splitContainer1.Panel1.Controls.Add(this.listContainer1);
            //
            // splitContainer1.Panel2
            //
            this.splitContainer1.Panel2.Controls.Add(this.simpleList1);
            this.splitContainer1.Size = new System.Drawing.Size(1178, 546);
            this.splitContainer1.SplitterDistance = 564;
            this.splitContainer1.TabIndex = 0;
            //
            // listContainer1
            //
            this.listContainer1.AutoScroll = true;
            this.listContainer1.Controls.Add(this.button1);
            this.listContainer1.Controls.Add(this.label9);
            this.listContainer1.Controls.Add(this.label8);
            this.listContainer1.Controls.Add(this.label5);
            this.listContainer1.Controls.Add(this.label3);
            this.listContainer1.Controls.Add(this.label1);
            this.listContainer1.DirectionHorizontal = false;
            this.listContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.listContainer1.HeightWeight = ((System.ComponentModel.BindingList<float>)(resources.GetObject("listContainer1.heightWeight")));
            this.listContainer1.Location = new System.Drawing.Point(0, 0);
            this.listContainer1.MinSplitHeight = 0;
            this.listContainer1.Name = "listContainer1";
            this.listContainer1.Size = new System.Drawing.Size(564, 546);
            this.listContainer1.SplitHeight = 4;
            this.listContainer1.TabIndex = 0;
            //
            // button1
            //
            this.button1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
            this.button1.Dock = System.Windows.Forms.DockStyle.Top;
            this.button1.Location = new System.Drawing.Point(0, 680);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(547, 136);
            this.button1.TabIndex = 5;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = false;
            //
            // label9
            //
            this.label9.Dock = System.Windows.Forms.DockStyle.Top;
            this.label9.Location = new System.Drawing.Point(0, 544);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(547, 136);
            this.label9.TabIndex = 4;
            this.label9.Text = "label9";
            //
            // label8
            //
            this.label8.BackColor = System.Drawing.Color.Red;
            this.label8.Dock = System.Windows.Forms.DockStyle.Top;
            this.label8.Location = new System.Drawing.Point(0, 408);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(547, 136);
            this.label8.TabIndex = 3;
            this.label8.Text = "label8";
            //
            // label5
            //
            this.label5.BackColor = System.Drawing.SystemColors.ActiveCaption;
            this.label5.Dock = System.Windows.Forms.DockStyle.Top;
            this.label5.Location = new System.Drawing.Point(0, 272);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(547, 136);
            this.label5.TabIndex = 2;
            this.label5.Text = "label5";
            //
            // label3
            //
            this.label3.BackColor = System.Drawing.Color.Red;
            this.label3.Dock = System.Windows.Forms.DockStyle.Top;
            this.label3.Location = new System.Drawing.Point(0, 136);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(547, 136);
            this.label3.TabIndex = 1;
            this.label3.Text = "label3";
            //
            // label1
            //
            this.label1.BackColor = System.Drawing.SystemColors.ActiveCaption;
            this.label1.Dock = System.Windows.Forms.DockStyle.Top;
            this.label1.Location = new System.Drawing.Point(0, 0);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(547, 136);
            this.label1.TabIndex = 0;
            this.label1.Text = "label1";
            //
            // simpleList1
            //
            this.simpleList1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.simpleList1.Location = new System.Drawing.Point(0, 0);
            this.simpleList1.Name = "simpleList1";
            this.simpleList1.Size = new System.Drawing.Size(610, 546);
            this.simpleList1.TabIndex = 0;
            this.simpleList1.Title = "tst";
            //
            // label7
            //
            this.label7.Location = new System.Drawing.Point(277, 414);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(100, 23);
            this.label7.TabIndex = 4;
            this.label7.Text = "label7";
            //
            // label6
            //
            this.label6.Location = new System.Drawing.Point(159, 381);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(100, 23);
            this.label6.TabIndex = 3;
            this.label6.Text = "label6";
            //
            // label4
            //
            this.label4.Location = new System.Drawing.Point(159, 316);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(100, 23);
            this.label4.TabIndex = 2;
            this.label4.Text = "label4";
            //
            // label2
            //
            this.label2.Location = new System.Drawing.Point(150, 245);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(100, 23);
            this.label2.TabIndex = 1;
            this.label2.Text = "label2";
            //
            // controls
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(1178, 546);
            this.Controls.Add(this.splitContainer1);
            this.Name = "Controls";
            this.Text = "controls";
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
            this.splitContainer1.ResumeLayout(false);
            this.listContainer1.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.SplitContainer splitContainer1;
        private winforms_collection.containers.ListContainer listContainer1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button button1;
        private winforms_collection.SimpleList simpleList1;
    }
}


text:
using UnityEngine;
using System.Collections;

public class TwoSwitch : MonoBehaviour {
    public GameObject sw1;
    public GameObject sw2;

    private Animation anim;

	void Start () {
        anim = sw1.GetComponent<Animation>();
	}

	void Update () {

	}
}


text:
/* This file was generated by SableCC (http://www.sablecc.org/). */

package org.acre.lang.node;

import java.util.*;
import org.acre.lang.analysis.*;

public final class AFirstExceptAdditiveExpr extends PAdditiveExpr
{
    private TIdentifier _identifier_;
    private TExcept _except_;
    private PMultiplicativeExpr _multiplicativeExpr_;

    public AFirstExceptAdditiveExpr()
    {
    }

    public AFirstExceptAdditiveExpr(
        TIdentifier _identifier_,
        TExcept _except_,
        PMultiplicativeExpr _multiplicativeExpr_)
    {
        setIdentifier(_identifier_);

        setExcept(_except_);

        setMultiplicativeExpr(_multiplicativeExpr_);

    }
    public Object clone()
    {
        return new AFirstExceptAdditiveExpr(
            (TIdentifier) cloneNode(_identifier_),
            (TExcept) cloneNode(_except_),
            (PMultiplicativeExpr) cloneNode(_multiplicativeExpr_));
    }

    public void apply(Switch sw)
    {
        ((Analysis) sw).caseAFirstExceptAdditiveExpr(this);
    }

    public TIdentifier getIdentifier()
    {
        return _identifier_;
    }

    public void setIdentifier(TIdentifier node)
    {
        if(_identifier_ != null)
        {
            _identifier_.parent(null);
        }

        if(node != null)
        {
            if(node.parent() != null)
            {
                node.parent().removeChild(node);
            }

            node.parent(this);
        }

        _identifier_ = node;
    }

    public TExcept getExcept()
    {
        return _except_;
    }

    public void setExcept(TExcept node)
    {
        if(_except_ != null)
        {
            _except_.parent(null);
        }

        if(node != null)
        {
            if(node.parent() != null)
            {
                node.parent().removeChild(node);
            }

            node.parent(this);
        }

        _except_ = node;
    }

    public PMultiplicativeExpr getMultiplicativeExpr()
    {
        return _multiplicativeExpr_;
    }

    public void setMultiplicativeExpr(PMultiplicativeExpr node)
    {
        if(_multiplicativeExpr_ != null)
        {
            _multiplicativeExpr_.parent(null);
        }

        if(node != null)
        {
            if(node.parent() != null)
            {
                node.parent().removeChild(node);
            }

            node.parent(this);
        }

        _multiplicativeExpr_ = node;
    }

    public String toString()
    {
        return ""
            + toString(_identifier_)
            + toString(_except_)
            + toString(_multiplicativeExpr_);
    }

    void removeChild(Node child)
    {
        if(_identifier_ == child)
        {
            _identifier_ = null;
            return;
        }

        if(_except_ == child)
        {
            _except_ = null;
            return;
        }

        if(_multiplicativeExpr_ == child)
        {
            _multiplicativeExpr_ = null;
            return;
        }

    }

    void replaceChild(Node oldChild, Node newChild)
    {
        if(_identifier_ == oldChild)
        {
            setIdentifier((TIdentifier) newChild);
            return;
        }

        if(_except_ == oldChild)
        {
            setExcept((TExcept) newChild);
            return;
        }

        if(_multiplicativeExpr_ == oldChild)
        {
            setMultiplicativeExpr((PMultiplicativeExpr) newChild);
            return;
        }

    }
}


text:
<!DOCTYPE html>

      <content-append node="tab.heading"></content-append>

    <content></content>


text:
import * as React from 'react';

declare class ResponsiveEmbed extends React.Component<ResponsiveEmbedProps> { }
declare namespace ResponsiveEmbed { }
export = ResponsiveEmbed

interface ResponsiveEmbedProps extends React.HTMLProps<ResponsiveEmbed> {
  a16by9?: boolean;
  a4by3?: boolean;
  bsClass?: string;
}


text:
package com.wookler.server.river.services.services;

import com.wookler.server.common.config.Config;
import com.wookler.server.common.config.ConfigNode;
import com.wookler.server.common.config.ConfigPath;

/**
 * @author Subho Ghosh (subho dot ghosh at outlook.com)
 * @created re10/08/14
 */
public class AdHocTests {

    public static void main(String[] args) {
        try {
            String cf = "/work/dev/RIVER/server/src/test/resources/server-config-pull.xml";
            Config c = new Config(cf, "/configuration");
            c.load();

            ConfigNode n = c.node();
            if (n instanceof ConfigPath) {
                ConfigPath cp = (ConfigPath) n;
                ConfigNode cn = cp.search("services.publisher");
                if (cn == null) {
                    throw new Exception("Not found...");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


text:
package org.apache.sentry.binding.hive.authz;

import java.lang.reflect.Constructor;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.hadoop.hive.ql.metadata.AuthorizationException;
import org.apache.hadoop.hive.ql.plan.HiveOperation;
import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.sentry.SentryUserException;
import org.apache.sentry.binding.hive.conf.HiveAuthzConf;
import org.apache.sentry.binding.hive.conf.HiveAuthzConf.AuthzConfVars;
import org.apache.sentry.binding.hive.conf.InvalidConfigurationException;
import org.apache.sentry.core.common.ActiveRoleSet;
import org.apache.sentry.core.common.Subject;
import org.apache.sentry.core.model.db.AccessConstants;
import org.apache.sentry.core.model.db.DBModelAction;
import org.apache.sentry.core.model.db.DBModelAuthorizable;
import org.apache.sentry.core.model.db.DBModelAuthorizable.AuthorizableType;
import org.apache.sentry.core.model.db.Server;
import org.apache.sentry.policy.common.PolicyEngine;
import org.apache.sentry.provider.common.AuthorizationProvider;
import org.apache.sentry.provider.common.ProviderBackend;
import org.apache.sentry.provider.db.service.thrift.TSentryRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;

public class HiveAuthzBinding {
  private static final Logger LOG = LoggerFactory
      .getLogger(HiveAuthzBinding.class);
  private static final Map<String, HiveAuthzBinding> authzBindingMap =
      new ConcurrentHashMap<String, HiveAuthzBinding>();
  private static final AtomicInteger queryID = new AtomicInteger();
  private static final Splitter ROLE_SET_SPLITTER = Splitter.on(",").trimResults()
      .omitEmptyStrings();
  public static final String HIVE_BINDING_TAG = "hive.authz.bindings.tag";

  private final HiveConf hiveConf;
  private final Server authServer;
  private final AuthorizationProvider authProvider;
  private volatile boolean open;
  private ActiveRoleSet activeRoleSet;
  private HiveAuthzConf authzConf;

  public static enum HiveHook {
    HiveServer2,
    HiveMetaStore
    ;
  }

  public HiveAuthzBinding (HiveConf hiveConf, HiveAuthzConf authzConf) throws Exception {
    this(HiveHook.HiveServer2, hiveConf, authzConf);
  }

  public HiveAuthzBinding (HiveHook hiveHook, HiveConf hiveConf, HiveAuthzConf authzConf) throws Exception {
    validateHiveConfig(hiveHook, hiveConf, authzConf);
    this.hiveConf = hiveConf;
    this.authzConf = authzConf;
    this.authServer = new Server(authzConf.get(AuthzConfVars.AUTHZ_SERVER_NAME.getVar()));
    this.authProvider = getAuthProvider(hiveConf, authzConf, authServer.getName());
    this.open = true;
    this.activeRoleSet = parseActiveRoleSet(hiveConf.get(HiveAuthzConf.SENTRY_ACTIVE_ROLE_SET,
        authzConf.get(HiveAuthzConf.SENTRY_ACTIVE_ROLE_SET, "")).trim());
  }

  private static ActiveRoleSet parseActiveRoleSet(String name)
      throws SentryUserException {
    return parseActiveRoleSet(name, null);
  }

  private static ActiveRoleSet parseActiveRoleSet(String name,
      Set<TSentryRole> allowedRoles) throws SentryUserException {
    // if unset, then we choose the default of ALL
    if (name.isEmpty()) {
      return ActiveRoleSet.ALL;
    } else if (AccessConstants.NONE_ROLE.equalsIgnoreCase(name)) {
      return new ActiveRoleSet(new HashSet<String>());
    } else if (AccessConstants.ALL_ROLE.equalsIgnoreCase(name)) {
      return ActiveRoleSet.ALL;
    } else if (AccessConstants.RESERVED_ROLE_NAMES.contains(name.toUpperCase())) {
      String msg = "Role " + name + " is reserved";
      throw new IllegalArgumentException(msg);
    } else {
      if (allowedRoles != null) {
        // check if the user has been granted the role
        boolean foundRole = false;
        for (TSentryRole role : allowedRoles) {
          if (role.getRoleName().equalsIgnoreCase(name)) {
            foundRole = true;
            break;
          }
        }
        if (!foundRole) {
          //Set the reason for hive binding to pick up
          throw new SentryUserException("Not authorized to set role " + name, "Not authorized to set role " + name);

        }
      }
      return new ActiveRoleSet(Sets.newHashSet(ROLE_SET_SPLITTER.split(name)));
    }
  }

  /**
   * Retrieve the HiveAuthzBinding if the tag is saved in the given configuration
   * @param conf
   * @return HiveAuthzBinding or null
   */
  public static HiveAuthzBinding get(Configuration conf) {
    String tagName = conf.get(HIVE_BINDING_TAG);
    if (tagName == null) {
      return null;
    } else {
      return authzBindingMap.get(tagName);
    }
  }

  /**
   * store the HiveAuthzBinding in the authzBindingMap and save a tag in the given configuration
   * @param conf
   */
  public void set (Configuration conf) {
    if (!open) {
      throw new IllegalStateException("Binding has been closed");
    }
    String tagName = SessionState.get().getSessionId() + "_" + queryID.incrementAndGet();
    authzBindingMap.put(tagName, this);
    conf.set(HIVE_BINDING_TAG, tagName);
  }

  /**
   * remove the authzBindingMap entry for given tag
   * @param conf
   */
  public void clear(Configuration conf) {
    if (!open) {
      throw new IllegalStateException("Binding has been closed");
    }
    String tagName = conf.get(HIVE_BINDING_TAG);
    if (tagName != null) {
      authzBindingMap.remove(tagName);
    }
    open = false;
    authProvider.close();
  }

  private void validateHiveConfig(HiveHook hiveHook, HiveConf hiveConf, HiveAuthzConf authzConf)
      throws InvalidConfigurationException{
    if(hiveHook.equals(HiveHook.HiveMetaStore)) {
      validateHiveMetaStoreConfig(hiveConf, authzConf);
    }else if(hiveHook.equals(HiveHook.HiveServer2)) {
      validateHiveServer2Config(hiveConf, authzConf);
    }
  }

  private void validateHiveMetaStoreConfig(HiveConf hiveConf, HiveAuthzConf authzConf)
      throws InvalidConfigurationException{
    boolean isTestingMode = Boolean.parseBoolean(Strings.nullToEmpty(
        authzConf.get(AuthzConfVars.SENTRY_TESTING_MODE.getVar())).trim());
    LOG.debug("Testing mode is " + isTestingMode);
    if(!isTestingMode) {
      boolean sasl = hiveConf.getBoolVar(ConfVars.METASTORE_USE_THRIFT_SASL);
      if(!sasl) {
        throw new InvalidConfigurationException(
            ConfVars.METASTORE_USE_THRIFT_SASL + " can't be false in non-testing mode");
      }
    } else {
      boolean setUgi = hiveConf.getBoolVar(ConfVars.METASTORE_EXECUTE_SET_UGI);
      if(!setUgi) {
        throw new InvalidConfigurationException(
            ConfVars.METASTORE_EXECUTE_SET_UGI.toString() + " can't be false in non secure mode");
      }
    }
  }

  private void validateHiveServer2Config(HiveConf hiveConf, HiveAuthzConf authzConf)
      throws InvalidConfigurationException{
    boolean isTestingMode = Boolean.parseBoolean(Strings.nullToEmpty(
        authzConf.get(AuthzConfVars.SENTRY_TESTING_MODE.getVar())).trim());
    LOG.debug("Testing mode is " + isTestingMode);
    if(!isTestingMode) {
      String authMethod = Strings.nullToEmpty(hiveConf.getVar(ConfVars.HIVE_SERVER2_AUTHENTICATION)).trim();
      if("none".equalsIgnoreCase(authMethod)) {
        throw new InvalidConfigurationException(ConfVars.HIVE_SERVER2_AUTHENTICATION +
            " can't be none in non-testing mode");
      }
      boolean impersonation = hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS);
      boolean allowImpersonation = Boolean.parseBoolean(Strings.nullToEmpty(
          authzConf.get(AuthzConfVars.AUTHZ_ALLOW_HIVE_IMPERSONATION.getVar())).trim());

      if(impersonation && !allowImpersonation) {
        LOG.error("Role based authorization does not work with HiveServer2 impersonation");
        throw new InvalidConfigurationException(ConfVars.HIVE_SERVER2_ENABLE_DOAS +
            " can't be set to true in non-testing mode");
      }
    }
    String defaultUmask = hiveConf.get(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY);
    if("077".equalsIgnoreCase(defaultUmask)) {
      LOG.error("HiveServer2 required a default umask of 077");
      throw new InvalidConfigurationException(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY +
          " should be 077 in non-testing mode");
    }
  }

  // Instantiate the configured authz provider
  public static AuthorizationProvider getAuthProvider(HiveConf hiveConf, HiveAuthzConf authzConf,
        String serverName) throws Exception {
    // get the provider class and resources from the authz config
    String authProviderName = authzConf.get(AuthzConfVars.AUTHZ_PROVIDER.getVar());
    String resourceName =
        authzConf.get(AuthzConfVars.AUTHZ_PROVIDER_RESOURCE.getVar());
    String providerBackendName = authzConf.get(AuthzConfVars.AUTHZ_PROVIDER_BACKEND.getVar());
    String policyEngineName = authzConf.get(AuthzConfVars.AUTHZ_POLICY_ENGINE.getVar());

    LOG.debug("Using authorization provider " + authProviderName +
        " with resource " + resourceName + ", policy engine "
        + policyEngineName + ", provider backend " + providerBackendName);
      // load the provider backend class
      Constructor<?> providerBackendConstructor =
        Class.forName(providerBackendName).getDeclaredConstructor(Configuration.class, String.class);
      providerBackendConstructor.setAccessible(true);
    ProviderBackend providerBackend = (ProviderBackend) providerBackendConstructor.
        newInstance(new Object[] {authzConf, resourceName});

    // load the policy engine class
    Constructor<?> policyConstructor =
      Class.forName(policyEngineName).getDeclaredConstructor(String.class, ProviderBackend.class);
    policyConstructor.setAccessible(true);
    PolicyEngine policyEngine = (PolicyEngine) policyConstructor.
        newInstance(new Object[] {serverName, providerBackend});

    // load the authz provider class
    Constructor<?> constrctor =
      Class.forName(authProviderName).getDeclaredConstructor(String.class, PolicyEngine.class);
    constrctor.setAccessible(true);
    return (AuthorizationProvider) constrctor.newInstance(new Object[] {resourceName, policyEngine});
  }

  /**
   * Validate the privilege for the given operation for the given subject
   * @param hiveOp
   * @param stmtAuthPrivileges
   * @param subject
   * @param currDB
   * @param inputEntities
   * @param outputEntities
   * @throws AuthorizationException
   */
  public void authorize(HiveOperation hiveOp, HiveAuthzPrivileges stmtAuthPrivileges,
      Subject subject, List<List<DBModelAuthorizable>> inputHierarchyList,
      List<List<DBModelAuthorizable>> outputHierarchyList)
          throws AuthorizationException {
    if (!open) {
      throw new IllegalStateException("Binding has been closed");
    }
    boolean isDebug = LOG.isDebugEnabled();
    if(isDebug) {
      LOG.debug("Going to authorize statement " + hiveOp.name() +
          " for subject " + subject.getName());
    }

    /* for each read and write entity captured by the compiler -
     *    check if that object type is part of the input/output privilege list
     *    If it is, then validate the access.
     * Note the hive compiler gathers information on additional entities like partitions,
     * etc which are not of our interest at this point. Hence its very
     * much possible that the we won't be validating all the entities in the given list
     */

    // Check read entities
    Map<AuthorizableType, EnumSet<DBModelAction>> requiredInputPrivileges =
        stmtAuthPrivileges.getInputPrivileges();
    if(isDebug) {
      LOG.debug("requiredInputPrivileges = " + requiredInputPrivileges);
      LOG.debug("inputHierarchyList = " + inputHierarchyList);
    }
    Map<AuthorizableType, EnumSet<DBModelAction>> requiredOutputPrivileges =
        stmtAuthPrivileges.getOutputPrivileges();
    if(isDebug) {
      LOG.debug("requiredOuputPrivileges = " + requiredOutputPrivileges);
      LOG.debug("outputHierarchyList = " + outputHierarchyList);
    }

    boolean found = false;
    for(AuthorizableType key: requiredInputPrivileges.keySet()) {
      for (List<DBModelAuthorizable> inputHierarchy : inputHierarchyList) {
        if (getAuthzType(inputHierarchy).equals(key)) {
          found = true;
          if (!authProvider.hasAccess(subject, inputHierarchy, requiredInputPrivileges.get(key), activeRoleSet)) {
            throw new AuthorizationException("User " + subject.getName() +
                " does not have privileges for " + hiveOp.name());
          }
        }
      }
      if(!found && !(key.equals(AuthorizableType.URI)) &&  !(hiveOp.equals(HiveOperation.QUERY))
          && !(hiveOp.equals(HiveOperation.CREATETABLE_AS_SELECT))) {
        //URI privileges are optional for some privileges: anyPrivilege, tableDDLAndOptionalUriPrivilege
        //Query can mean select/insert/analyze where all of them have different required privileges.
        //CreateAsSelect can has table/columns privileges with select.
        //For these alone we skip if there is no equivalent input privilege
        //TODO: Even this case should be handled to make sure we do not skip the privilege check if we did not build
        //the input privileges correctly
        throw new AuthorizationException("Required privilege( " + key.name() + ") not available in input privileges");
      }
      found = false;
    }

    for(AuthorizableType key: requiredOutputPrivileges.keySet()) {
      for (List<DBModelAuthorizable> outputHierarchy : outputHierarchyList) {
        if (getAuthzType(outputHierarchy).equals(key)) {
          found = true;
          if (!authProvider.hasAccess(subject, outputHierarchy, requiredOutputPrivileges.get(key), activeRoleSet)) {
            throw new AuthorizationException("User " + subject.getName() +
                " does not have privileges for " + hiveOp.name());
          }
        }
      }
      if(!found && !(key.equals(AuthorizableType.URI)) &&  !(hiveOp.equals(HiveOperation.QUERY))) {
        //URI privileges are optional for some privileges: tableInsertPrivilege
        //Query can mean select/insert/analyze where all of them have different required privileges.
        //For these alone we skip if there is no equivalent output privilege
        //TODO: Even this case should be handled to make sure we do not skip the privilege check if we did not build
        //the output privileges correctly
        throw new AuthorizationException("Required privilege( " + key.name() + ") not available in output privileges");
      }
      found = false;
    }

  }

  public void setActiveRoleSet(String activeRoleSet,
      Set<TSentryRole> allowedRoles) throws SentryUserException {
    this.activeRoleSet = parseActiveRoleSet(activeRoleSet, allowedRoles);
    hiveConf.set(HiveAuthzConf.SENTRY_ACTIVE_ROLE_SET, activeRoleSet);
  }

  public ActiveRoleSet getActiveRoleSet() {
    return activeRoleSet;
  }

  public Set<String> getGroups(Subject subject) {
    return authProvider.getGroupMapping().getGroups(subject.getName());
  }

  public Server getAuthServer() {
    if (!open) {
      throw new IllegalStateException("Binding has been closed");
    }
    return authServer;
  }

  public HiveAuthzConf getAuthzConf() {
    return authzConf;
  }

  private AuthorizableType getAuthzType (List<DBModelAuthorizable> hierarchy){
    return hierarchy.get(hierarchy.size() -1).getAuthzType();
  }

  public List<String> getLastQueryPrivilegeErrors() {
    if (!open) {
      throw new IllegalStateException("Binding has been closed");
    }
    return authProvider.getLastFailedPrivileges();
  }
}


text:
package pl.exsio.ca.model.entity.factory;

import pl.exsio.ca.model.Event;
import pl.exsio.ca.model.OverseerAssignment;
import pl.exsio.ca.model.Preacher;
import pl.exsio.ca.model.PreacherAssignment;
import pl.exsio.ca.model.PreacherPriviledge;
import pl.exsio.ca.model.ServiceGroup;
import pl.exsio.ca.model.Terrain;
import pl.exsio.ca.model.TerrainAssignment;
import pl.exsio.ca.model.TerrainFile;
import pl.exsio.ca.model.TerrainNote;
import pl.exsio.ca.model.TerrainNotification;

/**
 *
 * @author exsio
 */
public interface CaEntityFactory {

    <T extends Preacher> T newPreacher();

    <T extends PreacherAssignment> T newPreacherAssignment();

    <T extends OverseerAssignment> T newOverseerAssignment();

    <T extends PreacherPriviledge> T newPreacherPriviledge();

    <T extends ServiceGroup> T newServiceGroup();

    <T extends Terrain> T newTerrain();

    <T extends TerrainFile> T newTerrainFile();

    <T extends TerrainAssignment> T newTerrainAssignment();

    <T extends TerrainNotification> T newTerrainNotification();

    <T extends TerrainNote> T newTerrainNote();

    <T extends Event> T newEvent();

    <T extends Preacher> Class<T> getPreacherClass();

    <T extends PreacherAssignment> Class<T> getPreacherAssignmentClass();

    <T extends OverseerAssignment> Class<T> getOverseerAssignmentClass();

    <T extends PreacherPriviledge> Class<T> getPreacherPriviledgeClass();

    <T extends ServiceGroup> Class<T> getServiceGroupClass();

    <T extends Terrain> Class<T> getTerrainClass();

    <T extends TerrainAssignment> Class<T> getTerrainAssignmentClass();

    <T extends TerrainNotification> Class<T> getTerrainNotificationClass();

    <T extends TerrainNote> Class<T> getTerrainNoteClass();

    <T extends TerrainFile> Class<T> getTerrainFileClass();

    <T extends Event> Class<T> getEventClass();
}


text:
**Alive** is an open source browser-based [Framer](https://github.com/koenbok/Framer/) editor for rapid prototyping with a hint of Invision. A [Sketch plugin](https://github.com/tomger/alive) makes it easy to upload typical Framer layers to the server.

## Get Started

- [Download] (https://github.com/tomger/alive-server/archive/master.zip) (Node.js & React project)
- Run `npm install` to install dependencies
- Run `npm start` to start the web server and the "Create react app" live environment.
- Install the Sketch plugin to upload an artboard to your local server. The plugin will open a specific project on **http://localhost:3001/edit/[sketch page id]** automatically.

If that sounds scary, check out [this screencast](https://vimeo.com/185270726) of an older version of the web editor.

## Contribute

##### Current features
- The server accepts Framer JSON and PNG assets through HTTP POST
- The web client can edit and compile CoffeeScript for **each artboard**.
- Navigate through code by clicking on artboard previews.
- Autocomplete for Framer framework and layer names.
- **Invision style** point and click hotspots with artboard previews.
- Sharing using a read-only ID.

##### Wanted features

- **Figma** asset syncing (as background cloud service)
- Authentication / safer sharing
- More point & click FlowComponent transitions
- Improved autocomplete
- Point & click drawing of click targets


text:
import os
import sys

sys.path.append(os.pardir)  # 親ディレクトリのファイルをインポートするための設定
import numpy as np
import matplotlib.pyplot as plt
from dataset.mnist import load_mnist
from common.util import smooth_curve
from common.multi_layer_net import MultiLayerNet
from common.optimizer import SGD

# 0:MNISTデータの読み込み==========
(x_train, t_train), (x_test, t_test) = load_mnist(normalize=True)

train_size = x_train.shape[0]
batch_size = 128
max_iterations = 2000

# 1:実験の設定==========
weight_init_types = {'std=0.01': 0.01, 'Xavier': 'sigmoid', 'He': 'relu'}
optimizer = SGD(lr=0.01)

networks = {}
train_loss = {}
for key, weight_type in weight_init_types.items():
    networks[key] = MultiLayerNet(input_size=784, hidden_size_list=[100, 100, 100, 100],
                                  output_size=10, weight_init_std=weight_type)
    train_loss[key] = []

# 2:訓練の開始==========
for i in range(max_iterations):
    batch_mask = np.random.choice(train_size, batch_size)
    x_batch = x_train[batch_mask]
    t_batch = t_train[batch_mask]

    for key in weight_init_types.keys():
        grads = networks[key].gradient(x_batch, t_batch)
        optimizer.update(networks[key].params, grads)

        loss = networks[key].loss(x_batch, t_batch)
        train_loss[key].append(loss)

    if i % 100 == 0:
        print("===========" + "iteration:" + str(i) + "===========")
        for key in weight_init_types.keys():
            loss = networks[key].loss(x_batch, t_batch)
            print(key + ":" + str(loss))

# 3.グラフの描画==========
markers = {'std=0.01': 'o', 'Xavier': 's', 'He': 'D'}
x = np.arange(max_iterations)
for key in weight_init_types.keys():
    plt.plot(x, smooth_curve(train_loss[key]), marker=markers[key], markevery=100, label=key)
plt.xlabel("iterations")
plt.ylabel("loss")
plt.ylim(0, 2.5)
plt.legend()
plt.show()


text:
using Hl7.Fhir.Model;
using Hl7.Fhir.Support;
using Spark.Data;
using Spark.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using Spark.Support;
using Hl7.Fhir.Rest;
using Spark.Config;
using Spark.Core;

namespace Spark.Service
{

    internal class Pager
    {
        IFhirStore store;
        ResourceExporter exporter;
        public const int MAX_PAGE_SIZE = 100;
        public const int DEFAULT_PAGE_SIZE = 20;

        public Pager(IFhirStore store, ResourceExporter exporter)
        {
            this.store = store;
            this.exporter = exporter;
        }

        public Bundle GetPage(string snapshotkey, int start = 0, int count = DEFAULT_PAGE_SIZE)
        {
            Snapshot snapshot = store.GetSnapshot(snapshotkey);
            return GetPage(snapshot, start, count);
        }

        public Bundle GetPage(Snapshot snapshot, int start = 0, int pagesize = DEFAULT_PAGE_SIZE)
        {
            if (pagesize > MAX_PAGE_SIZE) pagesize = MAX_PAGE_SIZE;

            if (snapshot == null)
                throw new SparkException(HttpStatusCode.NotFound, "There is no paged snapshot with id '{0}'", snapshot.Id);

            if (!snapshot.InRange(start))
            {
                throw new SparkException(HttpStatusCode.NotFound,
                    "The specified index lies outside the range of available results ({0}) in snapshot {1}",
                    snapshot.Keys.Count(), snapshot.Id);
            }

            return CreateBundle(snapshot, start, pagesize);
        }

        public Bundle CreateSnapshotAndGetFirstPage(string title, Uri link, IEnumerable<Uri> keys, string sortby, IEnumerable<string> includes = null)
        {
            Snapshot snapshot = Snapshot.Create(title, link, keys, sortby, includes);
            store.AddSnapshot(snapshot);
            Bundle bundle = this.GetPage(snapshot);
            return bundle;
        }

        public Bundle CreateBundle(Snapshot snapshot, int start, int count)
        {
            Bundle bundle = new Bundle();
            bundle.Title = snapshot.FeedTitle;
            bundle.TotalResults = snapshot.Count;
            bundle.Id = Key.NewUuid();
            bundle.AuthorName = "Furore Spark FHIR server";
            bundle.AuthorUri = "http://fhir.furore.com";

            bundle.Links = new UriLinkList();
            bundle.Links.SelfLink = new Uri(snapshot.FeedSelfLink);
            bundle.LastUpdated = snapshot.WhenCreated;

            IEnumerable<Uri> keys = snapshot.Keys.Skip(start).Take(count);
            bundle.Entries = store.Get(keys, snapshot.SortBy).ToList();
            Include(bundle, snapshot.Includes);
            buildLinks(bundle, snapshot, start, count);
            exporter.Externalize(bundle);
            return bundle;
        }

        // Given a set of version id's, go fetch a subset of them from the store and build a Bundle
        /*private Bundle createBundle(Snapshot snapshot, int start, int count)
        {
            var entryVersionIds = snapshot.Keys.Skip(start).Take(count).ToList();
            var pageContents = store.Get(entryVersionIds, snapshot.SortBy).ToList();

            var bundle =
                BundleEntryFactory.CreateBundleWithEntries(snapshot.FeedTitle, new Uri(snapshot.FeedSelfLink),
                      "Spark MatchBox Search Engine", null, pageContents);

            if (snapshot.Count != Snapshot.NOCOUNT)
                bundle.TotalResults = snapshot.Count;
            else
                bundle.TotalResults = null;

            var total = snapshot.Keys.Count();

            // If we need paging, add the paging links
            if (total > count)
                buildLinks(bundle, snapshot, start, count);

            return bundle;
        }
        */

        private static void buildLinks(Bundle bundle, Snapshot snapshot, int start, int count)
        {
            var lastPage = snapshot.Count / count;

            // http://spark.furore.com/fhir/_snapshot/

            Uri baseurl = new Uri(Settings.Endpoint.ToString() + "/" + FhirRestOp.SNAPSHOT);

            bundle.Links.SelfLink =
                baseurl
                .AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
                .AddParam(FhirParameter.SNAPSHOT_INDEX, start.ToString())
                .AddParam(FhirParameter.COUNT, count.ToString());

            // First
            bundle.Links.FirstLink =
                baseurl
                .AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
                .AddParam(FhirParameter.SNAPSHOT_INDEX, "0");

            // Last
            bundle.Links.LastLink =
                baseurl
                .AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
                .AddParam(FhirParameter.SNAPSHOT_INDEX, (lastPage * count).ToString());

            // Only do a Previous if we can go back
            if (start > 0)
            {
                int prevIndex = start - count;
                if (prevIndex < 0) prevIndex = 0;

                bundle.Links.PreviousLink =
                    baseurl
                    .AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
                    .AddParam(FhirParameter.SNAPSHOT_INDEX, prevIndex.ToString());
            }

            // Only do a Next if we can go forward
            if (start + count < snapshot.Count)
            {
                int nextIndex = start + count;

                bundle.Links.NextLink =
                    baseurl
                    .AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
                    .AddParam(FhirParameter.SNAPSHOT_INDEX, nextIndex.ToString());
            }
        }

        public void Include(Bundle bundle, IEnumerable<string> includes)
        {
            if (includes == null) return;

            IEnumerable<Uri> keys = bundle.GetReferences(includes).Distinct();
            IEnumerable<BundleEntry> entries = store.Get(keys, null);
            bundle.AddRange(entries);
        }

    }

}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Saccharomyces pasteurianus var. ribi-idaei Thüm.

### Remarks
null


text:
<?php

error_reporting(E_ALL | E_STRICT);

define('VENDOR_PATH', realpath(__DIR__ . '/../vendor'));
define('FIXTURES_PATH', realpath(__DIR__.'/FSi/Component/DataSource/Tests/Fixtures'));

if (!class_exists('PHPUnit_Framework_TestCase') ||
    version_compare(PHPUnit_Runner_Version::id(), '3.5') < 0
) {
    die('PHPUnit framework is required, at least 3.5 version'."\n");
}

if (!class_exists('PHPUnit_Framework_MockObject_MockBuilder')) {
    die('PHPUnit MockObject plugin is required, at least 1.0.8 version'."\n");
}
if (!file_exists(__DIR__.'/../vendor/autoload.php')) {
    die('Install vendors using command: composer.phar install --dev'."\n");
}

$loader = require_once __DIR__.'/../vendor/autoload.php';
$loader->add('FSi\\Component\\DataSource\\Tests', __DIR__);
$loader->add('FSi\\FSiExtension\\DataGrid\\Extension\\Tests\\Fixtures', __DIR__);
if (class_exists($annotationRegistry = 'Doctrine\Common\Annotations\AnnotationRegistry')) {
    $annotationRegistry::registerLoader(function($class) {
        if (0 === strpos(ltrim($class, '/'), 'FSi\Component\DataSource')) {
            if (file_exists($file = __DIR__.'/../lib/'. str_replace('\\', '/', $class) .'.php')) {
                require_once $file;
            }
        }
        return class_exists($class, false);
    });
}


text:
#pragma once

#include "UMEventType.h"

namespace umimage
{

enum {
	eImageEventImageChaged = 100
};

} // umimage


text:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
    <id>test-jar-with-dependencies</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory>/</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <useProjectAttachments>true</useProjectAttachments>
            <unpack>true</unpack>
            <scope>test</scope>
        </dependencySet>
    </dependencySets>
    <fileSets>
        <fileSet>
            <directory>${project.build.directory}/test-classes</directory>
            <outputDirectory>/</outputDirectory>
            <includes>
                <include>**/*.class</include>
            </includes>
            <useDefaultExcludes>true</useDefaultExcludes>
        </fileSet>
    </fileSets>
</assembly>


text:
package com.plexobject.dp.domain;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.util.Arrays;
import java.util.Date;

import org.junit.Before;
import org.junit.Test;

public class DataRowSetTest {
    private Metadata metaFields;
    private MetaField keyMeta;
    private MetaField nameMeta;

    @Before
    public void setup() {
        MetaFieldFactory.reset();
        keyMeta = MetaFieldFactory.create("key", "Test",
                MetaFieldType.SCALAR_TEXT, true);
        nameMeta = MetaFieldFactory.create("name", "Test",
                MetaFieldType.SCALAR_TEXT, false);
        metaFields = Metadata.from(keyMeta, nameMeta);
    }

    @Test
    public void testCreate() {
        DataRowSet rowset = new DataRowSet(metaFields);
        assertEquals(0, rowset.size());
    }

    @Test
    public void testDefaultCreate() {
        DataRowSet rowset = new DataRowSet();
        assertEquals(0, rowset.size());
    }

    @Test
    public void testCreateRowSets() {
        DataRow row = DataRow.from(keyMeta, "hello there", nameMeta, "Jake");
        DataRowSet rowset = new DataRowSet(metaFields, row);
        assertEquals(1, rowset.size());
        assertTrue(rowset.toString().contains("Jake"));
    }

    @Test
    public void testCreateRowSetsCollection() {
        DataRow row = DataRow.from(keyMeta, "hello there", nameMeta, "Jake");
        DataRowSet rowset = new DataRowSet(metaFields, Arrays.asList(row));
        assertEquals(1, rowset.size());
        assertEquals(metaFields, rowset.getMetadata());
    }

    @Test
    public void testAddValueAtRow() {
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake1", 0);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake2", 1);
        assertEquals(2, rowset.size());
        assertEquals(2, rowset.getRows().size());
    }

    @Test
    public void testHasFieldValue() {
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake1", 0);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake2", 1);
        assertTrue(rowset.hasFieldValue(MetaFieldFactory.lookup("name"), 0));
        assertFalse(rowset.hasFieldValue(MetaFieldFactory.lookup("name"), 2));
        assertFalse(rowset.hasFieldValue(MetaFieldFactory.lookup("key"), 0));
    }

    @Test
    public void testGetFieldValueAsRowSet() {
        MetaField field1 = MetaFieldFactory.create("obj1", "Test",
                MetaFieldType.SCALAR_TEXT, false);
        MetaField field2 = MetaFieldFactory.create("obj2", "Test",
                MetaFieldType.ROWSET, false);
        DataRowSet rowset1 = new DataRowSet(Metadata.from(field1));
        rowset1.addValueAtRow(MetaFieldFactory.lookup("obj1"), "value", 0);
        //
        DataRowSet rowset2 = new DataRowSet(Metadata.from(field2));
        rowset2.addValueAtRow(MetaFieldFactory.lookup("obj2"), rowset1, 0);
        rowset2.getValueAsRowSet(MetaFieldFactory.lookup("obj2"), 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testGetFieldValueAsRowSetError() {
        MetaField field0 = MetaFieldFactory.create("obj0", "Test",
                MetaFieldType.SCALAR_TEXT, false);
        MetaField field1 = MetaFieldFactory.create("obj1", "Test",
                MetaFieldType.SCALAR_TEXT, false);
        MetaField field2 = MetaFieldFactory.create("obj2", "Test",
                MetaFieldType.SCALAR_TEXT, false);
        DataRowSet rowset1 = new DataRowSet(Metadata.from(field1));
        rowset1.addValueAtRow(MetaFieldFactory.lookup("obj1"), "value", 0);
        //
        DataRowSet rowset2 = new DataRowSet(Metadata.from(field0, field2));
        rowset2.addValueAtRow(MetaFieldFactory.lookup("obj0"), "xxx", 0);
        rowset2.addValueAtRow(MetaFieldFactory.lookup("obj2"), rowset1, 0);
        rowset2.getValueAsRowSet(MetaFieldFactory.lookup("obj0"), 0);
    }

    @Test
    public void testGetFieldValue() {
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake1", 0);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake2", 1);
        assertEquals("jake1",
                rowset.getValue(MetaFieldFactory.lookup("name"), 0));
        assertEquals("jake2",
                rowset.getValue(MetaFieldFactory.lookup("name"), 1));
    }

    @Test(expected = IllegalArgumentException.class)
    public void testGetFieldValueError() {
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake1", 0);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake1", 0);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake2", 1);
        rowset.getValue(MetaFieldFactory.lookup("name"), 2);
    }

    @Test
    public void testGetValueAsText() {
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("name"), "jake1", 0);
        assertEquals("jake1",
                rowset.getValueAsText(MetaFieldFactory.lookup("name"), 0));
    }

    @Test
    public void testGetValueAsLong() {
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.SCALAR_INTEGER, false);

        metaFields.addMetaField(field1);
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"), 100L, 0);
        assertEquals(100L,
                rowset.getValueAsLong(MetaFieldFactory.lookup("object"), 0));
    }

    @Test
    public void testGetValueAsBoolean() {
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.SCALAR_BOOLEAN, false);
        metaFields.addMetaField(field1);
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"), true, 0);
        assertTrue(rowset.getValueAsBoolean(MetaFieldFactory.lookup("object"),
                0));
    }

    @Test
    public void testGetValueAsDecimal() {
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.SCALAR_DECIMAL, false);
        metaFields.addMetaField(field1);

        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"), 1.1, 0);
        assertEquals(1.1,
                rowset.getValueAsDecimal(MetaFieldFactory.lookup("object"), 0),
                0.0001);
    }

    @Test
    public void testGetValueAsBinary() {
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.BINARY, false);
        metaFields.addMetaField(field1);

        String hello = "hello";
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"),
                hello.getBytes(), 0);
        assertEquals(
                hello,
                new String(rowset.getValueAsBinary(
                        MetaFieldFactory.lookup("object"), 0)));
    }

    @Test
    public void testGetValueAsDate() {
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.SCALAR_DATE, false);
        metaFields.addMetaField(field1);

        Date date = new Date();
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"), date, 0);
        assertEquals(date,
                rowset.getValueAsDate(MetaFieldFactory.lookup("object"), 0));
    }

    @Test
    public void testGetValueAsBooleanVector() {
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.VECTOR_BOOLEAN, false);
        metaFields.addMetaField(field1);

        boolean[] values = { true, false };
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"), values, 0);
        assertEquals(
                Arrays.toString(values),
                Arrays.toString(rowset.getValueAsBooleanVector(
                        MetaFieldFactory.lookup("object"), 0)));
    }

    @Test
    public void testGetValueAsLongVector() {
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.VECTOR_INTEGER, false);
        metaFields.addMetaField(field1);

        long[] values = { 1, 2, 3 };
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"), values, 0);
        assertEquals(
                Arrays.toString(values),
                Arrays.toString(rowset.getValueAsLongVector(
                        MetaFieldFactory.lookup("object"), 0)));
    }

    @Test
    public void testGetValueAsDecimalVector() {
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.VECTOR_DECIMAL, false);
        metaFields.addMetaField(field1);

        double[] values = { 1.1, 2.1, 3.1 };
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"), values, 0);
        assertEquals(
                Arrays.toString(values),
                Arrays.toString(rowset.getValueAsDecimalVector(
                        MetaFieldFactory.lookup("object"), 0)));
    }

    @Test
    public void testGetValueAsDateVector() {
        Date[] values = { new Date(0), new Date(1) };
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.VECTOR_DATE, false);
        metaFields.addMetaField(field1);

        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"), values, 0);
        assertArrayEquals(values, rowset.getValueAsDateVector(
                MetaFieldFactory.lookup("object"), 0));
    }

    @Test
    public void testGetValueAsTextVector() {
        MetaField field1 = MetaFieldFactory.create("object", "Test",
                MetaFieldType.VECTOR_TEXT, false);
        metaFields.addMetaField(field1);

        String[] values = { "one", "two" };
        DataRowSet rowset = new DataRowSet(metaFields);
        rowset.addValueAtRow(MetaFieldFactory.lookup("object"), values, 0);
        assertArrayEquals(values, rowset.getValueAsTextVector(
                MetaFieldFactory.lookup("object"), 0));
    }

    @Test
    public void testGetValueAsTextKeyField() {
        DataRowSet rowset = new DataRowSet(metaFields);
        MetaField field1 = MetaFieldFactory.create("key", "Test",
                MetaFieldType.SCALAR_TEXT, false);
        MetaField field2 = MetaFieldFactory.create("num", "Test",
                MetaFieldType.SCALAR_INTEGER, false);

        rowset.addValueAtRow(field1, "jake1", 0);
        rowset.addValueAtRow(field2, 1L, 0);
        DataRow row = rowset.getRowForKeyField(MetaFieldFactory.lookup("key"),
                "jake1");
        assertEquals("jake1",
                row.getValueAsText(MetaFieldFactory.lookup("key")));
        assertEquals(1L, row.getValueAsLong(MetaFieldFactory.lookup("num")));
    }

    @Test(expected = IllegalArgumentException.class)
    public void testGetValueAsTextKeyFieldNonexistant() {
        DataRowSet rowset = new DataRowSet(metaFields);
        MetaField field1 = MetaFieldFactory.create("key", "Test",
                MetaFieldType.SCALAR_TEXT, false);
        MetaField field2 = MetaFieldFactory.create("num", "Test",
                MetaFieldType.SCALAR_INTEGER, false);

        rowset.addValueAtRow(field1, "jake1", 0);
        rowset.addValueAtRow(field2, 1L, 0);
        assertNull(rowset.getRowForKeyField(MetaFieldFactory.lookup("key"),
                "jake2"));
    }

    @Test(expected = IllegalArgumentException.class)
    public void testGetRowForKeyFieldWithNonkey() {
        DataRowSet rowset = new DataRowSet(metaFields);
        MetaField field1 = MetaFieldFactory.create("key", "Test",
                MetaFieldType.SCALAR_TEXT, true);
        MetaField field2 = MetaFieldFactory.create("num", "Test",
                MetaFieldType.SCALAR_INTEGER, false);

        for (int i = 0; i < 10; i++) {
            rowset.addValueAtRow(field1, "key" + i, i);
            rowset.addValueAtRow(field2, i, i);
        }
        rowset.getRowForKeyField(field2, "key3");
    }

    @Test
    public void testGetRowForKeyField() {
        DataRowSet rowset = new DataRowSet(metaFields);
        MetaField field1 = MetaFieldFactory.create("key", "Test",
                MetaFieldType.SCALAR_TEXT, true);
        MetaField field2 = MetaFieldFactory.create("num", "Test",
                MetaFieldType.SCALAR_INTEGER, false);

        for (int i = 0; i < 10; i++) {
            rowset.addValueAtRow(field1, "key" + i, i);
            rowset.addValueAtRow(field2, i, i);
        }
        DataRow row = rowset.getRowForKeyField(field1, "key3"); // 4th row
        assertEquals("key3", row.getValueAsText(field1));
        assertEquals(3L, row.getValueAsLong(field2));
        assertFalse(rowset.isNestedRowSet());
    }

    @Test
    public void testMerge() {
        Metadata metadata1 = Metadata.from(keyMeta);
        Metadata metadata2 = Metadata.from(nameMeta);
        DataRowSet rowset1 = new DataRowSet(metadata1);
        DataRowSet rowset2 = new DataRowSet(metadata2);
        rowset1.addValueAtRow(keyMeta, "text1", 0);
        rowset2.addValueAtRow(nameMeta, "name1", 0);
        assertEquals(1, rowset1.getRows().size());
        assertEquals(1, rowset2.getRows().size());
        rowset1.merge(rowset2);
        assertEquals(2, rowset1.getRows().size());
        assertEquals(1, rowset2.getRows().size());
    }
}


text:
"""
Script that creates CSV files from a directory of USNO tables.

The script assumes that every file in the input directory is either a
rise/set table or an altitude/azimuth table. It creates two CSV files,
one named "USNO Rise Set Data.csv" and the other named
"USNO Altitude Azimuth Data.csv".
"""

import csv
import datetime
import os

import vesper.ephem.usno_table_utils as utils

_DATA_DIR_PATH = r'C:\Users\Harold\Desktop\NFC\Data'
_TABLES_DIR_PATH = os.path.join(_DATA_DIR_PATH, 'USNO Tables Test')
_RS_CSV_FILE_PATH = os.path.join(_DATA_DIR_PATH, 'USNO Rise Set Data.csv')
_AA_CSV_FILE_PATH = os.path.join(
    _DATA_DIR_PATH, 'USNO Altitude Azimuth Data.csv')
_RS_COLUMN_NAMES = (
    'Latitude', 'Longitude', 'Local Date', 'Event', 'UTC Time')
_AA_COLUMN_NAMES = (
    'Latitude', 'Longitude', 'UTC Time', 'Body', 'Altitude', 'Azimuth',
    'Illumination')
_RS_TABLE_TYPES = frozenset(utils.RISE_SET_TABLE_TYPES)
_AA_TABLE_TYPES = frozenset(utils.ALTITUDE_AZIMUTH_TABLE_TYPES)

def _main():

    rs_file, rs_writer = _open_csv_file(_RS_CSV_FILE_PATH, _RS_COLUMN_NAMES)
    aa_file, aa_writer = _open_csv_file(_AA_CSV_FILE_PATH, _AA_COLUMN_NAMES)

    for (dir_path, _, file_names) in os.walk(_TABLES_DIR_PATH):

        for file_name in file_names:

            table = _create_table(dir_path, file_name)

            if table.type in _RS_TABLE_TYPES:
                _append_rs_table_data(table, rs_writer)
            else:
                _append_aa_table_data(table, aa_writer)

            print(file_name, table.type)

    rs_file.close()
    aa_file.close()

def _open_csv_file(file_path, column_names):
    file_ = open(file_path, 'w', newline='')
    writer = csv.writer(file_)
    writer.writerow(column_names)
    return (file_, writer)

def _create_table(dir_path, file_name):

    file_name_table_type = file_name.split('_')[0]
    table_type = utils.get_table_type(file_name_table_type)
    table_class = utils.get_table_class(table_type)

    file_path = os.path.join(dir_path, file_name)
    with open(file_path, 'r') as file_:
        table_text = file_.read()
    return table_class(table_text)

_RISE_EVENTS = {
    'Sunrise/Sunset': 'Sunrise',
    'Moonrise/Moonset': 'Moonrise',
    'Civil Twilight': 'Civil Dawn',
    'Nautical Twilight': 'Nautical Dawn',
    'Astronomical Twilight': 'Astronomical Dawn'
}

_SET_EVENTS = {
    'Sunrise/Sunset': 'Sunset',
    'Moonrise/Moonset': 'Moonset',
    'Civil Twilight': 'Civil Dusk',
    'Nautical Twilight': 'Nautical Dusk',
    'Astronomical Twilight': 'Astronomical Dusk'
}

def _append_rs_table_data(table, writer):

    rows = []

    lat = table.lat
    lon = table.lon

    event = _RISE_EVENTS[table.type]
    _append_rows(rows, lat, lon, event, table.rising_times)

    event = _SET_EVENTS[table.type]
    _append_rows(rows, lat, lon, event, table.setting_times)

    writer.writerows(rows)

def _append_rows(rows, lat, lon, event, times):
    for dt in times:
        local_dt = _get_naive_local_time(dt, lon)
        date = local_dt.date()
        time = dt.strftime('%Y-%m-%d %H:%M')
        rows.append((lat, lon, date, event, time))

def _get_naive_local_time(time, lon):
    utc_offset = datetime.timedelta(hours=lon * 24. / 360.)
    return (time + utc_offset).replace(tzinfo=None)

def _append_aa_table_data(table, writer):

    rows = []

    lat = table.lat
    lon = table.lon
    body = table.body

    for data in table.data:

        if table.body == 'Sun':
            (time, alt, az) = data
            illumination = None
        else:
            (time, alt, az, illumination) = data

        time = time.strftime('%Y-%m-%d %H:%M')

        rows.append((lat, lon, time, body, alt, az, illumination))

    writer.writerows(rows)

if __name__ == '__main__':
    _main()


text:
package com.tsukaby.bean_validation_scala

import org.hibernate.validator.constraints.Mod10Check

import scala.annotation.meta.field

class Mod10CheckValidatorForOptionSpec extends BaseSpec {

  private[this] case class TestBean(
                                     @(Mod10Check@field)
                                     value: Option[String]
                                     )

  Seq(
    (TestBean(Some("00000001")), 1),
    (TestBean(Some("00000000")), 0)
  ) foreach { case (bean, expected) =>
    s"Check violations count. bean = $bean, count = $expected" >> {
      test(bean, expected)
    }
  }
}


text:
namespace blink {

static const float replacementTextRoundedRectHeight = 18;
static const float replacementTextRoundedRectLeftRightTextMargin = 6;
static const float replacementTextRoundedRectOpacity = 0.20f;
static const float replacementTextRoundedRectRadius = 5;
static const float replacementTextTextOpacity = 0.55f;

static Font replacementTextFont()
{
    FontDescription fontDescription;
    LayoutTheme::theme().systemFont(CSSValueWebkitSmallControl, fontDescription);
    fontDescription.setWeight(FontWeightBold);
    fontDescription.setComputedSize(fontDescription.specifiedSize());
    Font font(fontDescription);
    font.update(nullptr);
    return font;
}

void EmbeddedObjectPainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
    if (!m_layoutEmbeddedObject.showsUnavailablePluginIndicator())
        return;

    if (paintInfo.phase == PaintPhaseSelection)
        return;

    GraphicsContext* context = paintInfo.context;
    if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layoutEmbeddedObject, paintInfo.phase))
        return;

    FloatRect contentRect = m_layoutEmbeddedObject.contentBoxRect();
    contentRect.moveBy(roundedIntPoint(paintOffset));
    LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutEmbeddedObject, paintInfo.phase, contentRect);
    GraphicsContextStateSaver stateSaver(*context);
    context->clip(contentRect);

    Font font = replacementTextFont();
    // TODO(trchen): Speculative fix for crbug.com/481880
    // With last resort font, how could this ever be null?
    ASSERT(font.primaryFont());
    if (!font.primaryFont())
        return;
    TextRun textRun(m_layoutEmbeddedObject.unavailablePluginReplacementText());
    FloatSize textGeometry(font.width(textRun), font.fontMetrics().height());

    FloatRect backgroundRect(0, 0, textGeometry.width() + 2 * replacementTextRoundedRectLeftRightTextMargin, replacementTextRoundedRectHeight);
    backgroundRect.move(contentRect.center() - backgroundRect.center());
    Path roundedBackgroundRect;
    roundedBackgroundRect.addRoundedRect(backgroundRect, FloatSize(replacementTextRoundedRectRadius, replacementTextRoundedRectRadius));
    context->setFillColor(scaleAlpha(Color::white, replacementTextRoundedRectOpacity));
    context->fillPath(roundedBackgroundRect);

    FloatRect textRect(FloatPoint(), textGeometry);
    textRect.move(contentRect.center() - textRect.center());
    TextRunPaintInfo runInfo(textRun);
    runInfo.bounds = backgroundRect;
    context->setFillColor(scaleAlpha(Color::black, replacementTextTextOpacity));
    context->drawBidiText(font, runInfo, textRect.location() + FloatSize(0, font.fontMetrics().ascent()));
}

} // namespace blink


text:
#ifndef HK_DISPLACEMENT_MAPPING_UTIL_H
#define HK_DISPLACEMENT_MAPPING_UTIL_H

#include <Common/GeometryUtilities/Mesh/hkMeshTexture.h>

/// Utility class that computes per-vertex dominant displacements to be used in displacement mapping.
class hkDisplacementMappingUtil
{
	public:

		HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_SCENE_DATA, hkDisplacementMappingUtil);

		typedef hkMeshTexture::RawBufferDescriptor Descriptor;

	public:

		/// Per-vertex dominant info
		class DominantInfo
		{
			public:

				HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_SCENE_DATA, hkDisplacementMappingUtil::DominantInfo);

			public:

				/// Constructor
				HK_FORCE_INLINE DominantInfo();

				/// Retrieves the normal
				HK_FORCE_INLINE void getNormal(hkVector4& nrmOut) const;

				/// Sets the displacement normal. The normal is assumed normalized and will be encoded to just 2 components, .xy
				HK_FORCE_INLINE void setNormal(hkVector4Parameter n);

				/// Gets / sets the displacement amount, i.e. a factor in [0, 1] used to scale the displacement normal
				HK_FORCE_INLINE const hkSimdReal getDisplacement() const;
				HK_FORCE_INLINE void setDisplacement(hkSimdRealParameter d);

				/// Gets / sets the interpolation factor between the two displacement maps
				HK_FORCE_INLINE const hkSimdReal getBlendFactor() const;
				HK_FORCE_INLINE void setBlendFactor(hkSimdRealParameter f);

				/// Returns the uv for the i-th map
				HK_FORCE_INLINE void getUv(int mapIdx, hkVector4& uvOut) const;

				/// Sets the displacement map uv
				template <int I>
				HK_FORCE_INLINE void setUv(hkVector4Parameter uv);

				/// Sets the displacement map uv
				HK_FORCE_INLINE void setUv(int mapIdx, hkVector4Parameter uv);

				/// Gets the displacement vector
				HK_FORCE_INLINE void getDisplacementVector(hkVector4& dOut) const;

				/// Sets the displacement vector (i.e. n = normalize(vD), d = length(vD)). The normal is considered null if its length is under the given tol.
				HK_FORCE_INLINE void setDisplacementVector(hkVector4Parameter vD, hkSimdRealParameter tol);

				/// Permutes the displacement maps
				HK_FORCE_INLINE void permuteDisplacementMaps();

				/// Loads the values from a buffer
				HK_FORCE_INLINE void load(const void* buffer);

			protected:

				/// Displacement map uv.
				hkVector4f m_data0;	///< [uv0.x, uv0.y, uv1.x, uv1.y]

				/// Normalized displacement direction in .xyz.
				hkVector4f m_data1;	///< [normal.x, normal.y, mapBlendFactor, displacementAmount]
		};

		/// Dominants buffer
		class DominantsBuffer
		{
			public:

				HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_SCENE_DATA, hkDisplacementMappingUtil::DominantsBuffer);

			public:

				/// Constructor
				DominantsBuffer();

				/// Destructor
				virtual ~DominantsBuffer();

			public:

				/// Allocates a buffer for N dominants
				void alloc(int numDominants);

				/// Creates and returns the texture
				hkMeshTexture* realize(hkMeshSystem* meshSystem);

				/// Returns the I-th element
				HK_FORCE_INLINE DominantInfo& operator[](int i);
				HK_FORCE_INLINE const DominantInfo& operator[](int i) const;

			protected:

				hkUint8* m_data;					///< Buffer data
				hkRefPtr<hkMeshTexture> m_texture;	///< The texture
		};

	public:

		/// Returns the displacement map set on the given material
		static hkMeshTexture* HK_CALL getDisplacementMap(const hkMeshMaterial* mtl);

		/// Returns the dominants map set on the given material
		static hkMeshTexture* HK_CALL getDominantsMap(const hkMeshMaterial* mtl);

		/// Sets the given dominants map on the given material
		static void HK_CALL setDominantsMap(hkMeshMaterial* mtl, hkMeshTexture* dominantsMap);

		/// Sets the I-th displacement map on the given material to the given texture
		static void HK_CALL setDisplacementMap(int i, hkMeshMaterial* mtl, hkMeshTexture* displacementMap);

		/// Clones a material without preserving the name
		static hkMeshMaterial* HK_CALL duplicateMaterial(hkMeshSystem* meshSystem, const hkMeshMaterial* src);
};

#include <Common/GeometryUtilities/Mesh/Utils/DisplacementMappingUtil/hkDisplacementMappingUtil.inl>

#endif	// HK_DISPLACEMENT_MAPPING_UTIL_H

/*
 * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20140907)
 *
 * Confidential Information of Havok.  (C) Copyright 1999-2014
 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
 * Logo, and the Havok buzzsaw logo are trademarks of Havok.  Title, ownership
 * rights, and intellectual property rights in the Havok software remain in
 * Havok and/or its suppliers.
 *
 * Use of this software for evaluation purposes is subject to and indicates
 * acceptance of the End User licence Agreement for this product. A copy of
 * the license is included with this software and is also available at www.havok.com/tryhavok.
 *
 */


text:
<?php
	declare(strict_types=1);

	namespace Framework\Syscrack\Game\Softwares;

	/**
	 * Lewis Lancaster 2017
	 *
	 * Class VWarez
	 *
	 * @package Framework\Syscrack\Game\Softwares
	 */

	use Framework\Syscrack\Game\Bases\BaseSoftware;

	/**
	 * Class VWarez
	 * @package Framework\Syscrack\Game\Softwares
	 */
	class VWarez extends BaseSoftware
	{

		/**
		 * The configuration of this Structure
		 *
		 * @return array
		 */

		public function configuration()
		{

			return [
				'uniquename' => 'vwarez',
				'extension' => '.vwarez',
				'type' => 'virus',
				'installable' => true,
				'uninstallable' => true,
				'executable' => false,
				'removable' => false
			];
		}
	}


text:
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { syncHistoryWithStore, routerReducer } from 'react-router-redux'
import { createStore, combineReducers, applyMiddleware, compose } from 'redux'
import { browserHistory, Router, Route, IndexRoute, IndexRedirect } from 'react-router'

import thunk from 'redux-thunk'

import syncMiddleware from './middleware/Sync'

import * as reducers from './reducers'

const URLSearchParams = require('url-search-params')

export const store = createStore(
    combineReducers({
        ...reducers,
        routing: routerReducer
    }),
    compose(applyMiddleware(

        store => next => action => Promise.resolve(action).then(next),

        thunk,

        syncMiddleware({
            baseURL: apiBaseUrl,
        }),

    ), window.devToolsExtension ? window.devToolsExtension() : f => f),
)

import * as AppActions from 'actions/App'
import * as TopicActions from 'actions/Topics'

const history = syncHistoryWithStore(browserHistory, store);

import App from './App'
import Home from 'containers/Home'
import Subscriptions from 'containers/Subscriptions'
import SubscriptionLanding from 'containers/Subscriptions/Landing'
import SubscriptionFeed from 'containers/Subscriptions/Feed'
import GetStarted from 'containers/GetStarted'

const loading = store.dispatch(AppActions.init())
    .then(
        () => store.dispatch(AppActions.loaded()),
        () => {

            const qs = new URLSearchParams(window.location.search)
            if (qs.has('auth')) {

                localStorage.setItem('id', qs.get('id'))
                localStorage.setItem('token', qs.get('jwt'))
                localStorage.setItem('email', qs.get('email'))

                if (localStorage.getItem('topics')) {
                    store.dispatch(TopicActions.follow(
                        localStorage.getItem('topics').split(',')
                    ))
                    localStorage.removeItem('topics')
                    window.location.reload()
                } else {
                    window.location.reload()
                }

            } else {

                store.dispatch(AppActions.loaded())
                browserHistory.replace('/app/getting-started')

            }

        }
)

const isReady = (nextState, replace, callback) => {
    loading.then(res => {
        if (nextState.location.pathname == '/app') {
            replace('/app/personalization-feed')
        }
        return callback()
    }, () => {
        replace('/app/getting-started')
        return callback()
    })
}

const renderApp = () => {

    render((
        <Provider store={store}>
            <Router history={history}>
                <Route path="/app/getting-started" component={GetStarted} onEnter={isReady} />
                <Route path="/app" component={App} onEnter={isReady}>
                    <Route path="personalization-feed" component={Home}/>
                    <Route path="subscriptions" component={Subscriptions}>
                        <IndexRoute component={SubscriptionLanding} />
                        <Route path=":id" component={SubscriptionFeed} />
                    </Route>
                </Route>
            </Router>
        </Provider>
    ), document.getElementById('root'))

}

loading.then(
    () => renderApp(),
    (err) => {
        console.warn(err)
        renderApp()
    }
)


text:
@implementation WireFormatTests

- (void) testSerialization {
  TestAllTypes* message = [TestUtilities allSet];

  NSData* rawBytes = message.data;
  XCTAssertTrue(rawBytes.length == message.serializedSize, @"");

  TestAllTypes* message2 = [TestAllTypes parseFromData:rawBytes];

  [TestUtilities assertAllFieldsSet:message2];
}

- (void) testSerializationPacked {
  TestPackedTypes* message = [TestUtilities packedSet];

  NSData* rawBytes = message.data;
  XCTAssertTrue(rawBytes.length == message.serializedSize, @"");

  TestPackedTypes* message2 = [TestPackedTypes parseFromData:rawBytes];

  [TestUtilities assertPackedFieldsSet:message2];
}

- (void) testSerializeExtensions {
  // TestAllTypes and TestAllExtensions should have compatible wire formats,
  // so if we serealize a TestAllExtensions then parse it as TestAllTypes
  // it should work.

  TestAllExtensions* message = [TestUtilities allExtensionsSet];
  NSData* rawBytes = message.data;
  XCTAssertTrue(rawBytes.length == message.serializedSize, @"");

  TestAllTypes* message2 = [TestAllTypes parseFromData:rawBytes];

  [TestUtilities assertAllFieldsSet:message2];
}

- (void) testSerializePackedExtensions {
  // TestPackedTypes and TestPackedExtensions should have compatible wire
  // formats; check that they serialize to the same string.
  TestPackedExtensions* message = [TestUtilities packedExtensionsSet];
  NSData* rawBytes = message.data;

  TestPackedTypes* message2 = [TestUtilities packedSet];
  NSData* rawBytes2 = message2.data;

  XCTAssertEqualObjects(rawBytes, rawBytes2, @"");
}

- (void) testParseExtensions {
  // TestAllTypes and TestAllExtensions should have compatible wire formats,
  // so if we serealize a TestAllTypes then parse it as TestAllExtensions
  // it should work.

  TestAllTypes* message = [TestUtilities allSet];
  NSData* rawBytes = message.data;

  PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry];
  [TestUtilities registerAllExtensions:registry];

  TestAllExtensions* message2 =
  [TestAllExtensions parseFromData:rawBytes extensionRegistry:registry];

  [TestUtilities assertAllExtensionsSet:message2];
}

- (void) testExtensionsSerializedSize {
  XCTAssertTrue([TestUtilities allSet].serializedSize == [TestUtilities allExtensionsSet].serializedSize, @"");
}

- (void) testParsePackedExtensions {
  // Ensure that packed extensions can be properly parsed.
  TestPackedExtensions* message = [TestUtilities packedExtensionsSet];
  NSData* rawBytes = message.data;

  PBExtensionRegistry* registry = [TestUtilities extensionRegistry];

  TestPackedExtensions* message2 =
  [TestPackedExtensions parseFromData:rawBytes extensionRegistry:registry];

  [TestUtilities assertPackedExtensionsSet:message2];
}

- (void) assertFieldsInOrder:(NSData*) data {
  PBCodedInputStream* input = [PBCodedInputStream streamWithData:data];
  SInt32 previousTag = 0;

  while (YES) {
    SInt32 tag = [input readTag];
    if (tag == 0) {
      break;
    }

    XCTAssertTrue(tag > previousTag, @"");
    [input skipField:tag];
  }
}

@end