text:
Sample web part with Single and Multi-select taxonomy pickers using Office UI Fabric panel. The web part uses the Taxonomy API support available in the @pnp/taxonomy.

![TaxonomyPickerPanel web part](https://github.com/vipulkelkar/sp-dev-fx-webparts/blob/TaxonomyPanelPicker/samples/react-taxonomypicker-panel/assets/TaxonomyPicker.gif)

## Compatibility

![SPFx 1.5.1](https://img.shields.io/badge/SPFx-1.5.1-green.svg)
![Node.js v8 | v6](https://img.shields.io/badge/Node.js-LTS%208%20%7C%20v6-green.svg)
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower")
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
![Local Workbench Compatible](https://img.shields.io/badge/Local%20Workbench-Compatible-green.svg)
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)

## Applies to

* [SharePoint Framework](https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
* [Office 365 tenant](https://docs.microsoft.com/sharepoint/dev/spfx/set-up-your-development-environment)

## Prerequisites

- @pnp/sp
- Office UI Fabric React

## Solution

Solution|Author(s)
--------|---------
react-taxonomypicker-panel | Vipul Kelkar  @vipulkelkar

## Version history

Version|Date|Comments
-------|----|--------
1.0|June 22, 2018|Initial release
1.1|August 20, 2018|Bug fix and version upgrade

## Minimal Path to Awesome

- Clone this repository

- Navigate to the file 'src/webparts/components/TermsPickerComponent.tsx'

- In the method "GetTerms", replace the <TERM_STORE_NAME> with the term store name in your tenant.

- Navigate to the file 'src/webparts/components/ReactTaxonomyPickerpanel.tsx'

- In the RENDER method of the web part, a custom taxonomy picker component is used. Please replace the "TermSetId" property with the desired term set id in your tenant.

- in the command line run:
  - `npm install`
  - `gulp serve`

- Navigate to - <Your SP site>/_layouts/workbench.aspx and add the "react-taxonomypicker-panel"

>  This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit https://aka.ms/spfx-devcontainer for further instructions.

## Features

- This web part demonstrates the use of a custom taxonomy picker control built with Office UI Fabric React Panel and Tagpicker that enables users to select terms for a single-select or multi-select taxonomy field in a controlled manner.

- The custom taxonomy picker control is a reusable React component and can be easily placed in a SPFx web part just by providing the TermSetId as a property to the component.

  <TermsPickerComponent IsMultiValue={false} TermSetId='<TERM-SET-ID>' LabelText='Single-select field' SelectedTerms={<State variable>}/>

- By supplying the "SelectedTerms" property, the control can also be used in scenarios where pre-filled choices are to be shown such as the Edit form of a list item etc.

- The selected terms can be supplied as an array of a custom object

  {
    name : "<Term Name>",
    key : "<Term ID>"
  }

## Disclaimer

**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

<img src="https://pnptelemetry.azurewebsites.net/sp-dev-fx-webparts/samples/react-taxonomypicker-panel" />


text:
*14, male, high school student*

Sebastian is an enthusiastic and energized high school student, but he does not like to apply this
to his school work he would rather spend time gaming, or spend time out side. He would
like to be able to access the information for his school project all in one place.

**Personal Goals**

- Make money to buy a car
- Get good grades
- Complete the scouting program

**Technology skills**

- Can use computers and other devices
- Has a flip phone
- Plays video games regularly

**Likes**

- Throwing knives, archery pellet guns
- Video Games
- Camping
- Laughing and joking

**Dislikes**

- Doing homework, and doing Internet searches
- When people tease him about girls

### What would help?

- A website that had the information for his specific project
- Being able to access diagrams and images to help him learn about the sky

---

## Serena

*22, female, nature photographer*

Serena takes amazing images of nature so she can make large prints of them to sell. She is generally interested
in the sky and why it produces such amazing colours.

**Personal goals**

- To sell large prints of amazing images
- Become more knowledgeable about the items she takes pictures of

**Technology skills**

- Uses computers quite well to edit photos
- Has no issues accessing information on the internet

**Likes**

- Cute animals, beautiful and vibrant colours
- She likes knowing the science behind the beauty

**Dislikes**

- Seeing a lot of poorly taken photos
- Websites that don't really explain what they say they are going to explain

## What would help?

- Great high quality images
- Being able to find information with ease

redpajama_set_name: RedPajamaGithub


text:
#ifndef IMAGE_HPP
#define IMAGE_HPP

#include <cassert>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <limits>
#include <cmath>

#include <boost/random.hpp>

#include <graphlab.hpp>

#include <graphlab/macros_def.hpp>

/** A simple struct represent a gray scale image */
class image {
  size_t _rows, _cols;
  std::vector<double> data;
public:

  /** Create an empty image */
  image() : _rows(0), _cols(0), data(0,0) { }

  /** Create an image of a fixed size */
  image(size_t rows, size_t cols) :
    _rows(rows), _cols(cols), data(rows * cols, 0) { }

  inline void resize(size_t rows, size_t cols);

  /** Get the number of rows */
  inline size_t rows() const { return _rows; }

  /** Get the number of columns */
  inline size_t cols() const { return _cols; }

  /** get the number of pixels */
  inline size_t pixels() const { return _rows * _cols; }

  /** A function to read a pixel */
  inline double& pixel(size_t i, size_t j) { return data[vertid(i,j)]; }
  inline double pixel(size_t i, size_t j) const { return data[vertid(i,j)]; }

  /** Linear indexing */
  inline double& pixel(size_t i) { return data.at(i); }
  inline double pixel(size_t i) const { return data.at(i); }

  /** Get the vertex id of a pixel */
  inline size_t vertid(size_t i, size_t j) const;
  inline static size_t vertid(size_t rows, size_t cols, size_t i, size_t j) {
    assert(i < rows);
    assert(j < cols);
    return i * cols + j;
  }

  /** Get the pixel address from the vertex id */
  std::pair<size_t, size_t> loc(size_t vertex) const;

  /** A function to save the image to a file in pgm format */
  inline void save(const char* filename, bool autorescale = true, double min=0, double max=255) const;

  inline void save_vec(const char* filename) const {
    std::ofstream os(filename);
    assert(os.good());
    for(size_t i = 0; i < pixels(); ++i) {
      os << pixel(i) << "\n";
    }
    os.flush();
    os.close();
  }

  /** paint a beautiful sunset */
  void paint_sunset(size_t num_rings);

  /** Add random noise to the image */
  void corrupt(double sigma);

  inline double min() {
    return *std::min_element(data.begin(), data.end());
  }

  inline double max() {
    return *std::max_element(data.begin(), data.end());
  }

  inline void save(graphlab::oarchive &oarc) const {
    oarc << _rows;
    oarc << _cols;
    oarc << data;
  }

  inline void load(graphlab::iarchive &iarc) {
    iarc >> _rows;
    iarc >> _cols;
    iarc >> data;
  }

};

/** Generate a normally distributed random number N(mu, sigma^2) */
// std::pair<double, double> randn(double mu = 0, double sigma = 1 );

// IMPLEMENTATION =============================================================>

inline void image::resize(size_t rows, size_t cols) {
  _rows = rows;
  _cols = cols;
  data.resize(rows * cols, 0);
}

/** Get the vertex id of a pixel */
inline size_t image::vertid(size_t i, size_t j) const {
  assert(i < _rows);
  assert(j < _cols);
  return i * _cols + j;
}

// static size_t image::vertid(size_t rows, size_t cols, size_t i, size_t j)  {
//   assert(i < rows);
//   assert(j < cols);
//   return i * cols + j;
// }

/** Get the vertex id of a pixel */
inline std::pair<size_t, size_t> image::loc(size_t vertexid) const {
  assert(vertexid < _rows * _cols);
  return std::make_pair( vertexid / _cols, vertexid % _cols);
}

inline void image::save(const char* filename, bool autorescale, double min_, double max_) const {
  assert(_rows > 0 && _cols > 0);
  std::ofstream os(filename);
  os << "P2" << std::endl
     << _cols << " " << _rows << std::endl
     << 255 << std::endl;
  // Compute min and max pixel intensities
  double min = data[0]; double max = data[0];
  if (autorescale) {
    for(size_t i = 0; i < _rows * _cols; ++i) {
      min = std::min(min, data[i]);
      max = std::max(max, data[i]);
    }
  }
  else {
    min = min_;
    max = max_;
  }
  // Save the image (rescaled)
  for(size_t r = 0; r < _rows; ++r) {
    for(size_t c = 0; c < _cols; c++) {
      if(min != max) {
        int color =
          static_cast<int>(255.0 * (pixel(r,c) - min)/(max-min));
        if (color < 0) color = 0;
        if (color > 255) color = 255;
        os << color;
      } else { os << min; }
      if(c != _cols-1) os << "\t";
    }
    os << std::endl;
  }
  os.flush();
  os.close();
} // end of save

inline void image::paint_sunset(size_t num_rings) {
  const double center_r = rows() / 2.0;
  const double center_c = cols() / 2.0;
  const double max_radius = std::min(rows(), cols()) / 2.0;
  // Fill out the image
  for(size_t r = 0; r < rows(); ++r) {
    for(size_t c = 0; c < cols(); ++c) {
      double distance = sqrt((r-center_r)*(r-center_r) +
                             (c-center_c)*(c-center_c));
      // If on top of image
      if(r < rows() / 2) {
        // Compute ring of sunset
        size_t ring =
          static_cast<size_t>(std::floor(std::min(1.0, distance/max_radius)
                                         * (num_rings - 1) ) );
        pixel(r,c) = ring;
      } else {
        pixel(r,c) = 0;
      }
    }
  }
} // end of paint_beatiful_sunset

/** corrupt the image with gaussian noise */
inline void image::corrupt(double sigma) {
  //  boost::mt19937 rng;
  boost::lagged_fibonacci607 rng;
  boost::normal_distribution<double> noise_model(0, sigma);
  for(size_t i = 0; i < rows() * cols();  ) {
    // Corrupt two pixels at a time.
    pixel(i++) += noise_model(rng);
  }
} // end of corrupt_image

// /** generate a normally distributed iid pair */
// std::pair<double, double> randn(double mu , double sigma ) {
//   // Generate a N(0,1) from a Unif(0,1) using Box-Muller generator:
//   double u1 = static_cast<double>(rand()) / RAND_MAX;
//   double u2 = static_cast<double>(rand()) / RAND_MAX;
//   double coeff = std::sqrt(-2.0 * std::log(u1));
//   double n1 = coeff * std::cos(2.0 * M_PI * u2) ;
//   double n2 = coeff * std::sin(2.0 * M_PI * u2) ;
//   // Adjust for mean and variance
//   n1 = sigma * n1 + mu;
//   n2 = sigma * n2 + mu;
//   return std::make_pair(n1, n2);
// } // end of randn

#include <graphlab/macros_undef.hpp>

#endif


text:
package org.broadinstitute.hellbender.tools.picard.sam;

import htsjdk.samtools.SAMException;
import htsjdk.samtools.fastq.FastqReader;
import htsjdk.samtools.util.FastqQualityFormat;
import org.broadinstitute.hellbender.CommandLineProgramTest;
import org.broadinstitute.hellbender.exceptions.GATKException;
import org.broadinstitute.hellbender.exceptions.UserException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.io.File;
import java.io.IOException;
import java.util.*;

/**
 * Tests for FastqToBam
 */
public class FastqToSamIntegrationTest extends CommandLineProgramTest {
    private static final File TEST_DATA_DIR = new File(getTestDataDir(), "picard/sam/conversion/fastq2bam");

    public String getCommandLineProgramName() {
        return FastqToSam.class.getSimpleName();
    }

    // fastq files with legal values for each fastq version
    @DataProvider(name = "okVersionFiles")
    public Object[][] okVersionFiles() {
        return new Object[][] {
                {"fastq-sanger/5k-v1-Rhodobacter_LW1.sam.fastq",      FastqQualityFormat.Standard },
                {"fastq-sanger/5k-30BB2AAXX.3.aligned.sam.fastq",     FastqQualityFormat.Standard },
                {"fastq-sanger/sanger_full_range_as_sanger-63.fastq", FastqQualityFormat.Standard }, // all sanger chars

                {"fastq-solexa/s_1_sequence.txt", FastqQualityFormat.Solexa},
                {"fastq-solexa/solexa_full_range_as_solexa.fastq", FastqQualityFormat.Solexa}, // all solexa chars

                {"fastq-illumina/s_1_2_sequence.txt", FastqQualityFormat.Illumina},
                {"fastq-illumina/s_1_2_sequence.txt", FastqQualityFormat.Illumina},
                {"fastq-illumina/s_1_sequence.txt", FastqQualityFormat.Illumina},
        };
    }

    // Illegal values fastq files for each fastq version
    @DataProvider(name = "badVersionFiles")
    public Object[][] badVersionFiles() {
        return new Object[][] {
                {"fastq-sanger/sanger_full_range_as_sanger-63.fastq", FastqQualityFormat.Illumina},
                {"fastq-solexa/s_1_sequence.txt", FastqQualityFormat.Illumina},
        };
    }

    // Illegal fastq format, i.e. doesn't contain correct four lines per record
    @DataProvider(name = "badFormatFiles")
    public Object[][] badFormatFiles() {
        return new Object[][] {
                {"bad-format/bad-qual-header.txt"},
                {"bad-format/bad-seq-header.txt"},
                {"bad-format/extra-line.txt"},
                {"bad-format/too-many-quals.txt"},
                {"bad-format/1lines.txt"},
                {"bad-format/2lines.txt"},
                {"bad-format/3lines.txt"},
        };
    }

    // permissive fastq format, i.e. contain blank lines at various places
    @DataProvider(name = "permissiveFormatFiles")
    public Object[][] permissiveFormatFiles() {
        return new Object[][] {
                {"permissive-format/pair1.txt",          "permissive-format/pair2.txt", FastqQualityFormat.Standard },
                {"permissive-format/s_1_1_sequence.txt",    "permissive-format/s_1_2_sequence.txt", FastqQualityFormat.Illumina},
                {"permissive-format/pair1.txt", null, FastqQualityFormat.Standard},
                {"permissive-format/pair2.txt", null, FastqQualityFormat.Standard},
                {"permissive-format/s_1_1_sequence.txt", null, FastqQualityFormat.Illumina},
                {"permissive-format/s_1_2_sequence.txt", null, FastqQualityFormat.Illumina},
                {"permissive-format/s_1_sequence.txt", null, FastqQualityFormat.Illumina},

        };
    }

    // OK paired fastq files
    @DataProvider(name = "okPairedFiles")
    public Object[][] okPairedFiles() {
        return new Object[][] {
                {"ok-paired/pair1.txt",          "ok-paired/pair2.txt", FastqQualityFormat.Standard },
                {"fastq-illumina/s_1_1_sequence.txt", "fastq-illumina/s_1_2_sequence.txt", FastqQualityFormat.Illumina}
        };
    }

    // Inconsistent paired fastq files
    @DataProvider(name = "badPairedFiles")
    public Object[][] badPairedFiles() {
        return new Object[][] {
                {"ok-paired/pair1.txt",          "bad-paired/pair2-one-more-record.txt" },
                {"bad-paired/pair1-one-more-record.txt", "ok-paired/pair2.txt" },
                {"ok-paired/pair1.txt",          "bad-paired/pair2-badnum.txt" },
                {"bad-paired/pair1-badnum.txt",   "ok-paired/pair2.txt" },
                {"bad-paired/pair1-nonum.txt",    "ok-paired/pair2.txt" },
                {"bad-paired/pair1-onetoken.txt", "ok-paired/pair2.txt" },
        };
    }

    @Test(dataProvider = "permissiveFormatFiles")
    public void testPermissiveOk(final String filename1, final String filename2, final FastqQualityFormat version) throws IOException {
        convertFile(filename1,filename2,version,true);
    }

    @Test(dataProvider = "permissiveFormatFiles",expectedExceptions = SAMException.class)
    public void testPermissiveFail(final String filename1, final String filename2, final FastqQualityFormat version) throws IOException {
        convertFile(filename1,filename2,version,false);
    }

    @Test(dataProvider = "okVersionFiles")
    public void testFastqVersionOk(final String fastqVersionFilename, final FastqQualityFormat version) throws IOException {
        convertFile(fastqVersionFilename, version);
    }

    @Test(dataProvider = "badVersionFiles", expectedExceptions = SAMException.class)
    public void testFastqVersionBad(final String fastqVersionFilename, final FastqQualityFormat version) throws IOException {
        convertFile(fastqVersionFilename, version);
    }

    @Test(dataProvider = "badFormatFiles", expectedExceptions = SAMException.class)
    public void testBadFile(final String filename) throws IOException {
        convertFile(filename, null, FastqQualityFormat.Standard);
    }

    @Test(dataProvider = "badPairedFiles", expectedExceptions = UserException.class)
    public void testPairedBad(final String filename1, final String filename2) throws IOException {
        convertFile(filename1, filename2, FastqQualityFormat.Standard);
    }

    @Test(dataProvider = "okPairedFiles")
    public void testPairedOk(final String filename1, final String filename2, final FastqQualityFormat version) throws IOException {
        convertFile(filename1, filename2, version);
    }

    private File convertFile(final String filename, final FastqQualityFormat version) throws IOException {
        return convertFile(filename, null, version);
    }

    private File convertFile(final String fastqFilename1, final String fastqFilename2, final FastqQualityFormat version) throws IOException{
        return convertFile(fastqFilename1, fastqFilename2, version,false);
    }

    private File convertFile(final String fastqFilename1, final String fastqFilename2, final FastqQualityFormat version,final boolean permissiveFormat) throws IOException {
        final File fastq1 = new File(TEST_DATA_DIR, fastqFilename1);
        final File fastq2 = (fastqFilename2 != null) ? new File(TEST_DATA_DIR, fastqFilename2) : null;
        final File samFile = newTempSamFile(fastq1.getName());

        final List<String> args = new ArrayList<>();

        args.add("--FASTQ");
        args.add(fastq1.getAbsolutePath());
        if (fastqFilename2 != null) {
            args.add("--FASTQ2");
            args.add(fastq2.getAbsolutePath());
        }
        args.add("--OUTPUT");
        args.add(samFile.getAbsolutePath());
        args.add("--QUALITY_FORMAT");
        args.add(version.toString());
        args.add("--READ_GROUP_NAME");
        args.add("rg");
        args.add("--SAMPLE_NAME");
        args.add("s1");
        if (permissiveFormat) {
            args.add("--ALLOW_AND_IGNORE_EMPTY_LINES");
            args.add("true");
        }

        runCommandLine(args);
        return samFile;
    }

    private static File newTempSamFile(final String filename) throws IOException {
        final File file = File.createTempFile(filename,".sam");
        file.deleteOnExit();
        return file;
    }

    private static File newTempFile(final String filename) throws IOException {
        final File file = File.createTempFile(filename,".tmp");
        file.deleteOnExit();
        return file;
    }

    //  Test for legal syntax for pair read names for FastqToSam.getBaseName()
    //  We create a dummy file to test the getBaseName() method since it expects
    //  an existing file.

    // TODO - Should switch over to using invocation via new PicardCommandLine() - BUT the tests using this are accessing class members directly.
    private static final FastqToSam fastqToSam = new FastqToSam();
    private static FastqReader freader1;
    private static FastqReader freader2;

    @BeforeClass
    public static void beforeClass() throws IOException {
        final File dummyFile = newTempFile("dummy");
        freader1 = new FastqReader(dummyFile);
        freader2 = new FastqReader(dummyFile);
    }

    @DataProvider(name = "okPairNames")
    public Object[][] okPairNames() {
        return new Object[][] {
                {"aa/1", "aa/2" },
                {"aa", "aa" },
                {"aa/bb", "aa/bb" },
                {"aa/bb/", "aa/bb/" },
                {"aa/bb/1", "aa/bb/2" },
                {"aa/bb/cc/dd/ee/ff/1", "aa/bb/cc/dd/ee/ff/2" },
                {"////1", "////2" },
                {"/", "/" },
                {"////", "////" },
                {"/aa", "/aa" },
                {"aa/", "aa/" },
                {"ab/c", "ab/c"}
        };
    }

    @DataProvider(name = "badPairNames")
    public Object[][] badPairNames() {
        return new Object[][] {
                {"", "" },
                {"aa/1", "bb/2" },
                {"aa"  , "bb" },
                {"aa/1", "aa" },
                {"aa",   "aa/2" },
                {"aa/1", "aa/1" },
                {"aa/2", "aa/2" },
        };
    }

    @Test(dataProvider = "okPairNames")
    public void readPairNameOk(final String name1, final String name2) throws IOException {
        fastqToSam.getBaseName(name1, name2, freader1, freader2);
    }

    @Test(dataProvider = "badPairNames", expectedExceptions = {UserException.class, GATKException.class})
    public void readPairNameBad(final String name1, final String name2) throws IOException {
        fastqToSam.getBaseName(name1, name2, freader1, freader2);
    }
}


text:
Simple Que Services 101
======

13 Minute Lecture introducing Simple Queue Service (SQS).

## Video Link

[![acloud.guru lecture](https://i.imgur.com/HUEkJcw.png)](https://acloud.guru/course/aws-certified-solutions-architect-associate/learn/application-services/sqs/watch)

*Note - You will need an [acloud.guru](acloud.guru) account.*

## What is SQS?

Amazon SQS is a web service that gives you access to a message queue that can be used to store messages while
waiting for a computer to process them.  It is a distributed queue system that enables web service applications
to quickly and reliably queue messages that one component in the application generates to be consumed by another
component. A queue is a temporary repository for messages that are awaiting processing.

### MEME Website Example

Using SQS, you can decouple the components of an application so they run independently, with SQS easing message
management between components. Any component of a distributed application can store messages in a fail-safe
queue. Messages can contain up to 256 KB of text in any format. Any component can later retrieve the
messages programmatically using the SQS API.

The queue acts as a buffer between the component producing and saving data, and the component receiving the data
for processing. This means the queue resolves issues that arise if the producer is producing work faster than
the consumer can process it, or if the producer or consumer are only intermittently connected to the network.

There are two types of Queues:

* Standard Queues (default)
* Fifo Queues

### Standard Queues

Amazon SQS offers standard as the the default queue type. A standard queue let you have a nearly-unlimited number
of transactions per second. They guarantee that a message is delivered at least once. However, occasionally (because
of highly-distributed architecture that allows high throughput), more than one copy of a message might be delivered
out of order. Standard queues provide best-effort ordering which ensures that messages are generally delivered
in the same order as they are sent.

### FIFO Queues

First In First Out (FIFO) Queues compliment the standard queue. The most important feature of this queue type is
FIFO delivery and exactly once processing: The order in which messages are sent and received is strictly preserved
and a message is delivered once and remains available until a consumer processes and deletes it; duplicates are
not introduced into the queue. FIFO queues also support message groups that allow multiple ordered message groups
within a single queue. FIFO queues are limited to 300 transactions per second (TPS), but have all the capabilities
of a standard queue.

## Exam Tips

What did we learn?

* SQS is pull based, not push based
* Messages are 256 KB is size
* Messages can be kept in the queue from 1 minute to 14 days. The default is 4 days
* Visibility Time Out is the amount of time that the message is invisible in the SQS queue after a reader picks up
  that message. Provided the job is processed before the visibility time out expires, the message is then deleted
  from the queue. If the job is not processed within that time, the message will become visible again and another
  reader will process it. This could result in the same message being delivered twice
* Visibility timeout maximum is 12 hours
* SQS guarantees that your messages will be processed at least once
* Amazon SQS long polling is a way to retrieve messages from your Amazon SQS queue. While the regular short polling
  returns immediately, even if the message queue being polled is empty, long polling doesn't return a response until
  a message arrives in the message queue, or the long polling times out

### Review Questions

1.  What type (think "direction") of messaging service is SQS? What is the alternative?
2.  What is the `visibility timeout`?
3.  What is the size and format constraints of SQS messages?
4.  How does SQS introduce `elasticity` to applications?
5.  What are the two types of Queues?
6.  What is per second limit for messages sent via a standard queue?
7.  In what order are messages sent in a standard queue? Is this guaranteed-- why or why not?
8.  If order is not guaranteed, then how is it described?
9.  What is guaranteed about a standard queue?
10. What is the most important feature of a FIFO Queue? (2)
11. Can duplicate messages be added to a FIFO Queue? To a Standard Queue?
12. What is TPS?
13. What is the TPS of a standard Queue? FIFO Queue?
14. What other feature do FIFO Queue provide?
15. Despite their TPS, do FIFO Queue offer all the capabilities of a Standard Queue?
16. Are FIFO Queues covered on the exam?
17. Is SQS push or pull?
18. What is the max, min, average time that a message can remain in SQS?
19. If a message processing job does not complete within the configured timeout what happens?
20. What is the maximum visibility timeout?
21. What does SQS guarantee?
22. What is SQS long polling?

### Answers

1.  Pull Service; Simple Notification Service (SNS)
2.  Period of time before a processed message is returned to the queue (made visible) and can be reprocessed
3.  256 KB; text
4.  Auto-scaling integration based on queue state
5.  Standard (default) and Fifo
6.  Nearly unlimited
7.  Order in which they are received; no. Highly-distributed architecture, which allows for high throughput, can result
    in more than one copy of a message might be delivered out of order
8.  "best-effort ordering which ensures that messages are generally delivered in the same order as they are sent."
9.  Every message is delivered at least once
10. FIFO; exactly once processing
11. No; Yes
12. Transactions Per Second
13. Nearly Unlimited; 300
14. Message groups that allow multiple ordered message groups within a single queue
15. Yes
16. Probably not -- too new
17. Pull
18. 14 days; 1 minute; 4 days
19. The message remains in the queue and can be delivered to another reader
20. 12 hours
21. Your message is processed at least once
22. A way to retrieve messages from your Amazon SQS queue that doesn't return a response until a message arrives in
    the message queue, or the long polling times out

##

**[Previous Lab/Lecture](../vpc/vpc-exam-tips.md) | [AWS (root)](../readme.adoc) | [Next Lab/Lecture](apps-swf-101.md)**


text:
require 'test/unit'
require 'net/github-upload'

class GitHubUploadTest < Test::Unit::TestCase
	def setup
		login = `git config github.user`.chomp
		token = `git config github.token`.chomp
		@gh = Net::GitHub::Upload.new(
			:login => login,
			:token => token
		)
		@repos = 'ruby-net-github-upload'
    @gh.delete_all @repos
  end

	def test_file_upload
		direct_link = nil
		assert_nothing_raised {
			direct_link = @gh.upload(
				:repos => @repos,
				:file  => 'test/test',
				:content_type => 'text/plain',
				:description => "test file"
			)
		}
		assert_instance_of String, direct_link

		# replace method : thx id:rngtng
		assert_nothing_raised {
			direct_link = @gh.replace(
				:repos => @repos,
				:file  => 'test/test',
				:content_type => 'text/plain',
				:description => "test file"
			)
		}
		assert_instance_of String, direct_link
	end

	def test_content_upload
		direct_link = nil
		time = Time.now.to_i
		assert_nothing_raised {
			direct_link = @gh.upload(
				:repos => @repos,
				:data  => 'test',
				:name  => "test_#{time}.txt",
				:content_type => 'text/plain',
				:description => "test file2"
			)
		}
		assert_instance_of String, direct_link

		# replace method : thx id:rngtng
		assert_nothing_raised {
			direct_link = @gh.replace(
				:repos => @repos,
				:data  => 'test',
				:name  => "test_#{time}.txt",
				:content_type => 'text/plain',
				:description => "test file2"
			)
		}
		assert_instance_of String, direct_link
	end
end


text:
<?php

/* _sub/_editable_record_list.twig */
class __TwigTemplate_c464a2af92d2c1bf6127d0e313150788038c57f181c2388c8dcb321ac4b4f4c9 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
    }

    // line 1
    public function geteditable_record_list($__contenttype__ = null, $__multiplecontent__ = null, $__permissions__ = null, $__extra_classes__ = null, ...$__varargs__)
    {
        $context = $this->env->mergeGlobals(array(
            "contenttype" => $__contenttype__,
            "multiplecontent" => $__multiplecontent__,
            "permissions" => $__permissions__,
            "extra_classes" => $__extra_classes__,
            "varargs" => $__varargs__,
        ));

        $blocks = array();

        ob_start();
        try {
            // line 2
            $context["lastgroup"] = "----";
            // line 3
            $context["any_deletable"] = false;
            // line 4
            $context["any_editable"] = false;
            // line 5
            $context["includes"] = array(0 => (("custom/listing/" . $this->getAttribute(            // line 6
(isset($context["contenttype"]) ? $context["contenttype"] : null), "slug", array())) . ".twig"), 1 => "_sub/_listing.twig");
            // line 9
            echo "
";
            // line 10
            echo twig_escape_filter($this->env, $this->env->getExtension('Bolt')->addData("recordlisting", array("delete_one" => $this->env->getExtension('Bolt')->trans("Are you sure you wish to delete this record? There is no undo."), "delete_mult" => $this->env->getExtension('Bolt')->trans("Are you sure you wish to delete these records? There is no undo."))), "html", null, true);
            // line 13
            echo "

env, (isset($context["extra_classes"]) ? $context["extra_classes"] : null), "html", null, true);
            echo " dashboardlisting\" data-contenttype=\"";
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["contenttype"]) ? $context["contenttype"] : null), "slug", array()), "html", null, true);
            echo "\" data-bolt_csrf_token=\"";
            echo twig_escape_filter($this->env, $this->env->getExtension('Bolt')->token(), "html", null, true);
            echo "\">
    ";
            // line 16
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable((isset($context["multiplecontent"]) ? $context["multiplecontent"] : null));
            $context['_iterated'] = false;
            $context['loop'] = array(
              'parent' => $context['_parent'],
              'index0' => 0,
              'index'  => 1,
              'first'  => true,
            );
            if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable)) {
                $length = count($context['_seq']);
                $context['loop']['revindex0'] = $length - 1;
                $context['loop']['revindex'] = $length;
                $context['loop']['length'] = $length;
                $context['loop']['last'] = 1 === $length;
            }
            foreach ($context['_seq'] as $context["_key"] => $context["content"]) {
                // line 17
                echo "        ";
                $context["editable"] = $this->getAttribute((isset($context["permissions"]) ? $context["permissions"] : null), "edit", array());
                // line 18
                echo "        ";
                if ((isset($context["editable"]) ? $context["editable"] : null)) {
                    // line 19
                    echo "            ";
                    $context["any_editable"] = true;
                    // line 20
                    echo "        ";
                }
                // line 21
                echo "        ";
                $context["deletable"] = $this->getAttribute((isset($context["permissions"]) ? $context["permissions"] : null), "delete", array());
                // line 22
                echo "        ";
                if ((isset($context["deletable"]) ? $context["deletable"] : null)) {
                    // line 23
                    echo "            ";
                    $context["any_deletable"] = true;
                    // line 24
                    echo "        ";
                }
                // line 25
                echo "        ";
                $this->loadTemplate((isset($context["includes"]) ? $context["includes"] : null), "_sub/_editable_record_list.twig", 25)->display(array_merge($context, array("excerptlength" => 380, "thumbsize" => 80, "compact" => false)));
                // line 26
                echo "        ";
                if (($this->getAttribute($this->getAttribute($context["content"], "group", array(), "any", false, true), "name", array(), "any", true, true) && ($this->getAttribute($context["loop"], "first", array()) || ($this->getAttribute($this->getAttribute($context["content"], "group", array()), "name", array()) != (isset($context["lastgroup"]) ? $context["lastgroup"] : null))))) {
                    // line 27
                    echo "            ";
                    $context["lastgroup"] = $this->getAttribute($this->getAttribute($context["content"], "group", array()), "name", array());
                    // line 28
                    echo "        ";
                }
                // line 29
                echo "    ";
                $context['_iterated'] = true;
                ++$context['loop']['index0'];
                ++$context['loop']['index'];
                $context['loop']['first'] = false;
                if (isset($context['loop']['length'])) {
                    --$context['loop']['revindex0'];
                    --$context['loop']['revindex'];
                    $context['loop']['last'] = 0 === $context['loop']['revindex0'];
                }
            }
            if (!$context['_iterated']) {
                // line 30
                echo "        ";
                echo $this->env->getExtension('Bolt')->trans("contenttypes.generic.none-available", array("%contenttypes%" => $this->getAttribute((isset($context["contenttype"]) ? $context["contenttype"] : null), "slug", array())));
                echo "
    ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['content'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 32
            echo "

";
            // line 34
            if ((isset($context["any_deletable"]) ? $context["any_deletable"] : null)) {
                // line 35
                echo "

            ";
                // line 38
                echo $this->env->getExtension('Bolt')->trans("Delete selected");
                echo "

";
            }
            // line 42
            echo "
";
            // line 59
            echo "
";
            // line 60
            $context["__internal_2c941b507682452389df6107df53ca7cb9279feeca6c6a4fe1ca04064e236663"] = $this->loadTemplate("_macro/_pager.twig", "_sub/_editable_record_list.twig", 60);
            // line 61
            echo $context["__internal_2c941b507682452389df6107df53ca7cb9279feeca6c6a4fe1ca04064e236663"]->getpager($this->getAttribute((isset($context["contenttype"]) ? $context["contenttype"] : null), "slug", array()));
            echo "

";
        } catch (Exception $e) {
            ob_end_clean();

            throw $e;
        }

        return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
    }

    public function getTemplateName()
    {
        return "_sub/_editable_record_list.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  164 => 61,  162 => 60,  159 => 59,  156 => 42,  149 => 38,  144 => 35,  142 => 34,  138 => 32,  129 => 30,  116 => 29,  113 => 28,  110 => 27,  107 => 26,  104 => 25,  101 => 24,  98 => 23,  95 => 22,  92 => 21,  89 => 20,  86 => 19,  83 => 18,  80 => 17,  62 => 16,  54 => 15,  50 => 13,  48 => 10,  45 => 9,  43 => 6,  42 => 5,  40 => 4,  38 => 3,  36 => 2,  21 => 1,);
    }
}
/* {% macro editable_record_list(contenttype, multiplecontent, permissions, extra_classes) %}*/
/* {% set lastgroup = "----" %}*/
/* {% set any_deletable = false %}*/
/* {% set any_editable = false %}*/
/* {% set includes = [*/
/*     'custom/listing/' ~ contenttype.slug ~ '.twig',*/
/*     '_sub/_listing.twig']*/
/* %}*/
/* */
/* {{ data('recordlisting', {*/
/*     'delete_one':   __('Are you sure you wish to delete this record? There is no undo.'),*/
/*     'delete_mult':  __('Are you sure you wish to delete these records? There is no undo.')*/
/* })}}*/
/* */
/*
*/
/*     {% for content in multiplecontent %}*/
/*         {% set editable = permissions.edit %}*/
/*         {% if editable %}*/
/*             {% set any_editable = true %}*/
/*         {% endif %}*/
/*         {% set deletable = permissions.delete %}*/
/*         {% if deletable %}*/
/*             {% set any_deletable = true %}*/
/*         {% endif %}*/
/*         {% include includes with {'excerptlength': 380, 'thumbsize': 80, 'compact': false} %}*/
/*         {% if content.group.name is defined and (loop.first or content.group.name != lastgroup) %}*/
/*             {% set lastgroup = content.group.name %}*/
/*         {% endif %}*/
/*     {% else %}*/
/*         {{ __('contenttypes.generic.none-available', {'%contenttypes%': contenttype.slug}) }}*/
/*     {% endfor %}*/
/*
*/
/* */
/* {% if any_deletable %}*/
/*
*/
/*         */
/*             */
/*             {{ __('Delete selected') }}*/
/*         */
/*
*/
/* {% endif %}*/
/* */
/* {# -- commented out for now.. Finish when needed.*/
/* {% if any_editable %}*/
/*
*/
/*         */
/*             */
/*             {{ __('Publish selected') }}*/
/*         */
/*
*/
/*
*/
/*         */
/*             */
/*             {{ __('Depublish selected') }}*/
/*         */
/*
*/
/* {% endif %}*/
/* #}*/
/* */
/* {% from '_macro/_pager.twig' import pager %}*/
/* {{ pager(contenttype.slug) }}*/
/* */
/* {% endmacro %}*/
/* */


