text:
package org.apache.accumulo.core.client.mapred;

import java.io.IOException;
import java.util.Map.Entry;

import org.apache.accumulo.core.client.RowIterator;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.PeekingIterator;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.InputFormat;
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.RecordReader;
import org.apache.hadoop.mapred.Reporter;

/**
 * This class allows MapReduce jobs to use Accumulo as the source of data. This {@link InputFormat} provides row names as {@link Text} as keys, and a
 * corresponding {@link PeekingIterator} as a value, which in turn makes the {@link Key}/{@link Value} pairs for that row available to the Map function.
 *
 * The user must specify the following via static configurator methods:
 *
 * <ul>
 * <li>{@link AccumuloRowInputFormat#setConnectorInfo(JobConf, String, AuthenticationToken)}
 * <li>{@link AccumuloRowInputFormat#setInputTableName(JobConf, String)}
 * <li>{@link AccumuloRowInputFormat#setScanAuthorizations(JobConf, Authorizations)}
 * <li>{@link AccumuloRowInputFormat#setZooKeeperInstance(JobConf, String, String)} OR {@link AccumuloRowInputFormat#setMockInstance(JobConf, String)}
 * </ul>
 *
 * Other static methods are optional.
 */
public class AccumuloRowInputFormat extends InputFormatBase<Text,PeekingIterator<Entry<Key,Value>>> {
  @Override
  public RecordReader<Text,PeekingIterator<Entry<Key,Value>>> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException {
    log.setLevel(getLogLevel(job));
    RecordReaderBase<Text,PeekingIterator<Entry<Key,Value>>> recordReader = new RecordReaderBase<Text,PeekingIterator<Entry<Key,Value>>>() {
      RowIterator rowIterator;

      @Override
      public void initialize(InputSplit inSplit, JobConf job) throws IOException {
        super.initialize(inSplit, job);
        rowIterator = new RowIterator(scannerIterator);
      }

      @Override
      public boolean next(Text key, PeekingIterator<Entry<Key,Value>> value) throws IOException {
        if (!rowIterator.hasNext())
          return false;
        value.initialize(rowIterator.next());
        numKeysRead = rowIterator.getKVCount();
        key.set((currentKey = value.peek().getKey()).getRow());
        return true;
      }

      @Override
      public Text createKey() {
        return new Text();
      }

      @Override
      public PeekingIterator<Entry<Key,Value>> createValue() {
        return new PeekingIterator<Entry<Key,Value>>();
      }
    };
    recordReader.initialize(split, job);
    return recordReader;
  }
}


text:
<!doctype html>

<meta charset="utf-8">
<title>How I got here – Stephen Mariano Cabrera</title>

<meta name="keywords" content="about">

<meta name="twitter:title" content="How I got here">

<meta name="twitter:site" content="@stephenmarian0">
<meta name="twitter:creator" content="@stephenmarian0">

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="/images/lima-skyline_bw.jpg">

<meta property="og:locale" content="en_US">
<meta property="og:type" content="article">
<meta property="og:title" content="How I got here">

<meta property="og:url" content="/about/">
<meta property="og:site_name" content="Stephen Mariano Cabrera">

<link rel="canonical" href="/about/">
<link href="/feed.xml" type="application/atom+xml" rel="alternate" title="Stephen Mariano Cabrera Feed">

<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="/assets/css/main.css">

<meta http-equiv="cleartype" content="on">

<link href='//fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700%7CPT+Serif:400,700,400italic' rel='stylesheet' type='text/css'>

<link rel="shortcut icon" href="/favicon.ico">

<link rel="shortcut icon" href="/favicon.png">

<link rel="apple-touch-icon-precomposed" href="/images/apple-touch-icon-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/images/apple-touch-icon-72x72-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/images/apple-touch-icon-114x114-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/images/apple-touch-icon-144x144-precomposed.png">

		Stephen Mariano Cabrera

About

Projects

Blog

    Photo Credit: Wikimedia Commons

Stephen Mariano Cabrera

Software Developer

   Email
   Twitter

   LinkedIn

   Github
   Stackoverflow

How I got here

From non-profits…

In college my goal was to work in international development. I majored in economics, studied abroad in Argentina for a year and wrote an honor's thesis on the effect of economic crises on skilled migrants to the United States. After graduation I joined AmeriCorps for a year, training and managing a team of volunteers at tax preparation sites and providing organizational support for the local coalition of such sites. In 2011, I moved to Peru to work as a field researcher doing research with a non-profit Microfinance Institution  and an early childhood education program. I trained and led teams of surveyors, designed survey instruments, and cleaned/analyzed the resulting data.

…to discovering programming…

Considering doing graduate work in economics I took the GRE and took advantage of the advent of Massively Open Online Courses to prepare myself with classes on Data Analysis, calculus, linear algebra and python programming. Once I started learning programming  I was hooked, and discovered I could work remotely and have the freedom to live where I wanted while still making a difference in the world .

I took online courses in web development while while teaching English and  working in the marketing department of a travel agency. Eventually I learned enough to take on web responsibilities in my job at a travel agency doing tasks like automating the writing of SEO text with python scripts or creating a custom google analytics solution to improve tracking for sales.

I wanted to go deeper into programming, so I enrolled in an online web development apprenticeship through Bloc where I put went beyond the LAMP stack education I had pieced together and small scripts I had written and learned how to test drive writing complex database backed web applications with ruby on rails.

…to building companies

In the summer of 2015 I moved back to the U.S. and have been freelancing for startups all over the country since then. I've worked mainly with startups as a ruby on rails developer, working up and down the stack but mainly on web backends and APIs. I've worked for several clients, all startups with geographically distributed teams.

You can see find out more about my client work in projects.

When I'm not working on client work I'm studying ruby and rails resources to deepen my expertise and learning new skills like react and elixir to complement my rails toolset. I've also built some open source tools to simplify some common tasks which I've open sourced and can be found here or on my github.

To the city by the bay

In early 2017 I moved to the San Francisco bay area to work for Bright Funds, a startup with the ambitious goal of changing the way that people donate to charitable causes they care about. Since late 2018 I've been working at Canvas, a car subscription platform and wholly owned subsidiary of Ford Credit seeking to simplify and improve the way people get access to cars.

Share on

       Twitter

       Facebook

       Google+

© 2019 Stephen Mariano Cabrera. Powered by Jekyll using the Minimal Mistakes theme.

Please enable JavaScript to view the comments powered by Disqus.
comments powered by Disqus

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="5 seconds">
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>INFO</level>
        </filter>
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] [%-5level] %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

    <root level="DEBUG">
        <appender-ref ref="STDOUT" />
    </root>
</configuration>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
SelectExpressionItem
</TITLE>

<META NAME="date" CONTENT="2011-02-10">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

net.sf.jsqlparser.statement.select

Class SelectExpressionItem

java.lang.Object
  net.sf.jsqlparser.statement.select.SelectExpressionItem

All Implemented Interfaces:
SelectItem

public class SelectExpressionItem
extends java.lang.Object
implements SelectItem

An expression as in "SELECT expr1 AS EXPR"

Field Summary

private  java.lang.String
alias

private  Expression
expression

Constructor Summary

SelectExpressionItem()

Method Summary

 void
accept(SelectItemVisitor selectItemVisitor)

 java.lang.String
getAlias()

 Expression
getExpression()

 void
setAlias(java.lang.String string)

 void
setExpression(Expression expression)

 java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

expression

private Expression expression

alias

private java.lang.String alias

Constructor Detail

SelectExpressionItem

public SelectExpressionItem()

Method Detail

getAlias

public java.lang.String getAlias()

getExpression

public Expression getExpression()

setAlias

public void setAlias(java.lang.String string)

setExpression

public void setExpression(Expression expression)

accept

public void accept(SelectItemVisitor selectItemVisitor)

Specified by:
accept in interface SelectItem

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
require "hotel_beds/model"
require "hotel_beds/model/available_room"
require "hotel_beds/model/contract"
require "hotel_beds/model/destination"
require "hotel_beds/model/image"
require "hotel_beds/model/product_room"
require "hotel_beds/model/product_feature"

module HotelBeds
  module Model
    class HotelDetail
      include HotelBeds::Model

      # attributes
      attribute :code, String
      attribute :name, String
      attribute :description, String
      attribute :images, Array[HotelBeds::Model::Image]
      attribute :features, Array[HotelBeds::Model::ProductFeature]
      attribute :longitude, BigDecimal
      attribute :latitude, BigDecimal
      # attribute :available_rooms, Array[HotelBeds::Model::AvailableRoom]
      # attribute :contact, HotelBeds::Model::Contract
      attribute :destination, HotelBeds::Model::Destination
      attribute :stars, String
      attribute :chain, String
      attribute :product_rooms, Array[HotelBeds::Model::ProductRoom]

    end
  end
end


text:
namespace xwalk {
namespace application {

typedef std::map<std::string, std::string> TizenAppWidgetLabelLangValueMap;

struct TizenAppWidgetLabel {
  // may be empty
  std::string default_value;

  // may be empty if default is set
  TizenAppWidgetLabelLangValueMap lang_value_map;
};

enum TizenAppWidgetSizeType {
  k1x1, k2x1, k2x2
};

struct TizenAppWidgetSize {
  // mandatory
  TizenAppWidgetSizeType type;

  // optional, relative to web app directory
  std::string preview;

  // optional, default: true
  bool use_decoration;
};

typedef std::vector<TizenAppWidgetSize> TizenAppWidgetSizeVector;

struct TizenAppWidgetDropView {
  // mandatory, relative to web app directory or remote URL
  std::string src;

