text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography;

using Kirkin.Security.Cryptography.Internal;

namespace Kirkin.Security.Cryptography
{
    /// <summary>
    /// Symmetric crypto algorithm implementation which uses the AES256 CBC cipher,
    /// PKCS7 padding and prefixes the ciphertext with the random IV in plain text.
    /// Appends HMAC-SHA256 hash of the IV + ciphertext to the output.
    /// </summary>
    public sealed class Aes256CbcHmacSha256 : Aes256Cbc
    {
        private const int MAC_LENGTH_IN_BYTES = 32; // 256 bits.

        /// <summary>
        /// Returns the MAC length - 32 bytes (256 bits).
        /// </summary>
        protected internal override int MessageSuffixLength => MAC_LENGTH_IN_BYTES;

        /// <summary>
        /// Creates a new <see cref="Aes256CbcHmacSha256"/> instance with a randomly-generated key.
        /// </summary>
        public Aes256CbcHmacSha256()
            : base()
        {
        }

        /// <summary>
        /// Creates a new <see cref="Aes256CbcHmacSha256"/> instance with the given key.
        /// </summary>
        public Aes256CbcHmacSha256(byte[] key)
            : base(key)
        {
        }

        /// <summary>
        /// Encrypts the given plaintext bytes.
        /// </summary>
        /// <returns>Number of bytes written to the output buffer.</returns>
        protected internal override int EncryptBytes(in ArraySegment<byte> plaintext, byte[] output, int outputOffset)
        {
            byte[] iv = CryptoRandom.GetRandomBytes(Aes256.BlockSizeInBytes);

            // Write IV.
            Array.Copy(iv, 0, output, outputOffset, iv.Length);

            int bytesWritten = iv.Length;
            byte[] hash;

            using (Aes256CbcHmacSha256Key derivedKey = new Aes256CbcHmacSha256Key(Key))
            {
                // Write ciphertext.
                bytesWritten += Aes256.EncryptBytesCbcPkcs7(plaintext, derivedKey.EncryptionKey, iv, output, outputOffset + iv.Length);

                // MAC of the IV + ciphertext portion.
                using (HMACSHA256 hmac = new HMACSHA256(derivedKey.MACKey)) {
                    hash = hmac.ComputeHash(output, outputOffset, bytesWritten);
                }
            }

            Array.Copy(hash, 0, output, outputOffset + bytesWritten, hash.Length);

            return bytesWritten + MAC_LENGTH_IN_BYTES;
        }

        /// <summary>
        /// Decrypts the given ciphertext bytes.
        /// </summary>
        /// <returns>Number of bytes written to the output buffer.</returns>
        protected internal override int DecryptBytes(in ArraySegment<byte> ciphertext, byte[] output, int outputOffset)
        {
            byte[] iv = new byte[Aes256.BlockSizeInBytes];
            byte[] expectedHash = new byte[MAC_LENGTH_IN_BYTES];

            Array.Copy(ciphertext.Array, ciphertext.Offset, iv, 0, iv.Length);
            Array.Copy(ciphertext.Array, ciphertext.Offset + ciphertext.Count - MAC_LENGTH_IN_BYTES, expectedHash, 0, MAC_LENGTH_IN_BYTES);

            using (Aes256CbcHmacSha256Key derivedKey = new Aes256CbcHmacSha256Key(Key))
            {
                byte[] actualHash;

                // MAC of the IV + ciphertext portion.
                using (HMACSHA256 hmac = new HMACSHA256(derivedKey.MACKey)) {
                    actualHash = hmac.ComputeHash(ciphertext.Array, ciphertext.Offset, ciphertext.Count - MAC_LENGTH_IN_BYTES);
                }

                if (!((IStructuralEquatable)expectedHash).Equals(actualHash, EqualityComparer<byte>.Default)) {
                    throw new ArgumentException("MAC validation failed.");
                }

                ArraySegment<byte> ciphertextSlice = new ArraySegment<byte>(ciphertext.Array, ciphertext.Offset + iv.Length, ciphertext.Count - iv.Length - MAC_LENGTH_IN_BYTES);

                return Aes256.DecryptBytesCbcPkcs7(ciphertextSlice, derivedKey.EncryptionKey, iv, output, outputOffset);
            }
        }
    }
}


text:
package minefantasy.mf2.block.tileentity;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;

public class TileEntityBombPress extends TileEntity
{
	public float animation = 0F;

	@Override
	public void updateEntity()
	{
		super.updateEntity();
		if(worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
		{
			if(animation <= 0)
			{
				use(null);
			}
			animation = 1.0F;
		}
		else
		{
			if(animation > 0)
			{
				animation -= 0.05F;
			}
		}
	}

	public void use(EntityPlayer user)
	{
		TileEntity under = worldObj.getTileEntity(xCoord, yCoord-1, zCoord);
		if(animation <= 0 && under != null && under instanceof TileEntityBombBench)
		{
			((TileEntityBombBench)under).tryCraft(user, true);
			animation = 1.0F;
			worldObj.playSoundEffect(xCoord+0.5, yCoord+0.5, zCoord+0.5, "tile.piston.out", 1.0F, 0.75F);
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
<?php

/* FrameworkBundle:Exception:layout.html.twig */
class __TwigTemplate_3f1e30fa71257446a87540d7848e5740 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->blocks = array(
            'body' => array($this, 'block_body'),
        );
    }

    public function display(array $context, array $blocks = array())
    {
        $context = array_merge($this->env->getGlobals(), $context);

        // line 1
        echo "<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=";
        // line 4
        echo twig_escape_filter($this->env, $this->env->getCharset(), "html");
        echo "\"/>
        <title>";
        // line 5
        echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, 'exception', '5'), "message", array(), "any", false, 5), "html");
        echo " (";
        echo twig_escape_filter($this->env, $this->getContext($context, 'status_code', '5'), "html");
        echo " ";
        echo twig_escape_filter($this->env, $this->getContext($context, 'status_text', '5'), "html");
        echo ")</title>
        <style type=\"text/css\">
            html { background: #eee }
            body { font: 11px Verdana, Arial, sans-serif; color: #333 }
            .sf-exceptionreset, .sf-exceptionreset .block, .sf-exceptionreset #message { margin: auto }
        </style>
        <link href=\"";
        // line 11
        echo twig_escape_filter($this->env, $this->env->getExtension('templating')->getAssetUrl("bundles/framework/css/exception.css"), "html");
        echo "\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />
        <script type=\"text/javascript\">
            //<![CDATA[
            function toggle(id, clazz) {
                el = document.getElementById(id);
                current = el.style.display

                if (clazz) {
                    var tags = document.getElementsByTagName('*');
                    for (i = 0; i < tags.length; i++) {
                        if (tags[i].className == clazz) {
                            tags[i].style.display = 'none';
                        }
                    }
                }

                el.style.display = current == 'none' ? 'block' : 'none';
            }
            //]]>
        </script>
    </head>
    <body>
        ";
        // line 33
        $this->displayBlock('body', $context, $blocks);
        // line 34
        echo "    </body>
</html>
";
    }

    // line 33
    public function block_body($context, array $blocks = array())
    {
        echo "";
    }

    public function getTemplateName()
    {
        return "FrameworkBundle:Exception:layout.html.twig";
    }
}


text:
package org.apache.hadoop.sqoop;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.ToolRunner;

/**
 * Command-line arguments used by Sqoop
 */
public class ImportOptions {

  public static final Log LOG = LogFactory.getLog(ImportOptions.class.getName());

  /**
   * Thrown when invalid cmdline options are given
   */
  @SuppressWarnings("serial")
  public static class InvalidOptionsException extends Exception {

    private String message;

    public InvalidOptionsException(final String msg) {
      this.message = msg;
    }

    public String getMessage() {
      return message;
    }

    public String toString() {
      return getMessage();
    }
  }

  // control-flow selector based on command-line switches.
  public enum ControlAction {
    ListDatabases,  // list available databases and exit.
    ListTables,     // list available tables and exit.
    GenerateOnly,   // generate ORM code but do not import.
    FullImport,     // generate code (as needed) and import.
    DebugExec       // just execute a single sql command and print its results.
  }

  // selects in-HDFS destination file format
  public enum FileLayout {
    TextFile,
    SequenceFile
  }

  // TODO(aaron): Adding something here? Add a getter, a cmdline switch, and a properties file
  // entry in loadFromProperties(). Add a default value in initDefaults() if you need one.
  // Make sure you add the stub to the testdata/sqoop.properties.template file.
  private String connectString;
  private String tableName;
  private String [] columns;
  private boolean allTables;
  private String username;
  private String password;
  private String codeOutputDir;
  private String jarOutputDir;
  private ControlAction action;
  private String hadoopHome;
  private String splitByCol;
  private String whereClause;
  private String debugSqlCmd;
  private String driverClassName;
  private String warehouseDir;
  private FileLayout layout;
  private boolean direct; // if true and conn is mysql, use mysqldump.
  private String tmpDir; // where temp data goes; usually /tmp
  private String hiveHome;
  private boolean hiveImport;
  private String packageName; // package to prepend to auto-named classes.
  private String className; // package+class to apply to individual table import.
  private int numMappers;
  private boolean useCompression;
  private long directSplitSize; // In direct mode, open a new stream every X bytes.

  private char inputFieldDelim;
  private char inputRecordDelim;
  private char inputEnclosedBy;
  private char inputEscapedBy;
  private boolean inputMustBeEnclosed;

  private char outputFieldDelim;
  private char outputRecordDelim;
  private char outputEnclosedBy;
  private char outputEscapedBy;
  private boolean outputMustBeEnclosed;

  private boolean areDelimsManuallySet;

  private Configuration conf;

  public static final int DEFAULT_NUM_MAPPERS = 4;

  private static final String DEFAULT_CONFIG_FILE = "sqoop.properties";

  public ImportOptions() {
    initDefaults();
  }

  /**
   * Alternate ImportOptions interface used mostly for unit testing
   * @param connect JDBC connect string to use
   * @param database Database to read
   * @param table Table to read
   */
  public ImportOptions(final String connect, final String table) {
    initDefaults();

    this.connectString = connect;
    this.tableName = table;
  }

  private boolean getBooleanProperty(Properties props, String propName, boolean defaultValue) {
    String str = props.getProperty(propName,
        Boolean.toString(defaultValue)).toLowerCase();
    return "true".equals(str) || "yes".equals(str) || "1".equals(str);
  }

  private long getLongProperty(Properties props, String propName, long defaultValue) {
    String str = props.getProperty(propName,
        Long.toString(defaultValue)).toLowerCase();
    try {
      return Long.parseLong(str);
    } catch (NumberFormatException nfe) {
      LOG.warn("Could not parse integer value for config parameter " + propName);
      return defaultValue;
    }
  }