text:
using System;
using System.Collections.Generic;
using System.Linq;

using FluentMigrator.Exceptions;
using FluentMigrator.Runner;
using FluentMigrator.Runner.Conventions;
using FluentMigrator.Runner.Exceptions;
using FluentMigrator.Runner.Initialization;
using FluentMigrator.Runner.Initialization.NetFramework;
using FluentMigrator.Runner.Logging;
using FluentMigrator.Runner.Processors;

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

using Mono.Options;

using static FluentMigrator.Runner.ConsoleUtilities;

namespace FluentMigrator.Console
{
    public class MigratorConsole
    {
        [Obsolete("Use dependency injection to access 'application state'.")]
        public string ApplicationContext;
        public string Connection;
        public string ConnectionStringConfigPath;
        public string Namespace;
        public bool NestedNamespaces;
        public bool Output;
        public string OutputFilename;
        public bool OutputSemicolonDelimiter = false;
        public bool PreviewOnly;
        public string ProcessorType;
        public string Profile;
        public bool ShowHelp;
        public int Steps;
        public List<string> Tags = new List<string>();
        public bool IncludeUntaggedMaintenances;
        public bool IncludeUntaggedMigrations = true;
        public string TargetAssembly;
        public string Task;
        public int? Timeout;
        public bool Verbose;
        public bool StopOnError;
        public long Version;
        public long StartVersion;
        public bool NoConnection;
        public string WorkingDirectory;
        public bool TransactionPerSession;
        public bool AllowBreakingChange;
        public string ProviderSwitches;
        public bool StripComments = true;
        public string DefaultSchemaName { get; set; }

