text:
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'ruby-jmeter'

test do
  defaults domain: 'example.com',
      protocol: 'https',
      download_resources: true,
      use_concurrent_pool: 5,
      urls_must_match: 'http.+?example.com'
end.run(path: '/usr/share/jmeter/bin/', gui: true)


text:
class DropboxUploader < Formula
  desc "Bash script for interacting with Dropbox"
  homepage "http://www.andreafabrizi.it/?dropbox_uploader"
  url "https://github.com/andreafabrizi/Dropbox-Uploader/archive/0.16.tar.gz"
  sha256 "738aebdb57f75e9033cb9bb319b14fe1c3b471f951180acb48631e9810ebf1c3"

  bottle :unneeded

  def install
    bin.install "dropbox_uploader.sh"
  end

  test do
    (testpath/".dropbox_uploader").write <<-EOS.undent
      APPKEY=a
      APPSECRET=b
      ACCESS_LEVEL=sandbox
      OAUTH_ACCESS_TOKEN=c
      OAUTH_ACCESS_TOKEN_SECRET=d
    EOS
    pipe_output("#{bin}/dropbox_uploader.sh unlink", "y\n")
  end
end

redpajama_set_name: RedPajamaGithub


text:
#pragma once
#include <cstdint>
#include <immintrin.h>

struct nn_workload_item;
struct nn_device_internal;

namespace int16_fixedpoint
{
    typedef void(*FActiveFCShift)(void *, __m256i, __m256i, uint8_t);

    void run_multithreaded_fully_connected_fixedpoint_work_item(nn_workload_item *const work_item, nn_device_internal* device);
} //namespace device_int16


text:
<?php

namespace UIFI\ProductosBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Libro
 *
 * @ORM\Table("otra_publicacion_divulgativa")
 * @ORM\Entity(repositoryClass="UIFI\ProductosBundle\Repository\OtraPublicacionDivulgativaRepository")
 */
class OtraPublicacionDivulgativa
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="titulo", type="string", length=10000)
     */
    private $titulo;

    /**
     * @var string
     *
     * @ORM\Column(name="pais", type="string", length=255,nullable=true)
     */
    private $pais;

    /**
     * @var string
     *
     * @ORM\Column(name="anual", type="string", length=255,nullable=true)
     */
    private $anual;

    /**
     * @var string
     *
     * @ORM\Column(name="isbn", type="string", length=255)
     */
    private $isbn;
    /**
     * Volumen de libro
     *
     * @ORM\Column(name="tipo", type="string", length=50,nullable=true)
     */
    private $tipo;
    /**
     * Volumen de libro
     *
     * @ORM\Column(name="volumen", type="string", length=20,nullable=true)
     */
    private $volumen;

    /**
     * Numero de pagians que tiene el libro publicado
     *
     * @ORM\Column(name="paginas", type="string", length=20,nullable=true)
     */
    private $paginas;

    /**
     * Numero de pagians que tiene el libro publicado
     *
     * @ORM\Column(name="editorial", type="string", nullable=true)
     */
    private $editorial;
    /**
     * Codigo del grupo en el cual fue publicado el articulo
     *
     * @ORM\Column(name="grupo", type="string", length=255)
     */
    private $grupo;
    /**
     * @var string
     *
     * @ORM\Column(name="nombre_grupo", type="string", length=255)
     */
    private $nombreGrupo;
    /**
     * Integrantes de un grupo de un investigación que publicaron el Libro
     *
     * @ORM\ManyToMany(targetEntity="UIFI\IntegrantesBundle\Entity\Integrante", mappedBy="libros")
    */
    private $integrantes;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->integrantes = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set titulo
     *
     * @param string $titulo
     * @return OtraPublicacionDivulgativa
     */
    public function setTitulo($titulo)
    {
        $this->titulo = $titulo;

        return $this;
    }

    /**
     * Get titulo
     *
     * @return string
     */
    public function getTitulo()
    {
        return $this->titulo;
    }

    /**
     * Set pais
     *
     * @param string $pais
     * @return OtraPublicacionDivulgativa
     */
    public function setPais($pais)
    {
        $this->pais = $pais;

        return $this;
    }

    /**
     * Get pais
     *
     * @return string
     */
    public function getPais()
    {
        return $this->pais;
    }

    /**
     * Set anual
     *
     * @param string $anual
     * @return OtraPublicacionDivulgativa
     */
    public function setAnual($anual)
    {
        $this->anual = $anual;

        return $this;
    }

    /**
     * Get anual
     *
     * @return string
     */
    public function getAnual()
    {
        return $this->anual;
    }

    /**
     * Set isbn
     *
     * @param string $isbn
     * @return OtraPublicacionDivulgativa
     */
    public function setIsbn($isbn)
    {
        $this->isbn = $isbn;

        return $this;
    }

    /**
     * Get isbn
     *
     * @return string
     */
    public function getIsbn()
    {
        return $this->isbn;
    }

    /**
     * Set tipo
     *
     * @param string $tipo
     * @return OtraPublicacionDivulgativa
     */
    public function setTipo($tipo)
    {
        $this->tipo = $tipo;

        return $this;
    }

    /**
     * Get tipo
     *
     * @return string
     */
    public function getTipo()
    {
        return $this->tipo;
    }

    /**
     * Set volumen
     *
     * @param string $volumen
     * @return OtraPublicacionDivulgativa
     */
    public function setVolumen($volumen)
    {
        $this->volumen = $volumen;

        return $this;
    }

    /**
     * Get volumen
     *
     * @return string
     */
    public function getVolumen()
    {
        return $this->volumen;
    }

    /**
     * Set paginas
     *
     * @param string $paginas
     * @return OtraPublicacionDivulgativa
     */
    public function setPaginas($paginas)
    {
        $this->paginas = $paginas;

        return $this;
    }

    /**
     * Get paginas
     *
     * @return string
     */
    public function getPaginas()
    {
        return $this->paginas;
    }

    /**
     * Set editorial
     *
     * @param string $editorial
     * @return OtraPublicacionDivulgativa
     */
    public function setEditorial($editorial)
    {
        $this->editorial = $editorial;

        return $this;
    }

    /**
     * Get editorial
     *
     * @return string
     */
    public function getEditorial()
    {
        return $this->editorial;
    }

    /**
     * Set grupo
     *
     * @param string $grupo
     * @return OtraPublicacionDivulgativa
     */
    public function setGrupo($grupo)
    {
        $this->grupo = $grupo;

        return $this;
    }

    /**
     * Get grupo
     *
     * @return string
     */
    public function getGrupo()
    {
        return $this->grupo;
    }

    /**
     * Set nombreGrupo
     *
     * @param string $nombreGrupo
     * @return OtraPublicacionDivulgativa
     */
    public function setNombreGrupo($nombreGrupo)
    {
        $this->nombreGrupo = $nombreGrupo;

        return $this;
    }

    /**
     * Get nombreGrupo
     *
     * @return string
     */
    public function getNombreGrupo()
    {
        return $this->nombreGrupo;
    }

    /**
     * Add integrantes
     *
     * @param \UIFI\IntegrantesBundle\Entity\Integrante $integrantes
     * @return OtraPublicacionDivulgativa
     */
    public function addIntegrante(\UIFI\IntegrantesBundle\Entity\Integrante $integrantes)
    {
        $this->integrantes[] = $integrantes;

        return $this;
    }

    /**
     * Remove integrantes
     *
     * @param \UIFI\IntegrantesBundle\Entity\Integrante $integrantes
     */
    public function removeIntegrante(\UIFI\IntegrantesBundle\Entity\Integrante $integrantes)
    {
        $this->integrantes->removeElement($integrantes);
    }

    /**
     * Get integrantes
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getIntegrantes()
    {
        return $this->integrantes;
    }
}


text:
package MARC::File;

=head1 NAME

MARC::File - Base class for files of MARC records

=cut

use strict;
use warnings;
use integer;

use vars qw( $ERROR );

=head1 SYNOPSIS

    use MARC::File::USMARC;

    # If you have weird control fields...
    use MARC::Field;
    MARC::Field->allow_controlfield_tags('FMT', 'LDX');

    my $file = MARC::File::USMARC->in( $filename );

    while ( my $marc = $file->next() ) {
        # Do something
    }
    $file->close();
    undef $file;

=head1 EXPORT

None.

=head1 METHODS

=head2 in()

Opens a file for import. Ordinarily you will use C<MARC::File::USMARC>
or C<MARC::File::MicroLIF> to do this.

    my $file = MARC::File::USMARC->in( 'file.marc' );

Returns a C<MARC::File> object, or C<undef> on failure. If you
encountered an error the error message will be stored in
C<$MARC::File::ERROR>.

Optionally you can also pass in a filehandle, and C<MARC::File>.
will "do the right thing".

    my $handle = IO::File->new( 'gunzip -c file.marc.gz |' );
    my $file = MARC::File::USMARC->in( $handle );

=cut

sub in {
    my $class = shift;
    my $arg = shift;
    my ( $filename, $fh );

    ## if a valid filehandle was passed in
    my $ishandle = do { no strict; defined fileno($arg); };
    if ( $ishandle ) {
        $filename = scalar( $arg );
        $fh = $arg;
    }

    ## otherwise check if it's a filename, and
    ## return undef if we weren't able to open it
    else {
        $filename = $arg;
        $fh = eval { local *FH; open( FH, '<', $arg ) or die; *FH{IO}; };
        if ( $@ ) {
            $MARC::File::ERROR = "Couldn't open $filename: $@";
            return;
        }
    }

    my $self = {
        filename    => $filename,
        fh          => $fh,
        recnum      => 0,
        warnings    => [],
    };

    return( bless $self, $class );

} # new()

sub out {
    die "Not yet written";
}

=head2 next( [\&filter_func] )

Reads the next record from the file handle passed in.

The C<$filter_func> is a reference to a filtering function.  Currently,
only USMARC records support this.  See L<MARC::File::USMARC>'s C<decode()>
function for details.

Returns a MARC::Record reference, or C<undef> on error.

=cut

sub next {
    my $self = shift;
    $self->{recnum}++;
    my $rec = $self->_next() or return;
    return $self->decode($rec, @_);
}

=head2 skip()

Skips over the next record in the file.  Same as C<next()>,
without the overhead of parsing a record you're going to throw away
anyway.

Returns 1 or undef.

=cut

sub skip {
    my $self = shift;
    my $rec = $self->_next() or return;
    return 1;
}

=head2 warnings()

Simlilar to the methods in L<MARC::Record> and L<MARC::Batch>,
C<warnings()> will return any warnings that have accumulated while
processing this file; and as a side-effect will clear the warnings buffer.

=cut

sub warnings {
    my $self = shift;
    my @warnings = @{ $self->{warnings} };
    $self->{warnings} = [];
    return(@warnings);
}

=head2 close()

Closes the file, both from the object's point of view, and the actual file.

=cut

sub close {
    my $self = shift;
    close( $self->{fh} );
    delete $self->{fh};
    delete $self->{filename};
    return;
}

sub _unimplemented {
    my $self = shift;
    my $method = shift;
    warn "Method $method must be overridden";
}

=head2 write()

Writes a record to the output file.  This method must be overridden
in your subclass.

=head2 decode()

Decodes a record into a USMARC format.  This method must be overridden
in your subclass.

=cut

sub write   { $_[0]->_unimplemented("write"); }
sub decode  { $_[0]->_unimplemented("decode"); }

# NOTE: _warn must be called as an object method

sub _warn {
    my ($self,$warning) = @_;
    push( @{ $self->{warnings} }, "$warning in record ".$self->{recnum} );
    return( $self );
}

# NOTE: _gripe can be called as an object method, or not.  Your choice.
# NOTE: it's use is now deprecated use _warn instead
sub _gripe {
    my @parms = @_;
    if ( @parms ) {
        my $self = shift @parms;

        if ( ref($self) =~ /^MARC::File/ ) {
            push( @parms, " at byte ", tell($self->{fh}) )
                if $self->{fh};
            push( @parms, " in file ", $self->{filename} ) if $self->{filename};
        } else {
            unshift( @parms, $self );
        }

        $ERROR = join( "", @parms );
        warn $ERROR;
    }

    return;
}

1;

__END__

=head1 RELATED MODULES

L<MARC::Record>

=head1 TODO

=over 4

=item * C<out()> method

We only handle files for input right now.

=back

=cut

=head1 LICENSE

This code may be distributed under the same terms as Perl itself.

Please note that these modules are not products of or supported by the
employers of the various contributors to the code.

=head1 AUTHOR

Andy Lester, C<< <andy@petdance.com> >>

=cut


text:
import React from 'react';
import DrawerRoute from './Drawer';
import fetch from '../../core/fetch';

export default {

  path: '/drawer',

  async action() {
    return <DrawerRoute />;
  },

};


text:
layout: walkthrough
title:  "Viewing Derivatives - Part 9 - Walkthrough of GeoConcerns"
date:   2016-09-14 15:08:00
categories: tutorial
author: 'Darren Hardy'
author_link: 'https://github.com/drh-stanford'
snippet: 'Creating a GeoConcerns vector work automatically creates a variety of deriviative files. Created as part of a tutorial series given as Walkthrough of GeoConcerns'
---

## View Derivatives
  1. Thumbnail
  1. Display Vector
  1. GeoServer
  1. GeoBlacklight Metadata

### Thumbnail

Once you create a Vector Work and add a Shapefile to it, the thumbnail for the vector data is automatically created. It's viewable in the Summary page and directly downloadable from Fedora.

![Summary with thumbnail](/images/VectorFileSet_Summary.png)

![Direct access to thumbnail](/images/VectorFileSet_Thumbnail.png)

## Display Vector

A display derivative is a derivative produced by GeoConcerns for loading into external software such as Geoserver. These derivatives can be used to visualize the dataset in a web mapping applications like OpenLayers and Leaflet. Datasets are re-projected into WGS 84 and converted into a standard file format. Geoblacklight makes use of display derivatives for previewing data.

The vector data are also projected into a standard projection (EPSG:4326) and saved as a Shapefile.

![Direct download to Display Vector](/images/VectorFileSet_DisplayVector.png)

## GeoServer

This Display Vector is then uploaded and registered into your GeoServer catalog.

![GeoServer Workspaces](/images/GeoServer_DataMenu.png)

You will need to create two workspaces: "public" and "restricted". Login as `admin` with password `geoserver` to [http://localhost:8181/geoserver](http://localhost:8181/geoserver)

![GeoServer Workspaces](/images/GeoServer_Workspaces.png)

There's a new Data Store that holds your Display Vector Shapefile:

![GeoServer Workspaces](/images/GeoServer_DataStores.png)

There's a new Layer that renders the Vector data in your Data Store:

![GeoServer Workspaces](/images/GeoServer_Layers.png)

You can also preview your Vector data:

![GeoServer Workspaces](/images/GeoServer_VectorView.png)

## GeoBlacklight Metadata

Finally, if you modify the Vector Work URL by adding `/geoblacklight` to it, you will
receive your metadata as a GeoBlacklight Schema document that you can ingest into your GeoBlacklight instance.

![GeoBlacklight Export](/images/VectorWork_GeoBlacklight.png)

## Geoblacklight

The works you created in GeoConcerns should now be available to view in the included Geoblacklight application. [http://localhost:3001](http://localhost:3001)

![Geoblacklight](/images/geoblacklight.png)


text:
import sys

try:
  PATH = sys.argv[1]
except:
  raise Exception("Not enough arguments provided.")
PATH2 = None
if len(sys.argv) == 3:
  PATH2 = sys.argv[2]

class PageyFile (object):
  def __init__(self, filepath, to_name):
    self.filepath = filepath
    self.to_name = to_name

    opened = open(filepath, "r")
    self.file_contents = opened.read()
    opened.close()

    self.lines = self.file_contents.splitlines()

  def generate(self):
    self.markdown = ""

    for line in self.lines:
      if line != "":
        formatted = self.get(line)
        self.markdown += (formatted + "\n")
      else:
        self.markdown += "\n"

    if self.to_name != None:
      opened = open(self.to_name, "w")
      opened.write(self.markdown)
      opened.close()
    else:
      opened = open(self.filepath, "w")
      opened.write(self.markdown)
      opened.close()

  def get(self, line):
    part1 = line.split("{")
    part1[1] = part1[1][:-1]
    TYPE = part1[0]
    CONTENT = part1[1]

    if TYPE == "title":
      return "# " + CONTENT
    elif TYPE == "paragraph":
      return CONTENT
    elif TYPE == "subtitle":
      return "## " + CONTENT
    else:
      raise Exception("Unknown Markdown format \""+TYPE+"\"")

newFile = PageyFile(PATH, PATH2)
#print(newFile.lines)
newFile.generate()


text:
#ifndef	__TESTCALLER_H__
#define	__TESTCALLER_H__

typedef struct __TestFixture	TestFixture;
typedef struct __TestFixture*	TestFixtureRef;/*downward compatible*/