  private void loadFromProperties() {
    File configFile = new File(DEFAULT_CONFIG_FILE);
    if (!configFile.canRead()) {
      return; //can't do this.
    }

    Properties props = new Properties();
    InputStream istream = null;
    try {
      LOG.info("Loading properties from " + configFile.getAbsolutePath());
      istream = new FileInputStream(configFile);
      props.load(istream);

      this.hadoopHome = props.getProperty("hadoop.home", this.hadoopHome);
      this.codeOutputDir = props.getProperty("out.dir", this.codeOutputDir);
      this.jarOutputDir = props.getProperty("bin.dir", this.jarOutputDir);
      this.username = props.getProperty("db.username", this.username);
      this.password = props.getProperty("db.password", this.password);
      this.tableName = props.getProperty("db.table", this.tableName);
      this.connectString = props.getProperty("db.connect.url", this.connectString);
      this.splitByCol = props.getProperty("db.split.column", this.splitByCol);
      this.whereClause = props.getProperty("db.where.clause", this.whereClause);
      this.driverClassName = props.getProperty("jdbc.driver", this.driverClassName);
      this.warehouseDir = props.getProperty("hdfs.warehouse.dir", this.warehouseDir);
      this.hiveHome = props.getProperty("hive.home", this.hiveHome);
      this.className = props.getProperty("java.classname", this.className);
      this.packageName = props.getProperty("java.packagename", this.packageName);

      this.direct = getBooleanProperty(props, "direct.import", this.direct);
      this.hiveImport = getBooleanProperty(props, "hive.import", this.hiveImport);
      this.useCompression = getBooleanProperty(props, "compression", this.useCompression);
      this.directSplitSize = getLongProperty(props, "direct.split.size",
          this.directSplitSize);
    } catch (IOException ioe) {
      LOG.error("Could not read properties file " + DEFAULT_CONFIG_FILE + ": " + ioe.toString());
    } finally {
      if (null != istream) {
        try {
          istream.close();
        } catch (IOException ioe) {
          // ignore this; we're closing.
        }
      }
    }
  }

  /**
   * @return the temp directory to use; this is guaranteed to end with
   * the file separator character (e.g., '/')
   */
  public String getTempDir() {
    return this.tmpDir;
  }

  private void initDefaults() {
    // first, set the true defaults if nothing else happens.
    // default action is to run the full pipeline.
    this.action = ControlAction.FullImport;
    this.hadoopHome = System.getenv("HADOOP_HOME");

    // Set this with $HIVE_HOME, but -Dhive.home can override.
    this.hiveHome = System.getenv("HIVE_HOME");
    this.hiveHome = System.getProperty("hive.home", this.hiveHome);

    // Set this to cwd, but -Dsqoop.src.dir can override.
    this.codeOutputDir = System.getProperty("sqoop.src.dir", ".");

    String myTmpDir = System.getProperty("test.build.data", "/tmp/");
    if (!myTmpDir.endsWith(File.separator)) {
      myTmpDir = myTmpDir + File.separator;
    }

    this.tmpDir = myTmpDir;
    this.jarOutputDir = tmpDir + "sqoop/compile";
    this.layout = FileLayout.TextFile;

    this.inputFieldDelim = '\000';
    this.inputRecordDelim = '\000';
    this.inputEnclosedBy = '\000';
    this.inputEscapedBy = '\000';
    this.inputMustBeEnclosed = false;

    this.outputFieldDelim = ',';
    this.outputRecordDelim = '\n';
    this.outputEnclosedBy = '\000';
    this.outputEscapedBy = '\000';
    this.outputMustBeEnclosed = false;

    this.areDelimsManuallySet = false;

    this.numMappers = DEFAULT_NUM_MAPPERS;
    this.useCompression = false;
    this.directSplitSize = 0;

    this.conf = new Configuration();

    loadFromProperties();
  }

  /**
   * Allow the user to enter his password on the console without printing characters.
   * @return the password as a string
   */
  private String securePasswordEntry() {
    return new String(System.console().readPassword("Enter password: "));
  }

  /**
   * Print usage strings for the program's arguments.
   */
  public static void printUsage() {
    System.out.println("Usage: hadoop sqoop.jar org.apache.hadoop.sqoop.Sqoop (options)");
    System.out.println("");
    System.out.println("Database connection options:");
    System.out.println("--connect (jdbc-uri)         Specify JDBC connect string");
    System.out.println("--driver (class-name)        Manually specify JDBC driver class to use");
    System.out.println("--username (username)        Set authentication username");
    System.out.println("--password (password)        Set authentication password");
    System.out.println("-P                           Read password from console");
    System.out.println("--direct                     Use direct import fast path (mysql only)");
    System.out.println("");
    System.out.println("Import control options:");
    System.out.println("--table (tablename)          Table to read");
    System.out.println("--columns (col,col,col...)   Columns to export from table");
    System.out.println("--split-by (column-name)     Column of the table used to split work units");
    System.out.println("--where (where clause)       Where clause to use during export");
    System.out.println("--hadoop-home (dir)          Override $HADOOP_HOME");
    System.out.println("--hive-home (dir)            Override $HIVE_HOME");
    System.out.println("--warehouse-dir (dir)        HDFS path for table destination");
    System.out.println("--as-sequencefile            Imports data to SequenceFiles");
    System.out.println("--as-textfile                Imports data as plain text (default)");
    System.out.println("--all-tables                 Import all tables in database");
    System.out.println("                             (Ignores --table, --columns and --split-by)");
    System.out.println("--hive-import                If set, then import the table into Hive.");
    System.out.println("                    (Uses Hive's default delimiters if none are set.)");
    System.out.println("-m, --num-mappers (n)        Use 'n' map tasks to import in parallel");
    System.out.println("-z, --compress               Enable compression");
    System.out.println("--direct-split-size (n)      Split the input stream every 'n' bytes");
    System.out.println("                             when importing in direct mode.");
    System.out.println("");
    System.out.println("Output line formatting options:");
    System.out.println("--fields-terminated-by (char)    Sets the field separator character");
    System.out.println("--lines-terminated-by (char)     Sets the end-of-line character");
    System.out.println("--optionally-enclosed-by (char)  Sets a field enclosing character");
    System.out.println("--enclosed-by (char)             Sets a required field enclosing char");
    System.out.println("--escaped-by (char)              Sets the escape character");
    System.out.println("--mysql-delimiters               Uses MySQL's default delimiter set");
    System.out.println("  fields: ,  lines: \\n  escaped-by: \\  optionally-enclosed-by: '");
    System.out.println("");
    System.out.println("Input parsing options:");
    System.out.println("--input-fields-terminated-by (char)    Sets the input field separator");
    System.out.println("--input-lines-terminated-by (char)     Sets the input end-of-line char");
    System.out.println("--input-optionally-enclosed-by (char)  Sets a field enclosing character");
    System.out.println("--input-enclosed-by (char)             Sets a required field encloser");
    System.out.println("--input-escaped-by (char)              Sets the input escape character");
    System.out.println("");
    System.out.println("Code generation options:");
    System.out.println("--outdir (dir)               Output directory for generated code");
    System.out.println("--bindir (dir)               Output directory for compiled objects");
    System.out.println("--generate-only              Stop after code generation; do not import");
    System.out.println("--package-name (name)        Put auto-generated classes in this package");
    System.out.println("--class-name (name)          When generating one class, use this name.");
    System.out.println("                             This overrides --package-name.");
    System.out.println("");
    System.out.println("Additional commands:");
    System.out.println("--list-tables                List tables in database and exit");
    System.out.println("--list-databases             List all databases available and exit");
    System.out.println("--debug-sql (statement)      Execute 'statement' in SQL and exit");
    System.out.println("");
    System.out.println("Generic Hadoop command-line options:");
    ToolRunner.printGenericCommandUsage(System.out);
    System.out.println("");
    System.out.println("At minimum, you must specify --connect "
        + "and either --table or --all-tables.");
    System.out.println("Alternatively, you can specify --generate-only or one of the additional");
    System.out.println("commands.");
  }

  /**
   * Given a string containing a single character or an escape sequence representing
   * a char, return that char itself.
   *
   * Normal literal characters return themselves: "x" -> 'x', etc.
   * Strings containing a '\' followed by one of t, r, n, or b escape to the usual
   * character as seen in Java: "\n" -> (newline), etc.
   *
   * Strings like "\0ooo" return the character specified by the octal sequence 'ooo'
   * Strings like "\0xhhh" or "\0Xhhh" return the character specified by the hex sequence 'hhh'
   */
  static char toChar(String charish) throws InvalidOptionsException {
    if (null == charish) {
      throw new InvalidOptionsException("Character argument expected."
          + "\nTry --help for usage instructions.");
    } else if (charish.startsWith("\\0x") || charish.startsWith("\\0X")) {
      if (charish.length() == 3) {
        throw new InvalidOptionsException("Base-16 value expected for character argument."
          + "\nTry --help for usage instructions.");
      } else {
        String valStr = charish.substring(3);
        int val = Integer.parseInt(valStr, 16);
        return (char) val;
      }
    } else if (charish.startsWith("\\0")) {
      if (charish.equals("\\0")) {
        // it's just '\0', which we can take as shorthand for nul.
        return '\000';
      } else {
        // it's an octal value.
        String valStr = charish.substring(2);
        int val = Integer.parseInt(valStr, 8);
        return (char) val;
      }
    } else if (charish.startsWith("\\")) {
      if (charish.length() == 1) {
        // it's just a '\'. Keep it literal.
        return '\\';
      } else if (charish.length() > 2) {
        // we don't have any 3+ char escape strings.
        throw new InvalidOptionsException("Cannot understand character argument: " + charish
            + "\nTry --help for usage instructions.");
      } else {
        // this is some sort of normal 1-character escape sequence.
        char escapeWhat = charish.charAt(1);
        switch(escapeWhat) {
        case 'b':
          return '\b';
        case 'n':
          return '\n';
        case 'r':
          return '\r';
        case 't':
          return '\t';
        case '\"':
          return '\"';
        case '\'':
          return '\'';
        case '\\':
          return '\\';
        default:
          throw new InvalidOptionsException("Cannot understand character argument: " + charish
              + "\nTry --help for usage instructions.");
        }
      }
    } else if (charish.length() == 0) {
      throw new InvalidOptionsException("Character argument expected."
          + "\nTry --help for usage instructions.");
    } else {
      // it's a normal character.
      if (charish.length() > 1) {
        LOG.warn("Character argument " + charish + " has multiple characters; "
            + "only the first will be used.");
      }

      return charish.charAt(0);
    }
  }