        public int Run(params string[] args)
        {
            var dbChoicesList = new List<string>();
            string dbChoices;

            var services = CreateCoreServices()
                .AddScoped<IConnectionStringReader>(_ => new PassThroughConnectionStringReader("No connection"));
            using (var sp = services.BuildServiceProvider(validateScopes: false))
            {
                var processors = sp.GetRequiredService<IEnumerable<IMigrationProcessor>>().ToList();
                dbChoicesList.AddRange(processors.Select(p => p.DatabaseType));
            }

            dbChoices = string.Join(
                ", ",
                dbChoicesList
                    .Distinct(StringComparer.OrdinalIgnoreCase)
                    .OrderBy(x => x, StringComparer.OrdinalIgnoreCase));

            System.Console.Out.WriteHeader();

            try
            {
                var optionSet = new OptionSet
                {
                    {
                        "assembly=|a=|target=",
                        "REQUIRED. The assembly containing the migrations you want to execute.",
                        v => { TargetAssembly = v; }
                    },
                    {
                        "provider=|dbType=|db=",
                        $"REQUIRED. The kind of database you are migrating against. Available choices are: {dbChoices}.",
                        v => { ProcessorType = v; }
                    },
                    {
                        "connectionString=|connection=|conn=|c=",
                        "The name of the connection string (falls back to machine name) or the connection string itself to the server and database you want to execute your migrations against.",
                        v => { Connection = v; }
                    },
                    {
                        "connectionStringConfigPath=|configPath=",
                        string.Format(
                            "The path of the machine.config where the connection string named by connectionString" +
                            " is found. If not specified, it defaults to the machine.config used by the currently running CLR version"),
                        v => { ConnectionStringConfigPath = v; }
                    },
                    {
                        "namespace=|ns=",
                        "The namespace contains the migrations you want to run. Default is all migrations found within the Target Assembly will be run.",
                        v => { Namespace = v; }
                    },
                    {
                        "nested",
                        "Whether migrations in nested namespaces should be included. Used in conjunction with the namespace option.",
                        v => { NestedNamespaces = v != null; }
                    },
                    {
                        "output|out|o",
                        "Output generated SQL to a file. Default is no output. Use outputFilename to control the filename, otherwise [assemblyname].sql is the default.",
                        v => { Output = v != null; }
                    },
                    {
                        "outputSemicolonDelimiter|outsemdel|osd",
                        "Whether each command should be delimited with a semicolon.",
                        v => { OutputSemicolonDelimiter = v != null; }
                    },
                    {
                        "outputFilename=|outfile=|of=",
                        "The name of the file to output the generated SQL to. The output option must be included for output to be saved to the file.",
                        v => { OutputFilename = v; }
                    },
                    {
                        "preview|p",
                        "Only output the SQL generated by the migration - do not execute it. Default is false.",
                        v => { PreviewOnly = v != null; }
                    },
                    {
                        "steps=",
                        "The number of versions to rollback if the task is 'rollback'. Default is 1.",
                        v => { Steps = int.Parse(v); }
                    },
                    {
                        "task=|t=",
                        "The task you want FluentMigrator to perform. Available choices are: migrate:up, migrate (same as migrate:up), migrate:down, rollback, rollback:toversion, rollback:all, validateversionorder, listmigrations. Default is 'migrate'.",
                        v => { Task = v; }
                    },
                    {
                        "version=",
                        "The specific version to migrate. Default is 0, which will run all migrations.",
                        v => { Version = long.Parse(v); }
                    },
                    {
                        "startVersion=",
                        "The specific version to start migrating from. Only used when NoConnection is true. Default is 0",
                        v => { StartVersion = long.Parse(v); }
                    },
                    {
                        "noConnection",
                        "Indicates that migrations will be generated without consulting a target database. Should only be used when generating an output file.",
                        v => { NoConnection = v != null; }
                    },
                    {
                        "verbose=",
                        "Show the SQL statements generated and execution time in the console. Default is false.",
                        v => { Verbose = v != null; }
                    },
                    {
                        "stopOnError=",
                        "Pauses migration execution until the user input if any error occured. Default is false.",
                        v => { StopOnError = v != null; }
                    },
                    {
                        "workingdirectory=|wd=",
                        "The directory to load SQL scripts specified by migrations from.",
                        v => { WorkingDirectory = v; }
                    },
                    {
                        "profile=",
                        "The profile to run after executing migrations.",
                        v => { Profile = v; }
                    },
                    {
                        "context=",
                        "Set ApplicationContext to the given string.",
                        v => { ApplicationContext = v; }
                    },
                    {
                        "timeout=",
                        "Overrides the default SqlCommand timeout of 30 seconds.",
                        v => { Timeout = int.Parse(v); }
                    },
                    {
                        "tag=",
                        "Filters the migrations to be run by tag.",
                        v => { Tags.Add(v); }
                    },
                    {
                        "include-untagged:",
                        "Include untagged migrations and/or maintenance objects.",
                        v =>
                        {
                            if (string.IsNullOrEmpty(v))
                            {
                                IncludeUntaggedMigrations = IncludeUntaggedMaintenances = true;
                            }
                            else
                            {
                                var items = v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                    .Select(x => x.ToLowerInvariant().Trim())
                                    .Where(x => !string.IsNullOrEmpty(x))
                                    .Select(
                                        x =>
                                        {
                                            var hasOption = x.EndsWith("+") || x.EndsWith("-");
                                            var enable = !x.EndsWith("-");
                                            var name = hasOption ? x.Substring(0, x.Length - 1) : x;
                                            return new
                                            {
                                                FullName = x,
                                                ShortName = name.Substring(Math.Min(2, name.Length)),
                                                Enable = enable,
                                            };
                                        });
                                foreach (var item in items)
                                {
                                    switch (item.ShortName)
                                    {
                                        case "ma":
                                            IncludeUntaggedMaintenances = item.Enable;
                                            break;
                                        case "mi":
                                            IncludeUntaggedMigrations = item.Enable;
                                            break;
                                        default:
                                            throw new ArgumentOutOfRangeException(
                                                $"The argument {item.FullName} is not supported. "
                                              + "Valid values are: ma, maintenance, mi, migrations with an optional '+' or '-' at the end to enable or disable the option. "
                                              + "Multiple values may be given when separated by a comma.");
                                    }
                                }
                            }
                        }
                    },
                    {
                        "providerswitches=",
                        "Provider specific switches",
                        v => { ProviderSwitches = v; }
                    },
                    {
                        "strip|strip-comments",
                        "Strip comments from the SQL scripts. Default is true. To disable, use --strip- or --strip-comments-",
                        v => { StripComments = v != null; }
                    },
                    {
                        "help|h|?",
                        "Displays this help menu.",
                        v => { ShowHelp = true; }
                    },
                    {
                        "transaction-per-session|tps",
                        "Overrides the transaction behavior of migrations, so that all migrations to be executed will run in one transaction.",
                        v => { TransactionPerSession = v != null; }
                    },
                    {
                        "allow-breaking-changes|abc",
                        "Allows execution of migrations marked as breaking changes.",
                        v => { AllowBreakingChange = v != null; }
                    },
                    {
                        "default-schema-name=",
                        "Set default schema name for the VersionInfo table and the migrations.",
                        v => { DefaultSchemaName = v; }
                    },
                };

                try
                {
                    optionSet.Parse(args);
                }
                catch (OptionException e)
                {
                    AsError(() => System.Console.Error.WriteException(e));
                    System.Console.WriteLine(@"Try 'migrate --help' for more information.");
                    return 2;
                }

                if (string.IsNullOrEmpty(Task))
                {
                    Task = "migrate";
                }

                if (!ValidateArguments(optionSet))
                {
                    return 1;
                }

                if (ShowHelp)
                {
                    DisplayHelp(optionSet);
                    return 0;
                }

                return ExecuteMigrations();
            }
            catch (MissingMigrationsException ex)
            {
                AsError(() => System.Console.Error.WriteException(ex));
                return 6;
            }
            catch (RunnerException ex)
            {
                AsError(() => System.Console.Error.WriteException(ex));
                return 5;
            }
            catch (FluentMigratorException ex)
            {
                AsError(() => System.Console.Error.WriteException(ex));
                return 4;
            }
            catch (Exception ex)
            {
                AsError(() => System.Console.Error.WriteException(ex));
                return 3;
            }
        }

