text:
namespace syncer {

SingleObjectInvalidationSet::SingleObjectInvalidationSet() {}

SingleObjectInvalidationSet::~SingleObjectInvalidationSet() {}

void SingleObjectInvalidationSet::Insert(const Invalidation& invalidation) {
  invalidations_.insert(invalidation);
}

void SingleObjectInvalidationSet::InsertAll(
    const SingleObjectInvalidationSet& other) {
  invalidations_.insert(other.begin(), other.end());
}

void SingleObjectInvalidationSet::Clear() {
  invalidations_.clear();
}

void SingleObjectInvalidationSet::Erase(const_iterator it) {
  invalidations_.erase(*it);
}

bool SingleObjectInvalidationSet::StartsWithUnknownVersion() const {
  return !invalidations_.empty() &&
      invalidations_.begin()->is_unknown_version();
}

size_t SingleObjectInvalidationSet::GetSize() const {
  return invalidations_.size();
}

bool SingleObjectInvalidationSet::IsEmpty() const {
  return invalidations_.empty();
}

namespace {

struct InvalidationComparator {
  bool operator()(const Invalidation& inv1, const Invalidation& inv2) {
    return inv1.Equals(inv2);
  }
};

}  // namespace

bool SingleObjectInvalidationSet::operator==(
    const SingleObjectInvalidationSet& other) const {
  return std::equal(invalidations_.begin(),
                    invalidations_.end(),
                    other.invalidations_.begin(),
                    InvalidationComparator());
}

SingleObjectInvalidationSet::const_iterator
SingleObjectInvalidationSet::begin() const {
  return invalidations_.begin();
}

SingleObjectInvalidationSet::const_iterator
SingleObjectInvalidationSet::end() const {
  return invalidations_.end();
}

SingleObjectInvalidationSet::const_reverse_iterator
SingleObjectInvalidationSet::rbegin() const {
  return invalidations_.rbegin();
}

SingleObjectInvalidationSet::const_reverse_iterator
SingleObjectInvalidationSet::rend() const {
  return invalidations_.rend();
}

const Invalidation& SingleObjectInvalidationSet::back() const {
  return *invalidations_.rbegin();
}

scoped_ptr<base::ListValue> SingleObjectInvalidationSet::ToValue() const {
  scoped_ptr<base::ListValue> value(new base::ListValue);
  for (InvalidationsSet::const_iterator it = invalidations_.begin();
       it != invalidations_.end(); ++it) {
    value->Append(it->ToValue().release());
  }
  return value.Pass();
}

bool SingleObjectInvalidationSet::ResetFromValue(
    const base::ListValue& list) {
  for (size_t i = 0; i < list.GetSize(); ++i) {
    const base::DictionaryValue* dict;
    if (!list.GetDictionary(i, &dict)) {
      DLOG(WARNING) << "Could not find invalidation at index " << i;
      return false;
    }
    scoped_ptr<Invalidation> invalidation = Invalidation::InitFromValue(*dict);
    if (!invalidation) {
      DLOG(WARNING) << "Failed to parse invalidation at index " << i;
      return false;
    }
    invalidations_.insert(*invalidation);
  }
  return true;
}

}  // namespace syncer


text:
/**************************************************************************************/
/*                                                                                */
/*  Visualization Library                                                             */
/*  http://visualizationlibrary.org                                                   */
/*                                                                                */
/*  Copyright (c) 2005-2020, Michele Bosi                                             */
/*  All rights reserved.                                                              */
/*                                                                                */
/*  Redistribution and use in source and binary forms, with or without modification,  */
/*  are permitted provided that the following conditions are met:                     */
/*                                                                                */
/*  - Redistributions of source code must retain the above copyright notice, this     */
/*  list of conditions and the following disclaimer.                                  */
/*                                                                                */
/*  - Redistributions in binary form must reproduce the above copyright notice, this  */
/*  list of conditions and the following disclaimer in the documentation and/or       */
/*  other materials provided with the distribution.                                   */
/*                                                                                */
/*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
/*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
/*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
/*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
/*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
/*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
/*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
/*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
/*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
/*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
/*                                                                                */
/**************************************************************************************/

#ifndef BaseDemo_INCLUDE_ONCE
#define BaseDemo_INCLUDE_ONCE

#include <vlGraphics/Applet.hpp>
#include <vlGraphics/Rendering.hpp>
#include <vlCore/VisualizationLibrary.hpp>
#include <vlCore/ResourceDatabase.hpp>
#include <vlCore/Time.hpp>

class BaseDemo: public vl::Applet
{
public:
  BaseDemo()
  {
    mFPSTimer.start();
  }

  void updateEvent()
  {
    vl::Applet::updateEvent();

    if ( mFPSTimer.elapsed() > 1 )
    {
      mFPSTimer.start();
      openglContext()->setWindowTitle( vl::Say("[%.1n] %s") << fps() << appletName()  + " - " + vl::String("VL ") + vl::versionString() );
      vl::Log::print( vl::Say("FPS=%.1n\n") << fps() );
    }
  }

  virtual vl::String appletInfo()
  {
    return "Applet info: " + appletName() + "\n" +
    "Keys:\n" +
    "- Escape: quits the application.\n" +
    "- T:  enables the TrackballManipulator.\n" +
    "- F:  enables the GhostCameraManipulator (use A/D S/W keys).\n" +
    "- F1: toggles fullscreen mode if supported.\n" +
    "- F5: saves a screenshot of the current OpenGL window.\n" +
    "- C:  toggles the continuous update of the OpenGL window.\n" +
    "- U:  force update of the OpenGL window.\n" +
    "\n";
  }

protected:
  vl::Time mFPSTimer;
};

#endif

redpajama_set_name: RedPajamaGithub


text:
<!-- **************************************************************************
#
# Copyright (c) 2010-2012 Sonatype, Inc.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#
#  Jason Dillon, Winston Prakash
#
#************************************************************************** -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.eclipse.hudson</groupId>
    <artifactId>hudson-parent</artifactId>
    <version>3.1.2-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>hudson-inject</artifactId>
  <version>3.1.2-SNAPSHOT</version>
  <name>Hudson :: Inject (JSR-330 Strategy)</name>

  <description>
    Contains the strategy to wire up JSR-330 components in Hudson.
  </description>

  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.sonatype.sisu</groupId>
      <artifactId>sisu-inject-bean</artifactId>
    </dependency>

    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <exclusions>
        <exclusion>
          <artifactId>jsr305</artifactId>
          <groupId>com.google.code.findbugs</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjweaver</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>hudson-core</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>test-compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>