  /**
   * Read args from the command-line into member fields.
   * @throws Exception if there's a problem parsing arguments.
   */
  public void parse(String [] args) throws InvalidOptionsException {

    if (LOG.isDebugEnabled()) {
      LOG.debug("Parsing sqoop arguments:");
      for (String arg : args) {
        LOG.debug("  " + arg);
      }
    }

    int i = 0;
    try {
      for (i = 0; i < args.length; i++) {
        if (args[i].equals("--connect")) {
          this.connectString = args[++i];
        } else if (args[i].equals("--driver")) {
          this.driverClassName = args[++i];
        } else if (args[i].equals("--table")) {
          this.tableName = args[++i];
        } else if (args[i].equals("--columns")) {
          String columnString = args[++i];
          this.columns = columnString.split(",");
        } else if (args[i].equals("--split-by")) {
          this.splitByCol = args[++i];
        } else if (args[i].equals("--where")) {
          this.whereClause = args[++i];
        } else if (args[i].equals("--list-tables")) {
          this.action = ControlAction.ListTables;
        } else if (args[i].equals("--all-tables")) {
          this.allTables = true;
        } else if (args[i].equals("--local")) {
          // TODO(aaron): Remove this after suitable deprecation time period.
          LOG.warn("--local is deprecated; use --direct instead.");
          this.direct = true;
        } else if (args[i].equals("--direct")) {
          this.direct = true;
        } else if (args[i].equals("--username")) {
          this.username = args[++i];
          if (null == this.password) {
            // Set password to empty if the username is set first,
            // to ensure that they're either both null or neither.
            this.password = "";
          }
        } else if (args[i].equals("--password")) {
          LOG.warn("Setting your password on the command-line is insecure. "
              + "Consider using -P instead.");
          this.password = args[++i];
        } else if (args[i].equals("-P")) {
          this.password = securePasswordEntry();
        } else if (args[i].equals("--hadoop-home")) {
          this.hadoopHome = args[++i];
        } else if (args[i].equals("--hive-home")) {
          this.hiveHome = args[++i];
        } else if (args[i].equals("--hive-import")) {
          this.hiveImport = true;
        } else if (args[i].equals("--num-mappers") || args[i].equals("-m")) {
          String numMappersStr = args[++i];
          this.numMappers = Integer.valueOf(numMappersStr);
        } else if (args[i].equals("--fields-terminated-by")) {
          this.outputFieldDelim = ImportOptions.toChar(args[++i]);
          this.areDelimsManuallySet = true;
        } else if (args[i].equals("--lines-terminated-by")) {
          this.outputRecordDelim = ImportOptions.toChar(args[++i]);
          this.areDelimsManuallySet = true;
        } else if (args[i].equals("--optionally-enclosed-by")) {
          this.outputEnclosedBy = ImportOptions.toChar(args[++i]);
          this.outputMustBeEnclosed = false;
          this.areDelimsManuallySet = true;
        } else if (args[i].equals("--enclosed-by")) {
          this.outputEnclosedBy = ImportOptions.toChar(args[++i]);
          this.outputMustBeEnclosed = true;
          this.areDelimsManuallySet = true;
        } else if (args[i].equals("--escaped-by")) {
          this.outputEscapedBy = ImportOptions.toChar(args[++i]);
          this.areDelimsManuallySet = true;
        } else if (args[i].equals("--mysql-delimiters")) {
          this.outputFieldDelim = ',';
          this.outputRecordDelim = '\n';
          this.outputEnclosedBy = '\'';
          this.outputEscapedBy = '\\';
          this.outputMustBeEnclosed = false;
          this.areDelimsManuallySet = true;
        } else if (args[i].equals("--input-fields-terminated-by")) {
          this.inputFieldDelim = ImportOptions.toChar(args[++i]);
        } else if (args[i].equals("--input-lines-terminated-by")) {
          this.inputRecordDelim = ImportOptions.toChar(args[++i]);
        } else if (args[i].equals("--input-optionally-enclosed-by")) {
          this.inputEnclosedBy = ImportOptions.toChar(args[++i]);
          this.inputMustBeEnclosed = false;
        } else if (args[i].equals("--input-enclosed-by")) {
          this.inputEnclosedBy = ImportOptions.toChar(args[++i]);
          this.inputMustBeEnclosed = true;
        } else if (args[i].equals("--input-escaped-by")) {
          this.inputEscapedBy = ImportOptions.toChar(args[++i]);
        } else if (args[i].equals("--outdir")) {
          this.codeOutputDir = args[++i];
        } else if (args[i].equals("--as-sequencefile")) {
          this.layout = FileLayout.SequenceFile;
        } else if (args[i].equals("--as-textfile")) {
          this.layout = FileLayout.TextFile;
        } else if (args[i].equals("--bindir")) {
          this.jarOutputDir = args[++i];
        } else if (args[i].equals("--warehouse-dir")) {
          this.warehouseDir = args[++i];
        } else if (args[i].equals("--package-name")) {
          this.packageName = args[++i];
        } else if (args[i].equals("--class-name")) {
          this.className = args[++i];
        } else if (args[i].equals("-z") || args[i].equals("--compress")) {
          this.useCompression = true;
        } else if (args[i].equals("--direct-split-size")) {
          this.directSplitSize = Long.parseLong(args[++i]);
        } else if (args[i].equals("--list-databases")) {
          this.action = ControlAction.ListDatabases;
        } else if (args[i].equals("--generate-only")) {
          this.action = ControlAction.GenerateOnly;
        } else if (args[i].equals("--debug-sql")) {
          this.action = ControlAction.DebugExec;
          // read the entire remainder of the commandline into the debug sql statement.
          if (null == this.debugSqlCmd) {
            this.debugSqlCmd = "";
          }
          for (i++; i < args.length; i++) {
            this.debugSqlCmd = this.debugSqlCmd + args[i] + " ";
          }
        } else if (args[i].equals("--help")) {
          printUsage();
          throw new InvalidOptionsException("");
        } else {
          throw new InvalidOptionsException("Invalid argument: " + args[i] + ".\n"
              + "Try --help for usage.");
        }
      }
    } catch (ArrayIndexOutOfBoundsException oob) {
      throw new InvalidOptionsException("Error: " + args[--i] + " expected argument.\n"
          + "Try --help for usage.");
    } catch (NumberFormatException nfe) {
      throw new InvalidOptionsException("Error: " + args[--i] + " expected numeric argument.\n"
          + "Try --help for usage.");
    }
  }

  private static final String HELP_STR = "\nTry --help for usage instructions.";

  /**
   * Validates options and ensures that any required options are
   * present and that any mutually-exclusive options are not selected.
   * @throws Exception if there's a problem.
   */
  public void validate() throws InvalidOptionsException {
    if (this.allTables && this.columns != null) {
      // If we're reading all tables in a database, can't filter column names.
      throw new InvalidOptionsException("--columns and --all-tables are incompatible options."
          + HELP_STR);
    } else if (this.allTables && this.splitByCol != null) {
      // If we're reading all tables in a database, can't set pkey
      throw new InvalidOptionsException("--split-by and --all-tables are incompatible options."
          + HELP_STR);
    } else if (this.allTables && this.className != null) {
      // If we're reading all tables, can't set individual class name
      throw new InvalidOptionsException("--class-name and --all-tables are incompatible options."
          + HELP_STR);
    } else if (this.connectString == null) {
      throw new InvalidOptionsException("Error: Required argument --connect is missing."
          + HELP_STR);
    } else if (this.className != null && this.packageName != null) {
      throw new InvalidOptionsException(
          "--class-name overrides --package-name. You cannot use both." + HELP_STR);
    } else if (this.action == ControlAction.FullImport && !this.allTables
        && this.tableName == null) {
      throw new InvalidOptionsException(
          "One of --table or --all-tables is required for import." + HELP_STR);
    }

    if (this.hiveImport) {
      if (!areDelimsManuallySet) {
        // user hasn't manually specified delimiters, and wants to import straight to Hive.
        // Use Hive-style delimiters.
        LOG.info("Using Hive-specific delimiters for output. You can override");
        LOG.info("delimiters with --fields-terminated-by, etc.");
        this.outputFieldDelim = (char)0x1; // ^A
        this.outputRecordDelim = '\n';
        this.outputEnclosedBy = '\000'; // no enclosing in Hive.
        this.outputEscapedBy = '\000'; // no escaping in Hive
        this.outputMustBeEnclosed = false;
      }

      if (this.getOutputEscapedBy() != '\000') {
        LOG.warn("Hive does not support escape characters in fields;");
        LOG.warn("parse errors in Hive may result from using --escaped-by.");
      }

      if (this.getOutputEnclosedBy() != '\000') {
        LOG.warn("Hive does not support quoted strings; parse errors");
        LOG.warn("in Hive may result from using --enclosed-by.");
      }
    }
  }

  /** get the temporary directory; guaranteed to end in File.separator
   * (e.g., '/')
   */
  public String getTmpDir() {
    return tmpDir;
  }

  public String getConnectString() {
    return connectString;
  }

  public String getTableName() {
    return tableName;
  }

  public String[] getColumns() {
    if (null == columns) {
      return null;
    } else {
      return Arrays.copyOf(columns, columns.length);
    }
  }

  public String getSplitByCol() {
    return splitByCol;
  }

  public String getWhereClause() {
    return whereClause;
  }

  public ControlAction getAction() {
    return action;
  }

  public boolean isAllTables() {
    return allTables;
  }

  public String getUsername() {
    return username;
  }

  public String getPassword() {
    return password;
  }

  public boolean isDirect() {
    return direct;
  }

  /**
   * @return the number of map tasks to use for import
   */
  public int getNumMappers() {
    return this.numMappers;
  }

  /**
   * @return the user-specified absolute class name for the table
   */
  public String getClassName() {
    return className;
  }

  /**
   * @return the user-specified package to prepend to table names via --package-name.
   */
  public String getPackageName() {
    return packageName;
  }

  public String getHiveHome() {
    return hiveHome;
  }

  /** @return true if we should import the table into Hive */
  public boolean doHiveImport() {
    return hiveImport;
  }

  /**
   * @return location where .java files go; guaranteed to end with '/'
   */
  public String getCodeOutputDir() {
    if (codeOutputDir.endsWith(File.separator)) {
      return codeOutputDir;
    } else {
      return codeOutputDir + File.separator;
    }
  }

  /**
   * @return location where .jar and .class files go; guaranteed to end with '/'
   */
  public String getJarOutputDir() {
    if (jarOutputDir.endsWith(File.separator)) {
      return jarOutputDir;
    } else {
      return jarOutputDir + File.separator;
    }
  }

  /**
   * Return the value of $HADOOP_HOME
   * @return $HADOOP_HOME, or null if it's not set.
   */
  public String getHadoopHome() {
    return hadoopHome;
  }

  /**
   * @return a sql command to execute and exit with.
   */
  public String getDebugSqlCmd() {
    return debugSqlCmd;
  }

  /**
   * @return The JDBC driver class name specified with --driver
   */
  public String getDriverClassName() {
    return driverClassName;
  }

  /**
   * @return the base destination path for table uploads.
   */
  public String getWarehouseDir() {
    return warehouseDir;
  }

  /**
   * @return the destination file format
   */
  public FileLayout getFileLayout() {
    return this.layout;
  }

  public void setUsername(String name) {
    this.username = name;
  }

  public void setPassword(String pass) {
    this.password = pass;
  }

  /**
   * @return the field delimiter to use when parsing lines. Defaults to the field delim
   * to use when printing lines
   */
  public char getInputFieldDelim() {
    if (inputFieldDelim == '\000') {
      return this.outputFieldDelim;
    } else {
      return this.inputFieldDelim;
    }
  }

  /**
   * @return the record delimiter to use when parsing lines. Defaults to the record delim
   * to use when printing lines.
   */
  public char getInputRecordDelim() {
    if (inputRecordDelim == '\000') {
      return this.outputRecordDelim;
    } else {
      return this.inputRecordDelim;
    }
  }