        private bool ValidateArguments(OptionSet optionSet)
        {
            if (string.IsNullOrEmpty(TargetAssembly))
            {
                DisplayHelp(optionSet, "Please enter the path of the assembly containing migrations you want to execute.");
                return false;
            }
            if (string.IsNullOrEmpty(ProcessorType))
            {
                DisplayHelp(optionSet, "Please enter the kind of database you are migrating against.");
                return false;
            }
            return true;
        }

        private void DisplayHelp(OptionSet optionSet, string validationErrorMessage)
        {
            System.Console.ForegroundColor = ConsoleColor.Yellow;
            System.Console.WriteLine(validationErrorMessage);
            System.Console.ResetColor();
            DisplayHelp(optionSet);
        }

        private void DisplayHelp(OptionSet p)
        {
            System.Console.WriteLine(@"Usage:");
            System.Console.WriteLine(@"  migrate [OPTIONS]");
            System.Console.WriteLine(@"Example:");
            System.Console.WriteLine(@"  migrate -a bin\debug\MyMigrations.dll -db SqlServer2008 -conn ""SEE_BELOW"" -profile ""Debug""");
            System.Console.WriteLine(@"   ");
            System.Console.WriteLine(@"Boolean options/flags (those without '=' or ':' in the option format string)");
            System.Console.WriteLine(@"are explicitly enabled if they are followed with '+', and explicitly");
            System.Console.WriteLine(@"disabled if they are followed with '-'.");
            System.Console.Out.WriteHorizontalRuler();
            System.Console.WriteLine(@"Example Connection Strings:");
            System.Console.WriteLine(@"  MySql: Data Source=172.0.0.1;Database=Foo;User Id=USERNAME;Password=BLAH");
            System.Console.WriteLine(@"  Oracle: Server=172.0.0.1;Database=Foo;Uid=USERNAME;Pwd=BLAH");
            System.Console.WriteLine(@"  SqlLite: Data Source=:memory:");
            System.Console.WriteLine(@"  SqlServer: server=127.0.0.1;database=Foo;user id=USERNAME;password=BLAH");
            System.Console.WriteLine(@"             server=.\SQLExpress;database=Foo;trusted_connection=true");
            System.Console.WriteLine(@"   ");
            System.Console.WriteLine(@"OR use a named connection string from the machine.config:");
            System.Console.WriteLine(@"  migrate -a bin\debug\MyMigrations.dll -db SqlServer2008 -conn ""namedConnection"" -profile ""Debug""");
            System.Console.Out.WriteHorizontalRuler();
            System.Console.WriteLine(@"Options:");
            p.WriteOptionDescriptions(System.Console.Out);
        }