text:
[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/Flet/semistandard)
[![NPM version](https://img.shields.io/npm/v/nyc.svg)](https://www.npmjs.com/package/nyc)
[![Build Status](https://travis-ci.org/soundglom/getmusic-react.svg?branch=master)](https://travis-ci.org/soundglom/getmusiclive)

#GetMusicLive
*Find music events based on your specific tastes. Everything from large concerts to smalls bands at your neighborhood bars, From world class DJ's to spoken word to karaoke.*

##Installation
1. create file `.env` in root directory
2. Add `{ EVENTBRITE=[API_KEY] }`
3. uncomment line 1 of `root/server.js`
4. `npm i`
5. `npm run dev`
6. Open browser to `localhost:3000`

##Testing
1. `npm test` - Test runner
2. `npm run lint` - Linting (`semistandard`)
3. `npm cover` - Coverage with `nyc`

More documentation, STYLE_GUIDE, CONTRIBUTING, coming soon


text:
<?php

namespace CodrPress;

abstract class Action {

    private $app;
    private $response;

    public function __construct(Application $app) {
        $this->app = $app;
    }

    abstract protected function call();

    protected function getConfig() {
        return $this->app['config'];
    }

    protected function getRequest() {
        return $this->app['request'];
    }

    public function getResponse() {
        if ($this->response === null) {
            $this->response = $this->call();
        }

        return $this->response;
    }
}


text:
package serene.validation.schema.simplified;

import java.io.File;

import serene.bind.util.DocumentIndexedData;

abstract class SComponent implements SimplifiedComponent{
	int childIndex;
	/*SimplifiedComponent parent;*/

	/*protected String qName;
	protected String location;*/
    int recordIndex;
    DocumentIndexedData documentIndexedData;

	public SComponent(int recordIndex, DocumentIndexedData documentIndexedData){
		this.recordIndex = recordIndex;
		this.documentIndexedData = documentIndexedData;

		childIndex = -1;
	}

	/*void setParent(SimplifiedComponent parent){
		this.parent = parent;
	}*/

	/*public SimplifiedComponent getParent(){
		return parent;
	}*/

	/*void setChildIndex(int childIndex){
		this.childIndex = childIndex;
	}*/

	public int getChildIndex(){
		return childIndex;
	}

	public int getRecordIndex(){
	    return recordIndex;
	}

	public DocumentIndexedData getDocumentIndexedData(){
	    return documentIndexedData;
	}

	public String getQName(){
	    //System.out.println("ABSTRACT SIMPLIFIED COMPONENT documentIndexedData="+documentIndexedData);
		return documentIndexedData.getItemDescription(recordIndex);
	}
	public String getLocation(boolean restrictToFileName){
	    String si = documentIndexedData.getSystemId(recordIndex);
	    int ln = documentIndexedData.getLineNumber(recordIndex);
	    if(ln == DocumentIndexedData.UNKNOWN){
	        if(si == null || !restrictToFileName)return si;
	        return getRestrictedSystemId(si);
	    }

	    int cn = documentIndexedData.getColumnNumber(recordIndex);

        if(si == null || !restrictToFileName){
            return si+":"+ln+":"+cn;
        }
        return getRestrictedSystemId(si)+":"+ln+":"+cn;
	}
	String getRestrictedSystemId(String si){
	    int nameIndex = si.lastIndexOf(File.separatorChar)+1;
        if(nameIndex == 0) nameIndex = si.lastIndexOf('/')+1;
        return si.substring(nameIndex);
	}
}


text:
package api

import (
	"errors"
	"github.com/franela/goreq"
	"log"
	"net/http"
	"strings"
)

// Client is an API client
type Client struct {
	cookie http.CookieJar
}

func (c Client) get(url string, requestData interface{}, result interface{}) []error {
	var errs []error

	resp, err := goreq.Request{
		Uri:         url,
		QueryString: requestData,
		CookieJar:   c.cookie,
	}.Do()
	if err != nil {
		errs = append(errs, errors.New(err.Error()))
		log.Fatalln(err.Error())
	}
	defer func() {
		err := resp.Body.Close()
		if err != nil {
			log.Fatal(err)
		}
	}()

	if resp.StatusCode != http.StatusOK {
		errs = append(errs, errors.New("Failed login: status code is "+resp.Status))
	}

	err = resp.Body.FromJsonTo(&result)
	if err != nil {
		errs = append(errs, errors.New(err.Error()))
		log.Println(err.Error())
	}

	return errs
}

func (c Client) post(url string, requestData interface{}) []error {

	var errs []error
	req := goreq.Request{
		Method:      "POST",
		Body:        requestData,
		Uri:         url,
		ContentType: "application/x-www-form-urlencoded; charset=UTF-8",
		CookieJar:   c.cookie,
	}
	req.AddHeader("X-Requested-With", "XMLHttpRequest")
	resp, err := req.Do()

	if err != nil {
		errs = append(errs, errors.New(err.Error()))
		log.Fatalln(err.Error())
	}
	defer func() {
		err := resp.Body.Close()
		if err != nil {
			log.Fatal(err)
		}
	}()

	if resp.StatusCode != http.StatusOK {
		errs = append(errs, errors.New("Failed login: status code is "+resp.Status))
	}

	return errs
}

// DownloadPicture posts a picture to the translation
func (c Client) DownloadPicture(url string, translateID string) []error {
	req := "url=" + url + "&translate_id=" + translateID
	errs := c.post(downloadPictureURL, req)
	return errs
}

func (c Client) authorize(email string, password string) []error {
	req := LoginRequest{
		Email:    email,
		Password: password,
	}

	var loginResp LoginResponse
	errs := c.get(loginURL, req, loginResp)
	if strings.TrimSpace(loginResp.ErrorMsg) != "" {
		errs = append(errs, errors.New("Failed login: "+loginResp.ErrorMsg))
	}

	return errs
}

func (c Client) validateCredentials(email string, password string) []error {
	var errs []error

	if strings.TrimSpace(email) == "" {
		errs = append(errs, errors.New("Username should not be empty"))
	}
	if strings.TrimSpace(password) == "" {
		errs = append(errs, errors.New("Password should not be empty"))
	}
	return errs
}

// GetTranslations returns translations for a word
func (c Client) GetTranslations(word string) ([]error, Word) {
	req := TranslationRequest{
		Word: word,
	}

	translations := Word{}
	errs := c.get(translateURL, req, &translations)
	if strings.TrimSpace(translations.ErrorMsg) != "" {
		errs = append(errs, errors.New("Something went wrong: "+translations.ErrorMsg))
	}

	return errs, translations
}

// AddWord posts new word to the API
func (c Client) AddWord(word, translation string) ([]error, Word) {
	req := AddWordRequest{
		Word:        word,
		Translation: translation,
	}

	var result Word
	errs := c.get(addWordURL, req, &result)
	if strings.TrimSpace(result.ErrorMsg) != "" {
		errs = append(errs, errors.New("Something went wrong: "+result.ErrorMsg))
	}

	return errs, result
}

// AddWordWithContext add a word with a context
// ToDo: Rewrite the method to combine it with an AddWord call
func (c Client) AddWordWithContext(word, translation string, context string) ([]error, Word) {
	req := AddWordWithContextRequest{
		Word:        word,
		Translation: translation,
		Context:     context,
	}

	var result Word
	errs := c.get(addWordURL, req, &result)
	if strings.TrimSpace(result.ErrorMsg) != "" {
		errs = append(errs, errors.New("Something went wrong: "+result.ErrorMsg))
	}

	return errs, result
}


text:
using System;
using System.Diagnostics;
using Xunit;
using Xunit.Abstractions;

namespace System.Numerics.Tests
{
    public class PerformanceTests
    {
        private readonly Random _random;
        private readonly ITestOutputHelper _output;

        public PerformanceTests(ITestOutputHelper output)
        {
            _random = new Random(1138);
            _output = output;
        }

        [Theory]
        [ActiveIssue("PerformanceTest")]
        [InlineData(1000000, 16, 16)]
        [InlineData(1000000, 64, 64)]
        [InlineData(1000000, 256, 256)]
        [InlineData(1000000, 1024, 1024)]
        [InlineData(100000, 4096, 4096)]
        [InlineData(100000, 16384, 16384)]
        [InlineData(100000, 65536, 65536)]
        public void Add(int count, int leftBits, int rightBits)
        {
            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Add(l, r));
        }

        [Theory]
        [ActiveIssue("PerformanceTest")]
        [InlineData(1000000, 16, 16)]
        [InlineData(1000000, 64, 64)]
        [InlineData(1000000, 256, 256)]
        [InlineData(1000000, 1024, 1024)]
        [InlineData(100000, 4096, 4096)]
        [InlineData(100000, 16384, 16384)]
        [InlineData(100000, 65536, 65536)]
        public void Subtract(int count, int leftBits, int rightBits)
        {
            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Subtract(l, r));
        }

        [Theory]
        [ActiveIssue("PerformanceTest")]
        [InlineData(1000000, 16, 16)]
        [InlineData(1000000, 64, 64)]
        [InlineData(1000000, 256, 256)]
        [InlineData(100000, 1024, 1024)]
        [InlineData(10000, 4096, 4096)]
        [InlineData(1000, 16384, 16384)]
        [InlineData(100, 65536, 65536)]
        public void Multiply(int count, int leftBits, int rightBits)
        {
            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Multiply(l, r));
        }

        [Theory]
        [ActiveIssue("PerformanceTest")]
        [InlineData(1000000, 16)]
        [InlineData(1000000, 64)]
        [InlineData(1000000, 256)]
        [InlineData(100000, 1024)]
        [InlineData(10000, 4096)]
        [InlineData(1000, 16384)]
        [InlineData(100, 65536)]
        public void Square(int count, int bits)
        {
            RunBenchmark(count, bits, v => BigInteger.Multiply(v, v));
        }

        [Theory]
        [ActiveIssue("PerformanceTest")]
        [InlineData(1000000, 16, 16)]
        [InlineData(1000000, 64, 16)]
        [InlineData(1000000, 256, 128)]
        [InlineData(100000, 1024, 512)]
        [InlineData(10000, 4096, 2048)]
        [InlineData(1000, 16384, 8192)]
        [InlineData(100, 65536, 32768)]
        public void Divide(int count, int leftBits, int rightBits)
        {
            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Divide(l, r));
        }

        [Theory]
        [ActiveIssue("PerformanceTest")]
        [InlineData(1000000, 16, 16)]
        [InlineData(1000000, 64, 16)]
        [InlineData(1000000, 256, 128)]
        [InlineData(100000, 1024, 512)]
        [InlineData(10000, 4096, 2048)]
        [InlineData(1000, 16384, 8192)]
        [InlineData(100, 65536, 32768)]
        public void Remainder(int count, int leftBits, int rightBits)
        {
            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Remainder(l, r));
        }

        [Theory]
        [ActiveIssue("PerformanceTest")]
        [InlineData(100000, 16, 16, 16)]
        [InlineData(10000, 64, 64, 64)]
        [InlineData(1000, 256, 256, 256)]
        [InlineData(100, 1024, 1024, 1024)]
        [InlineData(10, 4096, 4096, 4096)]
        [InlineData(1, 16384, 16384, 16384)]
        public void ModPow(int count, int leftBits, int rightBits, int otherBits)
        {
            RunBenchmark(count, leftBits, rightBits, otherBits, (l, r, o) => BigInteger.ModPow(l, r, o));
        }

        private void RunBenchmark(int count, int bits, Action<BigInteger> operation)
        {
            BigInteger[] value = CreateIntegerSeed(count, bits);

            long result = RunBenchmark(count, i => operation(value[i]));

            _output.WriteLine("({1:N0}) : {2:N0} ms / {0:N0} ops", count, bits, result);
        }

        private void RunBenchmark(int count, int leftBits, int rightBits, Action<BigInteger, BigInteger> operation)
        {
            BigInteger[] left = CreateIntegerSeed(count, leftBits);
            BigInteger[] right = CreateIntegerSeed(count, rightBits);

            long result = RunBenchmark(count, i => operation(left[i], right[i]));

            _output.WriteLine("({1:N0}, {2:N0}) : {3:N0} ms / {0:N0} ops", count, leftBits, rightBits, result);
        }

        private void RunBenchmark(int count, int leftBits, int rightBits, int otherBits, Action<BigInteger, BigInteger, BigInteger> operation)
        {
            BigInteger[] left = CreateIntegerSeed(count, leftBits);
            BigInteger[] right = CreateIntegerSeed(count, rightBits);
            BigInteger[] other = CreateIntegerSeed(count, otherBits);

            long result = RunBenchmark(count, i => operation(left[i], right[i], other[i]));

            _output.WriteLine("({1:N0}, {2:N0}, {3:N0}) : {4:N0} ms / {0:N0} ops", count, leftBits, rightBits, otherBits, result);
        }

        private const int MAX_SEED = 10;
        private const int RUN_COUNT = 3;

        private long RunBenchmark(int count, Action<int> operation)
        {
            Stopwatch watch = new Stopwatch();
            long result = long.MaxValue;

            operation(0);

            for (int j = 0; j < RUN_COUNT; j++)
            {
                watch.Restart();
                for (int i = 0; i < count; i++)
                    operation(i % MAX_SEED);
                watch.Stop();

                result = Math.Min(result, watch.ElapsedMilliseconds);
            }

            return result;
        }

        private BigInteger[] CreateIntegerSeed(int count, int bits)
        {
            BigInteger[] seed = new BigInteger[Math.Min(count, MAX_SEED)];

            for (int i = 0; i < seed.Length; i++)
                seed[i] = CreateRandomInteger(bits);

            return seed;
        }

        private BigInteger CreateRandomInteger(int bits)
        {
            byte[] value = new byte[(bits + 8) / 8];
            BigInteger result = BigInteger.Zero;

            while (result.IsZero)
            {
                _random.NextBytes(value);

                // ensure actual bit count (remaining bits not set)
                // ensure positive value (highest-order bit not set)
                value[value.Length - 1] &= (byte)(0xFF >> 8 - bits % 8);

                result = new BigInteger(value);
            }

            return result;
        }
    }
}