struct __TestFixture {
	char *name;
	void(*test)(void);
};

#define new_TestFixture(name,test)\
	{\
		name,\
		test,\
	}

typedef struct __TestCaller		TestCaller;
typedef struct __TestCaller*	TestCallerRef;/*downward compatible*/

struct __TestCaller {
	TestImplement* isa;
	char *name;
	void(*setUp)(void);
	void(*tearDown)(void);
	int numberOfFixtuers;
	TestFixture	*fixtuers;
};

extern const TestImplement TestCallerImplement;

#define new_TestCaller(name,sup,tdw,numberOfFixtuers,fixtuers)\
	{\
		(TestImplement*)&TestCallerImplement,\
		name,\
		sup,\
		tdw,\
		numberOfFixtuers,\
		fixtuers,\
	}

#endif/*__TESTCALLER_H__*/


text:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<TITLE>CLHS: Function APPEND</TITLE>
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="The Harlequin Group Limited">
<LINK REL=TOP HREF="../FrontMatter/index.html">
<LINK REL=COPYRIGHT HREF="../FrontMatter/About-HyperSpec.html#Legal">
<LINK REL=DISCLAIMER HREF="../FrontMatter/About-HyperSpec.html#Disclaimer">
<LINK REL=PREV HREF="fun_nconc.html">
<LINK REL=UP HREF="sec_the_conses_dictionary.html">
<LINK REL=NEXT HREF="fun_revappendcm_nreconc.html">

Function APPEND

Syntax:

append <TT>&rest</TT> lists => result

Arguments and Values:

 list---each must be a proper list except the last, which may be any object.

result---an object. This will be a list unless the last list was not a list and all preceding lists were null.

Description:

append returns a new list that is the concatenation of the copies. lists are left unchanged; the list structure of each of lists except the last is copied. The last argument is not copied; it becomes the cdr of the final dotted pair of the concatenation of the preceding lists, or is returned directly if there are no preceding non-empty lists.