  /**
   * @return the character that may enclose fields when parsing lines. Defaults to the
   * enclosing-char to use when printing lines.
   */
  public char getInputEnclosedBy() {
    if (inputEnclosedBy == '\000') {
      return this.outputEnclosedBy;
    } else {
      return this.inputEnclosedBy;
    }
  }

  /**
   * @return the escape character to use when parsing lines. Defaults to the escape
   * character used when printing lines.
   */
  public char getInputEscapedBy() {
    if (inputEscapedBy == '\000') {
      return this.outputEscapedBy;
    } else {
      return this.inputEscapedBy;
    }
  }

  /**
   * @return true if fields must be enclosed by the --enclosed-by character when parsing.
   * Defaults to false. Set true when --input-enclosed-by is used.
   */
  public boolean isInputEncloseRequired() {
    if (inputEnclosedBy == '\000') {
      return this.outputMustBeEnclosed;
    } else {
      return this.inputMustBeEnclosed;
    }
  }

  /**
   * @return the character to print between fields when importing them to text.
   */
  public char getOutputFieldDelim() {
    return this.outputFieldDelim;
  }

  /**
   * @return the character to print between records when importing them to text.
   */
  public char getOutputRecordDelim() {
    return this.outputRecordDelim;
  }

  /**
   * @return a character which may enclose the contents of fields when imported to text.
   */
  public char getOutputEnclosedBy() {
    return this.outputEnclosedBy;
  }

  /**
   * @return a character which signifies an escape sequence when importing to text.
   */
  public char getOutputEscapedBy() {
    return this.outputEscapedBy;
  }

  /**
   * @return true if fields imported to text must be enclosed by the EnclosedBy char.
   * default is false; set to true if --enclosed-by is used instead of --optionally-enclosed-by.
   */
  public boolean isOutputEncloseRequired() {
    return this.outputMustBeEnclosed;
  }

  /**
   * @return true if the user wants imported results to be compressed.
   */
  public boolean shouldUseCompression() {
    return this.useCompression;
  }

  /**
   * @return the file size to split by when using --direct mode.
   */
  public long getDirectSplitSize() {
    return this.directSplitSize;
  }

  public Configuration getConf() {
    return conf;
  }