text: - Fixed an issue where a typo caused mismatch on **Entity name** incident field.


text:
namespace voxblox_fast {

// Types.
typedef float FloatingPoint;
typedef int IndexElement;

typedef Eigen::Matrix<FloatingPoint, 3, 1> Point;
typedef Eigen::Matrix<FloatingPoint, 3, 1> Ray;

typedef Eigen::Matrix<IndexElement, 3, 1> AnyIndex;
typedef AnyIndex VoxelIndex;
typedef AnyIndex BlockIndex;

typedef std::pair<BlockIndex, VoxelIndex> VoxelKey;

typedef std::vector<AnyIndex, Eigen::aligned_allocator<AnyIndex> > IndexVector;
typedef IndexVector BlockIndexList;
typedef IndexVector VoxelIndexList;

struct Color;
typedef uint32_t Label;

// Pointcloud types for external interface.
typedef std::vector<Point, Eigen::aligned_allocator<Point>> Pointcloud;
typedef std::vector<Color> Colors;
typedef std::vector<Label> Labels;

// For triangle meshing/vertex access.
typedef size_t VertexIndex;
typedef std::vector<VertexIndex> VertexIndexList;
typedef Eigen::Matrix<FloatingPoint, 3, 3> Triangle;
typedef std::vector<Triangle, Eigen::aligned_allocator<Triangle> >
    TriangleVector;

// Transformation type for defining sensor orientation.
typedef kindr::minimal::QuatTransformationTemplate<FloatingPoint>
    Transformation;
typedef kindr::minimal::RotationQuaternionTemplate<FloatingPoint> Rotation;

// For alignment of layers / point clouds
typedef Eigen::Matrix<FloatingPoint, 3, Eigen::Dynamic> PointsMatrix;
typedef Eigen::Matrix<FloatingPoint, 3, 3> Matrix3;

// Interpolation structure
typedef Eigen::Matrix<FloatingPoint, 8, 8> InterpTable;
typedef Eigen::Matrix<FloatingPoint, 1, 8> InterpVector;
// Type must allow negatives:
typedef Eigen::Array<IndexElement, 3, 8> InterpIndexes;

struct Color {
  Color() : r(0), g(0), b(0), a(0) {}
  Color(uint8_t _r, uint8_t _g, uint8_t _b) : Color(_r, _g, _b, 255) {}
  Color(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a)
      : r(_r), g(_g), b(_b), a(_a) {}

