text:
<?php

/**
 * ezcImageHandler implementation for ImageMagick.
 * This class only implements the base funtionality of handling images with
 * ImageMagick. If you want to manipulate images using ImageMagick in your
 * application, you should use the {@link ezcImageImagemagickHandler}.
 *
 * You can use this base class to implement your own filter set on basis of
 * ImageMagick, but you can also use {@link ezcImageImagemagickHandler} for
 * this and profit from its already implemented filters.
 *
 * @see ezcImageConverter
 * @see ezcImageHandler
 *
 * @package ImageConversion
 * @version 1.3.8
 */
class ezcImageImagemagickBaseHandler extends ezcImageMethodcallHandler
{
    /**
     * Path to the convert binary.
     *
     * @var string
     */
    private $binary;

    /**
     * Map of MIME types to convert tags.
     *
     * @var array(string=>string)
     */
    private $tagMap = array();

    /**
     * Filter options per reference.
     *
     * @var array(string=>array)
     */
    private $filterOptions = array();

    /**
     * Composite image setting per reference.
     *
     * @var array(string=>bool)
     */
    private $compositeImages = array();

    /**
     * Create a new image handler.
     * Creates an image handler. This should never be done directly,
     * but only through the manager for configuration reasons. One can
     * get a direct reference through manager afterwards.
     *
     * This handler has an option 'binary' available, which allows you to
     * explicitly set the path to your ImageMagicks "convert" binary (this
     * may be necessary on Windows, since there may be an obscure "convert.exe"
     * in the $PATH variable available, which has nothing to do with
     * ImageMagick).
     *
     * @throws ezcImageHandlerNotAvailableException
     *         If the ImageMagick binary is not found.
     *
     * @param ezcImageHandlerSettings $settings Settings for the handler.
     */
    public function __construct( ezcImageHandlerSettings $settings )
    {
        // Check for ImageMagick
        $this->checkImageMagick( $settings );
        $this->determineTypes();
        parent::__construct( $settings );
    }

    /**
     * Load an image file.
     * Loads an image file and returns a reference to it.
     *
     * @param string $file File to load.
     * @param string $mime The MIME type of the file.
     *
     * @return string Reference to the file in this handler.
     *
     * @see ezcImageAnalyzer
     *
     * @throws ezcBaseFileNotFoundException
     *         If the desired file does not exist.
     * @throws ezcImageMimeTypeUnsupportedException
     *         If the desired file has a not recognized type.
     * @throws ezcImageFileNameInvalidException
     *         If an invalid character (", ', $) is found in the file name.
     */
    public function load( $file, $mime = null )
    {
        $this->checkFileName( $file );
        $ref = $this->loadCommon( $file, $mime );

        // Atomic file operation
        $fileTmp = tempnam( dirname( $file ) . DIRECTORY_SEPARATOR, '.' . basename( $file ) );
        copy( $file, $fileTmp );

        $this->setReferenceData( $ref, $fileTmp, 'resource' );
        return $ref;
    }

    /**
     * Save an image file.
     * Saves a given open file. Can optionally save to a new file name.
     *
     * @see ezcImageHandler::load()
     *
     * @param string $image                File reference created through load().
     * @param string $newFile              Filename to save the image to.
     * @param string $mime                 New MIME type, if differs from initial one.
     * @param ezcImageSaveOptions $options Save options.
     * @return void
     *
     * @throws ezcBaseFilePermissionException
     *         If the desired file exists and is not writeable.
     * @throws ezcImageMimeTypeUnsupportedException
     *         If the desired MIME type is not recognized.
     * @throws ezcImageFileNameInvalidException
     *         If an invalid character (", ', $) is found in the file name.
     */
    public function save( $image, $newFile = null, $mime = null, ezcImageSaveOptions $options = null )
    {
        if ( $options === null )
        {
            $options = new ezcImageSaveOptions();
        }

        if ( $newFile !== null )
        {
            $this->checkFileName( $newFile );
        }

        // Check is transparency must be converted
        if  ( $this->needsTransparencyConversion( $this->getReferenceData( $image, 'mime' ), $mime ) && $options->transparencyReplacementColor !== null )
        {
            $this->addFilterOption( $image, '-background', $this->colorArrayToString( $options->transparencyReplacementColor ) );
            $this->addFilterOption( $image, '-flatten' );
        }

        $this->saveCommon( $image, $newFile, $mime );

        switch ( $this->getReferenceData( $image, 'mime' ) )
        {
            case "image/jpeg":
                if ( $options->quality !== null )
                {
                    $this->addFilterOption( $image, "-quality", $options->quality );
                }
            break;
            case "image/png":
                if ( $options->compression !== null )
                {
                    // ImageMagick uses qualtiy options here and incorporates filter options
                    $this->addFilterOption( $image, "-quality", $options->compression * 10 );
                }
            break;
        }

        // Prepare ImageMagick command
        // Here we need a work around, because older ImageMagick versions do not
        // support this option order

        if ( isset( $this->compositeImages[$image] ) )
        {
            $command = $this->binary . ' ' .
                ( isset( $this->filterOptions[$image] ) ? implode( ' ', $this->filterOptions[$image] ) : '' ) . ' ' .
                escapeshellarg( $this->getReferenceData( $image, 'resource' ) ) . ' ' .
                implode( ' ', $this->compositeImages[$image] ) . ' ' .
                escapeshellarg( $this->tagMap[$this->getReferenceData( $image, 'mime' )] . ':' . $this->getReferenceData( $image, 'resource' ) );
        }
        else
        {
            $command = $this->binary . ' ' .
                escapeshellarg( $this->getReferenceData( $image, 'resource' ) ) . ' ' .
                ( isset( $this->filterOptions[$image] ) ? implode( ' ', $this->filterOptions[$image] ) : '' ) . ' ' .
                escapeshellarg( $this->tagMap[$this->getReferenceData( $image, 'mime' )] . ':' . $this->getReferenceData( $image, 'resource' ) );
        }

        // Prepare to run ImageMagick command
        $descriptors = array(
            array( 'pipe', 'r' ),
            array( 'pipe', 'w' ),
            array( 'pipe', 'w' ),
        );

        // Open ImageMagick process
        $imageProcess = proc_open( $command, $descriptors, $pipes );
        // Close STDIN pipe
        fclose( $pipes[0] );

        $errorString  = '';
        $outputString = '';
        // Read STDERR
        do
        {
            $outputString .= rtrim( fgets( $pipes[1], 1024 ), "\n" );
            $errorString  .= rtrim( fgets( $pipes[2], 1024 ), "\n" );
        } while ( !feof( $pipes[2] ) );

        // Wait for process to terminate and store return value
        $status = proc_get_status( $imageProcess );
        while ( $status['running'] !== false )
        {
            // Sleep 1/100 second to wait for convert to exit
            usleep( 10000 );
            $status = proc_get_status( $imageProcess );
        }
        $return = proc_close( $imageProcess );

        // Process potential errors
        // Exit code may be messed up with -1, especially on Windoze
        if ( ( $status['exitcode'] != 0 && $status['exitcode'] != -1 ) || strlen( $errorString ) > 0 )
        {
            throw new ezcImageFileNotProcessableException(
                $this->getReferenceData( $image, 'resource' ),
                "The command '{$command}' resulted in an error ({$status['exitcode']}): '{$errorString}'. Output: '{$outputString}'"
            );
        }
        // Finish atomic file operation
        copy( $this->getReferenceData( $image, 'resource' ), $this->getReferenceData( $image, 'file' ) );
    }

    /**
     * Returns a string representation of the given color array.
     *
     * ImageConversion uses arrays to represent color values, in the format:
     * <code>
     * array(
     *      255,
     *      0,
     *      0,
     * )
     * </code>
     * This array represents the color red.
     *
     * This method takes such a color array and converts it into a string
     * representation usable by the convert binary. For the above examle it
     * would be '#FF0000'.
     *
     * @param array $color
     * @return void
     *
     * @throws ezcBaseValueException
     *         if one of the color values in the array is invalid (not integer,
     *         smaller than 0 or larger than 255).
     */
    protected function colorArrayToString( array $color )
    {
        $colorString = '#';
        $i = 0;
        foreach ( $color as $id => $colorVal )
        {
            if ( $i++ > 2 )
            {
                break;
            }
            if ( !is_int( $colorVal ) || $colorVal < 0 || $colorVal > 255 )
            {
                throw new ezcBaseValueException( "color[$id]", $color[$id], 'int > 0 and < 256' );
            }
            $colorString .= sprintf( '%02x', $colorVal );
        }
        return $colorString;
    }

    /**
     * Close the file referenced by $image.
     * Frees the image reference. You should call close() before.
     *
     * @see ezcImageHandler::load()
     * @see ezcImageHandler::save()
     * @param string $image The image reference.
     */
    public function close( $image )
    {
        unlink( $this->getReferenceData( $image, 'resource' ) );
        $this->setReferenceData( $image, false, 'resource' );
        $this->closeCommon( $image );
    }

    /**
     * Add a filter option to a given reference
     *
     * @param string $reference The reference to add a filter for.
     * @param string $name      The option name.
     * @param string $parameter The option parameter.
     * @return void
     */
    protected function addFilterOption( $reference, $name, $parameter = null )
    {
        $this->filterOptions[$reference][] = $name . ( $parameter !== null ? ' ' . escapeshellarg( $parameter ) : '' );
    }

    /**
     * Add an image to composite with the given reference.
     *
     * @param string $reference The reference to add an image to
     * @param string $file      The file to composite with the image.
     * @return void
     */
    protected function addCompositeImage( $reference, $file )
    {
        $this->compositeImages[$reference][] = $file;
    }

    /**
     * Determines the supported input/output types supported by handler.
     * Set's various attributes to reflect the MIME types this handler is
     * capable to process.
     *
     * @return void
     *
     * @apichange Faulty MIME type "image/svg" will be removed and replaced by
     *            correct MIME type image/svg+xml.
     */
    private function determineTypes()
    {
        $tagMap = array(
            'application/pcl' => 'PCL',
            'application/pdf' => 'PDF',
            'application/postscript' => 'PS',
            'application/vnd.palm' => 'PDB',
            'application/x-icb' => 'ICB',
            'application/x-mif' => 'MIFF',
            'image/bmp' => 'BMP3',
            'image/dcx' => 'DCX',
            'image/g3fax' => 'G3',
            'image/gif' => 'GIF',
            'image/jng' => 'JNG',
            'image/jpeg' => 'JPG',
            'image/pbm' => 'PBM',
            'image/pcd' => 'PCD',
            'image/pict' => 'PCT',
            'image/pjpeg' => 'PJPEG',
            'image/png' => 'PNG',
            'image/ras' => 'RAS',
            'image/sgi' => 'SGI',
            'image/svg+xml' => 'SVG',
            // Left over for BC reasons
            'image/svg' => 'SVG',
            'image/tga' => 'TGA',
            'image/tiff' => 'TIF',
            'image/vda' => 'VDA',
            'image/vnd.wap.wbmp' => 'WBMP',
            'image/vst' => 'VST',
            'image/x-fits' => 'FITS',
            'image/x-otb' => 'OTB',
            'image/x-palm' => 'PALM',
            'image/x-pcx' => 'PCX',
            'image/x-pgm' => 'PGM',
            'image/psd' => 'PSD',
            'image/x-ppm' => 'PPM',
            'image/x-ptiff' => 'PTIF',
            'image/x-viff' => 'VIFF',
            'image/x-xbitmap' => 'XPM',
            'image/x-xv' => 'P7',
            'image/xpm' => 'PICON',
            'image/xwd' => 'XWD',
            'text/plain' => 'TXT',
            'video/mng' => 'MNG',
            'video/mpeg' => 'MPEG',
            'video/mpeg2' => 'M2V',
        );
        $types = array_keys( $tagMap );
        $this->inputTypes = $types;
        $this->outputTypes = $types;
        $this->tagMap = $tagMap;
    }