        private bool ExecutingAgainstMsSql => ProcessorType.StartsWith("SqlServer", StringComparison.InvariantCultureIgnoreCase);

        private int ExecuteMigrations()
        {
            var conventionSet = new DefaultConventionSet(DefaultSchemaName, WorkingDirectory);

            var services = CreateCoreServices()
                .Configure<FluentMigratorLoggerOptions>(
                    opt =>
                    {
                        opt.ShowElapsedTime = Verbose;
                        opt.ShowSql = Verbose;
                    })
                .AddSingleton<IConventionSet>(conventionSet)
                .Configure<SelectingProcessorAccessorOptions>(opt => opt.ProcessorId = ProcessorType)
                .Configure<AssemblySourceOptions>(opt => opt.AssemblyNames = new[] { TargetAssembly })
#pragma warning disable 612
                .Configure<AppConfigConnectionStringAccessorOptions>(
                    opt => opt.ConnectionStringConfigPath = ConnectionStringConfigPath)
#pragma warning restore 612
                .Configure<TypeFilterOptions>(
                    opt =>
                    {
                        opt.Namespace = Namespace;
                        opt.NestedNamespaces = NestedNamespaces;
                    })
                .Configure<RunnerOptions>(
                    opt =>
                    {
                        opt.Task = Task;
                        opt.Version = Version;
                        opt.StartVersion = StartVersion;
                        opt.NoConnection = NoConnection;
                        opt.Steps = Steps;
                        opt.Profile = Profile;
                        opt.Tags = Tags.ToArray();
#pragma warning disable 612
                        opt.ApplicationContext = ApplicationContext;
#pragma warning restore 612
                        opt.TransactionPerSession = TransactionPerSession;
                        opt.AllowBreakingChange = AllowBreakingChange;
                        opt.IncludeUntaggedMaintenances = IncludeUntaggedMaintenances;
                        opt.IncludeUntaggedMigrations = IncludeUntaggedMigrations;
                    })
                .Configure<ProcessorOptions>(
                    opt =>
                    {
                        opt.ConnectionString = Connection;
                        opt.PreviewOnly = PreviewOnly;
                        opt.ProviderSwitches = ProviderSwitches;
                        opt.StripComments = StripComments;
                        opt.Timeout = Timeout == null ? null : (TimeSpan?) TimeSpan.FromSeconds(Timeout.Value);
                    });

            if (StopOnError)
            {
                services
                    .AddSingleton<ILoggerProvider, StopOnErrorLoggerProvider>();
            }
            else
            {
                services
                    .AddSingleton<ILoggerProvider, FluentMigratorConsoleLoggerProvider>();
            }

            if (Output)
            {
                services
                    .Configure<LogFileFluentMigratorLoggerOptions>(
                        opt =>
                        {
                            opt.ShowSql = true;
                            opt.OutputFileName = OutputFilename;
                            opt.OutputGoBetweenStatements = ExecutingAgainstMsSql;
                            opt.OutputSemicolonDelimiter = OutputSemicolonDelimiter;
                        })
                    .AddSingleton<ILoggerProvider, LogFileFluentMigratorLoggerProvider>();
            }

            using (var serviceProvider = services.BuildServiceProvider(validateScopes: false))
            {
                var executor = serviceProvider.GetRequiredService<TaskExecutor>();
                executor.Execute();
            }

            return 0;
        }