  uint8_t r;
  uint8_t g;
  uint8_t b;
  uint8_t a;

  static Color blendTwoColors(const Color& first_color,
                              FloatingPoint first_weight,
                              const Color& second_color,
                              FloatingPoint second_weight) {
    FloatingPoint total_weight = first_weight + second_weight;

    first_weight /= total_weight;
    second_weight /= total_weight;

    Color new_color;
    new_color.r = static_cast<uint8_t>(
        round(first_color.r * first_weight + second_color.r * second_weight));
    new_color.g = static_cast<uint8_t>(
        round(first_color.g * first_weight + second_color.g * second_weight));
    new_color.b = static_cast<uint8_t>(
        round(first_color.b * first_weight + second_color.b * second_weight));
    new_color.a = static_cast<uint8_t>(
        round(first_color.a * first_weight + second_color.a * second_weight));

    return new_color;
  }

  // Now a bunch of static colors to use! :)
  static const Color White() { return Color(255, 255, 255); }
  static const Color Black() { return Color(0, 0, 0); }
  static const Color Gray() { return Color(127, 127, 127); }
  static const Color Red() { return Color(255, 0, 0); }
  static const Color Green() { return Color(0, 255, 0); }
  static const Color Blue() { return Color(0, 0, 255); }
  static const Color Yellow() { return Color(255, 255, 0); }
  static const Color Orange() { return Color(255, 127, 0); }
  static const Color Purple() { return Color(127, 0, 255); }
  static const Color Teal() { return Color(0, 255, 255); }
  static const Color Pink() { return Color(255, 0, 127); }
};

// Grid <-> point conversion functions.

// IMPORTANT NOTE: Due the limited accuracy of the FloatingPoint type, this
// function doesn't always compute the correct grid index for coordinates
// near the grid cell boundaries.
inline AnyIndex getGridIndexFromPoint(const Point& point,
                                      const FloatingPoint grid_size_inv) {
  return AnyIndex(std::floor(point.x() * grid_size_inv),
                  std::floor(point.y() * grid_size_inv),
                  std::floor(point.z() * grid_size_inv));
}

// IMPORTANT NOTE: Due the limited accuracy of the FloatingPoint type, this
// function doesn't always compute the correct grid index for coordinates
// near the grid cell boundaries.
inline AnyIndex getGridIndexFromPoint(const Point& scaled_point) {
  return AnyIndex(std::floor(scaled_point.x()), std::floor(scaled_point.y()),
                  std::floor(scaled_point.z()));
}

inline AnyIndex getGridIndexFromOriginPoint(const Point& point,
                                            const FloatingPoint grid_size_inv) {
  return AnyIndex(std::round(point.x() * grid_size_inv),
                  std::round(point.y() * grid_size_inv),
                  std::round(point.z() * grid_size_inv));
}

inline Point getCenterPointFromGridIndex(const AnyIndex& idx,
                                         FloatingPoint grid_size) {
  return Point((static_cast<FloatingPoint>(idx.x()) + 0.5) * grid_size,
               (static_cast<FloatingPoint>(idx.y()) + 0.5) * grid_size,
               (static_cast<FloatingPoint>(idx.z()) + 0.5) * grid_size);
}

inline Point getOriginPointFromGridIndex(const AnyIndex& idx,
                                         FloatingPoint grid_size) {
  return Point(static_cast<FloatingPoint>(idx.x()) * grid_size,
               static_cast<FloatingPoint>(idx.y()) * grid_size,
               static_cast<FloatingPoint>(idx.z()) * grid_size);
}

inline BlockIndex getBlockIndexFromGlobalVoxelIndex(
    const AnyIndex& global_voxel_idx, FloatingPoint voxels_per_side_inv_) {
  return BlockIndex(
      std::floor(static_cast<FloatingPoint>(global_voxel_idx.x()) *
                 voxels_per_side_inv_),
      std::floor(static_cast<FloatingPoint>(global_voxel_idx.y()) *
                 voxels_per_side_inv_),
      std::floor(static_cast<FloatingPoint>(global_voxel_idx.z()) *
                 voxels_per_side_inv_));
}

inline VoxelIndex getLocalFromGlobalVoxelIndex(const AnyIndex& global_voxel_idx,
                                               int voxels_per_side) {
  VoxelIndex local_voxel_idx(global_voxel_idx.x() % voxels_per_side,
                             global_voxel_idx.y() % voxels_per_side,
                             global_voxel_idx.z() % voxels_per_side);

  // Make sure we're within bounds.
  for (unsigned int i = 0u; i < 3u; ++i) {
    if (local_voxel_idx(i) < 0) {
      local_voxel_idx(i) += voxels_per_side;
    }
  }

  return local_voxel_idx;
}

// Math functions.
inline int signum(FloatingPoint x) { return (x == 0) ? 0 : x < 0 ? -1 : 1; }

// For occupancy/octomap-style mapping.
inline float logOddsFromProbability(float probability) {
  DCHECK(probability >= 0.0f && probability <= 1.0f);
  return log(probability / (1.0 - probability));
}

inline float probabilityFromLogOdds(float log_odds) {
  return 1.0 - (1.0 / (1.0 + exp(log_odds)));
}

template <typename Type, typename... Arguments>
inline std::shared_ptr<Type> aligned_shared(Arguments&&... arguments) {
  typedef typename std::remove_const<Type>::type TypeNonConst;
  return std::allocate_shared<Type>(Eigen::aligned_allocator<TypeNonConst>(),
                                    std::forward<Arguments>(arguments)...);
}
}  // namespace voxblox