Examples:

 (append '(a b c) '(d e f) '() '(g)) =>  (A B C D E F G)
 (append '(a b c) 'd) =>  (A B C . D)
 (setq lst '(a b c)) =>  (A B C)
 (append lst '(d)) =>  (A B C D)
 lst =>  (A B C)
 (append) =>  NIL
 (append 'a) =>  A

</TT>

Affected By: None.

Exceptional Situations: None.

See Also:

nconc, concatenate

Notes: None.

The following X3J13 cleanup issue, not part of the specification, applies to this section:

 DOTTED-LIST-ARGUMENTS:CLARIFY

Copyright 1996, The Harlequin Group Limited.  All Rights Reserved.


text:
package org.cytoscape.d3.internal.writer;

import java.io.OutputStream;

import org.cytoscape.io.CyFileFilter;
import org.cytoscape.io.write.CyNetworkViewWriterFactory;
import org.cytoscape.io.write.CyWriter;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.view.model.CyNetworkView;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Create Writers for given data type (View or Network)
 *
 */
public class D3NetworkWriterFactory implements CyNetworkViewWriterFactory {

	private final CyFileFilter filter;
	private final ObjectMapper mapper;

	public D3NetworkWriterFactory(final CyFileFilter filter, final ObjectMapper mapper) {
		this.filter = filter;
		this.mapper = mapper;
	}

	@Override
	public CyWriter createWriter(OutputStream outputStream, CyNetworkView view) {
		return new D3NetworkViewWriter(outputStream, view, mapper);
	}

	@Override
	public CyWriter createWriter(OutputStream outputStream, CyNetwork network) {
		return new D3NetworkWriter(outputStream, network, mapper);
	}

	@Override
	public CyFileFilter getFileFilter() {
		return filter;
	}
}


text:
package de.wicketxforms.formcontrols.core;

import java.util.Objects;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import de.wicketxforms.DomUtil;
import de.wicketxforms.formcontrols.XFormsCssClass;

/**
 * The Wicket component representing an XForms output element.
 *
 * @see 8.1.5 The output Element
 * @author Karl Scheel
 */
class OutputControlPanel extends Panel {

  private static final long serialVersionUID = 1L;

  private Component outputElement;

  OutputControlPanel(String wicketID, OutputControl outputControl) {

    super(wicketID);
    addControlSpecificComponents(outputControl);
  }

  protected void addControlSpecificComponents(OutputControl outputControl) {

    boolean hasLabel   = DomUtil.isFirstChildLabel(outputControl.getFormControlNode());
    String typeBinding = outputControl.getTypeBinding();
    String fragmentMarkupId;

    // choose fragment depending on the controls type binding
    if ("xsd:boolean".equals(typeBinding))
      fragmentMarkupId = hasLabel ? "outputFragment_withLabel_boolean"
                                  : "outputFragment_noLabel_boolean";
    else
      fragmentMarkupId = hasLabel ? "outputFragment_withLabel_string"
                                  : "outputFragment_noLabel_string";

    Fragment outputContainer = new Fragment("output", fragmentMarkupId, this);
    outputControl.applyStyleAttributes(outputContainer);

    if (hasLabel) {

      Component label = outputControl.createLabelComponent("label");
      outputContainer.add(label);
    }

    outputElement = createOutputElement(outputControl.getBfDataValue(), typeBinding);
    outputContainer.add(outputElement);
    outputContainer.add(outputControl.createRedrawBehavior(outputContainer));

    add(outputContainer);
  }

  private Component createOutputElement(String modelValue, String typeBinding) {

    Component outputElement;

    if ("xsd:boolean".equals(typeBinding)) {

      IModel<Boolean> valueModel = Model.of(Boolean.valueOf(modelValue));
      outputElement = new CheckBox("outputValue", valueModel);
      outputElement.setEnabled(false);

    } else
      outputElement = new Label("outputValue", Model.of(modelValue));

    outputElement.add(new AttributeModifier("class", XFormsCssClass.PS_VALUE));

    return outputElement;
  }

  /**
   * Updates the Model of the component displaying the value of this inputControl. Does not trigger
   * a redraw of the component.
   * A Redraw will be triggered if this method returns true.
   *
   * @param newValue
   *          The new value to set.
   *
   * @return {@code true}, if newValue differed from the previous Value.
   */
  public boolean updateModelValue(String newValue) {

    Object oldModelObject = outputElement.getDefaultModelObject();

    // Bei einer Checkbox muss der ModelObject-Typ Boolean sein
    Object newModelObject = (oldModelObject instanceof Boolean)
                            ? Boolean.valueOf(newValue)
                            : newValue;

    if (!Objects.equals(oldModelObject, newModelObject)) {

      outputElement.setDefaultModelObject(newModelObject);
      System.out.println("new value: [" + newValue + "]\n"); // TODO dbg log
      return true;
    }

    return false;
  }
}


text:
set -e
source /build/buildconfig
source /etc/environment
set -x

## Install background_worker runit service.
mkdir /etc/service/background_worker
cp /build/runit/background_worker /etc/service/background_worker/run
touch /etc/service/background_worker/down


text:
package org.datanucleus.samples.array;

/**
 * Container of a double array.
 *
 * @version $Revision: 1.2 $
 */
public class DoubleArray implements ArrayHolderInterface
{
    long id;
    double[] array1;
    double[] array2;

    public DoubleArray(double[] elements1, double[] elements2)
    {
        this.array1 = elements1;
        this.array2 = elements2;
    }

    public Object getArray1()
    {
        return array1;
    }
    public Object getArray2()
    {
        return array2;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>cds: cds::intrusive::cuckoo::striping< RecursiveLock, Arity, Alloc, Stat > Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

cds
    1.4.0

Main Page

Modules

Namespaces

Data Structures

Files

Data Structures

Class Hierarchy

Data Fields

cds

intrusive

cuckoo

striping

Public Types |
Public Member Functions |
Static Public Attributes

cds::intrusive::cuckoo::striping< RecursiveLock, Arity, Alloc, Stat > Class Template Reference

Lock striping concurrent access policy.
 More...

#include <cds/intrusive/cuckoo_set.h>

Public Types

typedef RecursiveLock 	lock_type

 	lock type

typedef Alloc 	allocator_type

 	allocator type

typedef Stat 	statistics_type

 	Internal statistics type (striping_stat or empty_striping_stat)

typedef cds::lock::array

< lock_type,

cds::lock::pow2_select_policy,

allocator_type > 	lock_array_type

 	lock array type

Public Member Functions

 	striping (size_t nLockCount)

 	Constructor.  More...

size_t 	lock_count () const

 	Returns lock array size.  More...

constexpr unsigned int 	arity () const noexcept()

 	Returns the arity of striping mutex policy.

statistics_type const & 	statistics () const

 	Returns internal statistics.

Static Public Attributes

static unsigned int const 	c_nArity = Arity

 	the arity

Detailed Description

template<class RecursiveLock = cds_std::recursive_mutex, unsigned int Arity = 2, class Alloc = CDS_DEFAULT_ALLOCATOR, class Stat = empty_striping_stat>

class cds::intrusive::cuckoo::striping< RecursiveLock, Arity, Alloc, Stat >

Lock striping concurrent access policy.

This is one of available opt::mutex_policy option type for CuckooSet

Lock striping is very simple technique. The cuckoo set consists of the bucket tables and the array of locks. There is single lock array for each bucket table, at least, the count of bucket table is 2. Initially, the capacity of lock array and each bucket table is the same. When set is resized, bucket table capacity will be doubled but lock array will not. The lock i protects each bucket j, where  j = i mod L , where L - the size of lock array.

The policy contains an internal array of RecursiveLock locks.

Template arguments:

RecursiveLock - the type of recursive mutex. The default is cds_std::recursive_mutex. The mutex type should be default-constructible. Note that a recursive spin-lock is not suitable for lock striping for performance reason.

Arity - unsigned int constant that specifies an arity. The arity is the count of hash functors, i.e., the count of lock arrays. Default value is 2.

Alloc - allocator type used for lock array memory allocation. Default is CDS_DEFAULT_ALLOCATOR.

Stat - internal statistics type. Note that this template argument is automatically selected by CuckooSet class according to its opt::stat option.

Constructor & Destructor Documentation

template<class RecursiveLock  = cds_std::recursive_mutex, unsigned int Arity = 2, class Alloc  = CDS_DEFAULT_ALLOCATOR, class Stat  = empty_striping_stat>

          cds::intrusive::cuckoo::striping< RecursiveLock, Arity, Alloc, Stat >::striping
          (
          size_t
          nLockCount	)

inline

Constructor.

Parameters

nLockCount	The size of lock array. Must be power of two.

Member Function Documentation

template<class RecursiveLock  = cds_std::recursive_mutex, unsigned int Arity = 2, class Alloc  = CDS_DEFAULT_ALLOCATOR, class Stat  = empty_striping_stat>

          size_t cds::intrusive::cuckoo::striping< RecursiveLock, Arity, Alloc, Stat >::lock_count
          (
          	)
           const

inline

Returns lock array size.

Lock array size is unchanged during striping object lifetime

The documentation for this class was generated from the following file:

cds/intrusive/cuckoo_set.h

			cds 1.4.0
			Developed by Maxim Khiszinsky aka khizmax 2007 - 2012

			Autogenerated Mon May 20 2013 00:38:00 by Doxygen 1.8.3.1


text:
package org.apache.coyote.http11;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

import org.apache.coyote.Request;
import org.apache.tomcat.util.buf.MessageBytes;

public abstract class AbstractNioInputBuffer<S> extends AbstractInputBuffer<S> {

    // -------------------------------------------------------------- Constants

    enum HeaderParseStatus {
        DONE, HAVE_MORE_HEADERS, NEED_MORE_DATA
    }

    enum HeaderParsePosition {
        /**
         * Start of a new header. A CRLF here means that there are no more
         * headers. Any other character starts a header name.
         */
        HEADER_START,
        /**
         * Reading a header name. All characters of header are HTTP_TOKEN_CHAR.
         * Header name is followed by ':'. No whitespace is allowed.<br />
         * Any non-HTTP_TOKEN_CHAR (this includes any whitespace) encountered
         * before ':' will result in the whole line being ignored.
         */
        HEADER_NAME,
        /**
         * Skipping whitespace before text of header value starts, either on the
         * first line of header value (just after ':') or on subsequent lines
         * when it is known that subsequent line starts with SP or HT.
         */
        HEADER_VALUE_START,
        /**
         * Reading the header value. We are inside the value. Either on the
         * first line or on any subsequent line. We come into this state from
         * HEADER_VALUE_START after the first non-SP/non-HT byte is encountered
         * on the line.
         */
        HEADER_VALUE,
        /**
         * Before reading a new line of a header. Once the next byte is peeked,
         * the state changes without advancing our position. The state becomes
         * either HEADER_VALUE_START (if that first byte is SP or HT), or
         * HEADER_START (otherwise).
         */
        HEADER_MULTI_LINE,
        /**
         * Reading all bytes until the next CRLF. The line is being ignored.
         */
        HEADER_SKIPLINE
    }

    // ----------------------------------------------------------- Constructors

    /**
     * Alternate constructor.
     */
    public AbstractNioInputBuffer(Request request, int headerBufferSize) {

        this.request = request;
        headers = request.getMimeHeaders();

        this.headerBufferSize = headerBufferSize;

        filterLibrary = new InputFilter[0];
        activeFilters = new InputFilter[0];
        lastActiveFilter = -1;

        parsingHeader = true;
        parsingRequestLine = true;
        parsingRequestLinePhase = 0;
        parsingRequestLineEol = false;
        parsingRequestLineStart = 0;
        parsingRequestLineQPos = -1;
        headerParsePos = HeaderParsePosition.HEADER_START;
        headerData.recycle();
        swallowInput = true;

    }

    /**
     * Parsing state - used for non blocking parsing so that
     * when more data arrives, we can pick up where we left off.
     */
    private boolean parsingRequestLine;
    private int parsingRequestLinePhase = 0;
    private boolean parsingRequestLineEol = false;
    private int parsingRequestLineStart = 0;
    private int parsingRequestLineQPos = -1;
    private HeaderParsePosition headerParsePos;

    /**
     * Maximum allowed size of the HTTP request line plus headers plus any
     * leading blank lines.
     */
    protected final int headerBufferSize;

    /**
     * Known size of the NioChannel read buffer.
     */
    protected int socketReadBufferSize;

    // --------------------------------------------------------- Public Methods

    /**
     * Recycle the input buffer. This should be called when closing the
     * connection.
     */
    @Override
    public void recycle() {
        super.recycle();
        headerParsePos = HeaderParsePosition.HEADER_START;
        parsingRequestLine = true;
        parsingRequestLinePhase = 0;
        parsingRequestLineEol = false;
        parsingRequestLineStart = 0;
        parsingRequestLineQPos = -1;
        headerData.recycle();
    }

    /**
     * End processing of current HTTP request.
     * Note: All bytes of the current request should have been already
     * consumed. This method only resets all the pointers so that we are ready
     * to parse the next HTTP request.
     */
    @Override
    public void nextRequest() {
        super.nextRequest();
        headerParsePos = HeaderParsePosition.HEADER_START;
        parsingRequestLine = true;
        parsingRequestLinePhase = 0;
        parsingRequestLineEol = false;
        parsingRequestLineStart = 0;
        parsingRequestLineQPos = -1;
        headerData.recycle();
    }

    /**
     * Read the request line. This function is meant to be used during the
     * HTTP request header parsing. Do NOT attempt to read the request body
     * using it.
     *
     * @throws IOException If an exception occurs during the underlying socket
     * read operations, or if the given buffer is not big enough to accommodate
     * the whole line.
     * @return true if data is properly fed; false if no data is available
     * immediately and thread should be freed
     */
    @Override
    public boolean parseRequestLine(boolean useAvailableDataOnly)
        throws IOException {

        //check state
        if ( !parsingRequestLine ) return true;
        //
        // Skipping blank lines
        //
        if ( parsingRequestLinePhase < 2 ) {
            byte chr = 0;
            do {

                // Read new bytes if needed
                if (pos >= lastValid) {
                    if (useAvailableDataOnly) {
                        return false;
                    }
                    // Do a simple read with a short timeout
                    if (!fill(false)) {
                        // A read is pending, so no longer in initial state
                        parsingRequestLinePhase = 1;
                        return false;
                    }
                }
                // Set the start time once we start reading data (even if it is
                // just skipping blank lines)
                if (request.getStartTime() < 0) {
                    request.setStartTime(System.currentTimeMillis());
                }
                chr = buf[pos++];
            } while ((chr == Constants.CR) || (chr == Constants.LF));
            pos--;

            parsingRequestLineStart = pos;
            parsingRequestLinePhase = 2;
            if (getLog().isDebugEnabled()) {
                getLog().debug("Received ["
                        + new String(buf, pos, lastValid - pos,
                                StandardCharsets.ISO_8859_1)
                        + "]");
            }
        }
        if ( parsingRequestLinePhase == 2 ) {
            //
            // Reading the method name
            // Method name is always US-ASCII
            //
            boolean space = false;
            while (!space) {
                // Read new bytes if needed
                if (pos >= lastValid) {
                    if (!fill(false)) //request line parsing
                        return false;
                }
                // Spec says no CR or LF in method name
                if (buf[pos] == Constants.CR || buf[pos] == Constants.LF) {
                    throw new IllegalArgumentException(
                            sm.getString("iib.invalidmethod"));
                }
                if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
                    space = true;
                    request.method().setBytes(buf, parsingRequestLineStart, pos - parsingRequestLineStart);
                }
                pos++;
            }
            parsingRequestLinePhase = 3;
        }
        if ( parsingRequestLinePhase == 3 ) {
            // Spec says single SP but also be tolerant of multiple and/or HT
            boolean space = true;
            while (space) {
                // Read new bytes if needed
                if (pos >= lastValid) {
                    if (!fill(false)) //request line parsing
                        return false;
                }
                if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
                    pos++;
                } else {
                    space = false;
                }
            }
            parsingRequestLineStart = pos;
            parsingRequestLinePhase = 4;
        }
        if (parsingRequestLinePhase == 4) {
            // Mark the current buffer position

            int end = 0;
            //
            // Reading the URI
            //
            boolean space = false;
            while (!space) {
                // Read new bytes if needed
                if (pos >= lastValid) {
                    if (!fill(false)) //request line parsing
                        return false;
                }
                if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
                    space = true;
                    end = pos;
                } else if ((buf[pos] == Constants.CR)
                           || (buf[pos] == Constants.LF)) {
                    // HTTP/0.9 style request
                    parsingRequestLineEol = true;
                    space = true;
                    end = pos;
                } else if ((buf[pos] == Constants.QUESTION)
                           && (parsingRequestLineQPos == -1)) {
                    parsingRequestLineQPos = pos;
                }
                pos++;
            }
            if (parsingRequestLineQPos >= 0) {
                request.queryString().setBytes(buf, parsingRequestLineQPos + 1,
                                               end - parsingRequestLineQPos - 1);
                request.requestURI().setBytes(buf, parsingRequestLineStart, parsingRequestLineQPos - parsingRequestLineStart);
            } else {
                request.requestURI().setBytes(buf, parsingRequestLineStart, end - parsingRequestLineStart);
            }
            parsingRequestLinePhase = 5;
        }
        if ( parsingRequestLinePhase == 5 ) {
            // Spec says single SP but also be tolerant of multiple and/or HT
            boolean space = true;
            while (space) {
                // Read new bytes if needed
                if (pos >= lastValid) {
                    if (!fill(false)) //request line parsing
                        return false;
                }
                if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
                    pos++;
                } else {
                    space = false;
                }
            }
            parsingRequestLineStart = pos;
            parsingRequestLinePhase = 6;

            // Mark the current buffer position
            end = 0;
        }
        if (parsingRequestLinePhase == 6) {
            //
            // Reading the protocol
            // Protocol is always US-ASCII
            //
            while (!parsingRequestLineEol) {
                // Read new bytes if needed
                if (pos >= lastValid) {
                    if (!fill(false)) //request line parsing
                        return false;
                }

                if (buf[pos] == Constants.CR) {
                    end = pos;
                } else if (buf[pos] == Constants.LF) {
                    if (end == 0)
                        end = pos;
                    parsingRequestLineEol = true;
                }
                pos++;
            }

            if ( (end - parsingRequestLineStart) > 0) {
                request.protocol().setBytes(buf, parsingRequestLineStart, end - parsingRequestLineStart);
            } else {
                request.protocol().setString("");
            }
            parsingRequestLine = false;
            parsingRequestLinePhase = 0;
            parsingRequestLineEol = false;
            parsingRequestLineStart = 0;
            return true;
        }
        throw new IllegalStateException("Invalid request line parse phase:"+parsingRequestLinePhase);
    }

    protected void expand(int newsize) {
        if ( newsize > buf.length ) {
            if (parsingHeader) {
                throw new IllegalArgumentException(
                        sm.getString("iib.requestheadertoolarge.error"));
            }
            // Should not happen
            getLog().warn("Expanding buffer size. Old size: " + buf.length
                    + ", new size: " + newsize, new Exception());
            byte[] tmp = new byte[newsize];
            System.arraycopy(buf,0,tmp,0,buf.length);
            buf = tmp;
        }
    }

    /**
     * Parse the HTTP headers.
     */
    @Override
    public boolean parseHeaders()
        throws IOException {
        if (!parsingHeader) {
            throw new IllegalStateException(
                    sm.getString("iib.parseheaders.ise.error"));
        }

        HeaderParseStatus status = HeaderParseStatus.HAVE_MORE_HEADERS;

        do {
            status = parseHeader();
            // Checking that
            // (1) Headers plus request line size does not exceed its limit
            // (2) There are enough bytes to avoid expanding the buffer when
            // reading body
            // Technically, (2) is technical limitation, (1) is logical
            // limitation to enforce the meaning of headerBufferSize
            // From the way how buf is allocated and how blank lines are being
            // read, it should be enough to check (1) only.
            if (pos > headerBufferSize
                    || buf.length - pos < socketReadBufferSize) {
                throw new IllegalArgumentException(
                        sm.getString("iib.requestheadertoolarge.error"));
            }
        } while ( status == HeaderParseStatus.HAVE_MORE_HEADERS );
        if (status == HeaderParseStatus.DONE) {
            parsingHeader = false;
            end = pos;
            return true;
        } else {
            return false;
        }
    }

    /**
     * Parse an HTTP header.
     *
     * @return false after reading a blank line (which indicates that the
     * HTTP header parsing is done
     */
    private HeaderParseStatus parseHeader()
        throws IOException {

        //
        // Check for blank line
        //

        byte chr = 0;
        while (headerParsePos == HeaderParsePosition.HEADER_START) {

            // Read new bytes if needed
            if (pos >= lastValid) {
                if (!fill(false)) {//parse header
                    headerParsePos = HeaderParsePosition.HEADER_START;
                    return HeaderParseStatus.NEED_MORE_DATA;
                }
            }

            chr = buf[pos];

            if (chr == Constants.CR) {
                // Skip
            } else if (chr == Constants.LF) {
                pos++;
                return HeaderParseStatus.DONE;
            } else {
                break;
            }

            pos++;

        }

        if ( headerParsePos == HeaderParsePosition.HEADER_START ) {
            // Mark the current buffer position
            headerData.start = pos;
            headerParsePos = HeaderParsePosition.HEADER_NAME;
        }

        //
        // Reading the header name
        // Header name is always US-ASCII
        //

        while (headerParsePos == HeaderParsePosition.HEADER_NAME) {

            // Read new bytes if needed
            if (pos >= lastValid) {
                if (!fill(false)) { //parse header
                    return HeaderParseStatus.NEED_MORE_DATA;
                }
            }

            chr = buf[pos];
            if (chr == Constants.COLON) {
                headerParsePos = HeaderParsePosition.HEADER_VALUE_START;
                headerData.headerValue = headers.addValue(buf, headerData.start, pos - headerData.start);
                pos++;
                // Mark the current buffer position
                headerData.start = pos;
                headerData.realPos = pos;
                headerData.lastSignificantChar = pos;
                break;
            } else if (!HTTP_TOKEN_CHAR[chr]) {
                // If a non-token header is detected, skip the line and
                // ignore the header
                headerData.lastSignificantChar = pos;
                return skipLine();
            }

            // chr is next byte of header name. Convert to lowercase.
            if ((chr >= Constants.A) && (chr <= Constants.Z)) {
                buf[pos] = (byte) (chr - Constants.LC_OFFSET);
            }
            pos++;
        }

        // Skip the line and ignore the header
        if (headerParsePos == HeaderParsePosition.HEADER_SKIPLINE) {
            return skipLine();
        }

        //
        // Reading the header value (which can be spanned over multiple lines)
        //

        while (headerParsePos == HeaderParsePosition.HEADER_VALUE_START ||
               headerParsePos == HeaderParsePosition.HEADER_VALUE ||
               headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE) {

            if ( headerParsePos == HeaderParsePosition.HEADER_VALUE_START ) {
                // Skipping spaces
                while (true) {
                    // Read new bytes if needed
                    if (pos >= lastValid) {
                        if (!fill(false)) {//parse header
                            //HEADER_VALUE_START
                            return HeaderParseStatus.NEED_MORE_DATA;
                        }
                    }

                    chr = buf[pos];
                    if (chr == Constants.SP || chr == Constants.HT) {
                        pos++;
                    } else {
                        headerParsePos = HeaderParsePosition.HEADER_VALUE;
                        break;
                    }
                }
            }
            if ( headerParsePos == HeaderParsePosition.HEADER_VALUE ) {

                // Reading bytes until the end of the line
                boolean eol = false;
                while (!eol) {

                    // Read new bytes if needed
                    if (pos >= lastValid) {
                        if (!fill(false)) {//parse header
                            //HEADER_VALUE
                            return HeaderParseStatus.NEED_MORE_DATA;
                        }
                    }

                    chr = buf[pos];
                    if (chr == Constants.CR) {
                        // Skip
                    } else if (chr == Constants.LF) {
                        eol = true;
                    } else if (chr == Constants.SP || chr == Constants.HT) {
                        buf[headerData.realPos] = chr;
                        headerData.realPos++;
                    } else {
                        buf[headerData.realPos] = chr;
                        headerData.realPos++;
                        headerData.lastSignificantChar = headerData.realPos;
                    }

                    pos++;
                }

                // Ignore whitespaces at the end of the line
                headerData.realPos = headerData.lastSignificantChar;

                // Checking the first character of the new line. If the character
                // is a LWS, then it's a multiline header
                headerParsePos = HeaderParsePosition.HEADER_MULTI_LINE;
            }
            // Read new bytes if needed
            if (pos >= lastValid) {
                if (!fill(false)) {//parse header
                    //HEADER_MULTI_LINE
                    return HeaderParseStatus.NEED_MORE_DATA;
                }
            }

            chr = buf[pos];
            if ( headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE ) {
                if ( (chr != Constants.SP) && (chr != Constants.HT)) {
                    headerParsePos = HeaderParsePosition.HEADER_START;
                    break;
                } else {
                    // Copying one extra space in the buffer (since there must
                    // be at least one space inserted between the lines)
                    buf[headerData.realPos] = chr;
                    headerData.realPos++;
                    headerParsePos = HeaderParsePosition.HEADER_VALUE_START;
                }
            }
        }
        // Set the header value
        headerData.headerValue.setBytes(buf, headerData.start,
                headerData.lastSignificantChar - headerData.start);
        headerData.recycle();
        return HeaderParseStatus.HAVE_MORE_HEADERS;
    }

    public int getParsingRequestLinePhase() {
        return parsingRequestLinePhase;
    }

    private HeaderParseStatus skipLine() throws IOException {
        headerParsePos = HeaderParsePosition.HEADER_SKIPLINE;
        boolean eol = false;

        // Reading bytes until the end of the line
        while (!eol) {

            // Read new bytes if needed
            if (pos >= lastValid) {
                if (!fill(false)) {
                    return HeaderParseStatus.NEED_MORE_DATA;
                }
            }

            if (buf[pos] == Constants.CR) {
                // Skip
            } else if (buf[pos] == Constants.LF) {
                eol = true;
            } else {
                headerData.lastSignificantChar = pos;
            }

            pos++;
        }
        if (getLog().isDebugEnabled()) {
            getLog().debug(sm.getString("iib.invalidheader", new String(buf,
                    headerData.start,
                    headerData.lastSignificantChar - headerData.start + 1,
                    StandardCharsets.ISO_8859_1)));
        }

        headerParsePos = HeaderParsePosition.HEADER_START;
        return HeaderParseStatus.HAVE_MORE_HEADERS;
    }

    private final HeaderParseData headerData = new HeaderParseData();
    public static class HeaderParseData {
        /**
         * When parsing header name: first character of the header.<br />
         * When skipping broken header line: first character of the header.<br />
         * When parsing header value: first character after ':'.
         */
        int start = 0;
        /**
         * When parsing header name: not used (stays as 0).<br />
         * When skipping broken header line: not used (stays as 0).<br />
         * When parsing header value: starts as the first character after ':'.
         * Then is increased as far as more bytes of the header are harvested.
         * Bytes from buf[pos] are copied to buf[realPos]. Thus the string from
         * [start] to [realPos-1] is the prepared value of the header, with
         * whitespaces removed as needed.<br />
         */
        int realPos = 0;
        /**
         * When parsing header name: not used (stays as 0).<br />
         * When skipping broken header line: last non-CR/non-LF character.<br />
         * When parsing header value: position after the last not-LWS character.<br />
         */
        int lastSignificantChar = 0;
        /**
         * MB that will store the value of the header. It is null while parsing
         * header name and is created after the name has been parsed.
         */
        MessageBytes headerValue = null;
        public void recycle() {
            start = 0;
            realPos = 0;
            lastSignificantChar = 0;
            headerValue = null;
        }
    }

}


text:
package org.apache.flink.api.scala.operators

import org.apache.flink.api.scala._
import org.apache.flink.api.common.functions.RichFilterFunction
import org.apache.flink.api.scala.util.CollectionDataSets
import org.apache.flink.configuration.Configuration
import org.apache.flink.core.fs.FileSystem.WriteMode
import org.apache.flink.test.util.MultipleProgramsTestBase.TestExecutionMode
import org.apache.flink.test.util.{TestBaseUtils, MultipleProgramsTestBase}

import org.junit.{Test, After, Before, Rule}
import org.junit.rules.TemporaryFolder
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

import scala.collection.JavaConverters._

@RunWith(classOf[Parameterized])
class FilterITCase(mode: TestExecutionMode) extends MultipleProgramsTestBase(mode) {
  private var resultPath: String = null
  private var expected: String = null
  private val _tempFolder = new TemporaryFolder()

  @Rule
  def tempFolder = _tempFolder

  @Before
  def before(): Unit = {
    resultPath = tempFolder.newFile().toURI.toString
  }

  @After
  def after(): Unit = {
    TestBaseUtils.compareResultsByLinesInMemory(expected, resultPath)
  }

  @Test
  def testAllRejectingFilter(): Unit = {
    /*
     * Test all-rejecting filter.
     */
    val env = ExecutionEnvironment.getExecutionEnvironment
    val ds = CollectionDataSets.get3TupleDataSet(env)
    val filterDs = ds.filter( t => false )
    filterDs.writeAsCsv(resultPath, writeMode = WriteMode.OVERWRITE)
    env.execute()
    expected = "\n"
  }

  @Test
  def testAllPassingFilter(): Unit = {
    /*
     * Test all-passing filter.
     */
    val env = ExecutionEnvironment.getExecutionEnvironment
    val ds = CollectionDataSets.get3TupleDataSet(env)
    val filterDs = ds.filter( t => true )
    filterDs.writeAsCsv(resultPath, writeMode = WriteMode.OVERWRITE)
    env.execute()
    expected = "1,1,Hi\n" + "2,2,Hello\n" + "3,2,Hello world\n" + "4,3,Hello world, " +
      "how are you?\n" + "5,3,I am fine.\n" + "6,3,Luke Skywalker\n" + "7,4," +
      "Comment#1\n" + "8,4,Comment#2\n" + "9,4,Comment#3\n" + "10,4,Comment#4\n" + "11,5," +
      "Comment#5\n" + "12,5,Comment#6\n" + "13,5,Comment#7\n" + "14,5,Comment#8\n" + "15,5," +
      "Comment#9\n" + "16,6,Comment#10\n" + "17,6,Comment#11\n" + "18,6,Comment#12\n" + "19," +
      "6,Comment#13\n" + "20,6,Comment#14\n" + "21,6,Comment#15\n"
  }

  @Test
  def testFilterOnStringTupleField(): Unit = {
    /*
     * Test filter on String tuple field.
     */
    val env = ExecutionEnvironment.getExecutionEnvironment
    val ds = CollectionDataSets.get3TupleDataSet(env)
    val filterDs = ds.filter( _._3.contains("world") )
    filterDs.writeAsCsv(resultPath, writeMode = WriteMode.OVERWRITE)
    env.execute()
    expected = "3,2,Hello world\n" + "4,3,Hello world, how are you?\n"
  }

  @Test
  def testFilterOnIntegerTupleField(): Unit = {
    /*
     * Test filter on Integer tuple field.
     */
    val env = ExecutionEnvironment.getExecutionEnvironment
    val ds = CollectionDataSets.get3TupleDataSet(env)
    val filterDs = ds.filter( _._1 % 2 == 0 )
    filterDs.writeAsCsv(resultPath, writeMode = WriteMode.OVERWRITE)
    env.execute()
    expected = "2,2,Hello\n" + "4,3,Hello world, how are you?\n" + "6,3,Luke Skywalker\n" + "8,4," +
      "Comment#2\n" + "10,4,Comment#4\n" + "12,5,Comment#6\n" + "14,5,Comment#8\n" + "16,6," +
      "Comment#10\n" + "18,6,Comment#12\n" + "20,6,Comment#14\n"
  }

  @Test
  def testFilterBasicType(): Unit = {
    /*
     * Test filter on basic type
     */
    val env = ExecutionEnvironment.getExecutionEnvironment
    val ds = CollectionDataSets.getStringDataSet(env)
    val filterDs = ds.filter( _.startsWith("H") )
    filterDs.writeAsText(resultPath, WriteMode.OVERWRITE)
    env.execute()
    expected = "Hi\n" + "Hello\n" + "Hello world\n" + "Hello world, how are you?\n"
  }

  @Test
  def testFilterOnCustomType(): Unit = {
    /*
     * Test filter on custom type
     */
    val env = ExecutionEnvironment.getExecutionEnvironment
    val ds = CollectionDataSets.getCustomTypeDataSet(env)
    val filterDs = ds.filter( _.myString.contains("a") )
    filterDs.writeAsText(resultPath, WriteMode.OVERWRITE)
    env.execute()
    expected = "3,3,Hello world, how are you?\n" + "3,4,I am fine.\n" + "3,5,Luke Skywalker\n"
  }

  @Test
  def testRichFilterOnStringTupleField(): Unit = {
    /*
     * Test filter on String tuple field.
     */
    val env = ExecutionEnvironment.getExecutionEnvironment
    val ints = CollectionDataSets.getIntDataSet(env)
    val ds = CollectionDataSets.get3TupleDataSet(env)
    val filterDs = ds.filter( new RichFilterFunction[(Int, Long, String)] {
      var literal = -1
      override def open(config: Configuration): Unit = {
        val ints = getRuntimeContext.getBroadcastVariable[Int]("ints")
        for (i <- ints.asScala) {
          literal = if (literal < i) i else literal
        }
      }
      override def filter(value: (Int, Long, String)): Boolean = value._1 < literal
    }).withBroadcastSet(ints, "ints")
    filterDs.writeAsCsv(resultPath, writeMode = WriteMode.OVERWRITE)
    env.execute()
    expected = "1,1,Hi\n" + "2,2,Hello\n" + "3,2,Hello world\n" + "4,3,Hello world, how are you?\n"
  }

}


text:
package com.kogimobile.android.baselibrary.app.base.recyclerview;

import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;

import java.util.Collections;

public abstract class BaseSwipableAdapter<T, H extends BaseAdapter.BaseViewHolder> extends BaseAdapter<T, H> {

    private int whereItemStartToMove;
    private int whereItemEndToMove;
    private boolean callbackMoved;
    private boolean callbackSwiped;
    private ItemTouchHelperAdapter<T> itemTouchHelperAdapter;

    public void setCallbackMoved(boolean callbackMoved) {
        this.callbackMoved = callbackMoved;
    }

    public void setCallbackSwiped(boolean callbackSwiped) {
        this.callbackSwiped = callbackSwiped;
    }

    public boolean isCallbackMoved() {
        return callbackMoved;
    }

    public boolean isCallbackSwiped() {
        return callbackSwiped;
    }

    private boolean changeItemsByPosition(int adapterPositionStart, int adapterPositionEnd) {
        if (isHeaderEnabled() && adapterPositionEnd == 0) {
            return false;
        }
        if (adapterPositionEnd > getItems().size()) {
            return false;
        }
        if (adapterPositionStart < adapterPositionEnd) {
            for (int i = getItemPosition(adapterPositionStart); i < getItemPosition(adapterPositionEnd); i++) {
                Collections.swap(getItems(), i, i + 1);
            }
        } else {
            for (int i = getItemPosition(adapterPositionStart); i > getItemPosition(adapterPositionEnd); i--) {
                Collections.swap(getItems(), i, i - 1);
            }
        }
        whereItemEndToMove = adapterPositionEnd;
        notifyItemMoved(adapterPositionStart, adapterPositionEnd);
        if (getItemTouchHelperAdapter() != null) {
            T itemFrom = getItems().get(getItemPosition(adapterPositionStart));
            T itemTarget = getItems().get(getItemPosition(adapterPositionEnd));
            getItemTouchHelperAdapter().onItemMoved(adapterPositionStart,
                    getItemPosition(adapterPositionStart),
                    itemFrom,
                    getItemPosition(adapterPositionEnd),
                    adapterPositionEnd,
                    itemTarget);
        }
        return true;
    }

    /**
     * Insert an item in list by position.
     *
     * @param position       is the position adapter of the items.
     * @param itemsToDismiss is the item that you previews remove
     */
    public void undoRemovedItem(int position, T itemsToDismiss) {
        addItemAtPosition(itemsToDismiss, position);
    }

    public boolean undoLastItemsChangesPosition() {
        return changeItemsByPosition(whereItemEndToMove, whereItemStartToMove);
    }

    public ItemTouchHelperAdapter<T> getItemTouchHelperAdapter() {
        return itemTouchHelperAdapter;
    }

    public void addItemTouchHelperAdapter(RecyclerView recyclerView, ItemTouchHelperAdapter<T> itemTouchHelperAdapter, boolean activeSwipe, boolean activeMove) {
        this.itemTouchHelperAdapter = itemTouchHelperAdapter;
        setCallbackMoved(activeMove);
        setCallbackSwiped(activeSwipe);
        ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback();
        ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
        touchHelper.attachToRecyclerView(recyclerView);
    }

    public interface ItemTouchHelperAdapter<T> {

        void onItemMoved(int fromAdapterPosition, int fromItemPosition, T itemOrigin, int toAdapterPosition, int toItemsPosition, T itemTarget);

        void onItemDismissed(int position, T item);
    }

    /**
     * Move Items
     */
    public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback {

        @Override
        public boolean isLongPressDragEnabled() {
            return true;
        }

        @Override
        public boolean isItemViewSwipeEnabled() {
            return true;
        }

        @Override
        public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
            int dragFlags = 0;
            if (isCallbackMoved()) {
                dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN;
            }
            int swipeFlags = 0;
            if (isCallbackSwiped()) {
                swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
            }
            if ((isHeaderEnabled() && viewHolder.getAdapterPosition() == 0)
                    || getItems().size() == 0) {
                return 0;
            }
            whereItemStartToMove = viewHolder.getAdapterPosition();
            return makeMovementFlags(dragFlags, swipeFlags);
        }

        @Override
        public boolean onMove(RecyclerView recyclerView,
                              RecyclerView.ViewHolder viewHolder,
                              RecyclerView.ViewHolder target) {
            return changeItemsByPosition(viewHolder.getAdapterPosition(),
                    target.getAdapterPosition());
        }

        @Override
        public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
            if (!(isHeaderEnabled() && viewHolder.getAdapterPosition() == 0)) {
                int position = getItemPosition(viewHolder.getAdapterPosition());
                T item = getItems().get(position);
                getItems().remove(position);
                notifyItemRemoved(position + headerViewCount());
                if (getItemTouchHelperAdapter() != null) {
                    getItemTouchHelperAdapter().onItemDismissed(position,
                            item);
                }
            }
        }
    }

}