  // mandatory
  int width;

  // mandatory, <1, 380>
  int height;
};

typedef std::vector<TizenAppWidgetDropView> TizenAppWidgetDropViewVector;

struct TizenAppWidget {
  // mandatory, unique, must start with application id and end with label
  // separated with dot, the label can contain only 0-9, a-z, A-Z
  std::string id;

  // mandatory, only one may contain true
  bool primary;

  // optional(0-1), min: 1800.0, default: no update
  std::vector<double> update_period;

  // optional, default: false
  bool auto_launch;

  // box label, multiple(1+)
  TizenAppWidgetLabel label;

  // box icon, optional(0-1), src, mandatory, relative to web app directory
  std::string icon_src;

  // box content, mandatory(1) -[

  // mandatory, relative to web app directory or remote URL
  std::string content_src;

  // optional, default: false
  bool content_mouse_event;

  // optional, default: true
  bool content_touch_effect;

  // box size, mandatory(1-3), 1x1 must exist
  TizenAppWidgetSizeVector content_size;

  // drop view, optional(0-1)
  TizenAppWidgetDropViewVector content_drop_view;

  // ]- box content
};

typedef std::vector<TizenAppWidget> TizenAppWidgetVector;

class TizenAppWidgetInfo : public ApplicationData::ManifestData {
 public:
  explicit TizenAppWidgetInfo(const TizenAppWidgetVector& app_widgets);
  virtual ~TizenAppWidgetInfo();

  const TizenAppWidgetVector& app_widgets() const {
    return app_widgets_;
  }

 private:
  // multiple(0+)
  TizenAppWidgetVector app_widgets_;
};

class TizenAppWidgetHandler : public ManifestHandler {
 public:
  TizenAppWidgetHandler();
  virtual ~TizenAppWidgetHandler();

  bool Parse(scoped_refptr<ApplicationData> application,
             base::string16* error) override;
  bool Validate(scoped_refptr<const ApplicationData> application,
                std::string* error) const override;
  std::vector<std::string> Keys() const override;

 private:
  DISALLOW_COPY_AND_ASSIGN(TizenAppWidgetHandler);
};

}  // namespace application
}  // namespace xwalk

#endif  // XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_TIZEN_APPWIDGET_HANDLER_H_


text:
using namespace arangodb;
using namespace arangodb::basics;
using namespace arangodb::options;

////////////////////////////////////////////////////////////////////////////////
/// @brief portably and safely reads a number
////////////////////////////////////////////////////////////////////////////////

namespace {

template <typename T>
static inline T readNumber(uint8_t const* source, uint32_t length) {
  T value = 0;
  uint64_t x = 0;
  uint8_t const* end = source + length;
  do {
    value += static_cast<T>(*source++) << x;
    x += 8;
  } while (source < end);
  return value;
}

static std::string convertFromHex(std::string const& value) {
  std::string result;
  result.reserve(value.size());

  size_t const n = value.size();
  int prev = -1;

  for (size_t i = 0; i < n; ++i) {
    int current;

    if (value[i] >= '0' && value[i] <= '9') {
      current = value[i] - '0';
    } else if (value[i] >= 'a' && value[i] <= 'f') {
      current = 10 + (value[i] - 'a');
    } else if (value[i] >= 'A' && value[i] <= 'F') {
      current = 10 + (value[i] - 'A');
    } else {
      prev = -1;
      continue;
    }

    if (prev == -1) {
      // first part of two-byte sequence
      prev = current;
    } else {
      // second part of two-byte sequence
      result.push_back(static_cast<unsigned char>((prev << 4) + current));
      prev = -1;
    }
  }

  return result;
}

// custom type value handler, used for deciphering the _id attribute
struct CustomTypeHandler : public VPackCustomTypeHandler {
  CustomTypeHandler() = default;
  ~CustomTypeHandler() = default;

  void dump(VPackSlice const& value, VPackDumper* dumper, VPackSlice const& base) override final {
    dumper->appendString(toString(value, nullptr, base));
  }

  std::string toString(VPackSlice const& value, VPackOptions const* options,
                       VPackSlice const& base) override final {
    uint64_t cid = ::readNumber<uint64_t>(value.begin() + 1, sizeof(uint64_t));
    return "collection id " + std::to_string(cid);
  }
};

}  // namespace

VPackFeature::VPackFeature(application_features::ApplicationServer& server, int* result)
    : ApplicationFeature(server, "VPack"),
      _result(result),
      _prettyPrint(true),
      _jsonInput(false),
      _hexInput(false),
      _printNonJson(true) {
  requiresElevatedPrivileges(false);
  setOptional(false);
}

void VPackFeature::collectOptions(std::shared_ptr<options::ProgramOptions> options) {
  options->addOption("--input-file", "input filename", new StringParameter(&_inputFile));
  options->addOption("--output-file", "output filename", new StringParameter(&_outputFile));
  options->addOption("--pretty", "pretty print result", new BooleanParameter(&_prettyPrint));
  options->addOption("--hex", "read hex-encoded input", new BooleanParameter(&_hexInput));
  options->addOption("--json", "treat input as JSON", new BooleanParameter(&_jsonInput));
  options->addOption("--print-non-json", "print non-JSON types",
                     new BooleanParameter(&_printNonJson));
}

void VPackFeature::start() {
  *_result = EXIT_SUCCESS;

  bool toStdOut = false;
#ifdef __linux__
  // treat "-" as stdin. quick hack for linux
  if (_inputFile.empty() || _inputFile == "-") {
    _inputFile = "/proc/self/fd/0";
  }

  // treat missing outfile as stdout
  if (_outputFile.empty() || _outputFile == "+") {
    _outputFile = "/proc/self/fd/1";
    toStdOut = true;
  }
#endif

  std::string s = basics::FileUtils::slurp(_inputFile);

  if (_hexInput) {
    s = ::convertFromHex(s);
  }

  ::CustomTypeHandler customTypeHandler;

  VPackOptions options;
  options.prettyPrint = _prettyPrint;
  options.unsupportedTypeBehavior =
      (_printNonJson ? VPackOptions::ConvertUnsupportedType : VPackOptions::FailOnUnsupportedType);
  options.customTypeHandler = &customTypeHandler;

  VPackSlice slice;
  std::shared_ptr<VPackBuilder> builder;

  if (_jsonInput) {
    try {
      builder = VPackParser::fromJson(s);
      slice = builder->slice();
    } catch (std::exception const& ex) {
      LOG_TOPIC("d654d", ERR, Logger::FIXME)
          << "invalid JSON input while processing infile '" << _inputFile
          << "': " << ex.what();
      *_result = TRI_ERROR_INTERNAL;
      return;
    }
  } else {
    try {
      VPackValidator validator(&options);
      validator.validate(s.c_str(), s.size(), false);
    } catch (std::exception const& ex) {
      LOG_TOPIC("4c05d", ERR, Logger::FIXME)
          << "invalid VPack input while processing infile '" << _inputFile
          << "': " << ex.what();
      *_result = TRI_ERROR_INTERNAL;
      return;
    }

    slice = VPackSlice(reinterpret_cast<uint8_t const*>(s.data()));
  }

  VPackBuffer<char> buffer(4096);
  VPackCharBufferSink sink(&buffer);
  VPackDumper dumper(&sink, &options);

  try {
    dumper.dump(slice);
  } catch (std::exception const& ex) {
    LOG_TOPIC("ed2fb", ERR, Logger::FIXME)
        << "caught exception while processing infile '" << _inputFile
        << "': " << ex.what();
    *_result = TRI_ERROR_INTERNAL;
    return;
  } catch (...) {
    LOG_TOPIC("29ad4", ERR, Logger::FIXME)
        << "caught unknown exception occurred while processing infile '"
        << _inputFile << "'";
    *_result = TRI_ERROR_INTERNAL;
    return;
  }

  std::ofstream ofs(_outputFile, std::ofstream::out);

  if (!ofs.is_open()) {
    LOG_TOPIC("bb8a7", ERR, Logger::FIXME) << "cannot write outfile '" << _outputFile << "'";
    *_result = TRI_ERROR_INTERNAL;
    return;
  }

  // reset stream
  // cppcheck-suppress *
  if (!toStdOut) {
    ofs.seekp(0);
  }

  // write into stream
  char const* start = buffer.data();
  ofs.write(start, buffer.size());
  ofs.close();

  // cppcheck-suppress *
  if (!toStdOut) {
    LOG_TOPIC("0a90f", INFO, Logger::FIXME)
        << "successfully processed infile '" << _inputFile << "'";
    LOG_TOPIC("1f88b", INFO, Logger::FIXME) << "infile size: " << s.size();
    LOG_TOPIC("7c311", INFO, Logger::FIXME) << "outfile size: " << buffer.size();
  }

  *_result = TRI_ERROR_NO_ERROR;
}


text:
package com.example.applock.widget;

/**
 * Created by 我的 on 2017/8/29.
 */

public class LockPatternViewPattern implements LockPatternView.OnPatternListener {
}


text:
<?php

namespace denbora\R_T_G_Services\services\RESTv3;

use denbora\R_T_G_Services\helpers\UrlHelper;
use denbora\R_T_G_Services\R_T_G_ServiceException;
use denbora\R_T_G_Services\responses\RestResponse;
use denbora\R_T_G_Services\entity\RestEntity;
use denbora\R_T_G_Services\services\REST\RestService;
use denbora\R_T_G_Services\validators\ValidatorInterface;