#endif  // VOXBLOX_FAST_CORE_COMMON_H_


text:
<?php

use Psr\Container\ContainerInterface;
use PhpParser\Parser;
use PhpSchool\LearnYouPhp\Exercise\ArrayWeGo;
use PhpSchool\LearnYouPhp\Exercise\BabySteps;
use PhpSchool\LearnYouPhp\Exercise\ConcernedAboutSeparation;
use PhpSchool\LearnYouPhp\Exercise\DatabaseRead;
use PhpSchool\LearnYouPhp\Exercise\ExceptionalCoding;
use PhpSchool\LearnYouPhp\Exercise\FilteredLs;
use PhpSchool\LearnYouPhp\Exercise\HelloWorld;
use PhpSchool\LearnYouPhp\Exercise\HttpJsonApi;
use PhpSchool\LearnYouPhp\Exercise\MyFirstIo;
use PhpSchool\LearnYouPhp\Exercise\TimeServer;
use PhpSchool\LearnYouPhp\Exercise\DependencyHeaven;
use PhpSchool\PhpWorkshop\Event\Event;
use Symfony\Component\Filesystem\Filesystem;
use Faker\Factory as FakerFactory;

use function DI\create;
use function DI\factory;

return [
    'basePath' => __DIR__ . '/../',

    //Exercises
    BabySteps::class    => create(BabySteps::class),
    HelloWorld::class   => create(HelloWorld::class),
    HttpJsonApi::class  => create(HttpJsonApi::class),
    MyFirstIo::class    => factory(function (ContainerInterface $c) {
        return new MyFirstIo($c->get(Filesystem::class), FakerFactory::create());
    }),
    FilteredLs::class   => factory(function (ContainerInterface $c) {
        return new FilteredLs($c->get(Filesystem::class));
    }),
    ConcernedAboutSeparation::class   => factory(function (ContainerInterface $c) {
        return new ConcernedAboutSeparation(
            $c->get(Filesystem::class),
            $c->get(Parser::class)
        );
    }),
    ArrayWeGo::class    => factory(function (ContainerInterface $c) {
        return new ArrayWeGo($c->get(Filesystem::class), FakerFactory::create());
    }),
    ExceptionalCoding::class => factory(function (ContainerInterface $c) {
        return new ExceptionalCoding($c->get(Filesystem::class), FakerFactory::create());
    }),
    DatabaseRead::class => factory(function (ContainerInterface $c) {
        return new DatabaseRead(FakerFactory::create());
    }),
    TimeServer::class   => factory(function (ContainerInterface $c) {
        return new TimeServer();
    }),
    DependencyHeaven::class  => factory(function (ContainerInterface $c) {
        return new DependencyHeaven(FakerFactory::create('fr_FR'));
    }),

    'eventListeners' => [
        'create-solution-for-first-exercise' => [
            'exercise.selected.hello-world' => [
                DI\value(function () {
                    if (!file_exists(getcwd() . '/hello-world.php')) {
                        touch(getcwd() . '/hello-world.php');
                    }
                })
            ]
        ]
    ]
];


text:
"use strict";