text:
package org.dcm4chee.web.common.util;

import java.util.Calendar;

import org.apache.wicket.Component;
import org.joda.time.format.DateTimeFormat;

/**
 * @author Gunter Zeilinger <gunterze@gmail.com>
 * @version $Revision$ $Date$
 * @since Dec 19, 2008
 */
public class DateUtils {

    public static String da2str(String da) {
        if (da == null) {
            return null;
        }
        if (da.length() != 8) {
            return da;
        }
        StringBuilder sb = new StringBuilder(10);
        sb.append(da.substring(0, 4))
                .append('-')
                .append(da.substring(4, 6))
                .append('-')
                .append(da.substring(6));
        return sb.toString();
    }

    public static String str2da(String str) {
        String s = str.trim();
        if (s.length() != 10) {
            return s;
        }
        StringBuilder sb = new StringBuilder(8);
        sb.append(s.substring(0, 4))
                .append(s.substring(5, 7))
                .append(s.substring(8));
        return sb.toString();
    }

    public static String tm2str(String tm) {
        if (tm == null) {
            return null;
        }
        if (tm.length() < 4 || tm.charAt(2) == ':') {
            return tm;
        }
        StringBuilder sb = new StringBuilder(10);
        sb.append(tm.substring(0, 2))
                .append(':')
                .append(tm.substring(2, 4));
        if (tm.length() >= 6) {
            sb.append(':').append(tm.substring(4,6));
        }
        return sb.toString();
    }