abstract class RestV3Service extends RestService implements RestV3ServiceInterface
{
    const METHOD_V3_PATH = __DIR__ . '/../../config/restMethodsV3.json';

    /**
     * @var array with service methods
     */
    private $restMethods;

    public function __construct(
        string $certificate,
        string $key,
        string $password,
        ValidatorInterface $validator,
        RestResponse $response,
        string $baseUrl,
        string $apiKey,
        $options = []
    ) {
        $this->restMethods = json_decode(file_get_contents(self::METHOD_V3_PATH), true);
        parent::__construct($certificate, $key, $password, $validator, $response, $baseUrl, $apiKey, $options);
    }

    /**
     * @param string $service
     * @param string $method
     * @param string $queryJSON
     * @return array|mixed|object|string
     * @throws R_T_G_ServiceException
     */
    protected function callMethod(string $service, string $method, string $queryJSON = '{}')
    {
        $methodData = $this->getMethodData($service, $method);

        $restEntity = RestEntity::getInstance()
            ->hydrate($methodData)
            ->setQuery(json_decode($queryJSON, true));

        list($url, $query) = UrlHelper::createFullUrl(
            $this->baseUrl,
            $restEntity->getPathTemplate(),
            $restEntity->getQuery(),
            $this->getKeyForQueryParameters($restEntity->getParameters())
        );

        $restEntity->setUrl($url);
        $restEntity->setQuery($query);

        return $this->sendRequest($restEntity);
    }

    /**
     * @param string $service
     * @param string $method
     * @return array
     * @throws R_T_G_ServiceException
     */
    private function getMethodData(string $service, string $method): array
    {
        if (!isset($this->restMethods[$service])) {
            throw new R_T_G_ServiceException('Service not found');
        }

        if (!isset($this->restMethods[$service][$method])) {
            throw new R_T_G_ServiceException(
                'Service: "' . $service . '" does not contain the "' . $method . '" method'
            );
        }

        return $this->restMethods[$service][$method];
    }

    /**
     * @param array $methodParameters
     * @return array
     */
    private function getKeyForQueryParameters(array $methodParameters): array
    {
        foreach ($methodParameters as $parameterKey => $parameter) {
            if (isset($parameter['parameterType']) && $parameter['parameterType'] == 'query') {
                $queryParameters[] = $parameterKey;
            }
        }

        return $queryParameters ?? [];
    }

    /**
     * @param RestEntity $restEntity
     * @return array|mixed|object|string
     * @throws R_T_G_ServiceException
     */
    protected function sendRequest(RestEntity $restEntity)
    {
        $httpMethod = strtolower($restEntity->getHttpMethod());

        return $this->$httpMethod($restEntity->getUrl(), json_encode($restEntity->getQuery()));
    }
}


text:
<?php

namespace CrEOF\Spatial\PHP\Types\Geometry;

use CrEOF\Spatial\PHP\Types\AbstractPolygon;

/**
 * Polygon object for POLYGON geometry type
 *
 * @author  Derek J. Lambert <dlambert@dereklambert.com>
 * @license http://dlambert.mit-license.org MIT
 */
class Polygon extends AbstractPolygon
{

}


text:
package com.phoenixnap.oss.ramlplugin.raml2code.github;

import org.junit.Test;

import com.phoenixnap.oss.ramlplugin.raml2code.rules.GitHubAbstractRuleTestBase;
import com.phoenixnap.oss.ramlplugin.raml2code.rules.Spring4ControllerInterfaceRule;

/**
 * @author yuranos
 * @since 0.10.13
 */
public class Issue212RulesTest extends GitHubAbstractRuleTestBase {

	@Test
	public void testWithLongRootUrl() throws Exception {
		loadRaml("issue-212-1.raml");
		rule = new Spring4ControllerInterfaceRule();
		rule.apply(getControllerMetadata(), jCodeModel);
		verifyGeneratedCode("Issue212-1-pathvariablesnaming");
	}

	@Test
	public void testWithMatchingResourseNameAndPathVariable() throws Exception {
		loadRaml("issue-212-2.raml");
		rule = new Spring4ControllerInterfaceRule();
		rule.apply(getControllerMetadata(), jCodeModel);
		verifyGeneratedCode("Issue212-2-pathvariablesnaming");
	}

	@Test
	public void testWithNonmatchingResourseNameAndPathVariable() throws Exception {
		loadRaml("issue-212-3.raml");
		rule = new Spring4ControllerInterfaceRule();
		rule.apply(getControllerMetadata(), jCodeModel);
		verifyGeneratedCode("Issue212-3-pathvariablesnaming");
	}

}