var seattlers = (function () {
  var _seattlers = [];

  for (var _iterator = countries[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
    var customers = _step.value;
    for (var _iterator2 = customers[Symbol.iterator](), _step2; !(_step2 = _iterator2.next()).done;) {
      var c = _step2.value;
      if (c.city == "Seattle") {
        _seattlers.push({ name: c.name, age: c.age });
      }
    }
  }

  return _seattlers;
})();


text:
Expense By:

Amount:

      Added on

      by

      Deleted User


text:
namespace map {

class RespawnActorMapElementSystem : public MapElementSystem
{
public:
    DEFINE_SYSTEM_BASE( RespawnActorMapElementSystem )
    RespawnActorMapElementSystem();
    static Opt<RespawnActorMapElementSystem> Get();
    void SetRespawnOnDeath( bool respawnOnDeath );
protected:
    virtual void Init();
    virtual void Update( double DeltaTime );

    void SpawnActor( Opt<RespawnActorMapElement> respawnActorMapElement );

private:
    ActorFactory& mActorFactory;
    bool mRespawnOnDeath;
};

} // namespace map

#endif//INCLUDED_MAP_RESPAWN_ACTOR_MAP_ELEMENT_SYSTEM_H

//command:  "classgenerator.exe" -g "map_element_system" -c "respawn_actor_map_element_system" -t "respawn_actor_map_element"


text:
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Command Parser Tests")]
[assembly: AssemblyDescription("Tests for the Pyratron Command Parser Framework")]
[assembly: AssemblyCompany("Pyratron Studios")]
[assembly: AssemblyProduct("Command Tests")]
[assembly: AssemblyCopyright("Copyright © 2015")]

[assembly: ComVisible(false)]

[assembly: Guid("ec03b077-6925-4571-ba49-df9371da0941")]

[assembly: AssemblyVersion("1.3")]
[assembly: AssemblyFileVersion("1.3")]


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace NieuwsbriefSubscribePost
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            Console.WriteLine("╒════════════════════════════════════════╕");
            Console.WriteLine("║       Dynamic Newsletter forms         ║");
            Console.WriteLine("║        -= Proof of Concept =-          ║");
            Console.WriteLine("╘════════════════════════════════════════╛");
            Console.WriteLine();
            Console.WriteLine();

            Uri uriResult = GetAndValidateForm();
            var formUrl   = uriResult.AbsoluteUri;

            Console.Write("Form JSON file".PadRight(17) + ": ");
            var formJson = Console.ReadLine();
            Dictionary<string, string> fieldList = JsonConvert.DeserializeObject<Dictionary<string, string>>(LoadJson(formJson).ToString());
            Console.WriteLine();

            ClearLine();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("\nCOOL! Subscribe now? [Y/N] ");

            var result = Console.ReadKey();

            while (result.Key != ConsoleKey.Y && result.Key != ConsoleKey.N)
            {
                Console.CursorLeft--;
                Console.Write('\0');
                Console.CursorLeft--;
                result = Console.ReadKey();
            }

            if (result.Key == ConsoleKey.Y)
            {
                ClearLine();
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("\nFill in the form:\n");
                Console.ForegroundColor = ConsoleColor.White;
                SubscribeToNewsLetter(fieldList, uriResult, formUrl);
            }

            Console.WriteLine("\nBye!");
            Console.ResetColor();
        }

        /// <summary>
        /// Load form JSON
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private static object LoadJson(string fileName)
        {
            StreamReader re = new StreamReader(fileName);
            JsonTextReader reader = new JsonTextReader(re);
            JsonSerializer se = new JsonSerializer();
            return se.Deserialize(reader);
        }

        /// <summary>
        /// validate form URL
        /// </summary>
        /// <returns></returns>
        private static Uri GetAndValidateForm()
        {
            Console.Write("Enter Form URL ".PadRight(17) + ": ");
            var formUrl = Console.ReadLine();
            Console.WriteLine();

            Uri uriResult;
            bool check = Uri.TryCreate(formUrl, UriKind.Absolute, out uriResult) &&
                (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);

            if (!check)
            {
                Console.WriteLine("Not a valid URL.\n");
                Environment.Exit(1);
            }
            return uriResult;
        }

        /// <summary>
        /// Subscribe to the newsletter
        /// </summary>
        /// <param name="fieldList"></param>
        /// <param name="uriResult"></param>
        /// <param name="formUrl"></param>
        private static void SubscribeToNewsLetter(Dictionary<string, string> fieldList, Uri uriResult, string formUrl)
        {
            Console.ForegroundColor = ConsoleColor.White;
            var fields = fieldList.Where(c => string.IsNullOrEmpty(c.Value)).Select(c => c.Key).ToArray();

            foreach (var field in fields)
            {
                Console.Write("" + field.PadRight(20) + ": ");
                var entry = Console.ReadLine();
                fieldList[field] = entry;
            }

            Console.WriteLine("\nSubmitting form on {0} ...\n", uriResult.Host);

            var payLoad = string.Empty;

            foreach (KeyValuePair<string, string> field in fieldList)
            {
                if (!string.IsNullOrEmpty(payLoad))
                {
                    payLoad += "&";
                }
                payLoad += field.Key + "=" + field.Value;
            }

            var array = Encoding.ASCII.GetBytes(payLoad);

            var response = PostWebForm(formUrl, array);

            PrintResponse(response);
        }

        /// <summary>
        /// Clear previous Console line
        /// </summary>
        /// <param name="position"></param>
        private static void ClearLine(int position = 0)
        {
            Console.SetCursorPosition(0, Console.CursorTop + position);
            Console.Write(new string('\0', Console.BufferWidth - (Console.CursorLeft + 1)));
            Console.SetCursorPosition(0, Console.CursorTop - 1);
        }

        /// <summary>
        /// Post the actual form
        /// </summary>
        /// <param name="url"></param>
        /// <param name="array"></param>
        /// <returns></returns>
        private static WebResponse PostWebForm(string url, byte[] array)
        {
            var request = (HttpWebRequest) WebRequest.Create(url);

            request.Method = "POST";
            request.ContentLength = array.Length;
            request.ContentType = "application/x-www-form-urlencoded";

            using (Stream postdata = request.GetRequestStream())
            {
                postdata.Write(array, 0, array.Length);
            }

            WebResponse response = request.GetResponse();
            response.Close();
            return response;
        }

        /// <summary>
        /// Print results
        /// </summary>
        /// <param name="response"></param>
        private static void PrintResponse(WebResponse response)
        {
            string hostLabel = "Hostname".PadRight(12);
            string formPathLabel = "Redirect path".PadRight(12);
            string statusLabel = "Status".PadRight(12);

            string host = ((HttpWebResponse) response).ResponseUri.Host;
            string formPath = ((HttpWebResponse) response).ResponseUri.AbsolutePath;
            HttpStatusCode statusCode = ((HttpWebResponse) response).StatusCode;
            string statusDescription = ((HttpWebResponse) response).StatusDescription;

            Console.ResetColor();
            Console.Write(hostLabel);
            Console.Write(": ");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(host);

            Console.ResetColor();
            Console.Write(formPathLabel);
            Console.Write(": ");
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(formPath);

            Console.ResetColor();
            Console.Write(statusLabel);
            Console.Write(": ");
            Console.ForegroundColor = statusCode == HttpStatusCode.OK ? ConsoleColor.Green : ConsoleColor.Red;
            Console.WriteLine(statusDescription);
            Console.WriteLine("\n");
        }
    }
}


text:
#pragma once
#include "../ac_includes.hpp"

using namespace mail_client;

namespace utils {
    /**
     * Enter the mailbox and return pointer to mail client.
     * @param host Email server host.
     * @param port Email service port.
     * @param login User login.
     * @param password User password.
     * @return Returns shared pointer to new mailbox client.
     * @throws MailClientException Thrown if something's gone wrong with
     * Mail Client.
     */
    p_MC mailboxEnter (const string& host,  const string& port,
                       const string& login, const string& password)
                      throw(MailClientException);
    /**
     * Read messages headers in a file and return their number.
     * @param mailClient Mail Client which is ready to get messages from
     * mailbox.
     * @param out Output stream which should contain headers.
     * @return Returns number of received messages.
     * @throws ios_base::failure Thrown if stream error occured.
     * @throws MailClientException Thrown if connection error or another
     * Mail Client problem ocured.
     */
    int getMessagesHeaders (const p_MC& mailClient, ostream& out);
    /**
     * Read needed command line parameters.
     * @param host Reference to email server host.
     * @param port Reference to email service port.
     * @param login User login.
     * @param password User password.
     * @return Returns EXIT_SUCCESS if no errors occured,
     * returns EXIT_FAILURE otherwise.
     */
    int getCommandLineParameters (int argumentsCount, char* arguments[],
                  string& host, string& port, string& login, string& password);
    /**
     * Complete my task: connect to server, get emails list, write it to
     * file `letters.txt' and display number of emails on display.
     * @param host Email server host.
     * @param port Email service port.
     * @param login User login.
     * @param password User password.
     * @return Returns EXIT_SUCCESS if no errors occured,
     * returns EXIT_FAILURE otherwise.
     */
    int task (const string& host,  const string& port,
              const string& login, const string& password);
}


text:
#include <srs_app_caster_flv.hpp>

#ifdef SRS_AUTO_STREAM_CASTER

#include <algorithm>
using namespace std;

#include <srs_app_config.hpp>
#include <srs_kernel_error.hpp>
#include <srs_kernel_log.hpp>
#include <srs_app_config.hpp>
#include <srs_app_pithy_print.hpp>
#include <srs_app_http_conn.hpp>
#include <srs_core_autofree.hpp>
#include <srs_kernel_flv.hpp>
#include <srs_rtmp_stack.hpp>
#include <srs_rtmp_utility.hpp>
#include <srs_app_st.hpp>
#include <srs_app_utility.hpp>
#include <srs_rtmp_amf0.hpp>
#include <srs_kernel_utility.hpp>