    /**
     * Checks for ImageMagick on the system.
     *
     * @param ezcImageHandlerSettings $settings The settings object of the current handler instance.
     * @return void
     *
     * @throws ezcImageHandlerNotAvailableException
     *         If the ImageMagick binary is not found.
     */
    private function checkImageMagick( ezcImageHandlerSettings $settings )
    {
        if ( !isset( $settings->options['binary'] ) )
        {
            $this->binary = ezcBaseFeatures::getImageConvertExecutable();
        }
        else if ( file_exists( $settings->options['binary'] ) )
        {
            $this->binary = $settings->options['binary'];
        }

        if ( $this->binary === null )
        {
            throw new ezcImageHandlerNotAvailableException(
                'ezcImageImagemagickHandler',
                'ImageMagick not installed or not available in PATH variable.'
            );
        }

        // Prepare to run ImageMagick command
        $descriptors = array(
            array( 'pipe', 'r' ),
            array( 'pipe', 'w' ),
            array( 'pipe', 'w' ),
        );

        // Open ImageMagick process
        $imageProcess = proc_open( $this->binary, $descriptors, $pipes );

        // Close STDIN pipe
        fclose( $pipes[0] );

        $outputString = '';
        // Read STDOUT
        do
        {
            $outputString .= rtrim( fgets( $pipes[1], 1024 ), "\n" );
        } while ( !feof( $pipes[1] ) );

        $errorString = '';
        // Read STDERR
        do
        {
            $errorString .= rtrim( fgets( $pipes[2], 1024 ), "\n" );
        } while ( !feof( $pipes[2] ) );

        // Wait for process to terminate and store return value
        $return = proc_close( $imageProcess );

        // Process potential errors
        if ( strlen( $errorString ) > 0 || strpos( $outputString, 'ImageMagick' ) === false )
        {
            throw new ezcImageHandlerNotAvailableException( 'ezcImageImagemagickHandler', 'ImageMagick not installed or not available in PATH variable.' );
        }
    }

    /**
     * Creates default settings for the handler and returns it.
     * The reference name will be set to 'ImageMagick'.
     *
     * @return ezcImageHandlerSettings
     */
    static public function defaultSettings()
    {
        return new ezcImageHandlerSettings( 'ImageMagick', 'ezcImageImagemagickHandler' );
    }
}

?>


text:
package org.onosproject.ui.topo;

/**
 * Defines string constants used in the Topology View of the ONOS GUI.
 */
public final class TopoConstants {

    /**
     * Defines constants for property names on the default summary and
     * details panels.
     */
    public static final class Properties {
        public static final String SEPARATOR = "-";

        // summary panel
        public static final String DEVICES = "Devices";
        public static final String LINKS = "Links";
        public static final String HOSTS = "Hosts";
        public static final String TOPOLOGY_SSCS = "Topology SCCs";
        public static final String INTENTS = "Intents";
        public static final String TUNNELS = "Tunnels";
        public static final String FLOWS = "Flows";
        public static final String VERSION = "Version";

        // device details
        public static final String URI = "URI";
        public static final String VENDOR = "Vendor";
        public static final String HW_VERSION = "H/W Version";
        public static final String SW_VERSION = "S/W Version";
        public static final String SERIAL_NUMBER = "Serial #";
        public static final String PROTOCOL = "Protocol";
        public static final String LATITUDE = "Latitude";
        public static final String LONGITUDE = "Longitude";
        public static final String GRID_Y = "Grid Y";
        public static final String GRID_X = "Grid X";
        public static final String PORTS = "Ports";

        // host details
        public static final String MAC = "MAC";
        public static final String IP = "IP";
        public static final String VLAN = "VLAN";
    }

    /**
     * Defines identities of core buttons that appear on the topology
     * details panel.
     */
    public static final class CoreButtons {
        public static final ButtonId SHOW_DEVICE_VIEW =
                new ButtonId("showDeviceView");

        public static final ButtonId SHOW_FLOW_VIEW =
                new ButtonId("showFlowView");

        public static final ButtonId SHOW_PORT_VIEW =
                new ButtonId("showPortView");

        public static final ButtonId SHOW_GROUP_VIEW =
                new ButtonId("showGroupView");

        public static final ButtonId SHOW_METER_VIEW =
                new ButtonId("showMeterView");
    }
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.navigation;

import com.intellij.model.Pointer;
import com.intellij.pom.Navigatable;
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread;
import com.intellij.util.concurrency.annotations.RequiresReadLock;
import org.jetbrains.annotations.ApiStatus.Experimental;
import org.jetbrains.annotations.ApiStatus.ScheduledForRemoval;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Represents a minimal entity participating in navigation actions.
 * The entity is expected to be valid if it exists.
 */
@Experimental
public interface NavigationTarget {

  /**
   * @return smart pointer used to restore the instance in the subsequent read actions
   */
  @RequiresReadLock
  @RequiresBackgroundThread
  @NotNull Pointer<? extends NavigationTarget> createPointer();

  /**
   * This method is called if the platform decides to display the target in the UI (e.g., popup).
   * If the target is not displayed in the UI, then only {@link #navigationRequest()} is called.
   * <p/>
   * This method is called in read action.
   *
   * @return presentation to render this target in navigation popup
   */
  @NotNull TargetPresentation getTargetPresentation();

  /**
   * This method is called once before the actual navigation.
   * It is safe to unstub PSI in the implementation of this method.
   *
   * @return a request instance to use when this target is selected,
   * or {@code null} if navigation cannot be performed for any reason
   */
  @RequiresReadLock
  @RequiresBackgroundThread
  @Nullable NavigationRequest navigationRequest();

  /**
   * Two different symbols may have the same navigation target.
   * #equals and #hashCode are used to filter out same targets to hide them in navigation popup.
   */
  @Override
  boolean equals(Object obj);

  @Override
  int hashCode();

  /**
   * @deprecated This method is not used by the platform. Implement {@link #navigationRequest()} instead.
   * Please define your own interface if you need this method in your implementation.
   */
  @Deprecated
  @ScheduledForRemoval(inVersion = "2022.1")
  default @NotNull Navigatable getNavigatable() {
    return EmptyNavigatable.INSTANCE;
  }
}


text:
require 'spec_helper'
require 'chef/provider/user/useradd'

describe Chef::Provider::User::Useradd do

  subject(:provider) do
    p = described_class.new(@new_resource, @run_context)
    p.current_resource = @current_resource
    p
  end

  supported_useradd_options = {
    'comment' => "-c",
    'gid' => "-g",
    'uid' => "-u",
    'shell' => "-s",
    'password' => "-p"
  }

  include_examples "a useradd-based user provider", supported_useradd_options

  describe "manage_user" do
    # CHEF-5247: Chef::Provider::User::Solaris subclasses Chef::Provider::User::Useradd, but does not use usermod to change passwords.
    # Thus, a call to Solaris#manage_user calls Solaris#manage_password and Useradd#manage_user, but the latter should be a no-op.
    it "should not run the command if universal_options is an empty array" do
      allow(provider).to receive(:universal_options).and_return([])
      expect(provider).not_to receive(:shell_out!)
      provider.manage_user
    end
  end
end


text:
<?php

declare(strict_types=1);

namespace sad_spirit\pg_builder\nodes;

use sad_spirit\pg_builder\{
    Node,
    Parser,
    exceptions\InvalidArgumentException
};

/**
 * Base class for AST nodes
 */
abstract class GenericNode implements Node, \Serializable
{
    /**
     * Mapping ["class name" => ["magic property" => "actual protected property"]]
     * @var array<string, array>
     */
    private static $propertyNamesCache = [];

    /**
     * Mapping ["magic property" => "actual protected property"] for current object, {@see generatePropertyNames()}
     * @var array<string, string>
     */
    protected $propertyNames = [];

    /**
     * Link to the Node containing current one
     * @var Node|null
     */
    protected $parentNode = null;

    /**
     * Flag for preventing endless recursion in {@see setParentNode()}
     * @var bool
     */
    protected $settingParentNode = false;

    /**
     * Variable overloading, exposes values of protected properties having 'p_' name prefix
     *
     * @param string $name
     * @return mixed
     * @throws InvalidArgumentException
     */
    public function __get(string $name)
    {
        if (isset($this->propertyNames[$name])) {
            return $this->{$this->propertyNames[$name]};
        } else {
            throw new InvalidArgumentException("Unknown property '{$name}'");
        }
    }

    /**
     * Variable overloading, allows setting the $prop property if corresponding setProp() method is defined
     *
     * @param string $name
     * @param mixed  $value
     * @return void
     * @throws InvalidArgumentException
     */
    public function __set(string $name, $value)
    {
        if (method_exists($this, 'set' . $name)) {
            $this->{'set' . $name}($value);
        } else {
            throw new InvalidArgumentException(
                isset($this->propertyNames[$name])
                    ? "Property '{$name}' is read-only"
                    : "Unknown property '{$name}'"
            );
        }
    }

    /**
     * Variable overloading, checks the existence of protected property corresponding to magic one
     *
     * @param string $name
     * @return bool
     */
    public function __isset(string $name)
    {
        return isset($this->propertyNames[$name]);
    }

    /**
     * Deep cloning of child nodes
     */
    public function __clone()
    {
        foreach ($this->propertyNames as $name) {
            if ($this->$name instanceof Node) {
                $this->$name = clone $this->$name;
                if ($this->$name instanceof self) {
                    $this->$name->parentNode = $this;
                } else {
                    $this->$name->setParentNode($this);
                }
            }
        }
        $this->parentNode = null;
    }

    /**
     * GenericNode only serializes its magic properties by default
     * @return string
     */
    public function serialize(): string
    {
        return serialize($this->collectProperties());
    }

    /**
     * GenericNode only serializes its magic properties by default
     * @return array
     */
    public function __serialize(): array
    {
        return $this->collectProperties();
    }

    /**
     * GenericNode only unserializes its magic properties by default
     * @param string $serialized
     */
    public function unserialize($serialized)
    {
        $this->unserializeProperties(unserialize($serialized));
    }

    /**
     * GenericNode only unserializes its magic properties by default
     * @param array $data
     */
    public function __unserialize(array $data): void
    {
        $this->unserializeProperties($data);
    }

    /**
     * Returns an array containing all magic properties, used when serializing
     * @return array<string, mixed>
     */
    protected function collectProperties(): array
    {
        $result = [];
        foreach ($this->propertyNames as $name) {
            $result[$name] = $this->$name;
        }
        return $result;
    }

    /**
     * Unserializes properties, restoring parent node link for child nodes
     *
     * @param array<string, mixed> $properties
     */
    protected function unserializeProperties(array $properties): void
    {
        $this->generatePropertyNames();
        foreach ($properties as $k => $v) {
            if ($v instanceof self) {
                $v->parentNode = $this;
            } elseif ($v instanceof Node) {
                $v->setParentNode($this);
            }
            $this->$k = $v;
        }
    }