        private static IServiceCollection CreateCoreServices()
        {
            var services = new ServiceCollection()
                .AddFluentMigratorCore()
                .ConfigureRunner(
                    builder => builder
                        .AddDb2()
                        .AddDb2ISeries()
                        .AddDotConnectOracle()
                        .AddDotConnectOracle12C()
                        .AddFirebird()
                        .AddHana()
                        .AddMySql4()
                        .AddMySql5()
                        .AddOracle()
                        .AddOracle12C()
                        .AddOracleManaged()
                        .AddOracle12CManaged()
                        .AddPostgres()
                        .AddPostgres92()
                        .AddRedshift()
                        .AddSqlAnywhere()
                        .AddSQLite()
                        .AddSqlServer()
                        .AddSqlServer2000()
                        .AddSqlServer2005()
                        .AddSqlServer2008()
                        .AddSqlServer2012()
                        .AddSqlServer2014()
                        .AddSqlServer2016()
                        .AddSqlServerCe());
            return services;
        }
    }
}


text:
<?php
class Kwc_Composite_TwoColumns_Component extends Kwc_Abstract_Composite_Component
{
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['componentName'] = trlKwfStatic('2 Columns');
        $ret['componentIcon'] = 'application_tile_horizontal';
        $ret['generators']['child']['component']['leftColumn'] = 'Kwc_Composite_TwoColumns_Left_Component';
        $ret['generators']['child']['component']['rightColumn'] = 'Kwc_Composite_TwoColumns_Right_Component';

        $ret['extConfig'] = 'Kwc_Abstract_Composite_ExtConfigTabs';
        $ret['layoutClass'] = 'Kwc_Composite_TwoColumns_Layout';

        $ret['contentMargin'] = 20;

        return $ret;
    }

    public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer = null)
    {
        $ret = parent::getTemplateVars($renderer);
        $ret['leftWidth'] = $this->_getChildContentWidth($this->getData()->getChildComponent('-leftColumn'));
        $ret['rightWidth'] = $this->_getChildContentWidth($this->getData()->getChildComponent('-rightColumn'));
        return $ret;
    }
}


text:
#pragma once
#include <aws/appstream/AppStream_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/appstream/model/UserStackAssociationError.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace AppStream
{
namespace Model
{
  class AWS_APPSTREAM_API BatchAssociateUserStackResult
  {
  public:
    BatchAssociateUserStackResult();
    BatchAssociateUserStackResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    BatchAssociateUserStackResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
The list of UserStackAssociationError objects.

     */
    inline const Aws::Vector<UserStackAssociationError>& GetErrors() const{ return m_errors; }

    /**
     *
The list of UserStackAssociationError objects.

     */
    inline void SetErrors(const Aws::Vector<UserStackAssociationError>& value) { m_errors = value; }

    /**
     *
The list of UserStackAssociationError objects.

     */
    inline void SetErrors(Aws::Vector<UserStackAssociationError>&& value) { m_errors = std::move(value); }

    /**
     *
The list of UserStackAssociationError objects.

     */
    inline BatchAssociateUserStackResult& WithErrors(const Aws::Vector<UserStackAssociationError>& value) { SetErrors(value); return *this;}

    /**
     *
The list of UserStackAssociationError objects.

     */
    inline BatchAssociateUserStackResult& WithErrors(Aws::Vector<UserStackAssociationError>&& value) { SetErrors(std::move(value)); return *this;}

    /**
     *
The list of UserStackAssociationError objects.

     */
    inline BatchAssociateUserStackResult& AddErrors(const UserStackAssociationError& value) { m_errors.push_back(value); return *this; }

    /**
     *
The list of UserStackAssociationError objects.

     */
    inline BatchAssociateUserStackResult& AddErrors(UserStackAssociationError&& value) { m_errors.push_back(std::move(value)); return *this; }

  private:

    Aws::Vector<UserStackAssociationError> m_errors;
  };

} // namespace Model
} // namespace AppStream
} // namespace Aws


text:
/**
 * Activity.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
 */

package com.google.api.ads.dfp.axis.v201602;

/**
 *
An activity is a specific user action that an advertiser wants
 * to track, such as the
 *             completion of a purchase or a visit to a webpage. You
 * create and manage activities in DFP. When
 *             a user performs the action after seeing an advertiser's
 * ad, that's a conversion.

 *
 *
For example, you set up an activity in DFP to track
 * how many users visit an advertiser's
 *             promotional website after viewing or clicking on an ad.
 * When a user views an ad, then visits the
 *             page, that's one conversion.

 */
public class Activity  implements java.io.Serializable {
    /* The unique ID of the {@code Activity}. This value is readonly
     * and is assigned
     *                 by Google. */
    private java.lang.Integer id;

    /* The ID of the {@link ActivityGroup} that this {@link Activity}
     * belongs to. */
    private java.lang.Integer activityGroupId;

    /* The name of the {@code Activity}. This attribute is required
     * and has a maximum length of 255
     *                 characters. */
    private java.lang.String name;

    /* The URL of the webpage where the tags from this activity will
     * be placed. This attribute is
     *                 optional. */
    private java.lang.String expectedURL;

    /* The status of this activity. This attribute is readonly. */
    private com.google.api.ads.dfp.axis.v201602.ActivityStatus status;

    /* The activity type. This attribute is optional and defaults
     * to {@link Activity.Type#PAGE_VIEWS} */
    private com.google.api.ads.dfp.axis.v201602.ActivityType type;

    public Activity() {
    }

    public Activity(
           java.lang.Integer id,
           java.lang.Integer activityGroupId,
           java.lang.String name,
           java.lang.String expectedURL,
           com.google.api.ads.dfp.axis.v201602.ActivityStatus status,
           com.google.api.ads.dfp.axis.v201602.ActivityType type) {
           this.id = id;
           this.activityGroupId = activityGroupId;
           this.name = name;
           this.expectedURL = expectedURL;
           this.status = status;
           this.type = type;
    }

    /**
     * Gets the id value for this Activity.
     *
     * @return id   * The unique ID of the {@code Activity}. This value is readonly
     * and is assigned
     *                 by Google.
     */
    public java.lang.Integer getId() {
        return id;
    }

    /**
     * Sets the id value for this Activity.
     *
     * @param id   * The unique ID of the {@code Activity}. This value is readonly
     * and is assigned
     *                 by Google.
     */
    public void setId(java.lang.Integer id) {
        this.id = id;
    }

    /**
     * Gets the activityGroupId value for this Activity.
     *
     * @return activityGroupId   * The ID of the {@link ActivityGroup} that this {@link Activity}
     * belongs to.
     */
    public java.lang.Integer getActivityGroupId() {
        return activityGroupId;
    }

    /**
     * Sets the activityGroupId value for this Activity.
     *
     * @param activityGroupId   * The ID of the {@link ActivityGroup} that this {@link Activity}
     * belongs to.
     */
    public void setActivityGroupId(java.lang.Integer activityGroupId) {
        this.activityGroupId = activityGroupId;
    }

    /**
     * Gets the name value for this Activity.
     *
     * @return name   * The name of the {@code Activity}. This attribute is required
     * and has a maximum length of 255
     *                 characters.
     */
    public java.lang.String getName() {
        return name;
    }

    /**
     * Sets the name value for this Activity.
     *
     * @param name   * The name of the {@code Activity}. This attribute is required
     * and has a maximum length of 255
     *                 characters.
     */
    public void setName(java.lang.String name) {
        this.name = name;
    }

    /**
     * Gets the expectedURL value for this Activity.
     *
     * @return expectedURL   * The URL of the webpage where the tags from this activity will
     * be placed. This attribute is
     *                 optional.
     */
    public java.lang.String getExpectedURL() {
        return expectedURL;
    }

    /**
     * Sets the expectedURL value for this Activity.
     *
     * @param expectedURL   * The URL of the webpage where the tags from this activity will
     * be placed. This attribute is
     *                 optional.
     */
    public void setExpectedURL(java.lang.String expectedURL) {
        this.expectedURL = expectedURL;
    }

    /**
     * Gets the status value for this Activity.
     *
     * @return status   * The status of this activity. This attribute is readonly.
     */
    public com.google.api.ads.dfp.axis.v201602.ActivityStatus getStatus() {
        return status;
    }

    /**
     * Sets the status value for this Activity.
     *
     * @param status   * The status of this activity. This attribute is readonly.
     */
    public void setStatus(com.google.api.ads.dfp.axis.v201602.ActivityStatus status) {
        this.status = status;
    }

    /**
     * Gets the type value for this Activity.
     *
     * @return type   * The activity type. This attribute is optional and defaults
     * to {@link Activity.Type#PAGE_VIEWS}
     */
    public com.google.api.ads.dfp.axis.v201602.ActivityType getType() {
        return type;
    }