    public static String str2tm(String str) {
        String s = str.trim();
        int colon = s.indexOf(':');
        if (colon == -1) {
            return s;
        }
        StringBuilder sb = new StringBuilder(s.length());
        int pos = 0;
        do {
            sb.append(s.substring(pos, colon));
            pos = colon + 1;
            colon = s.indexOf(':', pos);
        } while (colon != -1);
        sb.append(s.substring(pos));
        return sb.toString();
    }

    public static String datm2str(String da, String tm) {
        return da2str(da) + " " + tm2str(tm);
    }

    public static String[] str2datm(String str) {
        String s = str.trim();
        int space = s.indexOf(' ');
        String[] datm = new String[2];
        if (space == -1) {
            datm[0] = str2da(s);
        } else {
            datm[0] = str2da(s.substring(0, space));
            datm[1] = str2tm(s.substring(space+1).trim());
        }
        return datm;
    }

    public static String getDatePattern(Component c) {
        String pattern = DateTimeFormat.patternForStyle("S-", c.getLocale());
        int pos1 = pattern.indexOf('y');
        if (pos1 != -1) {
            if (pattern.length() <= pos1+2) {
                pattern = pattern + "yy";
            } else if ( pattern.charAt(pos1+2)!='y') {
                pattern = pattern.substring(0,pos1)+"yyyy"+pattern.substring(pos1+2);
            }
        }
        return pattern;
    }