  public void setConf(Configuration config) {
    this.conf = config;
  }
}


text:
command += oiiotool ("--create 320x240 3 -d uint8 -o black.tif")
command += oiiotool ("--pattern constant:color=0.5,0.5,0.5 128x128 3 -d half -o grey128.exr")
command += oiiotool ("--pattern constant:color=0.5,0.5,0.5 64x64 3 -d half -o grey64.exr")
command += oiiotool ("--create 256x256 3 --fill:color=1,.5,.5 256x256 --fill:color=0,1,0 80x80+100+100 -d uint8 -o filled.tif")

# test --autotrim
command += oiiotool ("black.tif --fill:color=0,1,0 80x80+100+100 --autotrim -d uint8 -o autotrim.tif")

# test --colorcount  (using the results of the --fill test)
command += oiiotool ("filled.tif --colorcount:eps=.1,.1,.1 0,0,0:1,.5,.5:0,1,0")

# test --rangecheck  (using the results of the --fill test)
command += oiiotool ("filled.tif --rangecheck 0,0,0 1,0.9,1")

# test --rangecompress & --rangeexpand
command += oiiotool ("src/tahoe-small.tif --rangecompress -d uint8 -o rangecompress.tif")
command += oiiotool ("rangecompress.tif --rangeexpand -d uint8 -o rangeexpand.tif")
command += oiiotool ("src/tahoe-small.tif --rangecompress:luma=1 -d uint8 -o rangecompress-luma.tif")
command += oiiotool ("rangecompress-luma.tif --rangeexpand:luma=1 -d uint8 -o rangeexpand-luma.tif")

# test resample
command += oiiotool (parent + "/oiio-images/grid.tif --resample 128x128 -o resample.tif")

# test resize
command += oiiotool (parent + "/oiio-images/grid.tif --resize 256x256 -o resize.tif")
command += oiiotool (parent + "/oiio-images/grid.tif --resize 25% -o resize2.tif")

# test extreme resize
command += oiiotool (parent + "/oiio-images/grid.tif --resize 64x64 -o resize64.tif")
command += oiiotool ("resize64.tif --resize 512x512 -o resize512.tif")

# test fit
command += oiiotool (parent + "/oiio-images/grid.tif --fit 360x240 -d uint8 -o fit.tif")
command += oiiotool (parent + "/oiio-images/grid.tif --fit 240x360 -d uint8 -o fit2.tif")
# regression test: --fit without needing resize used to be problematic
command += oiiotool ("src/tahoe-tiny.tif --fit 128x128 -d uint8 -o fit3.tif")

# test --pixelaspect
command += oiiotool ("src/tahoe-small.tif -resize 256x192 --pixelaspect 2.0 -d uint8 -o pixelaspect.tif")

# test rotate
command += oiiotool ("resize.tif --rotate 45 -o rotated.tif")
command += oiiotool ("resize.tif --rotate:center=50,50 45 -o rotated-offcenter.tif")
command += oiiotool ("resize.tif --rotate 45 --rotate 90 --rotate 90 --rotate 90 --rotate 45 -o rotated360.tif")

# test warp
command += oiiotool ("resize.tif --warp 0.7071068,0.7071068,0,-0.7071068,0.7071068,0,128,-53.01933,1 -o warped.tif")

# Test --add
command += oiiotool ("--pattern constant:color=.1,.2,.3 64x64+0+0 3 "
            + " --pattern constant:color=.1,.1,.1 64x64+20+20 3 "
            + " --add -d half -o add.exr")
# Test --addc val (add to all channels the same scalar)
command += oiiotool ("grey128.exr --addc 0.25 -o cadd1.exr")
# Test --addc val,val,val... (add per-channel scalars)
command += oiiotool ("grey128.exr --addc 0,0.25,-0.25 -o cadd2.exr")

# Test --sub, subc
command += oiiotool ("--pattern constant:color=.1,.2,.3 64x64+0+0 3 "
            + " --pattern constant:color=.1,.1,.1 64x64+20+20 3 "
            + " --sub -d half -o sub.exr")
command += oiiotool ("--pattern constant:color=.1,.2,.3 64x64+0+0 3 "
            + " --subc 0.1,0.1,0.1 -d half -o subc.exr")

# test --mul of images
command += oiiotool ("grey64.exr -pattern constant:color=1.5,1,0.5 64x64 3 --mul -o mul.exr")
# Test --mulc val (multiply all channels by the same scalar)
command += oiiotool ("grey128.exr --mulc 1.5 -o cmul1.exr")
# Test --mulc val,val,val... (multiply per-channel scalars)
command += oiiotool ("grey128.exr --mulc 1.5,1,0.5 -o cmul2.exr")

# Test --divc val (divide all channels by the same scalar)
command += oiiotool ("grey64.exr --divc 2.0 -d half -o divc1.exr")
# Test --divc val,val,val... (divide per-channel scalars)
command += oiiotool ("grey64.exr --divc 2.0,1,0.5 -d half -o divc2.exr")
# Test --div of images
command += oiiotool ("grey64.exr --pattern constant:color=2.0,1,0.5 64x64 3 "
                   + "--div -d half -o div.exr")

# test --mad of images
command += oiiotool ("grey64.exr -pattern constant:color=1.5,1,0.5 64x64 3 "
                   + "-pattern constant:color=.1,.1,.1 64x64 3 --mad -o mad.exr")

# test --invert
command += oiiotool ("src/tahoe-small.tif --invert -o invert.tif")

# Test --powc val (raise all channels by the same power)
command += oiiotool ("grey128.exr --powc 2 -o cpow1.exr")
# Test --powc val,val,val... (per-channel powers)
command += oiiotool ("grey128.exr --powc 2,2,1 -o cpow2.exr")

# Test --abs, --absdiff, --absdiffc
# First, make a test image that's 0.5 on the left, -0.5 on the right
command += oiiotool ("-pattern constant:color=-0.25,-0.25,-0.25 64x128 3 "
                   + "-pattern constant:color=0.5,0.5,0.5 64x128 3 "
                   + "-mosaic 2x1 -d half -o negpos.exr")
command += oiiotool ("negpos.exr -abs -o abs.exr")
command += oiiotool ("negpos.exr -pattern constant:color=0.2,0.2,0.2 128x128 3 "
                   + "-absdiff -d half -o absdiff.exr")
command += oiiotool ("negpos.exr -absdiffc 0.2,0.2,0.2 -d half -o absdiffc.exr")

# test --chsum
command += oiiotool ("src/tahoe-small.tif --chsum:weight=.2126,.7152,.0722 "
            + "-d uint8 -o chsum.tif")

# test histogram generation
command += oiiotool ("ref/histogram_input.png --histogram 256x256 0 "
            + "-o histogram_regular.tif")
command += oiiotool ("ref/histogram_input.png --histogram:cumulative=1 256x256 0 "
            + "-o histogram_cumulative.tif")

# test --crop
command += oiiotool (parent + "/oiio-images/grid.tif --crop 100x400+50+200 -o crop.tif")

# test --cut
command += oiiotool (parent + "/oiio-images/grid.tif --cut 100x400+50+200 -o cut.tif")

# test paste
command += oiiotool (parent + "/oiio-images/grid.tif "
            + "--pattern checker 256x256 3 --paste +150+75 -o pasted.tif")

# test --trim
command += oiiotool ("--create 320x240 3 -fill:color=.1,.5,.1 120x80+50+70 "
                     + " -rotate 30 -trim -origin +0+0 -fullpixels -d uint8 -o trim.tif")

# test --trim, tricky case of multiple subimages
command += oiiotool (  "-a --create 320x240 3 -fill:color=.1,.5,.1 120x80+50+70 -rotate 30 "
                     + "--create 320x240 3 -fill:color=.5,.5,.1 100x10+70+70 -rotate 140 "
                     + "--siappend -trim -origin +0+0 -fullpixels -d uint8 -o trimsubimages.tif")

# test mosaic
command += oiiotool ("--pattern constant:color=1,0,0 50x50 3 "
            + "--pattern constant:color=0,1,0 50x50 3 "
            + "--pattern constant:color=0,0,1 50x50 3 "
            + "--pattern constant:color=1,1,1 50x50 3 "
            + "--mosaic:pad=10 2x2 -d uint8 -o mosaic.tif")

# test flip
command += oiiotool ("src/image.tif --flip -o flip.tif")
command += oiiotool ("src/image.tif --crop 180x140+30+30 --flip -o flip-crop.tif")

# test flop
command += oiiotool ("src/image.tif --flop -o flop.tif")
command += oiiotool ("src/image.tif --crop 180x140+30+30 --flop -o flop-crop.tif")

# test rotate90
command += oiiotool ("src/image.tif --rotate90 -o rotate90.tif")
command += oiiotool ("src/image.tif --crop 180x140+30+30 --rotate90 -o rotate90-crop.tif")

# test rotate270
command += oiiotool ("src/image.tif --rotate270 -o rotate270.tif")
command += oiiotool ("src/image.tif --crop 180x140+30+30 --rotate270 -o rotate270-crop.tif")

# test rotate180
command += oiiotool ("src/image.tif --rotate180 -o flipflop.tif")
command += oiiotool ("src/image.tif --crop 160x120+30+30 --rotate180 -o flipflop-crop.tif")

# Tricky: make image, rotate, set Orientation, and then re-orient.
# Make it half size so it can't accidentally match to another test image
# for the rotation tests.
command += oiiotool ("src/image.tif --resample 160x120 --rotate90  --orientccw --reorient -o reorient1.tif")
command += oiiotool ("src/image.tif --resample 160x120 --rotate180 --orient180 --reorient -o reorient2.tif")
command += oiiotool ("src/image.tif --resample 160x120 --rotate270 --orientcw  --reorient -o reorient3.tif")

# test transpose
command += oiiotool ("src/image.tif --transpose -o transpose.tif")
command += oiiotool ("src/image.tif --crop 160x120+30+30 --transpose -o transpose-crop.tif")

# test cshift
command += oiiotool ("src/image.tif --cshift +100+50 -o cshift.tif")

# test channel shuffling
command += oiiotool (parent + "/oiio-images/grid.tif"
            + " --ch =0.25,B,G -o chanshuffle.tif")

# test --ch to separate RGBA from an RGBAZ file
command += oiiotool ("src/rgbaz.exr --ch R,G,B,A -o ch-rgba.exr")
command += oiiotool ("src/rgbaz.exr --ch Z -o ch-z.exr")

# test --chappend to merge RGBA and Z
command += oiiotool ("ch-rgba.exr ch-z.exr --chappend -o chappend-rgbaz.exr")

# test --chnames to rename channels
command += oiiotool ("src/rgbaz.exr --chnames Red,,,,Depth -o chname.exr")
command += info_command ("chname.exr", safematch=1)

# test -d to change data formats
command += oiiotool ("src/rgbaz.exr -d half -o allhalf.exr")
command += info_command ("allhalf.exr", safematch=1)

# test -d NAME=fmt to change data format of one channel, and to make
# sure oiiotool will output per-channel formats.
command += oiiotool ("src/rgbaz.exr -d half -d Z=float -o rgbahalf-zfloat.exr")
command += info_command ("rgbahalf-zfloat.exr", safematch=1)

# test hole filling
command += oiiotool ("ref/hole.tif --fillholes -o tahoe-filled.tif")

# test clamping
command += oiiotool (parent + "/oiio-images/grid.tif --resize 50%"
            + " --clamp:min=0.2:max=,,0.5,1 -o grid-clamped.tif")

# test unpremult/premult
command += oiiotool ("--pattern constant:color=.1,.1,.1,1 100x100 4 "
            + " --fill:color=.2,.2,.2,.5 30x30+50+50 "
            + " -d half -o premulttarget.exr")
command += oiiotool ("premulttarget.exr --unpremult -o unpremult.exr")
command += oiiotool ("unpremult.exr --premult -o premult.exr")

# test kernel
command += oiiotool ("--kernel bspline 15x15 -o bsplinekernel.exr")

# test convolve
command += oiiotool ("src/tahoe-small.tif --kernel bspline 15x15 --convolve "
            + "-d uint8 -o bspline-blur.tif")

# test blur
command += oiiotool ("src/tahoe-small.tif --blur 5x5 -d uint8 -o gauss5x5-blur.tif")

# test median filter
command += oiiotool ("src/tahoe-small.tif --median 5x5 -d uint8 -o tahoe-median.tif")

# test dilate and erode
# command += oiiotool ("--pattern constant:color=0.1,0.1,0.1 80x64 3 --text:x=8:y=54:size=40:font=DroidSerif Aai -o morphsource.tif")
command += oiiotool ("src/morphsource.tif --dilate 3x3 -d uint8 -o dilate.tif")
command += oiiotool ("src/morphsource.tif --erode 3x3 -d uint8 -o erode.tif")
# command += oiiotool ("morphsource.tif --erode 3x3 --dilate 3x3 -d uint8 -o morphopen.tif")
# command += oiiotool ("morphsource.tif --dilate 3x3 --erode 3x3 -d uint8 -o morphclose.tif")
# command += oiiotool ("morphsource.tif morphopen.tif -sub -d uint8 -o tophat.tif")
# command += oiiotool ("morphclose.tif morphsource.tif -sub -d uint8 -o bottomhat.tif")

# test unsharp mask
command += oiiotool ("src/tahoe-small.tif --unsharp -d uint8 -o unsharp.tif")

# test unsharp mask with median filter
command += oiiotool ("src/tahoe-small.tif --unsharp:kernel=median -d uint8 -o unsharp-median.tif")

# test laplacian
command += oiiotool ("src/tahoe-tiny.tif --laplacian -d uint8 -o tahoe-laplacian.tif")

# test fft, ifft
command += oiiotool ("src/tahoe-tiny.tif --ch 2 --fft -d float -o fft.exr")
command += oiiotool ("fft.exr --ifft --ch 0 -d float -o ifft.exr")

# test --polar, --unpolar
# note that fft.exr that we built above is in complex form
command += oiiotool ("fft.exr --polar -d float -o polar.exr")
command += oiiotool ("polar.exr --unpolar -d float -o unpolar.exr")

# test labels
command += oiiotool (
            " --pattern constant:color=0.5,0.0,0.0 128x128 3 --label R " +
            " --pattern constant:color=0.0,0.5,0.0 128x128 3 --label G " +
            " --pattern constant:color=0.5,0.0,0.0 128x128 3 --label B " +
            " --pop --pop --pop " +
            " R G --add -d half -o labeladd.exr")

# test subimages
command += oiiotool ("--pattern constant:color=0.5,0.0,0.0 64x64 3 " +
                     "--pattern constant:color=0.0,0.5,0.0 64x64 3 " +
                     "--siappend -d half -o subimages-2.exr")
command += oiiotool ("--pattern constant:color=0.5,0.0,0.0 64x64 3 --text A -attrib oiio:subimagename layerA " +
                     "--pattern constant:color=0.0,0.5,0.0 64x64 3 --text B -attrib oiio:subimagename layerB " +
                     "--pattern constant:color=0.0,0.0,0.5 64x64 3 --text C -attrib oiio:subimagename layerC " +
                     "--pattern constant:color=0.5,0.5,0.0 64x64 3 --text D -attrib oiio:subimagename layerD " +
                     "--siappendall -d half -o subimages-4.exr")
command += oiiotool ("subimages-4.exr --subimage 3 -o subimageD3.exr")
command += oiiotool ("subimages-4.exr --subimage layerB -o subimageB1.exr")
command += oiiotool ("subimages-2.exr --sisplit -o subimage2.exr " +
                     "--pop -o subimage1.exr")

# test sequences
command += oiiotool ("fit.tif -o copyA.1-10#.jpg");
command += oiiotool (" --info  " +  " ".join(["copyA.{0:04}.jpg".format(x) for x in range(1,11)]))

# test expression substitution
command += oiiotool ("src/tahoe-small.tif --pattern fill:top=0,0,0,0:bottom=0,0,1,1 " +
                     "{TOP.geom} {TOP.nchannels} -d uint8 -o exprgradient.tif")
command += oiiotool ("src/tahoe-small.tif -cut '{TOP.width-20* 2}x{TOP.height-40+(4*2- 2 ) /6-1}+{TOP.x+100.5-80.5 }+{TOP.y+20}' -d uint8 -o exprcropped.tif")
command += oiiotool ("src/tahoe-small.tif -o exprstrcat{TOP.compression}.tif")

# test --no-autopremult on a TGA file thet needs it.
command += oiiotool ("--no-autopremult src/rgba.tga --ch R,G,B -o rgbfromtga.png")

# test --iconfig
command += oiiotool ("--info -v -metamatch Debug --iconfig oiio:DebugOpenConfig! 1 black.tif")

# To add more tests, just append more lines like the above and also add
# the new 'feature.tif' (or whatever you call it) to the outputs list,
# below.

# Outputs to check against references
outputs = [
            "filled.tif",
            "autotrim.tif",
            "resample.tif", "resize.tif", "resize2.tif",
            "resize64.tif", "resize512.tif",
            "fit.tif", "fit2.tif", "fit3.tif",
            "pixelaspect.tif",
            "warped.tif",
            "rotated.tif", "rotated-offcenter.tif", "rotated360.tif",
            "histogram_regular.tif", "histogram_cumulative.tif",
            "crop.tif", "cut.tif", "pasted.tif", "mosaic.tif",
            "trim.tif", "trimsubimages.tif",
            "flip.tif", "flip-crop.tif",
            "flop.tif", "flop-crop.tif",
            "flipflop.tif", "flipflop-crop.tif",
            "rotate90.tif", "rotate90-crop.tif",
            "rotate270.tif", "rotate270-crop.tif",
            "reorient1.tif", "reorient2.tif", "reorient3.tif",
            "transpose.tif", "transpose-crop.tif",
            "cshift.tif",
            "chanshuffle.tif", "ch-rgba.exr", "ch-z.exr",
            "chappend-rgbaz.exr", "chname.exr",
            "add.exr", "cadd1.exr", "cadd2.exr",
            "sub.exr", "subc.exr",
            "mul.exr", "cmul1.exr", "cmul2.exr",
            "div.exr", "divc1.exr", "divc2.exr",
            "mad.exr", "invert.tif",
            "cpow1.exr", "cpow2.exr",
            "abs.exr", "absdiff.exr", "absdiffc.exr",
            "chsum.tif",
            "rgbahalf-zfloat.exr",
            "tahoe-filled.tif",
            "rangecompress.tif", "rangeexpand.tif",
            "rangecompress-luma.tif", "rangeexpand-luma.tif",
            "grid-clamped.tif",
            "unpremult.exr", "premult.exr",
            "bsplinekernel.exr", "bspline-blur.tif",
            "gauss5x5-blur.tif", "tahoe-median.tif",
            "dilate.tif", "erode.tif",
            "unsharp.tif", "unsharp-median.tif", "tahoe-laplacian.tif",
            "fft.exr", "ifft.exr",
            "polar.exr", "unpolar.exr",
            "labeladd.exr",
            "exprgradient.tif", "exprcropped.tif", "exprstrcatlzw.tif",
            "rgbfromtga.png",
            "out.txt" ]

#print "Running this command:\n" + command + "\n"


text:
#pragma once

#include <afml/util/common.hpp>
#include <afml/nn/Weights.hpp>
#include <afml/nn/Nodes/Linear.hpp>
#include <afml/nn/Activations.hpp>

namespace afml
{
    namespace nn
    {
        class FeedForwardNetwork : public Node
        {
        private:
            IntVector mNodeSizes;
            std::vector<NodePtr> mNodes;
            std::vector<ArrayVector> mData;

            template<typename NodeType>
            FeedForwardNetwork& addNodePtr(NodeType *nodePtr)
            {
                mNodes.emplace_back(nodePtr);

                // TODO: Throw exception of node.getOutSizes() has >1 length
                int size = nodePtr->getOutSizes()[0];
                mNodeSizes.push_back(size);
                this->setOutSizes(1, &size);
                return *this;
            }

        public:

            FeedForwardNetwork(const int inputSize, const char *name="none") :
                Node(1, &inputSize, name),
                mNodeSizes(1),
                mNodes(0),
                mData(0)
            {
                mNodeSizes[0] = inputSize;
            }

            template<typename NodeType>
            FeedForwardNetwork& addNode(const NodeType &node)
            {
                return addNodePtr(new NodeType(node));
            }

            FeedForwardNetwork& addLinearNode(const int size, const float spread = 0.05)
            {
                return addNodePtr(new LinearNode(mNodeSizes.back(), size, spread));
            }

            template<typename ActivationType = SigmoidNode>
            FeedForwardNetwork& addActivationNode()
            {
                int size = (int)mNodeSizes.back();

                // Ensure ActivationType is derived from ActivationNode
                ActivationNode *node = new ActivationType(size);

                return addNodePtr(node);
            }

            ArrayVector forward(const ArrayVector &input)
            {
                mData.resize(mNodeSizes.size());
                mData[0] = input;
                for (int i = 0; i < (int)mNodes.size(); i++) {
                    mData[i + 1] = mNodes[i]->forward(mData[i]);
                }
                return mData.back();
            }

            ArrayVector backward(const ArrayVector &input,
                                 const ArrayVector &gradOutput)
            {
                //TODO: Assert input coming is same as the stored input
                ArrayVector currGradOutput = gradOutput;
                for (int i = (int)mNodes.size() - 1; i >= 0; i--) {
                    currGradOutput = mNodes[i]->backward(mData[i], currGradOutput);
                }
                return currGradOutput;
            }

            void update(float lr)
            {
                for(int i = 0; i < (int)mNodes.size(); i++) {
                    mNodes[i]->update(lr);
                }
            }
        };

        typedef FeedForwardNetwork FFNet;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/list_item_card_front"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ellipsize="end"
            android:padding="3dp"
            android:singleLine="true"
            android:textColor="@android:color/white"
            android:textStyle="bold"
            tools:text="Front" />

        <TextView
            android:id="@+id/list_item_card_back"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:layout_marginStart="20dp"
            android:layout_weight="1"
            android:ellipsize="end"
            android:padding="3dp"
            android:singleLine="true"
            android:textColor="@android:color/white"
            tools:text="Back" />

        <ImageView
            android:id="@+id/list_item_delete_icon"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@android:drawable/ic_menu_delete" />

    </LinearLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@color/colorPrimary" />

</LinearLayout>


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Electron App</title>

Testing...


text:
#pragma once

class CpuProfiler;

#include <vxlib/math/vector.h>
#include <vxEngineLib/MessageListener.h>
#include <vxEngineLib/ResourceAspectInterface.h>

class AudioAspectInterface : public vx::MessageListener
{
public:
	virtual ~AudioAspectInterface() {}

	virtual bool initialize(ResourceAspectInterface* resourceAspect) = 0;
	virtual void shutdown() = 0;

	virtual void update(f32 dt, CpuProfiler* profiler) = 0;

	virtual void setMasterVolume(f32 volume) = 0;

	virtual void setSourcePosition(u32 src, const vx::float3 &position) = 0;

	virtual void setListenerPosition(const __m128 &position) = 0;
	virtual void setListenerRotation(const __m128 &qRotation) = 0;
};

typedef AudioAspectInterface* (*CreateAudioAspectFunctionType)();


text:
'use strict';

define( function () {
    return function ( $scope ) {
        $scope.remove   = function () {
            $scope.$broadcast( 'REMOVE_USER' );
        };
        $scope.update   = function () {
            $scope.$broadcast( 'UPDATE_USER' );
        };
    };
});


text:
namespace chromeos {

namespace {

struct ChainVerifyArgs {
  CertVerifyProcChromeOS* cert_verify_proc;
  const net::CertificateList& additional_trust_anchors;
};

}  // namespace

CertVerifyProcChromeOS::CertVerifyProcChromeOS() {}

CertVerifyProcChromeOS::CertVerifyProcChromeOS(
    crypto::ScopedPK11Slot public_slot) {
  profile_filter_.Init(public_slot.Pass(), crypto::ScopedPK11Slot());
}

CertVerifyProcChromeOS::~CertVerifyProcChromeOS() {}

int CertVerifyProcChromeOS::VerifyInternal(
    net::X509Certificate* cert,
    const std::string& hostname,
    int flags,
    net::CRLSet* crl_set,
    const net::CertificateList& additional_trust_anchors,
    net::CertVerifyResult* verify_result) {
  ChainVerifyArgs chain_verify_args = {this, additional_trust_anchors};

  CERTChainVerifyCallback chain_verify_callback;
  chain_verify_callback.isChainValid =
      &CertVerifyProcChromeOS::IsChainValidFunc;
  chain_verify_callback.isChainValidArg =
      static_cast<void*>(&chain_verify_args);

  return VerifyInternalImpl(cert,
                            hostname,
                            flags,
                            crl_set,
                            additional_trust_anchors,
                            &chain_verify_callback,
                            verify_result);
}

// static
SECStatus CertVerifyProcChromeOS::IsChainValidFunc(
    void* is_chain_valid_arg,
    const CERTCertList* current_chain,
    PRBool* chain_ok) {
  ChainVerifyArgs* args = static_cast<ChainVerifyArgs*>(is_chain_valid_arg);
  CERTCertificate* cert = CERT_LIST_TAIL(current_chain)->cert;

  if (net::TestRootCerts::HasInstance()) {
    if (net::TestRootCerts::GetInstance()->Contains(cert)) {
      // Certs in the TestRootCerts are not stored in any slot, and thus would
      // not be allowed by the profile_filter. This should only be hit in tests.
      DVLOG(3) << cert->subjectName << " is a TestRootCert";
      *chain_ok = PR_TRUE;
      return SECSuccess;
    }
  }

  for (net::CertificateList::const_iterator i =
           args->additional_trust_anchors.begin();
       i != args->additional_trust_anchors.end();
       ++i) {
    if (net::X509Certificate::IsSameOSCert(cert, (*i)->os_cert_handle())) {
      // Certs in the additional_trust_anchors should always be allowed, even if
      // they aren't stored in a slot that would be allowed by the
      // profile_filter.
      DVLOG(3) << cert->subjectName << " is an additional_trust_anchor";
      *chain_ok = PR_TRUE;
      return SECSuccess;
    }
  }

  // TODO(mattm): If crbug.com/334384 is fixed to allow setting trust
  // properly when the same cert is in multiple slots, this would also need
  // updating to check the per-slot trust values.
  *chain_ok = args->cert_verify_proc->profile_filter_.IsCertAllowed(cert)
                  ? PR_TRUE
                  : PR_FALSE;
  DVLOG(3) << cert->subjectName << " is " << (*chain_ok ? "ok" : "not ok");
  return SECSuccess;
}

}  // namespace chromeos


text:
<?php

class Standings {
  public function __construct($podId) {
    $this->podId = $podId;
    //BAKERT what if there have been no completed matches/no pairings?
    $sql = 'SELECT SUM(pm1.wins) AS wins, SUM(pm2.wins) AS losses, '
      . 'SUM(CASE WHEN pm1.wins > pm2.wins '
          . 'THEN 3 ELSE ('
            . 'CASE WHEN pm1.wins = pm2.wins THEN 1 ELSE 0 END '
          . ') END) AS points, '
      . 'pe1.name AS name, pe1.url, pe1.player_id AS playerId '
      . 'FROM `match` AS m '
      . 'INNER JOIN round AS r ON r.id = m.round_id '
      . 'INNER JOIN pod AS p ON p.id = r.pod_id '
      . 'INNER JOIN player_match AS pm1 ON pm1.match_id = m.id '
      . 'INNER JOIN player_match AS pm2 ON pm2.match_id = m.id '
        . 'AND pm2.player_id != pm1.player_id '
      . 'INNER JOIN player_event AS pe1 ON pe1.player_id = pm1.player_id AND pe1.event_id = p.event_id '
      // LEFT because BYE does not have an entry.
      . 'LEFT JOIN player_event AS pe2 ON pe2.player_id = pm2.player_id AND pe2.event_id = p.event_id '
      . 'WHERE r.pod_id = ' . Q($this->podId) . ' AND pm1.player_id != 0 '
      . 'GROUP BY pm1.player_id '
      . 'ORDER BY points DESC, SUM(pm1.wins - pm2.wins) DESC';
    $this->standings = D()->execute($sql);
  }

  public function getStandings() {
    return $this->standings;
  }
}


text:
namespace Nz
{
	namespace Vk
	{
		class PipelineLayout : public DeviceObject<PipelineLayout, VkPipelineLayout, VkPipelineLayoutCreateInfo, VK_OBJECT_TYPE_PIPELINE_LAYOUT>
		{
			friend DeviceObject;

			public:
				PipelineLayout() = default;
				PipelineLayout(const PipelineLayout&) = delete;
				PipelineLayout(PipelineLayout&&) = default;
				~PipelineLayout() = default;

				using DeviceObject::Create;
				bool Create(Device& device, VkDescriptorSetLayout layout, VkPipelineLayoutCreateFlags flags = 0);
				bool Create(Device& device, UInt32 layoutCount, const VkDescriptorSetLayout* layouts, VkPipelineLayoutCreateFlags flags = 0);

				PipelineLayout& operator=(const PipelineLayout&) = delete;
				PipelineLayout& operator=(PipelineLayout&&) = delete;