    /**
     * Generates mapping from magic property names to names of actual protected properties
     *
     * Magic property 'foo' corresponds to protected property 'p_foo'
     *
     * Should be called from both __construct() and unserialize() methods of GenericNode descendant that defines
     * new magic properties
     */
    final protected function generatePropertyNames(): void
    {
        if (!isset(self::$propertyNamesCache[$className = get_class($this)])) {
            self::$propertyNamesCache[$className] = [];
            foreach (array_keys(get_class_vars($className)) as $name) {
                if ('p_' === substr($name, 0, 2)) {
                    self::$propertyNamesCache[$className][substr($name, 2)] = $name;
                }
            }
        }
        $this->propertyNames = self::$propertyNamesCache[$className];
    }

    /**
     * {@inheritDoc}
     */
    public function setParentNode(Node $parent = null): void
    {
        // no-op? recursion?
        if ($parent === $this->parentNode || $this->settingParentNode) {
            return;
        }

        $this->settingParentNode = true;
        try {
            if (null !== $parent) {
                $check = $parent;
                do {
                    if ($this === $check) {
                        throw new InvalidArgumentException(
                            'Cannot set a Node or its descendant as its own parent'
                        );
                    }
                } while ($check = $check->getparentNode());
            }
            if (null !== $this->parentNode) {
                $this->parentNode->removeChild($this);
            }
            $this->parentNode = $parent;

        } finally {
            $this->settingParentNode = false;
        }
    }

    /**
     * {@inheritDoc}
     */
    public function getParentNode(): ?Node
    {
        return $this->parentNode;
    }

    /**
     * {@inheritDoc}
     */
    public function replaceChild(Node $oldChild, Node $newChild): ?Node
    {
        if ($this !== $oldChild->getParentNode()) {
            throw new InvalidArgumentException(
                'First argument to replaceChild() is not a child of current node'
            );
        }
        // no-op?
        if ($newChild === $oldChild) {
            return $newChild;
        }
        // prevent the same child node in several places
        if ($this === $newChild->getParentNode()) {
            $this->removeChild($newChild);
        }
        foreach ($this->propertyNames as $name => $propertyName) {
            if ($oldChild === $this->$propertyName) {
                if (!method_exists($this, 'set' . $name)) {
                    throw new InvalidArgumentException("Property '{$name}' is read-only");
                }
                $this->{'set' . $name}($newChild);
                return $newChild;
            }
        }
        return null;
    }

    /**
     * {@inheritDoc}
     */
    public function removeChild(Node $child): ?Node
    {
        if ($this !== $child->getParentNode()) {
            throw new InvalidArgumentException("Argument to removeChild() is not a child of current node");
        }
        foreach ($this->propertyNames as $name => $propertyName) {
            if ($child === $this->$propertyName) {
                if (!method_exists($this, 'set' . $name)) {
                    throw new InvalidArgumentException("Property '{$name}' is read-only");
                }
                $this->{'set' . $name}(null);
                return $child;
            }
        }
        return null;
    }

    /**
     * {@inheritDoc}
     */
    public function getParser(): ?Parser
    {
        if (null === $this->parentNode) {
            return null;
        } else {
            return $this->parentNode->getParser();
        }
    }

    /**
     * Returns the Parser or throws an Exception if one is not available
     *
     * @param string $as
     * @return Parser
     */
    protected function getParserOrFail(string $as): Parser
    {
        if (null !== ($parser = $this->getParser())) {
            return $parser;
        }
        throw new InvalidArgumentException(sprintf("Passed a string as %s without a Parser available", $as));
    }

    /**
     * Sets the given property to the given value, takes care of updating parentNode info
     *
     * A helper for __set() / replaceChild() / removeChild() / setWhatever() methods. As the method accepts any
     * Node instance as $value, more stringent class / interface checks should be performed in calling methods.
     *
     * @template Prop of Node
     * @param Prop|null $property
     * @param Prop|null $value
     */
    protected function setProperty(?Node &$property, ?Node $value): void
    {
        if ($value === $property) {
            // no-op
            return;
        }
        if (null !== $value) {
            // we do not allow the same node in different places
            if ($this === $value->getParentNode()) {
                $this->removeChild($value);
            }
            $value->setParentNode($this);
        }

        [$oldValue, $property] = [$property, $value];

        if (null !== $oldValue) {
            if ($oldValue instanceof self) {
                $oldValue->parentNode = null;
            } else {
                $oldValue->setParentNode(null);
            }
        }
    }

    /**
     * Sets the given property to the given value, takes care of updating parentNode info, does not allow nulls
     *
     * @template Prop of Node
     * @param Prop $property
     * @param Prop $value
     */
    protected function setRequiredProperty(Node &$property, Node $value): void
    {
        if ($value !== $property) {
            $this->setProperty($property, $value);
        }
    }
}


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

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>Jasmine Test Runner</title>
	<link rel="stylesheet" type="text/css" href="lib/jasmine/jasmine-core/jasmine.css"/>

		<textarea id="text1"></textarea>

		<form>
			<textarea id="text2"></textarea>
		</form>


text:
  Augerville-la-Rivière est
       un village
       localisé dans le département de Loiret en Centre. Elle totalisait 228 habitants en 2008.

À coté de Augerville-la-Rivière sont positionnées géographiquement les villes de
Coudray située à 5 km, 415 habitants,
Boulancourt localisée à 0 km, 349 habitants,
Buthiers à 3 km, 737 habitants,
Malesherbes localisée à 4 km, 6 044 habitants,
Fromont située à 5 km, 222 habitants,
Labrosse à 3 km, 88 habitants,
 entre autres. De plus, Augerville-la-Rivière est située à seulement 28 km de Étampes.

La ville propose quelques  équipements, elle propose entre autres un parcours de golf.

Si vous pensez venir habiter à Augerville-la-Rivière, vous pourrez aisément trouver une maison à vendre.

Le nombre d'habitations, à Augerville-la-Rivière, était réparti en 2011 en un appartements et 136 maisons soit
 un marché relativement équilibré.


text:
package com.jarektoro.responsivelayout;

import com.vaadin.annotations.StyleSheet;
import com.vaadin.ui.CssLayout;

/**
 * Created by JarekToro on 9/23/16.
 */

@StyleSheet("styles.css")
public class ResponsiveLayout extends CssLayout {

    // just about the same as a StyleAdpterCssLayout
    // mainly syntax diffs.
    public ResponsiveLayout() {
        super();
        setHeightUndefined();
        setWidth("100%");
    }

    //when size is set to full. It sets the css property 'overflow' to 'hidden'
    // this inhibits scrolling to counter act that you can set a boolean var to add scrolling
    public void setSizeFull(boolean scrollable) {
        super.setSizeFull();

        if (scrollable) {
            addStyleName("scrollable-anyway");
        } else {
            removeStyleName("scrollable-anyway");
        }

    }

    /**
     * Adds the {@code ResponsiveRow} provided as a component.
     *
     * @param responsiveRow A {@code ResponsiveRow}
     */
    public void addRow(ResponsiveRow responsiveRow) {
        addComponent(responsiveRow);
    }