text:
'use strict'
angular.module('magApp').controller('processRunsCtrl',
                                    ['$scope', '$location', '$state', 'Collection', 'Process', '$http', '$q',
                                    function($scope, $location, $state, Collection, Process, $http, $q) {

    $scope.graphId = $state.params.graph_id;
    var graph = $scope.graph = new dagreD3.graphlib.Graph().setGraph({});
    var allNodes = {};
    var aggregationMap = $scope.aggregationMap = {};
    var aggregationsByLength = {};
    var reverseAggregationMap = {};  // nodeIdx -> aggregated node.s
    var aggregationCounter = 0;

    var processId = $location.search().processId;
    $scope.loadingShown = false;
    $scope.tipShown = false;
    $scope.processRuns = new Collection('/api/graphs/' + $scope.graphId + '/process_runs/');
    $scope.processRuns.filter({'processId': processId});

    var labelForNode = function(node) {
        if (!node.name && node.index) {
            return node.label + ' #' + node.index;
        }
        return node.label;
    }

    var addAggregation = function(node, aggregation) {
        aggregationMap[node.id] = aggregation;
        var byLength = aggregationsByLength[aggregation.length] || [];
        byLength.push(node.id);
        aggregationsByLength[aggregation.length] = byLength;
        aggregation.forEach(function(n) {
            reverseAggregationMap[n.id] = node;
        });
    };

    var removeAggregation = function(node) {
        var aggregation = aggregationMap[node.id];
        delete aggregationMap[node.id];

        aggregation.forEach(function(node) {
            delete reverseAggregationMap[node.id];
        });
        var byLength = aggregationsByLength[aggregation.length];
        var idx = byLength.indexOf(node.id);
        if (idx > -1) {
            byLength[idx] = byLength[byLength.length - 1];
            byLength.pop();
        };
    };

    var groupArtifacts = function(nodesIds, collection) {
        var deferred = $q.defer();
        var groups = [];
        $http.post('/api/graphs/' + $scope.graphId + '/artifacts/', {nodes: nodesIds})
        .then(function(response){
            for (var key in response.data) {
                var runsAggregate = {};
                var data = response.data[key];
                if (!allNodes[data.id]) {
                    allNodes[data.id] = data;
                } else {
                    var that = allNodes[data.id];
                    that.inputs = data.inputs;
                    that.outputs = data.outputs;
                    if (reverseAggregationMap[that.id]) continue;

                    data = that;
                }
                data.outputs.forEach(function(element) {
                    var label = 'artifact';
                    if (element.type == 'process_run') label = element.label;
                    if (!runsAggregate[label]) runsAggregate[label] = 0;
                    ++runsAggregate[label];
                });
                var match = false;
                var rightKeys = Object.keys(runsAggregate);

                for (var idx in groups) {
                    var group = groups[idx];
                    var leftKeys = Object.keys(group.key);
                    var matchesLeft = leftKeys
                    .map(function(key) { return group.key[key] == runsAggregate[key]; })
                    .indexOf(true);

                    var matchesRight = rightKeys
                    .map(function(key) { return group.key[key] == runsAggregate[key]; })
                    .indexOf(true);

                    if (matchesLeft >= 0 && matchesRight >= 0 || (leftKeys.length == rightKeys.length && rightKeys.length == 0)) {
                        match = true;
                        group.objects.push(data);
                    }
                }

                if (!match) {
                    groups.push({
                        key: runsAggregate,
                        objects: [data],
                    })
                }
            }
            groups.forEach(function(group) {
                var valueObj = {};
                group.objects.forEach(function(el) {
                    valueObj[el.id] = el;
                });
                var found = false;
                var byLength = (aggregationsByLength[group.objects.length] || []);
                for (var i in byLength) {
                    var id = byLength[i];
                    var aggregation = aggregationMap[id];
                    var ok = true;
                    for (var j in aggregation) {
                        var jValue = aggregation[j];
                        var otherObj = valueObj[jValue.id];
                        if (otherObj === undefined) {
                            ok = false;
                            break;
                        };
                    };
                    if (ok) {
                        found = true;
                        collection.push({
                            id: id,
                            label: allNodes[id].label,
                            type: 'artifact',
                        });
                        break;
                    }
                };
                if (found) return;
                if (group.objects.length > 1) {
                    collection.push({
                        id: 'aggregate' + ++aggregationCounter,
                        label: 'Artifacts aggregate #' + aggregationCounter + ' (' + group.objects.length + ' nodes)',
                        type: 'artifact',
                        name: 'Artifacts aggregate #' + aggregationCounter,
                        isAggregate: true,
                        shape: 'aggregate',
                        paddingRight: 22,
                        paddingTop: 22,
                    });
                } else {
                    collection.push(group.objects[0]);
                };
                if (group.objects.length != 1) {
                    addAggregation(collection[collection.length - 1], group.objects);
                };
            });
            deferred.resolve(groups);
        });
        return deferred.promise;
    }
    var fetchAndProcess = function(url, nodesIds, rootId) {
        $scope.loadingShown = true;
        $http.post(url, {nodes: nodesIds})
        .then(function(response) {
            var outputsMap = {};
            var outputs = [];
            var outputArtifacts = [];
            var inputs = [];
            var inputsMap = {};
            var inputArtifacts = [];
            if (allNodes[rootId] && allNodes[rootId].added) {
                return;
            }

            for (var key in response.data) {
                var data = response.data[key];
                if (data.index !== null) {
                    data.name = data.label;
                    data.label += ' #' + data.index;
                }
                if (!allNodes[data.id]) {
                    allNodes[data.id] = data;
                } else {
                    var that = allNodes[data.id];
                    that.inputs = data.inputs;
                    that.outputs = data.outputs;
                    data = that;
                }
                var node = data;
                if (rootId == node.id) {
                    graph.setNode(node.id, node);
                    reverseAggregationMap[node.id] = node;
                };

                node = allNodes[rootId];
                if (!node) {
                    allNodes[rootId] = node = {label: rootId, type: data.type};
                    graph.setNode(rootId, node);
                    reverseAggregationMap[data.id] = node;
                };
                node.added = true;
                node.style = 'fill: green';
                (aggregationMap[node.id] || []).forEach(function(node) {
                    node = allNodes[node.id];
                    node.added = true;
                    node.style = 'fill: green';
                });

                data.inputs.forEach(function(input) {
                    if (input.type == 'artifact') {
                        inputArtifacts.push(input.id);
                    } else {
                        if (reverseAggregationMap[input.id]) {
                            inputs.push(reverseAggregationMap[input.id]);
                            return;
                        };

                        if (!inputsMap[input.label]) {
                            inputsMap[input.label] = [];
                        };
                        inputsMap[input.label].push(input);
                    }
                });

                data.outputs.forEach(function(output) {
                    if (output.type == 'artifact') {
                        outputArtifacts.push(output.id);
                    } else {
                        if (reverseAggregationMap[output.id]) {
                            outputs.push(reverseAggregationMap[output.id]);
                            return;
                        };

                        if (!outputsMap[output.label]) {
                            outputsMap[output.label] = [];
                        };
                        outputsMap[output.label].push(output);
                    }
                });
            }

            var aggregateMap = function(map, collection) {
                for (var key in map) {
                    var value = map[key];
                    var valueObj = {};
                    value.forEach(function(el) {
                        valueObj[el.id] = el;
                    });
                    value = Object.keys(valueObj).map(function(key) {
                        return valueObj[key];
                    });
                    var found = false;
                    var byLength = (aggregationsByLength[value.length] || []);
                    for (var i in byLength) {
                        var id = byLength[i];
                        var aggregation = aggregationMap[id];
                        var ok = true;
                        for (var j in aggregation) {
                            var jValue = aggregation[j];
                            var otherObj = valueObj[jValue.id];
                            if (otherObj === undefined) {
                                ok = false;
                                break;
                            };
                        };
                        if (ok) {
                            found = true;
                            collection.push({
                                id: id,
                                label: allNodes[id].label,
                            });
                            break;
                        }
                    };
                    if (found) continue;
                    if (value.length > 1) {
                        collection.push({
                            id: 'aggregate' + ++aggregationCounter,
                            label: value[0].label + ' aggregate #' + aggregationCounter + ' (' + value.length + ' nodes)',
                            isAggregate: true,
                            shape: 'aggregate',
                            name: value[0].label + ' aggregate #' + aggregationCounter,
                            paddingRight: 22,
                            paddingTop: 22,
                        });
                        value.sort(function(a, b) { return a.index - b.index; });
                    } else {
                        collection.push(value[0]);
                    };

                    addAggregation(collection[collection.length - 1], value);
                };
            };
            aggregateMap(inputsMap, inputs);
            aggregateMap(outputsMap, outputs);

            var flat = function(obj) {
                var values = Object.keys(obj).map(function(key) { return obj[key]; });
                var result = [];
                return result.concat.apply(result, values).map(function(el) { return el.id; });
            }
            var ns = flat(inputsMap).concat(flat(outputsMap));
            return $http.post('/api/graphs/' + $scope.graphId + '/process_runs/', {nodes: ns})
            .then(function(response) {
                for (var key in response.data) {
                    var node = response.data[key];
                    if (!allNodes[node.id]) {
                        allNodes[node.id] = node;
                    } else {
                        var thatNode = allNodes[node.id];
                        thatNode.inputs = node.inputs;
                        thatNode.outputs = node.outputs;
                    };
                };
            })
            .then(function() { return groupArtifacts(inputArtifacts, inputs); })
            .then(function() { return groupArtifacts(outputArtifacts, outputs); })
            .then(function() {
                var processInputOutput = function (reverseEdge) {
                    return function(item) {
                        if (!allNodes[item.id]) {
                            allNodes[item.id] = item;
                        } else {
                            item = allNodes[item.id];
                        }

                        if (!item.name && item.index) {
                            item.name = item.label;
                            item.label += ' #' + item.index;
                        }

                        if (reverseEdge) {
                            var source = rootId;
                            var target = item.id;
                        } else {
                            var source = item.id;
                            var target = rootId;
                        }

                        if (!graph.node(item.id)) {
                            graph.setNode(item.id, item);
                            if (item.id)
                                reverseAggregationMap[item.id] = item;
                            else {
                                (aggregationMap[item.id] || []).forEach(function(node) {
                                    reverseAggregationMap[node.id] = item;
                                });
                            };
                        };

                        graph.setEdge(source, target, {minlen: 2});
                    };
                };

                inputs.forEach(processInputOutput(false));
                outputs.forEach(processInputOutput(true));

                $scope.processRunsGraphAccessor.render(graph);
                if ($scope.selectedNode) {
                    $scope.selectedNode.elem.classList.add('selected');
                };
            });
        })
        .then(function() { $scope.loadingShown = false; });
    };
    $scope.selectedNodeName = null;
    $scope.selectedNode = null;
    $scope.processRunsGraphAccessor = {
        nodeClicked: function(nodeId) {
            if ($scope.selectedNode && nodeId == $scope.selectedNode.id) {
                var node = allNodes[nodeId];
                if (node && node.type == 'artifact') {
                    var ids = (aggregationMap[nodeId] || [node]).map(function(node) {
                        return node.id;
                    });
                    fetchAndProcess(
                        '/api/graphs/' + $scope.graphId + '/artifacts/',
                        ids,
                        nodeId
                    );
                } else if (node) {
                    var ids = (aggregationMap[nodeId] || [node]).map(function(node) {
                        return node.id;
                    });
                    fetchAndProcess(
                        '/api/graphs/' + $scope.graphId + '/process_runs/',
                        ids,
                        nodeId
                    );
                }
            } else {
                if ($scope.selectedNode) {
                    $scope.selectedNode.elem.classList.remove('selected');
                }
                var node = allNodes[nodeId];
                $scope.selectedNode = node;
                node.elem.classList.add('selected');
            }
        },
    };
    $scope.selectedProcessRun = null;
    $scope.selectProcessRun = function(processRun) {
        $scope.tipShown = false;
        if (processRun.added) return;

        fetchAndProcess(
            '/api/graphs/' + $scope.graphId + '/process_runs/',
            [processRun.id],
            processRun.id
        );
    };

    $scope.splitNode = function(nodeToSplit, aggregationNode, render, cascade) {
        $scope.loadingShown = true;
        splitNode(nodeToSplit, aggregationNode, render, cascade);
        $scope.loadingShown = false;
    };

    var splitNode = function(nodeToSplit, aggregationNode, render, cascade) {
        render = render == true || render == undefined;
        cascade = cascade == true || cascade == undefined;
        if (render) $scope.loadingShown = true;
        var idx = -1;
        var aggregation = aggregationMap[aggregationNode.id];
        if (!aggregation) return;

        // Remove node from aggregation list.
        for (idx in aggregation) {
            if (aggregation[idx].id == nodeToSplit.id) break;
        };

        if (idx > -1) {
            removeAggregation(aggregationNode);
            aggregation.splice(idx, 1);
            delete allNodes[aggregationNode.id];

            if (aggregation.length) {
                addAggregation(aggregationNode, aggregation);
                aggregationNode.label = aggregationNode.name + ' (' + aggregation.length + ' nodes)';
                allNodes[aggregationNode.id] = aggregationNode;

                if (aggregation.length == 1) {
                    splitNode(aggregation[0], aggregationNode, false, cascade);
                }
            } else {
                graph.removeNode(aggregationNode.id);
                if ($scope.selectedNode == aggregationNode)
                    $scope.selectedNode = null;
            }
        }

        if (!nodeToSplit.name && nodeToSplit.index) {
            nodeToSplit.name = nodeToSplit.label;
            nodeToSplit.label += ' #' + nodeToSplit.index;
        };

        if (graph.node(nodeToSplit.id))
            return;

        var node = allNodes[nodeToSplit.id];
        if (!node) {
            node = allNodes[nodeToSplit.id] = nodeToSplit;
        } else {
            node.label = nodeToSplit.label;
            node.added = aggregationNode.added;
            if (node.added) node.style = 'fill: green';
        }
        reverseAggregationMap[node.id] = node;
        graph.setNode(node.id, node);

        node.inputs.forEach(function(input) {
            if (!reverseAggregationMap[input.id]) return;
            input = allNodes[input.id] || {id: input.id};
            if (node.added || (input.added && cascade)) {
                splitNode(input, reverseAggregationMap[input.id], false, false)
                input = allNodes[input.id];
                graph.setEdge(input.id, node.id, {minlen: 2});
            };
        });
        node.outputs.forEach(function(output) {
            if (!reverseAggregationMap[output.id]) return;
            output = allNodes[output.id] || {id: output.id};
            if (node.added || (output.added && cascade)) {
                splitNode(output, reverseAggregationMap[output.id], false, false)
                output = allNodes[output.id];
                graph.setEdge(node.id, output.id, {minlen: 2});
            };
        });

        if (render) {
            $scope.processRunsGraphAccessor.render(graph);
            if ($scope.selectedNode) {
                $scope.selectedNode.elem.classList.add('selected');
            };
        };
    };

    $scope
    .processRuns
    .fetch()
    .then(function() {
        if ($scope.processRuns.objects.length === 1) {
            $scope.selectProcessRun($scope.processRuns.objects[0]);
        } else {
            $scope.tipShown = true;
        }
    });

    $scope.searchRuns = _.debounce(function(query) {
        $scope.processRuns.filter({'q': query});
        $scope.processRuns.fetch();
    }, 300);
}]);