    public static void setTimeToMinOrMax(Calendar cal, boolean max) {
        if (max) {
            cal.set(Calendar.HOUR_OF_DAY, 23);
            cal.set(Calendar.MINUTE, 59);
            cal.set(Calendar.SECOND, 59);
            cal.set(Calendar.MILLISECOND, 999);
        } else {
            cal.set(Calendar.HOUR_OF_DAY, 0);
            cal.set(Calendar.MINUTE, 0);
            cal.set(Calendar.SECOND, 0);
            cal.set(Calendar.MILLISECOND, 0);
        }
    }

}


text:
<?php

declare(strict_types=1);

namespace WildPHP\Core\Connection\Replay\Replies;

use WildPHP\Core\Connection\MessageParser;

abstract class BaseReply implements ReplyInterface
{
    /**
     * @var callable
     */
    protected $callback;

    public function process(string $msg): void
    {
        $parsed = MessageParser::parseLine($msg);
        call_user_func($this->callback, $parsed);
    }
}


text:
package io.seldon.client.beans;

import org.springframework.stereotype.Component;

@Component
public class DimensionBean extends ResourceBean {
    private static final long serialVersionUID = -3726021428982495025L;

    private int dimId;
    private int attr;
    private int val;
    private String attrName;
    private String valName;
    private double amount;
    private Integer itemType;

    public Integer getItemType() {
        return itemType;
    }

    public void setItemType(Integer itemType) {
        this.itemType = itemType;
    }

    public DimensionBean() {
    }

    public int getDimId() {
        return dimId;
    }

    public void setDimId(int dimId) {
        this.dimId = dimId;
    }

    public int getAttr() {
        return attr;
    }

    public void setAttr(int attr) {
        this.attr = attr;
    }

    public int getVal() {
        return val;
    }

    public void setVal(int val) {
        this.val = val;
    }

    public String getAttrName() {
        return attrName;
    }

    public void setAttrName(String attrName) {
        this.attrName = attrName;
    }

    public String getValName() {
        return valName;
    }

    public void setValName(String valName) {
        this.valName = valName;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    @Override
    public String toString() {
        return "DimensionBean{" +
                "dimId=" + dimId +
                ", attr=" + attr +
                ", val=" + val +
                ", attrName='" + attrName + '\'' +
                ", valName='" + valName + '\'' +
                ", amount=" + amount +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof DimensionBean)) return false;

        DimensionBean that = (DimensionBean) o;

        if (Double.compare(that.amount, amount) != 0) return false;
        if (attr != that.attr) return false;
        if (dimId != that.dimId) return false;
        if (val != that.val) return false;
        if (attrName != null ? !attrName.equals(that.attrName) : that.attrName != null) return false;
        if (itemType != null ? !itemType.equals(that.itemType) : that.itemType != null) return false;
        if (valName != null ? !valName.equals(that.valName) : that.valName != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = dimId;
        result = 31 * result + attr;
        result = 31 * result + val;
        result = 31 * result + (attrName != null ? attrName.hashCode() : 0);
        result = 31 * result + (valName != null ? valName.hashCode() : 0);
        temp = amount != +0.0d ? Double.doubleToLongBits(amount) : 0L;
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + (itemType != null ? itemType.hashCode() : 0);
        return result;
    }
}


text:
<?php
namespace Think\Upload\Driver;
use Symfony\Component\ClassLoader\UniversalClassLoader;

require_once __DIR__.'/libs/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php';

$loader = new UniversalClassLoader();

$loader->registerNamespaces(array(
    'Guzzle\\Common' => __DIR__.'/libs/guzzle/common',
    'Guzzle\\Parser' => __DIR__.'/libs/guzzle/parser',
    'Guzzle\\Plugin' => __DIR__.'/libs/guzzle/plugin',
    'Guzzle\\Stream' => __DIR__.'/libs/guzzle/stream',
    'Guzzle\\Http' => __DIR__.'/libs/guzzle/http',
    'Symfony\\Component\\EventDispatcher' => __DIR__.'/libs/symfony/event-dispatcher',
    'Symfony\\Component\\ClassLoader' => __DIR__.'/libs/symfony/class-loader',
    'Aliyun' => __DIR__.'/src',
));

$loader->register();


text:
module ProductMutationHelper
  VALUE_FIELD_BY_PRICING_STRATEGY = {
    'fixed' => :fixed_value,
    'scheduled_value' => :scheduled_value,
    'pay_what_you_want' => :pay_what_you_want_value
  }

  def coerce_pricing_structure_input(input)
    return nil unless input

    value_field = VALUE_FIELD_BY_PRICING_STRATEGY.fetch(input[:pricing_strategy])
    PricingStructure.new(pricing_strategy: input[:pricing_strategy], value: input[value_field])
  end

  def create_or_update_variants(product, product_variants_fields)
    (product_variants_fields || []).each_with_index do |product_variant_fields, i|
      product_variant_attrs = product_variant_fields.merge(position: i + 1)
      variant_id = product_variant_attrs.delete(:id)
      product_variant_attrs[:override_pricing_structure] =
        coerce_pricing_structure_input(product_variant_fields[:override_pricing_structure])

      if variant_id
        variant = product.product_variants.find { |v| v.id.to_s == variant_id }
        variant.update!(product_variant_attrs)
      else
        product.product_variants.create!(product_variant_attrs)
      end
    end
  end
end