    public ResponsiveRow addRow() {

        ResponsiveRow row = new ResponsiveRow();

        addComponent(row);

        return row;
    }

}


text:
#include "cinder/Timeline.h"

#include <algorithm>
#include <vector>

using namespace std;

namespace cinder {

////////////////////////////////////////////////////////////////////////////////////////
// Timeline
typedef std::multimap<void*,TimelineItemRef>::iterator s_iter;
typedef std::multimap<void*,TimelineItemRef>::const_iterator s_const_iter;

Timeline::Timeline()
	: TimelineItem( 0, 0, 0, 0 ), mDefaultAutoRemove( true ), mCurrentTime( 0 )
{
	mUseAbsoluteTime = true;
}

Timeline::Timeline( const Timeline &rhs )
	: TimelineItem( rhs ), mDefaultAutoRemove( rhs.mDefaultAutoRemove ), mCurrentTime( rhs.mCurrentTime )
{
	for( s_const_iter iter = rhs.mItems.begin(); iter != rhs.mItems.end(); ++iter ) {
		mItems.insert( make_pair( iter->first, iter->second->clone() ) );
	}
}

void Timeline::step( float timestep )
{
	mCurrentTime += timestep;
	stepTo( mCurrentTime, timestep < 0 );
}

void Timeline::stepTo( float absoluteTime )
{
	bool reverse = mCurrentTime > absoluteTime;
	mCurrentTime = absoluteTime;

	eraseMarked();

	// we need to cache the end(). If a tween's update() fn or similar were to manipulate
	// the list of items by adding new ones, we'll have invalidated our iterator.
	// Deleted items are never removed immediately, but are marked for deletion.
	s_iter endItem = mItems.end();
	for( s_iter iter = mItems.begin(); iter != endItem; ++iter ) {
		iter->second->stepTo( mCurrentTime, reverse );
		if( iter->second->isComplete() && iter->second->getAutoRemove() )
			iter->second->mMarkedForRemoval = true;
	}

	eraseMarked();
}

CueRef Timeline::add( const std::function<void ()> &action, float atTime )
{
	CueRef newCue( new Cue( action, atTime ) );
	newCue->setAutoRemove( mDefaultAutoRemove );
	insert( newCue );
	return newCue;
}

void Timeline::clear()
{
	mItems.clear();
}

void Timeline::appendPingPong()
{
	vector<TimelineItemRef> toAppend;

	float duration = mDuration;
	for( s_iter iter = mItems.begin(); iter != mItems.end(); ++iter ) {
		TimelineItemRef cloned = iter->second->cloneReverse();
		cloned->mStartTime = duration + ( duration - ( cloned->mStartTime + cloned->mDuration ) );
		toAppend.push_back( cloned );
	}

	for( vector<TimelineItemRef>::const_iterator appIt = toAppend.begin(); appIt != toAppend.end(); ++appIt ) {
		mItems.insert( make_pair( (*appIt)->mTarget, *appIt ) );
	}

	setDurationDirty();
}

void Timeline::apply( TimelineItemRef item )
{
	if( item->getTarget() )
		removeTarget( item->getTarget() );
	insert( item );
}

void Timeline::add( TimelineItemRef item )
{
	item->mParent = this;
	item->mStartTime = mCurrentTime;
	mItems.insert( make_pair( item->mTarget, item ) );
	setDurationDirty();
}

void Timeline::insert( TimelineItemRef item )
{
	item->mParent = this;
	mItems.insert( make_pair( item->mTarget, item ) );
	setDurationDirty();
}

// remove all items which have been marked for removal
void Timeline::eraseMarked()
{
	bool needRecalc = false;
	for( s_iter iter = mItems.begin(); iter != mItems.end(); ) {
		if( iter->second->mMarkedForRemoval ) {
			mItems.erase( iter++ );
			needRecalc = true;
		}
		else
			++iter;
	}

	if( needRecalc )
		setDurationDirty();
}

float Timeline::calcDuration() const
{
	float duration = 0;
	for( s_const_iter iter = mItems.begin(); iter != mItems.end(); ++iter ) {
		duration = std::max( iter->second->getEndTime(), duration );
	}

	return duration;
}

TimelineItemRef Timeline::find( void *target ) const
{
	s_const_iter iter = mItems.begin();
	while( iter != mItems.end() ) {
		if( iter->second->getTarget() == target )
			return iter->second;
		++iter;
	}

	return TimelineItemRef(); // failed returns null tween
}

TimelineItemRef Timeline::findLast( void *target ) const
{
	s_const_iter result = mItems.end();
	for( s_const_iter iter = mItems.begin(); iter != mItems.end(); ++iter ) {
		if( iter->second->getTarget() == target && ( ! iter->second->mMarkedForRemoval ) ) {
			if( result == mItems.end() )
				result = iter;
			else if( iter->second->getStartTime() > result->second->getStartTime() )
				result = iter;
		}
	}

	return (result == mItems.end() ) ? TimelineItemRef() : result->second;
}

TimelineItemRef Timeline::findLastEnd( void *target ) const
{
	pair<s_const_iter,s_const_iter> range = mItems.equal_range( target );

	s_const_iter result = mItems.end();
	for( s_const_iter iter = range.first; iter != range.second; ++iter ) {
		if( iter->second->getTarget() == target && ( ! iter->second->mMarkedForRemoval ) ) {
			if( result == mItems.end() )
				result = iter;
			else if( iter->second->getEndTime() > result->second->getEndTime() )
				result = iter;
		}
	}

	if( result != mItems.end() )
		return result->second;
	else
		return TimelineItemRef();
}

float Timeline::findEndTimeOf( void *target, bool *found ) const
{
	pair<s_const_iter,s_const_iter> range = mItems.equal_range( target );

	s_const_iter result = mItems.end();
	for( s_const_iter iter = range.first; iter != range.second; ++iter ) {
		if( iter->second->getTarget() == target && ( ! iter->second->mMarkedForRemoval ) ) {
			if( result == mItems.end() )
				result = iter;
			else if( iter->second->getEndTime() > result->second->getEndTime() )
				result = iter;
		}
	}

	if( result != mItems.end() ) {
		if( found )
			*found = true;
		return result->second->getEndTime();
	}
	else {
		if( found )
			*found = false;
		return getCurrentTime();
	}
}

void Timeline::remove( TimelineItemRef item )
{
	for( s_iter iter = mItems.begin(); iter != mItems.end(); ++iter ) {
		if( iter->second == item ) {
			iter->second->mMarkedForRemoval = true;
			break;
		}
	}
}

void Timeline::removeTarget( void *target )
{
	if( target == 0 )
		return;

	pair<s_iter,s_iter> range = mItems.equal_range( target );
	for( s_iter iter = range.first; iter != range.second; ++iter )
		iter->second->mMarkedForRemoval = true;

	setDurationDirty();
}

void Timeline::cloneAndReplaceTarget( void *target, void *replacementTarget )
{
	if( target == 0 )
		return;

	pair<s_iter,s_iter> range = mItems.equal_range( target );

	vector<TimelineItemRef> newItems;
	newItems.reserve( std::distance( range.first, range.second ) );
	for( s_iter iter = range.first; iter != range.second; ++iter ) {
		newItems.push_back( iter->second->clone() );
		newItems.back()->setTarget( replacementTarget );
	}

	for( vector<TimelineItemRef>::iterator newItemIt = newItems.begin(); newItemIt != newItems.end(); ++newItemIt )
		mItems.insert( make_pair( replacementTarget, *newItemIt ) );

	setDurationDirty();
}

void Timeline::replaceTarget( void *target, void *replacementTarget )
{
	if( target == nullptr )
		return;

	s_iter iter = mItems.find( target );
	while( ( iter != mItems.end() ) && ( iter->first == target ) ) {
		iter->second->setTarget( replacementTarget );
		mItems.insert( make_pair( replacementTarget, iter->second ) );
		iter = mItems.erase( iter );
	}
}

void Timeline::reset( bool unsetStarted )
{
	TimelineItem::reset( unsetStarted );

	for( s_iter iter = mItems.begin(); iter != mItems.end(); ++iter )
		iter->second->reset( unsetStarted );
}

void Timeline::loopStart()
{
	reset( false );
}

void Timeline::reverse()
{
	for( s_iter iter = mItems.begin(); iter != mItems.end(); ++iter )
		iter->second->reverse();
}

TimelineItemRef Timeline::clone() const
{
	return TimelineItemRef( new Timeline( *this ) );
}

TimelineItemRef Timeline::cloneReverse() const
{
	Timeline *result = new Timeline( *this );
	for( s_iter iter = result->mItems.begin(); iter != result->mItems.end(); ++iter ) {
		iter->second->reverse();
		iter->second->mStartTime = mDuration + ( mDuration - ( iter->second->mStartTime + iter->second->mDuration ) );
	}
	return TimelineItemRef( result );
}

void Timeline::update( float absTime )
{
	absTime = loopTime( absTime );
	stepTo( absTime );
}

void Timeline::itemTimeChanged( TimelineItem *item )
{
	setDurationDirty();
}

////////////////////////////////////////////////////////////////////////////////////////
// Cue
Cue::Cue( const std::function<void ()> &fn, float atTime )
	: TimelineItem( 0, 0, atTime, 0 ), mFunction( fn )
{
}

void Cue::loopStart()
{
	if( mFunction )
		mFunction();
}

TimelineItemRef Cue::clone() const
{
	return TimelineItemRef( new Cue( *this ) );
}

TimelineItemRef Cue::cloneReverse() const
{
	return TimelineItemRef( new Cue( *this ) );
}

} // namespace cinder


text:
package examplepb

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// ResponseBodyServiceClient is the client API for ResponseBodyService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ResponseBodyServiceClient interface {
	GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error)
	ListResponseBodies(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseBodyOut, error)
	ListResponseStrings(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseStrings, error)
	GetResponseBodyStream(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (ResponseBodyService_GetResponseBodyStreamClient, error)
}

type responseBodyServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewResponseBodyServiceClient(cc grpc.ClientConnInterface) ResponseBodyServiceClient {
	return &responseBodyServiceClient{cc}
}

func (c *responseBodyServiceClient) GetResponseBody(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*ResponseBodyOut, error) {
	out := new(ResponseBodyOut)
	err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/GetResponseBody", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *responseBodyServiceClient) ListResponseBodies(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseBodyOut, error) {
	out := new(RepeatedResponseBodyOut)
	err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseBodies", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *responseBodyServiceClient) ListResponseStrings(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (*RepeatedResponseStrings, error) {
	out := new(RepeatedResponseStrings)
	err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseStrings", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *responseBodyServiceClient) GetResponseBodyStream(ctx context.Context, in *ResponseBodyIn, opts ...grpc.CallOption) (ResponseBodyService_GetResponseBodyStreamClient, error) {
	stream, err := c.cc.NewStream(ctx, &ResponseBodyService_ServiceDesc.Streams[0], "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/GetResponseBodyStream", opts...)
	if err != nil {
		return nil, err
	}
	x := &responseBodyServiceGetResponseBodyStreamClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type ResponseBodyService_GetResponseBodyStreamClient interface {
	Recv() (*ResponseBodyOut, error)
	grpc.ClientStream
}

type responseBodyServiceGetResponseBodyStreamClient struct {
	grpc.ClientStream
}

func (x *responseBodyServiceGetResponseBodyStreamClient) Recv() (*ResponseBodyOut, error) {
	m := new(ResponseBodyOut)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// ResponseBodyServiceServer is the server API for ResponseBodyService service.
// All implementations should embed UnimplementedResponseBodyServiceServer
// for forward compatibility
type ResponseBodyServiceServer interface {
	GetResponseBody(context.Context, *ResponseBodyIn) (*ResponseBodyOut, error)
	ListResponseBodies(context.Context, *ResponseBodyIn) (*RepeatedResponseBodyOut, error)
	ListResponseStrings(context.Context, *ResponseBodyIn) (*RepeatedResponseStrings, error)
	GetResponseBodyStream(*ResponseBodyIn, ResponseBodyService_GetResponseBodyStreamServer) error
}

// UnimplementedResponseBodyServiceServer should be embedded to have forward compatible implementations.
type UnimplementedResponseBodyServiceServer struct {
}

func (UnimplementedResponseBodyServiceServer) GetResponseBody(context.Context, *ResponseBodyIn) (*ResponseBodyOut, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetResponseBody not implemented")
}
func (UnimplementedResponseBodyServiceServer) ListResponseBodies(context.Context, *ResponseBodyIn) (*RepeatedResponseBodyOut, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListResponseBodies not implemented")
}
func (UnimplementedResponseBodyServiceServer) ListResponseStrings(context.Context, *ResponseBodyIn) (*RepeatedResponseStrings, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListResponseStrings not implemented")
}
func (UnimplementedResponseBodyServiceServer) GetResponseBodyStream(*ResponseBodyIn, ResponseBodyService_GetResponseBodyStreamServer) error {
	return status.Errorf(codes.Unimplemented, "method GetResponseBodyStream not implemented")
}

// UnsafeResponseBodyServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ResponseBodyServiceServer will
// result in compilation errors.
type UnsafeResponseBodyServiceServer interface {
	mustEmbedUnimplementedResponseBodyServiceServer()
}

func RegisterResponseBodyServiceServer(s grpc.ServiceRegistrar, srv ResponseBodyServiceServer) {
	s.RegisterService(&ResponseBodyService_ServiceDesc, srv)
}

func _ResponseBodyService_GetResponseBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ResponseBodyIn)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ResponseBodyServiceServer).GetResponseBody(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/GetResponseBody",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ResponseBodyServiceServer).GetResponseBody(ctx, req.(*ResponseBodyIn))
	}
	return interceptor(ctx, in, info, handler)
}

func _ResponseBodyService_ListResponseBodies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ResponseBodyIn)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ResponseBodyServiceServer).ListResponseBodies(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseBodies",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ResponseBodyServiceServer).ListResponseBodies(ctx, req.(*ResponseBodyIn))
	}
	return interceptor(ctx, in, info, handler)
}

func _ResponseBodyService_ListResponseStrings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ResponseBodyIn)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ResponseBodyServiceServer).ListResponseStrings(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService/ListResponseStrings",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ResponseBodyServiceServer).ListResponseStrings(ctx, req.(*ResponseBodyIn))
	}
	return interceptor(ctx, in, info, handler)
}

func _ResponseBodyService_GetResponseBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ResponseBodyIn)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ResponseBodyServiceServer).GetResponseBodyStream(m, &responseBodyServiceGetResponseBodyStreamServer{stream})
}

type ResponseBodyService_GetResponseBodyStreamServer interface {
	Send(*ResponseBodyOut) error
	grpc.ServerStream
}

type responseBodyServiceGetResponseBodyStreamServer struct {
	grpc.ServerStream
}

func (x *responseBodyServiceGetResponseBodyStreamServer) Send(m *ResponseBodyOut) error {
	return x.ServerStream.SendMsg(m)
}

// ResponseBodyService_ServiceDesc is the grpc.ServiceDesc for ResponseBodyService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ResponseBodyService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc.gateway.examples.internal.proto.examplepb.ResponseBodyService",
	HandlerType: (*ResponseBodyServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetResponseBody",
			Handler:    _ResponseBodyService_GetResponseBody_Handler,
		},
		{
			MethodName: "ListResponseBodies",
			Handler:    _ResponseBodyService_ListResponseBodies_Handler,
		},
		{
			MethodName: "ListResponseStrings",
			Handler:    _ResponseBodyService_ListResponseStrings_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "GetResponseBodyStream",
			Handler:       _ResponseBodyService_GetResponseBodyStream_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "examples/internal/proto/examplepb/response_body_service.proto",
}


