text:
package mil.army.usace.ehlschlaeger.digitalpopulations.csvplusmap;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import joptsimple.OptionParser;
import joptsimple.OptionSet;
import mil.army.usace.ehlschlaeger.rgik.core.DataException;
import mil.army.usace.ehlschlaeger.rgik.core.GISLattice;

import org.apache.commons.io.FilenameUtils;
import org.supercsv.io.CsvListReader;
import org.supercsv.io.CsvListWriter;
import org.supercsv.io.ICsvListReader;
import org.supercsv.io.ICsvListWriter;
import org.supercsv.prefs.CsvPreference;

public class CsvPlusMap {
    /** Name of column that holds x/easting/latitude. */
    private String xcol   = "x";
    /** Name of column that holds y/northing/longitude. */
    private String ycol   = "y";
    /** Name of column to append to table. */
    private String newcol = null;
    /** Input table to process. */
    private File   csvFile;
    /** Input map that will supply new values. */
    private File   mapFile;
    /** Output table to create with copy of csvFile plus new column. */
    private File   outFile;
    /** Formatter for values in new column. */
    private NumberFormat numfmt;

    /**
     * Construct default instance.  Call set*() methods to configure, then call go().
     */
    public CsvPlusMap() {
        numfmt = NumberFormat.getNumberInstance();
        numfmt.setMinimumFractionDigits(0);
        numfmt.setMaximumFractionDigits(80);
        numfmt.setMinimumIntegerDigits(1);
        numfmt.setMaximumIntegerDigits(80);
    }

    public String getXcol() {
        return xcol;
    }

    /**
     * @param xcol
     *            name of X/longitude/easting column in CSV file. Case
     *            sensitive.
     */
    public void setXcol(String xcol) {
        this.xcol = xcol;
    }

    public String getYcol() {
        return ycol;
    }

    /**
     * @param ycol
     *            name of Y/latitude/northing column in CSV file. Case
     *            sensitive.
     */
    public void setYcol(String ycol) {
        this.ycol = ycol;
    }

    public String getNewcol() {
        return newcol;
    }

    /**
     * @param newcol
     *            name of column to append to new CSV file. Defaults to base
     *            name of map file when setMapFile() is called.
     */
    public void setNewcol(String newcol) {
        this.newcol = newcol;
    }

    public File getCsvFile() {
        return csvFile;
    }

    /**
     * @param csvFile
     *            path and name of CSV file to read. File doesn't consume
     *            memory; rows will be read and written on the fly.
     */
    public void setCsvFile(File csvFile) {
        this.csvFile = csvFile;

        File dir = csvFile.getParentFile();
        String name = FilenameUtils.getBaseName(csvFile.getName());
        String ext = FilenameUtils.getExtension(csvFile.getName());
        this.outFile = new File(dir, name + ".plusmap." + ext);
    }

    public File getMapFile() {
        return mapFile;
    }

    /**
     * @param mapFile
     *            path and name of map file from which values will be read. Must
     *            be ESRI ASCII. Will be loaded entirely into memory before
     *            process starts.
     */
    public void setMapFile(File mapFile) {
        this.mapFile = mapFile;

        String col = FilenameUtils.getBaseName(mapFile.getName());
        newcol = col;
    }

    public File getOutFile() {
        return outFile;
    }

    /**
     * @param outFile
     *            path and name of file to create. Will be overwritten if
     *            exists. Defaults to csvFile+".plusmap.csv" when setCsvFile()
     *            is called.
     */
    public void setOutFile(File outFile) {
        this.outFile = outFile;
    }

    /**
     * Run the process as currently configured.
     *
     * @throws IOException on any file error
     */
    public void go() throws IOException {
        if (csvFile == null)
            throw new DataException("csv-file was not specified");
        if (mapFile == null)
            throw new DataException("map-file was not specified");

        ICsvListReader reader = new CsvListReader(new FileReader(csvFile),
            CsvPreference.STANDARD_PREFERENCE);
        try {
            // Load header line with column names.
            List<String> head = new ArrayList<String>(Arrays.asList(reader.getCSVHeader(true)));
            int xidx = head.indexOf(xcol);
            if (xidx < 0)
                throw new DataException("Column '" + xcol + "' not found in table header");
            int yidx = head.indexOf(ycol);
            if (yidx < 0)
                throw new DataException("Column '" + ycol + "' not found in table header");

            // Load map down here so error checks above are done first.
            System.out.println("Loading map " + mapFile.getName());
            GISLattice map = GISLattice.loadEsriAscii(mapFile);

            System.out.println("Writing file " + outFile.getName());
            ICsvListWriter writer = new CsvListWriter(new FileWriter(outFile),
                CsvPreference.STANDARD_PREFERENCE);
            try {
                head.add(newcol);
                writer.writeHeader(head.toArray(new String[head.size()]));

                // Process all rows.
                List<String> line;
                while ((line = reader.read()) != null) {
                    double x = Double.parseDouble(line.get(xidx));
                    double y = Double.parseDouble(line.get(yidx));
                    if(map.isNoData(x, y)) {
                        // Outside map or NODATA yields blank cell.
                        line.add("");
                    }
                    else {
                        double val = map.getCellValue(x, y);
                        line.add(numfmt.format(val));
                        writer.write(line);
                    }
                }

                System.out.println("Done.");
            } finally {
                writer.close();
            }
        } finally {
            reader.close();
        }
    }

    /**
     * Command-line interface to program.  Run for usage instructions.
     *
     * @param args command-line arguments
     * @throws IOException on any file error
     */
    public static void main(String[] args) throws IOException {
        // CsvPlusMap -x x -y y -n new-col -o out-file <csv> <map>
        OptionParser parser = new OptionParser();
        parser.accepts("x", "name of X/longitude/easting column (default is \"x\")").withRequiredArg().ofType(
            String.class);
        parser.accepts("y", "name of Y/latitude/northing column (default is \"y\")").withRequiredArg().ofType(
            String.class);
        parser.accepts("n", "name of new column (default is base name of map file)").withRequiredArg().ofType(
            String.class);
        parser.accepts("o", "output file (default is <csv-file>.plusmap.csv)").withRequiredArg().ofType(
            File.class);
        parser.acceptsAll(Arrays.asList("h", "help"), "print this help");

        CsvPlusMap cpm = new CsvPlusMap();

        OptionSet opts = parser.parse(args);
        if(opts.has("h") || opts.has("help") || args.length == 0) {
            System.out.println("Usage: " + cpm.getClass().getSimpleName()
                    + " [options] <csv-file> <map-file>");
            System.out.println("  <csv-file> is csv to extend");
            System.out.println("  <map-file> is ESRI ASCII map file that provides values");
            System.out.println();
            parser.printHelpOn(System.out);
            System.exit(5);
        }

        int reqdArgs = 2;
        if(opts.nonOptionArguments().size() != reqdArgs) {
            System.err.println("Required args are missing; there should be "+reqdArgs+".");
            System.exit(5);
        }

        cpm.setCsvFile(new File(opts.nonOptionArguments().get(0)));
        cpm.setMapFile(new File(opts.nonOptionArguments().get(1)));
        if (opts.has("x"))
            cpm.setXcol((String) opts.valueOf("x"));
        if (opts.has("y"))
            cpm.setYcol((String) opts.valueOf("y"));
        if (opts.has("n"))
            cpm.setNewcol((String) opts.valueOf("n"));
        if (opts.has("o"))
            cpm.setOutFile((File) opts.valueOf("o"));

        cpm.go();
    }
}