text:
layout: platform
category: platforms
title: "State GeoNode"
keywords:
thumbnail_150: "stategeonode_thumbnail_150px.png"
thumbnail_300: "stategeonode_thumbnail_700px.png"
refurl: "http://geonode.state.gov"
---
All open data published by the Humanitarian Information Unit is available on [State GeoNode](http://geonode.state.gov).  The State GeoNode is a digital service provided by the U.S. Department of State for publishing open geographic data produced by or compiled by the U.S. Government to the public, U.S. Government decision-makers, and partners on complex emergencies, natural disasters, and diplomatic activities world-wide.


text:
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/rpgcollab');
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId;

// Setup Database scheme

var UserSchema = new Schema({
    name:String,
    bio:String
});

var CommentSchema = new Schema({
    text:String,
    author: UserSchema,
    date:Date
})

var ProjectSchema = new Schema({
    name: String,
    subtitle: String,
    creator: UserSchema,
    contributors: [UserSchema],
    summary: String,
    description: String,
    comments: [CommentSchema],
    created: {type: Date, default: Date.now()},
    private: {type: Boolean, default: false},
    meta: {
        votes: Number,
        favs: Number
    }
}
);

var User = mongoose.model('User', UserSchema);
var Project = mongoose.model('Project', ProjectSchema);

// Setup test data

var user1 = new User({name:'atla', bio:'recrational game developer loving oldschool RPGs'});
var user2 = new User({name:'hexoor', bio:'D&D fan'});

var project1 = new Project ();

project1.name = 'Leihwelt Reboot 2';
project1.subtitle = 'Gonna try it again!';
project1.creator = user1;
project1.comments = [
    {text:'Setting up the initial idea', author: user1, date: Date.now()},
    {text:'Some random comment', author: user1, date: Date.now()},
    {text:'This is gonna be good', author: user2, date: Date.now()},
    {text:'SHould be discussing this', author: user1, date: Date.now()},
]

project1.save(function (err){
    if (err){
        console.log(err);
    } else {
        console.log('project was saved');
    }
});

var project2 = new Project();

project2.name = "Minimal D&D";
project2.subtitle = "Bring back the spirit";
project2.creator = user2;

project2.save(function (err){
    if (err){
        console.log(err);
    } else {
        console.log('project was saved');
    }
});


text:
<!doctype html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <title>vis</title>
  <meta name="description" content="">
  <meta name="author" content="">

  <meta name="viewport" content="width=device-width,initial-scale=1">

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


text:
package com.itheima.b_factory_bean;

public interface UserService {

	public void addUser();
	public void updateUser();
	public void deleteUser();

}


text:
package grafica;

import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;
import javax.swing.JTextField;

import negozio.Carrello;
import negozio.Magazzino;
import negozio.Prodotto;

/**
 * ActionListener per l'aggiunta di un prodotto al carrello.
 *
 * @author Alessio Scheri
 * @version 1.0
 *
 */
public class AddProductToCartListener implements ActionListener {

	private Carrello cart;
	private Magazzino store;
	private StringBuilder code;
	private JTextField amount;
	private Window windowCaller;

	private static final String ALERT_TITLE = "Prodotto aggiunto";
	private static final String ALERT_TEXT = "Prodotto aggiunto correttamente al carrello.";
	private static final String ALERT_NO_AMOUNT_TITLE = "Attenzione";
	private static final String ALERT_NO_AMOUNT_TEXT =
			"Inserire un valore valido nel campo dedicato alla quantità.";

	public AddProductToCartListener (Window windowCaller, Magazzino store,
			Carrello cart, StringBuilder code, JTextField amount) {
		this.store = store;
		this.cart = cart;
		this.code = code;
		this.amount = amount;
		this.windowCaller = windowCaller;
	}

	public AddProductToCartListener (Magazzino store, Carrello cart,
			StringBuilder code, JTextField amount) {
		this (null, store, cart, code, amount);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		Prodotto inStore = this.store.getProdotto(this.code.toString());
		if (inStore != null) {
			Prodotto inCart = this.cart.getProdotto(this.code.toString());
			int newAmount = Integer.parseInt(this.amount.getText());
			if (newAmount == 0) {
				JOptionPane.showMessageDialog(this.windowCaller, ALERT_NO_AMOUNT_TEXT,
						ALERT_NO_AMOUNT_TITLE, JOptionPane.ERROR_MESSAGE);
				return;
			}
//			controllo di poter inserire questa quantità
			if (inCart != null) {
				newAmount += inCart.getQuantita();
			}
			if (newAmount > inStore.getQuantita()) {
				newAmount = inStore.getQuantita();
			}
			if (inCart != null) {
				newAmount -= inCart.getQuantita();
			}
			try {
				Prodotto newProduct = inStore.clone();
				newProduct.setQuantita(newAmount);
				this.cart.aggiungiProdotto(newProduct);
				if (this.windowCaller != null) {
					this.windowCaller.dispose();
				}
			} catch (CloneNotSupportedException e1) {
				e1.printStackTrace();
			}
			if (this.windowCaller != null && this.windowCaller.getClass().equals(JAddProductToCartDialog.class)) {
				JOptionPane.showMessageDialog(this.windowCaller, ALERT_TEXT,
						ALERT_TITLE, JOptionPane.INFORMATION_MESSAGE);
			}
		}
	}
}


text:
package org.activiti.standalone.escapeclause;

import static org.assertj.core.api.Assertions.assertThat;

import org.activiti.engine.history.HistoricActivityInstanceQuery;

public class HistoricActivityInstanceEscapeClauseTest extends AbstractEscapeClauseTestCase {

  private String deploymentOneId;

  private String deploymentTwoId;

  @Override
  protected void setUp() throws Exception {
    deploymentOneId = repositoryService
      .createDeployment()
      .tenantId("One%")
      .addClasspathResource("org/activiti/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceQuery.bpmn20.xml")
      .deploy()
      .getId();

    deploymentTwoId = repositoryService
      .createDeployment()
      .tenantId("Two_")
      .addClasspathResource("org/activiti/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceQuery.bpmn20.xml")
      .deploy()
      .getId();

    super.setUp();
  }

  @Override
  protected void tearDown() throws Exception {
    super.tearDown();
    repositoryService.deleteDeployment(deploymentOneId, true);
    repositoryService.deleteDeployment(deploymentTwoId, true);
  }

  public void testQueryByTenantIdLike() {
    runtimeService.startProcessInstanceByKeyAndTenantId("noopProcess", "One%");
    runtimeService.startProcessInstanceByKeyAndTenantId("noopProcess", "Two_");

    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().activityId("noop").activityTenantIdLike("%\\%%");
    assertThat(query.singleResult().getTenantId()).isEqualTo("One%");
    assertThat(query.list()).hasSize(1);
    assertThat(query.count()).isEqualTo(1);

    query = historyService.createHistoricActivityInstanceQuery().activityId("noop").activityTenantIdLike("%\\_%");
    assertThat(query.singleResult().getTenantId()).isEqualTo("Two_");
    assertThat(query.list()).hasSize(1);
    assertThat(query.count()).isEqualTo(1);
  }
}


text:
package jadx.core.dex.visitors.typeinference;

import jadx.core.dex.instructions.args.ArgType;
import jadx.core.dex.instructions.args.InsnArg;

public final class TypeUpdateEntry {
	private final InsnArg arg;
	private final ArgType type;

	public TypeUpdateEntry(InsnArg arg, ArgType type) {
		this.arg = arg;
		this.type = type;
	}

	public InsnArg getArg() {
		return arg;
	}

	public ArgType getType() {
		return type;
	}

	@Override
	public String toString() {
		return "TypeUpdateEntry{" + arg + " -> " + type + '}';
	}
}


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
info: Error.prototype property has the attributes {DontDelete}
es5id: 15.11.3.1_A1_T1
description: Checking if deleting the Error.prototype property fails
---*/

var proto=Error.prototype;
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if(delete Error.prototype){
  $ERROR('#1: delete Error.prototype return false');
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#2
if(Error.prototype!==proto){
  $ERROR('#2: var proto=Error.prototype; delete Error.prototype; Error.prototype===proto. Actual: '+Error.prototype);
}
//
//////////////////////////////////////////////////////////////////////////////


text:
[pep8](https://github.com/PyCQA/pycodestyle) is a tool to check your Python code against some of the style conventions in PEP 8.

### Learn how to build it?
Use the `docker build` command build the image

```bash
docker build -t containerops/pep8 .
```

### Component Usage

```bash
docker run --rm -e CO_DATA='git-url=https://github.com/Lupino/python-aio-periodic.git' containerops/pep8
# test with python2
docker run --rm -e CO_DATA='git-url=https://github.com/Lupino/python-aio-periodic.git version=python' containerops/pep8
```

### Parameters

- `git-url` is the source git repo url
- `version` is one of `python`, `python2`, `python3`, `py3k`.  default is `py3k`
- `out-put-type` available value: yaml,json

### Versions 1.0.0


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/alert_btn_left_pressed" android:state_pressed="true"/>
    <item android:drawable="@mipmap/trans_bg"/>

</selector>


text:
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#todo-navbar-collapse-1" aria-expanded="false">
                Toggle Navigation

            </button>

 Home

 Logout

 Refresh

 Admin Panel


text:
package cz.upol.lecture01;

import java.io.InputStream;
import java.io.OutputStream;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class DOMRecipeReaderWriter implements RecipeReaderWriter {

	@Override
	public Recipe loadRecipe(InputStream input) throws Exception {

		DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
		DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();

		Document doc = documentBuilder.parse(input);

		Element root = doc.getDocumentElement();
		Recipe recipe = new Recipe();

		//Alespon lehke overeni struktury vstupu...
		if (root.getChildNodes().getLength() != 4) {
			throw new Exception("Wrong XML format");
		}

		String servings = root.getAttribute("servings");
		recipe.setServings(servings);

		for (int i = 0; i < root.getChildNodes().getLength(); i++) {
			//Nacti name
			if (root.getChildNodes().item(i).getNodeName().equals("name")) {
				recipe.setName(root.getChildNodes().item(i).getTextContent());
				continue;
			}
			//Nacti cookTime
			if (root.getChildNodes().item(i).getNodeName().equals("cooktime")) {
				recipe.setCookTime(root.getChildNodes().item(i).getTextContent());
				continue;
			}
			//Nacti ingredients
			if (root.getChildNodes().item(i).getNodeName().equals("ingredients")) {
				NodeList nodes = root.getChildNodes().item(i).getChildNodes();

				for (int j = 0; j < nodes.getLength(); j++) {
					Element elem = (Element)nodes.item(j);
					recipe.addIngredient(new Ingredient(elem.getTextContent(), elem.getAttribute("amount"), elem.getAttribute("unit")));
				}
				continue;
			}
			//Nacti directions
			if (root.getChildNodes().item(i).getNodeName().equals("directions")) {
				NodeList nodes = root.getChildNodes().item(i).getChildNodes();

				for (int j = 0; j < nodes.getLength(); j++) {
					Element elem = (Element)nodes.item(j);
					recipe.addStep(elem.getTextContent());
				}
				continue;
			}
		}
		return recipe;
	}

	@Override
	public void storeRecipe(OutputStream output, Recipe recept)	throws Exception {
		DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
		DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();

		Document doc = documentBuilder.newDocument();

		//Vytvor root element
		Element rootElement = doc.createElement("recipe");
		rootElement.setAttribute("servings", recept.getServings());
		doc.appendChild(rootElement);

		//Vytvor name
		Element nameElement = doc.createElement("name");
		nameElement.setTextContent(recept.getName());
		rootElement.appendChild(nameElement);

		//Vytvor cookTime
		Element cookTimeElement = doc.createElement("cooktime");
		cookTimeElement.setTextContent(recept.getCookTime());
		rootElement.appendChild(cookTimeElement);

		//Vytvor ingredients
		Element ingredientsElement = doc.createElement("ingredients");
		rootElement.appendChild(ingredientsElement);

		for (Ingredient ing : recept.getIngredients()) {
			Element ingredient = doc.createElement("ingredient");
			ingredient.setAttribute("amount", ing.getAmount());
			ingredient.setAttribute("unit", ing.getUnit());
			ingredient.setTextContent(ing.getName());
			ingredientsElement.appendChild(ingredient);
		}

		//Vytvor directions
		Element directionsElement = doc.createElement("directions");
		rootElement.appendChild(directionsElement);

		for (String step : recept.getSteps()) {
			Element direct = doc.createElement("step");
			direct.setTextContent(step);
			directionsElement.appendChild(direct);
		}

		TransformerFactory transformerFactory = TransformerFactory.newInstance();
		Transformer transformer = transformerFactory.newTransformer();
		transformer.setOutputProperty(OutputKeys.INDENT, "yes");

		DOMSource source = new DOMSource(doc);
		StreamResult result = new StreamResult(System.out);
		transformer.transform(source, result);
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.google.firebase.codelab.friendlychat.MainActivity">

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/colorLightGray"
        android:orientation="horizontal"
        android:paddingHorizontal="10dp">

        <ImageView
            android:id="@+id/addMessageImageView"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            ads:srcCompat="@drawable/outline_add_photo_alternate_24" />

        <EditText
            android:id="@+id/messageEditText"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_margin="10dp"
            android:layout_gravity="center"
            android:padding="10dp"
            android:background="@drawable/edit_text_shadow"
            android:hint="Say something..."
            android:inputType="text" />

        <ImageView
            android:id="@+id/sendButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:enabled="false"
            android:src="@drawable/outline_send_gray_24" />

    </LinearLayout>

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/messageRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/linearLayout"
        android:background="@android:color/white"
        android:paddingHorizontal="16dp" />
</RelativeLayout>


text:
package org.omg.CosNaming.NamingContextPackage;

import gnu.CORBA.Minor;
import gnu.CORBA.OrbRestricted;

import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;

/**
 * The helper operations for {@link NotFoundReason}
 *
 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
 */
public abstract class NotFoundReasonHelper
{
  /**
   * The {@link AlreadyBound} repository id.
   */
  private static String _id =
    "IDL:omg.org/CosNaming/NamingContext/NotFoundReason:1.0";

  /**
   * Extract the exception from the given {@link Any}.
   */
  public static NotFoundReason extract(Any a)
  {
    try
      {
        return ((NotFoundReasonHolder) a.extract_Streamable()).value;
      }
    catch (ClassCastException ex)
      {
        BAD_OPERATION bad = new BAD_OPERATION();
        bad.initCause(ex);
        bad.minor = Minor.Any;
        throw bad;
      }
  }

  /**
   * Return the exception repository id.
   */
  public static String id()
  {
    return _id;
  }

  /**
   * Insert the exception into the given {@link Any}.
   */
  public static void insert(Any a, NotFoundReason that)
  {
    a.insert_Streamable(new NotFoundReasonHolder(that));
  }

  /**
   * Read the exception from the given CDR stream.
   */
  public static NotFoundReason read(InputStream istream)
  {
    return NotFoundReason.from_int(istream.read_long());
  }

  /**
   * Create the type code for this exception.
   */
  public static TypeCode type()
  {
    return
    OrbRestricted.Singleton.create_enum_tc(id(), "NotFoundReason",
                              new String[]
                                         {
                                          "missing_node",
                                          "not_context",
                                          "not_object"
                                         }
    );
  }

  /**
   * Write the exception to the CDR output stream.
   */
  public static void write(OutputStream ostream, NotFoundReason value)
  {
    ostream.write_long(value.value());
  }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Regions — PetBlocks 8.32.0 documentation</title>

    <link rel="shortcut icon" href="../../_static/favicon.png"/>

    <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />

    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />

    <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />

        <link rel="index" title="Index"
              href="../../genindex.html"/>
        <link rel="search" title="Search" href="../../search.html"/>
    <link rel="top" title="PetBlocks 8.32.0 documentation" href="../../index.html"/>

             PetBlocks

                8.32.0

  <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

Getting Started

Pets

Customizing

Commands

General

Developer API

FAQ

Contributing to PetBlock

          PetBlocks

Docs »

Regions

               Edit on GitHub

Regions¶

It is often the case that you have got a region management plugin installed on your server regardless if you are using Spigot or Sponge.
They can cause issues when spawning pets when certain region restrictions are enabled.

Simply allow spawning rabbits and zombies in your regions and PetBlocks should work correctly. If it is not possible to allow this,
PetBlocks also hooks into the following popular region plugins to allow spawning its pets anyway. Please request a region management plugin
if it is not supported on this list.

The following Bukkit plugins are supported:

WorldGuard

The following Sponge plugins are supported:

GriefPrevention

WorldGuard¶

PetBlocks should automatically hook into any installed WorldGuard plugin and allows spawning pets in any region you configure.
You can restrict the regions by taking a look at the region settings below.

GriefPrevention¶

PetBlocks uses the same way as the popular Pixelmon mod to allow or deny pets in certain regions.

Use the modid petblocks and any for settings flags. (rabbit,zombie,armorstand)

command:

/cf entity-spawn petblocks:any true

Region Settings¶

You can also specify where pets are allowed to spawn. The world settings are available for both Spigot and Sponge, however
the region settings are only available when WorldGuard is installed.

config.yml:

# World-region settings
   world:
       excluded:
         - ''
       included:
         - 'all'
   region:
       excluded:
         - ''
       included:
         - 'all'

        © Copyright 2015 - 2022, Shynixn.


text:
package io.datarouter.storage.test.node.queue;

import java.util.Objects;

import io.datarouter.bytes.ByteTool;
import io.datarouter.bytes.Codec;
import io.datarouter.bytes.codec.booleancodec.RawBooleanCodec;
import io.datarouter.bytes.codec.charcodec.ComparableCharCodec;
import io.datarouter.bytes.codec.intcodec.RawIntCodec;

public class BloqQueueStorageTestDto{

	public final char chr;
	public final int number;
	public final boolean bool;

	public BloqQueueStorageTestDto(char chr, int number, boolean bool){
		this.chr = chr;
		this.number = number;
		this.bool = bool;
	}

	@Override
	public int hashCode(){
		return Objects.hash(bool, number, chr);
	}

	@Override
	public boolean equals(Object obj){
		if(this == obj){
			return true;
		}
		if(obj == null){
			return false;
		}
		if(getClass() != obj.getClass()){
			return false;
		}
		BloqQueueStorageTestDto other = (BloqQueueStorageTestDto)obj;
		return bool == other.bool && number == other.number && chr == other.chr;
	}

	public static class BloqQueueStorageTestDtoCodec implements Codec<BloqQueueStorageTestDto,byte[]>{

		@Override
		public byte[] encode(BloqQueueStorageTestDto value){
			return ByteTool.concat(
					ComparableCharCodec.INSTANCE.encode(value.chr),
					RawIntCodec.INSTANCE.encode(value.number),
					RawBooleanCodec.INSTANCE.encode(value.bool));
		}

		@Override
		public BloqQueueStorageTestDto decode(byte[] encodedValue){
			int cursor = 0;
			char chr = ComparableCharCodec.INSTANCE.decode(encodedValue);
			cursor += ComparableCharCodec.INSTANCE.length();
			int number = RawIntCodec.INSTANCE.decode(encodedValue, cursor);
			cursor += RawIntCodec.INSTANCE.length();
			boolean bool = RawBooleanCodec.INSTANCE.decode(encodedValue, cursor);
			return new BloqQueueStorageTestDto(chr, number, bool);
		}

		public static int length(){
			return ComparableCharCodec.INSTANCE.length()
					+ RawIntCodec.INSTANCE.length()
					+ RawBooleanCodec.INSTANCE.length();
		}

	}

}


text:
<?php

namespace humhub\modules\space\controllers;

/**
 * SpaceController is the main controller for spaces.
 *
 * It show the space itself and handles all related tasks like following or
 * memberships.
 *
 * @author Luke
 * @package humhub.modules_core.space.controllers
 * @since 0.5
 */
class SpaceController extends \humhub\modules\content\components\ContentContainerController
{

    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'acl' => [
                'class' => \humhub\components\behaviors\AccessControl::className(),
                'guestAllowedActions' => ['index', 'stream']
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    public function actions()
    {
        return array(
            'stream' => array(
                'class' => \humhub\modules\content\components\actions\ContentContainerStream::className(),
                'contentContainer' => $this->getSpace()
            ),
        );
    }

    /**
     * Generic Start Action for Profile
     */
    public function actionIndex()
    {
        return $this->render('index', ['space' => $this->contentContainer]);
    }

    /**
     * Follows a Space
     */
    public function actionFollow()
    {
        $this->forcePostRequest();
        $space = $this->getSpace();
        if (!$space->isMember()) {
            $space->follow();
        }

        return $this->redirect($space->getUrl());
    }

    /**
     * Unfollows a Space
     */
    public function actionUnfollow()
    {
        $this->forcePostRequest();
        $space = $this->getSpace();
        $space->unfollow();

        return $this->redirect($space->getUrl());
    }

}

?>


text:
import React from 'react'
import Simon from 'components/Simon/Simon'

describe('(Component) Simon', () => {
  it('should exist', () => {

  })
})


text:
<?php

function script_path()
{
  // Mention the path to activity script here
  return "/script/activity/activity.py";
}

function colorit($data)
{
  // Function to color and format report fields

  $color["yes"] = "green";
  $color["up"] = "green";
  $color["accessible"] = "green";
  $color["good"] = "green";
  $color["open"] = "green";
  $color["success"] = "green";

  $color["no"] = "red";
  $color["down"] = "red";
  $color["inaccessible"] = "red";
  $color["bad"] = "red";
  $color["closed"] = "red";
  $color["failed"] = "red";

  $color["n/a"] = "orange";
  $color["Unknown"] = "orange";

  $data = in_array(strtolower($data), array_keys($color)) ? "".$data."" : $data;
  return nl2br($data);
}

function startswith($needle, $haystack) {
  // search backwards starting from haystack length characters from the end
  return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
}

function endswith($needle, $haystack) {
  // search forward starting from end minus needle length characters
  return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
}
?>