text:
import java.util.*;
class Assign {
  String[] foo() {
    Set<String> set = Collections.singleton("s");
    String[] arr;
    arr = set.toArray(new String[0]);
    return arr;
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<places>
    <locality name="Luleå">
        <location altitude="17" latitude="65.5842" longitude="22.1547"/>
    </locality>
    <locality name="Skellefteå">
        <location altitude="55" latitude="64.4444" longitude="20.9644"/>
    </locality>
    <locality name="Kåge">
        <location altitude="20" latitude="64.8444" longitude="20.9844"/>
    </locality>
    <locality name="Stockholm">
        <location altitude="20" latitude="59.3250" longitude="18.0707"/>
    </locality>
</places>


text:
<?php
/*
Plugin Name: WP-Mail-SMTP
Version: 0.10.1
Plugin URI: http://www.callum-macdonald.com/code/wp-mail-smtp/
Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
Author: Callum Macdonald
Author URI: http://www.callum-macdonald.com/
*/

/**
 * @author Callum Macdonald
 * @copyright Callum Macdonald, 2007-11, All Rights Reserved
 * This code is released under the GPL licence version 3 or later, available here
 * http://www.gnu.org/licenses/gpl.txt
 */

/**
 * Setting options in wp-config.php
 *
 * Specifically aimed at WPMU users, you can set the options for this plugin as
 * constants in wp-config.php. This disables the plugin's admin page and may
 * improve performance very slightly. Copy the code below into wp-config.php.
 */
/*
define('WPMS_ON', true);
define('WPMS_MAIL_FROM', 'From Email');
define('WPMS_MAIL_FROM_NAME', 'From Name');
define('WPMS_MAILER', 'smtp'); // Possible values 'smtp', 'mail', or 'sendmail'
define('WPMS_SET_RETURN_PATH', 'false'); // Sets $phpmailer->Sender if true
define('WPMS_SMTP_HOST', 'localhost'); // The SMTP mail host
define('WPMS_SMTP_PORT', 25); // The SMTP server port number
define('WPMS_SSL', ''); // Possible values '', 'ssl', 'tls' - note TLS is not STARTTLS
define('WPMS_SMTP_AUTH', true); // True turns on SMTP authentication, false turns it off
define('WPMS_SMTP_USER', 'username'); // SMTP authentication username, only used if WPMS_SMTP_AUTH is true
define('WPMS_SMTP_PASS', 'password'); // SMTP authentication password, only used if WPMS_SMTP_AUTH is true
*/

// Array of options and their default values
global $wpms_options; // This is horrible, should be cleaned up at some point
$wpms_options = array (
	'mail_from' => '',
	'mail_from_name' => '',
	'mailer' => 'smtp',
	'mail_set_return_path' => 'false',
	'smtp_host' => 'localhost',
	'smtp_port' => '25',
	'smtp_ssl' => 'none',
	'smtp_auth' => false,
	'smtp_user' => '',
	'smtp_pass' => '',
	'pepipost_user' => '',
	'pepipost_pass' => '',
	'pepipost_port' => '2525',
	'pepipost_ssl' => 'none'
);

/**
 * Activation function. This function creates the required options and defaults.
 */
if (!function_exists('wp_mail_smtp_activate')) :
function wp_mail_smtp_activate() {

	global $wpms_options;

	// Create the required options...
	foreach ($wpms_options as $name => $val) {
		add_option($name,$val);
	}

}
endif;

if (!function_exists('wp_mail_smtp_whitelist_options')) :
function wp_mail_smtp_whitelist_options($whitelist_options) {

	global $wpms_options;

	// Add our options to the array
	$whitelist_options['email'] = array_keys($wpms_options);

	return $whitelist_options;

}
endif;

// To avoid any (very unlikely) clashes, check if the function alredy exists
if (!function_exists('phpmailer_init_smtp')) :
// This code is copied, from wp-includes/pluggable.php as at version 2.2.2
function phpmailer_init_smtp($phpmailer) {

	// If constants are defined, apply those options
	if (defined('WPMS_ON') && WPMS_ON) {

		$phpmailer->Mailer = WPMS_MAILER;

		if (WPMS_SET_RETURN_PATH)
			$phpmailer->Sender = $phpmailer->From;

		if (WPMS_MAILER == 'smtp') {
			$phpmailer->SMTPSecure = WPMS_SSL;
			$phpmailer->Host = WPMS_SMTP_HOST;
			$phpmailer->Port = WPMS_SMTP_PORT;
			if (WPMS_SMTP_AUTH) {
				$phpmailer->SMTPAuth = true;
				$phpmailer->Username = WPMS_SMTP_USER;
				$phpmailer->Password = WPMS_SMTP_PASS;
			}
		}

		// If you're using contstants, set any custom options here
		$phpmailer = apply_filters('wp_mail_smtp_custom_options', $phpmailer);

	}
	else {

		// Check that mailer is not blank, and if mailer=smtp, host is not blank
		if ( ! get_option('mailer') || ( get_option('mailer') == 'smtp' && ! get_option('smtp_host') ) ) {
			return;
		}

    // If the mailer is pepipost, make sure we have a username and password
    if (get_option('mailer') == 'pepipost' && (! get_option('pepipost_user') && ! get_option('pepipost_pass'))) {
      return;
    }

		// Set the mailer type as per config above, this overrides the already called isMail method
		$phpmailer->Mailer = get_option('mailer');

		// Set the Sender (return-path) if required
		if (get_option('mail_set_return_path'))
			$phpmailer->Sender = $phpmailer->From;

		// Set the SMTPSecure value, if set to none, leave this blank
		$phpmailer->SMTPSecure = get_option('smtp_ssl') == 'none' ? '' : get_option('smtp_ssl');

		// If we're sending via SMTP, set the host
		if (get_option('mailer') == "smtp") {

			// Set the SMTPSecure value, if set to none, leave this blank
			$phpmailer->SMTPSecure = get_option('smtp_ssl') == 'none' ? '' : get_option('smtp_ssl');

			// Set the other options
			$phpmailer->Host = get_option('smtp_host');
			$phpmailer->Port = get_option('smtp_port');

			// If we're using smtp auth, set the username & password
			if (get_option('smtp_auth') == "true") {
				$phpmailer->SMTPAuth = TRUE;
				$phpmailer->Username = get_option('smtp_user');
				$phpmailer->Password = get_option('smtp_pass');
			}
		} elseif (get_option('mailer') == 'pepipost') {
      // Set the Pepipost settings
      $phpmailer->Mailer = 'smtp';
      $phpmailer->Host = 'smtp.pepipost.com';
      $phpmailer->Port = get_option('pepipost_port');
      $phpmailer->SMTPSecure = get_option('pepipost_ssl') == 'none' ? '' : get_option('pepipost_ssl');;
      $phpmailer->SMTPAuth = TRUE;
      $phpmailer->Username = get_option('pepipost_user');
      $phpmailer->Password = get_option('pepipost_pass');
    }

		// You can add your own options here, see the phpmailer documentation for more info:
		// http://phpmailer.sourceforge.net/docs/
		$phpmailer = apply_filters('wp_mail_smtp_custom_options', $phpmailer);

		// STOP adding options here.

	}

} // End of phpmailer_init_smtp() function definition
endif;

/**
 * This function outputs the plugin options page.
 */
if (!function_exists('wp_mail_smtp_options_page')) :
// Define the function
function wp_mail_smtp_options_page() {

	// Load the options
	global $wpms_options, $phpmailer;

	// Make sure the PHPMailer class has been instantiated
	// (copied verbatim from wp-includes/pluggable.php)
	// (Re)create it, if it's gone missing
	if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) {
		require_once ABSPATH . WPINC . '/class-phpmailer.php';
		require_once ABSPATH . WPINC . '/class-smtp.php';
		$phpmailer = new PHPMailer( true );
	}

	// Send a test mail if necessary
	if (isset($_POST['wpms_action']) && $_POST['wpms_action'] == __('Send Test', 'wp_mail_smtp') && is_email($_POST['to'])) {

		check_admin_referer('test-email');

		// Set up the mail variables
		$to = $_POST['to'];
		$subject = 'WP Mail SMTP: ' . __('Test mail to ', 'wp_mail_smtp') . $to;
		$message = __('This is a test email generated by the WP Mail SMTP WordPress plugin.', 'wp_mail_smtp');

		// Set SMTPDebug to true
		$phpmailer->SMTPDebug = true;

		// Start output buffering to grab smtp debugging output
		ob_start();

		// Send the test mail
		$result = wp_mail($to,$subject,$message);

		// Strip out the language strings which confuse users
		//unset($phpmailer->language);
		// This property became protected in WP 3.2

		// Grab the smtp debugging output
		$smtp_debug = ob_get_clean();

		// Output the response
		?>

<?php _e('Test Message Sent', 'wp_mail_smtp'); ?>

<?php _e('The result was:', 'wp_mail_smtp'); ?>

<?php var_dump($result); ?>

<?php _e('The full debugging output is shown below:', 'wp_mail_smtp'); ?>

<?php var_dump($phpmailer); ?>

<?php _e('The SMTP debugging output is shown below:', 'wp_mail_smtp'); ?>

<?php echo $smtp_debug ?>

		<?php

		// Destroy $phpmailer so it doesn't cause issues later
		unset($phpmailer);

	}

	?>

<?php _e('Advanced Email Options', 'wp_mail_smtp'); ?>

<form method="post" action="options.php">
<?php wp_nonce_field('email-options'); ?>

<?php _e('From Email', 'wp_mail_smtp'); ?>
<input name="mail_from" type="text" id="mail_from" value="<?php print(get_option('mail_from')); ?>" size="40" class="regular-text" />

<?php _e('You can specify the email address that emails should be sent from. If you leave this blank, the default email will be used.', 'wp_mail_smtp'); if(get_option('db_version') < 6124) { print('
'); _e('Please Note: You appear to be using a version of WordPress prior to 2.3. Please ignore the From Name field and instead enter Name<email@domain.com> in this field.', 'wp_mail_smtp'); print(''); } ?>

<?php _e('From Name', 'wp_mail_smtp'); ?>
<input name="mail_from_name" type="text" id="mail_from_name" value="<?php print(get_option('mail_from_name')); ?>" size="40" class="regular-text" />

<?php _e('You can specify the name that emails should be sent from. If you leave this blank, the emails will be sent from WordPress.', 'wp_mail_smtp'); ?>

<?php _e('Mailer', 'wp_mail_smtp'); ?>
<fieldset><legend class="screen-reader-text"><?php _e('Mailer', 'wp_mail_smtp'); ?></legend>

<input id="mailer_smtp" class="wpms_mailer" type="radio" name="mailer" value="smtp" <?php checked('smtp', get_option('mailer')); ?> />
<?php _e('Send all WordPress emails via SMTP.', 'wp_mail_smtp'); ?>

<input id="mailer_pepipost" class="wpms_mailer" type="radio" name="mailer" value="pepipost" <?php checked('pepipost', get_option('mailer')); ?> />
<?php _e('Use Pepipost SMTP to send emails.', 'wp_mail_smtp'); ?>

<input id="mailer_mail" class="wpms_mailer" type="radio" name="mailer" value="mail" <?php checked('mail', get_option('mailer')); ?> />
<?php _e('Use the PHP mail() function to send emails.', 'wp_mail_smtp'); ?>

</fieldset>

Looking for high inbox delivery? Try Pepipost with easy setup and free emails. Learn more here.

<?php _e('Return Path', 'wp_mail_smtp'); ?>
<fieldset><legend class="screen-reader-text"><?php _e('Return Path', 'wp_mail_smtp'); ?></legend>
<input name="mail_set_return_path" type="checkbox" id="mail_set_return_path" value="true" <?php checked('true', get_option('mail_set_return_path')); ?> />
<?php _e('Set the return-path to match the From Email'); ?>
</fieldset>

<input type="submit" name="submit" id="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" />

<?php _e('SMTP Options', 'wp_mail_smtp'); ?>

<?php _e('These options only apply if you have chosen to send mail by SMTP above.', 'wp_mail_smtp'); ?>

<?php _e('SMTP Host', 'wp_mail_smtp'); ?>
<input name="smtp_host" type="text" id="smtp_host" value="<?php print(get_option('smtp_host')); ?>" size="40" class="regular-text" />

<?php _e('SMTP Port', 'wp_mail_smtp'); ?>
<input name="smtp_port" type="text" id="smtp_port" value="<?php print(get_option('smtp_port')); ?>" size="6" class="regular-text" />

<?php _e('Encryption', 'wp_mail_smtp'); ?>

  <fieldset>
    <legend class="screen-reader-text"><?php _e('Encryption', 'wp_mail_smtp'); ?></legend>
<input id="smtp_ssl_none" type="radio" name="smtp_ssl" value="none" <?php checked('none', get_option('smtp_ssl')); ?> />
<?php _e('No encryption.', 'wp_mail_smtp'); ?>

<input id="smtp_ssl_ssl" type="radio" name="smtp_ssl" value="ssl" <?php checked('ssl', get_option('smtp_ssl')); ?> />
<?php _e('Use SSL encryption.', 'wp_mail_smtp'); ?>

<input id="smtp_ssl_tls" type="radio" name="smtp_ssl" value="tls" <?php checked('tls', get_option('smtp_ssl')); ?> />
<?php _e('Use TLS encryption.', 'wp_mail_smtp'); ?>

<?php esc_html_e('TLS is not the same as STARTTLS. For most servers SSL is the recommended option.'); ?>

<?php _e('Authentication', 'wp_mail_smtp'); ?>

  <fieldset>
    <legend class="screen-reader-text"><?php _e('Authentication', 'wp_mail_smtp'); ?></legend>
<input id="smtp_auth_false" type="radio" name="smtp_auth" value="false" <?php checked('false', get_option('smtp_auth')); ?> />
<?php _e('No: Do not use SMTP authentication.', 'wp_mail_smtp'); ?>

<input id="smtp_auth_true" type="radio" name="smtp_auth" value="true" <?php checked('true', get_option('smtp_auth')); ?> />
<?php _e('Yes: Use SMTP authentication.', 'wp_mail_smtp'); ?>

<?php _e('If this is set to no, the values below are ignored.', 'wp_mail_smtp'); ?>

  </fieldset>

<?php _e('Username', 'wp_mail_smtp'); ?>
<input name="smtp_user" type="text" id="smtp_user" value="<?php print(get_option('smtp_user')); ?>" size="40" class="code" />

<?php _e('Password', 'wp_mail_smtp'); ?>

  <input name="smtp_pass" type="text" id="smtp_pass" value="<?php print(get_option('smtp_pass')); ?>" size="40" class="code" />

<?php printf(esc_html__('This is in plain text because it must be stored encrypted. For more information, click %1$shere%2$s'), '', ''); ?>.

<input type="submit" name="submit" id="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" />

<?php _e('Pepipost SMTP Options', 'wp_mail_smtp'); ?>

You need to signup on Pepipost to get the SMTP username/password. Refer this doc for more help.

      <?php _e('Username', 'wp_mail_smtp'); ?>
      <input name="pepipost_user" type="text" id="pepipost_user" value="<?php print(get_option('pepipost_user')); ?>" size="40" class="code" />

      <?php _e('Password', 'wp_mail_smtp'); ?>
      <input name="pepipost_pass" type="text" id="pepipost_pass" value="<?php print(get_option('pepipost_pass')); ?>" size="40" class="code" />

			<?php _e('SMTP Port', 'wp_mail_smtp'); ?>
			<input name="pepipost_port" type="text" id="pepipost_port" value="<?php print(get_option('pepipost_port')); ?>" size="6" class="regular-text" />

			<?php _e('Encryption', 'wp_mail_smtp'); ?>

			  <fieldset>
			    <legend class="screen-reader-text">

							<?php _e('Encryption', 'wp_mail_smtp'); ?>

					</legend>
				<input id="pepipost_ssl_none" type="radio" name="pepipost_ssl" value="none" <?php checked('none', get_option('pepipost_ssl')); ?> />
				<?php _e('No encryption.', 'wp_mail_smtp'); ?>

				<input id="pepipost_ssl_ssl" type="radio" name="pepipost_ssl" value="ssl" <?php checked('ssl', get_option('pepipost_ssl')); ?> />
				<?php _e('Use SSL encryption.', 'wp_mail_smtp'); ?>

				<input id="pepipost_ssl_tls" type="radio" name="pepipost_ssl" value="tls" <?php checked('tls', get_option('pepipost_ssl')); ?> />
				<?php _e('Use TLS encryption.', 'wp_mail_smtp'); ?>

<input type="submit" name="submit" id="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" />

<input type="hidden" name="action" value="update" />

<input type="hidden" name="option_page" value="email">
</form>

<?php _e('Send a Test Email', 'wp_mail_smtp'); ?>

<form method="POST" action="options-general.php?page=<?php echo plugin_basename(__FILE__); ?>">
<?php wp_nonce_field('test-email'); ?>

<?php _e('To', 'wp_mail_smtp'); ?>
<input name="to" type="text" id="to" value="" size="40" class="code" />

<?php _e('Type an email address here and then click Send Test to generate a test email.', 'wp_mail_smtp'); ?>

<input type="submit" name="wpms_action" id="wpms_action" class="button-primary" value="<?php _e('Send Test', 'wp_mail_smtp'); ?>" />

</form>

	<?php

} // End of wp_mail_smtp_options_page() function definition
endif;

/**
 * This function adds the required page (only 1 at the moment).
 */
if (!function_exists('wp_mail_smtp_menus')) :
function wp_mail_smtp_menus() {

	if (function_exists('add_submenu_page')) {
		add_options_page(__('Advanced Email Options', 'wp_mail_smtp'),__('Email', 'wp_mail_smtp'),'manage_options',__FILE__,'wp_mail_smtp_options_page');
	}

} // End of wp_mail_smtp_menus() function definition
endif;

/**
 * This function sets the from email value
 */
if (!function_exists('wp_mail_smtp_mail_from')) :
function wp_mail_smtp_mail_from ($orig) {

	// This is copied from pluggable.php lines 348-354 as at revision 10150
	// http://trac.wordpress.org/browser/branches/2.7/wp-includes/pluggable.php#L348

	// Get the site domain and get rid of www.
	$sitename = strtolower( $_SERVER['SERVER_NAME'] );
	if ( substr( $sitename, 0, 4 ) == 'www.' ) {
		$sitename = substr( $sitename, 4 );
	}

	$default_from = 'wordpress@' . $sitename;
	// End of copied code

	// If the from email is not the default, return it unchanged
	if ( $orig != $default_from ) {
		return $orig;
	}

	if (defined('WPMS_ON') && WPMS_ON) {
		if (defined('WPMS_MAIL_FROM') && WPMS_MAIL_FROM != false)
			return WPMS_MAIL_FROM;
	}
	elseif (is_email(get_option('mail_from'), false))
		return get_option('mail_from');

	// If in doubt, return the original value
	return $orig;

} // End of wp_mail_smtp_mail_from() function definition
endif;

/**
 * This function sets the from name value
 */
if (!function_exists('wp_mail_smtp_mail_from_name')) :
function wp_mail_smtp_mail_from_name ($orig) {

	// Only filter if the from name is the default
	if ($orig == 'WordPress') {
		if (defined('WPMS_ON') && WPMS_ON) {
			if (defined('WPMS_MAIL_FROM_NAME') && WPMS_MAIL_FROM_NAME != false)
				return WPMS_MAIL_FROM_NAME;
		}
		elseif ( get_option('mail_from_name') != "" && is_string(get_option('mail_from_name')) )
			return get_option('mail_from_name');
	}

	// If in doubt, return the original value
	return $orig;

} // End of wp_mail_smtp_mail_from_name() function definition
endif;

function wp_mail_plugin_action_links( $links, $file ) {
	if ( $file != plugin_basename( __FILE__ ))
		return $links;

	$settings_link = '' . __( 'Settings', 'wp_mail_smtp' ) . '';

	array_unshift( $links, $settings_link );

	return $links;
}

// Add an action on phpmailer_init
add_action('phpmailer_init','phpmailer_init_smtp');

if (!defined('WPMS_ON') || !WPMS_ON) {
	// Whitelist our options
	add_filter('whitelist_options', 'wp_mail_smtp_whitelist_options');
	// Add the create pages options
	add_action('admin_menu','wp_mail_smtp_menus');
	// Add an activation hook for this plugin
	register_activation_hook(__FILE__,'wp_mail_smtp_activate');
	// Adds "Settings" link to the plugin action page
	add_filter( 'plugin_action_links', 'wp_mail_plugin_action_links',10,2);
}

// Add filters to replace the mail from name and emailaddress
add_filter('wp_mail_from','wp_mail_smtp_mail_from');
add_filter('wp_mail_from_name','wp_mail_smtp_mail_from_name');

load_plugin_textdomain('wp_mail_smtp', false, dirname(plugin_basename(__FILE__)) . '/langs');

?>


text:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <solid android:color="@color/colorUnReadPoem"/>
    <corners android:bottomRightRadius="12dp" android:bottomLeftRadius="12dp"
        android:topLeftRadius="12dp" android:topRightRadius="12dp"/>
    <padding android:left="@dimen/toggle_favorites_padding"
        android:top="@dimen/toggle_favorites_padding"
        android:right="@dimen/toggle_favorites_padding"
        android:bottom="@dimen/toggle_favorites_padding" />
</shape>


text:
#include "mirtk/Common.h"
#include "mirtk/Options.h"

#include "mirtk/IOConfig.h"
#include "mirtk/BaseImage.h"

using namespace mirtk;

// =============================================================================
// Help
// =============================================================================

// -----------------------------------------------------------------------------
void PrintHelp(const char *name)
{
  cout << "\n";
  cout << "Usage: " << name << " <input> <output> [options]\n";
  cout << "\n";
  cout << "Description:\n";
  cout << "  Swaps the two image dimensions at a time, in the order of the input\n";
  cout << "  options. Both, the image data and the coordinates of the image origin\n";
  cout << "  are swapped each time an input option is processed. To swap the image\n";
  cout << "  axes instead of the origin, use the :option:`-axes` option before the\n";
  cout << "  swap options. This option should be used to reorder the image dimensions\n";
  cout << "  without changing the world coordinates of the voxels. When swapping of\n";
  cout << "  the coordinate axes is enabled, the coordinates of the image origin are\n";
  cout << "  kept the same, i.e., :option:`-origin` is ignored. The default behavior\n";
  cout << "  is to swap the image data and the coordinates of the image origin. This\n";
  cout << "  may in many cases not have the desired effect, but has been this way\n";
  cout << "  already for some time.\n";
  cout << "\n";
  cout << "Options:\n";
  cout << "  -axes [on|off]     Enable/disable swapping of the coordinate axes. (default: off)\n";
  cout << "  -noaxes            Disable swapping of the coordinate axes.\n";
  cout << "  -origin [on|off]   Enable/disable swapping of the origin coordinates. (default: on)\n";
  cout << "  -noorigin          Disable swapping of the origin coordinates.\n";
  cout << "  -xy, -yx           Swap x and y dimension.\n";
  cout << "  -xz, -zx           Swap x and z dimension.\n";
  cout << "  -xt, -tx           Swap x and t dimension.\n";
  cout << "  -yz, -zy           Swap y and z dimension.\n";
  cout << "  -yt, -ty           Swap y and t dimension.\n";
  cout << "  -zt, -tz           Swap z and t dimension.\n";
  PrintStandardOptions(cout);
  cout << endl;
}

// =============================================================================
// Main
// =============================================================================

// -----------------------------------------------------------------------------
int main(int argc, char **argv)
{
  EXPECTS_POSARGS(2);

  const char *input_name  = POSARG(1);
  const char *output_name = POSARG(2);

  InitializeIOLibrary();
  UniquePtr<BaseImage> image(BaseImage::New(input_name));
  bool modify_origin = true;
  bool modify_axes   = false;

  for (ALL_OPTIONS) {
    if (OPTION("-xy") || OPTION("-yx")) {
      if (modify_axes) {
        image->SwapXY(true);
      } else {
        image->FlipXY(modify_origin);
      }
    }
    else if (OPTION("-xz") || OPTION("-zx")) {
      if (modify_axes) {
        image->SwapXZ(true);
      } else {
        image->FlipXZ(modify_origin);
      }
    }
    else if (OPTION("-xt") || OPTION("-tx")) {
      if (modify_axes) {
        image->SwapXT(true);
      } else {
        image->FlipXT(modify_origin);
      }
    }
    else if (OPTION("-yz") || OPTION("-zy")) {
      if (modify_axes) {
        image->SwapYZ(true);
      } else {
        image->FlipYZ(modify_origin);
      }
    }
    else if (OPTION("-yt") || OPTION("-ty")) {
      if (modify_axes) {
        image->SwapYT(true);
      } else {
        image->FlipYT(modify_origin);
      }
    }
    else if (OPTION("-zt") || OPTION("-tz")) {
      if (modify_axes) {
        image->SwapZT(true);
      } else {
        image->FlipZT(modify_origin);
      }
    }
    else if (OPTION("-axes")) {
      modify_axes = true;
      if (HAS_ARGUMENT) {
        PARSE_ARGUMENT(modify_axes);
      }
    }
    else if (OPTION("-noaxes")) {
      modify_axes = false;
    }
    else if (OPTION("-origin")) {
      modify_origin = true;
      if (HAS_ARGUMENT) {
        PARSE_ARGUMENT(modify_origin);
      }
    }
    else if (OPTION("-noorigin")) {
      modify_origin = false;
    }
    else HANDLE_COMMON_OR_UNKNOWN_OPTION();
  }

  image->Write(output_name);

  return 0;
}


text:
#ifndef GGO_GROUPS_H
#define GGO_GROUPS_H

#include "my_string.h"
#include "my_map.h"

/**
 * Represents a group of options
 */
struct Group
{
  string desc;
  bool required;

  Group(const string &s, bool r) : desc (s), required (r) {}
};

typedef map<string,Group> groups_collection_t;

/**
 * Represents a mode of options
 */
struct Mode
{
  string desc;

  Mode(const string &s) : desc (s) {}
};

typedef map<string,Mode> modes_collection_t;

#endif // GROUPS_H


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>MVP Studio</title>
	<link rel="stylesheet" href="style.css">

				<button class="dropbtn">MENU</button>
				<button class="btn-hamburger-js-slideout-toggle"></button>

HOME

WHO WE ARE

HOW IT WORKS

SHOWCASE

HOME

WHO WE ARE

HOW IT WORKS

SHOWCASE

WORK WITH MVP STUDIO

Are you ready to grow your business or organization? We are a collaborative and fun group of web professionals who strive to provide cost–effective design solutions that support your organization's mission and suits your exact needs. Working with small businesses, startups and community–oriented organizations are our specialty.

© 2017 MVP STUDIO.

ALL RIGHTS RESERVED.

					TERMS OF USE

					PRIVACY POLICY


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.orc;

import com.facebook.presto.common.Subfield;
import com.facebook.presto.common.block.Block;
import com.facebook.presto.common.type.Type;
import com.facebook.presto.orc.cache.OrcFileTailSource;
import com.facebook.presto.orc.cache.StorageOrcFileTailSource;
import com.facebook.presto.orc.metadata.CompressionKind;
import com.facebook.presto.orc.metadata.DwrfEncryption;
import com.facebook.presto.orc.metadata.DwrfStripeCache;
import com.facebook.presto.orc.metadata.DwrfStripeCacheData;
import com.facebook.presto.orc.metadata.EncryptionGroup;
import com.facebook.presto.orc.metadata.ExceptionWrappingMetadataReader;
import com.facebook.presto.orc.metadata.Footer;
import com.facebook.presto.orc.metadata.Metadata;
import com.facebook.presto.orc.metadata.OrcFileTail;
import com.facebook.presto.orc.metadata.OrcType;
import com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion;
import com.facebook.presto.orc.metadata.StripeInformation;
import com.facebook.presto.orc.stream.OrcInputStream;
import com.facebook.presto.orc.stream.SharedBuffer;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
import io.airlift.slice.Slice;
import io.airlift.units.DataSize;
import org.joda.time.DateTimeZone;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Predicate;

import static com.facebook.presto.orc.DwrfEncryptionInfo.createNodeToGroupMap;
import static com.facebook.presto.orc.NoopOrcAggregatedMemoryContext.NOOP_ORC_AGGREGATED_MEMORY_CONTEXT;
import static com.facebook.presto.orc.NoopOrcLocalMemoryContext.NOOP_ORC_LOCAL_MEMORY_CONTEXT;
import static com.facebook.presto.orc.OrcDecompressor.createOrcDecompressor;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.lang.Math.toIntExact;
import static java.util.Objects.requireNonNull;

public class OrcReader
{
    public static final int MAX_BATCH_SIZE = 1024;
    public static final int INITIAL_BATCH_SIZE = 1;
    public static final int BATCH_SIZE_GROWTH_FACTOR = 2;

    private final OrcDataSource orcDataSource;
    private final ExceptionWrappingMetadataReader metadataReader;
    private final HiveWriterVersion hiveWriterVersion;
    private final int bufferSize;
    private final CompressionKind compressionKind;
    private final Optional<OrcDecompressor> decompressor;
    private final Optional<EncryptionLibrary> encryptionLibrary;
    private final Map<Integer, Integer> dwrfEncryptionGroupMap;
    private final Map<Integer, Slice> columnsToIntermediateKeys;
    private final Footer footer;
    private final Metadata metadata;

    private final Optional<OrcWriteValidation> writeValidation;

    private final StripeMetadataSource stripeMetadataSource;
    private final OrcReaderOptions orcReaderOptions;

    private final boolean cacheable;

    // This is based on the Apache Hive ORC code
    public OrcReader(
            OrcDataSource orcDataSource,
            OrcEncoding orcEncoding,
            OrcFileTailSource orcFileTailSource,
            StripeMetadataSource stripeMetadataSource,
            OrcAggregatedMemoryContext aggregatedMemoryContext,
            OrcReaderOptions orcReaderOptions,
            boolean cacheable,
            DwrfEncryptionProvider dwrfEncryptionProvider,
            DwrfKeyProvider dwrfKeyProvider)
            throws IOException
    {
        this(
                orcDataSource,
                orcEncoding,
                orcFileTailSource,
                StripeMetadataSourceFactory.of(stripeMetadataSource),
                Optional.empty(),
                aggregatedMemoryContext,
                orcReaderOptions,
                cacheable,
                dwrfEncryptionProvider,
                dwrfKeyProvider);
    }

    public OrcReader(
            OrcDataSource orcDataSource,
            OrcEncoding orcEncoding,
            OrcFileTailSource orcFileTailSource,
            StripeMetadataSourceFactory stripeMetadataSourceFactory,
            OrcAggregatedMemoryContext aggregatedMemoryContext,
            OrcReaderOptions orcReaderOptions,
            boolean cacheable,
            DwrfEncryptionProvider dwrfEncryptionProvider,
            DwrfKeyProvider dwrfKeyProvider)
            throws IOException
    {
        this(
                orcDataSource,
                orcEncoding,
                orcFileTailSource,
                stripeMetadataSourceFactory,
                Optional.empty(),
                aggregatedMemoryContext,
                orcReaderOptions,
                cacheable,
                dwrfEncryptionProvider,
                dwrfKeyProvider);
    }

    OrcReader(
            OrcDataSource orcDataSource,
            OrcEncoding orcEncoding,
            OrcFileTailSource orcFileTailSource,
            StripeMetadataSourceFactory stripeMetadataSourceFactory,
            Optional<OrcWriteValidation> writeValidation,
            OrcAggregatedMemoryContext aggregatedMemoryContext,
            OrcReaderOptions orcReaderOptions,
            boolean cacheable,
            DwrfEncryptionProvider dwrfEncryptionProvider,
            DwrfKeyProvider dwrfKeyProvider)
            throws IOException
    {
        this.orcReaderOptions = requireNonNull(orcReaderOptions, "orcReaderOptions is null");
        orcDataSource = wrapWithCacheIfTiny(orcDataSource, orcReaderOptions.getTinyStripeThreshold(), aggregatedMemoryContext);
        this.orcDataSource = orcDataSource;
        requireNonNull(orcEncoding, "orcEncoding is null");
        this.metadataReader = new ExceptionWrappingMetadataReader(orcDataSource.getId(), orcEncoding.createMetadataReader());

        this.writeValidation = requireNonNull(writeValidation, "writeValidation is null");

        OrcFileTail orcFileTail = orcFileTailSource.getOrcFileTail(orcDataSource, metadataReader, writeValidation, cacheable);
        this.bufferSize = orcFileTail.getBufferSize();
        this.compressionKind = orcFileTail.getCompressionKind();
        this.decompressor = createOrcDecompressor(orcDataSource.getId(), compressionKind, bufferSize, orcReaderOptions.isOrcZstdJniDecompressionEnabled());
        this.hiveWriterVersion = orcFileTail.getHiveWriterVersion();

        try (InputStream footerInputStream = new OrcInputStream(
                orcDataSource.getId(),
                // Memory is not accounted as the buffer is expected to be tiny and will be immediately discarded
                new SharedBuffer(NOOP_ORC_LOCAL_MEMORY_CONTEXT),
                orcFileTail.getFooterSlice().getInput(),
                decompressor,
                Optional.empty(),
                aggregatedMemoryContext,
                orcFileTail.getFooterSize())) {
            this.footer = metadataReader.readFooter(hiveWriterVersion, footerInputStream, dwrfEncryptionProvider, dwrfKeyProvider, orcDataSource, decompressor);
        }
        if (this.footer.getTypes().size() == 0) {
            throw new OrcCorruptionException(orcDataSource.getId(), "File has no columns");
        }

        Optional<DwrfEncryption> encryption = footer.getEncryption();
        if (encryption.isPresent()) {
            requireNonNull(dwrfEncryptionProvider, "dwrfEncryptionProvider is null");
            requireNonNull(dwrfKeyProvider, "dwrfKeyProvider is null");
            validateEncryption(footer, this.orcDataSource.getId());
            this.dwrfEncryptionGroupMap = createNodeToGroupMap(
                    encryption.get().getEncryptionGroups().stream()
                            .map(EncryptionGroup::getNodes)
                            .collect(toImmutableList()),
                    footer.getTypes());
            this.encryptionLibrary = Optional.of(dwrfEncryptionProvider.getEncryptionLibrary(encryption.get().getKeyProvider()));
            this.columnsToIntermediateKeys = ImmutableMap.copyOf(dwrfKeyProvider.getIntermediateKeys(footer.getTypes()));
        }
        else {
            this.dwrfEncryptionGroupMap = ImmutableMap.of();
            this.encryptionLibrary = Optional.empty();
            this.columnsToIntermediateKeys = ImmutableMap.of();
        }

        try (InputStream metadataInputStream = new OrcInputStream(
                orcDataSource.getId(),
                // Memory is not accounted as the buffer is expected to be tiny and will be immediately discarded
                new SharedBuffer(NOOP_ORC_LOCAL_MEMORY_CONTEXT),
                orcFileTail.getMetadataSlice().getInput(),
                decompressor,
                Optional.empty(),
                aggregatedMemoryContext,
                orcFileTail.getMetadataSize())) {
            this.metadata = metadataReader.readMetadata(hiveWriterVersion, metadataInputStream);
        }
        validateWrite(writeValidation, orcDataSource, validation -> validation.getColumnNames().equals(footer.getTypes().get(0).getFieldNames()), "Unexpected column names");
        validateWrite(writeValidation, orcDataSource, validation -> validation.getRowGroupMaxRowCount() == footer.getRowsInRowGroup(), "Unexpected rows in group");
        if (writeValidation.isPresent()) {
            writeValidation.get().validateMetadata(orcDataSource.getId(), footer.getUserMetadata());
            writeValidation.get().validateFileStatistics(orcDataSource.getId(), footer.getFileStats());
            writeValidation.get().validateStripeStatistics(orcDataSource.getId(), footer.getStripes(), metadata.getStripeStatsList());
        }

        this.cacheable = requireNonNull(cacheable, "hiveFileContext is null");

        Optional<DwrfStripeCache> dwrfStripeCache = Optional.empty();
        if (orcFileTail.getDwrfStripeCacheData().isPresent() && footer.getDwrfStripeCacheOffsets().isPresent()) {
            DwrfStripeCacheData dwrfStripeCacheData = orcFileTail.getDwrfStripeCacheData().get();
            DwrfStripeCache cache = dwrfStripeCacheData.buildDwrfStripeCache(footer.getStripes(), footer.getDwrfStripeCacheOffsets().get());
            dwrfStripeCache = Optional.of(cache);
        }

        requireNonNull(stripeMetadataSourceFactory, "stripeMetadataSourceFactory is null");
        this.stripeMetadataSource = requireNonNull(stripeMetadataSourceFactory.create(dwrfStripeCache), "stripeMetadataSource is null");
    }

    @VisibleForTesting
    public static void validateEncryption(Footer footer, OrcDataSourceId dataSourceId)
    {
        if (!footer.getEncryption().isPresent()) {
            return;
        }
        DwrfEncryption dwrfEncryption = footer.getEncryption().get();
        int encryptionGroupSize = dwrfEncryption.getEncryptionGroups().size();
        List<StripeInformation> stripes = footer.getStripes();
        if (!stripes.isEmpty() && encryptionGroupSize > 0 && stripes.get(0).getKeyMetadata().isEmpty()) {
            throw new OrcCorruptionException(dataSourceId, "Stripe encryption keys are missing, but file is encrypted");
        }
        for (StripeInformation stripe : stripes) {
            if (!stripe.getKeyMetadata().isEmpty() && stripe.getKeyMetadata().size() != encryptionGroupSize) {
                throw new OrcCorruptionException(
                        dataSourceId,
                        "Number of stripe encryption keys did not match number of encryption groups.  Expected %s, but found %s",
                        encryptionGroupSize,
                        stripe.getKeyMetadata().size());
            }
        }
    }

    public List<String> getColumnNames()
    {
        return footer.getTypes().get(0).getFieldNames();
    }

    public List<OrcType> getTypes()
    {
        return footer.getTypes();
    }

    public Footer getFooter()
    {
        return footer;
    }

    public Metadata getMetadata()
    {
        return metadata;
    }

    public int getBufferSize()
    {
        return bufferSize;
    }

    public CompressionKind getCompressionKind()
    {
        return compressionKind;
    }

    public OrcBatchRecordReader createBatchRecordReader(
            Map<Integer, Type> includedColumns,
            OrcPredicate predicate,
            DateTimeZone hiveStorageTimeZone,
            OrcAggregatedMemoryContext systemMemoryUsage,
            int initialBatchSize)
            throws OrcCorruptionException
    {
        return createBatchRecordReader(includedColumns, predicate, 0, getOrcDataSource().getSize(), hiveStorageTimeZone, systemMemoryUsage, initialBatchSize);
    }

    public OrcBatchRecordReader createBatchRecordReader(
            Map<Integer, Type> includedColumns,
            OrcPredicate predicate,
            long offset,
            long length,
            DateTimeZone hiveStorageTimeZone,
            OrcAggregatedMemoryContext systemMemoryUsage,
            int initialBatchSize)
            throws OrcCorruptionException
    {
        return new OrcBatchRecordReader(
                requireNonNull(includedColumns, "includedColumns is null"),
                requireNonNull(predicate, "predicate is null"),
                footer.getNumberOfRows(),
                footer.getStripes(),
                footer.getFileStats(),
                metadata.getStripeStatsList(),
                getOrcDataSource(),
                offset,
                length,
                footer.getTypes(),
                decompressor,
                encryptionLibrary,
                dwrfEncryptionGroupMap,
                columnsToIntermediateKeys,
                footer.getRowsInRowGroup(),
                requireNonNull(hiveStorageTimeZone, "hiveStorageTimeZone is null"),
                new OrcRecordReaderOptions(orcReaderOptions),
                hiveWriterVersion,
                metadataReader,
                footer.getUserMetadata(),
                systemMemoryUsage.newOrcAggregatedMemoryContext(),
                writeValidation,
                initialBatchSize,
                stripeMetadataSource,
                cacheable);
    }

    public OrcSelectiveRecordReader createSelectiveRecordReader(
            Map<Integer, Type> includedColumns,
            List<Integer> outputColumns,
            Map<Integer, Map<Subfield, TupleDomainFilter>> filters,
            List<FilterFunction> filterFunctions,
            Map<Integer, Integer> filterFunctionInputs,
            Map<Integer, List<Subfield>> requiredSubfields,
            Map<Integer, Object> constantValues,
            Map<Integer, Function<Block, Block>> coercers,
            OrcPredicate predicate,
            long offset,
            long length,
            DateTimeZone hiveStorageTimeZone,
            boolean legacyMapSubscript,
            OrcAggregatedMemoryContext systemMemoryUsage,
            Optional<OrcWriteValidation> writeValidation,
            int initialBatchSize)
    {
        return new OrcSelectiveRecordReader(
                includedColumns,
                outputColumns,
                filters,
                filterFunctions,
                filterFunctionInputs,
                requiredSubfields,
                constantValues,
                coercers,
                predicate,
                footer.getNumberOfRows(),
                footer.getStripes(),
                footer.getFileStats(),
                metadata.getStripeStatsList(),
                getOrcDataSource(),
                offset,
                length,
                footer.getTypes(),
                decompressor,
                encryptionLibrary,
                dwrfEncryptionGroupMap,
                columnsToIntermediateKeys,
                footer.getRowsInRowGroup(),
                hiveStorageTimeZone,
                new OrcRecordReaderOptions(orcReaderOptions),
                legacyMapSubscript,
                hiveWriterVersion,
                metadataReader,
                footer.getUserMetadata(),
                systemMemoryUsage.newOrcAggregatedMemoryContext(),
                writeValidation,
                initialBatchSize,
                stripeMetadataSource,
                cacheable);
    }

    private static OrcDataSource wrapWithCacheIfTiny(OrcDataSource dataSource, DataSize maxCacheSize, OrcAggregatedMemoryContext systemMemoryContext)
    {
        if (dataSource instanceof CachingOrcDataSource) {
            return dataSource;
        }
        if (dataSource.getSize() > maxCacheSize.toBytes()) {
            return dataSource;
        }
        DiskRange diskRange = new DiskRange(0, toIntExact(dataSource.getSize()));
        return new CachingOrcDataSource(dataSource, desiredOffset -> diskRange, systemMemoryContext.newOrcLocalMemoryContext(CachingOrcDataSource.class.getSimpleName()));
    }

    static void validateFile(
            OrcWriteValidation writeValidation,
            OrcDataSource input,
            List<Type> types,
            DateTimeZone hiveStorageTimeZone,
            OrcEncoding orcEncoding,
            OrcReaderOptions orcReaderOptions,
            DwrfEncryptionProvider dwrfEncryptionProvider,
            DwrfKeyProvider dwrfKeyProvider)
            throws OrcCorruptionException
    {
        ImmutableMap.Builder<Integer, Type> readTypes = ImmutableMap.builder();
        for (int columnIndex = 0; columnIndex < types.size(); columnIndex++) {
            readTypes.put(columnIndex, types.get(columnIndex));
        }
        try {
            OrcReader orcReader = new OrcReader(
                    input,
                    orcEncoding,
                    new StorageOrcFileTailSource(),
                    StripeMetadataSourceFactory.of(new StorageStripeMetadataSource()),
                    Optional.of(writeValidation),
                    NOOP_ORC_AGGREGATED_MEMORY_CONTEXT,
                    orcReaderOptions,
                    false,
                    dwrfEncryptionProvider,
                    dwrfKeyProvider);
            try (OrcBatchRecordReader orcRecordReader = orcReader.createBatchRecordReader(
                    readTypes.build(),
                    OrcPredicate.TRUE,
                    hiveStorageTimeZone,
                    NOOP_ORC_AGGREGATED_MEMORY_CONTEXT,
                    INITIAL_BATCH_SIZE)) {
                while (orcRecordReader.nextBatch() >= 0) {
                    // ignored
                }
            }
        }
        catch (IOException e) {
            throw new OrcCorruptionException(e, input.getId(), "Validation failed");
        }
    }

    public static void validateWrite(Optional<OrcWriteValidation> writeValidation, OrcDataSource orcDataSource, Predicate<OrcWriteValidation> test, String messageFormat, Object... args)
            throws OrcCorruptionException
    {
        if (writeValidation.isPresent() && !test.test(writeValidation.get())) {
            throw new OrcCorruptionException(orcDataSource.getId(), "Write validation failed: " + messageFormat, args);
        }
    }

    public OrcDataSource getOrcDataSource()
    {
        return orcDataSource;
    }
}