text:
using System;
class RefactorVolumeOfPyramid
{
    static void Main()
    {
        Console.Write("Length: ");
        double lenght = double.Parse(Console.ReadLine());

        Console.Write("Width: ");
        double width = double.Parse(Console.ReadLine());

        Console.Write("Heigth: ");
        double height = double.Parse(Console.ReadLine());

        double volume = ((lenght * width) * height) / 3;

        Console.WriteLine("Pyramid Volume: {0:F2}", volume);
    }
}

redpajama_set_name: RedPajamaGithub


text:
==========================
tzf.pyramid_yml README
==========================

.. image:: https://img.shields.io/pypi/v/tzf.pyramid_yml.svg
    :target: https://pypi.python.org/pypi/tzf.pyramid_yml/
    :alt: Latest PyPI version

.. image:: https://img.shields.io/pypi/dm/tzf.pyramid_yml.svg
    :target: https://pypi.python.org/pypi/tzf.pyramid_yml/
    :alt: Number of PyPI downloads

.. image:: https://img.shields.io/pypi/wheel/tzf.pyramid_yml.svg
    :target: https://pypi.python.org/pypi/tzf.pyramid_yml/
    :alt: Wheel Status

.. image:: https://pypip.in/egg/tzf.pyramid_yml/badge.png
    :target: https://pypi.python.org/pypi/tzf.pyramid_yml/
    :alt: Egg Status

.. image:: https://img.shields.io/pypi/l/tzf.pyramid_yml.svg
    :target: https://pypi.python.org/pypi/tzf.pyramid_yml/
    :alt: License

Package status
--------------

.. image:: https://travis-ci.org/fizyk/pyramid_yml.png?branch=master
    :target: https://travis-ci.org/fizyk/pyramid_yml
    :alt: Tests

.. image:: https://coveralls.io/repos/fizyk/pyramid_yml/badge.png?branch=master
    :target: https://coveralls.io/r/fizyk/pyramid_yml?branch=master
    :alt: Coverage Status

.. image:: https://requires.io/github/fizyk/pyramid_yml/requirements.png?branch=master
   :target: https://requires.io/github/fizyk/pyramid_yml/requirements/?branch=master
   :alt: Requirements Status

**tzf.pyramid_yml** is a convenience package, that allows for a yml settings, that can be kept in a structured, clear way, and also extensible depending on an 'environment'.

Documentation
-------------

Documentation can be found here: https://readthedocs.org/projects/tzfpyramid_yml/

Testing
-------

You'll need: packages defined in extra_requires[tests] to run tests, and then:

``py.test``

For detailed test report run this command:

``py.test --cov-report term-missing --cov tzf.pyramid_yml tests/``


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Globalization;

namespace BigQuery.Linq.Tests.Builder
{
    enum Nano : ulong
    {
        Hoge = 1,
        Huga = 4,
        Tako = 100
    }

    class Hoge
    {
        public double MyProperty { get; set; }
    }

    class Huga
    {
        public double MyProperty2 { get; set; }
    }

    class HogeMoge
    {
        public string Hoge { get; set; }
        public string Huga { get; set; }
        public int Tako { get; set; }
    }

    [TableName("[publicdata:samples.wikipedia]")]
    class Wikipedia
    {
        public string title { get; set; }

        public long? wp_namespace { get; set; }
    }

    [TableName("[publicdata:samples.shakespeare]")]
    class Shakespeare
    {
        public string word { get; set; }
        public string corpus { get; set; }
        public int word_count { get; set; }
    }

    class Repository
    {
        public bool has_downloads { get; set; }
    }

    [TestClass]
    public class StandardQueries
    {
        [TestMethod]
        public void DirectSelect()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var s = context.Select(() => new
            {
                A = "aaa",
                B = BqFunc.Abs(-5),
                FROM = 100,
            }).ToString().TrimEnd();

            s.Is(@"SELECT
  'aaa' AS [A],
  ABS(-5) AS [B],
  100 AS [FROM]");
        }

        [TestMethod]
        public void WhereSelect()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var s = context.From<Wikipedia>("tablewikipedia")
                .Where(x => x.wp_namespace == 100)
                .Select(x => new { x.title, x.wp_namespace })
                .ToString().TrimEnd();

            s.Is(@"SELECT
  [title],
  [wp_namespace]
FROM
  [tablewikipedia]
WHERE
  ([wp_namespace] = 100)");
        }

        [TestMethod]
        public void WhereWhere()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var s = context.From<Wikipedia>("tablewikipedia")
                .Where(x => x.wp_namespace == 100)
                .Where(x => x.title != null)
                .Where(x => x.title == "AiUeo")
                .Select(x => new { x.title, x.wp_namespace })
                .ToString().TrimEnd();

            s.Is(@"SELECT
  [title],
  [wp_namespace]
FROM
  [tablewikipedia]
WHERE
  ((([wp_namespace] = 100) AND ([title] IS NOT NULL)) AND ([title] = 'AiUeo'))");
        }

        [TestMethod]
        public void OrderBy()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var s = context.From<BigQuery.Linq.Tests.wikipedia>("tablewikipedia")
                .OrderByDescending(x => x.title)
                .ThenBy(x => x.wp_namespace)
                .ThenByDescending(x => x.language)
                .ThenBy(x => x.revision_id)
                .Select(x => new { x.title, x.wp_namespace })
                .ToString().TrimEnd();

            s.Is(@"SELECT
  [title],
  [wp_namespace]
FROM
  [tablewikipedia]
ORDER BY
  [title] DESC, [wp_namespace], [language] DESC, [revision_id]");
        }

        [TestMethod]
        public void Join()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<Wikipedia>("[publicdata:samples.wikipedia]")
                .Join(context.From<Wikipedia>("[publicdata:samples.wikipedia]").Select(x => new { x.title, x.wp_namespace }).Limit(1000),
                    (kp, tp) => new { kp, tp }, // alias selector
                    x => x.tp.title == x.kp.title) // conditional
                .Select(x => new { x.kp.title, x.tp.wp_namespace })
                .OrderBy(x => x.title)
                .ThenByDescending(x => x.wp_namespace)
                .Limit(100)
                .IgnoreCase()
                .ToString();

            query1.Is(@"
SELECT
  [kp.title] AS [title],
  [tp.wp_namespace] AS [wp_namespace]
FROM
  [publicdata:samples.wikipedia] AS [kp]
INNER JOIN
(
  SELECT
    [title],
    [wp_namespace]
  FROM
    [publicdata:samples.wikipedia]
  LIMIT 1000
) AS [tp] ON ([tp.title] = [kp.title])
ORDER BY
  [title], [wp_namespace] DESC
LIMIT 100
IGNORE CASE".TrimSmart());
        }

        [TestMethod]
        public void Sample1()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<Wikipedia>()
                .Where(x => x.wp_namespace == 0)
                .Select(x => new
                {
                    x.title,
                    hash_value = BqFunc.Hash(x.title),
                    included_in_sample = (BqFunc.Abs(BqFunc.Hash(x.title)) % 2 == 1)
                        ? "True"
                        : "False"
                })
                .Limit(5)
                .ToString();