#define SRS_HTTP_FLV_STREAM_BUFFER 4096

SrsAppCasterFlv::SrsAppCasterFlv(SrsConfDirective* c)
{
    http_mux = new SrsHttpServeMux();
    output = _srs_config->get_stream_caster_output(c);
}

SrsAppCasterFlv::~SrsAppCasterFlv()
{
}

int SrsAppCasterFlv::initialize()
{
    int ret = ERROR_SUCCESS;

    if ((ret = http_mux->handle("/", this)) != ERROR_SUCCESS) {
        return ret;
    }

    return ret;
}

int SrsAppCasterFlv::on_tcp_client(st_netfd_t stfd)
{
    int ret = ERROR_SUCCESS;

    SrsHttpConn* conn = new SrsDynamicHttpConn(this, stfd, http_mux);
    conns.push_back(conn);

    if ((ret = conn->start()) != ERROR_SUCCESS) {
        return ret;
    }

    return ret;
}

void SrsAppCasterFlv::remove(SrsConnection* c)
{
    std::vector<SrsHttpConn*>::iterator it;
    if ((it = std::find(conns.begin(), conns.end(), c)) != conns.end()) {
        conns.erase(it);
    }
}

int SrsAppCasterFlv::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
{
    SrsHttpMessage* msg = dynamic_cast<SrsHttpMessage*>(r);
    SrsDynamicHttpConn* conn = dynamic_cast<SrsDynamicHttpConn*>(msg->connection());
    srs_assert(conn);

    std::string app = srs_path_dirname(r->path());
    app = srs_string_trim_start(app, "/");

    std::string stream = srs_path_basename(r->path());
    stream = srs_string_trim_start(stream, "/");

    std::string o = output;
    if (!app.empty() && app != "/") {
        o = srs_string_replace(o, "[app]", app);
    }
    o = srs_string_replace(o, "[stream]", stream);

    // remove the extension.
    if (srs_string_ends_with(o, ".flv")) {
        o = o.substr(0, o.length() - 4);
    }

    return conn->proxy(w, r, o);
}

SrsDynamicHttpConn::SrsDynamicHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m)
    : SrsHttpConn(cm, fd, m)
{

    req = NULL;
    io = NULL;
    client = NULL;
    stfd = NULL;
    stream_id = 0;

    pprint = SrsPithyPrint::create_caster();
}

SrsDynamicHttpConn::~SrsDynamicHttpConn()
{
    close();

    srs_freep(pprint);
}

int SrsDynamicHttpConn::on_got_http_message(ISrsHttpMessage* msg)
{
    int ret = ERROR_SUCCESS;
    return ret;
}

int SrsDynamicHttpConn::proxy(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string o)
{
    int ret = ERROR_SUCCESS;

    output = o;
    srs_trace("flv: proxy %s to %s", r->uri().c_str(), output.c_str());

    char* buffer = new char[SRS_HTTP_FLV_STREAM_BUFFER];
    SrsAutoFree(char, buffer);

    ISrsHttpResponseReader* rr = r->body_reader();
    SrsHttpFileReader reader(rr);
    SrsFlvDecoder dec;

    if ((ret = dec.initialize(&reader)) != ERROR_SUCCESS) {
        return ret;
    }

    char header[9];
    if ((ret = dec.read_header(header)) != ERROR_SUCCESS) {
        if (!srs_is_client_gracefully_close(ret)) {
            srs_error("flv: proxy flv header failed. ret=%d", ret);
        }
        return ret;
    }
    srs_trace("flv: proxy drop flv header.");

    char pps[4];
    if ((ret = dec.read_previous_tag_size(pps)) != ERROR_SUCCESS) {
        if (!srs_is_client_gracefully_close(ret)) {
            srs_error("flv: proxy flv header pps failed. ret=%d", ret);
        }
        return ret;
    }

    ret = do_proxy(rr, &dec);
    close();

    return ret;
}

int SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec)
{
    int ret = ERROR_SUCCESS;

    char pps[4];
    while (!rr->eof()) {
        pprint->elapse();

        if ((ret = connect()) != ERROR_SUCCESS) {
            return ret;
        }

        char type;
        int32_t size;
        u_int32_t time;
        if ((ret = dec->read_tag_header(&type, &size, &time)) != ERROR_SUCCESS) {
            if (!srs_is_client_gracefully_close(ret)) {
                srs_error("flv: proxy tag header failed. ret=%d", ret);
            }
            return ret;
        }

        char* data = new char[size];
        if ((ret = dec->read_tag_data(data, size)) != ERROR_SUCCESS) {
            srs_freep(data);
            if (!srs_is_client_gracefully_close(ret)) {
                srs_error("flv: proxy tag data failed. ret=%d", ret);
            }
            return ret;
        }

        if ((ret = rtmp_write_packet(type, time, data, size)) != ERROR_SUCCESS) {
            if (!srs_is_client_gracefully_close(ret)) {
                srs_error("flv: proxy rtmp packet failed. ret=%d", ret);
            }
            return ret;
        }

        if ((ret = dec->read_previous_tag_size(pps)) != ERROR_SUCCESS) {
            if (!srs_is_client_gracefully_close(ret)) {
                srs_error("flv: proxy tag header pps failed. ret=%d", ret);
            }
            return ret;
        }
    }

    return ret;
}

int SrsDynamicHttpConn::rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size)
{
    int ret = ERROR_SUCCESS;

    SrsSharedPtrMessage* msg = NULL;

    if ((ret = srs_rtmp_create_msg(type, timestamp, data, size, stream_id, &msg)) != ERROR_SUCCESS) {
        srs_error("flv: create shared ptr msg failed. ret=%d", ret);
        return ret;
    }
    srs_assert(msg);

    if (pprint->can_print()) {
        srs_trace("flv: send msg %s age=%d, dts=%"PRId64", size=%d",
                  msg->is_audio()? "A":msg->is_video()? "V":"N", pprint->age(), msg->timestamp, msg->size);
    }

    // send out encoded msg.
    if ((ret = client->send_and_free_message(msg, stream_id)) != ERROR_SUCCESS) {
        return ret;
    }

    return ret;
}