text:
package test.entity;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_FIELD", "NP_BOOLEAN_RETURN_NULL"})
public class Address {

    @Id
    @GeneratedValue
    private long id;
    private String city;

}


text:
<?php
namespace cs\App\Router {
	// Stub for trait
	trait CLI {
		protected function print_cli_structure ($path) {
			var_dump("cs\\App\\Router\\CLI::print_cli_structure('$path') called");
		}
	}
}
namespace cs {
	include __DIR__.'/../../unit.php';
	define('MODULES', __DIR__.'/modules');

	class App_test extends App {
		public static function test () {
			$Request = Request::instance_stub(
				[
					'method'         => 'GET',
					'cli_path'       => false,
					'api_path'       => false,
					'admin_path'     => false,
					'current_module' => 'Module_with_files_routing'
				]
			);
			Response::instance_stub(
				[],
				[
					'header' => function (...$arguments) {
						var_dump("cs\\Response::header() called with", $arguments);
					}
				]
			);

			var_dump('Regular page request');
			$Router                    = new self;
			$Router->working_directory = $Router->get_working_directory($Request);
			$Router->controller_path   = [
				'index',
				'level10',
				'level21',
				'level30'
			];
			$Router->files_router($Request);

			var_dump('Admin page request');
			$Request->admin_path       = true;
			$Router                    = new self;
			$Router->working_directory = $Router->get_working_directory($Request);
			$Router->controller_path   = [
				'index',
				'level10',
				'level21',
				'level30'
			];
			$Router->files_router($Request);

			var_dump('API request (GET, method exists)');
			$Request->admin_path       = false;
			$Request->api_path         = true;
			$Router->working_directory = $Router->get_working_directory($Request);
			$Router->files_router($Request);

			var_dump('API request (PUT, method does not exists)');
			$Request->method = 'PUT';
			try {
				$Router->files_router($Request);
			} catch (ExitException $e) {
				var_dump($e->getCode());
			}

			var_dump('API request (OPTIONS, method does not exists)');
			$Request->method = 'OPTIONS';
			try {
				$Router->files_router($Request);
			} catch (ExitException $e) {
				var_dump($e->getCode());
			}

			var_dump('CLI request (GET, method exists)');
			$Request->api_path         = false;
			$Request->cli_path         = true;
			$Request->method           = 'GET';
			$Router->working_directory = $Router->get_working_directory($Request);
			$Router->files_router($Request);

			var_dump('CLI request (PUT, method does not exists)');
			$Request->method = 'PUT';
			try {
				$Router->files_router($Request);
			} catch (ExitException $e) {
				var_dump($e->getCode());
			}

			var_dump('CLI request (CLI, method does not exists)');
			$Request->method = 'CLI';
			try {
				$Router->files_router($Request);
			} catch (ExitException $e) {
				var_dump($e->getCode());
			}

			var_dump('API request (PUT, method does not exists, but exists OPTIONS)');
			$Request->cli_path         = false;
			$Request->api_path         = true;
			$Request->method           = 'PUT';
			$Router->working_directory = $Router->get_working_directory($Request);
			$Router->controller_path   = [
				'index',
				'level11'
			];
			try {
				$Router->files_router($Request);
			} catch (ExitException $e) {
				var_dump($e->getCode());
			}

			var_dump('CLI request (PUT, method does not exists, but exists CLI)');
			$Request->api_path         = false;
			$Request->cli_path         = true;
			$Router->working_directory = $Router->get_working_directory($Request);
			try {
				$Router->files_router($Request);
			} catch (ExitException $e) {
				var_dump($e->getCode());
			}
		}
	}
	App_test::test();
}
?>
--EXPECTF--
string(20) "Regular page request"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/level10.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/level10/level21.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/level10/level21/level30.php"
string(18) "Admin page request"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/admin/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/admin/level10.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/admin/level10/level21.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/admin/level10/level21/level30.php"
string(32) "API request (GET, method exists)"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/index.get.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/level10.get.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/level10/level21.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/level10/level21/level30.get.php"
string(41) "API request (PUT, method does not exists)"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/level10/level21.php"
string(33) "cs\Response::header() called with"
array(2) {
  [0]=>
  string(5) "Allow"
  [1]=>
  string(9) "GET, POST"
}
int(501)
string(45) "API request (OPTIONS, method does not exists)"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/level10/level21.php"
string(33) "cs\Response::header() called with"
array(2) {
  [0]=>
  string(5) "Allow"
  [1]=>
  string(9) "GET, POST"
}
string(32) "CLI request (GET, method exists)"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/index.get.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/level10.get.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/level10/level21.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/level10/level21/level30.get.php"
string(41) "CLI request (PUT, method does not exists)"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/level10/level21.php"
string(49) "cs\App\Router\CLI::print_cli_structure('') called"
int(501)
string(41) "CLI request (CLI, method does not exists)"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/level10/level21.php"
string(49) "cs\App\Router\CLI::print_cli_structure('') called"
string(61) "API request (PUT, method does not exists, but exists OPTIONS)"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/api/level11.options.php"
string(57) "CLI request (PUT, method does not exists, but exists CLI)"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/index.php"
string(%d) "%s/tests/quick/App/modules/Module_with_files_routing/cli/level11.cli.php"