            query1.Is(@"
SELECT
  [title],
  HASH([title]) AS [hash_value],
  IF(((ABS(HASH([title])) % 2) = 1), 'True', 'False') AS [included_in_sample]
FROM
  [publicdata:samples.wikipedia]
WHERE
  ([wp_namespace] = 0)
LIMIT 5".TrimStart());
        }

        [TestMethod]
        public void SampleFirstCase()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<Shakespeare>()
                .Where(x => x.word.Contains("th"))
                .Select(x => new
                {
                    x.word,
                    x.corpus,
                    count = BqFunc.Count(x.word)
                })
                .GroupBy(x => new { x.word, x.corpus })
                .ToString()
                .TrimSmart();

            query1.Is(@"
SELECT
  [word],
  [corpus],
  COUNT([word]) AS [count]
FROM
  [publicdata:samples.shakespeare]
WHERE
  [word] CONTAINS 'th'
GROUP BY
  [word],
  [corpus]".TrimSmart());
        }

        [TestMethod]
        public void GroupByRollup()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<natality>()
                .Where(x => x.year >= 2000 && x.year <= 2002)
                .Select(x => new
                {
                    x.year,
                    x.is_male,
                    count = BqFunc.Count(1)
                })
                .GroupBy(x => new { x.year, x.is_male }, rollup: true)
                .OrderBy(x => x.year)
                .ThenBy(x => x.is_male)
                .ToString()
                .TrimSmart();

            query1.Is(@"
SELECT
  [year],
  [is_male],
  COUNT(1) AS [count]
FROM
  [publicdata:samples.natality]
WHERE
  (([year] >= 2000) AND ([year] <= 2002))
GROUP BY ROLLUP
(
  [year],
  [is_male]
)
ORDER BY
  [year], [is_male]".TrimSmart());
        }

        [TestMethod]
        public void GroupByGrouping()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<natality>()
                .Where(x => x.year >= 2000 && x.year <= 2002)
                .Select(x => new
                {
                    x.year,
                    rollup_year = BqFunc.Grouping(x.year),
                    x.is_male,
                    rollup_gender = BqFunc.Grouping(x.is_male),
                    count = BqFunc.Count(1)
                })
                .GroupBy(x => new { x.year, x.is_male }, rollup: true)
                .OrderBy(x => x.year)
                .ThenBy(x => x.is_male)
                .ToString()
                .TrimSmart();

            query1.Is(@"
SELECT
  [year],
  GROUPING([year]) AS [rollup_year],
  [is_male],
  GROUPING([is_male]) AS [rollup_gender],
  COUNT(1) AS [count]
FROM
  [publicdata:samples.natality]
WHERE
  (([year] >= 2000) AND ([year] <= 2002))
GROUP BY ROLLUP
(
  [year],
  [is_male]
)
ORDER BY
  [year], [is_male]".TrimSmart());
        }

        [TestMethod]
        public void WindowFunction()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<Shakespeare>()
                .Where(x => x.corpus == "othello")
                .Select(x => new
                {
                    x.word,
                    cume_dist = BqFunc.CumulativeDistribution(x)
                        .PartitionBy(y => y.corpus)
                        .OrderByDescending(y => y.word_count)
                        .Value
                })
                .Limit(5)
                .ToString();

            query1.Is(@"
SELECT
  [word],
  CUME_DIST() OVER (PARTITION BY [corpus] ORDER BY [word_count] DESC) AS [cume_dist]
FROM
  [publicdata:samples.shakespeare]
WHERE
  ([corpus] = 'othello')
LIMIT 5".TrimSmart());
        }

        [TestMethod]
        public void WindowFunction2()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<Shakespeare>()
                .Where(x => x.corpus == "othello")
                .Select(x => new
                {
                    x.word,
                    lag = BqFunc.Lag(x, y => y.word, 1, "aaa")
                        .PartitionBy(y => y.corpus)
                        .OrderByDescending(y => y.word_count)
                        .Value
                })
                .Limit(5)
                .ToString();

            query1.Is(@"
SELECT
  [word],
  LAG([word], 1, 'aaa') OVER (PARTITION BY [corpus] ORDER BY [word_count] DESC) AS [lag]
FROM
  [publicdata:samples.shakespeare]
WHERE
  ([corpus] = 'othello')
LIMIT 5".TrimSmart());
        }

        [TestMethod]
        public void RowNumber1()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<Shakespeare>()
                .Where(x => x.corpus == "othello" && BqFunc.Length(x.word) > 10)
                .Select(x => new
                {
                    x.word,
                    lag = BqFunc.RowNumber(x).Value
                    //.PartitionBy(y => y.corpus)
                    //.OrderByDescending(y => y.word_count)
                })
                .Limit(5)
                .ToString();

            query1.Is(@"
SELECT
  [word],
  ROW_NUMBER() OVER () AS [lag]
FROM
  [publicdata:samples.shakespeare]
WHERE
  (([corpus] = 'othello') AND (LENGTH([word]) > 10))
LIMIT 5".TrimSmart());
        }

        [TestMethod]
        public void RowNumber2()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<Shakespeare>()
                .Where(x => x.corpus == "othello" && BqFunc.Length(x.word) > 10)
                .Select(x => new
                {
                    x.word,
                    lag = BqFunc.RowNumber(x)
                      .PartitionBy(y => y.corpus).Value
                    //.OrderByDescending(y => y.word_count)
                })
                .Limit(5)
                .ToString();

            query1.Is(@"
SELECT
  [word],
  ROW_NUMBER() OVER (PARTITION BY [corpus]) AS [lag]
FROM
  [publicdata:samples.shakespeare]
WHERE
  (([corpus] = 'othello') AND (LENGTH([word]) > 10))
LIMIT 5".TrimSmart());
        }

        [TestMethod]
        public void RowNumber3()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<Shakespeare>()
                .Where(x => x.corpus == "othello" && BqFunc.Length(x.word) > 10)
                .Select(x => new
                {
                    x.word,
                    lag = BqFunc.RowNumber(x)
                    //.PartitionBy(y => y.corpus)
                    .OrderByDescending(y => y.word_count)
                    .Value
                })
                .Limit(5)
                .ToString();

            query1.Is(@"
SELECT
  [word],
  ROW_NUMBER() OVER (ORDER BY [word_count] DESC) AS [lag]
FROM
  [publicdata:samples.shakespeare]
WHERE
  (([corpus] = 'othello') AND (LENGTH([word]) > 10))
LIMIT 5".TrimSmart());
        }