    /**
     * Sets the type value for this Activity.
     *
     * @param type   * The activity type. This attribute is optional and defaults
     * to {@link Activity.Type#PAGE_VIEWS}
     */
    public void setType(com.google.api.ads.dfp.axis.v201602.ActivityType type) {
        this.type = type;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof Activity)) return false;
        Activity other = (Activity) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true &&
            ((this.id==null && other.getId()==null) ||
             (this.id!=null &&
              this.id.equals(other.getId()))) &&
            ((this.activityGroupId==null && other.getActivityGroupId()==null) ||
             (this.activityGroupId!=null &&
              this.activityGroupId.equals(other.getActivityGroupId()))) &&
            ((this.name==null && other.getName()==null) ||
             (this.name!=null &&
              this.name.equals(other.getName()))) &&
            ((this.expectedURL==null && other.getExpectedURL()==null) ||
             (this.expectedURL!=null &&
              this.expectedURL.equals(other.getExpectedURL()))) &&
            ((this.status==null && other.getStatus()==null) ||
             (this.status!=null &&
              this.status.equals(other.getStatus()))) &&
            ((this.type==null && other.getType()==null) ||
             (this.type!=null &&
              this.type.equals(other.getType())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getId() != null) {
            _hashCode += getId().hashCode();
        }
        if (getActivityGroupId() != null) {
            _hashCode += getActivityGroupId().hashCode();
        }
        if (getName() != null) {
            _hashCode += getName().hashCode();
        }
        if (getExpectedURL() != null) {
            _hashCode += getExpectedURL().hashCode();
        }
        if (getStatus() != null) {
            _hashCode += getStatus().hashCode();
        }
        if (getType() != null) {
            _hashCode += getType().hashCode();
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(Activity.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201602", "Activity"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("id");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201602", "id"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("activityGroupId");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201602", "activityGroupId"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("name");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201602", "name"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("expectedURL");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201602", "expectedURL"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("status");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201602", "status"));
        elemField.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201602", "Activity.Status"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("type");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201602", "type"));
        elemField.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201602", "Activity.Type"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}


text:
package org.khk.robotcontroller.views;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

import org.khk.robotcontroller.ControllerActivity;
import org.khk.robotcontroller.MotherFuckingGlobals;

import java.util.Calendar;

/**
 * Created by Joe Dailey on 4/12/2015.
 */
public class ControllerView extends View{

    private ControllerActivity parentActivity;
    private Context context;
    private Paint brush;

    private V_Throttle vKnob;
    private H_Throttle hKnob;

    private Long fireCheck1;
    private Long fireCheck2;
    private final Long MAX_CLICK_TIME = 200L;

    private void init(Context context){
        this.context = context;
        this.brush = new Paint();
        this.vKnob = new V_Throttle(this);
        this.hKnob = new H_Throttle(this);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        brush.setColor(Color.CYAN);

        vKnob.draw(canvas);
        hKnob.draw(canvas);
    }

    public ControllerView(Context context) {
        super(context);
        init(context);
    }
    public ControllerView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }
    public ControllerView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        switch(ev.getAction() & MotionEvent.ACTION_MASK){
            case MotionEvent.ACTION_DOWN:
                fireCheck1 = Calendar.getInstance().getTimeInMillis();
                break;
            case MotionEvent.ACTION_POINTER_DOWN:
                fireCheck2 = Calendar.getInstance().getTimeInMillis();
                break;
            case MotionEvent.ACTION_UP: {
                long clickDuration = Calendar.getInstance().getTimeInMillis() - fireCheck1;
                if (clickDuration < MAX_CLICK_TIME) {
                    Toast.makeText(getContext(), "Fire!", Toast.LENGTH_SHORT).show();
                    fire();
                }
            }
                break;
            case MotionEvent.ACTION_POINTER_UP: {
                long clickDuration = Calendar.getInstance().getTimeInMillis() - fireCheck2;
                if (clickDuration < MAX_CLICK_TIME) {
                    Toast.makeText(getContext(), "Fire!", Toast.LENGTH_SHORT).show();
                    fire();
                }
            }
                break;
        }

        vKnob.trackTouch(ev);
        hKnob.trackTouch(ev);
        invalidate();
        return true;
    }

    public void fire(){
        MotherFuckingGlobals.fucker.serialSend("z");
        Log.d("Control Key", "z");
    }

    private class H_Throttle{
        private Paint brush;
        public float knubPosition;// -1.0 - 1.0
        public int padding;
        public float trackWidth;
        private int touchID;
        public ControllerView parent;
        private final long WAIT_DURATION = 100L;

        private Long lastSend;

        public H_Throttle(ControllerView parent){
            this.brush = new Paint();
            this.knubPosition = 0.5f;
            this.padding = 10;
            this.touchID = -1;
            this.parent = parent;
            lastSend = Calendar.getInstance().getTimeInMillis();
        }

        public void draw(Canvas canvas){

            int width = getWidth();
            int halfWidth = width/2;
            int height = getHeight();

            brush.setColor(Color.BLACK);
            brush.setStrokeCap(Paint.Cap.ROUND);
            brush.setStrokeWidth(15);

            canvas.drawLine(halfWidth+padding, height/2, halfWidth+width/2-padding, height/2, brush);

            trackWidth = (width/2-2*padding);
            canvas.drawCircle(halfWidth+padding+knubPosition*trackWidth, height/2, 20, brush);

        }

        public void moveKnob(float x){
            if(x < getWidth()/2+padding)
                x = getWidth()/2+padding;
            if(x > getWidth()-padding)
                x = getWidth()-padding;

            float realXonTrack = (x - (getWidth()/2+padding));
            knubPosition = realXonTrack/trackWidth;

            char out;
            double numba = (knubPosition*20);
            out = (char) ('A' + (char)numba);

            if(Calendar.getInstance().getTimeInMillis() - lastSend > WAIT_DURATION) {
                lastSend = Calendar.getInstance().getTimeInMillis();
                MotherFuckingGlobals.fucker.serialSend(""+out);
                Log.d("Control Key", ""+out);
            }

        }

        public void trackTouch(MotionEvent ev) {
            int index = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;

            switch(ev.getAction() & MotionEvent.ACTION_MASK){
                case MotionEvent.ACTION_DOWN:
                case MotionEvent.ACTION_POINTER_DOWN:
                    if( ev.getX(index) > getWidth()/2  && ev.getX(index) < getWidth() && touchID == -1){
                        touchID = ev.getPointerId(index);
                        moveKnob(ev.getX(index));
                    }
                    break;
                case MotionEvent.ACTION_MOVE:
                    if( touchID != -1){
                        moveKnob(ev.getX(ev.findPointerIndex(touchID)));
                    }
                    break;
                case MotionEvent.ACTION_UP:
                case MotionEvent.ACTION_POINTER_UP:
                    if( ev.getPointerId(index) == touchID ){
                        touchID = -1;
                        this.knubPosition = 0.5f;

                        MotherFuckingGlobals.fucker.serialSend("K");
                        MotherFuckingGlobals.fucker.serialSend("K");
                        MotherFuckingGlobals.fucker.serialSend("K");
                        MotherFuckingGlobals.fucker.serialSend("K");
                        MotherFuckingGlobals.fucker.serialSend("K");
                        MotherFuckingGlobals.fucker.serialSend("K");
                        Log.d("Control Key", "K");

                    }
                    break;
            }
        }
    }

    private class V_Throttle{
        private Paint brush;
        public float knubPosition;// 0.0 - 1.0
        public int padding;
        private float trackWidth;
        private int touchID;
        private Thread myRunner;
        public ControllerView parent;

        public V_Throttle(ControllerView parent){
            this.brush = new Paint();
            this.knubPosition = 0.5f;
            this.padding = 10;
            touchID = -1;
            this.parent = parent;

            myRunner = new Thread(new V_runner(this));
            myRunner.start();
        }

        public void draw(Canvas canvas){

            int width = getWidth();
            int height = getHeight();

            brush.setColor(Color.BLACK);
            brush.setStrokeCap(Paint.Cap.ROUND);
            brush.setStrokeWidth(15);

            canvas.drawLine(width/2/2, padding, width/2/2, height-padding, brush);

            trackWidth = (height-2*padding);
            canvas.drawCircle(width/2/2, padding+knubPosition*trackWidth, 20, brush);

        }

        public void moveKnob(float y){
            if(y < padding)
                y = padding;
            if(y > getHeight()-padding)
                y = getHeight()-padding;

            float realYonTrack = (y - (padding));
            knubPosition = realYonTrack/trackWidth;
        }

        public void trackTouch(MotionEvent ev) {
            int index = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;

            switch(ev.getAction() & MotionEvent.ACTION_MASK){
                case MotionEvent.ACTION_DOWN:
                case MotionEvent.ACTION_POINTER_DOWN:
                    if( ev.getX(index) > 0  && ev.getX(index) < getWidth()/2 && touchID == -1){
                        touchID = ev.getPointerId(index);
                        moveKnob(ev.getY(index));
                    }
                    break;
                case MotionEvent.ACTION_MOVE:
                    if( touchID != -1){
                        moveKnob(ev.getY(ev.findPointerIndex(touchID)));
                    }
                    break;
                case MotionEvent.ACTION_UP:
                case MotionEvent.ACTION_POINTER_UP:
                    if( ev.getPointerId(index) == touchID ){
                        touchID = -1;
                        this.knubPosition = 0.5f;
                    }
                    break;
            }
        }

    }

    public class V_runner implements Runnable{
        private V_Throttle throttle;
        private final long WAIT_DURATION = 100L;

        private Long lastSend;

        public V_runner(V_Throttle that){
            this.throttle = that;
            lastSend = Calendar.getInstance().getTimeInMillis();
        }

        @Override
        public void run() {
            while(true) {
                if (Calendar.getInstance().getTimeInMillis() - lastSend > WAIT_DURATION) {
                    if(throttle.knubPosition == 0.5f && throttle.parent.hKnob.knubPosition == 0.5f){

                        lastSend = Calendar.getInstance().getTimeInMillis();
                        MotherFuckingGlobals.fucker.serialSend("k");
                        Log.d("Control Key", "k");
                    }else{
                        if(throttle.knubPosition != 0.5f) {
                            char out;
                            double numba = (throttle.knubPosition * 20);
                            out = (char) ('a' + (char) numba);

                            lastSend = Calendar.getInstance().getTimeInMillis();
                            MotherFuckingGlobals.fucker.serialSend("" + out);
                            Log.d("Control Key", "" + out);
                        }
                    }

                }
            }
        }
    }
}