text:
class UniformNotifier
  class JavascriptConsole < Base
    class << self
      def active?
        !!UniformNotifier.console
      end

      protected

      def _inline_notify(data)
        message = data.values.compact.join("\n")
        options = UniformNotifier.console.is_a?(Hash) ? UniformNotifier.console : {}
        script_attributes = options[:attributes] || {}

        code = <<~CODE
          if (typeof(console) !== 'undefined' && console.log) {
            if (console.groupCollapsed && console.groupEnd) {
              console.groupCollapsed(#{'Uniform Notifier'.inspect});
              console.log(#{message.inspect});
              console.groupEnd();
            } else {
              console.log(#{message.inspect});
            }
          }
        CODE

        wrap_js_association code, script_attributes
      end
    end
  end
end


text:
namespace Fixtures.AcceptanceTestsHeader.Models
{
    using Fixtures.AcceptanceTestsHeader;
    using Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// Defines headers for responseByte operation.
    /// </summary>
    public partial class HeaderResponseByteHeaders
    {
        /// <summary>
        /// Initializes a new instance of the HeaderResponseByteHeaders class.
        /// </summary>
        public HeaderResponseByteHeaders() { }

        /// <summary>
        /// Initializes a new instance of the HeaderResponseByteHeaders class.
        /// </summary>
        /// <param name="value">response with header values
        /// "啊齄丂狛狜隣郎隣兀﨩"</param>
        public HeaderResponseByteHeaders(byte[] value = default(byte[]))
        {
            Value = value;
        }

        /// <summary>
        /// Gets or sets response with header values "啊齄丂狛狜隣郎隣兀﨩"
        /// </summary>
        [JsonProperty(PropertyName = "value")]
        public byte[] Value { get; set; }

    }
}


text:
[![GitHub stable release version](https://img.shields.io/github/release/Revadike/EnhancedBarter.svg?label=Stable&maxAge=600)](https://github.com/Revadike/EnhancedBarter/releases/latest)
[![GitHub stable release date](https://img.shields.io/github/release-date/Revadike/EnhancedBarter.svg?label=Released&maxAge=600)](https://github.com/Revadike/EnhancedBarter/releases/latest)
[![Github stable release downloads](https://img.shields.io/github/downloads/Revadike/EnhancedBarter/latest/total.svg?label=Downloads&maxAge=600)](https://github.com/Revadike/EnhancedBarter/releases/latest)

[![Bitcoin donate](https://img.shields.io/badge/Bitcoin-donate-yellow.svg)](https://www.blockchain.com/btc/payment_request?address=133YTipt9VUuB7EsYnkPFuVGutNc9UzswF)
[![Steam donate](https://img.shields.io/badge/Steam-donate-yellow.svg)](https://steamcommunity.com/tradeoffer/new/?partner=82699538&token=V7DQVtra)

# About
Enhanced Barter aims to enhance your experience at barter.vg.

# Features
 * Comprehensive library sync (DLC support)
 * Automated trading
 * Selection invertion
 * New filter options
 * Many more features!

# Instructions
1. Install [Tampermonkey](https://tampermonkey.net/)
2. Install [Enhanced Barter](https://github.com/Revadike/EnhancedBarter/raw/master/Enhanced%20Barter.user.js)
3. Enjoy!

# Screenshot
![](http://i.imgur.com/ZfaJKpT.png)

# Change Log
 * *Later versions*
      * [Releases](https://github.com/Revadike/EnhancedBarter/releases)

 * *Version 1.0.0*
      * Improved automated offers significantly
      * Improved ajaxify
      * Added selection options in bundle page
      * Added sorting options in match page
      * Added named user groups
      * Added steamtrades rep display
      * Removed deprecated functions
      * Code refactor

 * *Version 0.9.6*
      * Added several additional user preferences checks (incomplete)
      * Added search filter for displayed trade offers
      * Added option to cancel all displayed trade offers
      * Added option to send message to all displayed trade offers
      * Added option to extend expiration of all displayed trade offers
      * Modularized and cleaned code more

 * *Version 0.9.5*
      * Added 1 second delay to every ajax request
      * Add metadata for automated offers

 * *Version 0.9.4*
      * Improved automated offer message
      * Added max trades to automated offer setup
      * Added max want to automated offer setup

 * *Version 0.9.3*
     * Better offer creation system (thanks barter)
     * Now adds a message to each offer

 * *Version 0.9.2*
     * Fixed removeOwnedGamesFromPending()
     * Added button for to remove owned games from pending trade offers

 * *Version 0.9.1*
     * Fixed leaving feedback
     * Added more metadata

 * *Version 0.9.0*
     * Initial commit


text:
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Example - example-example86-production</title>

  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js"></script>
  <script src="script.js"></script>

</head>
<body ng-app="docsTransclusionExample">
    <div ng-controller="Controller">
    <my-dialog>Check out the contents, {{name}}!</my-dialog>
  </div>
</body>
</html>


text:
<?php

namespace League\Geotools\Batch;

use League\Geotools\Cache\CacheInterface;

/**
 * Batch interface
 *
 * @author Antoine Corcy <contact@sbin.dk>
 */
interface BatchInterface
{
    /**
     * Set an array of closures to geocode.
     * If a provider throws an exception it will return an empty ResultInterface.
     *
     * @param string|array $values A value or an array of values to geocode.
     *
     * @return BatchInterface
     *
     * @throws InvalidArgumentException
     */
    public function geocode($values);

    /**
     * Set an array of closures to reverse geocode.
     * If a provider throws an exception it will return an empty ResultInterface.
     *
     * @param CoordinateInterface|array $coordinates A coordinate or an array of coordinates to reverse.
     *
     * @return BatchInterface
     *
     * @throws InvalidArgumentException
     */
    public function reverse($coordinates);

    /**
     * Returns an array of ResultInterface processed in serie.
     *
     * @return ResultInterface[]
     *
     * @throws \Exception
     */
    public function serie();

    /**
     * Returns an array of ResultInterface processed in parallel.
     *
     * @return ResultInterface[]
     *
     * @throws \Exception
     */
    public function parallel();

    /**
     * Set the cache object to use.
     *
     * @param CacheInterface $cache The cache object to use.
     *
     * @return BatchInterface
     */
    public function setCache(CacheInterface $cache);
}


text:
<?php
namespace Neos\Flow\Command;

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Aop\Builder\ProxyClassBuilder as AopProxyClassBuilder;
use Neos\Cache\Backend\FreezableBackendInterface;
use Neos\Flow\Cache\CacheManager;
use Neos\Cache\Frontend\PhpFrontend;
use Neos\Cache\Frontend\VariableFrontend;
use Neos\Flow\Cli\CommandController;
use Neos\Flow\Cli\Dispatcher;
use Neos\Flow\Cli\RequestBuilder;
use Neos\Flow\Core\Bootstrap;
use Neos\Flow\Log\PsrLoggerFactoryInterface;
use Neos\Flow\ObjectManagement\DependencyInjection\ProxyClassBuilder;
use Neos\Flow\ObjectManagement\Proxy\Compiler;
use Neos\Flow\SignalSlot\Dispatcher as SignalSlotDispatcher;
use Neos\Flow\Utility\Environment;
use Neos\Utility\Files;

/**
 * Command controller for core commands
 *
 * NOTE: This command controller will run in compile time (as defined in the package bootstrap)
 *
 * @Flow\Scope("singleton")
 * @Flow\Proxy(false)
 */
class CoreCommandController extends CommandController
{
    /**
     * @var RequestBuilder
     */
    protected $requestBuilder;

    /**
     * @var Dispatcher
     */
    protected $dispatcher;

    /**
     * @var SignalSlotDispatcher
     */
    protected $signalSlotDispatcher;

    /**
     * @var Bootstrap
     */
    protected $bootstrap;

    /**
     * @var CacheManager
     */
    protected $cacheManager;

    /**
     * @var Compiler
     */
    protected $proxyClassCompiler;

    /**
     * @var AopProxyClassBuilder
     */
    protected $aopProxyClassBuilder;

    /**
     * @var ProxyClassBuilder
     */
    protected $dependencyInjectionProxyClassBuilder;

    /**
     * @var Environment
     */
    protected $environment;

    /**
     * @param RequestBuilder $requestBuilder
     * @return void
     */
    public function injectRequestBuilder(RequestBuilder $requestBuilder)
    {
        $this->requestBuilder = $requestBuilder;
    }

    /**
     * @param Dispatcher $dispatcher
     * @return void
     */
    public function injectDispatcher(Dispatcher $dispatcher)
    {
        $this->dispatcher = $dispatcher;
    }

    /**
     * @param SignalSlotDispatcher $signalSlotDispatcher
     * @return void
     */
    public function injectSignalSlotDispatcher(SignalSlotDispatcher $signalSlotDispatcher)
    {
        $this->signalSlotDispatcher = $signalSlotDispatcher;
    }

    /**
     * @param Bootstrap $bootstrap
     * @return void
     */
    public function injectBootstrap(Bootstrap $bootstrap)
    {
        $this->bootstrap = $bootstrap;
    }

    /**
     * @param CacheManager $cacheManager
     * @return void
     */
    public function injectCacheManager(CacheManager $cacheManager)
    {
        $this->cacheManager = $cacheManager;
    }

    /**
     * @param Compiler $proxyClassCompiler
     * @return void
     */
    public function injectProxyClassCompiler(Compiler $proxyClassCompiler)
    {
        $this->proxyClassCompiler = $proxyClassCompiler;
    }

    /**
     * @param AopProxyClassBuilder $aopProxyClassBuilder
     * @return void
     */
    public function injectAopProxyClassBuilder(AopProxyClassBuilder $aopProxyClassBuilder)
    {
        $this->aopProxyClassBuilder = $aopProxyClassBuilder;
    }

    /**
     * @param ProxyClassBuilder $dependencyInjectionProxyClassBuilder
     * @return void
     */
    public function injectDependencyInjectionProxyClassBuilder(ProxyClassBuilder $dependencyInjectionProxyClassBuilder)
    {
        $this->dependencyInjectionProxyClassBuilder = $dependencyInjectionProxyClassBuilder;
    }

    /**
     * @param Environment $environment
     * @return void
     */
    public function injectEnvironment(Environment $environment)
    {
        $this->environment = $environment;
    }

    /**
     * Explicitly compile proxy classes
     *
     * The compile command triggers the proxy class compilation.
     * Although a compilation run is triggered automatically by Flow, there might
     * be cases in a production context where a manual compile run is needed.
     *
     * @Flow\Internal
     * @param boolean $force If set, classes will be compiled even though the cache says that everything is up to date.
     * @return void
     */
    public function compileCommand(bool $force = false)
    {
        /** @var VariableFrontend $objectConfigurationCache */
        $objectConfigurationCache = $this->cacheManager->getCache('Flow_Object_Configuration');
        if ($force === false) {
            if ($objectConfigurationCache->has('allCompiledCodeUpToDate')) {
                return;
            }
        }

        /** @var PhpFrontend $classesCache */
        $classesCache = $this->cacheManager->getCache('Flow_Object_Classes');
        $logger = $this->objectManager->get(PsrLoggerFactoryInterface::class)->get('systemLogger');

        $this->proxyClassCompiler->injectClassesCache($classesCache);

        $this->aopProxyClassBuilder->injectObjectConfigurationCache($objectConfigurationCache);
        $this->aopProxyClassBuilder->injectLogger($logger);
        $this->dependencyInjectionProxyClassBuilder->injectLogger($logger);
        $this->aopProxyClassBuilder->build();
        $this->dependencyInjectionProxyClassBuilder->build();

        $classCount = $this->proxyClassCompiler->compile();

        $dataTemporaryPath = $this->environment->getPathToTemporaryDirectory();
        Files::createDirectoryRecursively($dataTemporaryPath);
        file_put_contents($dataTemporaryPath . 'AvailableProxyClasses.php', $this->proxyClassCompiler->getStoredProxyClassMap());

        $objectConfigurationCache->set('allCompiledCodeUpToDate', true);

        $classesCacheBackend = $classesCache->getBackend();
        if ($this->bootstrap->getContext()->isProduction() && $classesCacheBackend instanceof FreezableBackendInterface) {
            /** @var FreezableBackendInterface $backend */
            $backend = $classesCache->getBackend();
            $backend->freeze();
        }

        $this->emitFinishedCompilationRun($classCount);
    }

    /**
     * Adjust file permissions for CLI and web server access
     *
     * This command adjusts the file permissions of the whole Flow application to
     * the given command line user and webserver user / group.
     *
     * @param string $commandlineUser User name of the command line user, for example "john"
     * @param string $webserverUser User name of the webserver, for example "www-data"
     * @param string $webserverGroup Group name of the webserver, for example "www-data"
     * @return void
     */
    public function setFilePermissionsCommand(string $commandlineUser, string $webserverUser, string $webserverGroup)
    {
        // This command will never be really called. It rather acts as a stub for rendering the
        // documentation for this command. In reality, the "flow" command line script will already
        // check if this command is supposed to be called and invoke the setfilepermissions script
        // directly.
    }

    /**
     * Migrate source files as needed
     *
     * This will apply pending code migrations defined in packages to the
     * specified package.
     *
     * For every migration that has been run, it will create a commit in
     * the package. This allows for easy inspection, rollback and use of
     * the fixed code.
     * If the affected package contains local changes or is not part of
     * a git repository, the migration will be skipped. With the --force
     * flag this behavior can be changed, but changes will only be committed
     * if the working copy was clean before applying the migration.
     *
     * @param string $package The key of the package to migrate
     * @param boolean $status Show the migration status, do not run migrations
     * @param string $packagesPath If set, use the given path as base when looking for packages
     * @param string $version If set, execute only the migration with the given version (e.g. "20150119114100")
     * @param boolean $verbose If set, notes and skipped migrations will be rendered
     * @param boolean $force By default packages that are not under version control or contain local changes are skipped. With this flag set changes are applied anyways (changes are not committed if there are local changes though)
     * @return void
     * @see neos.flow:doctrine:migrate
     */
    public function migrateCommand(string $package, bool $status = false, string $packagesPath = null, string $version = null, bool $verbose = false, bool $force = false)
    {
        // This command will never be really called. It rather acts as a stub for rendering the
        // documentation for this command. In reality, the "flow" command line script will already
        // check if this command is supposed to be called and invoke the migrate script
        // directly.
    }

    /**
     * Signals that the compile command was successfully finished.
     *
     * @param integer $classCount Number of compiled proxy classes
     * @return void
     * @Flow\Signal
     */
    protected function emitFinishedCompilationRun(int $classCount)
    {
        $this->signalSlotDispatcher->dispatch(__CLASS__, 'finishedCompilationRun', [$classCount]);
    }
}


text:
#include <QWidget>
#include "module_scanningsonar.h"
#include <QGraphicsScene>
#include <log4qt/logger.h>

namespace Ui {
    class ScanningSonarForm;
}

class ScanningSonarForm : public QWidget {
    Q_OBJECT
public:
    ScanningSonarForm(Module_ScanningSonar* sonar, QWidget *parent = 0);
    ~ScanningSonarForm();

protected:
    void changeEvent(QEvent *e);

private:
    Log4Qt::Logger *logger;

    Ui::ScanningSonarForm *ui;
    Module_ScanningSonar* sonar;
    QGraphicsScene scene;
    QQueue<QGraphicsPolygonItem*> queue;
    QGraphicsItem* scanLine;
    float oldHeading;
    int oldStepSize;

private slots:
    void on_selFile_clicked();
    void on_fileReaderDelay_valueChanged(int );
    void on_fileCfgApply_clicked();
    void on_save_clicked();
    void updateSonarView(const SonarReturnData data);
};

#endif // SCANNINGSONARFORM_H


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/privacy/dlp/v2/storage.proto

package com.google.privacy.dlp.v2;

public interface CustomInfoTypeOrBuilder extends
    // @@protoc_insertion_point(interface_extends:google.privacy.dlp.v2.CustomInfoType)
    com.google.protobuf.MessageOrBuilder {

  /**
   *

   * Info type configuration. All custom info types must have configurations
   * that do not conflict with built-in info types or other custom info types.
   *

   *
   * .google.privacy.dlp.v2.InfoType info_type = 1;
   */
  boolean hasInfoType();
  /**
   *

   * Info type configuration. All custom info types must have configurations
   * that do not conflict with built-in info types or other custom info types.
   *

   *
   * .google.privacy.dlp.v2.InfoType info_type = 1;
   */
  com.google.privacy.dlp.v2.InfoType getInfoType();
  /**
   *

   * Info type configuration. All custom info types must have configurations
   * that do not conflict with built-in info types or other custom info types.
   *

   *
   * .google.privacy.dlp.v2.InfoType info_type = 1;
   */
  com.google.privacy.dlp.v2.InfoTypeOrBuilder getInfoTypeOrBuilder();

  /**
   *

   * Likelihood to return for this custom info type. This base value can be
   * altered by a detection rule if the finding meets the criteria specified by
   * the rule. Defaults to `VERY_LIKELY` if not specified.
   *

   *
   * .google.privacy.dlp.v2.Likelihood likelihood = 6;
   */
  int getLikelihoodValue();
  /**
   *

   * Likelihood to return for this custom info type. This base value can be
   * altered by a detection rule if the finding meets the criteria specified by
   * the rule. Defaults to `VERY_LIKELY` if not specified.
   *

   *
   * .google.privacy.dlp.v2.Likelihood likelihood = 6;
   */
  com.google.privacy.dlp.v2.Likelihood getLikelihood();

  /**
   *

   * Dictionary-based custom info type.
   *

   *
   * .google.privacy.dlp.v2.CustomInfoType.Dictionary dictionary = 2;
   */
  boolean hasDictionary();
  /**
   *

   * Dictionary-based custom info type.
   *

   *
   * .google.privacy.dlp.v2.CustomInfoType.Dictionary dictionary = 2;
   */
  com.google.privacy.dlp.v2.CustomInfoType.Dictionary getDictionary();
  /**
   *

   * Dictionary-based custom info type.
   *

   *
   * .google.privacy.dlp.v2.CustomInfoType.Dictionary dictionary = 2;
   */
  com.google.privacy.dlp.v2.CustomInfoType.DictionaryOrBuilder getDictionaryOrBuilder();

  /**
   *

   * Regex-based custom info type.
   *

   *
   * .google.privacy.dlp.v2.CustomInfoType.Regex regex = 3;
   */
  boolean hasRegex();
  /**
   *

   * Regex-based custom info type.
   *

   *
   * .google.privacy.dlp.v2.CustomInfoType.Regex regex = 3;
   */
  com.google.privacy.dlp.v2.CustomInfoType.Regex getRegex();
  /**
   *

   * Regex-based custom info type.
   *

   *
   * .google.privacy.dlp.v2.CustomInfoType.Regex regex = 3;
   */
  com.google.privacy.dlp.v2.CustomInfoType.RegexOrBuilder getRegexOrBuilder();

  /**
   *

   * Surrogate info type.
   *

   *
   * .google.privacy.dlp.v2.CustomInfoType.SurrogateType surrogate_type = 4;
   */
  boolean hasSurrogateType();
  /**
   *

   * Surrogate info type.
   *

   *
   * .google.privacy.dlp.v2.CustomInfoType.SurrogateType surrogate_type = 4;
   */
  com.google.privacy.dlp.v2.CustomInfoType.SurrogateType getSurrogateType();
  /**
   *

   * Surrogate info type.
   *

   *
   * .google.privacy.dlp.v2.CustomInfoType.SurrogateType surrogate_type = 4;
   */
  com.google.privacy.dlp.v2.CustomInfoType.SurrogateTypeOrBuilder getSurrogateTypeOrBuilder();

  /**
   *

   * Set of detection rules to apply to all findings of this custom info type.
   * Rules are applied in order that they are specified. Not supported for the
   * `surrogate_type` custom info type.
   *

   *
   * repeated .google.privacy.dlp.v2.CustomInfoType.DetectionRule detection_rules = 7;
   */
  java.util.List<com.google.privacy.dlp.v2.CustomInfoType.DetectionRule>
      getDetectionRulesList();
  /**
   *

   * Set of detection rules to apply to all findings of this custom info type.
   * Rules are applied in order that they are specified. Not supported for the
   * `surrogate_type` custom info type.
   *

   *
   * repeated .google.privacy.dlp.v2.CustomInfoType.DetectionRule detection_rules = 7;
   */
  com.google.privacy.dlp.v2.CustomInfoType.DetectionRule getDetectionRules(int index);
  /**
   *

   * Set of detection rules to apply to all findings of this custom info type.
   * Rules are applied in order that they are specified. Not supported for the
   * `surrogate_type` custom info type.
   *

   *
   * repeated .google.privacy.dlp.v2.CustomInfoType.DetectionRule detection_rules = 7;
   */
  int getDetectionRulesCount();
  /**
   *

   * Set of detection rules to apply to all findings of this custom info type.
   * Rules are applied in order that they are specified. Not supported for the
   * `surrogate_type` custom info type.
   *

   *
   * repeated .google.privacy.dlp.v2.CustomInfoType.DetectionRule detection_rules = 7;
   */
  java.util.List<? extends com.google.privacy.dlp.v2.CustomInfoType.DetectionRuleOrBuilder>
      getDetectionRulesOrBuilderList();
  /**
   *

   * Set of detection rules to apply to all findings of this custom info type.
   * Rules are applied in order that they are specified. Not supported for the
   * `surrogate_type` custom info type.
   *

   *
   * repeated .google.privacy.dlp.v2.CustomInfoType.DetectionRule detection_rules = 7;
   */
  com.google.privacy.dlp.v2.CustomInfoType.DetectionRuleOrBuilder getDetectionRulesOrBuilder(
      int index);

  public com.google.privacy.dlp.v2.CustomInfoType.TypeCase getTypeCase();
}


text:
@startDocuBlock batch_processing
@brief executes a batch request

@RESTHEADER{POST /_api/batch,executes a batch request, RestBatchHandler}

@RESTALLBODYPARAM{body,string,required}
The multipart batch request, consisting of the envelope and the individual
batch parts.

@RESTDESCRIPTION
Executes a batch request. A batch request can contain any number of
other requests that can be sent to ArangoDB in isolation. The benefit of
using batch requests is that batching requests requires less client/server
roundtrips than when sending isolated requests.

All parts of a batch request are executed serially on the server. The
server will return the results of all parts in a single response when all
parts are finished.

Technically, a batch request is a multipart HTTP request, with
content-type `multipart/form-data`. A batch request consists of an
envelope and the individual batch part actions. Batch part actions
are "regular" HTTP requests, including full header and an optional body.
Multiple batch parts are separated by a boundary identifier. The
boundary identifier is declared in the batch envelope. The MIME content-type
for each individual batch part must be `application/x-arango-batchpart`.

Please note that when constructing the individual batch parts, you must
use CRLF (`\r\n`) as the line terminator as in regular HTTP messages.

The response sent by the server will be an `HTTP 200` response, with an
optional error summary header `x-arango-errors`. This header contains the
number of batch part operations that failed with an HTTP error code of at
least 400. This header is only present in the response if the number of
errors is greater than zero.

The response sent by the server is a multipart response, too. It contains
the individual HTTP responses for all batch parts, including the full HTTP
result header (with status code and other potential headers) and an
optional result body. The individual batch parts in the result are
seperated using the same boundary value as specified in the request.

The order of batch parts in the response will be the same as in the
original client request. Client can additionally use the `Content-Id`
MIME header in a batch part to define an individual id for each batch part.
The server will return this id is the batch part responses, too.

@RESTRETURNCODES

@RESTRETURNCODE{200}
is returned if the batch was received successfully. HTTP 200 is returned
even if one or multiple batch part actions failed.

@RESTRETURNCODE{400}
is returned if the batch envelope is malformed or incorrectly formatted.
This code will also be returned if the content-type of the overall batch
request or the individual MIME parts is not as expected.

@RESTRETURNCODE{405}
is returned when an invalid HTTP method is used.

@EXAMPLES

Sending a batch request with five batch parts:

- GET /_api/version

- DELETE /_api/collection/products

- POST /_api/collection/products

- GET /_api/collection/products/figures

- DELETE /_api/collection/products

The boundary (`SomeBoundaryValue`) is passed to the server in the HTTP
`Content-Type` HTTP header.
*Please note the reply is not displayed all accurate.*

@EXAMPLE_ARANGOSH_RUN{RestBatchMultipartHeader}
    var parts = [
      "Content-Type: application/x-arango-batchpart\r\n" +
      "Content-Id: myId1\r\n\r\n" +
      "GET /_api/version HTTP/1.1\r\n",

      "Content-Type: application/x-arango-batchpart\r\n" +
      "Content-Id: myId2\r\n\r\n" +
      "DELETE /_api/collection/products HTTP/1.1\r\n",

      "Content-Type: application/x-arango-batchpart\r\n" +
      "Content-Id: someId\r\n\r\n" +
      "POST /_api/collection/products HTTP/1.1\r\n\r\n" +
      "{\"name\": \"products\" }\r\n",

      "Content-Type: application/x-arango-batchpart\r\n" +
      "Content-Id: nextId\r\n\r\n" +
      "GET /_api/collection/products/figures HTTP/1.1\r\n",

      "Content-Type: application/x-arango-batchpart\r\n" +
      "Content-Id: otherId\r\n\r\n" +
      "DELETE /_api/collection/products HTTP/1.1\r\n"
    ];
    var boundary = "SomeBoundaryValue";
    var headers = { "Content-Type" : "multipart/form-data; boundary=" +
    boundary };
    var body = "--" + boundary + "\r\n" +
               parts.join("\r\n" + "--" + boundary + "\r\n") +
               "--" + boundary + "--\r\n";

    var response = logCurlRequestPlain('POST', '/_api/batch', body, headers);

    assert(response.code === 200);

    logPlainResponse(response);
@END_EXAMPLE_ARANGOSH_RUN

Sending a batch request, setting the boundary implicitly (the server will
in this case try to find the boundary at the beginning of the request body).

@EXAMPLE_ARANGOSH_RUN{RestBatchImplicitBoundary}
    var parts = [
      "Content-Type: application/x-arango-batchpart\r\n\r\n" +
         "DELETE /_api/collection/notexisting1 HTTP/1.1\r\n",
      "Content-Type: application/x-arango-batchpart\r\n\r\n" +
         "DELETE _api/collection/notexisting2 HTTP/1.1\r\n"
    ];
    var boundary = "SomeBoundaryValue";
    var body = "--" + boundary + "\r\n" +
               parts.join("\r\n" + "--" + boundary + "\r\n") +
               "--" + boundary + "--\r\n";

    var response = logCurlRequestPlain('POST', '/_api/batch', body);

    assert(response.code === 200);
    assert(response.headers['x-arango-errors'] == 2);

    logPlainResponse(response);
@END_EXAMPLE_ARANGOSH_RUN
@endDocuBlock


text:
import pomp.protocol as protocol
from pomp.buffer import Buffer
from pomp.encoder import Encoder
from pomp.decoder import Decoder

#===============================================================================
#===============================================================================
class Message(object):
    def __init__(self):
        self.msgid = 0          # Id of message
        self.finished = False   # Header is filled
        self.buf = None         # Buffer with data

    def init(self, msgid):
        self.msgid = msgid
        self.finished = False
        self.buf = Buffer()

    def finish(self):
        # Make sure position is at least after header
        if self.buf.getPos() < protocol.HEADER_SIZE:
            self.buf.skip(protocol.HEADER_SIZE - self.buf.getPos())

        # Write header
        self.buf.rewind()
        self.buf.writeInt(protocol.POMP_MAGIC)
        self.buf.writeInt(self.msgid)
        self.buf.writeInt(len(self.buf))

        # Make message read-only
        self.finished = True
        self.buf.setReadOnly(True)

    def setFinished(self):
        self.finished = True
        self.buf.setReadOnly(True)

    def clear(self):
        self.msgid = 0
        self.finished = False
        self.buf = None

    def write(self, msgid, fmt, *args):
        self.init(msgid)
        enc = Encoder()
        enc.init(self)
        enc.write(fmt, *args)
        enc.clear()
        self.finish()

    def read(self, fmt):
        dec = Decoder()
        dec.init(self)
        res = dec.read(fmt)
        dec.clear()
        return res

    def dump(self):
        dec = Decoder()
        dec.init(self)
        res = dec.dump()
        dec.clear()
        return res


text:
<?php
/*%%SmartyHeaderCode:187542215457ce4b191fc234_36471647%%*/
if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' =>
  array (
    '01c3c230a0c34d4a87b0454450c9687a53fba9b6' =>
    array (
      0 => '/var/www/html/myProject/StudentManagement/application/views/templates/addStudentList.tpl',
      1 => 1447223387,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '187542215457ce4b191fc234_36471647',
  'tpl_function' =>
  array (
  ),
  'variables' =>
  array (
    'appPath' => 0,
    'basePath' => 0,
    'department' => 0,
    'i' => 0,
    'year' => 0,
  ),
  'has_nocache_code' => false,
  'version' => '3.1.27',
  'unifunc' => 'content_57ce4b19242123_85379296',
  'cache_lifetime' => 120,
),true);
/*/%%SmartyHeaderCode%%*/
if ($_valid && !is_callable('content_57ce4b19242123_85379296')) {
function content_57ce4b19242123_85379296 ($_smarty_tpl) {
?>

		<input type="hidden" id="appPath" value="localhost/myProject/StudentManagement/application">
		<input type="hidden" id="basePath" value="/var/www/html/myProject/StudentManagement/application">

 Upload Student Profile

						 Add Department

		 							Choose Excel File
									<input type="file" class="uploadMarklist" id="uploadStudentList" name="uploadStudentList">

			   				Department

					            <select class="cs-select cs-skin-elastic" id="studentDepartment">
						            <option value="" disabled selected>Select Department</option>
						            							               		 <option value="1">CSE</option>
						               							        </select>

					        Year

					            <select class="cs-select cs-skin-elastic" id="studentYear">
					               <option value="" disabled selected>Select Year</option>
					               						               		 <option value="1">First Year</option>
					               						               		 <option value="2">Second Year</option>
					               						               		 <option value="3">Third Year</option>
					               						               		 <option value="4">Final Year</option>
					               						            </select>

				            Semester

					            <select class="cs-select cs-skin-elastic" id="studentYear">
					               <option value="" disabled selected>Select Semester</option>
					               						               		 <option value="1">First Year</option>
					               						               		 <option value="2">Second Year</option>
					               						               		 <option value="3">Third Year</option>
					               						               		 <option value="4">Final Year</option>
					               						            </select>

					            <button class="btn btn-primary" style="margin-left:10px" onclick="uploadStudentProfile()"> Upload</button>

        <button type="button" class="close" data-dismiss="modal">×</button>

Add Department

	      		Enter Deparment

	      		<input type="text" class="form-control" id="department_name" style="margin-left: -40px;
">

			     <button class="btn btn-Danger" class="close" data-dismiss="modal"> Close </button>
		 		<button class="btn btn-success pull-right" onclick="addDepartment()"> Save </button>

<?php }
}
?>