        [TestMethod]
        public void RowNumber4()
        {
            var context = new BigQuery.Linq.BigQueryContext();

            var query1 = context.From<Shakespeare>()
                .Where(x => x.corpus == "othello" && BqFunc.Length(x.word) > 10)
                .Select(x => new
                {
                    x.word,
                    lag = BqFunc.RowNumber(x)
                        .PartitionBy(y => y.corpus)
                        .OrderByDescending(y => y.word_count)
                        .Value
                })
                .Limit(5)
                .ToString();

            query1.Is(@"
SELECT
  [word],
  ROW_NUMBER() OVER (PARTITION BY [corpus] ORDER BY [word_count] DESC) AS [lag]
FROM
  [publicdata:samples.shakespeare]
WHERE
  (([corpus] = 'othello') AND (LENGTH([word]) > 10))
LIMIT 5".TrimSmart());
        }

        [TestMethod]
        public void EnumAsValue()
        {
            new BigQueryContext().Select(() => new
            {
                Nano.Hoge,
                Nano.Huga,
                Nano.Tako,
            })
            .ToString()
            .Is(@"
SELECT
  1 AS [Hoge],
  4 AS [Huga],
  100 AS [Tako]
".TrimSmart());
        }

        [TestMethod]
        public void DateTime()
        {
            var local = new DateTime(2014, 10, 16, 21, 0, 0, DateTimeKind.Local);
            var offset = TimeZone.CurrentTimeZone.GetUtcOffset(local);
            var offsetLocal = new DateTime(local.Ticks + offset.Ticks, DateTimeKind.Local);
            new BigQueryContext().Select(() => new { dt = offsetLocal })
                            .ToString()
                            .Is(@"
SELECT
  '2014-10-16 21:00:00.000000' AS [dt]".TrimSmart());

            new BigQueryContext().Select(() => new { dt = new DateTime(2014, 10, 16, 21, 0, 0, DateTimeKind.Utc) })
                .ToString()
                .Is(@"
SELECT
  '2014-10-16 21:00:00.000000' AS [dt]".TrimSmart());

            new BigQueryContext().Select(() => new { dt = new DateTimeOffset(2014, 10, 16, 21, 0, 0, TimeSpan.Zero) })
                .ToString()
                .Is(@"
SELECT
  '2014-10-16 21:00:00.000000' AS [dt]".TrimSmart());
        }
    }
}


text:
<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use AppBundle\Entity\Tag;
use AppBundle\Form\TagType;
use AppBundle\Form\AssetTagType;
use Doctrine\ORM\Query\ResultSetMapping;

class TagController extends Controller
{
    /**
     * @Route("/tags/{style}", defaults={"style" = "list"}, requirements={"style": "list|block"})
     * @Route("/{style}", name="tags", defaults={"style" = "list", "_locale" = "de"}, requirements={"style": "list|block"})
     * @Template()
     */
    public function indexAction($style)
    {
        $em = $this->getDoctrine()->getManager();
        $tags = $em->getRepository('AppBundle:Tag')->findAll();

        return array('tags' => $tags, 'style' => $style);
    }

    /**
     * @Route("/files-without-tags", name="files_without_tags")
     * @Template()
     */
    public function assetsWithoutTagsAction()
    {
        return array('assets' => $this->get('archy.asset')->getAssetsWithoutTags());
    }

    /**
     * @Route("/tag/new", name="new_tag")
     * @Template()
     */
    public function newTagAction(Request $request)
    {
        $tag = new Tag();
        $form = $this->createForm(new TagType(), $tag);
        $form->add('save', 'submit', array('label' => 'archy.new_tag.submit'));

        if ($request->getMethod() == "POST") { //posts form
            $form->handleRequest($request);

            if ($form->isValid()) {
                $em = $this->getDoctrine()->getManager();
                $em->persist($tag);
                $em->flush();
                $this->get('session')->getFlashBag()->add('success', 'archy.new_tag.success');
                return $this->redirect($this->generateUrl('tags'));
            }
            $this->get('session')->getFlashBag()->add('error', 'archy.new_tag.error');
        }
        return array('form' => $form->createView());
    }

    /**
     * @Route("/tag/{tag}/{style}", name="show_tag", defaults={"style" = "list"}, requirements={"style": "list|block"})
     * @Template()
     */
    public function tagAction(Tag $tag, $style)
    {
        return array('tag' => $tag, 'style' => $style);
    }

    /**
     * @Route("/tag/{tag}/upload", name="upload_tag_assets")
     * @Template()
     */
    public function uploadTagAssetsAction(Request $request, Tag $tag)
    {
        $form = $this->createForm(new AssetTagType(), $tag);
        $form->add('save', 'submit', array('label' => 'archy.upload_tag_assets.submit'));
        //TODO show uploadform, upload post
        if ($request->getMethod() == "POST") {//posts form
            $form->handleRequest($request);
            $em = $this->getDoctrine()->getManager();
            $em->persist($tag);
            $em->flush();
            //TODO: service to map assets to user and make md5 checksum
            $this->get('session')->getFlashBag()->add('success', 'archy.upload.success');
            return $this->redirect($this->generateUrl('show_tag', array('tag'=>$tag->getId()) ));
        }

        return array('form' => $form->createView(), 'tag' => $tag);
    }

    /**
     * @Route("/tag/{id}/edit", name="edit_tag")
     * @Template()
     */
    public function editTagAction(Tag $tag, Request $request)
    {
        $form = $this->createForm(new TagType(), $tag);
         $form->add('save', 'submit', array('label' => 'archy.edit_tag.submit'));

        if ($request->getMethod() == "POST") { //posts form
            $form->handleRequest($request);

            if ($form->isValid()) {
                $em = $this->getDoctrine()->getManager();
                $em->persist($tag);
                $em->flush();
                $this->get('session')->getFlashBag()->add('success', 'archy.edit_tag.success');
                return $this->redirect($this->generateUrl('show_tag', array('tag'=> $tag->getId())));
            }
            $this->get('session')->getFlashBag()->add('error', 'archy.edit_tag.error');
        }
        return array('form' => $form->createView());
    }

    /**
     * @Route("/tag/{id}/delete", name="delete_tag")
     * @Template()
     */
    public function deleteTagAction(Request $request, Tag $tag)
    {
        if ($request->getMethod() == "DELETE") {
            $em = $this->getDoctrine()->getManager();
            $em->remove($tag);
            $em->flush();
            $this->get('session')->getFlashBag()->add('success', 'archy.delete_tag.success');
            $this->redirect($this->generateUrl('tags'));
        }
        $form = $this->createForm(new TagType(), $tag, array('method' => 'DELETE'));
        $form->add('save', 'submit', array('label' => 'archy.delete_tag.submit'));
        return array('form' => $form->createView());
    }

    /**
    * @Route("/tag/{id}/favorites/{action}", requirements={"action": "add|remove"}, name="tag_favourite")
    */
    public function addTagToFavoritesAction(Request $request, Tag $tag, $action)
    {
        $em = $this->getDoctrine()->getManager();
        $user = $user = $this->getUser();

        if ($action == "add") {
            $user->addTag($tag);
        } else {
            $user->removeTag($tag);
        }

        $em->persist($user);
        $em->flush();

        return $this->redirect($this->generateUrl('favorites'));
    }
}


text:
<?php

  require_once'../view/Schedule.php';
  require_once'../model/ScheduleDAO.php';

  session_start();

  $schedule_name = $_POST['name'];
  $schedule_evaluation = $_POST['eva'];
  $schedule_comment = $_POST['com'];
/*
  $hash = $_GET['hash'];
  $scheduleDao = new ScheduleDAO();
  $newschedule = $scheduleDao -> getschedule($hash);

  $newscheduleid = count(scheduleId());
  $newschedule = new Schedule($newscheduleid,$eventUrl,$candidateSchedule,$schedule_name,$schedule_evaluation,$schedule_comment);
  array_push($scheduleArray,$newschedule);
*/

  $_SESSION['display_name'] = $schedule_name;
  $_SESSION['evaluation'] = $schedule_evaluation;
  $_SESSION['comment'] = $schedule_comment;

  header('Location: ../view/Schedule.php');
  exit();
?>


text:
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Docker.DotNet
{
    /// <summary>
    /// Facade for <see cref="JsonConvert"/>.
    /// </summary>
    internal class JsonSerializer
    {
        private readonly JsonSerializerSettings _settings = new JsonSerializerSettings
        {
            NullValueHandling = NullValueHandling.Ignore,
            Converters = new JsonConverter[]
            {
                new JsonIso8601AndUnixEpochDateConverter(),
                new JsonVersionConverter(),
                new StringEnumConverter(),
                new TimeSpanSecondsConverter(),
                new TimeSpanNanosecondsConverter()
            }
        };

        public JsonSerializer()
        {
        }

        public T DeserializeObject<T>(string json)
        {
            return JsonConvert.DeserializeObject<T>(json, this._settings);
        }

        public string SerializeObject<T>(T value)
        {
            return JsonConvert.SerializeObject(value, this._settings);
        }
    }
}


text:
require 'soap/wsdlDriver'
require 'soap/header/simplehandler'
require 'stringio'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module EwayManaged
      class ProxyBase < EwayBase::Proxy
        def wdsl
          "https://www.eway.com.au/gateway/ManagedPaymentService/test/managedCreditCardPayment.asmx?WSDL"
        end

        def header(eway_customer_id, username, password)
          EwayManagedHeader.new(eway_customer_id, username, password)
        end
      end

      class EwayManagedHeader < SOAP::Header::SimpleHandler
        def initialize(eway_customer_id, username, password)
          super(XSD::QName.new('https://www.eway.com.au/gateway/managedpayment', 'eWAYHeader'))
          @item = { :eWAYCustomerID => eway_customer_id, :Username => username, :Password => password }
        end

        def on_simple_outbound
          @item if @item
        end
      end

      class Customer < ProxyBase
        attr_accessor :options

        def initialize(attributes = {}, options = {})
          self.fields = [ :id, :ref, :title, :first_name, :last_name, :company, :job_desc, :email, :address, :suburb, :state, :post_code, :country, :phone, :mobile, :fax, :url, :comments ]
          self.options = options
          super(attributes)
        end

        def credit_card
          @credit_card
        end

        def credit_card=(credit_card)
          @credit_card = credit_card
        end

        def save(options = {})
          if id
            update(options)
          else
            create(options)
          end
          return true
        rescue
          return false
        end

        def save!(options = {})
          if id
            update(options)
          else
            create(options)
          end
        end

        def create(options = {})
          self.credit_card.require_verification_value = false
          raise ::ActiveRecord::RecordInvalid.new(self) unless self.valid?
          raise ::ActiveRecord::RecordInvalid.new(self.credit_card) unless self.credit_card.valid?
          self.credit_card.year = self.credit_card.year.to_s[2..3]

          options = self.options.merge(options)
          res = driver(options[:login], options[:username], options[:password]).CreateCustomer(prepared_attributes).createCustomerResult
          self.id = res.to_i
        end

        def update(options = {})
          self.credit_card.require_verification_value = false
          return false unless self.valid?
          return false unless self.credit_card.valid?
          self.credit_card.year = self.credit_card.year.to_s[2..3]

          options = self.options.merge(options)
          res = driver(options[:login], options[:username], options[:password]).UpdateCustomer(prepared_attributes).updateCustomerResult
          res
        end

        def self.query(id, options = {})
          proxy = ProxyBase.new
          response = proxy.driver(options[:login], options[:username], options[:password]).QueryCustomer(:managedCustomerID => id).queryCustomerResult

          customer = Customer.new({}, options)

          customer.fields.each do |field|
            case(field)
            when :id
              camel_key = "managedCustomerID"
            when :url
              camel_key = "customerURL"
            when :phone
              camel_key = "customerPhone1"
            when :mobile
              camel_key = "customerPhone2"
            else
              camel_key = "customer" + ProxyBase.camelize(field)
            end
            customer.send("#{field.to_s}=", response.send(camel_key))
          end

          ccName = response.cCName.split(' ')
          customer.credit_card = ActiveMerchant::Billing::CreditCard.new(
            :number => response.cCNumber,
            :month => response.cCExpiryMonth,
            :year => response.cCExpiryYear,
            :first_name => ccName.shift,
            :last_name => ccName.join(' ')
          )

          customer
        end

        def validate
          errors.add :first_name, 'is required' if self.first_name.blank?
          errors.add :last_name, 'is required' if self.last_name.blank?
          errors.add :email, 'is required' if self.email.blank?
        end

        def prepared_attributes(attributes = nil)
          attributes ||= @attributes
          tmp = {}
          self.fields.each do |key|
            case(key)
            when :id
              camel_key = "managedCustomerID"
            when :ref
              camel_key = "CustomerRef"
            when :url
              camel_key = "URL"
            else
              camel_key = ProxyBase.camelize(key)
            end

            tmp[camel_key.to_s] = attributes[key].to_s
          end
          tmp["Title"] = "Mr."
          tmp["Country"] = "au"

          # Now go through the Credit Card object
          tmp['CCNumber'] = self.credit_card.number
          tmp['CCNameOnCard'] = self.credit_card.first_name + " " + self.credit_card.last_name
          tmp['CCExpiryMonth'] = self.credit_card.month
          tmp['CCExpiryYear'] = self.credit_card.year

          tmp
        end
      end

      class CustomerResponse < EwayBase::Response
        attr_accessor :customer_id, :customer

        def initialize(soap_obj)
          super
          self.customer_id = soap_obj.rebillCustomerID == "0" ? nil : soap_obj.rebillCustomerID

          # Try to fill the customer object
          self.customer = Customer.new
          self.customer.id = self.customer_id

          self.customer.fields.each do |key|
            case(key)
            when(:url)
              method = "customerURL"
            else
              method = "customer" + ProxyBase.camelize(key)
            end

            self.customer.send("#{key}=", soap_obj.send(method)) if soap_obj.respond_to?(method)
          end
        end
      end

      class Payment < ProxyBase
        def initialize(attributes = {})
          self.fields = [ :id, :customer_id, :amount, :invoice_reference, :invoice_description ]
          super
        end

        def self.query(customer_id, options = {})
          proxy = ProxyBase.new
          res = proxy.driver(options[:login], options[:username], options[:password]).QueryPayment(:managedCustomerID => customer_id).queryPaymentResult
          payments = []
          res.managedTransaction.each do |t|
            payments << PaymentQueryResponse.new(t)
          end
          payments
        end

        def query(options = {})
          Payment.query(self.customer_id)
        end

        def process(options = {})
          begin
            res = driver(options[:login], options[:username], options[:password]).ProcessPayment(prepared_attributes).ewayResponse
            return PaymentResponse.new(res)
          rescue SOAP::FaultError => message
            response = EwayManaged::PaymentResponse.new
            response.status = false
            response.error = message
            response.return_amount = self.amount
            return response
          end
        end

        def prepared_attributes(attributes = nil)
          attributes ||= @attributes
          tmp = {}
          self.fields.each do |key|
            case(key)
            when :customer_id
              camel_key = "managedCustomerID"
            else
              camel_key = ProxyBase.camelize(key, false)
            end
            tmp[camel_key] = attributes[key]
          end

          tmp
        end

        def validate
          errors.add :customer_id, 'is required' if self.customer_id.blank?
          errors.add :amount, 'is required' if self.amount.blank?
          errors.add :invoice_reference, 'is required' if self.invoice_reference.blank?
          errors.add :amount, 'must be a number' unless self.amount.is_a(Number)
        end
      end

      class PaymentResponse < EwayBase::Response
        attr_accessor :status, :transaction_number, :return_amount, :auth_code, :error

        def initialize(soap_obj = nil)
          if soap_obj
            self.status = soap_obj.ewayTrxnStatus == "True"
            self.transaction_number = soap_obj.ewayTrxnNumber.to_i
            self.return_amount = soap_obj.ewayReturnAmount.to_i
            self.auth_code = soap_obj.ewayAuthCode
            self.error = soap_obj.ewayTrxnError
          end
        end
      end

      class PaymentQueryResponse < EwayBase::Response
        attr_accessor :amount, :success, :response, :date, :transaction_number

        def initialize(soap_obj = nil)
          if soap_obj
            self.amount = soap_obj.totalAmount.to_i.to_f / 100
            self.success = soap_obj.result == "1"
            self.response = soap_obj.responseText
            self.date = DateTime.strptime(soap_obj.transactionDate, "%Y-%m-%dT%H:%M:%S%Z")
            self.transaction_number = soap_obj.ewayTrxnNumber.to_i
          end
        end
      end
    end
  end
end


text:
package com.amazonaws.services.glue.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * Represents a slice of table data.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Partition implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The values of the partition.
     *

     */
    private java.util.List<String> values;
    /**
     *

     * The name of the catalog database in which to create the partition.
     *

     */
    private String databaseName;
    /**
     *

     * The name of the database table in which to create the partition.
     *

     */
    private String tableName;
    /**
     *

     * The time at which the partition was created.
     *

     */
    private java.util.Date creationTime;
    /**
     *

     * The last time at which the partition was accessed.
     *

     */
    private java.util.Date lastAccessTime;
    /**
     *

     * Provides information about the physical location where the partition is stored.
     *

     */
    private StorageDescriptor storageDescriptor;
    /**
     *

     * These key-value pairs define partition parameters.
     *

     */
    private java.util.Map<String, String> parameters;
    /**
     *

     * The last time at which column statistics were computed for this partition.
     *

     */
    private java.util.Date lastAnalyzedTime;

    /**
     *

     * The values of the partition.
     *

     *
     * @return The values of the partition.
     */

    public java.util.List<String> getValues() {
        return values;
    }

    /**
     *

     * The values of the partition.
     *

     *
     * @param values
     *        The values of the partition.
     */

    public void setValues(java.util.Collection<String> values) {
        if (values == null) {
            this.values = null;
            return;
        }

        this.values = new java.util.ArrayList<String>(values);
    }

    /**
     *

     * The values of the partition.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setValues(java.util.Collection)} or {@link #withValues(java.util.Collection)} if you want to override the
     * existing values.
     *

     *
     * @param values
     *        The values of the partition.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition withValues(String... values) {
        if (this.values == null) {
            setValues(new java.util.ArrayList<String>(values.length));
        }
        for (String ele : values) {
            this.values.add(ele);
        }
        return this;
    }

    /**
     *

     * The values of the partition.
     *

     *
     * @param values
     *        The values of the partition.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition withValues(java.util.Collection<String> values) {
        setValues(values);
        return this;
    }

    /**
     *

     * The name of the catalog database in which to create the partition.
     *

     *
     * @param databaseName
     *        The name of the catalog database in which to create the partition.
     */

    public void setDatabaseName(String databaseName) {
        this.databaseName = databaseName;
    }

    /**
     *

     * The name of the catalog database in which to create the partition.
     *

     *
     * @return The name of the catalog database in which to create the partition.
     */

    public String getDatabaseName() {
        return this.databaseName;
    }

    /**
     *

     * The name of the catalog database in which to create the partition.
     *

     *
     * @param databaseName
     *        The name of the catalog database in which to create the partition.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition withDatabaseName(String databaseName) {
        setDatabaseName(databaseName);
        return this;
    }

    /**
     *

     * The name of the database table in which to create the partition.
     *

     *
     * @param tableName
     *        The name of the database table in which to create the partition.
     */

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /**
     *

     * The name of the database table in which to create the partition.
     *

     *
     * @return The name of the database table in which to create the partition.
     */

    public String getTableName() {
        return this.tableName;
    }

    /**
     *

     * The name of the database table in which to create the partition.
     *

     *
     * @param tableName
     *        The name of the database table in which to create the partition.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition withTableName(String tableName) {
        setTableName(tableName);
        return this;
    }

    /**
     *

     * The time at which the partition was created.
     *

     *
     * @param creationTime
     *        The time at which the partition was created.
     */

    public void setCreationTime(java.util.Date creationTime) {
        this.creationTime = creationTime;
    }

    /**
     *

     * The time at which the partition was created.
     *

     *
     * @return The time at which the partition was created.
     */

    public java.util.Date getCreationTime() {
        return this.creationTime;
    }

    /**
     *

     * The time at which the partition was created.
     *

     *
     * @param creationTime
     *        The time at which the partition was created.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition withCreationTime(java.util.Date creationTime) {
        setCreationTime(creationTime);
        return this;
    }

    /**
     *

     * The last time at which the partition was accessed.
     *

     *
     * @param lastAccessTime
     *        The last time at which the partition was accessed.
     */

    public void setLastAccessTime(java.util.Date lastAccessTime) {
        this.lastAccessTime = lastAccessTime;
    }

    /**
     *

     * The last time at which the partition was accessed.
     *

     *
     * @return The last time at which the partition was accessed.
     */

    public java.util.Date getLastAccessTime() {
        return this.lastAccessTime;
    }

    /**
     *

     * The last time at which the partition was accessed.
     *

     *
     * @param lastAccessTime
     *        The last time at which the partition was accessed.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition withLastAccessTime(java.util.Date lastAccessTime) {
        setLastAccessTime(lastAccessTime);
        return this;
    }

    /**
     *

     * Provides information about the physical location where the partition is stored.
     *

     *
     * @param storageDescriptor
     *        Provides information about the physical location where the partition is stored.
     */

    public void setStorageDescriptor(StorageDescriptor storageDescriptor) {
        this.storageDescriptor = storageDescriptor;
    }

    /**
     *

     * Provides information about the physical location where the partition is stored.
     *

     *
     * @return Provides information about the physical location where the partition is stored.
     */

    public StorageDescriptor getStorageDescriptor() {
        return this.storageDescriptor;
    }

    /**
     *

     * Provides information about the physical location where the partition is stored.
     *

     *
     * @param storageDescriptor
     *        Provides information about the physical location where the partition is stored.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition withStorageDescriptor(StorageDescriptor storageDescriptor) {
        setStorageDescriptor(storageDescriptor);
        return this;
    }

    /**
     *

     * These key-value pairs define partition parameters.
     *

     *
     * @return These key-value pairs define partition parameters.
     */

    public java.util.Map<String, String> getParameters() {
        return parameters;
    }

    /**
     *

     * These key-value pairs define partition parameters.
     *

     *
     * @param parameters
     *        These key-value pairs define partition parameters.
     */

    public void setParameters(java.util.Map<String, String> parameters) {
        this.parameters = parameters;
    }

    /**
     *

     * These key-value pairs define partition parameters.
     *

     *
     * @param parameters
     *        These key-value pairs define partition parameters.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition withParameters(java.util.Map<String, String> parameters) {
        setParameters(parameters);
        return this;
    }

    public Partition addParametersEntry(String key, String value) {
        if (null == this.parameters) {
            this.parameters = new java.util.HashMap<String, String>();
        }
        if (this.parameters.containsKey(key))
            throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
        this.parameters.put(key, value);
        return this;
    }

    /**
     * Removes all the entries added into Parameters.
     *
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition clearParametersEntries() {
        this.parameters = null;
        return this;
    }

    /**
     *

     * The last time at which column statistics were computed for this partition.
     *

     *
     * @param lastAnalyzedTime
     *        The last time at which column statistics were computed for this partition.
     */

    public void setLastAnalyzedTime(java.util.Date lastAnalyzedTime) {
        this.lastAnalyzedTime = lastAnalyzedTime;
    }

    /**
     *

     * The last time at which column statistics were computed for this partition.
     *

     *
     * @return The last time at which column statistics were computed for this partition.
     */

    public java.util.Date getLastAnalyzedTime() {
        return this.lastAnalyzedTime;
    }

    /**
     *

     * The last time at which column statistics were computed for this partition.
     *

     *
     * @param lastAnalyzedTime
     *        The last time at which column statistics were computed for this partition.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Partition withLastAnalyzedTime(java.util.Date lastAnalyzedTime) {
        setLastAnalyzedTime(lastAnalyzedTime);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getValues() != null)
            sb.append("Values: ").append(getValues()).append(",");
        if (getDatabaseName() != null)
            sb.append("DatabaseName: ").append(getDatabaseName()).append(",");
        if (getTableName() != null)
            sb.append("TableName: ").append(getTableName()).append(",");
        if (getCreationTime() != null)
            sb.append("CreationTime: ").append(getCreationTime()).append(",");
        if (getLastAccessTime() != null)
            sb.append("LastAccessTime: ").append(getLastAccessTime()).append(",");
        if (getStorageDescriptor() != null)
            sb.append("StorageDescriptor: ").append(getStorageDescriptor()).append(",");
        if (getParameters() != null)
            sb.append("Parameters: ").append(getParameters()).append(",");
        if (getLastAnalyzedTime() != null)
            sb.append("LastAnalyzedTime: ").append(getLastAnalyzedTime());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof Partition == false)
            return false;
        Partition other = (Partition) obj;
        if (other.getValues() == null ^ this.getValues() == null)
            return false;
        if (other.getValues() != null && other.getValues().equals(this.getValues()) == false)
            return false;
        if (other.getDatabaseName() == null ^ this.getDatabaseName() == null)
            return false;
        if (other.getDatabaseName() != null && other.getDatabaseName().equals(this.getDatabaseName()) == false)
            return false;
        if (other.getTableName() == null ^ this.getTableName() == null)
            return false;
        if (other.getTableName() != null && other.getTableName().equals(this.getTableName()) == false)
            return false;
        if (other.getCreationTime() == null ^ this.getCreationTime() == null)
            return false;
        if (other.getCreationTime() != null && other.getCreationTime().equals(this.getCreationTime()) == false)
            return false;
        if (other.getLastAccessTime() == null ^ this.getLastAccessTime() == null)
            return false;
        if (other.getLastAccessTime() != null && other.getLastAccessTime().equals(this.getLastAccessTime()) == false)
            return false;
        if (other.getStorageDescriptor() == null ^ this.getStorageDescriptor() == null)
            return false;
        if (other.getStorageDescriptor() != null && other.getStorageDescriptor().equals(this.getStorageDescriptor()) == false)
            return false;
        if (other.getParameters() == null ^ this.getParameters() == null)
            return false;
        if (other.getParameters() != null && other.getParameters().equals(this.getParameters()) == false)
            return false;
        if (other.getLastAnalyzedTime() == null ^ this.getLastAnalyzedTime() == null)
            return false;
        if (other.getLastAnalyzedTime() != null && other.getLastAnalyzedTime().equals(this.getLastAnalyzedTime()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getValues() == null) ? 0 : getValues().hashCode());
        hashCode = prime * hashCode + ((getDatabaseName() == null) ? 0 : getDatabaseName().hashCode());
        hashCode = prime * hashCode + ((getTableName() == null) ? 0 : getTableName().hashCode());
        hashCode = prime * hashCode + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode());
        hashCode = prime * hashCode + ((getLastAccessTime() == null) ? 0 : getLastAccessTime().hashCode());
        hashCode = prime * hashCode + ((getStorageDescriptor() == null) ? 0 : getStorageDescriptor().hashCode());
        hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode());
        hashCode = prime * hashCode + ((getLastAnalyzedTime() == null) ? 0 : getLastAnalyzedTime().hashCode());
        return hashCode;
    }

    @Override
    public Partition clone() {
        try {
            return (Partition) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.glue.model.transform.PartitionMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
<?php

namespace spec\Sylius\Bundle\CurrencyBundle\Command;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Component\Currency\Importer\ImporterInterface;
use Sylius\Component\Currency\Model\CurrencyInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class ImportExchangeRateCommandSpec extends ObjectBehavior
{
    function it_is_initializable()
    {
        $this->shouldHaveType('Sylius\Bundle\CurrencyBundle\Command\ImportExchangeRateCommand');
    }

    function it_is_a_command()
    {
        $this->shouldHaveType(ContainerAwareCommand::class);
    }

    function it_has_a_name()
    {
        $this->getName()->shouldReturn('sylius:currency:import');
    }

    function it_updates_a_available_exchange_rate(
        ContainerInterface $container,
        InputInterface $input,
        OutputInterface $output,
        ImporterInterface $importer,
        CurrencyInterface $currency
    ) {
        $input->bind(Argument::any())->shouldBeCalled();
        $input->isInteractive()->shouldBeCalled();
        $input->validate()->shouldBeCalled();
        $input->hasArgument('command')->willReturn(false);

        $output->writeln('Fetching data from external database.')->shouldBeCalled();

        $input->getArgument('importer')->shouldBeCalled()->willreturn('importer');
        $container->get('sylius.currency_importer.importer')->shouldBeCalled()->willreturn($importer);
        $importer->import()->shouldBeCalled();

        $output->writeln('Saving updated exchange rates.')->shouldBeCalled();

        $this->setContainer($container);
        $this->run($input, $output);
    }
}


text:
<?php

namespace Classroom\AnalyzerBundle;

use Classroom\AnalyzerBundle\PreProcessor\PreProcessorInterface;
use Classroom\AnalyzerBundle\Processor\ProcessorInterface;
use Classroom\AnalyzerBundle\PostProcessor\PostProcessorInterface;
use Classroom\AnalyzerBundle\Log\Log;
use Classroom\AnalyzerBundle\Result\Result;

class ResultBuilder implements ResultBuilderInterface
{
    /**
     * @var PostProcessorInterface
     */
    private $preProcessor;

    /**
     * @var PostProcessorInterface
     */
    private $processor;

    /**
     * @var PostProcessorInterface
     */
    private $postProcessor;

    /**
     * @param PreProcessorInterface $postProcessor
     * @param ProcessorInterface $postProcessor
     * @param PostProcessorInterface $postProcessor
     */
    public function __construct(PreProcessorInterface $preProcessor,
                                ProcessorInterface $processor,
                                PostProcessorInterface $postProcessor)
    {
        $this->preProcessor = $preProcessor;
        $this->processor = $processor;
        $this->postProcessor = $postProcessor;
    }

    /**
     * @inheritDoc
     */
    public function buildResult($sourceDirectory, $workingDirectory, callable $logCallback = null)
    {
        $result = new Result();
        $result->setLog(new Log($logCallback));
        $result->setSourceDirectory($sourceDirectory);
        $result->setWorkingDirectory($workingDirectory);

        $this->preProcessor->process($result);
        $this->processor->process($result);
        $this->postProcessor->process($result);

        $result->setBuiltAt(new \DateTime());

        return $result;
    }
}


text:
package com.gemstone.gemfire.internal;

import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.CopyOnWriteArrayList;

import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.DiskStoreFactory;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.internal.cache.DiskStoreImpl;
import com.gemstone.gemfire.pdx.PdxInstance;
import com.gemstone.gemfire.pdx.PdxReader;
import com.gemstone.gemfire.pdx.PdxSerializable;
import com.gemstone.gemfire.pdx.PdxWriter;
import com.gemstone.gemfire.pdx.internal.EnumInfo;
import com.gemstone.gemfire.pdx.internal.PdxInstanceImpl;
import com.gemstone.gemfire.pdx.internal.PdxType;

import dunit.Host;
import dunit.SerializableCallable;
import dunit.VM;

public class PdxRenameDUnitTest  extends CacheTestCase{
  final List<String> filesToBeDeleted = new CopyOnWriteArrayList<String>();

  public PdxRenameDUnitTest(String name) {
    super(name);
  }

  public void testPdxRenameVersioning() throws Exception {
    final String DS_NAME = "PdxRenameDUnitTestDiskStore";
    final String DS_NAME2 = "PdxRenameDUnitTestDiskStore2";
    final Properties props = new Properties();
    props.setProperty("mcast-port", Integer.toString(AvailablePortHelper.getRandomAvailablePortForDUnitSite()));
    props.setProperty("locators", "");

    final File f = new File(DS_NAME);
    f.mkdir();
    final File f2 = new File(DS_NAME2);
    f2.mkdir();
    this.filesToBeDeleted.add(DS_NAME);
    this.filesToBeDeleted.add(DS_NAME2);

    Host host = Host.getHost(0);
    VM vm1 = host.getVM(0);
    VM vm2 = host.getVM(1);

    vm1.invoke(new SerializableCallable() {
      public Object call() throws Exception {
        disconnectFromDS();
        final Cache cache = (new CacheFactory(props)).setPdxPersistent(true).setPdxDiskStore(DS_NAME).create();
        DiskStoreFactory dsf = cache.createDiskStoreFactory();
        dsf.setDiskDirs(new File[]{f});
        dsf.create(DS_NAME);
        RegionFactory<String, PdxValue> rf1 = cache.createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT);
        rf1.setDiskStoreName(DS_NAME);
        Region<String, PdxValue> region1 = rf1.create("region1");
        region1.put("key1", new PdxValue(1));
        return null;
      }
    });

    vm2.invoke(new SerializableCallable() {
      public Object call() throws Exception {
        disconnectFromDS();
        final Cache cache = (new CacheFactory(props)).setPdxReadSerialized(true).setPdxPersistent(true).setPdxDiskStore(DS_NAME2).create();
        DiskStoreFactory dsf = cache.createDiskStoreFactory();
        dsf.setDiskDirs(new File[]{f2});
        dsf.create(DS_NAME2);
        RegionFactory rf1 = cache.createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT);
        rf1.setDiskStoreName(DS_NAME2);
        Region region1 = rf1.create("region1");
        Object v = region1.get("key1");
        assertNotNull(v);
        cache.close();
        return null;
      }
    });

    vm1.invoke(new SerializableCallable() {
      public Object call() throws Exception {
        Cache cache = CacheFactory.getAnyInstance();
        if(cache != null && !cache.isClosed()) {
          cache.close();
        }
        return null;
      }
    });

    vm1.invoke(new SerializableCallable() {
      public Object call() throws Exception {
        Collection<Object> renameResults = DiskStoreImpl.pdxRename(DS_NAME, new File[]{f}, "gemstone", "pivotal");
        assertEquals(2, renameResults.size());

        for(Object o : renameResults) {
          if(o instanceof PdxType) {
            PdxType t = (PdxType)o;
            assertEquals("com.pivotal.gemfire.internal.PdxRenameDUnitTest$PdxValue", t.getClassName());
          } else {
            EnumInfo ei = (EnumInfo) o;
            assertEquals("com.pivotal.gemfire.internal.PdxRenameDUnitTest$Day", ei.getClassName());
          }
        }
        return null;
      }
    });

    vm1.invoke(new SerializableCallable() {
      public Object call() throws Exception {
        final Cache cache = (new CacheFactory(props)).setPdxPersistent(true).setPdxDiskStore(DS_NAME).create();
        DiskStoreFactory dsf = cache.createDiskStoreFactory();
        dsf.setDiskDirs(new File[]{f});
        dsf.create(DS_NAME);
        RegionFactory<String, PdxValue> rf1 = cache.createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT);
        rf1.setDiskStoreName(DS_NAME);
        Region<String, PdxValue> region1 = rf1.create("region1");
        return null;
      }
    });

    vm2.invoke(new SerializableCallable() {
      public Object call() throws Exception {
        disconnectFromDS();
        final Cache cache = (new CacheFactory(props)).setPdxReadSerialized(true).setPdxPersistent(true).setPdxDiskStore(DS_NAME2).create();

        DiskStoreFactory dsf = cache.createDiskStoreFactory();
        dsf.setDiskDirs(new File[]{f2});
        dsf.create(DS_NAME2);
        RegionFactory rf1 = cache.createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT);
        rf1.setDiskStoreName(DS_NAME2);
        Region region1 = rf1.create("region1");
        PdxInstance v = (PdxInstance) region1.get("key1");
        assertNotNull(v);
        assertEquals("com.pivotal.gemfire.internal.PdxRenameDUnitTest$PdxValue", ((PdxInstanceImpl)v).getClassName());
        cache.close();
        return null;
      }
    });

    vm1.invoke(new SerializableCallable() {
      public Object call() throws Exception {
        Cache cache = CacheFactory.getAnyInstance();
        if(cache != null && !cache.isClosed()) {
          cache.close();
        }
        return null;
      }
    });
  }

  @Override
  public void tearDown2() throws Exception {
    for (String path : this.filesToBeDeleted) {
      try {
        FileUtil.delete(new File(path));
      } catch (IOException e) {
        getLogWriter().error("Unable to delete file", e);
      }
    }
    this.filesToBeDeleted.clear();
    super.tearDown2();
  }

  enum Day {
    Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday;
  }

  class PdxValue implements PdxSerializable {
    private int value;
    public Day aDay;
    public PdxValue(int v) {
      this.value = v;
      aDay = Day.Sunday;
    }

    @Override
    public void toData(PdxWriter writer) {
      writer.writeInt("value", this.value);
      writer.writeObject("aDay", aDay);
    }

    @Override
    public void fromData(PdxReader reader) {
      this.value = reader.readInt("value");
      this.aDay = (Day) reader.readObject("aDay");
    }
  }
}