text:
describe("VersionFilters", () => {
	let stepVersionsFilter;
	let versionLabelFilter;
	let verInfoFilter;
	let verOptsfilter;
	let mockStepSourceService;
	let mockSemverService;
	let mockStep;

	beforeEach(() => {
		mockStepSourceService = {
			versionsOfStep: jasmine.createSpy("extractWildcardVersions"),
			latestVersion: jasmine.createSpy("latestVersion")
		};

		mockSemverService = {
			checkVersionPartsLocked: jasmine.createSpy("checkVersionPartsLocked")
		};

		module("BitriseWorkflowEditor");
		module($provide => {
			$provide.value("stepSourceService", mockStepSourceService);
			$provide.value("semverService", mockSemverService);
			$provide.value("resolveVersionFilter", _.identity);
			$provide.constant("STRINGS_VERSION", {
				versionText: "mock_version <version>",
				branchText: "mock_branch <version>",
				latestVersionText: "latest_version <latest_version>",
				exactVersionRemark: "exact_version <version>",
				patchUpdatesRemark: "patch_update",
				minorUpdateRemarks: "minor_update"
			});
		});

		mockStep = { isLibraryStep: () => true };
	});

	beforeEach(inject((
		_stepVersionsFilter_,
		_versionLabelFilter_,
		_versionInfoStringsFilter_,
		_versionSelectorOptionsFilter_
	) => {
		stepVersionsFilter = _stepVersionsFilter_;
		versionLabelFilter = _versionLabelFilter_;
		verInfoFilter = _versionInfoStringsFilter_;
		verOptsfilter = _versionSelectorOptionsFilter_;
	}));

	describe("stepVersionsFilter", () => {
		it("should use stepSource service to calculate wildcard versions", () => {
			stepVersionsFilter(mockStep);
			expect(mockStepSourceService.versionsOfStep).toHaveBeenCalledWith(mockStep);
		});

		it("should not include latest version in the list if the step is not library step", () => {
			mockStep.isLibraryStep = () => false;
			mockStepSourceService.versionsOfStep.and.returnValue(["1.2.x"]);

			const versions = stepVersionsFilter(mockStep);

			expect(versions).toEqual(["1.2.x"]);
		});
	});

	describe("versionLabel", () => {
		it("should display version str if set", () => {
			expect(versionLabelFilter("test-version")).toEqual("test-version");
		});

		it("should display latest version if version descriptor not set", () => {
			expect(versionLabelFilter(null)).toContain("latest");
		});
	});

	describe("versionInfoStrings", () => {
		it("should calculate version text for git steps", () => {
			const { versionText } = verInfoFilter({ isVCSStep: () => true }, "#branch");
			expect(versionText).toEqual("mock_branch #branch");
		});

		it("should calculate version text for library steps", () => {
			const { versionText } = verInfoFilter({ isVCSStep: () => false }, "1.2");
			expect(versionText).toEqual("mock_version 1.2");
		});

		it("should calculate latest version text", () => {
			mockStepSourceService.latestVersion.and.returnValue("1.5");

			const { latestVersionText } = verInfoFilter({ isVCSStep: () => false }, "1.2");
			expect(latestVersionText).toEqual("latest_version 1.5");
		});
	});

	describe("versionSelectorOptions", () => {
		it("should put an update to result", () => {
			const mockUpdater = jasmine.createSpy("updater");
			const { onUpdateVersion } = verOptsfilter({}, mockUpdater);
			expect(onUpdateVersion).toEqual(mockUpdater);
		});

		it("should support patch versions", () => {
			mockSemverService.checkVersionPartsLocked
				.withArgs("1.2.x", 2)
				.and.returnValue(false)
				.withArgs("1.2.x", 1)
				.and.returnValue(true);

			const {
				strings: { versionRemark }
			} = verOptsfilter({ version: "1.2.x" });
			expect(versionRemark).toEqual("patch_update");
		});

		it("should support minor versions", () => {
			mockSemverService.checkVersionPartsLocked
				.withArgs("1.x", 2)
				.and.returnValue(true)
				.withArgs("1.x", 1)
				.and.returnValue(false);

			const {
				strings: { versionRemark }
			} = verOptsfilter({ version: "1.x" });
			expect(versionRemark).toEqual("minor_update");
		});

		it("should support exact versions", () => {
			const {
				strings: { versionRemark }
			} = verOptsfilter({ version: "1.2.3" });
			expect(versionRemark).toEqual("exact_version 1.2.3");
		});
	});
});


text:
package pl.touk.nussknacker.restmodel.displayedgraph

import io.circe.Encoder
import io.circe.generic.JsonCodec
import pl.touk.nussknacker.engine.api.process.ProcessName
import pl.touk.nussknacker.engine.api.{MetaData, ProcessAdditionalFields, TypeSpecificData}
import pl.touk.nussknacker.engine.graph.node.NodeData
import pl.touk.nussknacker.restmodel.displayedgraph.displayablenode._
import pl.touk.nussknacker.restmodel.validation.ValidationResults.ValidationResult
import pl.touk.nussknacker.restmodel.process.ProcessingType
import pl.touk.nussknacker.engine.graph.NodeDataCodec._

//it would be better to have two classes but it would either to derivce from each other, which is not easy for case classes
//or we'd have to do composition which would break many things in client
// todo: id type should be ProcessName
@JsonCodec case class DisplayableProcess(id: String,
                                         properties: ProcessProperties,
                                         nodes: List[NodeData],
                                         edges: List[Edge],
                                         processingType: ProcessingType) {

  val metaData: MetaData = properties.toMetaData(id)

  val processName: ProcessName = ProcessName(id)
}

@JsonCodec case class ValidatedDisplayableProcess(id: String,
                                                  properties: ProcessProperties,
                                                  nodes: List[NodeData],
                                                  edges: List[Edge],
                                                  processingType: ProcessingType,
                                                  validationResult: ValidationResult) {

  def this(displayableProcess: DisplayableProcess, validationResult: ValidationResult) =
    this(
      displayableProcess.id,
      displayableProcess.properties,
      displayableProcess.nodes,
      displayableProcess.edges,
      displayableProcess.processingType,
      validationResult
    )

  def toDisplayable: DisplayableProcess = DisplayableProcess(id, properties, nodes, edges, processingType)

}

@JsonCodec(decodeOnly = true)
case class ProcessProperties(typeSpecificProperties: TypeSpecificData,
                             additionalFields: Option[ProcessAdditionalFields] = None,
                             subprocessVersions: Map[String, Long] = Map.empty) { //TODO: field subprocessVersions is deprecate - to remove

  def toMetaData(id: String): MetaData = MetaData(
    id = id,
    typeSpecificData = typeSpecificProperties,
    additionalFields = additionalFields,
    subprocessVersions = subprocessVersions
  )
  val isSubprocess: Boolean = typeSpecificProperties.isSubprocess

}

object ProcessProperties {
  implicit val encodeProcessProperties: Encoder[ProcessProperties] =
    Encoder.forProduct4("typeSpecificProperties", "isSubprocess", "additionalFields", "subprocessVersions") { p =>
    (p.typeSpecificProperties, p.isSubprocess, p.additionalFields, p.subprocessVersions)
  }
}


text:
Snapshot tool for the prooph event-store. Take aggregate snapshots with ease.

## Installation

```
composer require prooph/snapshotter
```

## Snapshots via Projection

There are two projections shipped with this package:

1) CategorySnapshotProjection
2) StreamSnapshotProjection

## CategorySnapshotProjection

Use this one, if you are using one stream per aggregate, so when you have two users with ids `123` and `234` the event
streams are named `user-123` and `user-234`, in this case you need to create the snapshots by querying the category user.

## StreamSnapshotProjection

Use this one, if you are using one stream for all aggregates, so when you have two users with ids `123` and `234` the event
stream is simply `user` for both of them, in this case you need to create the snapshots by querying the stream user.

## Usage

You need to create a simple script, that might look similar to this and run it in background.
With the help of docker-containers or supervisord you can keep the script alive, if it dies.

```php
<?php

$container = include 'container.php';

$projectionManager = $container->get(\Prooph\EventStore\Projection\ProjectionManager::class);

$projection = $projectionManager->createReadModelProjection(
    'user-snapshots',
    new \Prooph\Snapshotter\SnapshotReadModel(
        $container->get('user_repository'),
        new \Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator(),
        $container->get(\Prooph\SnapshotStore\SnapshotStore::class),
        [
          'user',
        ]
    )
);

$categorySnapshotProjection = new \Prooph\Snapshotter\CategorySnapshotProjection($projection, 'user');
$categorySnapshotProjection();

// or

$streamSnapshotProjection = new \Prooph\Snapshotter\StreamSnapshotProjection($projection, 'user');
$streamSnapshotProjection();
```


text:
#ifndef RENDERING_TEXTURE_POLICY_H_INCLUDED
#define RENDERING_TEXTURE_POLICY_H_INCLUDED

#include "opengl.h"

namespace eps {
namespace rendering {

template
<
    enum_type _Internal_format,
    enum_type _Format,
    enum_type _Type,
    enum_type _Filter,
    enum_type _Wrap
>
struct texture_policy
{
    static constexpr enum_type internal_format() { return _Internal_format; }
    static constexpr enum_type format() { return _Format; }
    static constexpr enum_type type() { return _Type; }
    static constexpr enum_type filter() { return _Filter; }
    static constexpr enum_type wrap() { return _Wrap; }
};

using default_texture_policy = texture_policy
<
    GL_RGBA,
    GL_RGBA,
    GL_UNSIGNED_BYTE,
    GL_LINEAR,
    GL_CLAMP_TO_EDGE
>;

using alpha_texture_policy = texture_policy
<
    GL_ALPHA,
    GL_ALPHA,
    GL_UNSIGNED_BYTE,
    GL_LINEAR,
    GL_CLAMP_TO_EDGE
>;

using repeat_texture_policy = texture_policy
<
    GL_RGBA,
    GL_RGBA,
    GL_UNSIGNED_BYTE,
    GL_LINEAR,
    GL_REPEAT
>;

using depth_texture_policy = texture_policy
<
    GL_DEPTH_COMPONENT16,
    GL_DEPTH_COMPONENT,
    GL_UNSIGNED_SHORT,
    GL_NEAREST,
    GL_CLAMP_TO_EDGE
>;

// GL_OES_depth24 extension
using depth24_texture_policy = texture_policy
<
    GL_DEPTH_COMPONENT24_OES,
    GL_DEPTH_COMPONENT,
    GL_UNSIGNED_INT,
    GL_NEAREST,
    GL_CLAMP_TO_EDGE
>;

// OES_packed_depth_stencil extension
using depth24_stencil8_texture_policy = texture_policy
<
    GL_DEPTH24_STENCIL8_OES,
    GL_DEPTH_STENCIL_OES,
    GL_UNSIGNED_INT_24_8_OES,
    GL_NEAREST,
    GL_CLAMP_TO_EDGE
>;

} /* rendering */
} /* eps */

#endif // RENDERING_TEXTURE_POLICY_H_INCLUDED