			private:
				static inline VkResult CreateHelper(Device& device, const VkPipelineLayoutCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkPipelineLayout* handle);
				static inline void DestroyHelper(Device& device, VkPipelineLayout handle, const VkAllocationCallbacks* allocator);
		};
	}
}

#include <Nazara/VulkanRenderer/Wrapper/PipelineLayout.inl>

#endif // NAZARA_VULKANRENDERER_WRAPPER_PIPELINELAYOUT_HPP


text:
test:
	python run-tests.py

develop:
	pip install --editable .

tox-test:
	@tox

release:
	python scripts/make-release.py

upload-docs:
	$(MAKE) -C docs html dirhtml latex
	$(MAKE) -C docs/_build/latex all-pdf
	cd docs/_build/; mv html jinja-docs; zip -r jinja-docs.zip jinja-docs; mv jinja-docs html
	scp -r docs/_build/dirhtml/* pocoo.org:/var/www/jinja.pocoo.org/docs/
	scp -r docs/_build/latex/Jinja2.pdf pocoo.org:/var/www/jinja.pocoo.org/docs/jinja-docs.pdf
	scp -r docs/_build/jinja-docs.zip pocoo.org:/var/www/jinja.pocoo.org/docs/

.PHONY: test


text:
<!DOCTYPE HTML>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Connoisseur</title>
<link href="styles/style.css" rel="stylesheet" type="text/css" media="screen" />

Home

About

Menu

Gallery

Reviews

Contact

Pizza Type A: $45

Order Now

Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae.

Pizza Type B: $40

Order Now

Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae.

Pizza Type C: $35

Order Now

Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae.

Pizza Type D: $30

Order Now

Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae.

From The Blog

Lorem Ipsum Dolor

          Orciint erdum condimen terdum nulla mcorper elit nam curabitur...

Praesent Et Eros

          Orciint erdum condimen terdum nulla mcorper elit nam curabitur...

Suspendisse In Neque

          Orciint erdum condimen terdum nulla mcorper elit nam curabitur...

Suspendisse In Neque

          Orciint erdum condimen terdum nulla mcorper elit nam curabitur...

Sidebar Widget

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. In turpis pulvinar facilisis. Ut felis.

        Continue Reading »

Some Title

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante.

From The Blog

Lorem Ipsum Dolor

          Orciint erdum condimen terdum nulla mcorper elit nam curabitur...

Praesent Et Eros

          Orciint erdum condimen terdum nulla mcorper elit nam curabitur...

Suspendisse In Neque

          Orciint erdum condimen terdum nulla mcorper elit nam curabitur...

Suspendisse In Neque

          Orciint erdum condimen terdum nulla mcorper elit nam curabitur...

We Are Social!

  Twitter    Facebook    Forrst    Flickr    Designmoo

    © Copyright 2012 - All Rights Reserved - Domain Name

    Design by PriteshGupta.com


text:
cd $( cd "$( dirname "$( dirname "${BASH_SOURCE[0]}" )" )" && pwd )

if [ -d "./.git" ]; then
  BRANCH=`git rev-parse --abbrev-ref HEAD`

  if [ "$BRANCH" != "master" ]; then
    echo "The current branch should be 'master'; please checkout 'master' before versioning."
    exit 1
  else
    npm test
  fi
else
  echo "This plugin project is not a Git repository; skipping versioning scripts."
  exit 1
fi


text:
ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = '''
---
module: avi_cloud
author: Gaurav Rastogi (@grastogi23) <grastogi@avinetworks.com>

short_description: Module for setup of Cloud Avi RESTful Object
description:
    - This module is used to configure Cloud object
    - more examples at U(https://github.com/avinetworks/devops)
requirements: [ avisdk ]
version_added: "2.4"
options:
    state:
        description:
            - The state that should be applied on the entity.
        default: present
        choices: ["absent", "present"]
    avi_api_update_method:
        description:
            - Default method for object update is HTTP PUT.
            - Setting to patch will override that behavior to use HTTP PATCH.
        version_added: "2.5"
        default: put
        choices: ["put", "patch"]
    avi_api_patch_op:
        description:
            - Patch operation to use when using avi_api_update_method as patch.
        version_added: "2.5"
        choices: ["add", "replace", "delete"]
    apic_configuration:
        description:
            - Apicconfiguration settings for cloud.
    apic_mode:
        description:
            - Boolean flag to set apic_mode.
            - Default value when not specified in API or module is interpreted by Avi Controller as False.
        type: bool
    aws_configuration:
        description:
            - Awsconfiguration settings for cloud.
    azure_configuration:
        description:
            - Field introduced in 17.2.1.
        version_added: "2.5"
    cloudstack_configuration:
        description:
            - Cloudstackconfiguration settings for cloud.
    custom_tags:
        description:
            - Custom tags for all avi created resources in the cloud infrastructure.
            - Field introduced in 17.1.5.
        version_added: "2.5"
    dhcp_enabled:
        description:
            - Select the ip address management scheme.
            - Default value when not specified in API or module is interpreted by Avi Controller as False.
        type: bool
    dns_provider_ref:
        description:
            - Dns profile for the cloud.
            - It is a reference to an object of type ipamdnsproviderprofile.
    docker_configuration:
        description:
            - Dockerconfiguration settings for cloud.
    east_west_dns_provider_ref:
        description:
            - Dns profile for east-west services.
            - It is a reference to an object of type ipamdnsproviderprofile.
    east_west_ipam_provider_ref:
        description:
            - Ipam profile for east-west services.
            - Warning - please use virtual subnets in this ipam profile that do not conflict with the underlay networks or any overlay networks in the cluster.
            - For example in aws and gcp, 169.254.0.0/16 is used for storing instance metadata.
            - Hence, it should not be used in this profile.
            - It is a reference to an object of type ipamdnsproviderprofile.
    enable_vip_static_routes:
        description:
            - Use static routes for vip side network resolution during virtualservice placement.
            - Default value when not specified in API or module is interpreted by Avi Controller as False.
        type: bool
    ipam_provider_ref:
        description:
            - Ipam profile for the cloud.
            - It is a reference to an object of type ipamdnsproviderprofile.
    license_tier:
        description:
            - Specifies the default license tier which would be used by new se groups.
            - This field by default inherits the value from system configuration.
            - Enum options - ENTERPRISE_16, ENTERPRISE_18.
            - Field introduced in 17.2.5.
        version_added: "2.5"
    license_type:
        description:
            - If no license type is specified then default license enforcement for the cloud type is chosen.
            - The default mappings are container cloud is max ses, openstack and vmware is cores and linux it is sockets.
            - Enum options - LIC_BACKEND_SERVERS, LIC_SOCKETS, LIC_CORES, LIC_HOSTS, LIC_SE_BANDWIDTH.
    linuxserver_configuration:
        description:
            - Linuxserverconfiguration settings for cloud.
    mesos_configuration:
        description:
            - Mesosconfiguration settings for cloud.
    mtu:
        description:
            - Mtu setting for the cloud.
            - Default value when not specified in API or module is interpreted by Avi Controller as 1500.
            - Units(BYTES).
    name:
        description:
            - Name of the object.
        required: true
    nsx_configuration:
        description:
            - Configuration parameters for nsx manager.
            - Field introduced in 17.1.1.
    obj_name_prefix:
        description:
            - Default prefix for all automatically created objects in this cloud.
            - This prefix can be overridden by the se-group template.
    openstack_configuration:
        description:
            - Openstackconfiguration settings for cloud.
    oshiftk8s_configuration:
        description:
            - Oshiftk8sconfiguration settings for cloud.
    prefer_static_routes:
        description:
            - Prefer static routes over interface routes during virtualservice placement.
            - Default value when not specified in API or module is interpreted by Avi Controller as False.
        type: bool
    proxy_configuration:
        description:
            - Proxyconfiguration settings for cloud.
    rancher_configuration:
        description:
            - Rancherconfiguration settings for cloud.
    state_based_dns_registration:
        description:
            - Dns records for vips are added/deleted based on the operational state of the vips.
            - Field introduced in 17.1.12.
            - Default value when not specified in API or module is interpreted by Avi Controller as True.
        version_added: "2.5"
        type: bool
    tenant_ref:
        description:
            - It is a reference to an object of type tenant.
    url:
        description:
            - Avi controller URL of the object.
    uuid:
        description:
            - Unique object identifier of the object.
    vca_configuration:
        description:
            - Vcloudairconfiguration settings for cloud.
    vcenter_configuration:
        description:
            - Vcenterconfiguration settings for cloud.
    vtype:
        description:
            - Cloud type.
            - Enum options - CLOUD_NONE, CLOUD_VCENTER, CLOUD_OPENSTACK, CLOUD_AWS, CLOUD_VCA, CLOUD_APIC, CLOUD_MESOS, CLOUD_LINUXSERVER, CLOUD_DOCKER_UCP,
            - CLOUD_RANCHER, CLOUD_OSHIFT_K8S, CLOUD_AZURE.
            - Default value when not specified in API or module is interpreted by Avi Controller as CLOUD_NONE.
        required: true
extends_documentation_fragment:
    - avi
'''

EXAMPLES = """
  - name: Create a VMWare cloud with write access mode
    avi_cloud:
      username: '{{ username }}'
      controller: '{{ controller }}'
      password: '{{ password }}'
      apic_mode: false
      dhcp_enabled: true
      enable_vip_static_routes: false
      license_type: LIC_CORES
      mtu: 1500
      name: VCenter Cloud
      prefer_static_routes: false
      tenant_ref: admin
      vcenter_configuration:
        datacenter_ref: /api/vimgrdcruntime/datacenter-2-10.10.20.100
        management_network: /api/vimgrnwruntime/dvportgroup-103-10.10.20.100
        password: password
        privilege: WRITE_ACCESS
        username: user
        vcenter_url: 10.10.20.100
      vtype: CLOUD_VCENTER
"""

RETURN = '''
obj:
    description: Cloud (api/cloud) object
    returned: success, changed
    type: dict
'''

from ansible.module_utils.basic import AnsibleModule
try:
    from ansible.module_utils.network.avi.avi import (
        avi_common_argument_spec, HAS_AVI, avi_ansible_api)
except ImportError:
    HAS_AVI = False

def main():
    argument_specs = dict(
        state=dict(default='present',
                   choices=['absent', 'present']),
        avi_api_update_method=dict(default='put',
                                   choices=['put', 'patch']),
        avi_api_patch_op=dict(choices=['add', 'replace', 'delete']),
        apic_configuration=dict(type='dict',),
        apic_mode=dict(type='bool',),
        aws_configuration=dict(type='dict',),
        azure_configuration=dict(type='dict',),
        cloudstack_configuration=dict(type='dict',),
        custom_tags=dict(type='list',),
        dhcp_enabled=dict(type='bool',),
        dns_provider_ref=dict(type='str',),
        docker_configuration=dict(type='dict',),
        east_west_dns_provider_ref=dict(type='str',),
        east_west_ipam_provider_ref=dict(type='str',),
        enable_vip_static_routes=dict(type='bool',),
        ipam_provider_ref=dict(type='str',),
        license_tier=dict(type='str',),
        license_type=dict(type='str',),
        linuxserver_configuration=dict(type='dict',),
        mesos_configuration=dict(type='dict',),
        mtu=dict(type='int',),
        name=dict(type='str', required=True),
        nsx_configuration=dict(type='dict',),
        obj_name_prefix=dict(type='str',),
        openstack_configuration=dict(type='dict',),
        oshiftk8s_configuration=dict(type='dict',),
        prefer_static_routes=dict(type='bool',),
        proxy_configuration=dict(type='dict',),
        rancher_configuration=dict(type='dict',),
        state_based_dns_registration=dict(type='bool',),
        tenant_ref=dict(type='str',),
        url=dict(type='str',),
        uuid=dict(type='str',),
        vca_configuration=dict(type='dict',),
        vcenter_configuration=dict(type='dict',),
        vtype=dict(type='str', required=True),
    )
    argument_specs.update(avi_common_argument_spec())
    module = AnsibleModule(
        argument_spec=argument_specs, supports_check_mode=True)
    if not HAS_AVI:
        return module.fail_json(msg=(
            'Avi python API SDK (avisdk>=17.1) is not installed. '
            'For more details visit https://github.com/avinetworks/sdk.'))
    return avi_ansible_api(module, 'cloud',
                           set([]))

if __name__ == '__main__':
    main()


text:
package org.apache.nifi.grok;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Pattern;

import org.apache.nifi.serialization.MalformedRecordException;
import org.apache.nifi.serialization.RecordReader;
import org.apache.nifi.serialization.record.DataType;
import org.apache.nifi.serialization.record.MapRecord;
import org.apache.nifi.serialization.record.Record;
import org.apache.nifi.serialization.record.RecordField;
import org.apache.nifi.serialization.record.RecordFieldType;
import org.apache.nifi.serialization.record.RecordSchema;
import org.apache.nifi.serialization.record.util.DataTypeUtils;

import io.thekraken.grok.api.Grok;
import io.thekraken.grok.api.Match;

public class GrokRecordReader implements RecordReader {
    private final BufferedReader reader;
    private final Grok grok;
    private final boolean append;
    private final RecordSchema schemaFromGrok;
    private RecordSchema schema;

    private String nextLine;

    static final String STACK_TRACE_COLUMN_NAME = "stackTrace";
    static final String RAW_MESSAGE_NAME = "_raw";

    private static final Pattern STACK_TRACE_PATTERN = Pattern.compile(
        "^\\s*(?:(?:    |\\t)+at )|"
            + "(?:(?:    |\\t)+\\[CIRCULAR REFERENCE\\:)|"
            + "(?:Caused by\\: )|"
            + "(?:Suppressed\\: )|"
            + "(?:\\s+... \\d+ (?:more|common frames? omitted)$)");

    public GrokRecordReader(final InputStream in, final Grok grok, final RecordSchema schema, final RecordSchema schemaFromGrok, final boolean append) {
        this.reader = new BufferedReader(new InputStreamReader(in));
        this.grok = grok;
        this.schema = schema;
        this.append = append;
        this.schemaFromGrok = schemaFromGrok;
    }

    @Override
    public void close() throws IOException {
        reader.close();
    }

    @Override
    public Record nextRecord(final boolean coerceTypes, final boolean dropUnknownFields) throws IOException, MalformedRecordException {
        Map<String, Object> valueMap = null;
        StringBuilder raw = new StringBuilder();

        while (valueMap == null || valueMap.isEmpty()) {
            final String line = nextLine == null ? reader.readLine() : nextLine;
            raw.append(line);
            nextLine = null; // ensure that we don't process nextLine again
            if (line == null) {
                return null;
            }

            final Match match = grok.match(line);
            match.captures();
            valueMap = match.toMap();
        }

        // Read the next line to see if it matches the pattern (in which case we will simply leave it for
        // the next call to nextRecord()) or we will attach it to the previously read record.
        String stackTrace = null;
        final StringBuilder trailingText = new StringBuilder();
        while ((nextLine = reader.readLine()) != null) {
            final Match nextLineMatch = grok.match(nextLine);
            nextLineMatch.captures();
            final Map<String, Object> nextValueMap = nextLineMatch.toMap();
            if (nextValueMap.isEmpty()) {
                // next line did not match. Check if it indicates a Stack Trace. If so, read until
                // the stack trace ends. Otherwise, append the next line to the last field in the record.
                if (isStartOfStackTrace(nextLine)) {
                    stackTrace = readStackTrace(nextLine);
                    raw.append("\n").append(stackTrace);
                    break;
                } else if (append) {
                    trailingText.append("\n").append(nextLine);
                    raw.append("\n").append(nextLine);
                }
            } else {
                // The next line matched our pattern.
                break;
            }
        }

        final Record record = createRecord(valueMap, trailingText, stackTrace, raw.toString(), coerceTypes, dropUnknownFields);
        return record;
    }

    private Record createRecord(final Map<String, Object> valueMap, final StringBuilder trailingText, final String stackTrace, final String raw, final boolean coerceTypes, final boolean dropUnknown) {
        final Map<String, Object> converted = new HashMap<>();
        for (final Map.Entry<String, Object> entry : valueMap.entrySet()) {
            final String fieldName = entry.getKey();
            final Object rawValue = entry.getValue();

            final Object normalizedValue;
            if (rawValue instanceof List) {
                final List<?> list = (List<?>) rawValue;
                final String[] array = new String[list.size()];
                for (int i = 0; i < list.size(); i++) {
                    final Object rawObject = list.get(i);
                    array[i] = rawObject == null ? null : rawObject.toString();
                }
                normalizedValue = array;
            } else {
                normalizedValue = rawValue == null ? null : rawValue.toString();
            }

            final Optional<RecordField> optionalRecordField = schema.getField(fieldName);

            final Object coercedValue;
            if (coerceTypes && optionalRecordField.isPresent()) {
                final RecordField field = optionalRecordField.get();
                final DataType fieldType = field.getDataType();
                coercedValue = convert(fieldType, normalizedValue, fieldName);
            } else {
                coercedValue = normalizedValue;
            }

            converted.put(fieldName, coercedValue);
        }

        // If there is any trailing text, determine the last column from the grok schema
        // and then append the trailing text to it.
        if (append && trailingText.length() > 0) {
            String lastPopulatedFieldName = null;
            final List<RecordField> schemaFields = schemaFromGrok.getFields();
            for (int i = schemaFields.size() - 1; i >= 0; i--) {
                final RecordField field = schemaFields.get(i);

                Object value = converted.get(field.getFieldName());
                if (value != null) {
                    lastPopulatedFieldName = field.getFieldName();
                    break;
                }

                for (final String alias : field.getAliases()) {
                    value = converted.get(alias);
                    if (value != null) {
                        lastPopulatedFieldName = alias;
                        break;
                    }
                }
            }

            if (lastPopulatedFieldName != null) {
                final Object value = converted.get(lastPopulatedFieldName);
                if (value == null) {
                    converted.put(lastPopulatedFieldName, trailingText.toString());
                } else if (value instanceof String) { // if not a String it is a List and we will just drop the trailing text
                    converted.put(lastPopulatedFieldName, (String) value + trailingText.toString());
                }
            }
        }

        converted.put(STACK_TRACE_COLUMN_NAME, stackTrace);
        converted.put(RAW_MESSAGE_NAME, raw);

        return new MapRecord(schema, converted);
    }

    private boolean isStartOfStackTrace(final String line) {
        if (line == null) {
            return false;
        }

        // Stack Traces are generally of the form:
        // java.lang.IllegalArgumentException: My message
        //   at org.apache.nifi.MyClass.myMethod(MyClass.java:48)
        //   at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
        // Caused by: java.net.SocketTimeoutException: null
        //   ... 13 common frames omitted

        int index = line.indexOf("Exception: ");
        if (index < 0) {
            index = line.indexOf("Error: ");
        }

        if (index < 0) {
            return false;
        }

        if (line.indexOf(" ") < index) {
            return false;
        }

        return true;
    }

    private String readStackTrace(final String firstLine) throws IOException {
        final StringBuilder sb = new StringBuilder(firstLine);

        String line;
        while ((line = reader.readLine()) != null) {
            if (isLineInStackTrace(line)) {
                sb.append("\n").append(line);
            } else {
                nextLine = line;
                break;
            }
        }

        return sb.toString();
    }

    private boolean isLineInStackTrace(final String line) {
        return STACK_TRACE_PATTERN.matcher(line).find();
    }

    protected Object convert(final DataType fieldType, final Object rawValue, final String fieldName) {
        if (fieldType == null) {
            return rawValue;
        }

        if (rawValue == null) {
            return null;
        }

        // If string is empty then return an empty string if field type is STRING. If field type is
        // anything else, we can't really convert it so return null
        final boolean fieldEmpty = rawValue instanceof String && ((String) rawValue).isEmpty();
        if (fieldEmpty && fieldType.getFieldType() != RecordFieldType.STRING) {
            return null;
        }

        return DataTypeUtils.convertType(rawValue, fieldType, fieldName);
    }

    @Override
    public RecordSchema getSchema() {
        return schema;
    }

}


text:
MerakiAPI
=========

This is the main class that should be called to initialize the module, since it
stands as the root of the api. All further actions are called from an instance
of this class.

.. autoclass:: meraki_api.MerakiAPI
   :members:

.. autoclass:: meraki_api.Organizations
   :members:

.. autoclass:: meraki_api.Networks
   :members:

.. autoclass:: meraki_api.Devices
   :members:

.. autoclass:: meraki_api.Admins
   :members:

.. autoclass:: meraki_api.ConfigTemplates
   :members:

.. autoclass:: meraki_api.L3FirewallRules
   :members:

.. autoclass:: meraki_api.PhoneContacts
   :members:

.. autoclass:: meraki_api.SAMLRoles
   :members:

.. autoclass:: meraki_api.SiteToSiteVPN
   :members:

.. autoclass:: meraki_api.SM
   :members:

.. autoclass:: meraki_api.SSIDs
   :members:

.. autoclass:: meraki_api.StaticRoutes
   :members:

.. autoclass:: meraki_api.SwitchPorts
   :members:

.. autoclass:: meraki_api.VLANs
   :members:


text:
/**
 * Created by nitesh on 5/10/15.
 */
var opertingFolder;
var exec = require('child_process').exec;
var future = require('q');
var fs = require('fs');
var folderReady = future.defer();
var folderIsReady = folderReady.promise;

module.exports = {
    writeToZipInputFile: function(filename, list) {
        var defer = future.defer();
        folderIsReady.then(function() {
            fs.appendFile(opertingFolder + filename, list.join('\n'), function (err) {
                if (err) throw err;
                console.log('Writing to the ' + filename);
                defer.resolve();
            });
        });
        return defer.promise;
    },
    writeToFlattenZipInputFile: function(filename, list) {
        var defer = future.defer();
        var strin = '';
        list.forEach(function(file) {
            strin += '-C ' + _path.dirname(file) + ' ' +_path.basename(file) + '\n';
        });
        fs.appendFile(opertingFolder + filename, strin, function (err) {
            if (err) throw err;
            console.log('Writing to the ' + filename);
            defer.resolve();
        });
        return defer.promise;
    },
    removeFile: function(filename) {
        folderIsReady.then(function() {
            exec('rm ' + opertingFolder + filename);
        });
    },
    createZipFile: function(tgz, input) {
        var createdZipFile = future.defer();
        folderIsReady.then(function() {
            var outfile = opertingFolder + tgz;
            exec('tar -cvzf ' + outfile + ' -T ' + opertingFolder + input, function(error, stdout, stderr) {
                if(!error) {
                    createdZipFile.resolve(outfile);
                }
            });
        });
        return createdZipFile.promise;
    },
    setOperatingFolder: function(folder) {
        opertingFolder = folder;
        exec('mkdir -p ' + opertingFolder, function(error, stdout, stderr) {
            if(!error) {
                folderReady.resolve();
            }
        });
    }
};


text:
<?php

namespace Agere\Communicator\Connector\Strategy;

class JSONMultitableTreeRenderStrategy extends MultitableTreeRenderStrategy {

	public function render_set($res, $name, $dload, $sep, $config, $mix){
		$output=array();
		$index=0;
		$conn = $this->conn;
		$this->mix($config, $mix);
		while ($data=$conn->sql->get_next($res)){
			$data = $this->complex_mix($mix, $data);
			$data[$config->id['name']] = $this->level_id($data[$config->id['name']]);
			$data = new $name($data,$config,$index);
			$conn->event->trigger("beforeRender",$data);

			if ($this->is_max_level()) {
				$data->set_kids(false);
			} else {
				if ($data->has_kids()===-1)
					$data->set_kids(true);
			}
			$record = $data->to_xml_start($output);
			$output[] = $record;
			$index++;
		}
		$this->unmix($config, $mix);
		return $output;
	}

}