int SrsDynamicHttpConn::connect()
{
    int ret = ERROR_SUCCESS;

    // when ok, ignore.
    // TODO: FIXME: should reconnect when disconnected.
    if (io || client) {
        return ret;
    }

    // parse uri
    if (!req) {
        req = new SrsRequest();

        size_t pos = string::npos;
        string uri = req->tcUrl = output;

        // tcUrl, stream
        if ((pos = uri.rfind("/")) != string::npos) {
            req->stream = uri.substr(pos + 1);
            req->tcUrl = uri = uri.substr(0, pos);
        }

        srs_discovery_tc_url(req->tcUrl,
                             req->schema, req->host, req->vhost, req->app, req->port,
                             req->param);
    }

    // connect host.
    if ((ret = srs_socket_connect(req->host, ::atoi(req->port.c_str()), ST_UTIME_NO_TIMEOUT, &stfd)) != ERROR_SUCCESS) {
        srs_error("mpegts: connect server %s:%s failed. ret=%d", req->host.c_str(), req->port.c_str(), ret);
        return ret;
    }
    io = new SrsStSocket(stfd);
    client = new SrsRtmpClient(io);

    client->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);
    client->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US);

    // connect to vhost/app
    if ((ret = client->handshake()) != ERROR_SUCCESS) {
        srs_error("mpegts: handshake with server failed. ret=%d", ret);
        return ret;
    }
    if ((ret = connect_app(req->host, req->port)) != ERROR_SUCCESS) {
        srs_error("mpegts: connect with server failed. ret=%d", ret);
        return ret;
    }
    if ((ret = client->create_stream(stream_id)) != ERROR_SUCCESS) {
        srs_error("mpegts: connect with server failed, stream_id=%d. ret=%d", stream_id, ret);
        return ret;
    }

    // publish.
    if ((ret = client->publish(req->stream, stream_id)) != ERROR_SUCCESS) {
        srs_error("mpegts: publish failed, stream=%s, stream_id=%d. ret=%d",
                  req->stream.c_str(), stream_id, ret);
        return ret;
    }

    return ret;
}

// TODO: FIXME: refine the connect_app.
int SrsDynamicHttpConn::connect_app(string ep_server, string ep_port)
{
    int ret = ERROR_SUCCESS;

    // args of request takes the srs info.
    if (req->args == NULL) {
        req->args = SrsAmf0Any::object();
    }

    // notify server the edge identity,
    // @see https://github.com/simple-rtmp-server/srs/issues/147
    SrsAmf0Object* data = req->args;
    data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY));
    data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")"));
    data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE));
    data->set("srs_role", SrsAmf0Any::str(RTMP_SIG_SRS_ROLE));
    data->set("srs_url", SrsAmf0Any::str(RTMP_SIG_SRS_URL));
    data->set("srs_version", SrsAmf0Any::str(RTMP_SIG_SRS_VERSION));
    data->set("srs_site", SrsAmf0Any::str(RTMP_SIG_SRS_WEB));
    data->set("srs_email", SrsAmf0Any::str(RTMP_SIG_SRS_EMAIL));
    data->set("srs_copyright", SrsAmf0Any::str(RTMP_SIG_SRS_COPYRIGHT));
    data->set("srs_primary", SrsAmf0Any::str(RTMP_SIG_SRS_PRIMARY));
    data->set("srs_authors", SrsAmf0Any::str(RTMP_SIG_SRS_AUTHROS));
    // for edge to directly get the id of client.
    data->set("srs_pid", SrsAmf0Any::number(getpid()));
    data->set("srs_id", SrsAmf0Any::number(_srs_context->get_id()));

    // local ip of edge
    std::vector<std::string> ips = srs_get_local_ipv4_ips();
    assert(_srs_config->get_stats_network() < (int)ips.size());
    std::string local_ip = ips[_srs_config->get_stats_network()];
    data->set("srs_server_ip", SrsAmf0Any::str(local_ip.c_str()));

    // generate the tcUrl
    std::string param = "";
    std::string tc_url = srs_generate_tc_url(ep_server, req->vhost, req->app, ep_port, param);

    // upnode server identity will show in the connect_app of client.
    // @see https://github.com/simple-rtmp-server/srs/issues/160
    // the debug_srs_upnode is config in vhost and default to true.
    bool debug_srs_upnode = _srs_config->get_debug_srs_upnode(req->vhost);
    if ((ret = client->connect_app(req->app, tc_url, req, debug_srs_upnode)) != ERROR_SUCCESS) {
        srs_error("mpegts: connect with server failed, tcUrl=%s, dsu=%d. ret=%d",
                  tc_url.c_str(), debug_srs_upnode, ret);
        return ret;
    }

    return ret;
}

void SrsDynamicHttpConn::close()
{
    srs_freep(client);
    srs_freep(io);
    srs_freep(req);
    srs_close_stfd(stfd);
}

SrsHttpFileReader::SrsHttpFileReader(ISrsHttpResponseReader* h)
{
    http = h;
}

SrsHttpFileReader::~SrsHttpFileReader()
{
}

int SrsHttpFileReader::open(std::string /*file*/)
{
    return ERROR_SUCCESS;
}

void SrsHttpFileReader::close()
{
}

bool SrsHttpFileReader::is_open()
{
    return true;
}

int64_t SrsHttpFileReader::tellg()
{
    return 0;
}

void SrsHttpFileReader::skip(int64_t /*size*/)
{
}

int64_t SrsHttpFileReader::lseek(int64_t offset)
{
    return offset;
}

int64_t SrsHttpFileReader::filesize()
{
    return 0;
}

int SrsHttpFileReader::read(void* buf, size_t count, ssize_t* pnread)
{
    int ret = ERROR_SUCCESS;

    if (http->eof()) {
        ret = ERROR_HTTP_REQUEST_EOF;
        srs_error("flv: encoder EOF. ret=%d", ret);
        return ret;
    }

    int total_read = 0;
    while (total_read < (int)count) {
        int nread = 0;
        if ((ret = http->read((char*)buf + total_read, (int)(count - total_read), &nread)) != ERROR_SUCCESS) {
            return ret;
        }

        if (nread == 0) {
            ret = ERROR_HTTP_REQUEST_EOF;
            srs_warn("flv: encoder read EOF. ret=%d", ret);
            break;
        }

        srs_assert(nread);
        total_read += nread;
    }

    if (pnread) {
        *pnread = total_read;
    }

    return ret;
}

#endif


text:
package org.broadinstitute.sting.alignment.reference.bwt;

/**
 * Models a block of bases within the BWT.
 */
public class SequenceBlock {
    /**
     * Start position of this sequence within the BWT.
     */
    public final int sequenceStart;

    /**
     * Length of this sequence within the BWT.
     */
    public final int sequenceLength;

    /**
     * Occurrences of each letter up to this sequence block.
     */
    public final Counts occurrences;

    /**
     * Sequence for this segment.
     */
    public final byte[] sequence;

    /**
     * Create a new block within this BWT.
     * @param sequenceStart Starting position of this sequence within the BWT.
     * @param sequenceLength Length of this sequence.
     * @param occurrences How many of each base has been seen before this sequence began.
     * @param sequence The actual sequence from the BWT.
     */
    public SequenceBlock( int sequenceStart, int sequenceLength, Counts occurrences, byte[] sequence ) {
        this.sequenceStart = sequenceStart;
        this.sequenceLength = sequenceLength;
        this.occurrences = occurrences;
        this.sequence = sequence;
    }
}